This patch should be applied to an un-modified XFree86 version 4.1.0 source tree. It is the fourth of four patches that will will convert the source tree to XFree86 version 4.2.0. To apply this patch, run the following from the directory containing your 'xc' directory: patch -p0 -E < 4.1.0-4.2.0.diff1 patch -p0 -E < 4.1.0-4.2.0.diff2 patch -p0 -E < 4.1.0-4.2.0.diff3 patch -p0 -E < 4.1.0-4.2.0.diff4 rm -f xc/extras/freetype2/builds/mac/ftlib.prj rm -fr xc/extras/freetype2/docs/design rm -fr xc/extras/freetype2/docs/glyphs rm -fr xc/extras/freetype2/docs/image rm -fr xc/extras/freetype2/docs/tutorial rm -f xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib gzip -d < 4.2.0.tgz | tar vxf - ------------------------------------------------------------------------------- Index: xc/programs/Xserver/hw/xfree86/Imakefile diff -u xc/programs/Xserver/hw/xfree86/Imakefile:3.76 xc/programs/Xserver/hw/xfree86/Imakefile:3.79 --- xc/programs/Xserver/hw/xfree86/Imakefile:3.76 Tue May 15 14:22:20 2001 +++ xc/programs/Xserver/hw/xfree86/Imakefile Mon Oct 29 11:51:55 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.76 2001/05/15 18:22:20 paulo Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.79 2001/10/29 16:51:55 tsi Exp $ #include #define IHaveSubdirs @@ -67,10 +67,6 @@ INT10DIR = int10 #endif -#if BuildSuperProbe -SUPERPROBE = SuperProbe -#endif - #if BuildXF86Setup XF86SETUPDIR = XF86Setup #endif @@ -96,7 +92,7 @@ drivers $(LOADERDIR) $(VGAHWDIR) $(FBDEVHWDIR) $(RAMDACDIR) \ $(RACDIR) $(I2CDIR) $(DDCDIR) $(INPUTDIR) $(INT10DIR) parser \ scanpci doc dummylib $(XF86CFGDIRS) $(XF86SETUPDIR) etc \ - $(SUPERPROBE) $(DRIVERSDK) $(XF8_32WIDDIR) + $(DRIVERSDK) $(XF8_32WIDDIR) #if !defined(OS2Architecture) && !defined(cygwinArchitecture) XF86CONFIG = XF86Config @@ -149,19 +145,6 @@ LINUXMOUSEDEV="XCOMM Option \"Device\" \"/dev/mouse\"" #endif -#ifdef MinixArchitecture -CppFileTarget($(XF86CONFIG), XF86Conf.cpp, - -DRGBPATH=$(RGBPATH) -DMISCFONTPATH=$(MISCFONTPATH) - -DLOCALFONTPATH=$(LOCALFONTPATH) - -DT1FONTPATH=$(T1FONTPATH) -DCIDFONTPATH=$(CIDFONTPATH) - -DSPFONTPATH=$(SPFONTPATH) - -DDPI75FONTPATH=$(DPI75FONTPATH) -DDPI100FONTPATH=$(DPI100FONTPATH) - -DDPI75USFONTPATH=$(DPI75USFONTPATH) -DDPI100USFONTPATH=$(DPI100USFONTPATH) - -DMANPAGE=$(MANPAGE) -DMODULEPATH=\"$(MODULEDIR)\", - $(ICONFIGFILES)) - -InstallDriverSDKNonExecFile($(XF86CONFIG),$(DRIVERSDKDIR)) -#else CppFileTarget($(XF86CONFIG), XF86Conf.cpp, \ -DRGBPATH=$(RGBPATH) -DMISCFONTPATH=$(MISCFONTPATH) \ -DLOCALFONTPATH=$(LOCALFONTPATH) \ @@ -192,7 +175,6 @@ $(ICONFIGFILES)) InstallDriverSDKNonExecFile($(XF86CONFIG),$(DRIVERSDKDIR)) InstallDriverSDKNonExecFile($(XF98CONFIG),$(DRIVERSDKDIR)) -#endif EXTRAMANDEFS=-D__logdir__=$(LOGDIRECTORY) InstallManPage(XFree86,$(MANDIR)) Index: xc/programs/Xserver/hw/xfree86/Options diff -u xc/programs/Xserver/hw/xfree86/Options:1.1.2.2 xc/programs/Xserver/hw/xfree86/Options:1.8 --- xc/programs/Xserver/hw/xfree86/Options:1.1.2.2 Thu May 31 22:24:16 2001 +++ xc/programs/Xserver/hw/xfree86/Options Mon Dec 17 15:52:29 2001 @@ -24,7 +24,7 @@ !! 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 $ +!! $XFree86: xc/programs/Xserver/hw/xfree86/Options,v 1.8 2001/12/17 20:52:29 dawes Exp $ !! XAA options xaa.XaaNoCPUToScreenColorExpandFill:\ @@ -64,12 +64,12 @@ stored in system memory (one scan line at a time). xaa.XaaNoScanlineImageWriteRect:\ -Disables acclerated transfers of full-color rectangular patterns from \ +Disables accelerated 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. +stored in off-screen video memory. xaa.XaaNoScreenToScreenCopy:\ Disables accelerated copies of rectangular regions from one part of video \ @@ -91,6 +91,21 @@ Disables accelerated solid line draws between two arbitrary points. +!! DDC Options +ddc.NoDDC:\ +Disables DDC (Display Data Channel) so that the Xserver doesn't try to talk to\ +the Monitor. \ +Default: off, implies DDC is used. + +ddc.NoDDC1:\ +Disables use of DDC version 1 (DDC using vertical refresh). \ +Default: off, implies DDC1 is used. + +ddc.NoDDC2:\ +Disables use of DDC version 2 (DDC using I2C - usually over vga connector). \ +Default: off, implies DDC2 is used. + + !! FBDev options fbdev.fbdev:\ The framebuffer device to use. \ @@ -100,6 +115,12 @@ Enable or disable use of the shadow framebuffer layer. \ Default: on. +fbdev.Rotate:\ +Enable rotation of the display. The supported values are "CW" (clockwise, \ +90 degrees), "UD" (upside down, 180 degrees) and "CCW" (counter clockwise, \ +270 degrees). Implies use of the shadow framebuffer layer. \ +Default: off. + !! MGA options mga.ColorKey:\ @@ -107,8 +128,8 @@ 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.HWcursor:\ +!Enable or disable the HW cursor. Default: on. mga.MGASDRAM:\ Specify whether G100, G200 or G400 cards have SDRAM. The driver attempts to \ @@ -116,10 +137,10 @@ 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. +configurations. Default: auto-detected. mga.NoAccel:\ -Disable or enable acceleration. Default: acceleration is enabled. +Disable or enable 2D hardware acceleration. Default: acceleration is enabled. mga.OverclockMem:\ Set clocks to values used by some commercial X-Servers (G100, G200 and \ @@ -138,8 +159,7 @@ Default: no rotation. mga.ShadowFB:\ -Enable or disable use of the shadow framebuffer layer. See shadowfb(4) for \ -further information. Default: off. +Enable or disable use of the shadow framebuffer layer. Default: off. \ mga.SyncOnGreen:\ Enable or disable combining the sync signals with the green signal. \ @@ -158,12 +178,58 @@ overlay. This option is only supported by the G200 and G400, and only in \ 16 and 32 bits per pixel. Default: off. +mga.NoHal:\ +Matrox provides a "Hardware Abstraction Layer", \ +a separate binary which enables extra hardware features from G400 onwards. \ +Default: HAL is used. + +!mga.DigitalScreen:\ +! Option Ignored. Drivers auto-detect Digital output if they support it at all. +!Default: Auto-detected. + +! mga.TV:\ +! Option Ignored. Drivers auto-detect TV if they support TV out at all. +!Default: Auto-detected. + +mga.TVStandard:\ +(HAL only) Picture standard for TV out. Use "PAL" for 50Hz PAL. \ +Default: 60Hz NTSC. + +mga.CableType:\ +(HAL only) Set the cable type for TV out. Options are "SCART_RGB", \ +"SCART_COMPOSITE", or "SCART_TYPE2". Any other string enables the default. \ +Default: YC_COMPOSITE. + +mga.SwappedHead:\ +(HAL only) For Dual Head cards, reverse relationship between CRTC picture \ +generators and video output sockets. \ +Especially useful with TV or digital outputs. \ +Default: CRTC1 generates output for socket 1 and CRTC2 generates output for socket 2. + +mga.Crtc2Half:\ +In dual head mode, allow CRTC2 to use half of the video memory. \ +Default: CRTC2 uses min{8MB, half video RAM}, but see also Crtc2Ram. + +mga.Crtc2Ram:\ +In dual head mode, CRTC2 will use this many KB of video memory. \ +Overrrides Crtc2Half. \ +Default: CRTC2 uses min{8MB, half video RAM}, but see also Crtc2Half. + +mga.ShowCache:\ +An option for hackers. The pixmap cache lives in off-screen video memory. \ +This option extends the virtual desktop to show this part of video memory. \ +Default: Off. + +mga.AGPMode:\ +AGP bus speed multiplier, used by DRI. \ +Default: x1 (slowest but most stable). + !! R128 options -r128.SWcursor: \ -Selects software cursor. \ -Default: off. +!r128.SWcursor: \ +!Selects software cursor. \ +!Default: off. r128.NoAccel:\ Enables or disables all hardware acceleration. \ @@ -200,9 +266,73 @@ 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. +!! NeoMagic options + +neo.StrangeLockups:\ +Before XFree86 version 4.2.0 many NeoMagic systems experienced \ +strange lockups unless they used the options \ +"XaaNoScanlineImageWriteRect" and "XaaNoScanlineCPUToScreenColorExpandFill". \ +Setting this to "No" is faster but will lock some machines. \ +Default: Yes. !! Vesa options vesa.ShadowFB:\ Enable or disable use of the shadow framebuffer layer. See shadowfb(4)\ for further information. Default: on. + +!! SiS Options +sis.NoAccel:\ +Disable or enable acceleration. \ +Default: acceleration is enabled. + +!sis.HWcursor:\ +!Enable or disable the HW cursor. \ +!Default: on. + +!sis.SWcursor:\ +!The opposite of HWCursor. \ +!Default: on. + +sis.NoXVideo:\ +Disable XV (XVideo) extension support. \ +Default: off. + +sis.SetMClk:\ +Set the memory clock in MHz. \ +Default: autodetect. + +sis.PciRetry:\ +Enable or disable PCI retries. \ +Default: on. + +sis.TurboQueue:\ +Enable or disable TurboQueue mode. \ +Default: off for SIS530, on for the others. + +sis.FastVram:\ +Enable or disable FastVram mode. \ +Default: on. + +sis.Rotate:\ +Rotate the display clockwise (CW) or counterclockwise (CCW). \ +This mode is unaccelerated, and uses the Shadow Frame Buffer layer \ +Default: no rotation. + +sis.ForceCRT2Type:\ +Force display type to one of: TV, LCD or VGA. \ +Default: autodetect. + +sis.ShadowFB:\ +Enable or disable use of the shadow framebuffer layer. See shadowfb(4) for \ +further information. Default: off. + +!! Generic driver options, apply to many drivers + +*.SWcursor:\ +See also HWcursor.\ +Default: Usually Off. + +*.HWcursor:\ +Use the hardware cursor. See also SWcursor. \ +Default: usually HWcursor, but some drivers may default to software. Index: xc/programs/Xserver/hw/xfree86/XF86Conf.cpp diff -u xc/programs/Xserver/hw/xfree86/XF86Conf.cpp:3.43 xc/programs/Xserver/hw/xfree86/XF86Conf.cpp:3.44 --- xc/programs/Xserver/hw/xfree86/XF86Conf.cpp:3.43 Fri Dec 3 14:17:20 1999 +++ xc/programs/Xserver/hw/xfree86/XF86Conf.cpp Mon Dec 17 15:52:29 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Conf.cpp,v 3.43 1999/12/03 19:17:20 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Conf.cpp,v 3.44 2001/12/17 20:52:29 dawes Exp $ XCOMM XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc. XCOMM @@ -400,7 +400,7 @@ XCOMM EndMode XCOMM If a monitor has DPMS support, that can be indicated here. This will -XCOMM enable DPMS when the montor is used with drivers that support it. +XCOMM enable DPMS when the monitor is used with drivers that support it. XCOMM Option "dpms" Index: xc/programs/Xserver/hw/xfree86/XF86Config.man diff -u xc/programs/Xserver/hw/xfree86/XF86Config.man:1.5 xc/programs/Xserver/hw/xfree86/XF86Config.man:1.6 --- xc/programs/Xserver/hw/xfree86/XF86Config.man:1.5 Tue May 8 17:53:08 2001 +++ xc/programs/Xserver/hw/xfree86/XF86Config.man Wed Aug 15 12:25:21 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.5 2001/05/08 21:53:08 paulo Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.6 2001/08/15 16:25:21 paulo Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH XF86Config __filemansuffix__ __vendorversion__ @@ -519,6 +519,28 @@ .TP 7 .BI "Option \*qXinerama\*q \*q" boolean \*q enable or disable XINERAMA extension. Default is disabled. +.TP 7 +.BI "Option \*qAllowDeactivateGrabs\*q \*q" boolean \*q +This option enables the use of the +.B Ctrl+Alt+Keypad-Divide +key sequence to desactivate any active keyboard and mouse grabs. +Default: off. +.TP 7 +.BI "Option \*qAllowClosedownGrabs\*q \*q" boolean \*q +This option enables the use of the +.B Ctrl+Alt+Keypad-Multiply +key sequence to kill clients with an active keyboard or mouse grab as well +as killing any application that may have locked the server, +normally using the XGrabServer(3) Xlib function. +Default: off. +.br +Note that the options +.BI AllowDeactivateGrabs +and +.BI AllowClosedownGrabs +will allow users to remove the grab used by screen saver/locker programs. +An API was written to such cases. If you enable this option, make sure your +screen saver/locker is updated. .SH MODULE SECTION The .B Module Index: xc/programs/Xserver/hw/xfree86/XF98Conf.cpp diff -u xc/programs/Xserver/hw/xfree86/XF98Conf.cpp:1.2 xc/programs/Xserver/hw/xfree86/XF98Conf.cpp:1.3 --- xc/programs/Xserver/hw/xfree86/XF98Conf.cpp:1.2 Mon Jun 12 22:28:30 2000 +++ xc/programs/Xserver/hw/xfree86/XF98Conf.cpp Mon Dec 17 15:52:30 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF98Conf.cpp,v 1.2 2000/06/13 02:28:30 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF98Conf.cpp,v 1.3 2001/12/17 20:52:30 dawes Exp $ XCOMM XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc. XCOMM @@ -381,7 +381,7 @@ XCOMM EndMode XCOMM If a monitor has DPMS support, that can be indicated here. This will -XCOMM enable DPMS when the montor is used with drivers that support it. +XCOMM enable DPMS when the monitor is used with drivers that support it. XCOMM Option "dpms" Index: xc/programs/Xserver/hw/xfree86/XFree86.man diff -u xc/programs/Xserver/hw/xfree86/XFree86.man:3.52 xc/programs/Xserver/hw/xfree86/XFree86.man:3.54 --- xc/programs/Xserver/hw/xfree86/XFree86.man:3.52 Thu Apr 5 15:29:41 2001 +++ xc/programs/Xserver/hw/xfree86/XFree86.man Thu Jan 17 12:10:37 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.52 2001/04/05 19:29:41 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.54 2002/01/17 17:10:37 dawes Exp $ .TH XFree86 1 __vendorversion__ .SH NAME XFree86 - X11R6 X server @@ -202,14 +202,13 @@ .B InputDevice section called .I keyboard-name -as the core keyboard. -By default the core keyboard input device referenced by the default +as the core keyboard. This option is ignored when the .B Layout -section are used, or the first relevant +section specifies a core keyboard. +In the absence of both a Layout section and this option, +the first relevant .B InputDevice -section when there are no -.B Layout -sections. +section is used for the core keyboard. .TP 8 .B \-layout \fIlayout-name\fP Use the XF86Config(__filemansuffix__) file @@ -273,14 +272,13 @@ .B InputDevice section called .I pointer-name -as the core pointer. -By default the core pointer input device referenced by the default +as the core pointer. This option is ignored when the .B Layout -section are used, or the first relevant +section specifies a core pointer. +In the absence of both a Layout section and this option, +the first relevant .B InputDevice -section when there are no -.B Layout -sections. +section is used for the core pointer. .TP 8 .B \-probeonly Causes the server to exit after the device probing stage. The XF86Config @@ -337,7 +335,7 @@ verbosity level. When the .I n value is supplied, the verbosity level is set to that value. The default -verbosity level is 1. +verbosity level is 0. .TP 8 .B \-version Print out the server version, patchlevel, release date, the operating Index: xc/programs/Xserver/hw/xfree86/xf86Version.h diff -u xc/programs/Xserver/hw/xfree86/xf86Version.h:3.472.2.5 xc/programs/Xserver/hw/xfree86/xf86Version.h:3.487 --- xc/programs/Xserver/hw/xfree86/xf86Version.h:3.472.2.5 Sat Jun 2 11:27:52 2001 +++ xc/programs/Xserver/hw/xfree86/xf86Version.h Fri Jan 18 15:09:24 2002 @@ -1,9 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.472.2.5 2001/06/02 15:27:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.487 2002/01/18 20:09:24 dawes Exp $ */ #ifndef XF86_VERSION_CURRENT #define XF86_VERSION_MAJOR 4 -#define XF86_VERSION_MINOR 1 +#define XF86_VERSION_MINOR 2 #define XF86_VERSION_PATCH 0 #define XF86_VERSION_SNAP 0 @@ -24,7 +24,7 @@ 0) -#define XF86_DATE "2 June 2001" +#define XF86_DATE "18 January 2002" #endif Index: xc/programs/Xserver/hw/xfree86/SuperProbe/00README diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/00README:3.6 xc/programs/Xserver/hw/xfree86/SuperProbe/00README:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/00README:3.6 Sat Jan 6 15:58:02 2001 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/00README Fri Jan 18 15:24:52 2002 @@ -1,85 +0,0 @@ - README file for SuperProbe - -------------------------- - Version 2.1 - - David E Wexelblat - dwex@xfree86.org - -What is it? ------------ -SuperProbe is a program for Intel-based Unix machines. It is used to -determine the type of video hardware installed in the machine, including, -where it can be determined, which specific chipset, what type of -RAMDAC is attached, and how much video memory resides on the board. -The current version supports EISA/ISA/VLB machines running SVR3, -SVR4, Linux, *BSD*, Minix-386, and Mach (MicroChannel and PCI machines -are believed to work as well, although the BIOS checking may need to -be disabled via the '-no_bios' option). Adding support for other -operating systems should be fairly trivial, as the OS dependencies are -isolated to a single file for each OS. - -Building --------- -Both an Imakefile and a standard Makefile are provided. If you are using -imake, you should be able to simply do: - - xmkmf -a - make - make install - make install.man - -If you are using the standard Makefile, edit the Makefile.std file to set -up the OS dependencies; then do: - - make -f Makefile.std - make install - -The program will need to be installed setuid-root on all of the currently -supported OSs. - -Running -------- -See the SuperProbe.1 manual page. - -Reporting Problems ------------------- -Please report any problems to the author, David E Wexeblat, - -Credits -------- -Finn Thoegersen - For providing the vgadoc2.zip and vgadoc3.zip video hardware - documentation packages and sample code, and for allowing me - to port his code to the Unix environment. - -David Dawes - For lots of help on the initial design, and writing the 386BSD OS - support module. - -Orest Zborowski - For writing the Linux OS support module. - -Philip Homburg - For writing the Minix-386 OS support module. - -Robert Baron - For writing the Mach OS support module. - -Tiago Gons -Kevin Martin - 8514/A, ATI Mach8 and ATI Mach32 probe code. - -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.6 2001/01/06 20:58:02 tsi Exp $ - - - - - -$XConsortium: 00README /main/7 1996/02/21 17:08:47 kaleb $ Index: xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights:3.5 Sat Mar 13 22:21:39 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights Fri Jan 18 15:24:52 2002 @@ -1,55 +0,0 @@ - SuperProbe is covered by the following copyright statement (certain - individual files are copyright by other authors as indicated in the - source files): - -/* - * (c) Copyright 1993,1994 by David Wexelblat - * (c) Copyright 1994-1998 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 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holders shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * the copyright holders. - * - */ - - The vgadoc3.zip package from which much of the information in - SuperProbe was derived contains the following copyright statement: - -This compilation (c) Copyright 1991-94 Finn Thoegersen. All Rights Reserved. -You can redistribute the collection provided it is distributed unmodified -in its entirety and these clauses are left intact. The programs - executables -and source - can be left out if they are not meaningful for the intended -audience. No fee, monies et ceterra can be charged, except for normal -connection, media, shipment and handling expenses. -You are free to use the information herein and excerpts from the programs, -provided that the source is credited (My name and the VGADOC3 package). - - The author of SuperProbe gratefully acknowledges the work and - cooperation of the author of vgadoc3.zip. - -$XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights,v 3.5 1999/03/14 03:21:39 dawes Exp $ - - - - - -$XConsortium: 01.CopyRights /main/4 1996/02/21 17:08:52 kaleb $ Index: xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c:3.4 Mon Dec 23 01:30:55 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c Fri Jan 18 15:24:52 2002 @@ -1,116 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c,v 3.4 1996/12/23 06:30:55 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: 8514.c /main/5 1996/02/21 17:08:59 kaleb $ */ - -#include "Probe.h" - -/* - * Check for basic 8514 functionality. 8514 extended functionality will - * be checked for elsewhere. - */ - -static Word Ports[] = {SUBSYS_CNTL,ERR_TERM}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_8514 __STDCARGS((int)); - -Chip_Descriptor IBM8514_Descriptor = { - "8514/A", - Probe_8514, - Ports, - NUMPORTS, - TRUE, - FALSE, - FALSE, - MemProbe_8514, -}; - -Bool Probe_8514(Chipset) -int *Chipset; -{ - Bool result = FALSE; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Reset the 8514/A, and disable all interrupts. - */ - outpw(SUBSYS_CNTL, GPCTRL_RESET|CHPTEST_NORMAL); - outpw(SUBSYS_CNTL, GPCTRL_ENAB|CHPTEST_NORMAL); - - /* - * Check to see if an 8514/A is actually installed by writing - * to the ERR_TERM register and reading back. The 0x5A5A value - * is entirely arbitrary. - */ - outpw(ERR_TERM, 0x5A5A); - if (inpw(ERR_TERM) == 0x5A5A) - { - /* - * Let's make certain. - */ - outpw(ERR_TERM, 0x5555); - if (inpw(ERR_TERM) == 0x5555) - { - if (tstrg(EXT_CONF_3, 0xF0)) - { - *Chipset = CHIP_CT480; - } - else - { - *Chipset = CHIP_8514; - } - result = TRUE; - } - } - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -/* ARGSUSED */ -static int MemProbe_8514(Chipset) -int Chipset; -{ - int Mem; - - EnableIOPorts(NUMPORTS, Ports); - - if (inpw(SUBSYS_CNTL) & 0x0080) - { - Mem = 1024; - } - else - { - Mem = 512; - } - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c:3.4 Mon Dec 23 01:30:56 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c Fri Jan 18 15:24:52 2002 @@ -1,131 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c,v 3.4 1996/12/23 06:30:56 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: AL.c /main/5 1996/02/21 17:09:04 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_AL __STDCARGS((int)); - -Chip_Descriptor AL_Descriptor = { - "AL", - Probe_AL, - Ports, - NUMPORTS, - FALSE, - FALSE, - FALSE, - MemProbe_AL, -}; - -Bool Probe_AL(Chipset) -int *Chipset; -{ - Byte old; - Bool result = FALSE; - - /* Add CRTC to enabled ports */ - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - - old = rdinx(CRTC_IDX, 0x1A); - clrinx(CRTC_IDX, 0x1A, 0x10); - if (!testinx2(CRTC_IDX, 0x19, 0xCF)) - { - setinx(CRTC_IDX, 0x1A, 0x10); - if ((testinx2(CRTC_IDX, 0x19, 0xCF) && - (testinx2(CRTC_IDX, 0x1A, 0x3F)))) - { - result = TRUE; - switch (rdinx(CRTC_IDX, 0x1A) >> 6) - { - case 0x03: - *Chipset = CHIP_AL2101; - break; - case 0x02: - *Chipset = CHIP_AL2228; - break; - default: - Chip_data = rdinx(CRTC_IDX, 0x1A); - *Chipset = CHIP_AL_UNKNOWN; - break; - } - } - } - wrinx(CRTC_IDX, 0x1A, old); - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -/* ARGSUSED */ -static int MemProbe_AL(Chipset) -int Chipset; -{ - Byte old; - int Mem; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock - */ - old = rdinx(CRTC_IDX, 0x1A); - setinx(CRTC_IDX, 0x1A, 0x10); - - /* - * Check - */ - switch (rdinx(CRTC_IDX, 0x1E) & 0x03) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 1024; - break; - case 0x03: - Mem = 2048; - break; - } - - /* - * Lock - */ - wrinx(CRTC_IDX, 0x1A, old); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c:3.3 xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c:3.3 Fri Nov 19 08:54:13 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c Fri Jan 18 15:24:52 2002 @@ -1,167 +0,0 @@ -/* $XConsortium: ARK.c /main/3 1996/10/25 21:18:52 kaleb $ */ -/* - * (c) Copyright 1996 Harm Hanemaayer - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Harm Hanemaayer shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Harm Hanemaayer. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c,v 3.3 1999/11/19 13:54:13 hohndel Exp $ */ - -#include "Probe.h" - -static Word Ports[] = {SEQ_IDX, SEQ_REG, 0x3B4, 0x3B5, 0x3D4, 0x3D5}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_ARK __STDCARGS((int)); - -Chip_Descriptor ARK_Descriptor = { - "ARK Logic", - Probe_ARK, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_ARK, -}; - -Bool Probe_ARK(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte CR50, savedSR1D; - int id, rev; - int i; - - if (!NoPCI) - { - i = 0; - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_ARK && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_1000PV: - *Chipset = CHIP_ARK1000PV; - break; - case PCI_CHIP_2000PV: - *Chipset = CHIP_ARK2000PV; - break; - case PCI_CHIP_2000MT: - *Chipset = CHIP_ARK2000MT; - break; - case PCI_CHIP_2000MI: - *Chipset = CHIP_ARK2000MI; - break; - default: - Chip_data = pcrp->_device; - *Chipset = CHIP_ARK_UNK; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - /* Unlock by setting bit 0 of SR1D. */ - savedSR1D = rdinx(SEQ_IDX, 0x1D); - modinx(SEQ_IDX, 0x1D, 0x01, 0x01); - - /* - * Check for read/writability of all the "Software Scratch" - * registers. - */ - if (!testinx(SEQ_IDX, 0x1E) - || !testinx(SEQ_IDX, 0x1F) - || !testinx(SEQ_IDX, 0x1A) - || !testinx(SEQ_IDX, 0x1B)) { - wrinx(SEQ_IDX, 0x1D, savedSR1D); - return FALSE; - } - - CR50 = rdinx(CRTC_IDX, 0x50); - id = CR50 >> 3; - rev = CR50 & 7; - - switch (id) { - /* The ARK1000VL is missing. I don't know the ID. */ - case 0x12 : - *Chipset = CHIP_ARK1000PV; - return TRUE; - case 0x13 : - *Chipset = CHIP_ARK2000PV; - return TRUE; - case 0x14 : - *Chipset = CHIP_ARK2000MT; - return TRUE; - case 0x15 : - *Chipset = CHIP_ARK2000MI; - return TRUE; - default : - /* - * The general ARK check is too weak, so don't assume - * it's an ARK chip. - */ - break; - } - wrinx(SEQ_IDX, 0x1D, savedSR1D); - - return(FALSE); -} - -static int MemProbe_ARK(Chipset) -int Chipset; -{ - int Mem = 0; - Byte SR10, savedSR1D; - - EnableIOPorts(NUMPORTS, Ports); - - /* Unlock by setting bit 0 of SR1D. */ - savedSR1D = rdinx(SEQ_IDX, 0x1D); - modinx(SEQ_IDX, 0x1D, 0x01, 0x01); - - SR10 = rdinx(SEQ_IDX, 0x10); - if (Chipset == CHIP_ARK1000PV) - if ((SR10 & 0x40) == 0) - Mem = 1024; - else - Mem = 2048; - if (Chipset == CHIP_ARK2000PV || Chipset == CHIP_ARK2000MT - || Chipset == CHIP_ARK2000MI) - if ((SR10 & 0xC0) == 0) - Mem = 1024; - else - if ((SR10 & 0xC0) == 0x40) - Mem = 2048; - else - Mem = 4096; - - wrinx(SEQ_IDX, 0x1D, savedSR1D); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c:3.20 xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c:3.20 Wed Oct 13 00:21:00 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c Fri Jan 18 15:24:52 2002 @@ -1,415 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c,v 3.20 1999/10/13 04:21:00 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: ATI.c /main/10 1996/10/25 07:00:11 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x01CE, 0x01CF}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_ATI __STDCARGS((int)); - -Chip_Descriptor ATI_Descriptor = { - "ATI", - Probe_ATI, - Ports, - NUMPORTS, - TRUE, - TRUE, - TRUE, - MemProbe_ATI, -}; - -Bool Crippled_Mach32 = FALSE, - Crippled_Mach64 = FALSE, - Mach64xTB = FALSE; - -extern Chip_Descriptor ATIMach_Descriptor; - -#ifdef __STDC__ -void Probe_ATI_ChipID(int chip, int *Chipset) -#else -void Probe_ATI_ChipID(chip, Chipset) -int chip, *Chipset; -#endif -{ - if (chip == CHIP_MACH64) - { - extern Word ATIMach64CONFIG_CHIP_ID; - - EnableIOPorts(1, &ATIMach64CONFIG_CHIP_ID); - chip = inpl(ATIMach64CONFIG_CHIP_ID); - switch (chip & 0xFFFF) - { - case 0x00D7: - case 0x4758: - switch ((chip & 0xFF000000) >> 24) - { - case 0x00: - *Chipset = CHIP_ATI88800GXC; - break; - case 0x01: - *Chipset = CHIP_ATI88800GXD; - break; - case 0x02: - *Chipset = CHIP_ATI88800GXE; - break; - case 0x03: - *Chipset = CHIP_ATI88800GXF; - break; - default: - Chip_data = chip; - *Chipset = CHIP_ATI_UNK; - break; - } - break; - case 0x0057: - case 0x4358: - *Chipset = CHIP_ATI88800CX; - break; - case 0x0053: - case 0x4354: - *Chipset = CHIP_ATI264CT; - break; - case 0x0093: - case 0x4554: - *Chipset = CHIP_ATI264ET; - break; - case 0x02B3: - case 0x5654: - if (chip & 0x07000000) - { - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264VTB; - } - else - *Chipset = CHIP_ATI264VT; - break; - case 0x02B4: - case 0x5655: - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264VT3; - break; - case 0x02B5: - case 0x5656: - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264VT4; - break; - case 0x00D3: - case 0x4754: - if (chip & 0x07000000) - { - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264GTB; - } - else - *Chipset = CHIP_ATI264GT; - break; - case 0x00D4: - case 0x4755: - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264GTDVD; - break; - case 0x00D5: - case 0x00D6: - case 0x00D9: - case 0x4756: - case 0x4757: - case 0x475A: - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264GTIIc; - break; - case 0x00C1: - case 0x00C3: - case 0x00C8: - case 0x00CF: - case 0x00D0: - case 0x4742: - case 0x4744: - case 0x4749: - case 0x4750: - case 0x4751: - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264GT3; - break; - case 0x0166: - case 0x4C47: - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264LT; - break; - case 0x0161: - case 0x0163: - case 0x0168: - case 0x016F: - case 0x4C42: - case 0x4C44: - case 0x4C49: - case 0x4C50: - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264LTPRO; - break; - case 0x00CB: - case 0x00CC: - case 0x00CD: - case 0x00CE: - case 0x00D1: - case 0x00D2: - case 0x474C: - case 0x474D: - case 0x474E: - case 0x474F: - case 0x4752: - case 0x4753: - Mach64xTB = TRUE; - *Chipset = CHIP_ATI264XL; - break; - case 0x016C: - case 0x016D: - case 0x0171: - case 0x0172: - case 0x4C4D: - case 0x4C4E: - case 0x4C52: - case 0x4C53: - Mach64xTB = TRUE; - *Chipset = CHIP_ATIMOBILITY; - break; - default: - Chip_data = chip; - Mach64xTB = TRUE; /* Most likely */ - *Chipset = CHIP_ATI_UNK; - break; - } - DisableIOPorts(1, &ATIMach64CONFIG_CHIP_ID); - } - else /* if (chip == CHIP_MACH32) */ - { - Word IOPort = CHIP_ID; - - EnableIOPorts(1, &IOPort); - - chip = inpw(CHIP_ID); - if (chip == 0xFFFF) - chip = 0; - switch (chip & 0x03FF) - { - case 0x0000: - *Chipset = CHIP_ATI68800_3; - break; - case 0x02F7: - *Chipset = CHIP_ATI68800_6; - break; - case 0x0177: - *Chipset = CHIP_ATI68800LX; - break; - case 0x0017: - *Chipset = CHIP_ATI68800AX; - break; - default: - Chip_data = chip; - *Chipset = CHIP_ATI_UNK; - break; - } - DisableIOPorts(1, &IOPort); - } -} - -#ifdef __STDC__ -Bool Probe_ATI(int *Chipset) -#else -Bool Probe_ATI(Chipset) -int *Chipset; -#endif -{ - Bool result = FALSE; - Byte bios[10]; - Byte *signature = (Byte *)"761295520"; - int chip; - - /* - * First, look for a Mach32 or a Mach64. - */ - if (ATIMach_Descriptor.f(&chip) && - ((chip == CHIP_MACH32) || (chip == CHIP_MACH64))) - { - Probe_ATI_ChipID(chip, Chipset); - return (TRUE); - } - - if (ReadBIOS(0x31, bios, 9) != 9) - { - fprintf(stderr, "%s: Failed to read ATI signature\n", MyName); - return(FALSE); - } - if (memcmp(bios, signature, 9) == 0) - { - if (ReadBIOS(0x40, bios, 4) != 4) - { - fprintf(stderr, "%s: Failed to read ATI BIOS data\n", - MyName); - return(FALSE); - } - - result = TRUE; - - if ((bios[0] == '3') && (bios[1] == '1')) - { - /* Set up Ports array */ - if (ReadBIOS(0x10, bios, sizeof(Word)) != sizeof(Word)) - { - fprintf(stderr, - "%s: Failed to read ATI BIOS data\n", - MyName); - return (FALSE); - } - - switch (bios[3]) - { - case '1': - *Chipset = CHIP_ATI18800; - break; - case '2': - *Chipset = CHIP_ATI18800_1; - break; - case '3': - *Chipset = CHIP_ATI28800_2; - break; - case '4': - *Chipset = CHIP_ATI28800_4; - break; - case '5': - *Chipset = CHIP_ATI28800_5; - break; - case '6': - *Chipset = CHIP_ATI28800_6; - break; - case 'a': - case 'b': - case 'c': - Crippled_Mach32 = TRUE; - Probe_ATI_ChipID(CHIP_MACH32, Chipset); - break; - case ' ': - Crippled_Mach64 = TRUE; - Probe_ATI_ChipID(CHIP_MACH64, Chipset); - break; - default: - Chip_data = (((((bios[0] << 8) | - bios[1]) << 8) | - bios[2]) << 8) | bios[3]; - *Chipset = CHIP_ATI_UNK; - break; - } - - if (!Crippled_Mach64) - { - Ports[0] = *((Word *)bios); - Ports[1] = Ports[0] + 1; - } - - /* - * Sometimes, the BIOS lies about the chip. - */ - if ((*Chipset >= CHIP_ATI28800_4) && - (*Chipset <= CHIP_ATI28800_6)) - { - EnableIOPorts(NUMPORTS, Ports); - chip = rdinx(Ports[0], 0xAA) & 0x0F; - if (chip < 7) - { - chip = SVGA_TYPE(V_ATI, chip); - if (chip > *Chipset) - *Chipset = chip; - } - DisableIOPorts(NUMPORTS, Ports); - } - } - else - { - Chip_data = (((((bios[0] << 8) | bios[1]) << 8) | - bios[2]) << 8) | bios[3]; - *Chipset = CHIP_ATI_UNK; - } - } - return(result); -} - -static int MemProbe_ATI(Chipset) -int Chipset; -{ - int Mem = 0; - - if ((Chipset >= CHIP_ATI88800GXC) && !Crippled_Mach64) - return (ATIMach_Descriptor.memcheck(CHIP_MACH64)); - if ((Chipset >= CHIP_ATI68800_3) && !Crippled_Mach32) - return (ATIMach_Descriptor.memcheck(CHIP_MACH32)); - - /* Ports array should already be set up */ - EnableIOPorts(NUMPORTS, Ports); - - if (Crippled_Mach32) - Chipset = CHIP_MACH32; - else if (Crippled_Mach64) - Chipset = CHIP_MACH64; - - switch (Chipset) - { - case CHIP_ATI18800: - case CHIP_ATI18800_1: - if (rdinx(Ports[0], 0xBB) & 0x20) - Mem = 512; - else - Mem = 256; - break; - case CHIP_ATI28800_2: - case CHIP_ATI28800_4: - case CHIP_ATI28800_5: - case CHIP_ATI28800_6: - case CHIP_MACH32: - case CHIP_MACH64: - switch (rdinx(Ports[0], 0xB0) & 0x18) - { - case 0x00: - Mem = 256; - break; - case 0x10: - Mem = 512; - break; - case 0x08: - case 0x18: - Mem = 1024; - break; - } - break; - } - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); - -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c:3.11 xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c:3.11 Thu May 22 10:22:21 1997 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c Fri Jan 18 15:24:52 2002 @@ -1,325 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c,v 3.11 1997/05/22 14:22:21 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: ATIMach.c /main/10 1996/10/25 07:00:15 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {ROM_ADDR_1, DESTX_DIASTP, READ_SRC_X, - CONFIG_STATUS_1, MISC_OPTIONS, GP_STAT}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_ATIMach __STDCARGS((int)); -extern void Probe_ATI_ChipID __STDCARGS((int, int *)); - -Chip_Descriptor ATIMach_Descriptor = { - "ATI_Mach", - Probe_ATIMach, - Ports, - NUMPORTS, - TRUE, - FALSE, - FALSE, - MemProbe_ATIMach, -}; - -#define WaitIdleEmpty() { int i; \ - for (i=0; i < 100000; i++) \ - if (!(inpw(GP_STAT) & (GPBUSY | 1))) \ - break; \ - } - -/* ATI Mach64 I/O port addresses */ -Word ATIMach64MEM_INFO, - ATIMach64SCRATCH_REG1, - ATIMach64DAC_CNTL, - ATIMach64CONFIG_CHIP_ID; - -#ifdef __STDC__ -static void Probe_ATIMach64(int *Chipset, - unsigned short int IOBase, - Bool SparseIO) -#else -static void Probe_ATIMach64(Chipset, IOBase, SparseIO) -int *Chipset; -unsigned short int IOBase; -Bool SparseIO; -#endif -{ - Long tmp; - Word IOPort; - int chip; - - if ((*Chipset != -1) || (IOBase == 0)) - return; - - /* Determine if a Mach64 answers the call */ - IOPort = (SparseIO ? 0x4000 : 0x0080) + IOBase; - EnableIOPorts(1, &IOPort); - tmp = inpl(IOPort); - outpl(IOPort, 0x55555555); /* Test odd bits */ - if (inpl(IOPort) == 0x55555555) - { - outpl(IOPort, 0xAAAAAAAA); /* Test even bits */ - if (inpl(IOPort) == 0xAAAAAAAA) - { - /* - * Fix I/O ports. I know, I know: hard-wired - * constants are *EVIL*, but this'll do for now. - */ - if (SparseIO) - { - ATIMach64SCRATCH_REG1 = 0x4400; - ATIMach64MEM_INFO = 0x5000; - ATIMach64DAC_CNTL = 0x6000; - ATIMach64CONFIG_CHIP_ID = 0x6C00; - } - else - { - ATIMach64SCRATCH_REG1 = 0x0084; - ATIMach64MEM_INFO = 0x00B0; - ATIMach64DAC_CNTL = 0x00C4; - ATIMach64CONFIG_CHIP_ID = 0x00E0; - } - ATIMach64SCRATCH_REG1 += IOBase; - ATIMach64MEM_INFO += IOBase; - ATIMach64DAC_CNTL += IOBase; - ATIMach64CONFIG_CHIP_ID += IOBase; - - /* - * Something's responding to our hail. Make sure it's - * a Mach64. This assumes ATI won't be producing any - * more adapters that don't register themselves in PCI - * configuration space. - */ - Probe_ATI_ChipID(CHIP_MACH64, &chip); - if ((chip == CHIP_ATI_UNK) && SparseIO) - Chip_data = (Long)~0; - else - *Chipset = CHIP_MACH64; - } - } - outpl(IOPort, tmp); - DisableIOPorts(1, &IOPort); -} - -#ifdef __STDC__ -Bool Probe_ATIMach(int *Chipset) -#else -Bool Probe_ATIMach(Chipset) -int *Chipset; -#endif -{ - Long tmp; - static int chip = -1; - static Bool Already_Called = FALSE; - struct pci_config_reg *PCIDevice; - int Index; - - if (Already_Called) - { - if (chip != -1) - *Chipset = chip; - return (chip != -1); - } - Already_Called = TRUE; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Check for 8514/A registers. Don't read BIOS, or an attached 8514 - * Ultra won't be detected (the slave SVGA's BIOS is in the normal SVGA - * place). - */ - tmp = inpw(ROM_ADDR_1); - outpw(ROM_ADDR_1, 0x5555); - WaitIdleEmpty(); - if (inpw(ROM_ADDR_1) == 0x5555) - { - outpw(ROM_ADDR_1, 0x2A2A); - WaitIdleEmpty(); - if (inpw(ROM_ADDR_1) == 0x2A2A) - chip = CHIP_8514; - } - outpw(ROM_ADDR_1, tmp); - if (chip != -1) - { - /* - * An 8514 accelerator is really present; now figure - * out which one. - */ - outpw(DESTX_DIASTP, 0xAAAA); - WaitIdleEmpty(); - if (inpw(READ_SRC_X) != 0x02AA) - chip = CHIP_MACH8; - else - chip = CHIP_MACH32; - outpw(DESTX_DIASTP, 0x5555); - WaitIdleEmpty(); - if (inpw(READ_SRC_X) != 0x0555) - { - if (chip != CHIP_MACH8) - /* - * Something bizarre is happening. - */ - chip = -1; - } - else - { - if (chip != CHIP_MACH32) - /* - * Something bizarre is happening. - */ - chip = -1; - } - } - - DisableIOPorts(NUMPORTS, Ports); - - if (chip == -1) - { - /* - * Check for a Mach64. Start with sparse I/O base addresses, - * then move on to PCI information. - */ - Probe_ATIMach64(&chip, 0x02EC, TRUE); - Probe_ATIMach64(&chip, 0x01CC, TRUE); - Probe_ATIMach64(&chip, 0x01C8, TRUE); - - Index = 0; - while ((chip == -1) && (PCIDevice = pci_devp[Index++])) - { - if (PCIDevice->_vendor != PCI_VENDOR_ATI) - continue; - if (PCIDevice->_device == PCI_CHIP_MACH32) - continue; - Probe_ATIMach64(&chip, PCIDevice->_base1 & 0xFF00, - FALSE); - } - } - - if (chip != -1) - { - *Chipset = chip; - } - - return(chip != -1); -} - -#ifdef __STDC__ -static int MemProbe_ATIMach(int Chipset) -#else -static int MemProbe_ATIMach(Chipset) -int Chipset; -#endif -{ - static int Mem = 0; - static Bool Already_Called = FALSE; - - if (Already_Called) - return (Mem); - Already_Called = TRUE; - - EnableIOPorts(NUMPORTS, Ports); - if (Chipset == CHIP_MACH8) - { - if (inpw(CONFIG_STATUS_1) & 0x0020) - { - Mem = 1024; - } - else - { - Mem = 512; - } - } - else if (Chipset == CHIP_MACH32) - { - switch ((inpw(MISC_OPTIONS) & 0x000C) >> 2) - { - case 0x00: - Mem = 512; - break; - case 0x01: - Mem = 1024; - break; - case 0x02: - Mem = 2048; - break; - case 0x03: - Mem = 4096; - break; - } - } - else if (Chipset == CHIP_MACH64) - { - extern Bool Mach64xTB; - int tmp; - - EnableIOPorts(1, &ATIMach64MEM_INFO); - tmp = inpl(ATIMach64MEM_INFO); - if (!Mach64xTB) { - switch (tmp & 0x00000007) - { - case 0x00: - Mem = 512; - break; - case 0x01: - Mem = 1024; - break; - case 0x02: - Mem = 2048; - break; - case 0x03: - Mem = 4096; - break; - case 0x04: - Mem = 6144; - break; - case 0x05: - Mem = 8192; - break; - case 0x06: - Mem = 12288; - break; - case 0x07: - Mem = 16384; - break; - } - } else { - if ((tmp &= 0x0000000F) < 8) - Mem = (tmp + 1) * 512; - else if (tmp < 12) - Mem = (tmp - 3) * 1024; - else - Mem = (tmp - 7) * 2048; - } - DisableIOPorts(1, &ATIMach64MEM_INFO); - } - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c:3.4 Mon Dec 23 01:31:01 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c Fri Jan 18 15:24:52 2002 @@ -1,123 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c,v 3.4 1996/12/23 06:31:01 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Ahead.c /main/5 1996/02/21 17:09:18 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {GRC_IDX, GRC_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Ahead __STDCARGS((int)); - -Chip_Descriptor Ahead_Descriptor = { - "Ahead", - Probe_Ahead, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_Ahead, -}; - -Bool Probe_Ahead(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old, tmp; - - EnableIOPorts(NUMPORTS, Ports); - old = rdinx(GRC_IDX, 0x0F); - wrinx(GRC_IDX, 0x0F, 0); - if (!testinx2(GRC_IDX, 0x0C, 0xFB)) - { - wrinx(GRC_IDX, 0x0F, 0x20); - if (testinx2(GRC_IDX, 0x0C, 0xFB)) - { - result = TRUE; - tmp = rdinx(GRC_IDX, 0x0F) & 0x0F; - switch (tmp) - { - case 0x00: - *Chipset = CHIP_AHEAD_A; - break; - case 0x01: - *Chipset = CHIP_AHEAD_B; - break; - default: - Chip_data = tmp; - *Chipset = CHIP_AHEAD_UNK; - break; - } - } - } - wrinx(GRC_IDX, 0x0F, old); - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -/* ARGSUSED */ -static int MemProbe_Ahead(Chipset) -int Chipset; -{ - Byte old; - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock - */ - old = rdinx(GRC_IDX, 0x0F); - setinx(GRC_IDX, 0x0F, 0x20); - - /* - * Check - */ - switch (rdinx(GRC_IDX, 0x1F) & 0x03) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x03: - Mem = 1024; - break; - } - - /* - * Lock - */ - wrinx(GRC_IDX, 0x0F, old); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c:3.4 Fri Nov 19 08:54:13 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c Fri Jan 18 15:24:52 2002 @@ -1,117 +0,0 @@ -/* - * (c) Copyright 1996 Joseph Moss - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * JOSEPH MOSS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Joseph Moss shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Joseph Moss. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c,v 3.4 1999/11/19 13:54:13 hohndel Exp $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Alliance __STDCARGS((int)); - -Chip_Descriptor Alliance_Descriptor = { - "Alliance", - Probe_Alliance, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_Alliance, -}; - -Bool Probe_Alliance(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte idx; - char chipid[9]; - int i = 0; - - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_ALLIANCE && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_PM6410: - *Chipset = CHIP_ALSC6410; - break; - case PCI_CHIP_PM6422: - *Chipset = CHIP_ALSC6422; - break; - case PCI_CHIP_PMAT24: - *Chipset = CHIP_ALSCAT24; - break; - case PCI_CHIP_PMAT3D: - *Chipset = CHIP_ALSCAT3D; - break; - default: - Chip_data = pcrp->_device; - *Chipset = CHIP_ALSC_UNK; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - EnableIOPorts(NUMPORTS, Ports); - for (idx = 0x11; idx < 0x19; idx++) { - chipid[idx-0x11] = rdinx(SEQ_IDX, idx); - } - DisableIOPorts(NUMPORTS, Ports); - - chipid[7] = '\0'; - if ( !strcmp(chipid, "Pro6410") ) - *Chipset = CHIP_ALSC6410; - else if ( !strcmp(chipid, "Pro6422") ) - *Chipset = CHIP_ALSC6422; - else if ( !strcmp(chipid, "Pro6424") ) - *Chipset = CHIP_ALSCAT24; - else if ( !strcmp(chipid, "ProAT3D") ) - *Chipset = CHIP_ALSCAT3D; - else - return(FALSE); - - return(TRUE); -} - -static int MemProbe_Alliance(Chipset) -int Chipset; -{ - int mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - mem = rdinx(SEQ_IDX, 0x20) * 64; - DisableIOPorts(NUMPORTS, Ports); - return mem; -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds:3.3 xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds:3.3 Mon Dec 23 01:31:02 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds Fri Jan 18 15:24:52 2002 @@ -1,18 +0,0 @@ -# Amakefile for X11R5/mit/server/ddx/x386/SuperProbe. -# $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds,v 3.3 1996/12/23 06:31:02 dawes Exp $ - - - - - -# $XConsortium: Amake.cmds /main/5 1996/02/21 17:09:22 kaleb $ - -INCLUDES= -{ -}; - -%include $ARCH/generic.amk; - -%include $PWD/Amake.srclist; - -%instance command(SuperProbe, $X11R5_MIT_SERVER_DDX_X386_SUPERPROBE); Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist:3.3 xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist:3.3 Mon Dec 23 01:31:03 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist Fri Jan 18 15:24:52 2002 @@ -1,44 +0,0 @@ -# $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist,v 3.3 1996/12/23 06:31:03 dawes Exp $ - - - - - -# $XConsortium: Amake.srclist /main/5 1996/02/21 17:09:27 kaleb $ - -X11R5_MIT_SERVER_DDX_X386_SUPERPROBE= -{ - $PWD/8514.c, - $PWD/AL.c, - $PWD/ATI.c, - $PWD/ATIMach.c, - $PWD/Ahead.c, - $PWD/CGA.c, - $PWD/ChipsTech.c, - $PWD/Cirrus.c, - $PWD/Compaq.c, - $PWD/Genoa.c, - $PWD/Herc.c, - $PWD/HMC.c, - $PWD/MDA.c, - $PWD/MX.c, - $PWD/Main.c, - $PWD/MemProbe.c, - $PWD/NCR.c, - $PWD/OS_Minix.c, - $PWD/Oak.c, - $PWD/Primus.c, - $PWD/Print.c, - $PWD/RamDac.c, - $PWD/RealTek.c, - $PWD/S3.c, - $PWD/Trident.c, - $PWD/Tseng.c, - $PWD/UMC.c, - $PWD/Utils.c, - $PWD/VGA.c, - $PWD/Video7.c, - $PWD/WD.c, - $PWD/Weitek.c, - $PWD/Yamaha.c, -}; Index: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h:3.18 xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h:3.18 Sun Apr 1 10:00:07 2001 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h Fri Jan 18 15:24:52 2002 @@ -1,450 +0,0 @@ -/* $XConsortium: AsmMacros.h /main/13 1996/10/25 11:33:12 kaleb $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ -/* - * Copyright 1997 - * Digital Equipment Corporation. All rights reserved. - * This software is furnished under license and may be used and copied only in - * accordance with the following terms and conditions. Subject to these - * conditions, you may download, copy, install, use, modify and distribute - * this software in source and/or binary form. No title or ownership is - * transferred hereby. - * - * 1) Any source code used, modified or distributed must reproduce and retain - * this copyright notice and list of conditions as they appear in the source - * file. - * - * 2) No right is granted to use any trade name, trademark, or logo of Digital - * Equipment Corporation. Neither the "Digital Equipment Corporation" name - * nor any trademark or logo of Digital Equipment Corporation may be used - * to endorse or promote products derived from this software without the - * prior written permission of Digital Equipment Corporation. - * - * 3) This software is provided "AS-IS" and any express or implied warranties, - * including but not limited to, any implied warranties of merchantability, - * fitness for a particular purpose, or non-infringement are disclaimed. In - * no event shall DIGITAL be liable for any damages whatsoever, and in - * particular, DIGITAL shall not be liable for special, indirect, - * consequential, or incidental damages or damages for - * lost profits, loss of revenue or loss of use, whether such damages arise - * in contract, - * negligence, tort, under statute, in equity, at law or otherwise, even if - * advised of the possibility of such damage. - * - */ - -/* $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 -#define outb(p,v) _outb((v),(p)) -#define outw(p,v) _outw((v),(p)) -#define outl(p,v) _outl((v),(p)) -#else -#if defined(__sparc__) -#ifndef ASI_PL -#define ASI_PL 0x88 -#endif - -static __inline__ void -outb(port, val) -unsigned long port; -char val; -{ - __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); -} - -static __inline__ void -outw(port, val) -unsigned long port; -char val; -{ - __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); -} - -static __inline__ void -outl(port, val) -unsigned long port; -char val; -{ - __asm__ __volatile__("sta %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); -} - -static __inline__ unsigned int -inb(port) -unsigned long port; -{ - unsigned char ret; - __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); - return ret; -} - -static __inline__ unsigned int -inw(port) -unsigned long port; -{ - unsigned char ret; - __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); - return ret; -} - -static __inline__ unsigned int -inl(port) -unsigned long port; -{ - unsigned char ret; - __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); - return ret; -} -#else -#ifdef __arm32__ -unsigned int IOPortBase; /* Memory mapped I/O port area */ - -static __inline__ void -outb(port, val) - short port; - char val; -{ - if ((unsigned short)port >= 0x400) return; - - *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val; -} - -static __inline__ void -outw(port, val) - short port; - short val; -{ - if ((unsigned short)port >= 0x400) return; - - *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val; -} - -static __inline__ void -outl(port, val) - short port; - int val; -{ - if ((unsigned short)port >= 0x400) return; - - *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val; -} - -static __inline__ unsigned int -inb(port) - short port; -{ - if ((unsigned short)port >= 0x400) return((unsigned int)-1); - - return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase)); -} - -static __inline__ unsigned int -inw(port) - short port; -{ - if ((unsigned short)port >= 0x400) return((unsigned int)-1); - - return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase)); -} - -static __inline__ unsigned int -inl(port) - short port; -{ - if ((unsigned short)port >= 0x400) return((unsigned int)-1); - - return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase)); -} -#else /* __arm32__ */ -#if defined(Lynx) && defined(__powerpc__) -extern unsigned char *ioBase; - -static volatile void -eieio() -{ - __asm__ __volatile__ ("eieio"); -} - -static void -outb(port, value) -short port; -unsigned char value; -{ - *(uchar *)(ioBase + port) = value; eieio(); -} - -static void -outw(port, value) -short port; -unsigned short value; -{ - *(unsigned short *)(ioBase + port) = value; eieio(); -} - -static void -outl(port, value) -short port; -unsigned long value; -{ - *(unsigned long *)(ioBase + port) = value; eieio(); -} - -static unsigned char -inb(port) -short port; -{ - unsigned char val; - - val = *((unsigned char *)(ioBase + port)); eieio(); - return(val); -} - -static unsigned short -inw(port) -short port; -{ - unsigned short val; - - val = *((unsigned short *)(ioBase + port)); eieio(); - return(val); -} - -static unsigned long -inl(port) -short port; -{ - unsigned long val; - - val = *((unsigned long *)(ioBase + port)); eieio(); - return(val); -} - -#else -#if defined(__FreeBSD__) && defined(__alpha__) - -#include - -extern void outb(u_int32_t port, u_int8_t val); -extern void outw(u_int32_t port, u_int16_t val); -extern void outl(u_int32_t port, u_int32_t val); -extern u_int8_t inb(u_int32_t port); -extern u_int16_t inw(u_int32_t port); -extern u_int32_t inl(u_int32_t port); - -#else -#ifdef GCCUSESGAS -static __inline__ void -outb(port, val) -short port; -char val; -{ - __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); -} - -static __inline__ void -outw(port, val) -short port; -short val; -{ - __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); -} - -static __inline__ void -outl(port, val) -short port; -unsigned int val; -{ - __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); -} - -static __inline__ unsigned int -inb(port) -short port; -{ - unsigned char ret; - __asm__ __volatile__("inb %1,%0" : - "=a" (ret) : - "d" (port)); - return ret; -} - -static __inline__ unsigned int -inw(port) -short port; -{ - unsigned short ret; - __asm__ __volatile__("inw %1,%0" : - "=a" (ret) : - "d" (port)); - return ret; -} - -static __inline__ unsigned int -inl(port) -short port; -{ - unsigned int ret; - __asm__ __volatile__("inl %1,%0" : - "=a" (ret) : - "d" (port)); - return ret; -} - -#else /* GCCUSESGAS */ - -static __inline__ void -outb(port, val) - short port; - char val; -{ - __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port)); -} - -static __inline__ void -outw(port, val) - short port; - short val; -{ - __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port)); -} - -static __inline__ void -outl(port, val) - short port; - unsigned int val; -{ - __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port)); -} - -static __inline__ unsigned int -inb(port) - short port; -{ - unsigned int ret; - __asm__ __volatile__("in%B0 (%1)" : - "=a" (ret) : - "d" (port)); - return ret; -} - -static __inline__ unsigned int -inw(port) - short port; -{ - unsigned int ret; - __asm__ __volatile__("in%W0 (%1)" : - "=a" (ret) : - "d" (port)); - return ret; -} - -static __inline__ unsigned int -inl(port) - short port; -{ - unsigned int ret; - __asm__ __volatile__("in%L0 (%1)" : - "=a" (ret) : - "d" (port)); - return ret; -} - -#endif /* GCCUSESGAS */ -#endif /* Lynx && __powerpc__ */ -#endif /* arm32 */ -#endif /* linux && __sparc__ */ -#endif /* linux && __alpha__ */ -#endif /* __FreeBSD__ && __alpha__ */ - -#if defined(linux) || defined(__arm32__) || (defined(Lynx) && defined(__powerpc__)) - -#define intr_disable() -#define intr_enable() - -#else - -static __inline__ void -intr_disable() -{ - __asm__ __volatile__("cli"); -} - -static __inline__ void -intr_enable() -{ - __asm__ __volatile__("sti"); -} - -#endif /* else !linux && !__arm32__ */ - -#else /* __GNUC__ */ - -#if defined(_MINIX) && defined(_ACK) - -/* inb, outb, inw and outw are defined in the library */ -/* ... but I've no idea if the same is true for inl & outl */ - -u8_t inb(U16_t); -void outb(U16_t, U8_t); -u16_t inw(U16_t); -void outw(U16_t, U16_t); -u32_t inl(U16_t); -void outl(U16_t, U32_t); - -#else /* not _MINIX and _ACK */ - -# if defined(__STDC__) && (__STDC__ == 1) -# ifndef NCR -# define asm __asm -# endif -# endif -# ifdef SVR4 -# include -# ifndef __USLC__ -# define __USLC__ -# endif -# endif -#ifndef SCO325 -# include -#else -# include "../common/scoasm.h" -#endif -#define intr_disable() asm("cli") -#define intr_enable() asm("sti") - -#endif /* _MINIX and _ACK */ -#endif /* __GNUC__ */ Index: xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c:3.4 Mon Dec 23 01:31:05 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c Fri Jan 18 15:24:52 2002 @@ -1,64 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c,v 3.4 1996/12/23 06:31:05 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: CGA.c /main/5 1996/02/21 17:09:35 kaleb $ */ - -#include "Probe.h" - -/* - * Assume that the CRT Controller is at 0x3D4 (either no other adapter, - * or an EGA/CGA is installed in Mono mode). Look for the cursor - * postition register. - */ -static Word Ports[] = {0x3D4, 0x3D5}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -Bool Probe_CGA(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte tmp; - - EnableIOPorts(NUMPORTS, Ports); - tmp = rdinx(0x3D4, 0x0F); - if (testinx(0x3D4, 0x0F)) - { - result = TRUE; - if (testinx(0x3D4, 0x13)) - { - *Chipset = CHIP_MCGA; - } - else - { - *Chipset = CHIP_CGA; - } - } - wrinx(0x3D4, 0x0F, tmp); - DisableIOPorts(NUMPORTS, Ports); - return(result); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog:3.2 xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog:3.2 Wed Nov 30 15:36:11 1994 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog Fri Jan 18 15:24:52 2002 @@ -1,101 +0,0 @@ -Version 0.1 - March 25, 1993 - - Initial delivery to XFree86 beta-team in 1.2A - - Handles ident of MDA,CGA,MCGA,EGA,VGA,Hercules, and lots of SVGA - - Handles many RAMDACs - - Requires ANSI C - -Version 0.2 - April 17, 1993 - - Delivery to XFree86 beta-team in 1.2B - - Modified to search out BIOS base address (don't assume it's at - 0xC0000). - - Add Trident 8900CL, Tseng ET4000/W32 - -Version 0.3 - May 7, 1993 - - Delivery to XFree86 beta-team in 1.2C - - Allow compilation with K&R C compilers - - Add support for Minix - - Add -noprobe option to skip certain chipsets. - - Cirrus has built-in RAMDAC. Test for it, since the RAMDAC probe - hangs machines with Cirrus boards. - - #ifdef out C&T probe - it just seems to be TOO evil for words. - -Version 0.4 - May 24, 1993 - - Delivery to XFree86 beta team for 1.2D - - Add support for Mach - - Add Compaq QVision/1280, fix up Cirrus and NCR - -Version 0.5 - June 1, 1993 - - Final delivery for XFree86 1.3 - - Change ET3000 probe - - Update docs regarding MicroChannel - -Version 0.6 - June 28, 1993 - - Redo C&T probe function - -Version 0.7 - - - Update RAMDAC probes to check 6/8-bit wide lookup tables and to - identify the different AT&T RAMDACs. - - Add support for 8514/A, ATI Mach8 and ATI Mach32 detection. - -Version 0.8 - - - Update the S3 probes with all currently-known information. - - Bug fixes from Holger Veit - -Version 0.9 - - - Fix coprocessor ID code. - - Add Cirrus 5428, correct Cirrus built-in RAMDACs - - Update OS_Mach.c for Mach 3.0 - - Even MORE S3 rev codes - -Version 0.91 - - Add ATI Ultra/XLR (I think...) - - Update ATIMach.c to not read BIOS so an 8514 Ultra is detected. - - Add -no_bios flag to disallow BIOS reading and assume EGA/VGA - - Update Oak probe mechanism and add 057 check - - Update WD/Paradise probe to distinguish 90C2X chipsets - -Version 0.92 - - Fix broken ATIMach.c (infinite loops are a bad thing :->) - - Add probe for Bt485 RAMDAC on S3 boards - - Rearrange chipset numbering so that the Unknown values are - always index 0. Add support for printing out a signature for - Unknown chipsets. - -Version 1.0 - - Add in Cirrus 62x5, 642x chipsets - - Call it "done" for XFree86 2.0 - -Version 1.1 - - Add AT&T 20C505/504 checks to the RAMDAC probe - - Add Solaris x86 support (from David Holland ) - - Add -no_dac option to skip RAMDAC probe, in case it's nuking things. - - Long and short RamDac names. - - If the video BIOS can't be located, don't fail. Assume that there's - no EGA/VGA, and probe for old hardware. - - Put architecture in place for doing installed memory probes. - -Version 1.2 - Jan 2, 1994 - - More work on memory probes. Add support for probing memory - by mapping 0xA0000-0xAFFFF and switching banks. Support - memory probe via this mechanism for Trident and ET4000AX. - - Add probes for Trident 9200CXr, 9400CXi. - - Add support for USL-style VTs on bsd-du-jour (from J"org Wunsch). - - Add -no_mem option to skip memory probe - -Version 2.0 - Feb 27, 1994 - - Add memory probes for everything that can be accomplished by - reading registers. Nothing is currently using the physical - memory probe. - - Bazillions of changes from vgadoc3.zip (thanks, Finn). Added - HMC, UMC, Weitek probes. Added more chipsets for Cirrus, - NCR, Oak, RealTek, S3, Trident, Tseng, Video7, WD. Made some - changes to the probes for ATI & Compaq. - -Version 2.1 - April 13, 1994 - - Small updates - -Version 2.2 - August 28, 1994 - - More small updates - -Version 2.3 - November 18, 1994 - - Add support for ATI Mach64. Index: xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c:3.19 xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c:3.19 Sat Sep 25 10:36:58 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c Fri Jan 18 15:24:52 2002 @@ -1,318 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c,v 3.19 1999/09/25 14:36:58 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: ChipsTech.c /main/8 1996/10/28 04:23:17 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x3D6, 0x3D7}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_CT __STDCARGS((int)); - -Chip_Descriptor CT_Descriptor = { - "CT", - Probe_CT, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_CT, -}; - -#ifdef __STDC__ -Bool Probe_CT(int *Chipset) -#else -Bool Probe_CT(Chipset) -int *Chipset; -#endif -{ - Bool result = FALSE; - Byte vers; - - EnableIOPorts(NUMPORTS, Ports); - if ((testinx(0x3D6, 0x18) && (testinx2(0x3D6, 0x7E, 0x3F)))) - { - /* - * It's a Chips & Tech. Now figure out which one. - */ - result = TRUE; - vers = rdinx(0x3D6, 0x00); - switch (vers) - { - case 0x00: - *Chipset = CHIP_CT451; - break; - case 0x10: - *Chipset = CHIP_CT452; - break; - case 0x20: - *Chipset = CHIP_CT455; - break; - case 0x30: - *Chipset = CHIP_CT453; - break; - case 0x40: - *Chipset = CHIP_CT450; - break; - case 0x50: - *Chipset = CHIP_CT456; - break; - case 0x60: - *Chipset = CHIP_CT457; - break; - case 0x70: - *Chipset = CHIP_CTF65520; - break; - case 0x80: - case 0xc0: /* guess */ - *Chipset = CHIP_CTF65530; - break; - case 0x90: - *Chipset = CHIP_CTF65510; - break; - case 0xa0: - *Chipset = CHIP_CTF64200; - break; - case 0xb0: - *Chipset = CHIP_CTF64300; - break; - case 0xd0: - *Chipset = CHIP_CTF65540; - break; - case 0xd8: - case 0xd9: - case 0xda: - *Chipset = CHIP_CTF65545; - break; - case 0xdb: - *Chipset = CHIP_CTF65546; - break; - case 0xdc: - *Chipset = CHIP_CTF65548; - break; - default: - Chip_data = vers; - *Chipset = CHIP_CT_UNKNOWN; - break; - } - } - /* - * We could still have a HiQV style chipset. C&T have the PCI - * vendor ID stored in XR00 and XR01 for HiQV chips, regardless - * of whether the chip is actually connected to a PCI BUS. So - * probe for C&T vendor ID. - */ - if ((rdinx(0x3D6, 0x00) == 0x2C) && (rdinx(0x3D6, 0x01) == 0x10)) - { - /* - * It's a HiQV PCI Chips & Tech. - * Now figure out which one on PCI device ID low - * stored in XR02. - */ - result = TRUE; - *Chipset = CHIP_CT_UNKNOWN; - vers = rdinx(0x3D6, 0x02); - switch (vers) - { - case 0xe0: - *Chipset = CHIP_CTF65550; - break; - case 0xe4: - *Chipset = CHIP_CTF65554; - break; - case 0xe5: - *Chipset = CHIP_CTF65555; - break; - case 0xf4: - *Chipset = CHIP_CTF68554; - break; - case 0xc0: - *Chipset = CHIP_CTF69000; - break; - case 0x30: - if (rdinx(0x3D6, 0x03) == 0xC) - *Chipset = CHIP_CTF69030; - else { - Chip_data = vers; - *Chipset = CHIP_CT_UNKNOWN; - } - break; - default: - Chip_data = vers; - *Chipset = CHIP_CT_UNKNOWN; - break; - } - } - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -static int MemProbe_CT(Chipset) -int Chipset; -{ - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - switch (Chipset) - { - case CHIP_CT450: - case CHIP_CT456: - if (rdinx(0x3D6, 0x04) & 0x01) - { - Mem = 512; - } - else - { - Mem = 256; - } - break; - case CHIP_CT451: - case CHIP_CT455: - case CHIP_CT457: - Mem = 256; - break; - case CHIP_CT452: - switch (rdinx(0x3D6, 0x04) & 0x03) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 1024; - break; - } - break; - case CHIP_CT453: - switch ((rdinx(0x3D6, 0x24) >> 1) & 0x03) - { - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 1024; - break; - case 0x03: - Mem = 256; - break; - } - break; - case CHIP_CTF65510: - Mem = 512; - break; - case CHIP_CTF65520: - case CHIP_CTF65530: - case CHIP_CTF65540: - case CHIP_CTF65545: - case CHIP_CTF65546: - case CHIP_CTF65548: - switch (rdinx(0x3D6, 0x0F) & 0x03) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - case 0x03: - Mem = 1024; - break; - } - break; - case CHIP_CTF64200: - case CHIP_CTF64300: - switch (rdinx(0x3D6, 0x0F) & 0x03) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 1024; - break; - case 0x03: - Mem = 2048; - break; - } - break; - case CHIP_CTF65550: - switch ((rdinx(0x3D6, 0x43) & 0x06) >> 1) - { - case 0x00: - Mem = 1024; - break; - case 0x01: - Mem = 2048; - break; - case 0x03: - case 0x04: - Mem = 4096; - break; - } - break; - case CHIP_CTF65554: - case CHIP_CTF65555: - case CHIP_CTF68554: - switch (rdinx(0x3D6, 0xE0) & 0x0F) - { - case 0x00: - Mem = 512; - break; - case 0x01: - Mem = 1024; - break; - case 0x02: - Mem = 1536; - break; - case 0x03: - Mem = 2048; - break; - case 0x07: - Mem = 4096; - break; - } - break; - case CHIP_CTF69000: - Mem = 2048; - break; - case CHIP_CTF69030: - Mem = 4096; - break; - } - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c:3.15 xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c:3.15 Fri Nov 19 08:54:13 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c Fri Jan 18 15:24:52 2002 @@ -1,511 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c,v 3.15 1999/11/19 13:54:13 hohndel Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Cirrus.c /main/12 1996/10/25 14:09:56 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG, GRC_IDX, GRC_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -Chip_Descriptor Cirrus_Descriptor = { - "Cirrus", - Probe_Cirrus, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - NULL, -}; - -static int MemProbe_Cirrus54 __STDCARGS((int)); - -Chip_Descriptor Cirrus54_Descriptor = { - "Cirrus54", - Probe_Cirrus54, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_Cirrus54, -}; - -static int MemProbe_Cirrus64 __STDCARGS((int)); - -Chip_Descriptor Cirrus64_Descriptor = { - "Cirrus64", - Probe_Cirrus64, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_Cirrus64, -}; - -#define CLASS_OLD 0 -#define CLASS_54XX 1 -#define CLASS_64XX 2 - -#ifdef __STDC__ -static Bool Probe_Cirrus_Class(int *, int); -#else -static Bool Probe_Cirrus_Class(); -#endif - -Bool Probe_Cirrus(Chipset) -int *Chipset; -{ - return(Probe_Cirrus_Class(Chipset, CLASS_OLD)); -} - -Bool Probe_Cirrus54(Chipset) -int *Chipset; -{ - return(Probe_Cirrus_Class(Chipset, CLASS_54XX)); -} - -Bool Probe_Cirrus64(Chipset) -int *Chipset; -{ - return(Probe_Cirrus_Class(Chipset, CLASS_64XX)); -} - -static Bool Probe_Cirrus_Class(Chipset, Class) -int *Chipset; -int Class; -{ - Bool result = FALSE; - Byte old, old1, Ver; - int i; - - if (!NoPCI && Class == CLASS_54XX) - { - i = 0; - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_CIRRUS && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_GD5430: - /* Note: CL-GD5440 has the same ID. */ - *Chipset = CHIP_CL5430; - break; - case PCI_CHIP_GD5434_4: - case PCI_CHIP_GD5434_8: - *Chipset = CHIP_CL5434; - break; - case PCI_CHIP_GD5436: - *Chipset = CHIP_CL5436; - break; - case PCI_CHIP_GD5446: - *Chipset = CHIP_CL5446; - break; - case PCI_CHIP_GD5480: - *Chipset = CHIP_CL5480; - break; - case PCI_CHIP_GD5462: - *Chipset = CHIP_CL5462; - break; - case PCI_CHIP_GD5464: - *Chipset = CHIP_CL5464; - break; - case PCI_CHIP_GD5465: - *Chipset = CHIP_CL5465; - break; - case PCI_CHIP_GD7541: - *Chipset = CHIP_CL7541; - break; - case PCI_CHIP_GD7542: - *Chipset = CHIP_CL7542; - break; - case PCI_CHIP_GD7543: - *Chipset = CHIP_CL7543; - break; - case PCI_CHIP_GD7548: - *Chipset = CHIP_CL7548; - break; - default: - /* - * The PCI probing only recognizes VGA - * devices, so we can be sure it is - * a graphics chip. - */ - Chip_data = pcrp->_device; - *Chipset = CHIP_CL_UNKNOWN; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - /* Add CRTC to enabled ports */ - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - - if (Class == CLASS_OLD) - { - old = rdinx(CRTC_IDX, 0x0C); - old1 = rdinx(SEQ_IDX, 0x06); - wrinx(CRTC_IDX,0x0C,0); - Ver = rdinx(CRTC_IDX, 0x1F); - wrinx(SEQ_IDX, 0x06, (Ver >> 4) | (Ver << 4)); - if (inp(SEQ_REG) == 0) - { - outp(SEQ_REG, Ver); - if (inp(SEQ_REG) == 1) - { - result = TRUE; - switch (Ver) - { - case 0xEC: - *Chipset = CHIP_CL510; - break; - case 0xCA: - *Chipset = CHIP_CL610; - break; - case 0xEA: - *Chipset = CHIP_CLV7; - break; - default: - Chip_data = Ver; - *Chipset = CHIP_CL_UNKNOWN; - break; - } - } - } - wrinx(SEQ_IDX, 0x06, old1); - wrinx(CRTC_IDX, 0x0C, old); - } - else if (Class == CLASS_54XX) - { - /* - * Cirrus 542x, 543x, 62x5 chips - */ - old = rdinx(SEQ_IDX, 0x06); - wrinx(SEQ_IDX, 0x06, 0x00); - if (rdinx(SEQ_IDX, 0x06) == 0x0F) - { - wrinx(SEQ_IDX, 0x06, 0x12); - if ((rdinx(SEQ_IDX, 0x06) == 0x12) && - (testinx2(SEQ_IDX, 0x1E, 0x3F))) - { - result = TRUE; - Ver = rdinx(CRTC_IDX, 0x27); - if (testinx(GRC_IDX, 0x09)) - { - /* 542x */ - switch ((Ver & 0xFC) >> 2) - { - case 0x06: - *Chipset = CHIP_CLAVGA2; - break; - case 0x22: - switch (Ver & 0x03) - { - case 0x00: - *Chipset=CHIP_CL5402; - break; - case 0x01: - *Chipset=CHIP_CL5402R1; - break; - case 0x02: - *Chipset=CHIP_CL5420; - break; - case 0x03: - *Chipset=CHIP_CL5420R1; - break; - } - break; - case 0x23: - *Chipset = CHIP_CL5422; - break; - case 0x25: - *Chipset = CHIP_CL5424; - break; - case 0x24: - *Chipset = CHIP_CL5426; - break; - case 0x26: - *Chipset = CHIP_CL5428; - break; - case 0x27: - *Chipset = CHIP_CL5429; - break; - case 0x28: - *Chipset = CHIP_CL5430; - break; - case 0x2A: - *Chipset = CHIP_CL5434; - break; - case 0x2B: - *Chipset = CHIP_CL5436; - break; - case 0x2E: - *Chipset = CHIP_CL5446; - break; - case 0x2F: - *Chipset = CHIP_CL5480; - break; - case 0x0A: /* guess */ - *Chipset = CHIP_CL7541; - break; - case 0x0B: - *Chipset = CHIP_CL7542; - break; - case 0x0C: - *Chipset = CHIP_CL7543; - break; - default: - Chip_data = Ver; - *Chipset = CHIP_CL_UNKNOWN; - break; - } - if (*Chipset == CHIP_CL5430 || - *Chipset == CHIP_CL5434 || - *Chipset == CHIP_CL5436 || - *Chipset == CHIP_CL5446 || - *Chipset == CHIP_CL5480) - { - /* - * Make sure that there is - * a sane value in the - * Display Compression - * Control register, which - * may be corrupted by other - * probes. - */ - unsigned char tmp; - tmp = rdinx(GRC_IDX, 0x0F); - wrinx(GRC_IDX, 0x0F, - tmp & 0xc0); - } - } - else if (testinx(SEQ_IDX, 0x19)) - { - /* 62x5 */ - switch ((Ver & 0xC0) >> 6) - { - case 0x00: - *Chipset = CHIP_CL6205; - break; - case 0x01: - *Chipset = CHIP_CL6235; - break; - case 0x02: - *Chipset = CHIP_CL6215; - break; - case 0x03: - *Chipset = CHIP_CL6225; - break; - } - } - else - { - *Chipset = CHIP_CLAVGA2; - } - } - } - wrinx(SEQ_IDX, 0x06, old); - } - else - { - /* - * The Cirrus 64xx chips. - */ - old = rdinx(GRC_IDX, 0x0A); - wrinx(GRC_IDX, 0x0A, 0xCE); - if (rdinx(GRC_IDX, 0x0A) == 0x00) - { - wrinx(GRC_IDX, 0x0A, 0xEC); - if (rdinx(GRC_IDX, 0x0A) == 0x01) - { - result = TRUE; - Ver = rdinx(GRC_IDX, 0xAA); - switch ((Ver & 0xF0) >> 4) - { - case 0x04: - *Chipset = CHIP_CL6440; - break; - case 0x05: - *Chipset = CHIP_CL6412; - break; - case 0x06: - *Chipset = CHIP_CL5410; - break; - case 0x07: - if (testinx2(0x3CE, 0x87, 0x90)) - { - *Chipset = CHIP_CL6420B; - } - else - { - *Chipset = CHIP_CL6420A; - } - break; - case 0x08: - *Chipset = CHIP_CL6410; - break; - default: - Chip_data = Ver; - *Chipset = CHIP_CL_UNKNOWN; - break; - } - } - } - wrinx(GRC_IDX, 0x0A, old); - } - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -static int MemProbe_Cirrus54(Chipset) -int Chipset; -{ - Byte old, SRF; - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock - */ - old = rdinx(SEQ_IDX, 0x06); - wrinx(SEQ_IDX, 0x06, 0x12); - - /* - * Check - */ - switch (Chipset) - { - case CHIP_CL6205: - case CHIP_CL6215: - case CHIP_CL6225: - case CHIP_CL6235: - Mem = 512; - break; - case CHIP_CL5430: - case CHIP_CL5434: - case CHIP_CL5436: - case CHIP_CL5446: - case CHIP_CL5480: - case CHIP_CL7543: - case CHIP_CL7548: - Mem = 512; - SRF = rdinx(SEQ_IDX, 0x0F); - if (SRF & 0x10) - Mem *= 2; - if ((SRF & 0x18) == 0x18) - Mem *= 2; - if (Chipset != CHIP_CL5430 && (SRF & 0x80)) - Mem *= 2; - break; - case CHIP_CL5462: - case CHIP_CL5464: - case CHIP_CL5465: - /* Read BIOS scratch register. */ - Mem = ((rdinx(SEQ_IDX, 0x14) & 0x07) + 1) * 1024; - break; - default: - /* 542x, use BIOS Scratch Register value */ - switch ((rdinx(SEQ_IDX, 0x0A) & 0x18) >> 3) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 1024; - break; - case 0x03: - Mem = 2048; - break; - } - break; - } - - /* - * Lock - */ - wrinx(SEQ_IDX, 0x06, old); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} - -/* ARGSUSED */ -static int MemProbe_Cirrus64(Chipset) -int Chipset; -{ - Byte old; - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock - */ - old = rdinx(GRC_IDX, 0x0A); - wrinx(GRC_IDX, 0x0A, 0xEC); - - /* - * Check - */ - switch (rdinx(GRC_IDX, 0xBB) >> 6) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 768; - break; - case 0x03: - Mem = 1024; - break; - } - - /* - * Lock - */ - wrinx(GRC_IDX, 0x0A, old); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c:3.5 Mon Dec 23 01:31:08 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c Fri Jan 18 15:24:52 2002 @@ -1,158 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c,v 3.5 1996/12/23 06:31:08 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Compaq.c /main/5 1996/02/21 17:09:58 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {GRC_IDX, GRC_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Compaq __STDCARGS((int)); - -Chip_Descriptor Compaq_Descriptor = { - "Compaq", - Probe_Compaq, - Ports, - NUMPORTS, - FALSE, - FALSE, - FALSE, - MemProbe_Compaq, -}; - -Bool Probe_Compaq(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old, ver; - - EnableIOPorts(NUMPORTS, Ports); - - old = rdinx(GRC_IDX, 0x0F); - wrinx(GRC_IDX, 0x0F, 0x00); - if (!testinx(GRC_IDX, 0x45)) - { - wrinx(GRC_IDX, 0x0F, 0x05); - if (testinx(GRC_IDX, 0x45)) - { - result = TRUE; - ver = rdinx(GRC_IDX, 0x0C) >> 3; - switch (ver) - { - case 0x03: - *Chipset = CHIP_CPQ_IVGS; - break; - case 0x05: - *Chipset = CHIP_CPQ_AVGA; - break; - case 0x06: - *Chipset = CHIP_CPQ_Q1024; - break; - case 0x0E: - if (rdinx(GRC_IDX, 0x56) & 0x04) - { - *Chipset = CHIP_CPQ_Q1280; - } - else - { - *Chipset = CHIP_CPQ_Q1024; - } - break; - case 0x10: - *Chipset = CHIP_CPQ_AVGA_P; - break; - default: - Chip_data = ver >> 3; - *Chipset = CHIP_CPQ_UNK; - break; - } - } - } - wrinx(GRC_IDX, 0x0F, old); - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -static int MemProbe_Compaq(Chipset) -int Chipset; -{ - Byte old, temp; - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock. - */ - old = rdinx(GRC_IDX, 0x0F); - wrinx(GRC_IDX, 0x0F, 0x05); - - /* - * Check - */ - switch (Chipset) - { - case CHIP_CPQ_IVGS: - Mem = 256; - break; - case CHIP_CPQ_AVGA: - case CHIP_CPQ_AVGA_P: - Mem = 512; - break; - case CHIP_CPQ_Q1024: - case CHIP_CPQ_Q1280: - temp = rdinx(GRC_IDX, 0x0F); - wrinx(GRC_IDX, 0x0F, 0x05); - switch (rdinx(GRC_IDX, 0x54)) - { - case 0x00: - Mem = 1024; - break; - case 0x02: - Mem = 512; - break; - case 0x04: - Mem = 1024; - break; - case 0x08: - Mem = 2048; - break; - } - wrinx(GRC_IDX, 0x0F, temp); - break; - } - - /* - * Lock - */ - wrinx(GRC_IDX, 0x0F, 0x05); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c:1.2 xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c:1.2 Sat Mar 13 20:21:14 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c Fri Jan 18 15:24:52 2002 @@ -1,91 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c,v 1.2 1999/03/14 01:21:14 dawes Exp $ */ -/* - * (c) Copyright 1998 by Thomas Mueller - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * THOMAS MUELLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Thomas Mueller shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Thomas Mueller. - * - */ - -#include "Probe.h" - -static Word Ports[] = {0x3CD, 0x3DE, 0x3DF, 0x3D0, 0x3D1, 0x3D2, 0x3D3, - ATR_IDX, ATR_REG_R, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Epson __STDCARGS((int)); - -Chip_Descriptor Epson_Descriptor = { - "Epson", - Probe_Epson, - Ports, - NUMPORTS, - FALSE, - FALSE, - FALSE, - MemProbe_Epson, -}; - -Bool Probe_Epson(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old, val; - - EnableIOPorts(NUMPORTS, Ports); - old = inp(0x3de); - outp(0x3de, 0x08); - val = inp(0x3df); - if ((val & 0xe0) == 0xe0) { - outp(0x3de, 0x0f); /* secondary revision code */ - val = inp(0x3df); - - if ((val & 0xf8) == 0xa0) { - *Chipset = CHIP_EPSON_8110; - result = TRUE; - } - } - outp(0x3de, old); - - DisableIOPorts(NUMPORTS, Ports); - return result; -} - - - -static int MemProbe_Epson(Chipset) -int Chipset; -{ - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - outp(0x3de, 3); - if (inp(0x3df) & 0x40) - Mem = 512; - else - Mem = 1024; - - DisableIOPorts(NUMPORTS, Ports); - - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c:3.3 xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c:3.3 Fri Aug 11 13:27:12 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c Fri Jan 18 15:24:52 2002 @@ -1,250 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c,v 3.3 2000/08/11 17:27:12 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by Dirk Hohndel - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Dirk Hohndel shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Dirk Hohndel. - * - */ - -#include "Probe.h" - -#define PCI_EN 0x80000000 - -static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 }; - -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_GLINT __STDCARGS((int)); -static int GLINTMem = 0; - -Chip_Descriptor GLINT_Descriptor = { - "GLINT", - Probe_GLINT, - Ports, - NUMPORTS, - FALSE, - FALSE, - FALSE, - MemProbe_GLINT, -}; - -Bool Probe_GLINT(Chipset) -int *Chipset; -{ - int chipset_passed; - int i = -1; - Bool result = FALSE; - struct pci_config_reg * pcip; - unsigned long glint300sx = 0; - unsigned long glint500tx = 0; - unsigned long glintdelta = 0; - unsigned long glintcopro = 0; - unsigned long basecopro; - unsigned long base3copro; - unsigned long basedelta; - unsigned long *delta_pci_basep; - unsigned long cmd; - unsigned long lbsize; - - /* - * to be able to detect multiple GLINT chips we need to set - * *Chipset to 0 first. We'll set it back to the value passed to - * us if nothing was found - */ - chipset_passed = *Chipset; - *Chipset = 0; - /* - * we only check for the GLINT in the PCI config data that we have - */ - while (pci_devp[++i] != NULL) - { - pcip = pci_devp[i]; - if (pcip->_vendor == PCI_VENDOR_3DLABS && pcip->_status_command & 7) - { - switch (pcip->_device) - { - case PCI_CHIP_3DLABS_300SX: - *Chipset |= CHIP_300SX; - glint300sx = PCI_EN | - (pcip->_pcibuses[pcip->_pcibusidx] << 16) | - (pcip->_cardnum << 11) | (pcip->_funcnum << 8); - result = TRUE; - break; - case PCI_CHIP_3DLABS_500TX: - *Chipset |= CHIP_500TX; - glint500tx = PCI_EN | - (pcip->_pcibuses[pcip->_pcibusidx] << 16) | - (pcip->_cardnum << 11) | (pcip->_funcnum << 8); - result = TRUE; - break; - case PCI_CHIP_3DLABS_DELTA: - *Chipset |= CHIP_DELTA; - glintdelta = PCI_EN | - (pcip->_pcibuses[pcip->_pcibusidx] << 16) | - (pcip->_cardnum << 11) | (pcip->_funcnum << 8); - delta_pci_basep = &(pcip->_base0); - result = TRUE; - break; - } - } - } - if (!result) - { - *Chipset = chipset_passed; - goto Probe_GLINT_exit; - } - /* - * due to a few bugs in the GLINT Delta we might have to relocate - * the base address of config region of the Delta, if bit 17 of - * the base addresses of config region of the Delta and the 500TX - * or 300SX are different - * We only handle config type 1 at this point - */ - if( glintdelta && (glint500tx || glint300sx) ) - { - if( glint500tx && glint300sx ) - { - /* - * can't handle if both of them are present - */ - goto Probe_GLINT_exit; - } - glintcopro = glint500tx | glint300sx; - - outpl(PCI_MODE1_ADDRESS_REG, glintcopro | 0x10); /* base0 */ - basecopro = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, glintdelta | 0x10); - basedelta = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, glintcopro | 0x1c); /* base3 */ - base3copro = inpl(PCI_MODE1_DATA_REG); - /* - * while we're at it, we can figure out the RAM size as well - */ - /* - * this number seems to be wrong, it shows 16MB on my board - * even though there are definitely just 8MB - * ignore it for now - */ -#if 0 - outpl(PCI_MODE1_DATA_REG,0xffffffff); - lbsize = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_DATA_REG,base3copro); - lbsize &= 0xfffffff0; - lbsize ^= 0xffffffff; - lbsize++; -#endif - if( (basedelta & 0x20000) ^ (basecopro & 0x20000) ) - { - /* - * if the base addresses are different at bit 17, - * we have to remap the base0 for the delta; - * as wrong as this looks, we can use the base3 of the - * 300SX/500TX for this. The delta is working as a bridge - * here and gives its own addresses preference. And we - * don't need to access base3, as this one is the bytw - * swapped local buffer which we don't need. - * Using base3 we know that the space is - * a) large enough - * b) free (well, almost) - */ - if( (basecopro & 0x20000) ^ (base3copro & 0x20000) ) - { - /* - * oops, still different; we know that base3 is at least - * 1 MB, so we just take 128k offset into it - */ - base3copro += 0x20000; - } - outpl(PCI_MODE1_ADDRESS_REG, glintdelta | 0x10); - outpl(PCI_MODE1_DATA_REG,base3copro); - /* - * now update our internal structure accordingly - */ - *delta_pci_basep = base3copro; - } - /* - * now make sure that memory space access is enabled on - * both chips - */ - outpl(PCI_MODE1_ADDRESS_REG, glintcopro | 0x04);/* command */ - cmd = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, glintcopro | 0x04); - outpl(PCI_MODE1_DATA_REG,cmd | 2); - outpl(PCI_MODE1_ADDRESS_REG, glintdelta | 0x04); - cmd = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, glintdelta | 0x04); - outpl(PCI_MODE1_DATA_REG,cmd | 2); - } - -Probe_GLINT_exit: - - return(result); -} - -static int MemProbe_GLINT(Chipset) -int Chipset; -{ - int mem; - unsigned int FBMemoryCtl,LBMemoryCtl; - Byte * config; - Bool found = FALSE; - int i = -1; - int j; - - while ((pci_devp[++i] != NULL) && !found) - { - if (pci_devp[i]->_vendor == PCI_VENDOR_3DLABS && pci_devp[i]->_status_command & 7) - { - /* - * ignore the Delta chip and use one of the real - * copros for the memory check - */ - switch (pci_devp[i]->_device) - { - case PCI_CHIP_3DLABS_300SX: - case PCI_CHIP_3DLABS_500TX: - case PCI_CHIP_3DLABS_DELTA: - config = MapMem(pci_devp[i]->_base0,0x2000L); - if (config == 0) - break; -#ifdef DEBUGPCI - printf("\npci bus 0x%x cardnum 0x%02x function 0x%02x, vendor 0x%04x device 0x%04x\n", - pci_devp[i]->_pcibuses[pci_devp[i]->_pcibusidx], - pci_devp[i]->_cardnum, pci_devp[i]->_funcnum, - pci_devp[i]->_vendor, pci_devp[i]->_device); - printf("mapped base0 from 0x%08x to 0x%08x\n\n", - pci_devp[i]->_base0, config); -#endif - LBMemoryCtl = *(int*)&config[0x1000]; - FBMemoryCtl = *(int*)&config[0x1800]; - mem = 1024 * (1 << ((LBMemoryCtl & 0x07000000) >> 24)); - mem <<= 16; - mem |= 1024 * (1 << ((FBMemoryCtl & 0xe0000000)>> 29)); - UnMapMem(config,0x2000L); - found = TRUE; - break; - } - } - } - return(mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c:3.4 Mon Dec 23 01:31:09 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c Fri Jan 18 15:24:52 2002 @@ -1,108 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c,v 3.4 1996/12/23 06:31:09 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Genoa.c /main/5 1996/02/21 17:10:03 kaleb $ */ - -#include "Probe.h" - -static int MemProbe_Genoa __STDCARGS((int)); - -Chip_Descriptor Genoa_Descriptor = { - "Genoa", - Probe_Genoa, - NULL, - 0, - FALSE, - TRUE, - TRUE, - MemProbe_Genoa, -}; - -Bool Probe_Genoa(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte addr, data[4]; - - if (ReadBIOS(0x37, &addr, 1) != 1) - { - fprintf(stderr, "%s: Failed to read Genoa BIOS address.\n", - MyName); - return(FALSE); - } - if (ReadBIOS((unsigned)addr, data, 4) != 4) - { - fprintf(stderr, "%s: Failed to read Genoa BIOS signature.\n", - MyName); - return(FALSE); - } - if ((data[0] == 0x77) && (data[2] == 0x99) && (data[3] == 0x66)) - { - /* - * Genoa also has ET3000 and (possibly) ET4000 based - * boards that match this signature. We only match - * the ones with Genoa chips, and let other probe - * functions deal with other chipsets. - */ - switch (data[1]) - { - case 0x00: - *Chipset = CHIP_G_6200; - result = TRUE; - break; - case 0x11: - *Chipset = CHIP_G_6400; - result = TRUE; - break; - case 0x22: - *Chipset = CHIP_G_6100; - result = TRUE; - break; - } - } - return(result); -} - -static int MemProbe_Genoa(Chipset) -int Chipset; -{ - int Mem = 0; - - switch (Chipset) - { - case CHIP_G_6100: - case CHIP_G_6200: - Mem = 256; - break; - case CHIP_G_6400: - Mem = 512; - break; - } - - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c:3.4 Mon Dec 23 01:31:10 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c Fri Jan 18 15:24:52 2002 @@ -1,85 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c,v 3.4 1996/12/23 06:31:10 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: HMC.c /main/5 1996/02/21 17:10:11 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_HMC __STDCARGS((int)); - -Chip_Descriptor HMC_Descriptor = { - "HMC", - Probe_HMC, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_HMC, -}; - -Bool Probe_HMC(Chipset) -int *Chipset; -{ - Bool result = FALSE; - - EnableIOPorts(NUMPORTS, Ports); - - if (testinx(SEQ_IDX, 0xE7) && testinx(SEQ_IDX, 0xEE)) - { - result = TRUE; - *Chipset = CHIP_HM86304; - } - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -/* ARGSUSED */ -static int MemProbe_HMC(Chipset) -int Chipset; -{ - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - if (rdinx(SEQ_IDX, 0xE7) & 0x10) - { - Mem = 512; - } - else - { - Mem = 256; - } - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c:3.4 Mon Dec 23 01:31:11 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c Fri Jan 18 15:24:52 2002 @@ -1,75 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c,v 3.4 1996/12/23 06:31:11 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Herc.c /main/5 1996/02/21 17:10:16 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x3BA}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -#define DSP_VSYNC_MASK 0x80 -#define DSP_ID_MASK 0x70 - -Bool Probe_Herc(Chipset) -int *Chipset; -{ - Bool result = FALSE; - int i, cnt = 0; - Byte dsp, dsp_old; - - EnableIOPorts(NUMPORTS, Ports); - dsp_old = inp(0x3BA) & DSP_VSYNC_MASK; - for (i = 0; i < 0x10000; i++) - { - dsp = inp(0x3BA) & DSP_VSYNC_MASK; - if (dsp != dsp_old) - cnt++; - dsp_old = dsp; - } - - /* If there are active sync changes, we found a Hercules board. */ - if (cnt) - { - dsp = inp(0x3BA) & DSP_ID_MASK; - switch(dsp) - { - case 0x10: - *Chipset = CHIP_HERC_PLUS; - break; - case 0x50: - *Chipset = CHIP_HERC_COL; - break; - default: - *Chipset = CHIP_HERC_STD; - } - result = TRUE; - } - DisableIOPorts(NUMPORTS, Ports); - return(result); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c:3.9 xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c:3.9 Fri Aug 11 13:27:12 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c Fri Jan 18 15:24:52 2002 @@ -1,202 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c,v 3.9 2000/08/11 17:27:12 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by Robin Cutshaw - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Robin Cutshaw shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Robin Cutshaw. - * - */ - -/* $XConsortium: I128.c /main/6 1996/10/19 17:46:43 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 }; - -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -#define PCI_EN 0x80000000 - -static int MemProbe_I128 __STDCARGS((int)); -static int I128Mem = 0; - -Chip_Descriptor I128_Descriptor = { - "I128", - Probe_I128, - Ports, - NUMPORTS, - FALSE, - FALSE, - FALSE, - MemProbe_I128, -}; - -Bool Probe_I128(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Word ioaddr, vendor, device, iobase; - Long id, vendordevice, tmplong1, tmplong2, pcibus, cardnum; - Byte tmp1, tmp2, configtype = 0; - - EnableIOPorts(2, Ports); - - outp(PCI_MODE2_ENABLE_REG, 0x00); - outp(PCI_MODE2_FORWARD_REG, 0x00); - tmp1 = inp(PCI_MODE2_ENABLE_REG); - tmp2 = inp(PCI_MODE2_FORWARD_REG); - if ((tmp1 == 0x00) && (tmp2 == 0x00)) - configtype = 2; - else { - tmplong1 = inpl(PCI_MODE1_ADDRESS_REG); - outpl(PCI_MODE1_ADDRESS_REG, PCI_EN); - tmplong2 = inpl(PCI_MODE1_ADDRESS_REG); - if (tmplong2 == PCI_EN); - configtype = 1; - outpl(PCI_MODE1_ADDRESS_REG, tmplong1); - } - - DisableIOPorts(2, Ports); - - if (configtype == 0) - return(FALSE); - else if (configtype == 1) { - EnableIOPorts(3, Ports); - for (pcibus = 0x000000; pcibus < 0x100000; pcibus += 0x10000) { - for (cardnum = 0x00000; cardnum < 0x10000; cardnum += 0x0800) { - outpl(PCI_MODE1_ADDRESS_REG, PCI_EN | pcibus | cardnum); - tmplong1 = inpl(PCI_MODE1_DATA_REG); - vendor = (unsigned short )(tmplong1 & 0xFFFF); - device = (unsigned short )((tmplong1 >> 16) & 0xFFFF); -#ifdef DEBUG - printf("pci bus/card 0x%08x, vendor 0x%04x device 0x%04x\n", - pcibus | cardnum, vendor, device); -#endif - if ((vendor == 0x105D) && - ((device == 0x2309) || (device == 0x2339) || - (device == 0x493D) || (device == 0x5348))) { - outpl(PCI_MODE1_ADDRESS_REG, PCI_EN | pcibus | cardnum | 0x24); - iobase = inpl(PCI_MODE1_DATA_REG) & 0xFFFFFF00; - - DisableIOPorts(3, Ports); - Ports[3] = iobase + 0x18; - EnableIOPorts(4, Ports); - - id = inpl(iobase + 0x18); - DisableIOPorts(4, Ports); - - switch (id & 0xC0) { - case 0x00: - I128Mem = 4096; - break; - case 0x40: - I128Mem = 8192; - break; - case 0x80: - I128Mem = 16384; - break; - case 0xC0: - I128Mem = 32768; - break; - } - - *Chipset = CHIP_I128; - return(TRUE); - } - } - } - /* not found */ - DisableIOPorts(3, Ports); - return(FALSE); - } - - /* else configtype == 2 */ - - EnableIOPorts(2, Ports); - outp(PCI_MODE2_ENABLE_REG, 0x80); - outp(PCI_MODE2_FORWARD_REG, 0x00); - DisableIOPorts(2, Ports); - - for (ioaddr = 0xC000; ioaddr < 0xD000; ioaddr += 0x0100) { - Ports[2] = ioaddr; - Ports[3] = ioaddr + 0x24; - EnableIOPorts(NUMPORTS, Ports); - - vendordevice = inpl(ioaddr); - vendor = (unsigned short )(vendordevice & 0xFFFF); - device = (unsigned short )((vendordevice >> 16) & 0xFFFF); - -#ifdef DEBUG - printf("pci slot at 0x%04x, vendor 0x%04x device 0x%04x\n", - ioaddr, vendor, device); -#endif - - if ((vendor != 0x105D) || - ((device != 0x2309) && (device != 0x2339) && - (device != 0x493D) && (device != 0x5348))) { - DisableIOPorts(NUMPORTS, Ports); - continue; - } - - iobase = inpl(ioaddr + 0x24) & 0xFFFFFF00; - - DisableIOPorts(NUMPORTS, Ports); - Ports[2] = iobase + 0x18; - Ports[3] = 0x000; - EnableIOPorts(NUMPORTS, Ports); - - id = inpl(iobase + 0x18) & 0x7FFFFFFF; - switch (id & 0xC0) { - case 0x00: - I128Mem = 4096; - break; - case 0x40: - I128Mem = 8192; - break; - case 0x80: - I128Mem = 16384; - break; - case 0xC0: - I128Mem = 32768; - break; - } - - *Chipset = CHIP_I128; - result = TRUE; - DisableIOPorts(NUMPORTS, Ports); - Ports[3] = 0x0000; - break; - } - - Ports[2] = Ports[3] = 0x0000; - EnableIOPorts(NUMPORTS, Ports); - outp(PCI_MODE2_ENABLE_REG, 0x00); - DisableIOPorts(NUMPORTS, Ports); - - return(result); -} - -static int MemProbe_I128(Chipset) -int Chipset; -{ - return(I128Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile:3.37 xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile:3.37 Tue Nov 28 15:59:16 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile Fri Jan 18 15:24:52 2002 @@ -1,127 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/14 1996/10/27 11:03:56 kaleb $ - - - - - -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile,v 3.37 2000/11/28 20:59:16 dawes Exp $ - -#if (defined(SVR3Architecture) || defined(SVR4Architecture) || defined(SCOArchitecture)) && !defined(DguxArchitecture) -# define OSModule OS_SYSV -#endif - -#if defined(MetroLink) && defined(NCR) -#undef NCR -#endif - -#if defined(SVR4Architecture) -# include -#endif - -#if defined(DguxArchitecture) -# define OSModule OS_DGUX -#endif - -#if defined(QNXArchitecture) -# define OSModule OS_QNX - CCOPTIONS = -T1 -#endif - -#if defined(QNX4Architecture) -# define OSModule OS_QNX4 - CCOPTIONS = -T1 -#endif - -#if defined(NTOArchitecture) -# define OSModule OS_NTO -#endif - -#if defined(SVR4Architecture) && defined(SunArchitecture) && !HasGcc - OS_IO_SRC = SolX86IO.s - OS_IO_OBJ = SolX86IO.o -#endif -#if defined(LinuxArchitecture) -# define OSModule OS_Linux -#if defined(AlphaArchitecture) && !UseElfFormat /* fix/replacement for broken libc-0.43 io.c */ - OS_IO_SRC = glibcAxpIo.c - OS_IO_OBJ = glibcAxpIo.o -#endif -#endif -#if defined(LynxOSArchitecture) -# define OSModule OS_LynxOS -#endif -#if defined(i386BsdArchitecture) -# define OSModule OS_386BSD -#endif -#if defined(AlphaBsdArchitecture) -# define OSModule OS_386BSD - SYS_LIBRARIES = -lio -#endif -#if defined(MinixArchitecture) -# define OSModule OS_Minix -#endif -#if defined(i386MachArchitecture) -#if defined(GNUMachArchitecture) - SYS_LIBRARIES = -# define OSModule OS_GNUmach -#else - SYS_LIBRARIES = /usr/lib/libmach.a -# define OSModule OS_Mach -#endif -#endif - -#if defined(cygwinArchitecture) -#define OSModule OS_cygwin -#endif - -#if defined(OS2Architecture) -# define OSModule OS_Os2 - CCOPTIONS = -Zmts -#endif -#if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \ - && ((OSMajorVersion == 1 && OSMinorVersion >= 1) || OSMajorVersion >= 2) - IOPERMDEFINES = -DUSE_I386_IOPL - SYS_LIBRARIES = -li386 -#endif -OS_SRC = OSModule.c $(OS_IO_SRC) -OS_OBJ = OSModule.o $(OS_IO_OBJ) -BASE_SRC = MDA.c Herc.c CGA.c VGA.c RamDac.c MemProbe.c PCI.c -BASE_OBJ = MDA.o Herc.o CGA.o VGA.o RamDac.o MemProbe.o PCI.o -SVGA_SRC = Tseng.c WD.c ChipsTech.c Video7.c Genoa.c Trident.c Oak.c \ - Cirrus.c Ahead.c ATI.c S3.c AL.c Yamaha.c NCR.c MX.c \ - RealTek.c Primus.c Compaq.c HMC.c UMC.c Weitek.c SiS.c \ - ARK.c Alliance.c Matrox.c SigmaDesigns.c Intergraphics.c \ - Epson.c Rendition.c SiliconMotion.c -SVGA_OBJ = Tseng.o WD.o ChipsTech.o Video7.o Genoa.o Trident.o Oak.o \ - Cirrus.o Ahead.o ATI.o S3.o AL.o Yamaha.o NCR.o MX.o \ - RealTek.o Primus.o Compaq.o HMC.o UMC.o Weitek.o SiS.o \ - ARK.o Alliance.o Matrox.o SigmaDesigns.o Intergraphics.o \ - Epson.o Rendition.o SiliconMotion.o -COPROC_SRC = 8514.c ATIMach.c I128.c GLINT.c -COPROC_OBJ = 8514.o ATIMach.o I128.o GLINT.o -SRCS = Main.c $(SVGA_SRC) $(COPROC_SRC) $(BASE_SRC) Print.c Utils.c $(OS_SRC) -OBJS = Main.o $(SVGA_OBJ) $(COPROC_OBJ) $(BASE_OBJ) Print.o Utils.o $(OS_OBJ) - -#ifdef GccGasOption -GASDEFINES = GccGasOption -#endif -CONSDEFINES = XFree86ConsoleDefines - -#ifdef OS2Architecture -SPECIALS= sprobe.def -#endif - -DEFINES = $(GASDEFINES) $(CONSDEFINES) $(IOPERMDEFINES) - -PROG = SuperProbe - -AllTarget(ProgramTargetName($(PROG))) -NormalProgramTarget($(PROG),$(OBJS),NullParameter,$(SPECIALS),NullParameter) -InstallProgram($(PROG),$(BINDIR)) -InstallManPage($(PROG),$(MANDIR)) - -#if defined(LinuxArchitecture) && defined(AlphaArchitecture) && !UseElfFormat -LinkSourceFile(glibcAxpIo.c,../common_hw) -#endif - -DependTarget() Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c:1.3 xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c:1.3 Fri Nov 19 08:54:14 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c Fri Jan 18 15:24:52 2002 @@ -1,83 +0,0 @@ -/* - * (c) Copyright 1997 Harald Koenig - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * HARALD KEONIG BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Harald Koenig shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Harald Koenig. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c,v 1.3 1999/11/19 13:54:14 hohndel Exp $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, }; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Intergraphics __STDCARGS((int)); - -Chip_Descriptor Intergraphics_Descriptor = { - "Intergraphics", - Probe_Intergraphics, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - NULL, -}; - -Bool Probe_Intergraphics(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte chip, old, old1, val; - int i = 0; - - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_INTERGRAPHICS && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_INTERG_1680: - *Chipset = CHIP_IG_1680; - break; - case PCI_CHIP_INTERG_1682: - *Chipset = CHIP_IG_1682; - break; - default: - Chip_data = chip; - *Chipset = CHIP_IG_UNK; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - return(FALSE); -} - - Index: xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c:3.4 Mon Dec 23 01:31:14 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c Fri Jan 18 15:24:53 2002 @@ -1,57 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c,v 3.4 1996/12/23 06:31:14 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: MDA.c /main/5 1996/02/21 17:10:32 kaleb $ */ - -#include "Probe.h" - -/* - * Assume that the CRT Controller is at 0x3B4 (either no other adapter, - * or an EGA/CGA is installed in Color mode). Look for the cursor - * postition register. - */ -static Word Ports[] = {0x3B4, 0x3B5}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -Bool Probe_MDA(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte tmp; - - EnableIOPorts(NUMPORTS, Ports); - tmp = rdinx(0x3B4, 0x0F); - if (testinx(0x3B4, 0x0F)) - { - result = TRUE; - *Chipset = CHIP_MDA; - } - wrinx(0x3B4, 0x0F, tmp); - DisableIOPorts(NUMPORTS, Ports); - return(result); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c:3.4 Mon Dec 23 01:31:15 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c Fri Jan 18 15:24:53 2002 @@ -1,119 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c,v 3.4 1996/12/23 06:31:15 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: MX.c /main/5 1996/02/21 17:10:36 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {SEQ_REG, SEQ_IDX}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_MX __STDCARGS((int)); - -Chip_Descriptor MX_Descriptor = { - "MX", - Probe_MX, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_MX, -}; - -Bool Probe_MX(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old; - - EnableIOPorts(NUMPORTS, Ports); - - old = rdinx(SEQ_IDX, 0xA7); - wrinx(SEQ_IDX, 0xA7, 0x00); - if (!testinx(SEQ_IDX, 0xC5)) - { - wrinx(SEQ_IDX, 0xA7, 0x87); - if (testinx(SEQ_IDX, 0xC5)) - { - result = TRUE; - if ((rdinx(SEQ_IDX, 0x26) & 0x01) == 0) - { - *Chipset = CHIP_MX68010; - } - else - { - *Chipset = CHIP_MX68000; - } - } - } - wrinx(SEQ_IDX, 0xA7, old); - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -/* ARGSUSED */ -static int MemProbe_MX(Chipset) -int Chipset; -{ - Byte old; - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock - */ - old = rdinx(SEQ_IDX, 0xA7); - wrinx(SEQ_IDX, 0xA7, 0x87); - - /* - * Check - */ - switch ((rdinx(SEQ_IDX, 0xC2) >> 2) & 0x03) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 1024; - break; - } - - /* - * Lock - */ - wrinx(SEQ_IDX, 0xA7, old); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c:3.30 xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c:3.30 Tue Nov 28 15:59:16 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c Fri Jan 18 15:24:53 2002 @@ -1,930 +0,0 @@ -/* $XConsortium: Main.c /main/11 1996/10/25 11:33:16 kaleb $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * (c) Copyright 1994-1998 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 - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holders shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * the copyright holders. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c,v 3.30 2000/11/28 20:59:16 dawes Exp $ */ - -#include "Probe.h" -#include "PatchLevel.h" - -char MyName[20]; -Word vgaIOBase; -Bool Verbose = FALSE; -Long Chip_data = (Long)~0; -Byte *Bios_Base = (Byte *)0; -Bool NoBIOS = FALSE; -Bool NoPCI = FALSE; -Bool PCIProbed = FALSE; -struct pci_config_reg *pcrp; - -static Bool No16Bits = FALSE; -static Bool Exclusions = FALSE; -static Bool Mask10 = FALSE; -static Range *Excl_List = NULL; -static char *NoProbe = (char *)0; - -static char *StdStuff = "MDA, Hercules, CGA, MCGA, EGA, VGA"; - -static Chip_Descriptor *SVGA_Descriptors[] = { - &WD_Descriptor, - &Video7_Descriptor, - &MX_Descriptor, - &Genoa_Descriptor, - &UMC_Descriptor, - &Trident_Descriptor, - &SiS_Descriptor, - &Matrox_Descriptor, - &ATI_Descriptor, - &Ahead_Descriptor, - &NCR_Descriptor, - &S3_Descriptor, - &AL_Descriptor, - &Cirrus54_Descriptor, - &Cirrus64_Descriptor, - &Epson_Descriptor, /* is detected as Tseng (has 0x3cd as Segment too) */ - &Tseng_Descriptor, - &RealTek_Descriptor, - &Rendition_Descriptor, - &Primus_Descriptor, - &Yamaha_Descriptor, - &Oak_Descriptor, - &Cirrus_Descriptor, - &Compaq_Descriptor, - &HMC_Descriptor, - &Weitek_Descriptor, - &ARK_Descriptor, - &Alliance_Descriptor, - &SigmaDesigns_Descriptor, - &Intergraphics_Descriptor, - &SiliconMotion_Descriptor, - &CT_Descriptor, /* I think this is screwing people up, so put it last */ - NULL -}; - -static Chip_Descriptor *CoProc_Descriptors[] = { - &ATIMach_Descriptor, - &IBM8514_Descriptor, /* Make this the last 8514-type entry */ - &I128_Descriptor, - &GLINT_Descriptor, - NULL -}; - -static int num_tokens __STDCARGS((char *, char)); -static void ParseExclusionList __STDCARGS((Range *, char *)); -static Bool TestChip __STDCARGS((Chip_Descriptor *, int *)); -static void PrintInfo __STDCARGS((void)); -static Byte *FindBios __STDCARGS((void)); - -#ifdef __STDC__ -static int num_tokens(char *list, char delim) -#else -static int num_tokens(list, delim) -char *list; -char delim; -#endif -{ - char *p = list; - int cnt = 1; - - while ((p = strchr(p, delim)) != NULL) - { - p++; - cnt++; - } - return(cnt); -} - -static void ParseExclusionList(excl_list, list) -Range *excl_list; -char *list; -{ - char *p = list, *p1, c; - Bool done = FALSE, lo = TRUE; - int i = 0; - - while (!done) - { - p1 = strpbrk(p, "-,"); - if (p1) - { - c = *p1; - *p1 = '\0'; - if ((c == '-') && (p == p1)) - { - fprintf(stderr, "%s: Unbounded range in exclusion\n", MyName); - exit(1); - } - else if (p == p1) - { - p++; - continue; - } - } - else - { - if ((!lo) && (p == p1)) - { - fprintf(stderr, "%s: Unbounded range in exclusion\n", MyName); - exit(1); - } - done = TRUE; - } - if (lo) - { - excl_list[i].lo = (Word)StrToUL(p); - } - else - { - excl_list[i].hi = (Word)StrToUL(p); - } - if (!done) - { - if (c == '-') - { - lo = FALSE; - } - else - { - if (lo) - { - excl_list[i].hi = (Word)-1; - } - else - { - lo = TRUE; - } - i++; - } - p = p1 + 1; - } - else - { - if (lo) - { - excl_list[i].hi = (Word)-1; - } - i++; - } - } - excl_list[i].lo = (Word)-1; -} - -static Bool TestChip(chip_p, Chipset) -Chip_Descriptor *chip_p; -int *Chipset; -{ - char *p, *p1, name[64]; - - if ((No16Bits) && (chip_p->bit16)) - { - if (Verbose) - { - printf("\tSkipping %s (16-bit registers)...\n", chip_p->name); - fflush(stdout); - } - return(FALSE); - } - if ((NoBIOS) && (chip_p->uses_bios)) - { - if (Verbose) - { - printf("\tSkipping %s (needs BIOS read)...\n", chip_p->name); - fflush(stdout); - } - return(FALSE); - } - if ((Exclusions) && (Excluded(Excl_List, chip_p, Mask10))) - { - if (Verbose) - { - printf("\tskipping %s (exclusion list)...\n", chip_p->name); - fflush(stdout); - } - return(FALSE); - } - if (NoProbe != (char *)0) - { - p1 = p = NoProbe; - while (p) - { - p1 = strchr(p1, ','); - if (p1 != NULL) - { - (void)strncpy(name, p, (p1-p) > sizeof(name) ? sizeof(name) : (p1-p)); - name[sizeof(name)] = '\0'; - p1++; - } - else - { - (void)strncpy(name, p, sizeof(name) - 1); - name[sizeof(name) - 1] = '\0'; - } - if (StrCaseCmp(name, chip_p->name) == 0) - { - if (Verbose) - { - printf("\tskipping %s (noprobe list)...\n", chip_p->name); - fflush(stdout); - } - return(FALSE); - } - p = p1; - } - } - if (Verbose) - { - printf("\tProbing %s...\n", chip_p->name); - fflush(stdout); - } - if (chip_p->f(Chipset)) - { - return(TRUE); - } - return(FALSE); -} - -static void PrintInfo() -{ - Chip_Descriptor *chip_p; - int i, len; - - PRINT_VERSION; - putchar('\n'); - printf("%s can detect the following standard video hardware:\n", MyName); - printf("\t%s\n", StdStuff); - printf("%s can detect the following SVGA chipsets/vendors:\n", MyName); - len = 0; - putchar('\t'); - for (i=0; SVGA_Descriptors[i] != NULL; i++) - { - chip_p = SVGA_Descriptors[i]; - len += strlen(chip_p->name) + 2; - if (len > 70) - { - printf("\n\t"); - len = strlen(chip_p->name) + 2; - } - printf("%s, ", chip_p->name); - } - putchar('\n'); - printf("%s can detect the following graphics coprocessors/vendors:\n", - MyName); - len = 0; - putchar('\t'); - for (i=0; CoProc_Descriptors[i] != NULL; i++) - { - chip_p = CoProc_Descriptors[i]; - len += strlen(chip_p->name) + 2; - if (len > 70) - { - printf("\n\t"); - len = strlen(chip_p->name) + 2; - } - printf("%s, ", chip_p->name); - } - putchar('\n'); - printf("%s can detect the following RAMDACs:\n", MyName); - len = 0; - putchar('\t'); - for (i=0; i < DAC_MAX; i++) - { - len += strlen(RamDac_Names[i+1].Short) + 2; - if (len > 70) - { - printf("\n\t"); - len = strlen(RamDac_Names[i+1].Short) + 2; - } - printf("%s, ", RamDac_Names[i+1].Short); - } - putchar('\n'); -} - -static Byte *FindBios() -{ - int i, score[7]; - Byte buf[3]; - Byte *base = (Byte *)0; - - for (i=0; i < 7; i++) - { - score[i] = 1; - } - for (i=0; i < 7; i++) - { - buf[0] = buf[1] = buf[2] = (Byte)0; - if (ReadBIOS((unsigned)(0xC0000+(i<<15)), buf, 3) != 3) - { - score[i] = 0; - } - else if ((buf[0] != 0x55) || (buf[1] != 0xAA) || (buf[2] < 48)) - { - score[i] = 0; - } - } - for (i=6; i >= 0; i--) - { - if (score[i] != 0) - { - base = (Byte *)(unsigned long)(0x0C0000+(i<<15)); - } - } - return(base); -} - -int main(argc, argv) -int argc; -char *argv[]; -{ - char *p, *order = NULL; - Byte copyright[5]; - Word Ports[10]; /* For whatever we need */ - int Primary = -1; - int Secondary = -1; - int RamDac = -1; - int CoProc = -1; - int MemVGA = -1; - int MemCoProc = -1; - int i, cnt; - Chip_Descriptor *chip_p, *matched; - Bool Probe_DAC = TRUE; - Bool Probe_Mem = TRUE; - Bool NoEGA = FALSE; - Bool PCIVGA = FALSE; - Bool Check_CoProc; - Bool flag; - - p = strrchr(argv[0], '/'); - if (p == NULL) - p = argv[0]; - else - p++; - (void)strncpy(MyName, p, sizeof(MyName) - 1); - MyName[sizeof(MyName)-1] = '\0'; - - for (i=1; i < argc; i++) - { - if (strncmp(argv[i], "-v", 2) == 0) - { - Verbose = TRUE; - continue; - } - else if (strncmp(argv[i], "-no16", 5) == 0) - { - No16Bits = TRUE; - continue; - } - else if ((strncmp(argv[i], "-excl", 5) == 0) || - (strncmp(argv[i], "-x", 2) == 0)) - { - if (Excl_List != NULL) - { - fprintf(stderr, - "%s: Warning - only one exclusion list allowed. ", - MyName); - fprintf(stderr, " The last one will be used\n"); - } - i++; - if (i == argc) - { - fprintf(stderr, "%s: Exclusion list not specified\n", MyName); - return(1); - } - cnt = num_tokens(argv[i], ','); - Excl_List = (Range *)calloc(cnt+1, sizeof(Range)); - ParseExclusionList(Excl_List, argv[i]); - Exclusions = TRUE; - continue; - } - else if ((strncmp(argv[i], "-mask10", 7) == 0) || - (strncmp(argv[i], "-msk10", 6) == 0) || - (strncmp(argv[i], "-10", 3) == 0)) - { - Mask10 = TRUE; - } - else if (strncmp(argv[i], "-o", 2) == 0) - { - if (order != NULL) - { - fprintf(stderr, - "%s: Warning - only one order list allowed. ", - MyName); - fprintf(stderr, " The last one will be used\n"); - } - i++; - if (i == argc) - { - fprintf(stderr, "%s: Order list not specified\n", MyName); - return(1); - } - order = argv[i]; - } - else if (strncmp(argv[i], "-nopr", 5) == 0) - { - if (NoProbe != NULL) - { - fprintf(stderr, - "%s: Warning - only one noprobe list allowed. ", - MyName); - fprintf(stderr, " The last one will be used\n"); - } - i++; - if (i == argc) - { - fprintf(stderr, "%s: noprobe list not specified\n", MyName); - return(1); - } - NoProbe = argv[i]; - } - else if (strncmp(argv[i], "-bios", 5) == 0) - { - i++; - if (i == argc) - { - fprintf(stderr, "%s: BIOS base address not specified\n", - MyName); - return(1); - } - Bios_Base = (Byte *)StrToUL(argv[i]); - } - else if (strncmp(argv[i], "-no_pci", 7) == 0) - { - NoPCI = TRUE; - } - else if (strncmp(argv[i], "-no_bios", 8) == 0) - { - NoBIOS = TRUE; - } - else if (strncmp(argv[i], "-no_dac", 7) == 0) - { - Probe_DAC = FALSE; - } - else if (strncmp(argv[i], "-no_mem", 7) == 0) - { - Probe_Mem = FALSE; - } - else if (strncmp(argv[i], "-in", 3) == 0) - { - PrintInfo(); - return(0); - } - else if ((strncmp(argv[i], "-?", 2) == 0) || - (strncmp(argv[i], "-h", 2) == 0)) - { - PRINT_VERSION; - printf("\n%s accepts the following options:\n", MyName); - printf("\t-verbose\tGive lots of information\n"); - printf("\t-no16\t\tSkip any test that requires 16-bit ports\n"); - printf("\t-excl list\tSkip any test that requires port on list\n"); - printf("\t-mask10\t\tMask registers to 10 bits before comparing\n"); - printf("\t\t\twith the exclusion list\n"); - printf("\t-order list\tPerform test on the specified chipsets\n"); - printf("\t\t\tin the specified order\n"); - printf("\t-noprobe list\tDon't probe for any chipsets specified\n"); - printf("\t-bios base\tSet BIOS base address to 'base'\n"); - printf("\t-no_bios\tDon't read BIOS & assume EGA/VGA as primary\n"); - printf("\t-no_dac\t\tDon't probe for RAMDAC type\n"); - printf("\t-no_mem\t\tDon't probe for video memory\n"); - printf("\t-no_pci\t\tDon't probe the PCI bus\n"); - printf("\t-info\t\tPrint a list of the capabilities of %s\n", - MyName); - printf("\nRefer to the manual page '%s.1' for complete details\n", - MyName); - return(0); - } - else - { - fprintf(stderr, "%s: Unknown option '%s'\n", MyName, argv[i]); - return(1); - } - } - - PRINT_VERSION; - printf("\t(c) Copyright 1993,1994 by David Wexelblat \n"); - printf("\t(c) Copyright 1994-1998 by The XFree86 Project, Inc\n"); - printf("\n\tThis work is derived from the 'vgadoc2.zip' and\n"); - printf("\t'vgadoc3.zip' documentation packages produced by Finn\n"); - printf("\tThoegersen, and released with all appropriate permissions\n"); - printf("\thaving been obtained. Additional information obtained from\n"); - printf("\t'Programmer's Guide to the EGA and VGA, 2nd ed', by Richard\n"); - printf("\tFerraro, and from manufacturer's data books\n\n"); - printf("Bug reports are welcome, and should be sent to " - "XFree86@XFree86.org.\n"); - printf("In particular, reports of chipsets that this program fails to\n"); - printf("correctly detect are appreciated.\n\n"); - printf("Before submitting a report, please make sure that you have the\n"); - printf("latest version of SuperProbe (see http://www.xfree86.org/FAQ).\n\n"); -{ - FILE *f; - - f = fopen("/dev/tty", "w"); -#ifdef __EMX__ - /* note: don't remove the fopen above ! */ - fclose(f); - f = stderr; /* OS/2 does not know /dev/tty, OTOH you cannot run this - * program in a window. - */ -#endif - if (f != (FILE *)NULL) - { -#if !defined(DGUX) /* It crashes SuperProbe in DG/ux */ - putc('\007', f); - putc('\007', f); - putc('\007', f); -#endif - fprintf(f, "WARNING - THIS SOFTWARE COULD HANG YOUR MACHINE.\n"); - fprintf(f, " READ THE SuperProbe.1 MANUAL PAGE BEFORE\n"); - fprintf(f, " RUNNING THIS PROGRAM.\n\n"); - fprintf(f, " INTERRUPT WITHIN FIVE SECONDS TO ABORT!\n\n"); -#if !defined(DGUX) /* It crashes SuperProbe in DG/ux */ - putc('\007', f); - putc('\007', f); - putc('\007', f); -#endif - fflush(f); - sleep(5); - } -} - - if (OpenVideo() < 0) - { - fprintf(stderr, "%s: Cannot open video\n", MyName); - return(-1); - } - - if (!NoBIOS) - { - if (Bios_Base == (Byte *)0) - { - Bios_Base = FindBios(); - if (Bios_Base == (Byte *)0) - { - if (Verbose) - { - printf("%s: Could not determine BIOS base address; %s", - MyName, " assuming no EGA/VGA present\n"); - fflush(stdout); - } - NoEGA = TRUE; - } - } - } - if (Verbose) - { - if (NoBIOS) - { - printf("Assuming an EGA/VGA is present\n\n"); - } - else - { - printf("BIOS Base address = 0x%lX\n\n", (long)Bios_Base); - } - fflush(stdout); - } - - if (!NoPCI) - { - xf86scanpci(); - - /* Now scan for VGA compatible cards in the PCI config space. - * This will avoid that the BIOS checking fails to detect a VGA, - * making SuperProbe report "MCGA =" ... [kmg] - */ - i=0; - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if ((pcrp->_base_class == PCI_CLASS_PREHISTORIC && - pcrp->_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) || - (pcrp->_base_class == PCI_CLASS_DISPLAY && - pcrp->_sub_class == PCI_SUBCLASS_DISPLAY_VGA)) - { - PCIVGA = TRUE; - } - i++; - } - } - - if ((!NoBIOS) && (!NoEGA)) - { - /* - * Look for 'IBM' at Bios_Base+0x1E of the BIOS. It will be there for - * an EGA or VGA. - */ - if (ReadBIOS(COPYRIGHT_BASE, copyright, 5) < 0) - { - fprintf(stderr, "%s: Failed to read BIOS\n", MyName); - CloseVideo(); - return(1); - } - } - if (PCIVGA || - ((!NoEGA) && - ((NoBIOS) || - ((copyright[0] == 'I') && - (copyright[1] == 'B') && - (copyright[2] == 'M')) || - ((copyright[2] == 'P') && - (copyright[3] == 'C') && - (copyright[4] == 'I'))))) - { - /* - * It's an EGA or VGA - */ - Ports[0] = 0x3CC; - EnableIOPorts(1, Ports); - vgaIOBase = (inp(0x3CC) & 0x01) ? 0x3D0 : 0x3B0; - DisableIOPorts(1, Ports); - if (vgaIOBase == 0x3D0) - { - /* - * Color - probe for secondary mono. - */ - if (Probe_MDA(&Secondary)) - { - (void)Probe_Herc(&Secondary); - } - } - else - { - /* - * Mono - probe for secondary color. - */ - (void)Probe_CGA(&Secondary); - } - - if (!Probe_VGA(&Primary)) - Primary = CHIP_EGA; - - /* - * Do SVGA probing, even if no VGA is detected. Some SVGA can emulate - * pre-VGA adapters (such as EGA) and be left in such a state by BIOS - * initialization. - */ - if (Verbose) - { - printf("Doing Super-VGA Probes...\n"); - fflush(stdout); - } - matched = &VGA_Descriptor; - - if (order == NULL) - { - /* - * Use default ordering. - */ - for (i=0; SVGA_Descriptors[i] != NULL; i++) - { - chip_p = SVGA_Descriptors[i]; - if (TestChip(chip_p, &Primary)) - { - matched = chip_p; - break; - } - } - } - else - { - /* - * Use user specified order - */ - p = order; - while (p) - { - order = strchr(order, ','); - if (order != NULL) - { - *order = '\0'; - order++; - } - flag = FALSE; - for (i=0; SVGA_Descriptors[i] != NULL; i++) - { - chip_p = SVGA_Descriptors[i]; - if (StrCaseCmp(p, chip_p->name) == 0) - { - flag = TRUE; - break; - } - } - if (flag) - { - if (TestChip(chip_p, &Primary)) - { - matched = chip_p; - break; - } - } - else - { - fprintf(stderr, "%s: Chip class '%s' not known\n", - MyName, p); - } - p = order; - } - } - - Check_CoProc = matched->check_coproc; - - if (Probe_Mem) - { - if (matched->memcheck != (MemCheckFunc)NULL) - { - MemVGA = (*matched->memcheck)(Primary); - } - else if (Verbose) - { - printf("Memory probe not supported for this chipset.\n"); - fflush(stdout); - } - } - else if (Verbose) - { - printf("Skipping memory probe\n"); - fflush(stdout); - } - - /* - * If this chipset doesn't exclude probing for a coprocessor, - * then look for one. - */ - if (Check_CoProc) - { - if (Verbose) - { - printf("\nDoing Graphics CoProcessor Probes...\n"); - fflush(stdout); - } - for (i=0; CoProc_Descriptors[i] != NULL; i++) - { - chip_p = CoProc_Descriptors[i]; - if (TestChip(chip_p, &CoProc)) - { - matched = chip_p; - break; - } - } - if (CoProc_Descriptors[i] != NULL) - { - if (Probe_Mem) - { - if (matched->memcheck != (MemCheckFunc)NULL) - { - MemCoProc = (*matched->memcheck)(CoProc); - } - else if (Verbose) - { - printf("Memory probe not supported "); - printf("for this chipset.\n"); - fflush(stdout); - } - } - else if (Verbose) - { - printf("Skipping memory probe\n"); - fflush(stdout); - } - } - } - } - else if (Probe_MDA(&Primary)) - { - (void)Probe_Herc(&Primary); - (void)Probe_CGA(&Secondary); - } - else if (Probe_CGA(&Primary)) - { - if (Probe_MDA(&Secondary)) - { - (void)Probe_Herc(&Secondary); - } - } - - putchar('\n'); - if (Primary == -1) - { - printf("Could not identify any video\n"); - } - else - { - printf("First video: "); - if (IS_MDA(Primary)) - { - printf("MDA\n"); - } - else if (IS_HERC(Primary)) - { - printf("Hercules\n"); - Print_Herc_Name(Primary); - } - else if (IS_CGA(Primary)) - { - printf("CGA\n"); - } - else if (IS_MCGA(Primary)) - { - printf("MCGA\n"); - } - else if (IS_EGA(Primary)) - { - printf("EGA\n"); - } - else if (IS_VGA(Primary)) - { - printf("Generic VGA (or unknown SVGA)\n"); - } - else if (IS_SVGA(Primary)) - { - printf("Super-VGA\n"); - Print_SVGA_Name(Primary); - if (MemVGA > -1) - { - if (MemVGA >> 16) - { - printf("\tMemory: %d Kbytes (plus %d Kbytes off-screen)\n", - MemVGA & 0xffff, MemVGA >> 16); - } - else - printf("\tMemory: %d Kbytes\n", MemVGA); - } - if (Probe_DAC) - { - Probe_RamDac(Primary, &RamDac); - Print_RamDac_Name(RamDac); - } - else if (Verbose) - { - printf("Skipping RAMDAC probe\n"); - } - } - if (CoProc != -1) - { - printf("\tAttached graphics coprocessor:\n"); - Print_CoProc_Name(CoProc); - if (MemCoProc > -1) - { - if (MemCoProc > 0x00010000) - { - /* - * for some copros we store the local buffer in - * the high order 16bits - */ - - printf("\t\tMemory: %d Kbytes Framebuffer, %d Kbytes Localbuffer\n", - MemCoProc & 0xffff, (MemCoProc & 0xffff0000)>>16); - } - else - { - printf("\t\tMemory: %d Kbytes\n", MemCoProc); - } - } - } - } - if (Secondary != -1) - { - printf("Second video: "); - if (IS_MDA(Secondary)) - { - printf("MDA\n"); - } - else if (IS_HERC(Secondary)) - { - printf("Hercules\n"); - Print_Herc_Name(Secondary); - } - else if (IS_CGA(Secondary)) - { - printf("CGA\n"); - } - else if (IS_MCGA(Secondary)) - { - printf("MCGA\n"); - } - } - - CloseVideo(); - return(0); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std:3.15 xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std:3.15 Sat Mar 13 22:21:42 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std Fri Jan 18 15:24:53 2002 @@ -1,160 +0,0 @@ -# $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std,v 3.15 1999/03/14 03:21:42 dawes Exp $ - - - - - -# $XConsortium: Makefile.std /main/8 1996/10/27 11:04:00 kaleb $ -# -# Installation parameters -# -BINDIR = /usr/local/bin -MANDIR = /usr/share/man/man1 -OWNER = root -GROUP = bin -MODE = 4755 - -# -# OS-specific library -# -# SVR3 & SVR4 -#OS_DEF = -DSYSV -#OS_DEF = -DSYSV -DSCO -#OS_DEF = -DSYSV -DESIX -#OS_DEF = -DSVR4 -Dsun -OS_DEF = -DSYSV -DSVR4 -OS_SRC = OS_SYSV.c -OS_OBJ = OS_SYSV.o -# For Solarix x86 with ProWorks compiler only -#IO_SRC = SolX86IO.s -#IO_OBJ = SolX86IO.o -# Linux -#OS_DEF = -Dlinux -DGCCUSESGAS -#OS_SRC = OS_Linux.c -#OS_OBJ = OS_Linux.o -# 386BSD -#OS_DEF = -DCSRG_BASED -D__386BSD__ -DGCCUSESGAS $(CONS_DEF) -#OS_SRC = OS_386BSD.c -#OS_OBJ = OS_386BSD.o -#CONS_DEF = -DPCCONS_SUPPORT -# NetBSD -#OS_DEF = -DCSRG_BASED -D__NetBSD__ -DGCCUSESGAS $(CONS_DEF) -#OS_SRC = OS_386BSD.c -#OS_OBJ = OS_386BSD.o -#CONS_DEF = -DPCCONS_SUPPORT -DPCVT_SUPPORT -# OpenBSD -#OS_DEF = -DCSRG_BASED -D__OpenBSD__ -DGCCUSESGAS $(CONS_DEF) -#OS_SRC = OS_386BSD.c -#OS_OBJ = OS_386BSD.o -#CONS_DEF = -DPCCONS_SUPPORT -DPCVT_SUPPORT -# FreeBSD -#OS_DEF = -DCSRG_BASED -D__FreeBSD__ -DGCCUSESGAS $(CONS_DEF) -#OS_SRC = OS_386BSD.c -#OS_OBJ = OS_386BSD.o -#CONS_DEF = -DPCCONS_SUPPORT -DSYSCONS_SUPPORT -DPCVT_SUPPORT -# BSD/386 -#OS_DEF = -DCSRG_BASED -D__bsdi__ -DGCCUSESGAS -#OS_SRC = OS_386BSD.c -#OS_OBJ = OS_386BSD.o -# Minix -#OS_DEF = -D_MINIX -D_POSIX_SOURCE -#OS_SRC = OS_Minix.c -#OS_OBJ = OS_Minix.o -# Mach (BSD Tree) -#OS_DEF = -DMACH386 -DGCCUSESGAS -I/usr/mach/include -I/usr/include -#OS_SRC = OS_Mach.c -#OS_OBJ = OS_Mach.o -#OS_LIB = /usr/lib/libmach.a -# Mach -#OS_DEF = -DMACH386 -DGCCUSESGAS -#OS_SRC = OS_Mach.c -#OS_OBJ = OS_Mach.o -#OS_LIB = /usr/misc/.mach/lib/libmach.a -# OS/2 with EMX -#OS_DEF = -D__EMX__ -DGCCUSESGAS -#OS_SRC = OS_Os2.c -#OS_OBJ = OS_Os2.o -#OS_LIB = -lemxio -# LynxOS -#OS_DEF = -#OS_SRC = OS_LynxOS.c -#OS_OBJ = OS_LynxOS.o - -HDRS = Probe.h -BASE_SRC = MDA.c Herc.c CGA.c VGA.c RamDac.c MemProbe.c PCI.c -BASE_OBJ = MDA.o Herc.o CGA.o VGA.o RamDac.o MemProbe.o PCI.o -SVGA_SRC = Tseng.c WD.c ChipsTech.c Video7.c Genoa.c Trident.c Oak.c \ - Cirrus.c Ahead.c ATI.c S3.c AL.c Yamaha.c NCR.c MX.c \ - RealTek.c Primus.c Compaq.c HMC.c UMC.c Weitek.c SiS.c \ - ARK.c Alliance.c Matrox.c SigmaDesigns.c Intergraphics.c \ - Epson.c Rendition.c -SVGA_OBJ = Tseng.o WD.o ChipsTech.o Video7.o Genoa.o Trident.o Oak.o \ - Cirrus.o Ahead.o ATI.o S3.o AL.o Yamaha.o NCR.o MX.o \ - RealTek.o Primus.o Compaq.o HMC.o UMC.o Weitek.o SiS.o \ - ARK.o Alliance.o Matrox.o SigmaDesigns.o Intergraphics.o \ - Epson.o Rendition.o -COPROC_SRC = 8514.c ATIMach.c I128.c GLINT.c -COPROC_OBJ = 8514.o ATIMach.o I128.o GLINT.o -SRCS = Main.c $(SVGA_SRC) $(COPROC_SRC) $(BASE_SRC) Print.c \ - Utils.c $(OS_SRC) $(IO_SRC) -OBJS = Main.o $(SVGA_OBJ) $(COPROC_OBJ) $(BASE_OBJ) Print.o \ - Utils.o $(OS_OBJ) $(IO_OBJ) -LIBS = $(OS_LIB) - - -#PROG = SuperProbe.exe # OS/2 -PROG = SuperProbe - -# Options for gcc -CC = gcc -CCOPTS = -m486 -ansi -pedantic -DEBUG_OR_OPT = -g -Wall -#DEBUG_OR_OPT = -O2 - -# Options for ProWorks compiler on Solaris 2.x -#PROWORKSHOME = /opt/SUNWspro -#CC = $(PROWORKSHOME)/bin/cc -#AS = /usr/ccs/bin/as -#CCOPTS = -Xa -#DEBUG_OR_OPT = -g -#DEBUG_OR_OPT = -O - -# Options for OS/2 -#CC= gcc -#CCOPTS = -m486 -#LDFLAGS = -Zexe - - -CFLAGS = $(CCOPTS) $(DEBUG_OR_OPT) $(OS_DEF) - -# -# Assemblier -> object format rule (Solaris x86 ProWorks compiler only) -# NOTE: AS must be defined to the assemblier to be used. Currently only -# the default assemblier supplied with Solaris/ProWorks is supported -# -.s.o: - $(RM) $@ - $(AS) -o $*.o $*.s - -all: $(PROG) - -$(PROG): $(OBJS) - $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) - -$(OBJS): $(HDRS) -Utils.o: AsmMacros.h -Main.o: PatchLevel.h - -clean: - rm -f $(OBJS) - -clobber: clean - rm -f $(PROG) - -install: $(PROG) - rm -f $(BINDIR)/$(PROG) - cp $(PROG) $(BINDIR) - chown $(OWNER) $(BINDIR)/$(PROG) - chgrp $(GROUP) $(BINDIR)/$(PROG) - chmod $(MODE) $(BINDIR)/$(PROG) - cp $(PROG).1 $(MANDIR)/$(PROG).1 Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c:3.5 Fri Nov 19 08:54:14 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c Fri Jan 18 15:24:53 2002 @@ -1,118 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c,v 3.5 1999/11/19 13:54:14 hohndel Exp $ */ -/* - * (c) Copyright 1997 Alan Hourihane - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * ALAN HOURIHANE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Alan Hourihane shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Alan Hourihane. - * - */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Matrox __STDCARGS((int)); - -Chip_Descriptor Matrox_Descriptor = { - "Matrox", - Probe_Matrox, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, -#if 0 - MemProbe_Matrox, -#else - NULL, -#endif -}; - -Bool Probe_Matrox(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte chip, old, old1, val; - int i = 0; - - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_MATROX && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_MGA1064SG: - *Chipset = CHIP_MGA1064SG; - break; - case PCI_CHIP_MGA2064W: - *Chipset = CHIP_MGA2064W; - break; - case PCI_CHIP_MGA2164W: - *Chipset = CHIP_MGA2164W; - break; - case PCI_CHIP_MGA2085PX: - *Chipset = CHIP_MGA2085PX; - break; - case PCI_CHIP_MGA2164W_AGP: - *Chipset = CHIP_MGA2164WAGP; - break; - case PCI_CHIP_MGAG100_PCI: - *Chipset = CHIP_MGAG100PCI; - break; - case PCI_CHIP_MGAG100_AGP: - *Chipset = CHIP_MGAG100AGP; - break; - case PCI_CHIP_MGAG200_PCI: - *Chipset = CHIP_MGAG200PCI; - break; - case PCI_CHIP_MGAG200_AGP: - *Chipset = CHIP_MGAG200AGP; - break; - default: - Chip_data = chip; - *Chipset = CHIP_MATROX_UNK; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - return(FALSE); -} - -static int MemProbe_Matrox(Chipset) -int Chipset; -{ - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - Mem = 2048; - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c:3.4 Mon Dec 23 01:31:18 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c Fri Jan 18 15:24:53 2002 @@ -1,152 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c,v 3.4 1996/12/23 06:31:18 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: MemProbe.c /main/5 1996/02/21 17:10:50 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {SEQ_IDX, SEQ_REG, GRC_IDX, GRC_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Ports[0])) - -#define SAVESIZE 100 -#define BYTE_AT(s,i,j) (*((s)+((i)*SAVESIZE)+(j))) -#define TAG "SuperProbe" - -int Probe_Mem(Check) -MemCheck_Descriptor Check; -{ - Byte Save256; - Byte SaveMap; - Byte SaveSeq; - Byte SaveMask; - Byte *Mem; - Byte *Store; - int BankNum; - register int i, j; - Bool IsMem = TRUE; - int SaveRBank; - int SaveWBank; - int Total; - - Store = (Byte *)malloc((Check.max_bank+1)*SAVESIZE); - if (Store == (Byte *)0) - { - return(0); - } - Mem = MapVGA(); - if (Mem == (Byte *)0) - { - return(0); - } - EnableIOPorts(NUMPORTS, Ports); - Save256 = rdinx(GRC_IDX, 0x05); - SaveMap = rdinx(GRC_IDX, 0x06); - SaveMask = rdinx(SEQ_IDX, 0x02); - SaveSeq = rdinx(SEQ_IDX, 0x04); - wrinx(GRC_IDX, 0x05, ((Save256 & 0x0F) | 0x40)); - wrinx(GRC_IDX, 0x06, (SaveMap & 0xF0) | 0x05); - wrinx(SEQ_IDX, 0x02, (SaveMask & 0xF0) | 0x0F); - wrinx(SEQ_IDX, 0x04, (SaveSeq | 0x0E)); - Check.get_bank(Check.chipset, &SaveRBank, &SaveWBank); - for (BankNum = 0; ((BankNum <= Check.max_bank) && (IsMem)); BankNum++) - { - Check.set_bank(Check.chipset, BankNum, BankNum); - /* - * See if this bank is tagged. - */ - if (strncmp((char *)Mem, TAG, strlen(TAG)) == 0) - { - break; - } - for (i=0; i < SAVESIZE; i++) - { - BYTE_AT(Store,BankNum,i) = Mem[i]; - Mem[i] ^= 0xAA; - } - IsMem = TRUE; - for (i=0; i < SAVESIZE; i++) - { - if (Mem[i] != (BYTE_AT(Store,BankNum,i) ^ 0xAA)) - { - IsMem = FALSE; - break; - } - } - for (i = 0; i < SAVESIZE; i++) - { - Mem[i] = BYTE_AT(Store,BankNum,i); - } - if (IsMem) - { - for (i=0; i < SAVESIZE; i++) - { - Mem[i] ^= 0x55; - } - IsMem = TRUE; - for (i=0; i < SAVESIZE; i++) - { - if (Mem[i] != (BYTE_AT(Store,BankNum,i) ^ 0x55)) - { - IsMem = FALSE; - break; - } - } - for (i = 0; i < SAVESIZE; i++) - { - Mem[i] = BYTE_AT(Store,BankNum,i); - } - } - if (IsMem) - { - /* - * Tag this bank - */ - strcpy((char *)Mem, TAG); - } - } - Total = (BankNum * Check.bank_size) / 1024; - - for (j=0; j < BankNum; j++) - { - Check.set_bank(Check.chipset, j, j); - for (i=0; i < SAVESIZE; i++) - { - Mem[i] = BYTE_AT(Store,j,i); - } - } - - Check.set_bank(Check.chipset, SaveRBank, SaveWBank); - wrinx(SEQ_IDX, 0x04, SaveSeq); - wrinx(SEQ_IDX, 0x02, SaveMask); - wrinx(GRC_IDX, 0x06, SaveMap); - wrinx(GRC_IDX, 0x05, Save256); - DisableIOPorts(NUMPORTS, Ports); - UnMapVGA(Mem); - - return(Total); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c:3.5 Mon Dec 23 01:31:19 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c Fri Jan 18 15:24:53 2002 @@ -1,101 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c,v 3.5 1996/12/23 06:31:19 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: NCR.c /main/6 1996/10/24 07:09:54 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -Chip_Descriptor NCR_Descriptor = { - "NCR", - Probe_NCR, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - NULL, -}; - -Bool Probe_NCR(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old, tmp; - - EnableIOPorts(NUMPORTS, Ports); - - if (testinx2(SEQ_IDX, 0x05, 0x05)) - { - old = rdinx(SEQ_IDX, 0x05); - wrinx(SEQ_IDX, 0x05, 0x00); - if (!testinx2(SEQ_IDX, 0x10, 0xFF)) - { - wrinx(SEQ_IDX, 0x05, 0x01); - if (testinx2(SEQ_IDX, 0x10, 0xFF)) - { - result = TRUE; - tmp = rdinx(SEQ_IDX, 0x08) >> 4; - if (tmp == 0) - { - *Chipset = CHIP_NCR77C22; - } - else if (tmp == 1) - { - *Chipset = CHIP_NCR77C21; - } - else if (tmp == 2) - { - if ((rdinx(SEQ_IDX, 0x08) & 0x0F) >= 8) - { - *Chipset = CHIP_NCR77C22EP; - } - else - { - *Chipset = CHIP_NCR77C22E; - } - } - else if (tmp == 3) - { - *Chipset = CHIP_NCR77C32B; - } - else - { - Chip_data = tmp; - *Chipset = CHIP_NCR_UNK; - } - } - } - wrinx(SEQ_IDX, 0x05, old); - } - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c:3.19 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c:3.19 Sat Mar 3 04:53:00 2001 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c Fri Jan 18 15:24:53 2002 @@ -1,507 +0,0 @@ -/* $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 - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID DAWES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Dawes shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Dawes. - * - */ - -/* - * Copyright 1997 - * Digital Equipment Corporation. All rights reserved. - * This software is furnished under license and may be used and copied only in - * accordance with the following terms and conditions. Subject to these conditions, - * you may download, copy, install, use, modify and distribute this software in - * source and/or binary form. No title or ownership is transferred hereby. - * - * 1) Any source code used, modified or distributed must reproduce and retain this - * copyright notice and list of conditions as they appear in the source file. - * - * 2) No right is granted to use any trade name, trademark, or logo of Digital - * Equipment Corporation. Neither the "Digital Equipment Corporation" name nor - * any trademark or logo of Digital Equipment Corporation may be used to endorse or - * promote products derived from this software without the prior written permission - * of Digital Equipment Corporation. - * - * 3) This software is provided "AS-IS" and any express or implied warranties, including - * but not limited to, any implied warranties of merchantability, fitness for a - * particular purpose, or non-infringement are disclaimed. In no event shall DIGITAL - * be liable for any damages whatsoever, and in particular, DIGITAL shall not be - * liable for special, indirect, consequential, or incidental damages or damages for - * lost profits, loss of revenue or loss of use, whether such damages arise in contract, - * negligence, tort, under statute, in equity, at law or otherwise, even if advised of - * the possibility of such damage. - * - */ - -/* $XConsortium: OS_386BSD.c /main/11 1996/10/27 11:04:03 kaleb $ */ - -#include "Probe.h" - -#include -#include -#include -#include - -#ifdef __bsdi__ -# include -# define CONSOLE_X_MODE_ON PCCONIOCRAW -# define CONSOLE_X_MODE_OFF PCCONIOCCOOK -#else -# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -# ifdef CODRV_SUPPORT - /* This header is part of codrv */ -# include -# endif -# if defined(PCVT_SUPPORT) && !defined(SYSCONS_SUPPORT) -# if defined(__NetBSD__) && defined(WSCONS_SUPPORT) - /* NetBSD's wscons has a PCVT compatibility module. */ -# include -# else -# if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) -# include -# else -# include -# endif -# endif -# endif -# ifdef SYSCONS_SUPPORT - /* both, Free and NetBSD have syscons */ -# if defined(__FreeBSD__) -# include -# if __FreeBSD_version >= 410000 -# include -# include -# else -# include -# endif -# else -# include -# endif -# endif -# else -# ifdef CODRV_SUPPORT - /* This header is part of codrv */ -# include -# endif -# endif -# undef CONSOLE_X_MODE_ON -# define CONSOLE_X_MODE_ON _IO('t',121) -# undef CONSOLE_X_MODE_OFF -# define CONSOLE_X_MODE_OFF _IO('t',122) -#endif -#if defined(__NetBSD__) && !defined(MAP_FILE) -#define MAP_FILE 0 -#endif - -#if defined(__NetBSD__) && !defined(__OpenBSD__) -# include -# ifdef NetBSD1_1 -# include -# endif -#endif - -#if defined(__OpenBSD__) -# include -#endif - -#if !defined(__OpenBSD__) -# define CONSOLE_DEVICE "/dev/ttyv0" -#else -# define CONSOLE_DEVICE "/dev/ttyC0" -#endif - -#ifdef __NetBSD__ -/* Temporary while we don't have a wscons driver for XFree86. */ -# define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0" -#endif - -#ifdef USE_ARM32_MMAP -#define DEV_MEM_IOBASE 0x43000000 -extern unsigned int IOPortBase; -static int DEVMEM_fd = -1; -#endif - -static int CONS_fd = -1; -static int BIOS_fd = -1; - -static Bool HasCodrv = FALSE; -static Bool HasUslVt = FALSE; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. For 386BSD, we disable - * IO protection, since this is currently the only way to access any - * IO registers. - */ -int OpenVideo() -{ - if (geteuid() != 0) - { - fprintf(stderr, - "%s: Must be run as root\n", - MyName); - return(-1); - } - /* - * Attempt to open /dev/kbd. If this fails, the driver is either - * pccons, or it is codrv and something else has it open. errno - * will tell us which case it is. - */ - if ((CONS_fd = open("/dev/kbd", O_RDONLY|O_NDELAY, 0)) < 0) - { - if (errno == EBUSY) - { - /* - * Codrv, but something else is using the console - * in "X" mode - */ - fprintf(stderr, - "%s: Cannot be run while an X server is running\n", - MyName); - return(-1); - } -#ifndef __bsdi__ - /* - * pccons. To guess if we're being run from within an - * X session, check $DISPLAY, and fail if it is set. - * This check is not foolproof -- just a guide. - */ - if (getenv("DISPLAY")) - { - fprintf(stderr, - "%s: Cannot be run while an X server is running\n", - MyName); - fprintf(stderr, - "%s: If an X server is not running, unset $DISPLAY", - MyName); - fprintf(stderr, - " and try again\n"); - return(-1); - } - if ((CONS_fd = open("/dev/vga", O_RDWR, 0)) < 0 - && (CONS_fd = open(CONSOLE_DEVICE, O_RDWR, 0)) < 0 -#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV - && (CONS_fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, - O_RDWR, 0)) < 0 -#endif - ) - { - fprintf(stderr, - "%s: Cannot open /dev/vga nor %s\n", - MyName, CONSOLE_DEVICE); - return(-1); - } -#endif - } - else - { -#ifndef __bsdi__ -#ifdef CODRV_SUPPORT - struct oldconsinfo tmp; - - if (ioctl(CONS_fd, OLDCONSGINFO, &tmp) < 0) - { - fprintf(stderr, "%s: Unknown console driver\n", - MyName); - return(-1); - } - HasCodrv = TRUE; -#endif -#endif - } -#ifndef __bsdi__ - if (HasCodrv) - { -#ifdef CODRV_SUPPORT - int onoff = X_MODE_ON; - - if (ioctl(CONS_fd, CONSOLE_X_MODE, &onoff) < 0) - { - fprintf(stderr, "%s: CONSOLE_X_MODE ON failed\n", - MyName); - return(-1); - } - ioctl(CONS_fd, VGATAKECTRL, 0); -#endif - } - else - { -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) - /* - * not codrv and not BSDI; first look if we have a console - * driver that understands USL-style VT commands - */ - int vt_num; - - if (ioctl(CONS_fd, VT_GETACTIVE, &vt_num) == 0) - { - /* yes, so we don't use the old stuff */ - HasUslVt = TRUE; - if (ioctl(CONS_fd, KDENABIO, 0) < 0) - { - fprintf(stderr, "%s: KDENABIO failed\n", - MyName); - return(-1); - } - } - else -#endif -#endif - if (ioctl(CONS_fd, CONSOLE_X_MODE_ON, 0) < 0) - { - fprintf(stderr, "%s: CONSOLE_X_MODE_ON failed\n", - MyName); - return(-1); - } -#ifdef __bsdi__ - ioctl(CONS_fd, PCCONENABIOPL, 0); -#else - } -#endif - return(CONS_fd); -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. For 386BSD, we re-enable - * IO protection. - */ -void CloseVideo() -{ - if (CONS_fd != -1) - { -#ifndef __bsdi__ -#ifdef CODRV_SUPPORT - int onoff = X_MODE_OFF; -#endif - - if (HasCodrv) - { -#ifdef CODRV_SUPPORT - ioctl(CONS_fd, VGAGIVECTRL, 0); - ioctl(CONS_fd, CONSOLE_X_MODE, &onoff); -#endif - } -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) - else if(HasUslVt) - ioctl(CONS_fd, KDDISABIO, 0); -#endif - else -#endif - ioctl(CONS_fd, CONSOLE_X_MODE_OFF, 0); - } -#ifdef __bsdi__ - ioctl(CONS_fd, PCCONDISABIOPL, 0); -#endif - if (CONS_fd > 0) - { - close(CONS_fd); - } -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - int fd; - Byte *base; - - if ((fd = open("/dev/vga", O_RDWR)) < 0) - { - fprintf(stderr, "%s: Failed to open /dev/vga\n", MyName); - return((Byte *)0); - } - base = (Byte *)mmap((caddr_t)0, 0x10000, PROT_READ|PROT_WRITE, - MAP_FILE, fd, 0); - close(fd); - if ((long)base == -1) - { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } - return(base); -} - -Byte *MapMem(address,size) - unsigned long address; - unsigned long size; -{ - return((Byte*)0); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) -Byte *base; -{ - munmap((caddr_t)base, 0x10000); -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Word tmp; - Byte *Base = Bios_Base + Offset; - unsigned long bs = (unsigned long) Base; - -#ifdef __arm32__ - return(-1); -#endif - - if (BIOS_fd == -1) - { - if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0) - { - fprintf(stderr, "%s: cannot open /dev/mem\n", MyName); - return(-1); - } - } - if ((off_t)(bs & 0x7FFF) != (off_t)0) - { - /* - * Sanity check... - */ - (void)lseek(BIOS_fd, (off_t)(bs & 0xF8000), SEEK_SET); - (void)read(BIOS_fd, &tmp, 2); - if (tmp != (Word)0xAA55) - { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%lx\n", - MyName, bs); - return(-1); - } - } - if (lseek(BIOS_fd, (off_t)bs, SEEK_SET) < 0) - { - fprintf(stderr, "%s: BIOS seek failed\n", MyName); - return(-1); - } - if (read(BIOS_fd, Buffer, Len) != Len) - { - fprintf(stderr, "%s: BIOS read failed\n", MyName); - return(-1); - } - return(Len); -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For 386BSD, - * we've disabled IO protections so this is a no-op. - */ -static int IOEnabled = 0; -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ -#ifdef USE_I386_IOPL - if (IOEnabled++ == 0) { - i386_iopl(TRUE); - } -#endif -#ifdef USE_ARM32_MMAP - if (IOEnabled++ == 0) { - if (DEVMEM_fd == -1 && (DEVMEM_fd = open("/dev/mem", O_RDWR, 0)) < 0) - { - fprintf(stderr, - "%s: Cannot open /dev/mem to map IO ports\n", MyName); - exit(1); - } - - IOPortBase = (unsigned int)mmap((caddr_t)0, 0x400, PROT_READ|PROT_WRITE, - MAP_FILE, DEVMEM_fd, (off_t)DEV_MEM_IOBASE); - - if (IOPortBase == (unsigned int)-1) - { - fprintf(stderr, - "%s: Cannot mmap IO ports\n", MyName); - exit(1); - } - } -#endif - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For 386BSD, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ -#ifdef USE_I386_IOPL - if (--IOEnabled == 0) { - i386_iopl(FALSE); - } -#endif -#ifdef USE_ARM32_MMAP - if (--IOEnabled == 0) { - munmap((caddr_t)IOPortBase, 0x400); - } -#endif - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -void ShortSleep(Delay) -int Delay; -{ - usleep(Delay * 1000); -} - Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c:1.3 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c:1.3 Sat Sep 25 10:36:59 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c Fri Jan 18 15:24:53 2002 @@ -1,264 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c,v 1.3 1999/09/25 14:36:59 dawes Exp $ */ -/* - * INTEL DG/UX RELEASE 4.20 MU04 - * Copyright Takis Psarogiannakopoulos - * e-mail - * - * 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. - * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FITNESS, IN NO EVENT SHALL XCONSORTIUM 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 "Probe.h" -#include -#include -#include -#include -#include -#include - -/* Definition of SI86IOPL for DG/ux - * According to sysi86 of DG/ux - * Unixware - */ - -#define DG_NO_SYSI86 1 - -#include -#if defined(DG_NO_SYSI86) -#define SI86IOPL 112 -#endif - -#define DEV_MEM "/dev/mem" - -int Takis_fd; -static int BIOS_fd = -1; - -/* - * OpenVideo -- - */ -int OpenVideo() -{ - int fd; - char takis[20]; - - if (geteuid() != 0) - { - fprintf(stderr, - "%s: Must be run as root or installed suid-root\n", - MyName); - return(-1); - } - if ((fd = open("/dev/console", O_RDWR, 0)) < 0) - { - fprintf(stderr, "%s: Cannot open /dev/console\n", - MyName); - return(-1); - } - close(fd); - sprintf(takis, "/dev/console"); - - if ((Takis_fd = open(takis, O_RDWR|O_NDELAY, 0)) < 0) - { - fprintf(stderr, "%s: Could not open system Console \n", - MyName); - return(-1); - } - if (sysi86(SI86IOPL, 3)< 0) - { - return(-1); - } - - return(Takis_fd); -} - - -/* - * CloseVideo -- - * - * Disable access to the video hardware, ie Close system console, - * and re-enable IO protection. - */ -void CloseVideo() -{ - if (Takis_fd>0) - { - sysi86(SI86IOPL, 0); /* Disable I/O ports */ - close(Takis_fd); - } -} - - -/* - * MapVGA -- - */ -Byte *MapVGA() -{ - int fd; - Byte *base; - - if ((fd = open(DEV_MEM, O_RDWR)) < 0) - { - fprintf(stderr, "%s: Failed to open %s\n", MyName, DEV_MEM); - return((Byte *)0); - } - base = (Byte *)mmap((caddr_t)0, 0x10000, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)0xA0000); - close(fd); - if ((long)base == -1) - { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } - return(base); -} - - -Byte *MapMem(address,size) - unsigned long address; - unsigned long size; -{ - return((Byte*)0); -} - - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) -Byte *base; -{ - munmap((caddr_t)base, 0x10000); - return; -} - - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Byte *Base = Bios_Base + Offset; - Word *tmp; - Byte *ptr; - unsigned long page_offset = (unsigned long)Base & 0xFFF; - unsigned long mmap_base = (unsigned long)Base & ~0xFFF; - unsigned long mmap_len = Len + page_offset; - - if (BIOS_fd == -1) - { - if ((BIOS_fd = open(DEV_MEM, O_RDONLY, 0)) < 0) - { - fprintf(stderr, "%s: cannot open %s\n", - MyName, DEV_MEM); - return(-1); - } - } - if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) - { - tmp = (Word *)mmap((caddr_t)0, 0x1000, PROT_READ, MAP_SHARED, - BIOS_fd, (off_t)((off_t)Base & 0xF8000)); - if ((int)tmp == -1) - { - fprintf(stderr, "%s: Failed to mmap() %s, addr=%x\n", - MyName, DEV_MEM, (int)Base); - return(-1); - } - if (*tmp != (Word)0xAA55) - { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Base); - return(-1); - } - (void)munmap((caddr_t)tmp, 0x1000); - } - ptr = (Byte *)mmap((caddr_t)0, mmap_len, PROT_READ, MAP_SHARED, - BIOS_fd, (off_t)mmap_base); - if ((int)ptr == -1) - { - fprintf(stderr, "%s: Failed to mmap() %s, addr=%x\n", - MyName, DEV_MEM, (int)Base); - return(-1); - } - (void)memcpy((void *)Buffer, (void *)(ptr + page_offset), Len); - (void)munmap((caddr_t)ptr, mmap_len); - return(Len); -} - - -/* - * EnableIOPort -- - */ -/*ADDED FOR INTEL DG/ux */ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - return(0); -} - -/* - * DisableIOPort -- - */ - -/*ADDED FOR INTEL DG/ux */ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ - return(0); -} - -/* - * ShortSleep -- - */ - -/*ADDED FOR INTEL DG/ux */ -void ShortSleep(Delay) -int Delay; -{ - usleep(Delay * 1000); -} - -/* Added to allow lightweight processes to access I/O directly */ - -#if defined(DGUX) && defined(DG_NO_SYSI86) - asm("sysi86:_sysi86:pushl %ebp"); - asm("movl %esp,%ebp"); - asm("pushl 12(%ebp)"); - asm("pushl 8(%ebp)"); - asm("pushl 4(%ebp)"); - asm("movl $50,%eax"); - asm("lcall $7,$0"); - asm("addl $12,%esp"); - asm("leave"); - asm("ret"); -#endif - Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c:1.1 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c:1.1 Sun Aug 16 06:25:38 1998 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c Fri Jan 18 15:24:53 2002 @@ -1,247 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c,v 1.1 1998/08/16 10:25:38 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by Robert V. Baron - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * ROBERT V. BARON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Robert V. Baron shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Robert V. Baron. - * - */ -/* $XConsortium: OS_Mach.c /main/5 1996/02/21 17:11:12 kaleb $ */ -/* GNU/Hurd port by UCHIYAMA Yasushi */ -#define _GNU_SOURCE -#define MACH3 -#include -#include - -#include "Probe.h" - -#include -#include -#include - -/* These can be Mach 2.5 or 3.0 headers */ -#include -#include -#include - -static device_t device_master = MACH_PORT_NULL; -static int iopl_dev = MACH_PORT_NULL; -static memory_object_t iopl_mem = MACH_PORT_NULL; -static vm_address_t mapped_address; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. For Mach, we disable - * IO protection, since this is currently the only way to access any - * IO registers. - */ -int screen_addr; - -int OpenVideo() -{ - int ret; -#define C /*Bios_Base*/ 0xc0000 -#define S 0x40000 - if(KERN_SUCCESS != get_privileged_ports(0,&device_master)){ - fprintf(stderr,"Failed get_privileged_ports\n"); - return -1; - } - if (KERN_SUCCESS != device_open(device_master,D_READ|D_WRITE,"iopl",&iopl_dev)){ - fprintf(stderr, "Failed to device_open iopl\n"); - return -1; - } - if(KERN_SUCCESS != device_map(iopl_dev,VM_PROT_READ|VM_PROT_WRITE, C , S ,&iopl_mem,0)){ - fprintf(stderr, "Failed to device_map\n"); - return -1; - } - if(KERN_SUCCESS != vm_map(mach_task_self(), - &mapped_address,S, - 0,1,iopl_mem,C,0,VM_PROT_READ|VM_PROT_WRITE, - VM_PROT_READ|VM_PROT_WRITE,VM_INHERIT_NONE)){ - fprintf(stderr,"Failed to vm_map\n"); - return -1; - } - - screen_addr = (int)mapped_address; - - return TRUE; - -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. For Mach, we re-enable - * IO protection. - */ -void CloseVideo() -{ - if (KERN_SUCCESS != vm_deallocate(mach_task_self(), screen_addr, S)) { - fprintf(stderr, "Failed vmdeallocate %x\n", S); - } - -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return((Byte *)0); -} - -Byte *MapMem(address,size) - unsigned long address; - unsigned long size; -{ - return((Byte *)0); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) -Byte *base; -{ - return; -} - -void UnMapMem(base,size) -Byte *base; -unsigned long size; -{ - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Word tmp; - Byte *Base; - - Base = (Byte *)(screen_addr + Bios_Base + Offset - C); -#ifdef DEBUG - {int i; - fprintf(stderr, "ReadBIOS(Offset %x, Buffer %x, Len %x) .. ", - Offset, Buffer, Len); - for (i=0;i - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * OREST ZBOROWSKI BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Orest Zborowski shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Orest Zborowski. - * - */ - -/* $XConsortium: OS_Linux.c /main/8 1996/10/19 17:47:14 kaleb $ */ - -#include "Probe.h" - -#include -#include -#include -#include -#include - -#ifdef __alpha__ -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - -#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */ -#define isJensen (1) -#define SPARSE (5) -#define WORD_CODING (0x08) -#else -#define isJensen (!_bus_base()) -#define SPARSE (7) -#define WORD_CODING (0x20) -#endif - -#define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base()) -#define JENSEN_SHIFT(x) (isJensen ? ((long)x< 0) - { - close(VT_fd); - if (VT_cur >= 0) - { - if ((fd = open("/dev/console", O_WRONLY, 0)) >= 0) - { - ioctl(fd, VT_ACTIVATE, VT_cur); - close(fd); - } - } - } -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return( MapMem(0xA0000,0x10000) ); -} - -Byte *MapMem(address, size) - unsigned long address; - unsigned long size; -{ - int fd; - Byte *base; - -#ifdef __alpha__ - if(isJensen){ - fprintf(stderr, "%s: MemProbe not supported on Jensen\n", MyName); - return((Byte *)0); - } -#endif - -#if defined(__ia64__) - if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) -#else - if ((fd = open("/dev/mem", O_RDWR)) < 0) -#endif - { - fprintf(stderr, "%s: Failed to open /dev/mem\n", MyName); - return((Byte *)0); - } - base = (Byte *)mmap((caddr_t)0, size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)address + BUS_BASE); - close(fd); - if ((long)base == -1) - { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } - return(base); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) - Byte *base; -{ - UnMapMem(base,0x10000); - return; -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - munmap((caddr_t)base, 0x10000); - return; -} - -#ifdef __alpha__ -SlowBCopyFromBus(src, dst, count) - unsigned char *src, *dst; - int count; -{ - unsigned long addr; - long result; - - addr = (unsigned long) src; - while( count ){ - result = *(volatile int *) addr; - result >>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (unsigned char) (0xffUL & result); - addr += 1<>= ((long)Base & 3) * 8; - tmp &= 0xffffUL; - } - else - { - tmp = *(Word *)mybase; - } - - if (tmp != (Word)0xAA55) - { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%lx\n", - MyName, (long)Base); - return(-1); - } - } - - if (isJensen) - SlowBCopyFromBus(&mybase[JENSEN_SHIFT(myoffset)], Buffer, Len); - else - memcpy(Buffer, &mybase[myoffset], Len); - - munmap((caddr_t)((off_t)JENSEN_SHIFT(Base) | BUS_BASE), mysize); - -#else /* __alpha__ */ - - if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) - { - /* - * Sanity check... - */ - (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET); - (void)read(BIOS_fd, &tmp, 2); - if (tmp != (Word)0xAA55) - { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%lx\n", - MyName, (long)Base); - return(-1); - } - } - if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0) - { - fprintf(stderr, "%s: BIOS seek failed\n", MyName); - return(-1); - } - if (read(BIOS_fd, Buffer, Len) != Len) - { - fprintf(stderr, "%s: BIOS read failed\n", MyName); - return(-1); - } -#endif /* __alpha__ */ - - return(Len); -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For Linux, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For Linux, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -void ShortSleep(Delay) -int Delay; -{ - usleep(Delay * 1000); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c:3.8 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c:3.8 Fri Jun 16 20:27:31 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c Fri Jan 18 15:24:53 2002 @@ -1,261 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c,v 3.8 2000/06/17 00:27:31 dawes Exp $ */ -/* - * Copyright 1993 by Thomas Mueller - * - * 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 Mueller not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Mueller makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS MUELLER 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: OS_LynxOS.c /main/5 1996/02/21 17:11:07 kaleb $ */ - -#include "Probe.h" - -#include -#include -#include -#include -#include -#include - -#ifdef __powerpc__ -unsigned char *ioBase = NULL; -static int IOEnabled; -#endif - -static int BIOS_fd = -1; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. - * For LynxOS just a check for super-user permissions. - */ -#ifdef __STDC__ -int OpenVideo(void) -#else -int OpenVideo() -#endif -{ - if (geteuid() != 0) - { - fprintf(stderr, - "%s: Must be run as root\n", - MyName); - return(-1); - } - - return(1); -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. - * For Lynxos a no-op. - */ -#ifdef __STDC__ -void CloseVideo(void) -#else -void CloseVideo() -#endif -{ -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return(MapMem(0xa0000,0x10000)); -} - -Byte *MapMem(address,size) - unsigned long address; - unsigned long size; -{ -#define SMEM_NAME "SuperProbe-VGA" - Byte *base; - - base = (Byte *) smem_create(SMEM_NAME, (char *)address, - size, SM_READ|SM_WRITE); - if ((long)base == -1) - { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } - return(base); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) -Byte *base; -{ - UnMapMem(base,0x10000); - return; -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - smem_create(NULL, (char *)base, 0, SM_DETACH); - smem_remove(SMEM_NAME); - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -#ifdef __STDC__ -int ReadBIOS(const unsigned Offset, Byte *Buffer, const int Len) -#else -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -#endif -{ - unsigned long physbase; - Word tmp; - Byte *Base = Bios_Base + Offset; - - physbase = info(_I_PHYSBASE); - if (physbase == -1) { - fprintf(stderr, "%s: can't inquire PHYSBASE\n", MyName); - return(-1); - } - if (BIOS_fd == -1) - { - if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0) - { - fprintf(stderr, "%s: cannot open /dev/mem\n", MyName); - return(-1); - } - } - if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) - { - /* - * Sanity check... - */ - (void)lseek(BIOS_fd, (off_t)physbase + ((off_t)Base & 0xF8000), SEEK_SET); - (void)read(BIOS_fd, &tmp, 2); - if (tmp != (Word)0xAA55) - { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Base); - fprintf(stderr, - "%s: BIOS sanity check failed, Seek to =%x, Read Word %04x\n", - MyName, (int)Base & 0xF8000, tmp); - return(-1); - } - } - /* check carefully against -1 because of physbase offset.. */ - if (lseek(BIOS_fd, (off_t)(physbase + Base), SEEK_SET) == -1) - { - fprintf(stderr, "%s: BIOS seek failed\n", MyName); - return(-1); - } - if (read(BIOS_fd, Buffer, Len) != Len) - { - fprintf(stderr, "%s: BIOS read failed\n", MyName); - return(-1); - } - return(Len); -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. - * For LynxOS this is a no-op. - */ -#ifdef __STDC__ -/*ARGSUSED*/ -int EnableIOPorts(const int NumPorts, const Word *Ports) -#else -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -int NumPorts; -Word *Ports; -#endif -{ -#ifdef __powerpc__ - if (IOEnabled++ == 0) { - ioBase = (unsigned char *) smem_create("IOBASE", - (char *)0x80000000, 64*1024, SM_READ|SM_WRITE); - if (ioBase == (void *) -1) { - ioBase = NULL; - IOEnabled--; - return -1; - } - } -#endif - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. - * For LynxOS this is a no-op. - */ -#ifdef __STDC__ -/*ARGSUSED*/ -int DisableIOPorts(const int NumPorts, const Word *Port) -#else -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -int NumPorts; -Word *Port; -#endif -{ -#ifdef __powerpc__ - if (--IOEnabled == 0 && ioBase) { - smem_create(NULL, (char *) ioBase, 0, SM_DETACH); - smem_remove("IOBASE"); - ioBase = NULL; - } -#endif - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -#ifdef __STDC__ -void ShortSleep(const int Delay) -#else -void ShortSleep(Delay) -int Delay; -#endif -{ - usleep(Delay * 1000); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c:3.5 Thu Mar 6 19:28:57 1997 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c Fri Jan 18 15:24:53 2002 @@ -1,236 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c,v 3.5 1997/03/07 00:28:57 hohndel Exp $ */ -/* - * (c) Copyright 1993,1994 by Robert V. Baron - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * ROBERT V. BARON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Robert V. Baron shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Robert V. Baron. - * - */ -/* $XConsortium: OS_Mach.c /main/5 1996/02/21 17:11:12 kaleb $ */ - -#include "Probe.h" - -#include -#include -#include - -/* These can be Mach 2.5 or 3.0 headers */ -#include -#include -#include -#ifdef MACH_PORT_NULL -#define MACH3 /* they must have been 3.0 headers beckerd@cs.unc.edu */ -#endif -#undef task_self - -static int IOPL_fd = -1; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. For Mach, we disable - * IO protection, since this is currently the only way to access any - * IO registers. - */ -int screen_addr; - -int OpenVideo() -{ - int ret; -#define C /*Bios_Base*/ 0xc0000 -#define S 0x40000 - - if ((IOPL_fd = open("/dev/iopl", O_RDWR, 0)) < 0) { - fprintf(stderr, "Failed to open /dev/iopl\n"); - return -1; - } -#define KERN_SUCESS 0 - if (KERN_SUCESS != vm_allocate(task_self(), &screen_addr, S, TRUE)) { - fprintf(stderr, "Failed vmallocate %x\n", S); - close(IOPL_fd); - return -1; - } - if (mmap(screen_addr+C, S, 3, 1, IOPL_fd, C) < 0) { - fprintf(stderr, "Failed to mmap %x bytes at %x\n", S, C); - vm_deallocate(task_self(), screen_addr, S); - close(IOPL_fd); - return -1; - } - return(IOPL_fd); -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. For Mach, we re-enable - * IO protection. - */ -void CloseVideo() -{ - if (KERN_SUCESS != vm_deallocate(task_self(), screen_addr, S)) { - fprintf(stderr, "Failed vmdeallocate %x\n", S); - } - close(IOPL_fd); -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return((Byte *)0); -} - -Byte *MapMem(address,size) - unsigned long address; - unsigned long size; -{ - return((Byte *)0); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) -Byte *base; -{ - return; -} - -void UnMapMem(base,size) -Byte *base; -unsigned long size; -{ - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Word tmp; - Byte *Base = (Byte *)(screen_addr + Bios_Base + Offset); - -#ifdef DEBUG - {int i; - fprintf(stderr, "ReadBIOS(Offset %x, Buffer %x, Len %x) .. ", - Offset, Buffer, Len); - for (i=0;i - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * PHILIP HOMBURG BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Philip Homburg shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Philip Homburg. - * - */ -/* $XConsortium: OS_Minix.c /main/5 1996/02/21 17:11:16 kaleb $ */ - -#include "Probe.h" - -#include -#include -#include -#include - -static int CONS_fd = -1; -static int BIOS_fd = -1; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. This also gives us - * access to all I/O registers and the interrupt enable/disable bit. - */ -int OpenVideo() -{ - void *base; - u32_t aligned_base; - struct mio_map mio_map; - - if (geteuid() != 0) - { - fprintf(stderr, - "%s: Must be run as root\n", - MyName); - return(-1); - } - base= malloc(0x21000); - if (base == NULL) - { - fprintf(stderr, - "%s: Cannot allocate enough memory to map /dev/vga\n", - MyName); - return(-1); - } - aligned_base= (((unsigned long)base) + 0xFFF) & ~0xFFF; - - if ((CONS_fd = open("/dev/vga", O_RDWR, 0)) == -1) - { - fprintf(stderr, "%s: Cannot open /dev/vga\n", - MyName); - return(-1); - } - mio_map.mm_base= aligned_base; - mio_map.mm_size= 0x20000; /* 128K */ - if (ioctl(CONS_fd, MIOCMAP, &mio_map) == -1) - { - fprintf(stderr, "%s: Cannot map /dev/vga\n", - MyName); - close(CONS_fd); - CONS_fd= -1; - return(-1); - } - return(CONS_fd); -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. For Minix, this removes access - * to I/O registers. - */ -void CloseVideo() -{ - if (CONS_fd > 0) - { - close(CONS_fd); - CONS_fd= -1; - } -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return((Byte *)0); -} - -Byte *MapMem(adress,size) - unsigned long address; - unsigned long size; -{ - return((Byte*)0); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) -Byte *base; -{ - return; -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Word tmp; - Byte *Base = Bios_Base + Offset; - - if (BIOS_fd == -1) - { - if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0) - { - fprintf(stderr, "%s: cannot open /dev/mem\n", MyName); - return(-1); - } - } - if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) - { - /* - * Sanity check... - */ - (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET); - (void)read(BIOS_fd, &tmp, 2); - if (tmp != (Word)0xAA55) - { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Base); - return(-1); - } - } - if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0) - { - fprintf(stderr, "%s: BIOS seek failed\n", MyName); - return(-1); - } - if (read(BIOS_fd, Buffer, Len) != Len) - { - fprintf(stderr, "%s: BIOS read failed\n", MyName); - return(-1); - } - return(Len); -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For Minix, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - if (CONS_fd == -1) abort(); - - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For Minix, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -void ShortSleep(Delay) -int Delay; -{ - usleep(Delay * 1000); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_NTO.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_NTO.c:1.2 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_NTO.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_NTO.c:1.2 Sat Sep 25 08:39:41 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_NTO.c Fri Jan 18 15:24:53 2002 @@ -1,224 +0,0 @@ -/* - * (c) Copyright 1998,1999 by Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * OREST ZBOROWSKI BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Orest Zborowski shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Orest Zborowski. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_NTO.c,v 1.2 1999/09/25 12:39:41 dawes Exp $ - */ - -#include "Probe.h" - -#include -#include -#include -#include - -static int VT_fd = -1; -static int BIOS_fd = -1; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. - */ -int OpenVideo() -{ - int fd; - char fn[20]; - - if (geteuid() != 0) { - fprintf(stderr, "%s: Must be run as root\n", MyName); - return(-1); - } - - if ((fd = open("/dev/console", O_WRONLY, 0)) < 0) { - fprintf(stderr, "%s: Cannot open /dev/console\n", MyName); - return(-1); - } - - if(ThreadCtl(_NTO_TCTL_IO,0)) { - close(fd); - fprintf(stderr, "Could not set I/O priviledge\n"); - return(-1); - } - - return fd; -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. - */ -void CloseVideo() -{ - int fd; - - if (VT_fd > 0) { - close(VT_fd); - } -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return( MapMem(0xA0000,0x10000) ); -} - -Byte *MapMem(address, size) - unsigned long address; - unsigned long size; -{ - int fd; - Byte *base; - - if ((fd = open("/dev/mem", O_RDWR)) < 0) { - fprintf(stderr, "%s: Failed to open /dev/mem\n", MyName); - return((Byte *)0); - } - - base = (Byte *)mmap((void *)0, size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)address); - close(fd); - - if ((long)base == -1) { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } - - return base; -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) - Byte *base; -{ - UnMapMem(base,0x10000); - return; -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - munmap((void *)base, size); - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Word tmp; - Byte *Base = Bios_Base + Offset; - Byte *mybase; - off_t myoffset; - int mysize; - - if (BIOS_fd == -1) { - if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0) { - fprintf(stderr, "%s: cannot open /dev/mem\n", MyName); - return(-1); - } - } - - if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) { - /* - * Sanity check... - */ - (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET); - (void)read(BIOS_fd, &tmp, 2); - if (tmp != (Word)0xAA55) { - fprintf(stderr, "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Base); - return(-1); - } - } - - if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0) { - fprintf(stderr, "%s: BIOS seek failed\n", MyName); - return(-1); - } - - if (read(BIOS_fd, Buffer, Len) != Len) { - fprintf(stderr, "%s: BIOS read failed\n", MyName); - return(-1); - } - - return Len; -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. - */ - -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. - */ - -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -void ShortSleep(Delay) -int Delay; -{ - usleep(Delay * 1000); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c:3.9 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c:3.9 Tue Mar 11 08:05:26 1997 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c Fri Jan 18 15:24:53 2002 @@ -1,322 +0,0 @@ -/* $XConsortium: OS_Os2.c /main/7 1996/10/27 11:46:26 kaleb $ */ -/* - * (c) Copyright 1994 by Holger Veit - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Holger Veit shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Holger Veit. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c,v 3.9 1997/03/11 13:05:26 hohndel Exp $ */ - - -#include "Probe.h" - -#define INCL_32 -#define INCL_DOS -#include - -#define UNUSED (Byte*)0xffffffffl - -HFILE consFd = -1; - -ULONG action; -char *videoDrvPath = "/dev/pmap$"; -char *ioDrvPath = "/dev/fastio$"; - -Byte* videoAddr = UNUSED; -ULONG videoSize = 0x10000; -int ioenabled = FALSE; - -static void sorry() -{ - fprintf(stderr, - "Didn't find a properly installed XF86SUP.SYS at your system\n"); - fprintf(stderr,"Please install it before retrying\n"); -} - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. For OS/2, we take - * advantage of the driver xf86sup.sys which was specifically written - * for XFree86/OS2. - * - * At this point we also try to weed out systems with outdated EMX code. - */ -int OpenVideo() -{ - ULONG rc; - HMODULE hmod; - char name[CCHMAXPATH]; - char fail[9]; - - if (DosOpen((PSZ)videoDrvPath, (PHFILE)&consFd, (PULONG)&action, - (ULONG)0, FILE_SYSTEM, FILE_OPEN, - OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY, - (ULONG)0) != 0) { - sorry(); - exit(2); - } - - /* check for correct EMX */ - if (_emx_rev < 50) { - fputs ("This program requires emx.dll revision 50 (0.9c) " - "or later.\n", stderr); - rc = DosLoadModule (fail, sizeof (fail), "emx", &hmod); - if (rc == 0) { - rc = DosQueryModuleName (hmod, sizeof (name), name); - if (rc == 0) - fprintf (stderr, "Please delete or update `%s'.\n", name); - DosFreeModule (hmod); - } - exit (2); - } - return 1; -} - -/* this structure is used as a parameter packet for the direct access - * to physical memory - */ -typedef struct { - ULONG addr; /* PHYSADDR for map, VIRTADDR for unmap */ - ULONG size; -} DIOParPkt; - -/* this structure is used as a return value for the direct access ioctl - * to physical memory - */ -typedef struct { - ULONG addr; - USHORT sel; -} DIODtaPkt; - -static Byte* UnmapPhys(Byte* addr,ULONG size) -{ - DIOParPkt par; - ULONG plen; - - par.addr = (ULONG)addr; - par.size = size; - plen = sizeof(par); - - if (consFd != -1) - DosDevIOCtl(consFd, (ULONG)0x76, (ULONG)0x45, - (PVOID)&par, (ULONG)plen, (PULONG)&plen, - NULL, 0, NULL); - return UNUSED; /* no error */ -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. - */ -void CloseVideo() -{ - if (videoAddr != UNUSED) - videoAddr = UnmapPhys(videoAddr,videoSize); - - DosClose(consFd); -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - DIOParPkt par; - ULONG plen; - DIODtaPkt dta; - ULONG dlen; - - par.addr = 0xa0000l; - par.size = videoSize; - plen = sizeof(par); - - if (consFd != -1 && - DosDevIOCtl(consFd, (ULONG)0x76, (ULONG)0x44, - (PVOID)&par, (ULONG)plen, (PULONG)&plen, - (PVOID)&dta, (ULONG)6, (PULONG)&dlen) == 0) { - if (dlen==6) { - videoAddr = (Byte*)dta.addr; - return videoAddr; - } - } else { - fprintf(stderr, "%s: Failed to map framebuffer\n", MyName); - return (Byte*)0; - } -} - -Byte *MapMem(address,size) - unsigned long address; - unsigned long size; -{ - return((Byte*)0); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) -Byte *base; -{ - UnmapPhys(videoAddr,videoSize); -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ - -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - struct { - ULONG cmd; - ULONG phys; - USHORT len; - } par; - UCHAR *dta; - ULONG plen,dlen; - int i; - - par.cmd = 0; - par.phys = (ULONG)Bios_Base+(Offset & 0xffff8000); - par.len = (Offset & 0x7fff) + Len; - plen = sizeof(par); - - dta = (UCHAR*)malloc(par.len); - dlen = Len; - - if (DosDevIOCtl(consFd, (ULONG)0x76, (ULONG)0x64, - (PVOID)&par, (ULONG)plen, (PULONG)&plen, - (PVOID)dta, (ULONG)dlen, (PULONG)&dlen)) { - fprintf(stderr, "%s: BIOS map failed, addr=%lx\n", - MyName, Bios_Base+Offset); - return -1; - } - - /* - * Sanity check... - */ - if ((Offset & 0x7fff) != 0 && - (dta[0] != 0x55 || dta[1] != 0xaa)) { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%x\n", - MyName, Bios_Base+Offset); - return -1; - } - - memcpy(Buffer,dta + (Offset & 0x7fff), Len); - free(dta); - return(Len); -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. - */ -USHORT callgate[3] = {0,0,0}; - -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - HFILE hfd; - ULONG dlen; - - /* no need to call multiple times */ - if (ioenabled) return 0; - - if (DosOpen((PSZ)ioDrvPath, (PHFILE)&hfd, (PULONG)&action, - (ULONG)0, FILE_SYSTEM, FILE_OPEN, - OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY, - (ULONG)0) != 0) { - sorry(); - return -1; - } - callgate[0] = callgate[1] = 0; - - if (DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x64, - NULL, 0, NULL, - (ULONG*)&callgate[2], sizeof(USHORT), &dlen) != 0) { - sorry(); - DosClose(hfd); - return -1; - } - - asm volatile ("movl $13,%%ebx;.byte 0xff,0x1d;.long _callgate" - : /*no outputs */ - : /*no inputs */ - : "eax","ebx","ecx","edx","cc"); - - ioenabled = TRUE; - return 0; -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. - * This is a no op here: I/O access is implicitly enabled for this - * process through a special library. - */ -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - * - */ -void ShortSleep(Delay) -int Delay; -{ - DosSleep(Delay ? Delay : 1); -} - Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX.c:1.2 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX.c:1.2 Sat Sep 25 08:39:42 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX.c Fri Jan 18 15:24:53 2002 @@ -1,234 +0,0 @@ -/* - * (c) Copyright 1998 by Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * OREST ZBOROWSKI BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Orest Zborowski shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Orest Zborowski. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX.c,v 1.2 1999/09/25 12:39:42 dawes Exp $ - */ - -#include "Probe.h" - -#include -#include -#include -#include -#include -#include -#include - -static int CONS_fd = -1; -static int PHMEM_fd = -1; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. On QNX, only allow the - * user to run from a text console, so that we do not mess any Photon - * drivers. - */ -int OpenVideo() -{ - int fd; - - if (geteuid() != 0) - { - fprintf(stderr, - "%s: Must be run as root\n", - MyName); - return(-1); - } - -/* if ((fd = open("/dev/con1", O_WRONLY, 0)) < 0) - { - fprintf(stderr, "%s: Cannot open /dev/console\n", MyName); - return(-1); - }*/ - CONS_fd = fd; - return (1); -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. - */ -void CloseVideo() -{ - - if(CONS_fd > 0) { - close(CONS_fd); - CONS_fd = -1; - } -} -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return( MapMem(0xA0000,0x10000) ); -} - -/* - * MapMem() is used to map a chunk of physical memory. We use the - * shm_open ("Physical"...) and the mmap mechanism. - * - */ -Byte *MapMem(address, size) - unsigned long address; - unsigned long size; -{ - int fd; - Byte *base; - - if(PHMEM_fd < 0) { - if ((fd = shm_open("Physical", O_RDWR, 0777)) < 0) { - fprintf(stderr, "%s: Failed to open /dev/mem\n", MyName); - return((Byte *)0); - } - PHMEM_fd = fd; - } - base = (Byte *)mmap((caddr_t)0, size, PROT_READ|PROT_WRITE, - MAP_SHARED, PHMEM_fd, (off_t)address); - /* close(fd); */ - if ((long)base == -1) - { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } - return(base); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) - Byte *base; -{ - UnMapMem(base,0x10000); - return; -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - munmap((caddr_t)base, size); - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Byte *VirtBase; - - if (PHMEM_fd == -1) - { - if ((PHMEM_fd = shm_open("Physical", O_RDWR, 0777)) < 0) - { - fprintf(stderr, "%s: cannot open Physical memory\n", MyName); - return(-1); - } - } - - /* Use mmap to map BIOS region. Note the restrictions on - * mmap alignement of offset variable (which must be on a page - * boundary). - */ - VirtBase = (Byte *) mmap(0, (size_t)((Offset & 0x7fff) + Len), PROT_READ, - MAP_SHARED, PHMEM_fd, - (off_t) (Bios_Base + (Offset & 0xffff8000))); - if(VirtBase == -1) { - fprintf(stderr, - "%s: Could not mmap BIOS memory space, errno=%i\n", - MyName, errno); - return(-1); - } - - /* So now we have our mapping to the BIOS region */ - /* Do a sanity check on what we have just mapped */ - if (((off_t)((off_t)Offset & 0x7FFF) != (off_t)0) && - (VirtBase[0] != 0x55) && - (VirtBase[1] != 0xaa)) { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Bios_Base + Offset); - munmap(VirtBase, (Offset & 0x7fff) + Len); - return(-1); - } - memcpy(Buffer, VirtBase + (Offset & 0x7fff), Len); - munmap(VirtBase, (Offset & 0x7fff) + Len); - return(Len); -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. The - * app is already compiled as Privity level 1 (-T1) so that IO port acces - * is already granted. - */ -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For Linux, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -void ShortSleep(Delay) -int Delay; -{ - delay(Delay); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX4.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX4.c:1.1 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX4.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX4.c:1.1 Sun Dec 26 19:45:44 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_QNX4.c Fri Jan 18 15:24:53 2002 @@ -1,233 +0,0 @@ -/* - * (c) Copyright 1998 by Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * OREST ZBOROWSKI BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Orest Zborowski shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Orest Zborowski. - * - */ - -#include "Probe.h" - -#include -#include -#include -#include -#include -#include -#include - -static int CONS_fd = -1; -static int PHMEM_fd = -1; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. On QNX4, only allow the - * user to run from a text console, so that we do not mess any Photon - * drivers. - */ -int OpenVideo() -{ - int fd; - - if (geteuid() != 0) - { - fprintf(stderr, - "%s: Must be run as root\n", - MyName); - return(-1); - } - -/* if ((fd = open("/dev/con1", O_WRONLY, 0)) < 0) - { - fprintf(stderr, "%s: Cannot open /dev/console\n", MyName); - return(-1); - }*/ - CONS_fd = fd; - return (1); -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. - */ -void CloseVideo() -{ - - if(CONS_fd > 0) { - close(CONS_fd); - CONS_fd = -1; - } -} -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return( MapMem(0xA0000,0x10000) ); -} - -/* - * MapMem() is used to map a chunk of physical memory. We use the - * shm_open ("Physical"...) and the mmap mechanism. - * - */ -Byte *MapMem(address, size) - unsigned long address; - unsigned long size; -{ - int fd; - Byte *base; - - if(PHMEM_fd < 0) { - if ((fd = shm_open("Physical", O_RDWR, 0777)) < 0) { - fprintf(stderr, "%s: Failed to open /dev/mem\n", MyName); - return((Byte *)0); - } - PHMEM_fd = fd; - } - base = (Byte *)mmap((caddr_t)0, size, PROT_READ|PROT_WRITE, - MAP_SHARED, PHMEM_fd, (off_t)address); - /* close(fd); */ - if ((long)base == -1) - { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } - return(base); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) - Byte *base; -{ - UnMapMem(base,0x10000); - return; -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - munmap((caddr_t)base, size); - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Byte *VirtBase; - - if (PHMEM_fd == -1) - { - if ((PHMEM_fd = shm_open("Physical", O_RDWR, 0777)) < 0) - { - fprintf(stderr, "%s: cannot open Physical memory\n", MyName); - return(-1); - } - } - - /* Use mmap to map BIOS region. Note the restrictions on - * mmap alignement of offset variable (which must be on a page - * boundary). - */ - VirtBase = (Byte *) mmap(0, (size_t)((Offset & 0x7fff) + Len), PROT_READ, - MAP_SHARED, PHMEM_fd, - (off_t) (Bios_Base + (Offset & 0xffff8000))); - if(VirtBase == -1) { - fprintf(stderr, - "%s: Could not mmap BIOS memory space, errno=%i\n", - MyName, errno); - return(-1); - } - - /* So now we have our mapping to the BIOS region */ - /* Do a sanity check on what we have just mapped */ - if (((off_t)((off_t)Offset & 0x7FFF) != (off_t)0) && - (VirtBase[0] != 0x55) && - (VirtBase[1] != 0xaa)) { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Bios_Base + Offset); - munmap(VirtBase, (Offset & 0x7fff) + Len); - return(-1); - } - memcpy(Buffer, VirtBase + (Offset & 0x7fff), Len); - munmap(VirtBase, (Offset & 0x7fff) + Len); - return(Len); -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. The - * app is already compiled as Privity level 1 (-T1) so that IO port acces - * is already granted. - */ -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For Linux, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -void ShortSleep(Delay) -int Delay; -{ - delay(Delay); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c:3.21 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c:3.21 Tue Feb 29 17:39:32 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c Fri Jan 18 15:24:53 2002 @@ -1,441 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c,v 3.21 2000/02/29 22:39:32 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ -/* $XConsortium: OS_SYSV.c /main/13 1996/10/25 11:33:20 kaleb $ */ - -#if defined(sun) -/* Fix for Solaris */ -#define __EXTENSIONS__ -#endif - -#include "Probe.h" - -#include -#if defined(SCO) || defined(ESIX) -# include -#endif -#ifdef SYSV -# if !defined(O_NDELAY) && defined(O_NONBLOCK) -# define O_NDELAY O_NONBLOCK -# endif -# ifndef SCO -# include -# endif -# include -#endif -#ifdef SCO -# include -# include -#ifdef SCO -#undef _status -#endif -#else -# include -# if !defined(sun) -# include -# endif -#endif -#include -#if !defined(sun) -# include -#endif -#include -#include -#ifdef NCR -/* broken NCR */ -#define __STDC -#include -#undef __STDC -#else -#include -#endif -#ifdef SVR4 -# if !defined(sun) -# include -# endif -#endif -#ifndef V86SC_IOPL -# include -#endif -#if defined(sun) -# include -#endif - -#ifdef __STDC__ -int sysi86(int, ...); -int syscall(int, ...); -#if !defined(SCO) && !defined(SVR4) -int munmap(caddr_t, size_t); -#endif -#else -int sysi86(); -int syscall(); -#ifndef SCO -int munmap(); -#endif -#endif - -#ifdef SVR4 -# include -# if defined(sun) -# define DEV_MEM "/dev/xsvc" -# else -# ifdef SCO325 -# define DEV_MEM "/dev/mem" -# else -# define DEV_MEM "/dev/pmem" -# endif -# endif -#else -# define DEV_MEM "/dev/mem" -#endif - -#ifndef SI86IOPL -#define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL) -#define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0) -#else -#define SET_IOPL() sysi86(SI86IOPL,3) -#define RESET_IOPL() sysi86(SI86IOPL,0) -#endif - -static int VT_fd = -1; -static int VT_num = -1; -static int BIOS_fd = -1; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. For SYSV, open a new - * VT if not running on a VT. Also, disable IO protection, since we may - * need to get at extended registers. - */ -int OpenVideo() -{ - int fd; - char fn[20]; - - if (geteuid() != 0) - { - fprintf(stderr, - "%s: Must be run as root\n", - MyName); - return(-1); - } -#if !defined(sun) - if (ioctl(0, KIOCINFO, 0) == (('k'<<8)|'d')) - { - VT_fd = 0; - } - else - { -#else - VT_fd = 0; -#endif - -#if !defined(sun) - if ((fd = open("/dev/console", O_RDWR, 0)) < 0) - { - fprintf(stderr, "%s: Cannot open /dev/console\n", - MyName); - return(-1); - } - if ((ioctl(fd, VT_OPENQRY, &VT_num) < 0) || (VT_num == -1)) - { - fprintf(stderr, "%s: No free VTs\n", MyName); - return(-1); - } - close(fd); - sprintf(fn, "/dev/vt%02d", VT_num); -#else - sprintf(fn, "/dev/xsvc"); -#endif - - if ((VT_fd = open(fn, O_RDWR|O_NDELAY, 0)) < 0) - { - fprintf(stderr, "%s: Could not open VT %s\n", - MyName, fn); - return(-1); - } -#if !defined(SCO) && !defined(sun) - if (ioctl(VT_fd, VT_WAITACTIVE, VT_num) != 0) - { - fprintf(stderr, "%s: VT_WAITACTIVE failed!\n", MyName); - return(-1); - } -#endif /* SCO */ - /* - * Give the other VT time to release. - */ - sleep(1); -#if !defined(sun) - } -#endif - (void)SET_IOPL(); - return(VT_fd); -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. For SYSV, close the VT if it's open. - * Also, re-enable IO protection. - */ -void CloseVideo() -{ - if (VT_fd != -1) - { - (void)RESET_IOPL(); - } - if (VT_fd > 0) - { - close(VT_fd); - } -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ -#if defined(SVR4) - int fd; - Byte *base; - - if ((fd = open(DEV_MEM, O_RDWR)) < 0) - { - fprintf(stderr, "%s: Failed to open %s\n", MyName, DEV_MEM); - return((Byte *)0); - } - base = (Byte *)mmap((caddr_t)0, 0x10000, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)0xA0000); - close(fd); - if ((long)base == -1) - { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } -#elif defined(OLDSCO) - static Byte *base = (Byte *)0; - ioctl(VT_fd, KDSETMODE, KD_GRAPHICS); - if (base == (Byte *) 0) - base = (Byte *) ioctl(VT_fd, MAPCONS, 0L); -#else /* SVR4 */ - static Byte *base = (Byte *)0; - static struct kd_memloc vgaDSC; - - ioctl(VT_fd, KDSETMODE, KD_GRAPHICS); - if (base == (Byte *)0) - { - base = (Byte *)(((unsigned int)malloc(0x11000) & ~0xFFF) - + 0x1000); - vgaDSC.vaddr = (char *)base; - vgaDSC.physaddr = (char *)0xA0000; - vgaDSC.length = 0x10000; - vgaDSC.ioflg = 1; - } - if (ioctl(VT_fd, KDMAPDISP, &vgaDSC) < 0) - { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } -#endif /* SVR4 */ - return(base); -} - -Byte *MapMem(address,size) - unsigned long address; - unsigned long size; -{ - return((Byte*)0); -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) -Byte *base; -{ -#ifdef SVR4 - munmap((caddr_t)base, 0x10000); -#else /* SVR4 */ -# ifndef SCO - ioctl(VT_fd, KDUNMAPDISP, 0); -# endif - ioctl(VT_fd, KDSETMODE, KD_TEXT); -#endif -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ -#ifndef SVR4 - Word tmp; - Byte *Base = Bios_Base + Offset; - - if (BIOS_fd == -1) - { - if ((BIOS_fd = open(DEV_MEM, O_RDONLY, 0)) < 0) - { - fprintf(stderr, "%s: cannot open %s\n", - MyName, DEV_MEM); - return(-1); - } - } - if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) - { - /* - * Sanity check... - */ - (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET); - (void)read(BIOS_fd, &tmp, 2); - if (tmp != (Word)0xAA55) - { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Base); - return(-1); - } - } - if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0) - { - fprintf(stderr, "%s: BIOS seek failed\n", MyName); - return(-1); - } - if (read(BIOS_fd, Buffer, Len) != Len) - { - fprintf(stderr, "%s: BIOS read failed\n", MyName); - return(-1); - } - return(Len); -#else /* SVR4 */ - Byte *Base = Bios_Base + Offset; - Word *tmp; - Byte *ptr; - unsigned long page_offset = (unsigned long)Base & 0xFFF; - unsigned long mmap_base = (unsigned long)Base & ~0xFFF; - unsigned long mmap_len = Len + page_offset; - - if (BIOS_fd == -1) - { - if ((BIOS_fd = open(DEV_MEM, O_RDONLY, 0)) < 0) - { - fprintf(stderr, "%s: cannot open %s\n", - MyName, DEV_MEM); - return(-1); - } - } - if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) - { - tmp = (Word *)mmap((caddr_t)0, 0x1000, PROT_READ, MAP_SHARED, - BIOS_fd, (off_t)((off_t)Base & 0xF8000)); - if ((int)tmp == -1) - { - fprintf(stderr, "%s: Failed to mmap() %s, addr=%x\n", - MyName, DEV_MEM, (int)Base); - return(-1); - } - if (*tmp != (Word)0xAA55) - { - fprintf(stderr, - "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Base); - return(-1); - } - (void)munmap((caddr_t)tmp, 0x1000); - } - ptr = (Byte *)mmap((caddr_t)0, mmap_len, PROT_READ, MAP_SHARED, - BIOS_fd, (off_t)mmap_base); - if ((int)ptr == -1) - { - fprintf(stderr, "%s: Failed to mmap() %s, addr=%x\n", - MyName, DEV_MEM, (int)Base); - return(-1); - } - (void)memcpy((void *)Buffer, (void *)(ptr + page_offset), Len); - (void)munmap((caddr_t)ptr, mmap_len); - return(Len); -#endif /* SVR4 */ -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For SYSV, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For SYSV, - * we've disabled IO protections so this is a no-op. - */ -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -void ShortSleep(Delay) -int Delay; -{ - syscall(3112, Delay); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_cygwin.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_cygwin.c:1.1 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_cygwin.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_cygwin.c:1.1 Wed Aug 23 16:56:50 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_cygwin.c Fri Jan 18 15:24:53 2002 @@ -1,221 +0,0 @@ -/* - * (c) Copyright 1998,1999 by Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * OREST ZBOROWSKI BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Orest Zborowski shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Orest Zborowski. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_cygwin.c,v 1.1 2000/08/23 20:56:50 dawes Exp $ - */ - -#include "Probe.h" - -#include -#include -#include -#include -#include -#include -#include - -static int VT_fd = -1; -static int BIOS_fd = -1; - -/* - * OpenVideo -- - * - * Enable access to the installed video hardware. - */ -int OpenVideo() -{ - int fd; - char fn[20]; - - if (geteuid() != 0) { - fprintf(stderr, "%s: Must be run as root\n", MyName); - return(-1); - } - - if ((fd = open("/dev/conin", O_WRONLY, 0)) < 0) { - fprintf(stderr, "%s: Cannot open /dev/conin\n", MyName); - return(-1); - } - - return fd; -} - -/* - * CloseVideo -- - * - * Disable access to the video hardware. - */ -void CloseVideo() -{ - int fd; - - if (VT_fd > 0) { - close(VT_fd); - } -} - -/* - * MapVGA -- - * - * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for - * the process for use in probing memory. - */ -Byte *MapVGA() -{ - return( MapMem(0xA0000,0x10000) ); -} - -Byte *MapMem(address, size) - unsigned long address; - unsigned long size; -{ - int fd; - Byte *base; - - if ((fd = open("/dev/zero", O_RDWR)) < 0) { - fprintf(stderr, "%s: Failed to open /dev/zero\n", MyName); - return((Byte *)0); - } - - base = (Byte *)mmap((void *)0, size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)address); - close(fd); - - if ((long)base == -1) { - fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName); - return((Byte *)0); - } - - return base; -} - -/* - * UnMapVGA -- - * - * Unmap the VGA memory window. - */ -void UnMapVGA(base) - Byte *base; -{ - UnMapMem(base,0x10000); - return; -} - -void UnMapMem(base,size) - Byte *base; - unsigned long size; -{ - munmap((void *)base, size); - return; -} - -/* - * ReadBIOS -- - * - * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into - * buffer 'Buffer'. - */ -int ReadBIOS(Offset, Buffer, Len) -unsigned Offset; -Byte *Buffer; -int Len; -{ - Word tmp; - Byte *Base = Bios_Base + Offset; - Byte *mybase; - off_t myoffset; - int mysize; - - if (BIOS_fd == -1) { - if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0) { - fprintf(stderr, "%s: cannot open /dev/mem\n", MyName); - return(-1); - } - } - - if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) { - /* - * Sanity check... - */ - (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET); - (void)read(BIOS_fd, &tmp, 2); - if (tmp != (Word)0xAA55) { - fprintf(stderr, "%s: BIOS sanity check failed, addr=%x\n", - MyName, (int)Base); - return(-1); - } - } - - if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0) { - fprintf(stderr, "%s: BIOS seek failed\n", MyName); - return(-1); - } - - if (read(BIOS_fd, Buffer, Len) != Len) { - fprintf(stderr, "%s: BIOS read failed\n", MyName); - return(-1); - } - - return Len; -} - -/* - * EnableIOPort -- - * - * Enable access to 'NumPorts' IO ports listed in array 'Ports'. - */ - -/*ARGSUSED*/ -int EnableIOPorts(NumPorts, Ports) -CONST int NumPorts; -CONST Word *Ports; -{ - return(0); -} - -/* - * DisableIOPort -- - * - * Disable access to 'NumPorts' IO ports listed in array 'Ports'. - */ - -/*ARGSUSED*/ -int DisableIOPorts(NumPorts, Port) -CONST int NumPorts; -CONST Word *Port; -{ - return(0); -} - -/* - * ShortSleep -- - * - * Sleep for the number of milliseconds specified in 'Delay'. - */ -void ShortSleep(Delay) -int Delay; -{ - usleep(Delay * 1000); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c:3.4 Mon Dec 23 01:31:29 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c Fri Jan 18 15:24:53 2002 @@ -1,145 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c,v 3.4 1996/12/23 06:31:29 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ -/* $XConsortium: Oak.c /main/5 1996/02/21 17:11:32 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x3DE, 0x3DF}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Oak __STDCARGS((int)); - -Chip_Descriptor Oak_Descriptor = { - "Oak", - Probe_Oak, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_Oak, -}; - -Bool Probe_Oak(Chipset) -int *Chipset; -{ - Byte temp; - Bool result = FALSE; - - EnableIOPorts(NUMPORTS, Ports); - - if (testinx2(0x3DE, 0x0D, 0x38)) - { - result = TRUE; - if (testinx2(0x3DE, 0x23, 0x1F)) - { - if ((rdinx(0x3DE, 0x00) & 0x02) == 0x00) - { - *Chipset = CHIP_OAK087; - } - else - { - *Chipset = CHIP_OAK083; - } - } - else - { - temp = inp(0x3DE) >> 5; - switch (temp) - { - case 0x00: - *Chipset = CHIP_OAK037C; - break; - case 0x02: - *Chipset = CHIP_OAK067; - break; - case 0x05: - *Chipset = CHIP_OAK077; - break; - case 0x07: - *Chipset = CHIP_OAK057; - break; - default: - Chip_data = temp; - *Chipset = CHIP_OAK_UNK; - break; - } - } - } - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -static int MemProbe_Oak(Chipset) -int Chipset; -{ - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - switch (Chipset) - { - case CHIP_OAK083: - case CHIP_OAK087: - switch (rdinx(0x3DE, 0x02) & 0x06) - { - case 0x00: - Mem = 256; - break; - case 0x02: - Mem = 512; - break; - case 0x04: - Mem = 1024; - break; - case 0x06: - Mem = 2048; - break; - } - break; - default: - switch (rdinx(0x3DE, 0x0D) >> 6) - { - case 0x00: - Mem = 256; - break; - case 0x02: - Mem = 512; - break; - case 0x01: - case 0x03: - Mem = 1024; - break; - } - break; - } - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c:3.10 xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c:3.10 Fri Aug 11 13:27:12 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c Fri Jan 18 15:24:53 2002 @@ -1,289 +0,0 @@ -/* - * PCI Probe - * - * Copyright 1996 The XFree86 Project, Inc. - * - * A lot of this comes from Robin Cutshaw's scanpci - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c,v 3.10 2000/08/11 17:27:12 dawes Exp $ */ - -/* #define DEBUGPCI */ - -#include "Probe.h" - -struct pci_config_reg *pci_devp[MAX_PCI_DEVICES + 1] = {NULL, }; - -void -xf86scanpci() -{ - unsigned long tmplong1, tmplong2, config_cmd, cmd; - unsigned char tmp1, tmp2; - unsigned int i, j, idx = 0; - int func; - struct pci_config_reg pcr; - Word PCI_CtrlIOPorts[] = { 0xCF8, 0xCFA, 0xCFC }; - int Num_PCI_CtrlIOPorts = 3; - unsigned PCI_DevIOAddrPorts[16*16]; - int Num_PCI_DevIOAddrPorts = 16*16; - int hostbridges = 0; - - for (i=0; i<16; i++) { - for (j=0; j<16; j++) - PCI_DevIOAddrPorts[(i*16)+j] = 0xC000 + (i*0x0100) + (j*4); - } - - /* Enable I/O access */ - EnableIOPorts(Num_PCI_CtrlIOPorts,PCI_CtrlIOPorts); - - outp(PCI_MODE2_ENABLE_REG, 0x00); - outp(PCI_MODE2_FORWARD_REG, 0x00); - tmp1 = inp(PCI_MODE2_ENABLE_REG); - tmp2 = inp(PCI_MODE2_FORWARD_REG); - - if ((tmp1 == 0x00) && (tmp2 == 0x00)) { - pcr._configtype = 2; -#ifdef DEBUGPCI - printf("PCI says configuration type 2\n"); -#endif - } else { - tmplong1 = inpl(PCI_MODE1_ADDRESS_REG); - outpl(PCI_MODE1_ADDRESS_REG, PCI_EN); - tmplong2 = inpl(PCI_MODE1_ADDRESS_REG); - outpl(PCI_MODE1_ADDRESS_REG, tmplong1); - if (tmplong2 == PCI_EN) { - pcr._configtype = 1; -#ifdef DEBUGPCI - printf("PCI says configuration type 1\n"); -#endif - } else { - pcr._configtype = 0; -#ifdef DEBUGPCI - printf("No PCI !\n"); -#endif -#if 0 - DisableIOPorts(0); -#endif - return; - } - } - - /* Try pci config 1 probe first */ - -#ifdef DEBUGPCI - printf("\nPCI probing configuration type 1\n"); -#endif - - pcr._pcibuses[0] = 0; - pcr._pcinumbus = 1; - pcr._pcibusidx = 0; - -#ifndef DEBUGPCI - if (pcr._configtype == 1) -#endif - do { - for (pcr._cardnum = 0x0; pcr._cardnum < 0x20; pcr._cardnum += 0x1) { - func = 0; - do { /* loop over different functions, if present */ - config_cmd = PCI_EN | (pcr._pcibuses[pcr._pcibusidx]<<16) | - (pcr._cardnum<<11) | (func<<8); - - outpl(PCI_MODE1_ADDRESS_REG, config_cmd); /* ioreg 0 */ - pcr._device_vendor = inpl(PCI_MODE1_DATA_REG); - - if (pcr._vendor == 0xFFFF) /* nothing there */ - break; - -#ifdef DEBUGPCI - printf("\npci bus 0x%x cardnum 0x%02x, vendor 0x%04x device 0x%04x\n", - pcr._pcibuses[pcr._pcibusidx], pcr._cardnum, pcr._vendor, - pcr._device); -#endif - - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x04); - pcr._status_command = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x08); - pcr._class_revision = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x0C); - pcr._bist_header_latency_cache = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x10); - pcr._base0 = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x14); - pcr._base1 = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x18); - pcr._base2 = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x1C); - pcr._base3 = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x20); - pcr._base4 = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x24); - pcr._base5 = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x30); - pcr._baserom = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x3C); - pcr._max_min_ipin_iline = inpl(PCI_MODE1_DATA_REG); - outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x40); - pcr._user_config = inpl(PCI_MODE1_DATA_REG); - - pcr._funcnum = func; - -#if 1 - /* check for pci-pci bridges */ -#define PCI_CLASS_MASK 0xff000000 -#define PCI_SUBCLASS_MASK 0x00ff0000 -#define PCI_CLASS_BRIDGE 0x06000000 -#define PCI_SUBCLASS_BRIDGE_PCI 0x00040000 - switch(pcr._class_revision & (PCI_CLASS_MASK|PCI_SUBCLASS_MASK)) { - case PCI_CLASS_BRIDGE|PCI_SUBCLASS_BRIDGE_PCI: - if (pcr._secondary_bus_number > 0) { - pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number; - } - break; - case PCI_CLASS_BRIDGE: - if ( ++hostbridges > 1) { - pcr._pcibuses[pcr._pcinumbus] = pcr._pcinumbus; - pcr._pcinumbus++; - } - break; - default: - break; - } -#else - /* check for pci-pci bridges (currently we only know Digital) */ - if ((pcr._vendor == 0x1011) && (pcr._device == 0x0001)) - if (pcr._secondary_bus_number > 0) - pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number; -#endif - - if (idx >= MAX_PCI_DEVICES) - break;; - - /* Ignore non-VGA devices */ - if (!((pcr._base_class == PCI_CLASS_PREHISTORIC && - pcr._sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) || - (pcr._base_class == PCI_CLASS_DISPLAY && - pcr._sub_class == PCI_SUBCLASS_DISPLAY_VGA) || - (pcr._base_class == PCI_CLASS_DISPLAY && - pcr._sub_class == PCI_SUBCLASS_DISPLAY_OTHER))) { - /* - * unfortunately, sometimes GLINT chips are strapped - * as class 0 subclass 0 by vendors... - */ - if( pcr._vendor != PCI_VENDOR_3DLABS ) - break; - } - - if ((pci_devp[idx] = (struct pci_config_reg *)malloc(sizeof( - struct pci_config_reg))) == (struct pci_config_reg *)NULL) { - outpl(PCI_MODE1_ADDRESS_REG, 0x00); -#if 0 - DisableIOPorts(0); -#endif - return; - } - - memcpy(pci_devp[idx++], &pcr, sizeof(struct pci_config_reg)); - pci_devp[idx] = NULL; - if((func==0) && ((pcr._header_type & PCI_MULTIFUNC_DEV) == 0)) { - /* not a multi function device */ - func = 8; - } else { - func++; - } - } while (func<8); - } - } while (++pcr._pcibusidx < pcr._pcinumbus); - -#ifndef DEBUGPCI - if (pcr._configtype == 1) { - outpl(PCI_MODE1_ADDRESS_REG, 0x00); -#if 0 - xf86DisableIOPorts(0); -#endif - return; - } -#endif - /* Now try pci config 2 probe (deprecated) */ - - outp(PCI_MODE2_ENABLE_REG, 0xF1); - outp(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ - -#ifdef DEBUGPCI - printf("\nPCI probing configuration type 2\n"); -#endif - - pcr._pcibuses[0] = 0; - pcr._pcinumbus = 1; - pcr._pcibusidx = 0; - - do { - for (pcr._ioaddr = 0xC000; pcr._ioaddr < 0xD000; pcr._ioaddr += 0x0100){ - outp(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */ - pcr._device_vendor = inpl(pcr._ioaddr); - outp(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ - - if (pcr._vendor == 0xFFFF) /* nothing there */ - continue; - /* opti chipsets that use config type 1 look like this on type 2 */ - if ((pcr._vendor == 0xFF00) && (pcr._device == 0xFFFF)) - continue; - -#ifdef DEBUGPCI - printf("\npci bus 0x%x slot at 0x%04x, vendor 0x%04x device 0x%04x\n", - pcr._pcibuses[pcr._pcibusidx], pcr._ioaddr, pcr._vendor, - pcr._device); -#endif - - outp(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */ - pcr._status_command = inpl(pcr._ioaddr + 0x04); - pcr._class_revision = inpl(pcr._ioaddr + 0x08); - pcr._bist_header_latency_cache = inpl(pcr._ioaddr + 0x0C); - pcr._base0 = inpl(pcr._ioaddr + 0x10); - pcr._base1 = inpl(pcr._ioaddr + 0x14); - pcr._base2 = inpl(pcr._ioaddr + 0x18); - pcr._base3 = inpl(pcr._ioaddr + 0x1C); - pcr._base4 = inpl(pcr._ioaddr + 0x20); - pcr._base5 = inpl(pcr._ioaddr + 0x24); - pcr._baserom = inpl(pcr._ioaddr + 0x30); - pcr._max_min_ipin_iline = inpl(pcr._ioaddr + 0x3C); - pcr._user_config = inpl(pcr._ioaddr + 0x40); - outp(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ - - /* check for pci-pci bridges (currently we only know Digital) */ - if ((pcr._vendor == 0x1011) && (pcr._device == 0x0001)) - if (pcr._secondary_bus_number > 0) - pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number; - - if (idx >= MAX_PCI_DEVICES) - continue; - - /* Ignore non-VGA devices */ - if (!((pcr._base_class == PCI_CLASS_PREHISTORIC && - pcr._sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) || - (pcr._base_class == PCI_CLASS_DISPLAY && - pcr._sub_class == PCI_SUBCLASS_DISPLAY_VGA))) - continue; - - if ((pci_devp[idx] = (struct pci_config_reg *)malloc(sizeof( - struct pci_config_reg))) == (struct pci_config_reg *)NULL) { - outp(PCI_MODE2_ENABLE_REG, 0x00); - outp(PCI_MODE2_FORWARD_REG, 0x00); -#if 0 - xf86DisableIOPorts(0); -#endif - return; - } - - memcpy(pci_devp[idx++], &pcr, sizeof(struct pci_config_reg)); - pci_devp[idx] = NULL; - } - } while (++pcr._pcibusidx < pcr._pcinumbus); - - outp(PCI_MODE2_ENABLE_REG, 0x00); - outp(PCI_MODE2_FORWARD_REG, 0x00); - -#if 0 - DisableIOPorts(0); -#endif -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h:3.36 xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h:3.36 Tue Nov 28 15:59:16 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h Fri Jan 18 15:24:53 2002 @@ -1,400 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h,v 3.36 2000/11/28 20:59:16 dawes Exp $ */ -/* - * PCI Probe - * - * Copyright 1995 The XFree86 Project, Inc. - * - * A lot of this comes from Robin Cutshaw's scanpci - * - */ - -#ifndef _PCI_H -#define _PCI_H - -/* - * Copyright 1995 by Robin Cutshaw - * - * 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 the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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. - * - */ - -struct pci_config_reg { - /* start of official PCI config space header */ - union { - unsigned long device_vendor; - struct { - unsigned short vendor; - unsigned short device; - } dv; - } dv_id; -#define _device_vendor dv_id.device_vendor -#define _vendor dv_id.dv.vendor -#define _device dv_id.dv.device - union { - unsigned long status_command; - struct { - unsigned short command; - unsigned short status; - } sc; - } stat_cmd; -#define _status_command stat_cmd.status_command -#define _command stat_cmd.sc.command -#define _status stat_cmd.sc.status - union { - unsigned long class_revision; - struct { - unsigned char rev_id; - unsigned char prog_if; - unsigned char sub_class; - unsigned char base_class; - } cr; - } class_rev; -#define _class_revision class_rev.class_revision -#define _rev_id class_rev.cr.rev_id -#define _prog_if class_rev.cr.prog_if -#define _sub_class class_rev.cr.sub_class -#define _base_class class_rev.cr.base_class - union { - unsigned long bist_header_latency_cache; - struct { - unsigned char cache_line_size; - unsigned char latency_timer; - unsigned char header_type; - unsigned char bist; - } bhlc; - } bhlc; -#define _bist_header_latency_cache bhlc.bist_header_latency_cache -#define _cache_line_size bhlc.bhlc.cache_line_size -#define _latency_timer bhlc.bhlc.latency_timer -#define _header_type bhlc.bhlc.header_type -#define _bist bhlc.bhlc.bist - union { - struct { - unsigned long dv_base0; - unsigned long dv_base1; - unsigned long dv_base2; - unsigned long dv_base3; - unsigned long dv_base4; - unsigned long dv_base5; - } dv; - struct { - unsigned long bg_rsrvd[2]; - unsigned char primary_bus_number; - unsigned char secondary_bus_number; - unsigned char subordinate_bus_number; - unsigned char secondary_latency_timer; - unsigned char io_base; - unsigned char io_limit; - unsigned short secondary_status; - unsigned short mem_base; - unsigned short mem_limit; - unsigned short prefetch_mem_base; - unsigned short prefetch_mem_limit; - } bg; - } bc; -#define _base0 bc.dv.dv_base0 -#define _base1 bc.dv.dv_base1 -#define _base2 bc.dv.dv_base2 -#define _base3 bc.dv.dv_base3 -#define _base4 bc.dv.dv_base4 -#define _base5 bc.dv.dv_base5 -#define _primary_bus_number bc.bg.primary_bus_number -#define _secondary_bus_number bc.bg.secondary_bus_number -#define _subordinate_bus_number bc.bg.subordinate_bus_number -#define _secondary_latency_timer bc.bg.secondary_latency_timer -#define _io_base bc.bg.io_base -#define _io_limit bc.bg.io_limit -#define _secondary_status bc.bg.secondary_status -#define _mem_base bc.bg.mem_base -#define _mem_limit bc.bg.mem_limit -#define _prefetch_mem_base bc.bg.prefetch_mem_base -#define _prefetch_mem_limit bc.bg.prefetch_mem_limit - unsigned long rsvd1; - unsigned long rsvd2; - unsigned long _baserom; - unsigned long rsvd3; - unsigned long rsvd4; - union { - unsigned long max_min_ipin_iline; - struct { - unsigned char int_line; - unsigned char int_pin; - unsigned char min_gnt; - unsigned char max_lat; - } mmii; - } mmii; -#define _max_min_ipin_iline mmii.max_min_ipin_iline -#define _int_line mmii.mmii.int_line -#define _int_pin mmii.mmii.int_pin -#define _min_gnt mmii.mmii.min_gnt -#define _max_lat mmii.mmii.max_lat - /* I don't know how accurate or standard this is (DHD) */ - union { - unsigned long user_config; - struct { - unsigned char user_config_0; - unsigned char user_config_1; - unsigned char user_config_2; - unsigned char user_config_3; - } uc; - } uc; -#define _user_config uc.user_config -#define _user_config_0 uc.uc.user_config_0 -#define _user_config_1 uc.uc.user_config_1 -#define _user_config_2 uc.uc.user_config_2 -#define _user_config_3 uc.uc.user_config_3 - /* end of official PCI config space header */ - unsigned long _pcibusidx; - unsigned long _pcinumbus; - unsigned long _pcibuses[16]; - unsigned short _configtype; /* config type found */ - unsigned short _ioaddr; /* config type 1 - private I/O addr */ - unsigned long _cardnum; /* config type 2 - private card number */ - unsigned short _funcnum; /* private function number */ -}; - -#define PCI_EN 0x80000000 -#define MAX_PCI_DEVICES 64 -#define PCI_MULTIFUNC_DEV 0x80 - -/* Registers */ -#define PCI_REG_USERCONFIG 0x40 - -/* Base Classes */ -#define PCI_CLASS_PREHISTORIC 0x00 -#define PCI_CLASS_DISPLAY 0x03 - -/* Sub Classes */ -#define PCI_SUBCLASS_PREHISTORIC_VGA 0x01 -#define PCI_SUBCLASS_DISPLAY_VGA 0x00 -#define PCI_SUBCLASS_DISPLAY_OTHER 0x80 - -/* PCI Configuration address */ -#define PCI_MODE1_ADDRESS_REG 0xCF8 -#define PCI_MODE1_DATA_REG 0xCFC - -#define PCI_MODE2_ENABLE_REG 0xCF8 -#ifdef PC98 -#define PCI_MODE2_FORWARD_REG 0xCF9 -#else -#define PCI_MODE2_FORWARD_REG 0xCFA -#endif - -extern struct pci_config_reg *pci_devp[]; - -#define PCI_VENDOR_NCR_1 0x1000 -#define PCI_VENDOR_ATI 0x1002 -#define PCI_VENDOR_AVANCE 0x1005 -#define PCI_VENDOR_TSENG 0x100C -#define PCI_VENDOR_WEITEK 0x100E -#define PCI_VENDOR_DIGITAL 0x1011 -#define PCI_VENDOR_CIRRUS 0x1013 -#define PCI_VENDOR_NCR_2 0x101A -#define PCI_VENDOR_TRIDENT 0x1023 -#define PCI_VENDOR_MATROX 0x102B -#define PCI_VENDOR_CHIPSTECH 0x102C -#define PCI_VENDOR_SIS 0x1039 -#define PCI_VENDOR_SGS 0x104A -#define PCI_VENDOR_NUMNINE 0x105D -#define PCI_VENDOR_UMC 0x1060 -#define PCI_VENDOR_NVIDIA 0x10DE -#define PCI_VENDOR_ALLIANCE 0x1142 -#define PCI_VENDOR_TRITECH 0x1292 -#define PCI_VENDOR_NVIDIA_SGS 0x12D2 -#define PCI_VENDOR_RENDITION 0x1163 -#define PCI_VENDOR_SIGMADESIGNS 0x1236 -#define PCI_VENDOR_S3 0x5333 -#define PCI_VENDOR_ARK 0xEDD8 -#define PCI_VENDOR_3DLABS 0x3D3D -#define PCI_VENDOR_INTERGRAPHICS 0x10EA -#define PCI_VENDOR_SMI 0x126F - -/* Matrox */ -#define PCI_CHIP_MGA2085PX 0x0518 -#define PCI_CHIP_MGA2064W 0x0519 -#define PCI_CHIP_MGA1064SG 0x051A -#define PCI_CHIP_MGA2164W 0x051B -#define PCI_CHIP_MGA2164W_AGP 0x051F -#define PCI_CHIP_MGAG100_PCI 0x1000 -#define PCI_CHIP_MGAG100_AGP 0x1001 -#define PCI_CHIP_MGAG200_PCI 0x0520 -#define PCI_CHIP_MGAG200_AGP 0x0521 - -/* ATI */ -#define PCI_CHIP_MACH32 0x4158 - /* Other ATI ChipID's deleted; not used by SuperProbe */ - -/* Avance Logic */ -#define PCI_CHIP_ALG2301 0x2301 - -/* Tseng */ -#define PCI_CHIP_ET4000_W32P_A 0x3202 -#define PCI_CHIP_ET4000_W32P_B 0x3205 -#define PCI_CHIP_ET4000_W32P_D 0x3206 -#define PCI_CHIP_ET4000_W32P_C 0x3207 -#define PCI_CHIP_ET6000 0x3208 -#define PCI_CHIP_ET6300 0x4702 - -/* Weitek */ -#define PCI_CHIP_P9000 0x9001 -#define PCI_CHIP_P9100 0x9100 - -/* Cirrus Logic */ -#define PCI_CHIP_GD7548 0x0038 -#define PCI_CHIP_GD5430 0x00A0 -#define PCI_CHIP_GD5434_4 0x00A4 -#define PCI_CHIP_GD5434_8 0x00A8 -#define PCI_CHIP_GD5436 0x00AC -#define PCI_CHIP_GD5446 0x00B8 -#define PCI_CHIP_GD5480 0x00BC -#define PCI_CHIP_GD5462 0x00D0 -#define PCI_CHIP_GD5464 0x00D4 -#define PCI_CHIP_GD5464BD 0x00D5 -#define PCI_CHIP_GD5465 0x00D6 -#define PCI_CHIP_GD7542 0x1200 -#define PCI_CHIP_GD7543 0x1202 -#define PCI_CHIP_GD7541 0x1204 - -/* Trident */ -#define PCI_CHIP_9320 0x9320 -#define PCI_CHIP_9420 0x9420 -#define PCI_CHIP_9440 0x9440 -#define PCI_CHIP_9660 0x9660 -#define PCI_CHIP_9680 0x9680 -#define PCI_CHIP_9682 0x9682 -/* Bill Mair */ -#define PCI_CHIP_939A 0x939A -#define PCI_CHIP_9388 0x9388 -#define PCI_CHIP_9397 0x9397 -#define PCI_CHIP_9520 0x9520 -#define PCI_CHIP_9750 0x9750 -#define PCI_CHIP_9850 0x9850 - -/* Chips & Tech */ -#define PCI_CHIP_65545 0x00D8 -#define PCI_CHIP_65548 0x00DC -#define PCI_CHIP_65550 0x00E0 -#define PCI_CHIP_65554 0x00E4 -#define PCI_CHIP_65555 0x00E5 -#define PCI_CHIP_68554 0x00F4 - -/* SiS */ -#define PCI_CHIP_SG86C201 0x0001 -#define PCI_CHIP_SG86C202 0x0002 -#define PCI_CHIP_SG86C205 0x0205 -#define PCI_CHIP_SG86C215 0x0215 -#define PCI_CHIP_SG86C225 0x0225 -#define PCI_CHIP_SIS5598 0x0200 -#define PCI_CHIP_SIS5597 0x0200 -#define PCI_CHIP_SIS6326 0x6326 -#define PCI_CHIP_SIS530 0x6306 -#define PCI_CHIP_SIS620 0x6306 -#define PCI_CHIP_SIS300 0x0300 -#define PCI_CHIP_SIS630 0x6300 -#define PCI_CHIP_SIS540 0x5300 - -/* SGS */ -#define PCI_CHIP_STG2000 0x0008 -#define PCI_CHIP_STG1764 0x0009 - -/* NVIDIA */ -#define PCI_CHIP_NV1 0x0008 -#define PCI_CHIP_DAC64 0x0009 - -/* NVIDIA & SGS */ -#define PCI_CHIP_RIVA128 0x0018 - -/* Number Nine */ -#define PCI_CHIP_I128 0x2309 -#define PCI_CHIP_I128_2 0x2339 -#define PCI_CHIP_I128_3 0x493D - -/* Alliance Semiconductor */ -#define PCI_CHIP_PM6410 0x3210 -#define PCI_CHIP_PM6422 0x6422 -#define PCI_CHIP_PMAT24 0x6424 -#define PCI_CHIP_PMAT3D 0x643D - -/* Rendition */ -#define PCI_CHIP_V1000 0x0001 -#define PCI_CHIP_V2000 0x0002 /* just guessing */ - - -/* SIGMA DESIGNS */ -#define PCI_CHIP_SD_REALMAGIG64GX 0x6401 - -/* S3 */ -#define PCI_CHIP_TRIO 0x8811 -#define PCI_CHIP_AURORA64VP 0x8812 -#define PCI_CHIP_TRIO64UVP 0x8814 -#define PCI_CHIP_TRIO64V2_DXGX 0x8901 -#define PCI_CHIP_PLATO_PX 0x8902 -#define PCI_CHIP_868 0x8880 -#define PCI_CHIP_928 0x88B0 -#define PCI_CHIP_864_0 0x88C0 -#define PCI_CHIP_864_1 0x88C1 -#define PCI_CHIP_964_0 0x88D0 -#define PCI_CHIP_964_1 0x88D1 -#define PCI_CHIP_968 0x88F0 -#define PCI_CHIP_ViRGE 0x5631 -#define PCI_CHIP_ViRGE_VX 0x883D -#define PCI_CHIP_ViRGE_DXGX 0x8A01 -#define PCI_CHIP_ViRGE_GX2 0x8A10 -#define PCI_CHIP_ViRGE_MX 0x8C01 -#define PCI_CHIP_ViRGE_MXP 0x8C03 -#define PCI_CHIP_TRIO3D_B 0x8903 -#define PCI_CHIP_TRIO3D 0x8904 -#define PCI_CHIP_TRIO3D_2X 0x8A13 -#define PCI_CHIP_SAVAGE3D 0x8A20 -#define PCI_CHIP_SAVAGE3D_M 0x8A21 -#define PCI_CHIP_SAVAGE4 0x8A22 -#define PCI_CHIP_SAVAGE2000 0x9102 - -/* ARK Logic */ -#define PCI_CHIP_1000PV 0xA091 -#define PCI_CHIP_2000PV 0xA099 -#define PCI_CHIP_2000MT 0xA0A1 -#define PCI_CHIP_2000MI 0xA0A9 - -/* 3Dlabs */ -#define PCI_CHIP_3DLABS_300SX 0x0001 -#define PCI_CHIP_3DLABS_500TX 0x0002 -#define PCI_CHIP_3DLABS_DELTA 0x0003 -#define PCI_CHIP_3DLABS_PERMEDIA 0x0004 - -/* Tritech Microelectronics */ -#define PCI_CHIP_TR25202 0xFC02 - -/* Intergraphics */ -#define PCI_CHIP_INTERG_1680 0x1680 -#define PCI_CHIP_INTERG_1682 0x1682 - -/* Silicon Motion */ -#define PCI_CHIP_SMI_910 0x0910 -#define PCI_CHIP_SMI_810 0x0810 -#define PCI_CHIP_SMI_820 0x0820 -#define PCI_CHIP_SMI_710 0x0710 -#define PCI_CHIP_SMI_712 0x0712 -#define PCI_CHIP_SMI_720 0x0720 - -/* Increase this as required */ -#define MAX_DEV_PER_VENDOR 18 - -#endif /* _PCI_H */ Index: xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h:3.27 xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h:3.27 Tue Nov 28 15:59:16 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h Fri Jan 18 15:24:53 2002 @@ -1,35 +0,0 @@ -/* $XConsortium: PatchLevel.h /main/15 1996/10/28 04:46:29 kaleb $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h,v 3.27 2000/11/28 20:59:16 dawes Exp $ */ - -#define VERSION 2 -#define PATCHLEV 23 -#define RELDATE "2000 November 28" -#define PRINT_VERSION printf("\n%s Version %d.%d (%s)\n", \ - MyName,VERSION,PATCHLEV,RELDATE) Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c:3.4 Mon Dec 23 01:31:31 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c Fri Jan 18 15:24:53 2002 @@ -1,64 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c,v 3.4 1996/12/23 06:31:31 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Primus.c /main/5 1996/02/21 17:11:57 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {GRC_IDX, GRC_REG, 0x3D6, 0x3D7}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -Chip_Descriptor Primus_Descriptor = { - "Primus", - Probe_Primus, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - NULL, -}; - -Bool Probe_Primus(Chipset) -int *Chipset; -{ - Bool result = FALSE; - - EnableIOPorts(NUMPORTS, Ports); - - if (testinx2(GRC_IDX, 0x3D, 0x3F) && - tstrg(0x3D6, 0x1F) && - tstrg(0x3D7, 0x1F)) - { - result = TRUE; - *Chipset = CHIP_P2000; - } - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c:3.71 xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c:3.71 Tue Nov 28 15:59:16 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c Fri Jan 18 15:24:53 2002 @@ -1,399 +0,0 @@ -/* $XConsortium: Print.c /main/25 1996/10/28 04:46:33 kaleb $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c,v 3.71 2000/11/28 20:59:16 dawes Exp $ */ - -#include "Probe.h" - -static CONST char *SVGA_Names[NUM_VENDORS+1][CHPS_PER_VENDOR] = -{ -/* dummy */ { "" }, -/* Ahead */ { "Ahead (chipset unknown)", - "Ahead V5000 Version A", "Ahead V5000 Version B" }, -/* ATI */ { "ATI (chipset unknown)", - "ATI 18800", "ATI 18800-1", - "ATI 28800-2", "ATI 28800-4", "ATI 28800-5", "ATI 28800-6", - "ATI 68800-3", "ATI 68800-6", "ATI 68800LX", "ATI 68800AX", - "ATI 88800GX-C", "ATI 88800GX-D", "ATI 88800GX-E", - "ATI 88800GX-F", - "ATI 88800CX", - "ATI 264CT", "ATI 264ET", - "ATI 264VT", "ATI 264VT-B", "ATI 264VT3", "ATI 264VT4", - "ATI 264GT (3D Rage I)", "ATI 264GT-B (3D Rage II)", - "ATI 264GT-B+DVD (3D Rage II+DVD)", - "ATI 264GT-IIc (3D Rage IIc)", "ATI 264GT3 (3D Rage Pro)", - "ATI 264LT", "ATI 264LT Pro (3D Rage LT Pro)", - "ATI Rage XL or XC", "ATI Rage Mobility" }, -/* AL */ { "Avance Logic (chipset unknown)", - "Avance Logic 2101", "Avance Logic 2228" }, -/* CT */ { "Chips & Tech (chipset unknown)", - "Chips & Tech 82c450", "Chips & Tech 82c451", - "Chips & Tech 82c452", "Chips & Tech 82c453", - "Chips & Tech 82c455", "Chips & Tech 82c456", - "Chips & Tech 82c457", "Chips & Tech F65510", - "Chips & Tech F65520", "Chips & Tech F65530", - "Chips & Tech F65540", "Chips & Tech F65545", - "Chips & Tech F65548", "Chips & Tech F65546", - "Chips & Tech F65550", "Chips & Tech F65554", - "Chips & Tech F65555", "Chips & Tech F68554", - "Chips & Tech F69000", "Chips & Tech F69030", - "Chips & Tech 64200 WinGine", - "Chips & Tech 64300 WinGine" }, -/* Cirrus */ { "Cirrus (chipset unknown)", - "Cirrus CL-GD 510/520", "Cirrus CL-GD 610/620", - "Cirrus Video7 OEM", - "Cirrus/AcuMos AVGA2", - "Cirrus CL-GD5402", "Cirrus CL-GD5402 Rev 1", - "Cirrus CL-GD5420", "Cirrus CL-GD5420 Rev 1", - "Cirrus CL-GD5422", "Cirrus CL-GD5424", - "Cirrus CL-GD5426", "Cirrus CL-GD5428", - "Cirrus CL-GD5429", - "Cirrus CL-GD5430/40", "Cirrus CL-GD5434", - "Cirrus CL-GD6205", "Cirrus CL-GD6215", - "Cirrus CL-GD6225", "Cirrus CL-GD6235", - "Cirrus CL-GD5410", - "Cirrus CL-GD6410", "Cirrus CL-GD6412", - "Cirrus CL-GD6420A", "Cirrus CL-GD6420B", - "Cirrus CL-GD6440", - "Cirrus CL-GD5436", - "Cirrus CL-GD7541", "Cirrus CL-GD7542", - "Cirrus CL-GD7543", - "Cirrus CL-GD5446", - "Cirrus CL-GD5462", - "Cirrus CL-GD7548", - "Cirrus CL-GD5464", - "Cirrus CL-GD5480", - "Cirrus CL-GD5465", - }, -/* Compaq */ { "Compaq (chipset unknown)", - "Compaq Int. Vid. Graphics Sys.", - "Compaq Advanced VGA", - "Compaq QVision/1024", "Compaq QVision/1280", - "Compaq Advanced VGA, Portable" }, -/* Genoa */ { "Genoa GVGA 6100", - "Genoa GVGA 6200/6300", "Genoa GVGA 6400/6600" }, -/* HMC */ { "HMC HM86304" }, -/* MX */ { "MX 68000", "MX 68010" }, -/* NCR */ { "NCR (chipset unknown)", - "NCR 77C21", "NCR 77C22", "NCR 77C22E", "NCR 77C22E+", - "NCR 77C32BLT" }, -/* Oak */ { "Oak (chipset unknown)", - "Oak OTI037C", - "Oak OTI-057", "Oak OTI-067", "Oak OTI-077", - "Oak OTI-083", "Oak OTI-087" }, -/* Primus */ { "Primus P2000" }, -/* Realtek */ { "Realtek (chipset unknown)", - "Realtek RT-3103", "Realtek RT-3105", "Realtek RT-3106" }, -/* Rendition */ { "Rendition V1000", "Rendition V2000" }, -/* S3 */ { "S3 (chipset unknown)", - "S3 86C911", "S3 86C924", - "S3 86C801, A or B-step", - "S3 86C801, C-step", "S3 86C801, D-step", - "S3 86C801i", - "S3 86C805, A or B-step", - "S3 86C805, C-step", "S3 86C805, D-step", - "S3 86C805i", - "S3 86C928, A,B,C, or D-step", "S3 86C928, E-step", - "S3 86C928PCI", - "S3 Vision864", - "S3 Vision964", - "S3 Vision866", - "S3 Vision868", - "S3 Vision968", - "S3 Trio32", - "S3 Trio64", - "S3 Trio64V+", - "S3 Vision968 & 3Dlabs 300SX", - "S3 Vision968 & 3Dlabs (unknown)", - "S3 ViRGE", - "S3 ViRGE/VX", - "S3 Aurora64V+", - "S3 Trio64UV+", - "S3 Trio64V2/DX", - "S3 Trio64V2/GX", - "S3 ViRGE/DX", - "S3 ViRGE/GX", - "S3 PLATO/PX", - "S3 ViRGE/GX2", - "S3 ViRGE/MX", - "S3 ViRGE/MXP", - "S3 Trio3D Business", - "S3 Trio3D", - "S3 Savage3D", - "S3 Savage3D (Macrovision Support)", - "S3 Trio3D/2X", - "S3 Savage4", - "S3 Savage2000", - }, -/* Trident */ { "Trident (chipset unknown)", - "Trident LX8200", - "Trident 8800BR", "Trident 8800CS", - "Trident 8900B", "Trident 8900C", "Trident 8900CL/8900D", - "Trident 9000", "Trident 9000i", - "Trident LCD9100B", "Trident 9200CXr", "Trident LCD9320", - "Trident 9400CXi", "Trident GUI 9420", "Trident GUI 9420DGi", - "Trident GUI 9440AGi", "Trident GUI 9660", - "Trident GUI 9680", "Trident ProVidia 9682", - "Trident ProVidia 9685", "Trident ProVidia 9692", - "Trident Cyber9382", "Trident Cyber9385", - "Trident Cyber9385-1", - "Trident Cyber9388", "Trident Cyber9388-1", - "Trident Cyber9397", "Trident Cyber9520", - "Trident 3DImage975", "Trident 3DImage985", -/* Bill Mair */ - "Trident Cyber9397 DVD" - }, -/* Tseng */ { "Tseng (chipset unknown)", - "Tseng ET3000", "Tseng ET4000", - "Tseng ET4000/W32", "Tseng ET4000/W32i", - "Tseng ET4000/W32p Rev A", - "Tseng ET4000/W32i Rev B", - "Tseng ET4000/W32i Rev C", - "Tseng ET4000/W32p Rev B", - "Tseng ET4000/W32p Rev C", - "Tseng ET4000/W32p Rev D", - "Tseng ET6000", "Tseng ET6100", "Tseng ET6300" - }, -/* UMC */ { "UMC 85c408" }, -/* Video7 */ { "Video7 (chipset unknown)", - "Video7 FastWrite/VRAM (HT208)", "Video7 1024i (HT208A)", - "Video7 VRAM II (HT208B)", "Video7 VRAM II (HT208C,D)", - "Video7 HT216B,C", "Video7 HT216D", - "Video7 HT216E", "Video7 HT216E", - "Video7 VEGA" }, -/* WD */ { "WD/Paradise (chipset unknown)", - "WD/Paradise PVGA1", "WD/Paradise 90C00", - "WD/Paradise 90C10", "WD/Paradise 90C11", - "WD/Paradise 90C20", "WD/Paradise 90C20A", - "WD/Paradise 90C22", "WD/Paradise 90C24", - "WD/Paradise 90C26", "WD/Paradise 90C27", - "WD/Paradise 90C30", "WD/Paradise 90C31", - "WD/Paradise 90C33" }, -/* Weitek */ { "Weitek (chipset unknown)", - "Weitek 5086", "Weitek 5186", "Weitek 5286" }, -/* Yamaha */ { "Yamaha 6388 VPDC" }, -/* SiS */ { "Silicon Integrated Systems (chipset unknown)", - "Silicon Integrated Systems SG86C201", - "Silicon Integrated Systems SG86C202", - "Silicon Integrated Systems SG86C205", - "Silicon Integrated Systems SG86C215", - "Silicon Integrated Systems SG86C225", - "Silicon Integrated Systems 5597/5598", - "Silicon Integrated Systems 530/620", - "Silicon Integrated Systems 6326 AGP", - "Silicon Integrated Systems 300 AGP", - "Silicon Integrated Systems 630 AGP", - "Silicon Integrated Systems 540 AGP", - }, -/* ARK */ { "ARK Logic (chipset unknown)", - "ARK Logic ARK1000VL", - "ARK Logic ARK1000PV", - "ARK Logic ARK2000PV", - "ARK Logic ARK2000MT", - "ARK Logic ARK2000MI (Quadro64)" }, -/* Alliance */ { "Alliance Semiconductor (chipset unknown)", - "Alliance Semiconductor ProMotion 6410", - "Alliance Semiconductor ProMotion 6422", - "Alliance Semiconductor ProMotion AT24" , - "Alliance Semiconductor ProMotion AT3D" }, -/* Matrox */ { "Matrox (chipset unknown)", - "Matrox Atlas", - "Matrox Millennium", - "Matrox Mystique", - "Matrox Millennium II", - "Matrox Millennium II AGP", - "Matrox G100 PCI", - "Matrox G100 AGP", - "Matrox G200 PCI", - "Matrox G200 AGP" }, -/* Sigma Designs */ { "Sigma Designs (chipset unknown)", - "Sigma Designs REALmagic64/GX (SD 6425)" }, -/* Intergraphics */ { "Intergraphics (chipset unknown)", - "Intergraphics IGA-1680", - "Intergraphics IGA-1682" }, -/* Epson */ { "Epson SPC8110" }, -/* Silicon Motion */ { "Silicon Motion (chipset unknown)" - "Silicon Motion SM910 Lynx", - "Silicon Motion SM810 LynxE", - "Silicon Motion SM820 Lynx3D", - "Silicon Motion SM710 LynxEM", - "Silicon Motion SM712 LynxEM+", - "Silicon Motion SM720 Lynx3DM" }, -}; - -static CONST char *Herc_Names[] = -{ - "", /* indices start at 1 */ - "Standard", - "Plus", - "InColor", -}; - -struct RamDac_Name RamDac_Names[] = -{ - { "Unknown", "Non-standard but unknown DAC" }, - { "Generic", "Generic 8-bit pseudo-color DAC" }, - { "ALG1101", "Avance Logc ALG1101" }, - { "SS2410", "Diamond SS2410 15/16/24-bit DAC" }, - { "Sierra15", "Sierra SC1148{1,6,8} 15-bit HiColor DAC" }, - { "Sierra16", - "Sierra SC1148{2,3,4} 15-bit or SC1148{5,7,9} 15/16-bit HiColor" }, - { "Sierra24", "Sierra 1502{5,6} 15/16/24-bit DAC" }, - { "MU9C4870", "MUSIC MU9C4870 15/16-bit HiColor DAC" }, - { "MU9C4910", "MUSIC MU9C4910 15/16/24-bit DAC" }, - { "ADAC1", "AcuMos ADAC1 15/16/24-bit DAC" }, - { "68830", "ATI 68830 15/16-bit HiColor DAC" }, - { "68860", "ATI 68860 15/15/24-bit DAC w/pixel-mux" }, - { "68875", "ATI-68875/Bt885/TLC34075 15/16/24-bit DAC w/pixel-mux" }, - { "ATIMisc", - "ATI Misc 3rd-party 15/16/24-bit DAC, probably BT481" }, - { "Cirrus8", "Cirrus Logic Built-in 8-bit pseudo-color DAC" }, - { "Cirrus24B", "Cirrus Logic Built-in 15/16/24-bit DAC" }, - { "Cirrus24", "Cirrus Logic 15/16/24-bit DAC" }, - { "20C490", "AT&T 20C490 15/16/24-bit DAC" }, - { "20C491", "AT&T 20C491 15/16/24-bit DAC with gamma correction" }, - { "20C492", "AT&T 20C492 15/16/18-bit DAC with gamma correction" }, - { "20C493", "AT&T 20C493 15/16/18-bit DAC" }, - { "20C497", "AT&T 20C497 24-bit wide, 8-bit pseudo-color DAC" }, - { "Bt485", "BrookTree Bt485 24-bit TrueColor DAC w/cursor,pixel-mux" }, - { "20C504", "AT&T 20C504 24-bit TrueColor DAC w/cursor,pixel-mux" }, - { "20C505", "AT&T 20C505 24-bit TrueColor DAC w/cursor,pixel-mux" }, - { "TVP3020", - "TI ViewPoint3020 24-bit TrueColor DAC w/cursor,pixel-mux" }, - { "TVP3025", - "TI ViewPoint3025 24-bit TrueColor DAC w/cursor,pixel-mux,clock" }, - { "EDSUN", "EDSUN CEG DAC" }, - { "20C498", "AT&T 20C498/21C498 15/16/24-bit DAC w/pixel-mux" }, - { "22C498", "AT&T 22C498 15/16/24-bit DAC w/pixel-mux" }, - { "STG1700", "STG1700 15/16/24-bit DAC w/pixel-mux" }, - { "S3_GENDAC", "S3 86C708 GENDAC 15/16/24-bit DAC w/clock-PLL" }, - { "S3_SDAC", "S3 86C716 SDAC 15/16/24-bit DAC w/pixel-mux w/clock-PLL" }, - { "TVP3026", - "TI ViewPoint3026 24-bit TrueColor DAC w/cursor,pixel-mux,clock" }, - { "RGB524", - "IBM RGB524 24-bit TrueColor DAC w/cursor,pixel-mux,clock" }, - { "RGB514/525", - "IBM RGB514/525 24-bit TrueColor DAC w/cursor,pixel-mux,clock" }, - { "RGB528", - "IBM RGB528 24-bit TrueColor DAC w/cursor,pixel-mux,clock" }, - { "STG1703", "STG1703 15/16/24-bit DAC w/pixel-mux,clock" }, - { "20C409", "AT&T 20C409 15/16/24-bit DAC w/clock" }, - { "20C499", "AT&T 20C499 15/16/24-bit DAC" }, - { "TKD8001", "Trident Built-In 15/16/24-bit DAC" }, - { "TGUIDAC", "Trident Built-In 15/16/24-bit DAC" }, - { "Integrated", "ATI Mach64 integrated 15/16/24/32-bit DAC w/clock" }, - { "MU9C1880", "Music 9C1880"}, - { "IMSG174", "Inmos G-174" }, - { "STG1702", "STG1702 15/16/24-bit DAC w/cursor,pixel-mux" }, - { "CH8398", "Chrontel 8398 15/16/24-bit DAC w/clock"}, - { "20C408", "AT&T 20C408 15/16/24-bit DAC w/clock" }, - { "TVP3030", - "TI ViewPoint3030 24-bit TrueColor DAC w/cursor,pixel-mux,clock" }, - { "ET6000", - "Tseng Labs ET6000 built-in 15/16/24-bit DAC w/pixel-mux,clock" }, - { "w30C516", - "IC Works w30C516 ZOOMDAC 15/16/24-bit DAC or AT&T 20C498" }, - { "PM642x", - "Alliance ProMotion built-in 15/16/24-bit DAC w/clock" }, - { "ICS5341", - "ICS5341 SDAC 15/16/24-bit DAC w/pixel-mux w/clock-PLL" }, - { "ICS5301", - "ICS5301 GENDAC 15/16/24-bit DAC w/clock-PLL" }, - { "MGA1064SG", - "Matrox Mystique built-in DAC w/clock" }, - { "MGAG100", - "Matrox G100 built-in DAC w/clock" }, - { "MGAG200", - "Matrox G200 built-in DAC w/clock" }, - { "SiS", - "SiS built-in DAC w/clock" }, - { "SMI", - "Silicon Motion built-in DAC w/clock" }, -}; - -static CONST char *CoProc_Names[NUM_CP_TYPES][CHPS_PER_CPTYPE] = -{ -/* 8514 */ { "8514/A (or true clone)", - "ATI Mach8", "ATI Mach32", - "Chips & Technologies 82C480 (8514/A clone)" }, -/* XGA */ { "" }, -/* Mach64 */ { "ATI Mach64" }, -/* Number9 */ { "Number Nine Imagine I128" }, -/* GLINT */ { "","GLINT 300SX","GLINT 500TX","GLINT 300SX & 500TX", - "GLINT Delta","GLINT Delta & 300SX","GLINT Delta & 500TX", - "GLINT Delta & 300SX & 500TX" }, -}; - -void Print_SVGA_Name(Chipset) -int Chipset; -{ - int vendor = SVGA_VENDOR(Chipset); - int chip = SVGA_CHIP(Chipset); - printf("\tChipset: %s %s\n", - SVGA_Names[vendor][chip], - (PCIProbed ? "(PCI Probed)" : "(Port Probed)")); - if ((!chip) && (~Chip_data)) - { - printf("\t\tSignature data: %x (please report)\n", - Chip_data); - } -} - -void Print_Herc_Name(Chipset) -int Chipset; -{ - int chip = HERC_CHIP(Chipset); - printf("\tChipset: %s\n", Herc_Names[chip]); -} - -void Print_RamDac_Name(RamDac) -int RamDac; -{ - printf("\tRAMDAC: %s\n", RamDac_Names[DAC_CHIP(RamDac)].Long); - if (RamDac & DAC_8BIT) - { - printf("\t\t (with 8-bit wide lookup tables)\n"); - } - else - { - printf("\t\t (with 6-bit wide lookup tables "); - printf("(or in 6-bit mode))\n"); - } - if (RamDac & DAC_6_8_PROGRAM) - { - printf("\t\t (programmable for 6/8-bit wide lookup tables)\n"); - } -} - -void Print_CoProc_Name(CoProc) -int CoProc; -{ - int class = COPROC_CLASS(CoProc); - int chip = COPROC_CHIP(CoProc); - printf("\t\tChipset: %s\n", CoProc_Names[class][chip]); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h:3.77 xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h:3.77 Wed Dec 6 10:35:05 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h Fri Jan 18 15:24:53 2002 @@ -1,774 +0,0 @@ -/* $XConsortium: Probe.h /main/27 1996/10/25 21:19:15 kaleb $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h,v 3.77 2000/12/06 15:35:05 eich Exp $ */ - -/* - * Includes - */ - -#if defined(__STDC__) && defined(__GNUC__) -#define inline __inline__ -#endif -#ifdef _POSIX_SOURCE -#include -#endif -#include -#ifndef MACH386 -#include -#include -#endif /* MACH386 */ -#include -#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__QNX__) || defined(__QNXNTO__) || defined(__GNU__) -#if defined(__ia64__) || defined(ia64) -#include -#endif -# include -#if !(defined(__QNX__) && !defined(__QNXNTO__)) -# include -#endif -#else -#if defined(_MINIX) || defined(__QNX__) -# include -#else -# include -# define strchr(a,b) index((a),(b)) -# define strrchr(a,b) rindex((a),(b)) -#endif /* _MINIX */ -#endif - -#include "PCI.h" - -#ifdef __STDC__ -# define CONST const -# define __STDCARGS(a) a -#else -# define CONST -# define __STDCARGS(a) () -#endif - -/* - * Types - */ -typedef unsigned char Byte; -typedef unsigned short Word; -typedef unsigned long Long; -typedef int Bool; -#define FALSE 0 -#define TRUE 1 -#ifndef NULL -# define NULL (void *)0 -#endif - - -typedef struct { - Word lo, hi; -} Range; - -typedef Bool (*ProbeFunc) __STDCARGS((int *)); -typedef int (*MemCheckFunc) __STDCARGS((int)); -typedef void (*SetBank) __STDCARGS((int, int, int)); -typedef void (*GetBank) __STDCARGS((int, int *, int *)); -typedef struct { - int chipset; /* Chipset for bank operations */ - SetBank set_bank; /* Set a read/write bank */ - GetBank get_bank; /* Get the current bank number */ - int bank_size; /* Size of a memory bank */ - int max_bank; /* Maximum bank number */ -} MemCheck_Descriptor; -typedef struct { - char *name; /* Chipset vendor/class name */ - ProbeFunc f; /* Probe function */ - Word *ports; /* List of ports used by probe */ - int num_ports; /* Number of ports in list */ - Bool bit16; /* Does probe use 16-bit ports? */ - Bool uses_bios; /* Does probe read the BIOS? */ - Bool check_coproc; /* Check for attached coprocessor */ - MemCheckFunc memcheck; /* For doing memory check */ -} Chip_Descriptor; - -/* - * Prototypes - */ - -/* OS_xxxx.c */ -int OpenVideo __STDCARGS((void)); -void CloseVideo __STDCARGS((void)); -Byte *MapVGA __STDCARGS((void)); -void UnMapVGA __STDCARGS((Byte *)); -Byte *MapMem __STDCARGS((unsigned long, unsigned long)); -void UnMapMem __STDCARGS((Byte *, unsigned long)); -int ReadBIOS __STDCARGS((const unsigned, Byte *, const int)); -int EnableIOPorts __STDCARGS((const int, const Word *)); -int DisableIOPorts __STDCARGS((const int, const Word *)); -void ShortSleep __STDCARGS((const int Delay)); - -/* Utils.c */ -Byte inp __STDCARGS((Word)); -Word inpw __STDCARGS((Word)); -Long inpl __STDCARGS((Word)); -void outp __STDCARGS((Word, Byte)); -void outpw __STDCARGS((Word, Word)); -void outpl __STDCARGS((Word, Long)); -Byte rdinx __STDCARGS((Word, Byte)); -void wrinx __STDCARGS((Word, Byte, Byte)); -void wrinx2 __STDCARGS((Word, Byte, Word)); -void wrinx3 __STDCARGS((Word, Byte, Long)); -void wrinx2m __STDCARGS((Word, Byte, Word)); -void wrinx3m __STDCARGS((Word, Byte, Long)); -void modinx __STDCARGS((Word, Byte, Byte, Byte)); -void modreg __STDCARGS((Word, Byte, Byte)); -void setinx __STDCARGS((Word, Byte, Byte)); -void clrinx __STDCARGS((Word, Byte, Byte)); -Bool tstrg __STDCARGS((Word, Byte)); -Bool testinx2 __STDCARGS((Word, Byte, Byte)); -Bool testinx __STDCARGS((Word, Byte)); -void dactopel __STDCARGS((void)); -Byte trigdac __STDCARGS((void)); -Byte dactocomm __STDCARGS((void)); -Byte getdaccomm __STDCARGS((void)); -void waitforretrace __STDCARGS((void)); -Bool Excluded __STDCARGS((Range *, Chip_Descriptor *, Bool)); -int StrCaseCmp __STDCARGS((char *, char *)); -unsigned long StrToUL __STDCARGS((const char *)); - -/* - * Ident functions - */ -int Probe_Mem __STDCARGS((MemCheck_Descriptor)); -void Probe_RamDac __STDCARGS((int, int *)); -Bool Probe_MDA __STDCARGS((int *)); -Bool Probe_Herc __STDCARGS((int *)); -Bool Probe_CGA __STDCARGS((int *)); -Bool Probe_VGA __STDCARGS((int *)); -/* SVGA */ -Bool Probe_Tseng __STDCARGS((int *)); -Bool Probe_WD __STDCARGS((int *)); -Bool Probe_CT __STDCARGS((int *)); -Bool Probe_Video7 __STDCARGS((int *)); -Bool Probe_Genoa __STDCARGS((int *)); -Bool Probe_Trident __STDCARGS((int *)); -Bool Probe_SiS __STDCARGS((int *)); -Bool Probe_Matrox __STDCARGS((int *)); -Bool Probe_Oak __STDCARGS((int *)); -Bool Probe_Cirrus __STDCARGS((int *)); -Bool Probe_Cirrus54 __STDCARGS((int *)); -Bool Probe_Cirrus64 __STDCARGS((int *)); -Bool Probe_Ahead __STDCARGS((int *)); -Bool Probe_ATI __STDCARGS((int *)); -Bool Probe_S3 __STDCARGS((int *)); -Bool Probe_AL __STDCARGS((int *)); -Bool Probe_Alliance __STDCARGS((int *)); -Bool Probe_Yamaha __STDCARGS((int *)); -Bool Probe_NCR __STDCARGS((int *)); -Bool Probe_MX __STDCARGS((int *)); -Bool Probe_Primus __STDCARGS((int *)); -Bool Probe_RealTek __STDCARGS((int *)); -Bool Probe_Rendition __STDCARGS((int *)); -Bool Probe_Compaq __STDCARGS((int *)); -Bool Probe_HMC __STDCARGS((int *)); -Bool Probe_UMC __STDCARGS((int *)); -Bool Probe_Weitek __STDCARGS((int *)); -Bool Probe_ARK __STDCARGS((int *)); -Bool Probe_SigmaDesigns __STDCARGS((int *)); -Bool Probe_Intergraphics __STDCARGS((int *)); -Bool Probe_Epson __STDCARGS((int *)); -Bool Probe_SiliconMotion __STDCARGS((int *)); -/* CoProc */ -Bool Probe_8514 __STDCARGS((int *)); -Bool Probe_ATIMach __STDCARGS((int *)); -Bool Probe_I128 __STDCARGS((int *)); -Bool Probe_GLINT __STDCARGS((int *)); - -/* - * Print functions - */ -void Print_SVGA_Name __STDCARGS((int)); -void Print_Herc_Name __STDCARGS((int)); -void Print_RamDac_Name __STDCARGS((int)); -void Print_CoProc_Name __STDCARGS((int)); - -/* - * Globals - */ -extern struct pci_config_reg *pcrp; -extern Bool NoPCI; -extern Bool PCIProbed; -extern char MyName[]; -extern Word vgaIOBase; -extern Bool Verbose; -extern Long Chip_data; -extern Byte *Bios_Base; -extern Bool AssumeEGA; - -extern Chip_Descriptor VGA_Descriptor; - -extern Chip_Descriptor AL_Descriptor; -extern Chip_Descriptor Alliance_Descriptor; -extern Chip_Descriptor ATI_Descriptor; -extern Chip_Descriptor Ahead_Descriptor; -extern Chip_Descriptor CT_Descriptor; -extern Chip_Descriptor Cirrus_Descriptor; -extern Chip_Descriptor Cirrus54_Descriptor; -extern Chip_Descriptor Cirrus64_Descriptor; -extern Chip_Descriptor Compaq_Descriptor; -extern Chip_Descriptor Epson_Descriptor; -extern Chip_Descriptor Genoa_Descriptor; -extern Chip_Descriptor HMC_Descriptor; -extern Chip_Descriptor MX_Descriptor; -extern Chip_Descriptor NCR_Descriptor; -extern Chip_Descriptor Oak_Descriptor; -extern Chip_Descriptor Primus_Descriptor; -extern Chip_Descriptor RealTek_Descriptor; -extern Chip_Descriptor Rendition_Descriptor; -extern Chip_Descriptor S3_Descriptor; -extern Chip_Descriptor Trident_Descriptor; -extern Chip_Descriptor SiS_Descriptor; -extern Chip_Descriptor Matrox_Descriptor; -extern Chip_Descriptor Tseng_Descriptor; -extern Chip_Descriptor UMC_Descriptor; -extern Chip_Descriptor Video7_Descriptor; -extern Chip_Descriptor WD_Descriptor; -extern Chip_Descriptor Weitek_Descriptor; -extern Chip_Descriptor Yamaha_Descriptor; -extern Chip_Descriptor ARK_Descriptor; -extern Chip_Descriptor SigmaDesigns_Descriptor; -extern Chip_Descriptor Intergraphics_Descriptor; -extern Chip_Descriptor SiliconMotion_Descriptor; - -extern Chip_Descriptor IBM8514_Descriptor; -extern Chip_Descriptor ATIMach_Descriptor; -extern Chip_Descriptor I128_Descriptor; -extern Chip_Descriptor GLINT_Descriptor; - -/* - * Useful macros - */ -/* VGA */ -#define COPYRIGHT_BASE (0x1E) -#define CRTC_IDX (vgaIOBase+0x04) -#define CRTC_REG (vgaIOBase+0x05) -#define GRC_IDX (0x3CE) -#define GRC_REG (0x3CF) -#define SEQ_IDX (0x3C4) -#define SEQ_REG (0x3C5) -#define ATR_IDX (0x3C0) -#define ATR_REG_W (0x3C0) -#define ATR_REG_R (0x3C1) -#define MISC_OUT_W (0x3C2) -#define MISC_OUT_R (0x3CC) -/* 8514 */ -#define CONFIG_STATUS_1 0x12EE -#define MISC_OPTIONS 0x36EE -#define CHIP_ID 0xFAEE -#define SUBSYS_CNTL 0x42E8 -#define EXT_CONF_3 0x5EE8 -#define ERR_TERM 0x92E8 -#define GPCTRL_ENAB 0x4000 -#define GPCTRL_RESET 0x8000 -#define CHPTEST_NORMAL 0x1000 -#define ROM_ADDR_1 0x52EE -#define DESTX_DIASTP 0x8EE8 -#define READ_SRC_X 0xDAEE -#define GP_STAT 0x9AE8 -#define GPBUSY 0x0200 - -/* - * RAMDAC Types - */ -#define DAC_UNKNOWN 0 /* Non-standard, but unknown */ -#define DAC_STANDARD 1 /* Standard 8-bit pseudo-color DAC */ -#define DAC_ALG1101 2 /* Avance Logic ALG1101 */ -#define DAC_SS24 3 /* Diamond SS2410 */ -#define DAC_SIERRA15 4 /* Sierra 15-bit HiColor */ -#define DAC_SIERRA15_16 5 /* Sierra 15/16-bit HiColor */ -#define DAC_SIERRA24 6 /* Sierra 15/16/24-bit DAC */ -#define DAC_MUSIC4870 7 /* MUSIC 15/16-bit HiColor DAC */ -#define DAC_MUSIC4910 8 /* MUSIC 15/16/24-bit DAC */ -#define DAC_ACUMOS 9 /* AcuMos ADAC1 15/16/24-bit DAC */ -#define DAC_ATI68830 10 /* ATI 68830 15/16-bit DAC */ -#define DAC_ATI68860 11 /* ATI 68860 15/16/24-bit DAC, mux */ -#define DAC_ATI68875 12 /* ATI 68875 15/16/24-bit DAC, mux */ -#define DAC_ATIMISC24 13 /* ATI Miscellaneous 3'rd party DACs */ -#define DAC_CIRRUSA 14 /* Cirrus 5420 8-bit pseudo-color DAC */ -#define DAC_CIRRUSB 15 /* Cirrus 542{2,4,6,8} 15/16/24-bit DAC */ -#define DAC_CIRRUS24 16 /* Cirrus 15/16/24-bit separate DAC */ -#define DAC_ATT490 17 /* AT&T 20C490 15/16/24-bit DAC */ -#define DAC_ATT491 18 /* AT&T 20C491 15/16/24-bit DAC w/gamma corr */ -#define DAC_ATT492 19 /* AT&T 20C492 15/16/18-bit DAC w/gamma corr */ -#define DAC_ATT493 20 /* AT&T 20C493 15/16/18-bit DAC */ -#define DAC_ATT497 21 /* AT&T 20C497 8-bit PseudoColor,24-bit wide */ -#define DAC_BT485 22 /* BrookTree 485 RAMDAC */ -#define DAC_ATT504 23 /* AT&T 20C504 (Bt484 clone, I think) */ -#define DAC_ATT505 24 /* AT&T 20C505 (Bt485 clone) */ -#define DAC_TVP3020 25 /* TI ViewPoint TVP3020 RAMDAC */ -#define DAC_TVP3025 26 /* TI ViewPoint TVP3025 RAMDAC */ -#define DAC_EDSUN 27 /* EDSUN CEG DAC */ -#define DAC_ATT498 28 /* AT&T 20C498/21C498 15/16/24-bit DAC w/pixel-mux */ -#define DAC_ATT22C498 29 /* AT&T 22C498 15/16/24-bit DAC w/pixel-mux */ -#define DAC_STG1700 30 /* STG 1700 15/16/24-bit DAC w/pixel-mux */ -#define DAC_S3_GENDAC 31 /* S3 86C708 GENDAC 15/16/24-bit DAC w/PLL */ -#define DAC_S3_SDAC 32 /* S3 86C716 SDAC 15/16/24 w/pixel-mux w/PLL */ -#define DAC_TVP3026 33 /* TI ViewPoint TVP3026 RAMDAC */ -#define DAC_IBMRGB524 34 /* IBM RGB524 RAMDAC */ -#define DAC_IBMRGB525 35 /* IBM RGB525 RAMDAC */ -#define DAC_IBMRGB528 36 /* IBM RGB528 RAMDAC */ -#define DAC_STG1703 37 /* STG 1703 15/16/24-bit DAC w/pixel-mux w/dual PLL */ -#define DAC_ATT409 38 /* AT&T 20C409 15/16/24-bit DAC */ -#define DAC_ATT499 39 /* AT&T 20C499 15/16/24-bit DAC */ -#define DAC_TKD8001 40 /* Trident TKD8001 15/16/24-bit DAC */ -#define DAC_TGUIDAC 41 /* Trident TGUIDAC 15/16/24-bit DAC */ -#define DAC_ATI_INTERNAL 42 /* ATI Mach64 integrated DAC */ -#define DAC_MU9C1880 43 /* Music 9C1880 */ -#define DAC_IMSG174 44 /* Inmos G-174 */ -#define DAC_STG1702 45 /* STG 1702 15/16/24-bit DAC w/pixel-mux */ -#define DAC_CH8398 46 /* Chrontel 8398 */ -#define DAC_ATT408 47 /* AT&T 20C408 */ -#define DAC_TVP3030 48 /* TI ViewPoint TVP3030 RAMDAC */ -#define DAC_ET6K 49 /* Built-in 15/16/24-bit ET6000 RAMDAC */ -#define DAC_ZOOMDAC 50 /* IC Works w30C516 ZOOMDAC or ATT20C498 */ -#define DAC_ALSC_642x 51 /* Alliance ProMotion 642[24] integrated DAC */ -#define DAC_ICS5341 52 /* ICS5341 16-bit SDAC-like DAC used on ET4000W32p */ -#define DAC_ICS5301 53 /* ICS5301 8-bit GENDAC-like DAC used on ET4000W32 */ -#define DAC_MGA1064SG 54 /* Matrox Mystique integrated DAC */ -#define DAC_MGAG100 55 /* Matrox G100 integrated DAC */ -#define DAC_MGAG200 56 /* Matrox G200 integrated DAC */ -#define DAC_SIS 57 /* SiS integrated DAC */ -#define DAC_SMI 58 /* Silicon Motion integrated DAC */ - -#define DAC_MAX DAC_SMI /* UPDATE THIS! */ - -#define DAC_6_8_PROGRAM 0x40 /* RAMDAC programmable for 6/8-bit tables */ -#define DAC_8BIT 0x80 /* RAMDAC with 8-bit wide lookup tables */ - -#define DAC_CHIP(x) ((x) & ~(DAC_8BIT|DAC_6_8_PROGRAM)) - - -/* - * RAMDAC names - */ - -struct RamDac_Name { - CONST char *Short; - CONST char *Long; -}; -extern struct RamDac_Name RamDac_Names[]; - -/* - * Base chipset classes - */ -#define CHIP_MDA 0 /* Monochrome Display Adapter */ -#define CHIP_CGA 1 /* Color Display Adapter */ -#define CHIP_EGA 2 /* Enhanced Graphics Adapter */ -#define CHIP_PGC 3 /* Professional Graphics Controller */ -#define CHIP_VGA 4 /* Video Graphics Array */ -#define CHIP_MCGA 5 /* MultiColor Graphics Array */ -#define CHIP_COPROC 6 /* Graphics Coprocessor */ - -/* - * Hercules cards - */ -#define HERC_TYPE(n) (CHIP_MDA | ((n) << 8)) -#define CHIP_HERC_STD HERC_TYPE(1) -#define CHIP_HERC_PLUS HERC_TYPE(2) -#define CHIP_HERC_COL HERC_TYPE(3) - -/* - * SVGA cards - */ -#define SVGA_TYPE(v,n) (((v) << 16) | ((n) << 8) | CHIP_VGA) -#define V_AHEAD 1 -#define V_ATI 2 -#define V_AL 3 -#define V_CT 4 -#define V_CIRRUS 5 -#define V_COMPAQ 6 -#define V_GENOA 7 -#define V_HMC 8 -#define V_MX 9 -#define V_NCR 10 -#define V_OAK 11 -#define V_PRIMUS 12 -#define V_REALTEK 13 -#define V_RENDITION 14 -#define V_S3 15 -#define V_TRIDENT 16 -#define V_TSENG 17 -#define V_UMC 18 -#define V_VIDEO7 19 -#define V_WD 20 -#define V_WEITEK 21 -#define V_YAMAHA 22 -#define V_SIS 23 -#define V_ARK 24 -#define V_ALLIANCE 25 -#define V_MATROX 26 -#define V_SD 27 -#define V_IG 28 -#define V_EPSON 29 -#define V_SMI 30 - -#define NUM_VENDORS 30 -#define CHPS_PER_VENDOR 64 - -#define CHIP_AHEAD_UNK SVGA_TYPE(V_AHEAD,0) /* Ahead unknown */ -#define CHIP_AHEAD_A SVGA_TYPE(V_AHEAD,1) /* Ahead V5000 Version A*/ -#define CHIP_AHEAD_B SVGA_TYPE(V_AHEAD,2) /* Ahead V5000 Version B*/ -#define CHIP_ARK_UNK SVGA_TYPE(V_ARK,0) /* ARK Logic unknown */ -#define CHIP_ARK1000VL SVGA_TYPE(V_ARK,1) /* ARK Logic ARK1000VL */ -#define CHIP_ARK1000PV SVGA_TYPE(V_ARK,2) /* ARK Logic ARK1000PV */ -#define CHIP_ARK2000PV SVGA_TYPE(V_ARK,3) /* ARK Logic ARK2000PV */ -#define CHIP_ARK2000MT SVGA_TYPE(V_ARK,4) /* ARK Logic ARK2000MT */ -#define CHIP_ARK2000MI SVGA_TYPE(V_ARK,5) /* ARK Logic ARK2000MI */ -#define CHIP_ATI_UNK SVGA_TYPE(V_ATI,0) /* ATI unknown */ -#define CHIP_ATI18800 SVGA_TYPE(V_ATI,1) /* ATI 18800 */ -#define CHIP_ATI18800_1 SVGA_TYPE(V_ATI,2) /* ATI 18800-1 */ -#define CHIP_ATI28800_2 SVGA_TYPE(V_ATI,3) /* ATI 28800-2 */ -#define CHIP_ATI28800_4 SVGA_TYPE(V_ATI,4) /* ATI 28800-4 */ -#define CHIP_ATI28800_5 SVGA_TYPE(V_ATI,5) /* ATI 28800-5 */ -#define CHIP_ATI28800_6 SVGA_TYPE(V_ATI,6) /* ATI 28800-6 */ -#define CHIP_ATI68800_3 SVGA_TYPE(V_ATI,7) /* ATI 68800-3 */ -#define CHIP_ATI68800_6 SVGA_TYPE(V_ATI,8) /* ATI 68800-6 */ -#define CHIP_ATI68800LX SVGA_TYPE(V_ATI,9) /* ATI 68800LX */ -#define CHIP_ATI68800AX SVGA_TYPE(V_ATI,10) /* ATI 68800AX */ -#define CHIP_ATI88800GXC SVGA_TYPE(V_ATI,11) /* ATI 88800GX-C */ -#define CHIP_ATI88800GXD SVGA_TYPE(V_ATI,12) /* ATI 88800GX-D */ -#define CHIP_ATI88800GXE SVGA_TYPE(V_ATI,13) /* ATI 88800GX-E */ -#define CHIP_ATI88800GXF SVGA_TYPE(V_ATI,14) /* ATI 88800GX-F */ -#define CHIP_ATI88800CX SVGA_TYPE(V_ATI,15) /* ATI 88800CX */ -#define CHIP_ATI264CT SVGA_TYPE(V_ATI,16) /* ATI 264CT */ -#define CHIP_ATI264ET SVGA_TYPE(V_ATI,17) /* ATI 264ET */ -#define CHIP_ATI264VT SVGA_TYPE(V_ATI,18) /* ATI 264VT */ -#define CHIP_ATI264VTB SVGA_TYPE(V_ATI,19) /* ATI 264VT-B */ -#define CHIP_ATI264VT3 SVGA_TYPE(V_ATI,20) /* ATI 264VT3 */ -#define CHIP_ATI264VT4 SVGA_TYPE(V_ATI,21) /* ATI 264VT4 */ -#define CHIP_ATI264GT SVGA_TYPE(V_ATI,22) /* ATI 264GT */ -#define CHIP_ATI264GTB SVGA_TYPE(V_ATI,23) /* ATI 264GT-B */ -#define CHIP_ATI264GTDVD SVGA_TYPE(V_ATI,24) /* ATI 264GT-B+DVD */ -#define CHIP_ATI264GTIIc SVGA_TYPE(V_ATI,25) /* ATI 264GT-IIc */ -#define CHIP_ATI264GT3 SVGA_TYPE(V_ATI,26) /* ATI 264GT3 */ -#define CHIP_ATI264LT SVGA_TYPE(V_ATI,27) /* ATI 264LT */ -#define CHIP_ATI264LTPRO SVGA_TYPE(V_ATI,28) /* ATI 264LT Pro */ -#define CHIP_ATI264XL SVGA_TYPE(V_ATI,29) /* ATI 264XL or XC */ -#define CHIP_ATIMOBILITY SVGA_TYPE(V_ATI,30) /* ATI 3D Rage Mobility */ -#define CHIP_AL_UNKNOWN SVGA_TYPE(V_AL,0) /* Avance Logic unknown */ -#define CHIP_AL2101 SVGA_TYPE(V_AL,1) /* Avance Logic 2101 */ -#define CHIP_AL2228 SVGA_TYPE(V_AL,2) /* Avance Logic 2228 */ -#define CHIP_ALSC_UNK SVGA_TYPE(V_ALLIANCE,0) /* Alliance unknown */ -#define CHIP_ALSC6410 SVGA_TYPE(V_ALLIANCE,1) /* Alliance PM6410 */ -#define CHIP_ALSC6422 SVGA_TYPE(V_ALLIANCE,2) /* Alliance PM6422 */ -#define CHIP_ALSCAT24 SVGA_TYPE(V_ALLIANCE,3) /* Alliance AT24 */ -#define CHIP_ALSCAT3D SVGA_TYPE(V_ALLIANCE,4) /* Alliance AT3D */ -#define CHIP_CT_UNKNOWN SVGA_TYPE(V_CT,0) /* C&T unknown */ -#define CHIP_CT450 SVGA_TYPE(V_CT,1) /* C&T 82c450 */ -#define CHIP_CT451 SVGA_TYPE(V_CT,2) /* C&T 82c451 */ -#define CHIP_CT452 SVGA_TYPE(V_CT,3) /* C&T 82c452 */ -#define CHIP_CT453 SVGA_TYPE(V_CT,4) /* C&T 82c453 */ -#define CHIP_CT455 SVGA_TYPE(V_CT,5) /* C&T 82c455 */ -#define CHIP_CT456 SVGA_TYPE(V_CT,6) /* C&T 82c456 */ -#define CHIP_CT457 SVGA_TYPE(V_CT,7) /* C&T 82c457 */ -#define CHIP_CTF65510 SVGA_TYPE(V_CT,8) /* C&T F65510 */ -#define CHIP_CTF65520 SVGA_TYPE(V_CT,9) /* C&T F65520 */ -#define CHIP_CTF65530 SVGA_TYPE(V_CT,10) /* C&T F65530 */ -#define CHIP_CTF65540 SVGA_TYPE(V_CT,11) /* C&T F65540 */ -#define CHIP_CTF65545 SVGA_TYPE(V_CT,12) /* C&T F65545 */ -#define CHIP_CTF65548 SVGA_TYPE(V_CT,13) /* C&T F65548 */ -#define CHIP_CTF65546 SVGA_TYPE(V_CT,14) /* C&T F65546 */ -#define CHIP_CTF65550 SVGA_TYPE(V_CT,15) /* C&T F65550 */ -#define CHIP_CTF65554 SVGA_TYPE(V_CT,16) /* C&T F65554 */ -#define CHIP_CTF65555 SVGA_TYPE(V_CT,17) /* C&T F65555 */ -#define CHIP_CTF68554 SVGA_TYPE(V_CT,18) /* C&T F68554 */ -#define CHIP_CTF69000 SVGA_TYPE(V_CT,19) /* C&T F69000 */ -#define CHIP_CTF69030 SVGA_TYPE(V_CT,20) /* C&T F69030 */ -#define CHIP_CTF64200 SVGA_TYPE(V_CT,21) /* C&T F64200 WinGine */ -#define CHIP_CTF64300 SVGA_TYPE(V_CT,22) /* C&T F64300 WinGine */ -#define CHIP_CL_UNKNOWN SVGA_TYPE(V_CIRRUS,0) /* Cirrus unknown */ -#define CHIP_CL510 SVGA_TYPE(V_CIRRUS,1) /* Cirrus CL-GD 510/520 */ -#define CHIP_CL610 SVGA_TYPE(V_CIRRUS,2) /* Cirrus CL-GD 610/620 */ -#define CHIP_CLV7 SVGA_TYPE(V_CIRRUS,3) /* Cirrus Video 7 OEM */ -#define CHIP_CLAVGA2 SVGA_TYPE(V_CIRRUS,4) /* Cirrus/AcuMos AVGA2 */ -#define CHIP_CL5402 SVGA_TYPE(V_CIRRUS,5) /* Cirrus 5402 */ -#define CHIP_CL5402R1 SVGA_TYPE(V_CIRRUS,6) /* Cirrus 5402 rev 1 */ -#define CHIP_CL5420 SVGA_TYPE(V_CIRRUS,7) /* Cirrus 5420 */ -#define CHIP_CL5420R1 SVGA_TYPE(V_CIRRUS,8) /* Cirrus 5420 rev 1 */ -#define CHIP_CL5422 SVGA_TYPE(V_CIRRUS,9) /* Cirrus 5422 */ -#define CHIP_CL5424 SVGA_TYPE(V_CIRRUS,10) /* Cirrus 5424 */ -#define CHIP_CL5426 SVGA_TYPE(V_CIRRUS,11) /* Cirrus 5426 */ -#define CHIP_CL5428 SVGA_TYPE(V_CIRRUS,12) /* Cirrus 5428 */ -#define CHIP_CL5429 SVGA_TYPE(V_CIRRUS,13) /* Cirrus 5429 */ -#define CHIP_CL5430 SVGA_TYPE(V_CIRRUS,14) /* Cirrus 5430 */ -#define CHIP_CL5434 SVGA_TYPE(V_CIRRUS,15) /* Cirrus 5434 */ -#define CHIP_CL6205 SVGA_TYPE(V_CIRRUS,16) /* Cirrus 6205 */ -#define CHIP_CL6215 SVGA_TYPE(V_CIRRUS,17) /* Cirrus 6215 */ -#define CHIP_CL6225 SVGA_TYPE(V_CIRRUS,18) /* Cirrus 6225 */ -#define CHIP_CL6235 SVGA_TYPE(V_CIRRUS,19) /* Cirrus 6235 */ -#define CHIP_CL5410 SVGA_TYPE(V_CIRRUS,20) /* Cirrus 6510 */ -#define CHIP_CL6410 SVGA_TYPE(V_CIRRUS,21) /* Cirrus 6410 */ -#define CHIP_CL6412 SVGA_TYPE(V_CIRRUS,22) /* Cirrus 6412 */ -#define CHIP_CL6420A SVGA_TYPE(V_CIRRUS,23) /* Cirrus 6420A */ -#define CHIP_CL6420B SVGA_TYPE(V_CIRRUS,24) /* Cirrus 6420B */ -#define CHIP_CL6440 SVGA_TYPE(V_CIRRUS,25) /* Cirrus 6440 */ -#define CHIP_CL5436 SVGA_TYPE(V_CIRRUS,26) /* Cirrus 5436 */ -#define CHIP_CL7541 SVGA_TYPE(V_CIRRUS,27) /* Cirrus 7541 */ -#define CHIP_CL7542 SVGA_TYPE(V_CIRRUS,28) /* Cirrus 7542 */ -#define CHIP_CL7543 SVGA_TYPE(V_CIRRUS,29) /* Cirrus 7543 */ -#define CHIP_CL5446 SVGA_TYPE(V_CIRRUS,30) /* Cirrus 5446 */ -#define CHIP_CL5462 SVGA_TYPE(V_CIRRUS,31) /* Cirrus 5462 */ -#define CHIP_CL7548 SVGA_TYPE(V_CIRRUS,32) /* Cirrus 7548 */ -#define CHIP_CL5464 SVGA_TYPE(V_CIRRUS,33) /* Cirrus 5464 */ -#define CHIP_CL5480 SVGA_TYPE(V_CIRRUS,34) /* Cirrus 5480 */ -#define CHIP_CL5465 SVGA_TYPE(V_CIRRUS,35) /* Cirrus 5465 */ -#define CHIP_CPQ_UNK SVGA_TYPE(V_COMPAQ,0) /* Compaq unknown */ -#define CHIP_CPQ_IVGS SVGA_TYPE(V_COMPAQ,1) /* Compaq Int Vid Gr Sys*/ -#define CHIP_CPQ_AVGA SVGA_TYPE(V_COMPAQ,2) /* Compaq Advanced VGA */ -#define CHIP_CPQ_Q1024 SVGA_TYPE(V_COMPAQ,3) /* Compaq QVision/1024 */ -#define CHIP_CPQ_Q1280 SVGA_TYPE(V_COMPAQ,4) /* Compaq QVision/1280 */ -#define CHIP_CPQ_AVGA_P SVGA_TYPE(V_COMPAQ,5) /* Compaq AVGA Portable */ -#define CHIP_G_6100 SVGA_TYPE(V_GENOA,0) /* Genoa GVGA 6100 */ -#define CHIP_G_6200 SVGA_TYPE(V_GENOA,1) /* Genoa GVGA 6200 */ -#define CHIP_G_6400 SVGA_TYPE(V_GENOA,2) /* Genoa GVGA 6400 */ -#define CHIP_HM86304 SVGA_TYPE(V_HMC,0) /* HMC HM86304 */ -#define CHIP_MX68000 SVGA_TYPE(V_MX,0) /* MX 68000 */ -#define CHIP_MX68010 SVGA_TYPE(V_MX,1) /* MX 68010 */ -#define CHIP_NCR_UNK SVGA_TYPE(V_NCR,0) /* NCR unknown */ -#define CHIP_NCR77C21 SVGA_TYPE(V_NCR,1) /* NCR 77C21 */ -#define CHIP_NCR77C22 SVGA_TYPE(V_NCR,2) /* NCR 77C22 */ -#define CHIP_NCR77C22E SVGA_TYPE(V_NCR,3) /* NCR 77C22E */ -#define CHIP_NCR77C22EP SVGA_TYPE(V_NCR,4) /* NCR 77C22E+ */ -#define CHIP_NCR77C32B SVGA_TYPE(V_NCR,5) /* NCR 77C32BLT */ -#define CHIP_OAK_UNK SVGA_TYPE(V_OAK,0) /* OAK unknown */ -#define CHIP_OAK037C SVGA_TYPE(V_OAK,1) /* OAK OTI037C */ -#define CHIP_OAK057 SVGA_TYPE(V_OAK,2) /* OAK OTI-057 */ -#define CHIP_OAK067 SVGA_TYPE(V_OAK,3) /* OAK OTI-067 */ -#define CHIP_OAK077 SVGA_TYPE(V_OAK,4) /* OAK OTI-077 */ -#define CHIP_OAK083 SVGA_TYPE(V_OAK,5) /* OAK OTI-083 */ -#define CHIP_OAK087 SVGA_TYPE(V_OAK,6) /* OAK OTI-087 */ -#define CHIP_P2000 SVGA_TYPE(V_PRIMUS,0) /* Primus P2000 */ -#define CHIP_RT_UNK SVGA_TYPE(V_REALTEK,0) /* Realtek unknown */ -#define CHIP_RT_3103 SVGA_TYPE(V_REALTEK,1) /* Realtek RT3103 */ -#define CHIP_RT_3105 SVGA_TYPE(V_REALTEK,2) /* Realtek RT3105 */ -#define CHIP_RT_3106 SVGA_TYPE(V_REALTEK,3) /* Realtek RT3106 */ -#define CHIP_REND_V1000 SVGA_TYPE(V_RENDITION,1)/* Rendtion V1000 */ -#define CHIP_REND_V2000 SVGA_TYPE(V_RENDITION,2)/* Rendtion V2000 */ -#define CHIP_S3_UNKNOWN SVGA_TYPE(V_S3,0) /* S3 unknown */ -#define CHIP_S3_911 SVGA_TYPE(V_S3,1) /* S3 86c911 */ -#define CHIP_S3_924 SVGA_TYPE(V_S3,2) /* S3 86c924 or 911A */ -#define CHIP_S3_801B SVGA_TYPE(V_S3,3) /* S3 86c801 A-B step */ -#define CHIP_S3_801C SVGA_TYPE(V_S3,4) /* S3 86c801 C step */ -#define CHIP_S3_801D SVGA_TYPE(V_S3,5) /* S3 86c801 D step */ -#define CHIP_S3_801I SVGA_TYPE(V_S3,6) /* S3 86c801i (?) */ -#define CHIP_S3_805B SVGA_TYPE(V_S3,7) /* S3 86c805 A-B step */ -#define CHIP_S3_805C SVGA_TYPE(V_S3,8) /* S3 86c805 C step */ -#define CHIP_S3_805D SVGA_TYPE(V_S3,9) /* S3 86c805 D step */ -#define CHIP_S3_805I SVGA_TYPE(V_S3,10) /* S3 86c805i */ -#define CHIP_S3_928D SVGA_TYPE(V_S3,11) /* S3 86c928 A-D step */ -#define CHIP_S3_928E SVGA_TYPE(V_S3,12) /* S3 86c928 E-step */ -#define CHIP_S3_928P SVGA_TYPE(V_S3,13) /* S3 86c928PCI */ -#define CHIP_S3_864 SVGA_TYPE(V_S3,14) /* S3 Vision864 */ -#define CHIP_S3_964 SVGA_TYPE(V_S3,15) /* S3 Vision964 */ -#define CHIP_S3_866 SVGA_TYPE(V_S3,16) /* S3 Vision866 */ -#define CHIP_S3_868 SVGA_TYPE(V_S3,17) /* S3 Vision868 */ -#define CHIP_S3_968 SVGA_TYPE(V_S3,18) /* S3 Vision968 */ -#define CHIP_S3_Trio32 SVGA_TYPE(V_S3,19) /* S3 Trio32 */ -#define CHIP_S3_Trio64 SVGA_TYPE(V_S3,20) /* S3 Trio64 */ -#define CHIP_S3_Trio64V SVGA_TYPE(V_S3,21) /* S3 Trio64V+ */ -#define CHIP_S3_968_3DLABS_300SX SVGA_TYPE(V_S3,22) /* S3 968 & 3Dlabs 300SX */ -#define CHIP_S3_968_3DLABS_UNK SVGA_TYPE(V_S3,23) /* S3 968 & 3Dlabs 300SX */ -#define CHIP_S3_ViRGE SVGA_TYPE(V_S3,24) /* S3 ViRGE */ -#define CHIP_S3_ViRGE_VX SVGA_TYPE(V_S3,25) /* S3 ViRGE/VX */ -#define CHIP_S3_Aurora64VP SVGA_TYPE(V_S3,26) /* S3 Aurora64V+ */ -#define CHIP_S3_Trio64UVP SVGA_TYPE(V_S3,27) /* S3 Trio64UV+ */ -#define CHIP_S3_Trio64V2_DX SVGA_TYPE(V_S3,28) /* S3 Trio64V2/DX */ -#define CHIP_S3_Trio64V2_GX SVGA_TYPE(V_S3,29) /* S3 Trio64V2/GX */ -#define CHIP_S3_ViRGE_DX SVGA_TYPE(V_S3,30) /* S3 ViRGE/DX */ -#define CHIP_S3_ViRGE_GX SVGA_TYPE(V_S3,31) /* S3 ViRGE/GX */ -#define CHIP_S3_PLATO_PX SVGA_TYPE(V_S3,32) /* S3 PLATO/PX */ -#define CHIP_S3_ViRGE_GX2 SVGA_TYPE(V_S3,33) /* S3 ViRGE/GX2 */ -#define CHIP_S3_ViRGE_MX SVGA_TYPE(V_S3,34) /* S3 ViRGE/MX */ -#define CHIP_S3_ViRGE_MXP SVGA_TYPE(V_S3,35) /* S3 ViRGE/MX+ */ -#define CHIP_S3_Trio3D_B SVGA_TYPE(V_S3,36) /* S3 Trio3D Business */ -#define CHIP_S3_Trio3D SVGA_TYPE(V_S3,37) /* S3 Trio3D */ -#define CHIP_S3_Savage3D SVGA_TYPE(V_S3,38) /* S3 Savage3D */ -#define CHIP_S3_Savage3D_M SVGA_TYPE(V_S3,39) /* S3 Savage3D Macro */ -#define CHIP_S3_Trio3D_2X SVGA_TYPE(V_S3,40) /* S3 Trio3D/2X */ -#define CHIP_S3_Savage4 SVGA_TYPE(V_S3,41) /* S3 Savage4 */ -#define CHIP_S3_Savage2000 SVGA_TYPE(V_S3,42) /* S3 Savage2000 */ -#define CHIP_TVGA_UNK SVGA_TYPE(V_TRIDENT,0) /* Trident unknown */ -#define CHIP_TVGA8200 SVGA_TYPE(V_TRIDENT,1) /* Trident LX8200 */ -#define CHIP_TVGA8800BR SVGA_TYPE(V_TRIDENT,2) /* Trident 8800BR */ -#define CHIP_TVGA8800CS SVGA_TYPE(V_TRIDENT,3) /* Trident 8800CS */ -#define CHIP_TVGA8900B SVGA_TYPE(V_TRIDENT,4) /* Trident 8900B */ -#define CHIP_TVGA8900C SVGA_TYPE(V_TRIDENT,5) /* Trident 8900C */ -#define CHIP_TVGA8900CL SVGA_TYPE(V_TRIDENT,6) /* Trident 8900CL */ -#define CHIP_TVGA9000 SVGA_TYPE(V_TRIDENT,7) /* Trident 9000 */ -#define CHIP_TVGA9000I SVGA_TYPE(V_TRIDENT,8) /* Trident 9000i */ -#define CHIP_TVGA9100B SVGA_TYPE(V_TRIDENT,9) /* Trident LCD9100B */ -#define CHIP_TVGA9200CX SVGA_TYPE(V_TRIDENT,10) /* Trident 9200CXr */ -#define CHIP_TVGA9320 SVGA_TYPE(V_TRIDENT,11) /* Trident LCD9320 */ -#define CHIP_TVGA9400CX SVGA_TYPE(V_TRIDENT,12) /* Trident 9400CXi */ -#define CHIP_TVGA9420 SVGA_TYPE(V_TRIDENT,13) /* Trident GUI9420 */ -#define CHIP_TVGA9420D SVGA_TYPE(V_TRIDENT,14) /* Trident GUI9420DGi */ -#define CHIP_TVGA9440 SVGA_TYPE(V_TRIDENT,15) /* Trident GUI9440AGi */ -#define CHIP_TVGA9660 SVGA_TYPE(V_TRIDENT,16) /* Trident GUI9660 */ -#define CHIP_TVGA9680 SVGA_TYPE(V_TRIDENT,17) /* Trident GUI9680 */ -#define CHIP_TVGA9682 SVGA_TYPE(V_TRIDENT,18) /* Trident GUI9682 */ -#define CHIP_TVGA9685 SVGA_TYPE(V_TRIDENT,19) /* Trident GUI9685 */ -#define CHIP_TVGA9692 SVGA_TYPE(V_TRIDENT,20) /* Trident GUI9692 */ -#define CHIP_TVGA9382 SVGA_TYPE(V_TRIDENT,21) /* Trident Cyber9382 */ -#define CHIP_TVGA9385 SVGA_TYPE(V_TRIDENT,22) /* Trident Cyber9385 */ -#define CHIP_TVGA9385_1 SVGA_TYPE(V_TRIDENT,23) /* Trident Cyber9385-1 */ -#define CHIP_TVGA9388 SVGA_TYPE(V_TRIDENT,24) /* Trident Cyber9388 */ -#define CHIP_TVGA9388_1 SVGA_TYPE(V_TRIDENT,25) /* Trident Cyber9388-1 */ -#define CHIP_TVGA9397 SVGA_TYPE(V_TRIDENT,26) /* Trident Cyber9397 */ -#define CHIP_TVGA9520 SVGA_TYPE(V_TRIDENT,27) /* Trident Cyber9520 */ -#define CHIP_TVGA9750 SVGA_TYPE(V_TRIDENT,28) /* Trident 3DImage975 */ -#define CHIP_TVGA9850 SVGA_TYPE(V_TRIDENT,29) /* Trident 3DImage985 */ -#define CHIP_TVGA939A SVGA_TYPE(V_TRIDENT,30) /* Trident Cyber932A */ -#define CHIP_SIS_UNK SVGA_TYPE(V_SIS,0) /* SiS unknown */ -#define CHIP_SIS86C201 SVGA_TYPE(V_SIS,1) /* SiS SG86C201 */ -#define CHIP_SIS86C202 SVGA_TYPE(V_SIS,2) /* SiS SG86C202 */ -#define CHIP_SIS86C205 SVGA_TYPE(V_SIS,3) /* SiS SG86C205 */ -#define CHIP_SIS86C215 SVGA_TYPE(V_SIS,4) /* SiS SG86C215 */ -#define CHIP_SIS86C225 SVGA_TYPE(V_SIS,5) /* SiS SG86C225 */ -#define CHIP_SIS5597 SVGA_TYPE(V_SIS,6) /* SiS 5597/5598 */ -#define CHIP_SIS530 SVGA_TYPE(V_SIS,7) /* SiS 530/620 */ -#define CHIP_SIS6326 SVGA_TYPE(V_SIS,8) /* SiS 6326 */ -#define CHIP_SIS300 SVGA_TYPE(V_SIS,9) /* SiS 300 */ -#define CHIP_SIS630 SVGA_TYPE(V_SIS,10) /* SiS 630 */ -#define CHIP_SIS540 SVGA_TYPE(V_SIS,11) /* SiS 540 */ -#define CHIP_MATROX_UNK SVGA_TYPE(V_MATROX,0) /* Matrox unknown */ -#define CHIP_MGA2085PX SVGA_TYPE(V_MATROX,1) /* Matrox Atlas */ -#define CHIP_MGA2064W SVGA_TYPE(V_MATROX,2) /* Matrox Millennium */ -#define CHIP_MGA1064SG SVGA_TYPE(V_MATROX,3) /* Matrox Mystique */ -#define CHIP_MGA2164W SVGA_TYPE(V_MATROX,4) /* Matrox Millennium II */ -#define CHIP_MGA2164WAGP SVGA_TYPE(V_MATROX,5) /* Matrox Millennium II AGP */ -#define CHIP_MGAG100PCI SVGA_TYPE(V_MATROX,6) /* Matrox G100 PCI */ -#define CHIP_MGAG100AGP SVGA_TYPE(V_MATROX,7) /* Matrox G100 AGP */ -#define CHIP_MGAG200PCI SVGA_TYPE(V_MATROX,8) /* Matrox G200 PCI */ -#define CHIP_MGAG200AGP SVGA_TYPE(V_MATROX,9) /* Matrox G200 AGP */ -#define CHIP_TSENG_UNK SVGA_TYPE(V_TSENG,0) /* Tseng unknown */ -#define CHIP_ET3000 SVGA_TYPE(V_TSENG,1) /* Tseng ET3000 */ -#define CHIP_ET4000 SVGA_TYPE(V_TSENG,2) /* Tseng ET4000 */ -#define CHIP_ET4000W32 SVGA_TYPE(V_TSENG,3) /* Tseng ET4000/W32 */ -#define CHIP_ET4000W32I SVGA_TYPE(V_TSENG,4) /* Tseng ET4000/W32i */ -#define CHIP_ET4KW32P_A SVGA_TYPE(V_TSENG,5) /* Tseng ET4000/W32p rA */ -#define CHIP_ET4KW32I_B SVGA_TYPE(V_TSENG,6) /* Tseng ET4000/W32i rB */ -#define CHIP_ET4KW32I_C SVGA_TYPE(V_TSENG,7) /* Tseng ET4000/W32i rC */ -#define CHIP_ET4KW32P_B SVGA_TYPE(V_TSENG,8) /* Tseng ET4000/W32p rB */ -#define CHIP_ET4KW32P_C SVGA_TYPE(V_TSENG,9) /* Tseng ET4000/W32p rC */ -#define CHIP_ET4KW32P_D SVGA_TYPE(V_TSENG,10) /* Tseng ET4000/W32p rD */ -#define CHIP_ET6K SVGA_TYPE(V_TSENG,11) /* Tseng ET6000 */ -#define CHIP_ET6K1 SVGA_TYPE(V_TSENG,12) /* Tseng ET6100 */ -#define CHIP_ET6K3 SVGA_TYPE(V_TSENG,13) /* Tseng ET6300 */ -#define CHIP_UMC_408 SVGA_TYPE(V_UMC,0) /* UMC 85c408 */ -#define CHIP_V7_UNKNOWN SVGA_TYPE(V_VIDEO7,0) /* Video7 unknown */ -#define CHIP_V7_FWRITE SVGA_TYPE(V_VIDEO7,1) /* Video7 Fastwrite/VRAM*/ -#define CHIP_V7_1024i SVGA_TYPE(V_VIDEO7,2) /* Video7 1024i */ -#define CHIP_V7_VRAM2_B SVGA_TYPE(V_VIDEO7,3) /* Video7 VRAM II (B) */ -#define CHIP_V7_VRAM2_C SVGA_TYPE(V_VIDEO7,4) /* Video7 VRAM II (C,D) */ -#define CHIP_HT216BC SVGA_TYPE(V_VIDEO7,5) /* Video7 HT216B,C */ -#define CHIP_HT216D SVGA_TYPE(V_VIDEO7,6) /* Video7 HT216D */ -#define CHIP_HT216E SVGA_TYPE(V_VIDEO7,7) /* Video7 HT216E */ -#define CHIP_HT216F SVGA_TYPE(V_VIDEO7,8) /* Video7 HT216F */ -#define CHIP_V7_VEGA SVGA_TYPE(V_VIDEO7,9) /* Video7 VEGA */ -#define CHIP_WD_UNK SVGA_TYPE(V_WD,0) /* WD unknown */ -#define CHIP_WD_PVGA1 SVGA_TYPE(V_WD,1) /* WD PVGA1 */ -#define CHIP_WD_90C00 SVGA_TYPE(V_WD,2) /* WD 90C00 */ -#define CHIP_WD_90C10 SVGA_TYPE(V_WD,3) /* WD 90C10 */ -#define CHIP_WD_90C11 SVGA_TYPE(V_WD,4) /* WD 90C11 */ -#define CHIP_WD_90C20 SVGA_TYPE(V_WD,5) /* WD 90C20 */ -#define CHIP_WD_90C20A SVGA_TYPE(V_WD,6) /* WD 90C20A */ -#define CHIP_WD_90C22 SVGA_TYPE(V_WD,7) /* WD 90C22 */ -#define CHIP_WD_90C24 SVGA_TYPE(V_WD,8) /* WD 90C24 */ -#define CHIP_WD_90C26 SVGA_TYPE(V_WD,9) /* WD 90C26 */ -#define CHIP_WD_90C27 SVGA_TYPE(V_WD,10) /* WD 90C27 (guess) */ -#define CHIP_WD_90C30 SVGA_TYPE(V_WD,11) /* WD 90C30 */ -#define CHIP_WD_90C31 SVGA_TYPE(V_WD,12) /* WD 90C31 */ -#define CHIP_WD_90C33 SVGA_TYPE(V_WD,13) /* WD 90C33 */ -#define CHIP_WEIT_UNK SVGA_TYPE(V_WEITEK,0) /* Weitek unknown */ -#define CHIP_WEIT_5086 SVGA_TYPE(V_WEITEK,1) /* Weitek 5086 */ -#define CHIP_WEIT_5186 SVGA_TYPE(V_WEITEK,2) /* Weitek 5186 */ -#define CHIP_WEIT_5286 SVGA_TYPE(V_WEITEK,3) /* Weitek 5286 */ -#define CHIP_YAMAHA6388 SVGA_TYPE(V_YAMAHA,0) /* Yamaha 6388 VPDC */ -#define CHIP_SD_RM_UNK SVGA_TYPE(V_SD,0) /* Sigma Desigs unknown */ -#define CHIP_SD_RM64GX SVGA_TYPE(V_SD,1) /* Sigma Desigs SD6425 */ -#define CHIP_IG_UNK SVGA_TYPE(V_IG,0) /* Intergraphics unknown */ -#define CHIP_IG_1680 SVGA_TYPE(V_IG,1) /* Intergraphics IGA-1680 */ -#define CHIP_IG_1682 SVGA_TYPE(V_IG,2) /* Intergraphics IGA-1682 */ -#define CHIP_EPSON_8110 SVGA_TYPE(V_EPSON,0) /* Epson SPC8110 */ -#define CHIP_SMI_UNK SVGA_TYPE(V_SMI,0) /* SMI unknwon */ -#define CHIP_SMI_910 SVGA_TYPE(V_SMI,1) /* SMI 910 */ -#define CHIP_SMI_810 SVGA_TYPE(V_SMI,2) /* SMI 810 */ -#define CHIP_SMI_820 SVGA_TYPE(V_SMI,3) /* SMI 820 */ -#define CHIP_SMI_710 SVGA_TYPE(V_SMI,4) /* SMI 710 */ -#define CHIP_SMI_712 SVGA_TYPE(V_SMI,5) /* SMI 712 */ -#define CHIP_SMI_720 SVGA_TYPE(V_SMI,6) /* SMI 720 */ - -/* - * Graphics Coprocessors - */ -#define COPROC_TYPE(c,n) (((c) << 16) | ((n) << 8) | CHIP_COPROC) -#define C_8514 0 -#define C_XGA 1 -#define C_MACH64 2 -#define C_I128 3 -#define C_GLINT 4 - -#define NUM_CP_TYPES 5 -#define CHPS_PER_CPTYPE 8 - -#define CHIP_8514 COPROC_TYPE(C_8514,0) /* 8514/A or true clone */ -#define CHIP_MACH8 COPROC_TYPE(C_8514,1) /* ATI Mach8 */ -#define CHIP_MACH32 COPROC_TYPE(C_8514,2) /* ATI Mach32 */ -#define CHIP_CT480 COPROC_TYPE(C_8514,3) /* C&T 82c480 */ - -#define CHIP_MACH64 COPROC_TYPE(C_MACH64,0) /* ATI Mach64 */ - -#define CHIP_I128 COPROC_TYPE(C_I128,0) /* Number9 Imagine I128 */ - -#define CHIP_300SX COPROC_TYPE(C_GLINT,1) /* 3DLabs GLINT 300SX */ -#define CHIP_500TX COPROC_TYPE(C_GLINT,2) /* 3DLabs GLINT 500TX */ -#define CHIP_DELTA COPROC_TYPE(C_GLINT,4) /* 3DLabs GLINT DELTA */ - -/* - * Useful macros - */ -#define IS_MDA(c) ((c) == CHIP_MDA) -#define IS_HERC(c) ((((c) & 0xFF) == CHIP_MDA) && ((c) != CHIP_MDA)) -#define HERC_CHIP(c) (((c) >> 8) & 0xFF) -#define IS_CGA(c) ((c) == CHIP_CGA) -#define IS_EGA(c) ((c) == CHIP_EGA) -#define IS_PGC(c) ((c) == CHIP_PGC) -#define IS_VGA(c) ((c) == CHIP_VGA) -#define IS_SVGA(c) ((((c) & 0xFF) == CHIP_VGA) && ((c) != CHIP_VGA)) -#define SVGA_VENDOR(c) (((c) >> 16) & 0xFF) -#define SVGA_CHIP(c) (((c) >> 8) & 0xFF) -#define IS_MCGA(c) ((c) == CHIP_MCGA) -#define IS_COPROC(c) (((c) & 0xFF) == CHIP_COPROC) -#define COPROC_CLASS(c) (((c) >> 16) & 0xFF) -#define COPROC_CHIP(c) (((c) >> 8) & 0xFF) Index: xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c:3.37 xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c:3.37 Tue Nov 28 15:59:16 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c Fri Jan 18 15:24:53 2002 @@ -1,1437 +0,0 @@ -/* $XConsortium: RamDac.c /main/17 1996/10/25 07:00:23 kaleb $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - * Contributing Authors: - * Robin Cutshaw - * Harald Koenig - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c,v 3.37 2000/11/28 20:59:16 dawes Exp $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, 0x3C6, 0x3C7, 0x3C8, 0x3C9}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -#define RED 0 -#define GREEN 1 -#define BLUE 2 - -static void ReadPelReg __STDCARGS((Byte, Byte *)); -static void WritePelReg __STDCARGS((Byte, Byte *)); -static Byte SetComm __STDCARGS((Byte)); -static Bool Width8Check __STDCARGS((void)); -static Bool TestDACBit __STDCARGS((Byte, Byte, Byte)); -static Bool S3_Bt485Check __STDCARGS((int *)); -static Bool S3_TVP3020Check __STDCARGS((int *)); -static Bool S3_ATT498Check __STDCARGS((int *)); -static Bool S3_STG1700Check __STDCARGS((int *)); -static Bool S3_GENDACCheck __STDCARGS((int *)); -static void CheckMach32 __STDCARGS((int, int *)); -static void CheckMach64 __STDCARGS((int, int *)); -static void CheckMatrox __STDCARGS((int, int *)); - -#ifdef __STDC__ -static void ReadPelReg(Byte Index, Byte *Pixel) -#else -static void ReadPelReg(Index, Pixel) -Byte Index; -Byte *Pixel; -#endif -{ - outp(0x3C7, Index); - Pixel[RED] = inp(0x3C9); - Pixel[GREEN] = inp(0x3C9); - Pixel[BLUE] = inp(0x3C9); - - return; -} - -#ifdef __STDC__ -static void WritePelReg(Byte Index, Byte *Pixel) -#else -static void WritePelReg(Index, Pixel) -Byte Index; -Byte *Pixel; -#endif -{ - outp(0x3C8, Index); - outp(0x3C9, Pixel[RED]); - outp(0x3C9, Pixel[GREEN]); - outp(0x3C9, Pixel[BLUE]); - return; -} - -#ifdef __STDC__ -static Byte SetComm(Byte Comm) -#else -static Byte SetComm(Comm) -Byte Comm; -#endif -{ - (void) dactocomm(); - outp(0x3C6, Comm); - (void) dactocomm(); - return(inp(0x3C6)); -} - -static Bool Width8Check() -{ - Byte old, x, v; - Byte pix[3]; - - old = inp(0x3C8); - ReadPelReg(0xFF, pix); - v = pix[RED]; - pix[RED]= 0xFF; - WritePelReg(0xFF, pix); - ReadPelReg(0xFF, pix); - x = pix[RED]; - pix[RED] = v; - WritePelReg(0xFF, pix); - outp(0x3C8, old); - return(x == 0xFF); -} - -#ifdef __STDC__ -static Bool TestDACBit(Byte Bit, Byte OldComm, Byte OldPel) -#else -static Bool TestDACBit(Bit, OldComm, OldPel) -Byte Bit; -Byte OldComm; -Byte OldPel; -#endif -{ - Byte tmp; - - dactopel(); - outp(0x3C6, OldPel & (Bit ^ 0xFF)); - (void) dactocomm(); - outp(0x3C6, OldComm | Bit); - tmp = inp(0x3C6); - outp(0x3C6, tmp & (Bit ^ 0xFF)); - return((tmp & Bit) != 0); -} - -static Bool S3_Bt485Check(RamDac) -int *RamDac; -{ - Byte old1, old2, old3, old4; - Byte lock1, lock2; - Bool Found = FALSE; - Bool DoChecks = FALSE; - - lock1 = rdinx(CRTC_IDX, 0x38); - lock2 = rdinx(CRTC_IDX, 0x39); - wrinx(CRTC_IDX, 0x38, 0x48); - wrinx(CRTC_IDX, 0x39, 0xA5); - - old1 = inp(0x3C6); - old2 = rdinx(CRTC_IDX, 0x55); - outp(0x3C6, 0x0F); - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x02); - old3 = inp(0x3C6); - if ((old3 & 0x80) == 0x80) - { - Found = TRUE; - if ((old3 & 0xC0) == 0x80) - { - *RamDac = DAC_BT485; - DoChecks = TRUE; - } - else if ((old3 & 0xF0) == 0xD0) - { - DoChecks = TRUE; - *RamDac = DAC_ATT505; - } - else - { - *RamDac = DAC_UNKNOWN; - } - } - else if ((old3 & 0xF0) == 0x40) - { - Found = TRUE; - *RamDac = DAC_ATT504; - DoChecks = TRUE; - } - else - { - /* Perhaps status reg is hidden behind CR3 */ - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x01); - old3 = inp(0x3C6); - if ((old3 & 0x80) == 0x80) - { - /* OK. CR3 is active... */ - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); - old3 = inp(0x3C8); - outp(0x3C8, 0x00); - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x02); - old4 = inp(0x3C6); - if ((old4 & 0x80) == 0x80) - { - Found = TRUE; - if ((old4 & 0xC0) == 0x80) - { - *RamDac = DAC_BT485; - } - else if ((old4 & 0xF0) == 0xD0) - { - *RamDac = DAC_ATT505; - } - else - { - *RamDac = DAC_UNKNOWN; - } - } - else if ((old4 & 0xF0) == 0x40) - { - Found = TRUE; - *RamDac = DAC_ATT504; - } - if ((Found) && (*RamDac != DAC_UNKNOWN)) - { - *RamDac |= DAC_6_8_PROGRAM; - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - } - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); - outp(0x3C8, old3); - } - } - if (DoChecks) - { - *RamDac |= DAC_6_8_PROGRAM; - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - } - wrinx(CRTC_IDX, 0x55, old2); - outp(0x3C6, old1); - - wrinx(CRTC_IDX, 0x39, lock2); - wrinx(CRTC_IDX, 0x38, lock1); - - return(Found); -} - -static Bool S3_TVP3020Check(RamDac) -int *RamDac; -{ - Byte old1, old2, old3, old4; - Byte lock1, lock2; - Bool Found = FALSE; - - /* - * TI ViewPoint TVP3020 support - Robin Cutshaw - * - * The 3020 has 8 direct registers accessed through standard - * VGA registers 0x3C8, 0x3C9, 0x3C6, and 0x3C7. Bit 0 of - * CR55 is used to map these four register to the low four - * or high four direct 3020 registers. The high register set - * includes index and data registers which are used to address - * indirect registers 0x00-0x3F and 0xFF. Indirect register - * 0x3F is the chip ID register which will always return 0x20. - */ - - lock1 = rdinx(CRTC_IDX, 0x38); - lock2 = rdinx(CRTC_IDX, 0x39); - wrinx(CRTC_IDX, 0x38, 0x48); - wrinx(CRTC_IDX, 0x39, 0xA5); - - old1 = inp(0x3C6); - old2 = rdinx(CRTC_IDX, 0x55); - - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x01); /* high four registers */ - old3 = inp(0x3C6); /* read current index register value */ - - outp(0x3C6, 0x3F); /* write ID register index to index register */ - old4 = inp(0x3C7); /* read ID register from data register */ - if (old4 == 0x20) { - Found = TRUE; - *RamDac = DAC_TVP3020 | DAC_6_8_PROGRAM; - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* regular VGA */ - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - } else { - Byte old5, old6; - - /* check for Ti3025 hiding behind Bt485 mode */ - old5 = rdinx(CRTC_IDX, 0x5C); - - /* clear 0x20 (RS4) for 3020 mode */ - wrinx(CRTC_IDX, 0x5C, old5 & 0xDF); - /* already twiddled CR55 above */ - old6 = inp(0x3C6); /* read current index register value */ - outp(0x3C6, 0x3F); /* write ID register index to index register */ - old4 = inp(0x3C7); /* read ID register from data register */ - if (old4 == 0x25) { - Found = TRUE; - *RamDac = DAC_TVP3025 | DAC_6_8_PROGRAM; - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* regular VGA */ - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x01); - } - - outp(0x3C6, old6); /* restore index register value */ - wrinx(CRTC_IDX, 0x5C, old5); /* restore 5C */ - } - - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x01); /* high four registers */ - outp(0x3C6, old3); /* restore index register value */ - - wrinx(CRTC_IDX, 0x55, old2); - outp(0x3C6, old1); - - wrinx(CRTC_IDX, 0x39, lock2); - wrinx(CRTC_IDX, 0x38, lock1); - - return(Found); -} - -static Bool S3_TVP3026Check(RamDac) -int *RamDac; -{ - Byte old1, old2, old3, old4, old5; - Byte lock1, lock2; - Bool Found = FALSE; - - /* - * TI ViewPoint TVP3026/3030 support - Harald Koenig - * - * The 3026/3030 have 16 direct registers accessed through standard - * VGA registers 0x3C8, 0x3C9, 0x3C6, and 0x3C7. Bits 0,1 of - * CR55 are used to map these four register to sets of four - * direct 3026/3030 registers each. The 00 register set includes - * the index register and the 10 register set includes the - * data register which are used to address indirect registers - * 0x00-0x3F and 0xFF. Indirect register 0x3F is the - * chip ID register which will always return 0x26. - */ - - lock1 = rdinx(CRTC_IDX, 0x38); - lock2 = rdinx(CRTC_IDX, 0x39); - wrinx(CRTC_IDX, 0x38, 0x48); - wrinx(CRTC_IDX, 0x39, 0xA5); - - old1 = inp(0x3C6); - old2 = rdinx(CRTC_IDX, 0x55); - old5 = rdinx(CRTC_IDX, 0x45); - - - wrinx(CRTC_IDX, 0x45, old5 & ~0x20); - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* 00 four registers */ - old3 = inp(0x3C8); /* read current index register value */ - - outp(0x3C8, 0x3F); /* write ID register index to index register */ - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x02); /* 10 four registers */ - old4 = inp(0x3C6); /* read ID register from data register */ - if (old4 == 0x26 || old4 == 0x30) { - outp(0x3C6, ~old4); /* check if ID register is read only */ - if (inp(0x3C6) != old4) { - outp(0x3C6, old4); - } - else { - Found = TRUE; - if (old4 == 0x26) - *RamDac = DAC_TVP3026 | DAC_6_8_PROGRAM; - else /* old4 == 0x30 */ - *RamDac = DAC_TVP3030 | DAC_6_8_PROGRAM; - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* regular VGA */ - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - } - } - - wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* 00 four registers */ - outp(0x3C8, old3); /* restore index register value */ - - wrinx(CRTC_IDX, 0x55, old2); - wrinx(CRTC_IDX, 0x45, old5); - outp(0x3C6, old1); - - wrinx(CRTC_IDX, 0x39, lock2); - wrinx(CRTC_IDX, 0x38, lock1); - - return(Found); -} - -static Bool S3_IBMRGBCheck(RamDac) -int *RamDac; -{ - Byte lock1, lock2; - Bool Found = FALSE; - unsigned char CR43, CR55, dac[3], lut[6]; - unsigned char ilow, ihigh, id, rev, id2, rev2; - int i,j; - int ret=0; - - /* - * IBM RGB52x support - Harald Koenig - */ - - lock1 = rdinx(CRTC_IDX, 0x38); - lock2 = rdinx(CRTC_IDX, 0x39); - wrinx(CRTC_IDX, 0x38, 0x48); - wrinx(CRTC_IDX, 0x39, 0xA5); - - CR43 = rdinx(CRTC_IDX, 0x43); - CR55 = rdinx(CRTC_IDX, 0x55); - - wrinx(CRTC_IDX, 0x43, CR43 & ~0x02); - wrinx(CRTC_IDX, 0x55, CR55 & ~0x03); - - /* save DAC and first LUT entries */ - for (i=0; i<3; i++) - dac[i] = inp(0x3c6+i); - for (i=j=0; i<2; i++) { - outp(0x3c7, i); - lut[j++] = inp(0x3c9); - lut[j++] = inp(0x3c9); - lut[j++] = inp(0x3c9); - } - - wrinx(CRTC_IDX, 0x55, (CR55 & ~0x03) | 0x01); /* set RS2 */ - - /* read ID and revision */ - ilow = inp(0x3c8); - ihigh = inp(0x3c9); - outp(0x3c9, 0); /* index high */ - outp(0x3c8, 0); - rev = inp(0x3c6); - outp(0x3c8, 1); - id = inp(0x3c6); - - /* known IDs: - 1 = RGB525 - 2 = RGB524, RGB528 - */ - - if (id >= 1 && id <= 2) { - /* check if ID and revision are read only */ - outp(0x3c8, 0); - outp(0x3c6, ~rev); - outp(0x3c8, 1); - outp(0x3c6, ~id); - outp(0x3c8, 0); - rev2 = inp(0x3c6); - outp(0x3c8, 1); - id2 = inp(0x3c6); - - if (id == id2 && rev == rev2) { /* IBM RGB52x found */ - Found = TRUE; - switch(id) { - case 1: - *RamDac = DAC_IBMRGB525 | DAC_6_8_PROGRAM; - break; - case 2: - outp(0x3c8, 0x70); - id2 = inp(0x3c6); - if ((id2 & 0x03) == 3) - *RamDac = DAC_IBMRGB528 | DAC_6_8_PROGRAM; - else - *RamDac = DAC_IBMRGB524 | DAC_6_8_PROGRAM; - break; - } - } - else { - outp(0x3c8, 0); - outp(0x3c6, rev); - outp(0x3c8, 1); - outp(0x3c6, id); - } - } - outp(0x3c8, ilow); - outp(0x3c9, ihigh); - - wrinx(CRTC_IDX, 0x55, CR55 & ~0x03); - - /* restore DAC and first LUT entries */ - for (i=j=0; i<2; i++) { - outp(0x3c8, i); - outp(0x3c9, lut[j++]); - outp(0x3c9 ,lut[j++]); - outp(0x3c9 ,lut[j++]); - } - for (i=0; i<3; i++) - outp(0x3c6+i, dac[i]); - - wrinx(CRTC_IDX, 0x43, CR43); - wrinx(CRTC_IDX, 0x55, CR55); - - - if (Found && Width8Check()) { - *RamDac |= DAC_8BIT; - } - - wrinx(CRTC_IDX, 0x39, lock2); - wrinx(CRTC_IDX, 0x38, lock1); - - return(Found); -} - -static Bool S3_ATT498Check(RamDac) -int *RamDac; -{ - Byte mir, dir, daccomm; - int i; - Bool Found = FALSE; - - /* - * ATT20C498 support - Harald Koenig - * ATT20C409 and - * ATT20C499 support - Dirk Hohndel - * - * The ATT498 has 4 direct registers accessed through standard - * VGA registers 0x3C8, 0x3C9, 0x3C6, and 0x3C7 and 6 indirect - * registers accessed through a back door by successive reads - * on RMR (Pixel read mask register 0x3C6). - */ - - dactocomm(); - inp(0x3C6); /* reading CR0 */ - mir = inp(0x3C6); - dir = inp(0x3C6); - dactopel(); - - if ((mir == 0x84) && (dir == 0x98)) { - daccomm = getdaccomm(); - SetComm(0); - SetComm(0x0a); - if (getdaccomm() == 0) - *RamDac = DAC_ATT22C498; - else - *RamDac = DAC_ATT498; - SetComm(daccomm); - Found = TRUE; - *RamDac |= DAC_6_8_PROGRAM; - } - else if( (mir = 0x84) && (dir == 0x09) ) { - SetComm(daccomm); - *RamDac = DAC_ATT409 | DAC_6_8_PROGRAM; - Found = TRUE; - } - else if( (mir = 0x84) && (dir == 0x99) ) { - SetComm(daccomm); - *RamDac = DAC_ATT499 | DAC_6_8_PROGRAM; - Found = TRUE; - } - - return(Found); -} - -static Bool CH8398Check(RamDac) -int *RamDac; -{ -/* This dac does not provide much information to distinguish itself. */ -/* So this probe may not be suitable, unless you know that the ch8398 */ -/* is a possibility. */ - Byte cid; - Bool Found = FALSE; - - dactopel(); - inp(0x3c6); - inp(0x3c6); - inp(0x3c6); - cid = inp(0x3c6); /* device ID */ - if (cid == 0xc0) { - Found = TRUE; - *RamDac = DAC_CH8398; - } - dactopel(); - return Found; -} - -static Bool S3_STG1700Check(RamDac) -int *RamDac; -{ - Byte cid, did, daccomm, readmask; - int i; - Bool Found = FALSE; - - readmask = inp(0x3c6); - dactopel(); - daccomm = getdaccomm(); - SetComm(daccomm | 0x10); - dactocomm(); - inp(0x3C6); - outp(0x3c6, 0x00); - outp(0x3c6, 0x00); - cid = inp(0x3c6); /* company ID */ - did = inp(0x3c6); /* device ID */ - dactopel(); - outp(0x3c6,readmask); - SetComm(daccomm); - - if ((cid == 0x44) && (did == 0x00)) { - Found = TRUE; - *RamDac = DAC_STG1700; - *RamDac |= DAC_6_8_PROGRAM; - } - if ((cid == 0x44) && (did == 0x02)) { - Found = TRUE; - *RamDac = DAC_STG1702; - *RamDac |= DAC_6_8_PROGRAM; - } - if ((cid == 0x44) && (did == 0x03)) { - Found = TRUE; - *RamDac = DAC_STG1703; - *RamDac |= DAC_6_8_PROGRAM; - } - - return(Found); -} - -static Bool S3_GENDACCheck(RamDac) -int *RamDac; -{ - Byte daccomm; - int i; - Bool Found = FALSE; - Byte lock1, lock2; - - Byte saveCR55, savelut[6]; - long clock01, clock23; - - /* probe for S3 GENDAC or SDAC */ - /* - * S3 GENDAC and SDAC have two fixed read only PLL clocks - * CLK0 f0: 25.255MHz M-byte 0x28 N-byte 0x61 - * CLK0 f1: 28.311MHz M-byte 0x3d N-byte 0x62 - * which can be used to detect GENDAC and SDAC since there is no chip-id - * for the GENDAC. - * - * NOTE: for the GENDAC on a MIRO 10SD (805+GENDAC) reading PLL values - * for CLK0 f0 and f1 always returns 0x7f (but is documented "read only) - */ - - - lock1 = rdinx(CRTC_IDX, 0x38); - lock2 = rdinx(CRTC_IDX, 0x39); - wrinx(CRTC_IDX, 0x38, 0x48); - wrinx(CRTC_IDX, 0x39, 0xA5); - - saveCR55 = rdinx(CRTC_IDX, 0x55); - wrinx(CRTC_IDX, 0x55, saveCR55 & ~1); - - outp(0x3c7,0); - for(i=0; i<2*3; i++) /* save first two LUT entries */ - savelut[i] = inp(0x3c9); - outp(0x3c8,0); - for(i=0; i<2*3; i++) /* set first two LUT entries to zero */ - outp(0x3c9,0); - - wrinx(CRTC_IDX, 0x55, saveCR55 | 1); - - outp(0x3c7,0); - for(i=clock01=0; i<4; i++) - clock01 = (clock01 << 8) | (inp(0x3c9) & 0xff); - for(i=clock23=0; i<4; i++) - clock23 = (clock23 << 8) | (inp(0x3c9) & 0xff); - - wrinx(CRTC_IDX, 0x55, saveCR55 & ~1); - - outp(0x3c8,0); - for(i=0; i<2*3; i++) /* restore first two LUT entries */ - outp(0x3c9,savelut[i]); - - wrinx(CRTC_IDX, 0x55, saveCR55); - wrinx(CRTC_IDX, 0x39, lock2); - wrinx(CRTC_IDX, 0x38, lock1); - - if ( clock01 == 0x28613d62 || - (clock01 == 0x7f7f7f7f && clock23 != 0x7f7f7f7f)) { - Found = TRUE; - - dactopel(); - inp(0x3c6); - inp(0x3c6); - inp(0x3c6); - - /* the fourth read will show the SDAC chip ID and revision */ - if (((i=inp(0x3c6)) & 0xf0) == 0x70) - *RamDac = DAC_S3_SDAC; - else - *RamDac = DAC_S3_GENDAC; - dactopel(); - } - - return(Found); -} - -static Bool Tseng_GENDACCheck(RamDac) -int *RamDac; -{ - Byte daccomm; - int i; - Bool Found = FALSE; - - Byte saveCR31, savelut[6]; - Byte saveHercComp, saveModeContr; - long clock01, clock23; - - /* probe for Tseng GENDAC or SDAC */ - /* - * S3 GENDAC and SDAC have two fixed read only PLL clocks - * CLK0 f0: 25.255MHz M-byte 0x28 N-byte 0x61 - * CLK0 f1: 28.311MHz M-byte 0x3d N-byte 0x62 - * which can be used to detect GENDAC and SDAC since there is no chip-id - * for the GENDAC. - */ - - - saveHercComp = inp(0x3BF); - saveModeContr= inp(0x3D8); - outp(0x3BF, 0x03); /* unlock ET4000 special */ - outp(0x3D8, 0xA0); - - saveCR31 = rdinx(CRTC_IDX, 0x31); - wrinx(CRTC_IDX, 0x31, saveCR31 & ~0x40); - - outp(0x3c7,0); - for(i=0; i<2*3; i++) /* save first two LUT entries */ - savelut[i] = inp(0x3c9); - outp(0x3c8,0); - for(i=0; i<2*3; i++) /* set first two LUT entries to zero */ - outp(0x3c9,0); - - wrinx(CRTC_IDX, 0x31, saveCR31 | 0x40); - - outp(0x3c7,0); - for(i=clock01=0; i<4; i++) - clock01 = (clock01 << 8) | (inp(0x3c9) & 0xff); - for(i=clock23=0; i<4; i++) - clock23 = (clock23 << 8) | (inp(0x3c9) & 0xff); - - wrinx(CRTC_IDX, 0x31, saveCR31 & ~0x40); - - outp(0x3c8,0); - for(i=0; i<2*3; i++) /* restore first two LUT entries */ - outp(0x3c9,savelut[i]); - - wrinx(CRTC_IDX, 0x31, saveCR31); - - outp(0x3BF, saveHercComp); - outp(0x3D8, saveModeContr); - - if ( clock01 == 0x28613d62 || - (clock01 == 0x7f7f7f7f && clock23 != 0x7f7f7f7f)) { - Found = TRUE; - - dactopel(); - inp(0x3c6); - inp(0x3c6); - inp(0x3c6); - - /* the fourth read will show the SDAC chip ID and revision */ - if (((i=inp(0x3c6)) & 0xf0) == 0xb0) - *RamDac = DAC_ICS5341; - else - *RamDac = DAC_ICS5301; /* ID code ICS5301 = 0xf0 */ - dactopel(); - } - - return(Found); -} - -static Bool S3_SC15025Check(RamDac) -int *RamDac; -{ - Byte c,id[4]; - int i; - Bool Found = FALSE; - - /* - * Sierra 15025 support - Harald Koenig - * - * The SC15025 has 9 indexed extended registers which can be accessed - * by setting bit 0x10 in the command register. - * In extended registers 0x9-0xC an identification code is stored - * should be 53 3a b1 41 - */ - - c = getdaccomm(); - SetComm(c | 0x10); /* enable extened data registers */ - for (i=0; i<4; i++) { - outp(0x3C7, 0x9+i); - id[i] = inp(0x3C8); - } - SetComm(c); /* restore command register */ - dactopel(); - - if (id[0] == 'S' && /* Sierra */ - ((id[1]<<8)|id[2]) == 15025) { /* unique for the SC 15025/26 */ - if (id[3] != 'A') { /* version number */ - fprintf(stderr,"*** ==> New Sierra SC 15025/26 version (%x) found, please report!\n",id[3]); - } - Found = TRUE; - *RamDac = DAC_SIERRA24; - *RamDac |= DAC_6_8_PROGRAM; - } - - return(Found); -} - -static Bool ARK_ZOOMDACCheck(RamDac) -int *RamDac; -{ - /* - * This DAC has the same ID as an AT&T ATT20C498, but - * with an ARK chip it is reasonable to assume it's a ZOOMDAC. - */ - Byte cid, did, daccomm, readmask; - int i; - Bool Found = FALSE; - - dactopel(); - dactocomm(); - inp(0x3C6); - cid = inp(0x3c6); /* company ID */ - did = inp(0x3c6); /* device ID */ - dactopel(); - - if ((cid == 0x84) && (did == 0x98)) { - Found = TRUE; - *RamDac = DAC_ZOOMDAC; - *RamDac |= DAC_6_8_PROGRAM; - } - - return(Found); -} - - -static void CheckMach32(ChipSet, RamDac) -int ChipSet; -int *RamDac; -{ - Word Port = CONFIG_STATUS_1; - EnableIOPorts(1, &Port); - - switch ((inpw(Port) & 0x0E00) >> 9) - { - case 0x00: - *RamDac = DAC_ATI68830; - break; - case 0x01: - *RamDac = DAC_SIERRA15_16; - break; - case 0x02: - *RamDac = DAC_ATI68875; - *RamDac |= DAC_6_8_PROGRAM; - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - break; - case 0x03: - *RamDac = DAC_STANDARD; - break; - case 0x04: - *RamDac = DAC_ATIMISC24; - *RamDac |= DAC_6_8_PROGRAM; - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - break; - case 0x05: - *RamDac = DAC_ATI68860; - *RamDac |= DAC_6_8_PROGRAM; - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - break; - case 0x06: - *RamDac = DAC_STG1700; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x07: - *RamDac = DAC_ATT498; - *RamDac |= DAC_6_8_PROGRAM; - break; - } - - DisableIOPorts(1, &Port); - return; -} - -static void CheckMach64(ChipSet, RamDac) -int ChipSet; -int *RamDac; -{ - extern Word ATIMach64DAC_CNTL, ATIMach64SCRATCH_REG1; - - if (ChipSet >= CHIP_ATI264CT) - { - *RamDac = DAC_ATI_INTERNAL; - *RamDac |= DAC_6_8_PROGRAM; - if (Width8Check()) - *RamDac |= DAC_8BIT; - return; - } - - EnableIOPorts(1, &ATIMach64DAC_CNTL); - EnableIOPorts(1, &ATIMach64SCRATCH_REG1); - - switch (((inpl(ATIMach64DAC_CNTL) & 0x00070000) | - (inpl(ATIMach64SCRATCH_REG1) & 0x0000F000)) >> 12) - { - case 0x10: - *RamDac = DAC_IBMRGB525; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x20: - *RamDac = DAC_ATI68875; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x27: - case 0x57: - *RamDac = DAC_TVP3025; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x30: - *RamDac = DAC_STANDARD; - break; - case 0x40: - *RamDac = DAC_ATIMISC24; - break; - case 0x41: - *RamDac = DAC_ATT491; - break; - case 0x42: - *RamDac = DAC_SIERRA24; - break; - case 0x43: - *RamDac = DAC_MU9C1880; - break; - case 0x44: - *RamDac = DAC_IMSG174; - break; - case 0x50: - case 0x51: - *RamDac = DAC_ATI68860; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x60: - *RamDac = DAC_STG1700; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x61: - *RamDac = DAC_ATT498; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x70: - *RamDac = DAC_STG1702; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x71: - *RamDac = DAC_SIERRA24; - break; - case 0x72: - *RamDac = DAC_ATT498; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x73: - *RamDac = DAC_STG1703; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x74: - *RamDac = DAC_CH8398; - *RamDac |= DAC_6_8_PROGRAM; - break; - case 0x75: - *RamDac = DAC_ATT408; - *RamDac |= DAC_6_8_PROGRAM; - break; - default: - break; - } - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - - DisableIOPorts(1, &ATIMach64DAC_CNTL); - DisableIOPorts(1, &ATIMach64SCRATCH_REG1); - return; -} - -void Probe_RamDac(Chipset, RamDac) -int Chipset; -int *RamDac; -{ - Byte x, y, z, u, v, oldcomm, oldpel, notcomm, tmp; - Bool dac8, dac8now; - - *RamDac = DAC_STANDARD; - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - - /* - * Handle special cases. - */ - if (Chipset == CHIP_AL2101) - { - *RamDac = DAC_ALG1101; - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - DisableIOPorts(NUMPORTS, Ports); - return; - } - else if (SVGA_VENDOR(Chipset) == V_ATI) - { - extern Bool Crippled_Mach32, Crippled_Mach64; - - if ((Chipset < CHIP_ATI68800_3) || Crippled_Mach32) - { - if (ReadBIOS(0x44, &x, 1) != 1) - { - fprintf(stderr, "%s: Failed to read ATI BIOS data\n", - MyName); - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (x & 0x80) - { - *RamDac = DAC_ATI68830; - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - DisableIOPorts(NUMPORTS, Ports); - return; - } - } - else if (!Crippled_Mach64) - { - if (Chipset <= CHIP_ATI88800GXC) - { - CheckMach32(Chipset, RamDac); - if (DAC_CHIP(*RamDac) != DAC_ATIMISC24) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - } - else - { - CheckMach64(Chipset, RamDac); - DisableIOPorts(NUMPORTS, Ports); - return; - } - } - } - else if ((SVGA_VENDOR(Chipset) == V_CIRRUS) && - (Chipset >= CHIP_CL5420)) - { - if ((Chipset == CHIP_CL5420) || (Chipset >= CHIP_CL5410)) - { - *RamDac = DAC_CIRRUSA; - } - else - { - *RamDac = DAC_CIRRUSB; - } - if (Width8Check()) - { - *RamDac |= DAC_8BIT; - } - DisableIOPorts(NUMPORTS, Ports); - return; - } - else if ((SVGA_VENDOR(Chipset) == V_S3) && (Chipset >= CHIP_S3_928D)) - { - if (S3_TVP3026Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_IBMRGBCheck(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_TVP3020Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_Bt485Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_ATT498Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_STG1700Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_GENDACCheck(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_SC15025Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - } - else if ( ((SVGA_VENDOR(Chipset) == V_S3) && (Chipset >= CHIP_S3_801B)) - ||(SVGA_VENDOR(Chipset) == V_TSENG) ) - { - if ( (Chipset == CHIP_ET6K) || (Chipset == CHIP_ET6K1) || (Chipset == CHIP_ET6K3) ) - { - *RamDac = DAC_ET6K; - } - if (S3_GENDACCheck(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_STG1700Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (CH8398Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if ( (SVGA_VENDOR(Chipset) == V_TSENG) && ( Chipset != CHIP_ET6K ) - && ( Chipset != CHIP_ET6K1 ) && ( Chipset != CHIP_ET6K3 ) ) - { - if (Tseng_GENDACCheck(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - } - } - else if (SVGA_VENDOR(Chipset) == V_MATROX) - { - if (Chipset == CHIP_MGA2085PX) - *RamDac = DAC_BT485; - if (Chipset == CHIP_MGA2064W) - *RamDac = DAC_TVP3026; - if ((Chipset == CHIP_MGA2164W)||(Chipset == CHIP_MGA2164WAGP)) - *RamDac = DAC_TVP3026; - if (Chipset == CHIP_MGA1064SG) - *RamDac = DAC_MGA1064SG; - if ((Chipset == CHIP_MGAG100PCI)||(Chipset == CHIP_MGAG100AGP)) - *RamDac = DAC_MGAG100; - if ((Chipset == CHIP_MGAG200PCI)||(Chipset == CHIP_MGAG200AGP)) - *RamDac = DAC_MGAG200; - DisableIOPorts(NUMPORTS, Ports); - return; - } - else if ( (SVGA_VENDOR(Chipset) == V_TRIDENT) && - (Chipset >= CHIP_TVGA9000I) ) - { - if (Chipset <= CHIP_TVGA9440) - *RamDac = DAC_TKD8001; - else - *RamDac = DAC_TGUIDAC; - DisableIOPorts(NUMPORTS, Ports); - return; - } - else if (SVGA_VENDOR(Chipset) == V_ARK) - { - if (ARK_ZOOMDACCheck(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - if (S3_STG1700Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - } - else if (SVGA_VENDOR(Chipset) == V_ALLIANCE) - { - if (Chipset == CHIP_ALSC6422 || Chipset == CHIP_ALSCAT24) - { - *RamDac = DAC_ALSC_642x; - } - if (S3_STG1700Check(RamDac)) - { - DisableIOPorts(NUMPORTS, Ports); - return; - } - } - else if (SVGA_VENDOR(Chipset) == V_SIS) - { - if ((Chipset >= CHIP_SIS86C201) && (Chipset <= CHIP_SIS540)) - *RamDac = DAC_SIS; - } - else if (SVGA_VENDOR(Chipset) == V_SMI) - { - if ((Chipset >= CHIP_SMI_910) && (Chipset <= CHIP_SMI_720)) - *RamDac = DAC_SMI; - } - /* - * Save current state. - */ - (void) dactocomm(); - oldcomm = inp(0x3C6); - dactopel(); - oldpel = inp(0x3C6); - - /* - * Do 8-bit-wide check. - */ - (void) dactocomm(); - outp(0x3C6, 0x00); - dac8 = Width8Check(); - dactopel(); - - /* - * Check whether this DAC has a HiColor-style command register. - */ - notcomm = ~oldcomm; - outp(0x3C6, notcomm); - (void) dactocomm(); - v = inp(0x3C6); - if (v != notcomm) - { - /* - * Check for early-generation HiColor-style DAC. - */ - if ((SetComm(0xE0) & 0xE0) != 0xE0) - { - dactopel(); - x = inp(0x3C6); - do - { - /* - * Wait for same value twice. - */ - y = x; - x = inp(0x3C6); - } - while (x != y); - z = x; - u = dactocomm(); - if (u != 0x8E) - { - /* - * If command register is 0x8E, we've got an SS24; - */ - y = 8; - do - { - x = inp(0x3C6); - y--; - } - while ((x != 0x8E) && (y != 0)); - } - else - { - x = u; - } - if (x == 0x8E) - { - *RamDac = DAC_SS24; - } - else - { - /* - * Sierra SC11486 - */ - *RamDac = DAC_SIERRA15; - } - dactopel(); - } - else - { - /* - * New generation of advanced DACs - */ - if ((SetComm(0x60) & 0xE0) == 0x00) - { - /* - * AT&T 20C490/20C493 - */ - if ((SetComm(0x02) & 0x02) != 0x00) - { - *RamDac = DAC_ATT490; - *RamDac |= DAC_6_8_PROGRAM; - } - else - { - *RamDac = DAC_ATT493; - } - } - else - { - x = SetComm(oldcomm); - if (inp(0x3C6) == notcomm) - { - if (SetComm(0xFF) != 0xFF) - { - *RamDac = DAC_ACUMOS; - } - else - { - (void) Width8Check(); - dactocomm(); - tmp = inp(0x3C6); - dactocomm(); - outp(0x3C6, (tmp | 0x02) & 0xFE); - dac8now = Width8Check(); - if (dac8now) - { - if (Width8Check()) - { - *RamDac = DAC_ATT491; - *RamDac |= DAC_6_8_PROGRAM; - } - else - { - *RamDac = DAC_CIRRUS24; - } - } - else - { - *RamDac = DAC_ATT492; - } - } - } - else - { - if (trigdac() == notcomm) - { - *RamDac = DAC_CIRRUS24; - } - else - { - dactopel(); - outp(0x3C6, 0xFF); - switch (trigdac()) - { - case 0x44: - *RamDac = DAC_MUSIC4870; - break; - case 0x82: - *RamDac = DAC_MUSIC4910; - break; - case 0x8E: - *RamDac = DAC_SS24; - break; - default: - if (TestDACBit(0x10,oldcomm,oldpel)) - { - *RamDac = DAC_SIERRA24; - *RamDac |= DAC_6_8_PROGRAM; - } - else if (TestDACBit(0x04,oldcomm,oldpel)) - { - *RamDac = DAC_UNKNOWN; - } - else - { - *RamDac = DAC_SIERRA15_16; - } - break; - } - } - } - } - } - dactocomm(); - outp(0x3C6, oldcomm); - } - dactopel(); - outp(0x3C6, oldpel); - - /* - * If no special DAC found, check for the EDSUN DAC. - */ - if (*RamDac == DAC_STANDARD) - { - /* - * Write "CEGEDSUN" + mode to DAC index 0xDE (222) - */ - waitforretrace(); - outp(0x3C8, 0xDE); - outp(0x3C9, (Byte)'C'); - outp(0x3C9, (Byte)'E'); - outp(0x3C9, (Byte)'G'); - outp(0x3C8, 0xDE); - outp(0x3C9, (Byte)'E'); - outp(0x3C9, (Byte)'D'); - outp(0x3C9, (Byte)'S'); - outp(0x3C8, 0xDE); - outp(0x3C9, (Byte)'U'); - outp(0x3C9, (Byte)'N'); - outp(0x3C9, (Byte)'\n'); - /* - * Should be in CEG mode now. - */ - outp(0x3C6, 0xFF); - x = (inp(0x3C6) >> 4) & 0x07; - if (x < 0x07) - { - *RamDac = DAC_EDSUN; - waitforretrace(); - outp(0x3C8, 0xDF); - outp(0x3C9, 0x00); - } - } - - /* - * Remember if DAC was in 8-bit mode. - */ - if (dac8) - { - *RamDac |= DAC_8BIT; - } - - DisableIOPorts(NUMPORTS, Ports); - return; -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c:3.4 Mon Dec 23 01:31:35 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c Fri Jan 18 15:24:53 2002 @@ -1,140 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c,v 3.4 1996/12/23 06:31:35 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: RealTek.c /main/5 1996/02/21 17:12:18 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, 0x3D6, 0x3D7}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_RealTek __STDCARGS((int)); - -Chip_Descriptor RealTek_Descriptor = { - "RealTek", - Probe_RealTek, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_RealTek, -}; - -#ifdef __STDC__ -Bool Probe_RealTek(int *Chipset) -#else -Bool Probe_RealTek(Chipset) -int *Chipset; -#endif -{ - Bool result = FALSE; - Byte ver; - - /* Add CRTC to enabled ports */ - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - - if (testinx2(CRTC_IDX, 0x1F, 0x3F) && - tstrg(0x3D6, 0x0F) && - tstrg(0x3D7, 0x0F)) - { - result = TRUE; - ver = rdinx(CRTC_IDX, 0x1A) >> 6; - switch (ver) - { - case 0x00: - *Chipset = CHIP_RT_3103; - break; - case 0x01: - *Chipset = CHIP_RT_3105; - break; - case 0x02: - *Chipset = CHIP_RT_3106; - break; - default: - Chip_data = ver; - *Chipset = CHIP_RT_UNK; - break; - } - } - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -static int MemProbe_RealTek(Chipset) -int Chipset; -{ - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - switch (Chipset) - { - case CHIP_RT_3103: - switch (rdinx(CRTC_IDX, 0x1E) & 0x03) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 768; - break; - case 0x03: - Mem = 1024; - break; - } - break; - case CHIP_RT_3105: - case CHIP_RT_3106: - switch (rdinx(CRTC_IDX, 0x1E) & 0x03) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - Mem = 1024; - break; - case 0x03: - Mem = 2048; - break; - } - break; - } - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c:3.3 xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c:3.3 Fri Aug 11 13:27:12 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c Fri Jan 18 15:24:53 2002 @@ -1,101 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c,v 3.3 2000/08/11 17:27:12 dawes Exp $ */ -/* - * (c) Copyright 1997 by Dirk Hohndel - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Dirk Hohndel shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Dirk Hohndel. - * - */ - -#include "Probe.h" - -#define PCI_EN 0x80000000 - -static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 }; - -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Rendition __STDCARGS((int)); - -Chip_Descriptor Rendition_Descriptor = { - "Rendition", - Probe_Rendition, - Ports, - NUMPORTS, - FALSE, - FALSE, - FALSE, - MemProbe_Rendition, -}; - -Bool Probe_Rendition(Chipset) -int *Chipset; -{ - int chipset_passed; - int i = -1; - Bool result = FALSE; - struct pci_config_reg * pcip; - - /* - * to be able to detect multiple chips we need to set - * *Chipset to 0 first. We'll set it back to the value passed to - * us if nothing was found - */ - chipset_passed = *Chipset; - *Chipset = 0; - /* - * we only check for the Rendition in the PCI config data that we have - */ - while (pci_devp[++i] != NULL) - { - pcip = pci_devp[i]; - if (pcip->_vendor == PCI_VENDOR_RENDITION && pcrp->_status_command & 7) - { - switch (pcip->_device) - { - case PCI_CHIP_V1000: - *Chipset = CHIP_REND_V1000; - result = TRUE; - break; - case PCI_CHIP_V2000: - *Chipset = CHIP_REND_V2000; - result = TRUE; - break; - } - } - } - if (!result) - { - *Chipset = chipset_passed; - } - - return(result); -} - -static int MemProbe_Rendition(Chipset) -int Chipset; -{ - /* - * I don't know how to do that, yet - */ - return(0); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c:3.26 xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c:3.26 Fri Nov 19 09:46:51 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c Fri Jan 18 15:24:53 2002 @@ -1,611 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c,v 3.26 1999/11/19 14:46:51 hohndel Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: S3.c /main/12 1996/10/25 11:33:27 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_S3 __STDCARGS((int)); - -Chip_Descriptor S3_Descriptor = { - "S3", - Probe_S3, - Ports, - NUMPORTS, - FALSE, - FALSE, - FALSE, - MemProbe_S3, -}; - -Bool Probe_S3(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte chip, cr38, cr39, cr42, tmp, rev; - int i = 0; - struct pci_config_reg *pcrp2; - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_S3 && pcrp->_status_command & 7) - { - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - cr38 = rdinx(CRTC_IDX, 0x38); - cr39 = rdinx(CRTC_IDX, 0x39); - wrinx(CRTC_IDX, 0x38, 0x48); - wrinx(CRTC_IDX, 0x39, 0xa5); - - switch (pcrp->_device) - { - case PCI_CHIP_TRIO: -#if 1 /* can only be distinguished using port probing... */ - PCIProbed = FALSE; -#else - PCIProbed = TRUE; - *Chipset = CHIP_S3_Trio32; - *Chipset = CHIP_S3_Trio64V; - *Chipset = CHIP_S3_Trio64; -#endif - break; - case PCI_CHIP_868: - PCIProbed = TRUE; - *Chipset = CHIP_S3_868; - break; - case PCI_CHIP_928: - PCIProbed = TRUE; - *Chipset = CHIP_S3_928P; - break; - case PCI_CHIP_864_0: - case PCI_CHIP_864_1: - PCIProbed = TRUE; - *Chipset = CHIP_S3_864; - break; - case PCI_CHIP_964_0: - case PCI_CHIP_964_1: - PCIProbed = TRUE; - *Chipset = CHIP_S3_964; - break; - case PCI_CHIP_968: - PCIProbed = TRUE; - *Chipset = CHIP_S3_968; - - /* probe for 3Dlabs chip in same PCI slot for ELSA Gloria */ - cr42 = rdinx(CRTC_IDX, 0x42); - wrinx(CRTC_IDX, 0x42, cr42 | 0x08); - xf86scanpci(); - if ((pcrp2 = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp2->_vendor == PCI_VENDOR_3DLABS) { - switch (pcrp2->_device) { - case PCI_CHIP_3DLABS_300SX: - *Chipset = CHIP_S3_968_3DLABS_300SX; - break; - default: - *Chipset = CHIP_S3_968_3DLABS_UNK; - break; - } - } - } - xf86scanpci(); - - break; - case PCI_CHIP_ViRGE: - PCIProbed = TRUE; - *Chipset = CHIP_S3_ViRGE; - /* - * the ViRGE is used as VGA part for - * the GLINT - */ - S3_Descriptor.check_coproc = TRUE; - break; - case PCI_CHIP_ViRGE_DXGX: - PCIProbed = TRUE; - if (rdinx(CRTC_IDX, 0x6f) & 1) - *Chipset = CHIP_S3_ViRGE_GX; - else - *Chipset = CHIP_S3_ViRGE_DX; - break; - case PCI_CHIP_ViRGE_GX2: - PCIProbed = TRUE; - *Chipset = CHIP_S3_ViRGE_GX2; - break; - case PCI_CHIP_ViRGE_MX: - PCIProbed = TRUE; - *Chipset = CHIP_S3_ViRGE_MX; - break; - case PCI_CHIP_ViRGE_MXP: - PCIProbed = TRUE; - *Chipset = CHIP_S3_ViRGE_MXP; - break; - case PCI_CHIP_ViRGE_VX: - PCIProbed = TRUE; - *Chipset = CHIP_S3_ViRGE_VX; - break; - case PCI_CHIP_AURORA64VP: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Aurora64VP; - break; - case PCI_CHIP_TRIO64UVP: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Trio64UVP; - break; - case PCI_CHIP_TRIO64V2_DXGX: - PCIProbed = TRUE; - if (rdinx(CRTC_IDX, 0x6f) & 1) - *Chipset = CHIP_S3_Trio64V2_GX; - else - *Chipset = CHIP_S3_Trio64V2_DX; - break; - case PCI_CHIP_TRIO3D_B: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Trio3D_B; - break; - case PCI_CHIP_TRIO3D: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Trio3D; - break; - case PCI_CHIP_TRIO3D_2X: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Trio3D_2X; - break; - case PCI_CHIP_SAVAGE3D: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Savage3D; - break; - case PCI_CHIP_SAVAGE3D_M: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Savage3D_M; - break; - case PCI_CHIP_SAVAGE4: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Savage4; - break; - case PCI_CHIP_SAVAGE2000: - PCIProbed = TRUE; - *Chipset = CHIP_S3_Savage2000; - break; -#if 0 /* use port probing then... */ - default: - PCIProbed = TRUE; - Chip_data = chip; - *Chipset = CHIP_S3_UNKNOWN; - break; -#endif - } - - wrinx(CRTC_IDX, 0x39, cr39); - wrinx(CRTC_IDX, 0x38, cr38); - DisableIOPorts(NUMPORTS, Ports); - if (PCIProbed) - return(TRUE); - } - i++; - } - } - - /* Add CRTC to enabled ports */ - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - cr38 = rdinx(CRTC_IDX, 0x38); - cr39 = rdinx(CRTC_IDX, 0x39); - wrinx(CRTC_IDX, 0x38, 0x00); - if (!testinx2(CRTC_IDX, 0x35, 0x0F)) - { - wrinx(CRTC_IDX, 0x38, 0x48); - if (testinx2(CRTC_IDX, 0x35, 0x0F)) - { - result = TRUE; - wrinx(CRTC_IDX, 0x39, 0xa5); - rev = rdinx(CRTC_IDX, 0x30); - switch (rev & 0xF0) - { - case 0x80: - switch (rev & 0x0F) - { - case 0x01: - *Chipset = CHIP_S3_911; - break; - case 0x02: - *Chipset = CHIP_S3_924; - break; - default: - Chip_data = rev; - *Chipset = CHIP_S3_UNKNOWN; - break; - } - break; - case 0xA0: - tmp = rdinx(CRTC_IDX, 0x36); - switch (tmp & 0x03) - { - case 0x00: - case 0x01: - /* EISA or VLB - 805 */ - switch (rev & 0x0F) - { - case 0x00: - *Chipset = CHIP_S3_805B; - break; - case 0x01: - Chip_data = rev; - *Chipset = CHIP_S3_UNKNOWN; - break; - case 0x02: - case 0x03: - case 0x04: - *Chipset = CHIP_S3_805C; - break; - case 0x05: - *Chipset = CHIP_S3_805D; - break; - case 0x08: - *Chipset = CHIP_S3_805I; - break; - default: - /* Call >0x05 D step for now */ - *Chipset = CHIP_S3_805D; - break; - } - break; - case 0x03: - /* ISA - 801 */ - switch (rev & 0x0F) - { - case 0x00: - *Chipset = CHIP_S3_801B; - break; - case 0x01: - Chip_data = rev; - *Chipset = CHIP_S3_UNKNOWN; - break; - case 0x02: - case 0x03: - case 0x04: - *Chipset = CHIP_S3_801C; - break; - case 0x05: - *Chipset = CHIP_S3_801D; - break; - case 0x08: - *Chipset = CHIP_S3_801I; - break; - default: - /* Call >0x05 D step for now */ - *Chipset = CHIP_S3_801D; - break; - } - break; - default: - Chip_data = rev; - *Chipset = CHIP_S3_UNKNOWN; - break; - } - break; - case 0x90: - switch (rev & 0x0F) - { - case 0x00: - case 0x01: - /* - * Contradictory documentation - - * one says 0, the other says 1. - */ - *Chipset = CHIP_S3_928D; - break; - case 0x02: - case 0x03: - Chip_data = rev; - *Chipset = CHIP_S3_UNKNOWN; - break; - case 0x04: - case 0x05: - *Chipset = CHIP_S3_928E; - break; - default: - /* Call >0x05 E step for now */ - *Chipset = CHIP_S3_928E; - } - break; - case 0xB0: - /* - * Don't know anything more about this - * just yet. - */ - *Chipset = CHIP_S3_928P; - break; - case 0xC0: - *Chipset = CHIP_S3_864; - break; - case 0xD0: - *Chipset = CHIP_S3_964; - break; - case 0xE0: { - int chip_id, chip_rev; - chip_id = rdinx(CRTC_IDX, 0x2d) << 8; - chip_id |= rdinx(CRTC_IDX, 0x2e); - chip_rev = rdinx(CRTC_IDX, 0x2f); - switch (chip_id) { - case 0x8880: - *Chipset = CHIP_S3_866; - break; - case 0x8890: - *Chipset = CHIP_S3_868; - break; - case 0x8810: - *Chipset = CHIP_S3_Trio32; - break; - case PCI_CHIP_TRIO: - if ((chip_rev&0x40) == 0x40) - *Chipset = CHIP_S3_Trio64V; - else - *Chipset = CHIP_S3_Trio64; - break; - case PCI_CHIP_TRIO64V2_DXGX: - if (rdinx(CRTC_IDX, 0x6f) & 1) - *Chipset = CHIP_S3_Trio64V2_GX; - else - *Chipset = CHIP_S3_Trio64V2_DX; - break; - case PCI_CHIP_ViRGE_DXGX: - if (rdinx(CRTC_IDX, 0x6f) & 1) - *Chipset = CHIP_S3_ViRGE_GX; - else - *Chipset = CHIP_S3_ViRGE_DX; - break; - case PCI_CHIP_968: - *Chipset = CHIP_S3_968; - break; - case PCI_CHIP_AURORA64VP: - *Chipset = CHIP_S3_Aurora64VP; - break; - case PCI_CHIP_ViRGE: - *Chipset = CHIP_S3_ViRGE; - break; - case PCI_CHIP_ViRGE_VX: - *Chipset = CHIP_S3_ViRGE_VX; - break; - case PCI_CHIP_PLATO_PX: - *Chipset = CHIP_S3_PLATO_PX; - break; - case PCI_CHIP_ViRGE_GX2: - *Chipset = CHIP_S3_ViRGE_GX2; - break; - case PCI_CHIP_ViRGE_MX: - *Chipset = CHIP_S3_ViRGE_MX; - break; - case PCI_CHIP_ViRGE_MXP: - *Chipset = CHIP_S3_ViRGE_MXP; - break; - case PCI_CHIP_TRIO3D_B: - *Chipset = CHIP_S3_Trio3D_B; - break; - case PCI_CHIP_TRIO3D: - *Chipset = CHIP_S3_Trio3D; - break; - case PCI_CHIP_TRIO3D_2X: - *Chipset = CHIP_S3_Trio3D_2X; - break; - case PCI_CHIP_SAVAGE3D: - *Chipset = CHIP_S3_Savage3D; - break; - case PCI_CHIP_SAVAGE3D_M: - *Chipset = CHIP_S3_Savage3D_M; - break; - case PCI_CHIP_SAVAGE4: - *Chipset = CHIP_S3_Savage4; - break; - case PCI_CHIP_SAVAGE2000: - *Chipset = CHIP_S3_Savage2000; - break; - default: - Chip_data = rev; - Chip_data = (Chip_data << 16) | chip_id; - Chip_data = (Chip_data << 8) | chip_rev; - *Chipset = CHIP_S3_UNKNOWN; - } - break; - } - default: - Chip_data = rev; - *Chipset = CHIP_S3_UNKNOWN; - break; - } - } - } - wrinx(CRTC_IDX, 0x39, cr39); - wrinx(CRTC_IDX, 0x38, cr38); - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -static int MemProbe_S3(Chipset) -int Chipset; -{ - Byte config, old, config2; - int Mem = 0, MemOffScreen = 0; - - EnableIOPorts(NUMPORTS, Ports); - - old = rdinx(CRTC_IDX, 0x38); - wrinx(CRTC_IDX, 0x38, 0x00); - if (!testinx2(CRTC_IDX, 0x35, 0x0F)) - { - wrinx(CRTC_IDX, 0x38, 0x48); - if (testinx2(CRTC_IDX, 0x35, 0x0F)) - { - config = rdinx(CRTC_IDX, 0x36); - config2 = rdinx(CRTC_IDX, 0x37); - if ((Chipset == CHIP_S3_911) || - (Chipset == CHIP_S3_924)) - { - if ((config & 0x20) != 0) - Mem = 512; - else - Mem = 1024; - } - else if (Chipset == CHIP_S3_ViRGE) - { - switch((config & 0xE0) >> 5) - { - case 0: - Mem = 4 * 1024; - break; - case 4: - Mem = 2 * 1024; - break; - case 6: - Mem = 1 * 1024; - break; - } - } - else if (Chipset == CHIP_S3_ViRGE_GX2 || - Chipset == CHIP_S3_ViRGE_MX || - Chipset == CHIP_S3_ViRGE_MXP) - { - switch((config & 0xC0) >> 6) - { - case 1: - Mem = 4 * 1024; - break; - case 3: - Mem = 2 * 1024; - break; - } - } - else if (Chipset == CHIP_S3_Trio3D) - { - switch((config & 0xE0) >> 5) - { - case 0: - case 2: - Mem = 4 * 1024; - break; - case 4: - Mem = 2 * 1024; - break; - } - } - else if (Chipset == CHIP_S3_Trio3D_2X) - { - switch((config & 0xE0) >> 5) - { - case 0: - Mem = 8 * 1024; - break; - case 1: /* 32 bit interface -- yuck */ - case 2: - Mem = 4 * 1024; - break; - case 6: - Mem = 2 * 1024; - break; - } - } - else if (Chipset == CHIP_S3_Savage3D || Chipset == CHIP_S3_Savage3D_M) - { - int memsize[] = { 8, 4, 4, 2}; - int sel = (config & 0xC0) >> 6; - Mem = memsize[sel] * 1024; - } - else if (Chipset == CHIP_S3_Savage4) - { - int memsize[] = { 2, 4, 8, 12, 16, 32, 0, 32 }; - int sel = (config & 0xE0) >> 5; - Mem = memsize[sel] * 1024; - } - else if (Chipset == CHIP_S3_Savage2000) - { - int memsize[] = { 2, 4, 8, 12, 16, 32, 64, 32 }; - int sel = (config & 0xE0) >> 5; - Mem = memsize[sel] * 1024; - } - else if (Chipset == CHIP_S3_ViRGE_VX) - { - switch((config2 & 0x60) >> 5) - { - case 1: - MemOffScreen = 4 * 1024; - break; - case 2: - MemOffScreen = 2 * 1024; - break; - } - switch((config & 0x60) >> 5) - { - case 0: - Mem = 2 * 1024; - break; - case 1: - Mem = 4 * 1024; - break; - case 2: - Mem = 6 * 1024; - break; - case 3: - Mem = 8 * 1024; - break; - } - Mem -= MemOffScreen; - } - else - { - switch((config & 0xE0) >> 5) - { - case 0: - Mem = 4 * 1024; - break; - case 2: - Mem = 3 * 1024; - break; - case 3: - Mem = 8 * 1024; - break; - case 4: - Mem = 2 * 1024; - break; - case 5: - Mem = 6 * 1024; - break; - case 6: - Mem = 1 * 1024; - break; - } - } - } - } - wrinx(CRTC_IDX, 0x38, old); - - DisableIOPorts(NUMPORTS, Ports); - return((MemOffScreen << 16) | Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c:3.8 xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c:3.8 Sat Feb 12 15:45:15 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c Fri Jan 18 15:24:53 2002 @@ -1,196 +0,0 @@ -/* - * (c) Copyright 1996 Alan Hourihane - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * ALAN HOURIHANE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Alan Hourihane shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Alan Hourihane. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c,v 3.8 2000/02/12 20:45:15 dawes Exp $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_SiS __STDCARGS((int)); - -Chip_Descriptor SiS_Descriptor = { - "SiS", - Probe_SiS, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_SiS, -}; - -Bool Probe_SiS(Chipset) -int *Chipset; -{ - int i = 0; - - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_SIS) - { - switch (pcrp->_device) - { - case PCI_CHIP_SG86C201: - *Chipset = CHIP_SIS86C201; - break; - case PCI_CHIP_SG86C202: - *Chipset = CHIP_SIS86C202; - break; - case PCI_CHIP_SG86C205: - *Chipset = CHIP_SIS86C205; - break; - case PCI_CHIP_SG86C215: /* 86C215 */ - *Chipset = CHIP_SIS86C215; - break; - case PCI_CHIP_SIS5597: /* 5597/5598 */ - *Chipset = CHIP_SIS5597; - break; - case PCI_CHIP_SIS6326: /* 6326 */ - *Chipset = CHIP_SIS6326; - break; - case PCI_CHIP_SG86C225: - *Chipset = CHIP_SIS86C225; - break; - case PCI_CHIP_SIS530: /* 530/620 */ - *Chipset = CHIP_SIS530; - break; - case PCI_CHIP_SIS300: /* 300 */ - *Chipset = CHIP_SIS300; - break; - case PCI_CHIP_SIS630: /* 630 */ - *Chipset = CHIP_SIS630; - break; - case PCI_CHIP_SIS540: /* 540 */ - *Chipset = CHIP_SIS540; - break; - default: - *Chipset = CHIP_SIS_UNK; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - return(FALSE); -} - -static int MemProbe_SiS(Chipset) -int Chipset; -{ - int Mem = 0; - unsigned char temp; - unsigned char bsiz; - unsigned char save; - - EnableIOPorts(NUMPORTS, Ports); - - /* unlock extended registers */ - save = rdinx(SEQ_IDX,0x05); - wrinx(SEQ_IDX,0x05,0x86); - - switch (Chipset) - { - case CHIP_SIS86C201: - case CHIP_SIS86C202: - case CHIP_SIS86C205: - case CHIP_SIS86C215: - case CHIP_SIS86C225: - switch (rdinx(SEQ_IDX, 0xF) & 0x03) - { - case 0x00: - Mem = 1024; - break; - case 0x01: - Mem = 2048; - break; - case 0x02: - Mem = 4096; - break; - } - break; - case CHIP_SIS5597: - bsiz = rdinx(SEQ_IDX,0x0C); - bsiz = (bsiz >> 1) & 3; - - temp = rdinx(CRTC_IDX,0x2F); - temp &= 7; - temp++; - if (bsiz > 0) temp = temp << 1; - - Mem = 256 * temp; - break; - case CHIP_SIS6326: - case CHIP_SIS530: - temp = rdinx(SEQ_IDX, 0xC); - temp >>= 1; - switch (temp & 0x0B) - { - case 0x00: - Mem = 1024; - break; - case 0x01: - Mem = 2048; - break; - case 0x02: - Mem = 4096; - break; - case 0x03: - if(Chipset == CHIP_SIS6326) - Mem = 1024; - else - Mem = 0; - break; - case 0x08: - Mem = 0; - break; - case 0x09: - Mem = 2048; - break; - case 0x0A: - Mem = 4096; - break; - case 0x0B: - Mem = 8192; - break; - } - case CHIP_SIS300: - case CHIP_SIS630: - case CHIP_SIS540: - Mem = ((rdinx(SEQ_IDX, 0x14) & 0x3F) + 1) * 1024; - break; - } - /* lock registers again */ - wrinx(SEQ_IDX,0x05,save); - DisableIOPorts(NUMPORTS, Ports); - return(Mem); - } Index: xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c:3.3 xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c:3.3 Fri Nov 19 08:54:17 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c Fri Jan 18 15:24:53 2002 @@ -1,80 +0,0 @@ -/* - * (c) Copyright 1997 Harald Koenig - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * HARALD KOENIG BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 Harald Koenig shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Harald Koenig. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c,v 3.3 1999/11/19 13:54:17 hohndel Exp $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, }; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_SigmaDesigns __STDCARGS((int)); - -Chip_Descriptor SigmaDesigns_Descriptor = { - "SigmaDesigns", - Probe_SigmaDesigns, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - NULL, -}; - -Bool Probe_SigmaDesigns(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte chip, old, old1, val; - int i = 0; - - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_SIGMADESIGNS && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_SD_REALMAGIG64GX: - *Chipset = CHIP_SD_RM64GX; - break; - default: - Chip_data = chip; - *Chipset = CHIP_SD_RM_UNK; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - return(FALSE); -} - - Index: xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c:1.1 xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c:1.1 Tue Nov 28 15:59:16 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c Fri Jan 18 15:24:53 2002 @@ -1,142 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c,v 1.1 2000/11/28 20:59:16 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * (c) Copyright 2000 by Silicon Motion - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_SiliconMotion __STDCARGS((int)); - -Chip_Descriptor SiliconMotion_Descriptor = { - "Silicon Motion", - Probe_SiliconMotion, - Ports, - NUMPORTS, - FALSE, - FALSE, - FALSE, - MemProbe_SiliconMotion, -}; - -Bool Probe_SiliconMotion(Chipset) -int *Chipset; -{ - int i = 0; - - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) - { - if (pcrp->_vendor == PCI_VENDOR_SMI && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_SMI_910: - *Chipset = CHIP_SMI_910; - PCIProbed = TRUE; - break; - - case PCI_CHIP_SMI_810: - *Chipset = CHIP_SMI_810; - PCIProbed = TRUE; - break; - - case PCI_CHIP_SMI_820: - *Chipset = CHIP_SMI_820; - PCIProbed = TRUE; - break; - - case PCI_CHIP_SMI_710: - *Chipset = CHIP_SMI_710; - PCIProbed = TRUE; - break; - - case PCI_CHIP_SMI_712: - *Chipset = CHIP_SMI_712; - PCIProbed = TRUE; - break; - - case PCI_CHIP_SMI_720: - *Chipset = CHIP_SMI_720; - PCIProbed = TRUE; - break; - } - - if (PCIProbed) - { - return(TRUE); - } - } - i++; - } - } - - return(FALSE); -} - -static int MemProbe_SiliconMotion(Chipset) -int Chipset; -{ - Byte config; - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - config = rdinx(SEQ_IDX, 0x71); - switch (Chipset) - { - case CHIP_SMI_910: - case CHIP_SMI_810: - case CHIP_SMI_710: - case CHIP_SMI_712: - { - int memsize[] = { 1, 2, 4, 0 }; - Mem = memsize[config >> 6] * 1024; - break; - } - - case CHIP_SMI_820: - { - int memsize[] = { 0, 2, 4, 6 }; - Mem = memsize[config >> 6] * 1024 + 512; - break; - } - - case CHIP_SMI_720: - { - int memsize[] = { 16, 2, 4, 8 }; - Mem = memsize[config >> 6] * 1024; - break; - } - } - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s:3.3 xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s:3.3 Mon Dec 23 01:31:37 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s Fri Jan 18 15:24:53 2002 @@ -1,104 +0,0 @@ -/ -/ File: SolX86IO.s -/ -/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions -/ for Solaris x86 using the ProWorks compiler by SunPro -/ -/ Author: Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com) -/ Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com) -/ -/ Synopsis: (c callable external declarations) -/ extern unsigned char inb(int port); -/ extern unsigned short inw(int port); -/ extern unsigned long inl(int port); -/ extern void outb(int port, unsigned char value); -/ extern void outw(int port, unsigned short value); -/ extern void outl(int port, unsigned long value); -/ -/ $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s,v 3.3 1996/12/23 06:31:37 dawes Exp $ -/ -/ -/ -/ -/ $XConsortium: SolX86IO.s /main/5 1996/02/21 17:12:33 kaleb $ - -.file "SolX86IO.s" -.text - -.globl inb -.globl inw -.globl inl -.globl outb -.globl outw -.globl outl - -/ -/ unsigned char inb(int port); -/ -.align 4 -inb: - movl 4(%esp),%edx - subl %eax,%eax - inb (%dx) - ret -.type inb,@function -.size inb,.-inb - -/ -/ unsigned short inw(int port); -/ -.align 4 -inw: - movl 4(%esp),%edx - subl %eax,%eax - inw (%dx) - ret -.type inw,@function -.size inw,.-inw - -/ -/ unsigned long inl(int port); -/ -.align 4 -inl: - movl 4(%esp),%edx - inl (%dx) - ret -.type inl,@function -.size inl,.-inl - -/ -/ void outb(int port, unsigned char value); -/ -.align 4 -outb: - movl 4(%esp),%edx - movl 8(%esp),%eax - outb (%dx) - ret -.type outb,@function -.size outb,.-outb - -/ -/ void outw(int port, unsigned short value); -/ -.align 4 -outw: - movl 4(%esp),%edx - movl 8(%esp),%eax - outw (%dx) - ret -.type outw,@function -.size outw,.-outw - -/ -/ void outl(int port, unsigned long value); -/ -.align 4 -outl: - movl 4(%esp),%edx - movl 8(%esp),%eax - outl (%dx) - ret -.type outl,@function -.size outl,.-outl Index: xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man:3.10 xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man:3.10 Sat Jan 27 13:20:44 2001 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man Fri Jan 18 15:24:53 2002 @@ -1,207 +0,0 @@ -.\" $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 -.B SuperProbe -[-verbose] [-no16] [-excl \fIlist\fP] [-mask10] -.if n .br - [-order \fIlist\fP] [-noprobe \fIlist\fP] [-bios \fIbase\fP] -.br - [-no_bios] [-no_dac] [-no_mem] [-info] -.SH DESCRIPTION -.PP -.I SuperProbe -is a a program that will attempt to determine the type of video hardware -installed in an EISA/ISA/VLB-bus system by checking for known registers -in various combinations at various locations (MicroChannel and PCI machines -may not be fully supported; many work with the use of the -.B -no_bios -option). This is an error-prone process, especially on Unix (which -usually has a lot more esoteric hardware installed than MS-DOS system do), so -SuperProbe may likely need help from the user. -.PP -.I SuperProbe -runs on SVR3, SVR4, Linux, 386BSD/FreeBSD/NetBSD, Minix-386, and Mach. It -should be trivial to extend it to work on any other Unix-like operating -system, and even non-Unix operating systems. All of the OS dependencies -are isolated to a single file for each OS. -.PP -At this time, -.I SuperProbe -can identify MDA, Hercules, CGA, MCGA, EGA, VGA, and an entire horde of -SVGA chipsets (see the -.I -info -option, below). It can also identify several HiColor/True-color RAMDACs -in use on SVGA boards, and the amount of video memory installed (for many -chipsets). It can identify 8514/A and some derivatives, but -not XGA, or PGC (although the author intends to add those capabilities). -Nor can it identify other esoteric video hardware (like Targa, TIGA, or -Microfield boards). -.SH OPTIONS -.TP 8 -.B "-verbose" -.I SuperProbe -will be verbose and provide lots of information as it does its work. -.TP 8 -.B "-no16" -.I SuperProbe -will not attempt to use any ports that require 16-bit I/O address decoding. -The original ISA bus only specified that I/O ports be decoded to 10 bits. -Therefore some old cards (including many 8-bit cards) will mis-decode -references to ports that use the upper 6 bits, and may get into funny states -because they think that they are being addressed when they are not. -It is recommended that this option be used initially if any 8-bit cards -are present in the system. -.TP 8 -.BI "-excl" "\ list" -.I SuperProbe -will not attempt to access any I/O ports on the specified exclusion list. -Some video cards use rather non-standard I/O ports that may conflict with -other cards installed in your system. By specifying to -.I SuperProbe -a list of ports already in use, it will know that there cannot be any video -cards that use those ports, and hence will not probe them (which could -otherwise confuse your hardware). The exclusion list is specified as -a comma-separated list of I/O ports or port ranges. A range is specified -as "low-high", and is inclusive. The ports can be specified in decimal, -in octal (numbers begin with '0'), or hexadecimal (numbers begin with '0x'). -.TP 8 -.B "-mask10" -This option is used in combination with -.I -excl. -It tells -.I SuperProbe -that when comparing an I/O port under test against the exclusion list, the -port address should be masked to 10 bits. This is important with older -8-bit cards that only do 10 bit decoding, and for some cheap 16-bit cards -as well. This option is simply a less-drastic form of the -.I -no16 -option. -.TP 8 -.BI "-order" "\ list" -This option specifies which chipsets -.I SuperProbe -should test, and in which order. The -.I list -parameter is a comma-separated list of chipset names. This list overrides -the built-in default testing order. To find the list of acceptable names, -use the -.I -info -option described below. Note that items displayed as "Standard video -hardware" are not usable with the -.I -order -option. -.TP 8 -.BI "-noprobe" "\ list" -This options specifies which chipsets -.I SuperProbe -should -.B not -test. The order of testing will either be the default order, or that -specified with the -.I -order -option described above. The -.I list -parameter is a comma-separated list of chipset names. To find the list -of acceptable names, use the -.I -info -option described below. Note that items displayed as "Standard video -hardware" are not usable with the -.I -noprobe -option. -.TP 8 -.BI "-bios" "\ base" -This option specifies the base address for the graphics-hardware BIOS. -By default, -.I SuperProbe -will attempt to locate the BIOS base on its own (the normal address is -0xC0000). If it fails to correctly locate the BIOS (an error message will -be printed if this occurs), the -.I -bios -option can be used to specify the base. -.TP 8 -.B "-no_bios" -Disallow reading of the video BIOS and assume that an EGA or later -(VGA, SVGA) board is present as the primary video hardware. -.TP 8 -.B "-no_dac" -Skip probing for the RAMDAC type when an (S)VGA is identified. -.TP 8 -.B "-no_mem" -Skip probing for the amount of installed video memory. -.TP 8 -.B "-info" -.I SuperProbe -will print out a listing of all the video hardware that it knows how to -identify. -.SH EXAMPLES -.PP -To run -.I SuperProbe -in its most basic and automated form, simply enter: -.sp -.ce -.B SuperProbe -.PP -Note - you may want to redirect -.I stdout -to a file when you run -.I SuperProbe -(especially if your OS does not support Virtual Terminals on the console). -.PP -However, if you have any 8-bit cards installed, you should initially run -.I SuperProbe -as: -.sp -.ce -.B SuperProbe -verbose -no16 -.PP -(the -.I -verbose -option is included so you can see what -.I SuperProbe -is skipping). -.PP -Finer granularity can be obtained with an exclusion list, for example: -.sp -.ce -.B SuperProbe -verbose -excl 0x200,0x220-0x230,0x250 -.PP -which will not test for any device that use port 0x200, ports 0x220 through -0x230, inclusive, or port 0x250. If you have any 8-bit cards installed, -you should add -.I -mask10 -to the list of options. -.PP -To restrict the search to Western Digital, Tseng, and Cirrus chipset, -run -.I SuperProbe -as follows: -.sp -.ce -.B SuperProbe -order WD,Tseng,Cirrus -.SH BUGS -.PP -Probably a lot at this point. Please report any bugs or incorrect -identifications to the author. -.PP -\fBIt is possible that SuperProbe can lock up your machine. Be sure to -narrow the search by using the \fI-no16\fB, \fI-excl\fB, and \fI-mask10\fB -options provided to keep SuperProbe from conflicting with other installed -hardware.\fR -.SH SEE ALSO -.PP -The -.I vgadoc3.zip -documentation package by Finn Thoegersen, available in the MS-DOS archives -of many FTP repositories. -.PP -\fIProgrammer's Guide to the EGA and VGA Cards, 2nd Ed\fP, by Richard -Ferraro. -.SH AUTHOR -David E. Wexelblat -.br -with help from David Dawes and the XFree86 -development team. -.\" $TOG: SuperProbe.man /main/7 1997/07/19 09:20:52 kaleb $ Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c:3.16 xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c:3.16 Fri Nov 19 08:54:17 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c Fri Jan 18 15:24:53 2002 @@ -1,345 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c,v 3.16 1999/11/19 13:54:17 hohndel Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Trident.c /main/7 1996/10/24 07:10:11 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Trident __STDCARGS((int)); - -Chip_Descriptor Trident_Descriptor = { - "Trident", - Probe_Trident, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_Trident, -}; - -Bool Probe_Trident(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte chip, old, old1, val; - unsigned char temp; - int i = 0; - - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_TRIDENT && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_9320: - *Chipset = CHIP_TVGA9320; - break; - case PCI_CHIP_9420: - *Chipset = CHIP_TVGA9420; - break; - case PCI_CHIP_9440: - *Chipset = CHIP_TVGA9440; - break; - case PCI_CHIP_9660: - outp(0x3C4, 0x09); - temp = inp(0x3C5); - switch (temp) { - case 0x00: - *Chipset = CHIP_TVGA9660; - break; - case 0x01: - *Chipset = CHIP_TVGA9680; - break; - case 0x10: - *Chipset = CHIP_TVGA9682; - break; - case 0x21: - *Chipset = CHIP_TVGA9685; - break; - case 0x22: - case 0x23: - *Chipset = CHIP_TVGA9397; - break; -/* Bill Mair */ - case 0xF3: - *Chipset = CHIP_TVGA939A; - break; - - case 0x30: - case 0x33: - case 0x34: - case 0x35: - case 0xB3: - *Chipset = CHIP_TVGA9385; - break; - case 0x38: - case 0x3A: - *Chipset = CHIP_TVGA9385_1; - break; - case 0x4A: - *Chipset = CHIP_TVGA9388_1; - break; - case 0x40: - case 0x41: /* Guessing */ - case 0x42: /* Guessing */ - case 0x43: - *Chipset = CHIP_TVGA9382; - break; - case 0x50: - *Chipset = CHIP_TVGA9692; - break; - default: - Chip_data = temp; - *Chipset = CHIP_TVGA_UNK; - break; - } - break; - case PCI_CHIP_9680: - *Chipset = CHIP_TVGA9680; - break; - case PCI_CHIP_9682: - *Chipset = CHIP_TVGA9682; - break; - case PCI_CHIP_9388: - *Chipset = CHIP_TVGA9388; - break; - case PCI_CHIP_9397: - *Chipset = CHIP_TVGA9397; - break; -/*Bill Mair*/ - case PCI_CHIP_939A: - *Chipset = CHIP_TVGA939A; - break; - - case PCI_CHIP_9520: - *Chipset = CHIP_TVGA9520; - break; - case PCI_CHIP_9750: - *Chipset = CHIP_TVGA9750; - break; - case PCI_CHIP_9850: - *Chipset = CHIP_TVGA9850; - break; - default: - Chip_data = pcrp->_device_vendor; - *Chipset = CHIP_TVGA_UNK; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - - old = rdinx(SEQ_IDX, 0x0B); - wrinx(SEQ_IDX, 0x0B, 0x00); - chip = inp(SEQ_REG); - old1 = rdinx(SEQ_IDX, 0x0E); - outp(SEQ_REG, 0); - val = inp(SEQ_REG); - outp(SEQ_REG, (old1 ^ 0x02)); - wrinx(SEQ_IDX, 0x0B, old); - wrinx(SEQ_IDX, 0x0E, old1); - if ((val & 0x0F) == 2) - { - result = TRUE; - switch (chip) - { - case 0x01: /* Can't happen - no "new mode" */ - *Chipset = CHIP_TVGA8800BR; - break; - case 0x02: - *Chipset = CHIP_TVGA8800CS; - break; - case 0x03: - *Chipset = CHIP_TVGA8900B; - break; - case 0x04: - case 0x13: - *Chipset = CHIP_TVGA8900C; - break; - case 0x23: - *Chipset = CHIP_TVGA9000; - break; - case 0x33: - *Chipset = CHIP_TVGA8900CL; - break; - case 0x43: - *Chipset = CHIP_TVGA9000I; - break; - case 0x53: - *Chipset = CHIP_TVGA9200CX; - break; - case 0x63: - *Chipset = CHIP_TVGA9100B; - break; - case 0x73: - case 0xF3: - *Chipset = CHIP_TVGA9420; - break; - case 0x83: - *Chipset = CHIP_TVGA8200; - break; - case 0x93: - *Chipset = CHIP_TVGA9400CX; - break; - case 0xA3: - *Chipset = CHIP_TVGA9320; - break; - case 0xC3: - *Chipset = CHIP_TVGA9420D; - break; - case 0xD3: - outp(0x3C4, 0x09); - temp = inp(0x3C5); - switch (temp) { - case 0x00: - *Chipset = CHIP_TVGA9660; - break; - case 0x01: - *Chipset = CHIP_TVGA9680; - break; - case 0x10: - *Chipset = CHIP_TVGA9682; - break; - case 0x21: - *Chipset = CHIP_TVGA9685; - break; - case 0x22: - case 0x23: - *Chipset = CHIP_TVGA9397; - break; -/*Bill Mair*/ - case 0xF3: - *Chipset = CHIP_TVGA939A; - break; - - case 0x30: - case 0x33: - case 0x34: - case 0x35: - case 0xB3: - *Chipset = CHIP_TVGA9385; - break; - case 0x38: - case 0x3A: - *Chipset = CHIP_TVGA9385_1; - break; - case 0x4A: - *Chipset = CHIP_TVGA9388_1; - break; - case 0x40: - case 0x41: /* Guessing */ - case 0x42: /* Guessing */ - case 0x43: - *Chipset = CHIP_TVGA9382; - break; - case 0x50: - *Chipset = CHIP_TVGA9692; - break; - default: - Chip_data = chip*256+temp; - *Chipset = CHIP_TVGA_UNK; - break; - } - break; - case 0xE3: - *Chipset = CHIP_TVGA9440; - break; - default: - Chip_data = chip; - *Chipset = CHIP_TVGA_UNK; - break; - } - } - else if ((chip == 1) && (testinx2(SEQ_IDX, 0x0E, 0x06))) - { - result = TRUE; - *Chipset = CHIP_TVGA8800BR; - } - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -static int MemProbe_Trident(Chipset) -int Chipset; -{ - int Mem = 0; - unsigned char temp; - - EnableIOPorts(NUMPORTS, Ports); - temp = rdinx(CRTC_IDX, 0x1F); - - switch (temp & 0x07) - { - case 0: - case 4: -/* Bill Mair */ - if (Chipset == CHIP_TVGA939A ) - Mem = 8192; - else - Mem = 256; - break; - case 1: - case 5: /* New TGUI's don't support less than 1MB */ - if (Chipset >= CHIP_TVGA9660) - Mem = 4096; - else - Mem = 512; - break; - case 2: - case 6: - Mem = 768; - break; - case 3: - Mem = 1024; - break; - case 7: - - if (((temp & 0x0F)==0x0F) && (Chipset >= CHIP_TVGA9685)) - /* This is for the 9685 */ - Mem = 4096; - else - Mem = 2048; - break; - } - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c:3.10 xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c:3.10 Fri Nov 19 08:54:17 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c Fri Jan 18 15:24:53 2002 @@ -1,388 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c,v 3.10 1999/11/19 13:54:17 hohndel Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Tseng.c /main/7 1996/10/19 17:48:18 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, 0x000, 0x000, 0x000, - 0x3BF, 0x3CB, 0x3CD, - ATR_IDX, ATR_REG_R, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_Tseng __STDCARGS((int)); -static Long ET6Kbase = 0; - -Chip_Descriptor Tseng_Descriptor = { - "Tseng", - Probe_Tseng, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_Tseng, -}; - -Bool Probe_Tseng(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old, old1, ver; - int i=0; - - /* Add CRTC to enabled ports */ - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - Ports[2] = inp(MISC_OUT_R) & 0x01 ? 0x3D8 : 0x3B8; - - /* check PCI config first */ - if (!NoPCI) - { - while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) { - if (pcrp->_vendor == PCI_VENDOR_TSENG && pcrp->_status_command & 7) - { - switch (pcrp->_device) - { - case PCI_CHIP_ET6000: - if (pcrp->_rev_id >= 0x70) - *Chipset = CHIP_ET6K1; - else - *Chipset = CHIP_ET6K; - ET6Kbase = pcrp->_base1 & ~0xFF; - break; - case PCI_CHIP_ET6300: - *Chipset = CHIP_ET6K3; - ET6Kbase = pcrp->_base1 & ~0xFF; - break; - case PCI_CHIP_ET4000_W32P_A: - *Chipset = CHIP_ET4KW32P_A; - break; - case PCI_CHIP_ET4000_W32P_B: - *Chipset = CHIP_ET4KW32P_B; - break; - case PCI_CHIP_ET4000_W32P_C: - *Chipset = CHIP_ET4KW32P_C; - break; - case PCI_CHIP_ET4000_W32P_D: - *Chipset = CHIP_ET4KW32P_D; - break; - default: - Chip_data = pcrp->_device; - *Chipset = CHIP_TSENG_UNK; - break; - } - PCIProbed = TRUE; - return(TRUE); - } - i++; - } - } - - EnableIOPorts(NUMPORTS, Ports); - - old = inp(0x3BF); - old1 = inp(Ports[2]); - outp(0x3BF, 0x03); - outp(Ports[2], 0xA0); - if (tstrg(0x3CD, 0x3F)) - { - result = TRUE; - if (testinx2(CRTC_IDX, 0x33, 0x0F)) - { - if (tstrg(0x3CB, 0x33)) - { - ver = rdinx(0x217A, 0xEC); - switch (ver >> 4) - { - case 0x00: - *Chipset = CHIP_ET4000W32; - break; - case 0x01: - *Chipset = CHIP_ET4000W32I; - break; - case 0x02: - *Chipset = CHIP_ET4KW32P_A; - break; - case 0x03: - *Chipset = CHIP_ET4KW32I_B; - break; - case 0x05: - *Chipset = CHIP_ET4KW32P_B; - break; - case 0x06: - *Chipset = CHIP_ET4KW32P_D; - break; - case 0x07: - *Chipset = CHIP_ET4KW32P_C; - break; - case 0x0B: - *Chipset = CHIP_ET4KW32I_C; - break; - default: - Chip_data = ver >> 4; - *Chipset = CHIP_TSENG_UNK; - break; - } - } - else - { - *Chipset = CHIP_ET4000; - } - } - else - { - *Chipset = CHIP_ET3000; - } - } - outp(Ports[2], old1); - outp(0x3BF, old); - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - - -/* - * The 8*32kb ET6000 MDRAM granularity causes the more general probe to - * detect too much memory in some configurations, because that code has a - * 8-bank (=256k) granularity. E.g. it fails to recognize 2.25 MB of memory - * (detects 2.5 instead). This function goes to check if the RAM is actually - * there. MDRAM comes in multiples of 4 banks (16, 24, 32, 36, 40, 64, 72, - * 80, ...), so checking each 64k block should be enough granularity. - * - * The exact same code could be used on other Tseng chips, or even on ANY - * VGA board, but probably only in case of trouble. - * - */ -#define VIDMEM ((volatile unsigned int*)check_vgabase) -#define SEGSIZE 64 /* 64 kb */ - -/* vgaSetVidPage() doesn't seem to work -- dunno why */ -static void Tseng_set_segment(int seg) -{ - int seg1, seg2; - seg1 = seg & 0x0F; - seg2 = (seg & 0x30) >> 4; - outp(0x3CB, seg2 | (seg2 << 4)); - outp(0x3CD, seg1 | (seg1 << 4)); -} - -static int et6000_check_videoram(int ram) -{ - unsigned char oldSegSel1, oldSegSel2, oldGR5, oldGR6, oldSEQ2, oldSEQ4; - int segment, i; - int real_ram; - Byte * check_vgabase; - Bool fooled = FALSE; - int save_vidmem; - - if (ram > 4096) { - printf("ET6000: Detected more than 4MB of video RAM.\n"); - printf(" Although some cards are sold with more than 4MB,\n"); - printf(" the ET6000 can only use 4MB maximum.\n"); - ram = 4096; - } - - check_vgabase = MapVGA(); - - /* - * We need to set the VGA controller in VGA graphics mode, or else we won't - * be able to access the full 4MB memory range. First, we save the - * registers we modify, of course. - */ - oldSegSel1 = inp(0x3CD); - oldSegSel2 = inp(0x3CB); - oldGR5 = rdinx(GRC_IDX, 5); - oldGR6 = rdinx(GRC_IDX, 6); - oldSEQ2 = rdinx(SEQ_IDX, 2); - oldSEQ4 = rdinx(SEQ_IDX, 4); - - /* set graphics mode */ - wrinx(GRC_IDX, 5, 5); - wrinx(GRC_IDX, 6, 0x40); - wrinx(SEQ_IDX, 2, 0x0f); - wrinx(SEQ_IDX, 4, 0x0e); - - /* - * count down from presumed amount of memory in SEGSIZE steps, and - * look at each segment for real RAM. - */ - - for (segment = (ram / SEGSIZE) - 1; segment >= 0; segment--) - { - Tseng_set_segment(segment); - - /* save contents of memory probing location */ - save_vidmem = *(VIDMEM); - - /* test with pattern */ - *VIDMEM = 0xAAAA5555; - if (*VIDMEM != 0xAAAA5555) { - *VIDMEM = save_vidmem; - continue; - } - - /* test with inverted pattern */ - *VIDMEM = 0x5555AAAA; - if (*VIDMEM != 0x5555AAAA) { - *VIDMEM = save_vidmem; - continue; - } - - /* check if we aren't fooled by address wrapping (mirroring) */ - fooled = FALSE; - for (i = segment-1; i >=0; i--) { - Tseng_set_segment(i); - if (*VIDMEM == 0x5555AAAA) { - fooled = TRUE; - break; - } - } - if (!fooled) { - real_ram = (segment+1) * SEGSIZE; - break; - } - /* restore old contents again */ - *VIDMEM = save_vidmem; - } - - /* restore original register contents */ - outp(0x3CD, oldSegSel1); - outp(0x3CB, oldSegSel2); - wrinx(GRC_IDX, 5, oldGR5); - wrinx(GRC_IDX, 6, oldGR6); - wrinx(SEQ_IDX, 2, oldSEQ2); - wrinx(SEQ_IDX, 4, oldSEQ4); - - UnMapVGA(check_vgabase); - - return real_ram; -} - -static int MemProbe_Tseng(Chipset) -int Chipset; -{ - Byte Save[2]; - int Mem = 0; - - if (PCIProbed) - { - Ports[3] = ET6Kbase + 0x45; - Ports[4] = ET6Kbase + 0x47; - } - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock - */ - Save[0] = inp(0x3BF); - Save[1] = inp(vgaIOBase + 8); - outp(0x3BF, 0x03); - outp(vgaIOBase + 8, 0xA0); - - /* - * Check - */ - switch (Chipset) - { - case CHIP_ET3000: - Mem = 512; - break; - case CHIP_ET4000: - switch (rdinx(CRTC_IDX, 0x37) & 0x0B) - { - case 0x03: - case 0x05: - Mem = 256; - break; - case 0x0A: - Mem = 512; - break; - case 0x0B: - Mem = 1024; - break; - } - break; - case CHIP_ET4000W32: - case CHIP_ET4000W32I: - case CHIP_ET4KW32P_A: - case CHIP_ET4KW32I_B: - case CHIP_ET4KW32I_C: - case CHIP_ET4KW32P_B: - case CHIP_ET4KW32P_C: - case CHIP_ET4KW32P_D: - switch (rdinx(CRTC_IDX, 0x37) & 0x09) - { - case 0x00: - Mem = 2048; - break; - case 0x01: - Mem = 4096; - break; - case 0x08: - Mem = 512; - break; - case 0x09: - Mem = 1024; - if ((Chipset != CHIP_ET4000W32) && - (rdinx(CRTC_IDX, 0x32) & 0x80)) - Mem = 2048; - break; - } - break; - case CHIP_ET6K: - case CHIP_ET6K1: - case CHIP_ET6K3: - switch (rdinx(CRTC_IDX, 0x34) & 0x80) - { - case 0x00: /* MDRAM */ - Mem = ((inp(ET6Kbase+0x47) & 0x07) + 1) * 8*32; /* number of 8 32kb banks */ - if (inp(ET6Kbase+0x45) & 0x04) - { - Mem <<= 1; - } - /* 8*32kb MDRAM refresh control granularity in the ET6000 fails to */ - /* recognize 2.25 MB of memory (detects 2.5 instead) */ - Mem = et6000_check_videoram(Mem); - break; - case 0x80: /* DRAM */ - Mem = 1024 << (inp(ET6Kbase+0x45) & 0x03); - break; - } - } - - /* - * Lock - */ - outp(vgaIOBase + 8, Save[1]); - outp(0x3BF, Save[0]); - DisableIOPorts(NUMPORTS, Ports); - - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c:3.4 Mon Dec 23 01:31:41 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c Fri Jan 18 15:24:53 2002 @@ -1,113 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c,v 3.4 1996/12/23 06:31:41 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: UMC.c /main/5 1996/02/21 17:12:56 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x3BF, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_UMC __STDCARGS((int)); - -Chip_Descriptor UMC_Descriptor = { - "UMC", - Probe_UMC, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_UMC, -}; - -Bool Probe_UMC(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old; - - EnableIOPorts(NUMPORTS, Ports); - - old = inp(0x3BF); - outp(0x3BF, 0x03); - if (!testinx(SEQ_IDX, 0x06)) - { - outp(0x3BF, 0xAC); - if (testinx(SEQ_IDX, 0x06)) - { - result = TRUE; - *Chipset = CHIP_UMC_408; - } - } - outp(0x3BF, old); - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -/* ARGSUSED */ -static int MemProbe_UMC(Chipset) -int Chipset; -{ - Byte old; - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock - */ - old = inp(0x3BF); - outp(0x3BF, 0xAC); - - /* - * Check - */ - switch(rdinx(SEQ_IDX, 0x07) >> 6) - { - case 0x00: - Mem = 256; - break; - case 0x01: - Mem = 512; - break; - case 0x02: - case 0x03: - Mem = 1024; - break; - } - - /* - * Lock - */ - outp(0x3BF, old); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c:3.7 xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c:3.7 Tue Sep 19 08:46:12 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c Fri Jan 18 15:24:53 2002 @@ -1,555 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c,v 3.7 2000/09/19 12:46:12 eich Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Utils.c /main/7 1996/02/21 17:13:00 kaleb $ */ - -#include "Probe.h" -#include "AsmMacros.h" - -/* - * Return the byte value of register 'port' - */ -#ifdef __STDC__ -Byte inp(Word port) -#else -Byte inp(port) -Word port; -#endif -{ - return(inb(port)); -} - -/* - * Return the word value of register 'port' - */ -#ifdef __STDC__ -Word inpw(Word port) -#else -Word inpw(port) -Word port; -#endif -{ - return(inw(port)); -} - -/* - * Return the long value of register 'port' - */ -#ifdef __STDC__ -Long inpl(Word port) -#else -Long inpl(port) -Word port; -#endif -{ - return(inl(port)); -} - -/* - * Set the byte register 'port' to 'val' - */ -#ifdef __STDC__ -void outp(Word port, Byte val) -#else -void outp(port, val) -Word port; -Byte val; -#endif -{ - outb(port, val); -} - -/* - * Set the word register 'port' to 'val' - */ -#ifdef __STDC__ -void outpw(Word port, Word val) -#else -void outpw(port, val) -Word port, val; -#endif -{ - outw(port, val); -} - -/* - * Set the long register 'port' to 'val' - */ -#ifdef __STDC__ -void outpl(Word port, Long val) -#else -void outpl(port, val) -Word port; -Long val; -#endif -{ - outl(port, val); -} - -/* - * Read byte register at 'port', index 'index' - */ -#ifdef __STDC__ -Byte rdinx(Word port, Byte index) -#else -Byte rdinx(port, index) -Word port; -Byte index; -#endif -{ - Byte tmp; - Word Port[2] = {MISC_OUT_R, 0x000}; - - if (port == ATR_IDX) - { - EnableIOPorts(1, Port); - Port[1] = (inp(MISC_OUT_R) & 0x01) ? 0x3DA : 0x3BA; - EnableIOPorts(2, Port); - tmp = inp(Port[1]); /* Reset Attribute Reg flip-flop */ - DisableIOPorts(2, Port); - } - outb(port, index); - return(inb(port+1)); -} - -/* - * Set the byte register 'port', index 'index' to 'val' - */ -#ifdef __STDC__ -void wrinx(Word port, Byte index, Byte val) -#else -void wrinx(port, index, val) -Word port; -Byte index; -Byte val; -#endif -{ - Byte tmp; - Word Port[2] = {MISC_OUT_R, 0x000}; - - if (port == ATR_REG_W) - { - EnableIOPorts(1, Port); - Port[1] = (inp(MISC_OUT_R) & 0x01) ? 0x3DA : 0x3BA; - EnableIOPorts(2, Port); - tmp = inp(Port[1]); - DisableIOPorts(2, Port); - outp(port, index); - outp(port, val); - } - else - { - outb(port, index); - outb(port+1, val); - } -} - -/* - * Set the word register 'port', index 'index' to 'val' - */ -#ifdef __STDC__ -void wrinx2(Word port, Byte index, Word val) -#else -void wrinx2(port, index, val) -Word port; -Byte index; -Word val; -#endif -{ - wrinx(port, index, (val) & 0xFF); - wrinx(port, index+1, (val >> 8) & 0xFF); -} - -/* - * Set the longword register 'port', index 'index' to 'val' (3 bytes, actually) - */ -#ifdef __STDC__ -void wrinx3(Word port, Byte index, Long val) -#else -void wrinx3(port, index, val) -Word port; -Byte index; -Long val; -#endif -{ - wrinx(port, index, (val) & 0xFF); - wrinx(port, index+1, (val >> 8) & 0xFF); - wrinx(port, index+2, (val >> 16) & 0xFF); -} - -/* - * Set the word register 'port', index 'index' to 'val' (Motorola (big-endian) - * byte order) - */ -#ifdef __STDC__ -void wrinx2m(Word port, Byte index, Word val) -#else -void wrinx2m(port, index, val) -Word port; -Byte index; -Word val; -#endif -{ - wrinx(port, index, (val >> 8) & 0xFF); - wrinx(port, index+1, (val) & 0xFF); -} - -/* - * Set the longword register 'port', index 'index' to 'val' (3 bytes, actually) - * (Motorola (big-endian) byte order) - */ -#ifdef __STDC__ -void wrinx3m(Word port, Byte index, Long val) -#else -void wrinx3m(port, index, val) -Word port; -Byte index; -Long val; -#endif -{ - wrinx(port, index, (val >> 16) & 0xFF); - wrinx(port, index+1, (val >> 8) & 0xFF); - wrinx(port, index+2, (val) & 0xFF); -} - -/* - * In byte register 'port', index 'index', set the bit that are 1 in 'mask' - * to the value of the corresponding bits in 'mask' - */ -#ifdef __STDC__ -void modinx(Word port, Byte index, Byte mask, Byte newval) -#else -void modinx(port, index, mask, newval) -Word port; -Byte index; -Byte mask; -Byte newval; -#endif -{ - Byte tmp; - - tmp = (rdinx(port, index) & ~mask) | (newval & mask); - wrinx(port, index, tmp); -} - -/* - * In register 'port' sets the bits in 'mask' as in 'nvw'. Other bits are - * left unchanged. - */ -#ifdef __STDC__ -void modreg(Word port, Byte mask, Byte nvw) -#else -void modreg(port, mask, nvw) -Word port; -Byte mask; -Byte nvw; -#endif -{ - Byte tmp; - - tmp = (inp(port) & (~mask)) | (nvw & mask); - outp(port, tmp); -} - -/* - * Sets the bits in register 'port', index 'index' that are also set in 'val' - */ -#ifdef __STDC__ -void setinx(Word port, Byte index, Byte val) -#else -void setinx(port, index, val) -Word port; -Byte index; -Byte val; -#endif -{ - Byte tmp; - - tmp = rdinx(port, index); - wrinx(port, index, tmp | val); -} - -/* - * Clears the bits in register 'port', index 'index' that are set in 'val' - */ -#ifdef __STDC__ -void clrinx(Word port, Byte index, Byte val) -#else -void clrinx(port, index, val) -Word port; -Byte index; -Byte val; -#endif -{ - Byte tmp; - - tmp = rdinx(port, index); - wrinx(port, index, tmp & ~val); -} -/* - * Return TRUE iff the bits in 'mask' of register 'port' are read/write. - */ -#ifdef __STDC__ -Bool tstrg(Word port, Byte mask) -#else -Bool tstrg(port, mask) -Word port; -Byte mask; -#endif -{ - Byte old, new1, new2; - - old = inp(port); - outp(port, (old & ~mask)); - new1 = inp(port) & mask; - outp(port, (old | mask)); - new2 = inp(port) & mask; - outp(port, old); - return((new1==0) && (new2==mask)); -} - -/* - * Returns true iff the bits in 'mask' of register 'port', index 'index' - * are read/write. - */ -#ifdef __STDC__ -Bool testinx2(Word port, Byte index, Byte mask) -#else -Bool testinx2(port, index, mask) -Word port; -Byte index; -Byte mask; -#endif -{ - Byte old, new1, new2; - - old = rdinx(port, index); - wrinx(port, index, (old & ~mask)); - new1 = rdinx(port, index) & mask; - wrinx(port, index, (old | mask)); - new2 = rdinx(port, index) & mask; - wrinx(port, index, old); - return((new1==0) && (new2==mask)); -} - -/* - * Returns true iff all bits of register 'port', index 'index' are read/write - */ -#ifdef __STDC__ -Bool testinx(Word port, Byte index) -#else -Bool testinx(port, index) -Word port; -Byte index; -#endif -{ - return(testinx2(port, index, 0xFF)); -} - -/* - * Force DAC back to PEL mode - */ -void dactopel() -{ - (void)inp(0x3C8); -} - -/* - * Trigger HiColor DACs to change mode. - */ -Byte trigdac() -{ - (void)inp(0x3C6); - (void)inp(0x3C6); - (void)inp(0x3C6); - return(inp(0x3C6)); -} - -/* - * Enter command mode of HiColor DACs. - */ -Byte dactocomm() -{ - dactopel(); - return(trigdac()); -} - -/* - * Get the HiColor DAC command register and return to PEL mode. - */ -Byte getdaccomm() -{ - Byte ret; - - dactocomm(); - ret = inp(0x3C6); - dactopel(); - - return(ret); -} - -/* - * Wait for vertical retrace interval. - */ -void waitforretrace() -{ - Word Port[2] = {MISC_OUT_R, 0x000}; - - EnableIOPorts(1, Port); - - Port[1] = (inp(MISC_OUT_R) & 0x01) ? 0x3DA : 0x3BA; - EnableIOPorts(2, Port); - while ((inp(Port[1]) & 0x08) != 0) - { - /* Idle */ - } - while ((inp(Port[1]) & 0x08) == 0) - { - /* Idle */ - } - - DisableIOPorts(2, Port); - return; -} - -/* - * Check chip descriptor against exclusion list - */ -Bool Excluded(ExList, Chip, Mask10) -Range *ExList; -Chip_Descriptor *Chip; -Bool Mask10; -{ - int i, j; - Word mask = (Mask10 ? 0x3FF : 0xFFFF); - - if (Chip->num_ports == 0) - { - return(FALSE); - } - if (Chip->ports[0] == 0) - { - /* Fill in CRTC */ - Chip->ports[0] = CRTC_IDX; - Chip->ports[1] = CRTC_REG; - } - for (i=0; i < Chip->num_ports; i++) - { - for (j=0; ExList[j].lo != (Word)-1; j++) - { - if (ExList[j].hi == (Word)-1) - { - /* single port */ - if ((Chip->ports[i] & mask) == ExList[j].lo) - { - return(TRUE); - } - } - else - { - /* range */ - if (((Chip->ports[i]&mask) >= ExList[j].lo) && - ((Chip->ports[i]&mask) <= ExList[j].hi)) - { - return(TRUE); - } - } - } - } - return(FALSE); -} - -int StrCaseCmp(s1, s2) -char *s1; -char *s2; -{ - char c1, c2; - - if (*s1 == 0) - if (*s2 == 0) - return(0); - else - return(1); - - c1 = (isupper(*s1) ? tolower(*s1) : *s1); - c2 = (isupper(*s2) ? tolower(*s2) : *s2); - while (c1 == c2) - { - if (c1 == '\0') - return(0); - s1++; - s2++; - c1 = (isupper(*s1) ? tolower(*s1) : *s1); - c2 = (isupper(*s2) ? tolower(*s2) : *s2); - } - return(c1 - c2); -} - -unsigned long StrToUL(str) -CONST char *str; -{ - int base = 10; - CONST char *p = str; - unsigned long tot = 0; - - if (*p == '0') - { - p++; - if (*p == 'x') - { - p++; - base = 16; - } - else - { - base = 8; - } - } - while (*p) - { - if ((*p >= '0') && (*p <= ((base == 8)?'7':'9'))) - { - tot = tot * base + (*p - '0'); - } - else if ((base == 16) && (*p >= 'a') && (*p <= 'f')) - { - tot = tot * base + 10 + (*p - 'a'); - } - else if ((base == 16) && (*p >= 'A') && (*p <= 'F')) - { - tot = tot * base + 10 + (*p - 'A'); - } - else - { - return(tot); - } - p++; - } - return(tot); -} - Index: xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c:3.4 Mon Dec 23 01:31:43 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c Fri Jan 18 15:24:53 2002 @@ -1,78 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c,v 3.4 1996/12/23 06:31:43 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: VGA.c /main/5 1996/02/21 17:13:06 kaleb $ */ - -#include "Probe.h" - -/* - * Determine if this is a VGA or an EGA. VGA has one more attribute - * register than EGA, so see if we can read/write it. - */ -static Word Ports[] = {0x3C0, 0x3C1}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_VGA __STDCARGS((int)); - -Chip_Descriptor VGA_Descriptor = { - "VGA", - Probe_VGA, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_VGA, -}; - -Bool Probe_VGA(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte origVal, newVal; - - EnableIOPorts(NUMPORTS, Ports); - origVal = rdinx(0x3C0, 0x14 | 0x20); - outp(0x3C0, origVal ^ 0x0F); - newVal = rdinx(0x3C0, 0x14 | 0x20); - outp(0x3C0, origVal); - DisableIOPorts(NUMPORTS, Ports); - if (newVal == (origVal ^ 0x0F)) - { - result = TRUE; - *Chipset = CHIP_VGA; - } - return(result); -} - -/* ARGSUSED */ -static int MemProbe_VGA(Chipset) -int Chipset; -{ - return(256); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c:3.5 Mon Dec 23 01:31:44 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c Fri Jan 18 15:24:54 2002 @@ -1,117 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c,v 3.5 1996/12/23 06:31:44 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Video7.c /main/6 1996/10/24 07:10:14 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -Chip_Descriptor Video7_Descriptor = { - "Video7", - Probe_Video7, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - NULL, -}; - -Bool Probe_Video7(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old, old1; - Word id; - - /* Add CRTC to enabled ports */ - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - - old = rdinx(SEQ_IDX, 0x06); - wrinx(SEQ_IDX, 0x06, 0xEA); /* enable extensions */ - old1 = rdinx(CRTC_IDX, 0x0C); - wrinx(CRTC_IDX, 0x0C, 0x55); - id = rdinx(CRTC_IDX, 0x1F); - wrinx(CRTC_IDX, 0x0C, old1); - if (id == (0x55 ^ 0xEA)) - { - /* - * It's Video7 - */ - result = TRUE; - id = (rdinx(SEQ_IDX, 0x8F) << 8) | rdinx(SEQ_IDX, 0x8E); - if ((id >= 0x7000) && (id <= 0x70FF)) - { - *Chipset = CHIP_V7_FWRITE; - } - else if ((id >= 0x7140) && (id <= 0x714F)) - { - *Chipset = CHIP_V7_1024i; - } - else if (id == 0x7151) - { - *Chipset = CHIP_V7_VRAM2_B; - } - else if (id == 0x7152) - { - *Chipset = CHIP_V7_VRAM2_C; - } - else if (id == 0x7760) - { - *Chipset = CHIP_HT216BC; - } - else if (id == 0x7763) - { - *Chipset = CHIP_HT216D; - } - else if (id == 0x7764) - { - *Chipset = CHIP_HT216E; - } - else if (id == 0x7765) - { - *Chipset = CHIP_HT216F; - } - else if ((id >= 0x8000) && (id < 0xFFFF)) - { - *Chipset = CHIP_V7_VEGA; - } - else - { - Chip_data = id; - *Chipset = CHIP_V7_UNKNOWN; - } - } - wrinx(SEQ_IDX, 6, old); /* disable extensions */ - DisableIOPorts(NUMPORTS, Ports); - return(result); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c:3.5 Mon Dec 23 01:31:45 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c Fri Jan 18 15:24:54 2002 @@ -1,200 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c,v 3.5 1996/12/23 06:31:45 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: WD.c /main/6 1996/10/24 07:10:17 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x000, 0x000, GRC_IDX, GRC_REG, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -static int MemProbe_WD __STDCARGS((int)); - -Chip_Descriptor WD_Descriptor = { - "WD", - Probe_WD, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - MemProbe_WD, -}; - -Bool Probe_WD(Chipset) -int *Chipset; -{ - Byte old, old1, old2, old3; - Word ver; - Bool result = FALSE; - - /* Add CRTC to enabled ports */ - Ports[0] = CRTC_IDX; - Ports[1] = CRTC_REG; - EnableIOPorts(NUMPORTS, Ports); - - old = rdinx(GRC_IDX, 0x0F); - setinx(GRC_IDX, 0x0F, 0x17); /* Lock registers */ - if (!testinx2(GRC_IDX, 0x09, 0x7F)) - { - wrinx(GRC_IDX, 0x0F, 0x05); /* Unlock them again */ - if (testinx2(GRC_IDX, 0x09, 0x7F)) - { - result = TRUE; - old2 = rdinx(CRTC_IDX, 0x29); - /* Unlock WD90Cxx regs */ - modinx(CRTC_IDX, 0x29, 0x8F, 0x85); - if (!testinx(CRTC_IDX, 0x2B)) - { - *Chipset = CHIP_WD_PVGA1; - } - else - { - old1 = rdinx(SEQ_IDX, 0x06); - wrinx(SEQ_IDX, 0x06, 0x48); - if (!testinx2(SEQ_IDX, 0x07, 0xF0)) - { - *Chipset = CHIP_WD_90C00; - } - else if (!testinx(SEQ_IDX, 0x10)) - { - if (testinx2(CRTC_IDX, 0x31, 0x68)) - { - *Chipset = CHIP_WD_90C22; - } - else if (testinx2(CRTC_IDX, 0x31, 0x90)) - { - *Chipset = CHIP_WD_90C20A; - } - else - { - *Chipset = CHIP_WD_90C20; - } - wrinx(CRTC_IDX, 0x34, 0xA6); - if (rdinx(CRTC_IDX, 0x32) & 0x20) - { - wrinx(CRTC_IDX, 0x34, 0x00); - } - } - else if (testinx2(SEQ_IDX, 0x14, 0x0F)) - { - old3 = rdinx(CRTC_IDX, 0x34); - wrinx(CRTC_IDX, 0x34, 0x00); - ver = ((rdinx(CRTC_IDX, 0x36) << 8) | - (rdinx(CRTC_IDX, 0x37))); - switch (ver) - { - case 0x3234: - *Chipset = CHIP_WD_90C24; - break; - case 0x3236: - *Chipset = CHIP_WD_90C26; - break; - case 0x3237: /* Guess */ - *Chipset = CHIP_WD_90C27; - break; - case 0x3330: - *Chipset = CHIP_WD_90C30; - break; - case 0x3331: - *Chipset = CHIP_WD_90C31; - break; - case 0x3333: - *Chipset = CHIP_WD_90C33; - break; - default: - Chip_data = ver & 0xFF; - *Chipset = CHIP_WD_UNK; - break; - } - wrinx(CRTC_IDX, 0x34, old3); - } - else if (!testinx2(SEQ_IDX, 0x10, 0x04)) - { - *Chipset = CHIP_WD_90C10; - } - else - { - *Chipset = CHIP_WD_90C11; - } - wrinx(SEQ_IDX, 0x06, old1); - } - wrinx(CRTC_IDX, 0x29, old2); - } - } - wrinx(0x3CE, 0x0F, old); - - DisableIOPorts(NUMPORTS, Ports); - return(result); -} - -static int MemProbe_WD(Chipset) -int Chipset; -{ - Byte old; - int Mem = 0; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Unlock - */ - old = rdinx(GRC_IDX, 0x0F); - wrinx(GRC_IDX, 0x0F, 0x05); - - /* - * Check - */ - switch (rdinx(GRC_IDX, 0x0B) >> 6) - { - case 0x00: - case 0x01: - Mem = 256; - break; - case 0x02: - Mem = 512; - break; - case 0x03: - Mem = 1024; - break; - } - - if ((Chipset >= CHIP_WD_90C33) && - (rdinx(CRTC_IDX, 0x3E) & 0x80)) - { - Mem = 2048; - } - - /* - * Lock - */ - wrinx(GRC_IDX, 0x0F, old); - - DisableIOPorts(NUMPORTS, Ports); - return(Mem); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c:3.5 Mon Dec 23 01:31:46 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c Fri Jan 18 15:24:54 2002 @@ -1,124 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c,v 3.5 1996/12/23 06:31:46 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Weitek.c /main/6 1996/10/25 06:19:09 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x3CD, SEQ_IDX, SEQ_REG}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -Chip_Descriptor Weitek_Descriptor = { - "Weitek", - Probe_Weitek, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - NULL, -}; - -static Byte WeitekEnable(Flag) -Byte Flag; -{ - Byte new, old, x; - - old = rdinx(SEQ_IDX, 0x11); - for (x=0; x < 10; x++) - { - ; - } - outp(SEQ_REG, old); - for (x=0; x < 10; x++) - { - ; - } - outp(SEQ_REG, old); - for (x=0; x < 10; x++) - { - ; - } - new = inp(SEQ_REG); - for (x=0; x < 10; x++) - { - ; - } - outp(SEQ_REG, (new & 0x9F) | Flag); - - return(old); -} - -Bool Probe_Weitek(Chipset) -int *Chipset; -{ - Bool result = FALSE; - Byte old, ver; - - EnableIOPorts(NUMPORTS, Ports); - - /* - * Disable extensions - */ - old = WeitekEnable(0x60); - if (!testinx(SEQ_IDX, 0x12)) - { - /* - * Enable extensions - */ - WeitekEnable(0); - if (testinx(SEQ_IDX, 0x12)) - { - if (tstrg(0x3CD, 0xFF)) - { - result = TRUE; - ver = rdinx(SEQ_IDX, 0x07) >> 5; - switch (ver) - { - case 0x00: /* guess */ - *Chipset = CHIP_WEIT_5086; - break; - case 0x01: - *Chipset = CHIP_WEIT_5186; - break; - case 0x02: - *Chipset = CHIP_WEIT_5286; - break; - default: - Chip_data = ver; - *Chipset = CHIP_WEIT_UNK; - break; - } - } - } - } - - wrinx(SEQ_IDX, 0x11, old); - DisableIOPorts(NUMPORTS, Ports); - return(result); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c:3.4 xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c:3.4 Mon Dec 23 01:31:47 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c Fri Jan 18 15:24:54 2002 @@ -1,60 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c,v 3.4 1996/12/23 06:31:47 dawes Exp $ */ -/* - * (c) Copyright 1993,1994 by David Wexelblat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 - * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION 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 David Wexelblat shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from David Wexelblat. - * - */ - -/* $XConsortium: Yamaha.c /main/5 1996/02/21 17:13:23 kaleb $ */ - -#include "Probe.h" - -static Word Ports[] = {0x3D4, 0x3D5}; -#define NUMPORTS (sizeof(Ports)/sizeof(Word)) - -Chip_Descriptor Yamaha_Descriptor = { - "Yamaha", - Probe_Yamaha, - Ports, - NUMPORTS, - FALSE, - FALSE, - TRUE, - NULL, -}; - -Bool Probe_Yamaha(Chipset) -int *Chipset; -{ - Bool result = FALSE; - - EnableIOPorts(NUMPORTS, Ports); - if (testinx2(0x3D4, 0x7C, 0x7C)) - { - result = TRUE; - *Chipset = CHIP_YAMAHA6388; - } - DisableIOPorts(NUMPORTS, Ports); - return(result); -} Index: xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def:3.1 xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def:removed --- xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def:3.1 Sat Mar 13 22:21:46 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def Fri Jan 18 15:24:54 2002 @@ -1,4 +0,0 @@ -NAME SuperProbe NOTWINDOWCOMPAT -DESCRIPTION "X11R6 XFree86 3.3.3.1 SuperProbe for OS/2 EMX0.9C" -PROTMODE -EXETYPE OS2 Index: xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c:1.9 xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c:1.10 --- xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c:1.9 Sat Sep 4 09:04:29 1999 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c Wed Jul 25 11:05:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c,v 1.9 1999/09/04 13:04:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c,v 1.10 2001/07/25 15:05:05 dawes Exp $ */ /* * Copyright 1999 by Joseph V. Moss * @@ -41,9 +41,7 @@ char *defaultFontPath = COMPILEDDEFAULTFONTPATH; char *rgbPath = RGB_DB; -#if NeedVarargsPrototypes #include -#endif #include #include #ifdef NEED_SNPRINTF Index: xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c:1.9 xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c:1.10 --- xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c:1.9 Sat Sep 4 09:04:29 1999 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c Wed Jul 25 11:05:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c,v 1.9 1999/09/04 13:04:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c,v 1.10 2001/07/25 15:05:05 dawes Exp $ */ /* * Copyright 1999 by Joseph V. Moss * @@ -38,9 +38,7 @@ #include "tcl.h" #include "xfsconf.h" -#if NeedVarargsPrototypes #include -#endif #include #include #ifdef NEED_SNPRINTF Index: xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c:3.13 xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c:3.14 --- xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c:3.13 Sun Apr 25 06:01:58 1999 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c Wed Jul 25 11:05:05 2001 @@ -4,7 +4,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c,v 3.13 1999/04/25 10:01:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c,v 3.14 2001/07/25 15:05:05 dawes Exp $ */ /* * Copyright 1996 by Joseph V. Moss * @@ -42,14 +42,6 @@ #include #include #include "tclmisc.h" - -#if X_NOT_STDC_ENV -int atoi( -#if NeedFunctionPrototypes - char *str -#endif -); -#endif static int (*savErrorFunc)(); static int errorOccurred; Index: xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c:3.9 xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c:3.10 --- xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c:3.9 Fri Dec 27 01:54:19 1996 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c Wed Jul 25 11:05:05 2001 @@ -4,7 +4,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c,v 3.9 1996/12/27 06:54:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c,v 3.10 2001/07/25 15:05:05 dawes Exp $ */ /* * Copyright 1996 by Joseph V. Moss * @@ -503,11 +503,7 @@ Emulate a subset of the Tcl 7.5 clock command */ -#ifdef X_NOT_STDC_ENV -extern long time(); -#else #include -#endif int TCL_XF86Clock(clientData, interp, argc, argv) Index: xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c:3.29 xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c:3.30 --- xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c:3.29 Sat Sep 4 09:04:29 1999 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c Wed Jul 25 11:05:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c,v 3.29 1999/09/04 13:04:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c,v 3.30 2001/07/25 15:05:05 dawes Exp $ */ /* * Copyright 1996,1999 by Joseph V. Moss * @@ -43,9 +43,7 @@ #include "xfsconf.h" -#if NeedVarargsPrototypes #include -#endif #include #include @@ -57,7 +55,6 @@ /* Error handling functions */ -#if NeedVarargsPrototypes void VErrorF(f, args) const char *f; @@ -67,59 +64,24 @@ vsprintf(tmpbuf, f, args); Tcl_AppendResult(errinterp, tmpbuf, (char *) NULL); } -#endif -/*VARARGS1*/ void -ErrorF( -#if NeedVarargsPrototypes - const char * f, ...) -#else - f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ - char *f; - char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; -#endif +ErrorF(const char * f, ...) { -#if NeedVarargsPrototypes va_list args; va_start(args, f); VErrorF(f, args); va_end(args); -#else - char tmpbuf[1024]; -#ifdef AMOEBA - mu_lock(&print_lock); -#endif - sprintf( tmpbuf, f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); - Tcl_AppendResult(errinterp, tmpbuf, (char *) NULL); -#ifdef AMOEBA - mu_unlock(&print_lock); -#endif -#endif } -/*VARARGS1*/ void -FatalError( -#if NeedVarargsPrototypes - const char *f, ...) -#else -f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ - char *f; - char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; -#endif +FatalError(const char *f, ...) { -#if NeedVarargsPrototypes va_list args; -#endif ErrorF("\nFatal server error:\n"); -#if NeedVarargsPrototypes va_start(args, f); VErrorF(f, args); va_end(args); -#else - ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); -#endif ErrorF("\n"); } Index: xc/programs/Xserver/hw/xfree86/common/Imakefile diff -u xc/programs/Xserver/hw/xfree86/common/Imakefile:3.134 xc/programs/Xserver/hw/xfree86/common/Imakefile:3.138 --- xc/programs/Xserver/hw/xfree86/common/Imakefile:3.134 Mon May 7 17:42:31 2001 +++ xc/programs/Xserver/hw/xfree86/common/Imakefile Tue Oct 9 15:31:05 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.134 2001/05/07 21:42:31 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.138 2001/10/09 19:31:05 herrb Exp $ @@ -18,18 +18,15 @@ #endif /* GNUMachArchitecture */ #else # if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \ - || defined(OpenBSDArchitecture) && defined(PpcArchitecture) + || defined(OpenBSDArchitecture) && defined(PpcArchitecture) \ + || defined(NetBSDArchitecture) KBD = xf86KbdBSD # else # ifdef LinuxArchitecture KBD = xf86KbdLnx # else -# if defined(SunArchitecture) && defined(SVR4Architecture) && OSMinorVersion >= 8 - KBD = xf86KbdSol8 -#else KBD = xf86Kbd # endif -# endif # endif #endif @@ -49,8 +46,8 @@ #endif #if BuildXInputExt - XF86_XINPUT_SRC = xf86Xinput.c xf86Switch.c xisb.c - XF86_XINPUT_OBJ = xf86Xinput.o xf86Switch.o xisb.o + XF86_XINPUT_SRC = xf86Xinput.c xisb.c + XF86_XINPUT_OBJ = xf86Xinput.o xisb.o #endif MODPATHDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" @@ -161,7 +158,8 @@ -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(SERVERSRC)/os \ -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext -I$(EXTINCSRC) \ -I$(SERVERSRC)/Xi -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(FONTLIBSRC)/include -I$(XF86SRC) -I$(XF86PARSERSRC) \ + -I$(FONTLIBSRC)/include -I$(FONTINCSRC) \ + -I$(XF86SRC) -I$(XF86PARSERSRC) \ -I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac \ -I$(XF86SRC)/scanpci -I$(XF86OSSRC)/vbe -I$(XF86SRC)/int10 \ -I$(XF86SRC)/ddc Index: xc/programs/Xserver/hw/xfree86/common/atKeynames.h diff -u xc/programs/Xserver/hw/xfree86/common/atKeynames.h:3.17 xc/programs/Xserver/hw/xfree86/common/atKeynames.h:3.18 --- xc/programs/Xserver/hw/xfree86/common/atKeynames.h:3.17 Fri May 18 12:03:10 2001 +++ xc/programs/Xserver/hw/xfree86/common/atKeynames.h Sat Sep 29 16:40:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.17 2001/05/18 16:03:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.18 2001/09/29 20:40:30 herrb Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -194,6 +194,7 @@ #define KEY_F17 /* F17 0x72 */ 114 #define KEY_KP_DEC /* KP_DEC 0x73 */ 115 #define KEY_BSlash2 /* \ _ 0x73 */ 115 +#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118 #define KEY_XFER /* Kanji Transfer 0x79 */ 121 #define KEY_NFER /* No Kanji Transfer 0x7b */ 123 #define KEY_Yen /* Yen 0x7d */ 125 Index: xc/programs/Xserver/hw/xfree86/common/compiler.h diff -u xc/programs/Xserver/hw/xfree86/common/compiler.h:3.81 xc/programs/Xserver/hw/xfree86/common/compiler.h:3.88 --- xc/programs/Xserver/hw/xfree86/common/compiler.h:3.81 Mon Apr 23 12:17:11 2001 +++ xc/programs/Xserver/hw/xfree86/common/compiler.h Mon Jan 7 15:38:27 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.81 2001/04/23 16:17:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.88 2002/01/07 20:38:27 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -31,27 +31,25 @@ #define _COMPILER_H -#ifndef __STDC__ -# ifdef signed -# undef signed -# endif -# ifdef volatile -# undef volatile -# endif -# ifdef const -# undef const +/* Allow drivers to use the GCC-supported __inline__ and/or __inline. */ +#ifndef __inline__ +# if defined(__GNUC__) + /* gcc has __inline__ */ +# elif defined(__HIGHC__) +# define __inline__ _Inline +# else +# define __inline__ /**/ # endif -# define signed /**/ -# ifdef __GNUC__ -# define volatile __volatile__ -# define const __const__ +#endif /* __inline__ */ +#ifndef __inline +# if defined(__GNUC__) + /* gcc has __inline */ +# elif defined(__HIGHC__) +# define __inline _Inline # else -# define const /**/ -# ifdef __HIGHC__ -# define __inline__ _Inline -# endif -# endif /* __GNUC__ */ -#endif /* !__STDC__ */ +# define __inline /**/ +# endif +#endif /* __inline */ #if defined(IODEBUG) && defined(__GNUC__) #define outb RealOutb @@ -862,6 +860,67 @@ return r1; } +#ifdef linux /* don't mess with other OSs */ + +/* + * EGCS 1.1 knows about arbitrary unaligned loads (and we don't support older + * versions anyway. Define some packed structures to talk about such things + * with. + */ + +struct __una_u32 { unsigned int x __attribute__((packed)); }; +struct __una_u16 { unsigned short x __attribute__((packed)); }; + +static __inline__ void stw_u(unsigned long val, unsigned short *p) +{ + struct __una_u16 *ptr = (struct __una_u16 *) p; + ptr->x = val; +} + +static __inline__ void stl_u(unsigned long val, unsigned int *p) +{ + struct __una_u32 *ptr = (struct __una_u32 *) p; + ptr->x = val; +} + +#if X_BYTE_ORDER == X_BIG_ENDIAN +static __inline__ unsigned int +xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned int ret; + + __asm__ __volatile__("lw %0, 0(%1)" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ void +xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("sw %0, 0(%1)" + : /* No outputs */ + : "r" (val), "r" (addr)); +} +#endif + +#define mem_barrier() \ +__asm__ __volatile__( \ + "# prevent instructions being moved around\n\t" \ + ".set\tnoreorder\n\t" \ + "# 8 nops to fool the R4400 pipeline\n\t" \ + "nop;nop;nop;nop;nop;nop;nop;nop\n\t" \ + ".set\treorder" \ + : /* no output */ \ + : /* no input */ \ + : "memory") +#define write_mem_barrier() mem_barrier() + +#else /* !linux */ #define stq_u(v,p) stl_u(v,p) #define stl_u(v,p) (*(unsigned char *)(p)) = (v); \ (*(unsigned char *)(p)+1) = ((v) >> 8); \ @@ -872,6 +931,7 @@ (*(unsigned char *)(p)+1) = ((v) >> 8) #define mem_barrier() /* NOP */ +#endif /* !linux */ #endif /* __mips__ */ #if defined(__arm32__) @@ -1123,7 +1183,7 @@ #define mem_barrier() /* NOP */ #define write_mem_barrier() /* NOP */ -#if !defined(FAKEIT) && !defined(__mc68000__) +#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) #ifdef GCCUSESGAS /* @@ -1232,7 +1292,7 @@ #endif /* GCCUSESGAS */ -#else /* !defined(FAKEIT) && !defined(__mc68000__) */ +#else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) */ static __inline__ void outb(unsigned short port, unsigned char val) @@ -1352,7 +1412,7 @@ #endif /* !PPCIO_DEBUG */ #else /* !GNUC && !PPC */ -#if !defined(AMOEBA) && !defined(MINIX) && !defined(QNX4) +#if !defined(QNX4) # if defined(__STDC__) && (__STDC__ == 1) # ifndef asm # define asm __asm @@ -1414,17 +1474,6 @@ extern void outb(unsigned port, unsigned val); extern void outw(unsigned port, unsigned val); extern void outl(unsigned port, unsigned val); -#define ldq_u(p) (*((unsigned long *)(p))) -#define ldl_u(p) (*((unsigned int *)(p))) -#define ldw_u(p) (*((unsigned short *)(p))) -#undef stq_u -#define stq_u(v,p) ((unsigned long *)(p)) = (v) -#undef stl_u -#define stl_u(v,p) ((unsigned int *)(p)) = (v) -#undef stw_u -#define stw_u(v,p) ((unsigned short *)(p)) = (v) -#define mem_barrier() /* NOP */ -#define write_mem_barrier() /* NOP */ #endif /* QNX4 */ #if defined(IODEBUG) && defined(__GNUC__) @@ -1457,14 +1506,6 @@ *----------------------------------------------------------------------- */ -#ifndef __GNUC__ -#ifdef __HIGHC__ -#define __inline__ _Inline -#else -#define __inline__ /**/ -#endif -#endif - /* * rdinx - read the indexed byte port 'port', index 'ind', and return its value */ @@ -1596,6 +1637,8 @@ (*xf86WriteMmioNB8)((CARD8)(val), base, offset) #define MMIO_ONB16(base, offset, val) \ (*xf86WriteMmioNB16)((CARD16)(val), base, offset) +#define MMIO_MOVE32(base, offset, val) \ + MMIO_OUT32(base, offset, val) #elif defined(__powerpc__) /* @@ -1633,6 +1676,9 @@ xf86WriteMmioNB32Le(base, offset, (CARD32)(val)) # endif +#define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) + static __inline__ void ppc_flush_icache(char *addr) { __asm__ volatile ( @@ -1682,6 +1728,9 @@ xf86WriteMmio32LeNB(base, offset, (CARD32)(val)) # endif +#define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) + #else /* !__alpha__ && !__powerpc__ && !__sparc__ */ #define MMIO_IN8(base, offset) \ @@ -1699,6 +1748,8 @@ #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) + +#define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val) #endif /* __alpha__ */ Index: xc/programs/Xserver/hw/xfree86/common/fourcc.h diff -u xc/programs/Xserver/hw/xfree86/common/fourcc.h:1.2 xc/programs/Xserver/hw/xfree86/common/fourcc.h:1.3 --- xc/programs/Xserver/hw/xfree86/common/fourcc.h:1.2 Wed Jun 14 14:20:33 2000 +++ xc/programs/Xserver/hw/xfree86/common/fourcc.h Mon Dec 3 17:13:24 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/fourcc.h,v 1.2 2000/06/14 18:20:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/fourcc.h,v 1.3 2001/12/03 22:13:24 mvojkovi Exp $ */ /* This header file contains listings of STANDARD guids for video formats. @@ -87,3 +87,44 @@ 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 \ } + +#define FOURCC_IA44 0x34344149 +#define XVIMAGE_IA44 \ + { \ + FOURCC_IA44, \ + XvYUV, \ + LSBFirst, \ + {'I','A','4','4', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 8, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 8, 8, \ + 1, 1, 1, \ + 1, 1, 1, \ + {'A','I', \ + 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,0}, \ + XvTopToBottom \ + } + +#define FOURCC_AI44 0x34344941 +#define XVIMAGE_AI44 \ + { \ + FOURCC_AI44, \ + XvYUV, \ + LSBFirst, \ + {'A','I','4','4', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 8, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 8, 8, \ + 1, 1, 1, \ + 1, 1, 1, \ + {'I','A', \ + 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,0}, \ + XvTopToBottom \ + } + Index: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl diff -u xc/programs/Xserver/hw/xfree86/common/modeline2c.pl:1.7 xc/programs/Xserver/hw/xfree86/common/modeline2c.pl:1.8 --- xc/programs/Xserver/hw/xfree86/common/modeline2c.pl:1.7 Fri Apr 6 20:50:15 2001 +++ xc/programs/Xserver/hw/xfree86/common/modeline2c.pl Sat Oct 27 23:33:17 2001 @@ -10,7 +10,7 @@ # hackish perl - author Dirk Hohndel # Copyright 1999-2001 by The XFree86 Project, Inc. # -# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.7 2001/04/07 00:50:15 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.8 2001/10/28 03:33:17 tsi Exp $ #my %flagshash; $flagshash{""} = "0"; @@ -69,6 +69,9 @@ $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}); +# Also generate half-width doublescanned modes + printf("\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s | V_DBLSCAN, MODESUFFIX},\n", + $2/2,$6/2,$1*500,$2/2,$3/2,$4/2,$5/2,$6/2,$7/2,$8/2,$9/2,$flagshash{$flags}); } Index: xc/programs/Xserver/hw/xfree86/common/xf86.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86.h:3.152 xc/programs/Xserver/hw/xfree86/common/xf86.h:3.157 --- xc/programs/Xserver/hw/xfree86/common/xf86.h:3.152 Wed May 16 16:08:35 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86.h Thu Dec 13 13:01:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.152 2001/05/16 20:08:35 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.157 2001/12/13 18:01:50 eich Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -60,9 +60,12 @@ (((p) == Pix24Use32) ? 32 : 0)) /* variables for debugging */ +#ifdef BUILDDEBUG +extern char* xf86p8bit[]; extern CARD32 xf86DummyVar1; extern CARD32 xf86DummyVar2; extern CARD32 xf86DummyVar3; +#endif /* Function Prototypes */ #ifndef _NO_XF86_PROTOTYPES @@ -110,21 +113,21 @@ int xf86GetPciEntity(int bus, int dev, int func); Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, pointer); -void xf86DeallocateResourcesForEntity(int entityIndex, long type); +void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type); resPtr xf86RegisterResources(int entityIndex, resList list, int Access); Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base); void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs, xf86SetAccessFuncPtr oldFuncs); Bool xf86IsEntityPrimary(int entityIndex); Bool xf86FixPciResource(int entityIndex, int prt, memType alignment, - long type); + unsigned long type); resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes); resPtr xf86SetOperatingState(resList list, int entityIndex, int mask); void xf86EnterServerState(xf86State state); -resRange xf86GetBlock(long type, memType size, +resRange xf86GetBlock(unsigned long type, memType size, memType window_start, memType window_end, memType align_mask, resPtr avoid); -resRange xf86GetSparse(long type, memType fixed_bits, +resRange xf86GetSparse(unsigned long type, memType fixed_bits, memType decode_mask, memType address_mask, resPtr avoid); memType xf86ChkConflict(resRange *rgp, int entityIndex); @@ -179,6 +182,7 @@ Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num); +xf86SetDGAModeProc xf86SetDGAMode; /* xf86Events.c */ @@ -263,6 +267,8 @@ Bool xf86LoaderCheckSymbol(const char *name); void xf86LoaderReqSymLists(const char **, ...); void xf86LoaderReqSymbols(const char *, ...); +void xf86LoaderRefSymLists(const char **, ...); +void xf86LoaderRefSymbols(const char *, ...); void xf86SetBackingStore(ScreenPtr pScreen); void xf86SetSilkenMouse(ScreenPtr pScreen); int xf86NewSerialNumber(WindowPtr p, pointer unused); Index: xc/programs/Xserver/hw/xfree86/common/xf86Beta.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Beta.c:3.7 xc/programs/Xserver/hw/xfree86/common/xf86Beta.c:3.8 --- xc/programs/Xserver/hw/xfree86/common/xf86Beta.c:3.7 Sun Aug 16 06:25:39 1998 +++ xc/programs/Xserver/hw/xfree86/common/xf86Beta.c Wed Jul 25 11:05:05 2001 @@ -1,6 +1,6 @@ /* Copyright 1996, The XFree86 Project, Inc */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Beta.c,v 3.7 1998/08/16 10:25:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Beta.c,v 3.8 2001/07/25 15:05:05 dawes Exp $ */ /* * This is for publicly released beta server binaries. @@ -54,10 +54,6 @@ #define XOR_VALUE_2 0x7df6324bL #define KEY_LENGTH 16 -#ifdef X_NOT_STDC_ENV -extern char *getenv(); -#endif - void xf86CheckBeta(int extraDays, char *key) { @@ -74,11 +70,7 @@ Bool writefile = FALSE; char oldvers[16] = {0, }; #endif -#ifndef X_NOT_STDC_ENV time_t expirytime = EXPIRY_TIME; -#else - long expirytime = EXPIRY_TIME; -#endif /* * Check if the beta message should be displayed. It is displayed when @@ -120,11 +112,7 @@ #ifdef EXPIRE_SERVER if (expirytime != 0) { if (extraDays > 0 && key != NULL && strlen(key) == KEY_LENGTH) { -#ifndef X_NOT_STDC_ENV time_t newExpiry; -#else - long newExpiry; -#endif unsigned long key1, key2; char tmp[9]; Index: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.61.2.2 xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.67 --- xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.61.2.2 Sat Jun 2 11:27:54 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Bus.c Sat Oct 27 23:33:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.61.2.2 2001/06/02 15:27:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.67 2001/10/28 03:33:17 tsi Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -53,16 +53,16 @@ resPtr ResRange = NULL; /* predefined special resources */ -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}; +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}; /* Flag: do we need RAC ? */ static Bool needRAC = FALSE; @@ -387,7 +387,7 @@ } void -xf86DeallocateResourcesForEntity(int entityIndex, long type) +xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type) { resPtr *pprev_next = &Acc; resPtr res = Acc; @@ -615,7 +615,7 @@ * xf86AccessRestoreState() - Restore the access registers to the * state before X was started. This is handy for framebuffers. */ -void +static void xf86AccessRestoreState(void) { if (!xf86ResAccessEnter) @@ -1020,7 +1020,7 @@ * depending on the types of the resource ranges and their locations */ static Bool -needCheck(resPtr pRes, long type, int entityIndex, xf86State state) +needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state) { /* the same entity shouldn't conflict with itself */ ScrnInfoPtr pScrn; @@ -1028,7 +1028,7 @@ BusType loc = BUS_NONE; BusType r_loc = BUS_NONE; - if (!(pRes->res_type & type & ResPhysMask)) + if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask)) return FALSE; /* @@ -1264,7 +1264,7 @@ int i = 0; const char *s, *r; resPtr tmp = list; - long type; + unsigned long type; if (!list) return; @@ -1406,8 +1406,8 @@ for (pRes = list; pRes; pRes = pRes->next) { if (pRes != target - && ((pRes->res_type & ResPhysMask) == - (target->res_type & ResPhysMask)) + && ((pRes->res_type & ResTypeMask) == + (target->res_type & ResTypeMask)) && pRes->block_begin <= target->block_end && pRes->block_end >= target->block_begin) { /* Possibly ignore estimated resources */ @@ -1460,7 +1460,7 @@ #define ALIGN(x,a) ((x) + a) &~(a) resRange -xf86GetBlock(long type, memType size, +xf86GetBlock(unsigned long type, memType size, memType window_start, memType window_end, memType align_mask, resPtr avoid) { @@ -1478,7 +1478,7 @@ type = (type & ~(ResExtMask | ResBios | ResEstimated)) | ResBlock; while (res_range) { - if (type & res_range->res_type & ResPhysMask) { + if ((type & ResTypeMask) == (res_range->res_type & ResTypeMask)) { if (res_range->block_begin > window_start) min = res_range->block_begin; else @@ -1557,7 +1557,7 @@ } resRange -xf86GetSparse(long type, memType fixed_bits, +xf86GetSparse(unsigned long type, memType fixed_bits, memType decode_mask, memType address_mask, resPtr avoid) { resRange r = {ResEnd,0,0}; @@ -1678,6 +1678,8 @@ return NULL; case BUS_PCI: return GetImplicitPciResources(entityIndex); + case BUS_last: + return NULL; } return NULL; } @@ -1686,8 +1688,6 @@ convertRange2Host(int entityIndex, resRange *pRange) { if (pRange->type & ResBus) { - pRange->type &= ~ResBus; - switch (xf86Entities[entityIndex]->busType) { case BUS_PCI: pciConvertRange2Host(entityIndex,pRange); @@ -1698,6 +1698,8 @@ default: break; } + + pRange->type &= ~ResBus; } } @@ -1724,9 +1726,8 @@ while(list->type != ResEnd) { range = *list; - if (range.type & ResBus) - convertRange2Host(entityIndex,&range); - + convertRange2Host(entityIndex,&range); + if ((access != ResNone) && (access & ResAccMask)) { range.type = (range.type & ~ResAccMask) | (access & ResAccMask); } @@ -2211,12 +2212,11 @@ while (list->type != ResEnd) { range = *list; - if (range.type & ResBus) - convertRange2Host(entityIndex,&range); + convertRange2Host(entityIndex,&range); acc = Acc; while (acc) { -#define MASK (ResPhysMask | ResExtMask) +#define MASK (ResTypeMask | ResExtMask) if ((acc->entityIndex == entityIndex) && (acc->val.a == range.a) && (acc->val.b == range.b) && ((acc->val.type & MASK) == (range.type & MASK))) @@ -2293,8 +2293,7 @@ while (list->type !=ResEnd) { range = *list; - if (range.type & ResBus) - convertRange2Host(entityIndex,&range); + convertRange2Host(entityIndex,&range); range.type &= ~ResEstimated; /* Not allowed for drivers */ switch (range.type & ResAccMask) { @@ -2382,8 +2381,8 @@ xf86ConvertListToHost(entityIndex,pResVGAHost); while (pAcc) { if (pAcc->entityIndex == entityIndex) - if (checkConflict(&pAcc->val,pResVGA, - entityIndex,state,FALSE)) { + if (checkConflict(&pAcc->val, pResVGAHost, + entityIndex, state, FALSE)) { if (vga && vga != pEnt->busAcc) { xf86Msg(X_ERROR, "Screen %i needs vga routed to" "different buses - deleting\n",i); @@ -2726,7 +2725,7 @@ if (list1) { list = list1; - if (range.type & list->res_type & ResPhysMask) { + if ((range.type & ResTypeMask) == (list->res_type & ResTypeMask)) { switch (range.type & ResExtMask) { case ResBlock: if ((list->res_type & ResExtMask) == ResBlock) { @@ -2885,7 +2884,7 @@ resPtr new = NULL; while (list) { - if (Range.type & list->res_type & ResPhysMask) { + if ((Range.type & ResTypeMask) == (list->res_type & ResTypeMask)) { switch (Range.type & ResExtMask) { case ResBlock: switch (list->res_type & ResExtMask) { @@ -2945,6 +2944,7 @@ return ret; } +#if 0 /* Not used */ static resPtr xf86FindComplement(resRange Range) { @@ -2978,6 +2978,7 @@ } return new; } +#endif resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type) @@ -2985,7 +2986,7 @@ resPtr ret = NULL; while (list) { - if ((list->res_type & type) == type) + if ((list->res_type & ResTypeMask) == type) ret = xf86AddResToList(ret,&(list->val),list->entityIndex); list = list->next; } Index: xc/programs/Xserver/hw/xfree86/common/xf86Config.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.242 xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.254 --- xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.242 Wed May 16 16:08:35 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Config.c Mon Jan 14 20:56:55 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.242 2001/05/16 20:08:35 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.254 2002/01/15 01:56:55 dawes Exp $ */ /* @@ -699,7 +699,10 @@ FLAG_PC98, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, FLAG_NOPM, - FLAG_XINERAMA + FLAG_XINERAMA, + FLAG_ALLOW_DEACTIVATE_GRABS, + FLAG_ALLOW_CLOSEDOWN_GRABS, + FLAG_SYNCLOG } FlagValues; static OptionInfoRec FlagOptions[] = { @@ -751,10 +754,17 @@ {0}, FALSE }, { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_ALLOW_DEACTIVATE_GRABS,"AllowDeactivateGrabs", OPTV_BOOLEAN, + {0}, FALSE }, + { FLAG_ALLOW_CLOSEDOWN_GRABS, "AllowClosedownGrabs", OPTV_BOOLEAN, + {0}, FALSE }, + { FLAG_SYNCLOG, "SyncLog", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, - {0}, FALSE } + {0}, FALSE }, }; +#if defined(i386) || defined(__i386__) static Bool detectPC98(void) { @@ -771,6 +781,7 @@ return FALSE; #endif } +#endif /* __i386__ */ static Bool configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) @@ -802,6 +813,11 @@ xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap); xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom); + xf86GetOptValBool(FlagOptions, FLAG_ALLOW_DEACTIVATE_GRABS, + &(xf86Info.grabInfo.allowDeactivate)); + xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS, + &(xf86Info.grabInfo.allowClosedown)); + /* * Set things up based on the config file information. Some of these * settings may be overridden later when the command line options are @@ -846,15 +862,15 @@ xf86Info.pciFlags = PCIForceConfig2; if (xf86IsOptionSet(FlagOptions, FLAG_PCIOSCONFIG)) xf86Info.pciFlags = PCIOsConfig; - /* - * XXX This should be handled like a proper boolean option -- see further - * above for examples. - */ - if (xf86IsOptionSet(FlagOptions, FLAG_NOPM)) - xf86Info.pmFlag = FALSE; - else - xf86Info.pmFlag = TRUE; - + + xf86Info.pmFlag = TRUE; + if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value)) + xf86Info.pmFlag = !value; + if (xf86GetOptValBool(FlagOptions, FLAG_SYNCLOG, &value)) { + xf86Msg(X_CONFIG, "SyncLog %s\n",value?"enabled":"disabled"); + xf86Info.syncLog = value; + } + i = -1; xf86GetOptValInteger(FlagOptions, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, &i); if (i >= 0) @@ -986,11 +1002,7 @@ s = xf86SetStrOption(inputp->commonOptions, "Protocol", "standard"); if (xf86NameCmp(s, "standard") == 0) { xf86Info.kbdProc = xf86KbdProc; -#if defined(AMOEBA) || defined(__CYGWIN__) - xf86Info.kbdEvents = NULL; -#else xf86Info.kbdEvents = xf86KbdEvents; -#endif xfree(s); } else if (xf86NameCmp(s, "xqueue") == 0) { #ifdef XQUEUE @@ -1001,13 +1013,16 @@ xfree(s); #ifdef WSCONS_SUPPORT } else if (xf86NameCmp(s, "wskbd") == 0) { - int xf86WSKbdProc(DeviceIntPtr, int); - - xf86Info.kbdProc = xf86WSKbdProc; - xf86Info.kbdEvents = xf86KbdEvents; + xf86Info.kbdProc = xf86KbdProc; + xf86Info.kbdEvents = xf86WSKbdEvents; xfree(s); s = xf86SetStrOption(inputp->commonOptions, "Device", NULL); xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n"); + if (s == NULL) { + xf86ConfigError("A \"device\" option is required with" + " the \"wskbd\" keyboard protocol"); + return FALSE; + } xf86Info.kbdFd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL); if (xf86Info.kbdFd == -1) { xf86ConfigError("cannot open \"%s\"", s); @@ -1015,6 +1030,33 @@ return FALSE; } xfree(s); + /* Find out keyboard type */ + if (ioctl(xf86Info.kbdFd, WSKBDIO_GTYPE, &xf86Info.wsKbdType) == -1) { + xf86ConfigError("cannot get keyboard type"); + close(xf86Info.kbdFd); + return FALSE; + } + switch (xf86Info.wsKbdType) { + case WSKBD_TYPE_PC_XT: + xf86Msg(X_PROBED, "Keyboard type: XT\n"); + break; + case WSKBD_TYPE_PC_AT: + xf86Msg(X_PROBED, "Keyboard type: AT\n"); + break; + case WSKBD_TYPE_USB: + xf86Msg(X_PROBED, "Keyboard type: USB\n"); + break; +#ifdef WSKBD_TYPE_ADB + case WSKBD_TYPE_ADB: + xf86Msg(X_PROBED, "Keyboard type: ADB\n"); + break; +#endif + default: + xf86ConfigError("Unsupported wskbd type \"%d\"", + xf86Info.wsKbdType); + close(xf86Info.kbdFd); + return FALSE; + } #endif } else { xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s); @@ -1063,7 +1105,7 @@ if (noXkbExtension) xf86Msg(from, "XKB: disabled\n"); -#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), NULL)) +#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), (char *)NULL)) if (!noXkbExtension && !XkbInitialMap) { if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) { @@ -2019,7 +2061,8 @@ /* all I can think of is a linear search... */ while(knownmodes != NULL) { - if(strcmp(modename,knownmodes->name) == 0) + if(!strcmp(modename,knownmodes->name) && + !(knownmodes->type & M_T_DEFAULT)) return TRUE; knownmodes = knownmodes->next; } @@ -2099,18 +2142,6 @@ xf86closeConfigFile (); /* Initialise a few things. */ - - /* Show what the marker symbols mean */ - xf86ErrorF("Markers: " X_PROBE_STRING " probed, " - X_CONFIG_STRING " from config file, " - X_DEFAULT_STRING " default setting,\n" - " " X_CMDLINE_STRING " from command line, " - X_NOTICE_STRING " notice, " - X_INFO_STRING " informational,\n" - " " X_WARNING_STRING " warning, " - X_ERROR_STRING " error, " - X_NOT_IMPLEMENTED_STRING " not implemented, " - X_UNKNOWN_STRING " unknown.\n"); /* * now we convert part of the information contained in the parser Index: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.55 xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.68 --- xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.55 Mon May 7 17:38:51 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Configure.c Mon Jan 7 16:39:18 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.55 2001/05/07 21:38:51 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.68 2002/01/07 21:39:18 dawes Exp $ */ /* * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. * @@ -26,6 +26,10 @@ #include #include +#include +#include +#include +#include #include "X.h" #include "Xmd.h" #include "os.h" @@ -36,6 +40,7 @@ #include "xf86Config.h" #include "xf86Priv.h" #include "xf86PciInfo.h" +#define IN_XSERVER #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" @@ -63,12 +68,20 @@ Bool xf86DoConfigurePass1 = TRUE; Bool foundMouse = FALSE; -#ifndef __EMX__ -static char *DFLT_MOUSE_DEV = "/dev/mouse"; -static char *DFLT_MOUSE_PROTO = "auto"; -#else +#if defined(__EMX__) #define DFLT_MOUSE_DEV "mouse$" #define DFLT_MOUSE_PROTO "OS2Mouse" +#elif defined(SCO) +static char *DFLT_MOUSE_PROTO = "OSMouse"; +#elif defined(QNX4) +static char *DFLT_MOUSE_PROTO = "OSMouse"; +static char *DFLT_MOUSE_DEV = "/dev/mouse"; +#elif defined(__QNXNTO__) +static char *DFLT_MOUSE_PROTO = "OSMouse"; +static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0"; +#else +static char *DFLT_MOUSE_DEV = "/dev/mouse"; +static char *DFLT_MOUSE_PROTO = "auto"; #endif static void @@ -297,11 +310,15 @@ } #endif +#ifndef SCO fd = open(DFLT_MOUSE_DEV, 0); if (fd != -1) { foundMouse = TRUE; close(fd); } +#else + foundMouse = TRUE; +#endif } mouse = xf86confmalloc(sizeof(XF86ConfInputRec)); @@ -310,8 +327,10 @@ mouse->inp_driver = "mouse"; mouse->inp_option_lst = xf86addNewOption(mouse->inp_option_lst, "Protocol", DFLT_MOUSE_PROTO); +#ifndef SCO mouse->inp_option_lst = xf86addNewOption(mouse->inp_option_lst, "Device", DFLT_MOUSE_DEV); +#endif ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse); return ptr; } @@ -319,9 +338,13 @@ static XF86ConfDRIPtr configureDRISection (void) { +#ifdef NOTYET parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec) return ptr; +#else + return NULL; +#endif } static XF86ConfVendorPtr @@ -366,7 +389,7 @@ return ptr; } -static char* +static const char* optionTypeToSting(OptionValueType type) { switch (type) { @@ -395,7 +418,9 @@ char identifier[16]; OptionInfoPtr p; int i = 0; +#ifdef DO_FBDEV_PROBE Bool foundFBDEV = FALSE; +#endif parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec) /* Move device info to parser structure */ @@ -426,29 +451,48 @@ /* Make sure older drivers don't segv */ if (DevToConfig[screennum].GDev.options) { /* Fill in the available driver options for people to use */ - ptr->dev_comment = xnfalloc(240 + 1); - strcpy(ptr->dev_comment, "Available Driver options are:-\n"); - strcat(ptr->dev_comment, " ### Values: : 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) + 80 + 1); - p_e = ptr->dev_comment + strlen(ptr->dev_comment); - sprintf(optname,"\"%s\"",p->name); - sprintf(p_e, " #Option %-20s \t# %s\n", - optname, optionTypeToSting(p->type)); - xfree(optname); + const char *descrip = + " ### Available Driver options are:-\n" + " ### Values: : integer, : float, " + ": \"True\"/\"False\",\n" + " ### : \"String\", : \" Hz/kHz/MHz\"\n" + " ### [arg]: arg optional\n"; + ptr->dev_comment = xstrdup(descrip); + if (ptr->dev_comment) { + for (p = DevToConfig[screennum].GDev.options; + p->name != NULL; p++) { + char *p_e; + const char *prefix = " #Option "; + const char *middle = " \t# "; + const char *suffix = "\n"; + const char *opttype = optionTypeToSting(p->type); + char *optname; + int len = strlen(ptr->dev_comment) + strlen(prefix) + + strlen(middle) + strlen(suffix) + 1; + + optname = xalloc(strlen(p->name) + 2 + 1); + if (!optname) + break; + sprintf(optname, "\"%s\"", p->name); + + len += max(20, strlen(optname)); + len += strlen(opttype); + + ptr->dev_comment = xrealloc(ptr->dev_comment, len); + if (!ptr->dev_comment) + break; + p_e = ptr->dev_comment + strlen(ptr->dev_comment); + sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle, + opttype, suffix); + xfree(optname); + } } } +#ifdef DO_FBDEV_PROBE /* Crude mechanism to auto-detect fbdev (os dependent) */ /* Skip it for now. Options list it anyway, and we can't - * determine which screen/driver this belongs too anyway. + * determine which screen/driver this belongs too anyway. */ { int fd; @@ -469,7 +513,7 @@ ptr->dev_option_lst = (XF86OptionPtr)xf86addListItem( (glp)ptr->dev_option_lst, (glp)fbdev); } - */ +#endif return ptr; } @@ -477,8 +521,6 @@ static XF86ConfLayoutPtr configureLayoutSection (void) { - pciVideoPtr xf86PciCard; - int i = 0; int scrnum = 0; parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec) @@ -540,9 +582,13 @@ static XF86ConfModesPtr configureModesSection (void) { +#ifdef NOTYET parsePrologue (XF86ConfModesPtr, XF86ConfModesRec) return ptr; +#else + return NULL; +#endif } static XF86ConfVideoAdaptorPtr @@ -574,6 +620,10 @@ "extensions", NULL }; + const char *fsubdirs[] = { + "fonts", + NULL + }; #endif parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec) @@ -593,6 +643,29 @@ } xfree(elist); } + + /* Process list of font backends separately to include only required ones */ + elist = LoaderListDirs(fsubdirs, NULL); + if (elist) { + for (el = elist; *el; el++) { + XF86LoadPtr module; + + module = xf86confmalloc(sizeof(XF86LoadRec)); + memset((XF86LoadPtr)module,0,sizeof(XF86LoadRec)); + module->load_name = *el; + + /* Add only those font backends which are referenced by fontpath */ + /* 'strstr(dFP,"/dir")' is meant as 'dFP =~ m(/dir\W)' */ + if (defaultFontPath && ( + (strcmp(*el, "type1") == 0 && + strstr(defaultFontPath, "/Type1")) || + (strcmp(*el, "speedo") == 0 && + strstr(defaultFontPath, "/Speedo")))) + ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem( + (glp)ptr->mod_load_lst, (glp)module); + } + xfree(elist); + } #endif return ptr; @@ -632,6 +705,11 @@ configureDDCMonitorSection (int screennum) { int i = 0; + int len, mon_width, mon_height; +#define displaySizeMaxLen 80 + char displaySize_string[displaySizeMaxLen]; + int displaySizeLen; + parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) ptr->mon_identifier = xf86confmalloc(19); @@ -640,6 +718,35 @@ ptr->mon_modelname = xf86confmalloc(12); sprintf(ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id); + /* features in centimetres, we want millimetres */ + mon_width = 10 * ConfiguredMonitor->features.hsize ; + mon_height = 10 * ConfiguredMonitor->features.vsize ; + +#ifdef CONFIGURE_DISPLAYSIZE + ptr->mon_width = mon_width; + ptr->mon_height = mon_height; +#else + if (mon_width && mon_height) { + /* when values available add DisplaySize option AS A COMMENT */ + + displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen, + "\t#DisplaySize\t%5d %5d\t# mm\n", + mon_width, mon_height); + + if (displaySizeLen>0 && displaySizeLenmon_comment) { + len = strlen(ptr->mon_comment); + } else { + len = 0; + } + if ((ptr->mon_comment = + xrealloc(ptr->mon_comment, len+strlen(displaySize_string)))) { + strcpy(ptr->mon_comment + len, displaySize_string); + } + } + } +#endif /* def CONFIGURE_DISPLAYSIZE */ + for (i=0;i<4;i++) { switch (ConfiguredMonitor->det_mon[i].type) { case DT: @@ -653,22 +760,16 @@ break; case DS_ASCII_STR: case DS_SERIAL: - break; case DS_RANGES: - ptr->mon_n_hsync = 1; - ptr->mon_hsync[0].lo = - ConfiguredMonitor->det_mon[i].section.ranges.min_h; - ptr->mon_hsync[0].hi = - ConfiguredMonitor->det_mon[i].section.ranges.max_h; - ptr->mon_n_vrefresh = 1; - ptr->mon_vrefresh[0].lo = - ConfiguredMonitor->det_mon[i].section.ranges.min_v; - ptr->mon_vrefresh[0].hi = - ConfiguredMonitor->det_mon[i].section.ranges.max_v; + default: break; } } + if (ConfiguredMonitor->features.dpms) { + ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, "DPMS", NULL); + } + return ptr; } @@ -749,9 +850,9 @@ xf86config->conf_modules = configureModuleSection(); xf86config->conf_flags = configureFlagsSection(); xf86config->conf_videoadaptor_lst = configureVideoAdaptorSection(); -/* xf86config->conf_modes_lst = configureModesSection(); */ + xf86config->conf_modes_lst = configureModesSection(); xf86config->conf_vendor_lst = configureVendorSection(); -/* xf86config->conf_dri = configureDRISection(); */ + xf86config->conf_dri = configureDRISection(); xf86config->conf_input_lst = configureInputSection(); xf86config->conf_layout_lst = configureLayoutSection(); @@ -761,6 +862,9 @@ #ifdef __EMX__ #define PATH_MAX 2048 #endif +#if defined(SCO) || defined(SCO325) +#define PATH_MAX 1024 +#endif const char* configfile = XF86CONFIGFILE".new"; char homebuf[PATH_MAX]; /* getenv might return R/O memory, as with OS/2 */ @@ -773,7 +877,12 @@ if (home[0] == '/' && home[1] == '\0') home[0] = '\0'; - sprintf(filename, "%s/%s", home,configfile); +#ifndef QNX4 + sprintf(filename, "%s/%s", home,configfile); +#else + sprintf(filename, "//%d%s/%s", getnid(),home,configfile); +#endif + } xf86writeConfigFile(filename, xf86config); @@ -877,17 +986,23 @@ ErrorF("\n"); +#ifdef SCO + ErrorF("\nXFree86 is using the kernel event driver to access the mouse.\n" + "If you wish to use the internal XFree86 mouse drivers, please\n" + "edit the file and correct the Device.\n"); +#else /* !SCO */ if (!foundMouse) { ErrorF("\nXFree86 is not able to detect your mouse.\n" "Edit the file and correct the Device.\n"); } else { -#ifndef __EMX__ /* OS/2 definitely has a mouse */ +#ifndef __EMX__ /* OS/2 definitely has a mouse */ ErrorF("\nXFree86 detected your mouse at device %s.\n" "Please check your config if the mouse is still not\n" "operational, as by default XFree86 tries to autodetect\n" "the protocol.\n",DFLT_MOUSE_DEV); #endif } +#endif /* !SCO */ if (xf86NumScreens > 1) { ErrorF("\nXFree86 has configured a multihead system, please check your config.\n"); Index: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.29 xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.32 --- xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.29 Tue May 8 23:12:01 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c Mon Jul 23 09:15:46 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.29 2001/05/09 03:12:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.32 2001/07/23 13:15:46 dawes Exp $ */ /* $XConsortium: xf86Cursor.c /main/10 1996/10/19 17:58:23 kaleb $ */ #define NEED_EVENTS @@ -182,47 +182,63 @@ void xf86ZoomViewport (ScreenPtr pScreen, int zoom) { - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); - Bool tmp; - int px, py; + ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + ScreenPtr pCursorScreen; + Bool tmp; + int px, py; if (pScr->zoomLocked) return; +#ifdef XFreeXDGA + if (DGAActive(pScr->scrnIndex)) + return; +#endif + + pCursorScreen = miPointerCurrentScreen(); + if (pScreen == pCursorScreen) + miPointerPosition(&px, &py); + if (pScr->SwitchMode != NULL && pScr->currentMode != pScr->currentMode->next) { pScr->currentMode = zoom > 0 ? pScr->currentMode->next : pScr->currentMode->prev; xf86EnterServerState(SETUP); - tmp = pScr->SwitchMode(pScr->scrnIndex, pScr->currentMode, 0); + tmp = (*pScr->SwitchMode)(pScr->scrnIndex, pScr->currentMode, 0); xf86EnterServerState(OPERATING); if (tmp) { /* * adjust new frame for the displaysize */ - pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 + 1 - - pScr->currentMode->HDisplay) / 2; + if (pScreen == pCursorScreen) + pScr->frameX0 = px - (pScr->currentMode->HDisplay / 2) + 1; + else + pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 + 1 - + pScr->currentMode->HDisplay) / 2; pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1; if (pScr->frameX0 < 0) { pScr->frameX0 = 0; - pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1; + pScr->frameX1 = pScr->currentMode->HDisplay - 1; } else if (pScr->frameX1 >= pScr->virtualX) { pScr->frameX0 = pScr->virtualX - pScr->currentMode->HDisplay; - pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1; + pScr->frameX1 = pScr->virtualX - 1; } - pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 + 1 - - pScr->currentMode->VDisplay) / 2; + if (pScreen == pCursorScreen) + pScr->frameY0 = py - (pScr->currentMode->VDisplay / 2) + 1; + else + pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 + 1 - + pScr->currentMode->VDisplay) / 2; pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1; if (pScr->frameY0 < 0) { pScr->frameY0 = 0; - pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1; + pScr->frameY1 = pScr->currentMode->VDisplay - 1; } else if (pScr->frameY1 >= pScr->virtualY) { pScr->frameY0 = pScr->virtualY - pScr->currentMode->VDisplay; - pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1; + pScr->frameY1 = pScr->virtualY - 1; } } else /* switch failed, so go back to old mode */ @@ -231,12 +247,10 @@ } if (pScr->AdjustFrame != NULL) - (pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); + (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); - if (pScreen == miPointerCurrentScreen()) { - miPointerPosition(&px, &py); + if (pScreen == pCursorScreen) xf86WarpCursor(pScreen, px, py); - } } @@ -621,7 +635,7 @@ minY = dixScreenOrigins[i].y; } - if (minX | minY) { + if (minX || minY) { for(i = 0; i < xf86NumScreens; i++) { dixScreenOrigins[i].x -= minX; dixScreenOrigins[i].y -= minY; Index: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.40 xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.43 --- xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.40 Sat Mar 3 20:29:03 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86DGA.c Sun Dec 16 13:30:22 2001 @@ -3,7 +3,7 @@ Written by Mark Vojkovich */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.40 2001/03/04 01:29:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.43 2001/12/16 18:30:22 keithp Exp $ */ #include "xf86.h" #include "xf86str.h" @@ -29,13 +29,6 @@ static void DGADestroyColormap(ColormapPtr pmap); static void DGAInstallColormap(ColormapPtr pmap); -static int -DGASetDGAMode( - int index, - int num, - DGADevicePtr devRet -); - static void DGACopyModeInfo( DGAModePtr mode, @@ -90,7 +83,7 @@ DGAScreenPtr pScreenPriv; int i; - if(!funcs->SetMode || !funcs->OpenFramebuffer) + if(!funcs || !funcs->SetMode || !funcs->OpenFramebuffer) return FALSE; if(!modes || num <= 0) @@ -137,7 +130,11 @@ pScreenPriv->InstallColormap = pScreen->InstallColormap; pScreen->InstallColormap = DGAInstallColormap; - pScrn->SetDGAMode = DGASetDGAMode; + /* + * This is now set in InitOutput(). + * + pScrn->SetDGAMode = xf86SetDGAMode; + */ return TRUE; } @@ -240,19 +237,27 @@ pScreen->InstallColormap = DGAInstallColormap; } -static int -DGASetDGAMode( +int +xf86SetDGAMode( int index, int num, DGADevicePtr devRet ){ ScreenPtr pScreen = screenInfo.screens[index]; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - ScrnInfoPtr pScrn = pScreenPriv->pScrn; + DGAScreenPtr pScreenPriv; + ScrnInfoPtr pScrn; DGADevicePtr device; PixmapPtr pPix = NULL; DGAModePtr pMode = NULL; + /* First check if DGAInit was successful on this screen */ + if (DGAScreenIndex < 0) + return BadValue; + pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + if (!pScreenPriv) + return BadValue; + pScrn = pScreenPriv->pScrn; + if(!num) { if(pScreenPriv->current) { PixmapPtr oldPix = pScreenPriv->current->pPix; @@ -265,12 +270,12 @@ xfree(pScreenPriv->current); pScreenPriv->current = NULL; pScrn->vtSema = TRUE; + (*pScreenPriv->funcs->SetMode)(pScrn, NULL); if(pScreenPriv->savedColormap) { (*pScreen->InstallColormap)(pScreenPriv->savedColormap); pScreenPriv->savedColormap = NULL; } pScreenPriv->dgaColormap = NULL; - (*pScreenPriv->funcs->SetMode)(pScrn, NULL); (*pScrn->EnableDisableFBAccess)(index, TRUE); FreeMarkedVisuals(pScreen); @@ -343,7 +348,7 @@ pScreenPriv->pixmapMode = FALSE; pScreenPriv->grabMouse = TRUE; pScreenPriv->grabKeyboard = TRUE; - + return Success; } @@ -458,30 +463,16 @@ void DGAShutdown() { - DGAScreenPtr pScreenPriv; - ScreenPtr pScreen; + ScrnInfoPtr pScrn; int i; if(DGAScreenIndex < 0) return; for(i = 0; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + pScrn = xf86Screens[i]; - if(pScreenPriv && pScreenPriv->current) { - PixmapPtr oldPix = pScreenPriv->current->pPix; - if(oldPix) { - if(oldPix->drawable.id) - FreeResource(oldPix->drawable.id, RT_NONE); - else - (*pScreen->DestroyPixmap)(oldPix); - } - xfree(pScreenPriv->current); - - (*pScreenPriv->funcs->SetMode)(pScreenPriv->pScrn, NULL); - pScreenPriv->pScrn->vtSema = TRUE; - } + (void)(*pScrn->SetDGAMode)(pScrn->scrnIndex, 0, NULL); } } @@ -1025,7 +1016,8 @@ { case ButtonPress: mouse->valuator->motionHintWindow = NullWindow; - butc->buttonsDown++; + if (!(*kptr & bit)) + butc->buttonsDown++; butc->motionMask = ButtonMotionMask; *kptr |= bit; if (key <= 5) @@ -1033,7 +1025,9 @@ break; case ButtonRelease: mouse->valuator->motionHintWindow = NullWindow; - if (!--butc->buttonsDown) + if (*kptr & bit) + --butc->buttonsDown; + if (!butc->buttonsDown) butc->motionMask = 0; *kptr &= ~bit; if (key == 0) Index: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.6 xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.7 --- xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.6 Thu May 10 06:17:39 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c Sat Oct 27 23:33:18 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.6 2001/05/10 10:17:39 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.7 2001/10/28 03:33:18 tsi Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -101,7 +101,7 @@ * the DPMS mode is to be changed. */ void -DPMSSet(CARD16 level) +DPMSSet(int level) { int i; DPMSPtr pDPMS; @@ -146,7 +146,6 @@ } -#if 0 /* * DPMSGet -- * Device dependent DPMS mode getting hook. This returns the current @@ -161,11 +160,10 @@ * 2. It isn't clear that this function is ever used or what it should * return. */ -CARD16 -DPMSGet(CARD16 *level) +int +DPMSGet(int *level) { return DPMSPowerLevel; } -#endif #endif /* DPMSExtension */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Debug.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Debug.c:1.3 xc/programs/Xserver/hw/xfree86/common/xf86Debug.c:1.4 --- xc/programs/Xserver/hw/xfree86/common/xf86Debug.c:1.3 Tue Sep 26 11:57:08 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Debug.c Thu Dec 13 13:01:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Debug.c,v 1.3 2000/09/26 15:57:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Debug.c,v 1.4 2001/12/13 18:01:50 eich Exp $ */ #include #include @@ -20,6 +20,72 @@ void xf86Break3(void) { } + +char *xf86p8bit[] = { "00000000", "00000001", "00000010", "00000011", + "00000100", "00000101", "00000110", "00000111", + "00001000", "00001001", "00001010", "00001011", + "00001100", "00001101", "00001110", "00001111", + "00010000", "00010001", "00010010", "00010011", + "00010100", "00010101", "00010110", "00010111", + "00011000", "00011001", "00011010", "00011011", + "00011100", "00011101", "00011110", "00011111", + "00100000", "00100001", "00100010", "00100011", + "00100100", "00100101", "00100110", "00100111", + "00101000", "00101001", "00101010", "00101011", + "00101100", "00101101", "00101110", "00101111", + "00110000", "00110001", "00110010", "00110011", + "00110100", "00110101", "00110110", "00110111", + "00111000", "00111001", "00111010", "00111011", + "00111100", "00111101", "00111110", "00111111", + "01000000", "01000001", "01000010", "01000011", + "01000100", "01000101", "01000110", "01000111", + "01001000", "01001001", "01001010", "01001011", + "01001100", "01001101", "01001110", "01001111", + "01010000", "01010001", "01010010", "01010011", + "01010100", "01010101", "01010110", "01010111", + "01011000", "01011001", "01011010", "01011011", + "01011100", "01011101", "01011110", "01011111", + "01100000", "01100001", "01100010", "01100011", + "01100100", "01100101", "01100110", "01100111", + "01101000", "01101001", "01101010", "01101011", + "01101100", "01101101", "01101110", "01101111", + "01110000", "01110001", "01110010", "01110011", + "01110100", "01110101", "01110110", "01110111", + "01111000", "01111001", "01111010", "01111011", + "01111100", "01111101", "01111110", "01111111", + "10000000", "10000001", "10000010", "10000011", + "10000100", "10000101", "10000110", "10000111", + "10001000", "10001001", "10001010", "10001011", + "10001100", "10001101", "10001110", "10001111", + "10010000", "10010001", "10010010", "10010011", + "10010100", "10010101", "10010110", "10010111", + "10011000", "10011001", "10011010", "10011011", + "10011100", "10011101", "10011110", "10011111", + "10100000", "10100001", "10100010", "10100011", + "10100100", "10100101", "10100110", "10100111", + "10101000", "10101001", "10101010", "10101011", + "10101100", "10101101", "10101110", "10101111", + "10110000", "10110001", "10110010", "10110011", + "10110100", "10110101", "10110110", "10110111", + "10111000", "10111001", "10111010", "10111011", + "10111100", "10111101", "10111110", "10111111", + "11000000", "11000001", "11000010", "11000011", + "11000100", "11000101", "11000110", "11000111", + "11001000", "11001001", "11001010", "11001011", + "11001100", "11001101", "11001110", "11001111", + "11010000", "11010001", "11010010", "11010011", + "11010100", "11010101", "11010110", "11010111", + "11011000", "11011001", "11011010", "11011011", + "11011100", "11011101", "11011110", "11011111", + "11100000", "11100001", "11100010", "11100011", + "11100100", "11100101", "11100110", "11100111", + "11101000", "11101001", "11101010", "11101011", + "11101100", "11101101", "11101110", "11101111", + "11110000", "11110001", "11110010", "11110011", + "11110100", "11110101", "11110110", "11110111", + "11111000", "11111001", "11111010", "11111011", + "11111100", "11111101", "11111110", "11111111" +}; CARD32 xf86DummyVar1; CARD32 xf86DummyVar2; Index: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.6 xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.7 --- xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.6 Thu Feb 15 13:20:33 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c Sat Oct 27 23:33:18 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.6 2001/02/15 18:20:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.7 2001/10/28 03:33:18 tsi Exp $ */ /* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at * modeline2c.pl */ @@ -22,75 +22,114 @@ DisplayModeRec xf86DefaultModes [] = { /* 640x350 @ 85Hz (VESA) hsync: 37.9kHz */ {MODEPREFIX("640x350"),31500, 640,672,736,832,0, 350,382,385,445,0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("320x175"),15750, 320,336,368,416,0, 175,191,192,222,0, V_PHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, /* 640x400 @ 85Hz (VESA) hsync: 37.9kHz */ {MODEPREFIX("640x400"),31500, 640,672,736,832,0, 400,401,404,445,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("320x200"),15750, 320,336,368,416,0, 200,200,202,222,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 720x400 @ 85Hz (VESA) hsync: 37.9kHz */ {MODEPREFIX("720x400"),35500, 720,756,828,936,0, 400,401,404,446,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("360x200"),17750, 360,378,414,468,0, 200,200,202,223,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */ {MODEPREFIX("640x480"),25200, 640,656,752,800,0, 480,490,492,525,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("320x240"),12600, 320,328,376,400,0, 240,245,246,262,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, /* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */ {MODEPREFIX("640x480"),31500, 640,664,704,832,0, 480,489,491,520,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("320x240"),15750, 320,332,352,416,0, 240,244,245,260,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, /* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */ {MODEPREFIX("640x480"),31500, 640,656,720,840,0, 480,481,484,500,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("320x240"),15750, 320,328,360,420,0, 240,240,242,250,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, /* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */ {MODEPREFIX("640x480"),36000, 640,696,752,832,0, 480,481,484,509,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("320x240"),18000, 320,348,376,416,0, 240,240,242,254,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, /* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */ {MODEPREFIX("800x600"),36000, 800,824,896,1024,0, 600,601,603,625,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("400x300"),18000, 400,412,448,512,0, 300,300,301,312,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */ {MODEPREFIX("800x600"),40000, 800,840,968,1056,0, 600,601,605,628,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("400x300"),20000, 400,420,484,528,0, 300,300,302,314,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */ {MODEPREFIX("800x600"),50000, 800,856,976,1040,0, 600,637,643,666,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("400x300"),25000, 400,428,488,520,0, 300,318,321,333,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */ {MODEPREFIX("800x600"),49500, 800,816,896,1056,0, 600,601,604,625,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("400x300"),24750, 400,408,448,528,0, 300,300,302,312,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */ {MODEPREFIX("800x600"),56300, 800,832,896,1048,0, 600,601,604,631,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("400x300"),28150, 400,416,448,524,0, 300,300,302,315,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */ {MODEPREFIX("1024x768"),44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, + {MODEPREFIX("512x384"),22450, 512,516,604,632,0, 384,384,388,408,0, V_PHSYNC | V_PVSYNC | V_INTERLACE | V_DBLSCAN, MODESUFFIX}, /* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */ {MODEPREFIX("1024x768"),65000, 1024,1048,1184,1344,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("512x384"),32500, 512,524,592,672,0, 384,385,388,403,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */ {MODEPREFIX("1024x768"),75000, 1024,1048,1184,1328,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("512x384"),37500, 512,524,592,664,0, 384,385,388,403,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */ {MODEPREFIX("1024x768"),78800, 1024,1040,1136,1312,0, 768,769,772,800,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("512x384"),39400, 512,520,568,656,0, 384,384,386,400,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */ {MODEPREFIX("1024x768"),94500, 1024,1072,1168,1376,0, 768,769,772,808,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("512x384"),47250, 512,536,584,688,0, 384,384,386,404,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */ {MODEPREFIX("1152x864"),108000, 1152,1216,1344,1600,0, 864,865,868,900,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("576x432"),54000, 576,608,672,800,0, 432,432,434,450,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1280x960 @ 60Hz (VESA) hsync: 60.0kHz */ {MODEPREFIX("1280x960"),108000, 1280,1376,1488,1800,0, 960,961,964,1000,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("640x480"),54000, 640,688,744,900,0, 480,480,482,500,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1280x960 @ 85Hz (VESA) hsync: 85.9kHz */ {MODEPREFIX("1280x960"),148500, 1280,1344,1504,1728,0, 960,961,964,1011,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("640x480"),74250, 640,672,752,864,0, 480,480,482,505,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz */ {MODEPREFIX("1280x1024"),108000, 1280,1328,1440,1688,0, 1024,1025,1028,1066,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("640x512"),54000, 640,664,720,844,0, 512,512,514,533,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz */ {MODEPREFIX("1280x1024"),135000, 1280,1296,1440,1688,0, 1024,1025,1028,1066,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("640x512"),67500, 640,648,720,844,0, 512,512,514,533,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz */ {MODEPREFIX("1280x1024"),157500, 1280,1344,1504,1728,0, 1024,1025,1028,1072,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("640x512"),78750, 640,672,752,864,0, 512,512,514,536,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz */ {MODEPREFIX("1600x1200"),162000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("800x600"),81000, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz */ {MODEPREFIX("1600x1200"),175500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("800x600"),87750, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz */ {MODEPREFIX("1600x1200"),189000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("800x600"),94500, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz */ {MODEPREFIX("1600x1200"),202500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("800x600"),101250, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz */ {MODEPREFIX("1600x1200"),229500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("800x600"),114750, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz */ {MODEPREFIX("1792x1344"),204800, 1792,1920,2120,2448,0, 1344,1345,1348,1394,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("896x672"),102400, 896,960,1060,1224,0, 672,672,674,697,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz */ {MODEPREFIX("1792x1344"),261000, 1792,1888,2104,2456,0, 1344,1345,1348,1417,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("896x672"),130500, 896,944,1052,1228,0, 672,672,674,708,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz */ {MODEPREFIX("1856x1392"),218300, 1856,1952,2176,2528,0, 1392,1393,1396,1439,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("928x696"),109150, 928,976,1088,1264,0, 696,696,698,719,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz */ {MODEPREFIX("1856x1392"),288000, 1856,1984,2208,2560,0, 1392,1393,1396,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("928x696"),144000, 928,992,1104,1280,0, 696,696,698,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, /* 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz */ {MODEPREFIX("1920x1440"),234000, 1920,2048,2256,2600,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, + {MODEPREFIX("960x720"),117000, 960,1024,1128,1300,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, 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}, + {MODEPREFIX("960x720"),148500, 960,1032,1144,1320,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, 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}, + {MODEPREFIX("700x525"),61000, 700,744,820,940,0, 525,526,532,541,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, 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("700x525"),77900, 700,732,892,956,0, 525,526,532,545,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, +/* 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz */ + {MODEPREFIX("1600x1024"),106910, 1600,1620,1640,1670,0, 1024,1027,1030,1067,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, + {MODEPREFIX("800x512"),53455, 800,810,820,835,0, 512,513,515,533,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, {MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX} }; Index: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c:1.9 xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c:1.10 --- xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c:1.9 Wed Mar 1 11:00:51 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c Sat Oct 27 23:33:18 2001 @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.9 2000/03/01 16:00:51 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.10 2001/10/28 03:33:18 tsi Exp $ */ /* * finish setting up the server * Load the driver modules and call their probe functions. @@ -55,6 +55,8 @@ for (i = 0; i < xf86NumDrivers; i++) { if (xf86DriverList[i]->Probe == NULL) continue; + xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", + xf86DriverList[i]->driverName); probeResult = (*xf86DriverList[i]->Probe)(xf86DriverList[i], PROBE_DETECT); ErrorF("Probe in driver `%s' returns %s\n", Index: xc/programs/Xserver/hw/xfree86/common/xf86Events.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.109 xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.124 --- xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.109 Fri May 18 12:03:10 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Events.c Fri Nov 30 07:11:54 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.109 2001/05/18 16:03:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.124 2001/11/30 12:11:54 eich Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -35,8 +35,8 @@ #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSlib.h" -#include "atKeynames.h" #include "Xpoll.h" +#include "atKeynames.h" #ifdef XFreeXDGA @@ -53,6 +53,11 @@ #include "mipointer.h" +#ifdef XF86BIGFONT +#define _XF86BIGFONT_SERVER_ +#include "xf86bigfont.h" +#endif + #ifdef XKB extern Bool noXkbExtension; #endif @@ -146,7 +151,7 @@ /* * TimeSinceLastInputEvent -- - * Function used for screensaver purposes by the os module. Retruns the + * Function used for screensaver purposes by the os module. Returns the * time in milliseconds since there last was any input. */ @@ -189,20 +194,6 @@ static int generation = 0; #endif -#ifdef AMOEBA -#define MAXEVENTS 32 -#define BUTTON_PRESS 0x1000 -#define MAP_BUTTON(ev,but) (((ev) == EV_ButtonPress) ? \ - ((but) | BUTTON_PRESS) : ((but) & ~BUTTON_PRESS)) -#define KEY_RELEASE 0x80 -#define MAP_KEY(ev, key) (((ev) == EV_KeyReleaseEvent) ? \ - ((key) | KEY_RELEASE) : ((key) & ~KEY_RELEASE)) - - register IOPEvent *e, *elast; - IOPEvent events[MAXEVENTS]; - int dx, dy, nevents; -#endif - /* * With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock * and ScrollLock will be set to match that of the VT the server is @@ -239,37 +230,6 @@ } #endif -#ifdef AMOEBA - /* - * Get all events from the IOP server - */ - while ((nevents = AmoebaGetEvents(events, MAXEVENTS)) > 0) { - for (e = &events[0], elast = &events[nevents]; e < elast; e++) { - xf86Info.lastEventTime = e->time; - switch (e->type) { - case EV_PointerDelta: - if (e->x != 0 || e->y != 0) { - xf86PostMseEvent(&xf86Info.pMouse, 0, e->x, e->y); - } - break; - case EV_ButtonPress: - case EV_ButtonRelease: - xf86PostMseEvent(&xf86Info.pMouse, MAP_BUTTON(e->type, e->keyorbut), 0, 0); - break; - case EV_KeyPressEvent: - case EV_KeyReleaseEvent: - xf86PostKbdEvent(MAP_KEY(e->type, e->keyorbut)); - break; - default: - /* this shouldn't happen */ - ErrorF("stray event %d (%d,%d) %x\n", - e->type, e->x, e->y, e->keyorbut); - break; - } - } - } -#endif - xf86Info.inputPending = FALSE; #ifdef XINPUT @@ -283,7 +243,14 @@ xf86SetViewport(xf86Info.currentScreen, x, y); } +void +xf86GrabServerCallback(CallbackListPtr *callbacks, pointer data, pointer args) +{ + ServerGrabInfoRec *grab = (ServerGrabInfoRec*)args; + xf86Info.grabInfo.server.client = grab->client; + xf86Info.grabInfo.server.grabstate = grab->grabstate; +} /* * xf86PostKbdEvent -- @@ -301,8 +268,7 @@ #if !defined(__EMX__) && \ !defined(__SOL8__) && \ - (!defined(sun) || defined(i386)) && \ - !defined(__CYGWIN__) + (!defined(sun) || defined(i386)) void xf86PostKbdEvent(unsigned key) { @@ -317,14 +283,14 @@ KeySym *keysym; int keycode; static int lockkeys = 0; -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) +#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) static Bool first_time = TRUE; #endif #if defined(__sparc__) static int kbdSun = -1; #endif -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) +#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) if (first_time) { first_time = FALSE; @@ -379,13 +345,13 @@ switch (scanCode) { case KEY_Prefix0: case KEY_Prefix1: -#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) +#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { #endif xf86Info.scanPrefix = scanCode; /* special prefixes */ return; -#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) +#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) } break; #endif @@ -434,7 +400,7 @@ case 0x36: return; default: - xf86MsgVerb(X_INFO, 2, "Unreported Prefix0 scancode: 0x%02x\n", + xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n", scanCode); /* * "Internet" keyboards are generating lots of new codes. Let them @@ -464,12 +430,18 @@ specialkey = scanCode; +#ifdef __linux__ customkeycodes: +#endif +#if defined(i386) || defined(__i386__) if (xf86IsPc98()) { switch (scanCode) { case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */ case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */ + + /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ + case 0x62: specialkey = 0x3b; break; /* KEY_F1 */ case 0x63: specialkey = 0x3c; break; /* KEY_F2 */ case 0x64: specialkey = 0x3d; break; /* KEY_F3 */ @@ -485,7 +457,7 @@ default: specialkey = 0x00; break; } } - +#endif #if defined (__sparc__) special: if (kbdSun) { @@ -493,6 +465,9 @@ case 0x2b: specialkey = KEY_BackSpace; break; case 0x47: specialkey = KEY_KP_Minus; break; case 0x7d: specialkey = KEY_KP_Plus; break; + + /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ + case 0x05: specialkey = KEY_F1; break; case 0x06: specialkey = KEY_F2; break; case 0x08: specialkey = KEY_F3; break; @@ -533,6 +508,45 @@ GiveUp(0); } break; + + /* + * Check grabs + */ + case KEY_KP_Divide: + if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) { + if (inputInfo.pointer && inputInfo.pointer->grab != NULL && + inputInfo.pointer->DeactivateGrab) + inputInfo.pointer->DeactivateGrab(inputInfo.pointer); + if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL && + inputInfo.keyboard->DeactivateGrab) + inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard); + } + break; + case KEY_KP_Multiply: + if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowClosedown) { + ClientPtr pointer, keyboard, server; + + pointer = keyboard = server = NULL; + if (inputInfo.pointer && inputInfo.pointer->grab != NULL) + pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)]; + if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) { + keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)]; + if (keyboard == pointer) + keyboard = NULL; + } + if ((xf86Info.grabInfo.server.grabstate == SERVER_GRABBED) && + (((server = xf86Info.grabInfo.server.client) == pointer) || + (server == keyboard))) + server = NULL; + + if (pointer) + CloseDownClient(pointer); + if (keyboard) + CloseDownClient(keyboard); + if (server) + CloseDownClient(server); + } + break; /* * The idea here is to pass the scancode down to a list of @@ -575,7 +589,7 @@ break; #endif -#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT))) || defined(SCO) +#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(SCO) /* * Under Linux, the raw keycodes are consumed before the kernel * does any processing on them, so we must emulate the vt switching @@ -592,7 +606,7 @@ case KEY_F9: case KEY_F10: if (VTSwitchEnabled && !xf86Info.vtSysreq -#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT))) +#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) #endif ) @@ -609,7 +623,7 @@ case KEY_F11: case KEY_F12: if (VTSwitchEnabled && !xf86Info.vtSysreq -#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT))) +#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) #endif ) @@ -861,11 +875,7 @@ */ 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 @@ -877,7 +887,7 @@ UsePrefix = TRUE; Direction = TRUE; } -#endif /* !CSRG_BASED && !MACH386 && !MINIX && !__OSF__ */ +#endif /* !CSRG_BASED && ... */ } } if (updateLeds) xf86KbdLeds(); @@ -922,8 +932,6 @@ #endif /* !__EMX__ */ -#ifndef AMOEBA - /* * xf86Wakeup -- * Os wakeup handler. @@ -933,11 +941,7 @@ void xf86Wakeup(pointer blockData, int err, pointer pReadmask) { -#if !defined(__EMX__) && !defined(__QNX__) && !defined(__CYGWIN__) -#ifdef __OSF__ - fd_set kbdDevices; - fd_set mseDevices; -#endif /* __OSF__ */ +#if !defined(__EMX__) && !defined(__QNX__) fd_set* LastSelectMask = (fd_set*)pReadmask; fd_set devicesWithInput; InputInfoPtr pInfo; @@ -945,7 +949,6 @@ if (err >= 0) { XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices); -#ifndef __OSF__ if (XFD_ANYSET(&devicesWithInput)) { (xf86Info.kbdEvents)(); pInfo = xf86InputDevs; @@ -965,25 +968,6 @@ pInfo = pInfo->next; } } -#else /* __OSF__ */ - /* - * Until the two devices are made nonblock on read, we have to do this. - */ - MASKANDSETBITS(devicesWithInput, pReadmask, EnabledDevices); - - CLEARBITS(kbdDevices); - BITSET(kbdDevices, xf86Info.consoleFd); - MASKANDSETBITS(kbdDevices, kbdDevices, devicesWithInput); - - CLEARBITS(mseDevices); - BITSET(mseDevices, xf86Info.mouseDev->mseFd); - MASKANDSETBITS(mseDevices, mseDevices, devicesWithInput); - - if (ANYSET(kbdDevices) || xf86Info.kbdRate) - (xf86Info.kbdEvents)(ANYSET(kbdDevices)); - if (ANYSET(mseDevices)) - (xf86Info.mouseDev->mseEvents)(1); -#endif /* __OSF__ */ } #else /* __EMX__ and __QNX__ */ @@ -1025,7 +1009,6 @@ if (xf86Info.inputPending) ProcessInputEvents(); } -#endif /* AMOEBA */ /* * xf86SigioReadInput -- @@ -1136,12 +1119,13 @@ if (!(dispatchException & DE_TERMINATE)) if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); - } - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) { - xf86Screens[i]->LeaveVT(i, 0); } -#if !defined(__EMX__) && !defined(__CYGWIN__) +#if !defined(__EMX__) + + /* + * Keep the order: Disable Device > LeaveVT + * EnterVT > EnableDevice + */ DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { @@ -1149,6 +1133,10 @@ pInfo = pInfo->next; } #endif /* !__EMX__ */ + xf86EnterServerState(SETUP); + for (i = 0; i < xf86NumScreens; i++) { + xf86Screens[i]->LeaveVT(i, 0); + } for (ih = InputHandlers; ih; ih = ih->next) xf86DisableInputHandler(ih); xf86AccessLeave(); /* We need this here, otherwise */ @@ -1177,7 +1165,7 @@ } SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); -#if !defined(__EMX__) && !defined(__CYGWIN__) +#if !defined(__EMX__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { @@ -1228,7 +1216,7 @@ /* Turn screen saver off when switching back */ SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); -#if !defined(__EMX__) && !defined(__CYGWIN__) +#if !defined(__EMX__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); pInfo = xf86InputDevs; while (pInfo) { @@ -1236,6 +1224,7 @@ pInfo = pInfo->next; } #endif /* !__EMX__ */ + for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); } @@ -1393,34 +1382,23 @@ /* XXX Currently XKB is mandatory. */ +extern int WSKbdToKeycode(int); + void xf86PostWSKbdEvent(struct wscons_event *event) { - int type = event->type; - int value = event->value; - Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); - KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; - xEvent kevent; - KeySym *keysym; - int keycode; - - /* - * Now map the scancodes to real X-keycodes ... - */ - keycode = value + MIN_KEYCODE; - keysym = keyc->curKeySyms.map + - keyc->curKeySyms.mapWidth * (keycode - keyc->curKeySyms.minKeyCode); - - /* - * check for an autorepeat-event - */ - if ((down && KeyPressed(keycode)) && - (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode])) - return; - - xf86Info.lastEventTime = kevent.u.keyButtonPointer.time - = event->time.tv_sec * 1000 + event->time.tv_nsec / 1000000; - - ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); + int type = event->type; + int value = event->value; + Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); + unsigned int keycode; + int blocked; + + /* map the scancodes to standard XFree86 scancode */ + keycode = WSKbdToKeycode(value); + if (!down) keycode |= 0x80; + /* It seems better to block SIGIO there */ + blocked = xf86BlockSIGIO(); + xf86PostKbdEvent(keycode); + xf86UnblockSIGIO(blocked); } #endif /* WSCONS_SUPPORT */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.32 xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.36 --- xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.32 Fri May 18 12:03:11 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Globals.c Fri Nov 30 07:11:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.32 2001/05/18 16:03:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.36 2001/11/30 12:11:55 eich Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -92,6 +92,9 @@ #if defined(SVR4) && defined(i386) FALSE, /* panix106 */ #endif +#if defined(__OpenBSD__) || defined(__NetBSD__) + 0, /* wskbdType */ +#endif NULL, /* pMouse */ #ifdef XINPUT NULL, /* mouseLocal */ @@ -109,9 +112,6 @@ -1, /* screenFd */ -1, /* consType */ #endif -#ifdef AMOEBA - NULL, /* screenPtr */ -#endif #ifdef XKB NULL, /* xkbkeymap */ NULL, /* xkbkeycodes */ @@ -138,6 +138,7 @@ FALSE, /* pc98 */ #endif TRUE, /* pmFlag */ + FALSE, /* syncLog */ 0, /* estimateSizesAggressively */ FALSE /* kbdCustomKeycodes */ }; @@ -146,6 +147,7 @@ MessageType xf86ModPathFrom = X_DEFAULT; const char *xf86LogFile = DEFAULT_LOGPREFIX; MessageType xf86LogFileFrom = X_DEFAULT; +Bool xf86LogFileWasOpened = FALSE; serverLayoutRec xf86ConfigLayout = {NULL, }; confDRIRec xf86ConfigDRI = {0, }; XF86ConfigPtr xf86configptr = NULL; Index: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.111.2.1 xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.120 --- xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.111.2.1 Thu May 24 15:43:39 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Helper.c Tue Dec 4 12:28:58 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.111.2.1 2001/05/24 19:43:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.120 2001/12/04 17:28:58 tsi Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -31,7 +31,7 @@ #include "xf86Bus.h" /* For xf86GetClocks */ -#if defined(CSRG_BASED) || defined(MACH386) || defined(__GNU__) +#if defined(CSRG_BASED) || defined(__GNU__) #define HAS_SETPRIORITY #include #endif @@ -880,7 +880,7 @@ /* * Set the DPI from the command line option. XXX should allow it to be - * calculated from the witdhmm/heightmm values. + * calculated from the widthmm/heightmm values. */ #undef MMPERINCH @@ -891,11 +891,23 @@ { MessageType from = X_DEFAULT; xf86MonPtr DDC = (xf86MonPtr)(pScrn->monitor->DDC); + int ddcWidthmm, ddcHeightmm; + int widthErr, heightErr; /* XXX Maybe there is no need for widthmm/heightmm in ScrnInfoRec */ pScrn->widthmm = pScrn->monitor->widthmm; pScrn->heightmm = pScrn->monitor->heightmm; + if (DDC && (DDC->features.hsize > 0 && DDC->features.vsize > 0) ) { + /* DDC gives display size in mm for individual modes, + * but cm for monitor + */ + ddcWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */ + ddcHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */ + } else { + ddcWidthmm = ddcHeightmm = 0; + } + if (monitorResolution > 0) { pScrn->xDpi = monitorResolution; pScrn->yDpi = monitorResolution; @@ -916,15 +928,32 @@ pScrn->xDpi = pScrn->yDpi; xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n", pScrn->widthmm, pScrn->heightmm); - } else if ( DDC && (DDC->features.hsize > 0 || DDC->features.vsize > 0) ) { + + /* Warn if config and probe disagree about display size */ + if ( ddcWidthmm && ddcHeightmm ) { + if (pScrn->widthmm > 0) { + widthErr = abs(ddcWidthmm - pScrn->widthmm); + } else { + widthErr = 0; + } + if (pScrn->heightmm > 0) { + heightErr = abs(ddcHeightmm - pScrn->heightmm); + } else { + heightErr = 0; + } + if (widthErr>10 || heightErr>10) { + /* Should include config file name for monitor here */ + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Probed monitor is %dx%d mm, using Displaysize %dx%d mm\n", + ddcWidthmm,ddcHeightmm, pScrn->widthmm,pScrn->heightmm); + } + } + } else if ( ddcWidthmm && ddcHeightmm ) { from = X_PROBED; - /* DDC gives display size in mm for individual modes, - * but cm for monitor - */ - xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) cm\n", - DDC->features.hsize, DDC->features.vsize ); - pScrn->widthmm = DDC->features.hsize * 10; /* 10mm in 1cm */ - pScrn->heightmm = DDC->features.vsize * 10; /* 10mm in 1cm */ + xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n", + ddcWidthmm, ddcHeightmm ); + pScrn->widthmm = ddcWidthmm; + pScrn->heightmm = ddcHeightmm; if (pScrn->widthmm > 0) { pScrn->xDpi = (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm); @@ -1182,9 +1211,11 @@ if ((verb < 0 || xf86Verbose >= verb) && len > 0) fwrite(buffer, len, 1, stderr); if ((verb < 0 || xf86LogVerbose >= verb) && len > 0) { - if (logfile) + if (logfile) { fwrite(buffer, len, 1, logfile); - else { + if (xf86Info.syncLog) + fflush(logfile); + } else { /* * Note, this code is used before OsInit() has been called, so * xalloc and friends can't be used. @@ -1220,7 +1251,7 @@ va_list args) { char *s = X_UNKNOWN_STRING; - + /* Ignore verbosity for X_ERROR */ if (xf86Verbose >= verb || xf86LogVerbose >= verb || type == X_ERROR) { switch (type) { @@ -1367,6 +1398,7 @@ } if ((logfile = fopen(xf86LogFile, "w")) == NULL) FatalError("Cannot open log file \"%s\"\n", xf86LogFile); + xf86LogFileWasOpened = TRUE; setvbuf(logfile, NULL, _IONBF, 0); #ifdef DDXOSVERRORF if (!OsVendorVErrorFProc) @@ -1376,6 +1408,8 @@ /* Flush saved log information */ if (saveBuffer && size > 0) { fwrite(saveBuffer, pos, 1, logfile); + if (xf86Info.syncLog) + fflush(logfile); free(saveBuffer); /* Note, must be free(), not xfree() */ saveBuffer = 0; size = 0; @@ -1940,6 +1974,10 @@ *foundEntities = NULL; +#if defined(__sparc__) || defined(__powerpc__) + FindIsaDevice = NULL; /* Temporary */ +#endif + if (xf86DoProbe || (xf86DoConfigure && xf86DoConfigurePass1)) { if (FindIsaDevice && ((foundChip = (*FindIsaDevice)(NULL)) != -1)) { @@ -2413,6 +2451,30 @@ va_start(ap, sym0); LoaderVReqSymbols(sym0, ap); + va_end(ap); +#endif +} + +void +xf86LoaderRefSymLists(const char **list0, ...) +{ +#ifdef XFree86LOADER + va_list ap; + + va_start(ap, list0); + LoaderVRefSymLists(list0, ap); + va_end(ap); +#endif +} + +void +xf86LoaderRefSymbols(const char *sym0, ...) +{ +#ifdef XFree86LOADER + va_list ap; + + va_start(ap, sym0); + LoaderVRefSymbols(sym0, ap); va_end(ap); #endif } Index: xc/programs/Xserver/hw/xfree86/common/xf86Init.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.176.2.1 xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.185 --- xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.176.2.1 Thu May 24 15:43:39 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Init.c Mon Jan 14 20:56:56 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.176.2.1 2001/05/24 19:43:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.185 2002/01/15 01:56:56 dawes Exp $ */ /* * Copyright 1991-1999 by The XFree86 Project, Inc. @@ -8,11 +8,7 @@ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. */ -#ifndef X_NOT_STDC_ENV #include -#else -extern int atoi(); -#endif #define NEED_EVENTS #include "X.h" @@ -61,6 +57,7 @@ /* forward declarations */ static void xf86PrintBanner(void); +static void xf86PrintMarkers(void); static void xf86RunVtInit(void); #ifdef DO_CHECK_BETA @@ -241,6 +238,7 @@ #endif xf86PrintBanner(); + xf86PrintMarkers(); { time_t t; const char *ct; @@ -603,13 +601,6 @@ xf86DeleteDriver(i); #endif -#ifdef XFree86LOADER - if (LoaderCheckUnresolved(LD_RESOLV_IFDONE)) { - /* For now, just a warning */ - xf86Msg(X_WARNING, "Some symbols could not be resolved!\n"); - } -#endif - /* * At this stage we know how many screens there are. */ @@ -726,6 +717,8 @@ #endif /* set up the proper access funcs */ xf86PostPreInit(); + + AddCallback(&ServerGrabCallback, xf86GrabServerCallback, NULL); } else { /* @@ -818,10 +811,11 @@ for (i = 0; i < xf86NumScreens; i++) { xf86EnableAccess(xf86Screens[i]); /* - * Almost everything uses this default, and many of those that - * don't, will wrap it. + * Almost everything uses these defaults, and many of those that + * don't, will wrap them. */ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; + xf86Screens[i]->SetDGAMode = xf86SetDGAMode; scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv); if (scr_index == i) { /* @@ -858,6 +852,14 @@ if (!xf86Info.sharedMonitor) (xf86Screens[i]->EnterLeaveMonitor)(ENTER); #endif } + +#ifdef XFree86LOADER + if ((serverGeneration == 1) && LoaderCheckUnresolved(LD_RESOLV_IFDONE)) { + /* For now, just a warning */ + xf86Msg(X_WARNING, "Some symbols could not be resolved!\n"); + } +#endif + xf86PostScreenInit(); xf86InitOrigins(); @@ -865,10 +867,8 @@ xf86Resetting = FALSE; xf86Initialising = FALSE; -#ifndef AMOEBA RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup, NULL); -#endif } @@ -888,9 +888,7 @@ /* * InitInput -- - * Initialize all supported input devices...what else is there - * besides pointer and keyboard? Two DeviceRec's are allocated and - * registered as the system pointer and keyboard devices. + * Initialize all supported input devices. */ void @@ -1009,6 +1007,10 @@ #endif } +#ifndef SET_STDERR_NONBLOCKING +#define SET_STDERR_NONBLOCKING 1 +#endif + /* * OsVendorInit -- * OS/Vendor-specific initialisations. Called from OsInit(), which @@ -1032,6 +1034,33 @@ if (!beenHere) xf86LogInit(); +#if SET_STDERR_NONBLOCKING + /* Set stderr to non-blocking. */ +#ifndef O_NONBLOCK +#if defined(FNDELAY) +#define O_NONBLOCK FNDELAY +#elif defined(O_NDELAY) +#define O_NONBLOCK O_NDELAY +#endif +#endif + +#ifdef O_NONBLOCK + if (!beenHere) { +#if !defined(__EMX__) + if (geteuid() == 0 && getuid() != geteuid()) +#endif + { + int status; + + status = fcntl(fileno(stderr), F_GETFL, 0); + if (status != -1) { + fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK); + } + } + } +#endif +#endif + beenHere = TRUE; } @@ -1121,7 +1150,7 @@ { ErrorF("\nWhen reporting a problem related to a server crash, please send\n" "the full server output, not just the last messages.\n"); - if (xf86LogFile) + if (xf86LogFile && xf86LogFileWasOpened) ErrorF("This can be found in the log file \"%s\".\n", xf86LogFile); ErrorF("Please report problems to %s.\n",BUILDERADDR); ErrorF("\n"); @@ -1590,7 +1619,7 @@ 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"); + "\treporting problems. (See http://www.XFree86.Org/)\n"); ErrorF("Build Operating System:%s%s\n", OSNAME, OSVENDOR); #if defined(BUILDERSTRING) ErrorF("%s \n",BUILDERSTRING); @@ -1601,9 +1630,24 @@ } static void +xf86PrintMarkers() +{ + /* Show what the marker symbols mean */ + ErrorF("Markers: " X_PROBE_STRING " probed, " + X_CONFIG_STRING " from config file, " + X_DEFAULT_STRING " default setting,\n" + " " X_CMDLINE_STRING " from command line, " + X_NOTICE_STRING " notice, " + X_INFO_STRING " informational,\n" + " " X_WARNING_STRING " warning, " + X_ERROR_STRING " error, " + X_NOT_IMPLEMENTED_STRING " not implemented, " + X_UNKNOWN_STRING " unknown.\n"); +} + +static void xf86RunVtInit(void) { -#if !defined(AMOEBA) && !defined(MINIX) int i; /* @@ -1633,7 +1677,6 @@ wait(NULL); } } -#endif /* !AMOEBA && !MINIX */ } #ifdef XFree86LOADER Index: xc/programs/Xserver/hw/xfree86/common/xf86Io.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.42 xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.46 --- xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.42 Fri Apr 20 12:32:30 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Io.c Thu Nov 8 16:49:43 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.42 2001/04/20 16:32:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.46 2001/11/08 21:49:43 herrb Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -71,18 +71,6 @@ xf86SoundKbdBell(percent, xf86Info.bell_pitch, xf86Info.bell_duration); } -#ifdef AMOEBA -#define LED_CAP IOP_LED_CAP -#define LED_NUM IOP_LED_NUM -#define LED_SCR IOP_LED_SCROLL -#endif - -#ifdef MINIX -#define LED_CAP KBD_LEDS_CAPS -#define LED_NUM KBD_LEDS_NUM -#define LED_SCR KBD_LEDS_SCROLL -#endif - void xf86KbdLeds () { @@ -155,7 +143,6 @@ KeyClassRec *keyc = xf86Info.pKeyboard->key; KeySym *map = keyc->curKeySyms.map; -#ifndef MACH386 kevent.u.keyButtonPointer.time = GetTimeInMillis(); kevent.u.keyButtonPointer.rootX = 0; kevent.u.keyButtonPointer.rootY = 0; @@ -189,7 +176,6 @@ (* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1); } } -#endif /* MACH386 */ xf86Info.scanPrefix = 0; @@ -369,7 +355,7 @@ read(kbdFd, buf, 16); } -#if !defined(__EMX__) && !defined(__CYGWIN__) /* Under EMX, keyboard cannot be select()'ed */ +#if !defined(__EMX__) /* Under EMX, keyboard cannot be select()'ed */ if (kbdFd != -1) AddEnabledDevice(kbdFd); #endif /* __EMX__ */ @@ -401,46 +387,31 @@ * These are getting tossed in here until I can think of where * they really belong */ +#define HALFMONTH ((unsigned long) 1<<31) CARD32 GetTimeInMillis() { struct timeval tp; + register CARD32 val; + static CARD32 oldval = 0; + static CARD32 skew = 0; gettimeofday(&tp, 0); - return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); + val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000) + skew; + /* On some systems the clock is not monothonic */ + if ((val < oldval) && ((oldval - val) < HALFMONTH)) { + /* if clock is not monothonic find out clock skew skew */ + xf86MsgVerb(X_WARNING,4,"System time not monotonic!\n"); + skew += oldval - val; + val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000) + skew; + } else if (skew && ((val - oldval) < HALFMONTH)) { + /* try to reduce skew */ + INT32 diff = skew - (val - oldval); + skew = diff < 0 ? 0 : diff; + val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000) + skew; + } + oldval = val; + return val; } #endif /* DDXTIME && !QNX4 */ -#ifdef WSCONS_SUPPORT - -#define NUMEVENTS 64 - -static void -wsconssig(fd, closure) - int fd; - void *closure; -{ - static struct wscons_event events[NUMEVENTS]; - int n, i; - - n = read(fd, events, sizeof events); - if (n <= 0) - return; - n /= sizeof(struct wscons_event); - for (i = 0; i < n; i++) - xf86PostWSKbdEvent(&events[i]); -} - -int -xf86WSKbdProc(pKeyboard, what) - DeviceIntPtr pKeyboard; /* Keyboard to manipulate */ - int what; /* What to do to it */ -{ - switch (what) { - case DEVICE_INIT: - xf86FlushInput(xf86Info.kbdFd); - xf86InstallSIGIOHandler(xf86Info.kbdFd, wsconssig, pKeyboard); - } - return xf86KbdProc(pKeyboard, what); -} -#endif /* WSCONS_SUPPORT */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c:3.20 xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c:3.23 --- xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c:3.20 Sun Dec 26 19:39:43 1999 +++ xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c Sat Oct 27 23:33:19 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.20 1999/12/27 00:39:43 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.23 2001/10/28 03:33:19 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -38,22 +38,21 @@ #include "xf86Keymap.h" -#define KD_GET_ENTRY(i,n) \ - eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] - #if defined(KDGKBTYPE) && \ - !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && \ - !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && \ + !defined(Lynx) && \ + !defined(__EMX__) && !defined(__mips__) && \ !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__) #define HAS_GETKBTYPE #endif #if defined(GIO_KEYMAP) && \ - !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && \ - !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && \ + !defined(Lynx) && \ + !defined(__EMX__) && !defined(__mips__) && \ !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \ !defined(__QNX__) #define HAS_GETKEYMAP -#endif + +#define KD_GET_ENTRY(i,n) \ + eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] /* * NOTE: Not all possible remappable symbols are remapped. There are two main @@ -223,6 +222,7 @@ NoSymbol, NoSymbol, NoSymbol, NoSymbol, }; +#endif /* HAS_GETKEYMAP */ /* * LegalModifier -- @@ -256,11 +256,12 @@ #ifdef HAS_GETKEYMAP keymap_t keymap; #endif - char type; int i; KeySym *pMap; - + #ifdef HAS_GETKBTYPE + char type; + xf86Info.kbdType = ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101; if (xf86Info.kbdType == KB_84) @@ -268,7 +269,10 @@ else pMap = map; #else +/* OS/2 sets the keyboard type during xf86OpenKbd */ +#ifndef __EMX__ xf86Info.kbdType = 0; +#endif pMap = map; #endif @@ -349,17 +353,6 @@ } -#ifdef HAS_GETKBTYPE - xf86Info.kbdType = - ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101; -#else -/* OS/2 sets the keyboard type during xf86OpenKbd */ -#ifndef __EMX__ - xf86Info.kbdType = 0; -#endif -#endif - - pKeySyms->map = pMap; pKeySyms->mapWidth = GLYPHS_PER_KEY; pKeySyms->minKeyCode = MIN_KEYCODE; Index: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.15 xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.18 --- xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.15 Thu Mar 8 18:23:32 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c Sun Oct 21 08:30:38 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.15 2001/03/08 23:23:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.18 2001/10/21 12:30:38 herrb Exp $ */ /* * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -37,6 +37,7 @@ #include "atKeynames.h" #include "xf86Keymap.h" +#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP) #define KD_GET_ENTRY(i,n) \ eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] @@ -357,6 +358,7 @@ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis }; #endif +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ /* * LegalModifier -- * determine whether a key is a legal modifier key, i.e send a @@ -587,3 +589,505 @@ } +#ifdef WSCONS_SUPPORT +#include "atKeynames.h" + +static CARD8 wsUsbMap[] = { + /* 0 */ KEY_NOTUSED, + /* 1 */ KEY_NOTUSED, + /* 2 */ KEY_NOTUSED, + /* 3 */ KEY_NOTUSED, + /* 4 */ KEY_A, + /* 5 */ KEY_B, + /* 6 */ KEY_C, + /* 7 */ KEY_D, + /* 8 */ KEY_E, + /* 9 */ KEY_F, + /* 10 */ KEY_G, + /* 11 */ KEY_H, + /* 12 */ KEY_I, + /* 13 */ KEY_J, + /* 14 */ KEY_K, + /* 15 */ KEY_L, + /* 16 */ KEY_M, + /* 17 */ KEY_N, + /* 18 */ KEY_O, + /* 19 */ KEY_P, + /* 20 */ KEY_Q, + /* 21 */ KEY_R, + /* 22 */ KEY_S, + /* 23 */ KEY_T, + /* 24 */ KEY_U, + /* 25 */ KEY_V, + /* 26 */ KEY_W, + /* 27 */ KEY_X, + /* 28 */ KEY_Y, + /* 29 */ KEY_Z, + /* 30 */ KEY_1, /* 1 !*/ + /* 31 */ KEY_2, /* 2 @ */ + /* 32 */ KEY_3, /* 3 # */ + /* 33 */ KEY_4, /* 4 $ */ + /* 34 */ KEY_5, /* 5 % */ + /* 35 */ KEY_6, /* 6 ^ */ + /* 36 */ KEY_7, /* 7 & */ + /* 37 */ KEY_8, /* 8 * */ + /* 38 */ KEY_9, /* 9 ( */ + /* 39 */ KEY_0, /* 0 ) */ + /* 40 */ KEY_Enter, /* Return */ + /* 41 */ KEY_Escape, /* Escape */ + /* 42 */ KEY_BackSpace, /* Backspace Delete */ + /* 43 */ KEY_Tab, /* Tab */ + /* 44 */ KEY_Space, /* Space */ + /* 45 */ KEY_Minus, /* - _ */ + /* 46 */ KEY_Equal, /* = + */ + /* 47 */ KEY_LBrace, /* [ { */ + /* 48 */ KEY_RBrace, /* ] } */ + /* 49 */ KEY_BSlash, /* \ | */ + /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */ + /* 51 */ KEY_SemiColon, /* ; : */ + /* 52 */ KEY_Quote, /* ' " */ + /* 53 */ KEY_Tilde, /* ` ~ */ + /* 54 */ KEY_Comma, /* , < */ + /* 55 */ KEY_Period, /* . > */ + /* 56 */ KEY_Slash, /* / ? */ + /* 57 */ KEY_CapsLock, /* Caps Lock */ + /* 58 */ KEY_F1, /* F1 */ + /* 59 */ KEY_F2, /* F2 */ + /* 60 */ KEY_F3, /* F3 */ + /* 61 */ KEY_F4, /* F4 */ + /* 62 */ KEY_F5, /* F5 */ + /* 63 */ KEY_F6, /* F6 */ + /* 64 */ KEY_F7, /* F7 */ + /* 65 */ KEY_F8, /* F8 */ + /* 66 */ KEY_F9, /* F9 */ + /* 67 */ KEY_F10, /* F10 */ + /* 68 */ KEY_F11, /* F11 */ + /* 69 */ KEY_F12, /* F12 */ + /* 70 */ KEY_Print, /* PrintScrn SysReq */ + /* 71 */ KEY_ScrollLock, /* Scroll Lock */ + /* 72 */ KEY_Pause, /* Pause Break */ + /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */ + /* 74 */ KEY_Home, /* Home */ + /* 75 */ KEY_PgUp, /* Page Up */ + /* 76 */ KEY_Delete, /* Delete */ + /* 77 */ KEY_End, /* End */ + /* 78 */ KEY_PgDown, /* Page Down */ + /* 79 */ KEY_Right, /* Right Arrow */ + /* 80 */ KEY_Left, /* Left Arrow */ + /* 81 */ KEY_Down, /* Down Arrow */ + /* 82 */ KEY_Up, /* Up Arrow */ + /* 83 */ KEY_NumLock, /* Num Lock */ + /* 84 */ KEY_KP_Divide, /* Keypad / */ + /* 85 */ KEY_KP_Multiply, /* Keypad * */ + /* 86 */ KEY_KP_Minus, /* Keypad - */ + /* 87 */ KEY_KP_Plus, /* Keypad + */ + /* 88 */ KEY_KP_Enter, /* Keypad Enter */ + /* 89 */ KEY_KP_1, /* Keypad 1 End */ + /* 90 */ KEY_KP_2, /* Keypad 2 Down */ + /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */ + /* 92 */ KEY_KP_4, /* Keypad 4 Left */ + /* 93 */ KEY_KP_5, /* Keypad 5 */ + /* 94 */ KEY_KP_6, /* Keypad 6 */ + /* 95 */ KEY_KP_7, /* Keypad 7 Home */ + /* 96 */ KEY_KP_8, /* Keypad 8 Up */ + /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */ + /* 98 */ KEY_KP_0, /* Keypad 0 Ins */ + /* 99 */ KEY_KP_Decimal, /* Keypad . Del */ + /* 100 */ KEY_Less, /* < > on some keyboards */ + /* 101 */ KEY_Menu, /* Menu */ + /* 102 */ KEY_NOTUSED, + /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */ + /* 104 */ KEY_NOTUSED, + /* 105 */ KEY_NOTUSED, + /* 106 */ KEY_NOTUSED, + /* 107 */ KEY_NOTUSED, + /* 108 */ KEY_NOTUSED, + /* 109 */ KEY_NOTUSED, + /* 110 */ KEY_NOTUSED, + /* 111 */ KEY_NOTUSED, + /* 112 */ KEY_NOTUSED, + /* 113 */ KEY_NOTUSED, + /* 114 */ KEY_NOTUSED, + /* 115 */ KEY_NOTUSED, + /* 116 */ KEY_NOTUSED, + /* 117 */ KEY_NOTUSED, + /* 118 */ KEY_NOTUSED, + /* 119 */ KEY_NOTUSED, + /* 120 */ KEY_NOTUSED, + /* 121 */ KEY_NOTUSED, + /* 122 */ KEY_NOTUSED, + /* 123 */ KEY_NOTUSED, + /* 124 */ KEY_NOTUSED, + /* 125 */ KEY_NOTUSED, + /* 126 */ KEY_NOTUSED, + /* 127 */ KEY_NOTUSED, + /* 128 */ KEY_NOTUSED, + /* 129 */ KEY_NOTUSED, + /* 130 */ KEY_NOTUSED, + /* 131 */ KEY_NOTUSED, + /* 132 */ KEY_NOTUSED, + /* 133 */ KEY_NOTUSED, + /* 134 */ KEY_NOTUSED, + /* 135 */ KEY_NOTUSED, + /* 136 */ KEY_NOTUSED, + /* 137 */ KEY_NOTUSED, + /* 138 */ KEY_NOTUSED, + /* 139 */ KEY_NOTUSED, + /* 140 */ KEY_NOTUSED, + /* 141 */ KEY_NOTUSED, + /* 142 */ KEY_NOTUSED, + /* 143 */ KEY_NOTUSED, + /* 144 */ KEY_NOTUSED, + /* 145 */ KEY_NOTUSED, + /* 146 */ KEY_NOTUSED, + /* 147 */ KEY_NOTUSED, + /* 148 */ KEY_NOTUSED, + /* 149 */ KEY_NOTUSED, + /* 150 */ KEY_NOTUSED, + /* 151 */ KEY_NOTUSED, + /* 152 */ KEY_NOTUSED, + /* 153 */ KEY_NOTUSED, + /* 154 */ KEY_NOTUSED, + /* 155 */ KEY_NOTUSED, + /* 156 */ KEY_NOTUSED, + /* 157 */ KEY_NOTUSED, + /* 158 */ KEY_NOTUSED, + /* 159 */ KEY_NOTUSED, + /* 160 */ KEY_NOTUSED, + /* 161 */ KEY_NOTUSED, + /* 162 */ KEY_NOTUSED, + /* 163 */ KEY_NOTUSED, + /* 164 */ KEY_NOTUSED, + /* 165 */ KEY_NOTUSED, + /* 166 */ KEY_NOTUSED, + /* 167 */ KEY_NOTUSED, + /* 168 */ KEY_NOTUSED, + /* 169 */ KEY_NOTUSED, + /* 170 */ KEY_NOTUSED, + /* 171 */ KEY_NOTUSED, + /* 172 */ KEY_NOTUSED, + /* 173 */ KEY_NOTUSED, + /* 174 */ KEY_NOTUSED, + /* 175 */ KEY_NOTUSED, + /* 176 */ KEY_NOTUSED, + /* 177 */ KEY_NOTUSED, + /* 178 */ KEY_NOTUSED, + /* 179 */ KEY_NOTUSED, + /* 180 */ KEY_NOTUSED, + /* 181 */ KEY_NOTUSED, + /* 182 */ KEY_NOTUSED, + /* 183 */ KEY_NOTUSED, + /* 184 */ KEY_NOTUSED, + /* 185 */ KEY_NOTUSED, + /* 186 */ KEY_NOTUSED, + /* 187 */ KEY_NOTUSED, + /* 188 */ KEY_NOTUSED, + /* 189 */ KEY_NOTUSED, + /* 190 */ KEY_NOTUSED, + /* 191 */ KEY_NOTUSED, + /* 192 */ KEY_NOTUSED, + /* 193 */ KEY_NOTUSED, + /* 194 */ KEY_NOTUSED, + /* 195 */ KEY_NOTUSED, + /* 196 */ KEY_NOTUSED, + /* 197 */ KEY_NOTUSED, + /* 198 */ KEY_NOTUSED, + /* 199 */ KEY_NOTUSED, + /* 200 */ KEY_NOTUSED, + /* 201 */ KEY_NOTUSED, + /* 202 */ KEY_NOTUSED, + /* 203 */ KEY_NOTUSED, + /* 204 */ KEY_NOTUSED, + /* 205 */ KEY_NOTUSED, + /* 206 */ KEY_NOTUSED, + /* 207 */ KEY_NOTUSED, + /* 208 */ KEY_NOTUSED, + /* 209 */ KEY_NOTUSED, + /* 210 */ KEY_NOTUSED, + /* 211 */ KEY_NOTUSED, + /* 212 */ KEY_NOTUSED, + /* 213 */ KEY_NOTUSED, + /* 214 */ KEY_NOTUSED, + /* 215 */ KEY_NOTUSED, + /* 216 */ KEY_NOTUSED, + /* 217 */ KEY_NOTUSED, + /* 218 */ KEY_NOTUSED, + /* 219 */ KEY_NOTUSED, + /* 220 */ KEY_NOTUSED, + /* 221 */ KEY_NOTUSED, + /* 222 */ KEY_NOTUSED, + /* 223 */ KEY_NOTUSED, + /* 224 */ KEY_LCtrl, /* Left Control */ + /* 225 */ KEY_ShiftL, /* Left Shift */ + /* 226 */ KEY_Alt, /* Left Alt */ + /* 227 */ KEY_LMeta, /* Left Meta */ + /* 228 */ KEY_RCtrl, /* Right Control */ + /* 229 */ KEY_ShiftR, /* Right Shift */ + /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */ + /* 231 */ KEY_LMeta, /* Right Meta XXX */ +}; + +#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char)) + +/* Map for adb keyboards */ +static CARD8 wsAdbMap[] = { + /* 0 */ KEY_A, + /* 1 */ KEY_S, + /* 2 */ KEY_D, + /* 3 */ KEY_F, + /* 4 */ KEY_H, + /* 5 */ KEY_G, + /* 6 */ KEY_Z, + /* 7 */ KEY_X, + /* 8 */ KEY_C, + /* 9 */ KEY_V, + /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */ + /* 11 */ KEY_B, + /* 12 */ KEY_Q, + /* 13 */ KEY_W, + /* 14 */ KEY_E, + /* 15 */ KEY_R, + /* 16 */ KEY_Y, + /* 17 */ KEY_T, + /* 18 */ KEY_1, + /* 19 */ KEY_2, + /* 20 */ KEY_3, + /* 21 */ KEY_4, + /* 22 */ KEY_6, + /* 23 */ KEY_5, + /* 24 */ KEY_Equal, + /* 25 */ KEY_9, + /* 26 */ KEY_7, + /* 27 */ KEY_Minus, + /* 28 */ KEY_8, + /* 29 */ KEY_0, + /* 30 */ KEY_RBrace, + /* 31 */ KEY_O, + /* 32 */ KEY_U, + /* 33 */ KEY_LBrace, + /* 34 */ KEY_I, + /* 35 */ KEY_P, + /* 36 */ KEY_Enter, + /* 37 */ KEY_L, + /* 38 */ KEY_J, + /* 39 */ KEY_Quote, + /* 40 */ KEY_K, + /* 41 */ KEY_SemiColon, + /* 42 */ KEY_BSlash, + /* 43 */ KEY_Comma, + /* 44 */ KEY_Slash, + /* 45 */ KEY_N, + /* 46 */ KEY_M, + /* 47 */ KEY_Period, + /* 48 */ KEY_Tab, + /* 49 */ KEY_Space, + /* 50 */ KEY_Tilde, + /* 51 */ KEY_Delete, + /* 52 */ KEY_AltLang, + /* 53 */ KEY_Escape, + /* 54 */ KEY_LCtrl, + /* 55 */ KEY_Alt, + /* 56 */ KEY_ShiftL, + /* 57 */ KEY_CapsLock, + /* 58 */ KEY_LMeta, + /* 59 */ KEY_Left, + /* 60 */ KEY_Right, + /* 61 */ KEY_Down, + /* 62 */ KEY_Up, + /* 63 */ KEY_UNKNOWN, /* Fn */ + /* 64 */ KEY_NOTUSED, + /* 65 */ KEY_KP_Decimal, + /* 66 */ KEY_NOTUSED, + /* 67 */ KEY_KP_Multiply, + /* 68 */ KEY_NOTUSED, + /* 69 */ KEY_KP_Plus, + /* 70 */ KEY_NOTUSED, + /* 71 */ KEY_UNKNOWN, /* Clear */ + /* 72 */ KEY_NOTUSED, + /* 73 */ KEY_NOTUSED, + /* 74 */ KEY_NOTUSED, + /* 75 */ KEY_KP_Divide, + /* 76 */ KEY_KP_Enter, + /* 77 */ KEY_NOTUSED, + /* 78 */ KEY_KP_Minus, + /* 79 */ KEY_NOTUSED, + /* 80 */ KEY_NOTUSED, + /* 81 */ KEY_KP_Equal, /* Keypad = */ + /* 82 */ KEY_KP_0, + /* 83 */ KEY_KP_1, + /* 84 */ KEY_KP_2, + /* 85 */ KEY_KP_3, + /* 86 */ KEY_KP_4, + /* 87 */ KEY_KP_5, + /* 88 */ KEY_KP_6, + /* 89 */ KEY_KP_7, + /* 90 */ KEY_NOTUSED, + /* 91 */ KEY_KP_8, + /* 92 */ KEY_KP_9, + /* 93 */ KEY_NOTUSED, + /* 94 */ KEY_NOTUSED, + /* 95 */ KEY_UNKNOWN, /* Keypad , */ + /* 96 */ KEY_F5, + /* 97 */ KEY_F6, + /* 98 */ KEY_F7, + /* 99 */ KEY_F3, + /* 100 */ KEY_F8, + /* 101 */ KEY_F9, + /* 102 */ KEY_NOTUSED, + /* 103 */ KEY_F11, + /* 104 */ KEY_NOTUSED, + /* 105 */ KEY_NOTUSED, + /* 106 */ KEY_KP_Enter, + /* 107 */ KEY_NOTUSED, + /* 108 */ KEY_NOTUSED, + /* 109 */ KEY_F10, + /* 110 */ KEY_NOTUSED, + /* 111 */ KEY_F12, + /* 112 */ KEY_NOTUSED, + /* 113 */ KEY_NOTUSED, + /* 114 */ KEY_NOTUSED, + /* 115 */ KEY_Home, + /* 116 */ KEY_PgUp, + /* 117 */ KEY_NOTUSED, + /* 118 */ KEY_F4, + /* 119 */ KEY_End, + /* 120 */ KEY_F2, + /* 121 */ KEY_PgDown, + /* 122 */ KEY_F1, + /* 123 */ KEY_NOTUSED, + /* 124 */ KEY_NOTUSED, + /* 125 */ KEY_NOTUSED, + /* 126 */ KEY_NOTUSED, + /* 127 */ KEY_NOTUSED, + /* 128 */ KEY_NOTUSED, + /* 129 */ KEY_NOTUSED, + /* 130 */ KEY_NOTUSED, + /* 131 */ KEY_NOTUSED, + /* 132 */ KEY_NOTUSED, + /* 133 */ KEY_NOTUSED, + /* 134 */ KEY_NOTUSED, + /* 135 */ KEY_NOTUSED, + /* 136 */ KEY_NOTUSED, + /* 137 */ KEY_NOTUSED, + /* 138 */ KEY_NOTUSED, + /* 139 */ KEY_NOTUSED, + /* 140 */ KEY_NOTUSED, + /* 141 */ KEY_NOTUSED, + /* 142 */ KEY_NOTUSED, + /* 143 */ KEY_NOTUSED, + /* 144 */ KEY_NOTUSED, + /* 145 */ KEY_NOTUSED, + /* 146 */ KEY_NOTUSED, + /* 147 */ KEY_NOTUSED, + /* 148 */ KEY_NOTUSED, + /* 149 */ KEY_NOTUSED, + /* 150 */ KEY_NOTUSED, + /* 151 */ KEY_NOTUSED, + /* 152 */ KEY_NOTUSED, + /* 153 */ KEY_NOTUSED, + /* 154 */ KEY_NOTUSED, + /* 155 */ KEY_NOTUSED, + /* 156 */ KEY_NOTUSED, + /* 157 */ KEY_NOTUSED, + /* 158 */ KEY_NOTUSED, + /* 159 */ KEY_NOTUSED, + /* 160 */ KEY_NOTUSED, + /* 161 */ KEY_NOTUSED, + /* 162 */ KEY_NOTUSED, + /* 163 */ KEY_NOTUSED, + /* 164 */ KEY_NOTUSED, + /* 165 */ KEY_NOTUSED, + /* 166 */ KEY_NOTUSED, + /* 167 */ KEY_NOTUSED, + /* 168 */ KEY_NOTUSED, + /* 169 */ KEY_NOTUSED, + /* 170 */ KEY_NOTUSED, + /* 171 */ KEY_NOTUSED, + /* 172 */ KEY_NOTUSED, + /* 173 */ KEY_NOTUSED, + /* 174 */ KEY_NOTUSED, + /* 175 */ KEY_NOTUSED, + /* 176 */ KEY_NOTUSED, + /* 177 */ KEY_NOTUSED, + /* 178 */ KEY_NOTUSED, + /* 179 */ KEY_NOTUSED, + /* 180 */ KEY_NOTUSED, + /* 181 */ KEY_NOTUSED, + /* 182 */ KEY_NOTUSED, + /* 183 */ KEY_NOTUSED, + /* 184 */ KEY_NOTUSED, + /* 185 */ KEY_NOTUSED, + /* 186 */ KEY_NOTUSED, + /* 187 */ KEY_NOTUSED, + /* 188 */ KEY_NOTUSED, + /* 189 */ KEY_NOTUSED, + /* 190 */ KEY_NOTUSED, + /* 191 */ KEY_NOTUSED, + /* 192 */ KEY_NOTUSED, + /* 193 */ KEY_NOTUSED, + /* 194 */ KEY_NOTUSED, + /* 195 */ KEY_NOTUSED, + /* 196 */ KEY_NOTUSED, + /* 197 */ KEY_NOTUSED, + /* 198 */ KEY_NOTUSED, + /* 199 */ KEY_NOTUSED, + /* 200 */ KEY_NOTUSED, + /* 201 */ KEY_NOTUSED, + /* 202 */ KEY_NOTUSED, + /* 203 */ KEY_NOTUSED, + /* 204 */ KEY_NOTUSED, + /* 205 */ KEY_NOTUSED, + /* 206 */ KEY_NOTUSED, + /* 207 */ KEY_NOTUSED, + /* 208 */ KEY_NOTUSED, + /* 209 */ KEY_NOTUSED, + /* 210 */ KEY_NOTUSED, + /* 211 */ KEY_NOTUSED, + /* 212 */ KEY_NOTUSED, + /* 213 */ KEY_NOTUSED, + /* 214 */ KEY_NOTUSED, + /* 215 */ KEY_NOTUSED, + /* 216 */ KEY_NOTUSED, + /* 217 */ KEY_NOTUSED, + /* 218 */ KEY_NOTUSED, + /* 219 */ KEY_NOTUSED, + /* 220 */ KEY_NOTUSED, + /* 221 */ KEY_NOTUSED, + /* 222 */ KEY_NOTUSED, + /* 223 */ KEY_NOTUSED, +}; + + +#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) + +/* + * Translate raw wskbd keyboard event values to XFree86 standard keycodes + * (based on the AT keyboard scan codes using the tables above + */ +int +WSKbdToKeycode(int keycode) +{ + switch (xf86Info.wsKbdType) { + case WSKBD_TYPE_PC_XT: + case WSKBD_TYPE_PC_AT: + /* No translation needed */ + return keycode; + case WSKBD_TYPE_USB: + if (keycode < 0 || keycode >= WS_USB_MAP_SIZE) + return KEY_UNKNOWN; + else + return wsUsbMap[keycode]; +#ifdef WSKBD_TYPE_ADB + case WSKBD_TYPE_ADB: + if (keycode < 0 || keycode >= WS_ADB_MAP_SIZE) + return KEY_UNKNOWN; + else + return wsAdbMap[keycode]; +#endif + default: + ErrorF("Unkown wskbd type %d\n", xf86Info.wsKbdType); + return KEY_UNKNOWN; + } +} + +#endif /* WSCONS_SUPPORT */ Index: xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c:1.1 xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c:removed --- xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c:1.1 Sat Sep 25 10:45:02 1999 +++ xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c Fri Jan 18 15:25:05 2002 @@ -1,26 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c,v 1.1 1999/09/25 14:45:02 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */ - -/* Dummy C File for place holder - see os-support/sol8_x86 */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.15 xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.18 --- xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.15 Tue May 1 18:31:30 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h Mon Jul 23 09:15:47 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.15 2001/05/01 22:31:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.18 2001/07/23 13:15:47 dawes Exp $ */ /* * * For Scancodes see notes in atKeynames.h !!!! @@ -6,7 +6,10 @@ */ /* $XConsortium: xf86Keymap.h /main/14 1996/02/21 17:38:47 kaleb $ */ -static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { +static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { + +#if !defined(__SOL8__) && (!defined(sun) || defined(i386)) + /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, @@ -83,7 +86,7 @@ /* 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, + /* 0x4c */ XK_KP_Begin, 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, @@ -96,7 +99,6 @@ /* 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, @@ -136,9 +138,159 @@ /* 0x7d */ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + +#else /* SunOS */ + +/* Assumes a US English keyboard as default - sorry 'bout that + * + * Hopefully it'll be enough someone can have a sorta working + * keyboard, if they're not using XKB + * + * DWH 9/12/99 + */ + + /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x01 */ XK_quoteleft, XK_asciitilde, 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 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x0f */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, + /* 0x10 */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, + /* 0x11 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, + /* 0x12 */ XK_W, NoSymbol, NoSymbol, NoSymbol, + /* 0x13 */ XK_E, NoSymbol, NoSymbol, NoSymbol, + /* 0x14 */ XK_R, NoSymbol, NoSymbol, NoSymbol, + /* 0x15 */ XK_T, NoSymbol, NoSymbol, NoSymbol, + /* 0x16 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, + /* 0x17 */ XK_U, NoSymbol, NoSymbol, NoSymbol, + /* 0x18 */ XK_I, NoSymbol, NoSymbol, NoSymbol, + /* 0x19 */ XK_O, NoSymbol, NoSymbol, NoSymbol, + /* 0x1a */ XK_P, NoSymbol, NoSymbol, NoSymbol, + /* 0x1b */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, + /* 0x1c */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, + /* 0x1d */ XK_backslash, XK_bar, NoSymbol, NoSymbol, + /* 0x1e */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, + /* 0x1f */ XK_A, NoSymbol, NoSymbol, NoSymbol, + /* 0x20 */ XK_S, NoSymbol, NoSymbol, NoSymbol, + /* 0x21 */ XK_D, NoSymbol, NoSymbol, NoSymbol, + /* 0x22 */ XK_F, NoSymbol, NoSymbol, NoSymbol, + /* 0x23 */ XK_G, NoSymbol, NoSymbol, NoSymbol, + /* 0x24 */ XK_H, NoSymbol, NoSymbol, NoSymbol, + /* 0x25 */ XK_J, NoSymbol, NoSymbol, NoSymbol, + /* 0x26 */ XK_K, NoSymbol, NoSymbol, NoSymbol, + /* 0x27 */ XK_L, NoSymbol, NoSymbol, NoSymbol, + /* 0x28 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, + /* 0x29 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, + /* 0x2a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x2b */ XK_Return, NoSymbol, NoSymbol, NoSymbol, + /* 0x2c */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, + /* 0x2d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x2e */ XK_Z, NoSymbol, NoSymbol, NoSymbol, + /* 0x2f */ XK_X, NoSymbol, NoSymbol, NoSymbol, + /* 0x30 */ XK_C, NoSymbol, NoSymbol, NoSymbol, + /* 0x31 */ XK_V, NoSymbol, NoSymbol, NoSymbol, + /* 0x32 */ XK_B, NoSymbol, NoSymbol, NoSymbol, + /* 0x33 */ XK_N, NoSymbol, NoSymbol, NoSymbol, + /* 0x34 */ XK_M, NoSymbol, NoSymbol, NoSymbol, + /* 0x35 */ XK_comma, XK_less, NoSymbol, NoSymbol, + /* 0x36 */ XK_period, XK_greater, NoSymbol, NoSymbol, + /* 0x37 */ XK_slash, XK_question, NoSymbol, NoSymbol, + /* 0x38 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x39 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, + /* 0x3a */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, + /* 0x3b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x3c */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, + /* 0x3d */ XK_space, NoSymbol, NoSymbol, NoSymbol, + /* 0x3e */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, + /* 0x3f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x40 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, + /* 0x41 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x42 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x43 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x44 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x45 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x46 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x47 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x48 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x49 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x4a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x4b */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, + /* 0x4c */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, + /* 0x4d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x4e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x4f */ XK_Left, NoSymbol, NoSymbol, NoSymbol, + /* 0x50 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, + /* 0x51 */ XK_End, NoSymbol, NoSymbol, NoSymbol, + /* 0x52 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x53 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, + /* 0x54 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, + /* 0x55 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, + /* 0x56 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, + /* 0x57 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x58 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x59 */ XK_Right, NoSymbol, NoSymbol, NoSymbol, + /* 0x5a */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, + /* 0x5b */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, + /* 0x5c */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, + /* 0x5d */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, + /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x5f */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, + /* 0x60 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, + /* 0x61 */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, + /* 0x62 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, + /* 0x63 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, + /* 0x64 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, + /* 0x65 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, + /* 0x66 */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, + /* 0x67 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, + /* 0x68 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, + /* 0x69 */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, + /* 0x6a */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, + /* 0x6b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x6c */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, + /* 0x6d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x6e */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, + /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x70 */ XK_F1, NoSymbol, NoSymbol, NoSymbol, + /* 0x71 */ XK_F2, NoSymbol, NoSymbol, NoSymbol, + /* 0x72 */ XK_F3, NoSymbol, NoSymbol, NoSymbol, + /* 0x73 */ XK_F4, NoSymbol, NoSymbol, NoSymbol, + /* 0x74 */ XK_F5, NoSymbol, NoSymbol, NoSymbol, + /* 0x75 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, + /* 0x76 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, + /* 0x77 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, + /* 0x78 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, + /* 0x79 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, + /* 0x7a */ XK_F11, NoSymbol, NoSymbol, NoSymbol, + /* 0x7b */ XK_F12, NoSymbol, NoSymbol, NoSymbol, + /* 0x7c */ XK_Print, NoSymbol, NoSymbol, NoSymbol, + /* 0x7d */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, + /* 0x7e */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, + /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + +#endif /* SunOS */ + }; + +#if !defined(Lynx) && \ + !defined(__EMX__) && \ + !defined(__mips__) && \ + !defined(linux) && \ + !defined(CSRG_BASED) && \ + !defined(__CYGWIN__) && \ + !defined(__SOL8__) && \ + (!defined(sun) || defined(i386)) -#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, @@ -229,7 +381,6 @@ /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, - /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, Index: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c:1.6 xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c:1.8 --- xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c:1.6 Fri Aug 4 12:13:25 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c Thu Aug 16 10:33:51 2001 @@ -1,7 +1,7 @@ /* * Copyright (c) 1999 by The XFree86 Project, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.6 2000/08/04 16:13:25 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.8 2001/08/16 14:33:51 dawes Exp $ */ /* * This file contains the Pointer/Keyboard functions needed by the @@ -25,8 +25,6 @@ #ifdef XINPUT #include "XI.h" #include "XIproto.h" -#include "extnsionst.h" -#include "extinit.h" #include "xf86Xinput.h" #else #include "inputstr.h" @@ -69,6 +67,8 @@ FROM_MISC } MseProtoMapDirection; +static void MiscExtClientStateCallback(pointer, pointer, pointer); + /* Sigh... @@ -202,6 +202,8 @@ return FALSE; } +/* The misc extension doesn't (yet) call this. */ +#if 0 Bool MiscExtSetMouseDevice(pointer mouse, char* device) { @@ -210,6 +212,7 @@ mse->device = device; return TRUE; } +#endif Bool MiscExtGetKbdSettings(pointer *kbd) @@ -263,6 +266,53 @@ return TRUE; } return FALSE; +} + +static void +MiscExtClientStateCallback(pointer callbacks, pointer data, pointer args) +{ + NewClientInfoRec *clientinfo = (NewClientInfoRec*)args; + + if (clientinfo->client == xf86Info.grabInfo.override && + clientinfo->client->clientState == ClientStateGone) { + xf86Info.grabInfo.override = NULL; + xf86Info.grabInfo.disabled = 0; + DeleteCallback(&ClientStateCallback, + (CallbackProcPtr)MiscExtClientStateCallback, NULL); + } +} + +#define MiscExtGrabStateSuccess 0 /* No errors */ +#define MiscExtGrabStateLocked 1 /* A client already requested that + * grabs cannot be removed/killed */ +#define MiscExtGrabStateAlready 2 /* Request for enabling/disabling + * grab removeal/kill already done */ +int +MiscExtSetGrabKeysState(ClientPtr client, int state) +{ + DEBUG_P("MiscExtSetGrabKeysState"); + + if (xf86Info.grabInfo.override == NULL || + xf86Info.grabInfo.override == client) { + if (state == 0 && xf86Info.grabInfo.disabled == 0) { + xf86Info.grabInfo.disabled = 1; + AddCallback(&ClientStateCallback, + (CallbackProcPtr)MiscExtClientStateCallback, NULL); + xf86Info.grabInfo.override = client; + } + else if (state == 1 && xf86Info.grabInfo.disabled == 1) { + xf86Info.grabInfo.disabled = 0; + DeleteCallback(&ClientStateCallback, + (CallbackProcPtr)MiscExtClientStateCallback, NULL); + xf86Info.grabInfo.override = NULL; + } + else + return MiscExtGrabStateAlready; + + return MiscExtGrabStateSuccess; + } + + return MiscExtGrabStateLocked; } pointer Index: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.40 xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.48 --- xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.40 Thu May 10 06:17:39 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Mode.c Thu Dec 6 10:40:27 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.40 2001/05/10 10:17:39 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.48 2001/12/06 15:40:27 tsi Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -14,6 +14,7 @@ #include "mibank.h" #include "xf86.h" #include "xf86Priv.h" +#include "xf86DDC.h" /* * xf86GetNearestClock -- @@ -668,6 +669,36 @@ return MODE_ERROR; } +#ifdef DEBUG + ErrorF("xf86CheckModeForMonitor(%p %s, %p %s)\n", + mode, mode->name, monitor, monitor->id); +#endif + + if (monitor->DDC) { + xf86MonPtr DDC = (xf86MonPtr)(monitor->DDC); + struct detailed_monitor_section* detMon; + struct monitor_ranges *mon_range; + int i; + + mon_range = NULL; + for (i = 0; i < 4; i++) { + detMon = &DDC->det_mon[i]; + if(detMon->type == DS_RANGES) { + mon_range = &detMon->section.ranges; + } + } + if (mon_range) { + /* mode->Clock in kHz, DDC in MHz */ + if (mon_range->max_clock < 2550 && + mode->Clock / 1000.0 > mon_range->max_clock) { + xf86Msg(X_WARNING, + "(%s,%s) mode clock %gMHz exceeds DDC maximum %dMHz\n", + mode->name, monitor->id, + mode->Clock/1000.0, mon_range->max_clock); + } + } + } + /* Some basic mode validity checks */ if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart || mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal) @@ -759,6 +790,11 @@ return MODE_ERROR; } +#ifdef DEBUG + ErrorF("xf86InitialCheckModeForDriver(%p, %p %s, %p, 0x%x, %d, %d, %d)\n", + scrp, mode, mode->name , clockRanges, strategy, maxPitch, virtualX, virtualY); +#endif + /* Some basic mode validity checks */ if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart || mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal) @@ -837,7 +873,8 @@ return MODE_ERROR; } - mode->HSync = (float)mode->SynthClock / (float)mode->CrtcHTotal; + if (mode->HSync <= 0.0) + mode->HSync = (float)mode->SynthClock / (float)mode->CrtcHTotal; if (monitor->nHsync > 0) { /* Check hsync against the allowed ranges */ for (i = 0; i < monitor->nHsync; i++) @@ -850,8 +887,9 @@ return MODE_HSYNC; } - mode->VRefresh = (mode->SynthClock * 1000.0) / - (mode->CrtcHTotal * mode->CrtcVTotal); + if (mode->VRefresh <= 0.0) + mode->VRefresh = (mode->SynthClock * 1000.0) / + (mode->CrtcHTotal * mode->CrtcVTotal); if (monitor->nVrefresh > 0) { /* Check vrefresh against the allowed ranges */ for (i = 0; i < monitor->nVrefresh; i++) @@ -1091,10 +1129,21 @@ int pixelArea = scrp->videoRam * (1024 * 8); /* in bits */ int modeSize; /* in pixels */ int bitsPerPixel, pixmapPad; + Bool validateAllDefaultModes; PixmapFormatRec *BankFormat; ClockRangePtr cp; ClockRangesPtr storeClockRanges; + struct monitor_ranges *mon_range = NULL; +#ifdef DEBUG + ErrorF("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n", + scrp, availModes, modeNames, clockRanges, + linePitches, minPitch, maxPitch, pitchInc, + minHeight, maxHeight, virtualX, virtualY, + apertureSize, strategy + ); +#endif + /* Some sanity checking */ if (scrp == NULL || scrp->name == NULL || !scrp->monitor || (!scrp->progClock && scrp->numClocks == 0)) { @@ -1118,6 +1167,60 @@ return -1; } + /* Probe monitor so that we can enforce/warn about its limits */ + if (scrp->monitor->DDC) { + MonPtr monitor = scrp->monitor; + xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC); + struct detailed_monitor_section* detMon; + int i; + + for (i = 0; i < 4; i++) { + detMon = &DDC->det_mon[i]; + if(detMon->type == DS_RANGES) { + mon_range = &detMon->section.ranges; + } + } + if (mon_range) { + +#ifdef DEBUG + ErrorF("DDC - Max clock %d, Hsync %d-%d kHz - Vrefresh %d-%d Hz\n", + mon_range->max_clock, mon_range->min_h, mon_range->max_h, + mon_range->min_v, mon_range->max_v ); +#endif + +#define DDC_SYNC_TOLERANCE SYNC_TOLERANCE + if (monitor->nHsync > 0) { + for (i = 0; i < monitor->nHsync; i++) { + if ((1.0 - DDC_SYNC_TOLERANCE) * mon_range->min_h > + monitor->hsync[i].lo || + (1.0 + DDC_SYNC_TOLERANCE) * mon_range->max_h < + monitor->hsync[i].hi) { + xf86DrvMsg(scrp->scrnIndex, X_WARNING, + "config file hsync range %g-%gkHz not within DDC " + "hsync range %d-%dkHz\n", + monitor->hsync[i].lo, monitor->hsync[i].hi, + mon_range->min_h, mon_range->max_h); + } + } + } + + if (monitor->nVrefresh > 0) { + for (i=0; inVrefresh; i++) { + if ((1.0 - DDC_SYNC_TOLERANCE) * mon_range->min_v > + monitor->vrefresh[0].lo || + (1.0 + DDC_SYNC_TOLERANCE) * mon_range->max_v < + monitor->vrefresh[0].hi) { + xf86DrvMsg(scrp->scrnIndex, X_WARNING, + "config file vrefresh range %g-%gHz not within DDC " + "vrefresh range %d-%dHz\n", + monitor->vrefresh[i].lo, monitor->vrefresh[i].hi, + mon_range->min_v, mon_range->max_v); + } + } + } + } /* if (mon_range) */ + } + /* * If requested by the driver, allow missing hsync and/or vrefresh ranges * in the monitor section. @@ -1126,11 +1229,17 @@ strategy &= ~LOOKUP_OPTIONAL_TOLERANCES; } else { if (scrp->monitor->nHsync <= 0) { + if (mon_range) { + scrp->monitor->hsync[0].lo = mon_range->min_h; + scrp->monitor->hsync[0].hi = mon_range->max_h; + } else { + scrp->monitor->hsync[0].lo = 28; + scrp->monitor->hsync[0].hi = 33; + } xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "%s: Using default hsync range of 28-33kHz\n", - scrp->monitor->id); - scrp->monitor->hsync[0].lo = 28; - scrp->monitor->hsync[0].hi = 33; + "%s: Using default hsync range of %.2f-%.2fkHz\n", + scrp->monitor->id, + scrp->monitor->hsync[0].lo, scrp->monitor->hsync[0].hi); scrp->monitor->nHsync = 1; } else { for (i = 0; i < scrp->monitor->nHsync; i++) @@ -1147,11 +1256,18 @@ scrp->monitor->hsync[i].hi); } if (scrp->monitor->nVrefresh <= 0) { + if (mon_range) { + scrp->monitor->vrefresh[0].lo = mon_range->min_v; + scrp->monitor->vrefresh[0].hi = mon_range->max_v; + } else { + scrp->monitor->vrefresh[0].lo = 43; + scrp->monitor->vrefresh[0].hi = 72; + } xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "%s: using default vrefresh range of 43-72Hz\n", - scrp->monitor->id); - scrp->monitor->vrefresh[0].lo = 43; - scrp->monitor->vrefresh[0].hi = 72; + "%s: using default vrefresh range of %.2f-%.2fHz\n", + scrp->monitor->id, + scrp->monitor->vrefresh[0].lo, + scrp->monitor->vrefresh[0].hi); scrp->monitor->nVrefresh = 1; } else { for (i = 0; i < scrp->monitor->nVrefresh; i++) @@ -1290,6 +1406,10 @@ status = xf86InitialCheckModeForDriver(scrp, p, clockRanges, strategy, maxPitch, virtualX, virtualY); + + if (status == MODE_OK) + status = xf86CheckModeForMonitor(p, scrp->monitor); + if (status == MODE_OK) { new = xnfalloc(sizeof(DisplayModeRec)); *new = *p; @@ -1349,7 +1469,9 @@ endp = &new->next; } } + /* Lookup each mode */ + validateAllDefaultModes = FALSE; for (p = scrp->modes; ; p = p->next) { /* * If the supplied mode names don't produce a valid mode, scan through @@ -1358,9 +1480,10 @@ */ if (p == NULL) { - if (numModes > 0) + if ((numModes > 0) && !validateAllDefaultModes) break; + validateAllDefaultModes = TRUE; r = NULL; modeSize = 0; for (q = scrp->modePool; q != NULL; q = q->next) { @@ -1377,9 +1500,20 @@ if (p != NULL) q->prev = p; - else if (modeSize < (q->HDisplay * q->VDisplay)) { - r = q; - modeSize = q->HDisplay * q->VDisplay; + else { + /* + * A quick check to not allow default modes with + * horizontal timing parameters that CRTs may have + * problems with. + */ + if ((q->type & M_T_DEFAULT) && + ((double)q->HTotal / (double)q->HDisplay) < 1.15) + continue; + + if (modeSize < (q->HDisplay * q->VDisplay)) { + r = q; + modeSize = q->HDisplay * q->VDisplay; + } } } } Index: xc/programs/Xserver/hw/xfree86/common/xf86Module.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.28 xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.31 --- xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.28 Tue Mar 13 11:03:36 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Module.h Thu Aug 16 10:33:52 2001 @@ -1,7 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.28 2001/03/13 16:03:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.31 2001/08/16 14:33:52 dawes Exp $ */ /* - * Copyright (c) 1997-1999 by The XFree86 Project, Inc. + * Copyright (c) 1997-2001 by The XFree86 Project, Inc. */ /* @@ -62,10 +62,10 @@ * mask is 0xFFFF0000. */ #define ABI_ANSIC_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_VIDEODRV_VERSION SET_ABI_VERSION(0, 5) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 3) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 1) -#define ABI_FONT_VERSION SET_ABI_VERSION(0, 2) +#define ABI_FONT_VERSION SET_ABI_VERSION(0, 3) #define MODINFOSTRING1 0xef23fdc5 #define MODINFOSTRING2 0x10dc023a Index: xc/programs/Xserver/hw/xfree86/common/xf86PM.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86PM.c:3.4 xc/programs/Xserver/hw/xfree86/common/xf86PM.c:3.6 --- xc/programs/Xserver/hw/xfree86/common/xf86PM.c:3.4 Fri Dec 8 15:13:34 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86PM.c Fri Nov 30 07:11:55 2001 @@ -1,13 +1,16 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PM.c,v 3.4 2000/12/08 20:13:34 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PM.c,v 3.6 2001/11/30 12:11:55 eich Exp $ */ #include "X.h" #include "xf86.h" #include "xf86Priv.h" +#include "xf86Xinput.h" int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num) = NULL; pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL; +static Bool suspended = FALSE; + static char * eventName(pmEvent event) { @@ -31,14 +34,80 @@ } static void -DoApmEvent(pmEvent event) +suspend (pmEvent event, Bool undo) { + int i; + InputInfoPtr pInfo; + + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); + } +#if !defined(__EMX__) + DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); + pInfo = xf86InputDevs; + while (pInfo) { + DisableDevice(pInfo->dev); + pInfo = pInfo->next; + } +#endif + xf86EnterServerState(SETUP); + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->PMEvent) + xf86Screens[i]->PMEvent(i,event,undo); + else { + xf86Screens[i]->LeaveVT(i, 0); + xf86Screens[i]->vtSema = FALSE; + } + } + xf86AccessLeave(); + xf86AccessLeaveState(); +} + +static void +resume(pmEvent event, Bool undo) +{ + int i; + InputInfoPtr pInfo; + + xf86AccessEnter(); + xf86EnterServerState(SETUP); + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->PMEvent) + xf86Screens[i]->PMEvent(i,event,undo); + else { + xf86Screens[i]->vtSema = TRUE; + xf86Screens[i]->EnterVT(i, 0); + } + } + xf86EnterServerState(OPERATING); + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + } + SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); +#if !defined(__EMX__) + pInfo = xf86InputDevs; + while (pInfo) { + EnableDevice(pInfo->dev); + pInfo = pInfo->next; + } + EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); +#endif +} + +static void +DoApmEvent(pmEvent event, Bool undo) +{ /* * we leave that as a global function for now. I don't know if * this might cause problems in the future. It is a global server * variable therefore it needs to be in a server info structure */ - static Bool suspended; int i; switch(event) { @@ -48,47 +117,19 @@ case XF86_APM_USER_STANDBY: case XF86_APM_USER_SUSPEND: /* should we do this ? */ - if (!suspended) { - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); - } - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i,event); - else - xf86Screens[i]->LeaveVT(i, 0); - } - xf86AccessLeave(); - xf86AccessLeaveState(); + if (!undo && !suspended) { + suspend(event,undo); suspended = TRUE; + } else if (undo && suspended) { + resume(event,undo); + suspended = FALSE; } break; case XF86_APM_STANDBY_RESUME: case XF86_APM_NORMAL_RESUME: case XF86_APM_CRITICAL_RESUME: - case XF86_APM_STANDBY_FAILED: - case XF86_APM_SUSPEND_FAILED: if (suspended) { - xf86AccessEnter(); - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i,event); - else - xf86Screens[i]->EnterVT(i, 0); - } - xf86EnterServerState(OPERATING); - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); - } - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); + resume(event,undo); suspended = FALSE; } break; @@ -97,7 +138,7 @@ for (i = 0; i < xf86NumScreens; i++) { xf86EnableAccess(xf86Screens[i]); if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i,event); + xf86Screens[i]->PMEvent(i,event,undo); } xf86EnterServerState(OPERATING); break; @@ -112,7 +153,7 @@ pmEvent events[MAX_NO_EVENTS]; int i,n; Bool wait = FALSE; - + if (!xf86PMGetEventFromOs) return; @@ -121,12 +162,16 @@ for (i = 0; i < n; i++) { xf86MsgVerb(X_INFO,3,"PM Event received: %s\n", eventName(events[i])); - DoApmEvent(events[i]); + DoApmEvent(events[i],FALSE); switch (xf86PMConfirmEventToOs(fd,events[i])) { case PM_WAIT: wait = TRUE; break; case PM_CONTINUE: + wait = FALSE; + break; + case PM_FAILED: + DoApmEvent(events[i],TRUE); wait = FALSE; break; default: Index: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.98 xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.119 --- xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.98 Fri May 11 03:56:10 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h Tue Jan 15 21:00:43 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.98 2001/05/11 07:56:10 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.119 2002/01/16 02:00:43 martin Exp $ */ /* * PCI Probe * @@ -38,7 +38,9 @@ #ifndef _XF86_PCIINFO_H #define _XF86_PCIINFO_H +#ifndef SELF_CONTAINED_PCI_INFO #include "xf86str.h" +#endif /* PCI Pseudo Vendor */ #define PCI_VENDOR_GENERIC 0x00FF @@ -93,6 +95,7 @@ #define PCI_VENDOR_LEADTEK 0x107D #define PCI_VENDOR_CONTAQ 0x1080 #define PCI_VENDOR_FOREX 0x1083 +#define PCI_VENDOR_SBS 0x108A #define PCI_VENDOR_OLICOM 0x108D #define PCI_VENDOR_SUN 0x108E #define PCI_VENDOR_DIAMOND 0x1092 @@ -199,6 +202,7 @@ /* ATI */ #define PCI_CHIP_MACH32 0x4158 +#define PCI_CHIP_R200_BB 0x4242 #define PCI_CHIP_MACH64CT 0x4354 #define PCI_CHIP_MACH64CX 0x4358 #define PCI_CHIP_MACH64ET 0x4554 @@ -218,6 +222,7 @@ #define PCI_CHIP_MACH64GV 0x4756 #define PCI_CHIP_MACH64GW 0x4757 #define PCI_CHIP_MACH64GX 0x4758 +#define PCI_CHIP_MACH64GY 0x4759 #define PCI_CHIP_MACH64GZ 0x475A #define PCI_CHIP_MACH64LB 0x4C42 #define PCI_CHIP_MACH64LD 0x4C44 @@ -228,23 +233,38 @@ #define PCI_CHIP_MACH64LM 0x4C4D #define PCI_CHIP_MACH64LN 0x4C4E #define PCI_CHIP_MACH64LP 0x4C50 +#define PCI_CHIP_MACH64LQ 0x4C51 #define PCI_CHIP_MACH64LR 0x4C52 #define PCI_CHIP_MACH64LS 0x4C53 +#define PCI_CHIP_RADEON_LW 0x4C57 +#define PCI_CHIP_RADEON_LY 0x4C59 +#define PCI_CHIP_RADEON_LZ 0x4C5A #define PCI_CHIP_RAGE128MF 0x4D46 #define PCI_CHIP_RAGE128ML 0x4D4C #define PCI_CHIP_RAGE128PD 0x5044 #define PCI_CHIP_RAGE128PF 0x5046 +#define PCI_CHIP_RAGE128PP 0x5050 #define PCI_CHIP_RAGE128PR 0x5052 #define PCI_CHIP_RADEON_QD 0x5144 #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_R200_QL 0x514C +#define PCI_CHIP_R200_QN 0x514E +#define PCI_CHIP_R200_QO 0x514F +#define PCI_CHIP_RV200_QW 0x5157 +#define PCI_CHIP_RADEON_QY 0x5159 +#define PCI_CHIP_RADEON_QZ 0x515A +#define PCI_CHIP_R200_Ql 0x516C #define PCI_CHIP_RAGE128RE 0x5245 #define PCI_CHIP_RAGE128RF 0x5246 #define PCI_CHIP_RAGE128RG 0x5247 #define PCI_CHIP_RAGE128RK 0x524B #define PCI_CHIP_RAGE128RL 0x524C +#define PCI_CHIP_RAGE128TF 0x5446 +#define PCI_CHIP_RAGE128TL 0x544C +#define PCI_CHIP_RAGE128TR 0x5452 +#define PCI_CHIP_RAGE128SM 0x534D #define PCI_CHIP_MACH64VT 0x5654 #define PCI_CHIP_MACH64VU 0x5655 #define PCI_CHIP_MACH64VV 0x5656 @@ -330,6 +350,8 @@ #define PCI_CHIP_8520 0x8520 #define PCI_CHIP_8600 0x8600 #define PCI_CHIP_8620 0x8620 +#define PCI_CHIP_8800 0x8800 +#define PCI_CHIP_8820 0x8820 #define PCI_CHIP_9320 0x9320 #define PCI_CHIP_9388 0x9388 #define PCI_CHIP_9397 0x9397 @@ -358,10 +380,12 @@ #define PCI_CHIP_MGAG200_PCI 0x0520 #define PCI_CHIP_MGAG200 0x0521 #define PCI_CHIP_MGAG400 0x0525 +#define PCI_CHIP_MGAG550 0x2527 #define PCI_CHIP_IMPRESSION 0x0D10 #define PCI_CHIP_MGAG100_PCI 0x1000 #define PCI_CHIP_MGAG100 0x1001 +#define PCI_CARD_G400_TH 0x2179 #define PCI_CARD_MILL_G200_SD 0xff00 #define PCI_CARD_PROD_G100_SD 0xff01 #define PCI_CARD_MYST_G200_SD 0xff02 @@ -468,6 +492,15 @@ #define PCI_CHIP_I128_T2R 0x493D #define PCI_CHIP_I128_T2R4 0x5348 +/* Sun */ +#define PCI_CHIP_EBUS 0x1000 +#define PCI_CHIP_HAPPY_MEAL 0x1001 +#define PCI_CHIP_SIMBA 0x5000 +#define PCI_CHIP_PSYCHO 0x8000 +#define PCI_CHIP_SCHIZO 0x8001 +#define PCI_CHIP_SABRE 0xA000 +#define PCI_CHIP_HUMMINGBIRD 0xA001 + /* BrookTree */ #define PCI_CHIP_BT848 0x0350 #define PCI_CHIP_BT849 0x0351 @@ -480,8 +513,6 @@ #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_ITNT2 0x00A0 #define PCI_CHIP_GEFORCE256 0x0100 #define PCI_CHIP_GEFORCEDDR 0x0101 @@ -494,10 +525,23 @@ #define PCI_CHIP_GEFORCE2GTS_1 0x0151 #define PCI_CHIP_GEFORCE2ULTRA 0x0152 #define PCI_CHIP_QUADRO2PRO 0x0153 +#define PCI_CHIP_0x0170 0x0170 +#define PCI_CHIP_0x0171 0x0171 +#define PCI_CHIP_0x0172 0x0172 +#define PCI_CHIP_0x0173 0x0173 +#define PCI_CHIP_0x0174 0x0174 +#define PCI_CHIP_0x0175 0x0175 +#define PCI_CHIP_0x0178 0x0178 +#define PCI_CHIP_0x017A 0x017A +#define PCI_CHIP_0x017B 0x017B +#define PCI_CHIP_0x017C 0x017C +#define PCI_CHIP_IGEFORCE2 0x01A0 #define PCI_CHIP_GEFORCE3 0x0200 #define PCI_CHIP_GEFORCE3_1 0x0201 #define PCI_CHIP_GEFORCE3_2 0x0202 -#define PCI_CHIP_GEFORCE3_3 0x0203 +#define PCI_CHIP_QUADRO_DDC 0x0203 +#define PCI_CHIP_0x0250 0x0250 +#define PCI_CHIP_0x0258 0x0258 /* NVIDIA & SGS */ #define PCI_CHIP_RIVA128 0x0018 @@ -596,6 +640,8 @@ #define PCI_CHIP_NM2380 0x0016 /* Intel */ +#define PCI_CHIP_I830_M_BRIDGE 0x3575 +#define PCI_CHIP_I830_M 0x3577 #define PCI_CHIP_I815_BRIDGE 0x1130 #define PCI_CHIP_I815 0x1132 #define PCI_CHIP_I810_BRIDGE 0x7120 @@ -672,6 +718,7 @@ {PCI_VENDOR_LEADTEK, "Leadtek"}, {PCI_VENDOR_CONTAQ, "Contaq"}, {PCI_VENDOR_FOREX, "FOREX"}, + {PCI_VENDOR_SBS, "SBS Technologies"}, /* Formerly Bit 3 Computer Corp */ {PCI_VENDOR_OLICOM, "Olicom"}, {PCI_VENDOR_SUN, "Sun"}, {PCI_VENDOR_DIAMOND, "Diamond"}, @@ -744,7 +791,7 @@ #endif /* Increase this as required */ -#define MAX_DEV_PER_VENDOR 64 +#define MAX_DEV_PER_VENDOR 80 typedef struct { unsigned short VendorID; @@ -792,6 +839,7 @@ #endif {PCI_VENDOR_ATI, { {PCI_CHIP_MACH32, "Mach32",0}, + {PCI_CHIP_R200_BB, "Radeon 8500 BB",0}, {PCI_CHIP_MACH64CT, "Mach64 CT",0}, {PCI_CHIP_MACH64CX, "Mach64 CX",0}, {PCI_CHIP_MACH64ET, "Mach64 ET",0}, @@ -811,6 +859,7 @@ {PCI_CHIP_MACH64GV, "Mach64 GV",0}, {PCI_CHIP_MACH64GW, "Mach64 GW",0}, {PCI_CHIP_MACH64GX, "Mach64 GX",0}, + {PCI_CHIP_MACH64GY, "Mach64 GY",0}, {PCI_CHIP_MACH64GZ, "Mach64 GZ",0}, {PCI_CHIP_MACH64LB, "Mach64 LB",0}, {PCI_CHIP_MACH64LD, "Mach64 LD",0}, @@ -821,18 +870,33 @@ {PCI_CHIP_MACH64LM, "Mach64 LM",0}, {PCI_CHIP_MACH64LN, "Mach64 LN",0}, {PCI_CHIP_MACH64LP, "Mach64 LP",0}, + {PCI_CHIP_MACH64LQ, "Mach64 LQ",0}, {PCI_CHIP_MACH64LR, "Mach64 LR",0}, {PCI_CHIP_MACH64LS, "Mach64 LS",0}, {PCI_CHIP_RAGE128MF, "Rage 128 Mobility MF",0}, {PCI_CHIP_RAGE128ML, "Rage 128 Mobility ML",0}, {PCI_CHIP_RAGE128PD, "Rage 128 Pro PD",0}, {PCI_CHIP_RAGE128PF, "Rage 128 Pro PF",0}, + {PCI_CHIP_RAGE128PP, "Rage 128 Pro PP",0}, {PCI_CHIP_RAGE128PR, "Rage 128 Pro PR",0}, + {PCI_CHIP_RAGE128TF, "Rage 128 Pro TF",0}, + {PCI_CHIP_RAGE128TL, "Rage 128 Pro TL",0}, + {PCI_CHIP_RAGE128TR, "Rage 128 Pro TR",0}, {PCI_CHIP_RADEON_QD, "Radeon QD",0}, {PCI_CHIP_RADEON_QE, "Radeon QE",0}, {PCI_CHIP_RADEON_QF, "Radeon QF",0}, {PCI_CHIP_RADEON_QG, "Radeon QG",0}, - {PCI_CHIP_RADEON_VE, "Radeon VE",0}, + {PCI_CHIP_R200_QL, "Radeon 8500 QL",0}, + {PCI_CHIP_R200_QN, "Radeon 8500 QN",0}, + {PCI_CHIP_R200_QO, "Radeon 8500 QO",0}, + {PCI_CHIP_RV200_QW, "Radeon 7500 QW",0}, + {PCI_CHIP_RADEON_QY, "Radeon VE QY",0}, + {PCI_CHIP_RADEON_QZ, "Radeon VE QZ",0}, + {PCI_CHIP_R200_Ql, "Radeon 8500 Ql",0}, + {PCI_CHIP_RADEON_LW, "Radeon Mobility M7 LW",0}, + {PCI_CHIP_RADEON_LY, "Radeon Mobility M6 LY",0}, + {PCI_CHIP_RADEON_LZ, "Radeon Mobility M6 LZ",0}, + {PCI_CHIP_RAGE128SM, "Rage 128 SM",0}, {PCI_CHIP_RAGE128RE, "Rage 128 RE",0}, {PCI_CHIP_RAGE128RF, "Rage 128 RF",0}, {PCI_CHIP_RAGE128RK, "Rage 128 RK",0}, @@ -949,6 +1013,8 @@ {PCI_CHIP_8520, "CyberBlade/DSTN/i1",0}, {PCI_CHIP_8600, "CyberBlade/Ai1",0}, {PCI_CHIP_8620, "CyberBlade/DSTN/Ai1",0}, + {PCI_CHIP_8800, "CyberBlade/XP/Ai1",0}, + {PCI_CHIP_8820, "CyberBlade/XP/DSTN/Ai1",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_ALI, { @@ -964,6 +1030,7 @@ {PCI_CHIP_MGAG200_PCI, "MGA G200 PCI",0}, {PCI_CHIP_MGAG200, "MGA G200 AGP",0}, {PCI_CHIP_MGAG400, "MGA G400 AGP",0}, + {PCI_CHIP_MGAG550, "MGA G550 AGP",0}, {PCI_CHIP_MGAG100_PCI, "MGA G100 PCI",0}, {PCI_CHIP_MGAG100, "MGA G100 AGP",0}, {0x0000, NULL,0}}}, @@ -1122,6 +1189,11 @@ {PCI_VENDOR_FOREX, { {0x0000, NULL,0}}}, #endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {PCI_VENDOR_SBS, { + {0x0040, "dataBLIZZARD",0 }, + {0x0000, NULL,0}}}, +#endif {PCI_VENDOR_OLICOM, { {0x0001, "OC-3136",0 }, {0x0011, "OC-2315",0 }, @@ -1131,10 +1203,13 @@ {0x0021, "OC-6151",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_SUN, { - {0x1000, "EBUS",0 }, - {0x1001, "Happy Meal",0 }, - {0x5000, "Advanced PCI bridge",0 }, - {0x8000, "PCI Bus Module",0 }, + {PCI_CHIP_EBUS, "EBUS",0 }, + {PCI_CHIP_HAPPY_MEAL, "Happy Meal",0 }, + {PCI_CHIP_SIMBA, "Simba Advanced PCI bridge",0 }, + {PCI_CHIP_PSYCHO, "U2P PCI host bridge (Psycho)",0 }, + {PCI_CHIP_SCHIZO, "PCI host bridge (Schizo)",0 }, + {PCI_CHIP_SABRE, "UltraSPARC IIi host bridge (Sabre)",0 }, + {PCI_CHIP_HUMMINGBIRD, "UltraSPARC IIi host bridge (Hummingbird)",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_CMD, { {0x0640, "640A",0 }, @@ -1235,28 +1310,40 @@ {PCI_VENDOR_NVIDIA, { {PCI_CHIP_NV1, "NV1",0}, {PCI_CHIP_DAC64, "DAC64",0}, - {PCI_CHIP_TNT, "Riva TNT",0}, - {PCI_CHIP_TNT2, "Riva TNT2",0}, - {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_ITNT2, "Riva Integrated",0}, + {PCI_CHIP_TNT, "RIVA TNT",0}, + {PCI_CHIP_TNT2, "RIVA TNT2/TNT2 Pro",0}, + {PCI_CHIP_UTNT2, "RIVA TNT2 Ultra",0}, + {PCI_CHIP_VTNT2, "Vanta",0}, + {PCI_CHIP_UVTNT2, "Riva TNT2 M64",0}, + {PCI_CHIP_ITNT2, "Aladdin TNT2",0}, {PCI_CHIP_GEFORCE256, "GeForce 256",0}, {PCI_CHIP_GEFORCEDDR, "GeForce DDR",0}, {PCI_CHIP_QUADRO, "Quadro",0}, - {PCI_CHIP_GEFORCE2MX, "GeForce2 MX",0}, - {PCI_CHIP_GEFORCE2MXDDR,"GeForce2 MX DDR",0}, - {PCI_CHIP_QUADRO2MXR, "GeForce2 MXR",0}, - {PCI_CHIP_GEFORCE2GTS, "GeForce2 GTS",0}, - {PCI_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)",0}, + {PCI_CHIP_GEFORCE2MX, "GeForce2 MX/MX 400",0}, + {PCI_CHIP_GEFORCE2MXDDR,"GeForce2 MX 100/200",0}, + {PCI_CHIP_GEFORCE2GO, "GeForce2 Go", 0}, + {PCI_CHIP_QUADRO2MXR, "Quadro2 MXR",0}, + {PCI_CHIP_GEFORCE2GTS, "GeForce2 GTS/Pro",0}, + {PCI_CHIP_GEFORCE2GTS_1,"GeForce2 Ti",0}, {PCI_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra",0}, - {PCI_CHIP_QUADRO2PRO, "Quadro 2 Pro",0}, + {PCI_CHIP_QUADRO2PRO, "Quadro2 Pro",0}, + {PCI_CHIP_0x0170, "0x0170",0}, + {PCI_CHIP_0x0171, "0x0171",0}, + {PCI_CHIP_0x0172, "0x0172",0}, + {PCI_CHIP_0x0173, "0x0173",0}, + {PCI_CHIP_0x0174, "0x0174",0}, + {PCI_CHIP_0x0175, "0x0175",0}, + {PCI_CHIP_0x0178, "0x0178",0}, + {PCI_CHIP_0x017A, "0x017A",0}, + {PCI_CHIP_0x017B, "0x017B",0}, + {PCI_CHIP_0x017C, "0x017C",0}, + {PCI_CHIP_IGEFORCE2, "GeForce2 Integrated",0}, {PCI_CHIP_GEFORCE3, "GeForce3",0}, - {PCI_CHIP_GEFORCE3_1, "GeForce3 (rev 1)",0}, - {PCI_CHIP_GEFORCE3_2, "GeForce3 (rev 2)",0}, - {PCI_CHIP_GEFORCE3_3, "GeForce3 (rev 3)",0}, + {PCI_CHIP_GEFORCE3_1, "GeForce3 Ti 200",0}, + {PCI_CHIP_GEFORCE3_2, "GeForce3 Ti 500",0}, + {PCI_CHIP_QUADRO_DDC, "Quadro DDC",0}, + {PCI_CHIP_0x0250, "0x0250",0}, + {PCI_CHIP_0x0258, "0x0258",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_IMS, { {PCI_CHIP_IMSTT128, "TwinTurbo 128", 0}, @@ -1465,6 +1552,7 @@ {PCI_CHIP_968, "968",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_INTEL,{ +#ifdef VENDOR_INCLUDE_NONVIDEO {0x0482, "82375EB pci-eisa bridge",0}, {0x0483, "82424ZX cache dram controller",0}, {0x0484, "82378IB/ZB pci-isa bridge",0x0601}, @@ -1504,15 +1592,18 @@ {0x71a2, "82443GX Host (no AGP)",0}, {0x84C4, "P6",0}, {0x84C5, "82450GX20",0}, - {PCI_CHIP_I740_AGP, "i740 (AGP)",0}, - {PCI_CHIP_I815_BRIDGE, "i815 Bridge",0}, - {PCI_CHIP_I815, "i815",0}, {PCI_CHIP_I810_BRIDGE, "i810 Bridge",0}, - {PCI_CHIP_I810, "i810",0}, {PCI_CHIP_I810_DC100_BRIDGE, "i810-dc100 Bridge",0}, - {PCI_CHIP_I810_DC100, "i810-dc100",0}, {PCI_CHIP_I810_E_BRIDGE,"i810e Bridge",0}, + {PCI_CHIP_I815_BRIDGE, "i815 Bridge",0}, + {PCI_CHIP_I830_M_BRIDGE,"i830M Bridge",0}, +#endif + {PCI_CHIP_I740_AGP, "i740 (AGP)",0}, + {PCI_CHIP_I810, "i810",0}, + {PCI_CHIP_I810_DC100, "i810-dc100",0}, {PCI_CHIP_I810_E, "i810e",0}, + {PCI_CHIP_I815, "i815",0}, + {PCI_CHIP_I830_M, "i830M",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_ADAPTEC, { {0x0010, "2940U2",0 }, @@ -1669,6 +1760,7 @@ { 0x0127, "Permedia3 Create!",0, NF }, { 0x0134, "Oxygen GVX1 PCI",0, NF }, { 0x0136, "Oxygen GVX210 AGP",0, NF }, + { 0x0139, "Oxygen GVX1 Pro AGP",0, NF }, { 0x0140, "Oxygen VX1-16 AGP",0, NF }, { 0x0144, "Oxygen VX1-4X AGP",0, NF }, { 0x0400, "Oxygen GVX420 AGP",0, NF }, @@ -1747,8 +1839,11 @@ {PCI_VENDOR_INTEL, { #ifdef VENDOR_INCLUDE_NONVIDEO { 0x0009, "PCI 10/100Mb/s ethernet card",0, NF }, + { 0x0040, "PRO/100 S Desktop Adapter PCI 10/100Mb/s ethernet card",0, NF }, /* Seattle AL440BX is 0x8080, is anything else ? */ { 0x8080, "motherboard",0, NF }, + { 0x3013, "Integrated LAN (82562ET)",0, NF }, + { 0x4541, "Eastern (D815EEA) motherboard",0, NF }, { 0x4d55, "Maui (MU) motherboard",0, NF }, #endif { 0x0000, (char *)NULL,0, NF } } }, @@ -1763,6 +1858,7 @@ { PCI_CARD_MILL_G200_SG, "Millennium G200 SG",0, NF }, { PCI_CARD_MARV_G200_SD, "Marvel G200 SD",0, NF }, { 0x1001, "Productiva G100 SG",0, NF }, + { PCI_CARD_G400_TH, "G400 Twin Head",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_SIS, { { 0x6306, "530 based motherboard",0, NF }, Index: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.72 xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.76 --- xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.72 Tue May 15 14:22:21 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Priv.h Mon Jan 14 20:56:56 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.72 2001/05/15 18:22:21 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.76 2002/01/15 01:56:56 dawes Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -61,6 +61,7 @@ extern MessageType xf86ModPathFrom; extern const char *xf86LogFile; extern MessageType xf86LogFileFrom; +extern Bool xf86LogFileWasOpened; extern serverLayoutRec xf86ConfigLayout; extern Pix24Flags xf86ConfigPix24; @@ -89,7 +90,7 @@ extern Bool xf86DoProbe; #ifndef DEFAULT_VERBOSE -#define DEFAULT_VERBOSE 1 +#define DEFAULT_VERBOSE 0 #endif #ifndef DEFAULT_LOG_VERBOSE #define DEFAULT_LOG_VERBOSE 3 @@ -157,7 +158,7 @@ void xf86HandlePMEvents(int fd, pointer data); extern int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num); extern pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event); - +void xf86GrabServerCallback(CallbackListPtr *, pointer, pointer); /* xf86Helper.c */ void xf86LogInit(void); Index: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.25 xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.30 --- xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.25 Fri May 18 12:03:11 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h Fri Nov 30 07:11:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.25 2001/05/18 16:03:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.30 2001/11/30 12:11:55 eich Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -59,6 +59,9 @@ #if defined(SVR4) && defined(i386) Bool panix106; #endif /* SVR4 && i386 */ +#if defined(__OpenBSD__) || defined(__NetBSD__) + int wsKbdType; +#endif /* mouse part */ DeviceIntPtr pMouse; @@ -83,9 +86,6 @@ * vga card */ int consType; /* Which console driver? */ #endif -#if defined(AMOEBA) - void * screenPtr; -#endif #ifdef XKB /* @@ -121,8 +121,21 @@ Bool pc98; #endif Bool pmFlag; + Bool syncLog; int estimateSizesAggressively; Bool kbdCustomKeycodes; + struct { + Bool disabled; /* enable/disable deactivating + * grabs or closing the + * connection to the grabbing + * client */ + ClientPtr override; /* client that disabled + * grab deactivation. + */ + Bool allowDeactivate; + Bool allowClosedown; + ServerGrabInfoRec server; + } grabInfo; } xf86InfoRec, *xf86InfoPtr; #ifdef DPMSExtension Index: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.11.4.1 xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.13 --- xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.11.4.1 Mon May 28 10:23:37 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Resources.h Fri Jun 1 14:43:49 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.11.4.1 2001/05/28 14:23:37 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.13 2001/06/01 18:43:49 tsi Exp $ */ #ifndef _XF86_RESOURCES_H @@ -80,16 +80,16 @@ {ResShrIoSparse | ResBios | ResBus, 0x02E8, 0x03F8} /* predefined resources */ -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[]; +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[]; /* 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.9 xc/programs/Xserver/hw/xfree86/common/xf86Switch.c:removed --- xc/programs/Xserver/hw/xfree86/common/xf86Switch.c:3.9 Fri Apr 20 12:32:31 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Switch.c Fri Jan 18 15:25:05 2002 @@ -1,225 +0,0 @@ -/* - * Copyright 1997-1998 by Frederic Lepied, France. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Frederic Lepied not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Frederic Lepied makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Switch.c,v 3.9 2001/04/20 16:32:31 tsi Exp $ */ - -#include "xf86.h" -#include "xf86Xinput.h" - -/****************************************************************************** - * debugging macro - *****************************************************************************/ -#ifdef DBG -#undef DBG -#endif -#ifdef DEBUG -#undef DEBUG -#endif - -static int debug_level = 0; -#define DEBUG 1 -#if DEBUG -#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} -#else -#define DBG(lvl, f) -#endif - -/****************************************************************************** - * device records - *****************************************************************************/ - -typedef struct -{ - XID last; /* last core pointer */ -} SwitchDevRec, *SwitchDevPtr; - -/* - *************************************************************************** - * - * xf86SwtConvert -- - * Convert valuators to X and Y. - * - *************************************************************************** - */ -static Bool -xf86SwtConvert(LocalDevicePtr local, - int first, - int num, - int v0, - int v1, - int v2, - int v3, - int v4, - int v5, - int* x, - int* y) -{ - return FALSE; -} - -/* - * xf86SwitchCoreDevice -- - * Test if the core device has changed and send a motion event accordingly. - */ -void -xf86SwitchCoreDevice(LocalDevicePtr local, - DeviceIntPtr core) -{ - SwitchDevPtr priv; - - if (!local) - return; - - priv = (SwitchDevPtr) local->private; - - if (core->id != priv->last) { - DBG(3, ErrorF("xf86SwitchCoreDevice new core id=%d old=%d\n", core->id, priv->last)); - priv->last = core->id; - xf86PostMotionEvent(local->dev, 1, 0, 1, core->id); - } -} - -static void -xf86SwtControlProc(DeviceIntPtr device, - PtrCtrl *ctrl) -{ - DBG(2, ErrorF("xf86SwtControlProc\n")); -} - -/* - * xf86SwtProc -- - * Handle the initialization, etc. of a switch - */ -static int -xf86SwtProc(pSwt, what) - DeviceIntPtr pSwt; - int what; -{ - int loop; - int nbaxes; - LocalDevicePtr local = (LocalDevicePtr)pSwt->public.devicePrivate; - SwitchDevPtr priv = (SwitchDevPtr)XI_PRIVATE(pSwt); - - DBG(2, ErrorF("BEGIN xf86SwtProc dev=0x%x priv=0x%x\n", pSwt, priv)); - - switch (what) - { - case DEVICE_INIT: - DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=INIT\n", pSwt)); - - nbaxes = 1; - - if (InitFocusClassDeviceStruct(pSwt) == FALSE) - { - ErrorF("unable to init Focus class device\n"); - return !Success; - } - - if (InitValuatorClassDeviceStruct(pSwt, - nbaxes, - xf86GetMotionEvents, - local->history_size, - Absolute) /* relatif ou absolute */ - == FALSE) - { - ErrorF("unable to allocate Valuator class device\n"); - return !Success; - } - else - { - for(loop=0; loopatom, local->name); - } - - break; - - case DEVICE_ON: - DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=ON\n", pSwt)); - pSwt->public.on = TRUE; - break; - - case DEVICE_OFF: - case DEVICE_CLOSE: - DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=%s\n", pSwt, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - pSwt->public.on = FALSE; - break; - - default: - ErrorF("unsupported mode=%d\n", what); - return !Success; - break; - } - DBG(2, ErrorF("END xf86SwtProc dev=0x%x priv=0x%x\n", pSwt, priv)); - return Success; -} - -/* - * xf86SwtAllocate -- - * Allocate Switch device structures. - */ -static LocalDevicePtr -xf86SwtAllocate() -{ - LocalDevicePtr local = (LocalDevicePtr) xalloc(sizeof(LocalDeviceRec)); - SwitchDevPtr priv = (SwitchDevPtr) xalloc(sizeof(SwitchDevRec)); - - local->name = "SWITCH"; - local->flags = 0; - local->device_control = xf86SwtProc; - local->read_input = NULL; - local->close_proc = NULL; - local->control_proc = NULL; - local->switch_mode = NULL; - local->conversion_proc = xf86SwtConvert; - local->fd = -1; - local->atom = 0; - local->dev = NULL; - local->private = priv; - local->type_name = "Switch"; - local->history_size = 0; - - priv->last = -1; - - return local; -} - -/* - * switch association - */ -DeviceAssocRec switch_assoc = -{ - " ", /* config_section_name */ - xf86SwtAllocate /* device_allocate */ -}; - -/* end of xf86Switch.c */ Index: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86XKB.c:3.9 xc/programs/Xserver/hw/xfree86/common/xf86XKB.c:3.10 --- xc/programs/Xserver/hw/xfree86/common/xf86XKB.c:3.9 Tue May 23 00:47:41 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86XKB.c Mon Jul 23 09:15:47 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.9 2000/05/23 04:47:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.10 2001/07/23 13:15:47 dawes Exp $ */ #include #define NEED_EVENTS 1 @@ -44,18 +44,6 @@ #include "xf86_OSlib.h" #include "XKBsrv.h" - -#ifdef AMOEBA -#define LED_CAP IOP_LED_CAP -#define LED_NUM IOP_LED_NUM -#define LED_SCR IOP_LED_SCROLL -#endif - -#ifdef MINIX -#define LED_CAP KBD_LEDS_CAPS -#define LED_NUM KBD_LEDS_NUM -#define LED_SCR KBD_LEDS_SCROLL -#endif void xf86InitXkb(void) Index: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.63 xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.66 --- xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.63 Sun Apr 1 10:00:08 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c Fri Aug 17 09:27:54 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.63 2001/04/01 14:00:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.66 2001/08/17 13:27:54 dawes Exp $ */ #include "Xfuncproto.h" #include "Xmd.h" @@ -52,6 +52,7 @@ #include "exevents.h" /* AddInputDevice */ #include "exglobals.h" +#define EXTENSION_PROC_ARGS void * #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ @@ -88,12 +89,6 @@ *****************************************************************************/ #define ENQUEUE(e) xf86eqEnqueue((e)) -/****************************************************************************** - * Global variables - *****************************************************************************/ -static LocalDevicePtr switch_device = NULL; -extern DeviceAssocRec switch_assoc; - /*********************************************************************** * * xf86AlwaysCoreControl -- @@ -297,6 +292,10 @@ xf86XinputFinalizeInit(dev); + /* + * XXX Can a single device instance be both core keyboard and + * core pointer? If so, this should be changed. + */ if (local->flags & XI86_CORE_POINTER) RegisterPointerDevice(dev); else if (local->flags & XI86_CORE_KEYBOARD) @@ -312,40 +311,7 @@ } } -#if 0 -/*********************************************************************** - * - * InitExtInput -- - * - * Initialize any extended devices we might have. It is called from - * ddx InitInput. - * - *********************************************************************** - */ -void -InitExtInput() -{ - LocalDevicePtr local; - /* Register a Wakeup handler to handle input when generated */ - RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA, ReadInput, - NULL); - - /* Create and initialize the special device Switch */ - local = switch_assoc.device_allocate(); - switch_device = local; - switch_device->flags |= XI86_CONFIGURED; /* no configuration available */ - switch_device->next = xf86FirstLocalDevice(); - - /* Add each device */ - while(local) { - xf86ActivateDevice(local); - local = local->next; - } -} -#endif - - #ifdef XINPUT /*********************************************************************** * @@ -474,11 +440,6 @@ axes_changed = FALSE; *************************************************************************/ - /* Return failure if we try with the Switch device */ - if (switch_device && new_dev == switch_device->dev) { - return !Success; - } - /* * We don't allow axis swap or other exotic features. */ @@ -894,23 +855,19 @@ int oldaxis[6]; int *axisvals; AxisInfoPtr axes; - int dx, dy; + int dx = 0, dy = 0; float mult; int x, y; int loop_start; int i; int num; - DBG(5, ErrorF("xf86PostMotionEvent BEGIN 0x%x(%s) switch=0x%x is_core=%s is_shared=%s is_absolute=%s\n", - device, device->name, switch_device, + DBG(5, ErrorF("xf86PostMotionEvent BEGIN 0x%x(%s) is_core=%s is_shared=%s is_absolute=%s\n", + device, device->name, is_core ? "True" : "False", is_shared ? "True" : "False", is_absolute ? "True" : "False")); - if (is_core || is_shared) { - xf86SwitchCoreDevice(switch_device, device); - } - xf86Info.lastEventTime = xev->time = current = GetTimeInMillis(); if (!is_core) { @@ -930,7 +887,7 @@ va_start(var, num_valuators); - loop_start = 0; + loop_start = first_valuator; for(loop=0; loop= 2 && loop_start == 0) { + if (is_core || + (is_shared && num_valuators >= 2 && loop_start == 0)) { #ifdef XFreeXDGA /* * Let DGA peek at the event and steal it @@ -1073,7 +1031,7 @@ axisvals[1] = y; } } - loop_start = loop + 1; + loop_start += 6; } } va_end(var); @@ -1082,8 +1040,8 @@ if (local->last == local->first) local->first = (local->first + 1) % device->valuator->numMotionEvents; } - DBG(5, ErrorF("xf86PostMotionEvent END 0x%x(%s) switch=0x%x is_core=%s is_shared=%s\n", - device, device->name, switch_device, + DBG(5, ErrorF("xf86PostMotionEvent END 0x%x(%s) is_core=%s is_shared=%s\n", + device, device->name, is_core ? "True" : "False", is_shared ? "True" : "False")); } @@ -1218,10 +1176,6 @@ if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) { ErrorF("Bad valuators reported for device \"%s\"\n", device->name); return; - } - - if (is_core || is_shared) { - xf86SwitchCoreDevice(switch_device, device); } if (!is_core) { Index: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86cmap.c:1.22 xc/programs/Xserver/hw/xfree86/common/xf86cmap.c:1.23 --- xc/programs/Xserver/hw/xfree86/common/xf86cmap.c:1.22 Sun May 6 17:59:07 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86cmap.c Fri Nov 16 11:47:55 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.22 2001/05/06 21:59:07 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.23 2001/11/16 16:47:55 dawes Exp $ */ -#ifdef _XOPEN_SOURCE +#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) #include #else #define _XOPEN_SOURCE /* to get prototype for pow on some systems */ Index: xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c:1.1 xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c:1.2 --- xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c:1.1 Wed Dec 6 10:35:11 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c Sat Oct 27 23:33:19 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c,v 1.1 2000/12/06 15:35:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c,v 1.2 2001/10/28 03:33:19 tsi Exp $ */ /* * Copyright (c) 2000 by The XFree86 Project, Inc. @@ -31,7 +31,6 @@ xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) { EntityPtr p; - BusAccPtr pbap = xf86BusAccInfo; int num; num = xf86AllocateEntity(); Index: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86fbman.c:1.22 xc/programs/Xserver/hw/xfree86/common/xf86fbman.c:1.24 --- xc/programs/Xserver/hw/xfree86/common/xf86fbman.c:1.22 Thu May 10 06:17:39 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86fbman.c Wed Dec 5 14:23:52 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.22 2001/05/10 10:17:39 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.24 2001/12/05 19:23:52 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -345,6 +345,9 @@ if(!link) return NULL; area = &(link->area); + link->next = offman->UsedAreas; + offman->UsedAreas = link; + offman->NumUsedAreas++; break; } @@ -376,8 +379,6 @@ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg); REGION_UNINIT(pScreen, &NewReg); - offman->NumUsedAreas--; - area = &(link->area); break; } @@ -397,10 +398,6 @@ REGION_INIT(pScreen, &NewReg, &(area->box), 1); REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg); REGION_UNINIT(pScreen, &NewReg); - - link->next = offman->UsedAreas; - offman->UsedAreas = link; - offman->NumUsedAreas++; } return area; @@ -1054,6 +1051,98 @@ REGION_UNINIT(pScreen, &FullRegion); return ret; +} + +Bool +xf86InitFBManagerArea( + ScreenPtr pScreen, + int PixelArea, + int Verbosity +) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + xRectangle Rect[3]; + RegionPtr pRegion, pScreenRegion; + int nRect; + Bool ret = FALSE; + + if (PixelArea < (pScrn->displayWidth * pScrn->virtualY)) + return FALSE; + + Rect[0].x = Rect[0].y = 0; + Rect[0].width = pScrn->displayWidth; + Rect[0].height = PixelArea / pScrn->displayWidth; + nRect = 1; + + /* Add a possible partial scanline */ + if ((Rect[1].height = Rect[1].width = PixelArea % pScrn->displayWidth)) { + Rect[1].x = 0; + Rect[1].y = Rect[0].height; + Rect[1].height = 1; + nRect++; + } + + /* Factor out virtual resolution */ + pRegion = RECTS_TO_REGION(pScreen, nRect, Rect, 0); + if (pRegion) { + if (!REGION_NAR(pRegion)) { + Rect[2].x = Rect[2].y = 0; + Rect[2].width = pScrn->virtualX; + Rect[2].height = pScrn->virtualY; + + pScreenRegion = RECTS_TO_REGION(pScreen, 1, &Rect[2], 0); + if (pScreenRegion) { + if (!REGION_NAR(pScreenRegion)) { + REGION_SUBTRACT(pScreen, pRegion, pRegion, pScreenRegion); + + ret = xf86InitFBManagerRegion(pScreen, pRegion); + + if (ret && xf86GetVerbosity() >= Verbosity) { + int scrnIndex = pScrn->scrnIndex; + + xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, + "Largest offscreen areas (with overlaps):\n"); + + if (Rect[2].width < Rect[0].width) { + xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, + "\t%d x %d rectangle at %d,0\n", + Rect[0].width - Rect[2].width, + Rect[0].height, + Rect[2].width); + } + if (Rect[2].width < Rect[1].width) { + xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, + "\t%d x %d rectangle at %d,0\n", + Rect[1].width - Rect[2].width, + Rect[0].height + Rect[1].height, + Rect[2].width); + } + if (Rect[2].height < Rect[0].height) { + xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, + "\t%d x %d rectangle at 0,%d\n", + Rect[0].width, + Rect[0].height - Rect[2].height, + Rect[2].height); + } + if (Rect[1].height) { + xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, + "\t%d x %d rectangle at 0,%d\n", + Rect[1].width, + Rect[0].height - Rect[2].height + + Rect[1].height, + Rect[2].height); + } + } + } + + REGION_DESTROY(pScreen, pScreenRegion); + } + } + + REGION_DESTROY(pScreen, pRegion); + } + + return ret; } Bool Index: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86fbman.h:1.11 xc/programs/Xserver/hw/xfree86/common/xf86fbman.h:1.12 --- xc/programs/Xserver/hw/xfree86/common/xf86fbman.h:1.11 Fri Jul 14 18:38:50 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86fbman.h Tue Aug 28 12:55:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h,v 1.11 2000/07/14 22:38:50 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h,v 1.12 2001/08/28 16:55:09 tsi Exp $ */ #ifndef _XF86FBMAN_H #define _XF86FBMAN_H @@ -93,6 +93,13 @@ xf86InitFBManagerRegion( ScreenPtr pScreen, RegionPtr ScreenRegion +); + +Bool +xf86InitFBManagerArea( + ScreenPtr pScreen, + int PixalArea, + int Verbosity ); Bool Index: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.42 xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.48 --- xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.42 Wed May 16 03:56:06 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c Fri Nov 30 07:11:55 2001 @@ -1,5 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.42 2001/05/16 07:56:06 alanh Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.48 2001/11/30 12:11:55 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -12,7 +11,7 @@ #include #include "X.h" #include "os.h" -#include "xf86Pci.h" +#include "Pci.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86Resources.h" @@ -81,13 +80,15 @@ #define B2M(tag,base) pciBusAddrToHostAddr(tag,PCI_MEM,base) #define B2I(tag,base) (base) -#define B2H(tag,base,type) ((type & ResMem) ? (B2M(tag,base)) : (B2I(tag,base))) +#define B2H(tag,base,type) (((type & ResPhysMask) == ResMem) ? \ + B2M(tag, base) : B2I(tag, base)) #define M2B(tag,base) pciHostAddrToBusAddr(tag,PCI_IO,base) #define I2B(tag,base) (base) -#define H2B(tag,base,type) (type & ResMem) ? M2B(tag,base) : I2B(tag,base) +#define H2B(tag,base,type) (((type & ResPhysMask) == ResMem) ? \ + M2B(tag, base) : I2B(tag, base)) #define TAG(pvp) (pciTag(pvp->bus,pvp->device,pvp->func)) #define SIZE(size) ((1 << size) - 1) -#define PCI_SIZE(type,tag,size) ((type & ResMem) \ +#define PCI_SIZE(type,tag,size) (((type & ResPhysMask) == ResMem) \ ? pciBusAddrToHostAddr(tag,PCI_MEM_SIZE,size) \ : pciBusAddrToHostAddr(tag,PCI_IO_SIZE,size)) #define PCI_M_RANGE(range,tag,begin,end,type) \ @@ -95,14 +96,14 @@ #define PCI_I_RANGE(range,tag,begin,end,type) \ { RANGE(range,B2I(tag,begin),B2I(tag,end),type); } #define PCI_X_RANGE(range,tag,begin,end,type) \ -{ if (type & ResMem) PCI_M_RANGE(range,tag,begin,end,type); \ +{ if ((type & ResPhysMask) == ResMem) PCI_M_RANGE(range,tag,begin,end,type); \ else PCI_I_RANGE(range,tag,begin,end,type); } #define P_M_RANGE(range,tag,begin,size,type) \ PCI_M_RANGE(range,tag,begin,(begin + SIZE(size)),type) #define P_I_RANGE(range,tag,begin,size,type) \ PCI_I_RANGE(range,tag,begin,(begin + SIZE(size)),type) #define P_X_RANGE(range,tag,begin,size,type) \ -{ if (type & ResMem) P_M_RANGE(range,tag,begin,size,type); \ +{ if ((type & ResPhysMask) == ResMem) P_M_RANGE(range,tag,begin,size,type); \ else P_I_RANGE(range,tag,begin,size,type); } #define PV_M_RANGE(range,pvp,i,type) \ P_M_RANGE(range,TAG(pvp),pvp->memBase[i],pvp->size[i],type) @@ -120,6 +121,20 @@ static void pciConvertListToHost(int bus, int dev, int func, resPtr list); +static Bool +IsBaseUnassigned(CARD32 base) +{ + CARD32 mask; + + if (base & PCI_MAP_IO) + mask = ~PCI_MAP_IO_ATTR_MASK; + else + mask = ~PCI_MAP_MEMORY_ATTR_MASK; + + base &= mask; + return (!base || (base == mask)); +} + static void FindPCIVideoInfo(void) { @@ -220,17 +235,17 @@ } if (PCINONSYSTEMCLASSES(baseclass, subclass)) { - if (!pcrp->pci_base0 && info->size[0]) + if (info->size[0] && IsBaseUnassigned(pcrp->pci_base0)) pcrp->pci_base0 = pciCheckForBrokenBase(pcrp->tag, 0); - if (!pcrp->pci_base1 && info->size[1]) + if (info->size[1] && IsBaseUnassigned(pcrp->pci_base1)) pcrp->pci_base1 = pciCheckForBrokenBase(pcrp->tag, 1); - if (!pcrp->pci_base2 && info->size[2]) + if (info->size[2] && IsBaseUnassigned(pcrp->pci_base2)) pcrp->pci_base2 = pciCheckForBrokenBase(pcrp->tag, 2); - if (!pcrp->pci_base3 && info->size[3]) + if (info->size[3] && IsBaseUnassigned(pcrp->pci_base3)) pcrp->pci_base3 = pciCheckForBrokenBase(pcrp->tag, 3); - if (!pcrp->pci_base4 && info->size[4]) + if (info->size[4] && IsBaseUnassigned(pcrp->pci_base4)) pcrp->pci_base4 = pciCheckForBrokenBase(pcrp->tag, 4); - if (!pcrp->pci_base5 && info->size[5]) + if (info->size[5] && IsBaseUnassigned(pcrp->pci_base5)) pcrp->pci_base5 = pciCheckForBrokenBase(pcrp->tag, 5); } @@ -357,6 +372,38 @@ i++; } + /* If we haven't found a primary device try a different heuristic */ + if (primaryBus.type == BUS_NONE && num) { + i = 0; + while (i < num) { + k = 0; + info = xf86PciVideoInfo[i]; + while ((pcrp = xf86PciInfo[k++])) { + if ( pcrp->busnum == info->bus + && pcrp->devnum == info->device + && pcrp->funcnum == info->func ) + break; + } + + if (pcrp && (num == 1 + || ( info->class == PCI_CLASS_DISPLAY + && info->subclass == PCI_SUBCLASS_DISPLAY_MISC)) + && pcrp->pci_command & PCI_CMD_MEM_ENABLE) { + if (primaryBus.type == BUS_NONE) { + primaryBus.type = BUS_PCI; + primaryBus.id.pci.bus = pcrp->busnum; + primaryBus.id.pci.device = pcrp->devnum; + primaryBus.id.pci.func = pcrp->funcnum; + } else { + xf86Msg(X_NOTICE, + "More than one possible primary device found\n"); + primaryBus.type ^= (BusType)(-1); + } + } + i++; + } + } + /* Print a summary of the video devices found */ { for (k = 0; k < num; k++) { @@ -471,21 +518,23 @@ pAcc = Acc; if (pvp->memBase[j]) while (pAcc) { - if (((pAcc->res_type & (ResMem | ResBlock)) + if (((pAcc->res_type & (ResPhysMask | ResBlock)) == (ResMem | ResBlock)) && (pAcc->block_begin == B2M(TAG(pvp),pvp->memBase[j])) && (pAcc->block_end == B2M(TAG(pvp),pvp->memBase[j] + SIZE(pvp->size[j])))) break; pAcc = pAcc->next; - } else if (pvp->ioBase[j]) + } + else if (pvp->ioBase[j]) while (pAcc) { - if (((pAcc->res_type & (ResIo | ResBlock)) == + if (((pAcc->res_type & (ResPhysMask | ResBlock)) == (ResIo | ResBlock)) && (pAcc->block_begin == B2I(TAG(pvp),pvp->ioBase[j])) && (pAcc->block_end == B2I(TAG(pvp),pvp->ioBase[j] + SIZE(pvp->size[j])))) break; pAcc = pAcc->next; - } else continue; + } + else continue; pvp->size[j] = pciGetBaseSize(tag, j, TRUE, &pvp->validSize); if (pAcc) { pAcc->block_end = pvp->memBase[j] ? @@ -498,7 +547,8 @@ if (pvp->biosBase) { pAcc = Acc; while (pAcc) { - if (((pAcc->res_type & (ResMem | ResBlock)) == (ResMem | ResBlock)) + if (((pAcc->res_type & (ResPhysMask | ResBlock)) == + (ResMem | ResBlock)) && (pAcc->block_begin == B2M(TAG(pvp),pvp->biosBase)) && (pAcc->block_end == B2M(TAG(pvp),pvp->biosBase + SIZE(pvp->biosSize)))) break; @@ -671,6 +721,10 @@ pciReadWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_PMEM_REG); ptr->busdep.pci.save.control = pciReadByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG); + /* Allow master aborts to complete normally on non-root buses */ + if (ptr->busdep.pci.save.control & PCI_PCI_BRIDGE_MASTER_ABORT_EN) + pciWriteByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG, + ptr->busdep.pci.save.control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); } /* move to OS layer */ @@ -723,9 +777,9 @@ for (i = 0; i < 6; i++) { int j = i; if (basep[i] && (pcrp->basesize[i] == old_bits)) - if (((type & ResIo) && PCI_MAP_IS_IO(basep[i]) + if ((((type & ResPhysMask) == ResIo) && PCI_MAP_IS_IO(basep[i]) && (B2I(pcrp->tag,PCIGETIO(basep[i])) == base)) - || ((type & ResMem) && PCI_MAP_IS_MEM(basep[i]) + || (((type & ResPhysMask) == ResMem) && PCI_MAP_IS_MEM(basep[i]) && (((!PCI_MAP_IS64BITMEM(basep[i])) && (B2M(pcrp->tag,PCIGETMEMORY(basep[i])) == base)) #if defined LONG64 || defined WORD64 @@ -743,9 +797,9 @@ for (i = 0; i < 6; i++) { if (pvp->size[i] == old_bits) { - if (((type & ResIo) && pvp->ioBase[i] + if ((((type & ResPhysMask) == ResIo) && pvp->ioBase[i] && (B2I(TAG(pvp),pvp->ioBase[i]) == base)) || - ((type & ResMem) && pvp->memBase[i] + (((type & ResPhysMask) == ResMem) && pvp->memBase[i] && (B2M(TAG(pvp),pvp->memBase[i]) == base))) { pvp->size[i] = new_bits; return; @@ -945,7 +999,8 @@ xf86MsgVerb(X_INFO, 3, "PCI %s resource overlap reduced 0x%08x" " from 0x%08x to 0x%08x\n", - (pRes->res_type & ResMem) ? "Memory" : "I/O", + ((pRes->res_type & ResPhysMask) == ResMem) ? + "Memory" : "I/O", range.rBegin, range.rEnd, pRes->block_end); } } @@ -973,7 +1028,8 @@ xf86MsgVerb(X_INFO, 3, "PCI %s resource overlap reduced 0x%08x" " from 0x%08x to 0x%08x\n", - (pRes->res_type & ResMem) ? "Memory" : "I/O", + ((pRes->res_type & ResPhysMask) == ResMem) ? + "Memory" : "I/O", range.rBegin, range.rEnd, pRes->block_end); } @@ -1022,7 +1078,7 @@ * PCI Resource modification */ static Bool -fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) +fixPciResource(int prt, memType alignment, pciVideoPtr pvp, unsigned long type) { int res_n; memType *p_base; @@ -1063,6 +1119,8 @@ p_base = &(pvp->ioBase[res_n]); p_size = &(pvp->size[res_n]); p_type = pvp->type[res_n]; + PCI_I_RANGE(range, tag, 0, 0xffffffff, ResExcIoBlock); + resSize = xf86AddResToList(resSize, &range, -1); } else return FALSE; } else if (prt == 6) { type |= ResMem; @@ -1077,14 +1135,14 @@ if (! *p_base) return FALSE; - type |= ResBlock; + type |= (range.type & ResDomain) | ResBlock; /* setup avoid: PciAvoid is bus range: convert later */ avoid = xf86DupResList(pciAvoidRes); while (pbp) { if (pbp->secondary == pvp->bus) { - if (type & ResMem) { + if ((type & ResPhysMask) == ResMem) { if (((p_type & PCI_MAP_MEMORY_CACHABLE) #if 0 /*EE*/ || (res_n == 0xff)/* bios should also be prefetchable */ @@ -1118,7 +1176,7 @@ while (pbp1) { if (pbp1->primary == pvp->bus) { - if (type & ResMem) { + if ((type & ResPhysMask) == ResMem) { tmp = xf86DupResList(pbp1->preferred_pmem); avoid = xf86JoinResLists(avoid,tmp); tmp = xf86DupResList(pbp1->preferred_mem); @@ -1203,16 +1261,19 @@ #else orgAcc = xf86DupResList(Acc); pAcc = &Acc; - while ((*pAcc)) { - if ((((*pAcc)->res_type & (type & ~ResAccMask)) - == (type & ~ResAccMask)) + while (*pAcc) { + if ((((*pAcc)->res_type & (ResTypeMask|ResExtMask)) == + (type & ~ResAccMask)) && ((*pAcc)->block_begin == B2H(tag,(*p_base),type)) && ((*pAcc)->block_end == B2H(tag,(*p_base) + SIZE(*p_size), type))) { #ifdef DEBUG ErrorF("removing old resource\n"); #endif - (*pAcc) = (*pAcc)->next; + tmp = *pAcc; + *pAcc = (*pAcc)->next; + tmp->next = NULL; + xf86FreeResList(tmp); break; } else pAcc = &((*pAcc)->next); @@ -1232,7 +1293,7 @@ #endif w_tmp = w; while (w) { - if (type & w->res_type & ResPhysMask) { + if ((type & ResTypeMask) == (w->res_type & ResTypeMask)) { #ifdef DEBUG ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w->block_begin, w->block_end); @@ -1250,7 +1311,7 @@ if (range.type == ResEnd && w_2nd) { w_tmp = w_2nd; while (w_2nd) { - if (type & w_2nd->res_type & ResPhysMask) { + if ((type & ResTypeMask) == (w_2nd->res_type & ResTypeMask)) { #ifdef DEBUG ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w_2nd->block_begin, w_2nd->block_end); @@ -1284,10 +1345,11 @@ (*p_base) = H2B(tag,range.rBegin,type); #ifdef DEBUG ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n", - res_n,(*p_base),(1 << (*p_size)), (type & ResMem) ? "Mem" : "Io"); + res_n,(*p_base),(1 << (*p_size)), + ((type & ResPhysMask) == ResMem) ? "Mem" : "Io"); #endif if (res_n != 0xff) { - if (type & ResMem) + if ((type & ResPhysMask) == ResMem) pvp->memBase[prt] = range.rBegin; else pvp->ioBase[prt] = range.rBegin; @@ -1323,7 +1385,7 @@ Bool xf86FixPciResource(int entityIndex, int prt, memType alignment, - long type) + unsigned long type) { pciVideoPtr pvp = xf86GetPciInfoForEntity(entityIndex); return fixPciResource(prt, alignment, pvp, type); @@ -1854,6 +1916,9 @@ pnPciBus = &PciBus->next; PciBus->primary = -1; PciBus->secondary = -1; /* to be set below */ + PciBus->brbus = pcrp->busnum; + PciBus->brdev = pcrp->devnum; + PciBus->brfunc = pcrp->funcnum; PciBus->subclass = sub_class; PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; PciBus->preferred_io = xf86ExtractTypeFromList( @@ -1870,11 +1935,16 @@ } } for (i = 0; i <= MaxBus; i++) { /* find PCI buses not attached to bridge */ + if (!pciBusInfo[i]) + continue; for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) if (PciBus->secondary == i) break; if (!PciBus) { /* We assume it's behind a HOST-PCI bridge */ - int minTag = 0xFFFFFF; /*find the 'smallest' free HOST-PCI bridge*/ - int tag; /*'small' is in the order of pciTag() */ + /* + * Find the 'smallest' free HOST-PCI bridge, where 'small' is in + * the order of pciTag(). + */ + PCITAG minTag = 0xFFFFFFFF, tag; PciBusPtr PciBusFound = NULL; for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) if ((PciBus->subclass == PCI_SUBCLASS_BRIDGE_HOST) && @@ -1912,7 +1982,7 @@ if (PciBus->subclass == PCI_SUBCLASS_BRIDGE_PCI && PciBus->interface == PCI_IF_BRIDGE_PCI_SUBTRACTIVE) { PciBusPtr PciBus1; - for (PciBus1 = PciBusBase; PciBus1; PciBus1 = PciBus->next) { + for (PciBus1 = PciBusBase; PciBus1; PciBus1 = PciBus1->next) { if (PciBus1->secondary == PciBus->primary) { PciBus->io = PciBus1->io ? PciBus1->io : PciBus1->preferred_io; @@ -2024,31 +2094,40 @@ if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) continue; - if ((pcrp->pci_header_type & 0x7f) != 0) + if ((pcrp->pci_header_type & 0x7f) || + !(pcrp->pci_command & (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE))) continue; basep = &pcrp->pci_base0; for (i = 0; i < 6; i++) { if (basep[i]) { - if (PCI_MAP_IS_IO(basep[i])) - P_I_RANGE(range,pcrp->tag,PCIGETIO(basep[i]), + if (PCI_MAP_IS_IO(basep[i])) { + if (!(pcrp->pci_command & PCI_CMD_IO_ENABLE)) + continue; + P_I_RANGE(range, pcrp->tag, PCIGETIO(basep[i]), pcrp->basesize[i], ResExcIoBlock) - else if (!PCI_MAP_IS64BITMEM(basep[i])) - P_M_RANGE(range,pcrp->tag,PCIGETMEMORY(basep[i]), - pcrp->basesize[i],ResExcMemBlock) - else { + } else if (!PCI_MAP_IS64BITMEM(basep[i])) { + if (!(pcrp->pci_command & PCI_CMD_MEM_ENABLE)) + continue; + P_M_RANGE(range, pcrp->tag, PCIGETMEMORY(basep[i]), + pcrp->basesize[i], ResExcMemBlock) + } else { i++; #if defined LONG64 || defined WORD64 - P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i-1]), - pcrp->basesize[i-1],ResExcMemBlock) -#else + if (!(pcrp->pci_command & PCI_CMD_MEM_ENABLE)) continue; + P_M_RANGE(range, pcrp->tag, PCIGETMEMORY64(basep[i-1]), + pcrp->basesize[i-1], ResExcMemBlock) +#else + continue; #endif } Sys = xf86AddResToList(Sys, &range, -1); } } - if (pcrp->pci_baserom) { + if ((pcrp->pci_baserom) && + (pcrp->pci_command & PCI_CMD_MEM_ENABLE) && + (pcrp->pci_baserom & PCI_MAP_ROM_DECODE_ENABLE)) { P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom), pcrp->basesize[6],ResExcMemBlock); Sys = xf86AddResToList(Sys, &range, -1); @@ -2158,8 +2237,8 @@ } } #ifdef DEBUG - xf86MsgVerb(X_INFO, 3,"own:\n"); - xf86PrintResList(3,own); + xf86MsgVerb(X_INFO, 3, "own:\n"); + xf86PrintResList(3, own); #endif if (pvp->ioBase[i]) { PV_I_RANGE(range,pvp,i,ResExcIoBlock); @@ -2224,7 +2303,6 @@ xf86FreeResList(res_m_io); } xf86FreeResList(Sys); - return; } resList @@ -3070,6 +3148,9 @@ static void pciTagConvertRange2Host(PCITAG tag, resRange *pRange) { + if (!(pRange->type & ResBus)) + return; + switch(pRange->type & ResPhysMask) { case ResMem: switch(pRange->type & ResExtMask) { @@ -3100,6 +3181,7 @@ } break; } + pRange->type &= ~ResBus; } static void @@ -3141,4 +3223,3 @@ 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.6 xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c:3.7 --- xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c:3.6 Sat Mar 3 17:16:35 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c Sat Oct 27 23:33:19 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.6 2001/03/03 22:16:35 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.7 2001/10/28 03:33:19 tsi Exp $ */ #include #include @@ -38,47 +38,10 @@ #include "xf86sbusBus.h" #include "xf86Sbus.h" -#define FB_DEV_PATH "/dev/fb%d" - Bool sbusSlotClaimed = FALSE; -sbusDevicePtr *xf86SbusInfo = NULL; static int xf86nSbusInfo; -#ifndef FBTYPE_SUNGP3 -#define FBTYPE_SUNGP3 -1 -#endif -#ifndef FBTYPE_MDICOLOR -#define FBTYPE_MDICOLOR -1 -#endif -#ifndef FBTYPE_SUNLEO -#define FBTYPE_SUNLEO -1 -#endif -#ifndef FBTYPE_TCXCOLOR -#define FBTYPE_TCXCOLOR -1 -#endif -#ifndef FBTYPE_CREATOR -#define FBTYPE_CREATOR -1 -#endif - -struct sbus_devtable sbusDeviceTable[] = { - { SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "Sun Monochrome (bwtwo)" }, - { SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", "Sun Color2 (cgtwo)" }, - { SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "Sun Color3 (cgthree)" }, - { SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", "Sun Color4 (cgfour)" }, - { SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "Sun GX" }, - { SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", "Sun CG8/RasterOps" }, - { SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", "Sun GS (cgtwelve)" }, - { SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "Sun SX" }, - { SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", "Sun Graphics Tower" }, - { SBUS_DEVICE_MGX, -1, "mgx", "Quantum 3D MGXplus" }, - { SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "Sun ZX or Turbo ZX" }, - { SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "Sun TCX" }, - { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "Sun FFB" }, - { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "Sun Elite3D" }, - { 0, 0, NULL } -}; - static void CheckSbusDevice(const char *device, int fbNum) { @@ -123,21 +86,23 @@ xf86SbusInfo = xalloc(sizeof(psdp)); *xf86SbusInfo = NULL; for (i = 0; i < 32; i++) { - sprintf(fbDevName, FB_DEV_PATH, i); + sprintf(fbDevName, "/dev/fb%d", i); CheckSbusDevice(fbDevName, i); } if (sparcPromInit() >= 0) { useProm = 1; sparcPromAssignNodes(); } - for (psdpp = xf86SbusInfo, psdp = *psdpp; psdp; psdp = *++psdpp) { + for (psdpp = xf86SbusInfo; (psdp = *psdpp); psdpp++) { for (i = 0; sbusDeviceTable[i].devId; i++) if (sbusDeviceTable[i].devId == psdp->devId) psdp->descr = sbusDeviceTable[i].descr; - /* If we can use PROM information and found the PROM node for this device, - * we can tell more about the card. */ + /* + * If we can use PROM information and found the PROM node for this + * device, we can tell more about the card. + */ if (useProm && psdp->node.node) { - char *prop; + char *prop, *promPath; int len, chiprev, vmsize; switch (psdp->devId) { @@ -169,9 +134,12 @@ psdp->descr = "Sun Single width GX"; break; case 11: switch (vmsize) { - case 2: psdp->descr = "Sun Turbo GX with 1M VSIMM"; break; - case 4: psdp->descr = "Sun Turbo GX Plus"; break; - default: psdp->descr = "Sun Turbo GX"; break; + case 2: + psdp->descr = "Sun Turbo GX with 1M VSIMM"; break; + case 4: + psdp->descr = "Sun Turbo GX Plus"; break; + default: + psdp->descr = "Sun Turbo GX"; break; } } break; @@ -181,8 +149,10 @@ if (prop && !(len % 12) && len > 0) vmsize = *(int *)(prop + len - 4); switch (vmsize) { - case 0x400000: psdp->descr = "Sun SX with 4M VSIMM"; break; - case 0x800000: psdp->descr = "Sun SX with 8M VSIMM"; break; + case 0x400000: + psdp->descr = "Sun SX with 4M VSIMM"; break; + case 0x800000: + psdp->descr = "Sun SX with 8M VSIMM"; break; } break; case SBUS_DEVICE_LEO: @@ -207,26 +177,33 @@ psdp->descr = "Sun|Elite3D-M6 Horizontal"; } else { switch (chiprev) { - case 0x08: psdp->descr = "Sun FFB 67MHz Creator"; break; - case 0x0b: psdp->descr = "Sun FFB 67MHz Creator 3D"; break; - case 0x1b: psdp->descr = "Sun FFB 75MHz Creator 3D"; break; + case 0x08: + psdp->descr = "Sun FFB 67MHz Creator"; break; + case 0x0b: + psdp->descr = "Sun FFB 67MHz Creator 3D"; break; + case 0x1b: + psdp->descr = "Sun FFB 75MHz Creator 3D"; break; case 0x20: - case 0x28: psdp->descr = "Sun FFB2 Vertical Creator"; break; + case 0x28: + psdp->descr = "Sun FFB2 Vertical Creator"; break; case 0x23: - case 0x2b: psdp->descr = "Sun FFB2 Vertical Creator 3D"; break; - case 0x30: psdp->descr = "Sun FFB2+ Vertical Creator"; break; - case 0x33: psdp->descr = "Sun FFB2+ Vertical Creator 3D"; break; + case 0x2b: + psdp->descr = "Sun FFB2 Vertical Creator 3D"; break; + case 0x30: + psdp->descr = "Sun FFB2+ Vertical Creator"; break; + case 0x33: + psdp->descr = "Sun FFB2+ Vertical Creator 3D"; break; case 0x40: - case 0x48: psdp->descr = "Sun FFB2 Horizontal Creator"; break; + case 0x48: + psdp->descr = "Sun FFB2 Horizontal Creator"; break; case 0x43: - case 0x4b: psdp->descr = "Sun FFB2 Horizontal Creator 3D"; break; + case 0x4b: + psdp->descr = "Sun FFB2 Horizontal Creator 3D"; break; } } break; } - } - if (useProm && psdp->node.node) { - char *promPath; + xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr); promPath = sparcPromNode2Pathname (&psdp->node); if (promPath) { Index: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h:3.3 xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h:3.4 --- xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h:3.3 Fri Jun 30 13:15:11 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h Sat Oct 27 23:33:19 2001 @@ -20,11 +20,13 @@ * IN AN ACTION 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.h,v 3.3 2000/06/30 17:15:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h,v 3.4 2001/10/28 03:33:19 tsi Exp $ */ #ifndef _XF86_SBUSBUS_H #define _XF86_SBUSBUS_H +#include "xf86str.h" + #define SBUS_DEVICE_BW2 0x0001 #define SBUS_DEVICE_CG2 0x0002 #define SBUS_DEVICE_CG3 0x0003 @@ -77,6 +79,14 @@ void xf86SbusHideOsHwCursor(sbusDevicePtr psdp); void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg); Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp); + +int promRootNode; + +int promGetSibling(int node); +int promGetChild(int node); +char * promGetProperty(const char *prop, int *lenp); +int promGetBool(const char *prop); + int sparcPromInit(void); void sparcPromClose(void); char * sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp); Index: xc/programs/Xserver/hw/xfree86/common/xf86str.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.79 xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.83 --- xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.79 Fri May 18 19:35:31 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86str.h Fri Nov 30 07:11:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.79 2001/05/18 23:35:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.83 2001/11/30 12:11:55 eich Exp $ */ /* * Copyright (c) 1997-2000 by The XFree86 Project, Inc. @@ -489,6 +489,7 @@ typedef enum { PM_WAIT, PM_CONTINUE, + PM_FAILED, PM_NONE } pmWait; @@ -533,10 +534,13 @@ /* new RAC */ /* Resource Type values */ -#define ResNone -1 +#define ResNone ((unsigned long)(-1)) #define ResMem 0x0001 #define ResIo 0x0002 +#define ResIrq 0x0003 +#define ResDma 0x0004 +#define ResPciCfg 0x000e /* PCI Configuration space */ #define ResPhysMask 0x000F #define ResExclusive 0x0010 @@ -560,6 +564,9 @@ #define ResBus 0x10000 +#define ResDomain 0xff000000ul +#define ResTypeMask (ResPhysMask | ResDomain) /* For conflict check */ + #define ResEnd ResNone #define ResExcMemBlock (ResMem | ResExclusive | ResBlock) @@ -592,7 +599,7 @@ #define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated) typedef struct { - long type; /* shared, exclusive, unused etc. */ + unsigned long type; /* shared, exclusive, unused etc. */ memType a; memType b; } resRange, *resList; @@ -600,7 +607,7 @@ #define RANGE(r,u,v,t) {\ (r).a = (u);\ (r).b = (v);\ - (r).type = t;\ + (r).type = (t);\ } #define rBase a @@ -726,7 +733,7 @@ typedef int xf86SetDGAModeProc (int, int, DGADevicePtr); typedef int xf86ChangeGammaProc (int, Gamma); typedef void xf86PointerMovedProc (int, int, int); -typedef Bool xf86PMEventProc (int, pmEvent); +typedef Bool xf86PMEventProc (int, pmEvent, Bool); /* * ScrnInfoRec Index: xc/programs/Xserver/hw/xfree86/common/xf86xv.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.29 xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.32 --- xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.29 Mon May 7 17:59:05 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86xv.c Wed Aug 22 18:13:43 2001 @@ -6,7 +6,7 @@ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.29 2001/05/07 21:59:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.32 2001/08/22 22:13:43 dawes Exp $ */ #include "misc.h" #include "xf86.h" @@ -218,6 +218,8 @@ pScrn = xf86Screens[pScreen->myNum]; + ScreenPriv->videoGC = NULL; /* for the helper */ + ScreenPriv->CreateWindow = pScreen->CreateWindow; ScreenPriv->DestroyWindow = pScreen->DestroyWindow; ScreenPriv->WindowExposures = pScreen->WindowExposures; @@ -659,10 +661,11 @@ RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; - ScreenPtr pScreen = portPriv->pDraw->pScreen; + ScreenPtr pScreen; int ret = Success; Bool clippedAway = FALSE; + pScreen = portPriv->pDraw->pScreen; xf86XVUpdateCompositeClip(portPriv); /* translate the video region to the screen */ @@ -721,10 +724,12 @@ RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; - ScreenPtr pScreen = portPriv->pDraw->pScreen; + ScreenPtr pScreen; int ret = Success; Bool clippedAway = FALSE; + pScreen = portPriv->pDraw->pScreen; + xf86XVUpdateCompositeClip(portPriv); /* translate the video region to the screen */ @@ -808,10 +813,12 @@ RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; - ScreenPtr pScreen = portPriv->pDraw->pScreen; + ScreenPtr pScreen; int ret = Success; Bool clippedAway = FALSE; + pScreen = portPriv->pDraw->pScreen; + xf86XVUpdateCompositeClip(portPriv); /* translate the video region to the screen */ @@ -1138,6 +1145,11 @@ if(!ScreenPriv) return TRUE; + if(ScreenPriv->videoGC) { + FreeGC(ScreenPriv->videoGC, 0); + ScreenPriv->videoGC = NULL; + } + pScreen->CreateWindow = ScreenPriv->CreateWindow; pScreen->DestroyWindow = ScreenPriv->DestroyWindow; pScreen->WindowExposures = ScreenPriv->WindowExposures; @@ -1361,7 +1373,7 @@ CARD16 drw_w, CARD16 drw_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen = pDraw->pScreen; + ScreenPtr pScreen; RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; @@ -1373,6 +1385,8 @@ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ + pScreen = pDraw->pScreen; + WinBox.x1 = pDraw->x + drw_x; WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; @@ -1512,7 +1526,7 @@ CARD16 drw_w, CARD16 drw_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen = pDraw->pScreen; + ScreenPtr pScreen; RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; @@ -1524,6 +1538,8 @@ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ + pScreen = pDraw->pScreen; + WinBox.x1 = pDraw->x + drw_x; WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; @@ -1657,7 +1673,7 @@ CARD16 width, CARD16 height ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen = pDraw->pScreen; + ScreenPtr pScreen; RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; @@ -1669,6 +1685,8 @@ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ + pScreen = pDraw->pScreen; + WinBox.x1 = pDraw->x + drw_x; WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; @@ -1763,6 +1781,137 @@ return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->pScrn, format->id, width, height, pitches, offsets); +} + +void +xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes) +{ + XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); + DrawablePtr root = &WindowTable[pScreen->myNum]->drawable; + XID pval[2]; + BoxPtr pbox = REGION_RECTS(clipboxes); + int i, nbox = REGION_NUM_RECTS(clipboxes); + xRectangle *rects; + + if(!xf86Screens[pScreen->myNum]->vtSema) return; + + if(!ScreenPriv->videoGC) { + int status; + pval[0] = key; + pval[1] = IncludeInferiors; + ScreenPriv->videoGC = CreateGC(root, GCForeground | GCSubwindowMode, + pval, &status); + if(!ScreenPriv->videoGC) return; + ValidateGC(root, ScreenPriv->videoGC); + } else if (key != ScreenPriv->videoGC->fgPixel){ + pval[0] = key; + ChangeGC(ScreenPriv->videoGC, GCForeground, pval); + ValidateGC(root, ScreenPriv->videoGC); + } + + rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle)); + + for(i = 0; i < nbox; i++, pbox++) { + rects[i].x = pbox->x1; + rects[i].y = pbox->y1; + rects[i].width = pbox->x2 - pbox->x1; + rects[i].height = pbox->y2 - pbox->y1; + } + + (*ScreenPriv->videoGC->ops->PolyFillRect)( + root, ScreenPriv->videoGC, nbox, rects); + + DEALLOCATE_LOCAL(rects); +} + +/* xf86XVClipVideoHelper - + + 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] + +Bool +xf86XVClipVideoHelper( + 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; } Index: xc/programs/Xserver/hw/xfree86/common/xf86xv.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.21 xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.22 --- xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.21 Mon May 7 17:59:06 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86xv.h Sat Jun 16 17:57:42 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.21 2001/05/07 21:59:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.22 2001/06/16 21:57:42 mvojkovi Exp $ */ #ifndef _XF86XV_H_ #define _XF86XV_H_ @@ -203,6 +203,21 @@ void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr); +void +xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes); + +Bool +xf86XVClipVideoHelper( + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height +); + /*** These are DDX layer privates ***/ extern int XF86XvScreenIndex; @@ -215,6 +230,7 @@ void (*AdjustFrame)(int, int, int, int); Bool (*EnterVT)(int, int); void (*LeaveVT)(int, int); + GCPtr videoGC; } XF86XVScreenRec, *XF86XVScreenPtr; typedef struct { Index: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h:1.4 xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h:1.5 --- xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h:1.4 Sun Apr 8 19:00:27 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h Wed Nov 14 16:54:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.4 2001/04/08 23:00:27 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.5 2001/11/14 21:54:39 mvojkovi Exp $ */ #ifndef _XF86XVMC_H #define _XF86XVMC_H @@ -14,7 +14,7 @@ typedef struct { int surface_type_id; /* Driver generated. Must be unique on the port */ int chroma_format; - int color_description; + int color_description; /* no longer used */ unsigned short max_width; unsigned short max_height; unsigned short subpicture_max_width; Index: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c diff -u xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c:1.7 xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c:1.9 --- xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c:1.7 Thu Apr 5 13:42:32 2001 +++ xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c Sat Oct 27 23:33:21 2001 @@ -3,7 +3,7 @@ * * Copyright 1999 by Andrew C Aitchison */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.7 2001/04/05 17:42:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.9 2001/10/28 03:33:21 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -24,7 +24,6 @@ Atom EDID1Atom=-1, EDID2Atom=-1, VDIFAtom=-1; CARD8 *EDID1rawdata = NULL; CARD8 *EDID2rawdata = NULL; - CARD8 *VDIFrawdata = NULL; int i, ret; Bool makeEDID1prop = FALSE; Bool makeEDID2prop = FALSE; @@ -48,8 +47,8 @@ if (DDC->ver.version == 1) { makeEDID1prop = TRUE; } else if (DDC->ver.version == 2) { - int checksum1 = 0; - int checksum2 = 0; + int checksum1; + int checksum2; makeEDID2prop = TRUE; /* Some monitors (eg Panasonic PanaSync4) @@ -58,14 +57,16 @@ * * Try using checksum to determine when we have such a monitor. */ + checksum2 = 0; for (i=0; i<256; i++) { checksum2 += DDC->rawData[i]; } if ( (checksum2 % 256) != 0 ) { xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v2 checksum failed\n"); xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property may be bad\n"); + checksum1 = 0; for (i=0; i<128; i++) { checksum1 += DDC->rawData[i]; } if ( (checksum1 % 256) == 0 ) { xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v1 checksum passed,\n"); - xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property created\n"); + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID1_RAWDATA property created\n"); makeEDID1prop = TRUE; } } Index: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c diff -u xc/programs/Xserver/hw/xfree86/ddc/print_edid.c:1.14.4.1 xc/programs/Xserver/hw/xfree86/ddc/print_edid.c:1.15 --- xc/programs/Xserver/hw/xfree86/ddc/print_edid.c:1.14.4.1 Tue May 22 13:02:36 2001 +++ xc/programs/Xserver/hw/xfree86/ddc/print_edid.c Tue May 22 13:01:23 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c,v 1.14.4.1 2001/05/22 17:02:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c,v 1.15 2001/05/22 17:01:23 tsi Exp $ */ /* print_edid.c: print out all information retrieved from display device * Index: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c diff -u xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.20.2.1 xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.21 --- xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.20.2.1 Fri May 25 17:45:00 2001 +++ xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c Fri May 25 17:43:16 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.20.2.1 2001/05/25 21:45:00 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.21 2001/05/25 21:43:16 paulo Exp $ */ /* xf86DDC.c * Index: xc/programs/Xserver/hw/xfree86/doc/BUILD diff -u xc/programs/Xserver/hw/xfree86/doc/BUILD:3.4 xc/programs/Xserver/hw/xfree86/doc/BUILD:3.7 --- xc/programs/Xserver/hw/xfree86/doc/BUILD:3.4 Wed Apr 14 23:34:43 1999 +++ xc/programs/Xserver/hw/xfree86/doc/BUILD Thu Nov 15 12:37:21 2001 @@ -1,122 +1,65 @@ - Building XFree86 + Building XFree86 from a Source Distribution - David Dawes + David Dawes, Matthieu Herrb - 24 May 1997 + 27 May 2001 Abstract This document describes how to build XFree86 from the source dis- - tribution. It covers building from the full source distribution as - well as from the cut-down source distribution available for build- - ing only the X servers. It is designed to be used in conjunction - with the OS-specific README files. + tribution. It is designed to be used in conjunction with the OS- + specific README files. -1. Building XFree86 From a Source Distribution - NOTE: Refer to the appropriate OS-specific README file before attempting to build XFree86. These files contain additional infor- mation that you may need to successfully build under your OS. -We highly recommend using GCC-2 to build XFree86. Do not use version 2.6.0 -or 2.4.x versions prior to 2.4.5 due to bugs that cause either build or exe- -cution failures. (gcc-2 is available from prep.ai.mit.edu and other sites -archiving GNU source.) +We highly recommend using gcc to build XFree86, but it generally also builds +with the native compiler for each platform; -1.1 How to get the XFree86 3.3 source +1. How to get the XFree86 4.2.0 source There are a few starting points for getting the XFree86 source. One option -is to start directly with the XFree86 3.3 source distribution. In this case, -the procedure is as follows: +is to start directly with the XFree86 4.2.0 source distribution. In this +case, the procedure is as follows: - o The XFree86 3.3 source is contained in files X33src-1.tgz, X33src-2.tgz - and X33src-3.tgz. These can be found at - ftp://ftp.xfree86.org/pub/XFree86/3.3/source/ and similar locations on - XFree86 mirror sites. X33src-2.tgz contains the fonts and documentation - source. X33src-3.tgz contains the hardcopy documentation. X33src-1.tgz - contains everything else. If you don't need the docs or fonts you can - get by with only X33src-1.tgz. + o The XFree86 source is contained in files X420src-1.tgz, X420src-2.tgz + and X420src-3.tgz. These can be found at + ftp://ftp.xfree86.org/pub/XFree86/4.2.0/source/ and similar locations on + XFree86 mirror sites. X420src-2.tgz contains the fonts and documenta- + tion source. X420src-3.tgz contains the hardcopy documentation. + X420src-1.tgz contains everything else. If you don't need the docs or + fonts you can get by with only X420src-1.tgz. o Extract each of these files by running the following from a directory on a filesystem containing enough space (the full source requires around - 130MB, and a similar amount is required in addition to this for the com- + 270MB, and a similar amount is required in addition to this for the com- piled binaries): + + gzip -d < X420src-1.tgz | tar vxf - + + gzip -d < X420src-2.tgz | tar vxf - + + gzip -d < X420src-3.tgz | tar vxf - + + o If the release is not a full release, it is available as a patch against + the previous full release in the + ftp://ftp.xfree86.org/pub/XFree86/4.2.0/patches/ directory. Get the + patch file from there and apply it by running the following command: - gzip -d < X33src-1.tgz | tar vxf - - gzip -d < X33src-2.tgz | tar vxf - - gzip -d < X33src-3.tgz | tar vxf - - -Another option is to start with the X11R6.3 source distribution and patch it -up to XFree86 3.3. In this case you need to do the following: - - o Start with the X Consortium's X11R6.3 distribution with public patch 1 - applied. This can be obtained by following the links from the X home- - page . - - o Get the files R6.3pl1-3.3.diff.gz and cfont33.tgz from - ftp://ftp.xfree86.org/pub/XFree86/3.3/patches/ (or a similar location on - mirror sites). To upgrade the source to XFree86 3.3, run the following - from directory containing the xc directory of the X11R6.3 pl1 source - tree: - - gzip -d < R6.3pl1-3.3.diff.gz | patch -p0 -E - gzip -d < cfont33.tgz | tar vxf - - - Be sure to do this with a clean unmodified source tree. If you don't - some patches may fail. - -If you only want to build the XFree86 X servers, you can use a cut-down ver- -sion of the XFree86 source tree called the ``servers only'' distribution. If -you choose this option, do the following: - - o Get the X33servonly.tgz file from - ftp://ftp.xfree86.org/pub/XFree86/3.3/source/ (or a similar locations on - mirror sites. - - o Extract this by running the following: - - gzip -d < X33servonly.tgz | tar vxf - - -There is no patch to upgrade from the XFree86 3.2 source to 3.3. The reason -for this is the large number of changes associated with the move from X11R6.1 -to X11R6.3. - -XFree86 supports a small subset of the X Consortium X11R6.1 contrib distribu- -tion. If you wish to build this, you will need at least the following -files/directories from that distribution: - - contrib/Imakefile - contrib/programs/Imakefile - contrib/programs/ico - contrib/programs/listres - contrib/programs/showfont - contrib/programs/viewres - contrib/programs/xbiff - contrib/programs/xcalc - contrib/programs/xditview - contrib/programs/xedit - contrib/programs/xev - contrib/programs/xeyes - contrib/programs/xfontsel - contrib/programs/xgc - contrib/programs/xload - contrib/programs/xman - contrib/programs/xmessage - -You will also need the XFree86 patch contrib-3.3.diff.gz. To apply the -patch, run the following from the directory containing the contrib directory: - - gzip -d < contrib-3.3.diff.gz | patch -p0 -E + cd the directory containing the xc directory -If you wish to build the xtest distribution, get the souce distribution -X33test.tgz from the XFree86 source directory, and extract it by running: + gzip -d < file | patch -s -p0 -E - gzip -d < X33test.tgz | tar vxf - + Look for special patching instructions in the Release Notes. -Note, xtest is no longer part of the core X11 distribution (since X11R6.3). +Another option is to get the source by anonymous CVS or CVSup. See +http://www.xfree86.org/cvs/ for details on the different procedure available. -1.2 Configuring the source before building +All method will produce one main source directory called xc. +2. Configuring the source before building + It is recommended that you start the configuration process by going to the xc/config/cf directory, and copying the file xf86site.def to host.def. Then read through the host.def file (which is heavily commented), and set any @@ -127,51 +70,94 @@ Unlike previous versions, imake can now automatically detect and set the var- ious OS*Version parameters, so you shouldn't need to enter those settings explicitly. + +If you are using just the X420src-1.tgz part of the source dist, you will +need to define BuildFonts to NO. + +3. Using a shadow directory of symbolic links for the build + +A recommended practice is to use a shadow directory of symbolic links to do +the build of XFree86. This permits to keep the source directory unmodified +during the build, which has the following benefits: + + o In the case where CVS is used to maintain the source tree up to date, + the update process is not disturbed by foreign files not under the con- + trol of CVS. + + o It is possible to build XFree86 for several different Operating System + or architectures from the same sources, shared by NFS. + + o It is possible to build XFree86 with different configuration options, + just by putting a real copyhost.def in each build tree and by customiz- + ing it separately in each build tree. + +To make a shadow directory of symbolic links, use the following steps: + + o create the directory at the top of the build tree. It is often created + at the same level that the xc directory, but this is not mandatory. + + cd the directory containing the xcdirectory + + mkdir build + + o use the lndircommand to make the shadow tree: + + lndir ../xc + + Note that you can refer to the xc directory with an absolute path if + needed. -If you are using just the X33src-1.tgz part of the source dist, you will need -to define BuildFonts to NO. + See the lndir(1) manual page for details. -If you are using the ``servers only'' distribution, you will need to define -BuildServersOnly to YES. +If lndir is not already installed on your system, you can build it manually +from the XFree86 sources by running the following commands: -1.3 Building and installing the distribution + cd xc/config/util + make -f Makefile.ini lndir + + cp lndir some directory in your PATH + +4. Building and installing the distribution + Before building the distribution, read through the OS-specific README file in xc/programs/Xserver/hw/xfree86/doc that is relevant to you. Once those OS- -specific details have been taken care of, go the xc directory and run ``make -World'' with the BOOTSTRAPCFLAGS set as described in the OS-specific README -(if necessary). It is advisable to redirect stdout and stderr to World.Log -so that you can track down problems that might occur during the build. +specific details have been taken care of, go your build directory (either the +xc directory or the shadow tree created before) and run ``make World'' with +the BOOTSTRAPCFLAGS set as described in the OS-specific README (if necessary, +but most systems supported by XFree86 don't need BOOTSTRAPCFLAGS). It is +advisable to redirect stdout and stderr to World.Log so that you can track +down problems that might occur during the build. -When the build is finished, you should check World.Log to see if there were -any problems. If there weren't any then you can install the binaries. When -using the full source distribution, the installation should be done from the -xc directory. When using the ``servers only'' distribution, the install -should be done from the xc/programs/Xserver directory. To do the install, -run ``make install'' and ``make install.man''. Make sure you have enough -space in /usr/X11R6 for the install to succeed. If you want to install on a -filesystem other than /usr, make a symbolic link to /usr/X11R6 before -installing. - -To install the binary LinkKit (in /usr/X11R6/lib/Server), run ``make -install.linkkit'' from the xc directory. - -To build the subset of the contrib release supported by XFree86, make sure -that you have first built and installed the core distribution. Then go to -the contrib directory and run ``xmkmf -a; make''. When that is completed, -run ``make install'' and ``make install.man'' to install it. +With Bourne-like shells (Bash, the Korn shell, zsh, etc.) use a command like: + + make World > World.log 2>&1 -To build/run the xtest distribution, refer to the instructions in the file -test/xsuite/NOTES.xf86. +Witch C-shell variants (csh, tcsh, etc), use: -2. Reconfiguring the server (source distribution) + make World >& World.log + +You can follow the progress of the build by running: + + tail -f World.log + + in a terminal. + +When the build is finished, you should check World.Log to see if there were +any problems. If there weren't any then you can install the binaries. To do +the install, run ``make install'' and ``make install.man''. Make sure you +have enough space in /usr/X11R6 for the install to succeed. If you want to +install on a filesystem other than /usr, make a symbolic link to /usr/X11R6 +before installing. +5. Reconfiguring the server (source distribution) + To build a different set of servers or servers with a different set of drivers installed: 1. Make sure the source for any new drivers is in the correct place (e.g., - driver source for the SVGA server should be in a subdirectory of - xc/programs/Xserver/hw/xfree86/vga256/drivers). + driver source should be in a subdirectory of xc/pro- + grams/Xserver/hw/xfree86/drivers). 2. Change the settings of the server defines in host.def to specify which servers you wish to build. Also, change the driver lists to suit your @@ -181,16 +167,48 @@ make Makefile make Makefiles + make includes make depend make + +6. Other useful make targets + +There are some other useful targets defined in the top level Makefileof +XFree86: + + o Everything after a make World, make Everythingdoes everything a make + World does, except the cleaning of the tree. It is a way to quickly + rebuild the tree after a source patch, but it is not 100% bullet proof. + There are cases were it is better to force a full build by using make + World. + + o clean does a partial cleaning of the source tree. Removes object files + and generated manual pages, but leaves the Makefiles and the generated + dependencies files in place. After a make clean you need to re-run + + make includes + make depend + make + + to rebuild the XFree86. + + o distclean does a full cleaning of the source tree, removing all gener- + ated files. After a make distclean, make World is the only option to + rebuild XFree86. + + o includes generates all generated header files and in-tree symbolic links + needed by the build. These files are removed by a make clean. -3. Reconfiguring the server (binary distribution) + o depend recomputes the dependencies for the various targets in all Make- + files. Depending on the operating system, the dependencies are stored in + the Makefile, or as a separate file, called .depend. This target needs + the generated include files produced by make includes. -If you have installed the server Binary LinkKit, it is possible to reconfig- -ure the drivers and some of the extensions in the servers. For details of -how to do this, please refer to the README.LinkKit file. + o VerifyOS displays the detected operating system version. If the numbers + shown do not match your system, you probably need to set them manually + in host.def and report the problem to XFree86@XFree86.org. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.2 1997/05/24 13:46:34 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.6 2001/11/15 17:32:16 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/BUILD,v 3.4 1999/04/15 03:34:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/BUILD,v 3.7 2001/11/15 17:37:21 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/DESIGN diff -u xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.36.2.1 xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.40 --- xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.36.2.1 Fri Jun 1 14:26:42 2001 +++ xc/programs/Xserver/hw/xfree86/doc/DESIGN Wed Jan 16 15:51:01 2002 @@ -2,7 +2,7 @@ The XFree86 Project, Inc - Last modified 1 May 2001 + Last modified 1 August 2001 NOTE: This is a DRAFT document, and the interfaces described here are subject to change without notice. @@ -921,6 +921,18 @@ Changes the viewport for the screen identified by index;. + It should be noted that many chipsets impose restrictions + on where the viewport may be placed in the virtual reso- + lution, either for alignment reasons, or to prevent the + start of the viewport from being positioned within a + pixel (as can happen in a 24bpp mode). After calculating + the value the chipset's panning registers need to be set + to for non-DGA modes, this function should recalculate + the ScrnInfoRec's frameX0, frameY0, frameX1 and frameY1 + fields to correspond to that value. If this is not done, + switching to another mode might cause the position of a + hardware cursor to change. + 5.21 VT Switching When a VT switch event is received, xf86VTSwitch() is called. xf86VTSwitch() @@ -2097,8 +2109,8 @@ of options that isn't marked as used. This is intended to show options that the driver hasn't recognised. It would normally be called near the end of the Chip- - ScreenInit() function, but only when - serverGeneration == 1. + ScreenInit() function, but only when serverGenera- + tion == 1. OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token) @@ -2473,10 +2485,9 @@ has been initialised. The pScrn->gamma field must also be initialised, preferably by calling xf86SetGamma(). maxColors is the number of entries in the palette. - sigRGBbits is the number of significant bits in each - colour component. This would normally be the same as - pScrn->rgbBits. loadPalette is a driver-provided func- - tion for loading a colormap into the hardware, and is + sigRGBbits is the size in bits of each color component in + the DAC's palette. loadPalette is a driver-provided + function for loading a colormap into the hardware, and is described below. setOverscan is an optional function that may be provided when the overscan color is an index from the standard LUT and when it needs to be adjusted to @@ -6335,7 +6346,7 @@ ZZZFreeRec(xf86Screens[scrnIndex]); } - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.44 2001/05/19 00:40:30 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.47 2002/01/16 20:38:44 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.36.2.1 2001/06/01 18:26:42 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.40 2002/01/16 20:51:01 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Imakefile diff -u xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.76.2.1 xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.79 --- xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.76.2.1 Fri Jun 1 14:09:46 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Imakefile Thu Nov 15 13:12:50 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.76.2.1 2001/06/01 18:09:46 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.79 2001/11/15 18:12:50 dawes Exp $ #include #include @@ -39,6 +39,7 @@ /*ReadmeFile(OS2)*/ \ /*OS2.Notes*/ \ /*ReadmeFile(SCO)*/ \ + /*ReadmeFile(Solaris)*/ \ /*ReadmeFile(SOLX86)*/ \ /*ReadmeFile(SVR4)*/ \ $(_NULLENTRY_) @@ -76,7 +77,7 @@ /*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*/ \ Index: xc/programs/Xserver/hw/xfree86/doc/Install diff -u xc/programs/Xserver/hw/xfree86/doc/Install:1.11.2.1 xc/programs/Xserver/hw/xfree86/doc/Install:1.14 --- xc/programs/Xserver/hw/xfree86/doc/Install:1.11.2.1 Fri Jun 1 14:26:43 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Install Wed Jan 16 15:51:01 2002 @@ -1,8 +1,8 @@ - Installation Details for XFree86[tm] 4.1.0 + Installation Details for XFree86[tm] 4.2.0 The XFree86 Project, Inc - 1 June 2001 + 16 January 2002 Abstract @@ -20,14 +20,13 @@ installation script. We recommend that these be used to install the bina- ries. -2. Downloading the XFree86 4.1.0 binaries +2. Downloading the XFree86 4.2.0 binaries -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). +We provide XFree86 4.2.0 binaries for a range of operating systems at our ftp +site and our web site +. Often during +releases our site is heavily loaded. Instead of downloading directly from us +we recommend that instead you use one of our mirror sites. 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 @@ -66,6 +65,17 @@ the release you're installing. Older versions of the script may not install newer releases correctly. + o If the binary distribution reported by the Xinstall.sh script isn't pre- + sent on our site, then there are two possibilities. The first is that + it hasn't been prepared and uploaded yet. This is likely if you are + looking soon after the release date. The second possibility is that we + won't have it available at all for this release. This is likely if it's + still not there about two weeks after the release date. Check here + for information about + updates to our binary distributions, and here + for errata related to + this release. + 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 @@ -111,7 +121,7 @@ 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) + 8. Xfscl.tgz Scalable fonts (Speedo, Type1 and TrueType) 9. Xhtml.tgz HTML version of the documentation 10. Xps.tgz PostScript version of the documentation 11. Xjdoc.tgz Documentation in Japanese @@ -123,9 +133,9 @@ 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 +3. Installing XFree86 4.2.0 using the Xinstall.sh script -We strongly recommend that our XFree86 4.1.0 binaries be installed using the +We strongly recommend that our XFree86 4.2.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 @@ -242,7 +252,7 @@ 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.1.0. One is to run the +ate a basic X server configuration file for XFree86 4.2.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: @@ -261,11 +271,13 @@ 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 +4. Installing XFree86 4.2.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. +This section contains information about manually installing the XFree86 4.2.0 +binary distributions. 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. It also may not be complete or up to date. Use at your own +risk. 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 @@ -366,7 +378,7 @@ /sbin/ldconfig -m /usr/X11R6/lib # For FreeBSD, NetBSD, OpenBSD /usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11.2.2 2001/06/01 18:09:48 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.13 2002/01/16 20:38:44 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.11.2.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.14 2002/01/16 20:51:01 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/LICENSE diff -u xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.12.2.1 xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.16 --- xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.12.2.1 Fri Jun 1 14:26:43 2001 +++ xc/programs/Xserver/hw/xfree86/doc/LICENSE Wed Jan 16 15:51:01 2002 @@ -2,14 +2,14 @@ The XFree86 Project - March 2001 + January 2002 1. XFree86 License XFree86 code without an explicit copyright is covered by the following copy- right/license: -Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. +Copyright (C) 1994-2002 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 @@ -35,12 +35,15 @@ 2. Other Licenses -Portions of code are covered by the following licenses/copyrights: +Portions of code are covered by the following licenses/copyrights. See indi- +vidual files for the copyright dates. -2.1 X Consortium +2.1 X/MIT Copyrights -Copyright (C) 1996 X Consortium +2.1.1 X Consortium +Copyright (C) X Consortium + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -64,6 +67,29 @@ X Window System is a trademark of X Consortium, Inc. +2.1.2 The Open Group + +Copyright The Open Group + +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. + +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 +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. + 2.2 Berkeley-based copyrights: 2.2.1 General @@ -552,10 +578,11 @@ solely in object code form, Recipient may replace the words "this file" with "this software" in both the first and second sentences.] -2.6 Bigelow & Holmes Inc and Y&Y Inc Lucidux font license +2.6 Bigelow & Holmes Inc and URW++ GmbH Luxi font license -Copyright (C) 2000 Bigelow & Holmes Inc. and Y&Y, Inc. Patents pending. All -Rights Reserved. Lucidux is a trademark of Bigelow & Holmes Inc. +Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction +code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a regis- +tered trademark of Bigelow & Holmes Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of these Fonts and associated documentation files (the "Font Software"), to @@ -564,35 +591,34 @@ Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: -The above copyright, trademark, patent notices and this permission notice -shall be included in all copies of one or more of the Font Software. +The above copyright and trademark notices and this permission notice shall be +included in all copies of one or more of the Font Software. The Font Software may not be modified, altered, or added to, and in particu- lar the designs of glyphs or characters in the Fonts may not be modified nor -may additional glyphs or characters be added to the Fonts, except that com- -posite characters composed of two or more characters in the Fonts may be cre- -ated using the seac (Standard Encoding Accented Character) Type 1 operator. +may additional glyphs or characters be added to the Fonts. This License +becomes null and void when the Fonts or Font Software have been modified. THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, -TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR Y&Y, -INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GEN- +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++ +GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GEN- ERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFT- WARE. Except as contained in this notice, the names of Bigelow & Holmes Inc. and -Y&Y, Inc. shall not be used in advertising or otherwise to promote the sale, -use or other dealings in this Font Software without prior written authoriza- -tion from the Bigelow & Holmes Inc. and Y&Y, Inc. +URW++ GmbH. shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Font Software without prior written +authorization from Bigelow & Holmes Inc. and URW++ GmbH. For further information, contact: - or +info@urwpp.de or design@bigelowandholmes.com - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.8 2001/03/16 22:13:19 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.11 2002/01/16 20:38:45 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.12.2.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.16 2002/01/16 20:51:01 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes diff -u xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.17.4.1 xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.19 --- xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.17.4.1 Fri Jun 1 14:26:43 2001 +++ xc/programs/Xserver/hw/xfree86/doc/OS2.Notes Sat Jun 30 18:58:09 2001 @@ -221,9 +221,9 @@ Well, you see, this was quite easy :-) - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml,v 3.7 2000/04/05 18:13:46 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml,v 1.1 2001/06/04 13:50:15 dawes Exp $ $XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.17.4.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.19 2001/06/30 22:58:09 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README diff -u xc/programs/Xserver/hw/xfree86/doc/README:3.111.2.3 xc/programs/Xserver/hw/xfree86/doc/README:3.116 --- xc/programs/Xserver/hw/xfree86/doc/README:3.111.2.3 Sat Jun 2 12:21:49 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README Wed Jan 16 15:51:01 2002 @@ -1,18 +1,18 @@ - README for XFree86[tm] 4.1.0 + README for XFree86[tm] 4.2.0 The XFree86 Project, Inc - 2 June 2001 + 16 January 2002 Abstract - XFree86 is the Open Source port of X.Org's X11R6.4 release that + XFree86 is the Open Source port of X.Org's X11R6.6 release that 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.1.0? +1. What is XFree86 4.2.0? -XFree86 4.1.0 is the fourth full release in the XFree86 4 series. +XFree86 4.2.0 is the fifth full release in the XFree86 4 series. 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. @@ -25,7 +25,7 @@ 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. The 4.1.0 version is an upgrade to 4.0.3, which include more +base release. The 4.2.0 version is an upgrade to 4.1.0, which include more hardware ports, code enhancements and bug fixes. Release 4 also included the long-awaited integration of the DRI (Direct Ren- @@ -38,6 +38,8 @@ 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. @@ -114,50 +116,56 @@ 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.1.0 +4. How to get XFree86 4.2.0 -XFree86 4.1.0 can be found at the XFree86 ftp server -, and at mirrors of this +XFree86 4.2.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 +The source for version 4.2.0 is split into three tarballs: X420src-1.tgz, +X420src-2.tgz, X420src-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 +A source patch relative to version 4.1.0 is also available. Because of its +size, it is split into four parts. The patch files are 4.1.0-4.2.0.diff1.gz, +4.1.0-4.2.0.diff2.gz, 4.1.0-4.2.0.diff3.gz and 4.1.0-4.2.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- +included in a diff. It is 4.2.0.tgz. These patches should be applied to a +clean 4.1.0 source tree, working from the directory containing the xc/ direc- tory. The patches should be applied by running: + + gzip -d < 4.1.0-4.2.0.diff1.gz | patch -p0 -E + gzip -d < 4.1.0-4.2.0.diff2.gz | patch -p0 -E + gzip -d < 4.1.0-4.2.0.diff3.gz | patch -p0 -E + gzip -d < 4.1.0-4.2.0.diff4.gz | patch -p0 -E + + rm -f xc/extras/freetype2/builds/mac/ftlib.prj + rm -fr xc/extras/freetype2/docs/design + rm -fr xc/extras/freetype2/docs/glyphs + rm -fr xc/extras/freetype2/docs/image + rm -fr xc/extras/freetype2/docs/tutorial + rm -f xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib + rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings + rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib - 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. + gzip -d < 4.2.0.tgz | tar vxf - 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 doctools-1.2.tgz. +package available as doctools-1.3.tgz. + +The XFree86 source code can also be accessed via the XFree86 CVS repository. +Information about accessing this can be found at the CVS page + on our web site. It's also possible to +browse the XFree86 CVS repository at our CVSWeb server +. 5. Reporting Bugs @@ -168,7 +176,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.113.2.3 2001/06/02 16:17:40 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.119 2002/01/16 19:40:48 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.111.2.3 2001/06/02 16:21:49 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.116 2002/01/16 20:51:01 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DECtga diff -u xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.17.4.1 xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.19 --- xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.17.4.1 Fri Jun 1 14:26:43 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.DECtga Thu Nov 15 12:37:21 2001 @@ -6,7 +6,7 @@ 1. DEC 21030 - o The DEC 21030 is supported by XFree86 4.1.0. The driver is now par- + o The DEC 21030 is supported by XFree86 4.2.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.4.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DECtga,v 3.19 2001/11/15 17:37:21 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DRI diff -u xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.16.2.1 xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.19 --- xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.16.2.1 Fri Jun 1 14:26:43 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.DRI Mon Jan 7 17:07:16 2002 @@ -2,7 +2,7 @@ VA Linux Systems, Inc. Professional Services - Graphics. - 3 May 2001 + 15 June 2001 1. Preamble @@ -45,8 +45,8 @@ the DRI for himself. DRI download, compilation and installation instructions can be found at http://dri.sourceforge.net/DRIcompile.html -Edits, corrections and updates to this document may be mailed to brianp@val- -inux.com. +Edits, corrections and updates to this document may be mailed to . 3. Supported Architectures & Hardware @@ -112,7 +112,7 @@ o i810e - o ATI Rage 128, supported on Intel x86 and AMD: + o ATI Rage 128, supported on Intel x86, AMD and Alpha: o Rage Fury @@ -126,15 +126,19 @@ o All-in-Wonder 128 + o Rage 128 PCI (Alpha-based systems) + Note that both PCI and AGP versions of Rage 128 based cards are sup- ported at this time. - o ATI Radeon, supported on Intel x86 and AMD: + o ATI Radeon, supported on Intel x86, AMD and Alpha: o Radeon SDR AGP o Radeon DDR AGP + o Radeon 32MB SDR PCI (Alpha-based systems) + o 3Dlabs, supported on Intel x86 and AMD: o Oxygen GMX 2000 (MX/Gamma based). Note: this driver is no longer @@ -173,7 +177,7 @@ XFree86 4.0.1 added automatic kernel module loading to the X server. On Linux, the X server uses modprobe to load kernel modules. In Linux 2.4.x the DRM kernel modules should be kept in /lib/modules/2.4.x/ker- -nel/driver/char/drm/ for automatic loading to work. +nel/drivers/char/drm/ for automatic loading to work. Optionally, DRM kernel modules can be loaded manually with insmod prior to starting the X server. @@ -621,7 +625,7 @@ 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 +in /lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. The DRI 3D driver for 3dfx hardware should be in /usr/X11R6/lib/mod- @@ -779,7 +783,7 @@ EndSection The kernel module for the i810 is named i810.o and should be installed in -/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +/lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. The DRI 3D driver for the i810 should be in /usr/X11R6/lib/mod- @@ -868,7 +872,7 @@ EndSection The kernel module for the G200/G400 is named mga.o and should be installed in -/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +/lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. The DRI 3D driver for the G200/G400 should be in /usr/X11R6/lib/mod- @@ -993,7 +997,7 @@ EndSection The kernel module for the Rage 128 is named r128.o and should be installed in -/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +/lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. The DRI 3D driver for the Rage 128 should be in /usr/X11R6/lib/mod- @@ -1014,7 +1018,9 @@ The following OpenGL features are implemented in software and will be slow: - o Stencil buffer and accumulation buffer operations + o accumulation buffer operations + + o stencil, when using a 16bpp screen o Blend subtract, min/max and logic op blend modes @@ -1069,7 +1075,7 @@ 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 +/lib/modules/2.4.x/kernel/drivers/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- @@ -1231,7 +1237,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.24 2001/05/19 00:42:22 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.27 2002/01/07 22:05:57 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.16.2.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.19 2002/01/07 22:07:16 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp diff -u xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.10.2.1 xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.13 --- xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.10.2.1 Fri Jun 1 14:26:43 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp Mon Jan 7 17:07:16 2002 @@ -35,8 +35,8 @@ This information is intended for experienced Linux developers. Beginners are probably better off installing precompiled packages. -Edits, corrections and updates to this document may be mailed to brianp@val- -inux.com. +Edits, corrections and updates to this document may be mailed to . 3. Prerequisites @@ -272,7 +272,7 @@ 3. Check out the CVS sources: cd ~/DRI-CVS - cvs -z3 -dYOURID@cvs.dri.sourceforge.net:/cvsroot/dri co xc + cvs -z3 -d:ext:YOURID@cvs.dri.sourceforge.net:/cvsroot/dri co xc Replace YOURID with your CVS login name. You'll be prompted to enter your sourceforge password. @@ -598,7 +598,7 @@ 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.14 2001/05/02 15:06:08 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.16 2002/01/07 22:05:57 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.10.2.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.13 2002/01/07 22:07:16 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.Darwin diff -u xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.3.4.4 xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.8 --- xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.3.4.4 Sat Jun 2 12:02:08 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.Darwin Wed Dec 19 19:15:41 2001 @@ -1,36 +1,48 @@ XFree86 on Darwin and Mac OS X - Torrey T. Lyons + Torrey T. Lyons, - 25 May 2001 + 12 December 2001 1. Introduction -XFree86, a free implementation of X Windows, has been ported to Darwin and -Mac OS X. This document is a collection of information for anyone experiment- -ing with running X Windows on Apple's next generation operating system. -Please send any comments on this page to . If you are also -working on modifications to the Darwin X server, please let me know. +XFree86, a freely redistributable open-source implementation of the X Window +System, has been ported to Darwin and Mac OS X. This document is a collection +of information for anyone running XFree86 on Apple's next generation operat- +ing system. + +Most of the current work on XFree86 for Darwin and Mac OS X is centered +around the XonX project at SourceForge. If you are interested in up-to-date +status, want to report a bug, or are interested in working on XFree86 for +Darwin, stop by the XonX project. 2. Hardware Support and Configuration -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. +The X window server for Darwin and Mac OS X provided by the XFree86 Project, +Inc. is called XDarwin. XDarwin can run in three different modes. On Mac +OS X, XDarwin runs in parallel with Aqua in full screen or rootless modes. +These modes are called Quartz modes, named after the Quartz 2D compositing +engine used by Aqua. XDarwin can also be run from the Darwin console in IOKit +mode. + +In full screen Quartz mode, 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 pref- +erences. From the Mac OS X desktop, click on the XDarwin icon in the Dock to +switch back to the X window system. (You can change this behavior in the user +preferences so that you must click the XDarwin icon in the floating switch +window instead.) + +In rootless mode, the X window system and Aqua share your display. The root +window of the X11 display is the size of the screen and contains all the +other windows. The X11 root window is not displayed in rootless mode as Aqua +handles the desktop background. 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. +other operating systems also do not apply. 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 @@ -41,25 +53,27 @@ 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. +I have tested. I have done no testing with ADB mice, but without a special +driver, only a single mouse button will work on an ADB mouse. 3. Getting Started 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. 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 +that to build XFree86 for yourself on Mac OS X, you 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. +FTP server at . Fol- +low the instructions in the Install document to install it. This will create +two new directory trees, /usr/X11R6 and /etc/X11 For Mac OS X Quartz support, +download the optional Xquartz.tgz tarball. With Quartz support, the XDarwin +application will be installed in /Applications. If you get the precompiled binaries you can skip ahead to the section on run- -ning the X window system (section 4., page 1) On the other hand, if you want +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. 3.1 Get the Code @@ -100,88 +114,77 @@ 4. Run the X Window System -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 -named ~/Library/init/tcsh/path: (You may need to create this file and direc- -tory path if it does not exist already.) - - setenv PATH "${PATH}:/usr/X11R6/bin" - setenv MANPATH "${MANPATH}:/usr/X11R6/man" - -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 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. +You need to add the X Window System executables to your path. Your path is +the list of directories to be searched for executable commands. The X11 com- +mands are located in /usr/X11R6/bin, which needs to be added to your path. +XDarwin does this for you by default and can also add additional directories +where you have installed command line applications. + +More experienced users will have already set their path correctly using the +initialization files for their shell. In this case, you can inform XDarwin +not to modify your path in the preferences. XDarwin launches the initial X11 +clients in the user's default login shell. (An alternate shell can also be +specified in the preferences.) The way to set the path depends on the shell +you are using. This is described in the man page documentation for the shell. + +In addition you may also want to add the man pages from XFree86 to the list +of pages to be searched when you are looking for documentation. The X11 man +pages are located in /usr/X11R6/man and the MANPATH environment variable con- +tains the list of directories to search. + +On Mac OS X, you can run XFree86 from the Darwin text console or in parallel +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 ``exec +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. +server does not shutdown correctly and if you did not start with ``exec +startx'', 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. +/Applications folder, or from the command line type ``startx -- -quartz''. By +default this will give you a mode picker to choose between full screen or +rootless mode. You can change the default to always use a particular mode in +the preferences, or you can specify the ``-fullscreen'' or ``-rootless'' +options on the command line instead of ``-quartz''. -Customize X Windows +Customize the X Window System -The X window system is very customizable and you will certainly want to +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 +fancier 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- +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. +There are many window managers that have been ported to Darwin. The following +pages contain collections of window managers and other X window system +clients: -Good luck! - -5. Outstanding Issues with the X server - -There is a still a lot to be done with the X server. As always please let me -know if you are interested in working on any of these issues. + o Fink: A package manager that will easily download, compile, and install + lots of open source software from the Internet. -Things that are broken: + o GNU-Darwin: A source for tons of software ported to Darwin. - o The bell does not work in IOKit mode. + o Stepwise's Softrak site - 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 Darwinfo's ports page - o Only one display is currently supported. - - o The display mode can not be changed once the X server has started. - - o A screen saver is not supported. +Good luck! - 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 $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml,v 1.9 2001/12/13 07:09:05 torrey Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Darwin,v 1.3.4.4 2001/06/02 16:02:08 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Darwin,v 1.8 2001/12/20 00:15:41 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.I128 diff -u xc/programs/Xserver/hw/xfree86/doc/README.I128:1.10.4.1 xc/programs/Xserver/hw/xfree86/doc/README.I128:1.11 --- xc/programs/Xserver/hw/xfree86/doc/README.I128:1.10.4.1 Fri Jun 1 14:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.I128 Fri Jun 1 14:28:40 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.4.1 2001/06/01 18:26:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.I128,v 1.11 2001/06/01 18:28:40 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS diff -u xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.28.4.1 xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.30 --- xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.28.4.1 Fri Jun 1 14:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.LynxOS Thu Nov 15 12:37:22 2001 @@ -1,4 +1,4 @@ - README for XFree86 4.1.0 on LynxOS + README for XFree86 4.2.0 on LynxOS Thomas Mueller @@ -13,19 +13,19 @@ See the Copyright Notice. -The sources for XFree86 4.1.0 are available by anonymous ftp from: +The sources for XFree86 4.2.0 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.1.0 +ftp://ftp.XFree86.org/pub/XFree86/4.2.0 Binaries of XFree86 for LynxOS x86 are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.1.0/binaries/LynxOS +ftp://ftp.XFree86.org/pub/XFree86/4.2.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.1.0 was released. In this case it is `LynxOS x86 +at the time XFree86 4.2.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.1.0 supports LynxOS on the x86 and on the PowerPC platform. X +XFree86 4.2.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.1.0 server stores its output +server switches to graphics mode. The XFree86 4.2.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.4.1 2001/06/01 18:26:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS,v 3.30 2001/11/15 17:37:22 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD diff -u xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.76.2.1 xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.80 --- xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.76.2.1 Fri Jun 1 14:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.NetBSD Wed Jan 16 17:37:23 2002 @@ -1,12 +1,12 @@ - README for XFree86 4.1.0 on NetBSD + README for XFree86 4.2.0 on NetBSD Rich Murphey, David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb - Last modified on: 3 March 2001 + Last modified on: 16 January 2002 1. What and Where is XFree86? -XFree86 is the Open Source port of X.Org's X11R6.4 release that supports sev- +XFree86 is the Open Source port of X.Org's X11R6.6 release that supports sev- eral UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operat- ing systems on Intel and other platforms. @@ -14,10 +14,10 @@ The sources for XFree86 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.1.0 +ftp://ftp.XFree86.org/pub/XFree86/4.2.0 Binaries for NetBSD 1.4 and later are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.1.0/binaries/NetBSD +ftp://ftp.XFree86.org/pub/XFree86/4.2.0/binaries/NetBSD A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml @@ -33,8 +33,20 @@ 3. New OS dependent features -3.1 New OS dependent features in 4.0.2 +See the Release Notes for non-OS dependent new features in XFree86 4.2.0. +3.1 New OS dependent features in 4.2.0 + + o Support of client side on NetBSD/sparc64 + + o Support for in-kernel MTRR and AGP support in NetBSD 1.5Y + +3.2 New OS dependent features in 4.1.0 + + o Enable wide characters support in NetBSD 1.5P and later. + +3.3 New OS dependent features in 4.0.2 + o A fix for libXmu OS detection which was broken since unix isn't defined anymore by the C preprocessor. @@ -46,22 +58,22 @@ o Add /usr/pkg/bin to the default user path. -3.2 New OS dependent features in 4.0.1 +3.4 New OS dependent features in 4.0.1 o Support for NetBSD 1.5_ALPHA o The Xsun server can be built on NetBSD/sparc -3.3 New OS dependent features in 4.0 +3.5 New OS dependent features in 4.0 o Preliminary APM support. -3.4 New OS dependent features in 3.9.18 +3.6 New OS dependent features in 3.9.18 o Soft-booting secondary cards through the int10 BIOS interface is now possible using the x86emu real mode emulator. -3.5 New OS dependent features in 3.9.17 +3.7 New OS dependent features in 3.9.17 o Support for silken mouse with the wsmouse protocol has been added. @@ -99,7 +111,7 @@ 5.1 About mouse configuration -XFree86 4.1.0 has support for the mouse driver included in the wscons console +XFree86 4.2.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. @@ -217,14 +229,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.1.0 card drivers require linear memory access. There are two +Most XFree86 4.2.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.1.0 source +xc/programs/Xserver/hw/xfree86/etc/apNetBSD.shar in the XFree86 4.2.0 source distribution. Unpack it in a new directory of your choice by running: sh apNetBSD.shar @@ -335,9 +347,6 @@ with this tree to rebuild from sources. The NetBSD xsrc source tree is available at: ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/xsrc/ -There's an experimental patch by Tsubai Masanari to make XFree86 4.0.1 work -on NetBSD/macppc at: ftp://nandra.iri.co.jp/pub/NetBSD/macppc/XFree86/README. - 9. Building New X Clients The easiest way to build a new client (X application) is to use xmkmf if an @@ -368,7 +377,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.60.2.1 2001/06/01 18:09:48 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.63 2002/01/16 22:35:18 herrb Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.76.2.1 2001/06/01 18:26:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.80 2002/01/16 22:37:23 herrb Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD diff -u xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.22.2.1 xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.30 --- xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.22.2.1 Fri Jun 1 14:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD Wed Jan 16 17:37:23 2002 @@ -1,24 +1,24 @@ - README for XFree86 4.1.0 on OpenBSD + README for XFree86 4.2.0 on OpenBSD Matthieu Herrb - Last modified on: 3 March 2000 + Last modified on: 16 January 2002 1. What and Where is XFree86? -XFree86 is the Open Source port of X.Org's X11R6.4 release that supports sev- +XFree86 is the Open Source port of X.Org's X11R6.6 release that supports sev- eral UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operat- ing systems on Intel and other platforms. See the Copyright Notice. -The sources for XFree86 4.1.0 are available by anonymous ftp from: +The sources for XFree86 4.2.0 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.1.0 +ftp://ftp.XFree86.org/pub/XFree86/4.2.0 -Binaries for OpenBSD/i386 2.8 and later are available from: +Binaries for OpenBSD/i386 3.0 and later are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.1.0/binaries/OpenBSD +ftp://ftp.XFree86.org/pub/XFree86/4.2.0/binaries/OpenBSD A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml @@ -32,26 +32,32 @@ 3. New OS dependent features -See the Release Notes for non-OS dependent new features in XFree86 4.1.0. +See the Release Notes for non-OS dependent new features in XFree86 4.2.0. -3.1 New OS dependent features in 4.0.3 +3.1 New OS dependent features in 4.2 + o Support for OpenBSD/macppc on the ATI Rage128 based Power Macintosh. + + o Support for building clients on OpenBSD/sparc64. + +3.2 New OS dependent features in 4.0.3 + o Support for the wscons console driver in post 2.8 OpenBSD. o A fix for multi-threaded libraries support. -3.2 New OS dependent features in 4.0.2 +3.3 New OS dependent features in 4.0.2 o Support for the OpenBSD ports tree, - o Preliminary support for the powerpc architecture (clients build and - work, the server doesn't work yet), + o Preliminary support for the macppc architecture (clients build and work, + the server doesn't work yet), o xdm now writes an utmp entry, o startx now creates an Xauthority magic cookie for the display. -3.3 New OS dependent features in 4.0.1 +3.4 New OS dependent features in 4.0.1 o Several features from the OpenBSD X11 tree were merged into xdm: @@ -70,21 +76,21 @@ o The Xsun server can be built again on OpenBSD/sparc. -3.4 New OS dependent features in 4.0 +3.5 New OS dependent features in 4.0 o Multi-thread safe libraries are built by default on OpenBSD 2.6 and later, o Preliminary APM support. -3.5 New OS dependent features in 3.9.18 +3.6 New OS dependent features in 3.9.18 o Support for USB mices has been added on OpenBSD. o Soft-booting secondary cards through the int10 BIOS interface is now possible using the x86emu real mode emulator. -3.6 New OS dependent features in 3.9.17 +3.7 New OS dependent features in 3.9.17 o Silken mouse is supported for serial mices, and, under post 2.6 OpenBSD- current for PS/2 mices. @@ -122,16 +128,10 @@ 5.1 About mouse configuration -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. - -The OpenBSD pms driver provides both ``raw'' and ``cooked'' (translated) -modes. ``raw'' mode does not do protocol translation, so XFree86 would use -the PS/2 protocol for talking to the device in that mode. ``Cooked'' mode is -the old BusMouse translation. The driver runs in ``raw'' mode when using the -/dev/psm0 device name. +XFree86 4.2.0 has support for the mouse driver included in the new wscons +console driver introduced by OpenBSD-2.9. Specify ``wsmouse'' as the proto- +col and ``/dev/wsmouse0'' as the device in /etc/X11/XF86Config if you're +using OpenBSD-2.9 or later with a PS/2 or USB mouse. See README.mouse for general instruction on mouse configuration in XFree86. @@ -176,21 +176,21 @@ 7.1 Console drivers -The server supports the two standard OpenBSD/i386 console drivers: pcvt and -pccons. They are detected at runtime and no configuration of the server +The server supports the standard OpenBSD/i386 console drivers: pcvt and +wscons. They are detected at runtime and no configuration of the server itself is required. The pcvt console driver is the default in OpenBSD up to OpenBSD 2.8. It offers several virtual consoles and international keyboard support. -OpenBSD-current after 2.8 has switched to the wscons console driver. This -console driver has a pcvt compatibility mode for X support. +OpenBSD 2.9 and later has switched to the wscons console driver. This console +driver has a pcvt compatibility mode for X support. 7.2 Aperture Driver -By default OpenBSD includes the BSD 4.4 kernel security feature that disable -access to the /dev/mem device when in multi-users mode. But the XFree86 -server require linear access to the display memory in most cases. +By default OpenBSD includes the BSD 4.4 kernel security feature that disables +access to the /dev/mem device when in multi-user mode. But the XFree86 server +requires linear access to the display memory in most cases. OpenBSD now requires the aperture driver to be enabled for all X servers, because the aperture driver also controls access to the I/O ports of the @@ -198,60 +198,19 @@ To enable the aperture driver, once included in the kernel, set - machdep.allowaperture=1 - -in /etc/sysctl.conf. - -Some drivers need a patch to the aperture driver in the kernel to work cor- -rectly with int10 support. If you get warning from xf86ReadBIOS like this -one: - - (II) checkDevMem: using aperture driver /dev/xf86 - (WW) xf86ReadBIOS: /dev/mem mmap[s=600,a=0,o=0] failed (Invalid argument) - -you should patch your kernel and rebuild it. Until it's integrated in -OpenBSD-current, or a better fix is found, the patch is available at -ftp://ftp.laas.fr/pub/ii/matthieu/OpenBSD/patch-kernel-xf4. - -I've also included it below, if you want to edit the source file by hand. - - Index: sys/arch/i386/i386/mem.c - =================================================================== - RCS file: /cvs/src/sys/arch/i386/i386/mem.c,v - retrieving revision 1.14 - diff -u -r1.14 mem.c - --- sys/arch/i386/i386/mem.c 1999/11/20 11:11:28 1.14 - +++ sys/arch/i386/i386/mem.c 2000/11/13 10:54:22 - @@ -269,8 +269,8 @@ - /* minor device 4 is aperture driver */ - case 4: - if (allowaperture && - - (((off >= VGA_START && off <= BIOS_END) || - - (unsigned)off > (unsigned)ctob(physmem)))) - + (off <= BIOS_END || - + (unsigned)off > (unsigned)ctob(physmem))) - return i386_btop(off); - else - return -1; - -In post 2.8 OpenBSD-current, a modified version of this patch has been inte- -grated. You should set - machdep.allowaperture=2 -in /etc/sysctl.conf in order to achieve this. See the xf86(4) manual page for -details. +in /etc/sysctl.conf. See the xf86(4) manual page for details. Another (less recommended) way to enable linear memory and I/O ports access -is to disable the kernel security feature by adding ``option INSECURE'' in -your kernel configuration file and build a new kernel. You will also need to -comment out the line initializing securelevel to 1 in /etc/rc.securelevel. +is to disable the kernel security feature by initializing securelevel to -1 +in /etc/rc.securelevel. Caveat: the aperture driver only allows one access at a time (so that the system is in the same security state once X is launched). - This means that if you run multiple servers on multiples VT, only - the first one will have linear memory access. Use 'option INSE- - CURE' if you need more that one X server at a time. + This means that if you run multiple servers on multiple virtual + terminals, only the first one will have linear memory access. Set + securelevel to -1 if you need more that one X server at a time. 7.3 MIT-SHM @@ -269,14 +228,9 @@ 8. Rebuilding the XFree86 Distribution -The server developer's kit allow you to rebuild just the X server with a min- -imum amount of disk space. Just unpack it, make the appropriate changes to -the xf86site.def, type ``./mkmf'' and ``make'' to link the server. See -/usr/X11R6/lib/Server/README for more info. - You should configure the distribution by editing xc/config/cf/host.def before compiling. To compile the sources, invoke ``make World'' in the xc -directory. +directory." 8.1 Console drivers @@ -294,13 +248,12 @@ If you don't define XFree86ConsoleDefines in host.def the pccons and pcvt drivers will be supported by default. -Experimental native support for the wscons console driver found on -OpenBSD/powerpc and on OpenBSD/i386 -current can be built by adding: +Native support for the wscons console driver found on OpenBSD/macppc and on +OpenBSD/i386 2.9 and later is built by adding: #define XFree86ConsoleDefines -DWSCONS_SUPPORT -to xc/config/host.def before rebuilding the server. This has not been thor- -oughly tested, except on the macppc. +to xc/config/host.def before rebuilding the server. For the i386, you should include both pcvt and wscons support in order to use the pcvt compatibility mode of wscons: @@ -309,15 +262,36 @@ 8.2 Building on other architectures -XFree86 should also compiles on other OpenBSD architectures. However, please -note that 3.9.x snapshots have only been tested on the i386 for now. +XFree86 also compiles on other OpenBSD architectures. -Note that OpenBSD project has now its own source tree, based on the XFree86 +Note that OpenBSD project now has its own source tree, based on the XFree86 source tree, with some local modifications. You may want to start with this -tree to rebuild from sources. The OpenBSD X11 source tree is available by +tree to rebuild from sources. The OpenBSD XF4 source tree is available by anoncvs from all OpenBSD anoncvs servers. See http://www.openbsd.org/anon- cvs.html for details on anoncvs. +8.2.1 XFree86 on OpenBSD/macppc + +The XFree86 server is currently known to work on the G4 Macs and new iBooks +with ATI Rage 128 cards running OpenBSD 3.0 or later. Other machines are +more or less untested. Earlier OpenBSD versions lack some kernel support for +it. + +Use xf86config to build a /etc/X11/XF86Config file before starting the server +for the first time. + +Tou configure the keyboard, the protocol should be specified as wskbd and the +device as /dev/wskbd0. Using a wsmux device as the keyboard device doesn't +work (yet). Use macintosh as XkbModel. + +For the Titanium Powerbook G4, you can try the following mode line in +/etc/X11/XF86Config to match the flat panel resolution: + + Modeline "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +HSync +VSync + +You need to set securelevel to -1 in the /etc/rc.securelevel configuration +file to run XFree86 on OpenBSD/macppc. + 9. Building New X Clients The easiest way to build a new client (X application) is to use xmkmf if an @@ -332,7 +306,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.17 2001/04/05 19:29:43 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.24 2002/01/16 22:35:17 herrb Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.22.2.1 2001/06/01 18:26:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.30 2002/01/16 22:37:23 herrb Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.S3 diff -u xc/programs/Xserver/hw/xfree86/doc/README.S3:3.56 xc/programs/Xserver/hw/xfree86/doc/README.S3:3.57 --- xc/programs/Xserver/hw/xfree86/doc/README.S3:3.56 Tue Feb 29 20:48:11 2000 +++ xc/programs/Xserver/hw/xfree86/doc/README.S3 Mon Dec 17 15:52:30 2001 @@ -713,7 +713,7 @@ s3MNadjust -31 255 -to the device section in your XF86Config file and restart X Windows. With +to the device section in your XF86Config file and restart X. With this option (which is for testing and debugging only) you'll get lots of dis- astrous display flickering and snowing, so it should be removed again immedi- ately after running the test script below. @@ -810,4 +810,4 @@ $XConsortium: S3.sgml /main/14 1996/02/21 17:45:58 kaleb $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.S3,v 3.56 2000/03/01 01:48:11 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.S3,v 3.57 2001/12/17 20:52:30 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.SCO diff -u xc/programs/Xserver/hw/xfree86/doc/README.SCO:3.31 xc/programs/Xserver/hw/xfree86/doc/README.SCO:3.32 --- xc/programs/Xserver/hw/xfree86/doc/README.SCO:3.31 Tue Feb 29 20:48:12 2000 +++ xc/programs/Xserver/hw/xfree86/doc/README.SCO Sat Jun 30 18:58:10 2001 @@ -1,8 +1,8 @@ - Information for SCO Users + Information for SCO OpenServer Users - J. Kean Johnston (hug@netcom.com) + J. Kean Johnston (jkj@sco.com) - 30 November 1996 + 21 May 2001 1. Binary Distribution @@ -544,9 +544,9 @@ Special thanks to Jerry Whelan (guru@stasi.bradley.edu) for providing an ftp site for the binary distribution. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.17 1997/12/05 22:01:38 hohndel Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.18 2001/06/30 22:41:48 tsi Exp $ $XConsortium: SCO.sgml /main/11 1996/10/23 11:45:55 kaleb $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SCO,v 3.31 2000/03/01 01:48:12 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SCO,v 3.32 2001/06/30 22:58:10 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.SiS diff -u xc/programs/Xserver/hw/xfree86/doc/README.SiS:3.16.4.1 xc/programs/Xserver/hw/xfree86/doc/README.SiS:3.17 --- xc/programs/Xserver/hw/xfree86/doc/README.SiS:3.16.4.1 Fri Jun 1 14:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.SiS Fri Jun 1 14:28:41 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.4.1 2001/06/01 18:26:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SiS,v 3.17 2001/06/01 18:28:41 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.apm diff -u xc/programs/Xserver/hw/xfree86/doc/README.apm:1.8.4.1 xc/programs/Xserver/hw/xfree86/doc/README.apm:1.9 --- xc/programs/Xserver/hw/xfree86/doc/README.apm:1.8.4.1 Fri Jun 1 14:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.apm Fri Jun 1 14:28:41 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.4.1 2001/06/01 18:26:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.apm,v 1.9 2001/06/01 18:28:41 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.ati diff -u xc/programs/Xserver/hw/xfree86/doc/README.ati:3.56.2.1 xc/programs/Xserver/hw/xfree86/doc/README.ati:3.59 --- xc/programs/Xserver/hw/xfree86/doc/README.ati:3.56.2.1 Fri Jun 1 14:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.ati Wed Jan 16 15:51:02 2002 @@ -611,7 +611,8 @@ o Mach32, Mach8 and 8514/A Draw Engines. - o Hardware cursors. + o Hardware cursors where implemented by hardware. This has already been + done for Mach64 integrated controllers. o TVOut, i.e. the ability to use a television screen as a monitor. @@ -630,9 +631,7 @@ Secondly, please check XFree86's doc directory for additional information. -Thirdly, do not forget to read http://www.xfree86.org/FAQ. - -Fourth, a scan through the comp.windows.x.i386unix and comp.os.linux.x news- +Thirdly, a scan through the comp.windows.x.i386unix and comp.os.linux.x news- groups using your favourite archiving service can also prove useful in resolving problems. @@ -691,7 +690,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.37 2001/04/16 15:02:08 tsi Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.39 2002/01/16 16:25:54 tsi Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.56.2.1 2001/06/01 18:26:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.59 2002/01/16 20:51:02 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.chips diff -u xc/programs/Xserver/hw/xfree86/doc/README.chips:3.36.2.1 xc/programs/Xserver/hw/xfree86/doc/README.chips:3.38 --- xc/programs/Xserver/hw/xfree86/doc/README.chips:3.36.2.1 Fri Jun 1 14:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.chips Thu Nov 15 12:37:22 2001 @@ -7,7 +7,7 @@ 1. Introduction -With the release of XFree86 version 4.1.0, the Chips and Technologies driver +With the release of XFree86 version 4.2.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 @@ -548,8 +548,14 @@ Modeline "800x600@8bpp" 30.150 800 896 960 1056 600 600 604 628 Options: "FixPanelSize", "UseModeline" - Test on a Zeos Meridan 850c (800x600 DSTN, 65545, 1Mbyte) + Tested on a Zeos Meridan 850c (800x600 DSTN, 65545, 1Mbyte) +The IBM PC110 works best with a 15MHz clock (Thanks to Alan Cox): + + Modeline "640x480" 15.00 640 672 728 816 480 489 496 526 + Options: "TextClockFreq" "15.00" + IBM PC110 (65535, Citizen L6481L-FF DSTN) + The NEC Versa 4080 just needs the "FixPanelSize" option. To the best of my knowledge no machine with a HiQV needs the "UseModeline" or "FixPanelSize" options. @@ -924,7 +930,7 @@ colour depths. However, 8 and 24 bit colour depths seem to work fine. - My ct69030 machine locks up when starting XFree + My ct69030 machine locks up when starting XFree86 The ct69030 chipset introduced a new dual channel architecture. In its current form, XFree86 can not take advantage of this sec- ond display channel. In fact if the video BIOS on the machine @@ -950,7 +956,7 @@ startx -- -depth 24 -fbbpp 32 8-8-8 RGB truecolor - however as XFree86 version 4.1.0 allows 32bpp pixmaps to be used + however as XFree86 version 4.2.0 allows 32bpp pixmaps to be used with framebuffers operating in 24bpp, this mode of operating will cost performance for no gain in functionality. @@ -1021,7 +1027,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.36 2001/05/19 00:35:42 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.38 2001/10/01 13:44:02 eich Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.36.2.1 2001/06/01 18:26:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.38 2001/11/15 17:37:22 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.cyrix diff -u xc/programs/Xserver/hw/xfree86/doc/README.cyrix:1.8.4.1 xc/programs/Xserver/hw/xfree86/doc/README.cyrix:1.9 --- xc/programs/Xserver/hw/xfree86/doc/README.cyrix:1.8.4.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.cyrix Fri Jun 1 14:28:41 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.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.cyrix,v 1.9 2001/06/01 18:28:41 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.dps diff -u xc/programs/Xserver/hw/xfree86/doc/README.dps:1.2.2.1 xc/programs/Xserver/hw/xfree86/doc/README.dps:1.3 --- xc/programs/Xserver/hw/xfree86/doc/README.dps:1.2.2.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.dps Fri Jun 1 14:28:42 2001 @@ -167,4 +167,4 @@ 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 $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.dps,v 1.3 2001/06/01 18:28:42 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.fonts diff -u xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.16.2.1 xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.19 --- xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.16.2.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.fonts Wed Dec 19 19:15:41 2001 @@ -2,7 +2,7 @@ Juliusz Chroboczek, - 21 January 2001 + 26 November 2001 1. Introduction @@ -415,43 +415,56 @@ /usr/X11R6/lib/X11/fonts/Speedo/font*.spd -3.4 The Bigelow & Holmes Lucidux family +3.4 The Bigelow & Holmes Luxi family -XFree86 includes the Lucidux family of Type 1 fonts. This family consists of -the fonts Lucidux Serif, with XLFD +XFree86 includes the Luxi family of scalable fonts, in both TrueType and +Type 1 format. This family consists of the fonts Luxi Serif, with XLFD - -b&h-lucidux serif-medium-*-normal--*-*-*-*-p-*-*-* + -b&h-luxi serif-medium-*-normal--*-*-*-*-p-*-*-* -Lucidux Sans, with XLFD +Luxi Sans, with XLFD - -b&h-lucidux sans-medium-*-normal--*-*-*-*-p-*-*-* + -b&h-luxi sans-medium-*-normal--*-*-*-*-p-*-*-* -and Lucidux Mono, with XLFD +and Luxi Mono, with XLFD - -b&h-lucidux mono-medium-*-normal--*-*-*-*-m-*-*-* + -b&h-luxi mono-medium-*-normal--*-*-*-*-m-*-*-* -Each of these fonts currently comes in Roman and oblique variants (bold vari- -ants will be included in a future release) and has 337 glyphs covering the -basic ASCII Unicode range, the Latin 1 range, as well as the Extended Latin -range. In particular, these fonts include all the glyphs needed for ISO 8859 -parts 1, 2, 3, 4, 9 and 15. +Each of these fonts comes Roman, oblique, bold and bold oblique variants The +TrueType version have glyphs covering the basic ASCII Unicode range, the +Latin 1 range, as well as the Extended Latin range and some additional punc- +tuation characters. In particular, these fonts include all the glyphs needed +for ISO 8859 parts 1, 2, 3, 4, 9, 13 and 15, as well as all the glyphs in the +Adobe Standard encoding and the Windows 3.1 character set. -The Lucidux fonts are original designs by Charles Bigelow and Kris Holmes. -Lucidux fonts include seriffed, sans serif, and monospaced styles that share -the same stem weight, x-height, capital height, ascent and descent. Lucidux -fonts harmonise with Lucida (R) fonts of the same vertical proportions and -weights. The character width metrics of Lucidux roman fonts match those of -core fonts bundled with several window systems. +The glyph coverage of the Type 1 versions is somewhat reduced, and only cov- +ers ISO 8859 parts 1, 2 and 15 as well as the Adobe Standard encoding. -Each PFA file has a copy of the license terms in PS comment lines. The -license terms are also included in the file `COPYRIGHT.BH' for convenience, +The Luxi fonts are original designs by Kris Holmes and Charles Bigelow. Luxi +fonts include seriffed, sans serif, and monospaced styles, in roman and +oblique, and normal and bold weights. The fonts share stem weight, x-height, +capital height, ascent and descent, for graphical harmony. + +The character width metrics of Luxi roman and bold fonts match those of core +fonts bundled with popular operating and window systems. + +The license terms for the Luxi fonts are included in the file `COPYRIGHT.BH', as well as in the License document. + +Charles Bigelow and Kris Holmes from Bigelow and Holmes Inc. developed the +Luxi typeface designs in Ikarus digital format. -The design and font outlines were donated by Charles Bigelow and Kris Holmes -from Bigelow and Holmes Inc., and the hinting was donated by Berthold Horn -and Blenda Horn from Y&Y, Inc. For more information, please contact - or , or consult Y&Y's web site -. +URW++ Design and Development GmbH converted the Ikarus format fonts to True- +Type and Type1 font programs and implemented the grid-fitting "hints" and +kerning tables in the Luxi fonts. + +For more information, please contact or +, or consult the URW++ web site . + +An earlier version of the Luxi fonts was made available under the name +Lucidux. This name should no longer be used due to trademark uncertainties, +and all traces of the Lucidux name have been removed from this version of +XFree86. 4. Fonts and internationalisation @@ -1010,7 +1023,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.13 2001/03/01 00:37:09 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.15 2001/12/17 19:25:36 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.16.2.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.19 2001/12/20 00:15:41 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.i740 diff -u xc/programs/Xserver/hw/xfree86/doc/README.i740:1.8.4.1 xc/programs/Xserver/hw/xfree86/doc/README.i740:1.9 --- xc/programs/Xserver/hw/xfree86/doc/README.i740:1.8.4.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.i740 Fri Jun 1 14:28:42 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.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i740,v 1.9 2001/06/01 18:28:42 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.i810 diff -u xc/programs/Xserver/hw/xfree86/doc/README.i810:1.6.2.1 xc/programs/Xserver/hw/xfree86/doc/README.i810:1.9 --- xc/programs/Xserver/hw/xfree86/doc/README.i810:1.6.2.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.i810 Thu Nov 15 12:37:23 2001 @@ -109,4 +109,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.3 2001/04/04 01:34:18 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i810,v 1.6.2.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i810,v 1.9 2001/11/15 17:37:23 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.isc diff -u xc/programs/Xserver/hw/xfree86/doc/README.isc:3.39.4.1 xc/programs/Xserver/hw/xfree86/doc/README.isc:3.40 --- xc/programs/Xserver/hw/xfree86/doc/README.isc:3.39.4.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.isc Fri Jun 1 14:28:42 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.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.isc,v 3.40 2001/06/01 18:28:42 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.mouse diff -u xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.11.4.1 xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.13 --- xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.11.4.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.mouse Thu Nov 15 12:37:23 2001 @@ -6,7 +6,7 @@ 1. Introduction -This document describes mouse support in XFree86 4.1.0. +This document describes mouse support in XFree86 4.2.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.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.mouse,v 1.13 2001/11/15 17:37:23 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.newport diff -u xc/programs/Xserver/hw/xfree86/doc/README.newport:1.2.4.1 xc/programs/Xserver/hw/xfree86/doc/README.newport:1.5 --- xc/programs/Xserver/hw/xfree86/doc/README.newport:1.2.4.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.newport Wed Jan 16 15:51:03 2002 @@ -1,44 +1,60 @@ Information for newport Users - Guido Guenther + Guido Günther - 1 August 2000 + 16 January 2002 1. Supported Hardware This is an unaccelerated driver for the SGI Indy's newport cards. Both the -8bit and 24bit versions are tested and working with some limitations(see -below). The 24bit newport additionally works in 8bit mode only. +8bit and 24bit versions are tested and working. -2. Notes +2. Features + o support for 8 and 24 bit pixel depths + +3. Notes + o X -configure does not generate a XF86Config file + + o Restoration of the console fails on some variants of the newport (Cmap + revision C) + + o There's only a 1280x1024 mode + +4. Configuration + +The driver auto-detects all device information necessary to initialize the +card. The only lines you need in the "Device" section of your XF86Config +file are: -3. Configuration + Section "Device" + Identifier "SGI newport" + Driver "newport" + EndSection -The following Section "Device" options are supported by the newport driver: +However, if you have problems with auto-detection, you can specify: - o Option "bitplanes" "x" Gives the maximum number of bitplanes your card - supports (8 or 24). + o bitplanes - number of physical bitplanes (8 or 24) -4. Authors +5. Authors - o Guido Guenther + o Guido Guenther -5. Acknowledgements +6. Acknowledgements o Gleb O. Raiko for getting the beast to build o Ralf Baechle for his patience... - o Ulf Carlsson for comments and the dynamic - loader code + o Ulf Carlsson for comments and elf loader + code - o Nina A. Podolskaya for dynamic loader code + o Nina A. Podolskaya for elf loader code o all the guys who wrote the newport_con linux kernel code - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.2 2000/12/12 18:54:29 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.4 2002/01/16 18:21:04 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.2.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.5 2002/01/16 20:51:03 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.r128 diff -u xc/programs/Xserver/hw/xfree86/doc/README.r128:1.13.4.1 xc/programs/Xserver/hw/xfree86/doc/README.r128:1.14 --- xc/programs/Xserver/hw/xfree86/doc/README.r128:1.13.4.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.r128 Fri Jun 1 14:28:42 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.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.r128,v 1.14 2001/06/01 18:28:42 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.rendition diff -u xc/programs/Xserver/hw/xfree86/doc/README.rendition:1.12.4.1 xc/programs/Xserver/hw/xfree86/doc/README.rendition:1.13 --- xc/programs/Xserver/hw/xfree86/doc/README.rendition:1.12.4.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.rendition Fri Jun 1 14:28:42 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.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.rendition,v 1.13 2001/06/01 18:28:42 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.s3virge diff -u xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.6.4.1 xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.9 --- xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.6.4.1 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.s3virge Mon Jan 7 17:07:16 2002 @@ -2,19 +2,18 @@ The XFree86 Project Inc. - 10 Jul 1999 + 19 Dec 2001 1. Supported hardware -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 -(untested) in depth 16 and 24, conversion to fb framebuffer rendering, and -support for the new Render extension (untested). +The s3virge driver in XFree86 4.2.0 supports the S3 ViRGE, ViRGE DX, GX, GX2, +MX, MX+, and VX chipsets. It also supports Trio3D and Trio3D/2x chips. A +majority of testing is done on ViRGE DX chips, making them the most stable to +date. This release has some stabilization fixes for MX, GX2 and Trio3D, and +XVideo support for MX and GX2. This driver is moderately stable, however please use caution with any new -install. Please report any problems to using the +install. Please report any problems to using the appropriate bug report sheet. 2. Features: @@ -44,13 +43,13 @@ 5. Support: For support with XFree86 video drivers please refer to our web site at -XFree86 . The web page has a FAQ and bug report- -ing form available. For problems not addressed in the web page please con- -tact our support email address +XFree86 . The web page has a bug reporting form +available. For problems not addressed in the web page please contact our +support email address 6. Authors - o Mark Vojkovich + o Mark Vojkovich o Sebastien Marineau @@ -58,9 +57,9 @@ o Matt Grossman - o Kevin Brosius + o Kevin Brosius - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.3 2000/11/28 20:59:17 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.5 2001/12/21 21:01:57 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.6.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.9 2002/01/07 22:07:16 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/RELNOTES diff -u xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.97.2.2 xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.104 --- xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.97.2.2 Sat Jun 2 00:44:36 2001 +++ xc/programs/Xserver/hw/xfree86/doc/RELNOTES Thu Jan 17 18:27:44 2002 @@ -1,23 +1,23 @@ - Release Notes for XFree86[tm] 4.1.0 + Release Notes for XFree86[tm] 4.2.0 The XFree86 Project, Inc - 17 December 2000 + 17 January 2002 Abstract - This document contains some information about the features present - in XFree86 4.1.0 and their status. + This document contains some information about features present in + XFree86 4.2.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. The -current release (4.1.0) is the latest in that series. XFree86 4 represents a +current release (4.2.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. +how the hardware driver support compares between 3.3.6 and 4.2.0. Please +check there first before downloading 4.2.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.1.0 config file format, and you can find that information in the +the 4.2.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,260 +37,197 @@ save you some time and help you figure out which of the binary releases you need. -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. +The next section describes what is new in the latest version (4.2.0) compared +with the previous full release (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. Summary of new features in 4.2.0. -2.1 X server +2.1 Video Driver Enhancements - 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. + o An s3 driver is added, which provides support for many of the older + non-ViRGE and non-Savage S3 chipsets. - o Mesa has been updated to the 3.4 stable release. + o Some vmware driver problems are fixed, and the driver is updated to + take advantage of VMWare Workstation 3.0 features. These include + improved hardware cursor handling and support for 8 bit emulation. - o A driver for ATI Radeon adapters has been added. + o Support added for Trident *BladeXP chipsets (currently not-acceler- + ated). - o ATI driver support for multi-head configurations and non-Intel platforms - has been improved. + o Xv support added for Trident TGUI series chips (not 9440 though). - o The ATI driver has been changed to invoke the appropriate driver for any - Rage 128 and Radeon adapters that it finds in the system. + o Support added for the older Trident chipsets again for ISA/VLBus (not + tested) - o A driver (i128) for Number Nine chipsets has been added. + o Support added to the glint driver for 3DLabs Permedia4, GLINT R4 and + Gamma 2 chipsets. - o A driver (savage) for S3 Savage chipsets has been added. + o Support added to the i810 driver for Intel i830 (tested on Linux only). - o A driver (siliconmotion) for some Silicon Motion chipsets has been - added. + o Support added to the ATI radeon driver for Radeon 7500 (2D and 3D), + Radeon 8500 (2D only), and Rage128ProII. - o The driver (ark) for Ark Logic chips has been ported to 4.x. + o Support added for the Matrox G550 support. This included dual-head + support. - o A VESA driver has been added. + o Support added for NVIDIA nForce integrated graphics. - o A driver for SGI newport cards has been added (Linux/mips). + o The NVIDIA nv driver now has preliminary powerpc support for the NV11 + and NV20. - o The trident driver has lots of fixes to the CyberBlade/Blade support, - XVideo support for the Image/Blade series (although scaling doesn't work - yet on the Image series). + o Support added to the NVIDIA nv driver for interlaced modes on hardware + that supports this, and support for resolutions higher than 1600x1200. - o The s3virge driver has stabilized ViRGE GX2 support, includes ViRGE DX - and ViRGE support for XVideo YUV images, and various fixes. + o Fixes for the savage driver on 64-bit platforms, XVideo support for the + SuperSavage, and other savage driver updates. - o The 3Dlabs (glint) driver now has Permedia3 support. + o The ATI r128 driver now uses the CCE DMA engine for 2D acceleration + when direct rendering is enabled, which reduces context switching over- + head and improves stability and performance for XVideo and some 2D oper- + ations. - o The SiS driver has had many updates, and XVideo support for the 630 is - included. + o The fbdev driver now supports rotation. - o The NVIDIA (nv) driver has been updated to include support for the - GeForce2, and line acceleration has been added. Also, DDC support has - been improved, and support added for Alpha platforms (dense only). + o Various updates to the apm, ark, chips (C&T), cirrus, i128, neomagic, + newport, s3virge, siliconmotion, sis, tdfx, tseng, vesa, and vga + drivers. - o The neomagic driver has had various bug fixes and extended acceleration - support. DGA support has also been added. +2.2 Input Driver Enhancements - o The Chips and Technologies driver (chips) has initial support for the - 69030. + o The mouse driver now has support for mouse wheel emulation. - o The tseng driver has multi-head fixes and DGA support has been added. + o The mouse driver can now handle replug events on Linux for PS/2 mice. - o Most video drivers have been converted to use the integrated "fb" frame- - buffer code instead of the old "cfb" code. + o The "Min/Max X/Y Position" options in the elographics and mutouch + drivers are changed to "Min/Max X/Y" to be consistent with the other + input drivers. - o DRI support has been updated for the Rage 128, 3Dfx Voodoo3 and Voodoo5, - Intel i810/i815 and Matrox G400. DRI support for SiS and Sun Creator3D - is available. The DRI is now also available on Alpha platforms. + o Linux USB keyboard access is fixed when no PS/2 controller is present. - o An input driver (citron) for Citron Infrared Touch devices has been - added. + o Added calcomp input driver. - o An input driver (penmount) for PenMount devices has been added. + o Added DMC input driver. - o An input driver (digitaledge) for DigitalEdge devices has been added. + o Added hyperpen input driver. - o Big endian problems in Xinerama have been fixed. +2.3 X Server and Extension Updates - 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 Resynced with X.Org's X11R6.6. - o A new FillRectangles request was added. + o Mesa updated to the post-3.4.2 3.4 branch version as of November 2001. - o The 'mask' operand was changed to allow per-channel alphas. + o DRI drivers resynced with the latest from the DRI project. - Server implementation: + o Various updates to the Xft library. - o Implemented remaining code for client clip lists. + o The DEC-XTRAP extension is now available. - o Fixed plenty of bugs related to text rendering. + o The PEX and XIE extensions are no longer built/distributed by default. - o Complete compositing code, except for separate alpha. + o A security problem related to glyph clipping for large origins is + fixed. - Todo: + o An i810 XvMC (motion compensation) driver is now available (Linux + only). - o Polygons + o A fatal bug XVideo Xineramification bug is fixed. - o Image scaling +2.4 Client and Library Updates - o Separate alpha channels + o FreeType2 updated to version 2.0.6. - o Support for visuals other than TrueColor. + o Added libGL man pages. - Drivers with render extension support include: i128, glint, ati (r128 - and radeon), chips, cirrus, mga, neomagic, nv, tdfx, trident, tseng, - vesa, s3virge. + o Xload now has support for displaying the load of remote hosts. - Acceleration for the render extension: + o Xterm updated to patch level 165. - o XAA infrastructure for acceleration. + o SuperProbe is removed. - o Experimental MGA acceleration using XAA + o Sample xtrap clients added. - o kdrive (TinyX) infrastructure +2.5 I18N and Font Updates - o Experimental TinyX Trident 9525DVD acceleration + o New Luxi scalable fonts (TrueType and Type 1) from Bigelow & Holmes. + These fonts are original designs by Kris Holmes and Charles Bigelow. + See below (section 4.22, page 1) for further information. - Xft library: + o More locale/international keyboards supported. - o New font naming/access library. + o Modularized I18N support in Xlib is included from X11R6.6. - o Abstraction for core/Render text. + o A problem that caused bdftopcf to sometimes write corrupted fonts is + fixed. - o Uses FreeType2 rasterizer. + o Some problem with Xlib's handling of CTEXT and multi-byte characters + are fixed. - o Allows anti-aliased/subpixel sampled text. + o The fontenc layer is updated, and the fontenc library is now installed + and available for other applications. - o Gracefully falls back to core rendering. + o Improvements to the input method framework in Xlib for UTF-8 locales. - o Complicated font matching mechanism. + o A filter called ``luit'' is added, which provides locale and ISO 2022 + support to any Unicode terminal, notably xterm. Use of luit is still + experimental in this release. - o Uses server DPI to convert point sizes to pixel sizes, even for - core fonts. +2.6 OS Support Updates - xterm: + o Build problems on both QNX4 and QNX6 are fixed. - o Can use Xft, by default uses core fonts. + o VT switching problems with the i810 driver on FreeBSD are worked + around. - o Uses new options '-fa' for family name and '-fs' for font size (in - points). + o Problems building modules with some enhanced versions of gcc are fixed. - x11perf: + o Lots of updates for Darwin/Mac OS X, including: - o Add tests for anti-aliased, subpixel sampled and aliased fonts - using the Xft library. + o On Mac OS X, a new rootless mode is added to the XDarwin X server. + This allows X clients to display windows on the Aqua desktop. - xditview: + o Xinerama support added to XDarwin - o When the Xft library is build, uses Xft for all font access. + o With XDarwin in full screen mode, the depth, size, and refresh + rate can now be chosen to be different from the settings used by + Aqua. - Qt, Gtk, twm: + o GLX support added for Darwin and Mac OS X with software rendering. - o Qt changes available here . + o Keymap setup in XDarwin is improved, particularly for interna- + tional keyboards. - o Gtk changes in process. + o In addition to English and Japanese, the XDarwin user interface is + now localized in Dutch, French, German, Spanish, and Korean. - o twm hacks should never see the light of day. + o Lots of Cygwin support updates. - o xf86cfg, a new graphical configuration tool for XFree86 4.x, and can be - used to either write the initial configuration or make customisations to - the current configuration. xf86cfg is a work in progress, and allows - configuration of: + o Support added for OpenBSD/powerpc. - o Specific setup of monitors, cards, keyboards and mice, as well as - adding or removing them. + o Build support added for Linux on IBM S/390. - o Server layout setup, allowing complex configuration of physical - monitor positions, default color depth and/or rotated monitors. + o Removed stale support for Amoeba and Minix. - o Mode line editor that can be used to configure multiple monitors, - and allows adding a modeline specific to a monitor directly to the - configuration file. + o Client-side support added for sparc64 on NetBSD and OpenBSD. - o AccessX configuration interface, that provides an interface to easy - setup of most AccessX options, including: + o Support added for building the X server on Linux/m68k. - o Timeout to reset controls. + o Support added for building on Linux/arm32. - o StickyKeys, for people with disabilities that cannot press two - keys at the same time. + o Updates to Linux/mips support. - o MouseKeys, mouse control only with the keyboard. +A more complete list of changes can be found in the CHANGELOG that is part of +the XFree86 source tree. It can also be viewed online at our CVSweb server +. - o RepeatKeys, repeat rate and repeat delay. - - o SlowKeys, to avoid pressing keys accidentally, they're only - accepted if pressed for some specific amount of time. - - o BounceKeys, helps avoiding multiple key presses by only - accepting a key if it is pressed only once and not pressed - again in a specific amount of time. - - New configuration options are being worked on, as well as correcting - some of the bugs in the current options. A protocol for plugging in - external modules is also planned. - -2.2 X libraries and clients. - - o Significant updates to the internationalisation support in Xlib (see - below (section 2.3, page 1)). - - o Some xfs updates, including font path verification, and new options. - - o XTerm updates. - - o New "xvinfo" client for querying the XVideo extension. - -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 - from ISO-10646 encoded master fonts. - - o The ClearlyU ISO-10646 encoded fonts have been updated. - - o Functions to read keyboard input in locale independent UTF-8 encoding - have been added to libX11: Xutf8LookupString, Xutf8ResetIC. - - o Functions to output strings in locale independent UTF-8 encoding have - been added to libX11: Xutf8DrawString, Xutf8DrawImageString, Xutf8Tex- - tEscapement, Xutf8TextExtents, Xutf8TextPerCharExtents, Xutf8DrawText. - - o Functions to convert between Compound Text or locale dependent encoding - and UTF-8 have been added to libX11: Xutf8TextListToTextProperty, - Xutf8TextPropertyToTextList. The converter between Compound Text and - UTF-8 in Xlib has been improved; a round-trip conversion now correctly - converts all graphic Unicode characters back and forth. - - o libXaw now offers selected text using both selection targets, - UTF8_STRING and COMPOUND_TEXT. - - o Locales with UTF-8 encodings are now supported; but the UTF-8 displaying - facilities are not adequate yet. - - o XKB keyboard definitions have been added and updated for some countries. - -2.4 Platforms - - o Darwin/Mac OS X. - - o Greatly improved IA-64 support. - - o Improved Linux/mips support. - - o Support has been added for more Alpha platforms under Linux. This now - includes all platforms that require sparse memory mapping. - 3. Drivers 3.1 Video Drivers -XFree86 4.1.0 includes the following video drivers: +XFree86 4.2.0 includes the following video drivers: +--------------+--------------------------+----------------------------------+ |Driver Name | Description | Further Information | @@ -301,7 +238,7 @@ |chips | Chips & Technologies | README.chips, chips(4) | |cirrus | Cirrus Logic | | |cyrix (*) | Cyrix MediaGX | README.cyrix | -|fbdev | Linux fbdev | fbdev(4) | +|fbdev | Linux framebuffer device | fbdev(4) | |glide | Glide2x (3Dfx) | glide(4) | |glint | 3Dlabs, TI | glint(4) | |i128 | Number Nine | README.I128, i128(4) | @@ -313,6 +250,7 @@ |newport (-) | SGI Newport | README.newport, newport(4) | |nv | NVIDIA | nv(4) | |rendition | Rendition | README.rendition, rendition(4) | +|s3 | S3 (not ViRGE or Savage) | | |s3virge | S3 ViRGE | README.s3virge, s3virge(4) | |savage | S3 Savage | savage(4) | |siliconmotion | Silicon Motion | siliconmotion(4) | @@ -330,6 +268,7 @@ |tseng | Tseng Labs | | |vesa | VESA | vesa(4) | |vga | Generic VGA | vga(4) | +|vmware | VMWare guest OS | vmware(4) | +--------------+--------------------------+----------------------------------+ Drivers marked with (*) are present in a preliminary form in this release, @@ -342,18 +281,20 @@ 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.1.0 includes the following input drivers: +XFree86 4.2.0 includes the following input drivers: 3.2 Input Drivers +------------+--------------------+---------------------+ |Driver Name | Description | Further Information | +------------+--------------------+---------------------+ - |acecad | AceCad | | + |calcomp | Calcomp | | |citron | Citron | citron(4) | |digitaledge | DigitalEdge | | + |dmc | DMC | dmc(4) | |dynapro | Dynapro | | |elographics | EloGraphics | | + |hyperpen | HyperPen | | |keyboard | generic keyboards | keyboard(4) | |microtouch | MicroTouch | | |mouse | most mouse devices | mouse(4) | @@ -365,15 +306,15 @@ |wacom | Wacom tablets | wacom(4) | +------------+--------------------+---------------------+ -4. Summary of XFree86 4. +4. Overview of XFree86 4.x. Unlike XFree86 3.3.x where there are multiple X server binaries, each of -which drive different hardware, XFree86 4.1.0 has a single X server binary +which drive different hardware, XFree86 4.2.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.1.0 has X server support for most UNIX(R) and UNIX-like operating +XFree86 4.2.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 @@ -395,7 +336,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.1.0 has support for Intel (x86), Alpha and PowerPC +The loader in version 4.2.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, @@ -425,11 +366,12 @@ has preliminary support for generating a basic config file. This is done by running (as root) "XFree86 -configure". Alternatively, the sample config file XF86Config.eg that is installed in /usr/X11R6/lib/X11 may be used as a -starting point. The XF86Setup utility is currently not usable, but work is -continuing in this area. +starting point. The xf86cfg utility can also be used to create a new config- +uration file or to edit an existing one. The XF86Setup utility is currently +not usable, but work is continuing in this area. -The main changes are covered here, but please refer to the XF86Config manual -page for more comprehensive information: +The main changes are covered here, but please refer to the XF86Config(5) man- +ual page for more comprehensive information: o The Module section is used to load server extension modules and font modules, but not XInput drivers. The .so suffix should no longer be @@ -450,8 +392,6 @@ Load "dbe" Load "record" Load "glx" - Load "pex5" - Load "xie" Load "extmod" Load "type1" @@ -500,6 +440,13 @@ Option "suspend time" "30" Option "off time" "40" + The new option AllowDeactivateGrabs allows deactivating any active grab + with the key sequence Ctrl+Alt+Keypad-Divide and the new option Allow- + ClosedownGrabs allows closing the conection to the grabbing client with + the key sequence Ctrl+Alt+Keypad-Multiply. Note that these options are + off by default as they allow users to remove the grab used by screen + saver/locker programs. + o The Keyboard, Pointer and XInput sections have been replaced by a more general InputDevice section. The old Keyboard and Pointer sections are still recognised for compatibility purposes, but they are discommended @@ -678,7 +625,7 @@ specified multiple times to increase the verbosity level (as with 3.3.x), or the verbosity level may be specified explicitly as a number. The default verbosity level is - 1. + 0. -xf86config filename @@ -688,6 +635,9 @@ This makes it possible for users to choose from multiple config files that the the sysadmin has provided. +A more complete list of XFree86 X server command line options can be found in +the XFree86(1) manual page. + 4.4 XAA The XFree86 Acceleration Architecture (XAA) has been completely rewritten @@ -734,7 +684,7 @@ 4.7 DGA version 2 -DGA 2.0 is included in 4.1.0, but is not implemented by all drivers. Prelim- +DGA 2.0 is included in 4.2.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. @@ -750,23 +700,24 @@ Option "NoDDC". We have support for DDC versions 1 and 2; these can be dis- abled independently with Option "NoDDC1" and Option "NoDDC2". -At startup the server prints out DDC information from the display, but it -does not yet use it the determine modelines. For some drivers, the X -server's new -configure option uses the DDC information when generating the -config file. - -Changed behavior caused by DDC. Several drivers uses DDC information to set -the screen size and pitch. This can be overridden by explicitly resetting it -to the and non-DDC default value 75 with the -dpi 75 command line option for -the X server, or by specifying appropriate screen dimensions with the "Dis- -playSize" keyword in the "Monitor" section of the config file. +At startup the server prints out DDC information from the display, and can +use this information to set or warn about monitor sync limits (but not mode- +lines yet). For some drivers, the X server's new -configure option uses the +DDC information when generating the config file. + +4.8.1 Changed behavior caused by DDC. + +Several drivers uses DDC information to set the screen size and pitch. This +can be overridden by explicitly resetting it to the and non-DDC default value +75 with the -dpi 75 command line option for the X server, or by specifying +appropriate screen dimensions with the "DisplaySize" keyword in the "Monitor" +section of the config file. 4.9 GLX and the Direct Rendering Infrastructure (DRI) -Precision Insight (now part of the Pro- -fessional Services group at VA Linux Systems ) -was provided with funding and support from Red Hat , SGI , 3Dfx , Intel +Precision Insight was provided with +funding and support from Red Hat , SGI +, 3Dfx , Intel , ATI , and Matrox to integrate the GLX extension for 3D rendering in an X11 window. The 3D core rendering component is the Mesa @@ -802,7 +753,7 @@ overlays and other image operations not possible with the core X rendering system. -XFree86 4.1.0 provides a partial implementation of Render sufficient for +XFree86 4.2.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. @@ -837,10 +788,10 @@ 4.11.2 FreeType support in Xft -XFree86 4.1.0 includes sources for FreeType version 2.0.1, and, by default, +XFree86 4.2.0 includes sources for FreeType version 2.0.1, and, by default, they are built and installed automatically. -If you prefer, you can configure XFree86 4.1.0 to use an existing Freetype2 +If you prefer, you can configure XFree86 4.2.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: @@ -857,7 +808,7 @@ 4.11.3 Application Support For Anti-Aliased Text -Only three applications have been modified in XFree86 4.1.0 to work with the +Only three applications have been modified in XFree86 4.2.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. @@ -885,9 +836,9 @@ the new server architecture. The area of mode validation needs further work, and the extension should be used with care. This extension has support for changing the gamma setting at run-time, for modes where this is possible. -The new xgamma utility makes use of this feature. Compatibility with the -3.3.x version of the extension is provided. The missing parts of this exten- -sion and some new features should be completed in a future release. +The xgamma utility makes use of this feature. Compatibility with the 3.3.x +version of the extension is provided. The missing parts of this extension +and some new features should be completed in a future release. 4.13 Xaw @@ -1022,9 +973,9 @@ 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. +access to, is placed in shared memory, so as to reduce redundant memory con- +sumption. For non-local clients, the glyph metrics array is transmitted in a +compressed format. 4.21 Unicode/ISO 10646 support @@ -1059,18 +1010,30 @@ o Both the xfsft (the "freetype" module) and the X-TrueType (the "xtt" module) TrueType font backends support Unicode-encoded fonts. -4.22 Lucidux fonts from Bigelow and Holmes +4.22 Luxi 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'' -and ``Lucidux Mono'' in Roman and oblique variants, and includes over 370 -glyphs in each font covering among others the glyphs needed for ISO 8859-1, -2, 3, 4, 9 and 15. Bold variants will be included in a future release. The -design and font outlines were donated by Charles Bigelow and Kris Holmes from -Bigelow and Holmes Inc., and the hinting was donated by Berthold Horn and -Blenda Horn from Y&Y, Inc. For more information, please contact - or , or consult Y&Y's web site -. +XFree86 now includes the ``Luxi'' family of Type 1 fonts and TrueType fonts. +This family consists of the fonts ``Luxi Serif'', ``Luxi Sans'' and +``Luxi Mono'' in Roman, oblique, bold and bold oblique variants. The True- +Type version have glyphs covering the basic ASCII Unicode range, the Latin 1 +range, as well as the Extended Latin range and some additional punctuation +characters. In particular, these fonts include all the glyphs needed for +ISO 8859 parts 1, 2, 3, 4, 9, 13 and 15, as well as all the glyphs in the +Adobe Standard encoding and the Windows 3.1 character set. + +The glyph coverage of the Type 1 versions is somewhat reduced, and only cov- +ers ISO 8859 parts 1, 2 and 15 as well as the Adobe Standard encoding. + +The Luxi fonts are original designs by Kris Holmes and Charles Bigelow from +Bigelow and Holmes Inc., who developed the Luxi typeface designs in Ikarus +digital format. URW++ Design and Development GmbH converted the Ikarus for- +mat fonts to TrueType and Type 1 font programs and implemented the grid-fit- +ting "hints" and kerning tables in the Luxi fonts. + +The license terms for the Luxi fonts are included in the file `COPYRIGHT.BH', +as well as in the License document. For further information, please contact + or , or consult the URW++ web +site . 4.23 Directory rearrangements @@ -1083,7 +1046,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.60 2001/03/02 17:40:48 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.70 2002/01/17 18:14:59 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.97.2.2 2001/06/02 04:44:36 torrey Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.104 2002/01/17 23:27:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Status diff -u xc/programs/Xserver/hw/xfree86/doc/Status:1.23.2.2 xc/programs/Xserver/hw/xfree86/doc/Status:1.29 --- xc/programs/Xserver/hw/xfree86/doc/Status:1.23.2.2 Fri Jun 1 14:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Status Wed Jan 16 15:51:04 2002 @@ -1,13 +1,13 @@ - Driver Status for XFree86[tm] 4.1.0 + Driver Status for XFree86[tm] 4.2.0 The XFree86 Project, Inc - 1 June 2001 + 16 January 2002 Abstract This document provides information about the status of the driver - and hardware support in XFree86 4.1.0 compared with that in XFree86 + and hardware support in XFree86 4.2.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). @@ -15,10 +15,10 @@ 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.1.0. It +each chipset family that is supported in XFree86 3.3.6 or XFree86 4.2.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.1.0. Unless otherwise stated, hardware is classified as "sup- +3.3.6 and 4.2.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. @@ -27,9 +27,9 @@ 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.1.0, there is only one X server, called "XFree86", which can +In XFree86 4.2.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.1.0 is discussed; only the XFree86 server is used. +server binary when 4.2.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. @@ -45,63 +45,67 @@ Support (including acceleration) for Voodoo Banshee and Voodoo3 cards is provided by the XF86_SVGA server with the tdfx driver. - 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 - library, which is not part of the XFree86 distribution). + 4.2.0: + Support for Voodoo Graphics and Voodoo2 chips is provided by the + "glide" driver (this requires version 2.x of the Glide library, + which is not part of the XFree86 distribution). Support (including acceleration) for Voodoo Banshee, Voodoo3, Voodoo4, and Voodoo5 is provided by the "tdfx" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. The + Voodoo Graphics, Voodoo2, Voodoo4, and Voodoo5 are supported only + in 4.2.0. 3. 3Dlabs 3.3.6: Support (including acceleration) for GLINT 500TX (with IBM RGB526 - ramdac), GLINT MX plus Delta or Gamma (with IBM RGB526 and RGB640 - ramdacs), Permedia with IBM RGB526 RAMDAC, and Permedia 2, 2a, 2v + RAMDAC), GLINT MX plus Delta or Gamma (with IBM RGB526 and RGB640 + RAMDACs), Permedia with IBM RGB526 RAMDAC, and Permedia 2, 2a, 2v is provided by the XF86_3DLabs server. - 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. + 4.2.0: + Support (including acceleration) for the Permedia series (includ- + ing 1, 2, 2a, 2v, 3, and 4) and GLINT series (including 300SX, + 500TX, MX, R3 and R4) with the Gamma, Gamma2 or Delta coprocessor + is provided by the "glint" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.1.0. The - Permedia 3 is only supported in 4.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. The + Permedia 3, Permedia 4, GLINT R3, GLINT R4 and Gamma2 are sup- + ported only in 4.2.0. 4. Alliance 3.3.6: - Support (including acceleration) for the AT24, AP6422, AT3D. - Support is provided by the XF86_SVGA server with the apm driver. + Support (including acceleration) for the AT24, AP6422, AT3D is + provided by the XF86_SVGA server with the apm driver. - 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. + 4.2.0: + Support (including acceleration) for the AT24, AT25 and AT3D is + provided by the "apm" driver. This driver currently has only + incomplete support for the AP6422. Summary: - 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. + The AP6422 is supported in 3.3.6 but not fully in 4.2.0. All + other hardware supported in 3.3.6 is also supported in 4.2.0. + The AT25 is supported only in 4.2.0. 5. ARK Logic 3.3.6: Support (including acceleration) for the ARK1000PV, ARK2000PV, - and ARK2000MT. Support is provided by the XF86_SVGA server with - the ark driver. + and ARK2000MT is provided by the XF86_SVGA server with the ark + driver. - 4.1.0: + 4.2.0: Support (including acceleration) for the ARK1000PV, ARK2000PV, - and ARK2000MT. Support is provided by the "ark" driver. + and ARK2000MT is provided by the "ark" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. 6. ATI @@ -119,17 +123,14 @@ driver. Accelerated support is provided for the Rage 128 chips by the XF86_SVGA server with the r128 driver. - 4.1.0: + 4.2.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. + Radeon chips by the "ati" driver, as is unaccelerated support for + all of the others except the Mach8 and some early Mach32 chips. Summary: - 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. + All hardware supported in 3.3.6 is also supported in 4.2.0 except + for Mach8 and some old Mach32 chips. 7. Avance Logic @@ -140,28 +141,27 @@ the others. These drivers reportedly work, but they have no maintainer. - 4.1.0: - No native support for these chipsets, because the old drivers - have not been ported. + 4.2.0: + No Avance Logic chips are supported because the old drivers have + not been ported. Summary: - No Avance Logic chips are supported in 4.1.0. + No Avance Logic chips are supported in 4.2.0. 8. Chips and Technologies 3.3.6: 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 XF86_SVGA server with the - chips driver. + 64300 is provided by the XF86_SVGA server with the chips driver. - 4.1.0: + 4.2.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. + 64300 is provided by the "chips" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. 9. Cirrus Logic @@ -173,13 +173,13 @@ 7541, 7542, 7543, 7548, 7555 and 7556 is provided by the XF86_SVGA server with the cirrus driver. - 4.1.0: + 4.2.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.1.0: + The following chips are supported in 3.3.6 but not in 4.2.0: 6410, 6412, 6420, 6440, 5420, 5422, 5424, 5426, 5428, 5429, 6205, 6215, 6225, 6235, 7541, 7542, 7543, 7555 and 7556. @@ -195,16 +195,17 @@ 24 plane 3D chips (on Alpha platforms) is provided by the XF86_TGA server. - 4.1.0: - No support for the Compaq AVGA (driver hasn't been ported). + 4.2.0: + No support exists for the Compaq AVGA (its driver hasn't been + ported). Support (accelerated) for the DEC 21030 TGA 8 plane, 24 plane and 24 plane 3D chips (only tested on Alpha platforms) is provided by the "tga" driver. Summary: - No Compaq AVGA support in 4.1.0. DEC TGA support is equivalent - in both 3.3.6 and 4.1.0. + No Compaq AVGA chips are supported in 4.2.0. DEC TGA support is + equivalent in both 3.3.6 and 4.2.0. 11. Cyrix @@ -212,12 +213,13 @@ Support (accelerated) for the Cyrix MediaGX is provided by the XF86_SVGA server with the cyrix driver. - 4.1.0: - The 3.3.6 driver has been ported to 4.1.0, including accelera- - tion, but feedback is needed. + 4.2.0: + The 3.3.6 driver has been ported to 4.2.0, including acceleration + support, and is provided by the "cyrix" driver. Feedback is + wanted. Summary: - Cyrix MediaGX users are encouraged to test its support in 4.1.0. + Cyrix MediaGX users are encouraged to test its support in 4.2.0. 12. Epson @@ -225,12 +227,12 @@ Support (accelerated) for the Epson SPC8110 is provided by the XF86_SVGA server with the spc8100 driver. - 4.1.0: - No native support for this chipset, because the old driver has - not been ported. + 4.2.0: + No Epson chips are supported, because the old driver has not been + ported. Summary: - No Epson chips are supported in 4.1.0. + No Epson chips are supported in 4.2.0. 13. Genoa @@ -240,12 +242,12 @@ because we don't have any recent test reports, and this driver has no maintainer. - 4.1.0: - No native support for this chipset, because the old driver has - not been ported. + 4.2.0: + No Genoa chips are supported, because the old driver has not been + ported. Summary: - No Genoa chips are supported in 4.1.0. + No Genoa chips are supported in 4.2.0. 14. IBM @@ -260,7 +262,7 @@ Support for the IBM XGA-2 chip is provided by the XF86_AGX server. - 4.1.0: + 4.2.0: Support for the standard IBM VGA chip (and compatibles) is pro- vided by the "vga" driver. @@ -269,7 +271,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.1.0. + no support for the 8514/A or XGA-2 in 4.2.0. 15. IIT @@ -277,46 +279,48 @@ Support (accelerated) for the AGX-016, AGX-015 and AGX-014 is provided by the XF86_AGX server. - 4.1.0: - No native support for these chipsets, because the old driver has - not been ported. + 4.2.0: + No IIT chips are supported, because the old driver has not been + ported. Summary: - No IIT chips are supported in 4.1.0. + No IIT chips are supported in 4.2.0. 16. Integrated Micro Solutions (IMS) 3.3.6: - Support (accelerated) for the IMS Twin Turbo 128 is provided by - the XF86_SVGA server with the imstt driver. + Support (accelerated) for the IMS Twin Turbo 128 and Twin Turbo + 3D is provided by the XF86_SVGA server with the imstt driver. - 4.1.0: - Support (accelerated) for the IMS Twin Turbo 128 is provided by - the "imstt" driver. + 4.2.0: + Support (accelerated) for the IMS Twin Turbo 128 and Twin Turbo + 3D is provided by the "imstt" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. 17. Intel 3.3.6: Support (accelerated) for the Intel i740 is provided by the XF86_SVGA server with the i740 driver, and for the Intel i810 - with the i810 driver. The i810 is currently only supported on - Linux, and requires the agpgart.o kernel module in order to use - modes that require more than 1MB of video memory. + with the i810 driver. The i810 is supported only on Linux, and + requires the agpgart.o kernel module in order to use modes that + require more than 1MB of video memory. - 4.1.0: + 4.2.0: 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. + i810-dc100 and i810e), i815, and i830 is provided by the "i810" + driver. The "i810" driver is currently supported only on Linux + and FreeBSD (4.1 and later), and requires AGP GART kernel sup- + port. Summary: - 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. + The i740 and and original i810 are supported in both versions, + but the i810 is supported only on Linux/x86 and recent + FreeBSD/i386 platforms at present. Support for later versions of + the i810 chipset, such as the i815, exists only in 4.2.0. 18. Matrox @@ -325,15 +329,16 @@ (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200 and G400 is provided by the XF86_SVGA server with the mga driver. - 4.1.0: + 4.2.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. + (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200, + G400, G450, and G550 is provided by the "mga" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. The + G450 and G550 are supported only in 4.2.0. -19. MX (???) +19. Micronix, Inc. (MX) 3.3.6: Support for the MX68000 and MX68010 chips is provided by the @@ -341,12 +346,12 @@ is unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.1.0: - No native support for this chipset, because the old driver has - not been ported. + 4.2.0: + No MX chips are supported, because the old driver has not been + ported. Summary: - No MX (???) chips are supported in 4.1.0. + No MX chips are supported in 4.2.0. 20. NCR @@ -355,12 +360,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.1.0: - No native support for this chipset, because the old driver has - not been ported. + 4.2.0: + No NCR chips are supported, because the old driver has not been + ported. Summary: - No NCR chips are supported in 4.1.0. + No NCR chips are supported in 4.2.0. 21. NeoMagic @@ -369,14 +374,14 @@ NM2097, NM2160 and NM2200 chipsets is provided by the XF86_SVGA server with the neo driver. - 4.1.0: + 4.2.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.1.0. The - NM2230 and later chips are only supported in 4.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. The + NM2230 and later chips are supported only in 4.2.0. 22. NVIDIA @@ -385,15 +390,15 @@ (Ultra, Vanta, M64), GeForce (DDR, 256) and Quadro is provided by the XF86_SVGA server and the nv driver. - 4.1.0: + 4.2.0: Support (accelerated) for the Riva 128, 128ZX, TNT, TNT2 (Ultra, - Vanta, M64), GeForce (DDR, 256), GeForce2 (GTS, Ultra, MX), - Quadro, and Quadro2 is provided by the "nv" driver. + Vanta, M64), GeForce (DDR, 256), Quadro, GeForce2 (GTS, Ultra, + MX), GeForce3, and Quadro2 is provided by the "nv" driver. Summary: All chipsets supported in 3.3.6 except the NV1 are also supported - in 4.1.0. Support for the newer chips (GeForce2 and later) is - only available in 4.1.0. + in 4.2.0. Support for the newer chips listed above (starting + with the GeForce2) is available only in 4.2.0. 23. Number Nine @@ -401,12 +406,12 @@ Support (accelerated) for the Imagine 128, Ticket 2 Ride, Revolu- tion 3D and Revolution IV is provided by the XF86_I128 server. - 4.1.0: + 4.2.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.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. 24. Oak Technologies, Inc. @@ -415,12 +420,12 @@ acceleration) is provided by the XF86_SVGA server and the oak driver. - 4.1.0: - No native support for these chipsets, because the old driver has - not been ported. + 4.2.0: + No Oak chips are supported, because the old driver has not been + ported. Summary: - No Oak chips are supported in 4.1.0. + No Oak chips are supported in 4.2.0. 25. Paradise/Western Digital @@ -431,12 +436,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.1.0: - No native support for these chipsets, because the old driver has - not been ported. + 4.2.0: + No Paradise/Western Digital chips are supported, because the old + driver has not been ported. Summary: - No Paradise/Western Digital chips are supported in 4.1.0. + No Paradise/Western Digital chips are supported in 4.2.0. 26. RealTek @@ -446,12 +451,12 @@ unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.1.0: - No native support for these chipsets, because the old driver has - not been ported. + 4.2.0: + No RealTek chips are supported, because the old driver has not + been ported. Summary: - No RealTek chips are supported in 4.1.0. + No RealTek chips are supported in 4.2.0. 27. Rendition/Micron @@ -459,51 +464,58 @@ Support for the Verite 1000, 2100 and 2200 is provided by the XF86_SVGA server with the rendition driver. - 4.1.0: + 4.2.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.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. 28. S3 3.3.6: Support (accelerated) for the S3 911, 924, 801, 805, 928, 864, 868, 964, 968, Trio32, Trio64, Trio64V+, Trio64UV+, Aurora64V+, - Trio64V2, PLATO/PX is provided by the XF86_S3 server and the + Trio64V2, and PLATO/PX is provided by the XF86_S3 server and the XF86_SVGA server with the s3_svga driver. Support (accelerated) for the ViRGE, ViRGE/VX, ViRGE/DX, ViRGE/GX, ViRGE/GX2, ViRGE/MX, ViRGE/MX+ is provided by the XF86_S3V server. Support (acceler- - ated) for those ViRGE chips, as well as the Trio3D and Trio3D/2X - is provided by the XF86_SVGA server with the s3v driver. Support - (accelerated) for the Savage3D, Savage3D/MV, Savage4, and Sav- - age2000, is provided by the XF86_SVGA server with the s3_savage - driver on some OSes (Linux, *BSD). - - 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 - Savage3D, Savage3D/MV, Savage4, and Savage2000, is provided by + ated) for the ViRGE chipsets, as well as the Trio3D and + Trio3D/2X, is provided by the XF86_SVGA server with the s3v + driver. Support (accelerated) for the Savage3D, Savage3D/MV, + Savage4, and Savage2000, is provided by the XF86_SVGA server with + the s3_savage driver on some OSes (Linux, *BSD). + + 4.2.0: + Support (accelerated) for the 964 (revisions 0 and 1), 968, + Trio32, Trio64, Trio64, Trio64V+, Trio64UV+, Aurora64V+, + Trio64V2, and PLATO/PX is provided by the "s3" driver (however, + only models using the IBM RGB 524, Texas Instruments 3025, or an + internal TrioDAC RAMDAC chip are supported). Support (acceler- + ated) 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 Savage3D, Sav- + age3D/MV, Savage4, Savage2000, and SuperSavage, is provided by the "savage" driver. Support for the other S3 chipsets has not yet been ported. Summary: - Only the ViRGE, Trio3D and Savage chipsets are supported in - 4.1.0. All of the other chipsets are only supported in 3.3.6. + All hardware supported in 3.3.6 is also supported in 4.2.0 except + for the 911, 924, 801, 805, 928, 864, and 868, and versions of + the 964 and 968 that do not use the RAMDAC chips listed above. + The SuperSavage chipset is supported only in 4.2.0. 29. Silicon Graphics, Inc. (SGI) 3.3.6: No SGI hardware is supported in 3.3.6. - 4.1.0: - Unaccelerated support for the SGI Indy's Newport cards is pro- - vided by the "newport" driver. + 4.2.0: + Unaccelerated support for the SGI Indy's Newport (a.k.a. "XL") + cards is provided by the "newport" driver. Summary: - SGI hardware is supported only in 4.1.0. + SGI hardware is supported only in 4.2.0. 30. Silicon Integrated Systems (SiS) @@ -512,7 +524,7 @@ 86C225, 5597, 5598, 6326, 530, 620, 300, 630 and 540 is provided by the XF86_SVGA server with the sis driver. - 4.1.0: + 4.2.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 @@ -529,20 +541,20 @@ LynxEM+ and Lynx3DM chips is provided by the XF86_SVGA server with the smi driver. - 4.1.0: + 4.2.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.1.0. + All hardware supported in 3.3.6 is also supported in 4.2.0. 32. Sun Microsystems 3.3.6: No Sun hardware is supported in 3.3.6. - 4.1.0: + 4.2.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 @@ -552,7 +564,7 @@ framebuffers are supported by the "suntcx" driver. Summary: - Sun hardware is supported only in 4.1.0. + Sun hardware is supported only in 4.2.0. 33. Trident Microsystems @@ -561,28 +573,40 @@ TVGA8200LX, TVGA8800CS, TVGA8900B, TVGA8900C, TVGA8900CL, TVGA8900D, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TGUI9400CXi, TGUI9420, TGUI9420DGi, TGUI9430DGi, TGUI9440AGi, - TGUI9660, TGUI9680, ProVidia 9682, ProVidia 9685, Cyber9320, - Cyber9382, Cyber9385, Cyber9388, Cyber9397, Cyber9520, Cyber9525, - 3DImage975, 3DImage985, Cyber9397/DVD, Blade3D, CyberBlade/i7, - CyberBlade/DSTN/i7 and CyberBlade/i1 is provided by the XF86_SVGA - server with the tvga8900 driver. + TGUI9660, TGUI9680, ProVidia 9682, ProVidia 9685, 3DImage975, + 3DImage985, Blade3D, Cyber9320, Cyber9382, Cyber9385, Cyber9388, + Cyber9397, Cyber9397/DVD, Cyber9520, Cyber9525, + CyberBlade/DSTN/i7, CyberBlade/i1, and CyberBlade/i7 is provided + by the XF86_SVGA server with the tvga8900 driver. - 4.1.0: + 4.2.0: Support (accelerated where the chip supports it) for the - TVGA8900D, TGUI9440AGi, TGUI9660, TGUI9680, ProVidia 9682, Pro- - Vidia 9685, Cyber9320, Cyber9382, Cyber9385, Cyber9388, - Cyber9397, Cyber9397/DVD, Cyber9520, Cyber9525/DVD, 3DImage975, - 3DImage985, Blade3D, CyberBlade/i7, CyberBlade/DSTN/i7, - CyberBlade/i1, CyberBlade/DSTN/i1, CyberBlade/Ai1, - CyberBlade/DSTN/Ai1 and CyberBlade/e4 is provided by the "tri- - dent" driver. + TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, + TVGA9200CXr, TVGA8900D, TGUI9440AGi, TGUI9660, TGUI9680, ProVidia + 9682, ProVidia 9685, 3DImage975, 3DImage985, Blade3D, Cyber9320, + Cyber9382, Cyber9385, Cyber9388, Cyber9397, Cyber9397/DVD, + Cyber9520, Cyber9525/DVD CyberBlade/Ai1, CyberBlade/i7, + CyberBlade/i1, CyberBlade/DSTN/Ai1, CyberBlade/DSTN/i7, + CyberBlade/DSTN/i1, CyberBlade/e4, CyberBladeXP, BladeXP is pro- + vided by the "trident" driver. (NOTE: the old TVGA ISA/VLbus + card support has not been fully tested) + + Summary: + The following (older) chipsets are supported in 3.3.6 and not in + 4.2.0: TVGA8200LX, TVGA8800CS, TVGA8900B, TVGA8900C, TVGA8900CL, + TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TGUI9400CXi, + TGUI9420, and TGUI9430DGi. + + The TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, + TVGA9100B, TVGA9200CXr, TGUI9400CXi, TGUI9440AGi, TGUI9660, + TGUI9680, ProVidia 9682, ProVidia 9685, 3DImage975, 3DImage985 + Blade3D, Cyber9320, Cyber9382, Cyber9385, Cyber9388, Cyber9397, + Cyber9397/DVD, CyberBlade/DSTN/i1, CyberBlade/DSTN/i7, + CyberBlade/i1 and CyberBlade/i7 are supported in both 3.3.6 and + 4.2.0. - Summary: - The following (older) chipsets that are supported in 3.3.6 are - 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.1.0. + The CyberBlade/Ai1, CyberBlade/DSTN/Ai1, CyberBlade/e4, + CyberBladeXP, and BladeXP are supported only in 4.2.0. 34. Tseng Labs @@ -594,13 +618,13 @@ driver. Support (accelerated) for the ET4000/W32 series and the ET6000 is also provided by the deprecated XF86_W32 server. - 4.1.0: + 4.2.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.1.0 except + All cards supported by 3.3.6 are also supported by 4.2.0 except for the old ET3000. 35. Video 7 @@ -611,12 +635,12 @@ unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.1.0: - No native support for these chipsets, because the old driver has - not been ported. + 4.2.0: + No Video 7 chips are supported, because the old driver has not + been ported. Summary: - No Video 7 chips are supported in 4.1.0. + No Video 7 chips are supported in 4.2.0. 36. Weitek @@ -625,14 +649,14 @@ server and accelerated support for the P9100 is provided by the XF86_SVGA server with the p9x00 driver. - 4.1.0: - No native support for these chipsets, because the old drivers - have not been ported. + 4.2.0: + No Weitek chips are supported, because the old drivers have not + been ported. Summary: - No Weitek chips are supported in 4.1.0. + No Weitek chips are supported in 4.2.0. - 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 $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.37 2002/01/16 20:38:45 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.23.2.2 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.29 2002/01/16 20:51:04 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Versions diff -u xc/programs/Xserver/hw/xfree86/doc/Versions:1.1.4.1 xc/programs/Xserver/hw/xfree86/doc/Versions:1.3 --- xc/programs/Xserver/hw/xfree86/doc/Versions:1.1.4.1 Fri Jun 1 14:26:46 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Versions Wed Jan 16 15:51:04 2002 @@ -2,7 +2,7 @@ The XFree86 Project, Inc - 28 January 2001 + 16 January 2002 Abstract @@ -13,17 +13,20 @@ 1. Releases, Development Streams and Branches As of the release of version 4.0.2 in December 2000, XFree86 has three -release branches. The main development stream is on the trunk of the CVS -repository. That is where all new development work is done. A stable bugfix -branch for the 4.0.2 release was created at the time of its release, and that -branch is called "xf-4_0_2-branch". Fixes for bugs found in the 4.0.2 -release will be added to this branch (as well as the trunk). Similar stable -branches will be created after each full release. +release branches. First is trunk of the CVS repository. This is the main +development stream, where all new work and work for future releases is done. -Finally, there is the 3.3.x legacy branch, which is called "xf-3_3-branch". +Second is the stable bugfix branch for the latest full release (4.2.0). It +is created around the time of the release. The branch for this one is called +"xf-4_2-branch". Fixes for bugs found in the release will be added to this +branch (as well as the trunk), and updates to this release (if any) will be +cut from this branch. Similar stable branches are present for previous full +releases. + +Finally there is the 3.3.x legacy branch, which is called "xf-3_3-branch". While this branch is not actively being maintained, it does include some -important post-3.3.6 bug fixes and security updates. Security updates in -particular are usually back-ported to this branch. +important post-3.3.6 bug fixes and security updates. Relevant security +updates in particular are usually back-ported to this branch. XFree86 is planning to make full releases from the main development stream approximately every six months, in late May and November of each year. The @@ -37,12 +40,9 @@ will consist of source code patches, plus binary updates to be layered on top of the previous full release. -The next full release will be version 4.1.0, scheduled for late May 2001. -The next update release will be 4.0.3. There is no specific schedule for -that, but it is expected to be available some time in February 2001. The -next release on the legacy branch will be 3.3.7. There is currently no -schedule for that release. The 3.3.7 release is likely to be the final -release on that branch. +The next full release will be version 4.3.0, tentatively scheduled for late +May 2002. There is no scheduled update release. If there is one, the ver- +sion will be 4.2.1. Aside from actual releases, snapshots of the active release branches are tagged in the CVS repository from time to time. Each such snapshot has an @@ -51,9 +51,9 @@ 2. Current (new) Version Numbering Scheme Starting with the main development branch after 4.0.2, the XFree86 versions -will be numbered according to the scheme outlined here. Both the 4.0.2 sta- -ble branch and the 3.3.x legacy branch will continue to use the previous -scheme, which is outlined in the sections below. +are numbered according to the scheme outlined here. Both the 4.0.2 stable +branch and the 3.3.x legacy branch continue to use the previous scheme, which +is outlined in the sections below. The version numbering format is M.m.P.s, where M is the major version number, m is the minor version number, P is the patch level, and s is the snapshot @@ -68,8 +68,8 @@ the main development branch is bumped to 99, and the snapshot number is reset. The snapshot number is incremented for each tagged development snap- shot. The CVS tag for snapshots is "xf-M_m_P_s". When the development -branch enters feature freeze, the snapshot number is bumped to 900, and a -stable branch is created for the next full release. The branch is called +branch enters feature freeze, the snapshot number may be bumped to 900, and a +stable branch may be created for the next full release. The branch is called "xf-M_m-branch". The snapshot number is incremented from there until the release is finalised. Each of these snapshots is a "release candidate". When the release is finalised, the minor version is incremented, the patch @@ -294,8 +294,51 @@ scheme, the VendorRelease value is MMmmPPsss. That is, version M.m.P.s has 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. + +The following is a code fragment taken from xdpyinfo.c that shows how the +VendorRelease information can be interpreted. + + 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.x */ + printf("%d.%d.%d", vendrel / 10000000, + (vendrel / 100000) % 100, + (vendrel / 1000) % 100); + if (vendrel % 1000) { + printf(".%d", vendrel % 1000); + } + } + } - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.1 2001/02/07 18:49:31 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.2 2002/01/16 20:38:45 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Versions,v 1.1.4.1 2001/06/01 18:26:46 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Versions,v 1.3 2002/01/16 20:51:04 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Japanese/sgml/CPYRIGHT.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/Japanese/sgml/CPYRIGHT.sgml:3.2 xc/programs/Xserver/hw/xfree86/doc/Japanese/sgml/CPYRIGHT.sgml:3.3 --- xc/programs/Xserver/hw/xfree86/doc/Japanese/sgml/CPYRIGHT.sgml:3.2 Sat Jan 25 23:34:15 1997 +++ xc/programs/Xserver/hw/xfree86/doc/Japanese/sgml/CPYRIGHT.sgml Fri Dec 14 14:59:50 2001 @@ -42,9 +42,15 @@ X ¥³¥ó¥½¡¼¥·¥¢¥à

-Copyright (C) 1996 X Consortium +Copyright 1996, 1998 The Open Group +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. + ̵ÎÁ¤Ç¡¢Ã¯¤â¤¬¤³¤Î¥½¥Õ¥È¥¦¥§¥¢¤È´ØÏ¢¤¹¤ëʸ½ñ¥Õ¥¡¥¤¥ë¡Ê°Ê¹ß¤Þ¤È¤á¤Æ ``¤½¤Õ¤È¤¦¤§¤¢'' ¤È¸Æ¤Ö¡Ë¤òÆþ¼ê¤¹¤ë»ö¡¢»ÈÍѸ¢¡¢Ê£¼Ì¸¢¡¢ Êѹ¹¸¢¡¢Ê»¹ç¸¢¡¢½ÐÈǸ¢¡¢ÇÛÉÕ¸¢¡¢ºÆ¼Â»ÜµöÂú¸¢ ¤«¤Ä/¤Þ¤¿¤Ï ``¤½¤Õ¤È¤¦¤§¤¢'' @@ -242,7 +248,7 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Japanese/sgml/CPYRIGHT.sgml,v 3.2 1997/01/26 04:34:15 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Japanese/sgml/CPYRIGHT.sgml,v 3.3 2001/12/14 19:59:50 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/man/Imakefile diff -u xc/programs/Xserver/hw/xfree86/doc/man/Imakefile:3.5 xc/programs/Xserver/hw/xfree86/doc/man/Imakefile:3.6 --- xc/programs/Xserver/hw/xfree86/doc/man/Imakefile:3.5 Fri Mar 3 20:07:33 2000 +++ xc/programs/Xserver/hw/xfree86/doc/man/Imakefile Thu Nov 1 18:35:32 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/Imakefile,v 3.5 2000/03/04 01:07:33 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/Imakefile,v 3.6 2001/11/01 23:35:32 dawes Exp $ MANDIR = $(LIBMANDIR) MANSUFFIX = $(LIBMANSUFFIX) @@ -26,6 +26,6 @@ /* XXX Check if this is up to date */ InstallManPageLong(XF86VM,$(MANDIR),XF86VidMode) #if ExpandManNames -InstallManPageAliases(XF86VidMode,$(MANDIR),XF86VidModeQueryExtension XF86VidModeQueryVersion XF86VidModeGetModeLine XF86VidModeGetAllModeLines XF86VidModeDeleteModeLine XF86VidModeModModeLine XF86VidModeSwitchMode XF86VidModeSwitchToMode XF86VidModeLockModeSwitch XF86VidModeGetMonitor XF86VidModeGetViewPort XF86VidModeSetViewPort) +InstallManPageAliases(XF86VidMode,$(MANDIR),XF86VidModeQueryExtension XF86VidModeQueryVersion XF86VidModeGetModeLine XF86VidModeGetAllModeLines XF86VidModeDeleteModeLine XF86VidModeModModeLine XF86VidModeSwitchMode XF86VidModeSwitchToMode XF86VidModeLockModeSwitch XF86VidModeGetMonitor XF86VidModeGetViewPort XF86VidModeSetViewPort XF86VidModeValidateModeLine) #endif Index: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml:3.3 xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml:3.6 --- xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml:3.3 Mon Jul 19 10:38:41 1999 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml Thu Nov 15 12:32:16 2001 @@ -1,23 +1,20 @@ - + %defs; +]>

-Building XFree86 -<author>David Dawes -<Date>24 May 1997 +<title>Building XFree86 from a Source Distribution +<author>David Dawes, Matthieu Herrb +<Date>27 May 2001 <abstract> This document describes how to build XFree86 from the <bf>source</bf> -distribution. It covers building from the full source distribution as -well as from the cut-down source distribution available for building -only the X servers. It is designed to +distribution. It is designed to be used in conjunction with the OS-specific README files. </abstract> <toc> - -<sect>Building XFree86 From a Source Distribution - <p> <quote> <bf/NOTE:/ Refer to the appropriate OS-specific README file before attempting @@ -25,114 +22,59 @@ you may need to successfully build under your OS. </quote> + +We highly recommend using gcc to build XFree86, but it generally also +builds with the native compiler for each platform; -We highly recommend using GCC-2 to build XFree86. Do not use version -2.6.0 or 2.4.x versions prior to 2.4.5 due to bugs that cause either -build or execution failures. (gcc-2 is available from prep.ai.mit.edu -and other sites archiving GNU source.) +<sect>How to get the XFree86 &relvers; source -<sect1>How to get the XFree86 3.3 source <p> There are a few starting points for getting the XFree86 source. One option -is to start directly with the XFree86 3.3 source distribution. In this +is to start directly with the XFree86 &relvers; source distribution. In this case, the procedure is as follows: <itemize> - <item>The XFree86 3.3 source is contained in files <tt>X33src-1.tgz</tt>, - <tt>X33src-2.tgz</tt> and <tt>X33src-3.tgz</tt>. These can be found - at <htmlurl name="ftp://ftp.xfree86.org/pub/XFree86/3.3/source/" - url="ftp://ftp.xfree86.org/pub/XFree86/3.3/source/"> and similar - locations on XFree86 mirror sites. <tt>X33src-2.tgz</tt> contains - the fonts and documentation source. <tt>X33src-3.tgz</tt> contains - the hardcopy documentation. <tt>X33src-1.tgz</tt> contains + <item>The XFree86 source is contained in files <tt>X&srcvers;src-1.tgz</tt>, + <tt>X&srcvers;src-2.tgz</tt> and <tt>X&srcvers;src-3.tgz</tt>. These can be found + at <htmlurl name="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/source/" + url="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/source/"> and similar + locations on XFree86 mirror sites. <tt>X&srcvers;src-2.tgz</tt> contains + the fonts and documentation source. <tt>X&srcvers;src-3.tgz</tt> contains + the hardcopy documentation. <tt>X&srcvers;src-1.tgz</tt> contains everything else. If you don't need the docs or fonts you can get - by with only <tt>X33src-1.tgz</tt>. + by with only <tt>X&srcvers;src-1.tgz</tt>. <item>Extract each of these files by running the following from a directory on a filesystem containing enough space (the full source requires - around 130MB, and a similar amount is required in addition to this + around 270MB, and a similar amount is required in addition to this for the compiled binaries): - <quote><verb> - gzip -d < X33src-1.tgz | tar vxf - - gzip -d < X33src-2.tgz | tar vxf - - gzip -d < X33src-3.tgz | tar vxf - - </verb></quote> -</itemize> - -Another option is to start with the X11R6.3 source distribution and patch -it up to XFree86 3.3. In this case you need to do the following: -<itemize> - <item>Start with the X Consortium's X11R6.3 distribution with public - patch 1 applied. This can be obtained by following the links - from the <url name="X homepage" url="http://www.x.org">. - <item>Get the files <tt>R6.3pl1-3.3.diff.gz</tt> and <tt>cfont33.tgz</tt> - from <htmlurl name="ftp://ftp.xfree86.org/pub/XFree86/3.3/patches/" - url="ftp://ftp.xfree86.org/pub/XFree86/3.3/patches/"> (or a similar - location on mirror sites). To upgrade the source to XFree86 3.3, - run the following from directory containing the <tt>xc</tt> - directory of the X11R6.3 pl1 source tree: - <quote><verb> - gzip -d < R6.3pl1-3.3.diff.gz | patch -p0 -E - gzip -d < cfont33.tgz | tar vxf - - </verb></quote> - Be sure to do this with a clean unmodified source tree. If you - don't some patches may fail. -</itemize> - -If you only want to build the XFree86 X servers, you can use a cut-down -version of the XFree86 source tree called the ``servers only'' distribution. -If you choose this option, do the following: -<itemize> - <item>Get the <tt>X33servonly.tgz</tt> file from - <htmlurl name="ftp://ftp.xfree86.org/pub/XFree86/3.3/source/" - url="ftp://ftp.xfree86.org/pub/XFree86/3.3/source/"> (or a similar - locations on mirror sites. - <item>Extract this by running the following: - <quote><verb> - gzip -d < X33servonly.tgz | tar vxf - - </verb></quote> + <quote><tt> + gzip -d < X&srcvers;src-1.tgz | tar vxf -<newline> + gzip -d < X&srcvers;src-2.tgz | tar vxf -<newline> + gzip -d < X&srcvers;src-3.tgz | tar vxf -<newline> + </tt></quote> + <item>If the release is not a full release, it is available as a + patch against the previous full release in the +<htmlurl +name="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/patches/" +url="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/patches/"> +directory. Get the patch file from there and apply it by running the +following command: +<quote><tt> +cd <em>the directory containing the</em> xc <em>directory</em><newline> +gzip -d < <em>file</em> | patch -s -p0 -E +</tt> +</quote> +Look for special patching instructions in the <htmlurl name="Release +Notes" url="http://www.xfree86.org/&relvers;/RELNOTES.html">. </itemize> -There is no patch to upgrade from the XFree86 3.2 source to 3.3. The -reason for this is the large number of changes associated with the -move from X11R6.1 to X11R6.3. - -XFree86 supports a small subset of the X Consortium X11R6.1 contrib -distribution. If you wish to build this, you will need at least the -following files/directories from that distribution: -<tscreen><verb> - contrib/Imakefile - contrib/programs/Imakefile - contrib/programs/ico - contrib/programs/listres - contrib/programs/showfont - contrib/programs/viewres - contrib/programs/xbiff - contrib/programs/xcalc - contrib/programs/xditview - contrib/programs/xedit - contrib/programs/xev - contrib/programs/xeyes - contrib/programs/xfontsel - contrib/programs/xgc - contrib/programs/xload - contrib/programs/xman - contrib/programs/xmessage -</verb></tscreen> -You will also need the XFree86 patch <tt>contrib-3.3.diff.gz</tt>. To -apply the patch, run the following from the directory containing the -<tt>contrib</tt> directory: -<tscreen><verb> - gzip -d < contrib-3.3.diff.gz | patch -p0 -E -</verb></tscreen> +Another option is to get the source by anonymous CVS or CVSup. +See <htmlurl name="http://www.xfree86.org/cvs/" +url="http://www.xfree86.org/cvs/"> for details on the different +procedure available. -If you wish to build the xtest distribution, get the source distribution -<tt>X33test.tgz</tt> from the XFree86 source directory, and extract it -by running: -<tscreen><verb> - gzip -d < X33test.tgz | tar vxf - -</verb></tscreen> -Note, xtest is no longer part of the core X11 distribution (since X11R6.3). +All method will produce one main source directory called <tt>xc</tt>. -<sect1>Configuring the source before building +<sect>Configuring the source before building <p> It is recommended that you start the configuration process by going to the <tt>xc/config/cf</tt> directory, and copying the file <tt>xf86site.def</tt> @@ -144,29 +86,86 @@ Unlike previous versions, imake can now automatically detect and set the various <bf>OS*Version</bf> parameters, so you shouldn't need to enter those settings explicitly. - -If you are using just the <tt>X33src-1.tgz</tt> part of the source dist, -you will need to define <bf>BuildFonts</bf> to <bf>NO</bf>. -If you are using the ``servers only'' distribution, you will need to -define <bf>BuildServersOnly</bf> to <bf>YES</bf>. +If you are using just the <tt>X&srcvers;src-1.tgz</tt> part of the +source dist, you will need to define <bf>BuildFonts</bf> to +<bf>NO</bf>. + +<sect>Using a shadow directory of symbolic links for the build +<p> +A recommended practice is to use a shadow directory of symbolic links +to do the build of XFree86. This permits to keep the source directory +unmodified during the build, which has the following benefits: +<itemize> +<item>In the case where CVS is used to maintain the source tree up to +date, the update process is not disturbed by foreign files not under +the control of CVS. +<item>It is possible to build XFree86 for several different Operating +System or architectures from the same sources, shared by NFS. +<item>It is possible to build XFree86 with different configuration +options, just by putting a real copy<tt>host.def</tt> in each build +tree and by customizing it separately in each build tree. +</itemize> +<p> +To make a shadow directory of symbolic links, use the following steps: +<itemize> +<item>create the directory at the top of the build tree. It is often +created at the same level that the <tt>xc</tt> directory, but this is +not mandatory. +<quote><tt> +cd <em>the directory containing the </em>xc<em>directory</em><newline> +mkdir build +</tt></quote> +<item>use the <tt>lndir</tt>command to make the shadow tree: +<quote><tt> +lndir ../xc +</tt></quote> +Note that you can refer to the <tt>xc</tt> directory with an absolute +path if needed. +<p> +See the <htmlurl name="lndir(1) manual page" +url="http://www.xfree86.org/&relvers;/lndir.1.html"> for details. +</itemize> +If <tt>lndir</tt> is not already installed on your system, you can +build it manually from the XFree86 sources by running the following +commands: +<quote><tt> +cd xc/config/util<newline> +make -f Makefile.ini lndir<newline> +cp lndir <em>some directory in your PATH</em> +</tt></quote> -<sect1>Building and installing the distribution +<sect>Building and installing the distribution <p> Before building the distribution, read through the OS-specific <tt/README/ file in <tt>xc/programs/Xserver/hw/xfree86/doc</tt> that is relevant to -you. Once those OS-specific details have been taken care of, go the -<tt/xc/ directory and run ``<tt/make World/'' with the <bf/BOOTSTRAPCFLAGS/ -set as described in the OS-specific README (if necessary). It is +you. Once those OS-specific details have been taken care of, go your +build directory +(either the <tt/xc/ directory or the shadow tree created before) and +run ``<tt/make World/'' with the <bf/BOOTSTRAPCFLAGS/ +set as described in the OS-specific README (if necessary, but most +systems supported by XFree86 don't need <bf/BOOTSTRAPCFLAGS/). It is advisable to redirect stdout and stderr to <tt/World.Log/ so that you can track down problems that might occur during the build. +<p> +With Bourne-like shells (Bash, the Korn shell, <tt>zsh</tt>, etc.) use +a command like: +<quote><tt> +make World > World.log 2>&1 +</tt></quote> +Witch C-shell variants (<tt>csh</tt>, <tt>tcsh</tt>, etc), use: +<quote><tt> +make World >& World.log +</tt></quote> +You can follow the progress of the build by running: +<quote><tt> +tail -f World.log +</tt></quote> in a terminal. +<p> When the build is finished, you should check <tt/World.Log/ to see if there were any problems. If there weren't any then you can install -the binaries. When using the full source distribution, the installation -should be done from the <tt/xc/ directory. When using the ``servers only'' -distribution, the install should be done from the -<tt>xc/programs/Xserver</tt> directory. +the binaries. To do the install, run ``<tt/make install/'' and ``<tt/make install.man/''. Make sure you have enough @@ -174,26 +173,14 @@ to install on a filesystem other than <tt>/usr</tt>, make a symbolic link to <tt>/usr/X11R6</tt> before installing. -To install the binary LinkKit (in <tt>/usr/X11R6/lib/Server</tt>), -run ``<tt>make install.linkkit</tt>'' from the <tt/xc/ directory. - -To build the subset of the contrib release supported by -XFree86, make sure that you have first built and installed the core -distribution. Then go to the <tt/contrib/ directory and run -``<tt/xmkmf -a; make/''. When that is completed, run -``<tt/make install/'' and ``<tt/make install.man/'' to install it. - -To build/run the xtest distribution, refer to the instructions in -the file <tt>test/xsuite/NOTES.xf86</tt>. - <sect>Reconfiguring the server (source distribution) <p> To build a different set of servers or servers with a different set of drivers installed: <enum> <item>Make sure the source for any new drivers is in the correct place (e.g., -driver source for the SVGA server should be in a subdirectory of -<tt>xc/programs/Xserver/hw/xfree86/vga256/drivers</tt>). +driver source should be in a subdirectory of +<tt>xc/programs/Xserver/hw/xfree86/drivers</tt>). <item>Change the settings of the server defines in <tt/host.def/ to specify which servers you @@ -203,21 +190,57 @@ <tscreen><verb> make Makefile make Makefiles + make includes make depend make </verb></tscreen> </enum> -<sect>Reconfiguring the server (binary distribution) -<p> +<sect>Other useful make targets +<p>There are some other useful targets defined in the top level +<tt>Makefile</tt>of XFree86: +<itemize> +<item><bf/Everything/ after a <tt>make World</tt>, <tt>make +Everything</tt>does everything a <tt>make World</tt> does, except the +cleaning of the tree. It is a way to quickly rebuild the tree after a +source patch, but it is not 100% bullet proof. There are cases were it +is better to force a full build by using <tt>make World</tt>. -If you have installed the server Binary LinkKit, it is possible to -reconfigure the drivers and some of the extensions in the servers. For -details of how to do this, please refer to the <htmlurl url="LinkKit.html" -name="README.LinkKit"> file. + +<item><bf/clean/ does a partial cleaning of the source tree. Removes +object files and generated manual pages, but leaves the Makefiles and +the generated dependencies files in place. After a <tt>make clean</tt> +you need to re-run +<tscreen><verb> + make includes + make depend + make +</verb> +</tscreen> +to rebuild the XFree86. + +<item><bf/distclean/ does a full cleaning of the source tree, +removing all generated files. After a <tt>make distclean</tt>, +<tt>make World</tt> is the only option to rebuild XFree86. + +<item><bf/includes/ generates all generated header files and in-tree +symbolic links needed by the build. These files are removed by a +<tt>make clean</tt>. + +<item><bf/depend/ recomputes the dependencies for the various targets +in all Makefiles. Depending on the operating system, the dependencies +are stored in the Makefile, or as a separate file, called +<tt>.depend</tt>. This target needs the generated include files +produced by <tt>make includes</tt>. + +<item><bf/VerifyOS/ displays the detected operating system version. If +the numbers shown do not match your system, you probably need to set +them manually in <tt>host.def</tt> and report the problem to +XFree86@XFree86.org. +</itemize> <verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.3 1999/07/19 14:38:41 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.6 2001/11/15 17:32:16 dawes Exp $ </verb> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.44 xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.47 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.44 Fri May 18 20:40:30 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml Wed Jan 16 15:38:44 2002 @@ -27,7 +27,7 @@ <title>XFree86 X server ``New Design'' (DRAFT) <author>The XFree86 Project, Inc -<date>Last modified 1 May 2001 +<date>Last modified 1 August 2001 @@ -36,7 +36,7 @@ <ident> -$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/sgml/DESIGN.sgml,v 1.47 2002/01/16 20:38:44 dawes Exp $ </ident> @@ -1122,6 +1122,17 @@ Changes the viewport for the screen identified by &s.code;index;&e.code;. + It should be noted that many chipsets impose restrictions on where the + viewport may be placed in the virtual resolution, either for alignment + reasons, or to prevent the start of the viewport from being positioned + within a pixel (as can happen in a 24bpp mode). After calculating the + value the chipset's panning registers need to be set to for non-DGA + modes, this function should recalculate the ScrnInfoRec's + &s.code;frameX0&e.code;, &s.code;frameY0&e.code, &s.code;frameX1&e.code; + and &s.code;frameY1&e.code; fields to correspond to that value. If + this is not done, switching to another mode might cause the position + of a hardware cursor to change. + </quote> </quote> @@ -2986,9 +2997,8 @@ initialised. The &s.code;pScrn->gamma&e.code; field must also be initialised, preferably by calling &s.code;xf86SetGamma()&e.code;. &s.code;maxColors&e.code; is the number of entries in the palette. - &s.code;sigRGBbits&e.code; is the number of significant bits in - each colour component. This would normally be the same as - &s.code;pScrn->rgbBits&e.code;. &s.code;loadPalette&e.code; + &s.code;sigRGBbits&e.code; is the size in bits of each color + component in the DAC's palette. &s.code;loadPalette&e.code; is a driver-provided function for loading a colormap into the hardware, and is described below. &s.code;setOverscan&e.code; is an optional function that may be provided when the overscan color Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DGUX.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DGUX.sgml:1.1 xc/programs/Xserver/hw/xfree86/doc/sgml/DGUX.sgml:1.2 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DGUX.sgml:1.1 Thu Feb 24 15:43:23 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DGUX.sgml Fri Aug 10 12:38:11 2001 @@ -85,7 +85,7 @@ <sect> GENERAL: <p> - Get from ftp.xfree86.org the XFree 3.3.x source code: + Get from ftp.xfree86.org the XFree86 3.3.x source code: <verb> ftp ftp.xfree86.org login: ftp @@ -373,7 +373,7 @@ And in another xterm give cd xc tail -f Build-dg.log to watch the building progress. <p> - To install X11R6.3 XFree version 3.3.5 after the build + To install X11R6.3 XFree86 version 3.3.5 after the build you must have a filesystem say usr_X11R6.3 mounted to the directory /usr/X11R6 size 350000 blocks. (or whatever you choose to be your ProjectRoot, if you @@ -783,7 +783,7 @@ <verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DGUX.sgml,v 1.1 2000/02/24 20:43:23 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DGUX.sgml,v 1.2 2001/08/10 16:38:11 dawes Exp $ </verb> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.24 xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.27 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.24 Fri May 18 20:42:22 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml Mon Jan 7 17:05:57 2002 @@ -10,10 +10,10 @@ <author> <htmlurl url="http://www.valinux.com/" name="VA Linux Systems, Inc."> Professional Services - Graphics. - <date>3 May 2001 + <date>15 June 2001 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.24 2001/05/19 00:42:22 dawes Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.27 2002/01/07 22:05:57 dawes Exp $ </ident> <toc> @@ -67,11 +67,11 @@ includes XFree86 4.0 or that you're an experienced Linux developer who has compiled the DRI for himself. DRI download, compilation and installation instructions can be found - at <htmlurl url="http://dri.sourceforge.net/DRIcompile.html" + at <htmlurl url="http://dri.sourceforge.net/doc/DRIcompile.html" name="http://dri.sourceforge.net/DRIcompile.html"> <p> Edits, corrections and updates to this document may be mailed - to brianp@valinux.com. + to <email>brian@tungstengrahpics.com</email>. <sect>Supported Architectures & Hardware <p> @@ -129,7 +129,7 @@ <item>i810-dc100 <item>i810e </itemize> - <item>ATI Rage 128, supported on Intel x86 and AMD: + <item>ATI Rage 128, supported on Intel x86, AMD and Alpha: <itemize> <item>Rage Fury <item>Rage Magnum @@ -137,13 +137,15 @@ <item>XPERT 128 <item>XPERT 99 <item>All-in-Wonder 128 + <item>Rage 128 PCI (Alpha-based systems) </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: + <item>ATI Radeon, supported on Intel x86, AMD and Alpha: <itemize> <item>Radeon SDR AGP <item>Radeon DDR AGP + <item>Radeon 32MB SDR PCI (Alpha-based systems) </itemize> <item>3Dlabs, supported on Intel x86 and AMD: <itemize> @@ -193,7 +195,7 @@ XFree86 4.0.1 added automatic kernel module loading to the X server. On Linux, the X server uses modprobe to load kernel modules. In Linux 2.4.x the DRM kernel modules should be kept in - <tt>/lib/modules/2.4.x/kernel/driver/char/drm/</tt> for automatic + <tt>/lib/modules/2.4.x/kernel/drivers/char/drm/</tt> for automatic loading to work. <p> Optionally, DRM kernel modules can be loaded manually with insmod @@ -746,7 +748,7 @@ <p> 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/. + should be installed in /lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for 3dfx hardware should be in @@ -937,7 +939,7 @@ </verb> <p> The kernel module for the i810 is named <tt>i810.o</tt> and - should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. + should be installed in /lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the i810 should be in @@ -1034,7 +1036,7 @@ <p> The kernel module for the G200/G400 is named <tt>mga.o</tt> and - should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. + should be installed in /lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the G200/G400 should be in @@ -1177,7 +1179,7 @@ </verb> <p> The kernel module for the Rage 128 is named <tt>r128.o</tt> and - should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. + should be installed in /lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the Rage 128 should be in @@ -1203,7 +1205,8 @@ The following OpenGL features are implemented in software and will be slow: <itemize> - <item>Stencil buffer and accumulation buffer operations + <item>accumulation buffer operations + <item>stencil, when using a 16bpp screen <item>Blend subtract, min/max and logic op blend modes <item>GL_SEPARATE_SPECULAR_COLOR lighting mode <item>glDrawBuffer(GL_FRONT_AND_BACK) @@ -1259,7 +1262,7 @@ </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/. + should be installed in /lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded by the Xserver if needed. <p> The DRI 3D driver for the Radeon should be in Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.14 xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.16 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.14 Wed May 2 11:06:08 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml Mon Jan 7 17:05:57 2002 @@ -13,7 +13,7 @@ <date>21 April 2001 <ident> - $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/sgml/DRIcomp.sgml,v 1.16 2002/01/07 22:05:57 dawes Exp $ </ident> <toc> @@ -59,7 +59,7 @@ Beginners are probably better off installing precompiled packages. <p> Edits, corrections and updates to this document may be mailed - to brianp@valinux.com. + to <email>brian@tungstengrahpics.com</email>. <sect>Prerequisites <p> @@ -266,7 +266,7 @@ <sect>Downloading the XFree86/DRI CVS Sources <p> The DRI project is hosted by VA Linux Systems' - <htmlurl url="http://sourceforge.net/project/?group_id=387" + <htmlurl url="http://dri.sourceforge.net/" name="SourceForge">. The DRI source code, which is a subset of the XFree86 source tree, is kept in a CVS repository there. @@ -325,7 +325,7 @@ <p> <verb> cd ~/DRI-CVS - cvs -z3 -dYOURID@cvs.dri.sourceforge.net:/cvsroot/dri co xc + cvs -z3 -d:ext:YOURID@cvs.dri.sourceforge.net:/cvsroot/dri co xc </verb> Replace <tt>YOURID</tt> with your CVS login name. You'll be prompted to enter your sourceforge password. @@ -708,7 +708,7 @@ At this point your X server should be up and running with hardware-accelerated direct rendering. Please read the - <htmlurl url="http://dri.sourceforge.net/DRIuserguide.html" + <htmlurl url="http://dri.sourceforge.net/doc/DRIuserguide.html" name="DRI User Guide"> for information about trouble shooting and how to use the DRI-enabled X server for 3D applications. <p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml:1.4.4.2 xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml:1.9 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml:1.4.4.2 Sat Jun 2 00:44:37 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml Thu Dec 13 02:09:05 2001 @@ -4,40 +4,56 @@ <article> <title>XFree86 on Darwin and Mac OS X -<author>Torrey T. Lyons -<date>25 May 2001 +<author>Torrey T. Lyons, <email>torrey@mrcla.com</email> +<date>12 December 2001 <ident> -$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/sgml/Darwin.sgml,v 1.9 2001/12/13 07:09:05 torrey Exp $ </ident> <toc> <sect>Introduction <p> -<htmlurl url="http://www.xfree86.org/" name="XFree86">, a free -implementation of X Windows, has been ported to <htmlurl -url="http://www.publicsource.apple.com/projects/darwin/" name="Darwin"> +<htmlurl url="http://www.xfree86.org/" name="XFree86">, a freely +redistributable open-source implementation of the <htmlurl +url="http://www.x.org/" name="X Window System">, has been ported to <htmlurl +url="http://www.opensource.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 -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 -working on modifications to the Darwin X server, please let me know. +running XFree86 on Apple's next generation operating system. +<p> +Most of the current work on XFree86 for Darwin and Mac OS X is centered +around the <htmlurl url="http://sourceforge.net/projects/xonx/" +name="XonX project"> at <htmlurl url="http://sourceforge.net" +name="SourceForge">. If you are interested in up-to-date status, want to +report a bug, or are interested in working on XFree86 for Darwin, stop by the +<htmlurl url="http://sourceforge.net/projects/xonx/" name="XonX project">. + <sect>Hardware Support and Configuration <p> -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. +The X window server for Darwin and Mac OS X provided by the <htmlurl +url="http://www.XFree86.Org/" name="XFree86 Project, Inc."> is called +XDarwin. XDarwin can run in three different modes. On Mac OS X, +XDarwin runs in parallel with Aqua in full screen or rootless modes. +These modes are called Quartz modes, named after the Quartz 2D compositing +engine used by Aqua. XDarwin can also be run from the Darwin console in +IOKit mode. + +<p> +In full screen Quartz mode, 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, click on the XDarwin +icon in the Dock to switch back to the X window system. (You can change +this behavior in the user preferences so that you must click the XDarwin +icon in the floating switch window instead.) + +<p>In rootless mode, the X window system and Aqua share your display. +The root window of the X11 display is the size of the screen and contains +all the other windows. The X11 root window is not displayed in rootless +mode as Aqua handles the desktop background. <p> From the console, the Darwin port of XFree86 uses the IOKit for device @@ -45,7 +61,6 @@ 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 @@ -54,14 +69,15 @@ 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/" +<htmlurl url="http://www.opensource.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> 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. +USB mice that I have tested. I have done no testing with ADB +mice, but without a special driver, only a single mouse button +will work on an ADB mouse. <sect>Getting Started <p> @@ -69,24 +85,25 @@ XFree86. The procedure for getting your X server up and running on 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. +Mac OS X, you need to install the Developers' Tools. <p> 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/">. +url="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/binaries/">. Follow the instructions in the <htmlurl url="http://www.xfree86.org/&relvers;/Install.html" name="Install"> 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. +support, download the optional Xquartz.tgz tarball. With Quartz support, +the XDarwin application will be installed in <tt>/Applications</tt>. <p> If you get the precompiled binaries you can skip ahead to the section -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. +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. <sect1> Get the Code @@ -133,106 +150,97 @@ <sect>Run the X Window System<label id="running"> <p> -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 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 PATH "${PATH}:/usr/X11R6/bin" -setenv MANPATH "${MANPATH}:/usr/X11R6/man" -</verb></tscreen> -The next time you login or open a Terminal window, this file will be -executed automatically. +You need to add the X Window System executables to your path. Your path +is the list of directories to be searched for executable commands. +The X11 commands are located in <tt>/usr/X11R6/bin</tt>, which needs to be +added to your path. XDarwin does this for you by default and can also add +additional directories where you have installed command line applications. + +<p> +More experienced users will have already set their path correctly using the +initialization files for their shell. In this case, you can inform XDarwin +not to modify your path in the preferences. XDarwin launches the initial +X11 clients in the user's default login shell. (An alternate shell can also +be specified in the preferences.) The way to set the path depends on the +shell you are using. This is described in the man page documentation for +the shell. + +<p> +In addition you may also want to add the man pages from XFree86 to the list +of pages to be searched when you are looking for documentation. The X11 man +pages are located in <tt>/usr/X11R6/man</tt> and the <tt>MANPATH</tt> +environment variable contains the list of directories to search. <p> -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 +On Mac OS X, you can run XFree86 from the Darwin +text console or in parallel 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> -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. +From the text console you can start the X Window System by typing +``exec 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 +running. Unfortunately the X server does not shutdown correctly and if +you did not start with ``exec startx'', 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 +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. <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. +``startx -- -quartz''. By default this will give you a mode picker to +choose between full screen or rootless mode. You can change the default +to always use a particular mode in the preferences, or you can specify +the ``-fullscreen'' or ``-rootless'' options on the command line instead +of ``-quartz''. <p> -<bf/Customize X Windows/ +<bf/Customize the X Window System/ <p> -The X window system is very customizable and you will certainly want to +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 +get a fancier 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 the X window system. You can find a sample +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 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 -url="http://softrak.stepwise.com/Apps/WebObjects/Softrak" name="Stepwise's -Softrak site">. - <p> -Good luck! +There are many window managers that have been ported to Darwin. The +following pages contain collections of window managers and other X +window system clients: -<sect>Outstanding Issues with the X server - -<p> -There is a still a lot to be done with the X server. As always please -let me know if you are interested in working on any of these issues. - -<bf/Things that are broken:/ <itemize> -<item>The bell does not work in IOKit mode. - -<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> <htmlurl url="http://fink.sourceforge.net/" name="Fink">: A +package manager that will easily download, compile, and install lots +of open source software from the Internet. -<item>Only one display is currently supported. +<item> <htmlurl url="http://gnu-darwin.sourceforge.net/" name="GNU-Darwin">: +A source for tons of software ported to Darwin. -<item>The display mode can not be changed once the X server -has started. +<item> <htmlurl url="http://softrak.stepwise.com/Apps/WebObjects/Softrak" +name="Stepwise's Softrak site"> -<item>A screen saver is not supported. +<item> <htmlurl url="http://www.darwinfo.org/ports/" +name="Darwinfo's ports page"> </itemize> + +<p> +Good luck! </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.71.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.78 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.71.2.1 Fri Jun 1 14:09:48 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile Thu Nov 15 13:12:50 2001 @@ -3,14 +3,14 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.71.2.1 2001/06/01 18:09:48 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.78 2001/11/15 18:12:50 dawes Exp $ #include <Server.tmpl> #include <lnxdoc.rules> -/* Set this to YES if the RELNOTES file is up to date */ +/* Set this to YES if the RELNOTES file is up to date (and during devel) */ #ifndef BuildRelnotes -#define BuildRelnotes NO +#define BuildRelnotes YES #endif #if BuildRelnotes @@ -23,7 +23,7 @@ DESIGN.sgml Versions.sgml \ mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml dps.sgml \ Darwin.sgml isc.sgml LynxOS.sgml NetBSD.sgml OpenBSD.sgml \ - OS2note.sgml \ + OS2Notes.sgml \ apm.sgml ati.sgml chips.sgml cyrix.sgml DECtga.sgml \ I128.sgml i740.sgml i810.sgml newport.sgml \ r128.sgml rendition.sgml s3virge.sgml SiS.sgml @@ -46,9 +46,14 @@ #ifdef OUTOFDATE LinuxDocReadmeTarget(OS2) #endif -LinuxDocTargetLong(OS2note.sgml,OS2.Notes,OS2Notes) +LinuxDocTargetLong(OS2Notes.sgml,OS2.Notes,OS2Notes) #ifdef OUTOFDATE LinuxDocReadmeTarget(SCO) +#endif +#ifdef NOTYET +LinuxDocReadmeTarget(Solaris) +#endif +#ifdef OUTOFDATE LinuxDocReadmeTarget(SOLX86) LinuxDocReadmeTarget(SVR4) #endif @@ -103,15 +108,15 @@ #endif /* Main docs */ -#ifdef OUTOFDATE LinuxDocTarget(BUILD) +#ifdef OUTOFDATE LinuxDocReadmeTarget(Config) #endif LinuxDocTarget(DESIGN) LinuxDocTarget(Install) LinuxDocTarget(LICENSE) #ifdef OUTOFDATE -LinuxDocTargetLong(QStart.sgml,QuickStart.doc,QuickStart) +LinuxDocTargetLong(QuickStart.sgml,QuickStart.doc,QuickStart) #endif LinuxDocTarget(README) #if BuildRelnotes @@ -124,7 +129,7 @@ LinuxDocReadmeTarget(mouse) LinuxDocTarget(Versions) #ifdef OUTOFDATE -LinuxDocTargetLong(VidModes.sgml,VideoModes.doc,VideoModes) +LinuxDocTargetLong(VideoModes.sgml,VideoModes.doc,VideoModes) LinuxDocTarget(xinput) #endif LinuxDocReadmeTarget(DRI) Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.11.2.2 xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.13 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.11.2.2 Fri Jun 1 14:09:48 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml Wed Jan 16 15:38:44 2002 @@ -6,10 +6,10 @@ <title>Installation Details for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>1 June 2001 +<date>16 January 2002 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11.2.2 2001/06/01 18:09:48 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.13 2002/01/16 20:38:44 dawes Exp $ </ident> <abstract> @@ -50,16 +50,24 @@ of operating systems at our <![ %snapshot; [ <url name="ftp site" -url="ftp://ftp.xfree86.org/pub/XFree86/snapshots/&relvers/binaries/">. +url="ftp://ftp.xfree86.org/pub/XFree86/snapshots/&relvers/binaries/"> ]]> <![ %release; [ <url name="ftp site" -url="ftp://ftp.xfree86.org/pub/XFree86/&relvers/binaries/">. +url="ftp://ftp.xfree86.org/pub/XFree86/&relvers/binaries/"> ]]> -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). +and our +<![ %snapshot; [ +<url name="web site" +url="http://ftp.xfree86.org/pub/XFree86/snapshots/&relvers/binaries/">. +]]> +<![ %release; [ +<url name="web site" +url="http://ftp.xfree86.org/pub/XFree86/&relvers/binaries/">. +]]> +Often during releases our site is heavily loaded. Instead of downloading +directly from us we recommend that instead you use one of our mirror +sites. <p> Our binaries are organized by sub-directories which correspond to each @@ -104,6 +112,19 @@ <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. + + <item>If the binary distribution reported by the Xinstall.sh script + isn't present on our site, then there are two possibilities. + The first is that it hasn't been prepared and uploaded yet. + This is likely if you are looking soon after the release date. + The second possibility is that we won't have it available at + all for this release. This is likely if it's still not there + about two weeks after the release date. Check <url name="here" + url="http://www.xfree86.org/&relvers;/UPDATES.html"> for + information about updates to our binary distributions, and <url + name="here" url="http://www.xfree86.org/&relvers;/ERRATA.html"> + for errata related to this release. + </itemize> Once you're run the <tt>Xinstall.sh</tt> script and found which binary @@ -173,7 +194,7 @@ 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) +8. Xfscl.tgz Scalable fonts (Speedo, Type1 and TrueType) 9. Xhtml.tgz HTML version of the documentation 10. Xps.tgz PostScript version of the documentation 11. Xjdoc.tgz Documentation in Japanese @@ -357,10 +378,11 @@ <![ %fullrel [ <sect>Installing XFree86 &relvers; manually<label id="manual-install"> <p> -This section describes how to manually install the XFree86 &relvers; binary -distributions. 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. +This section contains information about manually installing the XFree86 +&relvers; binary distributions. 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. It also may not be complete or up to date. +Use at your own risk. Put all of the downloaded files into a single directory (choose some temporary location with enough space). Become the super user (root). Index: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.8 xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.11 --- xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.8 Fri Mar 16 17:13:19 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml Wed Jan 16 15:38:45 2002 @@ -5,10 +5,10 @@ <article> <title>Licenses The XFree86 Project -March 2001 +January 2002 -$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/sgml/LICENSE.sgml,v 1.11 2002/01/16 20:38:45 dawes Exp $ XFree86 License @@ -17,7 +17,7 @@ copyright/license:

-Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. +Copyright (C) 1994-2002 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"), @@ -44,11 +44,14 @@ Other Licenses

-Portions of code are covered by the following licenses/copyrights: +Portions of code are covered by the following licenses/copyrights. See +individual files for the copyright dates. -X Consortium +X/MIT Copyrights

-Copyright (C) 1996 X Consortium +X Consortium +

+Copyright (C) <date> X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -75,6 +78,31 @@ X Window System is a trademark of X Consortium, Inc. +The Open Group +

+Copyright <date> The Open Group + +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. + +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. + + Berkeley-based copyrights:

General @@ -611,49 +639,50 @@ solely in object code form, Recipient may replace the words "this file" with "this software" in both the first and second sentences.] -Bigelow & Holmes Inc and Y&Y Inc Lucidux font license +Bigelow & Holmes Inc and URW++ GmbH Luxi font license

-Copyright (C) 2000 Bigelow & Holmes Inc. and Y&Y, Inc. Patents pending. -All Rights Reserved. Lucidux is a trademark of Bigelow & Holmes Inc. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of these Fonts and associated documentation files (the "Font -Software"), to deal in the Font Software, including without limitation the -rights to use, copy, merge, publish, distribute, sublicense, and/or sell -copies of the Font Software, and to permit persons to whom the Font -Software is furnished to do so, subject to the following conditions: +Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font +instruction code copyright (c) 2001 by URW++ GmbH. All Rights +Reserved. Luxi is a registered trademark of Bigelow & Holmes Inc. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of these Fonts and associated documentation files (the "Font +Software"), to deal in the Font Software, including without +limitation the rights to use, copy, merge, publish, distribute, +sublicense, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to +the following conditions: -The above copyright, trademark, patent notices and this permission notice +The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software. + +The Font Software may not be modified, altered, or added to, and in +particular the designs of glyphs or characters in the Fonts may not +be modified nor may additional glyphs or characters be added to the +Fonts. This License becomes null and void when the Fonts or Font +Software have been modified. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL +BIGELOW & HOLMES INC. OR URW++ GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, +INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR +INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT +SOFTWARE. -The Font Software may not be modified, altered, or added to, and in -particular the designs of glyphs or characters in the Fonts may not be -modified nor may additional glyphs or characters be added to the Fonts, -except that composite characters composed of two or more characters in the -Fonts may be created using the seac (Standard Encoding Accented Character) -Type 1 operator. - -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & -HOLMES INC. OR Y&Y, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR -CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. - -Except as contained in this notice, the names of Bigelow & Holmes Inc. and -Y&Y, Inc. shall not be used in advertising or otherwise to promote the -sale, use or other dealings in this Font Software without prior written -authorization from the Bigelow & Holmes Inc. and Y&Y, Inc. +Except as contained in this notice, the names of Bigelow & Holmes +Inc. and URW++ GmbH. shall not be used in advertising or otherwise to +promote the sale, use or other dealings in this Font Software without +prior written authorization from Bigelow & Holmes Inc. and URW++ GmbH. For further information, contact: -sales@yandy.com +info@urwpp.de or -design@bigelowandholmes.com - +design@bigelowandholmes.com

Index: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.60.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.63 --- xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.60.2.1 Fri Jun 1 14:09:48 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml Wed Jan 16 17:35:18 2002 @@ -9,10 +9,10 @@ Marc Wandschneider, Mark Weaver, Matthieu Herrb -Last modified on: 3 March 2001 +Last modified on: 16 January 2002 -$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/sgml/NetBSD.sgml,v 3.63 2002/01/16 22:35:18 herrb Exp $ @@ -20,7 +20,7 @@ What and Where is XFree86?

-XFree86 is the Open Source port of X.Org's X11R6.4 release that supports +XFree86 is the Open Source port of X.Org's X11R6.6 release that supports several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operating systems on Intel and other platforms. @@ -42,7 +42,7 @@ XFree86 also builds on other NetBSD architectures. See section - for details. + for details. XFree86 also supports NetBSD on PC98 machines. @@ -61,6 +61,19 @@ non-OS dependent new features in XFree86 &relvers;. ]]> +New OS dependent features in 4.2.0 +

+ +Support of client side on NetBSD/sparc64 +Support for in-kernel MTRR and AGP support in NetBSD 1.5Y + + +New OS dependent features in 4.1.0 +

+ +Enable wide characters support in NetBSD 1.5P and later. + + New OS dependent features in 4.0.2

@@ -407,7 +420,7 @@ #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT -Building on other architectures

Note that the NetBSD project has now its own source tree, based on the @@ -416,13 +429,6 @@ The NetBSD xsrc source tree is available at: - -

-There's an . Building New X Clients Index: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml:1.1 --- /dev/null Fri Jan 18 15:25:15 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml Mon Jun 4 09:50:15 2001 @@ -0,0 +1,214 @@ + +

+ +Notes on Rebuilding XFree86/OS2 from Scratch +<author>Holger Veit +<date>Last modified March 8th, 2000 + +<toc> + +<sect>Preface +<p> +X11 and XFree86 were initially developed on Unix-based systems. Usually +Unix systems provide a rich number of tools and utilities to get certain +things done. Under OS/2, these tools are not installed, but ports are +available which are sometimes functionally equivalent to Unix utilities +with the same name, but also differ sometimes in a subtle way. +This guide will give you hints if you intend to rebuild the system +from scratch under OS/2. +<p> +Please also read <htmlurl name=README.OS2 url=OS2.html> for end-user +information, and set at least the environment variables described there. +<p> +At the current time, the most recent version available is XFree86-4.0. +This is a full and unrestricted version which comes with complete source +code. 4.0 is a highly experimental release, so many features that might +have worked in earlier versions, may now no longer work, or work differently. +Be aware that for OS/2, XFree86-4.0 is considered to be alpha software. + +If you want to join the XFree86 developer team, e.g. to add support for +certain hardware, please send a request to BOD@XFree86.org. Please +think about such a step carefully before, though, since much work is +involved. Please use the XFree86-4.0 source code as a test example how +to compile the system. The ability to manage that is a basic requirement +for becoming a developer. + + +<sect>Tools required +<p> + +I have tried to reduce the number of external tools, but when looking back +it seems I were not very successful. At least I managed to get everything +working with the native CMD.EXE shell only. However, there is still plenty +of software required. +Most of this software is available from <tt/hobbes.nmsu.edu/ or <tt/ftp.leo.org/ +via anonymous FTP. The following shopping list shows what you will need: + +<itemize> +<item>gcc EMX/gcc emx 0.9C patch4 or later (0.9d preferred!) +<item>gzip GNU zip/unzip +<item>tar GNU tar +<item>patch Larry Wall's patch utility (attention: incompatible tool with same name in OS/2) +<item>install BSD/GNU install +<item>rm,mv,cp GNU file utilities +<item>tee,.. GNU shell utilities +<item>groff GNU nroff/troff +<item>sed GNU sed stream editor +<item>grep GNU grep +<item>gawk GNU awk +<item>make GNU make 3.71/3.72 (use the one from Xprog.zip!) +<item>flex GNU flex +<item>bison GNU bison +<item>m4 GNU m4 +<item>find GNU find (attention: incompatible tool with the same name in OS/2) +</itemize> + +If there is no version number given, any new version will do. Particularly +critical is only EMX/gcc and GNU make. Note that the second GCC implementation +which might still be available from some archives is NOT compatible. + +Furthermore, you need the XFree86 sources. These are available from +the common XFree86 repositories. Look into a directory which is +often named /pub/XFree86/4.0/source. + +<sect>Compiling and Installing +<p> + +You need about 300MB of free HPFS space for the whole system. This does not +include space for the postscript and troff documentation files. I have never +installed them. Nor did I install the test subtree. + +<enum> +<item>Install all the above utilities. Refer to the corresponding documentation. + Verify that everything works well, particularly EMX. +<item>It is a good idea to use the same or a similar structure I have. + I have made a directory <tt>\x11</tt> on the partition for compiling and have + put everything below this tree. I found that a clean tree occupies + less than the half space of the disk, this gives me the opportunity to + rename this tree to <tt>\x11old</tt> and copy a new version to the + same disk to produce diffs. Last time the complete tree was + arranged under the root directory <tt>xc</tt>, this would become + <tt>\x11\xc</tt> then. +<item>To unpack the files you would usually execute the command + <verb>gzip -dc file.tar.gz | tar xvf -</verb> + in the <tt>\x11</tt> directory. At the end you will usually see the + irritating, but non-fatal message "gzip: stdout Broken pipe". Ignore it. +<item>After that, is is likely necessary to apply some patches, either from + the XConsortium or from the XFree86 project. Before you do this, enter + <verb> + chmod -R a+rw \x11\xc + </verb> + to make certain files in the tree writable. +<item>There should be a file <tt>added-XXX</tt> accompanying the patch file + which lists the files that are newly created. The patch program has + a problem with creating new directories, so we need to create them + on advance. For each <tt/added-XXX/ file you find, execute from + <tt>\x11</tt> <verb>xc\config\util\added added-XXX</verb> + If there is no <tt>added-XXX</tt> file available, you can make one with + the following instructions: + <verb> + grep "\*\*\* xc/" patchfile >added-file + </verb> + Edit <tt/added-file/ with a text editor and remove the <tt/*** / at + the beginning and the time stamp at the end (search for a TAB and + erase to the end of the line). You get a list of file paths, one in a + line, which is the input to the added utility. +<item>After that you can apply the patches in the right order. Usually this + is done by a command + <verb> + patch -p -E <patchfile 2>&1 | tee patchlog + </verb> + from the <tt>\x11</tt> directory. Be aware to use the right + patch - OS/2 has a utility with the same name and different functionality. + Don't use the recommended <tt/-s/ option, this makes <tt/patch/ quiet, + and you won't see problems in the patchlog file. Use + <verb> + find \x11 -name *.rej -print + find \x11 -name *# -print + </verb> + to find any rejects and unapplied patches (attention: yet another OS/2 + program with wrong functionality). Normally there shouldn't + be any problems of this kind, else you have made a mistake. Finally + remove the original files with + <verb> + find \x11 -name *.orig -print -exec rm {} ; + </verb> +<item>Go to the <tt>xc/config/cf</tt> directory and edit the <tt>xf86site.def</tt> + file to match your requirements (you probably don't want to compile + all X servers). Certain changes must be set to the following values: + <itemize> + <item>Disable if not already done any PC98 server; PC98 (Japanese XFree86) + does not work yet. Porters from Japan are welcome! + <item><tt>#define WacomSupport NO + #define ElographicsSupport NO</tt> + Both options are not yet supported. + <item>Tcl* and Tk* don't need to be set explicitly. Reasonable defaults + are in the other config files, provided you have a complete + XFree86/OS2 binary tree with the tcl/tk runtime support installed. + <item><tt>#define BuildDynamicLoading NO</tt> + This does not work. + </itemize> +<item>Go to the directory <tt>xc\util\compress</tt> and + <tt>make compress.exe</tt> there. Install the program produced + there in your path. I stumbled more than once on half-ported + compress programs on OS/2 ftp servers that are defective w.r.t. + reading and writing stdin/stdout. In some stage (font compression) + otherwise you will get a core dump of mkfontdir, because all + compressed fonts are corrupt. +<item>Set the environment variable <tt/X11ROOT/ to something different than + it is; otherwise the installation process will overwrite your + original XFree86/OS2 installation. If you have not set this variable, + go back to the prefix section of this document: you have forgotten + something. +<item>Copy the file <tt>xc/programs/Xserver/hw/xfree86/etc/bindist/OS2/host.def.os2</tt> + to the location <tt>xc/config/cf/host.def</tt>. Use this file to do + any specific modifications to imake variables, rather than editing + the file xfree86.cf, imake.tmpl, or os2.cf directly. +<item>Copy the file <tt>xc/config/util/buildos2.cmd</tt> into the <tt/xc/ + directory. If this is a second or later attempt, you might need to + copy the saved toplevel Makefile.os2 back to Makefile. +<item>Execute this <tt/buildos2.cmd/ command in the <tt/xc/ directory; + it will produce a logfile <tt>buildxc.log</tt> in this directory. +<item>Go have a bucket of coffee, or better, buy new coffee - in Colombia! + The compile will need between 2 and 20 hours, depending on your + selections, and the horse power of your hardware. +<item>When finished, view the logfile for errors, and fix the problems if + there are some. I have managed to compile the whole system + flawlessly, so there is at least one configuration that works. +<item>Finally, from the <tt/xc/ dir, execute + <verb> + xmake install + xmake install.man + </verb> +<item>There are a few minor glitches in the installation: +<enum> +<item>The xdm and linkkit directories will fail in compile and installation. + This is no problem and has no effect on the rest of the system. +<item>The imake.exe which is installed in <tt/\XFree86\bin/ is usually defective. + The one which was built initially and installed in the root directory + of the drive where you have the source tree is okay. So simply copy + this <tt/\imake.exe/ to the <tt/\XFree86\bin/ directory + manually. Some day this might be fixed. +<item><tt/XF86Setup/ is not ported yet and won't work with the tcl/tk port + available for XFree86/OS2. My idea was to replace this by some native + installation tool, which I didn't find the time to do yet. Feel free + to spend a bit of time to play with XF86Setup if you like. +</enum> +</enum> + +Well, you see, this was quite easy :-) + + + + +<verb> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2Notes.sgml,v 1.1 2001/06/04 13:50:15 dawes Exp $ + + + + + +$XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $ +</verb> + +</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml:3.7 xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml:removed --- xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml:3.7 Wed Apr 5 14:13:46 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml Fri Jan 18 15:25:15 2002 @@ -1,214 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> -<article> - -<title>Notes on Rebuilding XFree86/OS2 from Scratch -<author>Holger Veit -<date>Last modified March 8th, 2000 - -<toc> - -<sect>Preface -<p> -X11 and XFree86 were initially developed on Unix-based systems. Usually -Unix systems provide a rich number of tools and utilities to get certain -things done. Under OS/2, these tools are not installed, but ports are -available which are sometimes functionally equivalent to Unix utilities -with the same name, but also differ sometimes in a subtle way. -This guide will give you hints if you intend to rebuild the system -from scratch under OS/2. -<p> -Please also read <htmlurl name=README.OS2 url=OS2.html> for end-user -information, and set at least the environment variables described there. -<p> -At the current time, the most recent version available is XFree86-4.0. -This is a full and unrestricted version which comes with complete source -code. 4.0 is a highly experimental release, so many features that might -have worked in earlier versions, may now no longer work, or work differently. -Be aware that for OS/2, XFree86-4.0 is considered to be alpha software. - -If you want to join the XFree86 developer team, e.g. to add support for -certain hardware, please send a request to BOD@XFree86.org. Please -think about such a step carefully before, though, since much work is -involved. Please use the XFree86-4.0 source code as a test example how -to compile the system. The ability to manage that is a basic requirement -for becoming a developer. - - -<sect>Tools required -<p> - -I have tried to reduce the number of external tools, but when looking back -it seems I were not very successful. At least I managed to get everything -working with the native CMD.EXE shell only. However, there is still plenty -of software required. -Most of this software is available from <tt/hobbes.nmsu.edu/ or <tt/ftp.leo.org/ -via anonymous FTP. The following shopping list shows what you will need: - -<itemize> -<item>gcc EMX/gcc emx 0.9C patch4 or later (0.9d preferred!) -<item>gzip GNU zip/unzip -<item>tar GNU tar -<item>patch Larry Wall's patch utility (attention: incompatible tool with same name in OS/2) -<item>install BSD/GNU install -<item>rm,mv,cp GNU file utilities -<item>tee,.. GNU shell utilities -<item>groff GNU nroff/troff -<item>sed GNU sed stream editor -<item>grep GNU grep -<item>gawk GNU awk -<item>make GNU make 3.71/3.72 (use the one from Xprog.zip!) -<item>flex GNU flex -<item>bison GNU bison -<item>m4 GNU m4 -<item>find GNU find (attention: incompatible tool with the same name in OS/2) -</itemize> - -If there is no version number given, any new version will do. Particularly -critical is only EMX/gcc and GNU make. Note that the second GCC implementation -which might still be available from some archives is NOT compatible. - -Furthermore, you need the XFree86 sources. These are available from -the common XFree86 repositories. Look into a directory which is -often named /pub/XFree86/4.0/source. - -<sect>Compiling and Installing -<p> - -You need about 300MB of free HPFS space for the whole system. This does not -include space for the postscript and troff documentation files. I have never -installed them. Nor did I install the test subtree. - -<enum> -<item>Install all the above utilities. Refer to the corresponding documentation. - Verify that everything works well, particularly EMX. -<item>It is a good idea to use the same or a similar structure I have. - I have made a directory <tt>\x11</tt> on the partition for compiling and have - put everything below this tree. I found that a clean tree occupies - less than the half space of the disk, this gives me the opportunity to - rename this tree to <tt>\x11old</tt> and copy a new version to the - same disk to produce diffs. Last time the complete tree was - arranged under the root directory <tt>xc</tt>, this would become - <tt>\x11\xc</tt> then. -<item>To unpack the files you would usually execute the command - <verb>gzip -dc file.tar.gz | tar xvf -</verb> - in the <tt>\x11</tt> directory. At the end you will usually see the - irritating, but non-fatal message "gzip: stdout Broken pipe". Ignore it. -<item>After that, is is likely necessary to apply some patches, either from - the XConsortium or from the XFree86 project. Before you do this, enter - <verb> - chmod -R a+rw \x11\xc - </verb> - to make certain files in the tree writable. -<item>There should be a file <tt>added-XXX</tt> accompanying the patch file - which lists the files that are newly created. The patch program has - a problem with creating new directories, so we need to create them - on advance. For each <tt/added-XXX/ file you find, execute from - <tt>\x11</tt> <verb>xc\config\util\added added-XXX</verb> - If there is no <tt>added-XXX</tt> file available, you can make one with - the following instructions: - <verb> - grep "\*\*\* xc/" patchfile >added-file - </verb> - Edit <tt/added-file/ with a text editor and remove the <tt/*** / at - the beginning and the time stamp at the end (search for a TAB and - erase to the end of the line). You get a list of file paths, one in a - line, which is the input to the added utility. -<item>After that you can apply the patches in the right order. Usually this - is done by a command - <verb> - patch -p -E <patchfile 2>&1 | tee patchlog - </verb> - from the <tt>\x11</tt> directory. Be aware to use the right - patch - OS/2 has a utility with the same name and different functionality. - Don't use the recommended <tt/-s/ option, this makes <tt/patch/ quiet, - and you won't see problems in the patchlog file. Use - <verb> - find \x11 -name *.rej -print - find \x11 -name *# -print - </verb> - to find any rejects and unapplied patches (attention: yet another OS/2 - program with wrong functionality). Normally there shouldn't - be any problems of this kind, else you have made a mistake. Finally - remove the original files with - <verb> - find \x11 -name *.orig -print -exec rm {} ; - </verb> -<item>Go to the <tt>xc/config/cf</tt> directory and edit the <tt>xf86site.def</tt> - file to match your requirements (you probably don't want to compile - all X servers). Certain changes must be set to the following values: - <itemize> - <item>Disable if not already done any PC98 server; PC98 (Japanese XFree86) - does not work yet. Porters from Japan are welcome! - <item><tt>#define WacomSupport NO - #define ElographicsSupport NO</tt> - Both options are not yet supported. - <item>Tcl* and Tk* don't need to be set explicitly. Reasonable defaults - are in the other config files, provided you have a complete - XFree86/OS2 binary tree with the tcl/tk runtime support installed. - <item><tt>#define BuildDynamicLoading NO</tt> - This does not work. - </itemize> -<item>Go to the directory <tt>xc\util\compress</tt> and - <tt>make compress.exe</tt> there. Install the program produced - there in your path. I stumbled more than once on half-ported - compress programs on OS/2 ftp servers that are defective w.r.t. - reading and writing stdin/stdout. In some stage (font compression) - otherwise you will get a core dump of mkfontdir, because all - compressed fonts are corrupt. -<item>Set the environment variable <tt/X11ROOT/ to something different than - it is; otherwise the installation process will overwrite your - original XFree86/OS2 installation. If you have not set this variable, - go back to the prefix section of this document: you have forgotten - something. -<item>Copy the file <tt>xc/programs/Xserver/hw/xfree86/etc/bindist/OS2/host.def.os2</tt> - to the location <tt>xc/config/cf/host.def</tt>. Use this file to do - any specific modifications to imake variables, rather than editing - the file xfree86.cf, imake.tmpl, or os2.cf directly. -<item>Copy the file <tt>xc/config/util/buildos2.cmd</tt> into the <tt/xc/ - directory. If this is a second or later attempt, you might need to - copy the saved toplevel Makefile.os2 back to Makefile. -<item>Execute this <tt/buildos2.cmd/ command in the <tt/xc/ directory; - it will produce a logfile <tt>buildxc.log</tt> in this directory. -<item>Go have a bucket of coffee, or better, buy new coffee - in Colombia! - The compile will need between 2 and 20 hours, depending on your - selections, and the horse power of your hardware. -<item>When finished, view the logfile for errors, and fix the problems if - there are some. I have managed to compile the whole system - flawlessly, so there is at least one configuration that works. -<item>Finally, from the <tt/xc/ dir, execute - <verb> - xmake install - xmake install.man - </verb> -<item>There are a few minor glitches in the installation: -<enum> -<item>The xdm and linkkit directories will fail in compile and installation. - This is no problem and has no effect on the rest of the system. -<item>The imake.exe which is installed in <tt/\XFree86\bin/ is usually defective. - The one which was built initially and installed in the root directory - of the drive where you have the source tree is okay. So simply copy - this <tt/\imake.exe/ to the <tt/\XFree86\bin/ directory - manually. Some day this might be fixed. -<item><tt/XF86Setup/ is not ported yet and won't work with the tcl/tk port - available for XFree86/OS2. My idea was to replace this by some native - installation tool, which I didn't find the time to do yet. Feel free - to spend a bit of time to play with XF86Setup if you like. -</enum> -</enum> - -Well, you see, this was quite easy :-) - - - - -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml,v 3.7 2000/04/05 18:13:46 dawes Exp $ - - - - - -$XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $ -</verb> - -</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.17 xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.24 --- xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.17 Thu Apr 5 15:29:43 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml Wed Jan 16 17:35:17 2002 @@ -6,10 +6,10 @@ <title>README for XFree86 &relvers; on OpenBSD <author> Matthieu Herrb -<Date>Last modified on: 3 March 2000 +<Date>Last modified on: 16 January 2002 <ident> -$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/sgml/OpenBSD.sgml,v 1.24 2002/01/16 22:35:17 herrb Exp $ </ident> <toc> @@ -18,7 +18,7 @@ <sect>What and Where is XFree86? <p> -XFree86 is the Open Source port of X.Org's X11R6.4 release that supports +XFree86 is the Open Source port of X.Org's X11R6.6 release that supports several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operating systems on Intel and other platforms. @@ -29,7 +29,7 @@ <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;" url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;"> -Binaries for OpenBSD/i386 2.8 and later are available from: +Binaries for OpenBSD/i386 3.0 and later are available from: <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/binaries/OpenBSD" url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/binaries/OpenBSD"> @@ -56,6 +56,14 @@ 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.2 +<p> +<itemize> +<item>Support for OpenBSD/macppc on the ATI Rage128 based +Power Macintosh. +<item>Support for building clients on OpenBSD/sparc64. +</itemize> + <sect1>New OS dependent features in 4.0.3 <p> <itemize> @@ -67,7 +75,7 @@ <p> <itemize> <item>Support for the OpenBSD ports tree, -<item>Preliminary support for the powerpc architecture (clients build +<item>Preliminary support for the macppc architecture (clients build and work, the server doesn't work yet), <item>xdm now writes an utmp entry, <item>startx now creates an Xauthority magic cookie for the display. @@ -150,18 +158,11 @@ <p> XFree86 &relvers; has support for the mouse driver included in -the new <bf/wscons/ console driver introduced by OpenBSD-current after -2.8. Specify ``<tt/wsmouse/'' as the protocol and +the new <bf/wscons/ console driver introduced by OpenBSD-2.9. +Specify ``<tt/wsmouse/'' as the protocol and ``<tt>/dev/wsmouse0</tt>'' as the device in <tt>/etc/X11/XF86Config</tt> -if you're using OpenBSD-current with a PS/2 mouse. +if you're using OpenBSD-2.9 or later with a PS/2 or USB mouse. <p> -The OpenBSD pms driver provides both ``raw'' and ``cooked'' -(translated) modes. ``raw'' mode does not do protocol translation, so -XFree86 would use the <bf>PS/2</bf> protocol for talking to the device -in that mode. ``Cooked'' mode is the old BusMouse translation. -The driver runs in ``raw'' mode when using the <tt>/dev/psm0</tt> -device name. -<p> See <htmlurl url="mouse.html" name="README.mouse"> for general instruction on mouse configuration in XFree86. @@ -216,8 +217,8 @@ <sect1>Console drivers <p> -The server supports the two standard OpenBSD/i386 -console drivers: pcvt and pccons. They are detected at runtime and no +The server supports the standard OpenBSD/i386 +console drivers: pcvt and wscons. They are detected at runtime and no configuration of the server itself is required. <p> @@ -225,15 +226,15 @@ It offers several virtual consoles and international keyboard support. <p> -OpenBSD-current after 2.8 has switched to the wscons console +OpenBSD 2.9 and later has switched to the wscons console driver. This console driver has a pcvt compatibility mode for X support. <sect1>Aperture Driver <p> By default OpenBSD includes the BSD 4.4 kernel security -feature that disable access to the <tt>/dev/mem</tt> device when in -multi-users mode. But the XFree86 server require +feature that disables access to the <tt>/dev/mem</tt> device when in +multi-user mode. But the XFree86 server requires linear access to the display memory in most cases. OpenBSD now requires the aperture driver to be enabled for all X @@ -242,68 +243,24 @@ <p> To enable the aperture driver, once included in the kernel, set <tscreen><verb> -machdep.allowaperture=1 +machdep.allowaperture=2 </verb></tscreen> -in <tt>/etc/sysctl.conf</tt>. - -Some drivers need a patch to the aperture driver in the kernel to work -correctly with int10 support. If you get warning from xf86ReadBIOS -like this one: -<tscreen><verb> -(II) checkDevMem: using aperture driver /dev/xf86 -(WW) xf86ReadBIOS: /dev/mem mmap[s=600,a=0,o=0] failed (Invalid argument) -</verb></tscreen> -you should patch your kernel and rebuild it. Until it's integrated in -OpenBSD-current, or a better fix is found, the patch is available at -<htmlurl -name="ftp://ftp.laas.fr/pub/ii/matthieu/OpenBSD/patch-kernel-xf4" -url="ftp://ftp.laas.fr/pub/ii/matthieu/OpenBSD/patch-kernel-xf4">. - -I've also included it below, if you want to edit the source file by -hand. - -<tscreen><verb> -Index: sys/arch/i386/i386/mem.c -=================================================================== -RCS file: /cvs/src/sys/arch/i386/i386/mem.c,v -retrieving revision 1.14 -diff -u -r1.14 mem.c ---- sys/arch/i386/i386/mem.c 1999/11/20 11:11:28 1.14 -+++ sys/arch/i386/i386/mem.c 2000/11/13 10:54:22 -@@ -269,8 +269,8 @@ - /* minor device 4 is aperture driver */ - case 4: - if (allowaperture && -- (((off >= VGA_START && off <= BIOS_END) || -- (unsigned)off > (unsigned)ctob(physmem)))) -+ (off <= BIOS_END || -+ (unsigned)off > (unsigned)ctob(physmem))) - return i386_btop(off); - else - return -1; -</verb></tscreen> - -<p>In post 2.8 OpenBSD-current, a modified version of this patch has -been integrated. You should set -<tscreen><verb>machdep.allowaperture=2</verb></tscreen> -in <tt>/etc/sysctl.conf</tt> in order to achieve this. See the xf86(4) +in <tt>/etc/sysctl.conf</tt>. See the +<htmlurl name="xf86(4)" url="http://www.openbsd.org/cgi-bin/man.cgi?query=xf86&apropos=0&sektion=4&manpath=OpenBSD+Current&arch=i386&format=html"> manual page for details. <p> Another (less recommended) way to enable linear memory and I/O ports -access is to disable the kernel security feature by adding ``option -INSECURE'' in your kernel configuration file and build a new kernel. -You will also need to comment out the line -initializing <tt/securelevel/ to 1 in <tt>/etc/rc.securelevel</tt>. +access is to disable the kernel security feature by +initializing <tt/securelevel/ to -1 in <tt>/etc/rc.securelevel</tt>. <p> <quote> <bf/Caveat:/ the aperture driver only allows one access at a time (so that the system is in the same security state once X is -launched). This means that if you run multiple servers on multiples -VT, only the first one will have linear memory access. Use 'option -INSECURE' if you need more that one X server at a time. +launched). This means that if you run multiple servers on multiple +virtual terminals, only the first one will have linear memory access. +Set <tt/securelevel/ to -1 if you need more that one X server at a time. </quote> - <sect1>MIT-SHM <p> OpenBSD supports System V shared memory. If XFree86 @@ -324,13 +281,6 @@ <sect> Rebuilding the XFree86 Distribution -<p> -The server developer's kit allow you to rebuild just the X server with a -minimum amount of disk space. Just unpack it, make the appropriate -changes to the <tt/xf86site.def/, type ``<tt>./mkmf</tt>'' and -``<tt/make/'' to link the server. See <tt>/usr/X11R6/lib/Server/README</tt> -for more info. - You should configure the distribution by editing <tt>xc/config/cf/host.def</tt> before compiling. To compile the sources, invoke ``<tt/make World/'' in the xc directory. @@ -354,14 +304,13 @@ pccons and pcvt drivers will be supported by default. <p> -Experimental native support for the wscons console driver found on -OpenBSD/powerpc and on OpenBSD/i386 -current can be built +Native support for the wscons console driver found on +OpenBSD/macppc and on OpenBSD/i386 2.9 and later is built by adding: <tscreen><verb> #define XFree86ConsoleDefines -DWSCONS_SUPPORT </verb></tscreen> to <tt>xc/config/host.def</tt> before rebuilding the server. -This has not been thoroughly tested, except on the macppc. For the i386, you should include both pcvt and wscons support in order to use the pcvt compatibility mode of wscons: @@ -373,17 +322,42 @@ <sect1>Building on other architectures<label id="otherarch"> <p> -XFree86 should also compiles on other OpenBSD architectures. However, -please note that 3.9.x snapshots have only been tested on the i386 for -now. +XFree86 also compiles on other OpenBSD architectures. <p> -Note that OpenBSD project has now its own source tree, based on +Note that OpenBSD project now has its own source tree, based on the XFree86 source tree, with some local modifications. You may want -to start with this tree to rebuild from sources. The OpenBSD X11 +to start with this tree to rebuild from sources. The OpenBSD XF4 source tree is available by anoncvs from all OpenBSD anoncvs servers. See <htmlurl url="http://www.openbsd.org/anoncvs.html" name="http://www.openbsd.org/anoncvs.html"> for details on anoncvs. + +<sect2>XFree86 on OpenBSD/macppc +<p> +The XFree86 server is currently known to work on the G4 Macs and new +iBooks with ATI Rage 128 cards running OpenBSD 3.0 or later. +Other machines are more or less untested. Earlier OpenBSD versions +lack some kernel support for it. +<p> +Use xf86config to build a /etc/X11/XF86Config file before starting +the server for the first time. +<p> +Tou configure the keyboard, the protocol should be specified as +<bf/wskbd/ and the device as <tt>/dev/wskbd0</tt>. +Using a wsmux device as the keyboard device doesn't work (yet). Use +<bf/macintosh/ as XkbModel. +<p> +For the Titanium Powerbook G4, you can try the following mode line in +<tt>/etc/X11/XF86Config</tt> to match the flat panel resolution: + +<tscreen><verb> +Modeline "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +HSync +VSync +</verb></tscreen> +<p> +You need to set <tt/securelevel/ to -1 in the +<tt>/etc/rc.securelevel</tt> +configuration file to run XFree86 on OpenBSD/macppc. + <sect>Building New X Clients Index: xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml:3.7 xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml:removed --- xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml:3.7 Mon Aug 23 02:38:51 1999 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml Fri Jan 18 15:25:15 2002 @@ -1,677 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> - -<article> - -<title>Quick-Start Guide to XFree86 Setup - -<author>Joe Moss -<date>27 February 1998 - -<abstract> - Current releases of XFree86 include several tools that can help -to automate the process of server configuration. Much of the existing -documentation, however, describes how to do the job manually, including -many technical details. - - For those users with esoteric hardware or with the desire to -get their hands dirty under the hood, this is great, but many users are -using common hardware and just want to get X up and running quickly. -This guide is for them. - -</abstract> - -<toc> - -<sect> Before You Start -<p> - There are a few bits of information that you will need to have - before you can setup the server: - <descrip> - <tag> The model name of your video card </tag> - Make sure you know the exact model name of the card. It - may help to also know the graphics chipset, RAMDAC, and - clock chip used on your card. - <tag> The amount of memory on your video card </tag> - Find out how many megabytes of RAM are on your video card. - <tag> Whether or not your card is VGA compatible </tag> - Most cards these days are VGA compatible, but for example, - if you have and older monochrome card, it might not be. - <tag> Your monitor's specifications </tag> - Specifically, you need to know the horizontal sync rate(s), - and vertical refresh rate(s). These are <bf>important</bf>! - Consult your monitor's manual. - <tag> The protocol used by your mouse </tag> - It will help speed up the process, if you know which protocol - is used by your mouse to communicate. Some mice are capable - of using two different protocols, although the method of - switching between them varies. In some cases, with new - Plug-n-Play mice, the protocol can be determined - automatically. - </descrip> - -<sect> What to Do - An Overview -<p> - There are three tools that can be used to set up XFree86: - <itemize> - <item>XF86Setup - <item>xf86config - <item>xvidtune - </itemize> -<p> - XF86Setup primarily uses a graphical user interface and - is the preferred tool for initial setup, but there - are a few cases where it can't be used. If you are using a - card that is not VGA compatible, have a fixed-frequency - monitor, or are running OS/2, you'll not be able to use - XF86Setup, read about xf86config instead. - If you have limited RAM or a slow system, you might be better - off using xf86config as well. -<p> - The xf86config program is text based only, but works for almost - any hardware combination. If you have a fixed frequency - monitor that won't work with standard text modes, you - will have to read the necessary documentation and - do the configuration manually. -<p> - To get things looking just right, you may need to use - <tt>xvidtune</tt>, a program that allows you to make adjustments - to the displayed image (e.g. make it wider, move it a little - to the left, etc.). XF86Setup will allow you to run xvidtune - at the appropriate time; if you use xf86config, you can use - xvidtune afterwards. -<p> - All of these are explained in detail in the following - sections. If you're the type that doesn't like to read - the documentation, but would rather just try and figure - your way through things, you can just type <tt/XF86Setup/ - now. - If you have problems, the documentation will still be here. -<p> - Although it is possible to use XF86Setup from within X to - make changes to your existing configuration, such use is - not specifically documented here. These instructions are - primarily for those initially setting up XFree86 on their - system. - -<sect> Using <tt>XF86Setup</tt> -<p> - XF86Setup will first check around to make sure certain files - are installed and that you are running as root. If a problem - is found, it will display a message and exit. Correct the - problem (e.g. install the missing files) and run it again. - - XF86Setup is internationalized. If you are Japanese and set - the LANG environment variable to ja, japan, japanese, etc., - XF86Setup's screen can be Japanized. But it is necessary that - XF86Setup is built with Japanized Tcl/Tk. Other language can - be added, if you prepare its own directory under the directory - XF86Setup/texts. Please see under the directory - XF86Setup/texts/generic. - -<sect1> Initial questions -<p> - If you have an existing XF86Config file, you will be asked if - you would like to use it to set the default values of various - configuration settings. If you've already got an (at least - somewhat) working configuration you will want to do this. - - If you are running on an OS which has a mouse driver in the - kernel (e.g. SCO or SVR4), you may be asked if you'd like to - use it. - - Once the questions (if any) are completed, you will see a message - indicating that the program is ready to switch into graphics mode. - Just press Enter. If you don't get a graphics screen saying - <it/Welcome to XFree86 Setup/ within a minute, something has - probably hung, you can try pressing Ctrl-Alt-Backspace to - switch back to text mode and you'll probably have to use - xf86config instead of XF86Setup. - -<sect1> Configuration areas -<p> - Once the VGA16 server is started, and once the program has - finished loading, you will see a screen with six - buttons along the top and three along the bottom. - The buttons along the top correspond to the general categories - of configuration settings. They can be done in any order. - Each of these areas is explained in detail below. - The bottom row consists of the <bf/Abort/, - <bf/Done/, and <bf/Help/ buttons. -<p> - <bf/Abort/ does as it name implies. It exits the program - without saving any changes that have been made. The one - possible exception is the link to the mouse device. Any - change to that is made as soon as <bf/Apply/ is selected. -<p> - <bf/Done/ should be selected when you've finished - configuration in each of the various categories. -<p> - The <bf/Help/ can be pressed at any time to get on-line - help regarding the current configuration screen. -<p> - You should start with configuring your mouse as it will make - things a lot easier to perform the configuration of other - categories. - -<sect2> Mouse -<p> - The mouse configuration screen is used to get the mouse working - properly. There are key bindings for everything so that you - can easily configure the mouse, if it's not already working. -<p> - The screen includes a representation of a white mouse with - three buttons. As you move your mouse it should show the - pointer coordinates on the mouse and the buttons should turn - black as you press the corresponding button on your mouse. - If that is not happening, then your mouse is not correctly - configured. -<p> - Along the top are some rows of buttons corresponding to - the various possible protocols. There will also be - several buttons and a couple of sliders - for other settings, a visual representation of the mouse, - and a button to apply any changes. - There may also be an entry box in which the - device can be set along with a list of possible devices. -<p> - First try moving your mouse around and see if the pointer moves - correctly. If so, try testing that the buttons are working - properly. If those are working as desired, go ahead and go on - to another configuration area. -<p> - If the mouse pointer doesn't move at all, you need to fix - either the mouse device or the protocol (or both). - You can press 'n' followed by a Tab, to move to the list - of mouse devices and select a different one. - Pressing 'p' will pick the next available protocol on the list - (protocols that are not available on your OS will be - greyed-out). If you have a PnP mouse, it may be easiest to - just select "Auto" as the protocol. - After changing these, press 'a' to apply the changes and try - again. Repeat the process until you are getting some response - from your mouse. -<p> - If the mouse pointer or button indicators do something when you - move the mouse, but the pointer is not moving properly, you - probably have the wrong protocol selected. Try with a different - one. -<p> - Most mice these days use the <bf/Microsoft/ protocol, the second - most common is <bf/MouseSystems/. Some mice do both. - These <it/dual-protocol/ mice have various methods of switching - between the two protocols. - Some have a switch on the mouse itself. - Some are switched by sending a certain signal to the mouse - when opening a connection to the mouse. - These signals can be controlled by using different - combinations of the 'ClearDTR' and 'ClearRTS' settings. - Other mice require a button to be depressed when the mouse - is opened (when the mouse driver first tries to talk to it). - If your mouse uses this method, hold down the appropriate - button while selecting apply (pressing 'a'). -<p> - Once the mouse pointer is moving correctly, test that all - three buttons are working properly. If your mouse only has - two buttons, select 'Emulate3Buttons' and you should be able - to press both buttons simultaneously to emulate the missing - middle button. If not all of the buttons are working, try - changing the 'ChordMiddle' setting or you may be using a - protocol that is similar to that of your mouse, - but not quite right. - -<sect2> Keyboard -<p> - You need to specify the model and layout of your keyboard (and - press apply) if they are not already correct. - The graphical representation of the keyboard will be - updated when you choose a different model. -<p> - For non-U.S. keyboards you may wish to choose a variant from - the list (at this time there is only one available variant: - <tt/nodeadkeys/>). -<p> - You can also pick from the options to the right, if you wish. - -<sect2> Card -<p> - Pick your card from the list. -<p> - If there are README files that may pertain to your card - the 'Read README file' button will then be usable (i.e. not - greyed out). - Please read them. -<p> - If your card is not in the list, or if there are any - special settings listed in the README file as required - by your card, you can press the 'Detailed Setup' - button to make sure that the required settings are selected. - Otherwise, you're finished with configuring your card. -<p> - To use 'Detailed Setup': - First select the appropriate server for your card. - Then read the README file corresponding to the selected - server by pressing the 'Read README file' button - (it won't do anything, if there is no README). -<p> - Next, pick the chipset, and Ramdac of your card, if - directed by the README file. - In most cases, you don't need to select these, - as the server will detect (probe) them automatically. -<p> - The clockchip should generally be picked, if your card - has one, as these are often impossible to probe - (the exception is when the clockchip is built - into one of the other chips). -<p> - Choose whatever options are appropriate (again, - according to the README). -<p> - You can also set the maximum speed of your Ramdac. - Some Ramdacs are available with various speed ratings. - The max speed cannot be detected by the server - so it will use the speed rating of the slowest version - of the specified Ramdac, if you don't specify one. -<p> - Additionally, you can also specify the amount of RAM on your - card, though the server will usually be able to detect this. - - -<sect2> Modeselect -<p> - Use this one to pick which depth you prefer to use (this - determines how many colors can be displayed at a time) - and to select all of the modes you are interested in - possibly using. -<p> - Your hardware may not be able to support all - of depth and mode combinations that can be selected. - Any unsupported combinations will automatically be - rejected by the server when it tries to startup. - Note also that if you select multiple modes, you will - get a virtual screen as large as the largest of the - usable modes. - -<sect2> Monitor -<p> - Enter the horizontal and vertical frequency ranges that your - monitor supports in the corresponding entry boxes near the - top of the screen. - You can enter specific frequencies or ranges of frequencies - (separated by hyphens). - If the monitor supports several different frequencies or - ranges, list them all, separated by commas. -<p> - If you can not find this information in you monitor's manual, - pick one of the choices from the list of common monitor - capabilities. The program will use conservative values - for each of these, so you'll get better performance if you - type in the correct values from your monitor manual. - -<sect2> Other -<p> - You can probably just skip this one. - -<sect2> Completing the configuration -<p> - Once you've finished with the above, press the 'Done' button - and then the 'Okay' button which will appear. You will then - be switched back to text mode. - -<sect1> Back to text mode -<p> - The program will now attempt to start the appropriate server - for your card, with all of the - configuration settings you selected. - If for some reason it is unable to start the server, you have - likely selected an improper setting and will be asked if you - would like to return to the graphical configuration screen - and try again. - -<sect1> The second server -<p> - This is unlikely to happen, but - if when the server starts, the display is unreadable, try - pressing Ctrl-Alt-+ (using the plus on the numeric keypad) - to switch to a different video mode. -<p> - The display will show an entry box and three buttons. -<p> - The first button allows you to run xvidtune to adjust your - video modes. One important point to keep in mind when using - xvidtune is that switching video modes with Ctrl-Alt-+ is - disabled while xvidtune is running. - You must use the 'Next' and 'Prev' buttons to switch modes. - Because of this, you should be careful not to move the mouse - when pressing either of these. If by some chance the mode - you switch to doesn't produce a readable display on your - monitor, you can then just press the mouse button again to - move to the next (hopefully readable) mode. -<p> - The second button causes the settings you've made to be - written to the filename given in the entry box. - After saving the settings a message will appear indicating - that it has finished. Just press the 'Okay' button and - you're done. -<p> - And the third button causes the program to exit without - saving any of the configuration settings. - -<sect1> Ending text -<p> - You are returned to text mode and the program will print a - `Configuration complete.' message. You should now have a - usable configuration file and can start the X server by - whichever method you wish (usually either the 'startx' - command or via 'xdm'). - -<sect> Running <tt>xf86config</tt> -<p> - From a text screen, run the <tt/xf86config/ program. This - program should be run as <it/root/ (although not absolutely - necessary, it will allow xf86config to do more of the work - for you). You can press your interrupt character (usually - Control-C or perhaps Delete), at any time to stop the program, - if you need to. You can just start it over again. - - The <tt/xf86config/ program provides instructions on screen - as to what you need to do. Following are some notes that - document the various stages in the process. They should help - you get through the process quickly and provide some - documentation for those people who like to know what they're - getting themselves into, before running a program. - -<sect1> The intro screen -<p> - First, <tt/xf86config/ begins by telling you a few things like - the fact that it can help you setup an XF86Config file or that - you can do the job yourself with an editor. Just read what - it says and press <sf/Enter/ when done. - -<sect1> Getting your <tt>PATH</tt> right -<p> - The program will next check that you have the directory - <tt>/usr/X11R6</tt> (the standard installation directory) - on your system and tell you that it needs to be in your - <tt/PATH/ environment variable. - - It will also check if you have the - <tt>/usr/X386</tt> directory as used by older (pre 3.0) - versions of XFree86. If by chance you do, it will warn you - that <tt>/usr/X11R6</tt> must be before <tt>/usr/X386</tt> - in your <tt/PATH/. - - If everything is okay, just press Enter and go on, otherwise - press Control-C to exit and make any necessary changes and - restart <tt/xf86config/. - -<sect1> Mouse setup -<p> - Pick the mouse type from the menu and enter the name of the - device to which mouse is connected, as directed. - - If you are using an OS (e.g. SVR4, SCO) that has a built in - mouse driver that the Xserver could use, you'll need to edit - the XF86Config file to setup your mouse, so just pick any - mouse from the list and press enter when asked for the device. - - If you don't know which protocol your mouse uses, you'll just - have to guess (the xf86config program will give you some hints - as to which might be most likely) and then see the - troubleshooting section if it doesn't work when you run the - server. - - The xf86config program has not been updated to allow you to - select the latest mouse protocols, so you may have to edit - the config file by hand after xf86config has finished. - -<sect1> Keyboard setup -<p> - Simply answer yes to the question regarding keyboard setup. - - If there is some reason you need to use the right-alt and - control keys for something else, you can enter no. - -<sect1> Monitor setup -<p> - Setting up a monitor consists of entering the specifications - of your monitor and a description of the model and manufacturer. - - You are first asked for the horizontal sync rate. It is - <bf/VERY/ important to enter the correct value(s) from the - manual. If one of the ranges given matches the rate of your - monitor, then pick it, otherwise pick <tt/custom/ and enter - the values from your manual. - - Next is the vertical refresh rate. Again, it is <bf/VERY/ - important that this parameter be specified correctly. - Enter it in a manner similar to the horizontal sync rate. - - <it>If either rate is mis-specified, it can result in damage - to your monitor.</it> - - Finally, you are asked for an "identifier", your monitor - manufacturer, and model. You can just press enter to - get through these quickly. - -<sect1> Selecting your card -<p> - You are next asked if you would like to view the database of - cards. Picking your card from the list will cause the answers - to the questions in the next two sections to be filled in for - you and so can save a little time. - - If your card does not appear in the list, just press <tt/q/ - and enter to skip on to the next step - where you'll have to - answer the questions yourself. - -<sect1> Server selection -<p> - If you selected your card in the previous step, then server - selection is easy - just use the recommendation from the - database. - - If you have a card which uses one of the chipsets for which a - specific server exists (Mach8, Mach32, Mach64, AGX/XGA, - 8514/A, S3, I128, P9000) you'll want to pick the - <tt/accel/ option. - - Otherwise you'll probably want to use the SVGA server. - - Next, answer yes when the program asks if you want it to - set the symbolic link for you. If you picked the <tt/accel/ - option, you'll also need to indicate which particular - accelerated server to link to. - -<sect1> Screen/Video configuration -<p> - Pick the appropriate option from the list to indicate the - amount of memory on your video card. - - Then you are asked to provide and identifier, the manufacturer, - and the model of your card. You can just press enter to skip - through these, if you wish. - - Next, the program will ask for the type of RAMDAC and Clockchip - on your card. If your card was in the database, you should - just to tell it to use the values from the database. - - If you don't have one of the listed RAMDACs or Clockchips - on your card, just press enter when asked what type you have. - If you do not have a programmable clock chip, the program will - next attempt to probe to find out what clock rates are - supported by your clock chip. - -<sect1> Mode Selection -<p> - Now you get to tell the program which video modes you would - like to be able to run. - - The program will show you the common modes that should work - with your card (some might not work with your monitor, but - if you've correctly specified the monitor's sync rates, the - X server will just ignore them when it runs). - - You could just accept the settings as they are given, but - you'll probably wish to reverse the order. For example, if - you have a card with 1 Meg RAM, it will list the modes - <tscreen><verb> - "640x480" "800x600" "1024x768" for 8bpp - </verb></tscreen> - - Select <tt/1/ to change the settings for 8bpp and the type - <tt/432/ to select the reverse order. - - When you've select the modes, in the order you wish, select - option <tt/4/ to continue. - -<sect1> Creating the <tt>XF86Config</tt> file -<p> - The program will now ask if you would like to write the - configuration settings you've selected to the file - <tt/XF86Config/. Answer yes. - -<sect1> Some final notes -<p> - Lastly, the program tells you that it's finished its part - of this process and counsels you to check the file before - using it. The next section covers the changes that are most - likely to be needed. - -<sect> Fixing the XF86Config file -<p> - Use an editor to look at the <tt/XF86Config/ file. Here are - some things that may need to be changed: - <itemize> - <item>If you are running an operating system which has - built-in mouse support, you'll want to change the - <tt/Pointer/ section. Specifically, you should set - the <tt/Protocol/ to <tt/OSMouse/ (SCO) or <tt/Xqueue/ - (SVR4, some SVR3) and you should remove the <tt/Device/ - line. - <item>If you are running a system with the Xqueue event driver - and would like to use it, change the <tt/Protocol/ - setting in the <tt/Keyboard/ section to <tt/Xqueue/. -<!-- What else should be added here? --> - </itemize> - - Once you are satisfied that the configuration is correct, copy - the XF86Config file to <tt>/usr/X11R6/lib/X11</tt> and run - the 'startx' command. - - You should now have a running X server. If it's running but - the display doesn't look as good as you think it should (i.e. - it doesn't fill the whole screen, it's off-center, it's wrapping - around on one side, etc.) see the section on <tt/xvidtune/. - If there is some other problem, see the troubleshooting section. - -<sect> Running <tt>xvidtune</tt> -<p> - If you need to make adjustments to the video display, - <tt/xvidtune/ is the tool to use. - - Simply enter the command <tt/xvidtune/ from a shell prompt - within an xterm. Read the warning and click on <tt/OK/. - Next click on the <tt/Auto/ button. - - Now click on whatever combination of <tt>Up/Down/Left/Right</tt> - <tt>Shorter/Taller/Wider/Narrower</tt> is need to adjust - the display to your liking. - - If you are using a recent S3-based card there will be some - extra buttons and entries at the bottom (InvertVCLK, EarlySC, - and Blank Delays). These can help solve problems of the - display wrapping around a few pixels. - - Once the display has been adjusted properly, press the <tt/show/ - button to printout the correct <tt/ModeLine/ to put in the - <tt/XF86Config/ to make the server always use the current - display settings. To aid in copying this information to your - XF86Config file, the modeline is also made the current - selection allowing you to just paste it into your editor. - - If you would like to adjust your other modes, you can click - on the <tt/Next/ and <tt/Prev/ buttons to switch modes. - - When you are through using <tt/xvidtune/ simply press on the - <tt/Quit/ button. - -<sect> Troubleshooting -<p> - Since you're reading this, something must not have gone - the way you had hoped (or else you just really enjoy reading). - - Below are listed some common problems that may occur - during configuration and some hints for solving them. - However, there are just too many different combinations - of hardware and software configurations, and, well, just - too many things that can go wrong, for this document - and the tools it documents, to cover every case. - - If after trying the steps in the previous sections and - checking the hints in this section, you still are unable - to get your system working, you'll have to read the full - documentation. Read the README file for your card and - OS (if they exist), the XFree86 Configuration Guide - (README.Config), and the XF86Config man page. - - You should also look at - <url name="the XFree86 FAQ" url="http://www.XFree86.org/FAQ"> - for more up-to-date information, - especially if you are trying to configure a fairly new card. - - If all else fails, you can try posting a message to - comp.windows.x.i386unix or comp.os.linux.x or send email - to XFree86@XFree86.org. - -<sect1> The mouse doesn't move correctly, it stays in one area of the screen -<p> - You've selected the wrong protocol for your mouse. Try a - different one. - -<sect1> The server doesn't start, it says the mouse is busy. -<p> - Well, it's probably right. This most often happens on - Linux systems that have <tt/gpm/ running. Kill the <tt/gpm/ - process and try <tt/startx/ again. - -<sect1> The middle button doesn't work. -<p> - There's no easy answer to this one. It's a lot of trial - and error. You need to make sure you're running the right - protocol for your mouse. - - Many three button mice are "dual protocol" which means that - they have both a 2-button and 3-button mode. The way to get - the mouse to switch into 3-button mode (which usually then - uses MouseSystems protocol) varies between different models. - - You may need to slide a switch on the mouse or hold down the - middle button when starting the server. Other methods of - switching modes can be done by the server, you just have to - find the right combination of settings for your mouse. See - the Pointer section of the XF86Config man page for a complete - list of settings. - -<sect1> The display is shifted to the left/right/top/bottom -<p> - See the section on xvidtune. - -<sect1> I don't appear to have xf86config or xvidtune on my system -<p> - Hmmm. A couple of possibilities: - <enum> - <item>Your <tt/PATH/ is not set correctly. Make sure it includes - the bin directory for the XFree86 binaries (usually, - <tt>/usr/X11R6/bin</tt> - <item>You don't have a complete installation of XFree86. - Go back to wherever you got XFree86 and get the missing - pieces. - </enum> - -<!-- Lots of things still need to be added --> - -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml,v 3.7 1999/08/23 06:38:51 dawes Exp $ -</verb> - -</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/QuickStart.sgml diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/sgml/QuickStart.sgml:1.2 --- /dev/null Fri Jan 18 15:25:15 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/QuickStart.sgml Fri Aug 10 12:38:11 2001 @@ -0,0 +1,679 @@ +<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> + +<article> + +<title>Quick-Start Guide to XFree86 Setup + +<author>Joe Moss +<date>27 February 1998 + +<abstract> + Current releases of XFree86 include several tools that can help +to automate the process of server configuration. Much of the existing +documentation, however, describes how to do the job manually, including +many technical details. + + For those users with esoteric hardware or with the desire to +get their hands dirty under the hood, this is great, but many users are +using common hardware and just want to get X up and running quickly. +This guide is for them. + +</abstract> + +<toc> + +<sect> Before You Start +<p> + There are a few bits of information that you will need to have + before you can setup the server: + <descrip> + <tag> The model name of your video card </tag> + Make sure you know the exact model name of the card. It + may help to also know the graphics chipset, RAMDAC, and + clock chip used on your card. + <tag> The amount of memory on your video card </tag> + Find out how many megabytes of RAM are on your video card. + <tag> Whether or not your card is VGA compatible </tag> + Most cards these days are VGA compatible, but for example, + if you have and older monochrome card, it might not be. + <tag> Your monitor's specifications </tag> + Specifically, you need to know the horizontal sync rate(s), + and vertical refresh rate(s). These are <bf>important</bf>! + Consult your monitor's manual. + <tag> The protocol used by your mouse </tag> + It will help speed up the process, if you know which protocol + is used by your mouse to communicate. Some mice are capable + of using two different protocols, although the method of + switching between them varies. In some cases, with new + Plug-n-Play mice, the protocol can be determined + automatically. + </descrip> + +<sect> What to Do - An Overview +<p> + There are three tools that can be used to set up XFree86: + <itemize> + <item>XF86Setup + <item>xf86config + <item>xvidtune + </itemize> +<p> + XF86Setup primarily uses a graphical user interface and + is the preferred tool for initial setup, but there + are a few cases where it can't be used. If you are using a + card that is not VGA compatible, have a fixed-frequency + monitor, or are running OS/2, you'll not be able to use + XF86Setup, read about xf86config instead. + If you have limited RAM or a slow system, you might be better + off using xf86config as well. +<p> + The xf86config program is text based only, but works for almost + any hardware combination. If you have a fixed frequency + monitor that won't work with standard text modes, you + will have to read the necessary documentation and + do the configuration manually. +<p> + To get things looking just right, you may need to use + <tt>xvidtune</tt>, a program that allows you to make adjustments + to the displayed image (e.g. make it wider, move it a little + to the left, etc.). XF86Setup will allow you to run xvidtune + at the appropriate time; if you use xf86config, you can use + xvidtune afterwards. +<p> + All of these are explained in detail in the following + sections. If you're the type that doesn't like to read + the documentation, but would rather just try and figure + your way through things, you can just type <tt/XF86Setup/ + now. + If you have problems, the documentation will still be here. +<p> + Although it is possible to use XF86Setup from within X to + make changes to your existing configuration, such use is + not specifically documented here. These instructions are + primarily for those initially setting up XFree86 on their + system. + +<sect> Using <tt>XF86Setup</tt> +<p> + XF86Setup will first check around to make sure certain files + are installed and that you are running as root. If a problem + is found, it will display a message and exit. Correct the + problem (e.g. install the missing files) and run it again. + + XF86Setup is internationalized. If you are Japanese and set + the LANG environment variable to ja, japan, japanese, etc., + XF86Setup's screen can be Japanized. But it is necessary that + XF86Setup is built with Japanized Tcl/Tk. Other language can + be added, if you prepare its own directory under the directory + XF86Setup/texts. Please see under the directory + XF86Setup/texts/generic. + +<sect1> Initial questions +<p> + If you have an existing XF86Config file, you will be asked if + you would like to use it to set the default values of various + configuration settings. If you've already got an (at least + somewhat) working configuration you will want to do this. + + If you are running on an OS which has a mouse driver in the + kernel (e.g. SCO or SVR4), you may be asked if you'd like to + use it. + + Once the questions (if any) are completed, you will see a message + indicating that the program is ready to switch into graphics mode. + Just press Enter. If you don't get a graphics screen saying + <it/Welcome to XFree86 Setup/ within a minute, something has + probably hung, you can try pressing Ctrl-Alt-Backspace to + switch back to text mode and you'll probably have to use + xf86config instead of XF86Setup. + +<sect1> Configuration areas +<p> + Once the VGA16 server is started, and once the program has + finished loading, you will see a screen with six + buttons along the top and three along the bottom. + The buttons along the top correspond to the general categories + of configuration settings. They can be done in any order. + Each of these areas is explained in detail below. + The bottom row consists of the <bf/Abort/, + <bf/Done/, and <bf/Help/ buttons. +<p> + <bf/Abort/ does as it name implies. It exits the program + without saving any changes that have been made. The one + possible exception is the link to the mouse device. Any + change to that is made as soon as <bf/Apply/ is selected. +<p> + <bf/Done/ should be selected when you've finished + configuration in each of the various categories. +<p> + The <bf/Help/ can be pressed at any time to get on-line + help regarding the current configuration screen. +<p> + You should start with configuring your mouse as it will make + things a lot easier to perform the configuration of other + categories. + +<sect2> Mouse +<p> + The mouse configuration screen is used to get the mouse working + properly. There are key bindings for everything so that you + can easily configure the mouse, if it's not already working. +<p> + The screen includes a representation of a white mouse with + three buttons. As you move your mouse it should show the + pointer coordinates on the mouse and the buttons should turn + black as you press the corresponding button on your mouse. + If that is not happening, then your mouse is not correctly + configured. +<p> + Along the top are some rows of buttons corresponding to + the various possible protocols. There will also be + several buttons and a couple of sliders + for other settings, a visual representation of the mouse, + and a button to apply any changes. + There may also be an entry box in which the + device can be set along with a list of possible devices. +<p> + First try moving your mouse around and see if the pointer moves + correctly. If so, try testing that the buttons are working + properly. If those are working as desired, go ahead and go on + to another configuration area. +<p> + If the mouse pointer doesn't move at all, you need to fix + either the mouse device or the protocol (or both). + You can press 'n' followed by a Tab, to move to the list + of mouse devices and select a different one. + Pressing 'p' will pick the next available protocol on the list + (protocols that are not available on your OS will be + greyed-out). If you have a PnP mouse, it may be easiest to + just select "Auto" as the protocol. + After changing these, press 'a' to apply the changes and try + again. Repeat the process until you are getting some response + from your mouse. +<p> + If the mouse pointer or button indicators do something when you + move the mouse, but the pointer is not moving properly, you + probably have the wrong protocol selected. Try with a different + one. +<p> + Most mice these days use the <bf/Microsoft/ protocol, the second + most common is <bf/MouseSystems/. Some mice do both. + These <it/dual-protocol/ mice have various methods of switching + between the two protocols. + Some have a switch on the mouse itself. + Some are switched by sending a certain signal to the mouse + when opening a connection to the mouse. + These signals can be controlled by using different + combinations of the 'ClearDTR' and 'ClearRTS' settings. + Other mice require a button to be depressed when the mouse + is opened (when the mouse driver first tries to talk to it). + If your mouse uses this method, hold down the appropriate + button while selecting apply (pressing 'a'). +<p> + Once the mouse pointer is moving correctly, test that all + three buttons are working properly. If your mouse only has + two buttons, select 'Emulate3Buttons' and you should be able + to press both buttons simultaneously to emulate the missing + middle button. If not all of the buttons are working, try + changing the 'ChordMiddle' setting or you may be using a + protocol that is similar to that of your mouse, + but not quite right. + +<sect2> Keyboard +<p> + You need to specify the model and layout of your keyboard (and + press apply) if they are not already correct. + The graphical representation of the keyboard will be + updated when you choose a different model. +<p> + For non-U.S. keyboards you may wish to choose a variant from + the list (at this time there is only one available variant: + <tt/nodeadkeys/>). +<p> + You can also pick from the options to the right, if you wish. + +<sect2> Card +<p> + Pick your card from the list. +<p> + If there are README files that may pertain to your card + the 'Read README file' button will then be usable (i.e. not + greyed out). + Please read them. +<p> + If your card is not in the list, or if there are any + special settings listed in the README file as required + by your card, you can press the 'Detailed Setup' + button to make sure that the required settings are selected. + Otherwise, you're finished with configuring your card. +<p> + To use 'Detailed Setup': + First select the appropriate server for your card. + Then read the README file corresponding to the selected + server by pressing the 'Read README file' button + (it won't do anything, if there is no README). +<p> + Next, pick the chipset, and Ramdac of your card, if + directed by the README file. + In most cases, you don't need to select these, + as the server will detect (probe) them automatically. +<p> + The clockchip should generally be picked, if your card + has one, as these are often impossible to probe + (the exception is when the clockchip is built + into one of the other chips). +<p> + Choose whatever options are appropriate (again, + according to the README). +<p> + You can also set the maximum speed of your Ramdac. + Some Ramdacs are available with various speed ratings. + The max speed cannot be detected by the server + so it will use the speed rating of the slowest version + of the specified Ramdac, if you don't specify one. +<p> + Additionally, you can also specify the amount of RAM on your + card, though the server will usually be able to detect this. + + +<sect2> Modeselect +<p> + Use this one to pick which depth you prefer to use (this + determines how many colors can be displayed at a time) + and to select all of the modes you are interested in + possibly using. +<p> + Your hardware may not be able to support all + of depth and mode combinations that can be selected. + Any unsupported combinations will automatically be + rejected by the server when it tries to startup. + Note also that if you select multiple modes, you will + get a virtual screen as large as the largest of the + usable modes. + +<sect2> Monitor +<p> + Enter the horizontal and vertical frequency ranges that your + monitor supports in the corresponding entry boxes near the + top of the screen. + You can enter specific frequencies or ranges of frequencies + (separated by hyphens). + If the monitor supports several different frequencies or + ranges, list them all, separated by commas. +<p> + If you can not find this information in you monitor's manual, + pick one of the choices from the list of common monitor + capabilities. The program will use conservative values + for each of these, so you'll get better performance if you + type in the correct values from your monitor manual. + +<sect2> Other +<p> + You can probably just skip this one. + +<sect2> Completing the configuration +<p> + Once you've finished with the above, press the 'Done' button + and then the 'Okay' button which will appear. You will then + be switched back to text mode. + +<sect1> Back to text mode +<p> + The program will now attempt to start the appropriate server + for your card, with all of the + configuration settings you selected. + If for some reason it is unable to start the server, you have + likely selected an improper setting and will be asked if you + would like to return to the graphical configuration screen + and try again. + +<sect1> The second server +<p> + This is unlikely to happen, but + if when the server starts, the display is unreadable, try + pressing Ctrl-Alt-+ (using the plus on the numeric keypad) + to switch to a different video mode. +<p> + The display will show an entry box and three buttons. +<p> + The first button allows you to run xvidtune to adjust your + video modes. One important point to keep in mind when using + xvidtune is that switching video modes with Ctrl-Alt-+ is + disabled while xvidtune is running. + You must use the 'Next' and 'Prev' buttons to switch modes. + Because of this, you should be careful not to move the mouse + when pressing either of these. If by some chance the mode + you switch to doesn't produce a readable display on your + monitor, you can then just press the mouse button again to + move to the next (hopefully readable) mode. +<p> + The second button causes the settings you've made to be + written to the filename given in the entry box. + After saving the settings a message will appear indicating + that it has finished. Just press the 'Okay' button and + you're done. +<p> + And the third button causes the program to exit without + saving any of the configuration settings. + +<sect1> Ending text +<p> + You are returned to text mode and the program will print a + `Configuration complete.' message. You should now have a + usable configuration file and can start the X server by + whichever method you wish (usually either the 'startx' + command or via 'xdm'). + +<sect> Running <tt>xf86config</tt> +<p> + From a text screen, run the <tt/xf86config/ program. This + program should be run as <it/root/ (although not absolutely + necessary, it will allow xf86config to do more of the work + for you). You can press your interrupt character (usually + Control-C or perhaps Delete), at any time to stop the program, + if you need to. You can just start it over again. + + The <tt/xf86config/ program provides instructions on screen + as to what you need to do. Following are some notes that + document the various stages in the process. They should help + you get through the process quickly and provide some + documentation for those people who like to know what they're + getting themselves into, before running a program. + +<sect1> The intro screen +<p> + First, <tt/xf86config/ begins by telling you a few things like + the fact that it can help you setup an XF86Config file or that + you can do the job yourself with an editor. Just read what + it says and press <sf/Enter/ when done. + +<sect1> Getting your <tt>PATH</tt> right +<p> + The program will next check that you have the directory + <tt>/usr/X11R6</tt> (the standard installation directory) + on your system and tell you that it needs to be in your + <tt/PATH/ environment variable. + + It will also check if you have the + <tt>/usr/X386</tt> directory as used by older (pre 3.0) + versions of XFree86. If by chance you do, it will warn you + that <tt>/usr/X11R6</tt> must be before <tt>/usr/X386</tt> + in your <tt/PATH/. + + If everything is okay, just press Enter and go on, otherwise + press Control-C to exit and make any necessary changes and + restart <tt/xf86config/. + +<sect1> Mouse setup +<p> + Pick the mouse type from the menu and enter the name of the + device to which mouse is connected, as directed. + + If you are using an OS (e.g. SVR4, SCO) that has a built in + mouse driver that the Xserver could use, you'll need to edit + the XF86Config file to setup your mouse, so just pick any + mouse from the list and press enter when asked for the device. + + If you don't know which protocol your mouse uses, you'll just + have to guess (the xf86config program will give you some hints + as to which might be most likely) and then see the + troubleshooting section if it doesn't work when you run the + server. + + The xf86config program has not been updated to allow you to + select the latest mouse protocols, so you may have to edit + the config file by hand after xf86config has finished. + +<sect1> Keyboard setup +<p> + Simply answer yes to the question regarding keyboard setup. + + If there is some reason you need to use the right-alt and + control keys for something else, you can enter no. + +<sect1> Monitor setup +<p> + Setting up a monitor consists of entering the specifications + of your monitor and a description of the model and manufacturer. + + You are first asked for the horizontal sync rate. It is + <bf/VERY/ important to enter the correct value(s) from the + manual. If one of the ranges given matches the rate of your + monitor, then pick it, otherwise pick <tt/custom/ and enter + the values from your manual. + + Next is the vertical refresh rate. Again, it is <bf/VERY/ + important that this parameter be specified correctly. + Enter it in a manner similar to the horizontal sync rate. + + <it>If either rate is mis-specified, it can result in damage + to your monitor.</it> + + Finally, you are asked for an "identifier", your monitor + manufacturer, and model. You can just press enter to + get through these quickly. + +<sect1> Selecting your card +<p> + You are next asked if you would like to view the database of + cards. Picking your card from the list will cause the answers + to the questions in the next two sections to be filled in for + you and so can save a little time. + + If your card does not appear in the list, just press <tt/q/ + and enter to skip on to the next step - where you'll have to + answer the questions yourself. + +<sect1> Server selection +<p> + If you selected your card in the previous step, then server + selection is easy - just use the recommendation from the + database. + + If you have a card which uses one of the chipsets for which a + specific server exists (Mach8, Mach32, Mach64, AGX/XGA, + 8514/A, S3, I128, P9000) you'll want to pick the + <tt/accel/ option. + + Otherwise you'll probably want to use the SVGA server. + + Next, answer yes when the program asks if you want it to + set the symbolic link for you. If you picked the <tt/accel/ + option, you'll also need to indicate which particular + accelerated server to link to. + +<sect1> Screen/Video configuration +<p> + Pick the appropriate option from the list to indicate the + amount of memory on your video card. + + Then you are asked to provide and identifier, the manufacturer, + and the model of your card. You can just press enter to skip + through these, if you wish. + + Next, the program will ask for the type of RAMDAC and Clockchip + on your card. If your card was in the database, you should + just to tell it to use the values from the database. + + If you don't have one of the listed RAMDACs or Clockchips + on your card, just press enter when asked what type you have. + If you do not have a programmable clock chip, the program will + next attempt to probe to find out what clock rates are + supported by your clock chip. + +<sect1> Mode Selection +<p> + Now you get to tell the program which video modes you would + like to be able to run. + + The program will show you the common modes that should work + with your card (some might not work with your monitor, but + if you've correctly specified the monitor's sync rates, the + X server will just ignore them when it runs). + + You could just accept the settings as they are given, but + you'll probably wish to reverse the order. For example, if + you have a card with 1 Meg RAM, it will list the modes + <tscreen><verb> + "640x480" "800x600" "1024x768" for 8bpp + </verb></tscreen> + + Select <tt/1/ to change the settings for 8bpp and the type + <tt/432/ to select the reverse order. + + When you've select the modes, in the order you wish, select + option <tt/4/ to continue. + +<sect1> Creating the <tt>XF86Config</tt> file +<p> + The program will now ask if you would like to write the + configuration settings you've selected to the file + <tt/XF86Config/. Answer yes. + +<sect1> Some final notes +<p> + Lastly, the program tells you that it's finished its part + of this process and counsels you to check the file before + using it. The next section covers the changes that are most + likely to be needed. + +<sect> Fixing the XF86Config file +<p> + Use an editor to look at the <tt/XF86Config/ file. Here are + some things that may need to be changed: + <itemize> + <item>If you are running an operating system which has + built-in mouse support, you'll want to change the + <tt/Pointer/ section. Specifically, you should set + the <tt/Protocol/ to <tt/OSMouse/ (SCO) or <tt/Xqueue/ + (SVR4, some SVR3) and you should remove the <tt/Device/ + line. + <item>If you are running a system with the Xqueue event driver + and would like to use it, change the <tt/Protocol/ + setting in the <tt/Keyboard/ section to <tt/Xqueue/. +<!-- What else should be added here? --> + </itemize> + + Once you are satisfied that the configuration is correct, copy + the XF86Config file to <tt>/usr/X11R6/lib/X11</tt> and run + the 'startx' command. + + You should now have a running X server. If it's running but + the display doesn't look as good as you think it should (i.e. + it doesn't fill the whole screen, it's off-center, it's wrapping + around on one side, etc.) see the section on <tt/xvidtune/. + If there is some other problem, see the troubleshooting section. + +<sect> Running <tt>xvidtune</tt> +<p> + If you need to make adjustments to the video display, + <tt/xvidtune/ is the tool to use. + + Simply enter the command <tt/xvidtune/ from a shell prompt + within an xterm. Read the warning and click on <tt/OK/. + Next click on the <tt/Auto/ button. + + Now click on whatever combination of <tt>Up/Down/Left/Right</tt> + <tt>Shorter/Taller/Wider/Narrower</tt> is need to adjust + the display to your liking. + + If you are using a recent S3-based card there will be some + extra buttons and entries at the bottom (InvertVCLK, EarlySC, + and Blank Delays). These can help solve problems of the + display wrapping around a few pixels. + + Once the display has been adjusted properly, press the <tt/show/ + button to printout the correct <tt/ModeLine/ to put in the + <tt/XF86Config/ to make the server always use the current + display settings. To aid in copying this information to your + XF86Config file, the modeline is also made the current + selection allowing you to just paste it into your editor. + + If you would like to adjust your other modes, you can click + on the <tt/Next/ and <tt/Prev/ buttons to switch modes. + + When you are through using <tt/xvidtune/ simply press on the + <tt/Quit/ button. + +<sect> Troubleshooting +<p> + Since you're reading this, something must not have gone + the way you had hoped (or else you just really enjoy reading). + + Below are listed some common problems that may occur + during configuration and some hints for solving them. + However, there are just too many different combinations + of hardware and software configurations, and, well, just + too many things that can go wrong, for this document + and the tools it documents, to cover every case. + + If after trying the steps in the previous sections and + checking the hints in this section, you still are unable + to get your system working, you'll have to read the full + documentation. Read the README file for your card and + OS (if they exist), the XFree86 Configuration Guide + (README.Config), and the XF86Config man page. + +<!-- + You should also look at + <url name="the XFree86 FAQ" url="http://www.XFree86.org/FAQ"> + for more up-to-date information, + especially if you are trying to configure a fairly new card. +--> + + If all else fails, you can try posting a message to + comp.windows.x.i386unix or comp.os.linux.x or send email + to XFree86@XFree86.org. + +<sect1> The mouse doesn't move correctly, it stays in one area of the screen +<p> + You've selected the wrong protocol for your mouse. Try a + different one. + +<sect1> The server doesn't start, it says the mouse is busy. +<p> + Well, it's probably right. This most often happens on + Linux systems that have <tt/gpm/ running. Kill the <tt/gpm/ + process and try <tt/startx/ again. + +<sect1> The middle button doesn't work. +<p> + There's no easy answer to this one. It's a lot of trial + and error. You need to make sure you're running the right + protocol for your mouse. + + Many three button mice are "dual protocol" which means that + they have both a 2-button and 3-button mode. The way to get + the mouse to switch into 3-button mode (which usually then + uses MouseSystems protocol) varies between different models. + + You may need to slide a switch on the mouse or hold down the + middle button when starting the server. Other methods of + switching modes can be done by the server, you just have to + find the right combination of settings for your mouse. See + the Pointer section of the XF86Config man page for a complete + list of settings. + +<sect1> The display is shifted to the left/right/top/bottom +<p> + See the section on xvidtune. + +<sect1> I don't appear to have xf86config or xvidtune on my system +<p> + Hmmm. A couple of possibilities: + <enum> + <item>Your <tt/PATH/ is not set correctly. Make sure it includes + the bin directory for the XFree86 binaries (usually, + <tt>/usr/X11R6/bin</tt> + <item>You don't have a complete installation of XFree86. + Go back to wherever you got XFree86 and get the missing + pieces. + </enum> + +<!-- Lots of things still need to be added --> + +<verb> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/QuickStart.sgml,v 1.2 2001/08/10 16:38:11 dawes Exp $ +</verb> + +</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.113.2.3 xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.119 --- xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.113.2.3 Sat Jun 2 12:17:40 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml Wed Jan 16 14:40:48 2002 @@ -13,15 +13,15 @@ <title>README for XFree86&tm; &relvers; <author>The XFree86 Project, Inc -<date>2 June 2001 +<date>16 January 2002 <ident> -$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/sgml/README.sgml,v 3.119 2002/01/16 19:40:48 dawes Exp $ </ident> <abstract> -XFree86 is the Open Source port of X.Org's X11R6.4 release that supports +XFree86 is the Open Source port of X.Org's X11R6.6 release that supports several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operating systems on Intel and other platforms. @@ -346,10 +346,14 @@ <![ %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 +rm -f xc/extras/freetype2/builds/mac/ftlib.prj +rm -fr xc/extras/freetype2/docs/design +rm -fr xc/extras/freetype2/docs/glyphs +rm -fr xc/extras/freetype2/docs/image +rm -fr xc/extras/freetype2/docs/tutorial +rm -f xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib +rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings +rm -f xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib </verb></tscreen> ]]> <tscreen><verb> @@ -370,6 +374,12 @@ To format the XFree86 documentation use the latest version of our doctools package available as <tt>doctools-&doctoolsvers;.tgz</tt>. ]]> <!-- fullrel --> + +The XFree86 source code can also be accessed via the XFree86 CVS repository. +Information about accessing this can be found at the <url name="CVS page" +url="http://www.xfree86.org/cvs/"> on our web site. It's also possible +to browse the XFree86 CVS repository at our <url name="CVSWeb server" +url="http://cvsweb.xfree86.org/">. <sect>Reporting Bugs <p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.60.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.70 --- xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.60.2.1 Sat Jun 2 12:28:25 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml Thu Jan 17 13:14:59 2002 @@ -6,15 +6,15 @@ <title>Release Notes for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>17 December 2000 +<date>17 January 2002 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.60.2.1 2001/06/02 16:28:25 torrey Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.70 2002/01/17 18:14:59 dawes Exp $ </ident> <abstract> -This document contains some information about the features present +This document contains some information about features present in XFree86 &relvers; and their status. </abstract> @@ -72,7 +72,8 @@ as well as what is new in the latest full release (&fullrelvers;). ]]> <![ %fullrel [ -The next section describes what is new in the latest version (&relvers;). +The next section describes what is new in the latest version (&relvers;) +compared with the previous full release (&prevfullrelvers). ]]> 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 @@ -88,299 +89,154 @@ ]]> <sect>Summary of new features in &fullrelvers;. -<p> -<sect1>X server -<p> -<itemize> - <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. - - <item>Mesa has been updated to the 3.4 stable release. - - <item>A driver for ATI Radeon adapters has been added. - - <item>ATI driver support for multi-head configurations and non-Intel - platforms has been improved. - - <item>The ATI driver has been changed to invoke the appropriate driver for - any Rage 128 and Radeon adapters that it finds in the system. - - <item>A driver (i128) for Number Nine chipsets has been added. - - <item>A driver (savage) for S3 Savage chipsets has been added. - - <item>A driver (siliconmotion) for some Silicon Motion chipsets has been - added. - - <item>The driver (ark) for Ark Logic chips has been ported to 4.x. - - <item>A VESA driver has been added. - - <item>A driver for SGI newport cards has been added (Linux/mips). - - <item>The trident driver has lots of fixes to the CyberBlade/Blade - support, XVideo support for the Image/Blade series (although - scaling doesn't work yet on the Image series). - - <item>The s3virge driver has stabilized ViRGE GX2 support, includes - ViRGE DX and ViRGE support for XVideo YUV images, and various fixes. - - <item>The 3Dlabs (glint) driver now has Permedia3 support. - - <item>The SiS driver has had many updates, and XVideo support for the 630 - is included. - - <item>The NVIDIA (nv) driver has been updated to include support for the - GeForce2, and line acceleration has been added. Also, DDC support - has been improved, and support added for Alpha platforms (dense only). - - <item>The neomagic driver has had various bug fixes and extended acceleration - support. DGA support has also been added. - - <item>The Chips and Technologies driver (chips) has initial support for - the 69030. - - <item>The tseng driver has multi-head fixes and DGA support has been added. - - <item>Most video drivers have been converted to use the integrated "fb" - framebuffer code instead of the old "cfb" code. - - <item>DRI support has been updated for the Rage 128, 3Dfx Voodoo3 and - Voodoo5, Intel i810/i815 and Matrox G400. DRI support for SiS - and Sun Creator3D is available. The DRI is now also available on - Alpha platforms. - - <item>An input driver (citron) for Citron Infrared Touch devices has been - added. - - <item>An input driver (penmount) for PenMount devices has been added. - - <item>An input driver (digitaledge) for DigitalEdge devices has been added. - - <item>Big endian problems in Xinerama have been fixed. - - <item>The new "render" extension has been added (see <ref id="render" - name="below">). The design has been - extended in the following ways:<p> - - <itemize> - <item>A new FillRectangles request was added. - - <item>The 'mask' operand was changed to allow per-channel alphas. - - </itemize> - - <p>Server implementation: - - <itemize> - <item>Implemented remaining code for client clip lists. - - <item>Fixed plenty of bugs related to text rendering. - - <item>Complete compositing code, except for separate alpha. - - </itemize> - - <p>Todo: - - <itemize> - <item>Polygons - - <item>Image scaling - - <item>Separate alpha channels - - <item>Support for visuals other than TrueColor. - - </itemize> - - <p>Drivers with render extension support include: i128, glint, ati (r128 - and radeon), chips, cirrus, mga, neomagic, nv, tdfx, trident, tseng, - vesa, s3virge. - - <p>Acceleration for the render extension: - - <itemize> - <item>XAA infrastructure for acceleration. - - <item>Experimental MGA acceleration using XAA - - <item>kdrive (TinyX) infrastructure - - <item>Experimental TinyX Trident 9525DVD acceleration - - </itemize> - - <p>Xft library: - - <itemize> - <item>New font naming/access library. - - <item>Abstraction for core/Render text. - - <item>Uses FreeType2 rasterizer. - - <item>Allows anti-aliased/subpixel sampled text. - <item>Gracefully falls back to core rendering. +<sect1>Video Driver Enhancements - <item>Complicated font matching mechanism. - - <item>Uses server DPI to convert point sizes to pixel sizes, even - for core fonts. - - </itemize> - - <p>xterm: - - <itemize> - <item>Can use Xft, by default uses core fonts. - - <item>Uses new options '<tt>-fa</tt>' for family name and - '<tt>-fs</tt>' for font size (in points). - - </itemize> - - <p>x11perf: - - <itemize> - <item>Add tests for anti-aliased, subpixel sampled and aliased - fonts using the Xft library. - - </itemize> - - <p>xditview: - - <itemize> - <item>When the Xft library is build, uses Xft for all font access. - - </itemize> - - <p>Qt, Gtk, twm: - - <itemize> - <item>Qt changes available <url - url="http://XFree86.org/~keithp/download/qtkernel.tar.bz2" - name="here">. - - <item>Gtk changes in process. - - <item>twm hacks should never see the light of day. - - </itemize> - - - <item><tt>xf86cfg</tt>, a new graphical configuration tool for XFree86 4.x, - and can be used to either write the initial configuration or make - customisations to the current configuration. <tt>xf86cfg</tt> is - a work in progress, and allows configuration of:<p> - - <itemize> - <item>Specific setup of monitors, cards, keyboards and mice, as - well as adding or removing them. - <item>Server layout setup, allowing complex configuration of - physical monitor positions, default color depth and/or - rotated monitors. - <item>Mode line editor that can be used to configure multiple - monitors, and allows adding a modeline specific to a - monitor directly to the configuration file. - <item>AccessX configuration interface, that provides an interface - to easy setup of most AccessX options, including:<p> - - <itemize> - <item>Timeout to reset controls. - <item>StickyKeys, for people with disabilities that cannot - press two keys at the same time. - <item>MouseKeys, mouse control only with the keyboard. - <item>RepeatKeys, repeat rate and repeat delay. - <item>SlowKeys, to avoid pressing keys accidentally, they're - only accepted if pressed for some specific amount - of time. - <item>BounceKeys, helps avoiding multiple key presses by - only accepting a key if it is pressed only once and - not pressed again in a specific amount of time. - </itemize> - </itemize> - - <p>New configuration options are being worked on, as well as correcting - some of the bugs in the current options. A protocol for plugging - in external modules is also planned. - -</itemize> -</sect1> - -<sect1>X libraries and clients. <p> <itemize> - <item>Significant updates to the internationalisation support in Xlib - (see <ref id="i18n" name="below">). - - <item>Some xfs updates, including font path verification, and new options. - - <item>XTerm updates. +<item> An s3 driver is added, which provides support for many of the + older non-ViRGE and non-Savage S3 chipsets. +<item> Some vmware driver problems are fixed, and the driver is updated + to take advantage of VMWare Workstation 3.0 features. These + include improved hardware cursor handling and support for 8 bit + emulation. +<item> Support added for Trident *BladeXP chipsets (currently not-accelerated). +<item> Xv support added for Trident TGUI series chips (not 9440 though). +<item> Support added for the older Trident chipsets again for ISA/VLBus (not tested) +<item> Support added to the glint driver for 3DLabs Permedia4, GLINT R4 and + Gamma 2 chipsets. +<item> Support added to the i810 driver for Intel i830 (tested on Linux only). +<item> Support added to the ATI radeon driver for Radeon 7500 (2D and 3D), + Radeon 8500 (2D only), and Rage128ProII. +<item> Support added for the Matrox G550 support. This included dual-head + support. +<item> Support added for NVIDIA nForce integrated graphics. +<item> The NVIDIA nv driver now has preliminary powerpc support for the + NV11 and NV20. +<item> Support added to the NVIDIA nv driver for interlaced modes on + hardware that supports this, and support for resolutions higher + than 1600x1200. +<item> Fixes for the savage driver on 64-bit platforms, XVideo support for the + SuperSavage, and other savage driver updates. +<item> The ATI r128 driver now uses the CCE DMA engine for 2D acceleration + when direct rendering is enabled, which reduces context switching + overhead and improves stability and performance for XVideo and some 2D + operations. +<item> The fbdev driver now supports rotation. +<item> Various updates to the apm, ark, chips (C&T), cirrus, i128, + neomagic, newport, s3virge, siliconmotion, sis, tdfx, tseng, vesa, + and vga drivers. - <item>New "xvinfo" client for querying the XVideo extension. - </itemize> + +<sect1>Input Driver Enhancements -<sect1>Fonts and Internationalisation <label id="i18n"> <p> <itemize> - <item>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 from ISO-10646 encoded master fonts. - - <item>The ClearlyU ISO-10646 encoded fonts have been updated. - - <item>Functions to read keyboard input in locale independent UTF-8 encoding - have been added to libX11: Xutf8LookupString, Xutf8ResetIC. - - <item>Functions to output strings in locale independent UTF-8 encoding - have been added to libX11: Xutf8DrawString, Xutf8DrawImageString, - Xutf8TextEscapement, Xutf8TextExtents, Xutf8TextPerCharExtents, - Xutf8DrawText. - - <item>Functions to convert between Compound Text or locale dependent encoding - and UTF-8 have been added to libX11: Xutf8TextListToTextProperty, - Xutf8TextPropertyToTextList. The converter between Compound Text - and UTF-8 in Xlib has been improved; a round-trip conversion - now correctly converts all graphic Unicode characters back and - forth. - - <item>libXaw now offers selected text using both selection targets, - UTF8_STRING and COMPOUND_TEXT. - - <item>Locales with UTF-8 encodings are now supported; but the UTF-8 - displaying facilities are not adequate yet. +<item> The mouse driver now has support for mouse wheel emulation. +<item> The mouse driver can now handle replug events on Linux for PS/2 mice. +<item> The "Min/Max X/Y Position" options in the elographics and mutouch + drivers are changed to "Min/Max X/Y" to be consistent with the other + input drivers. +<item> Linux USB keyboard access is fixed when no PS/2 controller is present. +<item> Added calcomp input driver. +<item> Added DMC input driver. +<item> Added hyperpen input driver. +</itemize> - <item>XKB keyboard definitions have been added and updated for some - countries. +<sect1>X Server and Extension Updates +<p> +<itemize> +<item> Resynced with X.Org's X11R6.6. +<item> Mesa updated to the post-3.4.2 3.4 branch version as of November 2001. +<item> DRI drivers resynced with the latest from the DRI project. +<item> Various updates to the Xft library. +<item> The DEC-XTRAP extension is now available. +<item> The PEX and XIE extensions are no longer built/distributed by default. +<item> A security problem related to glyph clipping for large origins is fixed. +<item> An i810 XvMC (motion compensation) driver is now available (Linux only). +<item> A fatal bug XVideo Xineramification bug is fixed. </itemize> -</sect1> + +<sect1>Client and Library Updates -<sect1>Platforms <p> <itemize> - <item>Darwin/Mac OS X. +<item> FreeType2 updated to version 2.0.6. +<item> Added libGL man pages. +<item> Xload now has support for displaying the load of remote hosts. +<item> Xterm updated to patch level 165. +<item> SuperProbe is removed. +<item> Sample xtrap clients added. +</itemize> - <item>Greatly improved IA-64 support. +<sect1>I18N and Font Updates - <item>Improved Linux/mips support. +<p> +<itemize> +<item> New Luxi scalable fonts (TrueType and Type 1) from Bigelow & + Holmes. + These fonts are original designs by Kris Holmes and Charles Bigelow. + See <ref id="luxi" name="below"> for further information. +<item> More locale/international keyboards supported. +<item> Modularized I18N support in Xlib is included from X11R6.6. +<item> A problem that caused bdftopcf to sometimes write corrupted fonts + is fixed. +<item> Some problem with Xlib's handling of CTEXT and multi-byte + characters are fixed. +<item> The fontenc layer is updated, and the fontenc library is now installed + and available for other applications. +<item> Improvements to the input method framework in Xlib for UTF-8 locales. +<item> A filter called ``luit'' is added, which provides locale and + ISO 2022 support to any Unicode terminal, notably xterm. + Use of luit is still experimental in this release. +</itemize> - <item>Support has been added for more Alpha platforms under Linux. This - now includes all platforms that require sparse memory mapping. +<sect1>OS Support Updates +<p> +<itemize> +<item> Build problems on both QNX4 and QNX6 are fixed. +<item> VT switching problems with the i810 driver on FreeBSD are worked around. +<item> Problems building modules with some enhanced versions of gcc are fixed. +<item> Lots of updates for Darwin/Mac OS X, including: + <itemize> + <item> On Mac OS X, a new rootless mode is added to the XDarwin + X server. This allows X clients to display windows on + the Aqua desktop. + <item> Xinerama support added to XDarwin + <item> With XDarwin in full screen mode, the depth, size, and refresh + rate can now be chosen to be different from the settings + used by Aqua. + <item> GLX support added for Darwin and Mac OS X with software + rendering. + <item> Keymap setup in XDarwin is improved, particularly for + international keyboards. + <item> In addition to English and Japanese, the XDarwin user + interface is now localized in Dutch, French, German, Spanish, + and Korean. + </itemize> +<item> Lots of Cygwin support updates. +<item> Support added for OpenBSD/powerpc. +<item> Build support added for Linux on IBM S/390. +<item> Removed stale support for Amoeba and Minix. +<item> Client-side support added for sparc64 on NetBSD and OpenBSD. +<item> Support added for building the X server on Linux/m68k. +<item> Support added for building on Linux/arm32. +<item> Updates to Linux/mips support. </itemize> -</sect1> -</sect> +A more complete list of changes can be found in the CHANGELOG that is +part of the XFree86 source tree. It can also be viewed online at our +<url name="CVSweb server" +url="http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xfree86/CHANGELOG?rev=HEAD">. +<!-- +<sect>Summary of new features in &prevrelvers;. +<p> +--> + <sect>Drivers <p> @@ -406,7 +262,7 @@ <tabrow><tt>cirrus</tt><colsep>Cirrus Logic<colsep> </tabrow> <tabrow><tt>cyrix</tt> (*)<colsep>Cyrix MediaGX<colsep><htmlurl name="README.cyrix" url="cyrix.html"></tabrow> - <tabrow><tt>fbdev</tt><colsep>Linux fbdev<colsep><htmlurl + <tabrow><tt>fbdev</tt><colsep>Linux framebuffer device<colsep><htmlurl name="fbdev(4)" url="fbdev.4.html"></tabrow> <tabrow><tt>glide</tt><colsep>Glide2x (3Dfx)<colsep><htmlurl name="glide(4)" url="glide.4.html"></tabrow> @@ -433,6 +289,7 @@ <tabrow><tt>rendition</tt><colsep>Rendition<colsep><htmlurl name="README.rendition" url="rendition.html">, <htmlurl name="rendition(4)" url="rendition.4.html"></tabrow> + <tabrow><tt>s3</tt><colsep>S3 (not ViRGE or Savage)<colsep> </tabrow> <tabrow><tt>s3virge</tt><colsep>S3 ViRGE<colsep><htmlurl name="README.s3virge" url="s3virge.html">, <htmlurl name="s3virge(4)" url="s3virge.4.html"></tabrow> @@ -459,6 +316,8 @@ name="vesa(4)" url="vesa.4.html"></tabrow> <tabrow><tt>vga</tt><colsep>Generic VGA<colsep><htmlurl name="vga(4)" url="vga.4.html"></tabrow> + <tabrow><tt>vmware</tt><colsep>VMWare guest OS<colsep><htmlurl + name="vmware(4)" url="vmware.4.html"></tabrow> </tabular> </table> @@ -485,12 +344,18 @@ <tabular ca="|l|l|l|"> <tabrow>Driver Name<colsep>Description<colsep>Further Information</tabrow> <hline> +<!-- <tabrow><tt>acecad</tt><colsep>AceCad<colsep> </tabrow> +--> + <tabrow><tt>calcomp</tt><colsep>Calcomp<colsep> </tabrow> <tabrow><tt>citron</tt><colsep>Citron<colsep><htmlurl name="citron(4)" url="citron.4.html"></tabrow> <tabrow><tt>digitaledge</tt><colsep>DigitalEdge<colsep> </tabrow> + <tabrow><tt>dmc</tt><colsep>DMC<colsep><htmlurl + name="dmc(4)" url="dmc.4.html"></tabrow> <tabrow><tt>dynapro</tt><colsep>Dynapro<colsep> </tabrow> <tabrow><tt>elographics</tt><colsep>EloGraphics<colsep> </tabrow> + <tabrow><tt>hyperpen</tt><colsep>HyperPen<colsep> </tabrow> <tabrow><tt>keyboard</tt><colsep>generic keyboards<colsep><htmlurl name="keyboard(4)" url="keyboard.4.html"></tabrow> <tabrow><tt>microtouch</tt><colsep>MicroTouch<colsep> </tabrow> @@ -507,7 +372,7 @@ </tabular> </table> -<sect>Summary of XFree86 4. +<sect>Overview of XFree86 4.x. <p> Unlike XFree86 3.3.x where there are multiple X server binaries, each of which drive different hardware, XFree86 &relvers; has a single X @@ -575,10 +440,13 @@ file. This is done by running (as root) "<tt>XFree86 -configure</tt>". Alternatively, the sample config file <tt>XF86Config.eg</tt> that is installed in <tt>/usr/X11R6/lib/X11</tt> may be used as a starting point. +The <tt>xf86cfg</tt> utility can also be used to create a new configuration +file or to edit an existing one. The <tt>XF86Setup</tt> utility is currently not usable, but work is continuing in this area. -The main changes are covered here, but please refer to the XF86Config +The main changes are covered here, but please refer to the <htmlurl +name="XF86Config(5)" url="XF86Config.5.html"> manual page for more comprehensive information: <itemize> @@ -604,8 +472,6 @@ Load "dbe" Load "record" Load "glx" - Load "pex5" - Load "xie" Load "extmod" Load "type1" @@ -665,6 +531,14 @@ Option "off time" "40" </verb></quote> + The new option <tt>AllowDeactivateGrabs</tt> allows deactivating + any active grab with the key sequence <tt>Ctrl+Alt+Keypad-Divide</tt> + and the new option <tt>AllowClosedownGrabs</tt> allows closing the + conection to the grabbing client with the key sequence + <tt>Ctrl+Alt+Keypad-Multiply</tt>. Note that these options are off + by default as they allow users to remove the grab used by screen + saver/locker programs. + <item>The Keyboard, Pointer and XInput sections have been replaced by a more general InputDevice section. The old Keyboard and Pointer sections are still recognised for compatibility purposes, but @@ -881,7 +755,7 @@ messages that get written to stderr. It may be specified multiple times to increase the verbosity level (as with 3.3.x), or the verbosity level may be specified explicitly as a number. The - default verbosity level is 1. + default verbosity level is 0. </quote> @@ -898,6 +772,8 @@ </quote> +A more complete list of XFree86 X server command line options can be found +in the <htmlurl name="XFree86(1)" url="XFree86.1.html"> manual page. <sect1>XAA <p> @@ -969,12 +845,15 @@ and 2; these can be disabled independently with <tt>Option "NoDDC1"</tt> and <tt>Option "NoDDC2"</tt>. -At startup the server prints out DDC information from the display, -but it does not yet use it the determine modelines. For some drivers, -the X server's new <tt>-configure</tt> option uses the DDC information -when generating the config file. +At startup the server prints out DDC information from the display, and +can use this information to set or warn about monitor sync limits (but +not modelines yet). For some drivers, the X server's new +<tt>-configure</tt> option uses the DDC information when generating the +config file. -Changed behavior caused by DDC. Several drivers uses DDC information to +<sect2>Changed behavior caused by DDC. +<p> +Several drivers uses DDC information to set the screen size and pitch. This can be overridden by explicitly resetting it to the and non-DDC default value 75 with the <tt>-dpi 75</tt> command line option for the X server, or by specifying appropriate @@ -986,8 +865,6 @@ <p> <url name="Precision Insight" url="http://www.precisioninsight.com"> -(now part of the Professional Services group at <url name="VA Linux Systems" -url="http://www.valinux.com">) was provided with funding and support from <url name="Red Hat" url="http://www.redhat.com">, <url name="SGI" url="http://www.sgi.com">, <url name="3Dfx" url="http://www.3dfx.com">, <url name="Intel" @@ -1138,7 +1015,7 @@ ported to the new server architecture. The area of mode validation needs further work, and the extension should be used with care. This extension has support for changing the gamma setting at run-time, for -modes where this is possible. The new <tt>xgamma</tt> utility makes +modes where this is possible. The <tt>xgamma</tt> utility makes use of this feature. Compatibility with the 3.3.x version of the extension is provided. The missing parts of this extension and some new features should be completed in a future release. @@ -1331,7 +1208,7 @@ <p> 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 +have access to, is 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. @@ -1376,21 +1253,38 @@ </itemize> -<sect1>Lucidux fonts from Bigelow and Holmes +<sect1>Luxi fonts from Bigelow and Holmes <label id="luxi"> <p> -XFree86 now includes the ``Lucidux'' family of professionally hinted -Type 1 fonts. This family consists of the fonts ``Lucidux Serif'', -``Lucidux Sans'' and ``Lucidux Mono'' in Roman and oblique variants, -and includes over 370 glyphs in each font covering among others the -glyphs needed for ISO 8859-1, 2, 3, 4, 9 and 15. Bold variants will be -included in a future release. The design and font outlines were donated -by Charles Bigelow and Kris Holmes from Bigelow and Holmes Inc., and -the hinting was donated by Berthold Horn and Blenda Horn from Y&Y, Inc. -For more information, please contact +XFree86 now includes the ``Luxi'' family of Type 1 fonts and TrueType +fonts. This family consists of the fonts ``Luxi Serif'', +``Luxi Sans'' and ``Luxi Mono'' in Roman, oblique, bold and +bold oblique variants. The TrueType version have glyphs covering the +basic ASCII Unicode range, the Latin 1 range, as well as the +<it/Extended Latin/ range and some additional punctuation characters. +In particular, these fonts include all the glyphs needed for ISO 8859 +parts 1, 2, 3, 4, 9, 13 and 15, as well as all the glyphs in the Adobe +Standard encoding and the Windows 3.1 character set. + +The glyph coverage of the Type 1 versions is somewhat reduced, +and only covers ISO 8859 parts 1, 2 and 15 as well as the Adobe +Standard encoding. + +The Luxi fonts are original designs by Kris Holmes and Charles Bigelow +from Bigelow and Holmes Inc., who developed the Luxi typeface designs +in Ikarus digital format. URW++ Design and Development GmbH converted +the Ikarus format fonts to TrueType and Type 1 font programs and +implemented the grid-fitting "hints" and kerning tables in the Luxi +fonts. + +The license terms for the Luxi fonts are included in the file +`<tt/COPYRIGHT.BH/', as well as in the <htmlurl +name="License document" url="LICENSE.html">. For further information, +please contact <email>design@bigelowandholmes.com</email> or -<email>sales@yandy.com</email>, or consult <url name="Y&Y's web site" -url="http://www.yandy.com">. +<email>info@urwpp.de</email>, or consult the +<url name="URW++ web site" url="http://www.urwpp.de">. + <!-- <sect>Miscellaneous Index: xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml:3.38 xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml:3.39 --- xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml:3.38 Mon Aug 23 02:38:52 1999 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml Fri Nov 23 14:50:45 2001 @@ -822,7 +822,7 @@ s3MNadjust -31 255 </verb></tscreen> -to the device section in your <tt/XF86Config/ file and restart X Windows. +to the device section in your <tt/XF86Config/ file and restart X. With this option (which is for testing and debugging only) you'll get lots of disastrous display flickering and snowing, so it should be removed again immediately after running the test script below. @@ -921,7 +921,7 @@ <verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml,v 3.38 1999/08/23 06:38:52 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml,v 3.39 2001/11/23 19:50:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml:3.17 xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml:3.19 --- xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml:3.17 Fri Dec 5 17:01:38 1997 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml Fri Aug 10 12:38:13 2001 @@ -3,9 +3,9 @@ <!-- TitleS information --> -<title>Information for SCO Users -<author>J. Kean Johnston (hug@netcom.com) -<date>30 November 1996 +<title>Information for SCO OpenServer Users +<author>J. Kean Johnston (jkj@sco.com) +<date>21 May 2001 <!-- Table of contents --> @@ -240,7 +240,7 @@ <enum> <item>Fine tune ``<tt>site.def/xf86site.def</tt>''<p> -Use GCC if you can. XFree should compile with the DevSys cc, but GCC has +Use GCC if you can. XFree86 should compile with the DevSys cc, but GCC has better optimizations, and is guaranteed to work. <item>SCO Open Server comes with Visual @@ -524,7 +524,7 @@ ftp site for the binary distribution. <verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.17 1997/12/05 22:01:38 hohndel Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.19 2001/08/10 16:38:13 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml:1.2 --- /dev/null Fri Jan 18 15:25:15 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml Thu Nov 15 12:22:55 2001 @@ -0,0 +1,218 @@ +<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> +<article> + +<!-- Title information --> +<title>Information for Solaris +<author>David Holland, modified by Marc Aurele La France +<date>2001 October 01 + +<!-- Table of contents --> +<toc> + +<!-- Begin the document --> +<sect>What is XFree86<p> +XFree86 is a port of X11R6.5.1 that supports several versions of Intel-based +Unix. +It is derived from X386 1.2 which was the X server distributed with X11R5. +This release consists of many new features and performance improvements as well +as many bug fixes. +The release is available as a source code distribution, as well as binary +distributions for many architectures. +<p> +The sources for XFree86 are available by anonymous ftp from: +<quote> + <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/current" + url="ftp://ftp.XFree86.org/pub/XFree86/current"> +</quote> +Solaris binaries for XFree86 are available for anonymous ftp at the same +address. +Currently, two binary distributions are available: one for Solaris 8 x86, the +other for previous Solaris x86 releases. +They are <it>not</it> interchangeable. +No binary distribution is available for Solaris/SPARC as it is still under +development.<p> +<sect>The VT-switching sub-system in Solaris x86<p> +The virtual terminal sub-system is a undocumented, and unsupported feature of +Solaris x86. +Therefore if you use virtual terminals, you do so at <bf>YOUR OWN RISK</bf>.<p> +Virtual terminals are not available in Solaris SPARC, and their availability +has been removed in Solaris8 x86.<p> +When available, the virtual terminals of Solaris work basically the same way as +most other Intel based SVR4 VT sub-systems. +However, there are a number of limitations documented below.<p> +First, if you are running a Solaris 2.4 x86 system, and you want VT's, you will +have to create the necessary devices first, so become root.<p> + +Verify the chanmux device driver's major number is 100:<p> +<tscreen><verb> + # grep -i chanmux /etc/name_to_major + chanmux 100 + # +</verb></tscreen> +If the number after 'chanmux' is anything but 100, I would suggest you +immediately abort your attempt to create virtual terminals, and learn to live +without them.<p> +However, if it is 100, then as root type the following commands to create the +maximum allowable number of virtual terminals.<p> +<tscreen><verb> + # cd /dev + # mknod vt01 c 100 1 + # mknod vt02 c 100 2 + # mknod vt03 c 100 3 + # mknod vt04 c 100 4 + # mknod vt05 c 100 5 + # mknod vt06 c 100 6 + # mknod vt07 c 100 7 +</verb></tscreen> +There is no need for a reconfiguration boot.<p> +Secondly, for both 2.1, and 2.4 x86 systems, add a few lines to the +<tt/inittab/ to enable logins on them.<p> + +(<bf>Note</bf>, do <bf>NOT</bf> make a mistake here, you could lock yourself +out of the system)<p> +<verb> +--------------------->Snip Snip<----------------------------------------------- +v1:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT01 login: " -T AT386 -d /dev/vt01 -l console +v2:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT02 login: " -T AT386 -d /dev/vt02 -l console +v3:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT03 login: " -T AT386 -d /dev/vt03 -l console +v4:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT04 login: " -T AT386 -d /dev/vt04 -l console +---------------------->End Here<----------------------------------------------- +</verb> +These four lines enable four VT's on Alt-SysReq-F1 through Alt-SysReq-F4.<p> +Then execute the command '<tt>init q</tt>' to immediately enable the virtual +terminals.<p> +The keys used for VT switching are as follows:<p> +<quote> + <tt>Alt-SysReq-F1</tt> through <tt>Alt-SysReq-F7</tt> + enable VT screens 1-7 respectively + (if the VT is active).<p> + <tt>Alt-SysReq-n</tt> enables the next active VT screen.<p> + <tt>Alt-SysReq-p</tt> enables the previous active VT screen.<p> + <tt>Alt-SysReq-h</tt> returns to the console.<p> +</quote> +If you are using virtual terminals, you must leave at least one free for use by +the Xserver.<p> +Limitations of the virtual terminal sub-system under Solaris x86:<p> +There are only a total of 8 available VT's (7 normal VT's + 1 console) not the +usual 15. +If you have all 8 allocated, and you attempt to allocate a additional VT you +will panic the system. +(This bug is worked around in the Solaris XFree86 Xserver.)<p> +From a programming stand point, they work pretty much as documented in the +AT&T Unix System V/386 Release 4 Integrated Software Development Guide, +however a number of <tt>ioctl()</tt> calls are broken.<p> +<sect>Notes for building XFree86 on Solaris<p> +<enum> +<item> +Both GCC, and ProWorks are supported by XFree86. +The minimum recommended GCC release is 2.7.2. +Some earlier GCC's are known to not work and should be avoided.<p> +You should also make certain your version of GCC predefines `sun'. +If needed edit <tt>/usr/local/lib/gcc-lib/*/*/specs</tt>, and modify the +<tt>*predefines:</tt> line.<p> +On SPARCs, regardless of the compiler you use, ensure it generates 32-bit +binaries. +At this time, 64-bit binaries will probably not work.<p> +<item> +Also on SPARCs, you will need to set BuildXFree86OnSparcSunOS to YES in +~xc/config/cf/host.def. +Otherwise, you can only build the old deprecated Xsun* servers.<p> +<item> +A Threaded Xlib compiled with GCC has subtle problems. +It'll work 98% of the time, however clients will occasionally exhibit +strange hangs. +Most notably image viewers such as xv-3.10 exhibit this problem.<p> +It is recommended that you set ThreadedX in <tt>~xc/config/cf/host.def</tt> to +NO, if you are using GCC. +ProWorks does not have this problem. +Whether this behaviour still exists with newer GCC's has not been verified.<p> +<item> +To build XFree86 with GCC you need gcc and (optionally) c++filt from GNU +binutils. +Don't install gas or ld from GNU binutils, use the one provided by Sun.<p> +You might need to setup a /opt/SUNWspro/bin directory containing symbolic links +named <tt/cc/, <tt/CC/, and <tt/c++filt/ pointing respectively to the actual +<tt/gcc/, <tt/g++/ and <tt/c++filt/ commands.<p> +<item> +If you are using ProWorks to compile the XFree86 distribution, you need to +modify your PATH appropriately so the ProWorks tools are available. +Normally, they should be in <tt>/opt/SUNWspro/bin</tt><p> +<item> +You <bf>MUST</bf> put <tt>/usr/ccs/bin</tt> at the front of your PATH. +There are known problems with some GNU replacements for the utilities found +there. +So the <tt>/usr/ccs/bin</tt> versions of these programs must be found before +any possible GNU versions. +(Most notably GNU '<tt/ar/' does not work during the build).<p> +</enum> +<sect>Notes for running XFree86 on Solaris<p> +<enum> +<item> +Depending on the release or architecture of Solaris you are running, you might +need to install an OS driver for an aperture device.<p> +Under Solaris x86 2.5 and later, there's a system driver (<tt>/dev/xsvc</tt>) +that provides this functionality. +It will be detected automatically by the server, so you don't need to install +the aperture driver.<p> +For older Solaris x86 and for Solaris SPARC releases, the source for this +driver is included in +<tt>xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar</tt> of the source +distribution. +This file can usually also be found in the <tt>/usr/X11R6/lib/X11/etc</tt> +directory when XFree86 is installed. +Building, and installing the driver is relatively straight forward. Please read +its accompanying README file.<p> +<item> +If you have not made the Virtual Terminal devices, you will need to specify the +terminal device to run the Xserver on. +The correct device is vt00 so your <tt>xinit</tt> command would look like +so:<p> +<tscreen><verb> + xinit -- vt00 +</verb></tscreen> +If you have made the virtual terminal devices you do not need to specify the VT +to run the Xserver on.<p> +<item> +For Solaris you will probably want to set your LD_LIBRARY_PATH to +<tt>/usr/X11R6/lib:/usr/openwin/lib:/usr/dt/lib</tt>. +Including <tt>/usr/X11R6/lib</tt> in your LD_LIBRARY_PATH is probably not +necessary, however it doesn't hurt. :)<p> +Including <tt>/usr/openwin/lib</tt> in the LD_LIBRARY_PATH is recommended +because some Sun supplied binaries were not compiled with LD_RUN_PATH set +properly at compile time.<p> +Motif and CDE applications may require <tt>/usr/dt/lib</tt> in your +LD_LIBRARY_PATH too. +<item> +Xqueue is <bf>NOT</bf> supported under Solaris. +The includes necessary for Xqueue are available, however the driver does not +seem to be in the kernel. +(Go figure)<p> +<item> +If you want to use xdm with Solaris, extract the files from the shar file in +<tt>/usr/X11R6/lib/X11/etc/XdmConf.svr4</tt> into a temporary directory. +The <tt>README</tt> file tells where the individual files need to be installed. +Be sure to read through each file and make any site-specific changes that you +need.<p> +</enum> +<sect> Known bugs, and work arounds with Solaris<p> +<enum> +<item> +The Solaris 2.1 for x86 OpenWindows filemgr does not work against a X11R5 +Xserver, it probably will also not work against a X11R6 Xserver. +Attempting to 'Drag and Drop' a file causes the filemgr to abort with an +'X error'<p> +Solaris x86 2.4 does not have this problem.<p> +There is no known work around.<p> +<item> +The SPARC port is still quite new, so instability is to be expected (and +reported!). +It might even have broken some aspects of the x86 port.<p> +</enum> +<sect>Bug Notification<p> +Bug reports should be sent to one of the <bf/XFree86@XFree86.org/, +<bf>Xpert@XFree86.org</bf>, or <bf>Newbie@XFree86.org</bf> (depending on your +level of comfort). +<verb> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Solaris.sgml,v 1.2 2001/11/15 17:22:55 dawes Exp $ +</verb> +</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.29.2.2 xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.37 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.29.2.2 Fri Jun 1 14:09:49 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml Wed Jan 16 15:38:45 2002 @@ -6,10 +6,10 @@ <title>Driver Status for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>1 June 2001 +<date>16 January 2002 <ident> -$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/sgml/Status.sgml,v 1.37 2002/01/16 20:38:45 dawes Exp $ </ident> <abstract> @@ -60,16 +60,17 @@ cards is provided by the XF86_SVGA server with the tdfx driver. <tag>&relvers;:</tag> - 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 - library, which is not part of the XFree86 distribution). + Support for Voodoo Graphics and Voodoo2 chips is provided by the + "glide" driver (this requires version 2.x of the Glide library, + which is not part of the XFree86 distribution). Support (including acceleration) for Voodoo Banshee, Voodoo3, Voodoo4, and Voodoo5 is provided by the "tdfx" driver. <tag>Summary:</tag> - All hardware supported in &legacyvers; is also supported in &relvers;. + All hardware supported in &legacyvers; is also supported in + &relvers;. The Voodoo Graphics, Voodoo2, Voodoo4, and Voodoo5 are + supported only in &relvers;. </descrip> @@ -78,19 +79,20 @@ <descrip> <tag>&legacyvers;:</tag> Support (including acceleration) for GLINT 500TX (with IBM RGB526 - ramdac), GLINT MX plus Delta or Gamma (with IBM RGB526 and RGB640 - ramdacs), Permedia with IBM RGB526 RAMDAC, and Permedia 2, 2a, 2v + RAMDAC), GLINT MX plus Delta or Gamma (with IBM RGB526 and RGB640 + RAMDACs), Permedia with IBM RGB526 RAMDAC, and Permedia 2, 2a, 2v is provided by the XF86_3DLabs server. - <tag>&relvers;:</tag> - 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. + Support (including acceleration) for the Permedia series (including + 1, 2, 2a, 2v, 3, and 4) and GLINT series (including 300SX, 500TX, MX, + R3 and R4) with the Gamma, Gamma2 or Delta coprocessor is provided + by the "glint" driver. <tag>Summary:</tag> All hardware supported in &legacyvers; is also supported in &relvers;. - The Permedia 3 is only supported in &relvers;. + The Permedia 3, Permedia 4, GLINT R3, GLINT R4 and Gamma2 are + supported only in &relvers;. </descrip> @@ -98,18 +100,18 @@ <p> <descrip> <tag>&legacyvers;:</tag> - Support (including acceleration) for the AT24, AP6422, AT3D. - Support is provided by the XF86_SVGA server with the apm driver. + Support (including acceleration) for the AT24, AP6422, AT3D is + provided by the XF86_SVGA server with the apm driver. <tag>&relvers;:</tag> - Support (including acceleration?) for the AT24, AT25 and AT3D. - This support is provided by the "apm" driver. This driver - currently has only incomplete support for the AP6422. + Support (including acceleration) for the AT24, AT25 and AT3D is + provided by the "apm" driver. This driver currently has only + incomplete support for the AP6422. <tag>Summary:</tag> - The AP6422 is supported in &legacyvers; but not fully in - &relvers;. The AT25 is supported in &relvers; but not in - &legacyvers;. + The AP6422 is supported in &legacyvers; but not fully in &relvers;. + All other hardware supported in &legacyvers; is also supported in + &relvers;. The AT25 is supported only in &relvers;. </descrip> @@ -117,13 +119,12 @@ <p> <descrip> <tag>&legacyvers;:</tag> - Support (including acceleration) for the ARK1000PV, ARK2000PV, - and ARK2000MT. - Support is provided by the XF86_SVGA server with the ark driver. + Support (including acceleration) for the ARK1000PV, ARK2000PV, and + ARK2000MT is provided by the XF86_SVGA server with the ark driver. <tag>&relvers;:</tag> Support (including acceleration) for the ARK1000PV, ARK2000PV, - and ARK2000MT. Support is provided by the "ark" driver. + and ARK2000MT is provided by the "ark" driver. <tag>Summary:</tag> All hardware supported in &legacyvers; is also supported in &relvers;. @@ -149,15 +150,12 @@ <tag>&relvers;:</tag> 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. + Radeon chips by the "ati" driver, as is unaccelerated support for + all of the others except the Mach8 and some early Mach32 chips. <tag>Summary:</tag> - 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, Rage 128 and Radeon variants. + All hardware supported in &legacyvers; is also supported in + &relvers; except for Mach8 and some old Mach32 chips. </descrip> @@ -172,8 +170,8 @@ maintainer. <tag>&relvers;:</tag> - No native support for these chipsets, because the old drivers - have not been ported. + No Avance Logic chips are supported because the old drivers have + not been ported. <tag>Summary:</tag> No Avance Logic chips are supported in &relvers;. @@ -186,16 +184,17 @@ <tag>&legacyvers;:</tag> 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 XF86_SVGA server - with the chips driver. + and 64300 is provided by the XF86_SVGA server with the chips + driver. <tag>&relvers;:</tag> 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. + and 64300 is provided by the "chips" driver. <tag>Summary:</tag> - All hardware supported in &legacyvers; is also supported in &relvers;. + All hardware supported in &legacyvers; is also supported in + &relvers;. </descrip> @@ -236,15 +235,16 @@ XF86_TGA server. <tag>&relvers;:</tag> - No support for the Compaq AVGA (driver hasn't been ported). + No support exists for the Compaq AVGA (its driver hasn't been + ported). Support (accelerated) for the DEC 21030 TGA 8 plane, 24 plane and 24 plane 3D chips (only tested on Alpha platforms) is provided by the "tga" driver. <tag>Summary:</tag> - No Compaq AVGA support in &relvers;. DEC TGA support is equivalent - in both &legacyvers; and &relvers;. + No Compaq AVGA chips are supported in &relvers;. DEC TGA support + is equivalent in both &legacyvers; and &relvers;. </descrip> @@ -257,7 +257,8 @@ <tag>&relvers;:</tag> The &legacyvers; driver has been ported to &relvers;, including - acceleration, but feedback is needed. + acceleration support, and is provided by the "cyrix" driver. + Feedback is wanted. <tag>Summary:</tag> Cyrix MediaGX users are encouraged to test its support in @@ -273,8 +274,8 @@ XF86_SVGA server with the spc8100 driver. <tag>&relvers;:</tag> - No native support for this chipset, because the old driver - has not been ported. + No Epson chips are supported, because the old driver has not been + ported. <tag>Summary:</tag> No Epson chips are supported in &relvers;. @@ -291,8 +292,8 @@ has no maintainer. <tag>&relvers;:</tag> - No native support for this chipset, because the old driver - has not been ported. + No Genoa chips are supported, because the old driver has not been + ported. <tag>Summary:</tag> No Genoa chips are supported in &relvers;. @@ -333,8 +334,8 @@ provided by the XF86_AGX server. <tag>&relvers;:</tag> - No native support for these chipsets, because the old driver - has not been ported. + No IIT chips are supported, because the old driver has not been + ported. <tag>Summary:</tag> No IIT chips are supported in &relvers;. @@ -345,12 +346,12 @@ <p> <descrip> <tag>&legacyvers;:</tag> - Support (accelerated) for the IMS Twin Turbo 128 is provided by the - XF86_SVGA server with the imstt driver. + Support (accelerated) for the IMS Twin Turbo 128 and Twin Turbo 3D + is provided by the XF86_SVGA server with the imstt driver. <tag>&relvers;:</tag> - Support (accelerated) for the IMS Twin Turbo 128 is provided by the - "imstt" driver. + Support (accelerated) for the IMS Twin Turbo 128 and Twin Turbo 3D + is provided by the "imstt" driver. <tag>Summary:</tag> All hardware supported in &legacyvers; is also supported in &relvers;. @@ -362,22 +363,23 @@ <descrip> <tag>&legacyvers;:</tag> Support (accelerated) for the Intel i740 is provided by the - XF86_SVGA server with the i740 driver, and for the Intel i810 - with the i810 driver. The i810 is currently only supported on - 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 - (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 and recent FreeBSD/i386 platforms - at present. + XF86_SVGA server with the i740 driver, and for the Intel i810 with + the i810 driver. The i810 is supported only on 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 (including i810-dc100 and + i810e), i815, and i830 is provided by the "i810" driver. The + "i810" driver is currently supported only on Linux and FreeBSD (4.1 + and later), and requires AGP GART kernel support. + +<tag>Summary:</tag> + The i740 and and original i810 are supported in both versions, but + the i810 is supported only on Linux/x86 and recent FreeBSD/i386 + platforms at present. Support for later versions of the i810 + chipset, such as the i815, exists only in &relvers;. </descrip> @@ -391,15 +393,16 @@ <tag>&relvers;:</tag> 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. + (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200, + G400, G450, and G550 is provided by the "mga" driver. <tag>Summary:</tag> - All hardware supported in &legacyvers; is also supported in &relvers;. + All hardware supported in &legacyvers; is also supported in + &relvers;. The G450 and G550 are supported only in &relvers;. </descrip> -<sect>MX (???) +<sect>Micronix, Inc. (MX) <p> <descrip> <tag>&legacyvers;:</tag> @@ -409,11 +412,11 @@ this driver has no maintainer. <tag>&relvers;:</tag> - No native support for this chipset, because the old driver - has not been ported. + No MX chips are supported, because the old driver has not been + ported. <tag>Summary:</tag> - No MX (???) chips are supported in &relvers;. + No MX chips are supported in &relvers;. </descrip> @@ -427,8 +430,8 @@ reports. <tag>&relvers;:</tag> - No native support for this chipset, because the old driver - has not been ported. + No NCR chips are supported, because the old driver has not been + ported. <tag>Summary:</tag> No NCR chips are supported in &relvers;. @@ -450,7 +453,7 @@ <tag>Summary:</tag> All hardware supported in &legacyvers; is also supported in &relvers;. - The NM2230 and later chips are only supported in &relvers;. + The NM2230 and later chips are supported only in &relvers;. </descrip> @@ -464,13 +467,13 @@ <tag>&relvers;:</tag> Support (accelerated) for the Riva 128, 128ZX, TNT, TNT2 (Ultra, - Vanta, M64), GeForce (DDR, 256), GeForce2 (GTS, Ultra, MX), Quadro, - and Quadro2 is provided by the "nv" driver. + Vanta, M64), GeForce (DDR, 256), Quadro, GeForce2 (GTS, Ultra, + MX), GeForce3, and Quadro2 is provided by the "nv" driver. <tag>Summary:</tag> All chipsets supported in &legacyvers; except the NV1 are also - supported in &relvers;. Support for the newer chips (GeForce2 and - later) is only available in &relvers;. + supported in &relvers;. Support for the newer chips listed above + (starting with the GeForce2) is available only in &relvers;. </descrip> @@ -500,8 +503,8 @@ driver. <tag>&relvers;:</tag> - No native support for these chipsets, because the old driver - has not been ported. + No Oak chips are supported, because the old driver has not been + ported. <tag>Summary:</tag> No Oak chips are supported in &relvers;. @@ -519,8 +522,8 @@ recent test reports, and this driver has no maintainer. <tag>&relvers;:</tag> - No native support for these chipsets, because the old driver - has not been ported. + No Paradise/Western Digital chips are supported, because the old + driver has not been ported. <tag>Summary:</tag> No Paradise/Western Digital chips are supported in &relvers;. @@ -537,8 +540,8 @@ driver has no maintainer. <tag>&relvers;:</tag> - No native support for these chipsets, because the old driver - has not been ported. + No RealTek chips are supported, because the old driver has not been + ported. <tag>Summary:</tag> No RealTek chips are supported in &relvers;. @@ -567,27 +570,34 @@ <tag>&legacyvers;:</tag> Support (accelerated) for the S3 911, 924, 801, 805, 928, 864, 868, 964, 968, Trio32, Trio64, Trio64V+, Trio64UV+, Aurora64V+, - Trio64V2, PLATO/PX is provided by the XF86_S3 server and the + Trio64V2, and PLATO/PX is provided by the XF86_S3 server and the XF86_SVGA server with the s3_svga driver. Support (accelerated) for the ViRGE, ViRGE/VX, ViRGE/DX, ViRGE/GX, ViRGE/GX2, ViRGE/MX, ViRGE/MX+ is provided by the XF86_S3V server. Support - (accelerated) for those ViRGE chips, as well as the Trio3D and - Trio3D/2X is provided by the XF86_SVGA server with the s3v driver. + (accelerated) for the ViRGE chipsets, as well as the Trio3D and + Trio3D/2X, is provided by the XF86_SVGA server with the s3v driver. Support (accelerated) for the Savage3D, Savage3D/MV, Savage4, and Savage2000, is provided by the XF86_SVGA server with the s3_savage driver on some OSes (Linux, *BSD). <tag>&relvers;:</tag> - 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 Savage3D, - Savage3D/MV, Savage4, and Savage2000, is provided by the "savage" - driver. Support for the other S3 chipsets has not yet been ported. + Support (accelerated) for the 964 (revisions 0 and 1), 968, Trio32, + Trio64, Trio64, Trio64V+, Trio64UV+, Aurora64V+, Trio64V2, and + PLATO/PX is provided by the "s3" driver (however, only models using + the IBM RGB 524, Texas Instruments 3025, or an internal TrioDAC + RAMDAC chip are supported). 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 Savage3D, Savage3D/MV, Savage4, + Savage2000, and SuperSavage, is provided by the "savage" driver. + Support for the other S3 chipsets has not yet been ported. + +<tag>Summary:</tag> + All hardware supported in &legacyvers; is also supported in + &relvers; except for the 911, 924, 801, 805, 928, 864, and 868, and + versions of the 964 and 968 that do not use the RAMDAC chips listed + above. The SuperSavage chipset is supported only in &relvers;. -<tag>Summary:</tag> - Only the ViRGE, Trio3D and Savage chipsets are supported in &relvers;. - All of the other chipsets are only supported in &legacyvers;. - </descrip> <sect>Silicon Graphics, Inc. (SGI) @@ -597,8 +607,8 @@ No SGI hardware is supported in &legacyvers;. <tag>&relvers;:</tag> - Unaccelerated support for the SGI Indy's Newport cards is provided - by the "newport" driver. + Unaccelerated support for the SGI Indy's Newport (a.k.a. "XL") + cards is provided by the "newport" driver. <tag>Summary:</tag> SGI hardware is supported only in &relvers;. @@ -670,27 +680,42 @@ TVGA8200LX, TVGA8800CS, TVGA8900B, TVGA8900C, TVGA8900CL, TVGA8900D, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TGUI9400CXi, TGUI9420, TGUI9420DGi, TGUI9430DGi, TGUI9440AGi, - TGUI9660, TGUI9680, ProVidia 9682, ProVidia 9685, Cyber9320, - Cyber9382, Cyber9385, Cyber9388, Cyber9397, Cyber9520, Cyber9525, - 3DImage975, 3DImage985, Cyber9397/DVD, Blade3D, CyberBlade/i7, - CyberBlade/DSTN/i7 and CyberBlade/i1 is provided by the XF86_SVGA + TGUI9660, TGUI9680, ProVidia 9682, ProVidia 9685, 3DImage975, + 3DImage985, Blade3D, Cyber9320, Cyber9382, Cyber9385, Cyber9388, + Cyber9397, Cyber9397/DVD, Cyber9520, Cyber9525, CyberBlade/DSTN/i7, + CyberBlade/i1, and CyberBlade/i7 is provided by the XF86_SVGA server with the tvga8900 driver. <tag>&relvers;:</tag> - Support (accelerated where the chip supports it) for the TVGA8900D, - TGUI9440AGi, TGUI9660, TGUI9680, ProVidia 9682, ProVidia 9685, - Cyber9320, Cyber9382, Cyber9385, Cyber9388, Cyber9397, Cyber9397/DVD, - Cyber9520, Cyber9525/DVD, 3DImage975, 3DImage985, Blade3D, - CyberBlade/i7, CyberBlade/DSTN/i7, CyberBlade/i1, CyberBlade/DSTN/i1, - CyberBlade/Ai1, CyberBlade/DSTN/Ai1 and CyberBlade/e4 is provided - by the "trident" driver. + Support (accelerated where the chip supports it) for the + TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, + TVGA9100B, TVGA9200CXr, TVGA8900D, TGUI9440AGi, TGUI9660, + TGUI9680, ProVidia 9682, ProVidia 9685, 3DImage975, + 3DImage985, Blade3D, Cyber9320, Cyber9382, Cyber9385, + Cyber9388, Cyber9397, Cyber9397/DVD, Cyber9520, Cyber9525/DVD + CyberBlade/Ai1, CyberBlade/i7, CyberBlade/i1, + CyberBlade/DSTN/Ai1, CyberBlade/DSTN/i7, CyberBlade/DSTN/i1, + CyberBlade/e4, CyberBladeXP, BladeXP is provided by the + "trident" driver. + (NOTE: the old TVGA ISA/VLbus card support has not been + fully tested) + +<tag>Summary:</tag> + The following (older) chipsets are supported in &legacyvers; and + not in &relvers;: TVGA8200LX, TVGA8800CS, TVGA8900B, TVGA8900C, + TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, + TGUI9400CXi, TGUI9420, and TGUI9430DGi. + + The TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, + TVGA9100B, TVGA9200CXr, TGUI9400CXi, TGUI9440AGi, TGUI9660, + TGUI9680, ProVidia 9682, ProVidia 9685, 3DImage975, 3DImage985 + Blade3D, Cyber9320, Cyber9382, Cyber9385, Cyber9388, Cyber9397, + Cyber9397/DVD, CyberBlade/DSTN/i1, CyberBlade/DSTN/i7, + CyberBlade/i1 and CyberBlade/i7 are supported in both &legacyvers; + and &relvers;. -<tag>Summary:</tag> - The following (older) chipsets that are supported in &legacyvers; - are not supported in &relvers;: TVGA8200LX, TVGA8800CS, TVGA8900B, - TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, - TGUI9400CXi, TGUI9420, TGUI9430DGi. The remaining listed chipsets - are supported in &relvers;. + The CyberBlade/Ai1, CyberBlade/DSTN/Ai1, CyberBlade/e4, + CyberBladeXP, and BladeXP are supported only in &relvers;. </descrip> @@ -726,8 +751,8 @@ driver has no maintainer. <tag>&relvers;:</tag> - No native support for these chipsets, because the old driver - has not been ported. + No Video 7 chips are supported, because the old driver has not been + ported. <tag>Summary:</tag> No Video 7 chips are supported in &relvers;. @@ -743,8 +768,8 @@ XF86_SVGA server with the p9x00 driver. <tag>&relvers;:</tag> - No native support for these chipsets, because the old drivers - have not been ported. + No Weitek chips are supported, because the old drivers have not + been ported. <tag>Summary:</tag> No Weitek chips are supported in &relvers;. Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.1 xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.2 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.1 Wed Feb 7 13:49:31 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml Wed Jan 16 15:38:45 2002 @@ -7,10 +7,10 @@ <title>XFree86 Version Numbering Schemes <author>The XFree86 Project, Inc -<date>28 January 2001 +<date>16 January 2002 <ident> -$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/sgml/Versions.sgml,v 1.2 2002/01/16 20:38:45 dawes Exp $ </ident> <abstract> @@ -26,19 +26,22 @@ <p> As of the release of version 4.0.2 in December 2000, XFree86 has three -release branches. The main development stream is on the trunk of the -CVS repository. That is where all new development work is done. A -stable bugfix branch for the 4.0.2 release was created at the time of its -release, and that branch is called "<tt>xf-4_0_2-branch</tt>". -Fixes for bugs found in the 4.0.2 release will be added to this branch -(as well as the trunk). Similar stable branches will be created after -each full release. +release branches. First is trunk of the CVS repository. This is the +main development stream, where all new work and work for future releases +is done. + +Second is the stable bugfix branch for the latest full release +(&relvers;). It is created around the time of the release. The branch +for this one is called "<tt>&relbranchtag;</tt>". Fixes for bugs found +in the release will be added to this branch (as well as the trunk), and +updates to this release (if any) will be cut from this branch. Similar +stable branches are present for previous full releases. -Finally, there is the 3.3.x legacy branch, which is called +Finally there is the 3.3.x legacy branch, which is called "<tt>xf-3_3-branch</tt>". While this branch is not actively being maintained, it does include some important post-3.3.6 bug fixes and -security updates. Security updates in particular are usually back-ported -to this branch. +security updates. Relevant security updates in particular are usually +back-ported to this branch. XFree86 is planning to make full releases from the main development stream approximately every six months, in late May and November of each @@ -52,12 +55,15 @@ will not be full releases, and will consist of source code patches, plus binary updates to be layered on top of the previous full release. -The next full release will be version 4.1.0, scheduled for late May 2001. -The next update release will be 4.0.3. There is no specific schedule -for that, but it is expected to be available some time in February 2001. +The next full release will be version &nextfullrelvers;, tentatively scheduled for late &nextfullreldate;. +There is no scheduled update release. If there is one, the version will be +&nextupdrelvers;. + +<!-- The next release on the legacy branch will be 3.3.7. There is currently no schedule for that release. The 3.3.7 release is likely to be the final release on that branch. +--> Aside from actual releases, snapshots of the active release branches are tagged in the CVS repository from time to time. Each such snapshot @@ -67,8 +73,8 @@ <p> Starting with the main development branch after 4.0.2, the XFree86 -versions will be numbered according to the scheme outlined here. -Both the 4.0.2 stable branch and the 3.3.x legacy branch will continue +versions are numbered according to the scheme outlined here. +Both the 4.0.2 stable branch and the 3.3.x legacy branch continue to use the previous scheme, which is outlined in the sections below. The version numbering format is <tt>M.m.P.s</tt>, where <tt>M</tt> is @@ -86,8 +92,8 @@ for the main development branch is bumped to 99, and the snapshot number is reset. The snapshot number is incremented for each tagged development snapshot. The CVS tag for snapshots is "<tt>xf-M_m_P_s</tt>". When -the development branch enters feature freeze, the snapshot number is -bumped to 900, and a stable branch is created for the next full release. +the development branch enters feature freeze, the snapshot number may be +bumped to 900, and a stable branch may be created for the next full release. The branch is called "<tt>xf-M_m-branch</tt>". The snapshot number is incremented from there until the release is finalised. Each of these snapshots is a "release candidate". When the release is finalised, the @@ -298,6 +304,50 @@ Note: 4.0.3 and any other 4.0.x releases will continue with the <tt>Mmnn</tt> scheme. +The following is a code fragment taken from <tt>xdpyinfo.c</tt> that shows +how the <tt>VendorRelease</tt> information can be interpreted. + +<tscreen><verb> + + 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.x */ + printf("%d.%d.%d", vendrel / 10000000, + (vendrel / 100000) % 100, + (vendrel / 1000) % 100); + if (vendrel % 1000) { + printf(".%d", vendrel % 1000); + } + } + } +</verb></tscreen> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml:3.16 xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml:removed --- xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml:3.16 Wed Feb 23 15:30:16 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml Fri Jan 18 15:25:15 2002 @@ -1,1428 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> - -<!-- This is the Linux Distribution HOWTO, SGML source -- > -<!-- Eric S. Raymond, esr@snark.thyrsus.com -- > -<!-- The submission address is gregh@sunsite.unc.edu -- > - -<article> - -<title>XFree86 Video Timings HOWTO -<author>Eric S. Raymond <esr@thyrsus.com> -<date>Version 3.0, 8 Aug 1997 - -<abstract> -How to compose a mode line for your card/monitor combination under XFree86. -The XFree86 distribution now includes good facilities for configuring most -standard combinations; this document is mainly useful if you are tuning a -custom mode line for a high-performance monitor or very unusual hardware. -It may also help you in using xvidtune to tweak a standard mode that is -not quite right for your monitor. -</abstract> - -<toc> - -<sect>Disclaimer -<p> - -You use the material herein SOLELY AT YOUR OWN RISK. It is possible -to harm both your monitor and yourself when driving it outside the -manufacturer's specs. Read <ref id="overd" name="Overdriving Your -Monitor"> for detailed cautions. Any damages to you or your monitor -caused by overdriving it are your problem. - -The most up-to-date version of this HOWTO can be found at the <url -url="http://sunsite.unc.edu/LDP" -name="Linux Documentation Project"> web page. - -Please direct comments, criticism, and suggestions for improvement to -<htmlurl url="mailto:esr@thyrsus.com" name="esr@snark.thyrsus.com">. Please do -<em>not</em> send email pleading for a magic solution to your -special monitor problem, as doing so will only burn up my time and -frustrate you -- everything I know about the subject is already in -here. - -<sect>Introduction<label id="intro"> -<p> - -The XFree86 server allows users to configure their video subsystem and thus -encourages best use of existing hardware. This tutorial is intended to help -you learn how to generate your own timing numbers to make optimum use of your -video card and monitor. - -We'll present a method for getting something that works, and then show you how -you can experiment starting from that base to develop settings that optimize -for your taste. - -Starting with XFree86 3.2, XFree86 provides an <bf>XF86Setup</bf>(1) -program that makes it easy to generate a working monitor mode -interactively, without messing with video timing number directly. So -you shouldn't actually need to calculate a base monitor mode in most -cases. Unfortunately, <bf>XF86Setup</bf>(1) has some limitations; it -only knows about standard video modes up to 1280x1024. If you have a -very high-performance monitor capable of 1600x1200 or more you will -still have to compute your base monitor mode yourself. - -Recent versions of XFree86 provide a tool called <bf>xvidtune</bf>(1) -which you will probably find quite useful for testing and tuning -monitor modes. It begins with a gruesome warning about the possible -consequences of mistakes with it. If you pay careful attention to -this document and learn what is behind the pretty numbers in -xvidtune's boxes, you will become able to use xvidtune effectively and -with confidence. - -If you already have a mode that almost works (in particular, if one of -predefined VESA modes gives you a stable display but one that's -displaced right or left, or too small, or too large) you can go -straight to the section on <ref id="fixes" name="Fixing Problems with the -Image">. This will enlighten you on ways to tweak the timing -numbers to achieve particular effects. - -If you have <bf>xvidtune</bf>(1), you'll be able to test new modes on the fly, -without modifying your X configuration files or even rebooting your X server. -Otherwise, XFree86 allows you to hot-key between different modes defined in -Xconfig (see XFree86.man for details). Use this capabilty to save -yourself hassles! When you want to test a new mode, give it a unique -mode label and add it to the <EM>end</EM> of your hot-key list. Leave a -known-good mode as the default to fall back on if the test mode -doesn't work. - -<sect>How Video Displays Work<label id="video"> -<p> - -Knowing how the display works is essential to understanding what numbers to put -in the various fields in the file Xconfig. Those values are used in the lowest -levels of controlling the display by the XFree86 server. - -The display generates a picture from a series of dots. The dots are arranged -from left to right to form lines. The lines are arranged from top to bottom to -form the picture. The dots emit light when they are struck by the electron -beam inside the display. To make the beam strike each dot for an equal amount -of time, the beam is swept across the display in a constant pattern. - -The pattern starts at the top left of the screen, goes across the screen to the -right in a straight line, and stops temporarily on the right side of the -screen. Then the beam is swept back to the left side of the display, but down -one line. The new line is swept from left to right just as the first line was. -This pattern is repeated until the bottom line on the display has been swept. -Then the beam is moved from the bottom right corner of the display to the top -left corner, and the pattern is started over again. - -There is one variation of this scheme known as interlacing: here only -every second line is swept during one half-frame and the others are filled in -in during a second half-frame. - -Starting the beam at the top left of the display is called the beginning of a -frame. The frame ends when the beam reaches the the top left corner again as -it comes from the bottom right corner of the display. A frame is made up of -all of the lines the beam traced from the top of the display to the bottom. - -If the electron beam were on all of the time it was sweeping through the frame, -all of the dots on the display would be illuminated. There would be no black -border around the edges of the display. At the edges of the display the -picture would become distorted because the beam is hard to control there. To -reduce the distortion, the dots around the edges of the display are not -illuminated by the beam even though the beam may be pointing at them. The -viewable area of the display is reduced this way. - -Another important thing to understand is what becomes of the beam when no spot -is being painted on the visible area. The time the beam would have been -illuminating the side borders of the display is used for sweeping the beam back -from the right edge to the left and moving the beam down to the next line. The -time the beam would have been illuminating the top and bottom borders of the -display is used for moving the beam from the bottom-right corner of the display -to the top-left corner. - -The adapter card generates the signals which cause the display to turn on the -electron beam at each dot to generate a picture. The card also controls when -the display moves the beam from the right side to the left and down a line by -generating a signal called the horizontal sync (for synchronization) pulse. -One horizontal sync pulse occurs at the end of every line. The adapter also -generates a vertical sync pulse which signals the display to move the beam to -the top-left corner of the display. A vertical sync pulse is generated near -the end of every frame. - -The display requires that there be short time periods both before and after the -horizontal and vertical sync pulses so that the position of the electron beam -can stabilize. If the beam can't stabilize, the picture will not be steady. - -In a later section, we'll come back to these basics with definitions, -formulas and examples to help you use them. - -<sect>Basic Things to Know about your Display and Adapter<label id="basic"> -<p> - -There are some fundamental things you need to know before hacking an Xconfig -entry. These are: - -<itemize> -<item>your monitor's horizontal and vertical sync frequency options -<item>your video adapter's driving clock frequency, or "dot clock" -<item>your monitor's bandwidth -</itemize> -The monitor sync frequencies: - -The horizontal sync frequency is just the number of times per second the -monitor can write a horizontal scan line; it is the single most important -statistic about your monitor. The vertical sync frequency is the number of -times per second the monitor can traverse its beam vertically. - -Sync frequencies are usually listed on the specifications page of your monitor -manual. The vertical sync frequency number is typically calibrated in Hz -(cycles per second), the horizontal one in KHz (kilocycles per second). The -usual ranges are between 50 and 150Hz vertical, and between 31 and 135KHz -horizontal. - -If you have a multisync monitor, these frequencies will be given as ranges. -Some monitors, especially lower-end ones, have multiple fixed frequencies. -These can be configured too, but your options will be severely limited by the -built-in monitor characteristics. Choose the highest frequency pair for best -resolution. And be careful --- trying to clock a fixed-frequency monitor at a -higher speed than it's designed for can easily damage it. - -Earlier versions of this guide were pretty cavalier about overdriving -multisync monitors, pushing them past their nominal highest vertical -sync frequency in order to get better performance. We have since had more -reasons pointed out to us for caution on this score; we'll cover those under -<ref id="overd" name="Overdriving Your Monitor"> below. - -The card driving clock frequency: - -Your video adapter manual's spec page will usually give you the card's dot -clock (that is, the total number of pixels per second it can write to the -screen). If you don't have this information, the X server will get it for -you. Even if your X locks up your monitor, it will emit a line of clock and -other info to standard output. If you redirect this to a file, it should be -saved even if you have to reboot to get your console back. (Recent versions -of the X servers allsupport a --probeonly option that prints out this -information and exits without actually starting up X or changing the -video mode.) - -Your X startup message should look something like one of the following -examples: - -If you're using XFree86: - -<tscreen><verb> -Xconfig: /usr/X11R6/lib/X11/Xconfig -(**) stands for supplied, (--) stands for probed/default values -(**) Mouse: type: MouseMan, device: /dev/ttyS1, baudrate: 9600 -Warning: The directory "/usr/andrew/X11fonts" does not exist. - Entry deleted from font path. -(**) FontPath set to "/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/" -(--) S3: card type: 386/486 localbus -(--) S3: chipset: 924 - --- - Chipset -- this is the exact chip type; an early mask of the 86C911 - -(--) S3: chipset driver: s3_generic -(--) S3: videoram: 1024k - ----- - Size of on-board frame-buffer RAM - -(**) S3: clocks: 25.00 28.00 40.00 3.00 50.00 77.00 36.00 45.00 -(**) S3: clocks: 0.00 0.00 79.00 31.00 94.00 65.00 75.00 71.00 - ------------------------------------------------------ - Possible driving frequencies in MHz - -(--) S3: Maximum allowed dot-clock: 110MHz - ------ - Bandwidth -(**) S3: Mode "1024x768": mode clock = 79.000, clock used = 79.000 -(--) S3: Virtual resolution set to 1024x768 -(--) S3: Using a banksize of 64k, line width of 1024 -(--) S3: Pixmap cache: -(--) S3: Using 2 128-pixel 4 64-pixel and 8 32-pixel slots -(--) S3: Using 8 pages of 768x255 for font caching -</verb></tscreen> - -If you're using SGCS or X/Inside X: - -<tscreen><verb> -WGA: 86C911 (mem: 1024k clocks: 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71) ---- ------ ----- -------------------------------------------- - | | | Possible driving frequencies in MHz - | | +-- Size of on-board frame-buffer RAM - | +-- Chip type - +-- Server type -</verb></tscreen> - -Note: do this with your machine unloaded (if at all possible). Because X is -an application, its timing loops can collide with disk activity, rendering the -numbers above inaccurate. Do it several times and watch for the numbers to -stabilize; if they don't, start killing processes until they do. SVr4 users: -the mousemgr process is particularly likely to mess you up. - -In order to avoid the clock-probe inaccuracy, you should clip out the clock -timings and put them in your Xconfig as the value of the Clocks property --- -this suppresses the timing loop and gives X an exact list of the clock values -it can try. Using the data from the example above: - -<tscreen><verb> -wga - Clocks 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71 -</verb></tscreen> -On systems with a highly variable load, this may help you avoid mysterious X -startup failures. It's possible for X to come up, get its timings wrong due -to system load, and then not be able to find a matching dot clock in its -config database --- or find the wrong one! - -<sect1>The monitor's video bandwidth: -<p> - -If you're running XFree86, your server will probe your card and tell you -what your highest-available dot clock is. - -Otherwise, your highest available dot clock is approximately the monitor's -video bandwidth. There's a lot of give here, though --- some monitors -can run as much as 30% over their nominal bandwidth. The risks here have -to do with exceeding the monitor's rated vertical-sync frequency; we'll -discuss them in detail below. - -Knowing the bandwidth will enable you to make more intelligent choices -between possible configurations. It may affect your display's visual -quality (especially sharpness for fine details). - -Your monitor's video bandwidth should be included on the manual's spec page. -If it's not, look at the monitor's higest rated resolution. As a rule of -thumb, here's how to translate these into bandwidth estimates (and thus into -rough upper bounds for the dot clock you can use): - -<tscreen><verb> - 640x480 25 - 800x600 36 - 1024x768 65 - 1024x768 interlaced 45 - 1280x1024 110 - 1600x1200 185 -</verb></tscreen> - -BTW, there's nothing magic about this table; these numbers are just -the lowest dot clocks per resolution in the standard XFree86 Modes -database (except for the last, which I interpolated). The bandwidth -of your monitor may actually be higher than the minimum needed for its -top resolution, so don't be afraid to try a dot clock a few MHz -higher. - -Also note that bandwidth is seldom an issue for dot clocks under 65MHz -or so. With an SVGA card and most hi-res monitors, you can't get -anywhere near the limit of your monitor's video bandwidth. The -following are examples: - -<tscreen><verb> - Brand Video Bandwidth - ---------- --------------- - NEC 4D 75Mhz - Nano 907a 50Mhz - Nano 9080i 60Mhz - Mitsubishi HL6615 110Mhz - Mitsubishi Diamond Scan 100Mhz - IDEK MF-5117 65Mhz - IOCOMM Thinksync-17 CM-7126 136Mhz - HP D1188A 100Mhz - Philips SC-17AS 110Mhz - Swan SW617 85Mhz - Viewsonic 21PS 185Mhz -</verb></tscreen> -Even low-end monitors usually aren't terribly bandwidth-constrained for their -rated resolutions. The NEC Multisync II makes a good example --- it can't -even display 800x600 per its spec. It can only display 800x560. For such low -resolutions you don't need high dot clocks or a lot of bandwidth; probably the -best you can do is 32Mhz or 36Mhz, both of them are still not too far from the -monitor's rated video bandwidth of 30Mhz. - -At these two driving frequencies, your screen image may not be as sharp as it -should be, but definitely of tolerable quality. Of course it would be nicer if -NEC Multisync II had a video bandwidth higher than, say, 36Mhz. But this is -not critical for common tasks like text editing, as long as the difference is -not so significant as to cause severe image distortion (your eyes would tell -you right away if this were so). - -<sect1>What these control: -<p> - -The sync frequency ranges of your monitor, together with your video adapter's -dot clock, determine the ultimate resolution that you can use. But it's up to -the driver to tap the potential of your hardware. A superior hardware -combination without an equally competent device driver is a waste of money. -On the other hand, with a versatile device driver but less capable hardware, -you can push the hardware's envelope a little. This is the design philosophy -of XFree86. - -<sect>Interpreting the Basic Specifications<label id="specs"> -<p> - -This section explains what the specifications above mean, and some other -things you'll need to know. First, some definitions. Next to each in parens -is the variable name we'll use for it when doing calculations - -<descrip> -<tag/horizontal sync frequency (HSF)/ - Horizontal scans per second (see above). - -<tag/vertical sync frequency (VSF) / - Vertical scans per second (see above). Mainly important as the upper - limit on your refresh rate. - -<tag/dot clock (DCF)/ - More formally, `driving clock frequency'; The frequency of the - crystal or VCO on your adaptor --- the maximum dots-per-second it can - emit. - -<tag/video bandwidth (VB)/ - The highest frequency you can feed into your monitor's video - input and still expect to see anything discernible. If your adaptor - produces an alternating on/off pattern, its lowest frequency is half - the DCF, so in theory bandwidth starts making sense at DCF/2. For - tolerately crisp display of fine details in the video image, however, - you don't want it much below your highest DCF, and preferably higher. - -<tag/frame length (HFL, VFL)/ - Horizontal frame length (HFL) is the number of dot-clock ticks - needed for your monitor's electron gun to scan one horizontal line, - <em>including the inactive left and right borders</em>. Vertical - frame length (VFL) is the number of scan lines in the - <em>entire</em> image, including the inactive top and bottom - borders. - -<tag/screen refresh rate (RR)/ - The number of times per second your screen is repainted (this is - also called "frame rate"). Higher frequencies are better, as they - reduce flicker. 60Hz is good, VESA-standard 72Hz is better. - Compute it as -<tscreen><verb> - RR = DCF / (HFL * VFL) -</verb></tscreen> - - Note that the product in the denominator is <em>not</em> the same - as the monitor's visible resolution, but typically somewhat larger. - We'll get to the details of this below. - -The rates for which interlaced modes are usually specified (like 87Hz -interlaced) are actually the half-frame rates: an entire screen seems -to have about that flicker frequency for typical displays, but every -single line is refreshed only half as often. - -For calculation purposes we reckon an interlaced display at its -full-frame (refresh) rate, i.e. 43.5Hz. The quality of an interlaced -mode is better than that of a non-interlaced mode with the same -full-frame rate, but definitely worse then the non-interlaced one -corresponding to the half-frame rate. -</descrip> - -<sect1>About Bandwidth: -<p> - -Monitor makers like to advertise high bandwidth because it constrains the -sharpness of intensity and color changes on the screen. A high bandwidth -means smaller visible details. - -Your monitor uses electronic signals to present an image to -your eyes. Such signals always come in in wave form once they are converted -into analog form from digitized form. They can be considered as combinations -of many simpler wave forms each one of which has a fixed frequency, many of -them are in the Mhz range, eg, 20Mhz, 40Mhz, or even 70Mhz. Your monitor -video bandwidth is, effectively, the highest-frequency analog signal it can -handle without distortion. - -For our purposes, bandwidth is mainly important as an approximate cutoff point -for the highest dot clock you can use. - -<sect1>Sync Frequencies and the Refresh Rate: -<p> - -Each horizontal scan line on the display is just the visible portion of a -frame-length scan. At any instant there is actually only one dot active on -the screen, but with a fast enough refresh rate your eye's persistence of -vision enables you to "see" the whole image. - -Here are some pictures to help: - -<code> - _______________________ - | | The horizontal sync frequency - |->->->->->->->->->->-> | is the number of times per - | )| second that the monitor's - |<-----<-----<-----<--- | electron beam can trace - | | a pattern like this - | | - | | - | | - |_______________________| - _______________________ - | ^ | The vertical sync frequency - | ^ | | is the number of times per - | | v | second that the monitor's - | ^ | | electron beam can trace - | | | | a pattern like this - | ^ | | - | | v | - | ^ | | - |_______|_v_____________| -</code> - -Remember that the actual raster scan is a very tight zigzag pattern; that is, -the beam moves left-right and at the same time up-down. - -Now we can see how the dot clock and frame size relates to refresh rate. By -definition, one hertz (hz) is one cycle per second. So, if your horizontal -frame length is HFL and your vertical frame length is VFL, then to cover the -entire screen takes (HFL * VFL) ticks. Since your card emits DCF ticks per -second by definition, then obviously your monitor's electron gun(s) can sweep -the screen from left to right and back and from bottom to top and back DCF / -(HFL * VFL) times/sec. This is your screen's refresh rate, because it's how -many times your screen can be updated (thus <em>refreshed</em>) per second! - -You need to understand this concept to design a configuration which trades off -resolution against flicker in whatever way suits your needs. - -For those of you who handle visuals better than text, here is one: - -<code> - RR VB - | min HSF max HSF | - | | R1 R2 | | -max VSF -+----|------------/----------/---|------+----- max VSF - | |:::::::::::/::::::::::/:::::\ | - | \::::::::::/::::::::::/:::::::\ | - | |::::::::/::::::::::/:::::::::| | - | |:::::::/::::::::::/::::::::::\ | - | \::::::/::::::::::/::::::::::::\ | - | \::::/::::::::::/::::::::::::::| | - | |::/::::::::::/:::::::::::::::| | - | \/::::::::::/:::::::::::::::::\| - | /\:::::::::/:::::::::::::::::::| - | / \:::::::/::::::::::::::::::::|\ - | / |:::::/:::::::::::::::::::::| | - | / \::::/::::::::::::::::::::::| \ -min VSF -+----/-------\--/-----------------------|--\--- min VSF - | / \/ | \ - +--/----------/\------------------------+----\- DCF - R1 R2 \ | \ - min HSF | max HSF - VB -</code> - -This is a generic monitor mode diagram. The x axis of the diagram -shows the clock rate (DCF), the y axis represents the refresh rate -(RR). The filled region of the diagram describes the monitor's -capabilities: every point within this region is a possible video -mode. - -The lines labeled `R1' and `R2' represent a fixed resolutions (such as -640x480); they are meant to illustrate how one resolution can be realized -by many different combinations of dot clock and refresh rate. The R2 -line would represent a higher resolution than R1. - -The top and bottom boundaries of the permitted region are simply -horizontal lines representing the limiting values for the vertical sync -frequency. The video bandwidth is an upper limit to the clock rate and -hence is represented by a vertical line bounding the capability region on -the right. - -Under <ref id="cplot" name="Plotting Monitor Capabilities">) you'll -find a program that will help you plot a diagram like -this (but much nicer, with X graphics) for your individual monitor. -That section also discusses the interesting part; the derivation of -the boundaries resulting from the limits on the horizontal sync -frequency. - -<sect>Tradeoffs in Configuring your System<label id="trade"> -<p> - -Another way to look at the formula we derived above is - -<tscreen><verb> - DCF = RR * HFL * VFL -</verb></tscreen> -That is, your dot clock is fixed. You can use those dots per second to buy -either refresh rate, horizontal resolution, or vertical resolution. If one -of those increases, one or both of the others must decrease. - -Note, though, that your refresh rate cannot be greater than the maximum -vertical sync frequency of your monitor. Thus, for any given monitor at a -given dot clock, there is a minimum product of frame lengths below which you -can't force it. - -In choosing your settings, remember: if you set RR too low, you will get -mugged by screen flicker. - -You probably do not want to pull your refresh rate below 60Hz. This is the -flicker rate of fluorescent lights; if you're sensitive to those, you need -to hang with 72Hz, the VESA ergonomic standard. - -Flicker is very eye-fatiguing, though human eyes are adaptable and peoples' -tolerance for it varies widely. If you face your monitor at a 90% viewing -angle, are using a dark background and a good contrasting color for -foreground, and stick with low to medium intensity, you *may* be comfortable -at as little as 45Hz. - -The acid test is this: open a xterm with pure white back-ground and black -foreground using <TT>xterm -bg white -fg black</TT> and make it so large as -to cover the entire viewable area. Now turn your monitor's intensity to 3/4 of -its maximum setting, and turn your face away from the monitor. Try peeking at -your monitor sideways (bringing the more sensitive peripheral-vision cells into -play). If you don't sense any flicker or if you feel the flickering is -tolerable, then that refresh rate is fine with you. Otherwise you better -configure a higher refresh rate, because that semi-invisible flicker is going -to fatigue your eyes like crazy and give you headaches, even if the screen -looks OK to normal vision. - -For interlaced modes, the amount of flicker depends on more factors -such as the current vertical resolution and the actual screen -contents. So just experiment. You won't want to go much below about -85Hz half frame rate, though. - -So let's say you've picked a minimum acceptable refresh rate. In choosing -your HFL and VFL, you'll have some room for maneuver. - -<sect>Memory Requirements<label id="sizes"> -<p> - -Available frame-buffer RAM may limit the resolution you can achieve on color or -gray-scale displays. It probably isn't a factor on displays that have only two -colors, white and black with no shades of gray in between. - -For 256-color displays, a byte of video memory is required for each visible -dot to be shown. This byte contains the information that determines what mix -of red, green, and blue is generated for its dot. To get the amount of memory -required, multiply the number of visible dots per line by the number of -visible lines. For a display with a resolution of 800x600, this would be 800 -x 600 = 480,000, which is the number of visible dots on the display. This is -also, at one byte per dot, the number of bytes of video memory that are -necessary on your adapter card. - -Thus, your memory requirement will typically be (HR * VR)/1024 Kbytes of VRAM, -rounded up. If you have more memory than strictly required, you'll have extra -for virtual-screen panning. - -However, if you only have 512K on board, then you can't use this -resolution. Even if you have a good monitor, without enough video -RAM, you can't take advantage of your monitor's potential. On the -other hand, if your SVGA has one meg, but your monitor can display at -most 800x600, then high resolution is beyond your reach anyway (see -<ref id="inter" name="Using Interlaced Modes"> for a possible -remedy). - -Don't worry if you have more memory than required; XFree86 will make -use of it by allowing you to scroll your viewable area (see the -Xconfig file documentation on the virtual screen size parameter). -Remember also that a card with 512K bytes of memory really doesn't -have 512,000 bytes installed, it has 512 x 1024 = 524,288 bytes. - -If you're running SGCS X (now called X/Inside) using an S3 card, and -are willing to live with 16 colors (4 bits per pixel), you can set -depth 4 in Xconfig and effectively double the resolution your card can -handle. S3 cards, for example, normally do 1024x768x256. You can -make them do 1280x1024x16 with depth 4. - -<sect>Computing Frame Sizes<label id="frame"> -<p> - -Warning: this method was developed for multisync monitors. It will probably -work with fixed-frequency monitors as well, but no guarantees! - -Start by dividing DCF by your highest available HSF to get a horizontal -frame length. - -For example; suppose you have a Sigma Legend SVGA with a 65MHz dot clock, and -your monitor has a 55KHz horizontal scan frequency. The quantity (DCF / HSF) -is then 1181 (65MHz = 65000KHz; 65000/55 = 1181). - -Now for our first bit of black magic. You need to round this figure to the -nearest multiple of 8. This has to do with the VGA hardware controller used by -SVGA and S3 cards; it uses an 8-bit register, left-shifted 3 bits, for what's -really an 11-bit quantity. Other card types such as ATI 8514/A may not have -this requirement, but we don't know and the correction can't hurt. So round -the usable horizontal frame length figure down to 1176. - -This figure (DCF / HSF rounded to a multiple of 8) is the minimum HFL you can -use. You can get longer HFLs (and thus, possibly, more horizontal dots on the -screen) by setting the sync pulse to produce a lower HSF. But you'll pay with -a slower and more visible flicker rate. - -As a rule of thumb, 80% of the horizontal frame length is available for -horizontal resolution, the visible part of the horizontal scan line (this -allows, roughly, for borders and sweepback time -- that is, the time required -for the beam to move from the right screen edge to the left edge of the next -raster line). In this example, that's 944 ticks. - -Now, to get the normal 4:3 screen aspect ratio, set your vertical resolution -to 3/4ths of the horizontal resolution you just calculated. For this -example, that's 708 ticks. To get your actual VFL, multiply that by 1.05 -to get 743 ticks. - -The 4:3 is not technically magic; nothing prevents you from using a -non-Golden-Section ratio if that will get the best use out of your -screen real estate. It does make figuring frame height and frame -width from the diagonal size convenient, you just multiply the -diagonal by by 0.8 to get width and 0.6 to get height. - -So, HFL=1176 and VFL=743. Dividing 65MHz by the product of the two gives -us a nice, healthy 74.4Hz refresh rate. Excellent! Better than VESA standard! -And you got 944x708 to boot, more than the 800 by 600 you were probably -expecting. Not bad at all! - -You can even improve the refresh rate further, to almost 76 Hz, by using the -fact that monitors can often sync horizontally at 2khz or so higher than rated, -and by lowering VFL somewhat (that is, taking less than 75% of 944 in the -example above). But before you try this "overdriving" maneuver, if you do, -make <em>sure</em> that your monitor electron guns can sync up to 76 Hz -vertical. (the popular NEC 4D, for instance, cannot. It goes only up to 75 Hz -VSF). (See <ref id="overd" name="Overdriving Your Monitor"> for more general -discussion of this issue. ) - -So far, most of this is simple arithmetic and basic facts about raster -displays. Hardly any black magic at all! - -<sect>Black Magic and Sync Pulses<label id="magic"> -<p> - -OK, now you've computed HFL/VFL numbers for your chosen dot clock, found the -refresh rate acceptable, and checked that you have enough VRAM. Now for the -real black magic -- you need to know when and where to place synchronization -pulses. - -The sync pulses actually control the horizontal and vertical scan frequebcies -of the monitor. The HSF and VSF you've pulled off the spec sheet are nominal, -approximate maximum sync frequencies. The sync pulse in the signal from the -adapter card tells the monitor how fast to actually run. - -Recall the two pictures above? Only part of the time required for -raster-scanning a frame is used for displaying viewable image (ie. your -resolution). - -<sect1>Horizontal Sync: -<p> - -By previous definition, it takes HFL ticks to trace the a horizontal scan line. -Let's call the visible tick count (your horizontal screen resolution) HR. Then -Obviously, HR < HFL by definition. For concreteness, let's assume both start -at the same instant as shown below: -<code> - |___ __ __ __ __ __ __ __ __ __ __ __ __ - |_ _ _ _ _ _ _ _ _ _ _ _ | - |_______________________|_______________|_____ - 0 ^ ^ unit: ticks - | ^ ^ | - HR | | HFL - | |<----->| | - |<->| HSP |<->| - HGT1 HGT2 -</code> - -Now, we would like to place a sync pulse of length HSP as shown above, ie, -between the end of clock ticks for display data and the end of clock ticks for -the entire frame. Why so? because if we can achieve this, then your screen -image won't shift to the right or to the left. It will be where it supposed to -be on the screen, covering squarely the monitor's viewable area. - -Furthermore, we want about 30 ticks of "guard time" on either side of the sync -pulse. This is represented by HGT1 and HGT2. In a typical configuration HGT1 -!= HGT2, but if you're building a configuration from scratch, you want to start -your experimentation with them equal (that is, with the sync pulse centered). - -The symptom of a misplaced sync pulse is that the image is displaced on the -screen, with one border excessively wide and the other side of the image -wrapped around the screen edge, producing a white edge line and a band of -"ghost image" on that side. A way-out-of-place vertical sync pulse can -actually cause the image to roll like a TV with a mis-adjusted vertical hold -(in fact, it's the same phenomenon at work). - -If you're lucky, your monitor's sync pulse widths will be documented on its -specification page. If not, here's where the real black magic starts... - -You'll have to do a little trial and error for this part. But most of the -time, we can safely assume that a sync pulse is about 3.5 to 4.0 microsecond -in length. - -For concretness again, let's take HSP to be 3.8 microseconds (which btw, is not -a bad value to start with when experimenting). - -Now, using the 65Mhz clock timing above, we know HSP is equivalent to 247 clock -ticks (= 65 * 10**6 * 3.8 * 10^-6) [recall M=10^6, micro=10^-6] - -Some makers like to quote their horizontal framing parameters as timings rather -than dot widths. You may see the following terms: -<descrip> -<tag/active time (HAT)/ - Corresponds to HR, but in milliseconds. HAT * DCF = HR. -<tag/blanking time (HBT)/ - Corresponds to (HFL - HR), but in milliseconds. HBT * DCF = (HFL - - HR). -<tag/front porch (HFP)/ - This is just HGT1. -<tag/sync time/ - This is just HSP. -<tag/back porch (HBP)/ - This is just HGT2. -</descrip> - -<sect1>Vertical Sync: -<p> - -Going back to the picture above, how do we place the 247 clock ticks as shown -in the picture? - -Using our example, HR is 944 and HFL is 1176. The difference between the two -is 1176 - 944=232 < 247! Obviously we have to do some adjustment here. What -can we do? - -The first thing is to raise 1176 to 1184, and lower 944 to 936. Now the -difference = 1184-936= 248. Hmm, closer. - -Next, instead using 3.8, we use 3.5 for calculating HSP; then, we have -65*3.5=227. Looks better. But 248 is not much higher than 227. It's normally -necessary to have 30 or so clock ticks between HR and the start of SP, and the -same for the end of SP and HFL. AND they have to be multiple of eight! Are we -stuck? - -No. Let's do this, 936 % 8 = 0, (936 + 32) % 8 = 0 too. But 936 + 32 = 968, -968 + 227 = 1195, 1195 + 32 = 1227. Hmm.. this looks not too bad. But it's -not a multiple of 8, so let's round it up to 1232. - -But now we have potential trouble, the sync pulse is no longer placed right in -the middle between h and H any more. Happily, using our calculator we find -1232 - 32 = 1200 is also a multiple of 8 and (1232 - 32) - 968 = 232 -corresponding using a sync pulse of 3.57 micro second long, still -reasonable. - -In addition, 936/1232 ~ 0.76 or 76%, still not far from 80%, so it should be -all right. - -Furthermore, using the current horizontal frame length, we basically ask our -monitor to sync at 52.7khz (= 65Mhz/1232) which is within its capability. No -problems. - -Using rules of thumb we mentioned before, 936*75%=702, This is our new vertical -resolution. 702 * 1.05 = 737, our new vertical frame length. - -Screen refresh rate = 65Mhz/(737*1232)=71.6 Hz. This is still excellent. - -Figuring the vertical sync pulse layout is similar: -<code> - |___ __ __ __ __ __ __ __ __ __ __ __ __ - |_ _ _ _ _ _ _ _ _ _ _ _ | - |_______________________|_______________|_____ - 0 VR VFL unit: ticks - ^ ^ ^ - | | | - |<->|<----->| - VGT VSP -</code> - -We start the sync pulse just past the end of the vertical display data ticks. -VGT is the vertical guard time required for the sync pulse. Most monitors are -comfortable with a VGT of 0 (no guard time) and we'll use that in this -example. A few need two or three ticks of guard time, and it usually doesn't -hurt to add that. - -Returning to the example: since by the defintion of frame length, a vertical -tick is the time for tracing a complete HORIZONTAL frame, therefore in our -example, it is 1232/65Mhz=18.95us. - -Experience shows that a vertical sync pulse should be in the range of 50us and -300us. As an example let's use 150us, which translates into 8 vertical clock -ticks (150us/18.95us~8). - -Some makers like to quote their vertical framing parameters as timings rather -than dot widths. You may see the following terms: - -<descrip> -<tag/active time (VAT)/ - Corresponds to VR, but in milliseconds. VAT * VSF = VR. -<tag/blanking time (VBT)/ - Corresponds to (VFL - VR), but in milliseconds. VBT * VSF = (VFL - VR). -<tag/front porch (VFP)/ - This is just VGT. -<tag/sync time/ - This is just VSP. -<tag/back porch (VBP)/ - This is like a second guard time after the vertical sync pulse. It - is often zero. -</descrip> - -<sect>Putting it All Together<label id="synth"> -<p> - -The Xconfig file Table of Video Modes contains lines of numbers, with each line -being a complete specification for one mode of X-server operation. The fields -are grouped into four sections, the name section, the clock frequency section, -the horizontal section, and the vertical section. - -The name section contains one field, the name of the video mode specified by -the rest of the line. This name is referred to on the "Modes" line of the -Graphics Driver Setup section of the Xconfig file. The name field may be -omitted if the name of a previous line is the same as the current line. - -The dot clock section contains only the dot clock (what we've called DCF) field -of the video mode line. The number in this field specifies what dot clock was -used to generate the numbers in the following sections. - -The horizontal section consists of four fields which specify how each -horizontal line on the display is to be generated. The first field of the -section contains the number of dots per line which will be illuminated to form -the picture (what we've called HR). The second field of the section indicates -at which dot the horizontal sync pulse will begin. The third field indicates -at which dot the horizontal sync pulse will end. The fourth field specifies -the toal horzontal frame length (HFL). - -The vertical section also contains four fields. The first field contains the -number of visible lines which will appear on the display (VR). The second -field indicates the line number at which the vertical sync pulse will begin. -The third field specifies the line number at which the vertical sync pulse will -end. The fourth field contains the total vertical frame length (VFL). - -Example: -<tscreen><verb> - #Modename clock horizontal timing vertical timing - - "752x564" 40 752 784 944 1088 564 567 569 611 - 44.5 752 792 976 1240 564 567 570 600 -</verb></tscreen> -(Note: stock X11R5 doesn't support fractional dot clocks.) - -For Xconfig, all of the numbers just mentioned - the number of illuminated dots -on the line, the number of dots separating the illuminated dots from the -beginning of the sync pulse, the number of dots representing the duration of -the pulse, and the number of dots after the end of the sync pulse - are added -to produce the number of dots per line. The number of horizontal dots must be -evenly divisible by eight. - -Example horizontal numbers: 800 864 1024 1088 - -This sample line has the number of illuminated dots (800) followed by the -number of the dot when the sync pulse starts (864), followed by the number of -the dot when the sync pulse ends (1024), followed by the number of the last dot -on the horizontal line (1088). - -Note again that all of the horizontal numbers (800, 864, 1024, and 1088) are -divisible by eight! This is not required of the vertical numbers. - -The number of lines from the top of the display to the bottom form the frame. -The basic timing signal for a frame is the line. A number of lines will -contain the picture. After the last illuminated line has been displayed, a -delay of a number of lines will occur before the vertical sync pulse is -generated. Then the sync pulse will last for a few lines, and finally the last -lines in the frame, the delay required after the pulse, will be generated. The -numbers that specify this mode of operation are entered in a manner similar to -the following example. - -Example vertical numbers: 600 603 609 630 - -This example indicates that there are 600 visible lines on the display, that -the vertical sync pulse starts with the 603rd line and ends with the 609th, and -that there are 630 total lines being used. - -Note that the vertical numbers don't have to be divisible by eight! - -Let's return to the example we've been working. According to the above, all -we need to do from now on is to write our result into Xconfig as follows: -<tscreen><verb> -<name> DCF HR SH1 SH2 HFL VR SV1 SV2 VFL -</verb></tscreen> -where SH1 is the start tick of the horizontal sync pulse and SH2 is its end -tick; similarly, SV1 is the start tick of the vertical sync pulse and SV2 is -its end tick. -<tscreen><verb> -#name clock horizontal timing vertical timing flag -936x702 65 936 968 1200 1232 702 702 710 737 -</verb></tscreen> -No special flag necessary; this is a non-interlaced mode. Now we are really -done. - -<sect>Overdriving Your Monitor<label id="overd"> -<p> - -You should absolutely <EM>not</EM> try exceeding your monitor's scan -rates if it's a fixed-frequency type. You can smoke your hardware -doing this! There are potentially subtler problems with overdriving a -multisync monitor which you should be aware of. - -Having a pixel clock higher than the monitor's maximum bandwidth is -rather harmless, in contrast. (Note: the theoretical limit of -discernible features is reached when the pixel clock reaches double -the monitor's bandwidth. This is a straightforward application of -Nyquist's Theorem: consider the pixels as a spatially distributed -series of samples of the drive signals and you'll see why.) - -It's exceeding the rated maximum sync frequencies that's problematic. -Some modern monitors might have protection circuitry that shuts the -monitor down at dangerous scan rates, but don't rely on it. In -particular there are older multisync monitors (like the Multisync II) -which use just one horizontal transformer. These monitors will not -have much protection against overdriving them. While you necessarily -have high voltage regulation circuitry (which can be absent in fixed -frequency monitors), it will not necessarily cover every conceivable -frequency range, especially in cheaper models. This not only implies -more wear on the circuitry, it can also cause the screen phosphors to -age faster, and cause more than the specified radiation (including X-rays) -to be emitted from the monitor. - -Another importance of the bandwidth is that the monitor's input -impedance is specified only for that range, and using higher -frequencies can cause reflections probably causing minor screen -interferences, and radio disturbance. - -However, the basic problematic magnitude in question here is the slew -rate (the steepness of the video signals) of the video output drivers, -and that is usually independent of the actual pixel frequency, but -(if your board manufacturer cares about such problems) related -to the maximum pixel frequency of the board. - -So be careful out there... - -<sect>Using Interlaced Modes<label id="inter"> -<p> - -(This section is largely due to David Kastrup -<dak@pool.informatik.rwth-aachen.de>) - -At a fixed dot clock, an interlaced display is going to have -considerably less noticable flicker than a non-interlaced display, if -the vertical circuitry of your monitor is able to support it stably. -It is because of this that interlaced modes were invented in the first -place. - -Interlaced modes got their bad repute because they are inferior to -their non-interlaced companions at the same vertical scan frequency, -VSF (which is what is usually given in advertisements). But they are -definitely superior at the same horizontal scan rate, and that's where -the decisive limits of your monitor/graphics card usually lie. - -At a fixed <EM>refresh rate</EM> (or half frame rate, or VSF) the -interlaced display will flicker more: a 90Hz interlaced display will -be inferior to a 90Hz non-interlaced display. It will, however, need -only half the video bandwidth and half the horizontal scan rate. If -you compared it to a non-interlaced mode with the same dot clock and -the same scan rates, it would be vastly superior: 45Hz non-interlaced -is intolerable. With 90Hz interlaced, I have worked for years with my -Multisync 3D (at 1024x768) and am very satisfied. I'd guess you'd need -at least a 70Hz non-interlaced display for similar comfort. - -You have to watch a few points, though: use interlaced modes only at -high resolutions, so that the alternately lighted lines are close -together. You might want to play with sync pulse widths and positions -to get the most stable line positions. If alternating lines are bright -and dark, interlace will <EM>jump</EM> at you. I have one application that -chooses such a dot pattern for a menu background (XCept, no other -application I know does that, fortunately). I switch to 800x600 for -using XCept because it really hurts my eyes otherwise. - -For the same reason, use at least 100dpi fonts, or other fonts where -horizontal beams are at least two lines thick (for high resolutions, -nothing else will make sense anyhow). - -And of course, never use an interlaced mode when your hardware would -support a non-interlaced one with similar refresh rate. - -If, however, you find that for some resolution you are pushing either -monitor or graphics card to their upper limits, and getting -dissatisfactorily flickery or outwashed (bandwidth exceeded) display, -you might want to try tackling the same resolution using an -interlaced mode. Of course this is useless if the VSF -of your monitor is already close to its limits. - -Design of interlaced modes is easy: do it like a non-interlaced -mode. Just two more considerations are necessary: you need an odd -total number of vertical lines (the last number in your mode line), and -when you specify the "interlace" flag, the actual vertical frame rate -for your monitor doubles. Your monitor needs to support a 90Hz frame -rate if the mode you specified looks like a 45Hz mode apart from the -"Interlace" flag. - -As an example, here is my modeline for 1024x768 interlaced: my -Multisync 3D will support up to 90Hz vertical and 38kHz horizontal. - -<tscreen><verb> -ModeLine "1024x768" 45 1024 1048 1208 1248 768 768 776 807 Interlace -</verb></tscreen> - -Both limits are pretty much exhausted with this mode. Specifying the -same mode, just without the "Interlace" flag, still is almost at the -limit of the monitor's horizontal capacity (and strictly speaking, a -bit under the lower limit of vertical scan rate), but produces an -intolerably flickery display. - -Basic design rules: if you have designed a mode at less than half of -your monitor's vertical capacity, make the vertical total of lines odd -and add the "Interlace" flag. The display's quality should vastly -improve in most cases. - -If you have a non-interlaced mode otherwise exhausting your monitor's -specs where the vertical scan rate lies about 30% or more under the -maximum of your monitor, hand-designing an interlaced mode (probably -with somewhat higher resolution) could deliver superior results, but I -won't promise it. - -<sect>Questions and Answers<label id="answe"> -<p> - - Q. The example you gave is not a standard screen size, can I use it? - - A. Why not? There is NO reason whatsover why you have to use 640x480, -800x600, or even 1024x768. The XFree86 servers let you configure your hardware -with a lot of freedom. It usually takes two to three tries to come up the -right one. The important thing to shoot for is high refresh rate with -reasonable viewing area. not high resolution at the price of eye-tearing -flicker! - - Q. It this the only resolution given the 65Mhz dot clock and 55Khz HSF? - - A. Absolutely not! You are encouraged to follow the general procedure and -do some trial-and-error to come up a setting that's really to your liking. -Experimenting with this can be lots of fun. Most settings may just give you -nasty video hash, but in practice a modern multi-sync monitor is usually not -damaged easily. Be sure though, that your monitor can support the frame -rates of your mode before using it for longer times. - - Beware fixed-frequency monitors! This kind of hacking around can damage -them rather quickly. Be sure you use valid refresh rates for <EM>every</EM> -experiment on them. - - Q. You just mentioned two standard resolutions. In Xconfig, there are many -standard resolutions available, can you tell me whether there's any point in -tinkering with timings? - - A. Absolutely! Take, for example, the "standard" 640x480 listed in the -current Xconfig. It employes 25Mhz driving frequency, frame lengths are 800 -and 525 => refresh rate ~ 59.5Hz. Not too bad. But 28Mhz is a commonly -available driving frequency from many SVGA boards. If we use it to drive -640x480, following the procedure we discussed above, you would get frame -lengths like 812 and 505. Now the refresh rate is raised to 68Hz, a -quite significant improvement over the standard one. - - Q. Can you summarize what we have discussed so far? - - A. In a nutshell: - -<enum> -<item> -for any fixed driving frequency, raising max resolution incurs the penalty -of lowering refresh rate and thus introducing more flicker. -<item> -if high resolution is desirable and your monitor supports it, try to -get a SVGA card that provides a matching dot clock or DCF. The higher, -the better! -</enum> - -<sect>Fixing Problems with the Image.<label id="fixes"> -<p> - -OK, so you've got your X configuration numbers. You put them in Xconfig with -a test mode label. You fire up X, hot-key to the new mode, ... and the image -doesn't look right. What do you do? Here's a list of common problems and how -to fix them. - -(Fixing these minor distortions is where <bf>xvidtune</bf>(1) really shines.) - -You <em>move</em> the image by changing the sync pulse timing. You -<em>scale</em> it by changing the frame length (you need to move the -sync pulse to keep it in the same relative position, otherwise scaling will -move the image as well). Here are some more specific recipes: - -The horizontal and vertical positions are independent. That is, moving the -image horizontally doesn't affect placement vertically, or vice-versa. -However, the same is not quite true of scaling. While changing the horizontal -size does nothing to the vertical size or vice versa, the total change in both -may be limited. In particular, if your image is too large in both dimensions -you will probably have to go to a higher dot clock to fix it. Since this -raises the usable resolution, it is seldom a problem! - -<sect1>The image is displaced to the left or right -<p> - -To fix this, move the horizontal sync pulse. That is, increment or decrement -(by a multiple of 8) the middle two numbers of the horizontal timing section -that define the leading and trailing edge of the horizontal sync pulse. - -If the image is shifted left (right border too large, you want to move -the image to the right) decrement the numbers. If the image is shifted right -(left border too large, you want it to move left) increment the sync pulse. - -<sect1>The image is displaced up or down -<p> - -To fix this, move the vertical sync pulse. That is, increment or decrement the -middle two numbers of the vertical timing section that define the leading and -trailing edge of the vertical sync pulse. - -If the image is shifted up (lower border too large, you want to move the image -down) decrement the numbers. If the image is shifted down (top border too -large, you want it to move up) increment the numbers. - -<sect1>The image is too large both horizontally and vertically -<p> - -Switch to a higher card clock speed. If you have multiple modes in your -clock file, possibly a lower-speed one is being activated by mistake. - -<sect1>The image is too wide (too narrow) horizontally -<p> - -To fix this, increase (decrease) the horizontal frame length. That is, change -the fourth number in the first timing section. To avoid moving the image, also -move the sync pulse (second and third numbers) half as far, to keep it in the -same relative position. - -<sect1>The image is too deep (too shallow) vertically -<p> - -To fix this, increase (decrease) the vertical frame length. That is, change -the fourth number in the second timing section. To avoid moving the image, -also move the sync pulse (second and third numbers) half as far, to keep it in -the same relative position. - -Any distortion that can't be handled by combining these techniques is probably -evidence of something more basically wrong, like a calculation mistake or a -faster dot clock than the monitor can handle. - -Finally, remember that increasing either frame length will decrease your -refresh rate, and vice-versa. - -<sect>Plotting Monitor Capabilities<label id="cplot"> -<p> - -To plot a monitor mode diagram, you'll need the gnuplot package (a -freeware plotting language for UNIX-like operating systems) and the -tool <TT>modeplot</TT>, a shell/gnuplot script to plot the diagram from your -monitor characteristics, entered as command-line options. - -Here is a copy of modeplot: - -<code> -#!/bin/sh -# -# modeplot -- generate X mode plot of available monitor modes -# -# Do `modeplot -?' to see the control options. -# -# (Id: video-modes.sgml,v 1.2 1997/08/08 15:07:24 esr Exp $) - -# Monitor description. Bandwidth in MHz, horizontal frequencies in kHz -# and vertical frequencies in Hz. -TITLE="Viewsonic 21PS" -BANDWIDTH=185 -MINHSF=31 -MAXHSF=85 -MINVSF=50 -MAXVSF=160 -ASPECT="4/3" -vesa=72.5 # VESA-recommended minimum refresh rate - -while [ "$1" != "" ] -do - case $1 in - -t) TITLE="$2"; shift;; - -b) BANDWIDTH="$2"; shift;; - -h) MINHSF="$2" MAXHSF="$3"; shift; shift;; - -v) MINVSF="$2" MAXVSF="$3"; shift; shift;; - -a) ASPECT="$2"; shift;; - -g) GNUOPTS="$2"; shift;; - -?) cat <<EOF -modeplot control switches: - --t "<description>" name of monitor defaults to "Viewsonic 21PS" --b <nn> bandwidth in MHz defaults to 185 --h <min> <max> min & max HSF (kHz) defaults to 31 85 --v <min> <max> min & max VSF (Hz) defaults to 50 160 --a <aspect ratio> aspect ratio defaults to 4/3 --g "<options>" pass options to gnuplot - -The -b, -h and -v options are required, -a, -t, -g optional. You can -use -g to pass a device type to gnuplot so that (for example) modeplot's -output can be redirected to a printer. See gnuplot(1) for details. - -The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on -analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de> - -This is modeplot Revision: 1.2 $ -EOF - exit;; - esac - shift -done - -gnuplot $GNUOPTS <<EOF -set title "$TITLE Mode Plot" - -# Magic numbers. Unfortunately, the plot is quite sensitive to changes in -# these, and they may fail to represent reality on some monitors. We need -# to fix values to get even an approximation of the mode diagram. These come -# from looking at lots of values in the ModeDB database. -F1 = 1.30 # multiplier to convert horizontal resolution to frame width -F2 = 1.05 # multiplier to convert vertical resolution to frame height - -# Function definitions (multiplication by 1.0 forces real-number arithmetic) -ac = (1.0*$ASPECT)*F1/F2 -refresh(hsync, dcf) = ac * (hsync**2)/(1.0*dcf) -dotclock(hsync, rr) = ac * (hsync**2)/(1.0*rr) -resolution(hv, dcf) = dcf * (10**6)/(hv * F1 * F2) - -# Put labels on the axes -set xlabel 'DCF (MHz)' -set ylabel 'RR (Hz)' 6 # Put it right over the Y axis - -# Generate diagram -set grid -set label "VB" at $BANDWIDTH+1, ($MAXVSF + $MINVSF) / 2 left -set arrow from $BANDWIDTH, $MINVSF to $BANDWIDTH, $MAXVSF nohead -set label "max VSF" at 1, $MAXVSF-1.5 -set arrow from 0, $MAXVSF to $BANDWIDTH, $MAXVSF nohead -set label "min VSF" at 1, $MINVSF-1.5 -set arrow from 0, $MINVSF to $BANDWIDTH, $MINVSF nohead -set label "min HSF" at dotclock($MINHSF, $MAXVSF+17), $MAXVSF + 17 right -set label "max HSF" at dotclock($MAXHSF, $MAXVSF+17), $MAXVSF + 17 right -set label "VESA $vesa" at 1, $vesa-1.5 -set arrow from 0, $vesa to $BANDWIDTH, $vesa nohead # style -1 -plot [dcf=0:1.1*$BANDWIDTH] [$MINVSF-10:$MAXVSF+20] \ - refresh($MINHSF, dcf) notitle with lines 1, \ - refresh($MAXHSF, dcf) notitle with lines 1, \ - resolution(640*480, dcf) title "640x480 " with points 2, \ - resolution(800*600, dcf) title "800x600 " with points 3, \ - resolution(1024*768, dcf) title "1024x768 " with points 4, \ - resolution(1280*1024, dcf) title "1280x1024" with points 5, \ - resolution(1600*1280, dcf) title "1600x1200" with points 6 - -pause 9999 -EOF -</code> - -Once you know you have <TT>modeplot</TT> and the gnuplot package in -place, you'll need the following monitor characteristics: - -<itemize> -<item> video bandwidth (VB) -<item> range of horizontal sync frequency (HSF) -<item> range of vertical sync frequency (VSF) -</itemize> - -The plot program needs to make some simplifying assumptions which are -not necessarily correct. This is the reason why the resulting diagram is -only a rough description. These assumptions are: - -<enum> -<item> All resolutions have a single fixed aspect ratio AR = HR/VR. -Standard resolutions have AR = 4/3 or AR = 5/4. The <TT>modeplot</TT> -programs assumes 4/3 by default, but you can override this. -<item> For the modes considered, horizontal and vertical frame lengths are -fixed multiples of horizontal and vertical resolutions, respectively: - -<tscreen><verb> - HFL = F1 * HR - VFL = F2 * VR -</verb></tscreen> -</enum> - -As a rough guide, take F1 = 1.30 and F2 = 1.05 (see <ref id=frame> -"Computing Frame Sizes"). - -Now take a particular sync frequency, HSF. Given the assumptions just -presented, every value for the clock rate DCF already determines the -refresh rate RR, i.e. for every value of HSF there is a function RR(DCF). -This can be derived as follows. - -The refresh rate is equal to the clock rate divided by the product of the -frame sizes: - -<tscreen><verb> - RR = DCF / (HFL * VFL) (*) -</verb></tscreen> - -On the other hand, the horizontal frame length is equal to the clock rate -divided by the horizontal sync frequency: - -<tscreen><verb> - HFL = DCF / HSF (**) -</verb></tscreen> - -VFL can be reduced to HFL be means of the two assumptions above: - -<tscreen><verb> - VFL = F2 * VR - = F2 * (HR / AR) - = (F2/F1) * HFL / AR (***) -</verb></tscreen> - -Inserting (**) and (***) into (*) we obtain: - -<tscreen><verb> - RR = DCF / ((F2/F1) * HFL**2 / AR) - = (F1/F2) * AR * DCF * (HSF/DCF)**2 - = (F1/F2) * AR * HSF**2 / DCF -</verb></tscreen> - -For fixed HSF, F1, F2 and AR, this is a hyperbola in our diagram. Drawing -two such curves for minimum and maximum horizontal sync frequencies we -have obtained the two remaining boundaries of the permitted region. - -The straight lines crossing the capability region represent particular -resolutions. This is based on (*) and the second assumption: - -<tscreen><verb> - RR = DCF / (HFL * VFL) = DCF / (F1 * HR * F2 * VR) -</verb></tscreen> - -By drawing such lines for all resolutions one is interested in, one -can immediately read off the possible relations between resolution, -clock rate and refresh rate of which the monitor is capable. Note that -these lines do not depend on monitor properties, but they do depend on -the second assumption. - -The <TT>modeplot</TT> tool provides you with an easy way to do this. Do -<TT>modeplot -?</TT> to see its control options. A typical invocation -looks like this: - -<tscreen><verb> - modeplot -t "Swan SW617" -b 85 -v 50 90 -h 31 58 -</verb></tscreen> - -The -b option specifies video bandwidth; -v and -h set horizontal and -vertical sync frequency ranges. - -When reading the output of <TT>modeplot</TT>, always bear in mind that -it gives only an approximate description. For example, it disregards -limitations on HFL resulting from a minimum required sync pulse width, -and it can only be accurate as far as the assumptions are. It is -therefore no substitute for a detailed calculation (involving some -black magic) as presented in <ref id="synth" name="Putting it All -Together">. However, it should give you a better feeling for what -is possible and which tradeoffs are involved. - -<sect>Credits<label id="credi"> -<p> - -The original ancestor of this document was by Chin Fang -<fangchin@leland.stanford.edu>. - -Eric S. Raymond <esr@snark.thyrsus.com> reworked, reorganized, and -massively rewrote Chin Fang's original in an attempt to understand it. In -the process, he merged in most of a different how-to by Bob Crosson -<crosson@cam.nist.gov>. - -The material on interlaced modes is largely by David Kastrup -<dak@pool.informatik.rwth-aachen.de> - -Martin Lottermoser <Martin.Lottermoser@mch.sni.de> contributed -the idea of using gnuplot to make mode diagrams and did the -mathematical analysis behind <TT>modeplot</TT>. The distributed -<TT>modeplot</TT> was redesigned and generalized by ESR from -Martin's original gnuplot code for one case. -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v 3.16 2000/02/23 20:30:16 dawes Exp $ - - - - - -$XConsortium: VidModes.sgml /main/7 1996/02/21 17:46:17 kaleb $ -</verb> - -</article> - -<!-- -The following sets edit modes for GNU EMACS -Local Variables: -fill-prefix:"\t" -fill-column:75 -End: --- > Index: xc/programs/Xserver/hw/xfree86/doc/sgml/VideoModes.sgml diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/sgml/VideoModes.sgml:1.1 --- /dev/null Fri Jan 18 15:25:15 2002 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/VideoModes.sgml Mon Jun 4 09:50:16 2001 @@ -0,0 +1,1428 @@ +<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> + +<!-- This is the Linux Distribution HOWTO, SGML source -- > +<!-- Eric S. Raymond, esr@snark.thyrsus.com -- > +<!-- The submission address is gregh@sunsite.unc.edu -- > + +<article> + +<title>XFree86 Video Timings HOWTO +<author>Eric S. Raymond <esr@thyrsus.com> +<date>Version 3.0, 8 Aug 1997 + +<abstract> +How to compose a mode line for your card/monitor combination under XFree86. +The XFree86 distribution now includes good facilities for configuring most +standard combinations; this document is mainly useful if you are tuning a +custom mode line for a high-performance monitor or very unusual hardware. +It may also help you in using xvidtune to tweak a standard mode that is +not quite right for your monitor. +</abstract> + +<toc> + +<sect>Disclaimer +<p> + +You use the material herein SOLELY AT YOUR OWN RISK. It is possible +to harm both your monitor and yourself when driving it outside the +manufacturer's specs. Read <ref id="overd" name="Overdriving Your +Monitor"> for detailed cautions. Any damages to you or your monitor +caused by overdriving it are your problem. + +The most up-to-date version of this HOWTO can be found at the <url +url="http://sunsite.unc.edu/LDP" +name="Linux Documentation Project"> web page. + +Please direct comments, criticism, and suggestions for improvement to +<htmlurl url="mailto:esr@thyrsus.com" name="esr@snark.thyrsus.com">. Please do +<em>not</em> send email pleading for a magic solution to your +special monitor problem, as doing so will only burn up my time and +frustrate you -- everything I know about the subject is already in +here. + +<sect>Introduction<label id="intro"> +<p> + +The XFree86 server allows users to configure their video subsystem and thus +encourages best use of existing hardware. This tutorial is intended to help +you learn how to generate your own timing numbers to make optimum use of your +video card and monitor. + +We'll present a method for getting something that works, and then show you how +you can experiment starting from that base to develop settings that optimize +for your taste. + +Starting with XFree86 3.2, XFree86 provides an <bf>XF86Setup</bf>(1) +program that makes it easy to generate a working monitor mode +interactively, without messing with video timing number directly. So +you shouldn't actually need to calculate a base monitor mode in most +cases. Unfortunately, <bf>XF86Setup</bf>(1) has some limitations; it +only knows about standard video modes up to 1280x1024. If you have a +very high-performance monitor capable of 1600x1200 or more you will +still have to compute your base monitor mode yourself. + +Recent versions of XFree86 provide a tool called <bf>xvidtune</bf>(1) +which you will probably find quite useful for testing and tuning +monitor modes. It begins with a gruesome warning about the possible +consequences of mistakes with it. If you pay careful attention to +this document and learn what is behind the pretty numbers in +xvidtune's boxes, you will become able to use xvidtune effectively and +with confidence. + +If you already have a mode that almost works (in particular, if one of +predefined VESA modes gives you a stable display but one that's +displaced right or left, or too small, or too large) you can go +straight to the section on <ref id="fixes" name="Fixing Problems with the +Image">. This will enlighten you on ways to tweak the timing +numbers to achieve particular effects. + +If you have <bf>xvidtune</bf>(1), you'll be able to test new modes on the fly, +without modifying your X configuration files or even rebooting your X server. +Otherwise, XFree86 allows you to hot-key between different modes defined in +Xconfig (see XFree86.man for details). Use this capabilty to save +yourself hassles! When you want to test a new mode, give it a unique +mode label and add it to the <EM>end</EM> of your hot-key list. Leave a +known-good mode as the default to fall back on if the test mode +doesn't work. + +<sect>How Video Displays Work<label id="video"> +<p> + +Knowing how the display works is essential to understanding what numbers to put +in the various fields in the file Xconfig. Those values are used in the lowest +levels of controlling the display by the XFree86 server. + +The display generates a picture from a series of dots. The dots are arranged +from left to right to form lines. The lines are arranged from top to bottom to +form the picture. The dots emit light when they are struck by the electron +beam inside the display. To make the beam strike each dot for an equal amount +of time, the beam is swept across the display in a constant pattern. + +The pattern starts at the top left of the screen, goes across the screen to the +right in a straight line, and stops temporarily on the right side of the +screen. Then the beam is swept back to the left side of the display, but down +one line. The new line is swept from left to right just as the first line was. +This pattern is repeated until the bottom line on the display has been swept. +Then the beam is moved from the bottom right corner of the display to the top +left corner, and the pattern is started over again. + +There is one variation of this scheme known as interlacing: here only +every second line is swept during one half-frame and the others are filled in +in during a second half-frame. + +Starting the beam at the top left of the display is called the beginning of a +frame. The frame ends when the beam reaches the the top left corner again as +it comes from the bottom right corner of the display. A frame is made up of +all of the lines the beam traced from the top of the display to the bottom. + +If the electron beam were on all of the time it was sweeping through the frame, +all of the dots on the display would be illuminated. There would be no black +border around the edges of the display. At the edges of the display the +picture would become distorted because the beam is hard to control there. To +reduce the distortion, the dots around the edges of the display are not +illuminated by the beam even though the beam may be pointing at them. The +viewable area of the display is reduced this way. + +Another important thing to understand is what becomes of the beam when no spot +is being painted on the visible area. The time the beam would have been +illuminating the side borders of the display is used for sweeping the beam back +from the right edge to the left and moving the beam down to the next line. The +time the beam would have been illuminating the top and bottom borders of the +display is used for moving the beam from the bottom-right corner of the display +to the top-left corner. + +The adapter card generates the signals which cause the display to turn on the +electron beam at each dot to generate a picture. The card also controls when +the display moves the beam from the right side to the left and down a line by +generating a signal called the horizontal sync (for synchronization) pulse. +One horizontal sync pulse occurs at the end of every line. The adapter also +generates a vertical sync pulse which signals the display to move the beam to +the top-left corner of the display. A vertical sync pulse is generated near +the end of every frame. + +The display requires that there be short time periods both before and after the +horizontal and vertical sync pulses so that the position of the electron beam +can stabilize. If the beam can't stabilize, the picture will not be steady. + +In a later section, we'll come back to these basics with definitions, +formulas and examples to help you use them. + +<sect>Basic Things to Know about your Display and Adapter<label id="basic"> +<p> + +There are some fundamental things you need to know before hacking an Xconfig +entry. These are: + +<itemize> +<item>your monitor's horizontal and vertical sync frequency options +<item>your video adapter's driving clock frequency, or "dot clock" +<item>your monitor's bandwidth +</itemize> +The monitor sync frequencies: + +The horizontal sync frequency is just the number of times per second the +monitor can write a horizontal scan line; it is the single most important +statistic about your monitor. The vertical sync frequency is the number of +times per second the monitor can traverse its beam vertically. + +Sync frequencies are usually listed on the specifications page of your monitor +manual. The vertical sync frequency number is typically calibrated in Hz +(cycles per second), the horizontal one in KHz (kilocycles per second). The +usual ranges are between 50 and 150Hz vertical, and between 31 and 135KHz +horizontal. + +If you have a multisync monitor, these frequencies will be given as ranges. +Some monitors, especially lower-end ones, have multiple fixed frequencies. +These can be configured too, but your options will be severely limited by the +built-in monitor characteristics. Choose the highest frequency pair for best +resolution. And be careful --- trying to clock a fixed-frequency monitor at a +higher speed than it's designed for can easily damage it. + +Earlier versions of this guide were pretty cavalier about overdriving +multisync monitors, pushing them past their nominal highest vertical +sync frequency in order to get better performance. We have since had more +reasons pointed out to us for caution on this score; we'll cover those under +<ref id="overd" name="Overdriving Your Monitor"> below. + +The card driving clock frequency: + +Your video adapter manual's spec page will usually give you the card's dot +clock (that is, the total number of pixels per second it can write to the +screen). If you don't have this information, the X server will get it for +you. Even if your X locks up your monitor, it will emit a line of clock and +other info to standard output. If you redirect this to a file, it should be +saved even if you have to reboot to get your console back. (Recent versions +of the X servers allsupport a --probeonly option that prints out this +information and exits without actually starting up X or changing the +video mode.) + +Your X startup message should look something like one of the following +examples: + +If you're using XFree86: + +<tscreen><verb> +Xconfig: /usr/X11R6/lib/X11/Xconfig +(**) stands for supplied, (--) stands for probed/default values +(**) Mouse: type: MouseMan, device: /dev/ttyS1, baudrate: 9600 +Warning: The directory "/usr/andrew/X11fonts" does not exist. + Entry deleted from font path. +(**) FontPath set to "/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/" +(--) S3: card type: 386/486 localbus +(--) S3: chipset: 924 + --- + Chipset -- this is the exact chip type; an early mask of the 86C911 + +(--) S3: chipset driver: s3_generic +(--) S3: videoram: 1024k + ----- + Size of on-board frame-buffer RAM + +(**) S3: clocks: 25.00 28.00 40.00 3.00 50.00 77.00 36.00 45.00 +(**) S3: clocks: 0.00 0.00 79.00 31.00 94.00 65.00 75.00 71.00 + ------------------------------------------------------ + Possible driving frequencies in MHz + +(--) S3: Maximum allowed dot-clock: 110MHz + ------ + Bandwidth +(**) S3: Mode "1024x768": mode clock = 79.000, clock used = 79.000 +(--) S3: Virtual resolution set to 1024x768 +(--) S3: Using a banksize of 64k, line width of 1024 +(--) S3: Pixmap cache: +(--) S3: Using 2 128-pixel 4 64-pixel and 8 32-pixel slots +(--) S3: Using 8 pages of 768x255 for font caching +</verb></tscreen> + +If you're using SGCS or X/Inside X: + +<tscreen><verb> +WGA: 86C911 (mem: 1024k clocks: 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71) +--- ------ ----- -------------------------------------------- + | | | Possible driving frequencies in MHz + | | +-- Size of on-board frame-buffer RAM + | +-- Chip type + +-- Server type +</verb></tscreen> + +Note: do this with your machine unloaded (if at all possible). Because X is +an application, its timing loops can collide with disk activity, rendering the +numbers above inaccurate. Do it several times and watch for the numbers to +stabilize; if they don't, start killing processes until they do. SVr4 users: +the mousemgr process is particularly likely to mess you up. + +In order to avoid the clock-probe inaccuracy, you should clip out the clock +timings and put them in your Xconfig as the value of the Clocks property --- +this suppresses the timing loop and gives X an exact list of the clock values +it can try. Using the data from the example above: + +<tscreen><verb> +wga + Clocks 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71 +</verb></tscreen> +On systems with a highly variable load, this may help you avoid mysterious X +startup failures. It's possible for X to come up, get its timings wrong due +to system load, and then not be able to find a matching dot clock in its +config database --- or find the wrong one! + +<sect1>The monitor's video bandwidth: +<p> + +If you're running XFree86, your server will probe your card and tell you +what your highest-available dot clock is. + +Otherwise, your highest available dot clock is approximately the monitor's +video bandwidth. There's a lot of give here, though --- some monitors +can run as much as 30% over their nominal bandwidth. The risks here have +to do with exceeding the monitor's rated vertical-sync frequency; we'll +discuss them in detail below. + +Knowing the bandwidth will enable you to make more intelligent choices +between possible configurations. It may affect your display's visual +quality (especially sharpness for fine details). + +Your monitor's video bandwidth should be included on the manual's spec page. +If it's not, look at the monitor's higest rated resolution. As a rule of +thumb, here's how to translate these into bandwidth estimates (and thus into +rough upper bounds for the dot clock you can use): + +<tscreen><verb> + 640x480 25 + 800x600 36 + 1024x768 65 + 1024x768 interlaced 45 + 1280x1024 110 + 1600x1200 185 +</verb></tscreen> + +BTW, there's nothing magic about this table; these numbers are just +the lowest dot clocks per resolution in the standard XFree86 Modes +database (except for the last, which I interpolated). The bandwidth +of your monitor may actually be higher than the minimum needed for its +top resolution, so don't be afraid to try a dot clock a few MHz +higher. + +Also note that bandwidth is seldom an issue for dot clocks under 65MHz +or so. With an SVGA card and most hi-res monitors, you can't get +anywhere near the limit of your monitor's video bandwidth. The +following are examples: + +<tscreen><verb> + Brand Video Bandwidth + ---------- --------------- + NEC 4D 75Mhz + Nano 907a 50Mhz + Nano 9080i 60Mhz + Mitsubishi HL6615 110Mhz + Mitsubishi Diamond Scan 100Mhz + IDEK MF-5117 65Mhz + IOCOMM Thinksync-17 CM-7126 136Mhz + HP D1188A 100Mhz + Philips SC-17AS 110Mhz + Swan SW617 85Mhz + Viewsonic 21PS 185Mhz +</verb></tscreen> +Even low-end monitors usually aren't terribly bandwidth-constrained for their +rated resolutions. The NEC Multisync II makes a good example --- it can't +even display 800x600 per its spec. It can only display 800x560. For such low +resolutions you don't need high dot clocks or a lot of bandwidth; probably the +best you can do is 32Mhz or 36Mhz, both of them are still not too far from the +monitor's rated video bandwidth of 30Mhz. + +At these two driving frequencies, your screen image may not be as sharp as it +should be, but definitely of tolerable quality. Of course it would be nicer if +NEC Multisync II had a video bandwidth higher than, say, 36Mhz. But this is +not critical for common tasks like text editing, as long as the difference is +not so significant as to cause severe image distortion (your eyes would tell +you right away if this were so). + +<sect1>What these control: +<p> + +The sync frequency ranges of your monitor, together with your video adapter's +dot clock, determine the ultimate resolution that you can use. But it's up to +the driver to tap the potential of your hardware. A superior hardware +combination without an equally competent device driver is a waste of money. +On the other hand, with a versatile device driver but less capable hardware, +you can push the hardware's envelope a little. This is the design philosophy +of XFree86. + +<sect>Interpreting the Basic Specifications<label id="specs"> +<p> + +This section explains what the specifications above mean, and some other +things you'll need to know. First, some definitions. Next to each in parens +is the variable name we'll use for it when doing calculations + +<descrip> +<tag/horizontal sync frequency (HSF)/ + Horizontal scans per second (see above). + +<tag/vertical sync frequency (VSF) / + Vertical scans per second (see above). Mainly important as the upper + limit on your refresh rate. + +<tag/dot clock (DCF)/ + More formally, `driving clock frequency'; The frequency of the + crystal or VCO on your adaptor --- the maximum dots-per-second it can + emit. + +<tag/video bandwidth (VB)/ + The highest frequency you can feed into your monitor's video + input and still expect to see anything discernible. If your adaptor + produces an alternating on/off pattern, its lowest frequency is half + the DCF, so in theory bandwidth starts making sense at DCF/2. For + tolerately crisp display of fine details in the video image, however, + you don't want it much below your highest DCF, and preferably higher. + +<tag/frame length (HFL, VFL)/ + Horizontal frame length (HFL) is the number of dot-clock ticks + needed for your monitor's electron gun to scan one horizontal line, + <em>including the inactive left and right borders</em>. Vertical + frame length (VFL) is the number of scan lines in the + <em>entire</em> image, including the inactive top and bottom + borders. + +<tag/screen refresh rate (RR)/ + The number of times per second your screen is repainted (this is + also called "frame rate"). Higher frequencies are better, as they + reduce flicker. 60Hz is good, VESA-standard 72Hz is better. + Compute it as +<tscreen><verb> + RR = DCF / (HFL * VFL) +</verb></tscreen> + + Note that the product in the denominator is <em>not</em> the same + as the monitor's visible resolution, but typically somewhat larger. + We'll get to the details of this below. + +The rates for which interlaced modes are usually specified (like 87Hz +interlaced) are actually the half-frame rates: an entire screen seems +to have about that flicker frequency for typical displays, but every +single line is refreshed only half as often. + +For calculation purposes we reckon an interlaced display at its +full-frame (refresh) rate, i.e. 43.5Hz. The quality of an interlaced +mode is better than that of a non-interlaced mode with the same +full-frame rate, but definitely worse then the non-interlaced one +corresponding to the half-frame rate. +</descrip> + +<sect1>About Bandwidth: +<p> + +Monitor makers like to advertise high bandwidth because it constrains the +sharpness of intensity and color changes on the screen. A high bandwidth +means smaller visible details. + +Your monitor uses electronic signals to present an image to +your eyes. Such signals always come in in wave form once they are converted +into analog form from digitized form. They can be considered as combinations +of many simpler wave forms each one of which has a fixed frequency, many of +them are in the Mhz range, eg, 20Mhz, 40Mhz, or even 70Mhz. Your monitor +video bandwidth is, effectively, the highest-frequency analog signal it can +handle without distortion. + +For our purposes, bandwidth is mainly important as an approximate cutoff point +for the highest dot clock you can use. + +<sect1>Sync Frequencies and the Refresh Rate: +<p> + +Each horizontal scan line on the display is just the visible portion of a +frame-length scan. At any instant there is actually only one dot active on +the screen, but with a fast enough refresh rate your eye's persistence of +vision enables you to "see" the whole image. + +Here are some pictures to help: + +<code> + _______________________ + | | The horizontal sync frequency + |->->->->->->->->->->-> | is the number of times per + | )| second that the monitor's + |<-----<-----<-----<--- | electron beam can trace + | | a pattern like this + | | + | | + | | + |_______________________| + _______________________ + | ^ | The vertical sync frequency + | ^ | | is the number of times per + | | v | second that the monitor's + | ^ | | electron beam can trace + | | | | a pattern like this + | ^ | | + | | v | + | ^ | | + |_______|_v_____________| +</code> + +Remember that the actual raster scan is a very tight zigzag pattern; that is, +the beam moves left-right and at the same time up-down. + +Now we can see how the dot clock and frame size relates to refresh rate. By +definition, one hertz (hz) is one cycle per second. So, if your horizontal +frame length is HFL and your vertical frame length is VFL, then to cover the +entire screen takes (HFL * VFL) ticks. Since your card emits DCF ticks per +second by definition, then obviously your monitor's electron gun(s) can sweep +the screen from left to right and back and from bottom to top and back DCF / +(HFL * VFL) times/sec. This is your screen's refresh rate, because it's how +many times your screen can be updated (thus <em>refreshed</em>) per second! + +You need to understand this concept to design a configuration which trades off +resolution against flicker in whatever way suits your needs. + +For those of you who handle visuals better than text, here is one: + +<code> + RR VB + | min HSF max HSF | + | | R1 R2 | | +max VSF -+----|------------/----------/---|------+----- max VSF + | |:::::::::::/::::::::::/:::::\ | + | \::::::::::/::::::::::/:::::::\ | + | |::::::::/::::::::::/:::::::::| | + | |:::::::/::::::::::/::::::::::\ | + | \::::::/::::::::::/::::::::::::\ | + | \::::/::::::::::/::::::::::::::| | + | |::/::::::::::/:::::::::::::::| | + | \/::::::::::/:::::::::::::::::\| + | /\:::::::::/:::::::::::::::::::| + | / \:::::::/::::::::::::::::::::|\ + | / |:::::/:::::::::::::::::::::| | + | / \::::/::::::::::::::::::::::| \ +min VSF -+----/-------\--/-----------------------|--\--- min VSF + | / \/ | \ + +--/----------/\------------------------+----\- DCF + R1 R2 \ | \ + min HSF | max HSF + VB +</code> + +This is a generic monitor mode diagram. The x axis of the diagram +shows the clock rate (DCF), the y axis represents the refresh rate +(RR). The filled region of the diagram describes the monitor's +capabilities: every point within this region is a possible video +mode. + +The lines labeled `R1' and `R2' represent a fixed resolutions (such as +640x480); they are meant to illustrate how one resolution can be realized +by many different combinations of dot clock and refresh rate. The R2 +line would represent a higher resolution than R1. + +The top and bottom boundaries of the permitted region are simply +horizontal lines representing the limiting values for the vertical sync +frequency. The video bandwidth is an upper limit to the clock rate and +hence is represented by a vertical line bounding the capability region on +the right. + +Under <ref id="cplot" name="Plotting Monitor Capabilities">) you'll +find a program that will help you plot a diagram like +this (but much nicer, with X graphics) for your individual monitor. +That section also discusses the interesting part; the derivation of +the boundaries resulting from the limits on the horizontal sync +frequency. + +<sect>Tradeoffs in Configuring your System<label id="trade"> +<p> + +Another way to look at the formula we derived above is + +<tscreen><verb> + DCF = RR * HFL * VFL +</verb></tscreen> +That is, your dot clock is fixed. You can use those dots per second to buy +either refresh rate, horizontal resolution, or vertical resolution. If one +of those increases, one or both of the others must decrease. + +Note, though, that your refresh rate cannot be greater than the maximum +vertical sync frequency of your monitor. Thus, for any given monitor at a +given dot clock, there is a minimum product of frame lengths below which you +can't force it. + +In choosing your settings, remember: if you set RR too low, you will get +mugged by screen flicker. + +You probably do not want to pull your refresh rate below 60Hz. This is the +flicker rate of fluorescent lights; if you're sensitive to those, you need +to hang with 72Hz, the VESA ergonomic standard. + +Flicker is very eye-fatiguing, though human eyes are adaptable and peoples' +tolerance for it varies widely. If you face your monitor at a 90% viewing +angle, are using a dark background and a good contrasting color for +foreground, and stick with low to medium intensity, you *may* be comfortable +at as little as 45Hz. + +The acid test is this: open a xterm with pure white back-ground and black +foreground using <TT>xterm -bg white -fg black</TT> and make it so large as +to cover the entire viewable area. Now turn your monitor's intensity to 3/4 of +its maximum setting, and turn your face away from the monitor. Try peeking at +your monitor sideways (bringing the more sensitive peripheral-vision cells into +play). If you don't sense any flicker or if you feel the flickering is +tolerable, then that refresh rate is fine with you. Otherwise you better +configure a higher refresh rate, because that semi-invisible flicker is going +to fatigue your eyes like crazy and give you headaches, even if the screen +looks OK to normal vision. + +For interlaced modes, the amount of flicker depends on more factors +such as the current vertical resolution and the actual screen +contents. So just experiment. You won't want to go much below about +85Hz half frame rate, though. + +So let's say you've picked a minimum acceptable refresh rate. In choosing +your HFL and VFL, you'll have some room for maneuver. + +<sect>Memory Requirements<label id="sizes"> +<p> + +Available frame-buffer RAM may limit the resolution you can achieve on color or +gray-scale displays. It probably isn't a factor on displays that have only two +colors, white and black with no shades of gray in between. + +For 256-color displays, a byte of video memory is required for each visible +dot to be shown. This byte contains the information that determines what mix +of red, green, and blue is generated for its dot. To get the amount of memory +required, multiply the number of visible dots per line by the number of +visible lines. For a display with a resolution of 800x600, this would be 800 +x 600 = 480,000, which is the number of visible dots on the display. This is +also, at one byte per dot, the number of bytes of video memory that are +necessary on your adapter card. + +Thus, your memory requirement will typically be (HR * VR)/1024 Kbytes of VRAM, +rounded up. If you have more memory than strictly required, you'll have extra +for virtual-screen panning. + +However, if you only have 512K on board, then you can't use this +resolution. Even if you have a good monitor, without enough video +RAM, you can't take advantage of your monitor's potential. On the +other hand, if your SVGA has one meg, but your monitor can display at +most 800x600, then high resolution is beyond your reach anyway (see +<ref id="inter" name="Using Interlaced Modes"> for a possible +remedy). + +Don't worry if you have more memory than required; XFree86 will make +use of it by allowing you to scroll your viewable area (see the +Xconfig file documentation on the virtual screen size parameter). +Remember also that a card with 512K bytes of memory really doesn't +have 512,000 bytes installed, it has 512 x 1024 = 524,288 bytes. + +If you're running SGCS X (now called X/Inside) using an S3 card, and +are willing to live with 16 colors (4 bits per pixel), you can set +depth 4 in Xconfig and effectively double the resolution your card can +handle. S3 cards, for example, normally do 1024x768x256. You can +make them do 1280x1024x16 with depth 4. + +<sect>Computing Frame Sizes<label id="frame"> +<p> + +Warning: this method was developed for multisync monitors. It will probably +work with fixed-frequency monitors as well, but no guarantees! + +Start by dividing DCF by your highest available HSF to get a horizontal +frame length. + +For example; suppose you have a Sigma Legend SVGA with a 65MHz dot clock, and +your monitor has a 55KHz horizontal scan frequency. The quantity (DCF / HSF) +is then 1181 (65MHz = 65000KHz; 65000/55 = 1181). + +Now for our first bit of black magic. You need to round this figure to the +nearest multiple of 8. This has to do with the VGA hardware controller used by +SVGA and S3 cards; it uses an 8-bit register, left-shifted 3 bits, for what's +really an 11-bit quantity. Other card types such as ATI 8514/A may not have +this requirement, but we don't know and the correction can't hurt. So round +the usable horizontal frame length figure down to 1176. + +This figure (DCF / HSF rounded to a multiple of 8) is the minimum HFL you can +use. You can get longer HFLs (and thus, possibly, more horizontal dots on the +screen) by setting the sync pulse to produce a lower HSF. But you'll pay with +a slower and more visible flicker rate. + +As a rule of thumb, 80% of the horizontal frame length is available for +horizontal resolution, the visible part of the horizontal scan line (this +allows, roughly, for borders and sweepback time -- that is, the time required +for the beam to move from the right screen edge to the left edge of the next +raster line). In this example, that's 944 ticks. + +Now, to get the normal 4:3 screen aspect ratio, set your vertical resolution +to 3/4ths of the horizontal resolution you just calculated. For this +example, that's 708 ticks. To get your actual VFL, multiply that by 1.05 +to get 743 ticks. + +The 4:3 is not technically magic; nothing prevents you from using a +non-Golden-Section ratio if that will get the best use out of your +screen real estate. It does make figuring frame height and frame +width from the diagonal size convenient, you just multiply the +diagonal by by 0.8 to get width and 0.6 to get height. + +So, HFL=1176 and VFL=743. Dividing 65MHz by the product of the two gives +us a nice, healthy 74.4Hz refresh rate. Excellent! Better than VESA standard! +And you got 944x708 to boot, more than the 800 by 600 you were probably +expecting. Not bad at all! + +You can even improve the refresh rate further, to almost 76 Hz, by using the +fact that monitors can often sync horizontally at 2khz or so higher than rated, +and by lowering VFL somewhat (that is, taking less than 75% of 944 in the +example above). But before you try this "overdriving" maneuver, if you do, +make <em>sure</em> that your monitor electron guns can sync up to 76 Hz +vertical. (the popular NEC 4D, for instance, cannot. It goes only up to 75 Hz +VSF). (See <ref id="overd" name="Overdriving Your Monitor"> for more general +discussion of this issue. ) + +So far, most of this is simple arithmetic and basic facts about raster +displays. Hardly any black magic at all! + +<sect>Black Magic and Sync Pulses<label id="magic"> +<p> + +OK, now you've computed HFL/VFL numbers for your chosen dot clock, found the +refresh rate acceptable, and checked that you have enough VRAM. Now for the +real black magic -- you need to know when and where to place synchronization +pulses. + +The sync pulses actually control the horizontal and vertical scan frequebcies +of the monitor. The HSF and VSF you've pulled off the spec sheet are nominal, +approximate maximum sync frequencies. The sync pulse in the signal from the +adapter card tells the monitor how fast to actually run. + +Recall the two pictures above? Only part of the time required for +raster-scanning a frame is used for displaying viewable image (ie. your +resolution). + +<sect1>Horizontal Sync: +<p> + +By previous definition, it takes HFL ticks to trace the a horizontal scan line. +Let's call the visible tick count (your horizontal screen resolution) HR. Then +Obviously, HR < HFL by definition. For concreteness, let's assume both start +at the same instant as shown below: +<code> + |___ __ __ __ __ __ __ __ __ __ __ __ __ + |_ _ _ _ _ _ _ _ _ _ _ _ | + |_______________________|_______________|_____ + 0 ^ ^ unit: ticks + | ^ ^ | + HR | | HFL + | |<----->| | + |<->| HSP |<->| + HGT1 HGT2 +</code> + +Now, we would like to place a sync pulse of length HSP as shown above, ie, +between the end of clock ticks for display data and the end of clock ticks for +the entire frame. Why so? because if we can achieve this, then your screen +image won't shift to the right or to the left. It will be where it supposed to +be on the screen, covering squarely the monitor's viewable area. + +Furthermore, we want about 30 ticks of "guard time" on either side of the sync +pulse. This is represented by HGT1 and HGT2. In a typical configuration HGT1 +!= HGT2, but if you're building a configuration from scratch, you want to start +your experimentation with them equal (that is, with the sync pulse centered). + +The symptom of a misplaced sync pulse is that the image is displaced on the +screen, with one border excessively wide and the other side of the image +wrapped around the screen edge, producing a white edge line and a band of +"ghost image" on that side. A way-out-of-place vertical sync pulse can +actually cause the image to roll like a TV with a mis-adjusted vertical hold +(in fact, it's the same phenomenon at work). + +If you're lucky, your monitor's sync pulse widths will be documented on its +specification page. If not, here's where the real black magic starts... + +You'll have to do a little trial and error for this part. But most of the +time, we can safely assume that a sync pulse is about 3.5 to 4.0 microsecond +in length. + +For concretness again, let's take HSP to be 3.8 microseconds (which btw, is not +a bad value to start with when experimenting). + +Now, using the 65Mhz clock timing above, we know HSP is equivalent to 247 clock +ticks (= 65 * 10**6 * 3.8 * 10^-6) [recall M=10^6, micro=10^-6] + +Some makers like to quote their horizontal framing parameters as timings rather +than dot widths. You may see the following terms: +<descrip> +<tag/active time (HAT)/ + Corresponds to HR, but in milliseconds. HAT * DCF = HR. +<tag/blanking time (HBT)/ + Corresponds to (HFL - HR), but in milliseconds. HBT * DCF = (HFL - + HR). +<tag/front porch (HFP)/ + This is just HGT1. +<tag/sync time/ + This is just HSP. +<tag/back porch (HBP)/ + This is just HGT2. +</descrip> + +<sect1>Vertical Sync: +<p> + +Going back to the picture above, how do we place the 247 clock ticks as shown +in the picture? + +Using our example, HR is 944 and HFL is 1176. The difference between the two +is 1176 - 944=232 < 247! Obviously we have to do some adjustment here. What +can we do? + +The first thing is to raise 1176 to 1184, and lower 944 to 936. Now the +difference = 1184-936= 248. Hmm, closer. + +Next, instead using 3.8, we use 3.5 for calculating HSP; then, we have +65*3.5=227. Looks better. But 248 is not much higher than 227. It's normally +necessary to have 30 or so clock ticks between HR and the start of SP, and the +same for the end of SP and HFL. AND they have to be multiple of eight! Are we +stuck? + +No. Let's do this, 936 % 8 = 0, (936 + 32) % 8 = 0 too. But 936 + 32 = 968, +968 + 227 = 1195, 1195 + 32 = 1227. Hmm.. this looks not too bad. But it's +not a multiple of 8, so let's round it up to 1232. + +But now we have potential trouble, the sync pulse is no longer placed right in +the middle between h and H any more. Happily, using our calculator we find +1232 - 32 = 1200 is also a multiple of 8 and (1232 - 32) - 968 = 232 +corresponding using a sync pulse of 3.57 micro second long, still +reasonable. + +In addition, 936/1232 ~ 0.76 or 76%, still not far from 80%, so it should be +all right. + +Furthermore, using the current horizontal frame length, we basically ask our +monitor to sync at 52.7khz (= 65Mhz/1232) which is within its capability. No +problems. + +Using rules of thumb we mentioned before, 936*75%=702, This is our new vertical +resolution. 702 * 1.05 = 737, our new vertical frame length. + +Screen refresh rate = 65Mhz/(737*1232)=71.6 Hz. This is still excellent. + +Figuring the vertical sync pulse layout is similar: +<code> + |___ __ __ __ __ __ __ __ __ __ __ __ __ + |_ _ _ _ _ _ _ _ _ _ _ _ | + |_______________________|_______________|_____ + 0 VR VFL unit: ticks + ^ ^ ^ + | | | + |<->|<----->| + VGT VSP +</code> + +We start the sync pulse just past the end of the vertical display data ticks. +VGT is the vertical guard time required for the sync pulse. Most monitors are +comfortable with a VGT of 0 (no guard time) and we'll use that in this +example. A few need two or three ticks of guard time, and it usually doesn't +hurt to add that. + +Returning to the example: since by the defintion of frame length, a vertical +tick is the time for tracing a complete HORIZONTAL frame, therefore in our +example, it is 1232/65Mhz=18.95us. + +Experience shows that a vertical sync pulse should be in the range of 50us and +300us. As an example let's use 150us, which translates into 8 vertical clock +ticks (150us/18.95us~8). + +Some makers like to quote their vertical framing parameters as timings rather +than dot widths. You may see the following terms: + +<descrip> +<tag/active time (VAT)/ + Corresponds to VR, but in milliseconds. VAT * VSF = VR. +<tag/blanking time (VBT)/ + Corresponds to (VFL - VR), but in milliseconds. VBT * VSF = (VFL - VR). +<tag/front porch (VFP)/ + This is just VGT. +<tag/sync time/ + This is just VSP. +<tag/back porch (VBP)/ + This is like a second guard time after the vertical sync pulse. It + is often zero. +</descrip> + +<sect>Putting it All Together<label id="synth"> +<p> + +The Xconfig file Table of Video Modes contains lines of numbers, with each line +being a complete specification for one mode of X-server operation. The fields +are grouped into four sections, the name section, the clock frequency section, +the horizontal section, and the vertical section. + +The name section contains one field, the name of the video mode specified by +the rest of the line. This name is referred to on the "Modes" line of the +Graphics Driver Setup section of the Xconfig file. The name field may be +omitted if the name of a previous line is the same as the current line. + +The dot clock section contains only the dot clock (what we've called DCF) field +of the video mode line. The number in this field specifies what dot clock was +used to generate the numbers in the following sections. + +The horizontal section consists of four fields which specify how each +horizontal line on the display is to be generated. The first field of the +section contains the number of dots per line which will be illuminated to form +the picture (what we've called HR). The second field of the section indicates +at which dot the horizontal sync pulse will begin. The third field indicates +at which dot the horizontal sync pulse will end. The fourth field specifies +the toal horzontal frame length (HFL). + +The vertical section also contains four fields. The first field contains the +number of visible lines which will appear on the display (VR). The second +field indicates the line number at which the vertical sync pulse will begin. +The third field specifies the line number at which the vertical sync pulse will +end. The fourth field contains the total vertical frame length (VFL). + +Example: +<tscreen><verb> + #Modename clock horizontal timing vertical timing + + "752x564" 40 752 784 944 1088 564 567 569 611 + 44.5 752 792 976 1240 564 567 570 600 +</verb></tscreen> +(Note: stock X11R5 doesn't support fractional dot clocks.) + +For Xconfig, all of the numbers just mentioned - the number of illuminated dots +on the line, the number of dots separating the illuminated dots from the +beginning of the sync pulse, the number of dots representing the duration of +the pulse, and the number of dots after the end of the sync pulse - are added +to produce the number of dots per line. The number of horizontal dots must be +evenly divisible by eight. + +Example horizontal numbers: 800 864 1024 1088 + +This sample line has the number of illuminated dots (800) followed by the +number of the dot when the sync pulse starts (864), followed by the number of +the dot when the sync pulse ends (1024), followed by the number of the last dot +on the horizontal line (1088). + +Note again that all of the horizontal numbers (800, 864, 1024, and 1088) are +divisible by eight! This is not required of the vertical numbers. + +The number of lines from the top of the display to the bottom form the frame. +The basic timing signal for a frame is the line. A number of lines will +contain the picture. After the last illuminated line has been displayed, a +delay of a number of lines will occur before the vertical sync pulse is +generated. Then the sync pulse will last for a few lines, and finally the last +lines in the frame, the delay required after the pulse, will be generated. The +numbers that specify this mode of operation are entered in a manner similar to +the following example. + +Example vertical numbers: 600 603 609 630 + +This example indicates that there are 600 visible lines on the display, that +the vertical sync pulse starts with the 603rd line and ends with the 609th, and +that there are 630 total lines being used. + +Note that the vertical numbers don't have to be divisible by eight! + +Let's return to the example we've been working. According to the above, all +we need to do from now on is to write our result into Xconfig as follows: +<tscreen><verb> +<name> DCF HR SH1 SH2 HFL VR SV1 SV2 VFL +</verb></tscreen> +where SH1 is the start tick of the horizontal sync pulse and SH2 is its end +tick; similarly, SV1 is the start tick of the vertical sync pulse and SV2 is +its end tick. +<tscreen><verb> +#name clock horizontal timing vertical timing flag +936x702 65 936 968 1200 1232 702 702 710 737 +</verb></tscreen> +No special flag necessary; this is a non-interlaced mode. Now we are really +done. + +<sect>Overdriving Your Monitor<label id="overd"> +<p> + +You should absolutely <EM>not</EM> try exceeding your monitor's scan +rates if it's a fixed-frequency type. You can smoke your hardware +doing this! There are potentially subtler problems with overdriving a +multisync monitor which you should be aware of. + +Having a pixel clock higher than the monitor's maximum bandwidth is +rather harmless, in contrast. (Note: the theoretical limit of +discernible features is reached when the pixel clock reaches double +the monitor's bandwidth. This is a straightforward application of +Nyquist's Theorem: consider the pixels as a spatially distributed +series of samples of the drive signals and you'll see why.) + +It's exceeding the rated maximum sync frequencies that's problematic. +Some modern monitors might have protection circuitry that shuts the +monitor down at dangerous scan rates, but don't rely on it. In +particular there are older multisync monitors (like the Multisync II) +which use just one horizontal transformer. These monitors will not +have much protection against overdriving them. While you necessarily +have high voltage regulation circuitry (which can be absent in fixed +frequency monitors), it will not necessarily cover every conceivable +frequency range, especially in cheaper models. This not only implies +more wear on the circuitry, it can also cause the screen phosphors to +age faster, and cause more than the specified radiation (including X-rays) +to be emitted from the monitor. + +Another importance of the bandwidth is that the monitor's input +impedance is specified only for that range, and using higher +frequencies can cause reflections probably causing minor screen +interferences, and radio disturbance. + +However, the basic problematic magnitude in question here is the slew +rate (the steepness of the video signals) of the video output drivers, +and that is usually independent of the actual pixel frequency, but +(if your board manufacturer cares about such problems) related +to the maximum pixel frequency of the board. + +So be careful out there... + +<sect>Using Interlaced Modes<label id="inter"> +<p> + +(This section is largely due to David Kastrup +<dak@pool.informatik.rwth-aachen.de>) + +At a fixed dot clock, an interlaced display is going to have +considerably less noticable flicker than a non-interlaced display, if +the vertical circuitry of your monitor is able to support it stably. +It is because of this that interlaced modes were invented in the first +place. + +Interlaced modes got their bad repute because they are inferior to +their non-interlaced companions at the same vertical scan frequency, +VSF (which is what is usually given in advertisements). But they are +definitely superior at the same horizontal scan rate, and that's where +the decisive limits of your monitor/graphics card usually lie. + +At a fixed <EM>refresh rate</EM> (or half frame rate, or VSF) the +interlaced display will flicker more: a 90Hz interlaced display will +be inferior to a 90Hz non-interlaced display. It will, however, need +only half the video bandwidth and half the horizontal scan rate. If +you compared it to a non-interlaced mode with the same dot clock and +the same scan rates, it would be vastly superior: 45Hz non-interlaced +is intolerable. With 90Hz interlaced, I have worked for years with my +Multisync 3D (at 1024x768) and am very satisfied. I'd guess you'd need +at least a 70Hz non-interlaced display for similar comfort. + +You have to watch a few points, though: use interlaced modes only at +high resolutions, so that the alternately lighted lines are close +together. You might want to play with sync pulse widths and positions +to get the most stable line positions. If alternating lines are bright +and dark, interlace will <EM>jump</EM> at you. I have one application that +chooses such a dot pattern for a menu background (XCept, no other +application I know does that, fortunately). I switch to 800x600 for +using XCept because it really hurts my eyes otherwise. + +For the same reason, use at least 100dpi fonts, or other fonts where +horizontal beams are at least two lines thick (for high resolutions, +nothing else will make sense anyhow). + +And of course, never use an interlaced mode when your hardware would +support a non-interlaced one with similar refresh rate. + +If, however, you find that for some resolution you are pushing either +monitor or graphics card to their upper limits, and getting +dissatisfactorily flickery or outwashed (bandwidth exceeded) display, +you might want to try tackling the same resolution using an +interlaced mode. Of course this is useless if the VSF +of your monitor is already close to its limits. + +Design of interlaced modes is easy: do it like a non-interlaced +mode. Just two more considerations are necessary: you need an odd +total number of vertical lines (the last number in your mode line), and +when you specify the "interlace" flag, the actual vertical frame rate +for your monitor doubles. Your monitor needs to support a 90Hz frame +rate if the mode you specified looks like a 45Hz mode apart from the +"Interlace" flag. + +As an example, here is my modeline for 1024x768 interlaced: my +Multisync 3D will support up to 90Hz vertical and 38kHz horizontal. + +<tscreen><verb> +ModeLine "1024x768" 45 1024 1048 1208 1248 768 768 776 807 Interlace +</verb></tscreen> + +Both limits are pretty much exhausted with this mode. Specifying the +same mode, just without the "Interlace" flag, still is almost at the +limit of the monitor's horizontal capacity (and strictly speaking, a +bit under the lower limit of vertical scan rate), but produces an +intolerably flickery display. + +Basic design rules: if you have designed a mode at less than half of +your monitor's vertical capacity, make the vertical total of lines odd +and add the "Interlace" flag. The display's quality should vastly +improve in most cases. + +If you have a non-interlaced mode otherwise exhausting your monitor's +specs where the vertical scan rate lies about 30% or more under the +maximum of your monitor, hand-designing an interlaced mode (probably +with somewhat higher resolution) could deliver superior results, but I +won't promise it. + +<sect>Questions and Answers<label id="answe"> +<p> + + Q. The example you gave is not a standard screen size, can I use it? + + A. Why not? There is NO reason whatsover why you have to use 640x480, +800x600, or even 1024x768. The XFree86 servers let you configure your hardware +with a lot of freedom. It usually takes two to three tries to come up the +right one. The important thing to shoot for is high refresh rate with +reasonable viewing area. not high resolution at the price of eye-tearing +flicker! + + Q. It this the only resolution given the 65Mhz dot clock and 55Khz HSF? + + A. Absolutely not! You are encouraged to follow the general procedure and +do some trial-and-error to come up a setting that's really to your liking. +Experimenting with this can be lots of fun. Most settings may just give you +nasty video hash, but in practice a modern multi-sync monitor is usually not +damaged easily. Be sure though, that your monitor can support the frame +rates of your mode before using it for longer times. + + Beware fixed-frequency monitors! This kind of hacking around can damage +them rather quickly. Be sure you use valid refresh rates for <EM>every</EM> +experiment on them. + + Q. You just mentioned two standard resolutions. In Xconfig, there are many +standard resolutions available, can you tell me whether there's any point in +tinkering with timings? + + A. Absolutely! Take, for example, the "standard" 640x480 listed in the +current Xconfig. It employes 25Mhz driving frequency, frame lengths are 800 +and 525 => refresh rate ~ 59.5Hz. Not too bad. But 28Mhz is a commonly +available driving frequency from many SVGA boards. If we use it to drive +640x480, following the procedure we discussed above, you would get frame +lengths like 812 and 505. Now the refresh rate is raised to 68Hz, a +quite significant improvement over the standard one. + + Q. Can you summarize what we have discussed so far? + + A. In a nutshell: + +<enum> +<item> +for any fixed driving frequency, raising max resolution incurs the penalty +of lowering refresh rate and thus introducing more flicker. +<item> +if high resolution is desirable and your monitor supports it, try to +get a SVGA card that provides a matching dot clock or DCF. The higher, +the better! +</enum> + +<sect>Fixing Problems with the Image.<label id="fixes"> +<p> + +OK, so you've got your X configuration numbers. You put them in Xconfig with +a test mode label. You fire up X, hot-key to the new mode, ... and the image +doesn't look right. What do you do? Here's a list of common problems and how +to fix them. + +(Fixing these minor distortions is where <bf>xvidtune</bf>(1) really shines.) + +You <em>move</em> the image by changing the sync pulse timing. You +<em>scale</em> it by changing the frame length (you need to move the +sync pulse to keep it in the same relative position, otherwise scaling will +move the image as well). Here are some more specific recipes: + +The horizontal and vertical positions are independent. That is, moving the +image horizontally doesn't affect placement vertically, or vice-versa. +However, the same is not quite true of scaling. While changing the horizontal +size does nothing to the vertical size or vice versa, the total change in both +may be limited. In particular, if your image is too large in both dimensions +you will probably have to go to a higher dot clock to fix it. Since this +raises the usable resolution, it is seldom a problem! + +<sect1>The image is displaced to the left or right +<p> + +To fix this, move the horizontal sync pulse. That is, increment or decrement +(by a multiple of 8) the middle two numbers of the horizontal timing section +that define the leading and trailing edge of the horizontal sync pulse. + +If the image is shifted left (right border too large, you want to move +the image to the right) decrement the numbers. If the image is shifted right +(left border too large, you want it to move left) increment the sync pulse. + +<sect1>The image is displaced up or down +<p> + +To fix this, move the vertical sync pulse. That is, increment or decrement the +middle two numbers of the vertical timing section that define the leading and +trailing edge of the vertical sync pulse. + +If the image is shifted up (lower border too large, you want to move the image +down) decrement the numbers. If the image is shifted down (top border too +large, you want it to move up) increment the numbers. + +<sect1>The image is too large both horizontally and vertically +<p> + +Switch to a higher card clock speed. If you have multiple modes in your +clock file, possibly a lower-speed one is being activated by mistake. + +<sect1>The image is too wide (too narrow) horizontally +<p> + +To fix this, increase (decrease) the horizontal frame length. That is, change +the fourth number in the first timing section. To avoid moving the image, also +move the sync pulse (second and third numbers) half as far, to keep it in the +same relative position. + +<sect1>The image is too deep (too shallow) vertically +<p> + +To fix this, increase (decrease) the vertical frame length. That is, change +the fourth number in the second timing section. To avoid moving the image, +also move the sync pulse (second and third numbers) half as far, to keep it in +the same relative position. + +Any distortion that can't be handled by combining these techniques is probably +evidence of something more basically wrong, like a calculation mistake or a +faster dot clock than the monitor can handle. + +Finally, remember that increasing either frame length will decrease your +refresh rate, and vice-versa. + +<sect>Plotting Monitor Capabilities<label id="cplot"> +<p> + +To plot a monitor mode diagram, you'll need the gnuplot package (a +freeware plotting language for UNIX-like operating systems) and the +tool <TT>modeplot</TT>, a shell/gnuplot script to plot the diagram from your +monitor characteristics, entered as command-line options. + +Here is a copy of modeplot: + +<code> +#!/bin/sh +# +# modeplot -- generate X mode plot of available monitor modes +# +# Do `modeplot -?' to see the control options. +# +# (Id: video-modes.sgml,v 1.2 1997/08/08 15:07:24 esr Exp $) + +# Monitor description. Bandwidth in MHz, horizontal frequencies in kHz +# and vertical frequencies in Hz. +TITLE="Viewsonic 21PS" +BANDWIDTH=185 +MINHSF=31 +MAXHSF=85 +MINVSF=50 +MAXVSF=160 +ASPECT="4/3" +vesa=72.5 # VESA-recommended minimum refresh rate + +while [ "$1" != "" ] +do + case $1 in + -t) TITLE="$2"; shift;; + -b) BANDWIDTH="$2"; shift;; + -h) MINHSF="$2" MAXHSF="$3"; shift; shift;; + -v) MINVSF="$2" MAXVSF="$3"; shift; shift;; + -a) ASPECT="$2"; shift;; + -g) GNUOPTS="$2"; shift;; + -?) cat <<EOF +modeplot control switches: + +-t "<description>" name of monitor defaults to "Viewsonic 21PS" +-b <nn> bandwidth in MHz defaults to 185 +-h <min> <max> min & max HSF (kHz) defaults to 31 85 +-v <min> <max> min & max VSF (Hz) defaults to 50 160 +-a <aspect ratio> aspect ratio defaults to 4/3 +-g "<options>" pass options to gnuplot + +The -b, -h and -v options are required, -a, -t, -g optional. You can +use -g to pass a device type to gnuplot so that (for example) modeplot's +output can be redirected to a printer. See gnuplot(1) for details. + +The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on +analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de> + +This is modeplot Revision: 1.2 $ +EOF + exit;; + esac + shift +done + +gnuplot $GNUOPTS <<EOF +set title "$TITLE Mode Plot" + +# Magic numbers. Unfortunately, the plot is quite sensitive to changes in +# these, and they may fail to represent reality on some monitors. We need +# to fix values to get even an approximation of the mode diagram. These come +# from looking at lots of values in the ModeDB database. +F1 = 1.30 # multiplier to convert horizontal resolution to frame width +F2 = 1.05 # multiplier to convert vertical resolution to frame height + +# Function definitions (multiplication by 1.0 forces real-number arithmetic) +ac = (1.0*$ASPECT)*F1/F2 +refresh(hsync, dcf) = ac * (hsync**2)/(1.0*dcf) +dotclock(hsync, rr) = ac * (hsync**2)/(1.0*rr) +resolution(hv, dcf) = dcf * (10**6)/(hv * F1 * F2) + +# Put labels on the axes +set xlabel 'DCF (MHz)' +set ylabel 'RR (Hz)' 6 # Put it right over the Y axis + +# Generate diagram +set grid +set label "VB" at $BANDWIDTH+1, ($MAXVSF + $MINVSF) / 2 left +set arrow from $BANDWIDTH, $MINVSF to $BANDWIDTH, $MAXVSF nohead +set label "max VSF" at 1, $MAXVSF-1.5 +set arrow from 0, $MAXVSF to $BANDWIDTH, $MAXVSF nohead +set label "min VSF" at 1, $MINVSF-1.5 +set arrow from 0, $MINVSF to $BANDWIDTH, $MINVSF nohead +set label "min HSF" at dotclock($MINHSF, $MAXVSF+17), $MAXVSF + 17 right +set label "max HSF" at dotclock($MAXHSF, $MAXVSF+17), $MAXVSF + 17 right +set label "VESA $vesa" at 1, $vesa-1.5 +set arrow from 0, $vesa to $BANDWIDTH, $vesa nohead # style -1 +plot [dcf=0:1.1*$BANDWIDTH] [$MINVSF-10:$MAXVSF+20] \ + refresh($MINHSF, dcf) notitle with lines 1, \ + refresh($MAXHSF, dcf) notitle with lines 1, \ + resolution(640*480, dcf) title "640x480 " with points 2, \ + resolution(800*600, dcf) title "800x600 " with points 3, \ + resolution(1024*768, dcf) title "1024x768 " with points 4, \ + resolution(1280*1024, dcf) title "1280x1024" with points 5, \ + resolution(1600*1280, dcf) title "1600x1200" with points 6 + +pause 9999 +EOF +</code> + +Once you know you have <TT>modeplot</TT> and the gnuplot package in +place, you'll need the following monitor characteristics: + +<itemize> +<item> video bandwidth (VB) +<item> range of horizontal sync frequency (HSF) +<item> range of vertical sync frequency (VSF) +</itemize> + +The plot program needs to make some simplifying assumptions which are +not necessarily correct. This is the reason why the resulting diagram is +only a rough description. These assumptions are: + +<enum> +<item> All resolutions have a single fixed aspect ratio AR = HR/VR. +Standard resolutions have AR = 4/3 or AR = 5/4. The <TT>modeplot</TT> +programs assumes 4/3 by default, but you can override this. +<item> For the modes considered, horizontal and vertical frame lengths are +fixed multiples of horizontal and vertical resolutions, respectively: + +<tscreen><verb> + HFL = F1 * HR + VFL = F2 * VR +</verb></tscreen> +</enum> + +As a rough guide, take F1 = 1.30 and F2 = 1.05 (see <ref id=frame> +"Computing Frame Sizes"). + +Now take a particular sync frequency, HSF. Given the assumptions just +presented, every value for the clock rate DCF already determines the +refresh rate RR, i.e. for every value of HSF there is a function RR(DCF). +This can be derived as follows. + +The refresh rate is equal to the clock rate divided by the product of the +frame sizes: + +<tscreen><verb> + RR = DCF / (HFL * VFL) (*) +</verb></tscreen> + +On the other hand, the horizontal frame length is equal to the clock rate +divided by the horizontal sync frequency: + +<tscreen><verb> + HFL = DCF / HSF (**) +</verb></tscreen> + +VFL can be reduced to HFL be means of the two assumptions above: + +<tscreen><verb> + VFL = F2 * VR + = F2 * (HR / AR) + = (F2/F1) * HFL / AR (***) +</verb></tscreen> + +Inserting (**) and (***) into (*) we obtain: + +<tscreen><verb> + RR = DCF / ((F2/F1) * HFL**2 / AR) + = (F1/F2) * AR * DCF * (HSF/DCF)**2 + = (F1/F2) * AR * HSF**2 / DCF +</verb></tscreen> + +For fixed HSF, F1, F2 and AR, this is a hyperbola in our diagram. Drawing +two such curves for minimum and maximum horizontal sync frequencies we +have obtained the two remaining boundaries of the permitted region. + +The straight lines crossing the capability region represent particular +resolutions. This is based on (*) and the second assumption: + +<tscreen><verb> + RR = DCF / (HFL * VFL) = DCF / (F1 * HR * F2 * VR) +</verb></tscreen> + +By drawing such lines for all resolutions one is interested in, one +can immediately read off the possible relations between resolution, +clock rate and refresh rate of which the monitor is capable. Note that +these lines do not depend on monitor properties, but they do depend on +the second assumption. + +The <TT>modeplot</TT> tool provides you with an easy way to do this. Do +<TT>modeplot -?</TT> to see its control options. A typical invocation +looks like this: + +<tscreen><verb> + modeplot -t "Swan SW617" -b 85 -v 50 90 -h 31 58 +</verb></tscreen> + +The -b option specifies video bandwidth; -v and -h set horizontal and +vertical sync frequency ranges. + +When reading the output of <TT>modeplot</TT>, always bear in mind that +it gives only an approximate description. For example, it disregards +limitations on HFL resulting from a minimum required sync pulse width, +and it can only be accurate as far as the assumptions are. It is +therefore no substitute for a detailed calculation (involving some +black magic) as presented in <ref id="synth" name="Putting it All +Together">. However, it should give you a better feeling for what +is possible and which tradeoffs are involved. + +<sect>Credits<label id="credi"> +<p> + +The original ancestor of this document was by Chin Fang +<fangchin@leland.stanford.edu>. + +Eric S. Raymond <esr@snark.thyrsus.com> reworked, reorganized, and +massively rewrote Chin Fang's original in an attempt to understand it. In +the process, he merged in most of a different how-to by Bob Crosson +<crosson@cam.nist.gov>. + +The material on interlaced modes is largely by David Kastrup +<dak@pool.informatik.rwth-aachen.de> + +Martin Lottermoser <Martin.Lottermoser@mch.sni.de> contributed +the idea of using gnuplot to make mode diagrams and did the +mathematical analysis behind <TT>modeplot</TT>. The distributed +<TT>modeplot</TT> was redesigned and generalized by ESR from +Martin's original gnuplot code for one case. +<verb> +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VideoModes.sgml,v 1.1 2001/06/04 13:50:16 dawes Exp $ + + + + + +$XConsortium: VidModes.sgml /main/7 1996/02/21 17:46:17 kaleb $ +</verb> + +</article> + +<!-- +The following sets edit modes for GNU EMACS +Local Variables: +fill-prefix:"\t" +fill-column:75 +End: +-- > Index: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.37 xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.39 --- xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.37 Mon Apr 16 11:02:08 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml Wed Jan 16 11:25:54 2002 @@ -15,7 +15,7 @@ <ident> -$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/sgml/ati.sgml,v 3.39 2002/01/16 16:25:54 tsi Exp $ </ident> <abstract> @@ -559,7 +559,8 @@ <item>Colour depth greater than 8 on non-integrated controllers, where permitted by the hardware. <item>Mach32, Mach8 and 8514/A Draw Engines. -<item>Hardware cursors. +<item>Hardware cursors where implemented by hardware. +This has already been done for Mach64 integrated controllers. <item>TVOut, i.e. the ability to use a television screen as a monitor. <item>Motion Video, i.e. displaying an asynchronous data stream (TV signal, DVD, etc.) in a window or full-screen. @@ -573,9 +574,11 @@ name="ftp://ftp.xfree86.org/pub/XFree86" url="ftp://ftp.xfree86.org/pub/XFree86"> if you are uncertain.<p> Secondly, please check XFree86's doc directory for additional information.<p> +<!-- Thirdly, do not forget to read <htmlurl name="http://www.xfree86.org/FAQ" url="http://www.xfree86.org/FAQ">.<p> -Fourth, a scan through the comp.windows.x.i386unix and comp.os.linux.x +--> +Thirdly, a scan through the comp.windows.x.i386unix and comp.os.linux.x 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> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml:3.36 xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml:3.38 --- xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml:3.36 Fri May 18 20:35:42 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml Mon Oct 1 09:44:02 2001 @@ -11,7 +11,7 @@ <date> 1st January 2001 <ident> -$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/sgml/chips.sgml,v 3.38 2001/10/01 13:44:02 eich Exp $ </ident> <!-- Table of contents --> @@ -590,9 +590,16 @@ <quote><verb> Modeline "800x600@8bpp" 30.150 800 896 960 1056 600 600 604 628 Options: "FixPanelSize", "UseModeline" -Test on a Zeos Meridan 850c (800x600 DSTN, 65545, 1Mbyte) +Tested on a Zeos Meridan 850c (800x600 DSTN, 65545, 1Mbyte) </verb></quote> +The IBM PC110 works best with a 15MHz clock (Thanks to Alan Cox): +<quote><verb> +Modeline "640x480" 15.00 640 672 728 816 480 489 496 526 +Options: "TextClockFreq" "15.00" +IBM PC110 (65535, Citizen L6481L-FF DSTN) +</verb></quote> + The NEC Versa 4080 just needs the "FixPanelSize" option. To the best of my knowledge no machine with a HiQV needs the "UseModeline" or "FixPanelSize" options. @@ -973,7 +980,7 @@ The XVideo extension has only recently been added to the chips driver. Some YUV to RGB colour have been noted at 15 and 16 bit colour depths. However, 8 and 24 bit colour depths seem to work fine. -<tag> My ct69030 machine locks up when starting XFree</tag> +<tag> My ct69030 machine locks up when starting XFree86</tag> The ct69030 chipset introduced a new dual channel architecture. In its current form, XFree86 can not take advantage of this second display channel. In fact if the video BIOS on the machine sets the ct69030 Index: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.16.2.3 xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.22 --- xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.16.2.3 Sat Jun 2 12:17:40 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent Wed Jan 16 15:38:45 2002 @@ -1,28 +1,28 @@ -<!-- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent,v 1.16.2.3 2001/06/02 16:17:40 dawes Exp $ --> +<!-- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent,v 1.22 2002/01/16 20:38:45 dawes Exp $ --> <!-- shared entity definitions for the XFree86 documentation --> <!-- XFree86 version string --> -<!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 relvers CDATA "4.2.0"> +<!ENTITY prevrelvers CDATA "4.1.0"> +<!ENTITY fullrelvers CDATA "4.2.0"> +<!ENTITY prevfullrelvers CDATA "4.1.0"> +<!ENTITY nextfullrelvers CDATA "4.3.0"> +<!ENTITY nextfullreldate CDATA "May 2002"> +<!ENTITY nextupdrelvers CDATA "4.2.1"> +<!ENTITY srcvers CDATA "420"> +<!ENTITY prevsrcvers CDATA "410"> +<!ENTITY fullsrcvers CDATA "420"> +<!ENTITY prevfullsrcvers CDATA "410"> +<!ENTITY whichfullrel CDATA "fifth"> <!ENTITY whichupdaterel CDATA "none"> +<!ENTITY relbranchtag CDATA "xf-4_2-branch"> <!-- Version of the most recent 3.3.x release --> <!ENTITY legacyvers CDATA "3.3.6"> -<!-- SuperProbe version strings --> -<!ENTITY spvers CDATA "2.23"> -<!ENTITY legacyspvers CDATA "2.21"> - <!-- doctools version strings --> -<!ENTITY doctoolsvers CDATA "1.2"> +<!ENTITY doctoolsvers CDATA "1.3"> <!-- These should be set according to which snapshot/release this is --> <!ENTITY % firstsnap 'IGNORE'> @@ -34,8 +34,8 @@ <!ENTITY % laterrel 'INCLUDE'> <!ENTITY % fullrel 'INCLUDE'> <!ENTITY % updaterel 'IGNORE'> -<!ENTITY % prevrelwasupdate 'INCLUDE'> +<!ENTITY % prevrelwasupdate 'IGNORE'> <!-- Set this to INCLUDE when references to the RELNOTES are to be included --> -<!ENTITY % haverelnotes 'IGNORE'> +<!ENTITY % haverelnotes 'INCLUDE'> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.13 xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.15 --- xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.13 Wed Feb 28 19:37:09 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml Mon Dec 17 14:25:36 2001 @@ -6,10 +6,10 @@ <title>Fonts in XFree86 <author>Juliusz Chroboczek, <email/jch@xfree86.org/ -<date>21 January 2001</date> +<date>26 November 2001</date> <ident> -$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/sgml/fonts.sgml,v 1.15 2001/12/17 19:25:36 dawes Exp $ </ident> <toc> @@ -463,47 +463,63 @@ /usr/X11R6/lib/X11/fonts/Speedo/font*.spd </verb></tscreen> -<sect1>The Bigelow & Holmes Lucidux family +<sect1>The Bigelow & Holmes Luxi family -<p>XFree86 includes the <it/Lucidux/ family of Type 1 fonts. This -family consists of the fonts <it/Lucidux Serif/, with XLFD +<p>XFree86 includes the <it/Luxi/ family of scalable fonts, in both +TrueType and Type 1 format. This family consists of the fonts +<it/Luxi Serif/, with XLFD <tscreen><verb> --b&h-lucidux serif-medium-*-normal--*-*-*-*-p-*-*-* +-b&h-luxi serif-medium-*-normal--*-*-*-*-p-*-*-* </verb></tscreen> -<it/Lucidux Sans/, with XLFD +<it/Luxi Sans/, with XLFD <tscreen><verb> --b&h-lucidux sans-medium-*-normal--*-*-*-*-p-*-*-* +-b&h-luxi sans-medium-*-normal--*-*-*-*-p-*-*-* </verb></tscreen> -and <it/Lucidux Mono/, with XLFD +and <it/Luxi Mono/, with XLFD <tscreen><verb> --b&h-lucidux mono-medium-*-normal--*-*-*-*-m-*-*-* +-b&h-luxi mono-medium-*-normal--*-*-*-*-m-*-*-* </verb></tscreen> -Each of these fonts currently comes in Roman and oblique variants -(bold variants will be included in a future release) and has 337 -glyphs covering the basic ASCII Unicode range, the Latin 1 -range, as well as the <it/Extended Latin/ range. In particular, +Each of these fonts comes Roman, oblique, bold and bold oblique variants +The TrueType version have glyphs covering the basic ASCII Unicode +range, the Latin 1 range, as well as the <it/Extended Latin/ +range and some additional punctuation characters. In particular, these fonts include all the glyphs needed for ISO 8859 parts 1, -2, 3, 4, 9 and 15. +2, 3, 4, 9, 13 and 15, as well as all the glyphs in the Adobe Standard +encoding and the Windows 3.1 character set. -The Lucidux fonts are original designs by Charles Bigelow and Kris -Holmes. Lucidux fonts include seriffed, sans serif, and monospaced -styles that share the same stem weight, x-height, capital height, -ascent and descent. Lucidux fonts harmonise with Lucida (R) fonts of -the same vertical proportions and weights. The character width -metrics of Lucidux roman fonts match those of core fonts bundled with -several window systems. - -Each PFA file has a copy of the license terms in PS comment lines. -The license terms are also included in the file `<tt/COPYRIGHT.BH/' -for convenience, as well as in the <htmlurl name="License document" -url="LICENSE.html">. - -The design and font outlines were donated by Charles Bigelow and -Kris Holmes from Bigelow and Holmes Inc., and the hinting was donated -by Berthold Horn and Blenda Horn from Y&Y, Inc. For more information, -please contact <email>design@bigelowandholmes.com</email> or -<email>sales@yandy.com</email>, or consult -<url name="Y&Y's web site" url="http://www.yandy.com">. +The glyph coverage of the Type 1 versions is somewhat reduced, +and only covers ISO 8859 parts 1, 2 and 15 as well as the Adobe +Standard encoding. + +The Luxi fonts are original designs by Kris Holmes and Charles +Bigelow. Luxi fonts include seriffed, sans serif, and monospaced +styles, in roman and oblique, and normal and bold weights. The fonts +share stem weight, x-height, capital height, ascent and descent, for +graphical harmony. + +The character width metrics of Luxi roman and bold fonts match those +of core fonts bundled with popular operating and window systems. + +The license terms for the Luxi fonts are included in the file +`<tt/COPYRIGHT.BH/', as well as in the <htmlurl +name="License document" url="LICENSE.html">. + +Charles Bigelow and Kris Holmes from Bigelow and Holmes Inc. +developed the Luxi typeface designs in Ikarus digital format. + +URW++ Design and Development GmbH converted the Ikarus format fonts +to TrueType and Type1 font programs and implemented the grid-fitting +"hints" and kerning tables in the Luxi fonts. + +For more information, please contact +<email>design@bigelowandholmes.com</email> or +<email>info@urwpp.de</email>, or consult +<url name="the URW++ web site" url="http://www.urwpp.de">. + +An earlier version of the Luxi fonts was made available under the +name <em/Lucidux/. This name should no longer be used due to trademark +uncertainties, and all traces of the <em/Lucidux/ name have been +removed from this version of XFree86. <sect>Fonts and internationalisation <label id="sec:internationalisation"> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre:1.11 xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre:1.13 --- xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre:1.11 Sun Dec 17 18:01:10 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre Tue Jan 15 16:24:46 2002 @@ -8,10 +8,10 @@ <!-- Title information --> <title>Documentation for XFree86™ version &relvers; <author>The XFree86 Project, Inc -<date>18 December 2000 +<date>18 January 2002 <!-- -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre,v 1.11 2000/12/17 23:01:10 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre,v 1.13 2002/01/15 21:24:46 dawes Exp $ --> <p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml:1.2 xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml:1.4 --- xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml:1.2 Tue Dec 12 13:54:29 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml Wed Jan 16 13:21:04 2002 @@ -4,39 +4,56 @@ <article> <title>Information for newport Users -<author>Guido Guenther -<date>1 August 2000 +<author>Guido Günther +<date>16 January 2002 <ident> -$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/sgml/newport.sgml,v 1.4 2002/01/16 18:21:04 dawes Exp $ </ident> <toc> <sect>Supported Hardware <p> This is an unaccelerated driver for the SGI Indy's newport cards. Both the - 8bit and 24bit versions are tested and working with some limitations(see below). -The 24bit newport additionally works in 8bit mode only. + 8bit and 24bit versions are tested and working. + +<sect>Features +<p> +<itemize> + <item> support for 8 and 24 bit pixel depths +</itemize> + <sect>Notes <p> <itemize> <item>X -configure does not generate a XF86Config file + <item>Restoration of the console fails on some variants of the newport + (Cmap revision C) + <item>There's only a 1280x1024 mode </itemize> <sect>Configuration <p> -The following Section "Device" options are supported by the newport driver: +The driver auto-detects all device information necessary to +initialize the card. The only lines you need in the "Device" +section of your XF86Config file are: +<verb> + Section "Device" + Identifier "SGI newport" + Driver "newport" + EndSection +</verb> + +However, if you have problems with auto-detection, you can specify: <itemize> - <item>Option "bitplanes" "x" - Gives the maximum number of bitplanes your card supports (8 or 24). + <item>bitplanes - number of physical bitplanes (8 or 24) </itemize> - <sect>Authors <p> <itemize> - <item>Guido Guenther <email>guido.guenther@gmx.net</email> + <item>Guido Guenther <email>agx@sigxcpu.org</email> </itemize> @@ -45,8 +62,8 @@ <itemize> <item>Gleb O. Raiko <email>raiko@niisi.msk.ru</email> for getting the beast to build <item>Ralf Baechle <email>ralf@oss.sgi.com</email> for his patience... - <item>Ulf Carlsson <email>ulfc@calypso.engr.sgi.com</email> for comments and the dynamic loader code - <item>Nina A. Podolskaya <email>nap@niisi.msk.ru</email> for dynamic loader code + <item>Ulf Carlsson <email>ulfc@calypso.engr.sgi.com</email> for comments and elf loader code + <item>Nina A. Podolskaya <email>nap@niisi.msk.ru</email> for elf loader code <item>all the guys who wrote the newport_con linux kernel code </itemize> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml:1.3 xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml:1.5 --- xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml:1.3 Tue Nov 28 15:59:17 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml Fri Dec 21 16:01:57 2001 @@ -5,20 +5,20 @@ <article> <title> Information for S3 ViRGE Users <author>The XFree86 Project Inc. -<date>10 Jul 1999 +<date>19 Dec 2001 <ident> -$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/sgml/s3virge.sgml,v 1.5 2001/12/21 21:01:57 dawes Exp $ </ident> <toc> <sect> Supported hardware <p> -The s3virge driver in XFree86 &relvers; supports the S3 ViRGE, ViRGE DX, GX, MX, MX+, and VX chipsets. A majority of testing is done on ViRGE DX chips, making them the most stable to date. This release has improved support for ViRGE GX2 stability, XVideo support for ViRGE DX (tested) and ViRGE (untested) in depth 16 and 24, conversion to fb framebuffer rendering, and support for the new Render extension (untested). +The s3virge driver in XFree86 &relvers; supports the S3 ViRGE, ViRGE DX, GX, GX2, MX, MX+, and VX chipsets. It also supports Trio3D and Trio3D/2x chips. A majority of testing is done on ViRGE DX chips, making them the most stable to date. This release has some stabilization fixes for MX, GX2 and Trio3D, and XVideo support for MX and GX2. This driver is moderately stable, however please use caution with any new install. Please report any problems to -<email>XFree86@Xfree86.org</email> +<email>XFree86@XFree86.org</email> using the appropriate bug report sheet. <sect>Features: @@ -46,17 +46,17 @@ <sect>Support: <p> -For support with XFree86 video drivers please refer to our web site at <url name="XFree86" url="http://www.XFree86.org">. The web page has a FAQ and bug reporting form available. For problems not addressed in the web page please contact our support email address <email>XFree86@Xfree86.org</email> +For support with XFree86 video drivers please refer to our web site at <url name="XFree86" url="http://www.XFree86.org">. The web page has a <!-- FAQ and --> bug reporting form available. For problems not addressed in the web page please contact our support email address <email>XFree86@XFree86.org</email> <sect>Authors <p> <itemize> -<item>Mark Vojkovich <email>mvojkovi@ucsd.edu</email> +<item>Mark Vojkovich <email>mvojkovich@nvidia.com</email> <item>Sebastien Marineau <item>Harald Koenig <email>koenig@tat.physik.uni-tuebingen.de</email> <item>Matt Grossman <email>mattg@oz.net</email> -<item>Kevin Brosius <email>Cobra@compuserve.com</email> +<item>Kevin Brosius <email>cobra@compuserve.com</email> </itemize> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/tseng.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/tseng.sgml:3.32 xc/programs/Xserver/hw/xfree86/doc/sgml/tseng.sgml:3.33 --- xc/programs/Xserver/hw/xfree86/doc/sgml/tseng.sgml:3.32 Mon Aug 23 02:38:54 1999 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/tseng.sgml Fri Aug 10 12:38:16 2001 @@ -575,7 +575,7 @@ <sect> Acceleration issues <p> -The XFree Acceleration Architecture makes extensive use of the unused video +The XFree86 Acceleration Architecture makes extensive use of the unused video memory on the VGA card. If there is not enough free video memory, some acceleration features will be disabled or crippled, resulting in less performance. @@ -1041,7 +1041,7 @@ <verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/tseng.sgml,v 3.32 1999/08/23 06:38:54 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/tseng.sgml,v 3.33 2001/08/10 16:38:16 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.21 xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.21 Thu Apr 5 15:29:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/Imakefile Mon Jul 2 06:46:04 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.21 2001/04/05 19:29:43 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.22 2001/07/02 10:46:04 alanh Exp $ #define IHaveModules #include <Server.tmpl> @@ -13,8 +13,8 @@ OBJS = apm/?*_drv.o ati/?*_drv.o chips/?*_drv.o cirrus/?*_drv.o \ cyrix/?*_drv.o glint/?*_drv.o i128/?*_drv.o i740/?*_drv.o \ i810/?*_drv.o imstt/?*_drv.o mga/?*_drv.o neomagic/?*_drv.o \ - nv/?*_drv.o rendition/?*_drv.o s3virge/?*_drv.o sis/?*_drv.o \ - tdfx/?*_drv.o tga/?*_drv.o trident/?*_drv.o tseng/?*_drv.o \ + nv/?*_drv.o rendition/?*_drv.o s3/?*_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 vmware/?*_drv.o #endif Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c diff -u 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.18 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c:1.16.2.1 Wed May 23 16:21:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c Sat Oct 27 23:33:21 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.16.2.1 2001/05/23 20:21:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.18 2001/10/28 03:33:21 tsi Exp $ */ #define COMPILER_H_EXTRAS @@ -147,6 +147,7 @@ return &pCache->apmStippleCache; } +#if 0 extern GCOps XAAPixmapOps; static RegionPtr (*SaveCopyAreaPixmap)(DrawablePtr, DrawablePtr, GC *, int, int, int, int, int, int); @@ -203,6 +204,7 @@ width, height, dstx, dsty); } +#endif void ApmAccelReserveSpace(ApmPtr pApm) { Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.50 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.56 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.50 Fri May 4 15:05:31 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c Fri Jan 4 16:22:25 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.50 2001/05/04 19:05:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.56 2002/01/04 21:22:25 tsi Exp $ */ #define COMPILER_H_EXTRAS #include "apm.h" @@ -138,7 +138,6 @@ "vgaHWProtect", "vgaHWRestore", "vgaHWSave", - "vgaHWSaveScreen", "vgaHWSetMmioFuncs", "vgaHWUnlock", NULL @@ -149,35 +148,35 @@ "XAACursorInfoRec", "XAACursorInit", "XAADestroyInfoRec", + "XAAGlyphScanlineFuncLSBFirst", "XAAInit", - "XAAPixmapIndex", "XAAQueryBestSize", "XAAReverseBitOrder", "XAARestoreCursor", "XAAScreenIndex", "XAAStippleScanlineFuncMSBFirst", - "XAAGlyphScanlineFuncLSBFirst", "XAAWarpCursor", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", NULL }; static const char *ddcSymbols[] = { - "xf86PrintEDID", "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86PrintEDID", NULL }; @@ -191,18 +190,27 @@ "ShadowFBInit", NULL }; - -#ifdef XFree86LOADER - -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", - "fbScreenInit", + NULL +}; + +static const char *fbSymbols[] = { "fbPictureInit", + "fbScreenInit", NULL }; +static const char *int10Symbols[] = { + "xf86Free10", + "xf86InitInt10", + NULL +}; + +#ifdef XFree86LOADER + static XF86ModuleVersionInfo apmVersRec = { "apm", MODULEVENDORSTRING, @@ -234,8 +242,9 @@ xf86AddDriver(&APM, module, 0); LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, - /*xf8_32bppSymbols,*/ ramdacSymbols, vbeSymbols, - ddcSymbols, i2cSymbols, shadowSymbols, NULL); + miscfbSymbols, ramdacSymbols, vbeSymbols, + ddcSymbols, i2cSymbols, shadowSymbols, + int10Symbols, NULL); return (pointer)1; } @@ -482,6 +491,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL, index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -604,7 +614,7 @@ } } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Collect all of the relevant option flags (fill in pScrn->options) */ @@ -765,6 +775,7 @@ if (xf86LoadSubModule(pScrn, "int10")) { void *ptr; + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); ptr = xf86InitInt10(pEnt->index); if (ptr) @@ -1047,7 +1058,6 @@ case 24: case 32: mod = "fb"; - req = "fbScreenInit"; break; } @@ -1056,7 +1066,13 @@ return FALSE; } - xf86LoaderReqSymbols(req, NULL); + if (mod) { + if (req) { + xf86LoaderReqSymbols(req, NULL); + } else { + xf86LoaderReqSymLists(fbSymbols, NULL); + } + } /* Load XAA if needed */ if (!pApm->NoAccel) { @@ -1409,10 +1425,7 @@ f = (int)(k * fvco/1000.0 + c + 0.5); if (f > 7) f = 7; if (f < 0) f = 0; - } - - if (pApm->Chipset < AT24) /* i.e AP6422 */ - { + } else { /* i.e AP6422 */ c = (211.0*6.0-169.0*4.5)/(211.0-169.0); k = (4.5-c)/211.0; f = (int)(k * fvco/1000.0 + c + 0.5); @@ -1848,8 +1861,6 @@ ret = fbScreenInit(pScreen, 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, @@ -1878,6 +1889,10 @@ } } + /* must be after visual RGB order fixed */ + if (pScrn->bitsPerPixel > 4) + fbPictureInit(pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); if (!pApm->ShadowFB) { /* hardware cursor needs to wrap this layer */ @@ -2154,8 +2169,7 @@ static void ApmFreeScreen(int scrnIndex, int flags) { - if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) - vgaHWFreeHWRec(xf86Screens[scrnIndex]); + vgaHWFreeHWRec(xf86Screens[scrnIndex]); ApmFreeRec(xf86Screens[scrnIndex]); } Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c:1.13 Fri Jun 30 14:27:02 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c Mon Oct 1 09:44:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c,v 1.13 2000/06/30 18:27:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c,v 1.15 2001/10/01 13:44:03 eich Exp $ */ #define FASTER #ifndef PSZ @@ -133,7 +133,6 @@ if (i == MAXLOOP) { unsigned int status = STATUS(); - xf86Break1(); WRXB(0x1FF, 0); if (!xf86ServerIsExiting()) FatalError("Hung in WaitForFifo() (Status = 0x%08X)\n", status); @@ -1338,8 +1337,6 @@ int shift = ((long)src & 0x03L) << 3; if (--dwords) { - int count; - for (count = dwords >> 2; count-- > 0; ) { A(SyncBlt)(pApm); *(CARD32*)pApm->BltMap = *(CARD32*)src; @@ -1484,7 +1481,6 @@ if (i == MAXLOOP) { unsigned int status = STATUS(); - xf86Break1(); WRXB(0x1FF, 0); if (!xf86ServerIsExiting()) FatalError("Hung in ApmSync" APM_SUFF_24 APM_SUFF_IOP "(%d) (Status = 0x%08X)\n", pScrn->pScreen->myNum, status); @@ -1520,7 +1516,6 @@ if (i == MAXLOOP) { unsigned int status = STATUS(); - xf86Break1(); WRXB(0x1FF, 0); if (!xf86ServerIsExiting()) FatalError("Hung in ApmSync6422() (Status = 0x%08X)\n", status); Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c diff -u 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.10 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c:1.9.2.1 Wed May 23 16:21:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c Wed May 23 16:13:23 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.9.2.1 2001/05/23 20:21:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.10 2001/05/23 20:13:23 dawes Exp $ */ /* * Copyright Loïc Grenié 1999 */ Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c:1.8 Wed Apr 25 13:46:42 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c Fri Jun 15 17:22:45 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.8 2001/04/25 17:46:42 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.9 2001/06/15 21:22:45 dawes Exp $ */ #if PSZ != 24 #include "dixstruct.h" @@ -421,7 +421,7 @@ #endif static void -A(StopVideo)(ScrnInfoPtr pScrn, pointer data, Bool exit) +A(StopVideo)(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { ApmPortPrivPtr pPriv = (ApmPortPrivPtr)data; APMDECL(pScrn); @@ -546,10 +546,10 @@ static int A(ReputImage)(ScrnInfoPtr pScrn, short drw_x, short drw_y, - RegionPtr clipBoxes, pointer data) + RegionPtr clipBoxes, pointer pdata) { APMDECL(pScrn); - ApmPortPrivPtr pPriv = data, pPriv0, pPriv1; + ApmPortPrivPtr pPriv = pdata, pPriv0, pPriv1; register int fx, fy; CARD32 mask; RegionRec Union; Index: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.14 Thu May 10 12:48:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c Sat Oct 27 23:33:22 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.14 2001/05/10 16:48:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.19 2001/10/28 03:33:22 tsi Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> * @@ -113,29 +113,30 @@ }; static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; static const char *vgaHWSymbols[] = { - "vgaHWGetHWRec", "vgaHWFreeHWRec", + "vgaHWGetHWRec", "vgaHWGetIOBase", - "vgaHWSave", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWLock", "vgaHWProtect", "vgaHWRestore", - "vgaHWMapMem", - "vgaHWUnmapMem", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWLock", + "vgaHWUnlock", + "vgaHWUnmapMem", NULL }; static const char *xaaSymbols[] = { "XAACreateInfoRec", - "XAADestroyInfoRec", "XAAInit", - "XAAScreenIndex", NULL }; @@ -203,7 +204,7 @@ static void ARKIdentify(int flags) { - xf86PrintChipsets("ark", "driver (version " DRIVER_VERSION " for ARK Logic chipset", + xf86PrintChipsets("ARK", "driver (version " DRIVER_VERSION " for ARK Logic chipset", ARKChipsets); } @@ -482,12 +483,19 @@ pScrn->currentMode = pScrn->modes; xf86PrintModes(pScrn); xf86SetDpi(pScrn, 0, 0); + + if (!xf86LoadSubModule(pScrn, "fb")) { + ARKFreeRec(pScrn); + return FALSE; + } - xf86LoadSubModule(pScrn, "fb"); - xf86LoaderReqSymbols("fbScreenInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); if (!pARK->NoAccel) { - xf86LoadSubModule(pScrn, "xaa"); + if (!xf86LoadSubModule(pScrn, "xaa")) { + ARKFreeRec(pScrn); + return FALSE; + } xf86LoaderReqSymLists(xaaSymbols, NULL); } @@ -509,7 +517,7 @@ ARKSave(pScrn); -/* vgaHWBlankScreen(pScrn, TRUE); */ + vgaHWBlankScreen(pScrn, TRUE); if (!ARKModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -536,8 +544,6 @@ pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; - fbPictureInit (pScreen, 0, 0); - xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -556,6 +562,9 @@ } } + /* must be after RGB order fixed */ + + fbPictureInit (pScreen, 0, 0); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -580,7 +589,7 @@ CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; -/* vgaHWBlankScreen(pScrn, TRUE); */ + vgaHWBlankScreen(pScrn, FALSE); pScreen->SaveScreen = ARKSaveScreen; pARK->CloseScreen = pScreen->CloseScreen; @@ -707,12 +716,9 @@ offset = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3; pVga->CRTC[0x13] = offset; - pVga->Attribute[0x11] = 0x00; new->cr41 = (offset & 0x100) >> 5; - - pVga->MiscOutReg |= 0x0c; - new->sr11 = rdinx(0x3c4, 0x11) & ~0x0f; + new->sr11 = 0x90; switch (pScrn->bitsPerPixel) { case 8: new->sr11 |= 0x06; @@ -819,7 +825,6 @@ /* set display FIFO threshold */ { int threshold; - unsigned char tmp; int bandwidthused, percentused; /* mostly guesses here as I would need to know more about @@ -877,9 +882,6 @@ new->dac_command = 0xe0; } - /* hrmm... */ - new->dac_command |= 0x02; - #if 0 /* hw cursor regs */ new->sr20 = rdinx(0x3c4, 0x20); @@ -950,7 +952,7 @@ * restoration can suceed */ wrinx(0x3c4, 0x10, new->sr10); - modinx(0x3c4, 0x11, 0x3f, new->sr11); + wrinx(0x3c4, 0x11, new->sr11); wrinx(0x3c4, 0x12, new->sr12); wrinx(0x3c4, 0x13, new->sr13); wrinx(0x3c4, 0x14, new->sr14); @@ -1000,9 +1002,6 @@ else vgaHWRestore(pScrn, pVga, VGA_SR_MODE); - inb(0x3c8); - outb(0x3c6, 0xff); - vgaHWProtect(pScrn, FALSE); } @@ -1067,6 +1066,7 @@ { ARKPtr pARK = ARKPTR(pScrn); + /* XXX vgaHWMapMem() isn't called explicitly, so is this correct? */ vgaHWUnmapMem(pScrn); xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pARK->FBBase, @@ -1091,6 +1091,8 @@ pScrn->vtSema = FALSE; pScreen->CloseScreen = pARK->CloseScreen; + + /* XXX Shouldn't XAADestroyInfoRec() be called? */ return (*pScreen->CloseScreen)(scrnIndex, pScreen); } Index: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h:1.1 Tue Nov 14 12:28:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h Fri Jan 4 16:05:51 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h,v 1.1 2000/11/14 17:28:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h,v 1.2 2002/01/04 21:05:51 tsi Exp $ */ #ifndef _ARK_REG_H #define _ARK_REG_H @@ -80,9 +80,9 @@ /* IO macros */ #define OUTREG16(offset, value) \ - *(unsigned short *)(pARK->MMIOBase + offset) = value + *(volatile unsigned short *)(pARK->MMIOBase + offset) = value #define OUTREG(offset, value) \ - *(unsigned int *)(pARK->MMIOBase + offset) = value + *(volatile unsigned int *)(pARK->MMIOBase + offset) = value #endif /* _ARK_REG_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.32 xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.36 --- xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.32 Fri May 18 16:22:28 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.32 2001/05/18 20:22:28 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.36 2002/01/16 16:22:25 tsi Exp $ XCOMM -XCOMM Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org +XCOMM Copyright 1997 through 2002 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 @@ -121,31 +121,54 @@ #endif -DEFINES = $(CPIODEFINES) $(NONPCIDEFINES) $(DRIDEFINES) +/* + * For now, disable DGA on SPARC. + */ +#if defined(SparcArchitecture) +# undef ATIAvoidDGA +# define ATIAvoidDGA YES +#endif + +#ifndef ATIAvoidDGA +#define ATIAVoidDGA NO +#endif + +#if ATIAvoidDGA + +DGADEFINES = -DAVOID_DGA + +#else + +DGASRCS2 = atidga.c +DGAOBJS2 = atidga.o + +#endif + +DEFINES = $(CPIODEFINES) $(DGADEFINES) $(NONPCIDEFINES) $(DRIDEFINES) SRCS1 = ati.c atiadapter.c atibus.c atichip.c atiident.c atioption.c \ - atiprobe.c atividmem.c $(MODSRCS1) $(CPIOSRCS1) \ + atiprobe.c atividmem.c $(CPIOSRCS1) $(MODSRCS1) \ radeon_probe.c r128_probe.c 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) + aticursor.c atidac.c atidsp.c atilock.c atimach64.c atimach64io.c \ + atimode.c atipreinit.c atiprint.c atirgb514.c atiscreen.c atiutil.c \ + ativalid.c atixv.c $(CPIOSRCS2) $(DGASRCS2) $(MODSRCS2) +SRCS3 = r128_accel.c r128_cursor.c r128_dga.c r128_driver.c \ + r128_video.c $(DRISRCS3) $(MODSRCS3) SRCS4 = radeon_accel.c radeon_cursor.c radeon_dga.c radeon_driver.c \ - radeon_video.c $(MODSRCS4) $(DRISRCS4) + radeon_video.c $(DRISRCS4) $(MODSRCS4) OBJS1 = ati.o atiadapter.o atibus.o atichip.o atiident.o atioption.o \ - atiprobe.o atividmem.o $(MODOBJS1) $(CPIOOBJS1) \ + atiprobe.o atividmem.o $(CPIOOBJS1) $(MODOBJS1) \ radeon_probe.o r128_probe.o 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) + aticursor.o atidac.o atidsp.o atilock.o atimach64.o atimach64io.o \ + atimode.o atipreinit.o atiprint.o atirgb514.o atiscreen.o atiutil.o \ + ativalid.o atixv.o $(CPIOOBJS2) $(DGAOBJS2) $(MODOBJS2) +OBJS3 = r128_accel.o r128_cursor.o r128_dga.o r128_driver.o \ + r128_video.o $(DRIOBJS3) $(MODOBJS3) OBJS4 = radeon_accel.o radeon_cursor.o radeon_dga.o radeon_driver.o \ - radeon_video.o $(MODOBJS4) $(DRIOBJS4) + radeon_video.o $(DRIOBJS4) $(MODOBJS4) SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) @@ -192,7 +215,6 @@ InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(ati.c,$(DRIVERSDKDIR)/drivers/ati) -InstallDriverSDKNonExecFile(ati.cpp,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(ati.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiaccel.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiaccel.h,$(DRIVERSDKDIR)/drivers/ati) @@ -249,6 +271,8 @@ InstallDriverSDKNonExecFile(atiprobe.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiproto.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiregs.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atirgb514.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atirgb514.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiscreen.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiscreen.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atistruct.h,$(DRIVERSDKDIR)/drivers/ati) @@ -270,7 +294,6 @@ InstallDriverSDKNonExecFile(atixv.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atixv.h,$(DRIVERSDKDIR)/drivers/ati) -InstallDriverSDKNonExecFile(r128.cpp,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128_accel.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128_cursor.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.17 xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c:1.17 Tue May 8 23:12:02 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.17 2001/05/09 03:12:02 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.19 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -68,6 +68,7 @@ * Linus Torvalds, torvalds@transmeta.com * William Blew, wblew@home.com * Ignacio Garcia Etxebarria, garetxe@euskalnet.net + * Patrick Chase, pchase2@pacbell.net * * ... and, many, many others from around the world. * Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.7 Sat Jan 6 15:58:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h,v 1.7 2001/01/06 20:58:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h,v 1.8 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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/atiaccel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c:1.6 Mon May 7 17:59:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.6 2001/05/07 21:59:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.10 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2002 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 @@ -29,7 +29,8 @@ /* * ATIInitializeAcceleration -- * - * This function is called to initialise XAA on a screen. + * This function is called to initialise both the framebuffer manager and XAA + * on a screen. */ Bool ATIInitializeAcceleration @@ -39,39 +40,40 @@ ATIPtr pATI ) { - BoxRec ScreenArea; - unsigned int nScanlines, maxScanlines; + int maxScanlines = 32767, maxPixelArea, PixelArea; - if (!pATI->OptionAccel) - return TRUE; - - if (!(pATI->pXAAInfo = XAACreateInfoRec())) - return FALSE; - - switch (pATI->Adapter) + if (pATI->OptionAccel) { - case ATI_ADAPTER_MACH64: - maxScanlines = ATIMach64AccelInit(pATI, pATI->pXAAInfo); - break; + if (!(pATI->pXAAInfo = XAACreateInfoRec())) + return FALSE; - default: - maxScanlines = 0; + switch (pATI->Adapter) + { + case ATI_ADAPTER_MACH64: + maxScanlines = ATIMach64AccelInit(pATI, pATI->pXAAInfo); + break; + + default: + break; + } } - 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); +#ifndef AVOID_CPIO + + if (!pATI->BankInfo.BankSize) - if (XAAInit(pScreen, pATI->pXAAInfo)) - return TRUE; +#endif /* AVOID_CPIO */ + + { + maxPixelArea = maxScanlines * pScreenInfo->displayWidth; + PixelArea = pScreenInfo->videoRam * 1024 * 8 / pATI->bitsPerPixel; + if (PixelArea > maxPixelArea) + PixelArea = maxPixelArea; + xf86InitFBManagerArea(pScreen, PixelArea, 2); } + + if (!pATI->OptionAccel || XAAInit(pScreen, pATI->pXAAInfo)) + return TRUE; XAADestroyInfoRec(pATI->pXAAInfo); pATI->pXAAInfo = NULL; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h:1.2 Mon May 7 17:59:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h,v 1.2 2001/05/07 21:59:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h,v 1.3 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2002 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.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.15 Sat Jan 6 15:58:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c,v 1.15 2001/01/06 20:58:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c,v 1.16 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h:1.8 Sat Jan 6 15:58:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.8 2001/01/06 20:58:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.9 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c:1.12 Tue May 8 23:12:02 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c,v 1.12 2001/05/09 03:12:02 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c,v 1.13 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.6 Sat Jan 6 15:58:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h,v 1.6 2001/01/06 20:58:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h,v 1.7 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.10 xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c:1.10 Sat Jan 6 15:58:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c,v 1.10 2001/01/06 20:58:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c,v 1.11 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h:1.6 Sat Jan 6 15:58:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h,v 1.6 2001/01/06 20:58:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h,v 1.7 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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/atibus.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.14 Sun Feb 11 22:27:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.14 2001/02/12 03:27:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.16 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -86,9 +86,9 @@ if (pATI->CPIO_VGAWonder) { if (pATI->SharedVGA) - Resources[0].type = ResShrIoSparse; + Resources[0].type = ResShrIoSparse | ResBus; else - Resources[0].type = ResExcIoSparse; + Resources[0].type = ResExcIoSparse | ResBus; Resources[0].rBase = pATI->CPIO_VGAWonder; if (pATI->Chip <= ATI_CHIP_18800_1) Resources[0].rMask = 0x03FEU; @@ -116,9 +116,9 @@ (pATI->CPIODecoding == SPARSE_IO)) { if (pATI->SharedAccelerator) - Resources[0].type = ResShrIoSparse; + Resources[0].type = ResShrIoSparse | ResBus; else - Resources[0].type = ResExcIoSparse; + Resources[0].type = ResExcIoSparse | ResBus; Resources[0].rBase = pATI->CPIOBase; Resources[0].rMask = 0x03FCU; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.8 Sat Jan 6 15:58:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.8 2001/01/06 20:58:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.9 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.19 xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c:1.19 Wed Apr 25 14:21:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.19 2001/04/25 18:21:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.25 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -80,13 +80,16 @@ "ATI Rage 128 VR", "ATI Rage 128 Pro GL", "ATI Rage 128 Pro VR", + "ATI Rage 128 Pro ULTRA", "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 Radeon Mobility M6", + "ATI Radeon Mobility M7", + "ATI Radeon 8500", + "ATI Radeon 7500", "ATI Rage HDTV" }; @@ -529,82 +532,92 @@ case OldChipID('L', 'S'): case NewChipID('L', 'S'): return ATI_CHIP_MOBILITY; - case OldChipID('R', 'E'): case NewChipID('R', 'E'): - case OldChipID('R', 'F'): case NewChipID('R', 'F'): - 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'): + case NewChipID('R', 'E'): + case NewChipID('R', 'F'): + case NewChipID('S', 'K'): + case NewChipID('S', 'L'): + case NewChipID('S', 'M'): + case NewChipID('S', 'N'): return ATI_CHIP_RAGE128GL; - case OldChipID('R', 'K'): case NewChipID('R', 'K'): - case OldChipID('R', 'L'): case NewChipID('R', 'L'): - case OldChipID('S', 'E'): case NewChipID('S', 'E'): - case OldChipID('S', 'F'): case NewChipID('S', 'F'): - case OldChipID('S', 'G'): case NewChipID('S', 'G'): + case NewChipID('R', 'K'): + case NewChipID('R', 'L'): + case NewChipID('S', 'E'): + case NewChipID('S', 'F'): + case NewChipID('S', 'G'): return ATI_CHIP_RAGE128VR; - case OldChipID('P', 'A'): case NewChipID('P', 'A'): - case OldChipID('P', 'B'): case NewChipID('P', 'B'): - case OldChipID('P', 'C'): case NewChipID('P', 'C'): - case OldChipID('P', 'D'): case NewChipID('P', 'D'): - case OldChipID('P', 'E'): case NewChipID('P', 'E'): - case OldChipID('P', 'F'): case NewChipID('P', 'F'): + case NewChipID('P', 'A'): + case NewChipID('P', 'B'): + case NewChipID('P', 'C'): + case NewChipID('P', 'D'): + case NewChipID('P', 'E'): + case NewChipID('P', 'F'): return ATI_CHIP_RAGE128PROGL; - case OldChipID('P', 'G'): case NewChipID('P', 'G'): - case OldChipID('P', 'H'): case NewChipID('P', 'H'): - case OldChipID('P', 'I'): case NewChipID('P', 'I'): - case OldChipID('P', 'J'): case NewChipID('P', 'J'): - case OldChipID('P', 'K'): case NewChipID('P', 'K'): - case OldChipID('P', 'L'): case NewChipID('P', 'L'): - case OldChipID('P', 'M'): case NewChipID('P', 'M'): - case OldChipID('P', 'N'): case NewChipID('P', 'N'): - case OldChipID('P', 'O'): case NewChipID('P', 'O'): - case OldChipID('P', 'P'): case NewChipID('P', 'P'): - case OldChipID('P', 'Q'): case NewChipID('P', 'Q'): - case OldChipID('P', 'R'): case NewChipID('P', 'R'): - case OldChipID('P', 'S'): case NewChipID('P', 'S'): - case OldChipID('P', 'T'): case NewChipID('P', 'T'): - case OldChipID('P', 'U'): case NewChipID('P', 'U'): - case OldChipID('P', 'V'): case NewChipID('P', 'V'): - case OldChipID('P', 'W'): case NewChipID('P', 'W'): - case OldChipID('P', 'X'): case NewChipID('P', 'X'): + case NewChipID('P', 'G'): + case NewChipID('P', 'H'): + case NewChipID('P', 'I'): + case NewChipID('P', 'J'): + case NewChipID('P', 'K'): + case NewChipID('P', 'L'): + case NewChipID('P', 'M'): + case NewChipID('P', 'N'): + case NewChipID('P', 'O'): + case NewChipID('P', 'P'): + case NewChipID('P', 'Q'): + case NewChipID('P', 'R'): + case NewChipID('P', 'S'): + case NewChipID('P', 'T'): + case NewChipID('P', 'U'): + case NewChipID('P', 'V'): + case NewChipID('P', 'W'): + case NewChipID('P', 'X'): return ATI_CHIP_RAGE128PROVR; - case OldChipID('L', 'E'): case NewChipID('L', 'E'): - case OldChipID('L', 'F'): case NewChipID('L', 'F'): - case OldChipID('L', 'K'): case NewChipID('L', 'K'): - case OldChipID('L', 'L'): case NewChipID('L', 'L'): + case NewChipID('T', 'F'): + case NewChipID('T', 'L'): + case NewChipID('T', 'R'): + return ATI_CHIP_RAGE128PROULTRA; + + case NewChipID('L', 'E'): + case NewChipID('L', 'F'): + case NewChipID('L', 'K'): + case NewChipID('L', 'L'): return ATI_CHIP_RAGE128MOBILITY3; - case OldChipID('M', 'F'): case NewChipID('M', 'F'): - case OldChipID('M', 'L'): case NewChipID('M', 'L'): + case NewChipID('M', 'F'): + case NewChipID('M', 'L'): return ATI_CHIP_RAGE128MOBILITY4; - case OldChipID('T', 'F'): case NewChipID('T', 'F'): - case OldChipID('T', 'L'): case NewChipID('T', 'L'): - case OldChipID('T', 'R'): case NewChipID('T', 'R'): - case OldChipID('T', 'S'): case NewChipID('T', 'S'): - case OldChipID('T', 'T'): case NewChipID('T', 'T'): - case OldChipID('T', 'U'): case NewChipID('T', 'U'): - return ATI_CHIP_RAGE128ULTRA; - - case OldChipID('Q', 'D'): case NewChipID('Q', 'D'): - case OldChipID('Q', 'E'): case NewChipID('Q', 'E'): - case OldChipID('Q', 'F'): case NewChipID('Q', 'F'): - case OldChipID('Q', 'G'): case NewChipID('Q', 'G'): + case NewChipID('Q', 'D'): + case NewChipID('Q', 'E'): + case NewChipID('Q', 'F'): + case NewChipID('Q', 'G'): return ATI_CHIP_RADEON; - case OldChipID('Q', 'Y'): case NewChipID('Q', 'Y'): - case OldChipID('Q', 'Z'): case NewChipID('Q', 'Z'): + case NewChipID('Q', 'Y'): + 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 NewChipID('L', 'Y'): + case NewChipID('L', 'Z'): + return ATI_CHIP_RADEONMOBILITY6; + + case NewChipID('L', 'W'): + return ATI_CHIP_RADEONMOBILITY7; + + case NewChipID('Q', 'L'): + case NewChipID('Q', 'N'): + case NewChipID('Q', 'O'): + case NewChipID('Q', 'l'): + case NewChipID('B', 'B'): + return ATI_CHIP_R200; - case OldChipID('H', 'D'): case NewChipID('H', 'D'): + case NewChipID('Q', 'W'): + return ATI_CHIP_RV200; + + case NewChipID('H', 'D'): return ATI_CHIP_HDTV; default: Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.15 xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.15 Wed Apr 25 14:21:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h Wed Jan 16 11:22:25 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.15 2001/04/25 18:21:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.20 2002/01/16 16:22:25 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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,13 +82,16 @@ ATI_CHIP_RAGE128VR, /* Rage128 */ ATI_CHIP_RAGE128PROGL, /* Rage128 */ ATI_CHIP_RAGE128PROVR, /* Rage128 */ + ATI_CHIP_RAGE128PROULTRA, /* 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_RADEONVE, /* Radeon VE */ + ATI_CHIP_RADEONMOBILITY6, /* Radeon M6 */ + ATI_CHIP_RADEONMOBILITY7, /* Radeon M7 */ + ATI_CHIP_R200, /* R200 */ + ATI_CHIP_RV200, /* RV200 */ 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.16 xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c:1.16 Sun Feb 11 22:27:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c,v 1.16 2001/02/12 03:27:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c,v 1.18 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -263,7 +263,7 @@ }, { 65, 128, 65, 1, 1, - 2, 31, 0, + 2, 14, 0, 4, ATIPostDividers, "IBM RGB 514 or similar" } @@ -784,7 +784,7 @@ /* Ensure clock select pins are not OR'ed with anything */ if (pATI->CPIO_VGAWonder && (pATI->OldHW.crtc == ATI_CRTC_VGA)) - ATIModifyExtReg(pATI, 0xB5, pATI->OldHW.b5, 0x7FU, 0x00U); + ATIModifyExtReg(pATI, 0xB5U, pATI->OldHW.b5, 0x7FU, 0x00U); } #endif /* AVOID_CPIO */ @@ -977,8 +977,9 @@ else if (pScreenInfo->clock[ClockIndex]) /* Round to the nearest 10 kHz */ pScreenInfo->clock[ClockIndex] = - (((ScaleFactor / (double)pScreenInfo->clock[ClockIndex]) + - 5) / 10) * 10; + (int)(((ScaleFactor / + (double)pScreenInfo->clock[ClockIndex]) + + 5) / 10) * 10; } pScreenInfo->numClocks = NumberOfClocks; @@ -1176,7 +1177,7 @@ * Due to the way clock lines are matched, the following * can prevent the override if the clock is probed, * documented or set by the user to a value greater than - * MaximumClock. + * maxClock. */ if (abs(SpecificationClock - pScreenInfo->clock[ClockIndex]) > CLOCK_TOLERANCE) @@ -1313,6 +1314,12 @@ if (!pATI->ClockDescriptor.PostDividers[D]) continue; + /* Limit undivided VCO to maxClock */ + if (pATI->maxClock && + ((pATI->maxClock / pATI->ClockDescriptor.PostDividers[D]) < + pMode->Clock)) + continue; + /* * Calculate closest feedback divider and apply its * restrictions. @@ -1452,7 +1459,8 @@ /* Temporarily switch to accelerator mode */ crtc_gen_cntl = inr(CRTC_GEN_CNTL); - outr(CRTC_GEN_CNTL, crtc_gen_cntl | CRTC_EXT_DISP_EN); + if (!(crtc_gen_cntl & CRTC_EXT_DISP_EN)) + outr(CRTC_GEN_CNTL, crtc_gen_cntl | CRTC_EXT_DISP_EN); switch (pATI->ProgrammableClock) { @@ -1556,17 +1564,14 @@ break; case ATI_CLOCK_IBMRGB514: - tmp = inr(DAC_CNTL); - outr(DAC_CNTL, (tmp & ~DAC_EXT_SEL_RS3) | DAC_EXT_SEL_RS2); - tmp2 = (pATIHW->clock << 1) + 0x20U; - out8(M64_DAC_WRITE, tmp2); - out8(M64_DAC_DATA, 0); - out8(M64_DAC_MASK, - (SetBits(N, 0x3FU) | SetBits(D, 0xC0U)) ^ 0xC0U); - out8(M64_DAC_WRITE, tmp2 + 1); - out8(M64_DAC_DATA, 0); - out8(M64_DAC_MASK, SetBits(M, 0x3FU)); - outr(DAC_CNTL, tmp); + /* + * Here, only update in-core data. It will be written out later by + * ATIRGB514Set(). + */ + tmp = (pATIHW->clock << 1) + 0x20U; + pATIHW->ibmrgb514[tmp] = + (SetBits(N, 0x3FU) | SetBits(D, 0xC0U)) ^ 0xC0U; + pATIHW->ibmrgb514[tmp + 1] = SetBits(M, 0x3FU); break; default: @@ -1576,5 +1581,6 @@ (void)in8(M64_DAC_WRITE); /* Clear DAC counter */ /* Restore register */ - outr(CRTC_GEN_CNTL, crtc_gen_cntl); + if (!(crtc_gen_cntl & CRTC_EXT_DISP_EN)) + outr(CRTC_GEN_CNTL, crtc_gen_cntl); } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.6 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h,v 1.6 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h,v 1.7 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.5 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c:1.5 Sun Mar 25 00:32:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.5 2001/03/25 05:32:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.9 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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 @@ -23,6 +23,7 @@ #include "ati.h" #include "atiadapter.h" +#include "atichip.h" #include "aticonfig.h" #include "aticursor.h" #include "atioption.h" @@ -34,7 +35,8 @@ typedef enum { ATI_OPTION_DEVEL, /* Intentionally undocumented */ - ATI_OPTION_SYNC /* Temporary and undocumented */ + ATI_OPTION_SYNC, /* Use XF86Config panel mode porches */ + ATI_OPTION_BLEND /* Force horizontal blending of small modes */ } ATIPrivateOptionType; /* @@ -53,20 +55,27 @@ OptionInfoPtr PublicOption = xnfalloc(ATIPublicOptionSize); OptionInfoRec PrivateOption[] = { - { - ATI_OPTION_DEVEL, + { /* ON: Ease exploration of loose ends */ + ATI_OPTION_DEVEL, /* OFF: Fit for public consumption */ "tsi", OPTV_BOOLEAN, {0, }, FALSE }, - { - ATI_OPTION_SYNC, + { /* ON: Use XF86Config porch timings */ + ATI_OPTION_SYNC, /* OFF: Use porches from mode on entry */ "lcdsync", OPTV_BOOLEAN, {0, }, FALSE }, + { /* ON: Horizontally blend most modes */ + ATI_OPTION_BLEND, /* OFF: Use pixel replication more often */ + "lcdblend", + OPTV_BOOLEAN, + {0, }, + FALSE + }, { -1, NULL, @@ -79,6 +88,7 @@ (void)memcpy(PublicOption, ATIPublicOptions, ATIPublicOptionSize); # define Accel PublicOption[ATI_OPTION_ACCEL].value.bool +# define Blend PrivateOption[ATI_OPTION_BLEND].value.bool # define CRTScreen PublicOption[ATI_OPTION_CRT].value.bool # define CSync PublicOption[ATI_OPTION_CSYNC].value.bool # define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool @@ -133,7 +143,7 @@ ShadowFB = TRUE; } - Sync = TRUE; + Blend = CSync = /* Sync = */ TRUE; xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, PublicOption); @@ -155,6 +165,7 @@ /* Move option values into driver private structure */ pATI->OptionAccel = Accel; + pATI->OptionBlend = Blend; pATI->OptionCRT = CRTScreen; pATI->OptionCSync = CSync; pATI->OptionDevel = Devel; @@ -171,12 +182,18 @@ pATI->OptionSync = Sync; /* Validate and set cursor options */ + pATI->Cursor = ATI_CURSOR_SOFTWARE; 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 if (pATI->Chip < ATI_CHIP_264CT) + { + if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Option \"hw_cursor\" not supported in this configuration.\n"); } else { Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.2 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h,v 1.2 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h,v 1.3 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.16 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c:1.16 Sun Feb 11 22:27:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.16 2001/02/12 03:27:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.19 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -105,7 +105,7 @@ switch (pATI->Adapter) { case ATI_ADAPTER_MACH64: - ATIMach64SetDPMSMode(pATI, DPMSMode); + ATIMach64SetDPMSMode(pScreenInfo, pATI, DPMSMode); break; default: @@ -201,7 +201,17 @@ ATILock(pATI); /* Unmap apertures */ + +#ifdef AVOID_DGA + + if (!pATI->Closeable) + +#else /* AVOID_DGA */ + if (!pATI->Closeable || !pATI->nDGAMode) + +#endif /* AVOID_DGA */ + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); SetTimeSinceLastInputEvent(); @@ -339,7 +349,11 @@ xfree(pATI->pShadow); +#ifndef AVOID_DGA + xfree(pATI->pDGAMode); + +#endif /* AVOID_DGA */ xfree(pATI); pScreenInfo->driverPrivate = NULL; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.7 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h,v 1.7 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h,v 1.8 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.6 xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h:1.6 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.6 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.7 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c:1.1 Sun Mar 25 00:33:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c,v 1.1 2001/03/25 05:33:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c,v 1.2 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2002 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.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h:1.1 Sun Mar 25 00:33:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h,v 1.1 2001/03/25 05:33:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h,v 1.2 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2002 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/atidac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.12 Wed Jan 10 22:36:57 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c,v 1.12 2001/01/11 03:36:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c,v 1.14 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -147,7 +147,7 @@ ) { int Index, Index2; - CARD8 maxColour = (1 << pScreenInfo->rgbBits) - 1; + CARD8 maxColour = (1 << pATI->rgbBits) - 1; pATIHW->dac_read = pATIHW->dac_write = 0x00U; pATIHW->dac_mask = 0xFFU; @@ -379,7 +379,7 @@ { ATIPtr pATI = ATIPTR(pScreenInfo); CARD8 *LUTEntry; - int i, Index; + int i, j, Index; if (((pVisual->class | DynamicClass) == DirectColor) && ((1 << pVisual->nplanes) > (SizeOf(pATI->NewHW.lut) / 3))) @@ -398,6 +398,10 @@ int minShift; + CARD8 fChanged[SizeOf(pATI->NewHW.lut) / 3]; + + (void)memset(fChanged, SizeOf(fChanged), 0); + minShift = redShift; if (minShift > greenShift) minShift = greenShift; @@ -410,14 +414,23 @@ continue; if (Index <= reds) - pATI->NewHW.lut[(Index * redMult) + 0] = - Colours[Index].red << minShift; + { + j = Index * redMult; + pATI->NewHW.lut[j + 0] = Colours[Index].red; + fChanged[j / 3] = TRUE; + } if (Index <= greens) - pATI->NewHW.lut[(Index * greenMult) + 1] = - Colours[Index].green << minShift; + { + j = Index * greenMult; + pATI->NewHW.lut[j + 1] = Colours[Index].green; + fChanged[j / 3] = TRUE; + } if (Index <= blues) - pATI->NewHW.lut[(Index * blueMult) + 2] = - Colours[Index].blue << minShift; + { + j = Index * blueMult; + pATI->NewHW.lut[j + 2] = Colours[Index].blue; + fChanged[j / 3] = TRUE; + } } if (pScreenInfo->vtSema || pATI->currentMode) @@ -430,6 +443,8 @@ Index < (SizeOf(pATI->NewHW.lut) / 3); Index += i, LUTEntry += i * 3) { + if (!fChanged[Index]) + continue; #ifdef AVOID_CPIO Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.10 xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.10 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h,v 1.10 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h,v 1.11 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c:1.5 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.5 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.8 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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 @@ -21,6 +21,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#ifndef AVOID_DGA + #include "ati.h" #include "atiadjust.h" #include "atichip.h" @@ -87,9 +89,9 @@ DGAModePtr pDGAMode ) { - ATIPtr pATI = ATIPTR(pScreenInfo); + ATIPtr pATI = ATIPTR(pScreenInfo); DisplayModePtr pMode; - int scrnIndex = pScreenInfo->pScreen->myNum; + int iScreen = pScreenInfo->scrnIndex; int frameX0, frameY0; if (pDGAMode) @@ -123,11 +125,11 @@ ATIAdjustPreInit(pATI); ATIModePreInit(pScreenInfo, pATI, &pATI->NewHW); - if (!(*pScreenInfo->SwitchMode)(scrnIndex, pMode, 0)) + if (!(*pScreenInfo->SwitchMode)(iScreen, pMode, 0)) return FALSE; if (!pDGAMode) pATI->currentMode = NULL; - (*pScreenInfo->AdjustFrame)(scrnIndex, frameX0, frameY0, 0); + (*pScreenInfo->AdjustFrame)(iScreen, frameX0, frameY0, 0); return TRUE; } @@ -163,21 +165,105 @@ { return 0; /* There are never any pending requests */ } + +/* + * ATIDGAFillRect -- + * + * This function calls XAA solid fill primitives to fill a rectangle. + */ +static void +ATIDGAFillRect +( + ScrnInfoPtr pScreenInfo, + int x, + int y, + int w, + int h, + unsigned long colour +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; + + (*pXAAInfo->SetupForSolidFill)(pScreenInfo, (int)colour, GXcopy, + (CARD32)(~0)); + (*pXAAInfo->SubsequentSolidFillRect)(pScreenInfo, x, y, w, h); + + if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) + SET_SYNC_FLAG(pXAAInfo); +} -static DGAFunctionRec ATIDGAFunctions = +/* + * ATIDGABlitRect -- + * + * This function calls XAA screen-to-screen copy primitives to copy a + * rectangle. + */ +static void +ATIDGABlitRect +( + ScrnInfoPtr pScreenInfo, + int xSrc, + int ySrc, + int w, + int h, + int xDst, + int yDst +) { - ATIDGAOpenFramebuffer, - NULL, /* CloseFramebuffer */ - ATIDGASetMode, - ATIDGASetViewport, - ATIDGAGetViewport, - NULL, /* Sync */ - NULL, /* FillRect */ - NULL, /* BlitRect */ - NULL, /* BlitTransRect */ -}; + ATIPtr pATI = ATIPTR(pScreenInfo); + XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; + int xdir = ((xSrc < xDst) && (ySrc == yDst)) ? -1 : 1; + int ydir = (ySrc < yDst) ? -1 : 1; + + (*pXAAInfo->SetupForScreenToScreenCopy)(pScreenInfo, + xdir, ydir, GXcopy, (CARD32)(~0), -1); + (*pXAAInfo->SubsequentScreenToScreenCopy)(pScreenInfo, + xSrc, ySrc, xDst, yDst, w, h); + + if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) + SET_SYNC_FLAG(pXAAInfo); +} /* + * ATIDGABlitTransRect -- + * + * This function calls XAA screen-to-screen copy primitives to transparently + * copy a rectangle. + */ +static void +ATIDGABlitTransRect +( + ScrnInfoPtr pScreenInfo, + int xSrc, + int ySrc, + int w, + int h, + int xDst, + int yDst, + unsigned long colour +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; + int xdir = ((xSrc < xDst) && (ySrc == yDst)) ? -1 : 1; + int ydir = (ySrc < yDst) ? -1 : 1; + + pATI->XAAForceTransBlit = TRUE; + + (*pXAAInfo->SetupForScreenToScreenCopy)(pScreenInfo, + xdir, ydir, GXcopy, (CARD32)(~0), (int)colour); + + pATI->XAAForceTransBlit = FALSE; + + (*pXAAInfo->SubsequentScreenToScreenCopy)(pScreenInfo, + xSrc, ySrc, xDst, yDst, w, h); + + if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) + SET_SYNC_FLAG(pXAAInfo); +} + +/* * ATIDGAAddModes -- * * This function translates DisplayModeRec's into DGAModeRec's. @@ -187,6 +273,7 @@ ( ScrnInfoPtr pScreenInfo, ATIPtr pATI, + int flags, int depth, int bitsPerPixel, int redMask, @@ -237,13 +324,13 @@ /* Fill in the mode structure */ pDGAMode->mode = pMode; - pDGAMode->flags = DGA_CONCURRENT_ACCESS; + pDGAMode->flags = flags; if (bitsPerPixel == pScreenInfo->bitsPerPixel) { pDGAMode->flags |= DGA_PIXMAP_AVAILABLE; pDGAMode->address = pATI->pMemory; - if (pATI->OptionAccel) + if (pATI->pXAAInfo) pDGAMode->flags &= ~DGA_CONCURRENT_ACCESS; } if ((pMode->Flags & V_DBLSCAN) || (pMode->VScan > 1)) @@ -305,6 +392,9 @@ ATIPtr pATI ) { + XAAInfoRecPtr pXAAInfo; + int flags; + if (!pATI->nDGAMode) { @@ -319,41 +409,71 @@ return FALSE; #endif /* AVOID_CPIO */ + + /* Set up DGA callbacks */ + pATI->ATIDGAFunctions.OpenFramebuffer = ATIDGAOpenFramebuffer; + pATI->ATIDGAFunctions.SetMode = ATIDGASetMode; + pATI->ATIDGAFunctions.SetViewport = ATIDGASetViewport; + pATI->ATIDGAFunctions.GetViewport = ATIDGAGetViewport; - ATIDGAAddModes(pScreenInfo, pATI, + flags = 0; + if ((pXAAInfo = pATI->pXAAInfo)) + { + pATI->ATIDGAFunctions.Sync = pXAAInfo->Sync; + if (pXAAInfo->SetupForSolidFill && + pXAAInfo->SubsequentSolidFillRect) + { + flags |= DGA_FILL_RECT; + pATI->ATIDGAFunctions.FillRect = ATIDGAFillRect; + } + if (pXAAInfo->SetupForScreenToScreenCopy && + pXAAInfo->SubsequentScreenToScreenCopy) + { + flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; + pATI->ATIDGAFunctions.BlitRect = ATIDGABlitRect; + pATI->ATIDGAFunctions.BlitTransRect = ATIDGABlitTransRect; + } + } + if (!flags) + flags = DGA_CONCURRENT_ACCESS; + + ATIDGAAddModes(pScreenInfo, pATI, flags, 8, 8, 0, 0, 0, PseudoColor); if ((pATI->Chip >= ATI_CHIP_264CT) && (pATI->Chipset == ATI_CHIPSET_ATI)) { - ATIDGAAddModes(pScreenInfo, pATI, 15, 16, - 0x7C00U, 0x03E0U, 0x001FU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 15, 16, 0x7C00U, 0x03E0U, 0x001FU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, 16, 16, - 0xF800U, 0x07E0U, 0x001FU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 16, 16, 0xF800U, 0x07E0U, 0x001FU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, 24, 24, - 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 24, 24, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, 24, 32, - 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 24, 32, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); if (pATI->DAC != ATI_DAC_INTERNAL) /* Not first revision */ { - ATIDGAAddModes(pScreenInfo, pATI, 15, 16, - 0x7C00U, 0x03E0U, 0x001FU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 15, 16, 0x7C00U, 0x03E0U, 0x001FU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, 16, 16, - 0xF800U, 0x07E0U, 0x001FU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 16, 16, 0xF800U, 0x07E0U, 0x001FU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, 24, 24, - 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 24, 24, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, 24, 32, - 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 24, 32, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); } } } - return DGAInit(pScreen, &ATIDGAFunctions, pATI->pDGAMode, pATI->nDGAMode); + return DGAInit(pScreen, &pATI->ATIDGAFunctions, pATI->pDGAMode, + pATI->nDGAMode); } + +#endif /* AVOID_DGA */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.3 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.3 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.5 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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,15 @@ #ifndef ___ATIDGA_H___ #define ___ATIDGA_H___ 1 +#ifndef AVOID_DGA + #include "atipriv.h" #include "atiproto.h" #include "xf86str.h" extern Bool ATIDGAInit FunctionPrototype((ScrnInfoPtr, ScreenPtr, ATIPtr)); + +#endif /* AVOID_DGA */ #endif /* ___ATIDGA_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.13 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c,v 1.13 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c,v 1.14 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h:1.8 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h,v 1.8 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h,v 1.9 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c:1.8 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c,v 1.8 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c,v 1.9 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h:1.8 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h,v 1.8 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h,v 1.9 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h:1.12 Sat Jan 6 16:29:15 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.12 2001/01/06 21:29:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.13 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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/atiload.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.6 Sun Mar 25 00:32:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.6 2001/03/25 05:32:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.8 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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 @@ -135,7 +135,7 @@ return FALSE; /* Require more fb symbols */ - xf86LoaderReqSymbols("fbPictureInit", FALSE); + xf86LoaderReqSymbols("fbPictureInit", NULL); return TRUE; default: Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.2 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h,v 1.2 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h,v 1.3 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.10 xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c:1.10 Sun Mar 25 00:32:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.10 2001/03/25 05:32:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.12 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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 @@ -97,12 +97,17 @@ { /* Reset everything */ - pATI->LockData.bus_cntl = - (inr(BUS_CNTL) & ~BUS_HOST_ERR_INT_EN) | BUS_HOST_ERR_INT; - if (pATI->Chip < ATI_CHIP_264VTB) + pATI->LockData.bus_cntl = inr(BUS_CNTL); + if (pATI->Chip < ATI_CHIP_264VT4) + { pATI->LockData.bus_cntl = - (pATI->LockData.bus_cntl & ~BUS_FIFO_ERR_INT_EN) | - BUS_FIFO_ERR_INT; + (pATI->LockData.bus_cntl & ~BUS_HOST_ERR_INT_EN) | + BUS_HOST_ERR_INT; + if (pATI->Chip < ATI_CHIP_264VTB) + pATI->LockData.bus_cntl = + (pATI->LockData.bus_cntl & ~BUS_FIFO_ERR_INT_EN) | + BUS_FIFO_ERR_INT; + } tmp = (pATI->LockData.bus_cntl & ~BUS_ROM_DIS) | SetBits(15, BUS_FIFO_WS); if (pATI->Chip >= ATI_CHIP_264VT) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.3 Sat Jan 6 15:58:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h,v 1.3 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h,v 1.4 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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.36 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c:1.45 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c:1.36 Tue May 8 23:12:02 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c Wed Jan 16 11:22:26 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.36 2001/05/09 03:12:02 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.45 2002/01/16 16:22:26 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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,9 +47,10 @@ #include "ati.h" #include "atibus.h" #include "atichip.h" -#include "aticrtc.h" +#include "atidac.h" #include "atimach64.h" #include "atimach64io.h" +#include "atirgb514.h" #include "miline.h" @@ -110,8 +111,10 @@ pATIHW->crtc_off_pitch = SetBits(pATI->displayWidth >> 3, CRTC_PITCH); } - bus_cntl = inr(BUS_CNTL); - pATIHW->bus_cntl = (bus_cntl & ~BUS_HOST_ERR_INT_EN) | BUS_HOST_ERR_INT; + pATIHW->bus_cntl = bus_cntl = inr(BUS_CNTL); + if (pATI->Chip < ATI_CHIP_264VT4) + pATIHW->bus_cntl = (pATIHW->bus_cntl & ~BUS_HOST_ERR_INT_EN) | + BUS_HOST_ERR_INT; if (pATI->Chip < ATI_CHIP_264VTB) { pATIHW->bus_cntl &= ~(BUS_FIFO_ERR_INT_EN | BUS_ROM_DIS); @@ -146,10 +149,12 @@ pATIHW->dac_cntl = inr(DAC_CNTL) & ~(DAC1_CLK_SEL | DAC_PALETTE_ACCESS_CNTL | DAC_8BIT_EN); - if ((pATI->depth > 8) || (pScreenInfo->rgbBits == 8)) + if (pATI->rgbBits == 8) pATIHW->dac_cntl |= DAC_8BIT_EN; pATIHW->gen_test_cntl = pATI->LockData.gen_test_cntl & ~GEN_CUR_EN; + if (pATI->DAC == ATI_DAC_IBMRGB514) + pATIHW->gen_test_cntl |= GEN_OVR_OUTPUT_EN; pATIHW->config_cntl = config_cntl = inr(CONFIG_CNTL); @@ -245,7 +250,7 @@ { case 8: pATIHW->dp_chain_mask = DP_CHAIN_8BPP; - pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | + pATIHW->dp_pix_width = SetBits(PIX_WIDTH_8BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_8BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -253,7 +258,7 @@ case 15: pATIHW->dp_chain_mask = DP_CHAIN_15BPP_1555; - pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | + pATIHW->dp_pix_width = SetBits(PIX_WIDTH_15BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_15BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -261,7 +266,7 @@ case 16: pATIHW->dp_chain_mask = DP_CHAIN_16BPP_565; - pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | + pATIHW->dp_pix_width = SetBits(PIX_WIDTH_16BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_16BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -271,7 +276,7 @@ if (pATI->bitsPerPixel == 24) { pATIHW->dp_chain_mask = DP_CHAIN_24BPP_888; - pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | + pATIHW->dp_pix_width = SetBits(PIX_WIDTH_8BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_8BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -279,7 +284,7 @@ else { pATIHW->dp_chain_mask = DP_CHAIN_32BPP_8888; - pATIHW->dp_pix_width = DP_BYTE_PIX_ORDER | + pATIHW->dp_pix_width = SetBits(PIX_WIDTH_32BPP, DP_DST_PIX_WIDTH) | SetBits(PIX_WIDTH_32BPP, DP_SRC_PIX_WIDTH) | SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); @@ -290,6 +295,12 @@ break; } +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + pATIHW->dp_pix_width |= DP_BYTE_PIX_ORDER; + +#endif /* X_BYTE_ORDER */ + pATIHW->dp_mix = SetBits(MIX_SRC, DP_FRGD_MIX) | SetBits(MIX_DST, DP_BKGD_MIX); pATIHW->dp_src = DP_MONO_SRC_ALLONES | @@ -624,6 +635,9 @@ (pATI->ProgrammableClock != ATI_CLOCK_NONE)) ATIClockSet(pATI, pATIHW); /* Programme clock */ + if (pATI->DAC == ATI_DAC_IBMRGB514) + ATIRGB514Set(pATI, pATIHW); + /* Load Mach64 CRTC registers */ outr(CRTC_H_TOTAL_DISP, pATIHW->crtc_h_total_disp); outr(CRTC_H_SYNC_STRT_WID, pATIHW->crtc_h_sync_strt_wid); @@ -833,8 +847,9 @@ void ATIMach64SetDPMSMode ( - ATIPtr pATI, - int DPMSMode + ScrnInfoPtr pScreenInfo, + ATIPtr pATI, + int DPMSMode ) { CARD32 crtc_gen_cntl = @@ -861,6 +876,9 @@ return; } + if (pATI->pXAAInfo && pATI->pXAAInfo->NeedToSync) + (*pATI->pXAAInfo->Sync)(pScreenInfo); + outr(CRTC_GEN_CNTL, crtc_gen_cntl); if ((pATI->LCDPanelID >= 0) && !pATI->OptionCRT) @@ -908,10 +926,6 @@ return; } - /* Panel power management seems to involve the engine */ - if (pATI->OptionAccel) - ATIMach64WaitForIdle(pATI); - if (pATI->Chip == ATI_CHIP_264LT) outr(POWER_MANAGEMENT, power_management); else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || @@ -1119,7 +1133,6 @@ xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "CLR_CMP_CNTL write cache disabled!\n"); } - } /* @@ -1128,6 +1141,7 @@ * caching of framebuffer data I haven't found any way of disabling, or * otherwise circumventing. Thanks to Mark Vojkovich for the suggestion. */ + pATI->pXAAInfo->NeedToSync = FALSE; pATI = *(volatile ATIPtr *)pATI->pMemory; } @@ -1156,7 +1170,16 @@ SetBits(SRC_BLIT, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); +#ifdef AVOID_DGA + if (TransparencyColour == -1) + +#else /* AVOID_DGA */ + + if (!pATI->XAAForceTransBlit && (TransparencyColour == -1)) + +#endif /* AVOID_DGA */ + outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); else { @@ -1566,11 +1589,8 @@ { 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) { @@ -1589,38 +1609,52 @@ * Always start transfers on a chuck-sized boundary. Note that * HOST_DATA_0 is actually on a 512-byte boundary, but *pBitmapData can * only be guaranteed to be on a chunk-sized boundary. - */ - iDWord = 16 - nDWord; - pDst = (volatile CARD32 *)pATI->pHOST_DATA - iDWord; - pSrc = pBitmapData - iDWord; - - /* + * * Transfer current chunk. With any luck, the compiler won't mangle * this too badly... */ - switch (iDWord) + +# if defined(ATIMove32) + + ATIMove32(pATI->pHOST_DATA, pBitmapData, nDWord); + +# else + { - case 0: MMIO_OUT32(pDst + 0, 0, *(pSrc + 0)); - case 1: MMIO_OUT32(pDst + 1, 0, *(pSrc + 1)); - case 2: MMIO_OUT32(pDst + 2, 0, *(pSrc + 2)); - case 3: MMIO_OUT32(pDst + 3, 0, *(pSrc + 3)); - case 4: MMIO_OUT32(pDst + 4, 0, *(pSrc + 4)); - case 5: MMIO_OUT32(pDst + 5, 0, *(pSrc + 5)); - case 6: MMIO_OUT32(pDst + 6, 0, *(pSrc + 6)); - case 7: MMIO_OUT32(pDst + 7, 0, *(pSrc + 7)); - case 8: MMIO_OUT32(pDst + 8, 0, *(pSrc + 8)); - case 9: MMIO_OUT32(pDst + 9, 0, *(pSrc + 9)); - case 10: MMIO_OUT32(pDst + 10, 0, *(pSrc + 10)); - case 11: MMIO_OUT32(pDst + 11, 0, *(pSrc + 11)); - case 12: MMIO_OUT32(pDst + 12, 0, *(pSrc + 12)); - case 13: MMIO_OUT32(pDst + 13, 0, *(pSrc + 13)); - case 14: MMIO_OUT32(pDst + 14, 0, *(pSrc + 14)); - case 15: MMIO_OUT32(pDst + 15, 0, *(pSrc + 15)); + volatile CARD32 *pDst; + CARD32 *pSrc; + unsigned int iDWord; - default: /* Muffle compiler */ - break; + iDWord = 16 - nDWord; + pDst = (volatile CARD32 *)pATI->pHOST_DATA - iDWord; + pSrc = pBitmapData - iDWord; + + switch (iDWord) + { + case 0: MMIO_MOVE32(pDst + 0, 0, *(pSrc + 0)); + case 1: MMIO_MOVE32(pDst + 1, 0, *(pSrc + 1)); + case 2: MMIO_MOVE32(pDst + 2, 0, *(pSrc + 2)); + case 3: MMIO_MOVE32(pDst + 3, 0, *(pSrc + 3)); + case 4: MMIO_MOVE32(pDst + 4, 0, *(pSrc + 4)); + case 5: MMIO_MOVE32(pDst + 5, 0, *(pSrc + 5)); + case 6: MMIO_MOVE32(pDst + 6, 0, *(pSrc + 6)); + case 7: MMIO_MOVE32(pDst + 7, 0, *(pSrc + 7)); + case 8: MMIO_MOVE32(pDst + 8, 0, *(pSrc + 8)); + case 9: MMIO_MOVE32(pDst + 9, 0, *(pSrc + 9)); + case 10: MMIO_MOVE32(pDst + 10, 0, *(pSrc + 10)); + case 11: MMIO_MOVE32(pDst + 11, 0, *(pSrc + 11)); + case 12: MMIO_MOVE32(pDst + 12, 0, *(pSrc + 12)); + case 13: MMIO_MOVE32(pDst + 13, 0, *(pSrc + 13)); + case 14: MMIO_MOVE32(pDst + 14, 0, *(pSrc + 14)); + case 15: MMIO_MOVE32(pDst + 15, 0, *(pSrc + 15)); + + default: /* Muffle compiler */ + break; + } } +# endif + /* Step to next chunk */ pBitmapData += nDWord; w -= nDWord; @@ -1636,7 +1670,7 @@ * This function fills in structure fields needed for acceleration on Mach64 * variants. */ -unsigned int +int ATIMach64AccelInit ( ATIPtr pATI, @@ -1673,6 +1707,13 @@ /* 8x8 mono pattern fills */ pXAAInfo->Mono8x8PatternFillFlags = + +#if X_BYTE_ORDER != X_LITTLE_ENDIAN + + BIT_ORDER_IN_BYTE_MSBFIRST | + +#endif /* X_BYTE_ORDER */ + HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN; pXAAInfo->SetupForMono8x8PatternFill = ATIMach64SetupForMono8x8PatternFill; pXAAInfo->SubsequentMono8x8PatternFillRect = @@ -1684,9 +1725,6 @@ */ 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; @@ -1823,146 +1861,153 @@ CARD8 *pImage ) { - ATIPtr pATI = ATIPTR(pScreenInfo); - CARD32 *pSrc = (pointer)pImage; - volatile CARD32 *pDst = pATI->pCursorImage; + ATIPtr pATI = ATIPTR(pScreenInfo); + XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; + 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; - } + if (pXAAInfo && pXAAInfo->NeedToSync) + (*pXAAInfo->Sync)(pScreenInfo); + +# if defined(ATIMove32) + + ATIMove32(pDst, pSrc, 256); + +# else + + /* 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]; + +#endif - /* 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]; } /* Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.12 Mon Apr 16 11:47:56 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.12 2001/04/16 15:47:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.15 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -33,19 +33,18 @@ #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((ScrnInfoPtr, ATIPtr, int)); -extern unsigned int ATIMach64AccelInit FunctionPrototype((ATIPtr, - XAAInfoRecPtr)); +extern int ATIMach64AccelInit FunctionPrototype((ATIPtr, XAAInfoRecPtr)); -extern Bool ATIMach64CursorInit FunctionPrototype((xf86CursorInfoPtr)); +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.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c:1.3 Sat Jan 6 15:58:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c,v 1.3 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c,v 1.4 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h:1.9 Mon Apr 16 11:02:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.9 2001/04/16 15:02:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.13 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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 @@ -63,6 +63,20 @@ * registers are non-FIFO'ed. * * in8/out8 8-bit counterparts to inr/outr. + * + * For portability reasons, inr/outr/in8/out8 should be used in preference to + * inl/outl/inb/outb to/from any register space starting with CRTC_H_TOTAL_DISP + * but before DST_OFF_PITCH (in the order defined by atiregs.h). None of + * inm/outm/outf should ever be used for these registers. + * + * outf()'s should be grouped together as much as possible, while respecting + * any ordering constraints the engine might impose. Groups larger than 16 + * outf()'s should be split up into two or more groups as needed (but not + * necessarily wanted). The outf() groups that result should be immediately + * preceeded by an ATIMach64WaitForFIFO(n) call, where "n" is the number of + * outf()'s in the group with the exception that groups containing a single + * outf() should not be thus preceeded. This means "n" should not be less than + * 2, nor larger than 16. */ /* @@ -71,11 +85,11 @@ * accessed (nor by what). */ -#define inm(_Register) \ - MMIO_IN32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ +#define inm(_Register) \ + MMIO_IN32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ (_Register) & MM_IO_SELECT) -#define outm(_Register, _Value) \ - MMIO_OUT32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ +#define outm(_Register, _Value) \ + MMIO_OUT32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \ (_Register) & MM_IO_SELECT, _Value) #ifdef AVOID_CPIO @@ -85,11 +99,11 @@ # define outr(_Register, _Value) \ MMIO_OUT32(pATI->pBlock[0], (_Register) & MM_IO_SELECT, _Value) -# define in8(_Register) \ - MMIO_IN8(pATI->pBlock[0], \ +# define in8(_Register) \ + MMIO_IN8(pATI->pBlock[0], \ (_Register) & (MM_IO_SELECT | IO_BYTE_SELECT)) -# define out8(_Register, _Value) \ - MMIO_OUT8(pATI->pBlock[0], \ +# define out8(_Register, _Value) \ + MMIO_OUT8(pATI->pBlock[0], \ (_Register) & (MM_IO_SELECT | IO_BYTE_SELECT), _Value) /* Cause a cpp syntax error if any of these are used */ @@ -130,7 +144,19 @@ extern void ATIMach64PollEngineStatus FunctionPrototype((ATIPtr)); /* - * MMIO cache definitions + * MMIO cache definitions. + * + * Many FIFO'ed registers can be cached by the driver. Registers that qualify + * for caching must not contain values that can change without driver + * intervention. Thus registers that contain hardware counters, strobe lines, + * etc., cannot be cached. This caching is intended to minimise FIFO use. + * There is therefore not much point to enable it for non-FIFO'ed registers. + * + * The cache for a particular 32-bit register is enabled by coding a + * CacheRegister() line for that register in the ATIMach64Set() function. The + * integrity of the cache for a particular register should be verified by the + * ATIMach64Sync() function. This code should be kept in register order, as + * defined in atiregs.h. */ #define CacheByte(___Register) pATI->MMIOCached[CacheSlotOf(___Register) >> 3] #define CacheBit(___Register) (0x80U >> (CacheSlotOf(___Register) & 0x07U)) @@ -212,5 +238,32 @@ out8(TV_OUT_INDEX, SetBits(_Index, TV_REG_INDEX)); \ outr(TV_OUT_DATA, _Value); \ } while (0) + +/* + * Block transfer definitions. + */ + +#if defined(GCCUSESGAS) && \ + (defined(i386) || defined(__i386) || defined(__i386__)) + +#define ATIMove32(_pDst, _pSrc, _nCount) \ + do \ + { \ + long d0, d1, d2; \ + __asm__ __volatile__ \ + ( \ + "cld\n\t" \ + "rep ; movsl" \ + : "=&c" (d0), \ + "=&D" (d1), \ + "=&S" (d2) \ + : "0" (_nCount), \ + "1" (_pDst), \ + "2" (_pSrc) \ + : "memory" \ + ); \ + } while (0) + +#endif #endif /* ___ATIMACH64IO_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.3 Sat Mar 3 17:27:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.3 2001/03/03 22:27:41 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.4 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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/atimode.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.5 Mon Apr 16 11:02:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.5 2001/04/16 15:02:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.9 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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,6 +30,7 @@ #include "atimach64io.h" #include "atimode.h" #include "atiprint.h" +#include "atirgb514.h" #include "ativga.h" #include "atiwonder.h" #include "atiwonderio.h" @@ -297,9 +298,11 @@ (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->lcd_index = lcd_index & + ~(LCD_REG_INDEX | LCD_DISPLAY_DIS | LCD_SRC_SEL | + LCD_CRTC2_DISPLAY_DIS); + if (pATI->Chip != ATI_CHIP_264XL) + pATIHW->lcd_index |= LCD_CRTC2_DISPLAY_DIS; pATIHW->config_panel = ATIGetMach64LCDReg(LCD_CONFIG_PANEL) | DONT_SHADOW_HEND; @@ -330,6 +333,8 @@ } } } + else if (pATI->DAC == ATI_DAC_IBMRGB514) + ATIRGB514PreInit(pATI, pATIHW); } /* Set RAMDAC data */ @@ -436,37 +441,34 @@ 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)); + /* 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) @@ -480,6 +482,8 @@ } } } + else if (pATI->DAC == ATI_DAC_IBMRGB514) + ATIRGB514Save(pATI, pATIHW); } #ifndef AVOID_CPIO @@ -720,10 +724,87 @@ ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_LOOP | AUTO_HORZ_RATIO | HORZ_STRETCH_MODE | HORZ_STRETCH_EN); if (!pATI->OptionCRT && (pMode->HDisplay < pATI->LCDHorizontal)) + do + { + /* + * The horizontal blender misbehaves when HDisplay is less than a + * a certain threshold (440 for a 1024-wide panel). It doesn't + * stretch such modes enough. Use pixel replication instead of + * blending to stretch modes that can be made to exactly fit the + * panel width. The undocumented "NoLCDBlend" option allows the + * pixel-replicated mode to be slightly wider or narrower than the + * panel width. It also causes a mode that is exactly half as wide + * as the panel to be pixel-replicated, rather than blended. + */ + int HDisplay = pMode->HDisplay & ~7; + int nStretch = pATI->LCDHorizontal / HDisplay; + int Remainder = pATI->LCDHorizontal % HDisplay; + + if ((!Remainder && ((nStretch > 2) || !pATI->OptionBlend)) || + (((HDisplay * 16) / pATI->LCDHorizontal) < 7)) + { + static const char StretchLoops[] = {10, 12, 13, 15, 16}; + int horz_stretch_loop = -1, BestRemainder; + int Numerator = HDisplay, Denominator = pATI->LCDHorizontal; + + ATIReduceRatio(&Numerator, &Denominator); + + BestRemainder = (Numerator * 16) / Denominator; + Index = NumberOf(StretchLoops); + while (--Index >= 0) + { + Remainder = + ((Denominator - Numerator) * StretchLoops[Index]) % + Denominator; + if (Remainder < BestRemainder) + { + horz_stretch_loop = Index; + if (!(BestRemainder = Remainder)) + break; + } +#if 0 + /* + * Enabling this code allows the pixel-replicated mode to + * be slightly wider than the panel width. + */ + Remainder = Denominator - Remainder; + if (Remainder < BestRemainder) + { + horz_stretch_loop = Index; + BestRemainder = Remainder; + } +#endif + } + + if ((horz_stretch_loop >= 0) && + (!BestRemainder || !pATI->OptionBlend)) + { + int horz_stretch_ratio = 0, Accumulator = 0; + int reuse_previous = 1; + + Index = StretchLoops[horz_stretch_loop]; + + while (--Index >= 0) + { + if (Accumulator > 0) + horz_stretch_ratio |= reuse_previous; + else + Accumulator += Denominator; + Accumulator -= Numerator; + reuse_previous <<= 1; + } + + pATIHW->horz_stretching |= HORZ_STRETCH_EN | + SetBits(horz_stretch_loop, HORZ_STRETCH_LOOP) | + SetBits(horz_stretch_ratio, HORZ_STRETCH_RATIO); + break; /* Out of the do { ... } while (0) */ + } + } + pATIHW->horz_stretching |= (HORZ_STRETCH_MODE | HORZ_STRETCH_EN) | - SetBits(((pMode->HDisplay & ~7) * - (MaxBits(HORZ_STRETCH_BLEND) + 1)) / + SetBits((HDisplay * (MaxBits(HORZ_STRETCH_BLEND) + 1)) / pATI->LCDHorizontal, HORZ_STRETCH_BLEND); + } while(0); if (pATI->OptionCRT || (VDisplay >= pATI->LCDVertical)) pATIHW->vert_stretching = 0; @@ -734,22 +815,18 @@ pATI->LCDVertical, VERT_STRETCH_RATIO0); } - if (!pATI->OptionCRT) - { - #ifndef AVOID_CPIO - /* Copy non-shadow CRTC register values to the shadow set */ - for (Index = 0; Index < NumberOf(pATIHW->shadow_vga); Index++) - pATIHW->shadow_vga[Index] = pATIHW->crt[Index]; + /* Copy non-shadow CRTC register values to the shadow set */ + for (Index = 0; Index < NumberOf(pATIHW->shadow_vga); Index++) + pATIHW->shadow_vga[Index] = pATIHW->crt[Index]; #endif /* AVOID_CPIO */ - pATIHW->shadow_h_total_disp = pATIHW->crtc_h_total_disp; - pATIHW->shadow_h_sync_strt_wid = pATIHW->crtc_h_sync_strt_wid; - pATIHW->shadow_v_total_disp = pATIHW->crtc_v_total_disp; - pATIHW->shadow_v_sync_strt_wid = pATIHW->crtc_v_sync_strt_wid; - } + pATIHW->shadow_h_total_disp = pATIHW->crtc_h_total_disp; + pATIHW->shadow_h_sync_strt_wid = pATIHW->crtc_h_sync_strt_wid; + pATIHW->shadow_v_total_disp = pATIHW->crtc_v_total_disp; + pATIHW->shadow_v_sync_strt_wid = pATIHW->crtc_v_sync_strt_wid; } /* Fill in clock data */ @@ -776,6 +853,8 @@ ECPClock >>= 1; pATIHW->pll_vclk_cntl |= SetBits(Index, PLL_ECP_DIV); } + else if (pATI->DAC == ATI_DAC_IBMRGB514) + ATIRGB514Calculate(pATI, pATIHW, pMode); return TRUE; } @@ -879,6 +958,10 @@ (pATI->ProgrammableClock > ATI_CLOCK_FIXED)) ATIClockSet(pATI, pATIHW); + /* Set up RAMDAC */ + if (pATI->DAC == ATI_DAC_IBMRGB514) + ATIRGB514Set(pATI, pATIHW); + /* Load VGA Wonder */ if (pATI->CPIO_VGAWonder) ATIVGAWonderSet(pATI, pATIHW); @@ -945,48 +1028,44 @@ if (pATI->LCDPanelID >= 0) { - if (!pATI->OptionCRT && - (!pATI->OptionDevel || (pATIHW == &pATI->OldHW))) - { - /* Switch to shadow registers */ - if (pATI->Chip == ATI_CHIP_264LT) - outr(LCD_GEN_CTRL, (pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT)) | - (SHADOW_EN | SHADOW_RW_EN)); - else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || - (pATI->Chip == ATI_CHIP_264XL) || - (pATI->Chip == ATI_CHIP_MOBILITY)) */ - ATIPutMach64LCDReg(LCD_GEN_CNTL, - (pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT)) | - (SHADOW_EN | SHADOW_RW_EN)); + /* Switch to shadow registers */ + if (pATI->Chip == ATI_CHIP_264LT) + outr(LCD_GEN_CTRL, (pATIHW->lcd_gen_ctrl & + ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT)) | + (SHADOW_EN | SHADOW_RW_EN)); + else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || + (pATI->Chip == ATI_CHIP_264XL) || + (pATI->Chip == ATI_CHIP_MOBILITY)) */ + ATIPutMach64LCDReg(LCD_GEN_CNTL, + (pATIHW->lcd_gen_ctrl & + ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT)) | + (SHADOW_EN | SHADOW_RW_EN)); - /* Restore shadow registers */ - switch (pATIHW->crtc) - { + /* Restore shadow registers */ + switch (pATIHW->crtc) + { #ifndef AVOID_CPIO - case ATI_CRTC_VGA: - for (Index = 0; - Index < NumberOf(pATIHW->shadow_vga); - Index++) - PutReg(CRTX(pATI->CPIO_VGABase), Index, - pATIHW->shadow_vga[Index]); - /* Fall through */ + case ATI_CRTC_VGA: + for (Index = 0; + Index < NumberOf(pATIHW->shadow_vga); + Index++) + PutReg(CRTX(pATI->CPIO_VGABase), Index, + pATIHW->shadow_vga[Index]); + /* Fall through */ #endif /* AVOID_CPIO */ - case ATI_CRTC_MACH64: - outr(CRTC_H_TOTAL_DISP, pATIHW->shadow_h_total_disp); - outr(CRTC_H_SYNC_STRT_WID, pATIHW->shadow_h_sync_strt_wid); - outr(CRTC_V_TOTAL_DISP, pATIHW->shadow_v_total_disp); - outr(CRTC_V_SYNC_STRT_WID, pATIHW->shadow_v_sync_strt_wid); - break; + case ATI_CRTC_MACH64: + outr(CRTC_H_TOTAL_DISP, pATIHW->shadow_h_total_disp); + outr(CRTC_H_SYNC_STRT_WID, pATIHW->shadow_h_sync_strt_wid); + outr(CRTC_V_TOTAL_DISP, pATIHW->shadow_v_total_disp); + outr(CRTC_V_SYNC_STRT_WID, pATIHW->shadow_v_sync_strt_wid); + break; - default: - break; - } + default: + break; } /* Restore CRTC selection & shadow state and enable stretching */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.3 Sun Mar 25 00:32:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.3 2001/03/25 05:32:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.4 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.12 Sat Jan 6 15:58:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c,v 1.12 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c,v 1.13 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h:1.7 Sat Jan 6 15:58:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.7 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.8 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h:1.5 Sat Jan 6 15:58:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h,v 1.5 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h,v 1.6 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.18 xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c:1.18 Mon May 7 17:59:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.18 2001/05/07 21:59:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.19 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.8 Fri May 18 16:22:28 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.8 2001/05/18 20:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.9 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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/atipreinit.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.47.2.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.57 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.47.2.1 Tue May 22 11:57:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c Fri Jan 18 11:56:16 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.47.2.1 2001/05/22 15:57:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.57 2002/01/18 16:56:16 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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 @@ -409,6 +409,7 @@ int Numerator, Denominator; int MinX, MinY; ClockRange ATIClockRange = {NULL, 0, 80000, 0, TRUE, TRUE, 1, 1, 0}; + int DefaultmaxClock = 0; int minPitch, maxPitch = 0xFFU, maxHeight = 0; int ApertureSize = 0x00010000U; LookupModeFlags Strategy = LOOKUP_CLOSEST_CLOCK; @@ -442,7 +443,7 @@ } /* Register resources */ - pEntity = xf86GetEntityInfo(pScreenInfo->entityList[0]); + pEntity = xf86GetEntityInfo(pATI->iEntity); pGDev = pEntity->device; pResources = pEntity->resources; xfree(pEntity); @@ -1061,8 +1062,21 @@ if ((pATI->ProgrammableClock > ATI_CLOCK_FIXED) && (pATI->ProgrammableClock < ATI_CLOCK_MAX)) + { + /* + * Graphics PRO TURBO 1600's are unusual in that an ICS2595 is used + * to generate clocks for VGA modes, and an IBM RGB514 is used for + * accelerator modes. + */ + if ((pATI->ProgrammableClock == ATI_CLOCK_ICS2595) && + (pATI->DAC == ATI_DAC_IBMRGB514) && + (pScreenInfo->depth >= 8) && + (pATI->Chipset == ATI_CHIPSET_ATI)) + pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514; + pATI->ClockDescriptor = ATIClockDescriptors[pATI->ProgrammableClock]; + } ClockDac = pATI->DAC; switch (pATI->ProgrammableClock) @@ -1329,6 +1343,11 @@ xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s adapter detected.\n", ATIAdapterNames[pATI->Adapter]); + if (pATI->Chip >= ATI_CHIP_264GT) + xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, + "For information on using the multimedia capabilities\n of this" + " adapter, please see http://gatos.sf.net.\n"); + if ((pATI->DAC & ~0x0FU) == ATI_DAC_INTERNAL) xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "Internal RAMDAC (subtype %d) detected.\n", pATI->DAC & 0x0FU); @@ -1602,12 +1621,12 @@ pATI->LCDVSyncWidth = (pATIHW->crt[17] - pATIHW->crt[16]) & 0x0FU; pATI->LCDVBlankWidth = - (pATIHW->crt[22] - pATIHW->crt[21]) & 0xFFU; + ((pATIHW->crt[22] - pATIHW->crt[21]) & 0xFFU) + 1; HDisplay = pATIHW->crt[0] + 5 - pATI->LCDHBlankWidth; VDisplay = (((pATIHW->crt[7] << 4) & 0x0200U) | ((pATIHW->crt[7] << 8) & 0x0100U) | - pATIHW->crt[6]) + 2 - pATI->LCDVBlankWidth; + pATIHW->crt[6]) + 3 - pATI->LCDVBlankWidth; pATI->LCDHSyncStart = ((pATIHW->crt[4] - pATIHW->crt[2]) & 0xFFU) + 1; @@ -1995,7 +2014,8 @@ */ if (pATI->LinearBase && !pATI->LinearSize) { - if (pATI->VideoRAM < 4096) + if ((pATI->Chip <= ATI_CHIP_88800GXD) && + (pATI->VideoRAM < 4096)) pATI->LinearSize = 4 * 1024 * 1024; else pATI->LinearSize = 8 * 1024 * 1024; @@ -2005,7 +2025,7 @@ #ifndef AVOID_CPIO /* Except for PCI & AGP, allow for user override */ - if (!pATI->PCIInfo) + if (!pVideo) { if (pATI->Chip == ATI_CHIP_88800CX) IOValue = ~((CARD32)((1 << 23) - 1)); @@ -2028,13 +2048,14 @@ { if (!pATI->LinearSize) { - if (pATI->VideoRAM < 4096) + if ((pATI->Chip <= ATI_CHIP_88800GXD) && + (pATI->VideoRAM < 4096)) pATI->LinearSize = 4 * 1024 * 1024; else pATI->LinearSize = 8 * 1024 * 1024; } - Resources[0].type = ResExcMemBlock; + Resources[0].type = ResExcMemBlock | ResBus; Resources[0].rBegin = pATI->LinearBase; Resources[0].rEnd = pATI->LinearBase + pATI->LinearSize - 1; @@ -2622,7 +2643,7 @@ DacSpeed = pGDev->dacSpeeds[DAC_BPP8]; if (DacSpeed < ATIClockRange.maxClock) { - int DefaultmaxClock = 135000; + DefaultmaxClock = 135000; if (pATI->depth > 8) DefaultmaxClock = 80000; @@ -2644,45 +2665,68 @@ ATIClockRange.maxClock = DefaultmaxClock; } } - else switch(pATI->DAC) + else { - case ATI_DAC_STG1700: - case ATI_DAC_STG1702: - case ATI_DAC_STG1703: - ATIClockRange.maxClock = 110000; - break; + switch(pATI->DAC) + { + case ATI_DAC_STG1700: + case ATI_DAC_STG1702: + case ATI_DAC_STG1703: + DefaultmaxClock = 110000; + break; - default: + case ATI_DAC_IBMRGB514: + pATI->maxClock = 220000; #ifndef AVOID_CPIO - /* - * 80 MHz is too high in some cases. Limit 18800-x's to 40 MHz. - * Don't exceed the memory clock on VGA Wonder capables with less - * than 1 MB, if using a packed mode. - */ - if ((pATI->Chip == ATI_CHIP_18800) || - (pATI->Chip == ATI_CHIP_18800_1)) - ATIClockRange.maxClock = 40000; - else if (pATI->CPIO_VGAWonder && - (pATI->VideoRAM < 1024) && - (pATI->depth >= 8)) - ATIClockRange.maxClock = - (GetBits(BIOSByte(0x44U), 0x04U) * 5000) + 40000; - else + if (pATI->NewHW.crtc == ATI_CRTC_VGA) + DefaultmaxClock = 100000; + else #endif /* AVOID_CPIO */ - { - ATIClockRange.maxClock = 80000; - } + DefaultmaxClock = 220000; + break; - break; + default: + +#ifndef AVOID_CPIO + + /* + * 80 MHz is too high in some cases. Limit 18800-x's to 40 + * MHz. Don't exceed the memory clock on VGA Wonder capables + * with less than 1 MB, if using a packed mode. + */ + if ((pATI->Chip == ATI_CHIP_18800) || + (pATI->Chip == ATI_CHIP_18800_1)) + DefaultmaxClock = 40000; + else if (pATI->CPIO_VGAWonder && + (pATI->VideoRAM < 1024) && + (pATI->depth >= 8)) + DefaultmaxClock = + (GetBits(BIOSByte(0x44U), 0x04U) * 5000) + 40000; + else + +#endif /* AVOID_CPIO */ + + { + DefaultmaxClock = 80000; + } + + break; + } + + if (DefaultmaxClock < ATIClockRange.maxClock) + ATIClockRange.maxClock = DefaultmaxClock; } if (pATI->ClockDescriptor.MaxN <= 0) + { + ATIClockRange.maxClock = DefaultmaxClock; xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Maximum pixel clock: %.3f MHz.\n", (double)ATIClockRange.maxClock / 1000.0); + } /* * Determine available pixel clock frequencies. Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.4 Sat Jan 6 15:58:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h,v 1.4 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h,v 1.5 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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.20 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c:1.20 Thu Apr 19 10:14:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.20 2001/04/19 14:14:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.23 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -86,11 +86,11 @@ static void ATIPrintIndexedRegisters ( - const CARD16 Port, - const CARD8 StartIndex, - const CARD8 EndIndex, - const char *Name, - const CARD16 GenS1 + const IOADDRESS Port, + const CARD8 StartIndex, + const CARD8 EndIndex, + const char *Name, + const IOADDRESS GenS1 ) { int Index; @@ -274,6 +274,72 @@ } /* + * ATIPrintRGB514Registers -- + * + * Display IBM RGB 514 registers when the server is invoked with -verbose. + */ +static void +ATIPrintRGB514Registers +( + ATIPtr pATI +) +{ + CARD32 crtc_gen_cntl, dac_cntl; + CARD8 index_lo, index_hi, index_ctl; + int Index; + + /* Temporarily switch to Mach64 CRTC */ + crtc_gen_cntl = inr(CRTC_GEN_CNTL); + if (!(crtc_gen_cntl & CRTC_EXT_DISP_EN)) + outr(CRTC_GEN_CNTL, crtc_gen_cntl | CRTC_EXT_DISP_EN); + + /* Temporarily switch to IBM RGB 514 registers */ + dac_cntl = inr(DAC_CNTL); + outr(DAC_CNTL, (dac_cntl & ~DAC_EXT_SEL_RS3) | DAC_EXT_SEL_RS2); + + index_lo = in8(M64_DAC_WRITE); + index_hi = in8(M64_DAC_DATA); + index_ctl = in8(M64_DAC_READ); + + out8(M64_DAC_WRITE, 0x00U); + out8(M64_DAC_DATA, 0x00U); + out8(M64_DAC_READ, 0x01U); /* Auto-increment */ + + xf86ErrorFVerb(4, "\n IBM RGB 514 registers:"); + for (Index = 0; Index < 0x0800; Index++) + { + if (!(Index & 3)) + { + if (!(Index & 15)) + { + xf86ErrorFVerb(4, "\n 0x%04X: ", Index); + + /* Need to rewrite index every so often... */ + if ((Index == 0x0100) || (Index == 0x0500)) + { + out8(M64_DAC_WRITE, 0x00U); + out8(M64_DAC_DATA, Index >> 8); + } + } + + xf86ErrorFVerb(4, " "); + } + + xf86ErrorFVerb(4, "%02X", in8(M64_DAC_MASK)); + } + + /* Restore registers */ + out8(M64_DAC_WRITE, index_lo); + out8(M64_DAC_DATA, index_hi); + out8(M64_DAC_READ, index_ctl); + outr(DAC_CNTL, dac_cntl); + if (!(crtc_gen_cntl & CRTC_EXT_DISP_EN)) + outr(CRTC_GEN_CNTL, crtc_gen_cntl); + + xf86ErrorFVerb(4, "\n"); +} + +/* * ATIPrintRegisters -- * * Display various registers when the server is invoked with -verbose. @@ -339,8 +405,11 @@ outr(LCD_INDEX, lcd_index); } else + { ATIPrintIndexedRegisters(CRTX(ColourIOBase), 0, 64, "Colour CRT controller", 0); + } + ATIPrintIndexedRegisters(ATTRX, 0, 32, "Attribute controller", GENS1(ColourIOBase)); } @@ -381,8 +450,11 @@ outr(LCD_INDEX, lcd_index); } else + { ATIPrintIndexedRegisters(CRTX(MonochromeIOBase), 0, 64, "Monochrome CRT controller", 0); + } + ATIPrintIndexedRegisters(ATTRX, 0, 32, "Attribute controller", GENS1(MonochromeIOBase)); } @@ -454,8 +526,11 @@ (lcd_gen_ctrl & ~CRTC_RW_SELECT) | (SHADOW_EN | SHADOW_RW_EN)); ATIPrintMach64Registers(pATI, &crtc, "shadow"); - ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl | CRTC_RW_SELECT); - ATIPrintMach64Registers(pATI, &crtc, "secondary"); + if (pATI->Chip != ATI_CHIP_264XL) + { + ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl | CRTC_RW_SELECT); + ATIPrintMach64Registers(pATI, &crtc, "secondary"); + } ATIPutMach64LCDReg(LCD_GEN_CNTL, lcd_gen_ctrl); @@ -508,6 +583,9 @@ if (pATI->Chip >= ATI_CHIP_264CT) ATIPrintMach64PLLRegisters(pATI); + + if (pATI->DAC == ATI_DAC_IBMRGB514) + ATIPrintRGB514Registers(pATI); } #ifdef AVOID_CPIO @@ -626,6 +704,10 @@ if (pATI->pMemory == pATI->pBank) xf86ErrorFVerb(4, "\n No linear aperture.\n"); else + +#else /* AVOID_CPIO */ + + if (pATI->pMemory) #endif /* AVOID_CPIO */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.8 Sat Jan 6 15:58:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h,v 1.8 2001/01/06 20:58:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h,v 1.9 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h:1.3 Sat Jan 6 15:58:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h Wed Jan 16 11:22:27 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h,v 1.3 2001/01/06 20:58:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h,v 1.4 2002/01/16 16:22:27 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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.45 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c:1.52 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c:1.45 Fri May 18 16:22:28 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c Fri Jan 18 11:56:16 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.45 2001/05/18 20:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.52 2002/01/18 16:56:16 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -110,9 +110,9 @@ #define DoProbe (1 << 4) typedef struct { - CARD16 Base; - CARD8 Size; - CARD8 Flag; + IOADDRESS Base; + CARD8 Size; + CARD8 Flag; } PortRec, *PortPtr; /* @@ -131,8 +131,8 @@ const CARD8 ProbeFlag ) { - int i, j; - CARD16 Base; + IOADDRESS Base; + int i, j; for (i = 6; --i >= 0; pBase++, pSize++) { @@ -177,11 +177,11 @@ static CARD8 ATICheckSparseIOBases ( - pciVideoPtr pVideo, - CARD8 *ProbeFlags, - const CARD16 IOBase, - const int Count, - const Bool Override + pciVideoPtr pVideo, + CARD8 *ProbeFlags, + const IOADDRESS IOBase, + const int Count, + const Bool Override ) { CARD32 FirstPort, LastPort; @@ -223,10 +223,10 @@ static void ATIClaimSparseIOBases ( - CARD8 *ProbeFlags, - const CARD16 IOBase, - const int Count, - const CARD8 ProbeFlag + CARD8 *ProbeFlags, + const IOADDRESS IOBase, + const int Count, + const CARD8 ProbeFlag ) { CARD32 FirstPort = LongPort(IOBase), @@ -558,7 +558,7 @@ outr(BUS_CNTL, (bus_cntl & ~(BUS_HOST_ERR_INT_EN | BUS_FIFO_ERR_INT_EN)) | (BUS_HOST_ERR_INT | BUS_FIFO_ERR_INT)); - else + else if (Chip < ATI_CHIP_264VT4) outr(BUS_CNTL, (bus_cntl & ~BUS_HOST_ERR_INT_EN) | BUS_HOST_ERR_INT); gen_test_cntl = inr(GEN_TEST_CNTL); @@ -625,7 +625,7 @@ ATIMach64Probe ( pciVideoPtr pVideo, - const CARD16 IOBase, + const IOADDRESS IOBase, const CARD8 IODecoding, const ATIChipType Chip ) @@ -698,7 +698,7 @@ ATIMach64Probe ( pciVideoPtr pVideo, - const CARD16 IOBase, + const IOADDRESS IOBase, const CARD8 IODecoding, const ATIChipType Chip ) @@ -969,9 +969,7 @@ { ATIPtr pATI = *ppATI; - if (*ppVGA) - ATIAssignVGA(pVideo, ppVGA, pATI, p8514, ProbeFlags); - else + if (!*ppVGA) { /* * An ATI PCI adapter has been detected at this point, and its VGA, if @@ -985,8 +983,10 @@ if (pATI->VGAAdapter == ATI_ADAPTER_NONE) return; - ATIAssignVGA(pVideo, ppATI, pATI, p8514, ProbeFlags); + ppVGA = ppATI; } + + ATIAssignVGA(pVideo, ppVGA, pATI, p8514, ProbeFlags); } #endif /* AVOID_CPIO */ @@ -1004,42 +1004,42 @@ int flags ) { - ATIPtr pATI, *ATIPtrs = NULL; - GDevPtr *GDevs, pGDev; - pciVideoPtr pVideo, *xf86PciVideoInfo = xf86GetPciVideoInfo(); - pciConfigPtr pPCI; - ATIGDev *ATIGDevs = NULL, *pATIGDev; - ScrnInfoPtr pScreenInfo; - CARD32 PciReg; - Bool ProbeSuccess = FALSE; - Bool DoRage128 = FALSE, DoRadeon = FALSE; - int i, j, k; - int nGDev, nATIGDev = -1, nATIPtr = 0; - int Chipset; - ATIChipType Chip; + ATIPtr pATI, *ATIPtrs = NULL; + GDevPtr *GDevs, pGDev; + pciVideoPtr pVideo, *xf86PciVideoInfo = xf86GetPciVideoInfo(); + pciConfigPtr pPCI; + ATIGDev *ATIGDevs = NULL, *pATIGDev; + ScrnInfoPtr pScreenInfo; + CARD32 PciReg; + Bool ProbeSuccess = FALSE; + Bool DoRage128 = FALSE, DoRadeon = FALSE; + int i, j, k; + int nGDev, nATIGDev = -1, nATIPtr = 0; + int Chipset; + ATIChipType Chip; #ifndef AVOID_CPIO - ATIPtr pVGA = NULL, p8514 = NULL; - ATIPtr pMach64[3] = {NULL, NULL, NULL}; - pciConfigPtr *xf86PciInfo = xf86GetPciConfigInfo(); - PortPtr PCIPorts = NULL; - int nPCIPort = 0; - CARD8 fChipsets[ATI_CHIPSET_MAX]; - static const CARD16 Mach64SparseIOBases[] = {0x02ECU, 0x01CCU, 0x01C8U}; - CARD8 ProbeFlags[LongPort(SPARSE_IO_BASE) + 1]; - - unsigned long BIOSBase; - static const CARD8 ATISignature[] = " 761295520"; -# define SignatureSize 10 -# define PrefixSize 0x50U -# define BIOSSignature 0x30U - CARD8 BIOS[PrefixSize]; -# define BIOSWord(_n) (BIOS[_n] | (BIOS[(_n) + 1] << 8)) + ATIPtr pVGA = NULL, p8514 = NULL; + ATIPtr pMach64[3] = {NULL, NULL, NULL}; + pciConfigPtr *xf86PciInfo = xf86GetPciConfigInfo(); + PortPtr PCIPorts = NULL; + int nPCIPort = 0; + CARD8 fChipsets[ATI_CHIPSET_MAX]; + static const IOADDRESS Mach64SparseIOBases[] = {0x02ECU, 0x01CCU, 0x01C8U}; + CARD8 ProbeFlags[LongPort(SPARSE_IO_BASE) + 1]; + + unsigned long BIOSBase; + static const CARD8 ATISignature[] = " 761295520"; +# define SignatureSize 10 +# define PrefixSize 0x50U +# define BIOSSignature 0x30U + CARD8 BIOS[PrefixSize]; +# define BIOSWord(_n) (BIOS[_n] | (BIOS[(_n) + 1] << 8)) #endif /* AVOID_CPIO */ -# define AddAdapter(_p) \ +# define AddAdapter(_p) \ do \ { \ nATIPtr++; \ @@ -1312,7 +1312,7 @@ continue; } - sprintf(Identifier, "Unshared Mach64 at sparse PIO base 0x%04X", + sprintf(Identifier, "Unshared Mach64 at sparse PIO base 0x%04lX", Mach64SparseIOBases[i]); xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected.\n", Identifier); @@ -1720,17 +1720,20 @@ { case ATI_CHIP_RAGE128GL: case ATI_CHIP_RAGE128VR: + case ATI_CHIP_RAGE128PROULTRA: case ATI_CHIP_RAGE128PROGL: 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: + case ATI_CHIP_RADEONMOBILITY6: + case ATI_CHIP_RADEONMOBILITY7: + case ATI_CHIP_R200: + case ATI_CHIP_RV200: DoRadeon = TRUE; continue; @@ -2105,9 +2108,11 @@ * value in the case of Mach64 adapters whose ChipID is * unrecognised. */ + pVideo = pATI->PCIInfo; if (pGDev->chipID >= 0) { - if (pATI->ChipType != pGDev->chipID) + if ((pATI->ChipType != pGDev->chipID) && + (!pVideo || (pGDev->chipID != pVideo->chipType))) { if ((pATI->Adapter != ATI_ADAPTER_MACH64) || (pATI->Chip != ATI_CHIP_Mach64)) @@ -2119,16 +2124,15 @@ continue; } if ((pGDev->chipRev >= 0) && - (pATI->ChipRev != pGDev->chipRev)) + (pATI->ChipRev != pGDev->chipRev) && + (!pVideo || (pGDev->chipRev != pVideo->chipRev) || + (pGDev->chipID != pVideo->chipType))) { - if (pATI->Adapter != ATI_ADAPTER_MACH64) + if (pATI->Chip < ATI_CHIP_264CT) continue; if (pATI->Chip != ATI_CHIP_Mach64) { - if (pATI->ChipRev == pATI->ChipRevision) - continue; - /* * There are two foundry codes for UMC. Some * adapters will advertise one in CONFIG_CHIP_ID Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.6 Sat Jan 6 15:58:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h,v 1.6 2001/01/06 20:58:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h,v 1.7 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h:1.5 Sat Jan 6 15:58:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h,v 1.5 2001/01/06 20:58:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h,v 1.6 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.17 xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h:1.17 Mon Apr 16 11:02:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.17 2001/04/16 15:02:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.18 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1994 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1994 through 2002 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 @@ -2041,16 +2041,16 @@ #define LCD_LT_GIO 0x07u /* See LT's LT_GIO (0x2f) */ #define LCD_POWER_MANAGEMENT 0x08u /* See LT's POWER_MANAGEMENT (0x36) */ #define LCD_ZVGPIO 0x09u -#define LCD_ICON_CLR0 0x0au /* XC/XL */ -#define LCD_ICON_CLR1 0x0bu /* XC/XL */ -#define LCD_ICON_OFFSET 0x0cu /* XC/XL */ -#define LCD_ICON_HORZ_VERT_POSN 0x0du /* XC/XL */ -#define LCD_ICON_HORZ_VERT_OFF 0x0eu /* XC/XL */ -#define LCD_ICON2_CLR0 0x0fu /* XC/XL */ -#define LCD_ICON2_CLR1 0x10u /* XC/XL */ -#define LCD_ICON2_OFFSET 0x11u /* XC/XL */ -#define LCD_ICON2_HORZ_VERT_POSN 0x12u /* XC/XL */ -#define LCD_ICON2_HORZ_VERT_OFF 0x13u /* XC/XL */ +#define LCD_ICON_CLR0 0x0au /* Mobility */ +#define LCD_ICON_CLR1 0x0bu /* Mobility */ +#define LCD_ICON_OFFSET 0x0cu /* Mobility */ +#define LCD_ICON_HORZ_VERT_POSN 0x0du /* Mobility */ +#define LCD_ICON_HORZ_VERT_OFF 0x0eu /* Mobility */ +#define LCD_ICON2_CLR0 0x0fu /* Mobility */ +#define LCD_ICON2_CLR1 0x10u /* Mobility */ +#define LCD_ICON2_OFFSET 0x11u /* Mobility */ +#define LCD_ICON2_HORZ_VERT_POSN 0x12u /* Mobility */ +#define LCD_ICON2_HORZ_VERT_OFF 0x13u /* Mobility */ #define LCD_MISC_CNTL 0x14u /* XC/XL */ #define BL_MOD_LEVEL 0x000000fful #define BIAS_MOD_LEVEL 0x0000ff00ul @@ -2063,10 +2063,15 @@ #define FORCE_DAC_DATA_SEL_X 0x00c00000ul #define FORCE_DAC_DATA_X 0xff000000ul #define LCD_TMDS_CNTL 0x15u /* XC/XL */ +#define LCD_SCRATCH_PAD_4M 0x15u /* Mobility */ #define LCD_TMDS_SYNC_CHAR_SETA 0x16u /* XC/XL */ +#define LCD_SCRATCH_PAD_5M 0x16u /* Mobility */ #define LCD_TMDS_SYNC_CHAR_SETB 0x17u /* XC/XL */ +#define LCD_SCRATCH_PAD_6M 0x17u /* Mobility */ #define LCD_TMDS_SRC 0x18u /* XC/XL */ +#define LCD_SCRATCH_PAD_7M 0x18u /* Mobility */ #define LCD_PLTSTBLK_CNTL 0x19u /* XC/XL */ +#define LCD_SCRATCH_PAD_8M 0x19u /* Mobility */ #define LCD_SYNC_GEN_CNTL 0x1au /* XC/XL */ #define LCD_PATTERN_GEN_SEED 0x1bu /* XC/XL */ #define LCD_APC_CNTL 0x1cu /* XC/XL */ @@ -2105,9 +2110,9 @@ #define LCD_CRC_PATTERN_RPT 0x22u /* XC/XL */ #define LCD_PL_TRANSMITTER_CNTL 0x23u /* XC/XL */ #define LCD_PL_PLL_CNTL 0x24u /* XC/XL */ -#define LCD_ALPHA_BLENDING 0x25u /* XC/XL */ -#define LCD_PORTRAIT_GEN_CNTL 0x26u /* XC/XL */ -#define LCD_APC_CTRL_IO 0x27u /* XC/XL */ +#define LCD_ALPHA_BLENDING 0x25u /* Mobility */ +#define LCD_PORTRAIT_GEN_CNTL 0x26u /* Mobility */ +#define LCD_APC_CTRL_IO 0x27u /* Mobility */ #define LCD_TEST_IO 0x28u /* XC/XL */ /* ? 0x29u */ #define LCD_DP1_MEM_ACCESS 0x2au /* XC/XL */ @@ -2119,14 +2124,19 @@ #define LCD_DPCTRL_DEBUG_A 0x30u /* XC/XL */ #define LCD_DPCTRL_DEBUG_B 0x31u /* XC/XL */ #define LCD_MEMBLK_DEBUG 0x32u /* XC/XL */ -#define LCD_APC_LUT_AB 0x33u /* XC/XL */ -#define LCD_APC_LUT_CD 0x34u /* XC/XL */ -#define LCD_APC_LUT_EF 0x35u /* XC/XL */ -#define LCD_APC_LUT_GH 0x36u /* XC/XL */ -#define LCD_APC_LUT_IJ 0x37u /* XC/XL */ -#define LCD_APC_LUT_KL 0x38u /* XC/XL */ -#define LCD_APC_LUT_MN 0x39u /* XC/XL */ -#define LCD_APC_LUT_OP 0x3au /* XC/XL */ +#define LCD_APC_LUT_AB 0x33u /* Mobility */ +#define LCD_SCRATCH_PAD_4X 0x33u /* XL/XC */ +#define LCD_APC_LUT_CD 0x34u /* Mobility */ +#define LCD_SCRATCH_PAD_5X 0x34u /* XL/XC */ +#define LCD_APC_LUT_EF 0x35u /* Mobility */ +#define LCD_SCRATCH_PAD_6X 0x35u /* XL/XC */ +#define LCD_APC_LUT_GH 0x36u /* Mobility */ +#define LCD_SCRATCH_PAD_7X 0x36u /* XL/XC */ +#define LCD_APC_LUT_IJ 0x37u /* Mobility */ +#define LCD_SCRATCH_PAD_8X 0x37u /* XL/XC */ +#define LCD_APC_LUT_KL 0x38u /* Mobility */ +#define LCD_APC_LUT_MN 0x39u /* Mobility */ +#define LCD_APC_LUT_OP 0x3au /* Mobility */ /* ? 0x3bu */ /* ? 0x3cu */ /* ? 0x3du */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c:1.3 --- /dev/null Fri Jan 18 15:25:19 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c Wed Jan 16 11:22:28 2002 @@ -0,0 +1,280 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.c,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ +/* + * Copyright 2001 through 2002 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 "ati.h" +#include "aticrtc.h" +#include "atimach64io.h" +#include "atirgb514.h" + +/* + * ATIRGB514PreInit -- + * + * This function fills in the IBM RGB 514 portion of an ATIHWRec that is common + * to all video modes generated by the server. + */ +void +ATIRGB514PreInit +( + ATIPtr pATI, + ATIHWPtr pATIHW +) +{ + /* Get a work copy of IBM RGB 514 registers */ + ATIRGB514Save(pATI, pATIHW); + + /* Miscellaneous Clock Control */ + pATIHW->ibmrgb514[0x0002U] = 0x01U; + + /* Sync Control */ + pATIHW->ibmrgb514[0x0003U] &= ~0x80U; + + /* Horizontal Sync Control */ + pATIHW->ibmrgb514[0x0004U] = 0x00U; + + /* Power Management */ + pATIHW->ibmrgb514[0x0005U] = 0x00U; + + /* DAC Operation */ + pATIHW->ibmrgb514[0x0006U] &= ~0x04U; + + /* Palette Control */ + pATIHW->ibmrgb514[0x0007U] = 0x00U; + + /* PLL Control */ + pATIHW->ibmrgb514[0x0010U] = 0x01U; + + /* Cursor control */ + pATIHW->ibmrgb514[0x0030U] &= ~0x03U; /* For now */ + + /* Border (i.e. overscan) */ + pATIHW->ibmrgb514[0x0060U] = 0x00U; + pATIHW->ibmrgb514[0x0061U] = 0x00U; + pATIHW->ibmrgb514[0x0062U] = 0x00U; + + /* Miscellaneous Control */ + pATIHW->ibmrgb514[0x0070U] &= ~0x20U; + pATIHW->ibmrgb514[0x0071U] = 0x41U; /* See workaround in ATIRGB514Set() */ + +#ifndef AVOID_CPIO + + if (pATIHW->crtc == ATI_CRTC_VGA) + { + /* Pixel Format */ + pATIHW->ibmrgb514[0x000AU] = 0x03U; + + /* Miscellaneous Control */ + pATIHW->ibmrgb514[0x0070U] |= 0x40U; + + /* VRAM Mask */ + pATIHW->ibmrgb514[0x0090U] = 0x03U; + } + else + +#endif /* AVOID_CPIO */ + + { + /* Miscellaneous Control */ + pATIHW->ibmrgb514[0x0070U] &= ~0x40U; + + /* VRAM Mask */ + pATIHW->ibmrgb514[0x0090U] = 0x00U; + pATIHW->ibmrgb514[0x0091U] = 0x00U; + + /* Pixel Format */ + switch (pATI->depth) + { + case 8: + pATIHW->ibmrgb514[0x000AU] = 0x03U; + pATIHW->ibmrgb514[0x000BU] = 0x00U; + break; + + case 15: + pATIHW->ibmrgb514[0x000AU] = 0x04U; + pATIHW->ibmrgb514[0x000CU] = 0xC4U; + break; + + case 16: + pATIHW->ibmrgb514[0x000AU] = 0x04U; + pATIHW->ibmrgb514[0x000CU] = 0xC6U; + break; + + case 24: + if (pATI->bitsPerPixel == 24) + { + pATIHW->ibmrgb514[0x000AU] = 0x05U; + pATIHW->ibmrgb514[0x000DU] = 0x01U; + } + else + { + pATIHW->ibmrgb514[0x000AU] = 0x06U; + pATIHW->ibmrgb514[0x000EU] = 0x03U; + } + break; + + default: + break; + } + } + + if (pATI->rgbBits == 8) + pATIHW->ibmrgb514[0x0071U] |= 0x04U; +} + +/* + * ATIRGB514Save -- + * + * This function saves IBM RGB514 related data into an ATIHWRec. + */ +void +ATIRGB514Save +( + ATIPtr pATI, + ATIHWPtr pATIHW +) +{ + CARD32 crtc_gen_cntl, dac_cntl; + CARD8 index_lo, index_hi, index_ctl; + int Index; + + /* Temporarily switch to Mach64 CRTC */ + crtc_gen_cntl = inr(CRTC_GEN_CNTL); + if (!(crtc_gen_cntl & CRTC_EXT_DISP_EN)) + outr(CRTC_GEN_CNTL, crtc_gen_cntl | CRTC_EXT_DISP_EN); + + /* Temporarily switch to IBM RGB 514 registers */ + dac_cntl = inr(DAC_CNTL) & ~(DAC_EXT_SEL_RS2 | DAC_EXT_SEL_RS3); + outr(DAC_CNTL, dac_cntl | DAC_EXT_SEL_RS2); + + index_lo = in8(M64_DAC_WRITE); + index_hi = in8(M64_DAC_DATA); + index_ctl = in8(M64_DAC_READ); + + out8(M64_DAC_WRITE, 0x00U); + out8(M64_DAC_DATA, 0x00U); + out8(M64_DAC_READ, 0x01U); /* Auto-increment */ + + /* Save IBM RGB 514 registers */ + for (Index = 0; Index < NumberOf(pATIHW->ibmrgb514); Index++) + { + /* Need to rewrite the index every so often... */ + if ((Index == 0x0100) || (Index == 0x0500)) + { + out8(M64_DAC_WRITE, 0); + out8(M64_DAC_DATA, Index >> 8); + } + pATIHW->ibmrgb514[Index] = in8(M64_DAC_MASK); + } + + /* Restore registers */ + out8(M64_DAC_WRITE, index_lo); + out8(M64_DAC_DATA, index_hi); + out8(M64_DAC_READ, index_ctl); + outr(DAC_CNTL, dac_cntl); + if (!(crtc_gen_cntl & CRTC_EXT_DISP_EN)) + outr(CRTC_GEN_CNTL, crtc_gen_cntl); +} + +/* + * ATIRGB514Calculate -- + * + * This function fills in the IBM RGB 514 portion of an ATIHWRec that is + * specific to a display mode. pATIHW->ibmrgb514 has already been + * initialised by a previous call to ATIRGB514PreInit(). + */ +void +ATIRGB514Calculate +( + ATIPtr pATI, + ATIHWPtr pATIHW, + DisplayModePtr pMode +) +{ + if (pATI->OptionCSync || (pMode->Flags & (V_CSYNC | V_PCSYNC))) + pATIHW->ibmrgb514[0x0006U] |= 0x08U; + else + pATIHW->ibmrgb514[0x0006U] &= ~0x08U; + + if (pMode->Flags & V_INTERLACE) + pATIHW->ibmrgb514[0x0071U] |= 0x20U; + else + pATIHW->ibmrgb514[0x0071U] &= ~0x20U; +} + +/* + * ATIRGB514Set -- + * + * This function is called to set an IBM RGB514's registers. + */ +void +ATIRGB514Set +( + ATIPtr pATI, + ATIHWPtr pATIHW +) +{ + CARD32 crtc_gen_cntl, dac_cntl; + CARD8 index_lo, index_hi, index_ctl; + int Index; + + /* Temporarily switch to Mach64 CRTC */ + crtc_gen_cntl = inr(CRTC_GEN_CNTL); + if (!(crtc_gen_cntl & CRTC_EXT_DISP_EN)) + outr(CRTC_GEN_CNTL, crtc_gen_cntl | CRTC_EXT_DISP_EN); + + /* Temporarily switch to IBM RGB 514 registers */ + dac_cntl = inr(DAC_CNTL) & ~(DAC_EXT_SEL_RS2 | DAC_EXT_SEL_RS3); + outr(DAC_CNTL, dac_cntl | DAC_EXT_SEL_RS2); + + index_lo = in8(M64_DAC_WRITE); + index_hi = in8(M64_DAC_DATA); + index_ctl = in8(M64_DAC_READ); + + out8(M64_DAC_WRITE, 0x00U); + out8(M64_DAC_DATA, 0x00U); + out8(M64_DAC_READ, 0x01U); /* Auto-increment */ + + /* Load IBM RGB 514 registers */ + for (Index = 0; Index < NumberOf(pATIHW->ibmrgb514); Index++) + out8(M64_DAC_MASK, pATIHW->ibmrgb514[Index]); + +#ifndef AVOID_CPIO + + /* Deal with documented anomaly */ + if (pATIHW->crtc == ATI_CRTC_VGA) + { + /* Reset Miscellaneous Control 2 */ + out8(M64_DAC_WRITE, 0x71U); + out8(M64_DAC_DATA, 0x00U); + out8(M64_DAC_MASK, pATIHW->ibmrgb514[0x0071U] & ~0x41U); + } + +#endif /* AVOID_CPIO */ + + /* Restore registers */ + out8(M64_DAC_WRITE, index_lo); + out8(M64_DAC_DATA, index_hi); + out8(M64_DAC_READ, index_ctl); + outr(DAC_CNTL, dac_cntl); + if (!(crtc_gen_cntl & CRTC_EXT_DISP_EN)) + outr(CRTC_GEN_CNTL, crtc_gen_cntl); +} Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h:1.2 --- /dev/null Fri Jan 18 15:25:19 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h Wed Jan 16 11:22:28 2002 @@ -0,0 +1,38 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atirgb514.h,v 1.2 2002/01/16 16:22:28 tsi Exp $ */ +/* + * Copyright 2001 through 2002 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 ___ATIRGB514_H___ +#define ___ATIRGB514_H___ 1 + +#include "atipriv.h" +#include "atiproto.h" + +#include "xf86str.h" + +extern void ATIRGB514PreInit FunctionPrototype((ATIPtr, ATIHWPtr)); +extern void ATIRGB514Save FunctionPrototype((ATIPtr, ATIHWPtr)); +extern void ATIRGB514Calculate FunctionPrototype((ATIPtr, ATIHWPtr, + DisplayModePtr)); +extern void ATIRGB514Set FunctionPrototype((ATIPtr, ATIHWPtr)); + +#endif /* ___ATIRGB514_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.21 xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.28 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.21 Tue May 8 23:12:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.21 2001/05/09 03:12:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.28 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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 @@ -112,7 +112,7 @@ else VisualMask = miGetDefaultVisualMask(pATI->depth); - if (!miSetVisualTypes(pATI->depth, VisualMask, pScreenInfo->rgbBits, + if (!miSetVisualTypes(pATI->depth, VisualMask, pATI->rgbBits, pScreenInfo->defaultVisual)) return FALSE; @@ -162,28 +162,6 @@ pScreenInfo->virtualX, pScreenInfo->virtualY, 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: @@ -213,6 +191,35 @@ } } + /* If applicable, initialise RENDER extension */ + if (pATI->bitsPerPixel > 4) + { + if (pATI->OptionShadowFB) + { + if (serverGeneration == 1) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "RENDER extension not supported with a shadowed" + " framebuffer.\n"); + } + +#ifndef AVOID_CPIO + + else if (pATI->BankInfo.BankSize) + { + if (serverGeneration == 1) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "RENDER extension not supported with a banked" + " framebuffer.\n"); + } + +#endif /* AVOID_CPIO */ + + else if (!fbPictureInit(pScreen, NULL, 0) && + (serverGeneration == 1)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "RENDER extension initialisation failed.\n"); + } + xf86SetBlackWhitePixels(pScreen); #ifndef AVOID_CPIO @@ -225,13 +232,17 @@ #endif /* AVOID_CPIO */ - /* Initialise DGA support */ - (void)ATIDGAInit(pScreenInfo, pScreen, pATI); - /* Setup acceleration */ if (!ATIInitializeAcceleration(pScreen, pScreenInfo, pATI)) return FALSE; +#ifndef AVOID_DGA + + /* Initialise DGA support */ + (void)ATIDGAInit(pScreenInfo, pScreen, pATI); + +#endif /* AVOID_DGA */ + /* Initialise backing store */ miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -246,8 +257,7 @@ #ifdef AVOID_CPIO - if (!xf86HandleColormaps(pScreen, 256, pScreenInfo->rgbBits, - ATILoadPalette, NULL, + if (!xf86HandleColormaps(pScreen, 256, pATI->rgbBits, ATILoadPalette, NULL, CMAP_PALETTED_TRUECOLOR | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE; @@ -256,7 +266,7 @@ if (pATI->depth > 1) if (!xf86HandleColormaps(pScreen, (pATI->depth == 4) ? 16 : 256, - pScreenInfo->rgbBits, ATILoadPalette, NULL, + pATI->rgbBits, ATILoadPalette, NULL, CMAP_PALETTED_TRUECOLOR | CMAP_LOAD_EVEN_IF_OFFSCREEN)) return FALSE; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.4 Sat Jan 6 15:58:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h,v 1.4 2001/01/06 20:58:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h,v 1.5 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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.25 xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h:1.30 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h:1.25 Sun Mar 25 00:32:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.25 2001/03/25 05:32:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.30 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2002 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 @@ -29,6 +29,7 @@ #include "atiregs.h" #include "xf86Cursor.h" +#include "xf86Pci.h" #include "xf86Resources.h" #include "xaa.h" @@ -73,6 +74,9 @@ /* Generic DAC registers */ CARD8 dac_read, dac_write, dac_mask; + /* IBM RGB 514 registers */ + CARD8 ibmrgb514[0x0092U]; /* All that's needed for now */ + /* Mach64 PLL registers */ CARD8 pll_vclk_cntl, pll_vclk_post_div, pll_vclk0_fb_div, pll_vclk1_fb_div, @@ -172,19 +176,19 @@ * Processor I/O decoding definitions. */ CARD8 CPIODecoding; - CARD16 CPIOBase; + IOADDRESS CPIOBase; #ifndef AVOID_CPIO /* * Processor I/O port definition for VGA. */ - CARD16 CPIO_VGABase; + IOADDRESS CPIO_VGABase; /* * Processor I/O port definitions for VGA Wonder. */ - CARD16 CPIO_VGAWonder; + IOADDRESS CPIO_VGAWonder; CARD8 B2Reg; /* The B2 mirror */ CARD8 VGAOffset; /* Low index for CPIO_VGAWonder */ @@ -196,7 +200,7 @@ #ifndef AVOID_CPIO - CARD16 CPIO_DAC_MASK, CPIO_DAC_DATA, CPIO_DAC_READ, CPIO_DAC_WRITE; + IOADDRESS CPIO_DAC_MASK, CPIO_DAC_DATA, CPIO_DAC_READ, CPIO_DAC_WRITE; #endif /* AVOID_CPIO */ @@ -285,7 +289,7 @@ * Clock-related definitions. */ int ClockNumberToProgramme, ReferenceNumerator, ReferenceDenominator; - int ProgrammableClock; + int ProgrammableClock, maxClock; ClockRec ClockDescriptor; CARD16 BIOSClocks[16]; CARD8 Clock; @@ -320,13 +324,24 @@ int pitchInc; rgb weight; +#ifndef AVOID_DGA + /* - * Video mode data for DGA. + * DGA-related data. */ DGAModePtr pDGAMode; + DGAFunctionRec ATIDGAFunctions; int nDGAMode; /* + * XAAForceTransBlit alters the behavior of 'SetupForScreenToScreenCopy', + * such that ~0 is interpreted as a legitimate transparency key. + */ + CARD8 XAAForceTransBlit; + +#endif /* AVOID_DGA */ + + /* * Data saved by ATIUnlock() and restored by ATILock(). */ struct @@ -369,6 +384,7 @@ * Driver options. */ CARD8 OptionAccel; /* Use hardware draw engine */ + CARD8 OptionBlend; /* Force horizontal blending */ CARD8 OptionCRT; /* Prefer CRT over digital panel */ CARD8 OptionCSync; /* Use composite sync */ CARD8 OptionDevel; /* Intentionally undocumented */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.5 Sat Jan 6 15:58:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c,v 1.5 2001/01/06 20:58:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c,v 1.7 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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,34 @@ #include "atiutil.h" /* + * ATIReduceRatio -- + * + * Reduce a fraction by factoring out the largest common divider of the + * fraction's numerator and denominator. + */ +void +ATIReduceRatio +( + int *Numerator, + int *Denominator +) +{ + int Multiplier, Divider, Remainder; + + Multiplier = *Numerator; + Divider = *Denominator; + + while ((Remainder = Multiplier % Divider)) + { + Multiplier = Divider; + Divider = Remainder; + } + + *Numerator /= Divider; + *Denominator /= Divider; +} + +/* * ATIDivide -- * * Using integer arithmetic and avoiding overflows, this function finds the @@ -33,7 +61,7 @@ * ----------- * 2 * Denominator * - * using the specified rounding (floor, nearest or ceiling). + * using the specified rounding (floor (<0), nearest (=0) or ceiling (>0)). */ int ATIDivide @@ -44,21 +72,11 @@ const int RoundingKind ) { - int Multiplier, Divider, Remainder; int Rounding = 0; /* Default to floor */ #define MaxInt ((int)((unsigned int)(-1) >> 2)) - /* Filter out largest common divider */ - Multiplier = Numerator; - Divider = Denominator; - while ((Remainder = Multiplier % Divider)) - { - Multiplier = Divider; - Divider = Remainder; - } - Numerator /= Divider; - Denominator /= Divider; + ATIReduceRatio(&Numerator, &Denominator); /* Deal with left shifts but try to keep the denominator even */ if (Denominator & 1) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.5 Sat Jan 6 15:58:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h,v 1.5 2001/01/06 20:58:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h,v 1.7 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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 @@ -64,6 +64,7 @@ #define GetWord(_Value, _Word) GetBits(_Value, _WordMask(_Word)) #define SetWord(_Value, _Word) SetBits(_Value, _WordMask(_Word)) -extern int ATIDivide FunctionPrototype((int, int, int, const int)); +extern void ATIReduceRatio FunctionPrototype((int *, int *)); +extern int ATIDivide FunctionPrototype((int, int, int, const int)); #endif /* ___ATIUTIL_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.12 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c,v 1.12 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c,v 1.13 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.6 xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h:1.6 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h,v 1.6 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h,v 1.7 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.38 xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h:1.47 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h:1.38 Fri May 18 16:22:28 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.38 2001/05/18 20:22:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.47 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.3.6" +#define ATI_VERSION_NAME "6.4.8" #define ATI_VERSION_MAJOR 6 -#define ATI_VERSION_MINOR 3 -#define ATI_VERSION_PATCH 6 +#define ATI_VERSION_MINOR 4 +#define ATI_VERSION_PATCH 8 #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.14 xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c:1.14 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.14 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.15 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.8 xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h:1.8 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h,v 1.8 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h,v 1.9 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.2 xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c:1.2 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.3 xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h:1.3 Sun Mar 25 00:32:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.3 2001/03/25 05:32:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.4 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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/atividmem.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.12 Sun Mar 25 00:32:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.12 2001/03/25 05:32:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.13 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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/atividmem.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.7 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h,v 1.7 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h,v 1.8 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c:1.12 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c,v 1.12 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c,v 1.13 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h:1.7 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h,v 1.7 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h,v 1.8 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c:1.2 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h:1.2 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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 xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c:1.1 Tue May 8 23:12:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c,v 1.1 2001/05/09 03:12:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c,v 1.2 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2002 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.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h:1.1 Tue May 8 23:12:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h,v 1.1 2001/05/09 03:12:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h,v 1.2 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2001 through 2002 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.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.13 Tue May 15 06:19:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h Tue Oct 2 15:44:01 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.13 2001/05/15 10:19:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.17 2001/10/02 19:44:01 herrb Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -47,6 +47,9 @@ #include "xaa.h" #include "xf86Cursor.h" + /* DDC support */ +#include "xf86DDC.h" + /* Xv support */ #include "xf86xv.h" @@ -143,6 +146,7 @@ CARD32 fp_vert_stretch; CARD32 lvds_gen_cntl; CARD32 tmds_crc; + CARD32 tmds_transmitter_cntl; /* Computed values for PLL */ CARD32 dot_clock_freq; @@ -211,6 +215,12 @@ /* Computed values for FPs */ int PanelXRes; int PanelYRes; + int HOverPlus; + int HSyncWidth; + int HBlank; + int VOverPlus; + int VSyncWidth; + int VBlank; int PanelPwrDly; R128PLLRec pll; @@ -229,6 +239,12 @@ unsigned long cursor_start; unsigned long cursor_end; + /* + * XAAForceTransBlit is used to change the behavior of the XAA + * SetupForScreenToScreenCopy function, to make it DGA-friendly. + */ + Bool XAAForceTransBlit; + int fifo_slots; /* Free slots in the FIFO (64 max) */ int pix24bpp; /* Depth of pixmap for 24bpp framebuffer */ Bool dac6bits; /* Use 6 bit DAC? */ @@ -257,12 +273,14 @@ int numDGAModes; Bool DGAactive; int DGAViewportStatus; + DGAFunctionRec DGAFuncs; R128FBLayout CurrentLayout; #ifdef XF86DRI Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; int drmFD; + drmContext drmCtx; int numVisualConfigs; __GLXvisualConfig *pVisualConfigs; R128ConfigPrivPtr pVisualConfigsPriv; @@ -288,7 +306,6 @@ int CCEFifoSize; /* Size of the CCE command FIFO */ Bool CCESecure; /* CCE security enabled */ int CCEusecTimeout; /* CCE timeout in usecs */ - Bool CCE2D; /* CCE is used for X server 2D prims */ /* CCE ring buffer data */ unsigned long ringStart; /* Offset into AGP space */ @@ -320,6 +337,10 @@ unsigned char *agpTex; /* Map */ int log2AGPTexGran; + /* CCE 2D accleration */ + drmBufPtr indirectBuffer; + int indirectStart; + /* DRI screen private data */ int fbX; int fbY; @@ -344,6 +365,10 @@ CARD32 sc_right; CARD32 sc_top; CARD32 sc_bottom; + + CARD32 re_top_left; + CARD32 re_width_height; + CARD32 aux_sc_cntl; #endif @@ -352,6 +377,12 @@ int videoKey; Bool showCache; OptionInfoPtr Options; + + Bool isDFP; + Bool isPro2; + I2CBusPtr pI2CBus; + CARD32 DDCReg; + } R128InfoRec, *R128InfoPtr; #define R128WaitForFifo(pScrn, entries) \ @@ -389,7 +420,6 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "%s: CCE start %d\n", __FUNCTION__, _ret); \ } \ - info->CCEInUse = TRUE; \ } while (0) #define R128CCE_STOP(pScrn, info) \ @@ -399,7 +429,6 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "%s: CCE stop %d\n", __FUNCTION__, _ret); \ } \ - info->CCEInUse = FALSE; \ } while (0) #define R128CCE_RESET(pScrn, info) \ @@ -412,29 +441,102 @@ "%s: CCE reset %d\n", __FUNCTION__, _ret); \ } \ } \ - info->CCEInUse = FALSE; \ } while (0) + +#endif + +#ifdef XF86DRI +extern drmBufPtr R128CCEGetBuffer(ScrnInfoPtr pScrn); +#endif +extern void R128CCEFlushIndirect(ScrnInfoPtr pScrn); +extern void R128CCEReleaseIndirect(ScrnInfoPtr pScrn); +extern void R128CCEWaitForIdle(ScrnInfoPtr pScrn); + + +#define CCE_PACKET0( reg, n ) \ + (R128_CCE_PACKET0 | ((n) << 16) | ((reg) >> 2)) +#define CCE_PACKET1( reg0, reg1 ) \ + (R128_CCE_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2)) +#define CCE_PACKET2() \ + (R128_CCE_PACKET2) +#define CCE_PACKET3( pkt, n ) \ + (R128_CCE_PACKET3 | (pkt) | ((n) << 16)) + -#define R128CCE_TO_MMIO(pScrn, info) \ +#define R128_VERBOSE 0 + +#define RING_LOCALS CARD32 *__head; int __count; +#define RING_THRESHOLD 256 + +#define R128CCE_REFRESH(pScrn, info) \ do { \ - if (info->CCEInUse) { \ - R128CCE_STOP(pScrn, info); \ - \ - R128WaitForFifo(pScrn, 5); \ - OUTREG(R128_SC_LEFT, info->sc_left); \ - OUTREG(R128_SC_RIGHT, info->sc_right); \ - OUTREG(R128_SC_TOP, info->sc_top); \ - OUTREG(R128_SC_BOTTOM, info->sc_bottom); \ - OUTREG(R128_AUX_SC_CNTL, info->aux_sc_cntl); \ - } \ + if ( R128_VERBOSE ) { \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "REFRESH( %d ) in %s\n", \ + !info->CCEInUse , __FUNCTION__ ); \ + } \ + if ( !info->CCEInUse ) { \ + R128CCEWaitForIdle(pScrn); \ + BEGIN_RING( 6 ); \ + OUT_RING_REG( R128_RE_TOP_LEFT, info->re_top_left ); \ + OUT_RING_REG( R128_RE_WIDTH_HEIGHT, info->re_width_height ); \ + OUT_RING_REG( R128_AUX_SC_CNTL, info->aux_sc_cntl ); \ + ADVANCE_RING(); \ + info->CCEInUse = TRUE; \ + } \ +} while (0) + +#define BEGIN_RING( n ) do { \ + if ( R128_VERBOSE ) { \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ + "BEGIN_RING( %d ) in %s\n", n, __FUNCTION__ ); \ + } \ + if ( !info->indirectBuffer ) { \ + info->indirectBuffer = R128CCEGetBuffer( pScrn ); \ + info->indirectStart = 0; \ + } else if ( info->indirectBuffer->used - info->indirectStart + \ + (n) * (int)sizeof(CARD32) > RING_THRESHOLD ) { \ + R128CCEFlushIndirect( pScrn ); \ + } \ + __head = (pointer)((char *)info->indirectBuffer->address + \ + info->indirectBuffer->used); \ + __count = 0; \ +} while (0) + +#define ADVANCE_RING() do { \ + if ( R128_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 R128MMIO_TO_CCE(pScrn, info) \ +#define OUT_RING( x ) do { \ + if ( R128_VERBOSE ) { \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ + " OUT_RING( 0x%08x )\n", (unsigned int)(x) ); \ + } \ + MMIO_OUT32(&__head[__count++], 0, (x)); \ +} while (0) + +#define OUT_RING_REG( reg, val ) \ do { \ - if (!info->CCEInUse) { \ - R128CCE_START(pScrn, info); \ - } \ + OUT_RING( CCE_PACKET0( reg, 0 ) ); \ + OUT_RING( val ); \ } while (0) -#endif + +#define FLUSH_RING() \ +do { \ + if ( R128_VERBOSE ) \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ + "FLUSH_RING in %s\n", __FUNCTION__ ); \ + if ( info->indirectBuffer ) { \ + R128CCEFlushIndirect( pScrn ); \ + } \ +} while (0) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.2.2.1 xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.2.2.1 Thu May 31 22:24:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man Thu May 31 22:10:05 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man,v 1.2.2.1 2001/06/01 02:24:17 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man,v 1.3 2001/06/01 02:10:05 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH R128 __drivermansuffix__ __vendorversion__ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.9 Tue Apr 10 12:07:58 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c Tue Oct 2 15:44:01 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.9 2001/04/10 16:07:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.13 2001/10/02 19:44:01 herrb Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -83,6 +83,7 @@ #include "r128.h" #include "r128_reg.h" #ifdef XF86DRI +#include "r128_sarea.h" #define _XF86DRI_SERVER_ #include "r128_dri.h" #endif @@ -179,7 +180,7 @@ R128EngineReset(pScrn); #ifdef XF86DRI R128CCE_RESET(pScrn, info); - if (info->CCE2D) { + if (info->directRenderingEnabled) { R128CCE_START(pScrn, info); } #endif @@ -213,7 +214,7 @@ R128EngineReset(pScrn); #ifdef XF86DRI R128CCE_RESET(pScrn, info); - if (info->CCE2D) { + if (info->directRenderingEnabled) { R128CCE_START(pScrn, info); } #endif @@ -224,12 +225,14 @@ /* Wait until the CCE is completely idle: the FIFO has drained and the * CCE is idle. */ -static void R128CCEWaitForIdle(ScrnInfoPtr pScrn) +void R128CCEWaitForIdle(ScrnInfoPtr pScrn) { R128InfoPtr info = R128PTR(pScrn); int ret; int i = 0; + FLUSH_RING(); + for (;;) { do { ret = drmR128WaitForIdleCCE(info->drmFD); @@ -259,10 +262,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128WaitForFifo(pScrn, 4); OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | R128_GMC_BRUSH_SOLID_COLOR @@ -284,10 +283,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128WaitForFifo(pScrn, 2); OUTREG(R128_DST_Y_X, (y << 16) | x); OUTREG(R128_DST_WIDTH_HEIGHT, (w << 16) | h); @@ -300,10 +295,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128WaitForFifo(pScrn, 3); OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | R128_GMC_BRUSH_SOLID_COLOR @@ -336,10 +327,6 @@ unsigned char *R128MMIO = info->MMIO; int flags = 0; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR; if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT; if (!(octant & YDECREASING)) flags |= R128_DST_Y_DIR_TOP_TO_BOTTOM; @@ -366,10 +353,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128WaitForFifo(pScrn, 1); OUTREG(R128_DP_CNTL, (R128_DST_X_LEFT_TO_RIGHT | R128_DST_Y_TOP_TO_BOTTOM)); @@ -404,15 +387,17 @@ unsigned char *R128MMIO = info->MMIO; CARD32 pat = *(CARD32 *)(pointer)pattern; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +# define PAT_SHIFT(pat,n) pat << n +#else +# define PAT_SHIFT(pat,n) pat >> n #endif switch (length) { - case 2: pat |= pat << 2; /* fall through */ - case 4: pat |= pat << 4; /* fall through */ - case 8: pat |= pat << 8; /* fall through */ - case 16: pat |= pat << 16; + case 2: pat |= PAT_SHIFT(pat,2); /* fall through */ + case 4: pat |= PAT_SHIFT(pat,4); /* fall through */ + case 8: pat |= PAT_SHIFT(pat,8); /* fall through */ + case 16: pat |= PAT_SHIFT(pat,16); } R128WaitForFifo(pScrn, 5); @@ -439,10 +424,6 @@ unsigned char *R128MMIO = info->MMIO; int flags = 0; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR; if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT; if (!(octant & YDECREASING)) flags |= R128_DST_Y_DIR_TOP_TO_BOTTOM; @@ -480,10 +461,6 @@ int origdxL = dxL; int origdxR = dxR; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128TRACE(("Trap %d %d; L %d %d %d %d; R %d %d %d %d\n", y, h, left, dxL, dyL, eL, @@ -534,10 +511,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - info->xdir = xdir; info->ydir = ydir; R128WaitForFifo(pScrn, 3); @@ -552,7 +525,7 @@ ? R128_DST_Y_TOP_TO_BOTTOM : 0))); - if (trans_color != -1) { + if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { /* Set up for transparency */ R128WaitForFifo(pScrn, 3); OUTREG(R128_CLR_CMP_CLR_SRC, trans_color); @@ -571,10 +544,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - if (info->xdir < 0) xa += w - 1, xb += w - 1; if (info->ydir < 0) ya += h - 1, yb += h - 1; @@ -604,10 +573,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128WaitForFifo(pScrn, 6); OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | (bg == -1 @@ -631,10 +596,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128WaitForFifo(pScrn, 3); OUTREG(R128_BRUSH_Y_X, (patterny << 8) | patternx); OUTREG(R128_DST_Y_X, (y << 16) | x); @@ -654,10 +615,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128TRACE(("Color8x8 %d %d %d\n", trans_color, patx, paty)); R128WaitForFifo(pScrn, 2); @@ -686,10 +643,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128TRACE(("Color8x8 %d,%d %d,%d %d %d\n", patx, paty, x, y, w, h)); R128WaitForFifo(pScrn, 3); OUTREG(R128_SRC_Y_X, (paty << 16) | patx); @@ -750,10 +703,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - R128WaitForFifo(pScrn, 4); OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | R128_GMC_DST_CLIPPING @@ -781,10 +730,6 @@ int x1clip = x+skipleft; int x2clip = x+w; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - info->scanline_h = h; info->scanline_words = (w + 31) >> 5; @@ -831,10 +776,6 @@ int left = info->scanline_words; volatile CARD32 *d; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - if (info->scanline_direct) return; --info->scanline_h; while (left) { @@ -881,10 +822,6 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - info->scanline_bpp = bpp; R128WaitForFifo(pScrn, 2); @@ -921,10 +858,6 @@ int shift = 0; /* 32bpp */ -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - if (pScrn->bitsPerPixel == 8) shift = 3; else if (pScrn->bitsPerPixel == 16) shift = 1; @@ -973,10 +906,6 @@ int left = info->scanline_words; volatile CARD32 *d; -#ifdef XF86DRI - R128CCE_TO_MMIO(pScrn, info); -#endif - if (info->scanline_direct) return; --info->scanline_h; while (left) { @@ -1069,18 +998,475 @@ OUTREGP(R128_DP_DATATYPE, 0, ~R128_HOST_BIG_ENDIAN_EN); #endif +#ifdef XF86DRI + info->sc_left = 0x00000000; + info->sc_right = R128_DEFAULT_SC_RIGHT_MAX; + info->sc_top = 0x00000000; + info->sc_bottom = R128_DEFAULT_SC_BOTTOM_MAX; + + info->re_top_left = 0x00000000; + info->re_width_height = ((0x7ff << R128_RE_WIDTH_SHIFT) | + (0x7ff << R128_RE_HEIGHT_SHIFT)); + + info->aux_sc_cntl = 0x00000000; +#endif + R128WaitForIdle(pScrn); } #ifdef XF86DRI - /* FIXME: When direct rendering is enabled, we should use the CCE to - draw 2D commands */ -static void R128CCEAccelInit(XAAInfoRecPtr a) + +/* Setup for XAA SolidFill. */ +static void R128CCESetupForSolidFill(ScrnInfoPtr pScrn, + int color, int rop, + unsigned int planemask) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + BEGIN_RING( 8 ); + + OUT_RING_REG( R128_DP_GUI_MASTER_CNTL, + (info->dp_gui_master_cntl + | R128_GMC_BRUSH_SOLID_COLOR + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP[rop].pattern) ); + + OUT_RING_REG( R128_DP_BRUSH_FRGD_CLR, color ); + OUT_RING_REG( R128_DP_WRITE_MASK, planemask ); + OUT_RING_REG( R128_DP_CNTL, (R128_DST_X_LEFT_TO_RIGHT | + R128_DST_Y_TOP_TO_BOTTOM)); + ADVANCE_RING(); +} + +/* Subsequent XAA SolidFillRect. + + Tests: xtest CH06/fllrctngl, xterm +*/ +static void R128CCESubsequentSolidFillRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + BEGIN_RING( 4 ); + + OUT_RING_REG( R128_DST_Y_X, (y << 16) | x ); + OUT_RING_REG( R128_DST_WIDTH_HEIGHT, (w << 16) | h ); + + ADVANCE_RING(); +} + +/* Setup for XAA screen-to-screen copy. + + Tests: xtest CH06/fllrctngl (also tests transparency). +*/ +static void R128CCESetupForScreenToScreenCopy(ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, + unsigned int planemask, + int trans_color) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + info->xdir = xdir; + info->ydir = ydir; + + BEGIN_RING( 6 ); + + OUT_RING_REG( R128_DP_GUI_MASTER_CNTL, + (info->dp_gui_master_cntl + | R128_GMC_BRUSH_NONE + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP[rop].rop + | R128_DP_SRC_SOURCE_MEMORY) ); + + OUT_RING_REG( R128_DP_WRITE_MASK, planemask ); + OUT_RING_REG( R128_DP_CNTL, + ((xdir >= 0 ? R128_DST_X_LEFT_TO_RIGHT : 0) | + (ydir >= 0 ? R128_DST_Y_TOP_TO_BOTTOM : 0)) ); + + ADVANCE_RING(); + + if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { + BEGIN_RING( 6 ); + + OUT_RING_REG( R128_CLR_CMP_CLR_SRC, trans_color ); + OUT_RING_REG( R128_CLR_CMP_MASK, R128_CLR_CMP_MSK ); + OUT_RING_REG( R128_CLR_CMP_CNTL, (R128_SRC_CMP_NEQ_COLOR | + R128_CLR_CMP_SRC_SOURCE) ); + + ADVANCE_RING(); + } +} + +/* Subsequent XAA screen-to-screen copy. */ +static void R128CCESubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, + int xa, int ya, + int xb, int yb, + int w, int h) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_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( R128_SRC_Y_X, (ya << 16) | xa ); + OUT_RING_REG( R128_DST_Y_X, (yb << 16) | xb ); + OUT_RING_REG( R128_DST_HEIGHT_WIDTH, (h << 16) | w ); + + ADVANCE_RING(); +} + +/* Solid lines */ +static void R128CCESetupForSolidLine(ScrnInfoPtr pScrn, + int color, int rop, unsigned int planemask) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + BEGIN_RING( 6 ); + + OUT_RING_REG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl + | R128_GMC_BRUSH_SOLID_COLOR + | R128_GMC_SRC_DATATYPE_COLOR + | R128_ROP[rop].pattern)); + OUT_RING_REG(R128_DP_BRUSH_FRGD_CLR, color); + OUT_RING_REG(R128_DP_WRITE_MASK, planemask); + + ADVANCE_RING(); +} + +static void R128CCESubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, + int x, int y, + int major, int minor, + int err, int len, int octant) +{ + R128InfoPtr info = R128PTR(pScrn); + int flags = 0; + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR; + if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT; + if (!(octant & YDECREASING)) flags |= R128_DST_Y_DIR_TOP_TO_BOTTOM; + + BEGIN_RING( 12 ); + + OUT_RING_REG(R128_DP_CNTL_XDIR_YDIR_YMAJOR, flags); + OUT_RING_REG(R128_DST_Y_X, (y << 16) | x); + OUT_RING_REG(R128_DST_BRES_ERR, err); + OUT_RING_REG(R128_DST_BRES_INC, minor); + OUT_RING_REG(R128_DST_BRES_DEC, -major); + OUT_RING_REG(R128_DST_BRES_LNTH, len); + + ADVANCE_RING(); +} + +static void R128CCESubsequentSolidHorVertLine(ScrnInfoPtr pScrn, + int x, int y, int len, int dir ) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + BEGIN_RING( 2 ); + + OUT_RING_REG(R128_DP_CNTL, (R128_DST_X_LEFT_TO_RIGHT + | R128_DST_Y_TOP_TO_BOTTOM)); + + ADVANCE_RING(); + + if (dir == DEGREES_0) { + R128CCESubsequentSolidFillRect(pScrn, x, y, len, 1); + } else { + R128CCESubsequentSolidFillRect(pScrn, x, y, 1, len); + } +} + +/* Dashed lines */ +static void R128CCESetupForDashedLine(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, unsigned int planemask, + int length, unsigned char *pattern) { - a->Flags = 0; + R128InfoPtr info = R128PTR(pScrn); + CARD32 pat = *(CARD32 *)(pointer)pattern; + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +# define PAT_SHIFT(pat,n) pat << n +#else +# define PAT_SHIFT(pat,n) pat >> n +#endif + + switch (length) { + case 2: pat |= PAT_SHIFT(pat,2); /* fall through */ + case 4: pat |= PAT_SHIFT(pat,4); /* fall through */ + case 8: pat |= PAT_SHIFT(pat,8); /* fall through */ + case 16: pat |= PAT_SHIFT(pat,16); + } + + BEGIN_RING( 10 ); + + OUT_RING_REG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl + | (bg == -1 + ? R128_GMC_BRUSH_32x1_MONO_FG_LA + : R128_GMC_BRUSH_32x1_MONO_FG_BG) + | R128_ROP[rop].pattern + | R128_GMC_BYTE_LSB_TO_MSB)); + OUT_RING_REG(R128_DP_WRITE_MASK, planemask); + OUT_RING_REG(R128_DP_BRUSH_FRGD_CLR, fg); + OUT_RING_REG(R128_DP_BRUSH_BKGD_CLR, bg); + OUT_RING_REG(R128_BRUSH_DATA0, pat); + + ADVANCE_RING(); +} + +static void R128CCESubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, + int x, int y, + int major, int minor, + int err, int len, int octant, + int phase) +{ + R128InfoPtr info = R128PTR(pScrn); + int flags = 0; + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR; + if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT; + if (!(octant & YDECREASING)) flags |= R128_DST_Y_DIR_TOP_TO_BOTTOM; + + BEGIN_RING( 14 ); + + OUT_RING_REG(R128_DP_CNTL_XDIR_YDIR_YMAJOR, flags); + OUT_RING_REG(R128_DST_Y_X, (y << 16) | x); + OUT_RING_REG(R128_BRUSH_Y_X, (phase << 16) | phase); + OUT_RING_REG(R128_DST_BRES_ERR, err); + OUT_RING_REG(R128_DST_BRES_INC, minor); + OUT_RING_REG(R128_DST_BRES_DEC, -major); + OUT_RING_REG(R128_DST_BRES_LNTH, len); + + ADVANCE_RING(); +} + +/* Mono 8x8 pattern color expansion */ +static void R128CCESetupForMono8x8PatternFill(ScrnInfoPtr pScrn, + int patternx, int patterny, + int fg, int bg, int rop, + unsigned int planemask) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + + BEGIN_RING( 12 ); + + OUT_RING_REG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl + | (bg == -1 + ? R128_GMC_BRUSH_8X8_MONO_FG_LA + : R128_GMC_BRUSH_8X8_MONO_FG_BG) + | R128_ROP[rop].pattern + | R128_GMC_BYTE_LSB_TO_MSB)); + OUT_RING_REG(R128_DP_WRITE_MASK, planemask); + OUT_RING_REG(R128_DP_BRUSH_FRGD_CLR, fg); + OUT_RING_REG(R128_DP_BRUSH_BKGD_CLR, bg); + OUT_RING_REG(R128_BRUSH_DATA0, patternx); + OUT_RING_REG(R128_BRUSH_DATA1, patterny); + + ADVANCE_RING(); +} + +static void R128CCESubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, + int patternx, int patterny, + int x, int y, int w, int h) +{ + R128InfoPtr info = R128PTR(pScrn); + RING_LOCALS; + + R128CCE_REFRESH( pScrn, info ); + BEGIN_RING( 6 ); + + OUT_RING_REG(R128_BRUSH_Y_X, (patterny << 8) | patternx); + OUT_RING_REG(R128_DST_Y_X, (y << 16) | x); + OUT_RING_REG(R128_DST_HEIGHT_WIDTH, (h << 16) | w); + + ADVANCE_RING(); +} + +/* Get an indirect buffer for the CCE 2D acceleration commands. + */ +drmBufPtr R128CCEGetBuffer( ScrnInfoPtr pScrn ) +{ + R128InfoPtr info = R128PTR(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 + 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 = R128_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: CCE GetBuffer %d\n", __FUNCTION__, ret ); + } + } while ( ( ret == -EBUSY ) && ( i++ < R128_TIMEOUT ) ); + + if ( ret == 0 ) { + buf = &info->buffers->list[indx]; + buf->used = 0; + if ( R128_VERBOSE ) { + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + " GetBuffer returning %d\n", buf->idx ); + } + return buf; + } + + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "GetBuffer timed out, resetting engine...\n"); + R128EngineReset( pScrn ); + /* R128EngineRestore( pScrn ); FIXME ??? */ + + /* Always restart the engine when doing CCE 2D acceleration */ + R128CCE_RESET( pScrn, info ); + R128CCE_START( pScrn, info ); + } +} + +/* Flush the indirect buffer to the kernel for submission to the card. + */ +void R128CCEFlushIndirect( ScrnInfoPtr pScrn ) +{ + R128InfoPtr info = R128PTR(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 ); + + drmR128FlushIndirectBuffer( info->drmFD, buffer->idx, + start, buffer->used, discard ); + + if ( discard ) { + info->indirectBuffer = R128CCEGetBuffer( pScrn ); + info->indirectStart = 0; + } else { + info->indirectStart = buffer->used; + } +} + +/* Flush and release the indirect buffer. + */ +void R128CCEReleaseIndirect( ScrnInfoPtr pScrn ) +{ + R128InfoPtr info = R128PTR(pScrn); + drmBufPtr buffer = info->indirectBuffer; + int start = info->indirectStart; + + info->indirectBuffer = NULL; + info->indirectStart = 0; + + if ( !buffer ) + return; + + drmR128FlushIndirectBuffer( info->drmFD, buffer->idx, + start, buffer->used, 1 ); +} + +static void R128CCEAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) +{ + a->Flags = (PIXMAP_CACHE + | OFFSCREEN_PIXMAPS + | LINEAR_FRAMEBUFFER); + /* Sync */ a->Sync = R128CCEWaitForIdle; + + /* Solid Filled Rectangle */ + a->PolyFillRectSolidFlags = 0; + a->SetupForSolidFill = R128CCESetupForSolidFill; + a->SubsequentSolidFillRect = R128CCESubsequentSolidFillRect; + + /* Screen-to-screen Copy */ + /* Transparency uses the wrong colors for + 24 bpp mode -- the transparent part is + correct, but the opaque color is wrong. + This can be seen with netscape's I-bar + cursor when editing in the URL location + box. */ + a->ScreenToScreenCopyFlags = ((pScrn->bitsPerPixel == 24) + ? NO_TRANSPARENCY + : 0); + a->SetupForScreenToScreenCopy = R128CCESetupForScreenToScreenCopy; + a->SubsequentScreenToScreenCopy = R128CCESubsequentScreenToScreenCopy; + + /* Bresenham Solid Lines */ + a->SetupForSolidLine = R128CCESetupForSolidLine; + a->SubsequentSolidBresenhamLine = R128CCESubsequentSolidBresenhamLine; + a->SubsequentSolidHorVertLine = R128CCESubsequentSolidHorVertLine; + + /* Bresenham Dashed Lines*/ + a->SetupForDashedLine = R128CCESetupForDashedLine; + a->SubsequentDashedBresenhamLine = R128CCESubsequentDashedBresenhamLine; + a->DashPatternMaxLength = 32; + a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED + | LINE_PATTERN_POWER_OF_2_ONLY); + + /* Mono 8x8 Pattern Fill (Color Expand) */ + a->SetupForMono8x8PatternFill = R128CCESetupForMono8x8PatternFill; + a->SubsequentMono8x8PatternFillRect = R128CCESubsequentMono8x8PatternFillRect; + a->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS + | HARDWARE_PATTERN_PROGRAMMED_ORIGIN + | HARDWARE_PATTERN_SCREEN_ORIGIN + | BIT_ORDER_IN_BYTE_LSBFIRST); } #endif @@ -1183,7 +1569,8 @@ #ifdef XF86DRI /* FIXME: When direct rendering is enabled, we should use the CCE to draw 2D commands */ - if (info->CCE2D) R128CCEAccelInit(a); + if (info->directRenderingEnabled) + R128CCEAccelInit(pScrn, a); else #endif R128MMIOAccelInit(pScrn, a); Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c:1.4 Tue Nov 21 18:10:33 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c Tue Nov 6 10:53:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c,v 1.4 2000/11/21 23:10:33 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c,v 1.6 2001/11/06 15:53:10 alanh Exp $ */ /* * Authors: * Ove Kåven <ovek@transgaming.com>, @@ -23,29 +23,10 @@ static void R128_SetViewport(ScrnInfoPtr, int, int, int); static void R128_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void R128_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 static void R128_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); -#endif + unsigned long); -static -DGAFunctionRec R128_DGAFuncs = { - R128_OpenFramebuffer, - NULL, - R128_SetMode, - R128_SetViewport, - R128_GetViewport, - R128WaitForIdle, - R128_FillRect, - R128_BlitRect, -#if 0 - R128_BlitTransRect -#else - NULL -#endif -}; - static DGAModePtr R128SetupDGAMode( ScrnInfoPtr pScrn, @@ -92,12 +73,23 @@ (*num)++; currentMode->mode = pMode; - /* FIXME: is concurrent access really possible? */ currentMode->flags = DGA_CONCURRENT_ACCESS; if(pixmap) currentMode->flags |= DGA_PIXMAP_AVAILABLE; - if(info->accel) - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if(info->accel) { + if(info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + currentMode->flags |= DGA_FILL_RECT; + if(info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) + currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; + + if(currentMode->flags & + (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT | + DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS)) + currentMode->flags &= -DGA_CONCURRENT_ACCESS; + } + if(pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if(pMode->Flags & V_INTERLACE) @@ -213,7 +205,30 @@ info->numDGAModes = num; info->DGAModes = modes; - return DGAInit(pScreen, &R128_DGAFuncs, modes, num); + info->DGAFuncs.OpenFramebuffer = R128_OpenFramebuffer; + info->DGAFuncs.CloseFramebuffer = NULL; + info->DGAFuncs.SetMode = R128_SetMode; + info->DGAFuncs.SetViewport = R128_SetViewport; + info->DGAFuncs.GetViewport = R128_GetViewport; + + info->DGAFuncs.Sync = NULL; + info->DGAFuncs.FillRect = NULL; + info->DGAFuncs.BlitRect = NULL; + info->DGAFuncs.BlitTransRect = NULL; + + if (info->accel) { + info->DGAFuncs.Sync = R128WaitForIdle; + if (info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + info->DGAFuncs.FillRect = R128_FillRect; + if (info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) { + info->DGAFuncs.BlitRect = R128_BlitRect; + info->DGAFuncs.BlitTransRect = R128_BlitTransRect; + } + } + + return DGAInit(pScreen, &(info->DGAFuncs), modes, num); } @@ -233,8 +248,8 @@ pScrn->currentMode = info->CurrentLayout.mode; - R128SwitchMode(indx, pScrn->currentMode, 0); - R128AdjustFrame(indx, 0, 0, 0); + pScrn->SwitchMode(indx, pScrn->currentMode, 0); + pScrn->AdjustFrame(indx, 0, 0, 0); info->DGAactive = FALSE; } else { if(!info->DGAactive) { /* save the old parameters */ @@ -252,7 +267,7 @@ : pMode->depth); /* R128ModeInit() will set the mode field */ - R128SwitchMode(indx, pMode->mode, 0); + pScrn->SwitchMode(indx, pMode->mode, 0); } return TRUE; @@ -278,7 +293,7 @@ ){ R128InfoPtr info = R128PTR(pScrn); - R128AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags); info->DGAViewportStatus = 0; /* FIXME */ } @@ -290,12 +305,12 @@ unsigned long color ){ R128InfoPtr info = R128PTR(pScrn); + + (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); + (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); - if(info->accel) { - (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); - (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) SET_SYNC_FLAG(info->accel); - } } static void @@ -306,21 +321,19 @@ int dstx, int dsty ){ R128InfoPtr info = R128PTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*info->accel->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, (CARD32)(~0), -1); + (*info->accel->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); - if(info->accel) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*info->accel->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, (CARD32)(~0), -1); - (*info->accel->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) SET_SYNC_FLAG(info->accel); - } } -#if 0 static void R128_BlitTransRect( ScrnInfoPtr pScrn, @@ -329,10 +342,23 @@ int dstx, int dsty, unsigned long color ){ - /* this one should be separate since the XAA function would - prohibit usage of ~0 as the key */ + R128InfoPtr info = R128PTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + info->XAAForceTransBlit = TRUE; + + (*info->accel->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, (CARD32)(~0), color); + + info->XAAForceTransBlit = FALSE; + + (*info->accel->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); + + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) + SET_SYNC_FLAG(info->accel); } -#endif static Bool Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.14 Wed May 2 11:06:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c Fri Dec 28 10:49:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.14 2001/05/02 15:06:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.22 2001/12/28 15:49:11 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -58,6 +58,8 @@ /* ?? Alpha - this may need to be a variable to handle UP1x00 vs TITAN */ #if defined(__alpha__) # define DRM_PAGE_SIZE 8192 +#elif defined(__ia64__) +# define DRM_PAGE_SIZE getpagesize() #else # define DRM_PAGE_SIZE 4096 #endif @@ -257,7 +259,10 @@ drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore) { - /* Nothing yet */ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + R128InfoPtr info = R128PTR(pScrn); + + info->drmCtx = hwContext; return TRUE; } @@ -294,7 +299,7 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - if (!info->CCE2D) { + if (!info->directRenderingEnabled) { if (!info->CCEInUse) { /* Save all hardware scissors */ info->sc_left = INREG(R128_SC_LEFT); @@ -303,8 +308,6 @@ info->sc_bottom = INREG(R128_SC_BOTTOM); info->aux_sc_cntl = INREG(R128_SC_BOTTOM); } - - R128MMIO_TO_CCE(pScrn, info); } } @@ -338,7 +341,8 @@ int depth; /* FIXME: Use accel when CCE 2D code is written */ - if (info->CCE2D) return; + if (info->directRenderingEnabled) + return; /* FIXME: This should be based on the __GLXvisualConfig info */ switch (pScrn->bitsPerPixel) { @@ -399,7 +403,8 @@ that request them */ /* FIXME: Use accel when CCE 2D code is written */ - if (info->CCE2D) return; + if (info->directRenderingEnabled) + return; } /* Initialize the AGP state. Request memory for use in AGP space, and @@ -653,7 +658,7 @@ (unsigned long)info->ring); xf86DrvMsg(pScreen->myNum, X_INFO, "[pci] Ring contents 0x%08lx\n", - *(unsigned long *)info->ring); + *(unsigned long *)(pointer)info->ring); if (drmAddMap(info->drmFD, info->ringReadOffset, info->ringReadMapSize, DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) { @@ -676,7 +681,7 @@ (unsigned long)info->ringReadPtr); xf86DrvMsg(pScreen->myNum, X_INFO, "[pci] Ring read ptr contents 0x%08lx\n", - *(unsigned long *)info->ringReadPtr); + *(unsigned long *)(pointer)info->ringReadPtr); if (drmAddMap(info->drmFD, info->bufStart, info->bufMapSize, DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) { @@ -699,12 +704,15 @@ (unsigned long)info->buf); xf86DrvMsg(pScreen->myNum, X_INFO, "[pci] Vertex/indirect buffers contents 0x%08lx\n", - *(unsigned long *)info->buf); + *(unsigned long *)(pointer)info->buf); switch (info->Chipset) { case PCI_CHIP_RAGE128LE: case PCI_CHIP_RAGE128RE: case PCI_CHIP_RAGE128RK: + case PCI_CHIP_RAGE128PD: + case PCI_CHIP_RAGE128PP: + case PCI_CHIP_RAGE128PR: /* This is a PCI card, do nothing */ break; @@ -714,7 +722,11 @@ case PCI_CHIP_RAGE128RF: case PCI_CHIP_RAGE128RG: case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128SM: case PCI_CHIP_RAGE128PF: + case PCI_CHIP_RAGE128TF: + case PCI_CHIP_RAGE128TL: + case PCI_CHIP_RAGE128TR: default: /* This is really an AGP card, force PCI GART mode */ chunk = INREG(R128_BM_CHUNK_0_VAL); @@ -848,7 +860,7 @@ case R128_PM4_64PIO_64VCPIO_64INDPIO: info->CCEFifoSize = 64; break; } - if (info->CCE2D) { + if (info->directRenderingEnabled) { /* Make sure the CCE is on for the X server */ R128CCE_START(pScrn, info); } else { @@ -986,11 +998,11 @@ version = drmGetVersion(info->drmFD); if (version) { if (version->version_major != 2 || - version->version_minor < 1) { + version->version_minor < 2) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "[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] r128.o kernel module version is %d.%d.%d but version 2.2 or greater is needed.\n" "[dri] Disabling the DRI.\n", version->version_major, version->version_minor, @@ -1118,7 +1130,7 @@ R128InfoPtr info = R128PTR(pScrn); /* Stop the CCE if it is still in use */ - if (info->CCE2D) { + if (info->directRenderingEnabled) { R128CCE_STOP(pScrn, info); } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c diff -u 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.57 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.29.2.1 Thu May 24 15:43:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c Fri Jan 4 16:22:26 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.29.2.1 2001/05/24 19:43:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.57 2002/01/04 21:22:26 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -53,7 +53,6 @@ * DDC1 & DDC2 * shadowfb * overlay planes - * DGA * * Modified by Marc Aurele La France <tsi@xfree86.org> for ATI driver merge. */ @@ -117,8 +116,6 @@ static Bool R128ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -static Bool R128EnterVTFBDev(int scrnIndex, int flags); -static void R128LeaveVTFBDev(int scrnIndex, int flags); typedef enum { OPTION_NOACCEL, @@ -134,7 +131,6 @@ OPTION_AGP_SIZE, OPTION_RING_SIZE, OPTION_BUFFER_SIZE, - OPTION_USE_CCE_2D, #endif #if USE_CRT_ONLY /* FIXME: Disable CRTOnly until it is tested */ @@ -163,7 +159,6 @@ { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_RING_SIZE, "RingSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_USE_CCE_2D, "UseCCEfor2D", OPTV_BOOLEAN, {0}, FALSE }, #endif { OPTION_DISPLAY, "Display", OPTV_STRING, {0}, FALSE }, { OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE }, @@ -186,39 +181,39 @@ }; static const char *vgahwSymbols[] = { - "vgaHWGetHWRec", "vgaHWFreeHWRec", + "vgaHWGetHWRec", + "vgaHWGetIndex", "vgaHWLock", - "vgaHWUnlock", - "vgaHWSave", "vgaHWRestore", + "vgaHWSave", + "vgaHWUnlock", NULL }; static const char *fbdevHWSymbols[] = { "fbdevHWInit", "fbdevHWUseBuildinMode", - - "fbdevHWGetDepth", + "fbdevHWGetLineLength", "fbdevHWGetVidmem", /* colormap */ "fbdevHWLoadPalette", /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", "fbdevHWModeInit", + "fbdevHWRestore", "fbdevHWSave", + "fbdevHWSwitchMode", + "fbdevHWValidMode", - "fbdevHWUnmapMMIO", - "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", + "fbdevHWUnmapMMIO", + "fbdevHWUnmapVidmem", NULL }; @@ -230,9 +225,15 @@ NULL }; -#ifdef XFree86LOADER +static const char *i2cSymbols[] = { + "xf86CreateI2CBusRec", + "xf86I2CBusInit", + NULL +}; + #ifdef USE_FB static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; @@ -248,25 +249,16 @@ #endif static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", - NULL -}; - -static const char *xf8_32bppSymbols[] = { - "xf86Overlay8Plus32Init", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; @@ -285,39 +277,35 @@ "drmAgpUnbind", "drmAgpVendorId", "drmAvailable", - "drmCtlAddCommand", - "drmCtlInstHandler", "drmFreeVersion", - "drmGetInterruptFromBusID", "drmGetVersion", "drmMap", "drmMapBufs", - "drmMarkBufs", + "drmDMA", "drmR128CleanupCCE", "drmR128InitCCE", "drmR128ResetCCE", "drmR128StartCCE", "drmR128StopCCE", "drmR128WaitForIdleCCE", + "drmR128FlushIndirectBuffer", + "drmScatterGatherAlloc", + "drmScatterGatherFree", "drmUnmap", "drmUnmapBufs", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", - "DRILock", - "DRIUnlock", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", "DRIGetSAREAPrivate", - "DRIGetContext", + "DRILock", "DRIQueryVersion", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; @@ -329,8 +317,15 @@ "vbeFree", NULL }; -#endif +static const char *int10Symbols[] = { + "xf86InitInt10", + "xf86FreeInt10", + "xf86int10Addr", + NULL +}; + + /* Allocate our private R128InfoRec. */ static Bool R128GetRec(ScrnInfoPtr pScrn) { @@ -473,8 +468,10 @@ { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - - OUTREGP(R128_CRTC_EXT_CNTL, R128_CRTC_DISPLAY_DIS, ~R128_CRTC_DISPLAY_DIS); + if(info->isDFP) + OUTREGP(R128_FP_GEN_CNTL, R128_FP_BLANK_DIS, ~R128_FP_BLANK_DIS); + else + OUTREGP(R128_CRTC_EXT_CNTL, R128_CRTC_DISPLAY_DIS, ~R128_CRTC_DISPLAY_DIS); } /* Unblank screen. */ @@ -483,7 +480,10 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - OUTREGP(R128_CRTC_EXT_CNTL, 0, ~R128_CRTC_DISPLAY_DIS); + if(info->isDFP) + OUTREGP(R128_FP_GEN_CNTL, 0, ~R128_FP_BLANK_DIS); + else + OUTREGP(R128_CRTC_EXT_CNTL, 0, ~R128_CRTC_DISPLAY_DIS); } /* Compute log base 2 of val. */ @@ -616,6 +616,13 @@ } } + if (!info->PanelXRes || !info->PanelYRes) { + info->HasPanelRegs = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Can't determine panel dimensions, and none specified. \ + Disabling programming of FP registers.\n"); + } + return TRUE; } @@ -827,6 +834,7 @@ from = X_PROBED; info->LinearAddr = info->PciInfo->memBase[0] & 0xfc000000; + pScrn->memPhysBase = info->LinearAddr; if (dev->MemBase) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Linear address override, using 0x%08x instead of 0x%08x\n", @@ -884,7 +892,20 @@ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "\n\nWARNING: Forcing the driver to use/not use the flat panel registers\nmight damage your flat panel. Use at your *OWN* *RISK*.\n\n"); } else { + info->isDFP = FALSE; + info->isPro2 = FALSE; switch (info->Chipset) { + /* R128 Pro and Pro2 can have DFP, we will deal with it. + No support for dual-head/xinerama yet. + M3 can also have DFP, no support for now */ + case PCI_CHIP_RAGE128TF: + case PCI_CHIP_RAGE128TL: + case PCI_CHIP_RAGE128TR: info->isPro2 = TRUE; + case PCI_CHIP_RAGE128PD: + case PCI_CHIP_RAGE128PF: + case PCI_CHIP_RAGE128PP: + case PCI_CHIP_RAGE128PR: info->isDFP = TRUE; break; + case PCI_CHIP_RAGE128LE: case PCI_CHIP_RAGE128LF: case PCI_CHIP_RAGE128MF: @@ -894,8 +915,7 @@ case PCI_CHIP_RAGE128RG: case PCI_CHIP_RAGE128RK: case PCI_CHIP_RAGE128RL: - case PCI_CHIP_RAGE128PD: - case PCI_CHIP_RAGE128PF: + case PCI_CHIP_RAGE128SM: default: info->HasPanelRegs = FALSE; break; } } @@ -919,25 +939,25 @@ config file setting. BIOS_5_SCRATCH holds the display device on flat panel systems only. */ if (info->HasPanelRegs) { - char *display = xf86GetOptValString(info->Options, OPTION_DISPLAY); + char *Display = xf86GetOptValString(info->Options, OPTION_DISPLAY); if (info->FBDev) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Option \"Display\" ignored " "(framebuffer device determines display type)\n"); - else if (!display || !xf86NameCmp(display, "FP")) + else if (!Display || !xf86NameCmp(Display, "FP")) info->BIOSDisplay = R128_BIOS_DISPLAY_FP; - else if (!xf86NameCmp(display, "BIOS")) + else if (!xf86NameCmp(Display, "BIOS")) info->BIOSDisplay = INREG8(R128_BIOS_5_SCRATCH); - else if (!xf86NameCmp(display, "Mirror")) + else if (!xf86NameCmp(Display, "Mirror")) info->BIOSDisplay = R128_BIOS_DISPLAY_FP_CRT; - else if (!xf86NameCmp(display, "CRT")) + else if (!xf86NameCmp(Display, "CRT")) info->BIOSDisplay = R128_BIOS_DISPLAY_CRT; else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unsupported type \"%s\" specified for Option \"Display\".\n" "\tSupported types are: " - "\"BIOS\", \"Mirror\", \"CRT\" and \"FP\"\n", display); + "\"BIOS\", \"Mirror\", \"CRT\" and \"FP\"\n", Display); return FALSE; } } else { @@ -951,6 +971,9 @@ switch (info->MemCntl & 0x3) { case 0: /* SDR SGRAM 1:1 */ switch (info->Chipset) { + case PCI_CHIP_RAGE128TF: + case PCI_CHIP_RAGE128TL: + case PCI_CHIP_RAGE128TR: case PCI_CHIP_RAGE128LE: case PCI_CHIP_RAGE128LF: case PCI_CHIP_RAGE128MF: @@ -960,6 +983,7 @@ case PCI_CHIP_RAGE128RG: offset = 0; break; /* 128-bit SDR SGRAM 1:1 */ case PCI_CHIP_RAGE128RK: case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128SM: default: offset = 1; break; /* 64-bit SDR SGRAM 1:1 */ } break; @@ -1025,6 +1049,8 @@ case PCI_CHIP_RAGE128LE: case PCI_CHIP_RAGE128RE: case PCI_CHIP_RAGE128RK: + case PCI_CHIP_RAGE128PP: + case PCI_CHIP_RAGE128PR: case PCI_CHIP_RAGE128PD: info->IsPCI = TRUE; break; case PCI_CHIP_RAGE128LF: case PCI_CHIP_RAGE128MF: @@ -1032,7 +1058,11 @@ case PCI_CHIP_RAGE128RF: case PCI_CHIP_RAGE128RG: case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128SM: case PCI_CHIP_RAGE128PF: + case PCI_CHIP_RAGE128TF: + case PCI_CHIP_RAGE128TL: + case PCI_CHIP_RAGE128TR: default: info->IsPCI = FALSE; break; } } @@ -1054,13 +1084,10 @@ return TRUE; #else if (xf86LoadSubModule(pScrn, "vbe")) { -#ifdef XFree86LOADER xf86LoaderReqSymLists(vbeSymbols,NULL); -#endif pVbe = VBEInit(pInt10,info->pEnt->index); if (!pVbe) return FALSE; - - xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); + xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); vbeFree(pVbe); return TRUE; } else @@ -1077,6 +1104,359 @@ return TRUE; } +static void +R128I2CGetBits(I2CBusPtr b, int *Clock, int *data) +{ + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + R128InfoPtr info = R128PTR(pScrn); + unsigned long val; + unsigned char *R128MMIO = info->MMIO; + + /* Get the result. */ + val = INREG(info->DDCReg); + *Clock = (val & R128_GPIO_MONID_Y_3) != 0; + *data = (val & R128_GPIO_MONID_Y_0) != 0; + +} + +static void +R128I2CPutBits(I2CBusPtr b, int Clock, int data) +{ + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + R128InfoPtr info = R128PTR(pScrn); + unsigned long val; + unsigned char *R128MMIO = info->MMIO; + + val = INREG(info->DDCReg) + & ~(CARD32)(R128_GPIO_MONID_EN_0 | R128_GPIO_MONID_EN_3); + val |= (Clock ? 0:R128_GPIO_MONID_EN_3); + val |= (data ? 0:R128_GPIO_MONID_EN_0); + OUTREG(info->DDCReg, val); +} + + +static Bool +R128I2cInit(ScrnInfoPtr pScrn) +{ + R128InfoPtr info = R128PTR(pScrn); + if ( xf86LoadSubModule(pScrn, "i2c") ) + xf86LoaderReqSymLists(i2cSymbols,NULL); + else{ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to load i2c module\n"); + return FALSE; + } + + info->pI2CBus = xf86CreateI2CBusRec(); + if(!info->pI2CBus) return FALSE; + + info->pI2CBus->BusName = "DDC"; + info->pI2CBus->scrnIndex = pScrn->scrnIndex; + info->DDCReg = R128_GPIO_MONID; + info->pI2CBus->I2CPutBits = R128I2CPutBits; + info->pI2CBus->I2CGetBits = R128I2CGetBits; + info->pI2CBus->AcknTimeout = 5; + + if (!xf86I2CBusInit(info->pI2CBus)) { + return FALSE; + } + return TRUE; +} + +/* return TRUE is a DFP is indeed connected to a DVI port */ +static Bool R128GetDFPInfo(ScrnInfoPtr pScrn) +{ + R128InfoPtr info = R128PTR(pScrn); + int i; + xf86MonPtr MonInfo = NULL; + xf86MonPtr ddc; + unsigned char *R128MMIO = info->MMIO; + + if(!R128I2cInit(pScrn)){ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "I2C initialization failed!\n"); + } + + OUTREG(info->DDCReg, (INREG(info->DDCReg) + | R128_GPIO_MONID_MASK_0 | R128_GPIO_MONID_MASK_3)); + + OUTREG(info->DDCReg, INREG(info->DDCReg) + & ~(CARD32)(R128_GPIO_MONID_A_0 | R128_GPIO_MONID_A_3)); + + MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, info->pI2CBus); + if(!MonInfo) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No DFP detected\n"); + return FALSE; + } + xf86SetDDCproperties(pScrn, MonInfo); + ddc = pScrn->monitor->DDC; + + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == 0) + { + info->PanelXRes = + ddc->det_mon[i].section.d_timings.h_active; + info->PanelYRes = + ddc->det_mon[i].section.d_timings.v_active; + + info->HOverPlus = + ddc->det_mon[i].section.d_timings.h_sync_off; + info->HSyncWidth = + ddc->det_mon[i].section.d_timings.h_sync_width; + info->HBlank = + ddc->det_mon[i].section.d_timings.h_blanking; + info->VOverPlus = + ddc->det_mon[i].section.d_timings.v_sync_off; + info->VSyncWidth = + ddc->det_mon[i].section.d_timings.v_sync_width; + info->VBlank = + ddc->det_mon[i].section.d_timings.v_blanking; + } + } + return TRUE; +} + + +static void R128SetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) +{ + int i; + xf86MonPtr ddc = pScrn->monitor->DDC; + if(flag) /*HSync*/ + { + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == DS_RANGES) + { + pScrn->monitor->nHsync = 1; + pScrn->monitor->hsync[0].lo = + ddc->det_mon[i].section.ranges.min_h; + pScrn->monitor->hsync[0].hi = + ddc->det_mon[i].section.ranges.max_h; + return; + } + } + /*if no sync ranges detected in detailed timing table, + let's try to derive them from supported VESA modes + Are we doing too much here!!!? + **/ + i = 0; + if(ddc->timings1.t1 & 0x02) /*800x600@56*/ + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 35.2; + i++; + } + if(ddc->timings1.t1 & 0x04) /*640x480@75*/ + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 37.5; + i++; + } + if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t1 & 0x01)) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 37.9; + i++; + } + if(ddc->timings1.t2 & 0x40) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 46.9; + i++; + } + if((ddc->timings1.t2 & 0x80) || (ddc->timings1.t2 & 0x08)) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 48.1; + i++; + } + if(ddc->timings1.t2 & 0x04) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 56.5; + i++; + } + if(ddc->timings1.t2 & 0x02) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 60.0; + i++; + } + if(ddc->timings1.t2 & 0x01) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 64.0; + i++; + } + pScrn->monitor->nHsync = i; + } + else /*Vrefresh*/ + { + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == DS_RANGES) + { + pScrn->monitor->nVrefresh = 1; + pScrn->monitor->vrefresh[0].lo = + ddc->det_mon[i].section.ranges.min_v; + pScrn->monitor->vrefresh[0].hi = + ddc->det_mon[i].section.ranges.max_v; + return; + } + } + i = 0; + if(ddc->timings1.t1 & 0x02) /*800x600@56*/ + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 56; + i++; + } + if((ddc->timings1.t1 & 0x01) || (ddc->timings1.t2 & 0x08)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 60; + i++; + } + if(ddc->timings1.t2 & 0x04) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 70; + i++; + } + if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t2 & 0x80)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 72; + i++; + } + if((ddc->timings1.t1 & 0x04) || (ddc->timings1.t2 & 0x40) + || (ddc->timings1.t2 & 0x02) || (ddc->timings1.t2 & 0x01)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 75; + i++; + } + pScrn->monitor->nVrefresh = i; + } +} + +/*********** + xfree's xf86ValidateModes routine deosn't work well with DFPs + here is our own validation routine. All modes between + 640<=XRes<=MaxRes and 480<=YRes<=MaxYRes will be permitted. + NOTE: RageProII doesn't support rmx, can only work with the + standard modes the monitor can support (scale). +************/ + +static int R128ValidateFPModes(ScrnInfoPtr pScrn) +{ + int i, j, count=0, width, height; + R128InfoPtr info = R128PTR(pScrn); + DisplayModePtr last = NULL, new = NULL, first = NULL; + xf86MonPtr ddc; + + /* Free any allocated modes during configuration. We don't need them*/ + while (pScrn->modes) + { + xf86DeleteMode(&pScrn->modes, pScrn->modes); + } + while (pScrn->modePool) + { + xf86DeleteMode(&pScrn->modePool, pScrn->modePool); + } + + pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + + /* If no mode specified in config, we use native resolution*/ + if(!pScrn->display->modes[0]) + { + pScrn->display->modes[0] = xnfalloc(16); + sprintf(pScrn->display->modes[0], "%dx%d", + info->PanelXRes, info->PanelYRes); + } + + for(i=0; pScrn->display->modes[i] != NULL; i++) + { + if (sscanf(pScrn->display->modes[i], "%dx%d", &width, &height) == 2) + { + + if(width < 640 || width > info->PanelXRes || + height < 480 || height > info->PanelYRes) + { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Mode %s is out of range.\n" + "Valid mode should be between 640x480-%dx%d\n", + pScrn->display->modes[i], info->PanelXRes, info->PanelYRes); + continue; + } + + new = xnfcalloc(1, sizeof(DisplayModeRec)); + new->prev = last; + new->name = xnfalloc(strlen(pScrn->display->modes[i]) + 1); + strcpy(new->name, pScrn->display->modes[i]); + new->HDisplay = new->CrtcHDisplay = width; + new->VDisplay = new->CrtcVDisplay = height; + + ddc = pScrn->monitor->DDC; + for(j=0; j<DET_TIMINGS; j++) + { + /*We use native mode clock only*/ + if(ddc->det_mon[j].type == 0){ + new->Clock = ddc->det_mon[j].section.d_timings.clock / 1000; + break; + } + } + + if(new->prev) new->prev->next = new; + last = new; + if(!first) first = new; + pScrn->display->virtualX = + pScrn->virtualX = MAX(pScrn->virtualX, width); + pScrn->display->virtualY = + pScrn->virtualY = MAX(pScrn->virtualY, height); + count++; + } + else + { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Mode name %s is invalid\n", pScrn->display->modes[i]); + continue; + } + } + + if(last) + { + last->next = first; + first->prev = last; + pScrn->modes = first; + + /*FIXME: May need to validate line pitch here*/ + { + int dummy = 0; + switch(pScrn->depth / 8) + { + case 1: + dummy = 128 - pScrn->virtualX % 128; + break; + case 2: + dummy = 32 - pScrn->virtualX % 32; + break; + case 3: + case 4: + dummy = 16 - pScrn->virtualX % 16; + } + pScrn->displayWidth = pScrn->virtualX + dummy; + } + + } + + return count; +} + + /* This is called by R128PreInit to validate modes and compute parameters for all of the valid modes. */ static Bool R128PreInitModes(ScrnInfoPtr pScrn) @@ -1085,31 +1465,71 @@ ClockRangePtr clockRanges; int modesFound; char *mod = NULL; +#ifndef USE_FB const char *Sym = NULL; +#endif - /* Get mode information */ - pScrn->progClock = TRUE; - clockRanges = xnfcalloc(sizeof(*clockRanges), 1); - clockRanges->next = NULL; - clockRanges->minClock = info->pll.min_pll_freq; - clockRanges->maxClock = info->pll.max_pll_freq * 10; - clockRanges->clockIndex = -1; - if (info->HasPanelRegs) { - clockRanges->interlaceAllowed = FALSE; - clockRanges->doubleScanAllowed = FALSE; - } else { - clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = TRUE; + if(info->isDFP) { + R128MapMem(pScrn); + /* validate if DFP really connected. */ + if(!R128GetDFPInfo(pScrn)) { + info->isDFP = FALSE; + } else if(!info->isPro2) { + /* RageProII doesn't support rmx, we can't use native-mode + stretching for other non-native modes. It will rely on + whatever VESA modes monitor can support. */ + modesFound = R128ValidateFPModes(pScrn); + if(modesFound < 1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No valid mode found for this DFP/LCD\n"); + R128UnmapMem(pScrn); + return FALSE; + + } + } + info->BIOSDisplay = R128_BIOS_DISPLAY_FP; + R128UnmapMem(pScrn); } - modesFound = xf86ValidateModes(pScrn, + if(!info->isDFP || info->isPro2) { + /* Get mode information */ + pScrn->progClock = TRUE; + clockRanges = xnfcalloc(sizeof(*clockRanges), 1); + clockRanges->next = NULL; + clockRanges->minClock = info->pll.min_pll_freq; + clockRanges->maxClock = info->pll.max_pll_freq * 10; + clockRanges->clockIndex = -1; + if (info->HasPanelRegs || info->isDFP) { + clockRanges->interlaceAllowed = FALSE; + clockRanges->doubleScanAllowed = FALSE; + } else { + clockRanges->interlaceAllowed = TRUE; + clockRanges->doubleScanAllowed = TRUE; + } + + if(pScrn->monitor->DDC) { + /*if we still don't know sync range yet, let's try EDID. + Note that, since we can have dual heads, the Xconfigurator + may not be able to probe both monitors correctly through + vbe probe function (R128ProbeDDC). Here we provide an + additional way to auto-detect sync ranges if they haven't + been added to XF86Config manually. + **/ + if(pScrn->monitor->nHsync <= 0) + R128SetSyncRangeFromEdid(pScrn, 1); + if(pScrn->monitor->nVrefresh <= 0) + R128SetSyncRangeFromEdid(pScrn, 0); + } + + + modesFound = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, /* linePitches */ 8 * 64, /* minPitch */ 8 * 1024, /* maxPitch */ - 64 * pScrn->bitsPerPixel, /* pitchInc */ + 8 * 64, /* pitchInc */ 128, /* minHeight */ 2048, /* maxHeight */ pScrn->display->virtualX, @@ -1117,29 +1537,29 @@ info->FbMapSize, LOOKUP_BEST_REFRESH); - if (modesFound < 1 && info->FBDev) { - fbdevHWUseBuildinMode(pScrn); - pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */ - modesFound = 1; - } - - if (modesFound == -1) return FALSE; - xf86PruneDriverModes(pScrn); - if (!modesFound || !pScrn->modes) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); - return FALSE; + if (modesFound < 1 && info->FBDev) { + fbdevHWUseBuildinMode(pScrn); + pScrn->displayWidth = fbdevHWGetLineLength(pScrn)/(pScrn->bitsPerPixel/8); + modesFound = 1; + } + + if (modesFound == -1) return FALSE; + xf86PruneDriverModes(pScrn); + if (!modesFound || !pScrn->modes) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + return FALSE; + } + xf86SetCrtcForModes(pScrn, 0); } - xf86SetCrtcForModes(pScrn, 0); + /* Set DPI */ pScrn->currentMode = pScrn->modes; xf86PrintModes(pScrn); - /* Set DPI */ xf86SetDpi(pScrn, 0, 0); /* Get ScreenInit function */ #ifdef USE_FB mod = "fb"; - Sym = "fbScreenInit"; #else switch (pScrn->bitsPerPixel) { case 8: mod = "cfb"; Sym = "cfbScreenInit"; break; @@ -1155,9 +1575,10 @@ } #endif if (mod && !xf86LoadSubModule(pScrn, mod)) return FALSE; - xf86LoaderReqSymbols(Sym, NULL); #ifdef USE_FB - xf86LoaderReqSymbols("fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); +#else + xf86LoaderReqSymbols(Sym, NULL); #endif info->CurrentLayout.displayWidth = pScrn->displayWidth; @@ -1173,6 +1594,7 @@ if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); } return TRUE; } @@ -1184,6 +1606,7 @@ if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; + xf86LoaderReqSymLists(xaaSymbols, NULL); } return TRUE; } @@ -1194,6 +1617,7 @@ #if 1 && !defined(__alpha__) /* int10 is broken on some Alphas */ if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); *ppInt10 = xf86InitInt10(info->pEnt->index); } @@ -1213,13 +1637,6 @@ info->CCEMode = R128_DEFAULT_CCE_BM_MODE; } - 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(info->Options, OPTION_NO_SECURITY, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "WARNING!!! CCE Security checks disabled!!! **********\n"); @@ -1320,6 +1737,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,indx); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -1331,19 +1749,17 @@ R128TRACE(("R128PreInit\n")); -#ifdef XFree86LOADER /* * Tell the loader about symbols from other modules that this module might * refer to. */ - LoaderRefSymLists(vgahwSymbols, + xf86LoaderRefSymLists(vgahwSymbols, #ifdef USE_FB fbSymbols, #else cfbSymbols, #endif xaaSymbols, - xf8_32bppSymbols, ramdacSymbols, #ifdef XF86DRI drmSymbols, @@ -1352,10 +1768,9 @@ fbdevHWSymbols, vbeSymbols, /* ddcsymbols, */ - /* i2csymbols, */ + i2cSymbols, /* shadowSymbols, */ NULL); -#endif if (pScrn->numEntities != 1) return FALSE; @@ -1430,8 +1845,6 @@ if (!fbdevHWInit(pScrn, info->PciInfo, NULL)) return FALSE; pScrn->SwitchMode = fbdevHWSwitchMode; pScrn->AdjustFrame = fbdevHWAdjustFrame; - pScrn->EnterVT = R128EnterVTFBDev; - pScrn->LeaveVT = R128LeaveVTFBDev; pScrn->ValidMode = fbdevHWValidMode; } @@ -1469,6 +1882,10 @@ if (pInt10) xf86FreeInt10(pInt10); + xf86DrvMsg(pScrn->scrnIndex, X_NOTICE, + "For information on using the multimedia capabilities\n of this" + " adapter, please see http://gatos.sf.net.\n"); + return TRUE; fail: @@ -1500,7 +1917,7 @@ unsigned char r, g, b; /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); + if (info->HasPanelRegs || info->isDFP) PAL_SELECT(0); if (info->CurrentLayout.depth == 15) { /* 15bpp mode. This sends 32 values. */ @@ -1546,6 +1963,11 @@ ScrnInfoPtr pScrn = xf86Screens[i]; R128InfoPtr info = R128PTR(pScrn); +#ifdef XF86DRI + if (info->directRenderingEnabled) + FLUSH_RING(); +#endif + pScreen->BlockHandler = info->BlockHandler; (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); pScreen->BlockHandler = R128BlockHandler; @@ -1636,7 +2058,6 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; - fbPictureInit (pScreen, 0, 0); #else switch (pScrn->bitsPerPixel) { case 8: @@ -1695,9 +2116,11 @@ } } } - - R128DGAInit(pScreen); +#ifdef USE_FB + /* must be after RGB order fixed */ + fbPictureInit (pScreen, 0, 0); +#endif /* Memory manager setup */ #ifdef XF86DRI if (info->directRenderingEnabled) { @@ -1933,6 +2356,9 @@ info->accelOn = FALSE; } + /* DGA setup */ + R128DGAInit(pScreen); + /* Cursor setup */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -2015,6 +2441,8 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; + OUTREG(R128_FP_GEN_CNTL, restore->fp_gen_cntl | R128_FP_BLANK_DIS); + OUTREG(R128_OVR_CLR, restore->ovr_clr); OUTREG(R128_OVR_WID_LEFT_RIGHT, restore->ovr_wid_left_right); OUTREG(R128_OVR_WID_TOP_BOTTOM, restore->ovr_wid_top_bottom); @@ -2060,17 +2488,20 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; CARD32 tmp; + - OUTREG(R128_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl); + /*OUTREG(R128_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl);*/ + OUTREG(R128_FP_HORZ_STRETCH, restore->fp_horz_stretch); + OUTREG(R128_FP_VERT_STRETCH, restore->fp_vert_stretch); OUTREG(R128_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp); OUTREG(R128_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp); - OUTREG(R128_FP_GEN_CNTL, restore->fp_gen_cntl); OUTREG(R128_FP_H_SYNC_STRT_WID, restore->fp_h_sync_strt_wid); - OUTREG(R128_FP_HORZ_STRETCH, restore->fp_horz_stretch); - OUTREG(R128_FP_PANEL_CNTL, restore->fp_panel_cntl); OUTREG(R128_FP_V_SYNC_STRT_WID, restore->fp_v_sync_strt_wid); - OUTREG(R128_FP_VERT_STRETCH, restore->fp_vert_stretch); OUTREG(R128_TMDS_CRC, restore->tmds_crc); + OUTREG(R128_FP_PANEL_CNTL, restore->fp_panel_cntl); + OUTREG(R128_FP_GEN_CNTL, restore->fp_gen_cntl & ~(CARD32)R128_FP_BLANK_DIS); + + if(info->isDFP) return; tmp = INREG(R128_LVDS_GEN_CNTL); if ((tmp & (R128_LVDS_ON | R128_LVDS_BLON)) == @@ -2168,7 +2599,7 @@ if (!restore->palette_valid) return; /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); + if (info->HasPanelRegs || info->isDFP) PAL_SELECT(0); OUTPAL_START(0); for (i = 0; i < 256; i++) OUTPAL_NEXT_CARD32(restore->palette[i]); @@ -2182,11 +2613,13 @@ R128TRACE(("R128RestoreMode(%p)\n", restore)); R128RestoreCommonRegisters(pScrn, restore); R128RestoreCrtcRegisters(pScrn, restore); - if (info->HasPanelRegs) - R128RestoreFPRegisters(pScrn, restore); - if (!info->HasPanelRegs || info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) - R128RestorePLLRegisters(pScrn, restore); + if (!(info->HasPanelRegs) || info->BIOSDisplay == R128_BIOS_DISPLAY_CRT){ + R128RestorePLLRegisters(pScrn, restore); + } R128RestoreDDARegisters(pScrn, restore); + if (info->HasPanelRegs || info->isDFP) + R128RestoreFPRegisters(pScrn, restore); + R128RestorePalette(pScrn, restore); } @@ -2247,6 +2680,7 @@ save->fp_vert_stretch = INREG(R128_FP_VERT_STRETCH); save->lvds_gen_cntl = INREG(R128_LVDS_GEN_CNTL); save->tmds_crc = INREG(R128_TMDS_CRC); + save->tmds_transmitter_cntl = INREG(R128_TMDS_TRANSMITTER_CNTL); } /* Read PLL registers. */ @@ -2284,7 +2718,7 @@ int i; /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); + if (info->HasPanelRegs || info->isDFP) PAL_SELECT(0); INPAL_START(0); for (i = 0; i < 256; i++) save->palette[i] = INPAL_NEXT(); @@ -2298,7 +2732,7 @@ R128SaveCommonRegisters(pScrn, save); R128SaveCrtcRegisters(pScrn, save); - if (R128PTR(pScrn)->HasPanelRegs) + if (R128PTR(pScrn)->HasPanelRegs || R128PTR(pScrn)->isDFP) R128SaveFPRegisters(pScrn, save); R128SavePLLRegisters(pScrn, save); R128SaveDDARegisters(pScrn, save); @@ -2446,6 +2880,21 @@ | R128_DAC_VGA_ADR_EN | (info->dac6bits ? 0 : R128_DAC_8BIT_EN)); + + if(info->isDFP && !info->isPro2) + { + if(info->PanelXRes < mode->CrtcHDisplay) + mode->HDisplay = mode->CrtcHDisplay = info->PanelXRes; + if(info->PanelYRes < mode->CrtcVDisplay) + mode->VDisplay = mode->CrtcVDisplay = info->PanelYRes; + mode->CrtcHTotal = mode->CrtcHDisplay + info->HBlank; + mode->CrtcHSyncStart = mode->CrtcHDisplay + info->HOverPlus; + mode->CrtcHSyncEnd = mode->CrtcHSyncStart + info->HSyncWidth; + mode->CrtcVTotal = mode->CrtcVDisplay + info->VBlank; + mode->CrtcVSyncStart = mode->CrtcVDisplay + info->VOverPlus; + mode->CrtcVSyncEnd = mode->CrtcVSyncStart + info->VSyncWidth; + } + save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff) | (((mode->CrtcHDisplay / 8) - 1) << 16)); @@ -2512,20 +2961,20 @@ float Hratio, Vratio; 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; - save->fp_gen_cntl &= ~(R128_FP_FPON | - 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 |= (R128_FP_SEL_CRTC2 | - R128_FP_CRTC_DONT_SHADOW_VPAR); - 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; + save->crtc_ext_cntl |= R128_CRTC_CRT_ON; + save->crtc2_gen_cntl = 0; + save->fp_gen_cntl = orig->fp_gen_cntl; + save->fp_gen_cntl &= ~(R128_FP_FPON | + 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 |= (R128_FP_SEL_CRTC2 | + R128_FP_CRTC_DONT_SHADOW_VPAR); + 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; } if (xres > info->PanelXRes) xres = info->PanelXRes; @@ -2537,14 +2986,15 @@ save->fp_horz_stretch = (((((int)(Hratio * R128_HORZ_STRETCH_RATIO_MAX + 0.5)) & R128_HORZ_STRETCH_RATIO_MASK) << R128_HORZ_STRETCH_RATIO_SHIFT) | - (orig->fp_horz_stretch & (R128_HORZ_PANEL_SIZE | - R128_HORZ_FP_LOOP_STRETCH | - R128_HORZ_STRETCH_RESERVED))); + (orig->fp_horz_stretch & (R128_HORZ_PANEL_SIZE | + R128_HORZ_FP_LOOP_STRETCH | + R128_HORZ_STRETCH_RESERVED))); save->fp_horz_stretch &= ~R128_HORZ_AUTO_RATIO_FIX_EN; - if (Hratio == 1.0) save->fp_horz_stretch &= ~(R128_HORZ_STRETCH_BLEND | - R128_HORZ_STRETCH_ENABLE); - else save->fp_horz_stretch |= (R128_HORZ_STRETCH_BLEND | - R128_HORZ_STRETCH_ENABLE); + save->fp_horz_stretch &= ~R128_AUTO_HORZ_RATIO; + if (xres == info->PanelXRes) + save->fp_horz_stretch &= ~(R128_HORZ_STRETCH_BLEND | R128_HORZ_STRETCH_ENABLE); + else + save->fp_horz_stretch |= (R128_HORZ_STRETCH_BLEND | R128_HORZ_STRETCH_ENABLE); save->fp_vert_stretch = (((((int)(Vratio * R128_VERT_STRETCH_RATIO_MAX + 0.5)) @@ -2552,10 +3002,10 @@ (orig->fp_vert_stretch & (R128_VERT_PANEL_SIZE | R128_VERT_STRETCH_RESERVED))); save->fp_vert_stretch &= ~R128_VERT_AUTO_RATIO_EN; - if (Vratio == 1.0) save->fp_vert_stretch &= ~(R128_VERT_STRETCH_ENABLE | - R128_VERT_STRETCH_BLEND); - else save->fp_vert_stretch |= (R128_VERT_STRETCH_ENABLE | - R128_VERT_STRETCH_BLEND); + if (yres == info->PanelYRes) + save->fp_vert_stretch &= ~(R128_VERT_STRETCH_ENABLE | R128_VERT_STRETCH_BLEND); + else + save->fp_vert_stretch |= (R128_VERT_STRETCH_ENABLE | R128_VERT_STRETCH_BLEND); save->fp_gen_cntl = (orig->fp_gen_cntl & (CARD32)~(R128_FP_SEL_CRTC2 | @@ -2563,14 +3013,9 @@ 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); - } - + save->fp_panel_cntl = orig->fp_panel_cntl; save->lvds_gen_cntl = orig->lvds_gen_cntl; - save->tmds_crc = orig->tmds_crc; /* Disable CRT output by disabling CRT output and setting the CRT @@ -2578,21 +3023,36 @@ 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. */ - 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; + + if(!info->isDFP){ + 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 - save->lvds_gen_cntl |= (R128_LVDS_ON | R128_LVDS_BLON); -#else - save->fp_panel_cntl |= (R128_FP_DIGON | R128_FP_BLON); - save->fp_gen_cntl |= (R128_FP_FPON); -#endif + if(info->isDFP){ + save->fp_gen_cntl = orig->fp_gen_cntl; + + save->fp_gen_cntl &= ~(R128_FP_CRTC_USE_SHADOW_VEND | + R128_FP_CRTC_USE_SHADOW_ROWCUR | + R128_FP_CRTC_HORZ_DIV2_EN | + R128_FP_CRTC_HOR_CRT_DIV2_DIS | + R128_FP_CRT_SYNC_SEL | + R128_FP_USE_SHADOW_EN); + + save->fp_panel_cntl |= (R128_FP_DIGON | R128_FP_BLON); + save->fp_gen_cntl |= (R128_FP_FPON | R128_FP_TDMS_EN | + R128_FP_CRTC_DONT_SHADOW_VPAR | R128_FP_CRTC_DONT_SHADOW_HEND); + save->tmds_transmitter_cntl = (orig->tmds_transmitter_cntl + & ~(CARD32)R128_TMDS_PLLRST) | R128_TMDS_PLLEN; + } + else + save->lvds_gen_cntl |= (R128_LVDS_ON | R128_LVDS_BLON); save->fp_crtc_h_total_disp = save->crtc_h_total_disp; save->fp_crtc_v_total_disp = save->crtc_v_total_disp; @@ -2649,11 +3109,13 @@ save->ppll_ref_div = pll->reference_div; save->ppll_div_3 = (save->feedback_div | (post_div->bitvalue << 16)); save->htotal_cntl = 0; + } /* Define DDA registers for requested video mode. */ static Bool R128InitDDARegisters(ScrnInfoPtr pScrn, R128SavePtr save, - R128PLLPtr pll, R128InfoPtr info) + R128PLLPtr pll, R128InfoPtr info, + DisplayModePtr mode) { int DisplayFifoWidth = 128; int DisplayFifoDepth = 32; @@ -2670,6 +3132,11 @@ VclkFreq = R128Div(pll->reference_freq * save->feedback_div, pll->reference_div * save->post_div); + if(info->isDFP && !info->isPro2){ + if(info->PanelXRes != mode->CrtcHDisplay) + VclkFreq = (VclkFreq * mode->CrtcHDisplay)/info->PanelXRes; + } + XclksPerTransfer = R128Div(XclkFreq * DisplayFifoWidth, VclkFreq * (info->CurrentLayout.pixel_bytes * 8)); @@ -2715,12 +3182,14 @@ } +#if 0 /* Define initial palette for requested video mode. This doesn't do anything for XFree86 4.0. */ static void R128InitPalette(R128SavePtr save) { save->palette_valid = FALSE; } +#endif /* Define registers for a requested video mode. */ static Bool R128Init(ScrnInfoPtr pScrn, DisplayModePtr mode, R128SavePtr save) @@ -2779,12 +3248,20 @@ R128InitCommonRegisters(save, info); if (!R128InitCrtcRegisters(pScrn, save, mode, info)) return FALSE; - if (info->HasPanelRegs) - R128InitFPRegisters(&info->SavedReg, save, mode, info); - R128InitPLLRegisters(pScrn, save, &info->pll, dot_clock); - if (!R128InitDDARegisters(pScrn, save, &info->pll, info)) - return FALSE; - if (!info->PaletteSavedOnVT) R128InitPalette(save); + if (info->HasPanelRegs || info->isDFP) + R128InitFPRegisters(&info->SavedReg, save, mode, info); + if(dot_clock > 0){ + R128InitPLLRegisters(pScrn, save, &info->pll, dot_clock); + if (!R128InitDDARegisters(pScrn, save, &info->pll, info, mode)) + return FALSE; + } + else{ + save->ppll_ref_div = info->SavedReg.ppll_ref_div; + save->ppll_div_3 = info->SavedReg.ppll_div_3; + save->htotal_cntl = info->SavedReg.htotal_cntl; + save->dda_config = info->SavedReg.dda_config; + save->dda_on_off = info->SavedReg.dda_on_off; + } R128TRACE(("R128Init returns %p\n", save)); return TRUE; @@ -2837,6 +3314,14 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; R128InfoPtr info = R128PTR(pScrn); + if(info->isDFP) { + if(info->PanelXRes < mode->CrtcHDisplay || + info->PanelYRes < mode->CrtcVDisplay) + return MODE_NOMODE; + else + return MODE_OK; + } + if (info->HasPanelRegs) { if (mode->Flags & V_INTERLACE) return MODE_NO_INTERLACE; if (mode->Flags & V_DBLSCAN) return MODE_NO_DBLESCAN; @@ -2921,18 +3406,22 @@ R128InfoPtr info = R128PTR(pScrn); R128TRACE(("R128EnterVT\n")); + if (info->FBDev) { + if (!fbdevHWEnterVT(scrnIndex,flags)) return FALSE; + } else + if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE; + if (info->accelOn) + R128EngineInit(pScrn); + #ifdef XF86DRI - if (R128PTR(pScrn)->directRenderingEnabled) { + if (info->directRenderingEnabled) { R128CCE_START(pScrn, info); DRIUnlock(pScrn->pScreen); } #endif - if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE; - if (info->accelOn) - R128EngineInit(pScrn); info->PaletteSavedOnVT = FALSE; - R128AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); return TRUE; } @@ -2954,29 +3443,12 @@ #endif R128SavePalette(pScrn, save); info->PaletteSavedOnVT = TRUE; - R128Restore(pScrn); -} - -static Bool -R128EnterVTFBDev(int scrnIndex, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - R128InfoPtr info = R128PTR(pScrn); - R128SavePtr restore = &info->SavedReg; - fbdevHWEnterVT(scrnIndex,flags); - R128RestorePalette(pScrn,restore); - R128EngineInit(pScrn); - return TRUE; + if (info->FBDev) + fbdevHWLeaveVT(scrnIndex,flags); + else + R128Restore(pScrn); } -static void R128LeaveVTFBDev(int scrnIndex, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - R128InfoPtr info = R128PTR(pScrn); - R128SavePtr save = &info->SavedReg; - R128SavePalette(pScrn,save); - fbdevHWLeaveVT(scrnIndex,flags); -} /* Called at the end of each server generation. Restore the original text mode, unmap video memory, and unwrap and call the saved CloseScreen Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.2 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.10 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c:1.10 Fri May 4 15:05:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c Mon Nov 5 18:37:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.10 2001/05/04 19:05:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.16 2001/11/05 23:37:50 alanh Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -80,8 +80,14 @@ { PCI_CHIP_RAGE128RG, "ATI Rage 128 RG (AGP)" }, { PCI_CHIP_RAGE128RK, "ATI Rage 128 RK (PCI)" }, { PCI_CHIP_RAGE128RL, "ATI Rage 128 RL (AGP)" }, + { PCI_CHIP_RAGE128SM, "ATI Rage 128 SM (AGP)" }, { PCI_CHIP_RAGE128PD, "ATI Rage 128 Pro PD (PCI)" }, { PCI_CHIP_RAGE128PF, "ATI Rage 128 Pro PF (AGP)" }, + { PCI_CHIP_RAGE128PP, "ATI Rage 128 Pro PP (PCI)" }, + { PCI_CHIP_RAGE128PR, "ATI Rage 128 Pro PR (PCI)" }, + { PCI_CHIP_RAGE128TF, "ATI Rage 128 Pro ULTRA TF (AGP)" }, + { PCI_CHIP_RAGE128TL, "ATI Rage 128 Pro ULTRA TL (AGP)" }, + { PCI_CHIP_RAGE128TR, "ATI Rage 128 Pro ULTRA TR (AGP)" }, { PCI_CHIP_RAGE128LE, "ATI Rage 128 Mobility LE (PCI)" }, { PCI_CHIP_RAGE128LF, "ATI Rage 128 Mobility LF (AGP)" }, { PCI_CHIP_RAGE128MF, "ATI Rage 128 Mobility MF (AGP)" }, @@ -95,8 +101,14 @@ { PCI_CHIP_RAGE128RG, PCI_CHIP_RAGE128RG, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RK, PCI_CHIP_RAGE128RK, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RL, PCI_CHIP_RAGE128RL, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SM, PCI_CHIP_RAGE128SM, RES_SHARED_VGA }, { PCI_CHIP_RAGE128PD, PCI_CHIP_RAGE128PD, RES_SHARED_VGA }, { PCI_CHIP_RAGE128PF, PCI_CHIP_RAGE128PF, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PP, PCI_CHIP_RAGE128PP, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PR, PCI_CHIP_RAGE128PR, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TF, PCI_CHIP_RAGE128TF, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TL, PCI_CHIP_RAGE128TL, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TR, PCI_CHIP_RAGE128TR, RES_SHARED_VGA }, { PCI_CHIP_RAGE128LE, PCI_CHIP_RAGE128LE, RES_SHARED_VGA }, { PCI_CHIP_RAGE128LF, PCI_CHIP_RAGE128LF, RES_SHARED_VGA }, { PCI_CHIP_RAGE128MF, PCI_CHIP_RAGE128MF, RES_SHARED_VGA }, Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.11 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.11 Tue Apr 10 12:07:59 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h Tue Oct 2 07:44:16 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.11 2001/04/10 16:07:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.13 2001/10/02 11:44:16 alanh Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -322,6 +322,8 @@ # define R128_CRTC_VSYNC_DIS (1 << 9) # define R128_CRTC_DISPLAY_DIS (1 << 10) # define R128_CRTC_CRT_ON (1 << 15) +# define R128_FP_OUT_EN (1 << 22) +# define R128_FP_ACTIVE (1 << 23) #define R128_CRTC_EXT_CNTL_DPMS_BYTE 0x0055 # define R128_CRTC_HSYNC_DIS_BYTE (1 << 0) # define R128_CRTC_VSYNC_DIS_BYTE (1 << 1) @@ -556,13 +558,17 @@ #define R128_FP_CRTC_V_TOTAL_DISP 0x0254 #define R128_FP_GEN_CNTL 0x0284 # define R128_FP_FPON (1 << 0) +# define R128_FP_BLANK_DIS (1 << 1) # define R128_FP_TDMS_EN (1 << 2) # define R128_FP_DETECT_SENSE (1 << 8) # define R128_FP_SEL_CRTC2 (1 << 13) # define R128_FP_CRTC_DONT_SHADOW_VPAR (1 << 16) +# define R128_FP_CRTC_DONT_SHADOW_HEND (1 << 17) # define R128_FP_CRTC_USE_SHADOW_VEND (1 << 18) +# define R128_FP_CRTC_USE_SHADOW_ROWCUR (1 << 19) # define R128_FP_CRTC_HORZ_DIV2_EN (1 << 20) # define R128_FP_CRTC_HOR_CRT_DIV2_DIS (1 << 21) +# define R128_FP_CRT_SYNC_SEL (1 << 23) # define R128_FP_USE_SHADOW_EN (1 << 24) #define R128_FP_H_SYNC_STRT_WID 0x02c4 #define R128_FP_HORZ_STRETCH 0x028c @@ -571,6 +577,7 @@ # define R128_HORZ_STRETCH_RATIO_MAX 4096 # define R128_HORZ_PANEL_SIZE (0xff << 16) # define R128_HORZ_PANEL_SHIFT 16 +# define R128_AUTO_HORZ_RATIO (0 << 24) # define R128_HORZ_STRETCH_PIXREP (0 << 25) # define R128_HORZ_STRETCH_BLEND (1 << 25) # define R128_HORZ_STRETCH_ENABLE (1 << 26) @@ -913,6 +920,9 @@ #define R128_TEST_DEBUG_MUX 0x0124 #define R128_TEST_DEBUG_OUT 0x012c #define R128_TMDS_CRC 0x02a0 +#define R128_TMDS_TRANSMITTER_CNTL 0x02a4 +# define R128_TMDS_PLLEN (1 << 0) +# define R128_TMDS_PLLRST (1 << 1) #define R128_TRAIL_BRES_DEC 0x1614 #define R128_TRAIL_BRES_ERR 0x160c #define R128_TRAIL_BRES_INC 0x1610 @@ -1483,5 +1493,13 @@ #define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020 #define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030 #define R128_CCE_VC_CNTL_NUM_SHIFT 16 + +/* hmm copyed blindly (no specs) from radeon.h ... */ +#define R128_RE_TOP_LEFT 0x26c0 +# define R128_RE_LEFT_SHIFT 0 +# define R128_RE_TOP_SHIFT 16 +#define R128_RE_WIDTH_HEIGHT 0x1c44 +# define R128_RE_WIDTH_SHIFT 0 +# define R128_RE_HEIGHT_SHIFT 16 #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.2 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h:1.2 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.18 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c:1.18 Sat Mar 3 17:26:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c Tue Oct 2 07:44:16 2001 @@ -1,8 +1,13 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.18 2001/03/03 22:26:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.20 2001/10/02 11:44:16 alanh Exp $ */ #include "r128.h" #include "r128_reg.h" +#ifdef XF86DRI +#include "xf86drmR128.h" +#include "r128_sarea.h" +#endif + #include "xf86.h" #include "dixstruct.h" @@ -96,12 +101,15 @@ xfree(newAdaptors); } +#define MAXWIDTH 2048 +#define MAXHEIGHT 2048 + /* client libraries expect an encoding */ static XF86VideoEncodingRec DummyEncoding = { 0, "XV_IMAGE", - 2048, 2048, + MAXWIDTH, MAXHEIGHT, {1, 1} }; @@ -472,8 +480,115 @@ } +/* + * + * R128DMA - abuse the texture blit ioctl to transfer rectangular blocks + * + * The block is split into 'passes' pieces of 'hpass' lines which fit entirely + * into an indirect buffer + * + */ + +static Bool +R128DMA( + R128InfoPtr info, + unsigned char *src, + unsigned char *dst, + int srcPitch, + int dstPitch, + int h, + int w +){ + +#ifdef XF86DRI + +#define BUFSIZE (R128_BUFFER_SIZE - R128_HOSTDATA_BLIT_OFFSET) +#define MAXPASSES (MAXHEIGHT/(BUFSIZE/(MAXWIDTH*2))+1) + + unsigned char *buf; + int err=-1, i, idx, offset, hpass, passes, srcpassbytes, dstpassbytes; + int sizes[MAXPASSES], list[MAXPASSES]; + drmDMAReq req; + + /* Verify conditions and bail out as early as possible */ + if (!info->directRenderingEnabled) + return FALSE; + + if ((hpass = min(h,(BUFSIZE/w))) == 0) + return FALSE; + + if ((passes = (h+hpass-1)/hpass) > MAXPASSES) + return FALSE; + + /* Request indirect buffers */ + srcpassbytes = w*hpass; + + req.context = info->drmCtx; + req.send_count = 0; + req.send_list = NULL; + req.send_sizes = NULL; + req.flags = DRM_DMA_LARGER_OK; + req.request_count = passes; + req.request_size = srcpassbytes + R128_HOSTDATA_BLIT_OFFSET; + req.request_list = &list[0]; + req.request_sizes = &sizes[0]; + req.granted_count = 0; + + if (drmDMA(info->drmFD, &req)) + return FALSE; + + if (req.granted_count < passes) { + drmFreeBufs(info->drmFD, req.granted_count, req.request_list); + return FALSE; + } + + /* Copy parts of the block into buffers and fire them */ + dstpassbytes = hpass*dstPitch; + dstPitch /= 8; + + for (i=0, offset=dst-info->FB; i<passes; i++, offset+=dstpassbytes) { + if (i == (passes-1) && (h % hpass) != 0) { + hpass = h % hpass; + srcpassbytes = w*hpass; + } + + idx = req.request_list[i]; + buf = (unsigned char *) info->buffers->list[idx].address + R128_HOSTDATA_BLIT_OFFSET; + + if (srcPitch == w) { + memcpy(buf, src, srcpassbytes); + src += srcpassbytes; + } else { + int count = hpass; + while(count--) { + memcpy(buf, src, w); + src += srcPitch; + buf += w; + } + } + + if ((err = drmR128TextureBlit(info->drmFD, idx, offset, dstPitch, + (R128_DATATYPE_CI8 >> 16), (offset % 32), 0, w, hpass)) < 0) + break; + } + + drmFreeBufs(info->drmFD, req.granted_count, req.request_list); + + return (err==0) ? TRUE : FALSE; + +#else + + /* This is to avoid cluttering the rest of the code with '#ifdef XF86DRI' */ + return FALSE; + +#endif /* XF86DRI */ + +} + + static void R128CopyData422( + R128InfoPtr info, unsigned char *src, unsigned char *dst, int srcPitch, @@ -482,15 +597,21 @@ int w ){ w <<= 1; - while(h--) { - memcpy(dst, src, w); - src += srcPitch; - dst += dstPitch; + + /* Attempt data transfer with DMA and fall back to memcpy */ + + if (!R128DMA(info, src, dst, srcPitch, dstPitch, h, w)) { + while(h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } } } static void R128CopyData420( + R128InfoPtr info, unsigned char *src1, unsigned char *src2, unsigned char *src3, @@ -504,30 +625,38 @@ int w ){ int count; + + /* Attempt data transfer with DMA and fall back to memcpy */ - count = h; - while(count--) { - memcpy(dst1, src1, w); - src1 += srcPitch; - dst1 += dstPitch; + if (!R128DMA(info, src1, dst1, srcPitch, dstPitch, h, w)) { + count = h; + while(count--) { + memcpy(dst1, src1, w); + src1 += srcPitch; + dst1 += dstPitch; + } } w >>= 1; h >>= 1; dstPitch >>= 1; - count = h; - while(count--) { - memcpy(dst2, src2, w); - src2 += srcPitch2; - dst2 += dstPitch; + if (!R128DMA(info, src2, dst2, srcPitch2, dstPitch, h, w)) { + count = h; + while(count--) { + memcpy(dst2, src2, w); + src2 += srcPitch2; + dst2 += dstPitch; + } } - count = h; - while(count--) { - memcpy(dst3, src3, w); - src3 += srcPitch2; - dst3 += dstPitch; + if (!R128DMA(info, src3, dst3, srcPitch2, dstPitch, h, w)) { + count = h; + while(count--) { + memcpy(dst3, src3, w); + src3 += srcPitch2; + dst3 += dstPitch; + } } } @@ -854,9 +983,24 @@ } nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; - R128CopyData420(buf + s1offset, buf + s2offset, buf + s3offset, - info->FB+d1offset, info->FB+d2offset, info->FB+d3offset, - srcPitch, srcPitch2, dstPitch, nlines, npixels); + { +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned char *R128MMIO = info->MMIO; + CARD32 config_cntl; + + /* We need to disable byte swapping, or the data gets mangled */ + config_cntl = INREG(R128_CONFIG_CNTL); + OUTREG(R128_CONFIG_CNTL, config_cntl & + ~(APER_0_BIG_ENDIAN_16BPP_SWAP|APER_0_BIG_ENDIAN_32BPP_SWAP)); +#endif + R128CopyData420(info, buf + s1offset, buf + s2offset, buf + s3offset, + info->FB+d1offset, info->FB+d2offset, info->FB+d3offset, + srcPitch, srcPitch2, dstPitch, nlines, npixels); +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* restore byte swapping */ + OUTREG(R128_CONFIG_CNTL, config_cntl); +#endif + } break; case FOURCC_UYVY: case FOURCC_YUY2: @@ -870,7 +1014,7 @@ d3offset = 0; s1offset += (top * srcPitch) + left; nlines = ((yb + 0xffff) >> 16) - top; - R128CopyData422(buf + s1offset, info->FB + d1offset, + R128CopyData422(info, buf + s1offset, info->FB + d1offset, srcPitch, dstPitch, nlines, npixels); break; } @@ -919,8 +1063,8 @@ ){ int size, tmp; - if(*w > 2048) *w = 2048; - if(*h > 2048) *h = 2048; + if(*w > MAXWIDTH) *w = MAXWIDTH; + if(*h > MAXHEIGHT) *h = MAXHEIGHT; *w = (*w + 1) & ~1; if(offsets) offsets[0] = 0; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.19 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.19 Fri May 4 15:05:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h Wed Nov 14 11:50:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.19 2001/05/04 19:05:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.24 2001/11/14 16:50:44 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -47,6 +47,9 @@ #include "xaa.h" #include "xf86Cursor.h" + /* DDC support */ +#include "xf86DDC.h" + /* Xv support */ #include "xf86xv.h" @@ -113,6 +116,7 @@ CARD32 cap0_trig_cntl; CARD32 cap1_trig_cntl; CARD32 bus_cntl; + CARD32 surface_cntl; /* Other registers to save for VT switches */ CARD32 dp_datatype; @@ -136,6 +140,15 @@ /* CRTC2 registers */ CARD32 crtc2_gen_cntl; + CARD32 dac2_cntl; + CARD32 disp_output_cntl; + CARD32 crtc2_h_total_disp; + CARD32 crtc2_h_sync_strt_wid; + CARD32 crtc2_v_total_disp; + CARD32 crtc2_v_sync_strt_wid; + CARD32 crtc2_offset; + CARD32 crtc2_offset_cntl; + CARD32 crtc2_pitch; /* Flat panel registers */ CARD32 fp_crtc_h_total_disp; CARD32 fp_crtc_v_total_disp; @@ -146,6 +159,7 @@ CARD32 fp_v_sync_strt_wid; CARD32 fp_vert_stretch; CARD32 lvds_gen_cntl; + CARD32 lvds_pll_cntl; CARD32 tmds_crc; /* Computed values for PLL */ @@ -159,6 +173,17 @@ CARD32 ppll_div_3; CARD32 htotal_cntl; + /* Computed values for PLL2 */ + CARD32 dot_clock_freq_2; + CARD32 pll_output_freq_2; + int feedback_div_2; + int post_div_2; + + /* PLL2 registers */ + CARD32 p2pll_ref_div; + CARD32 p2pll_div_0; + CARD32 htotal_cntl2; + /* DDA register */ CARD32 dda_config; CARD32 dda_on_off; @@ -166,6 +191,7 @@ /* Pallet */ Bool palette_valid; CARD32 palette[256]; + CARD32 palette2[256]; } RADEONSaveRec, *RADEONSavePtr; typedef struct { @@ -185,6 +211,34 @@ DisplayModePtr mode; } RADEONFBLayout; +typedef enum +{ + MT_NONE, + MT_CRT, + MT_LCD, + MT_DFP, + MT_CTV, + MT_STV +}RADEONMonitorType; + +typedef enum +{ + DDC_NONE_DETECTED, + DDC_MONID, + DDC_DVI, + DDC_VGA, + DDC_CRT2 +}RADEONDDCType; + +typedef enum +{ + CONNECTOR_NONE, + CONNECTOR_PROPRIETARY, + CONNECTOR_CRT, + CONNECTOR_DVI_I, + CONNECTOR_DVI_D +}RADEONConnectorType; + typedef struct { EntityInfoPtr pEnt; pciVideoPtr PciInfo; @@ -207,16 +261,39 @@ unsigned long FbMapSize; /* Size of frame buffer, in bytes */ int Flags; /* Saved copy of mode flags */ -#ifdef ENABLE_FLAT_PANEL - Bool HasPanelRegs; /* Current chip can connect to a FP */ - Bool CRTOnly; /* Only use External CRT instead of FP */ + /****** Added for VE/M6 support *******************/ + RADEONMonitorType DisplayType; /* Monitor connected on*/ + RADEONDDCType DDCType; + RADEONConnectorType ConnectorType; + BOOL HasCRTC2; /* VE/M6/M7 */ + BOOL IsR200; /* R200 chip */ + BOOL IsRV200; /* RV200 chip */ + BOOL IsSecondary; /* second Screen */ + BOOL UseCRT; /* force use CRT port as primary */ + BOOL IsM6; /* M6 card, for some workarounds */ + BOOL SwitchingMode; int FPBIOSstart; /* Start of the flat panel info */ - /* Computed values for FPs */ + /* EDID or BIOS values for FPs */ int PanelXRes; int PanelYRes; + int HOverPlus; + int HSyncWidth; + int HBlank; + int VOverPlus; + int VSyncWidth; + int VBlank; int PanelPwrDly; -#endif + int DotClock; + /****************************************************/ + + /*for getting EDID data using DDC interface*/ + BOOL ddc_bios; + BOOL ddc1; + BOOL ddc2; + I2CBusPtr pI2CBus; + CARD32 DDCReg; + BOOL HasEDID; RADEONPLLRec pll; RADEONRAMPtr ram; @@ -235,6 +312,12 @@ unsigned long cursor_start; unsigned long cursor_end; + /* + * XAAForceTransBlit is used to change the behavior of the XAA + * SetupForScreenToScreenCopy function, to make it DGA-friendly. + */ + Bool XAAForceTransBlit; + int fifo_slots; /* Free slots in the FIFO (64 max) */ int pix24bpp; /* Depth of pixmap for 24bpp framebuffer */ Bool dac6bits; /* Use 6 bit DAC? */ @@ -263,6 +346,7 @@ int numDGAModes; Bool DGAactive; int DGAViewportStatus; + DGAFunctionRec DGAFuncs; RADEONFBLayout CurrentLayout; #ifdef XF86DRI Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.14 Wed May 2 11:06:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c Sat Nov 24 09:38:19 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.14 2001/05/02 15:06:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.23 2001/11/24 14:38:19 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -72,7 +72,9 @@ /* Driver data structures */ #include "radeon.h" +#include "radeon_probe.h" #include "radeon_reg.h" +#include "radeon_version.h" #ifdef XF86DRI #define _XF86DRI_SERVER_ #include "radeon_dri.h" @@ -107,6 +109,8 @@ { RADEON_ROP3_ONE, RADEON_ROP3_ONE } /* GXset */ }; +extern int gRADEONEntityIndex; + /* The FIFO has 64 slots. This routines waits until at least `entries' of these slots are empty. */ void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries) @@ -232,6 +236,7 @@ CARD32 clock_cntl_index; CARD32 mclk_cntl; CARD32 rbbm_soft_reset; + CARD32 host_path_cntl; RADEONEngineFlush(pScrn); @@ -246,6 +251,11 @@ RADEON_FORCEON_MC | RADEON_FORCEON_AIC)); + /*Soft resetting HDP thru RBBM_SOFT_RESET register can + cause some unexpected behaviour on some machines. + Here we use RADEON_HOST_PATH_CNTL to reset it.*/ + host_path_cntl = INREG(RADEON_HOST_PATH_CNTL); + rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset | @@ -255,8 +265,7 @@ RADEON_SOFT_RESET_RE | RADEON_SOFT_RESET_PP | RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB | - RADEON_SOFT_RESET_HDP); + RADEON_SOFT_RESET_RB ); INREG(RADEON_RBBM_SOFT_RESET); OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset & (CARD32) ~(RADEON_SOFT_RESET_CP | @@ -265,13 +274,18 @@ RADEON_SOFT_RESET_RE | RADEON_SOFT_RESET_PP | RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB | - RADEON_SOFT_RESET_HDP)); + RADEON_SOFT_RESET_RB )); INREG(RADEON_RBBM_SOFT_RESET); - OUTPLL(RADEON_MCLK_CNTL, mclk_cntl); - OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); + OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl | RADEON_HDP_SOFT_RESET); + INREG(RADEON_HOST_PATH_CNTL); + OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl); + OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); + + OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); + OUTPLL(RADEON_MCLK_CNTL, mclk_cntl); + } /* Restore the acceleration hardware to its previous state. */ @@ -303,6 +317,9 @@ OUTREGP(RADEON_DP_DATATYPE, 0, ~RADEON_HOST_BIG_ENDIAN_EN); #endif + /* restore SURFACE_CNTL */ + OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl); + RADEONWaitForFifo(pScrn, 1); OUTREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX | RADEON_DEFAULT_SC_BOTTOM_MAX)); @@ -323,6 +340,64 @@ RADEONWaitForIdle(pScrn); } +/* This callback is required for multiheader cards using XAA */ +static +void RADEONRestoreAccelState(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 pitch64; + RADEONEntPtr pRADEONEnt; + DevUnion* pPriv; + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + if(pRADEONEnt->IsDRIEnabled) + { + /*not working yet*/ + /* + RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + RADEONCP_TO_MMIO(pRADEONEnt->pPrimaryScrn, info0); + */ + } + pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6; + + OUTREG(RADEON_DEFAULT_OFFSET, (pScrn->fbOffset>>10) | + (pitch64 << 22)); + + /* FIXME: May need to restore other things, + like BKGD_CLK FG_CLK...*/ + + RADEONWaitForIdle(pScrn); + +} + +/* This callback is required for multiheader cards using XAA */ +#ifdef XF86DRI +static +void RADEONRestoreCPAccelState(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + /*xf86DrvMsg(pScrn->scrnIndex, X_INFO, "===>RestoreCP\n");*/ + + RADEONWaitForFifo(pScrn, 1); + OUTREG( RADEON_DEFAULT_OFFSET, info->frontPitchOffset); + + RADEONWaitForIdle(pScrn); + + /*Not working yet*/ + /* + RADEONMMIO_TO_CP(pScrn, info); + */ + + /* FIXME: May need to restore other things, + like BKGD_CLK FG_CLK...*/ + +} +#endif + /* Initialize the acceleration hardware. */ static void RADEONEngineInit(ScrnInfoPtr pScrn) { @@ -334,6 +409,15 @@ info->CurrentLayout.bitsPerPixel)); OUTREG(RADEON_RB3D_CNTL, 0); +#if defined(__powerpc__) +#if defined(XF86_DRI) + if(!info->directRenderinEnabled) +#endif + { + OUTREG(RADEON_MC_FB_LOCATION, 0xffff0000); + OUTREG(RADEON_MC_AGP_LOCATION, 0xfffff000); + } +#endif RADEONEngineReset(pScrn); switch (info->CurrentLayout.pixel_code) { @@ -407,6 +491,47 @@ } /* Setup for XAA solid lines. */ + +/* unlike r128, Radeon don't have the Last-Pel controlling bit in DP_CNTL_XDIR_YDIR_YMAJOR + for line drawing, so we have to do it using our own extrapolation routine*/ +static void LastLinePel(int *X1, int *Y1, int *X2, int *Y2) +{ + int tg, deltax, deltay; + int xa = *X1, ya = *Y1, xb = *X2, yb = *Y2; + + deltax = xb - xa; + deltay = yb - ya; + + if(deltax == 0) + tg = 40; + else + tg = labs((deltay<<4) / deltax); + + if((tg >= 7) && (tg <= 39)) + { + if(deltax > 0)xb++; + else xb--; + if(deltay > 0)yb++; + else yb--; + } + else + { + if(labs(deltax) > labs(deltay)) + { + if(deltax > 0) xb++; + else xb--; + } + else + { + if(deltay > 0) yb++; + else yb--; + } + + } +} + + +/* Setup for XAA solid lines. */ static void RADEONSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { @@ -436,17 +561,14 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int direction = 0; - if (xa < xb) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT; - if (ya < yb) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM; - - RADEONWaitForFifo(pScrn, 4); - OUTREG(RADEON_DST_Y_X, (ya << 16) | xa); if (!(flags & OMIT_LAST)) - OUTREG(RADEON_DP_CNTL_XDIR_YDIR_YMAJOR, direction); + LastLinePel(&xa, &ya, &xb, &yb); + + RADEONWaitForFifo(pScrn, 2); OUTREG(RADEON_DST_LINE_START, (ya << 16) | xa); OUTREG(RADEON_DST_LINE_END, (yb << 16) | xb); + } /* Subsequent XAA solid horizontal and vertical lines */ @@ -512,17 +634,13 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int direction = 0; - - if (xa < xb) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT; - if (ya < yb) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM; - RADEONWaitForFifo(pScrn, 5); + RADEONWaitForFifo(pScrn, 3); if (!(flags & OMIT_LAST)) - OUTREG(RADEON_DP_CNTL_XDIR_YDIR_YMAJOR, direction); - OUTREG(RADEON_DST_Y_X, (ya << 16) | xa); - OUTREG(RADEON_BRUSH_Y_X, (phase << 16) | phase); + LastLinePel(&xa, &ya, &xb, &yb); + OUTREG(RADEON_DST_LINE_START, (ya << 16) | xa); + OUTREG(RADEON_DST_LINE_PATCOUNT, phase); OUTREG(RADEON_DST_LINE_END, (yb << 16) | xb); } @@ -554,7 +672,7 @@ ? RADEON_DST_Y_TOP_TO_BOTTOM : 0))); - if (trans_color != -1) { + if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { /* Set up for transparency */ RADEONWaitForFifo(pScrn, 3); OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color); @@ -915,7 +1033,63 @@ } } +static void RADEONSetClippingRectangle(ScrnInfoPtr pScrn, + int xa, int ya, int xb, int yb) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + unsigned long tmp = 0; + + if(xa < 0) + { + tmp = -xa; + tmp |= RADEON_SC_SIGN_MASK_LO; + } + else tmp = xa; + + if(ya < 0) + { + tmp |= ((-ya) << 16); + tmp |= RADEON_SC_SIGN_MASK_HI; + } + else tmp |= (ya << 16); + + OUTREG(RADEON_SC_TOP_LEFT, tmp); + + if(xb < 0) + { + tmp = -xb; + tmp |= RADEON_SC_SIGN_MASK_LO; + } + else tmp = xb; + + if(yb < 0) + { + tmp |= ((-yb) << 16); + tmp |= RADEON_SC_SIGN_MASK_HI; + } + else tmp |= (yb << 16); + OUTREG(RADEON_SC_BOTTOM_RIGHT, tmp); + + OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl | RADEON_GMC_DST_CLIPPING)); +} + +static void +RADEONDisableClipping(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl & ~(CARD32)RADEON_GMC_DST_CLIPPING)); + + OUTREG(RADEON_SC_TOP_LEFT, 0); + OUTREG(RADEON_SC_BOTTOM_RIGHT, INREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT)); + +} + + + /* ================================================================ * CP-based 2D acceleration */ @@ -999,7 +1173,7 @@ ADVANCE_RING(); - if ( trans_color != -1 ) { + if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { BEGIN_RING( 6 ); OUT_RING_REG( RADEON_CLR_CMP_CLR_SRC, trans_color ); @@ -1037,6 +1211,208 @@ ADVANCE_RING(); } +/* Setup for XAA solid lines. */ +static void RADEONCPSetupForSolidLine(ScrnInfoPtr pScrn, + int color, int rop, unsigned int planemask) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + RING_LOCALS; + BEGIN_RING( 6 ); + 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); + + ADVANCE_RING(); + +} + + +/* Subsequent XAA solid TwoPointLine line. + + Tests: xtest CH06/drwln, ico, Mark Vojkovich's linetest program + + [See http://www.xfree86.org/devel/archives/devel/1999-Jun/0102.shtml for + Mark Vojkovich's linetest program, posted 2Jun99 to devel@xfree86.org.] +*/ +static void RADEONCPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, + int xa, int ya, int xb, int yb, + int flags) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + RING_LOCALS; + BEGIN_RING( 4 ); + + if (!(flags & OMIT_LAST)) + { + LastLinePel(&xa, &ya, &xb, &yb); + } + + OUT_RING_REG(RADEON_DST_LINE_START, (ya << 16) | xa); + OUT_RING_REG(RADEON_DST_LINE_END, (yb << 16) | xb); + + ADVANCE_RING(); + +} + +/* Subsequent XAA solid horizontal and vertical lines */ +static void RADEONCPSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, + int x, int y, int len, int dir ) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + RING_LOCALS; + BEGIN_RING( 6 ); + + OUT_RING_REG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT + | RADEON_DST_Y_TOP_TO_BOTTOM)); + + if (dir == DEGREES_0) + { + OUT_RING_REG( RADEON_DST_Y_X, (y << 16) | x ); + OUT_RING_REG( RADEON_DST_WIDTH_HEIGHT, (len << 16) | 1 ); + } + else + { + OUT_RING_REG( RADEON_DST_Y_X, (y << 16) | x ); + OUT_RING_REG( RADEON_DST_WIDTH_HEIGHT, (1 << 16) | len ); + } + ADVANCE_RING(); +} + + +/* Setup for XAA dashed lines. + + Tests: xtest CH05/stdshs, XFree86/drwln + + NOTE: Since we can only accelerate lines with power-of-2 patterns of + length <= 32. +*/ +static void RADEONCPSetupForDashedLine(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, unsigned int planemask, + int length, unsigned char *pattern) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + CARD32 pat = *(CARD32 *)(pointer)pattern; + + RING_LOCALS; + + switch (length) { + case 2: pat |= pat << 2; /* fall through */ + case 4: pat |= pat << 4; /* fall through */ + case 8: pat |= pat << 8; /* fall through */ + case 16: pat |= pat << 16; + } + + BEGIN_RING( 12 ); + OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl + | (bg == -1 + ? RADEON_GMC_BRUSH_32x1_MONO_FG_LA + : RADEON_GMC_BRUSH_32x1_MONO_FG_BG) + | RADEON_ROP[rop].pattern + | RADEON_GMC_BYTE_LSB_TO_MSB)); + OUT_RING_REG(RADEON_DP_WRITE_MASK, planemask); + OUT_RING_REG(RADEON_DP_BRUSH_FRGD_CLR, fg); + if(bg != -1) OUT_RING_REG(RADEON_DP_BRUSH_BKGD_CLR, bg); + OUT_RING_REG(RADEON_BRUSH_DATA0, pat); + ADVANCE_RING(); + +} + +/* Subsequent XAA dashed line. */ +static void RADEONCPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, + int xa, int ya, + int xb, int yb, + int flags, + int phase) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + RING_LOCALS; + + if (!(flags & OMIT_LAST)) + { + LastLinePel(&xa, &ya, &xb, &yb); + } + + BEGIN_RING(6); + OUT_RING_REG(RADEON_DST_LINE_START, (ya << 16) | xa); + OUT_RING_REG(RADEON_DST_LINE_PATCOUNT, phase); + OUT_RING_REG(RADEON_DST_LINE_END, (yb << 16) | xb); + ADVANCE_RING(); +} + + +static void RADEONCPSetClippingRectangle(ScrnInfoPtr pScrn, + int xa, int ya, int xb, int yb) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned long tmp1 = 0, tmp2 = 0; + + if(xa < 0) + { + tmp1 = -xa; + tmp1 |= RADEON_SC_SIGN_MASK_LO; + } + else tmp1 = xa; + + if(ya < 0) + { + tmp1 |= ((-ya) << 16); + tmp1 |= RADEON_SC_SIGN_MASK_HI; + } + else tmp1 |= (ya << 16); + + if(xb < 0) + { + tmp2 = -xb; + tmp2 |= RADEON_SC_SIGN_MASK_LO; + } + else tmp2 = xb; + + if(yb < 0) + { + tmp2 |= ((-yb) << 16); + tmp2 |= RADEON_SC_SIGN_MASK_HI; + } + else tmp2 |= (yb << 16); + + { + + RING_LOCALS; + BEGIN_RING( 3 ); + OUT_RING_REG(RADEON_SC_TOP_LEFT, tmp1); + OUT_RING_REG(RADEON_SC_BOTTOM_RIGHT, tmp2); + OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, + (info->dp_gui_master_cntl | RADEON_GMC_DST_CLIPPING)); + + ADVANCE_RING(); + } +} + +static void +RADEONCPDisableClipping(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + /* unsigned char *RADEONMMIO = info->MMIO;*/ + RING_LOCALS; + BEGIN_RING( 3 ); + OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, + (info->dp_gui_master_cntl & ~(CARD32)(RADEON_GMC_DST_CLIPPING))); + OUT_RING_REG(RADEON_SC_TOP_LEFT, 0); + OUT_RING_REG(RADEON_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX + | RADEON_DEFAULT_SC_BOTTOM_MAX)); + + 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. @@ -1200,6 +1576,35 @@ a->ScreenToScreenCopyFlags = 0; a->SetupForScreenToScreenCopy = RADEONCPSetupForScreenToScreenCopy; a->SubsequentScreenToScreenCopy = RADEONCPSubsequentScreenToScreenCopy; + + + a->SetupForDashedLine = RADEONCPSetupForDashedLine; + a->SubsequentDashedTwoPointLine = RADEONCPSubsequentDashedTwoPointLine; + a->DashPatternMaxLength = 32; + /*ROP3 doesn't seem to work properly for dashedline with GXinvert*/ + a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED + | LINE_PATTERN_POWER_OF_2_ONLY + | ROP_NEEDS_SOURCE); + + + a->SolidLineFlags = 0; + a->SetupForSolidLine = RADEONCPSetupForSolidLine; + a->SubsequentSolidTwoPointLine = RADEONCPSubsequentSolidTwoPointLine; + a->SubsequentSolidHorVertLine = RADEONCPSubsequentSolidHorVertLine; + a->SubsequentSolidBresenhamLine = NULL; + + /* clipping */ + a->SetClippingRectangle = RADEONCPSetClippingRectangle; + a->DisableClipping = RADEONCPDisableClipping; + a->ClippingFlags = HARDWARE_CLIP_SOLID_LINE | + HARDWARE_CLIP_DASHED_LINE | + /*HARDWARE_CLIP_SOLID_FILL |*/ /* seems very slow with this on ???*/ + HARDWARE_CLIP_MONO_8x8_FILL | + HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY; + + if(!info->IsSecondary && xf86IsEntityShared(pScrn->entityList[0])) + a->RestoreAccelState = RADEONRestoreCPAccelState; + } #endif @@ -1268,9 +1673,37 @@ a->SetupForDashedLine = RADEONSetupForDashedLine; a->SubsequentDashedTwoPointLine = RADEONSubsequentDashedTwoPointLine; a->DashPatternMaxLength = 32; + /*ROP3 doesn't seem to work properly for dashedline with GXinvert*/ a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED - | LINE_PATTERN_POWER_OF_2_ONLY); + | LINE_PATTERN_POWER_OF_2_ONLY + | ROP_NEEDS_SOURCE); + /* clipping, note without this, + all line accelerations will not be called */ + a->SetClippingRectangle = RADEONSetClippingRectangle; + a->DisableClipping = RADEONDisableClipping; + a->ClippingFlags = HARDWARE_CLIP_SOLID_LINE | + HARDWARE_CLIP_DASHED_LINE | + /*HARDWARE_CLIP_SOLID_FILL |*/ /* seems very slow with this on ???*/ + HARDWARE_CLIP_MONO_8x8_FILL | + HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY; + + + if(xf86IsEntityShared(pScrn->entityList[0])) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + + /*if there are more than one devices sharing this entity, we + have to assign this call back, otherwise the XAA will be + disabled */ + if(pRADEONEnt->HasSecondary || pRADEONEnt->BypassSecondary) + a->RestoreAccelState = RADEONRestoreAccelState; + } + /* ImageWrite */ a->NumScanlineImageWriteBuffers = 1; a->ScanlineImageWriteBuffers = info->scratch_buffer; @@ -1310,9 +1743,13 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); XAAInfoRecPtr a; - - if (!(a = info->accel = XAACreateInfoRec())) return FALSE; + if (!(a = info->accel = XAACreateInfoRec())) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "XAACreateInfoRec Error\n"); + return FALSE; + } #ifdef XF86DRI if (info->directRenderingEnabled) RADEONCPAccelInit(pScrn, a); @@ -1321,5 +1758,12 @@ RADEONMMIOAccelInit(pScrn, a); RADEONEngineInit(pScrn); - return XAAInit(pScreen, a); + + if(!XAAInit(pScreen, a)) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "XAAInit Error\n"); + return FALSE; + } + return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.5 Sat Mar 3 17:26:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c Fri Nov 23 14:50:45 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.5 2001/03/03 22:26:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.9 2001/11/23 19:50:45 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -72,10 +72,19 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + if(info->IsSecondary) + { + OUTREG(RADEON_CUR2_CLR0, bg); + OUTREG(RADEON_CUR2_CLR1, fg); + } + else + { OUTREG(RADEON_CUR_CLR0, bg); OUTREG(RADEON_CUR_CLR1, fg); + } } + /* Set cursor position to (x,y) with offset into cursor bitmap at (xorigin,yorigin). */ static void RADEONSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) @@ -94,13 +103,38 @@ if (xorigin >= cursor->MaxWidth) xorigin = cursor->MaxWidth - 1; if (yorigin >= cursor->MaxHeight) yorigin = cursor->MaxHeight - 1; - OUTREG(RADEON_CUR_HORZ_VERT_OFF, (RADEON_CUR_LOCK +#if 0 + /* This test is NOT needed, and is the cause of jerky behavior + * as the mouse approaches the left edge of the screen, especially + * at high acceleration. + * + * Nowhere below is x (or y) used when they are negative! + */ + if(x >= 0) +#endif + { + if(!info->IsSecondary) + { + OUTREG(RADEON_CUR_HORZ_VERT_OFF, (RADEON_CUR_LOCK + | (xorigin << 16) + | yorigin)); + OUTREG(RADEON_CUR_HORZ_VERT_POSN, (RADEON_CUR_LOCK + | ((xorigin ? 0 : x) << 16) + | (yorigin ? 0 : y))); + OUTREG(RADEON_CUR_OFFSET, info->cursor_start + yorigin * 16); + } + else + { + OUTREG(RADEON_CUR2_HORZ_VERT_OFF, (RADEON_CUR2_LOCK | (xorigin << 16) | yorigin)); - OUTREG(RADEON_CUR_HORZ_VERT_POSN, (RADEON_CUR_LOCK + OUTREG(RADEON_CUR2_HORZ_VERT_POSN, (RADEON_CUR2_LOCK | ((xorigin ? 0 : x) << 16) | (yorigin ? 0 : y))); - OUTREG(RADEON_CUR_OFFSET, info->cursor_start + yorigin * 16); + OUTREG(RADEON_CUR2_OFFSET, + info->cursor_start + pScrn->fbOffset + yorigin * 16); + } + } } /* Copy cursor image from `image' to video memory. RADEONSetCursorPosition @@ -114,8 +148,16 @@ int y; CARD32 save; + if(!info->IsSecondary) + { save = INREG(RADEON_CRTC_GEN_CNTL); - OUTREG(RADEON_CRTC_GEN_CNTL, save & (CARD32)~RADEON_CRTC_CUR_EN); + OUTREG(RADEON_CRTC_GEN_CNTL, save & (CARD32)~RADEON_CRTC_CUR_EN); + } + else + { + save = INREG(RADEON_CRTC2_GEN_CNTL); + OUTREG(RADEON_CRTC2_GEN_CNTL, save & (CARD32)~RADEON_CRTC2_CUR_EN); + } #if X_BYTE_ORDER == X_BIG_ENDIAN switch(info->CurrentLayout.pixel_bytes) { @@ -170,7 +212,11 @@ *d++ = 0x00000000; } + if(!info->IsSecondary) OUTREG(RADEON_CRTC_GEN_CNTL, save); + else + OUTREG(RADEON_CRTC2_GEN_CNTL, save); + } /* Hide hardware cursor. */ @@ -179,7 +225,11 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + if(info->IsSecondary) + OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~RADEON_CRTC2_CUR_EN); + else OUTREGP(RADEON_CRTC_GEN_CNTL, 0, ~RADEON_CRTC_CUR_EN); + } /* Show hardware cursor. */ @@ -188,7 +238,16 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - OUTREGP(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_CUR_EN, ~RADEON_CRTC_CUR_EN); + if(info->IsSecondary) + { + OUTREGP(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_CUR_EN, + ~RADEON_CRTC2_CUR_EN); + } + else + { + OUTREGP(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_CUR_EN, + ~RADEON_CRTC_CUR_EN); + } } /* Determine if hardware cursor is in use. */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c:1.5 Tue Nov 21 18:10:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c Tue Dec 4 12:30:46 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c,v 1.5 2000/11/21 23:10:35 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c,v 1.8 2001/12/04 17:30:46 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -57,29 +57,10 @@ static void RADEON_SetViewport(ScrnInfoPtr, int, int, int); static void RADEON_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void RADEON_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 static void RADEON_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); -#endif -static -DGAFunctionRec RADEON_DGAFuncs = { - RADEON_OpenFramebuffer, - NULL, - RADEON_SetMode, - RADEON_SetViewport, - RADEON_GetViewport, - RADEONWaitForIdle, - RADEON_FillRect, - RADEON_BlitRect, -#if 0 - RADEON_BlitTransRect -#else - NULL -#endif -}; - static DGAModePtr RADEONSetupDGAMode(ScrnInfoPtr pScrn, DGAModePtr modes, int *num, @@ -95,64 +76,68 @@ RADEONInfoPtr info = RADEONPTR(pScrn); DGAModePtr newmodes = NULL, currentMode; DisplayModePtr pMode, firstMode; - int otherPitch, Bpp = bitsPerPixel >> 3; - Bool oneMore; - - pMode = firstMode = pScrn->modes; - - 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; + unsigned int size; + int pitch, Bpp = bitsPerPixel >> 3; SECOND_PASS: - currentMode = modes + *num; - (*num)++; + pMode = firstMode = pScrn->modes; - currentMode->mode = pMode; - /* FIXME: is concurrent access really possible? */ - currentMode->flags = DGA_CONCURRENT_ACCESS; - if (pixmap) - currentMode->flags |= DGA_PIXMAP_AVAILABLE; - if (info->accel) - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; - if (pMode->Flags & V_DBLSCAN) - currentMode->flags |= DGA_DOUBLESCAN; - if (pMode->Flags & V_INTERLACE) - currentMode->flags |= DGA_INTERLACED; - currentMode->byteOrder = pScrn->imageByteOrder; - currentMode->depth = depth; - currentMode->bitsPerPixel = bitsPerPixel; - currentMode->red_mask = red; - currentMode->green_mask = green; - currentMode->blue_mask = blue; - currentMode->visualClass = visualClass; - currentMode->viewportWidth = pMode->HDisplay; - currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = 8; - currentMode->yViewportStep = 1; - currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = 0; - currentMode->address = (unsigned char*)info->LinearAddr; - - if (oneMore) { /* first one is narrow width */ - currentMode->bytesPerScanline = (((pMode->HDisplay * Bpp) + 3) - & ~3L); - currentMode->imageWidth = pMode->HDisplay; - currentMode->imageHeight = pMode->VDisplay; + while (1) { + pitch = pScrn->displayWidth; + size = pitch * Bpp * pMode->VDisplay; + + if ((!secondPitch || (pitch != secondPitch)) && + (size <= info->FbMapSize)) { + + if (secondPitch) + pitch = secondPitch; + + if (!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)))) + break; + + modes = newmodes; + currentMode = modes + *num; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS; + + if (pixmap) + currentMode->flags |= DGA_PIXMAP_AVAILABLE; + + if (info->accel) { + if (info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + currentMode->flags |= DGA_FILL_RECT; + if (info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) + currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; + if (currentMode->flags & + (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT | + DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS)) + currentMode->flags &= ~DGA_CONCURRENT_ACCESS; + } + if (pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if (pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = depth; + currentMode->bitsPerPixel = bitsPerPixel; + currentMode->red_mask = red; + currentMode->green_mask = green; + currentMode->blue_mask = blue; + currentMode->visualClass = visualClass; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 8; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = (unsigned char*)info->LinearAddr; + currentMode->bytesPerScanline = pitch * Bpp; + currentMode->imageWidth = pitch; + currentMode->imageHeight = info->FbMapSize / currentMode->bytesPerScanline; currentMode->pixmapWidth = currentMode->imageWidth; currentMode->pixmapHeight = currentMode->imageHeight; currentMode->maxViewportX = currentMode->imageWidth - @@ -160,19 +145,7 @@ /* this might need to get clamped to some maximum */ currentMode->maxViewportY = (currentMode->imageHeight - currentMode->viewportHeight); - oneMore = FALSE; - goto SECOND_PASS; - } else { - currentMode->bytesPerScanline = ((otherPitch * Bpp) + 3) & ~3L; - currentMode->imageWidth = otherPitch; - 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); + (*num)++; } pMode = pMode->next; @@ -180,6 +153,11 @@ break; } + if (secondPitch) { + secondPitch = 0; + goto SECOND_PASS; + } + return modes; } @@ -239,7 +217,30 @@ info->numDGAModes = num; info->DGAModes = modes; - return DGAInit(pScreen, &RADEON_DGAFuncs, modes, num); + info->DGAFuncs.OpenFramebuffer = RADEON_OpenFramebuffer; + info->DGAFuncs.CloseFramebuffer = NULL; + info->DGAFuncs.SetMode = RADEON_SetMode; + info->DGAFuncs.SetViewport = RADEON_SetViewport; + info->DGAFuncs.GetViewport = RADEON_GetViewport; + + info->DGAFuncs.Sync = NULL; + info->DGAFuncs.FillRect = NULL; + info->DGAFuncs.BlitRect = NULL; + info->DGAFuncs.BlitTransRect = NULL; + + if (info->accel) { + info->DGAFuncs.Sync = RADEONWaitForIdle; + if (info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + info->DGAFuncs.FillRect = RADEON_FillRect; + if (info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) { + info->DGAFuncs.BlitRect = RADEON_BlitRect; + info->DGAFuncs.BlitTransRect = RADEON_BlitTransRect; + } + } + + return DGAInit(pScreen, &info->DGAFuncs, modes, num); } static Bool RADEON_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) @@ -303,11 +304,11 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); - if (info->accel) { - (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); - (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); + (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); + (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); + + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) SET_SYNC_FLAG(info->accel); - } } static void RADEON_BlitRect(ScrnInfoPtr pScrn, @@ -315,28 +316,39 @@ int dstx, int dsty) { RADEONInfoPtr info = RADEONPTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; - if (info->accel) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; + (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, + GXcopy, (CARD32)(~0), -1); + (*info->accel->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, + dstx, dsty, w, h); - (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, - GXcopy, (CARD32)(~0), -1); - (*info->accel->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, - dstx, dsty, w, h); + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) SET_SYNC_FLAG(info->accel); - } } -#if 0 static void RADEON_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long color) { - /* this one should be separate since the XAA function would prohibit - usage of ~0 as the key */ + RADEONInfoPtr info = RADEONPTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + info->XAAForceTransBlit = TRUE; + + (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, + GXcopy, (CARD32)(~0), color); + + info->XAAForceTransBlit = FALSE; + + (*info->accel->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, + dstx, dsty, w, h); + + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) + SET_SYNC_FLAG(info->accel); } -#endif static Bool RADEON_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c:1.13 Wed May 2 11:06:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c Mon Oct 1 09:44:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.13 2001/05/02 15:06:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.14 2001/10/01 13:44:03 eich Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -62,6 +62,8 @@ /* ?? Alpha - this may need to be a variable to handle UP1x00 vs TITAN */ #if defined(__alpha__) # define DRM_PAGE_SIZE 8192 +#elif defined(__ia64__) +# define DRM_PAGE_SIZE getpagesize() #else # define DRM_PAGE_SIZE 4096 #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.25.2.2 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c:1.50 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c:1.25.2.2 Thu May 31 04:36:15 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c Tue Jan 15 21:00:43 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.25.2.2 2001/05/31 08:36:15 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.50 2002/01/16 02:00:43 martin Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -114,8 +114,6 @@ static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -static Bool RADEONEnterVTFBDev(int scrnIndex, int flags); -static void RADEONLeaveVTFBDev(int scrnIndex, int flags); typedef enum { OPTION_NOACCEL, @@ -133,15 +131,8 @@ OPTION_BUFFER_SIZE, OPTION_DEPTH_MOVE, #endif -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ -#if 0 - /* FIXME: Disable CRTOnly until it is tested */ - OPTION_CRT, -#endif - OPTION_PANEL_WIDTH, - OPTION_PANEL_HEIGHT, -#endif + OPTION_CRT_SCREEN, + OPTION_PANEL_SIZE, OPTION_FBDEV } RADEONOpts; @@ -159,16 +150,9 @@ { OPTION_RING_SIZE, "RingSize", OPTV_INTEGER, {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 */ -#if 0 - /* FIXME: Disable CRTOnly until it is tested */ - { OPTION_CRT, "CRTOnly", OPTV_BOOLEAN, {0}, FALSE }, -#endif - { OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE }, - { OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE }, #endif + { OPTION_CRT_SCREEN, "CrtScreen", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_PANEL_SIZE, "PanelSize", OPTV_ANYSTR, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -180,12 +164,14 @@ }; static const char *vgahwSymbols[] = { - "vgaHWGetHWRec", "vgaHWFreeHWRec", + "vgaHWGetHWRec", + "vgaHWGetIndex", "vgaHWLock", - "vgaHWUnlock", - "vgaHWSave", "vgaHWRestore", + "vgaHWSave", + "vgaHWUnlock", + "vgaHWGetIOBase", NULL }; @@ -193,26 +179,24 @@ "fbdevHWInit", "fbdevHWUseBuildinMode", - "fbdevHWGetDepth", "fbdevHWGetVidmem", /* colormap */ "fbdevHWLoadPalette", - /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", "fbdevHWModeInit", + "fbdevHWRestore", "fbdevHWSave", + "fbdevHWSwitchMode", + "fbdevHWValidMode", - "fbdevHWUnmapMMIO", - "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", + "fbdevHWUnmapMMIO", + "fbdevHWUnmapVidmem", NULL }; @@ -224,10 +208,10 @@ NULL }; -#ifdef XFree86LOADER #ifdef USE_FB static const char *fbSymbols[] = { "fbScreenInit", + "fbPictureInit", NULL }; #else @@ -242,25 +226,23 @@ #endif static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; +#if 0 static const char *xf8_32bppSymbols[] = { "xf86Overlay8Plus32Init", NULL }; +#endif static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; @@ -268,32 +250,46 @@ static const char *drmSymbols[] = { "drmAddBufs", "drmAddMap", - "drmAvailable", - "drmCtlAddCommand", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", - "drmMapBufs", - "drmMarkBufs", - "drmUnmapBufs", + "drmAgpAcquire", + "drmAgpAlloc", + "drmAgpBind", + "drmAgpDeviceId", + "drmAgpEnable", + "drmAgpFree", + "drmAgpGetMode", + "drmAgpRelease", + "drmAgpUnbind", + "drmAgpVendorId", + "drmDMA", "drmFreeVersion", "drmGetVersion", + "drmMap", + "drmMapBufs", + "drmRadeonCleanupCP", + "drmRadeonClear", + "drmRadeonFlushIndirectBuffer", + "drmRadeonInitCP", + "drmRadeonResetCP", + "drmRadeonStartCP", + "drmRadeonStopCP", + "drmRadeonWaitForIdleCP", + "drmScatterGatherFree" + "drmUnmap", + "drmUnmapBufs", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", - "DRILock", - "DRIUnlock", - "DRIGetSAREAPrivate", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", "DRIGetContext", + "DRIGetSAREAPrivate", + "DRILock", "DRIQueryVersion", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; @@ -304,8 +300,22 @@ "vbeDoEDID", NULL }; -#endif +static const char *int10Symbols[] = { + "xf86InitInt10", + "xf86FreeInt10", + "xf86int10Addr", + NULL +}; + +static const char *i2cSymbols[] = { + "xf86CreateI2CBusRec", + "xf86I2CBusInit", + NULL +}; + +extern int gRADEONEntityIndex; + #if !defined(__alpha__) # define RADEONPreInt10Save(s, r1, r2) # define RADEONPostInt10Check(s, r1, r2) @@ -515,9 +525,9 @@ unsigned char *RADEONMMIO = info->MMIO; #if !RADEON_ATOMIC_UPDATE - while ( (INREG8(RADEON_CLOCK_CNTL_INDEX) & 0x9f) != addr) { + while ( (INREG8(RADEON_CLOCK_CNTL_INDEX) & 0xbf) != addr) { #endif - OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x1f); + OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x3f); #if !RADEON_ATOMIC_UPDATE } #endif @@ -555,6 +565,15 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + if(!info->IsSecondary) + { + switch(info->DisplayType) + { + case MT_LCD: + OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, + ~RADEON_LVDS_DISPLAY_DIS); + case MT_CRT: + case MT_DFP: OUTREGP(RADEON_CRTC_EXT_CNTL, RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | @@ -562,6 +581,22 @@ ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS)); + break; + case MT_NONE: + default: + break; + } + } + else + { + OUTREGP(RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + } } /* Unblank screen. */ @@ -569,12 +604,91 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - - OUTREGP(RADEON_CRTC_EXT_CNTL, 0, + if(!info->IsSecondary) + { + switch(info->DisplayType) + { + case MT_LCD: + OUTREGP(RADEON_LVDS_GEN_CNTL, 0, + ~RADEON_LVDS_DISPLAY_DIS); + case MT_CRT: + case MT_DFP: + OUTREGP(RADEON_CRTC_EXT_CNTL, + RADEON_CRTC_CRT_ON, ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS)); + break; + case MT_NONE: + default: + break; + } + } + else + { + switch(info->DisplayType) + { + case MT_LCD: + case MT_DFP: + case MT_CRT: + OUTREGP(RADEON_CRTC2_GEN_CNTL, + 0, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + break; + case MT_NONE: + default: + break; + } + } +} + +/***Used to turn particular crtc or dac off + Not tested, comment out for now*/ +#if 0 +static void RADEONSetDisplayOff(ScrnInfoPtr pScrn, int crtc, int dac) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 tmp; + + if(crtc == 0) /* primary crtc*/ + { + tmp = INREG(RADEON_CRTC_EXT_CNTL); + tmp |= RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_SYNC_TRISTAT; + OUTREG(RADEON_CRTC_EXT_CNTL, tmp); + tmp &= ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_CRT_ON); + OUTREG(RADEON_CRTC_EXT_CNTL, tmp); + /*TODO update BIOS scratch register*/ + } + else /* secondary crtc*/ + { + tmp = INREG(RADEON_CRTC2_GEN_CNTL); + tmp |= RADEON_CRTC2_SYNC_TRISTAT | RADEON_CRTC2_DISP_DIS; + OUTREG(RADEON_CRTC2_GEN_CNTL, tmp); + tmp &= ~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_CRT2_ON); + OUTREG(RADEON_CRTC2_GEN_CNTL, tmp); + /*TODO update BIOS scratch register*/ + } + if(dac == 0) + { + tmp = INREG(RADEON_DAC_CNTL); + tmp |= RADEON_DAC_PDWN; + OUTREG(RADEON_DAC_CNTL, tmp); + } + else + { + tmp = INREG(RADEON_TV_DAC_CNTL); + if(RADEON_TV_DAC_STD_MASK & tmp) + { + tmp |= RADEON_TV_DAC_RDACPD | RADEON_TV_DAC_GDACPD + | RADEON_TV_DAC_BDACPD; + OUTREG(RADEON_TV_DAC_CNTL, tmp); + } + } } +#endif /* Compute log base 2 of val. */ int RADEONMinBits(int val) @@ -596,10 +710,8 @@ static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { RADEONInfoPtr info = RADEONPTR(pScrn); -#ifdef ENABLE_FLAT_PANEL - int i; - int FPHeader = 0; -#endif + unsigned long tmp, i; + unsigned char *RADEONMMIO; #define RADEON_BIOS8(v) (info->VBIOS[v]) #define RADEON_BIOS16(v) (info->VBIOS[v] | \ @@ -609,19 +721,25 @@ (info->VBIOS[(v) + 2] << 16) | \ (info->VBIOS[(v) + 3] << 24)) - if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) { + if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) + { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot allocate space for hold Video BIOS!\n"); return FALSE; } - if (pInt10) { + + if (pInt10) + { info->BIOSAddr = pInt10->BIOSseg << 4; (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), RADEON_VBIOS_SIZE); - } else { + } + else + { xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, RADEON_VBIOS_SIZE); - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) + { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Video BIOS not detected in PCI space!\n"); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -630,84 +748,196 @@ xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, RADEON_VBIOS_SIZE); } } - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) + { + xfree(info->VBIOS); + info->VBIOS = NULL; info->BIOSAddr = 0x00000000; xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Video BIOS not found!\n"); + return TRUE; } - -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) { - info->FPBIOSstart = 0; - - /* FIXME: There should be direct access to the start of the FP info - tables, but until we find out where that offset is stored, we - must search for the ATI signature string: "M3 ". */ - for (i = 4; i < RADEON_VBIOS_SIZE-8; i++) { - if (RADEON_BIOS8(i) == 'M' && - RADEON_BIOS8(i+1) == '3' && - RADEON_BIOS8(i+2) == ' ' && - RADEON_BIOS8(i+3) == ' ' && - RADEON_BIOS8(i+4) == ' ' && - RADEON_BIOS8(i+5) == ' ' && - RADEON_BIOS8(i+6) == ' ' && - RADEON_BIOS8(i+7) == ' ') { - FPHeader = i-2; - break; - } - } - if (!FPHeader) return TRUE; + info->FPBIOSstart = RADEON_BIOS16(0x48); - /* Assume that only one panel is attached and supported */ - for (i = FPHeader+20; i < FPHeader+84; i += 2) { - if (RADEON_BIOS16(i) != 0) { - info->FPBIOSstart = RADEON_BIOS16(i); - break; - } - } - if (!info->FPBIOSstart) return TRUE; - - if (!info->PanelXRes) - info->PanelXRes = RADEON_BIOS16(info->FPBIOSstart+25); - if (!info->PanelYRes) - info->PanelYRes = RADEON_BIOS16(info->FPBIOSstart+27); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n", - info->PanelXRes, info->PanelYRes); - - info->PanelPwrDly = RADEON_BIOS8(info->FPBIOSstart+56); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID: "); - for (i = 1; i <= 24; i++) - ErrorF("%c", RADEON_BIOS8(info->FPBIOSstart+i)); - ErrorF("\n"); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Type: "); - i = RADEON_BIOS16(info->FPBIOSstart+29); - if (i & 1) ErrorF("Color, "); - else ErrorF("Monochrome, "); - if (i & 2) ErrorF("Dual(split), "); - else ErrorF("Single, "); - switch ((i >> 2) & 0x3f) { - case 0: ErrorF("STN"); break; - case 1: ErrorF("TFT"); break; - case 2: ErrorF("Active STN"); break; - case 3: ErrorF("EL"); break; - case 4: ErrorF("Plasma"); break; - default: ErrorF("UNKNOWN"); break; - } - ErrorF("\n"); - if (RADEON_BIOS8(info->FPBIOSstart+61) & 1) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Interface: LVDS\n"); - } else { - /* FIXME: Add Non-LVDS flat pael support */ - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Non-LVDS panel interface detected! " - "This support is untested and may not " - "function properly\n"); - } + { + BOOL BypassSecondary = FALSE; + RADEONMapMMIO(pScrn); + RADEONMMIO = info->MMIO; + /*FIXME: using BIOS scratch registers to detect connected monitors + may not be a reliable way.... should use EDID data. + Also it only works with for VE/M6, no + such registers in regular RADEON!!!*/ + /***** + VE and M6 have both DVI and CRT ports (for M6 DVI port can be switch to + DFP port). The DVI port can also be conneted to a CRT with an adapter. + Here is the definition of ports for this driver--- + (1) If both port are connected, DVI port will be treated as the Primary + port (first screen in XF86Config, uses CRTC1) and CRT port will be + treated as the Secondary port (second screen in XF86Config, uses CRTC2) + (2) If only one screen specified in XF86Config, it will be used for DVI port + if a monitor is connected to DVI port, otherwise (only one monitor is + connected the CRT port) it will be used for CRT port. + *****/ + if(info->HasCRTC2) + { + /*FIXME: this may not be reliable*/ + tmp = INREG(RADEON_BIOS_4_SCRATCH); + if(info->IsSecondary) + { + /*check Port2 (CRT port, for the existing boards + (VE & M6),this port can only be connected to a CRT*/ + if(tmp & 0x02) info->DisplayType = MT_CRT; + else if(tmp & 0x800) info->DisplayType = MT_DFP; + else if(tmp & 0x400) info->DisplayType = MT_LCD; + else if(tmp & 0x1000) info->DisplayType = MT_CTV; + else if(tmp & 0x2000) info->DisplayType = MT_STV; + else info->DisplayType = MT_CRT; + + if(info->DisplayType > MT_NONE) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->HasSecondary = TRUE; + + } + else return FALSE; + + } + else + { + /*check Primary (DVI/DFP port)*/ + if(tmp & 0x08) info->DisplayType = MT_DFP; + else if(tmp & 0x04) info->DisplayType = MT_LCD; + else if(tmp & 0x0200) info->DisplayType = MT_CRT; + else if(tmp & 0x10) info->DisplayType = MT_CTV; + else if(tmp & 0x20) info->DisplayType = MT_STV; + else + { + /*DVI port has no monitor connected, try CRT port. + If something on CRT port, treat it as primary*/ + if(xf86IsEntityShared(pScrn->entityList[0])) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->BypassSecondary = TRUE; + } + + if(tmp & 0x02) info->DisplayType = MT_CRT; + else if(tmp & 0x800) info->DisplayType = MT_DFP; + else if(tmp & 0x400) info->DisplayType = MT_LCD; + else if(tmp & 0x1000) info->DisplayType = MT_CTV; + else if(tmp & 0x2000) info->DisplayType = MT_STV; + else + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No monitor detected!!!\n"); + return FALSE; + } + BypassSecondary = TRUE; + } + } + } + else + { + /*Regular Radeon ASIC, only one CRTC, but it could be + used for DFP with a DVI output, like AIW board*/ + tmp = INREG(RADEON_FP_GEN_CNTL); + if(tmp & RADEON_FP_EN_TMDS) info->DisplayType = MT_DFP; + else info->DisplayType = MT_CRT; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Display == Type %d\n", + (info->IsSecondary ? "Secondary" : "Primary"), + info->DisplayType); + + RADEONMMIO = NULL; + RADEONUnmapMMIO(pScrn); + + info->HBlank = 0; + info->HOverPlus = 0; + info->HSyncWidth = 0; + info->VBlank = 0; + info->VOverPlus = 0; + info->VSyncWidth = 0; + info->DotClock = 0; + + if(info->DisplayType == MT_LCD) { + tmp = RADEON_BIOS16(info->FPBIOSstart + 0x40); + if(!tmp) { + info->PanelPwrDly = 200; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Panel Info Table found in BIOS!\n"); + } else { + char stmp[30]; + int tmp0; + for(i=0; i<24; i++) + stmp[i] = RADEON_BIOS8(tmp+i+1); + stmp[24] = 0; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Panel ID string: %s\n", stmp); + info->PanelXRes = RADEON_BIOS16(tmp+25); + info->PanelYRes = RADEON_BIOS16(tmp+27); + xf86DrvMsg(0, X_INFO, "Panel Size from BIOS: %dx%d\n", + info->PanelXRes, info->PanelYRes); + info->PanelPwrDly = RADEON_BIOS16(tmp+44); + if(info->PanelPwrDly > 2000 || info->PanelPwrDly < 0) + info->PanelPwrDly = 2000; + for(i=0; i<20; i++) { + tmp0 = RADEON_BIOS16(tmp+64+i*2); + if(tmp0 == 0) break; + if((RADEON_BIOS16(tmp0) == info->PanelXRes) && + (RADEON_BIOS16(tmp0+2) == info->PanelYRes)) { + + info->HBlank = (RADEON_BIOS16(tmp0+17) - RADEON_BIOS16(tmp0+19)) * 8; + info->HOverPlus = (RADEON_BIOS16(tmp0+21) - RADEON_BIOS16(tmp0+19) - 1) * 8; + info->HSyncWidth = RADEON_BIOS8(tmp0+23) * 8; + info->VBlank = RADEON_BIOS16(tmp0+24) - RADEON_BIOS16(tmp0+26); + info->VOverPlus = (RADEON_BIOS16(tmp0+28) & 0x7ff) - RADEON_BIOS16(tmp0+26); + info->VSyncWidth = (RADEON_BIOS16(tmp0+28) & 0xf800) >> 11; + info->DotClock = RADEON_BIOS16(tmp0+9) * 10; + } + } + } + } + + /* Detect connector type from BIOS, used for + I2C/DDC qeurying EDID, Only available for VE or newer cards*/ + tmp = RADEON_BIOS16(info->FPBIOSstart + 0x50); + if(tmp) + { + for(i=1; i<4; i++) { + if(!RADEON_BIOS8(tmp + i*2) && i>1) break; + + /*Note: our Secondary port (CRT port) + actually uses primary DAC*/ + if(RADEON_BIOS16(tmp + i*2) & 0x01) { + if(!info->IsSecondary) { + info->DDCType = + (RADEON_BIOS16(tmp + i*2) & 0x0f00) >> 8; + break; + } + } else {/*Primary DAC*/ + + if(info->IsSecondary || BypassSecondary || !info->HasCRTC2) { + info->DDCType = + (RADEON_BIOS16(tmp + i*2) & 0x0f00) >> 8; + break; + } + } + } + } else { + /* orignal radeon cards, set it to DDC_VGA, + this will not work with AIW, it should be DDC_DVI, + let it fall back to VBE calls for AIW */ + info->DDCType = DDC_VGA; + } } -#endif return TRUE; } @@ -728,11 +958,15 @@ the card you are using. Specifically, reference freq can be 29.50MHz, 28.63MHz, or 14.32MHz. YMMV. */ - pll->reference_freq = 2950; - pll->reference_div = 65; + /* + * these are somewhat sane defaults for Mac boards, we will + * need to find a good way of getting these from OpenFirmware + */ + pll->reference_freq = 2700; + pll->reference_div = 67; pll->min_pll_freq = 12500; pll->max_pll_freq = 35000; - pll->xclk = 10300; + pll->xclk = 16615; } else { bios_header = RADEON_BIOS16(0x48); pll_info_block = RADEON_BIOS16(bios_header + 0x30); @@ -762,7 +996,7 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) + if(!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) return FALSE; switch (pScrn->depth) { @@ -886,10 +1120,41 @@ pScrn->chipset, info->Chipset); + + info->IsM6 = FALSE; + switch (info->Chipset) + { + case PCI_CHIP_RADEON_LY: + case PCI_CHIP_RADEON_LZ: + info->IsM6 = TRUE; + case PCI_CHIP_RADEON_QY: + case PCI_CHIP_RADEON_QZ: + /*VE or M6 has secondary CRTC*/ + info->HasCRTC2 = TRUE; + break; + case PCI_CHIP_R200_QL: + case PCI_CHIP_R200_QN: + case PCI_CHIP_R200_QO: + case PCI_CHIP_R200_Ql: + case PCI_CHIP_R200_BB: + /*R200 has secondary CRTC*/ + info->HasCRTC2 = TRUE; + info->IsR200 = TRUE; + break; + case PCI_CHIP_RV200_QW: /* RV200 desktop */ + case PCI_CHIP_RADEON_LW: /* M7 */ + info->HasCRTC2 = TRUE; + info->IsRV200 = TRUE; + break; + default: + info->HasCRTC2 = FALSE; + } + /* Framebuffer */ from = X_PROBED; info->LinearAddr = info->PciInfo->memBase[0] & 0xfc000000; + pScrn->memPhysBase = info->LinearAddr; if (dev->MemBase) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Linear address override, using 0x%08x instead of 0x%08x\n", @@ -938,31 +1203,36 @@ "BIOS at 0x%08lx\n", info->BIOSAddr); } -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - /* Flat panel (part 1) */ - /* FIXME: Make this an option */ - switch (info->Chipset) { -#if 0 - case PCI_CHIP_RADEON_XX: info->HasPanelRegs = TRUE; break; -#endif - case PCI_CHIP_RADEON_QD: - case PCI_CHIP_RADEON_QE: - case PCI_CHIP_RADEON_QF: - case PCI_CHIP_RADEON_QG: - case PCI_CHIP_RADEON_VE: - default: info->HasPanelRegs = FALSE; break; - } -#endif + RADEONMapMMIO(pScrn); + RADEONMMIO = info->MMIO; /* Read registers used to determine options */ from = X_PROBED; - RADEONMapMMIO(pScrn); - RADEONMMIO = info->MMIO; if (info->FBDev) pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024; else pScrn->videoRam = INREG(RADEON_CONFIG_MEMSIZE) / 1024; + + /* some production boards of m6 will return 0 if it's 8 MB */ + if(pScrn->videoRam == 0) pScrn->videoRam = 8192; + + if(info->IsSecondary) + { + /*FIXME: For now, split FB into two equal sections. This should + be able to be adjusted by user with a config option*/ + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + RADEONInfoPtr info1; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pScrn->videoRam /= 2; + pRADEONEnt->pPrimaryScrn->videoRam = pScrn->videoRam; + info1 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + info1->FbMapSize = pScrn->videoRam * 1024; + info->LinearAddr += pScrn->videoRam * 1024; + } + info->MemCntl = INREG(RADEON_SDRAM_MODE_REG); info->BusCntl = INREG(RADEON_BUS_CNTL); RADEONMMIO = NULL; @@ -976,7 +1246,8 @@ } info->ram = &RADEONRAM[offset]; - if (dev->videoRam) { + if (dev->videoRam) + { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Video RAM override, using %d kB instead of %d kB\n", dev->videoRam, @@ -989,45 +1260,6 @@ xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte (%s)\n", pScrn->videoRam, info->ram->name); -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - /* Flat panel (part 2) */ - if (info->HasPanelRegs) { -#if 1 - info->CRTOnly = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using flat panel for display\n"); -#else - /* Panel CRT mode override */ - if ((info->CRTOnly = xf86ReturnOptValBool(info->Options, - OPTION_CRT, FALSE))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using external CRT instead of " - "flat panel for display\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using flat panel for display\n"); - } -#endif - - /* Panel width/height overrides */ - info->PanelXRes = 0; - info->PanelYRes = 0; - if (xf86GetOptValInteger(info->Options, - OPTION_PANEL_WIDTH, &(info->PanelXRes))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Flat panel width: %d\n", info->PanelXRes); - } - if (xf86GetOptValInteger(info->Options, - OPTION_PANEL_HEIGHT, &(info->PanelYRes))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Flat panel height: %d\n", info->PanelYRes); - } - } else { - info->CRTOnly = FALSE; - } -#endif - #ifdef XF86DRI /* AGP/PCI */ if (xf86ReturnOptValBool(info->Options, OPTION_IS_PCI, FALSE)) { @@ -1038,11 +1270,21 @@ #if 0 case PCI_CHIP_RADEON_XX: info->IsPCI = TRUE; break; #endif + case PCI_CHIP_RADEON_QY: + case PCI_CHIP_RADEON_QZ: + case PCI_CHIP_RADEON_LW: + case PCI_CHIP_RADEON_LY: + case PCI_CHIP_RADEON_LZ: case PCI_CHIP_RADEON_QD: case PCI_CHIP_RADEON_QE: case PCI_CHIP_RADEON_QF: case PCI_CHIP_RADEON_QG: - case PCI_CHIP_RADEON_VE: + case PCI_CHIP_R200_QL: + case PCI_CHIP_R200_QN: + case PCI_CHIP_R200_QO: + case PCI_CHIP_R200_Ql: + case PCI_CHIP_R200_BB: + case PCI_CHIP_RV200_QW: default: info->IsPCI = FALSE; break; } } @@ -1051,21 +1293,294 @@ return TRUE; } -static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) +static void +RADEONI2CGetBits(I2CBusPtr b, int *Clock, int *data) { + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; RADEONInfoPtr info = RADEONPTR(pScrn); - vbeInfoPtr pVbe; + unsigned long val; + unsigned char *RADEONMMIO = info->MMIO; + + /* Get the result. */ + val = INREG(info->DDCReg); + + *Clock = (val & RADEON_GPIO_Y_1) != 0; + *data = (val & RADEON_GPIO_Y_0) != 0; + +} + +static void +RADEONI2CPutBits(I2CBusPtr b, int Clock, int data) +{ + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned long val; + unsigned char *RADEONMMIO = info->MMIO; + + val = INREG(info->DDCReg) & + (CARD32)~(RADEON_GPIO_EN_0 | RADEON_GPIO_EN_1); + val |= (Clock ? 0:RADEON_GPIO_EN_1); + val |= (data ? 0:RADEON_GPIO_EN_0); + OUTREG(info->DDCReg, val); +} + + +static Bool +RADEONI2cInit(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + info->pI2CBus = xf86CreateI2CBusRec(); + if(!info->pI2CBus) return FALSE; + + info->pI2CBus->BusName = "DDC"; + info->pI2CBus->scrnIndex = pScrn->scrnIndex; + info->pI2CBus->I2CPutBits = RADEONI2CPutBits; + info->pI2CBus->I2CGetBits = RADEONI2CGetBits; + info->pI2CBus->AcknTimeout = 5; + + switch(info->DDCType) + { + case DDC_MONID: + info->DDCReg = RADEON_GPIO_MONID; + break; + case DDC_DVI: + info->DDCReg = RADEON_GPIO_DVI_DDC; + break; + case DDC_VGA: + info->DDCReg = RADEON_GPIO_VGA_DDC; + break; + case DDC_CRT2: + info->DDCReg = RADEON_GPIO_CRT2_DDC; + break; + default: + return FALSE; + } + + if (!xf86I2CBusInit(info->pI2CBus)) return FALSE; + return TRUE; +} + +static void RADEONPreInitDDC(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + /*vbeInfoPtr pVbe;*/ - if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE; + info->ddc1 = FALSE; + info->ddc_bios = FALSE; + if (!xf86LoadSubModule(pScrn, "ddc")) + { + info->ddc2 = FALSE; + } + else + { xf86LoaderReqSymLists(ddcSymbols, NULL); - if (xf86LoadSubModule(pScrn, "vbe")) { - pVbe = VBEInit(pInt10, info->pEnt->index); - if (!pVbe) return FALSE; + info->ddc2 = TRUE; + } - xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); - return TRUE; - } else - return FALSE; + /*info->ddc1 = TRUE;*/ + + /* - DDC can use I2C bus */ + /* Load I2C if we have the code to use it */ + if(info->ddc2) + { + if ( xf86LoadSubModule(pScrn, "i2c") ) + { + xf86LoaderReqSymLists(i2cSymbols,NULL); + info->ddc2 = RADEONI2cInit(pScrn); + } + else info->ddc2 = FALSE; + } +} + +static xf86MonPtr +RADEONDoDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + xf86MonPtr MonInfo = NULL; + unsigned char *RADEONMMIO; + + + /** + We'll use DDC2, BIOS EDID can only detect the monitor + connected to one port. For VE, BIOS EDID detects the + monitor connected to DVI port by default. If no monitor + their, it will try CRT port + */ + + /* Read and output monitor info using DDC2 over I2C bus */ + if (info->pI2CBus && info->ddc2) + { + if (!RADEONMapMMIO(pScrn)) return NULL; + RADEONMMIO = info->MMIO; + /*OUTREG(RADEON_I2C_CNTL_1, 0); + OUTREG(RADEON_DVI_I2C_CNTL_1, 0);*/ + OUTREG(info->DDCReg, INREG(info->DDCReg) & + (CARD32)~(RADEON_GPIO_A_0 | RADEON_GPIO_A_1)); + + MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, info->pI2CBus); + if(!MonInfo) info->ddc2 = FALSE; + RADEONUnmapMMIO(pScrn); + } + + if(!MonInfo) + { + if (xf86LoadSubModule(pScrn, "vbe")) + { + vbeInfoPtr pVbe; + pVbe = VBEInit(pInt10, info->pEnt->index); + if (pVbe) + { + MonInfo = vbeDoEDID(pVbe,NULL); + info->ddc_bios = TRUE; + } + else + info->ddc_bios = FALSE; + } + } + +/***Not used for now + if(!MonInfo && info->ddc1) + { + if (info->ddc1Read && info->DDC1SetSpeed) + { + MonInfo = xf86DoEDID_DDC1(pScrn->scrnIndex, + info->DDC1SetSpeed, + info->ddc1Read); + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", MonInfo); + xf86PrintEDID( MonInfo ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n\n"); + } +***/ + + if(MonInfo) + { + if(info->ddc2) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C EDID Info:\n"); + else if(info->ddc_bios) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS EDID Info:\n"); + else return NULL; + + xf86PrintEDID(MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of DDC Monitor info\n\n"); + + xf86SetDDCproperties(pScrn, MonInfo); + return MonInfo; + } + else return NULL; +} + +/*********** + xfree's xf86ValidateModes routine deosn't work well with DFPs + here is our own validation routine. All modes between + 640<=XRes<=MaxRes and 480<=YRes<=MaxYRes will be permitted. +************/ +static int RADEONValidateFPModes(ScrnInfoPtr pScrn) +{ + int i, j, count=0, width, height; + RADEONInfoPtr info = RADEONPTR(pScrn); + DisplayModePtr last = NULL, new = NULL, first = NULL; + + /* Free any allocated modes during configuration. We don't need them*/ + while (pScrn->modes) + { + xf86DeleteMode(&pScrn->modes, pScrn->modes); + } + while (pScrn->modePool) + { + xf86DeleteMode(&pScrn->modePool, pScrn->modePool); + } + + pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + + /* If no mode specified in config, we use native resolution*/ + if(!pScrn->display->modes[0]) + { + pScrn->display->modes[0] = xnfalloc(16); + sprintf(pScrn->display->modes[0], "%dx%d", + info->PanelXRes, info->PanelYRes); + } + + for(i=0; pScrn->display->modes[i] != NULL; i++) + { + if (sscanf(pScrn->display->modes[i], "%dx%d", &width, &height) == 2) + { + + if(width < 640 || width > info->PanelXRes || + height < 480 || height > info->PanelYRes) + { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Mode %s is out of range.\n" + "Valid mode should be between 640x480-%dx%d\n", + pScrn->display->modes[i], info->PanelXRes, info->PanelYRes); + continue; + } + + new = xnfcalloc(1, sizeof(DisplayModeRec)); + new->prev = last; + new->name = xnfalloc(strlen(pScrn->display->modes[i]) + 1); + strcpy(new->name, pScrn->display->modes[i]); + new->HDisplay = new->CrtcHDisplay = width; + new->VDisplay = new->CrtcVDisplay = height; + + if(info->HasEDID) + { + xf86MonPtr ddc = pScrn->monitor->DDC; + for(j=0; j<DET_TIMINGS; j++) + { + /*We use native mode clock only*/ + if(ddc->det_mon[j].type == 0) + new->Clock = ddc->det_mon[j].section.d_timings.clock / 1000; + } + } else + new->Clock = info->DotClock; + + if(new->prev) new->prev->next = new; + last = new; + if(!first) first = new; + pScrn->display->virtualX = + pScrn->virtualX = MAX(pScrn->virtualX, width); + pScrn->display->virtualY = + pScrn->virtualY = MAX(pScrn->virtualY, height); + count++; + } + else + { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Mode name %s is invalid\n", pScrn->display->modes[i]); + continue; + } + } + + if(last) + { + last->next = first; + first->prev = last; + pScrn->modes = first; + + /*FIXME: May need to validate line pitch here*/ + { + int dummy = 0; + switch(pScrn->depth / 8) + { + case 1: + dummy = 128 - pScrn->virtualX % 128; + break; + case 2: + dummy = 32 - pScrn->virtualX % 32; + break; + case 3: + case 4: + dummy = 16 - pScrn->virtualX % 16; + } + pScrn->displayWidth = pScrn->virtualX + dummy; + } + + } + + return count; } /* This is called by RADEONPreInit to initialize gamma correction. */ @@ -1077,6 +1592,129 @@ return TRUE; } +static void RADEONSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) +{ + int i; + xf86MonPtr ddc = pScrn->monitor->DDC; + if(flag) /*HSync*/ + { + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == DS_RANGES) + { + pScrn->monitor->nHsync = 1; + pScrn->monitor->hsync[0].lo = + ddc->det_mon[i].section.ranges.min_h; + pScrn->monitor->hsync[0].hi = + ddc->det_mon[i].section.ranges.max_h; + return; + } + } + /*if no sync ranges detected in detailed timing table, + let's try to derive them from supported VESA modes + Are we doing too much here!!!? + **/ + i = 0; + if(ddc->timings1.t1 & 0x02) /*800x600@56*/ + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 35.2; + i++; + } + if(ddc->timings1.t1 & 0x04) /*640x480@75*/ + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 37.5; + i++; + } + if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t1 & 0x01)) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 37.9; + i++; + } + if(ddc->timings1.t2 & 0x40) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 46.9; + i++; + } + if((ddc->timings1.t2 & 0x80) || (ddc->timings1.t2 & 0x08)) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 48.1; + i++; + } + if(ddc->timings1.t2 & 0x04) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 56.5; + i++; + } + if(ddc->timings1.t2 & 0x02) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 60.0; + i++; + } + if(ddc->timings1.t2 & 0x01) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 64.0; + i++; + } + pScrn->monitor->nHsync = i; + } + else /*Vrefresh*/ + { + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == DS_RANGES) + { + pScrn->monitor->nVrefresh = 1; + pScrn->monitor->vrefresh[0].lo = + ddc->det_mon[i].section.ranges.min_v; + pScrn->monitor->vrefresh[0].hi = + ddc->det_mon[i].section.ranges.max_v; + return; + } + } + i = 0; + if(ddc->timings1.t1 & 0x02) /*800x600@56*/ + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 56; + i++; + } + if((ddc->timings1.t1 & 0x01) || (ddc->timings1.t2 & 0x08)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 60; + i++; + } + if(ddc->timings1.t2 & 0x04) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 70; + i++; + } + if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t2 & 0x80)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 72; + i++; + } + if((ddc->timings1.t1 & 0x04) || (ddc->timings1.t2 & 0x40) + || (ddc->timings1.t2 & 0x02) || (ddc->timings1.t2 & 0x01)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 75; + i++; + } + pScrn->monitor->nVrefresh = i; + } +} + /* This is called by RADEONPreInit to validate modes and compute parameters for all of the valid modes. */ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) @@ -1085,8 +1723,15 @@ ClockRangePtr clockRanges; int modesFound; char *mod = NULL; +#ifndef USE_FB const char *Sym = NULL; +#endif + /*We'll use our own mode validation routine for DFP/LCD, since + xf86ValidateModes is not working well with the DFP/LCD modes + 'stretched' from their native mode.*/ + if(info->DisplayType == MT_CRT || info->UseCRT) + { /* Get mode information */ pScrn->progClock = TRUE; clockRanges = xnfcalloc(sizeof(*clockRanges), 1); @@ -1094,20 +1739,26 @@ clockRanges->minClock = info->pll.min_pll_freq; clockRanges->maxClock = info->pll.max_pll_freq * 10; clockRanges->clockIndex = -1; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) { - clockRanges->interlaceAllowed = FALSE; - clockRanges->doubleScanAllowed = FALSE; - } else { + clockRanges->interlaceAllowed = TRUE; clockRanges->doubleScanAllowed = TRUE; + + if(info->HasEDID) + { + /*if we still don't know sync range yet, let's try EDID. + Note that, since we can have dual heads, the Xconfigurator + may not be able to probe both monitors correctly through + vbe probe function (RADEONProbeDDC). Here we provide an + additional way to auto-detect sync ranges if they haven't + been added to XF86Config manually. + **/ + if(pScrn->monitor->nHsync <= 0) + RADEONSetSyncRangeFromEdid(pScrn, 1); + if(pScrn->monitor->nVrefresh <= 0) + RADEONSetSyncRangeFromEdid(pScrn, 0); } -#else - clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = TRUE; -#endif + modesFound = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, @@ -1123,19 +1774,40 @@ info->FbMapSize, LOOKUP_BEST_REFRESH); - if (modesFound < 1 && info->FBDev) { + if(modesFound < 1 && info->FBDev) + { fbdevHWUseBuildinMode(pScrn); pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */ modesFound = 1; } + + if(modesFound == -1) return FALSE; - if (modesFound == -1) return FALSE; xf86PruneDriverModes(pScrn); - if (!modesFound || !pScrn->modes) { + if(!modesFound || !pScrn->modes) + { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); return FALSE; } xf86SetCrtcForModes(pScrn, 0); + } + else + { + + /*DFP/LCD mode validation routine*/ + modesFound = RADEONValidateFPModes(pScrn); + if(modesFound < 1) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No valid mode found for this DFP/LCD\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "If you have an analog monitor attached but no DFP/LCD try" + "specifying\n\t'Option \"CrtScreen\"' in your X server" + "config file.\n"); + return FALSE; + } + } + pScrn->currentMode = pScrn->modes; xf86PrintModes(pScrn); @@ -1145,7 +1817,6 @@ /* Get ScreenInit function */ #ifdef USE_FB mod = "fb"; - Sym = "fbScreenInit"; #else switch (pScrn->bitsPerPixel) { case 8: mod = "cfb"; Sym = "cfbScreenInit"; break; @@ -1153,11 +1824,13 @@ case 32: mod = "cfb32"; Sym = "cfb32ScreenInit"; break; } #endif + if (mod && !xf86LoadSubModule(pScrn, mod)) return FALSE; - xf86LoaderReqSymbols(Sym, NULL); #ifdef USE_FB - xf86LoaderReqSymbols("fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); +#else + xf86LoaderReqSymbols(Sym, NULL); #endif info->CurrentLayout.displayWidth = pScrn->displayWidth; @@ -1173,6 +1846,7 @@ if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); } return TRUE; } @@ -1184,6 +1858,7 @@ if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; + xf86LoaderReqSymLists(xaaSymbols, NULL); } return TRUE; } @@ -1192,13 +1867,17 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); +#if !defined(__powerpc__) if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); *ppInt10 = xf86InitInt10(info->pEnt->index); } +#endif return TRUE; } + #ifdef XF86DRI static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn) { @@ -1309,32 +1988,163 @@ RADEONProbeDDC(ScrnInfoPtr pScrn, int indx) { vbeInfoPtr pVbe; - if (xf86LoadSubModule(pScrn, "vbe")) { + if (xf86LoadSubModule(pScrn, "vbe")) + { pVbe = VBEInit(NULL,indx); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); } } -/* RADEONPreInit is called once at server startup. */ +/*This funtion is used to reverse calculate + panel information from register settings in VGA mode. + More graceful way is to use EDID information... if it can be detected. + This way may be better than directly probing BIOS image. Because + BIOS image could change from version to version, while the + registers should always(?) contain right information, otherwise + the VGA mode display will not be correct. Well, if someone + messes up these registers before our driver is loaded, we'll be in + trouble...*/ +static Bool RadeonGetDFPInfo(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + char *s; + unsigned long r; + unsigned short a, b; + unsigned char* RADEONMMIO; + unsigned long mapped; + + if(info->HasEDID) + { + int i; + xf86MonPtr ddc = pScrn->monitor->DDC; + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == 0) + { + info->PanelXRes = + ddc->det_mon[i].section.d_timings.h_active; + info->PanelYRes = + ddc->det_mon[i].section.d_timings.v_active; + + info->HOverPlus = + ddc->det_mon[i].section.d_timings.h_sync_off; + info->HSyncWidth = + ddc->det_mon[i].section.d_timings.h_sync_width; + info->HBlank = + ddc->det_mon[i].section.d_timings.h_blanking; + info->VOverPlus = + ddc->det_mon[i].section.d_timings.v_sync_off; + info->VSyncWidth = + ddc->det_mon[i].section.d_timings.v_sync_width; + info->VBlank = + ddc->det_mon[i].section.d_timings.v_blanking; + + return TRUE; + } + } + } + + /* in case both EDID and BIOS probings failed, we'll try to get + panel information from the registers. This will depends on + how the registers are set up by bios, not very reliable*/ + mapped = RADEONMapMem(pScrn); + RADEONMMIO = info->MMIO; + + if(info->PanelXRes==0 || info->PanelYRes==0) { + r = INREG(RADEON_FP_VERT_STRETCH); + if(r & 0x08000000) { + r &= 0x00fff000; + info->PanelYRes = (unsigned short)(r >> 0x0c) + 1; + } else { + info->PanelYRes = (unsigned short)(((float)(INREG(RADEON_FP_CRTC_V_TOTAL_DISP >> 16) + 1.0) + * 4096.0 / (float) (r & 0x00000fff)) + 0.5); + } + + r = INREG(RADEON_FP_HORZ_STRETCH); + if(r & 0x08000000) { + r &= 0x01ff0000; + info->PanelXRes = (unsigned short)(r >> 0x10) + 1; + info->PanelXRes *= 8; + } else { + info->PanelXRes = (unsigned short)(((float)(INREG(RADEON_FP_CRTC_H_TOTAL_DISP >> 16) + 1.0) * 8.0 + * 4096.0 / (float) (r & 0x0000ffff)) + 0.5); + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected panel size from registers: %dx%d\n", info->PanelXRes, info->PanelYRes); + + if ((s = xf86GetOptValString(info->Options, OPTION_PANEL_SIZE))) { + if (sscanf(s, "%dx%d", &info->PanelXRes, &info->PanelYRes) == 2) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Panel size: %dx%d defined in config file is used\n", + info->PanelXRes, info->PanelYRes); + } + } + } + + if (info->PanelXRes == 0 || info->PanelYRes == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to detect the panel size.\n"); + return FALSE; + } + + if(info->HBlank == 0 || info->VBlank == 0) { + r = INREG(RADEON_FP_CRTC_H_TOTAL_DISP); + a = (r & RADEON_FP_CRTC_H_TOTAL_MASK) + 4; + b = (r & 0x01FF0000) >> RADEON_FP_CRTC_H_DISP_SHIFT; + info->HBlank = (a - b + 1) * 8; + + r = INREG(RADEON_FP_H_SYNC_STRT_WID); + info->HOverPlus = + (unsigned short)((r & RADEON_FP_H_SYNC_STRT_CHAR_MASK) + >> RADEON_FP_H_SYNC_STRT_CHAR_SHIFT) - b - 1; + info->HOverPlus *= 8; + info->HSyncWidth = + (unsigned short)((r & RADEON_FP_H_SYNC_WID_MASK) + >> RADEON_FP_H_SYNC_WID_SHIFT); + info->HSyncWidth *= 8; + r = INREG(RADEON_FP_CRTC_V_TOTAL_DISP); + a = (r & RADEON_FP_CRTC_V_TOTAL_MASK) + 1; + b = (r & RADEON_FP_CRTC_V_DISP_MASK) >> RADEON_FP_CRTC_V_DISP_SHIFT; + info->VBlank = a - b /*+ 24*/; + + r = INREG(RADEON_FP_V_SYNC_STRT_WID); + info->VOverPlus = (unsigned short)(r & RADEON_FP_V_SYNC_STRT_MASK) + - b + 1; + info->VSyncWidth = (unsigned short)((r & RADEON_FP_V_SYNC_WID_MASK) + >> RADEON_FP_V_SYNC_WID_SHIFT); + } + + if(mapped) RADEONUnmapMem(pScrn); + + return TRUE; +} + + +/* RADEONPreInit is called once at server startup. */ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) { RADEONInfoPtr info; xf86Int10InfoPtr pInt10 = NULL; +#ifdef __alpha__ CARD32 save1, save2; +#endif -#ifdef XFree86LOADER /* * Tell the loader about symbols from other modules that this module might * refer to. */ - LoaderRefSymLists(vgahwSymbols, + xf86LoaderRefSymLists(vgahwSymbols, #ifdef USE_FB fbSymbols, #else cfbSymbols, #endif xaaSymbols, +#if 0 xf8_32bppSymbols, +#endif ramdacSymbols, #ifdef XF86DRI drmSymbols, @@ -1342,11 +2152,11 @@ #endif fbdevHWSymbols, vbeSymbols, - /* ddcsymbols, */ + int10Symbols, + ddcSymbols, /* i2csymbols, */ /* shadowSymbols, */ NULL); -#endif RADEONTRACE(("RADEONPreInit\n")); if (pScrn->numEntities != 1) return FALSE; @@ -1354,13 +2164,44 @@ if (!RADEONGetRec(pScrn)) return FALSE; info = RADEONPTR(pScrn); - + info->IsSecondary = FALSE; info->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (info->pEnt->location.type != BUS_PCI) goto fail; RADEONPreInt10Save(pScrn, &save1, &save2); - if (flags & PROBE_DETECT) { + if(xf86IsEntityShared(pScrn->entityList[0])) + { + if(xf86IsPrimInitDone(pScrn->entityList[0])) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + info->IsSecondary = TRUE; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + if(pRADEONEnt->BypassSecondary) return FALSE; + pRADEONEnt->pSecondaryScrn = pScrn; + } + else + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + xf86SetPrimInitDone(pScrn->entityList[0]); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->pPrimaryScrn = pScrn; + pRADEONEnt->IsDRIEnabled = FALSE; + pRADEONEnt->BypassSecondary = FALSE; + pRADEONEnt->HasSecondary = FALSE; + pRADEONEnt->RestorePrimary = FALSE; + pRADEONEnt->IsSecondaryRestored = FALSE; + } + } + + if (flags & PROBE_DETECT) + { RADEONProbeDDC(pScrn, info->pEnt->index); RADEONPostInt10Check(pScrn, save1, save2); return TRUE; @@ -1368,11 +2209,14 @@ if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; xf86LoaderReqSymLists(vgahwSymbols, NULL); - if (!vgaHWGetHWRec(pScrn)) { + if (!vgaHWGetHWRec(pScrn)) + { RADEONFreeRec(pScrn); return FALSE; } + vgaHWGetIOBase(VGAHWPTR(pScrn)); + info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index); info->PciTag = pciTag(info->PciInfo->bus, info->PciInfo->device, @@ -1384,9 +2228,10 @@ info->PciInfo->device, info->PciInfo->func); - if (xf86RegisterResources(info->pEnt->index, 0, ResNone)) goto fail; + if (xf86RegisterResources(info->pEnt->index, 0, ResExclusive)) + goto fail; - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR; pScrn->monitor = pScrn->confScreen->monitor; if (!RADEONPreInitVisual(pScrn)) goto fail; @@ -1406,15 +2251,24 @@ "Using framebuffer device\n"); } - if (info->FBDev) { + info->UseCRT = FALSE; + + /*This option is used to force the ONLY DEVICE in XFConfig to + use CRT port, instead of default DVI port*/ + if (xf86ReturnOptValBool(info->Options, OPTION_CRT_SCREEN, FALSE)) + { + if(!xf86IsEntityShared(pScrn->entityList[0])) + info->UseCRT = TRUE; + } + + if (info->FBDev) + { /* check for linux framebuffer device */ if (!xf86LoadSubModule(pScrn, "fbdevhw")) return FALSE; xf86LoaderReqSymLists(fbdevHWSymbols, NULL); if (!fbdevHWInit(pScrn, info->PciInfo, NULL)) return FALSE; pScrn->SwitchMode = fbdevHWSwitchMode; pScrn->AdjustFrame = fbdevHWAdjustFrame; - pScrn->EnterVT = RADEONEnterVTFBDev; - pScrn->LeaveVT = RADEONLeaveVTFBDev; pScrn->ValidMode = fbdevHWValidMode; } @@ -1425,14 +2279,25 @@ if (!RADEONPreInitConfig(pScrn)) goto fail; +#if !defined(__powerpc__) if (!RADEONGetBIOSParameters(pScrn, pInt10)) goto fail; +#else + /* + * force type to CRT since we currently can't read BIOS to + * tell us what kind of heads we have + */ + info->DisplayType = MT_CRT; +#endif - if (!RADEONGetPLLParameters(pScrn)) goto fail; + RADEONPreInitDDC(pScrn); + info->HasEDID = + ((pScrn->monitor->DDC = RADEONDoDDC(pScrn, pInt10)) ? TRUE:FALSE); - /* shouldn't fail just because we can't get DDC */ - RADEONPreInitDDC(pScrn, pInt10); + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + if(!RadeonGetDFPInfo(pScrn)) goto fail; - RADEONPostInt10Check(pScrn, save1, save2); + if (!RADEONGetPLLParameters(pScrn)) goto fail; if (!RADEONPreInitGamma(pScrn)) goto fail; @@ -1445,9 +2310,9 @@ #ifdef XF86DRI if (!RADEONPreInitDRI(pScrn)) goto fail; #endif - /* Free the video bios (if applicable) */ - if (info->VBIOS) { + if (info->VBIOS) + { xfree(info->VBIOS); info->VBIOS = NULL; } @@ -1456,13 +2321,18 @@ if (pInt10) xf86FreeInt10(pInt10); + xf86DrvMsg(pScrn->scrnIndex, X_NOTICE, + "For information on using the multimedia capabilities\n of this" + " adapter, please see http://gatos.sf.net.\n"); + return TRUE; - fail: +fail: /* Pre-init failed. */ /* Free the video bios (if applicable) */ - if (info->VBIOS) { + if (info->VBIOS) + { xfree(info->VBIOS); info->VBIOS = NULL; } @@ -1483,14 +2353,15 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; int i; - int idx; + int idx, j; unsigned char r, g, b; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); -#endif + /* If the second monitor is connected, we also + need to deal with the secondary palette*/ + if (info->IsSecondary) j = 1; + else j = 0; + + PAL_SELECT(j); if (info->CurrentLayout.depth == 15) { /* 15bpp mode. This sends 32 values. */ @@ -1550,6 +2421,11 @@ ScrnInfoPtr pScrn = xf86Screens[i]; RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef XF86DRI + if (info->directRenderingEnabled) + FLUSH_RING(); +#endif + pScreen->BlockHandler = info->BlockHandler; (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); pScreen->BlockHandler = RADEONBlockHandler; @@ -1574,26 +2450,30 @@ /* Turn off the CP for now. */ info->CPInUse = FALSE; #endif - - if (!RADEONMapMem(pScrn)) return FALSE; pScrn->fbOffset = 0; + if(info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024; + if (!RADEONMapMem(pScrn)) return FALSE; + #ifdef XF86DRI info->fbX = 0; info->fbY = 0; #endif info->PaletteSavedOnVT = FALSE; + info->SwitchingMode = FALSE; RADEONSave(pScrn); if (info->FBDev) { + unsigned char *RADEONMMIO = info->MMIO; if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; + info->ModeReg.surface_cntl = INREG(RADEON_SURFACE_CNTL); } else { if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE; } RADEONSaveScreen(pScreen, SCREEN_SAVER_ON); - pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); /* Visual setup */ miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, @@ -1627,8 +2507,38 @@ (pScrn->displayWidth * pScrn->virtualY * info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024); info->directRenderingEnabled = FALSE; + } else if (info->IsR200) { + info->directRenderingEnabled = FALSE; + xf86DrvMsg(scrnIndex, X_WARNING, + "Direct rendering not yet supported on Radeon 8500\n"); } else { - info->directRenderingEnabled = RADEONDRIScreenInit(pScreen); + if(info->IsSecondary) + info->directRenderingEnabled = FALSE; + else + { + /* Xinerama has sync problem with DRI, disable it for now */ + if(xf86IsEntityShared(pScrn->entityList[0])) + { + info->directRenderingEnabled = FALSE; + xf86DrvMsg(scrnIndex, X_WARNING, + "Direct Rendering Disabled -- " + "Dual-head configuration is not working with DRI " + "at present.\nPlease use only one Device/Screen " + "section in your XFConfig file.\n"); + } + else + info->directRenderingEnabled = + RADEONDRIScreenInit(pScreen); + if(xf86IsEntityShared(pScrn->entityList[0])) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->IsDRIEnabled = info->directRenderingEnabled; + } + } } } #endif @@ -1639,7 +2549,6 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; - fbPictureInit (pScreen, 0, 0); #else switch (pScrn->bitsPerPixel) { case 8: @@ -1683,8 +2592,10 @@ } } } - - RADEONDGAInit(pScreen); +#ifdef USE_FB + /* must be after RGB order fixed */ + fbPictureInit (pScreen, 0, 0); +#endif /* Memory manager setup */ #ifdef XF86DRI @@ -1852,11 +2763,13 @@ y2 = (info->FbMapSize / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes)); + if (y2 >= 32768) y2 = 32767; /* because MemBox.y2 is signed short */ + MemBox.y2 = y2; + /* The acceleration engine uses 14 bit signed coordinates, so we can't have any drawable caches beyond this region. */ - if (y2 > 8191) y2 = 8191; - MemBox.y2 = y2; + if (MemBox.y2 > 8191) MemBox.y2 = 8191; if (!xf86InitFBManager(pScreen, &MemBox)) { xf86DrvMsg(scrnIndex, X_ERROR, @@ -1887,7 +2800,6 @@ } } } - /* Backing store setup */ miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -1911,6 +2823,9 @@ info->accelOn = FALSE; } + /* DGA setup */ + RADEONDGAInit(pScreen); + /* Cursor setup */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -1950,13 +2865,12 @@ )) return FALSE; /* DPMS setup */ -#ifdef ENABLE_FLAT_PANEL - if (!info->HasPanelRegs || info->CRTOnly) -#endif +#ifdef DPMSExtension + if (info->DisplayType == MT_CRT) xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); +#endif RADEONInitVideo(pScreen); - /* Provide SaveScreen */ pScreen->SaveScreen = RADEONSaveScreen; @@ -2009,6 +2923,7 @@ OUTREG(RADEON_CAP0_TRIG_CNTL, restore->cap0_trig_cntl); OUTREG(RADEON_CAP1_TRIG_CNTL, restore->cap1_trig_cntl); OUTREG(RADEON_BUS_CNTL, restore->bus_cntl); + OUTREG(RADEON_SURFACE_CNTL, restore->surface_cntl); } /* Write CRTC registers. */ @@ -2038,45 +2953,75 @@ OUTREG(RADEON_CRTC_PITCH, restore->crtc_pitch); } -#ifdef ENABLE_FLAT_PANEL +/* Write CRTC2 registers. */ +static void RADEONRestoreCrtc2Registers(ScrnInfoPtr pScrn, + RADEONSavePtr restore) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + +/* OUTREG(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl);*/ + OUTREGP(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl, + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS | + RADEON_CRTC2_DISP_DIS); + + OUTREG(RADEON_DAC_CNTL2, restore->dac2_cntl); + OUTREG(RADEON_DISP_OUTPUT_CNTL, restore->disp_output_cntl); + + OUTREG(RADEON_CRTC2_H_TOTAL_DISP, restore->crtc2_h_total_disp); + OUTREG(RADEON_CRTC2_H_SYNC_STRT_WID, restore->crtc2_h_sync_strt_wid); + OUTREG(RADEON_CRTC2_V_TOTAL_DISP, restore->crtc2_v_total_disp); + OUTREG(RADEON_CRTC2_V_SYNC_STRT_WID, restore->crtc2_v_sync_strt_wid); + OUTREG(RADEON_CRTC2_OFFSET, restore->crtc2_offset); + OUTREG(RADEON_CRTC2_OFFSET_CNTL, restore->crtc2_offset_cntl); + OUTREG(RADEON_CRTC2_PITCH, restore->crtc2_pitch); + +} + /* Note: Radeon flat panel support has been disabled for now */ /* Write flat panel registers */ static void RADEONRestoreFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 tmp; + unsigned long tmp; - OUTREG(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl); OUTREG(RADEON_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp); OUTREG(RADEON_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp); - OUTREG(RADEON_FP_GEN_CNTL, restore->fp_gen_cntl); OUTREG(RADEON_FP_H_SYNC_STRT_WID, restore->fp_h_sync_strt_wid); - OUTREG(RADEON_FP_HORZ_STRETCH, restore->fp_horz_stretch); - OUTREG(RADEON_FP_PANEL_CNTL, restore->fp_panel_cntl); OUTREG(RADEON_FP_V_SYNC_STRT_WID, restore->fp_v_sync_strt_wid); - OUTREG(RADEON_FP_VERT_STRETCH, restore->fp_vert_stretch); OUTREG(RADEON_TMDS_CRC, restore->tmds_crc); + OUTREG(RADEON_FP_HORZ_STRETCH, restore->fp_horz_stretch); + OUTREG(RADEON_FP_VERT_STRETCH, restore->fp_vert_stretch); + OUTREG(RADEON_FP_GEN_CNTL, restore->fp_gen_cntl); + if(info->DisplayType == MT_LCD) + { tmp = INREG(RADEON_LVDS_GEN_CNTL); if ((tmp & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) == - (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON))) { + (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON))) + { OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); - } else { - if (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) { - OUTREG(RADEON_LVDS_GEN_CNTL, - restore->lvds_gen_cntl & ~RADEON_LVDS_BLON); + } + else + { + if (restore->lvds_gen_cntl & + (RADEON_LVDS_ON | RADEON_LVDS_BLON)) + { usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000); OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); - } else { + } + else + { OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl | RADEON_LVDS_BLON); usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000); OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); } } + } } -#endif #if RADEON_ATOMIC_UPDATE static void RADEONPLLWaitForReadUpdateComplete(ScrnInfoPtr pScrn) @@ -2099,6 +3044,8 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + OUTPLLP(pScrn, 0x08, 0x00, ~(0x03)); + #if !RADEON_ATOMIC_UPDATE while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & RADEON_PLL_DIV_SEL) != RADEON_PLL_DIV_SEL) { @@ -2177,6 +3124,104 @@ restore->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK, restore->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK, (restore->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16)); + + OUTPLLP(pScrn, 0x08, 0x03, ~(0x03)); + +} + + +/* Write PLL2 registers. */ +static void RADEONRestorePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr restore) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + OUTPLLP(pScrn, 0x2d, 0x00, ~(0x03)); + + +#if !RADEON_ATOMIC_UPDATE + while (INREG(RADEON_CLOCK_CNTL_INDEX) & ~(RADEON_PLL2_DIV_SEL_MASK)) { +#endif + OUTREGP(RADEON_CLOCK_CNTL_INDEX, 0, RADEON_PLL2_DIV_SEL_MASK); +#if !RADEON_ATOMIC_UPDATE + } +#endif + + +#if RADEON_ATOMIC_UPDATE + OUTPLLP(pScrn, + RADEON_P2PLL_CNTL, + RADEON_P2PLL_RESET + | RADEON_P2PLL_ATOMIC_UPDATE_EN + | RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN, + 0xffff); +#else + OUTPLLP(pScrn, + RADEON_P2PLL_CNTL, + RADEON_P2PLL_RESET, + 0xffff); +#endif + +#if RADEON_ATOMIC_UPDATE + RADEONPLLWaitForReadUpdateComplete(pScrn); +#endif + while ( (INPLL(pScrn, RADEON_P2PLL_REF_DIV) & RADEON_P2PLL_REF_DIV_MASK) != + (restore->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK)) { + OUTPLLP(pScrn, RADEON_P2PLL_REF_DIV, restore->p2pll_ref_div, ~RADEON_P2PLL_REF_DIV_MASK); + } +#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); +#endif + +#if RADEON_ATOMIC_UPDATE + RADEONPLLWaitForReadUpdateComplete(pScrn); +#endif + while ( (INPLL(pScrn, RADEON_P2PLL_DIV_0) & RADEON_P2PLL_FB0_DIV_MASK) != + (restore->p2pll_div_0 & +RADEON_P2PLL_FB0_DIV_MASK)) { + OUTPLLP(pScrn, RADEON_P2PLL_DIV_0, + restore->p2pll_div_0, ~RADEON_P2PLL_FB0_DIV_MASK); + } +#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); +#endif + +#if RADEON_ATOMIC_UPDATE + RADEONPLLWaitForReadUpdateComplete(pScrn); +#endif + while ( (INPLL(pScrn, RADEON_P2PLL_DIV_0) & RADEON_P2PLL_POST0_DIV_MASK) != + (restore->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK)) { + OUTPLLP(pScrn, RADEON_P2PLL_DIV_0, + restore->p2pll_div_0, ~RADEON_P2PLL_POST0_DIV_MASK); + } +#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); +#endif + +#if RADEON_ATOMIC_UPDATE + RADEONPLLWaitForReadUpdateComplete(pScrn); +#endif + OUTPLL(RADEON_HTOTAL2_CNTL, restore->htotal_cntl2); +#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); +#endif + + OUTPLLP(pScrn, RADEON_P2PLL_CNTL, 0, + ~(RADEON_P2PLL_RESET | RADEON_P2PLL_SLEEP)); + + RADEONTRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n", + restore->p2pll_ref_div, + restore->p2pll_div_0, + restore->htotal_cntl2, + INPLL(pScrn, RADEON_P2PLL_CNTL))); + RADEONTRACE(("Wrote: rd=%d, fd=%d, pd=%d\n", + restore->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, + restore->p2pll_div_0 & RADEON_P2PLL_FB3_DIV_MASK, + (restore->p2pll_div_0 & RADEON_P2PLL_POST3_DIV_MASK) >>16)); + + OUTPLLP(pScrn, 0x2d, 0x03, ~(0x03)); + + } /* Write DDA registers. */ @@ -2189,6 +3234,7 @@ OUTREG(RADEON_DDA_ON_OFF, restore->dda_on_off); } +#if 0 /* Write palette data. */ static void RADEONRestorePalette(ScrnInfoPtr pScrn, RADEONSavePtr restore) { @@ -2198,40 +3244,122 @@ if (!restore->palette_valid) return; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); -#endif + PAL_SELECT(1); + OUTPAL_START(0); + for (i = 0; i < 256; i++) { + RADEONWaitForFifo(pScrn, 32); /* delay */ + OUTPAL_NEXT_CARD32(restore->palette2[i]); + } + PAL_SELECT(0); OUTPAL_START(0); for (i = 0; i < 256; i++) { RADEONWaitForFifo(pScrn, 32); /* delay */ OUTPAL_NEXT_CARD32(restore->palette[i]); } } +#endif /* Write out state to define a new video mode. */ -static void RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore) +static void +RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore) { -#ifdef ENABLE_FLAT_PANEL RADEONInfoPtr info = RADEONPTR(pScrn); -#endif + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + static RADEONSaveRec restore0; - RADEONTRACE(("RADEONRestoreMode(%p)\n", restore)); + /* for Non-dual head card, we don't have private field in the Entity*/ + if(!info->HasCRTC2) + { RADEONRestoreCommonRegisters(pScrn, restore); + RADEONRestoreDDARegisters(pScrn, restore); RADEONRestoreCrtcRegisters(pScrn, restore); -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + { RADEONRestoreFPRegisters(pScrn, restore); - if (!info->HasPanelRegs || info->CRTOnly) - RADEONRestorePLLRegisters(pScrn, restore); -#else + } RADEONRestorePLLRegisters(pScrn, restore); + return; + } + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + + RADEONTRACE(("RADEONRestoreMode(%p)\n", restore)); + + /***** + When changing mode with Dual-head card (VE/M6), care must + be taken for the special order in setting registers. CRTC2 has + to be set before changing CRTC_EXT register. + In the dual-head setup, X server calls this routine twice with + primary and secondary pScrn pointers respectively. The calls + can come with different order. Regardless the order of X server issuing + the calls, we have to ensure we set registers in the right order!!! + Otherwise we may get a blank screen. + *****/ + if(info->IsSecondary) + { + RADEONRestoreCrtc2Registers(pScrn, restore); + RADEONRestorePLL2Registers(pScrn, restore); + + if(!info->SwitchingMode) + pRADEONEnt->IsSecondaryRestored = TRUE; + + if(pRADEONEnt->RestorePrimary) + { + RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + pRADEONEnt->RestorePrimary = FALSE; + + RADEONRestoreCrtcRegisters(pScrn, &restore0); + if((info0->DisplayType == MT_DFP) || + (info0->DisplayType == MT_LCD)) + { + RADEONRestoreFPRegisters(pScrn, &restore0); + } + + RADEONRestorePLLRegisters(pScrn, &restore0); + pRADEONEnt->IsSecondaryRestored = FALSE; + + } + } + else + { + RADEONRestoreCommonRegisters(pScrn, restore); + RADEONRestoreDDARegisters(pScrn, restore); + if(!pRADEONEnt->HasSecondary || pRADEONEnt->IsSecondaryRestored + || info->SwitchingMode) + { + pRADEONEnt->IsSecondaryRestored = FALSE; + RADEONRestoreCrtcRegisters(pScrn, restore); + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + { + RADEONRestoreFPRegisters(pScrn, restore); + } + RADEONRestorePLLRegisters(pScrn, restore); + } + else + { + memcpy(&restore0, restore, sizeof(restore0)); + pRADEONEnt->RestorePrimary = TRUE; + } + } + + /* if only one screen is used, we should turn off + the unused screen, not working for now */ + /* + if(!xf86IsEntityShared(pScrn->entityList[0])) + { + RADEONSetDisplayOff(pScrn, 1, 1); + } + */ + +#if 0 + RADEONRestorePalette(pScrn, &info->SavedReg); #endif - RADEONRestoreDDARegisters(pScrn, restore); - RADEONRestorePalette(pScrn, restore); } /* Read common registers. */ @@ -2253,6 +3381,7 @@ save->cap0_trig_cntl = INREG(RADEON_CAP0_TRIG_CNTL); save->cap1_trig_cntl = INREG(RADEON_CAP1_TRIG_CNTL); save->bus_cntl = INREG(RADEON_BUS_CNTL); + save->surface_cntl = INREG(RADEON_SURFACE_CNTL); } /* Read CRTC registers. */ @@ -2271,9 +3400,9 @@ save->crtc_offset = INREG(RADEON_CRTC_OFFSET); save->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL); save->crtc_pitch = INREG(RADEON_CRTC_PITCH); + } -#ifdef ENABLE_FLAT_PANEL /* Note: Radeon flat panel support has been disabled for now */ /* Read flat panel registers */ static void RADEONSaveFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) @@ -2281,20 +3410,38 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - save->crtc2_gen_cntl = INREG(RADEON_CRTC2_GEN_CNTL); save->fp_crtc_h_total_disp = INREG(RADEON_FP_CRTC_H_TOTAL_DISP); save->fp_crtc_v_total_disp = INREG(RADEON_FP_CRTC_V_TOTAL_DISP); save->fp_gen_cntl = INREG(RADEON_FP_GEN_CNTL); save->fp_h_sync_strt_wid = INREG(RADEON_FP_H_SYNC_STRT_WID); save->fp_horz_stretch = INREG(RADEON_FP_HORZ_STRETCH); - save->fp_panel_cntl = INREG(RADEON_FP_PANEL_CNTL); save->fp_v_sync_strt_wid = INREG(RADEON_FP_V_SYNC_STRT_WID); save->fp_vert_stretch = INREG(RADEON_FP_VERT_STRETCH); save->lvds_gen_cntl = INREG(RADEON_LVDS_GEN_CNTL); + save->lvds_pll_cntl = INREG(RADEON_LVDS_PLL_CNTL); save->tmds_crc = INREG(RADEON_TMDS_CRC); } -#endif +/* Read CRTC2 registers. */ +static void RADEONSaveCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr +save) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + save->dac2_cntl = INREG(RADEON_DAC_CNTL2); + save->disp_output_cntl = INREG(RADEON_DISP_OUTPUT_CNTL); + + save->crtc2_gen_cntl = INREG(RADEON_CRTC2_GEN_CNTL); + save->crtc2_h_total_disp = INREG(RADEON_CRTC2_H_TOTAL_DISP); + save->crtc2_h_sync_strt_wid = INREG(RADEON_CRTC2_H_SYNC_STRT_WID); + save->crtc2_v_total_disp = INREG(RADEON_CRTC2_V_TOTAL_DISP); + save->crtc2_v_sync_strt_wid = INREG(RADEON_CRTC2_V_SYNC_STRT_WID); + save->crtc2_offset = INREG(RADEON_CRTC2_OFFSET); + save->crtc2_offset_cntl = INREG(RADEON_CRTC2_OFFSET_CNTL); + save->crtc2_pitch = INREG(RADEON_CRTC2_PITCH); +} + /* Read PLL registers. */ static void RADEONSavePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) { @@ -2312,6 +3459,23 @@ (save->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16)); } +/* Read PLL registers. */ +static void RADEONSavePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save) +{ + save->p2pll_ref_div = INPLL(pScrn, RADEON_P2PLL_REF_DIV); + save->p2pll_div_0 = INPLL(pScrn, RADEON_P2PLL_DIV_0); + save->htotal_cntl2 = INPLL(pScrn, RADEON_HTOTAL2_CNTL); + + RADEONTRACE(("Read: 0x%08x 0x%08x 0x%08x\n", + save->p2pll_ref_div, + save->p2pll_div_0, + save->htotal_cntl2)); + RADEONTRACE(("Read: rd=%d, fd=%d, pd=%d\n", + save->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, + save->p2pll_div_0 & RADEON_P2PLL_FB0_DIV_MASK, + (save->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK) >> 16)); +} + /* Read DDA registers. */ static void RADEONSaveDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) { @@ -2330,11 +3494,13 @@ int i; #ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); + /*if (info->Port1 == MT_DFP) PAL_SELECT(1);*/ #endif - + PAL_SELECT(1); + INPAL_START(0); + for (i = 0; i < 256; i++) save->palette2[i] = INPAL_NEXT(); + PAL_SELECT(0); INPAL_START(0); for (i = 0; i < 256; i++) save->palette[i] = INPAL_NEXT(); save->palette_valid = TRUE; @@ -2343,19 +3509,27 @@ /* Save state that defines current video mode. */ static void RADEONSaveMode(ScrnInfoPtr pScrn, RADEONSavePtr save) { - RADEONTRACE(("RADEONSaveMode(%p)\n", save)); + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONTRACE(("RADEONSaveMode(%p)\n", save)); + if(info->IsSecondary) + { + RADEONSaveCrtc2Registers(pScrn, save); + RADEONSavePLL2Registers(pScrn, save); + } + else + { RADEONSaveCommonRegisters(pScrn, save); RADEONSaveCrtcRegisters(pScrn, save); -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (RADEONPTR(pScrn)->HasPanelRegs) + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + { RADEONSaveFPRegisters(pScrn, save); -#endif + } RADEONSavePLLRegisters(pScrn, save); RADEONSaveDDARegisters(pScrn, save); - RADEONSavePalette(pScrn, save); - + /*RADEONSavePalette(pScrn, save);*/ + } RADEONTRACE(("RADEONSaveMode returns %p\n", save)); } @@ -2372,17 +3546,28 @@ fbdevHWSave(pScrn); return; } + + if(!info->IsSecondary) + { vgaHWUnlock(hwp); - vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts, cmap */ +#if defined(__powerpc__) + /* temporary hack to prevent crashing on PowerMacs when trying to + * read VGA fonts and colormap, will find a better solution + * in the future + */ + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* save mode only */ +#else + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts,cmap */ +#endif vgaHWLock(hwp); - - RADEONSaveMode(pScrn, save); - save->dp_datatype = INREG(RADEON_DP_DATATYPE); save->rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); save->clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX); save->amcgpio_en_reg = INREG(RADEON_AMCGPIO_EN_REG); save->amcgpio_mask = INREG(RADEON_AMCGPIO_MASK); + } + + RADEONSaveMode(pScrn, save); } /* Restore the original (text) mode. */ @@ -2398,7 +3583,6 @@ fbdevHWRestore(pScrn); return; } - RADEONBlank(pScrn); OUTREG(RADEON_AMCGPIO_MASK, restore->amcgpio_mask); @@ -2407,17 +3591,57 @@ OUTREG(RADEON_RBBM_SOFT_RESET, restore->rbbm_soft_reset); OUTREG(RADEON_DP_DATATYPE, restore->dp_datatype); + /* M6 card has trouble restoring text mode for its CRT. + Needs this workaround.*/ + if(xf86IsEntityShared(pScrn->entityList[0]) && info->IsM6) + OUTREG(RADEON_DAC_CNTL2, restore->dac2_cntl); + RADEONRestoreMode(pScrn, restore); + + /* Temp fix to "solve" VT switch problems. When switching VTs on + some systems, the console can either hang or the fonts can be + corrupted. This hack solves the problem 99% of the time. A + correct fix is being worked on. */ + usleep(100000); + + if(!info->IsSecondary) + { vgaHWUnlock(hwp); +#if defined(__powerpc__) + /* temporary hack to prevent crashing on PowerMacs when trying to + * write VGA fonts, will find a better solution in the future + */ + vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); +#else vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); +#endif vgaHWLock(hwp); + } + else + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + { + ScrnInfoPtr pScrn0 = pRADEONEnt->pPrimaryScrn; + vgaHWPtr hwp0 = VGAHWPTR(pScrn0); + vgaHWUnlock(hwp0); + vgaHWRestore(pScrn0, &hwp0->SavedReg, + VGA_SR_MODE | VGA_SR_FONTS ); + vgaHWLock(hwp0); + } + } + RADEONUnblank(pScrn); + #if 0 RADEONWaitForVerticalSync(pScrn); #endif - RADEONUnblank(pScrn); } + /* Define common registers for requested video mode. */ static void RADEONInitCommonRegisters(RADEONSavePtr save, RADEONInfoPtr info) { @@ -2453,11 +3677,7 @@ int vsync_wid; int bytpp; int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - int hsync_fudge_fp[] = { 0x12, 0x11, 0x09, 0x09, 0x05, 0x05 }; - int hsync_fudge_fp_crt[] = { 0x12, 0x10, 0x08, 0x08, 0x04, 0x04 }; -#endif + int hsync_fudge_fp[] = { 0x02, 0x02, 0x00, 0x00, 0x05, 0x05 }; switch (info->CurrentLayout.pixel_code) { case 4: format = 1; bytpp = 0; break; @@ -2473,15 +3693,11 @@ } RADEONTRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp)); -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) - if (info->CRTOnly) hsync_fudge = hsync_fudge_fp_crt[format-1]; - else hsync_fudge = hsync_fudge_fp[format-1]; - else hsync_fudge = hsync_fudge_default[format-1]; -#else + if ((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + hsync_fudge = hsync_fudge_fp[format-1]; + else hsync_fudge = hsync_fudge_default[format-1]; -#endif save->crtc_gen_cntl = (RADEON_CRTC_EXT_DISP_EN | RADEON_CRTC_EN @@ -2493,31 +3709,51 @@ ? RADEON_CRTC_INTERLACE_EN : 0)); - if (info->Chipset == PCI_CHIP_RADEON_VE) { - save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_CRTC_CRT_ON; - } else { - save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_XCRT_CNT_EN; + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + { + save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | + RADEON_XCRT_CNT_EN; + save->crtc_gen_cntl &= ~(RADEON_CRTC_DBL_SCAN_EN | + RADEON_CRTC_INTERLACE_EN); } - save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_XCRT_CNT_EN; + else + save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | + RADEON_XCRT_CNT_EN | + RADEON_CRTC_CRT_ON; + save->dac_cntl = (RADEON_DAC_MASK_ALL | RADEON_DAC_VGA_ADR_EN | (info->dac6bits ? 0 : RADEON_DAC_8BIT_EN)); - - save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff) - | (((mode->CrtcHDisplay / 8) - 1) << 16)); + + if(((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) && !info->UseCRT) + { + if(info->PanelXRes < mode->CrtcHDisplay) + mode->HDisplay = mode->CrtcHDisplay = info->PanelXRes; + if(info->PanelYRes < mode->CrtcVDisplay) + mode->VDisplay = mode->CrtcVDisplay = info->PanelYRes; + mode->CrtcHTotal = mode->CrtcHDisplay + info->HBlank; + mode->CrtcHSyncStart = mode->CrtcHDisplay + info->HOverPlus; + mode->CrtcHSyncEnd = mode->CrtcHSyncStart + info->HSyncWidth; + mode->CrtcVTotal = mode->CrtcVDisplay + info->VBlank; + mode->CrtcVSyncStart = mode->CrtcVDisplay + info->VOverPlus; + mode->CrtcVSyncEnd = mode->CrtcVSyncStart + info->VSyncWidth; + } + save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0x3ff) + | ((((mode->CrtcHDisplay / 8) - 1) & 0x1ff) << 16)); hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8; if (!hsync_wid) hsync_wid = 1; if (hsync_wid > 0x3f) hsync_wid = 0x3f; - hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge; save->crtc_h_sync_strt_wid = ((hsync_start & 0x1fff) - | (hsync_wid << 16) + | (hsync_wid << 16) | ((mode->Flags & V_NHSYNC) ? RADEON_CRTC_H_SYNC_POL : 0)); - + #if 1 /* This works for double scan mode. */ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) @@ -2540,6 +3776,7 @@ | ((mode->Flags & V_NVSYNC) ? RADEON_CRTC_V_SYNC_POL : 0)); + save->crtc_offset = 0; save->crtc_offset_cntl = 0; @@ -2548,13 +3785,122 @@ (pScrn->bitsPerPixel * 8); save->crtc_pitch |= save->crtc_pitch << 16; + save->surface_cntl = RADEON_SURF_TRANSLATION_DIS; +#if X_BYTE_ORDER == X_BIG_ENDIAN + switch (pScrn->bitsPerPixel) { + case 16: + save->surface_cntl |= RADEON_NONSURF_AP0_SWP_16BPP; + break; + case 32: + save->surface_cntl |= RADEON_NONSURF_AP0_SWP_32BPP; + break; + } +#endif + RADEONTRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n", save->crtc_pitch, pScrn->virtualX, info->CurrentLayout.displayWidth)); return TRUE; } -#ifdef ENABLE_FLAT_PANEL +/* Define CRTC2 registers for requested video mode. */ +static Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save, + DisplayModePtr mode, RADEONInfoPtr info) +{ + int format; + int hsync_start; + int hsync_wid; + int hsync_fudge; + int vsync_wid; + int bytpp; + int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; + + switch (info->CurrentLayout.pixel_code) { + case 4: format = 1; bytpp = 0; break; + case 8: format = 2; bytpp = 1; break; + case 15: format = 3; bytpp = 2; break; /* 555 */ + case 16: format = 4; bytpp = 2; break; /* 565 */ + case 24: format = 5; bytpp = 3; break; /* RGB */ + case 32: format = 6; bytpp = 4; break; /* xRGB */ + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel); + return FALSE; + } + RADEONTRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp)); + + hsync_fudge = hsync_fudge_default[format-1]; + + save->crtc2_gen_cntl = (RADEON_CRTC2_EN + | RADEON_CRTC2_CRT2_ON + | (format << 8) + | ((mode->Flags & V_DBLSCAN) + ? RADEON_CRTC2_DBL_SCAN_EN + : 0) + | ((mode->Flags & V_INTERLACE) + ? RADEON_CRTC2_INTERLACE_EN + : 0)); + + if(info->IsR200) + save->disp_output_cntl = + ((info->SavedReg.disp_output_cntl & ~(CARD32)RADEON_DISP_DAC_SOURCE_MASK) + | RADEON_DISP_DAC_SOURCE_CRTC2); + else + save->dac2_cntl = info->SavedReg.dac2_cntl + /*| RADEON_DAC2_DAC2_CLK_SEL*/ + | RADEON_DAC2_DAC_CLK_SEL; + + save->crtc2_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0x3ff) + | ((((mode->CrtcHDisplay / 8) - 1) & 0x1ff) << 16)); + + hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8; + if (!hsync_wid) hsync_wid = 1; + if (hsync_wid > 0x3f) hsync_wid = 0x3f; + hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge; + + save->crtc2_h_sync_strt_wid = ((hsync_start & 0x1fff) + | (hsync_wid << 16) + | ((mode->Flags & V_NHSYNC) + ? RADEON_CRTC_H_SYNC_POL + : RADEON_CRTC_H_SYNC_POL)); + +#if 1 + /* This works for double scan mode. */ + save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) + | ((mode->CrtcVDisplay - 1) << 16)); +#else + /* This is what cce/nbmode.c example code + does -- is this correct? */ + save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) + | ((mode->CrtcVDisplay + * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1) + << 16)); +#endif + + vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; + if (!vsync_wid) vsync_wid = 1; + if (vsync_wid > 0x1f) vsync_wid = 0x1f; + + save->crtc2_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff) + | (vsync_wid << 16) + | ((mode->Flags & V_NVSYNC) + ? RADEON_CRTC2_V_SYNC_POL + : RADEON_CRTC2_V_SYNC_POL)); + + save->crtc2_offset = 0; + save->crtc2_offset_cntl = 0; + + save->crtc2_pitch = ((pScrn->displayWidth * pScrn->bitsPerPixel) + + ((pScrn->bitsPerPixel * 8) -1)) / + (pScrn->bitsPerPixel * 8); + save->crtc2_pitch |= save->crtc2_pitch << 16; + + RADEONTRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n", + save->crtc2_pitch, pScrn->virtualX, + info->CurrentLayout.displayWidth)); + return TRUE; +} + /* Note: Radeon flat panel support has been disabled for now */ /* Define CRTC registers for requested video mode. */ static void RADEONInitFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr orig, @@ -2565,92 +3911,90 @@ int yres = mode->CrtcVDisplay; float Hratio, Vratio; - if (info->CRTOnly) { - save->crtc_ext_cntl |= RADEON_CRTC_CRT_ON; - save->crtc2_gen_cntl = 0; - save->fp_gen_cntl = orig->fp_gen_cntl; - save->fp_gen_cntl &= ~(RADEON_FP_FPON | - RADEON_FP_CRTC_USE_SHADOW_VEND | - RADEON_FP_CRTC_HORZ_DIV2_EN | - RADEON_FP_CRTC_HOR_CRT_DIV2_DIS | - RADEON_FP_USE_SHADOW_EN); - save->fp_gen_cntl |= (RADEON_FP_SEL_CRTC2 | - RADEON_FP_CRTC_DONT_SHADOW_VPAR); - save->fp_panel_cntl = orig->fp_panel_cntl & ~RADEON_FP_DIGON; - save->lvds_gen_cntl = orig->lvds_gen_cntl & ~(RADEON_LVDS_ON | - RADEON_LVDS_BLON); - return; + if(info->PanelXRes == 0 || info->PanelYRes == 0) + { + Hratio = 1; + Vratio = 1; } - + else + { if (xres > info->PanelXRes) xres = info->PanelXRes; if (yres > info->PanelYRes) yres = info->PanelYRes; Hratio = (float)xres/(float)info->PanelXRes; Vratio = (float)yres/(float)info->PanelYRes; + } + if (Hratio == 1.0) + { + save->fp_horz_stretch = orig->fp_horz_stretch; + save->fp_horz_stretch &= ~(RADEON_HORZ_STRETCH_BLEND | + RADEON_HORZ_STRETCH_ENABLE); + } + else + { save->fp_horz_stretch = - (((((int)(Hratio * RADEON_HORZ_STRETCH_RATIO_MAX + 0.5)) - & RADEON_HORZ_STRETCH_RATIO_MASK) - << RADEON_HORZ_STRETCH_RATIO_SHIFT) | + ((((unsigned long)(Hratio * RADEON_HORZ_STRETCH_RATIO_MAX + + 0.5)) & RADEON_HORZ_STRETCH_RATIO_MASK)) | (orig->fp_horz_stretch & (RADEON_HORZ_PANEL_SIZE | RADEON_HORZ_FP_LOOP_STRETCH | - RADEON_HORZ_STRETCH_RESERVED))); - save->fp_horz_stretch &= ~RADEON_HORZ_AUTO_RATIO_FIX_EN; - if (Hratio == 1.0) save->fp_horz_stretch &= ~(RADEON_HORZ_STRETCH_BLEND | - RADEON_HORZ_STRETCH_ENABLE); - else save->fp_horz_stretch |= (RADEON_HORZ_STRETCH_BLEND | + RADEON_HORZ_AUTO_RATIO_INC)); + save->fp_horz_stretch |= (RADEON_HORZ_STRETCH_BLEND | RADEON_HORZ_STRETCH_ENABLE); + } + save->fp_horz_stretch &= ~RADEON_HORZ_AUTO_RATIO; + if (Vratio == 1.0) + { + save->fp_vert_stretch = orig->fp_vert_stretch; + save->fp_vert_stretch &= ~(RADEON_VERT_STRETCH_ENABLE| + RADEON_VERT_STRETCH_BLEND); + } + else + { save->fp_vert_stretch = - (((((int)(Vratio * RADEON_VERT_STRETCH_RATIO_MAX + 0.5)) - & RADEON_VERT_STRETCH_RATIO_MASK) - << RADEON_VERT_STRETCH_RATIO_SHIFT) | + (((((unsigned long)(Vratio * RADEON_VERT_STRETCH_RATIO_MAX + + 0.5)) & RADEON_VERT_STRETCH_RATIO_MASK)) | (orig->fp_vert_stretch & (RADEON_VERT_PANEL_SIZE | RADEON_VERT_STRETCH_RESERVED))); - save->fp_vert_stretch &= ~RADEON_VERT_AUTO_RATIO_EN; - if (Vratio == 1.0) save->fp_vert_stretch &= ~(RADEON_VERT_STRETCH_ENABLE | - RADEON_VERT_STRETCH_BLEND); - else save->fp_vert_stretch |= (RADEON_VERT_STRETCH_ENABLE | + save->fp_vert_stretch |= (RADEON_VERT_STRETCH_ENABLE | RADEON_VERT_STRETCH_BLEND); + } + save->fp_vert_stretch &= ~RADEON_VERT_AUTO_RATIO_EN; - save->fp_gen_cntl = (orig->fp_gen_cntl & ~(RADEON_FP_SEL_CRTC2 | - RADEON_FP_CRTC_USE_SHADOW_VEND | - RADEON_FP_CRTC_HORZ_DIV2_EN | - RADEON_FP_CRTC_HOR_CRT_DIV2_DIS | - RADEON_FP_USE_SHADOW_EN)); - if (orig->fp_gen_cntl & RADEON_FP_DETECT_SENSE) { + save->fp_gen_cntl = (orig->fp_gen_cntl & (CARD32) + ~(RADEON_FP_SEL_CRTC2 | + RADEON_FP_RMX_HVSYNC_CONTROL_EN | + RADEON_FP_DFP_SYNC_SEL | + RADEON_FP_CRT_SYNC_SEL | + RADEON_FP_CRTC_LOCK_8DOT | + RADEON_FP_USE_SHADOW_EN | + RADEON_FP_CRTC_USE_SHADOW_VEND | + RADEON_FP_CRT_SYNC_ALT)); save->fp_gen_cntl |= (RADEON_FP_CRTC_DONT_SHADOW_VPAR | - RADEON_FP_TDMS_EN); - } + RADEON_FP_CRTC_DONT_SHADOW_HEND ); - save->fp_panel_cntl = orig->fp_panel_cntl; save->lvds_gen_cntl = orig->lvds_gen_cntl; - + save->lvds_pll_cntl = orig->lvds_pll_cntl; save->tmds_crc = orig->tmds_crc; - /* Disable CRT output by disabling CRT output and setting the CRT - DAC to use CRTC2, which we set to 0's. In the future, we will - want to use the dual CRTC capabilities of the RADEON to allow both - the flat panel and external CRT to either simultaneously display - the same image or display two different images. */ + /* Disable CRT output by disabling CRT output for DFP*/ save->crtc_ext_cntl &= ~RADEON_CRTC_CRT_ON; - save->dac_cntl |= RADEON_DAC_CRT_SEL_CRTC2; - save->crtc2_gen_cntl = 0; - /* WARNING: Be careful about turning on the flat panel */ -#if 1 + if(info->DisplayType == MT_LCD) + { save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_BLON); -#else - save->fp_panel_cntl |= (RADEON_FP_DIGON | RADEON_FP_BLON); - save->fp_gen_cntl |= (RADEON_FP_FPON); -#endif + save->fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); + } + else if(info->DisplayType == MT_DFP) + save->fp_gen_cntl |= (RADEON_FP_FPON | RADEON_FP_TMDS_EN); - save->fp_crtc_h_total_disp = save->crtc_h_total_disp; - save->fp_crtc_v_total_disp = save->crtc_v_total_disp; - save->fp_h_sync_strt_wid = save->crtc_h_sync_strt_wid; - save->fp_v_sync_strt_wid = save->crtc_v_sync_strt_wid; + save->fp_crtc_h_total_disp = orig->fp_crtc_h_total_disp; + save->fp_crtc_v_total_disp = orig->fp_crtc_v_total_disp; + save->fp_h_sync_strt_wid = orig->fp_h_sync_strt_wid; + save->fp_v_sync_strt_wid = orig->fp_v_sync_strt_wid; + } -#endif /* Define PLL registers for requested video mode. */ static void RADEONInitPLLRegisters(RADEONSavePtr save, RADEONPLLPtr pll, @@ -2703,6 +4047,57 @@ save->htotal_cntl = 0; } +/* Define PLL2 registers for requested video mode. */ +static void RADEONInitPLL2Registers(RADEONSavePtr save, RADEONPLLPtr pll, + double dot_clock) +{ + unsigned long freq = dot_clock * 100; + struct { + int divider; + int bitvalue; + } *post_div, + post_divs[] = { + /* From RAGE 128 VR/RAGE 128 GL Register + Reference Manual (Technical Reference + Manual P/N RRG-G04100-C Rev. 0.04), page + 3-17 (PLL_DIV_[3:0]). */ + { 1, 0 }, /* VCLK_SRC */ + { 2, 1 }, /* VCLK_SRC/2 */ + { 4, 2 }, /* VCLK_SRC/4 */ + { 8, 3 }, /* VCLK_SRC/8 */ + { 3, 4 }, /* VCLK_SRC/3 */ + { 16, 5 }, /* VCLK_SRC/16 */ + { 6, 6 }, /* VCLK_SRC/6 */ + { 12, 7 }, /* VCLK_SRC/12 */ + { 0, 0 } + }; + + if (freq > pll->max_pll_freq) freq = pll->max_pll_freq; + if (freq * 12 < pll->min_pll_freq) freq = pll->min_pll_freq / 12; + + for (post_div = &post_divs[0]; post_div->divider; ++post_div) { + save->pll_output_freq_2 = post_div->divider * freq; + if (save->pll_output_freq_2 >= pll->min_pll_freq + && save->pll_output_freq_2 <= pll->max_pll_freq) break; + } + + save->dot_clock_freq_2 = freq; + save->feedback_div_2 = RADEONDiv(pll->reference_div + * save->pll_output_freq_2, + pll->reference_freq); + save->post_div_2 = post_div->divider; + + RADEONTRACE(("dc=%d, of=%d, fd=%d, pd=%d\n", + save->dot_clock_freq_2, + save->pll_output_freq_2, + save->feedback_div_2, + save->post_div_2)); + + save->p2pll_ref_div = pll->reference_div; + save->p2pll_div_0 = (save->feedback_div_2 | (post_div->bitvalue<<16)); + save->htotal_cntl2 = 0; +} + /* Define DDA registers for requested video mode. */ static Bool RADEONInitDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, RADEONPLLPtr pll, RADEONInfoPtr info) @@ -2771,10 +4166,12 @@ /* Define initial palette for requested video mode. This doesn't do anything for XFree86 4.0. */ +/* static void RADEONInitPalette(RADEONSavePtr save) { save->palette_valid = FALSE; } +*/ /* Define registers for a requested video mode. */ static Bool RADEONInit(ScrnInfoPtr pScrn, DisplayModePtr mode, @@ -2832,18 +4229,44 @@ info->Flags = mode->Flags; + if(info->IsSecondary) + { + if (!RADEONInitCrtc2Registers(pScrn, save, + pScrn->currentMode,info)) + return FALSE; + RADEONInitPLL2Registers(save, &info->pll, dot_clock); + } + else + { RADEONInitCommonRegisters(save, info); - if (!RADEONInitCrtcRegisters(pScrn, save, mode, info)) return FALSE; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) - RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info); -#endif + if(!RADEONInitCrtcRegisters(pScrn, save, mode, info)) + return FALSE; + if(dot_clock) + { RADEONInitPLLRegisters(save, &info->pll, dot_clock); if (!RADEONInitDDARegisters(pScrn, save, &info->pll, info)) return FALSE; - if (!info->PaletteSavedOnVT) RADEONInitPalette(save); + } + else + { + save->ppll_ref_div = info->SavedReg.ppll_ref_div; + save->ppll_div_3 = info->SavedReg.ppll_div_3; + save->htotal_cntl = info->SavedReg.htotal_cntl; + save->dda_config = info->SavedReg.dda_config; + save->dda_on_off = info->SavedReg.dda_on_off; + + } + /* not used for now */ + /*if (!info->PaletteSavedOnVT) RADEONInitPalette(save);*/ + } + + if (((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD))) + { + RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info); + } + RADEONTRACE(("RADEONInit returns %p\n", save)); return TRUE; } @@ -2855,13 +4278,13 @@ if (!RADEONInit(pScrn, mode, &info->ModeReg)) return FALSE; /* FIXME? DRILock/DRIUnlock here? */ + pScrn->vtSema = TRUE; RADEONBlank(pScrn); RADEONRestoreMode(pScrn, &info->ModeReg); RADEONUnblank(pScrn); info->CurrentLayout.mode = mode; - return TRUE; } @@ -2885,31 +4308,38 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + /* when switch mode in dual-head setup, this function will be called + separately for each screen (depending on which screen the cursor is + in when user press ctrl-alt-+). Since this function is always + called when screen already in extensive mode, the sequence of + setting CRTC2 and CRT_EXT regesters doesn't matter any more, + So we set the flag for RADEONRestoreMode here. */ + info->SwitchingMode = TRUE; return RADEONModeInit(xf86Screens[scrnIndex], mode); + info->SwitchingMode = FALSE; } /* Used to disallow modes that are not supported by the hardware. */ int RADEONValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flag) { -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ + + /* Searching for native mode timing table embedded in BIOS image. + Not working yet. Currently we calculate from FP registers*/ + /****** ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RADEONInfoPtr info = RADEONPTR(pScrn); - - if (info->HasPanelRegs) { - if (mode->Flags & V_INTERLACE) return MODE_NO_INTERLACE; - if (mode->Flags & V_DBLSCAN) return MODE_NO_DBLESCAN; - } - - if (info->HasPanelRegs && !info->CRTOnly && info->VBIOS) { + if (info->DisplayType == MT_LCD && info->VBIOS) + { int i; - for (i = info->FPBIOSstart+64; RADEON_BIOS16(i) != 0; i += 2) { + for (i = info->FPBIOSstart+0x40; RADEON_BIOS16(i) != 0; i += 2) { int j = RADEON_BIOS16(i); if (mode->CrtcHDisplay == RADEON_BIOS16(j) && mode->CrtcVDisplay == RADEON_BIOS16(j+2)) { - /* Assume we are using expanded mode */ if (RADEON_BIOS16(j+5)) j = RADEON_BIOS16(j+5); else j += 9; @@ -2932,13 +4362,11 @@ mode->CrtcVSyncStart + ((RADEON_BIOS16(j+19) >> 11)&0x1f); mode->VTotal = mode->CrtcVTotal = (RADEON_BIOS16(j+15) & 0x07ff)+1; - return MODE_OK; } } return MODE_NOMODE; - } -#endif + }*****/ return MODE_OK; } @@ -2963,7 +4391,14 @@ Base &= ~7; /* 3 lower bits are always 0 */ + if(info->IsSecondary) + { + Base += pScrn->fbOffset; + OUTREG(RADEON_CRTC2_OFFSET, Base); + } + else OUTREG(RADEON_CRTC_OFFSET, Base); + } /* Called when VT switching back to the X server. Reinitialize the video @@ -2974,19 +4409,26 @@ RADEONInfoPtr info = RADEONPTR(pScrn); RADEONTRACE(("RADEONEnterVT\n")); + + if (info->FBDev) { + unsigned char *RADEONMMIO = info->MMIO; + if (!fbdevHWEnterVT(scrnIndex,flags)) return FALSE; + info->PaletteSavedOnVT = FALSE; + info->ModeReg.surface_cntl = INREG(RADEON_SURFACE_CNTL); + } else + if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE; + + if (info->accelOn) + RADEONEngineRestore(pScrn); + #ifdef XF86DRI if (RADEONPTR(pScrn)->directRenderingEnabled) { RADEONCP_START(pScrn, info); DRIUnlock(pScrn->pScreen); } #endif - if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE; - if (info->accelOn) - RADEONEngineRestore(pScrn); - info->PaletteSavedOnVT = FALSE; RADEONAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - return TRUE; } @@ -3005,31 +4447,13 @@ RADEONCP_STOP(pScrn, info); } #endif - RADEONSavePalette(pScrn, save); - info->PaletteSavedOnVT = TRUE; - RADEONRestore(pScrn); -} -static Bool -RADEONEnterVTFBDev(int scrnIndex, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONSavePtr restore = &info->SavedReg; - fbdevHWEnterVT(scrnIndex,flags); - RADEONRestorePalette(pScrn,restore); - if (info->accelOn) - RADEONEngineRestore(pScrn); - return TRUE; -} - -static void RADEONLeaveVTFBDev(int scrnIndex, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONSavePtr save = &info->SavedReg; - RADEONSavePalette(pScrn,save); - fbdevHWLeaveVT(scrnIndex,flags); + if (info->FBDev) { + RADEONSavePalette(pScrn, save); + info->PaletteSavedOnVT = TRUE; + fbdevHWLeaveVT(scrnIndex,flags); + } else + RADEONRestore(pScrn); } /* Called at the end of each server generation. Restore the original text @@ -3050,7 +4474,8 @@ } #endif - if (pScrn->vtSema) { + if (pScrn->vtSema) + { RADEONRestore(pScrn); RADEONUnmapMem(pScrn); } @@ -3069,6 +4494,8 @@ pScrn->vtSema = FALSE; + xf86ClearPrimInitDone(pScrn->entityList[0]); + pScreen->BlockHandler = info->BlockHandler; pScreen->CloseScreen = info->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); @@ -3079,6 +4506,7 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RADEONTRACE(("RADEONFreeScreen\n")); + if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) vgaHWFreeHWRec(pScrn); RADEONFreeRec(pScrn); Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.3 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.3 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.4 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.9 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c:1.9 Fri May 4 15:05:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c Tue Jan 15 21:00:44 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.9 2001/05/04 19:05:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.15 2002/01/16 02:00:44 martin Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -78,7 +78,17 @@ { PCI_CHIP_RADEON_QE, "ATI Radeon QE (AGP)" }, { PCI_CHIP_RADEON_QF, "ATI Radeon QF (AGP)" }, { PCI_CHIP_RADEON_QG, "ATI Radeon QG (AGP)" }, - { PCI_CHIP_RADEON_VE, "ATI Radeon VE (AGP)" }, + { PCI_CHIP_RADEON_QY, "ATI Radeon VE QY (AGP)" }, + { PCI_CHIP_RADEON_QZ, "ATI Radeon VE QZ (AGP)" }, + { PCI_CHIP_RADEON_LW, "ATI Radeon Mobility LW (AGP)" }, + { PCI_CHIP_RADEON_LY, "ATI Radeon Mobility LY (AGP)" }, + { PCI_CHIP_RADEON_LZ, "ATI Radeon Mobility LZ (AGP)" }, + { PCI_CHIP_R200_QL, "ATI Radeon 8500 QL (AGP)" }, + { PCI_CHIP_R200_QN, "ATI Radeon 8500 QN (AGP)" }, + { PCI_CHIP_R200_QO, "ATI Radeon 8500 QO (AGP)" }, + { PCI_CHIP_R200_Ql, "ATI Radeon 8500 Ql (AGP)" }, + { PCI_CHIP_R200_BB, "ATI Radeon 8500 BB (AGP)" }, + { PCI_CHIP_RV200_QW, "ATI Radeon 7500 QW (AGP)" }, { -1, NULL } }; @@ -87,10 +97,22 @@ { PCI_CHIP_RADEON_QE, PCI_CHIP_RADEON_QE, RES_SHARED_VGA }, { PCI_CHIP_RADEON_QF, PCI_CHIP_RADEON_QF, RES_SHARED_VGA }, { PCI_CHIP_RADEON_QG, PCI_CHIP_RADEON_QG, RES_SHARED_VGA }, - { PCI_CHIP_RADEON_VE, PCI_CHIP_RADEON_VE, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_QY, PCI_CHIP_RADEON_QY, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_QZ, PCI_CHIP_RADEON_QZ, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_LW, PCI_CHIP_RADEON_LW, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_LY, PCI_CHIP_RADEON_LY, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_LZ, PCI_CHIP_RADEON_LZ, RES_SHARED_VGA }, + { PCI_CHIP_R200_QL, PCI_CHIP_R200_QL, RES_SHARED_VGA }, + { PCI_CHIP_R200_QN, PCI_CHIP_R200_QN, RES_SHARED_VGA }, + { PCI_CHIP_R200_QO, PCI_CHIP_R200_QO, RES_SHARED_VGA }, + { PCI_CHIP_R200_Ql, PCI_CHIP_R200_Ql, RES_SHARED_VGA }, + { PCI_CHIP_R200_BB, PCI_CHIP_R200_BB, RES_SHARED_VGA }, + { PCI_CHIP_RV200_QW, PCI_CHIP_RV200_QW, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; +int gRADEONEntityIndex = -1; + /* Return the options for supported chipset 'n'; NULL otherwise */ const OptionInfoRec * RADEONAvailableOptions(int chipid, int busid) @@ -127,7 +149,6 @@ int numDevSections, nATIGDev, nRadeonGDev; int *usedChips; GDevPtr *devSections, *ATIGDevs, *RadeonGDevs; - EntityInfoPtr pEnt; Bool foundScreen = FALSE; int i; @@ -169,15 +190,17 @@ &usedChips); if (numUsed<=0) return FALSE; - - if (flags & PROBE_DETECT) - foundScreen = TRUE; - else for (i = 0; i < numUsed; i++) { - pEnt = xf86GetEntityInfo(usedChips[i]); - if (pEnt->active) { - ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); - + if (flags & PROBE_DETECT) foundScreen = TRUE; + else for (i = 0; i < numUsed; i++) + { + ScrnInfoPtr pScrn; + EntityInfoPtr pEnt; + + pScrn = NULL; + if((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], + RADEONPciChipsets, 0, 0, 0, 0, 0))) + { #ifdef XFree86LOADER if (!xf86LoadSubModule(pScrn, "radeon")) { @@ -188,7 +211,6 @@ } xf86LoaderReqSymLists(RADEONSymbols, NULL); - #endif pScrn->driverVersion = RADEON_VERSION_CURRENT; @@ -203,11 +225,50 @@ pScrn->LeaveVT = RADEONLeaveVT; pScrn->FreeScreen = RADEONFreeScreen; pScrn->ValidMode = RADEONValidMode; - foundScreen = TRUE; + + } + + pEnt = xf86GetEntityInfo(usedChips[i]); - xf86ConfigActivePciEntity(pScrn, usedChips[i], RADEONPciChipsets, - 0, 0, 0, 0, 0); + /* VE/M6 card support Dual-Head, mark the entity as sharable*/ + if(pEnt->chipset == PCI_CHIP_RADEON_QY || + pEnt->chipset == PCI_CHIP_RADEON_QZ || + pEnt->chipset == PCI_CHIP_R200_QL || + pEnt->chipset == PCI_CHIP_R200_QN || + pEnt->chipset == PCI_CHIP_R200_QO || + pEnt->chipset == PCI_CHIP_R200_Ql || + pEnt->chipset == PCI_CHIP_R200_BB || + pEnt->chipset == PCI_CHIP_RV200_QW || + pEnt->chipset == PCI_CHIP_RADEON_LW || + pEnt->chipset == PCI_CHIP_RADEON_LY || + pEnt->chipset == PCI_CHIP_RADEON_LZ) + { + static int instance = 0; + DevUnion* pPriv; + + xf86SetEntitySharable(usedChips[i]); + xf86SetEntityInstanceForScreen(pScrn, + pScrn->entityList[0], instance); + + if(gRADEONEntityIndex < 0) + { + gRADEONEntityIndex = xf86AllocateEntityPrivateIndex(); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + + if (!pPriv->ptr) + { + RADEONEntPtr pRADEONEnt; + pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->IsDRIEnabled = FALSE; + pRADEONEnt->BypassSecondary = FALSE; + pRADEONEnt->HasSecondary = FALSE; + pRADEONEnt->IsSecondaryRestored = FALSE; + } + } + instance++; } xfree(pEnt); } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.5 Mon May 7 17:59:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h Wed Jul 25 04:04:43 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.6 2001/07/25 08:04:43 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -40,6 +40,21 @@ #include "atiproto.h" #include "xf86str.h" + +typedef struct +{ + Bool IsDRIEnabled; + + Bool HasSecondary; + Bool BypassSecondary; + /*These two registers are used to make sure the CRTC2 is + retored before CRTC_EXT, otherwise it could lead to blank screen.*/ + Bool IsSecondaryRestored; + Bool RestorePrimary; + + ScrnInfoPtr pSecondaryScrn; + ScrnInfoPtr pPrimaryScrn; +}RADEONEntRec, *RADEONEntPtr; /* radeon_probe.c */ extern const OptionInfoRec * RADEONAvailableOptions Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.9 Wed May 2 11:06:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h Wed Sep 26 08:49:25 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.9 2001/05/02 15:06:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.13 2001/09/26 12:49:25 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -85,9 +85,9 @@ #if !RADEON_ATOMIC_UPDATE #define OUTPLL(addr, val) \ do { \ - while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & 0x9f) != \ + while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & 0xbf) != \ (addr | RADEON_PLL_WR_EN)) { \ - OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x1f) | \ + OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \ RADEON_PLL_WR_EN)); \ } \ OUTREG(RADEON_CLOCK_CNTL_DATA, val); \ @@ -95,7 +95,7 @@ #else #define OUTPLL(addr, val) \ do { \ - OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x1f) | \ + OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \ RADEON_PLL_WR_EN)); \ OUTREG(RADEON_CLOCK_CNTL_DATA, val); \ } while (0) @@ -139,15 +139,16 @@ #define PAL_SELECT(idx) \ do { \ - if (idx) { \ - OUTREG(RADEON_DAC_CNTL, INREG(RADEON_DAC_CNTL) | \ - RADEON_DAC_PALETTE_ACC_CTL); \ + if (!idx) { \ + OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) & \ + (CARD32)~RADEON_DAC2_PALETTE_ACC_CTL); \ } else { \ - OUTREG(RADEON_DAC_CNTL, INREG(RADEON_DAC_CNTL) & \ - (CARD32)~RADEON_DAC_PALETTE_ACC_CTL); \ + OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) | \ + RADEON_DAC2_PALETTE_ACC_CTL); \ } \ } while (0) + #define RADEON_ADAPTER_ID 0x0f2c /* PCI */ #define RADEON_AGP_BASE 0x0170 #define RADEON_AGP_CNTL 0x0174 @@ -203,6 +204,10 @@ #define RADEON_BIOS_1_SCRATCH 0x0014 #define RADEON_BIOS_2_SCRATCH 0x0018 #define RADEON_BIOS_3_SCRATCH 0x001c +#define RADEON_BIOS_4_SCRATCH 0x0020 +#define RADEON_BIOS_5_SCRATCH 0x0024 +#define RADEON_BIOS_6_SCRATCH 0x0028 +#define RADEON_BIOS_7_SCRATCH 0x002c #define RADEON_BIOS_ROM 0x0f30 /* PCI */ #define RADEON_BIST 0x0f0f /* PCI */ #define RADEON_BRUSH_DATA0 0x1480 @@ -292,6 +297,7 @@ #define RADEON_CLOCK_CNTL_INDEX 0x0008 # define RADEON_PLL_WR_EN (1 << 7) # define RADEON_PLL_DIV_SEL (3 << 8) +# define RADEON_PLL2_DIV_SEL_MASK ~(3 << 8) #define RADEON_CLR_CMP_CLR_3D 0x1a24 #define RADEON_CLR_CMP_CLR_DST 0x15c8 #define RADEON_CLR_CMP_CLR_SRC 0x15c4 @@ -329,6 +335,7 @@ # define RADEON_CRTC_HSYNC_DIS (1 << 8) # define RADEON_CRTC_VSYNC_DIS (1 << 9) # define RADEON_CRTC_DISPLAY_DIS (1 << 10) +# define RADEON_CRTC_SYNC_TRISTAT (1 << 11) # define RADEON_CRTC_CRT_ON (1 << 15) #define RADEON_CRTC_EXT_CNTL_DPMS_BYTE 0x0055 # define RADEON_CRTC_HSYNC_DIS_BYTE (1 << 0) @@ -344,23 +351,54 @@ # define RADEON_CRTC_EXT_DISP_EN (1 << 24) # define RADEON_CRTC_EN (1 << 25) # define RADEON_CRTC_DISP_REQ_EN_B (1 << 26) +#define RADEON_CRTC2_GEN_CNTL 0x03f8 +# define RADEON_CRTC2_DBL_SCAN_EN (1 << 0) +# define RADEON_CRTC2_INTERLACE_EN (1 << 1) +# define RADEON_CRTC2_SYNC_TRISTAT (1 << 4) +# define RADEON_CRTC2_HSYNC_TRISTAT (1 << 5) +# define RADEON_CRTC2_VSYNC_TRISTAT (1 << 6) +# define RADEON_CRTC2_CRT2_ON (1 << 7) +# define RADEON_CRTC2_ICON_EN (1 << 15) +# define RADEON_CRTC2_CUR_EN (1 << 16) +# define RADEON_CRTC2_CUR_MODE_MASK (7 << 20) +# define RADEON_CRTC2_DISP_DIS (1 << 23) +# define RADEON_CRTC2_EN (1 << 25) +# define RADEON_CRTC2_DISP_REQ_EN_B (1 << 26) +# define RADEON_CRTC2_HSYNC_DIS (1 << 28) +# define RADEON_CRTC2_VSYNC_DIS (1 << 29) #define RADEON_CRTC_GUI_TRIG_VLINE 0x0218 #define RADEON_CRTC_H_SYNC_STRT_WID 0x0204 # define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0) -# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x1ff << 3) +# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x3ff << 3) # define RADEON_CRTC_H_SYNC_STRT_CHAR_SHIFT 3 # define RADEON_CRTC_H_SYNC_WID (0x3f << 16) # define RADEON_CRTC_H_SYNC_WID_SHIFT 16 # define RADEON_CRTC_H_SYNC_POL (1 << 23) +#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304 +# define RADEON_CRTC2_H_SYNC_STRT_PIX (0x07 << 0) +# define RADEON_CRTC2_H_SYNC_STRT_CHAR (0x3ff << 3) +# define RADEON_CRTC2_H_SYNC_STRT_CHAR_SHIFT 3 +# define RADEON_CRTC2_H_SYNC_WID (0x3f << 16) +# define RADEON_CRTC2_H_SYNC_WID_SHIFT 16 +# define RADEON_CRTC2_H_SYNC_POL (1 << 23) #define RADEON_CRTC_H_TOTAL_DISP 0x0200 -# define RADEON_CRTC_H_TOTAL (0x01ff << 0) +# define RADEON_CRTC_H_TOTAL (0x03ff << 0) # define RADEON_CRTC_H_TOTAL_SHIFT 0 -# define RADEON_CRTC_H_DISP (0x00ff << 16) +# define RADEON_CRTC_H_DISP (0x01ff << 16) # define RADEON_CRTC_H_DISP_SHIFT 16 +#define RADEON_CRTC2_H_TOTAL_DISP 0x0300 +# define RADEON_CRTC2_H_TOTAL (0x03ff << 0) +# define RADEON_CRTC2_H_TOTAL_SHIFT 0 +# define RADEON_CRTC2_H_DISP (0x01ff << 16) +# define RADEON_CRTC2_H_DISP_SHIFT 16 #define RADEON_CRTC_OFFSET 0x0224 +#define RADEON_CRTC2_OFFSET 0x0324 #define RADEON_CRTC_OFFSET_CNTL 0x0228 # define RADEON_CRTC_TILE_EN (1 << 15) +#define RADEON_CRTC2_OFFSET_CNTL 0x0328 +# define RADEON_CRTC2_TILE_EN (1 << 15) #define RADEON_CRTC_PITCH 0x022c +#define RADEON_CRTC2_PITCH 0x032c #define RADEON_CRTC_STATUS 0x005c # define RADEON_CRTC_VBLANK_SAVE (1 << 1) #define RADEON_CRTC_V_SYNC_STRT_WID 0x020c @@ -369,25 +407,28 @@ # define RADEON_CRTC_V_SYNC_WID (0x1f << 16) # define RADEON_CRTC_V_SYNC_WID_SHIFT 16 # define RADEON_CRTC_V_SYNC_POL (1 << 23) +#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c +# define RADEON_CRTC2_V_SYNC_STRT (0x7ff << 0) +# define RADEON_CRTC2_V_SYNC_STRT_SHIFT 0 +# define RADEON_CRTC2_V_SYNC_WID (0x1f << 16) +# define RADEON_CRTC2_V_SYNC_WID_SHIFT 16 +# define RADEON_CRTC2_V_SYNC_POL (1 << 23) #define RADEON_CRTC_V_TOTAL_DISP 0x0208 # define RADEON_CRTC_V_TOTAL (0x07ff << 0) # define RADEON_CRTC_V_TOTAL_SHIFT 0 # define RADEON_CRTC_V_DISP (0x07ff << 16) # define RADEON_CRTC_V_DISP_SHIFT 16 +#define RADEON_CRTC2_V_TOTAL_DISP 0x0308 +# define RADEON_CRTC2_V_TOTAL (0x07ff << 0) +# define RADEON_CRTC2_V_TOTAL_SHIFT 0 +# define RADEON_CRTC2_V_DISP (0x07ff << 16) +# define RADEON_CRTC2_V_DISP_SHIFT 16 #define RADEON_CRTC_VLINE_CRNT_VLINE 0x0210 # define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16) #define RADEON_CRTC2_CRNT_FRAME 0x0314 #define RADEON_CRTC2_DEBUG 0x031c -#define RADEON_CRTC2_GEN_CNTL 0x03f8 #define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318 -#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304 -#define RADEON_CRTC2_H_TOTAL_DISP 0x0300 -#define RADEON_CRTC2_OFFSET 0x0324 -#define RADEON_CRTC2_OFFSET_CNTL 0x0328 -#define RADEON_CRTC2_PITCH 0x032c #define RADEON_CRTC2_STATUS 0x03fc -#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c -#define RADEON_CRTC2_V_TOTAL_DISP 0x0308 #define RADEON_CRTC2_VLINE_CRNT_VLINE 0x0310 #define RADEON_CRTC8_DATA 0x03d5 /* VGA, 0x3b5 */ #define RADEON_CRTC8_IDX 0x03d4 /* VGA, 0x3b4 */ @@ -397,15 +438,33 @@ #define RADEON_CUR_HORZ_VERT_POSN 0x0264 #define RADEON_CUR_OFFSET 0x0260 # define RADEON_CUR_LOCK (1 << 31) +#define RADEON_CUR2_CLR0 0x036c +#define RADEON_CUR2_CLR1 0x0370 +#define RADEON_CUR2_HORZ_VERT_OFF 0x0368 +#define RADEON_CUR2_HORZ_VERT_POSN 0x0364 +#define RADEON_CUR2_OFFSET 0x0360 +# define RADEON_CUR2_LOCK (1 << 31) #define RADEON_DAC_CNTL 0x0058 # define RADEON_DAC_RANGE_CNTL (3 << 0) # define RADEON_DAC_BLANKING (1 << 2) -# define RADEON_DAC_CRT_SEL_CRTC2 (1 << 4) -# define RADEON_DAC_PALETTE_ACC_CTL (1 << 5) # define RADEON_DAC_8BIT_EN (1 << 8) # define RADEON_DAC_VGA_ADR_EN (1 << 13) +# define RADEON_DAC_PDWN (1 << 15) # define RADEON_DAC_MASK_ALL (0xff << 24) +#define RADEON_DAC_CNTL2 0x007c +# define RADEON_DAC2_DAC_CLK_SEL (1 << 0) +# define RADEON_DAC2_DAC2_CLK_SEL (1 << 1) +# define RADEON_DAC2_PALETTE_ACC_CTL (1 << 5) +#define RADEON_TV_DAC_CNTL 0x088c +# define RADEON_TV_DAC_STD_MASK 0x0300 +# define RADEON_TV_DAC_RDACPD (1 << 24) +# define RADEON_TV_DAC_GDACPD (1 << 25) +# define RADEON_TV_DAC_BDACPD (1 << 26) +#define RADEON_DISP_OUTPUT_CNTL 0x0d64 +# define RADEON_DISP_DAC_SOURCE_MASK 0x03 +# define RADEON_DISP_DAC_SOURCE_CRTC2 0x01 + #define RADEON_DAC_CRC_SIG 0x02cc #define RADEON_DAC_DATA 0x03c9 /* VGA */ #define RADEON_DAC_MASK 0x03c6 /* VGA */ @@ -533,6 +592,7 @@ #define RADEON_DST_HEIGHT_Y 0x15a0 #define RADEON_DST_LINE_START 0x1600 #define RADEON_DST_LINE_END 0x1604 +#define RADEON_DST_LINE_PATCOUNT 0x1608 #define RADEON_DST_OFFSET 0x1404 #define RADEON_DST_PITCH 0x1408 #define RADEON_DST_PITCH_OFFSET 0x142c @@ -568,45 +628,85 @@ #define RADEON_FOG_TABLE_DATA 0x1a18 #define RADEON_FP_CRTC_H_TOTAL_DISP 0x0250 #define RADEON_FP_CRTC_V_TOTAL_DISP 0x0254 +#define RADEON_FP_CRTC2_H_TOTAL_DISP 0x0350 +#define RADEON_FP_CRTC2_V_TOTAL_DISP 0x0354 +/*added for FP support------------------------------------------*/ +# define RADEON_FP_CRTC_H_TOTAL_MASK 0x000003ff +# define RADEON_FP_CRTC_H_DISP_MASK 0x01ff0000 +# define RADEON_FP_CRTC_V_TOTAL_MASK 0x00000fff +# define RADEON_FP_CRTC_V_DISP_MASK 0x0fff0000 +# define RADEON_FP_H_SYNC_STRT_CHAR_MASK 0x00001ff8 +# define RADEON_FP_H_SYNC_WID_MASK 0x003f0000 +# define RADEON_FP_V_SYNC_STRT_MASK 0x00000fff +# define RADEON_FP_V_SYNC_WID_MASK 0x001f0000 +# define RADEON_FP_CRTC_H_TOTAL_SHIFT 0x00000000 +# define RADEON_FP_CRTC_H_DISP_SHIFT 0x00000010 +# define RADEON_FP_CRTC_V_TOTAL_SHIFT 0x00000000 +# define RADEON_FP_CRTC_V_DISP_SHIFT 0x00000010 +# define RADEON_FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003 +# define RADEON_FP_H_SYNC_WID_SHIFT 0x00000010 +# define RADEON_FP_V_SYNC_STRT_SHIFT 0x00000000 +# define RADEON_FP_V_SYNC_WID_SHIFT 0x00000010 +/*-----------------------------------------------------------------*/ #define RADEON_FP_GEN_CNTL 0x0284 -# define RADEON_FP_FPON (1 << 0) -# define RADEON_FP_TDMS_EN (1 << 2) +# define RADEON_FP_FPON (1 << 0) +# define RADEON_FP_TMDS_EN (1 << 2) +# define RADEON_FP_EN_TMDS (1 << 7) # define RADEON_FP_DETECT_SENSE (1 << 8) # define RADEON_FP_SEL_CRTC2 (1 << 13) +# define RADEON_FP_CRTC_DONT_SHADOW_HPAR (1 << 15) # define RADEON_FP_CRTC_DONT_SHADOW_VPAR (1 << 16) +# define RADEON_FP_CRTC_DONT_SHADOW_HEND (1 << 17) # define RADEON_FP_CRTC_USE_SHADOW_VEND (1 << 18) -# define RADEON_FP_CRTC_HORZ_DIV2_EN (1 << 20) -# define RADEON_FP_CRTC_HOR_CRT_DIV2_DIS (1 << 21) +# define RADEON_FP_RMX_HVSYNC_CONTROL_EN (1 << 20) +# define RADEON_FP_DFP_SYNC_SEL (1 << 21) +# define RADEON_FP_CRTC_LOCK_8DOT (1 << 22) +# define RADEON_FP_CRT_SYNC_SEL (1 << 23) # define RADEON_FP_USE_SHADOW_EN (1 << 24) +# define RADEON_FP_CRT_SYNC_ALT (1 << 26) +#define RADEON_FP2_GEN_CNTL 0x0288 +# define RADEON_FP2_FPON (1 << 0) +# define RADEON_FP2_TMDS_EN (1 << 2) +# define RADEON_FP2_EN_TMDS (1 << 7) +# define RADEON_FP2_DETECT_SENSE (1 << 8) +# define RADEON_FP2_SEL_CRTC2 (1 << 13) +# define RADEON_FP2_FP_POL (1 << 16) +# define RADEON_FP2_LP_POL (1 << 17) +# define RADEON_FP2_SCK_POL (1 << 18) +# define RADEON_FP2_LCD_CNTL_MASK (7 << 19) +# define RADEON_FP2_PAD_FLOP_EN (1 << 22) +# define RADEON_FP2_CRC_EN (1 << 23) +# define RADEON_FP2_CRC_READ_EN (1 << 24) + #define RADEON_FP_H_SYNC_STRT_WID 0x02c4 +#define RADEON_FP_H2_SYNC_STRT_WID 0x03c4 #define RADEON_FP_HORZ_STRETCH 0x028c +#define RADEON_FP_HORZ2_STRETCH 0x038c # define RADEON_HORZ_STRETCH_RATIO_MASK 0xffff -# define RADEON_HORZ_STRETCH_RATIO_SHIFT 0 # define RADEON_HORZ_STRETCH_RATIO_MAX 4096 -# define RADEON_HORZ_PANEL_SIZE (0xff << 16) +# define RADEON_HORZ_PANEL_SIZE (0x1ff << 16) # define RADEON_HORZ_PANEL_SHIFT 16 # define RADEON_HORZ_STRETCH_PIXREP (0 << 25) -# define RADEON_HORZ_STRETCH_BLEND (1 << 25) -# define RADEON_HORZ_STRETCH_ENABLE (1 << 26) -# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 27) -# define RADEON_HORZ_STRETCH_RESERVED (1 << 30) -# define RADEON_HORZ_AUTO_RATIO_FIX_EN (1 << 31) - -#define RADEON_FP_PANEL_CNTL 0x0288 -# define RADEON_FP_DIGON (1 << 0) -# define RADEON_FP_BLON (1 << 1) +# define RADEON_HORZ_STRETCH_BLEND (1 << 26) +# define RADEON_HORZ_STRETCH_ENABLE (1 << 25) +# define RADEON_HORZ_AUTO_RATIO (1 << 27) +# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 28) +# define RADEON_HORZ_AUTO_RATIO_INC (1 << 31) + #define RADEON_FP_V_SYNC_STRT_WID 0x02c8 #define RADEON_FP_VERT_STRETCH 0x0290 -# define RADEON_VERT_PANEL_SIZE (0x7ff << 0) -# define RADEON_VERT_PANEL_SHIFT 0 -# define RADEON_VERT_STRETCH_RATIO_MASK 0x3ff -# define RADEON_VERT_STRETCH_RATIO_SHIFT 11 -# define RADEON_VERT_STRETCH_RATIO_MAX 1024 -# define RADEON_VERT_STRETCH_ENABLE (1 << 24) -# define RADEON_VERT_STRETCH_LINEREP (0 << 25) -# define RADEON_VERT_STRETCH_BLEND (1 << 25) -# define RADEON_VERT_AUTO_RATIO_EN (1 << 26) -# define RADEON_VERT_STRETCH_RESERVED 0xf8e00000 +#define RADEON_FP_V2_SYNC_STRT_WID 0x03c8 +#define RADEON_FP_VERT2_STRETCH 0x0390 +# define RADEON_VERT_PANEL_SIZE (0xfff << 12) +# define RADEON_VERT_PANEL_SHIFT 12 +# define RADEON_VERT_STRETCH_RATIO_MASK 0xfff +# define RADEON_VERT_STRETCH_RATIO_SHIFT 0 +# define RADEON_VERT_STRETCH_RATIO_MAX 4096 +# define RADEON_VERT_STRETCH_ENABLE (1 << 25) +# define RADEON_VERT_STRETCH_LINEREP (0 << 26) +# define RADEON_VERT_STRETCH_BLEND (1 << 26) +# define RADEON_VERT_AUTO_RATIO_EN (1 << 27) +# define RADEON_VERT_STRETCH_RESERVED 0xf1000000 #define RADEON_GEN_INT_CNTL 0x0040 #define RADEON_GEN_INT_STATUS 0x0044 @@ -619,24 +719,24 @@ #define RADEON_GENMO_WT 0x03c2 /* VGA */ #define RADEON_GENS0 0x03c2 /* VGA */ #define RADEON_GENS1 0x03da /* VGA, 0x03ba */ + +/*DDC interface using I2C*/ #define RADEON_GPIO_MONID 0x0068 -# define RADEON_GPIO_MONID_A_0 (1 << 0) -# define RADEON_GPIO_MONID_A_1 (1 << 1) -# define RADEON_GPIO_MONID_A_2 (1 << 2) -# define RADEON_GPIO_MONID_A_3 (1 << 3) -# define RADEON_GPIO_MONID_Y_0 (1 << 8) -# define RADEON_GPIO_MONID_Y_1 (1 << 9) -# define RADEON_GPIO_MONID_Y_2 (1 << 10) -# define RADEON_GPIO_MONID_Y_3 (1 << 11) -# define RADEON_GPIO_MONID_EN_0 (1 << 16) -# define RADEON_GPIO_MONID_EN_1 (1 << 17) -# define RADEON_GPIO_MONID_EN_2 (1 << 18) -# define RADEON_GPIO_MONID_EN_3 (1 << 19) -# define RADEON_GPIO_MONID_MASK_0 (1 << 24) -# define RADEON_GPIO_MONID_MASK_1 (1 << 25) -# define RADEON_GPIO_MONID_MASK_2 (1 << 26) -# define RADEON_GPIO_MONID_MASK_3 (1 << 27) #define RADEON_GPIO_MONIDB 0x006c +#define RADEON_GPIO_CRT2_DDC 0x006c +#define RADEON_GPIO_DVI_DDC 0x0064 +#define RADEON_GPIO_VGA_DDC 0x0060 +# define RADEON_GPIO_A_0 (1 << 0) +# define RADEON_GPIO_A_1 (1 << 1) +# define RADEON_GPIO_Y_0 (1 << 8) +# define RADEON_GPIO_Y_1 (1 << 9) +# define RADEON_GPIO_Y_SHIFT_0 8 +# define RADEON_GPIO_Y_SHIFT_1 9 +# define RADEON_GPIO_EN_0 (1 << 16) +# define RADEON_GPIO_EN_1 (1 << 17) +# define RADEON_GPIO_MASK_0 (1 << 24) /*??*/ +# define RADEON_GPIO_MASK_1 (1 << 25) /*??*/ + #define RADEON_GRPH8_DATA 0x03cf /* VGA */ #define RADEON_GRPH8_IDX 0x03ce /* VGA */ #define RADEON_GUI_DEBUG0 0x16a0 @@ -663,11 +763,14 @@ #define RADEON_HOST_DATA7 0x17dc #define RADEON_HOST_DATA_LAST 0x17e0 #define RADEON_HOST_PATH_CNTL 0x0130 +# define RADEON_HDP_SOFT_RESET (1 << 26) #define RADEON_HTOTAL_CNTL 0x0009 /* PLL */ +#define RADEON_HTOTAL2_CNTL 0x002e /* PLL */ #define RADEON_HW_DEBUG 0x0128 #define RADEON_HW_DEBUG2 0x011c #define RADEON_I2C_CNTL_1 0x0094 /* ? */ +#define RADEON_DVI_I2C_CNTL_1 0x02e4 /* ? */ #define RADEON_INTERRUPT_LINE 0x0f3c /* PCI */ #define RADEON_INTERRUPT_PIN 0x0f3d /* PCI */ #define RADEON_IO_BASE 0x0f14 /* PCI */ @@ -678,8 +781,15 @@ #define RADEON_LEAD_BRES_LNTH_SUB 0x1624 #define RADEON_LVDS_GEN_CNTL 0x02d0 # define RADEON_LVDS_ON (1 << 0) +# define RADEON_LVDS_DISPLAY_DIS (1 << 1) +# define RADEON_LVDS_PANEL_TYPE (1 << 2) +# define RADEON_LVDS_PANEL_FORMAT (1 << 3) +# define RADEON_LVDS_EN (1 << 7) +# define RADEON_LVDS_DIGON (1 << 18) # define RADEON_LVDS_BLON (1 << 19) # define RADEON_LVDS_SEL_CRTC2 (1 << 23) +#define RADEON_LVDS_PLL_CNTL 0x02d4 + # define RADEON_HSYNC_DELAY_SHIFT 28 # define RADEON_HSYNC_DELAY_MASK (0xf << 28) @@ -860,6 +970,19 @@ # define RADEON_PPLL_REF_DIV_MASK 0x03ff # define RADEON_PPLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ # define RADEON_PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ +#define RADEON_P2PLL_CNTL 0x002a /* P2PLL */ +# define RADEON_P2PLL_RESET (1 << 0) +# define RADEON_P2PLL_SLEEP (1 << 1) +# define RADEON_P2PLL_ATOMIC_UPDATE_EN (1 << 16) +# define RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN (1 << 17) +# define RADEON_P2PLL_ATOMIC_UPDATE_VSYNC (1 << 18) +#define RADEON_P2PLL_DIV_0 0x002c +# define RADEON_P2PLL_FB0_DIV_MASK 0x07ff +# define RADEON_P2PLL_POST0_DIV_MASK 0x00070000 +#define RADEON_P2PLL_REF_DIV 0x002B /* PLL */ +# define RADEON_P2PLL_REF_DIV_MASK 0x03ff +# define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ +# define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ #define RADEON_PWR_MNGMT_CNTL_STATUS 0x0f60 /* PCI */ #define RADEON_RBBM_SOFT_RESET 0x00f0 # define RADEON_SOFT_RESET_CP (1 << 0) @@ -891,6 +1014,8 @@ #define RADEON_SC_TOP 0x1648 #define RADEON_SC_TOP_LEFT 0x16ec #define RADEON_SC_TOP_LEFT_C 0x1c88 +# define RADEON_SC_SIGN_MASK_LO 0x8000 +# define RADEON_SC_SIGN_MASK_HI 0x80000000 #define RADEON_SDRAM_MODE_REG 0x0158 #define RADEON_SEQ8_DATA 0x03c5 /* VGA */ #define RADEON_SEQ8_IDX 0x03c4 /* VGA */ @@ -911,6 +1036,9 @@ #define RADEON_SUBPIC_CNTL 0x0540 /* ? */ #define RADEON_SUB_CLASS 0x0f0a /* PCI */ #define RADEON_SURFACE_CNTL 0x0b00 +# define RADEON_SURF_TRANSLATION_DIS (1 << 8) +# define RADEON_NONSURF_AP0_SWP_16BPP (1 << 20) +# define RADEON_NONSURF_AP0_SWP_32BPP (1 << 21) #define RADEON_SURFACE0_INFO 0x0b0c #define RADEON_SURFACE0_LOWER_BOUND 0x0b04 #define RADEON_SURFACE0_UPPER_BOUND 0x0b08 @@ -1630,3 +1758,4 @@ #define RADEON_CP_VC_CNTL_NUM_SHIFT 16 #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.2 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h:1.2 Sat Jan 6 15:58:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h Wed Jan 16 11:22:28 2002 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h,v 1.3 2002/01/16 16:22:28 tsi Exp $ */ /* - * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2000 through 2002 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.11 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c:1.11 Sat Mar 3 17:26:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c Wed Jul 18 22:22:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.11 2001/03/03 22:26:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.12 2001/07/19 02:22:50 tsi Exp $ */ #include "radeon.h" #include "radeon_reg.h" @@ -205,7 +205,7 @@ adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "ATI Rage128 Video Overlay"; + adapt->name = "ATI Radeon Video Overlay"; adapt->nEncodings = 1; adapt->pEncodings = &DummyEncoding; adapt->nFormats = NUM_FORMATS; Index: xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man:1.3 Wed May 9 15:57:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man Fri Jan 4 16:22:27 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man,v 1.3 2001/05/09 19:57:04 dbateman Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man,v 1.5 2002/01/04 21:22:27 tsi Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH CHIPS __drivermansuffix__ __vendorversion__ @@ -142,7 +142,7 @@ and programmable clocks. Default: off .TP .BI "Option \*qUseVclk1\*q \*q" boolean \*q -Use the Vclk1 programable clock on +Use the Vclk1 programmable clock on .B HiQV chipsets instead of Vclk2. Default: off .TP @@ -179,8 +179,7 @@ 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. +Enable or disable use of the shadow framebuffer layer. Default: off. .TP .BI "Option \*qSyncOnGreen\*q \*q" boolean \*q Enable or disable combining the sync signals with the green signal. Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.36 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.38 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.36 Wed May 9 15:57:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c Mon Jan 7 13:46:03 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c,v 1.36 2001/05/09 19:57:04 dbateman Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c,v 1.38 2002/01/07 18:46:03 dawes Exp $ */ /* * Copyright 1996, 1997, 1998 by David Bateman <dbateman@ee.uts.edu.au> * Modified 1997, 1998 by Nozomi Ytow @@ -59,7 +59,7 @@ # define DEBUG_P(x) /**/ #endif -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define CATNAME(prefix,subname) prefix##subname #else #define CATNAME(prefix,subname) prefix/**/subname @@ -1487,10 +1487,6 @@ } } -#ifndef __GNUC__ -#define __inline__ /**/ -#endif - static __inline__ void MoveDataFromCPU(unsigned char *src, unsigned char *dest, int srcwidth, int window, int h, int dwords) Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.23 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.23 Tue May 15 06:19:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c Mon Oct 1 09:44:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c,v 1.23 2001/05/15 10:19:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c,v 1.24 2001/10/01 13:44:03 eich Exp $ */ /* * Copyright 1994 The XFree86 Project @@ -77,12 +77,12 @@ 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->writeMSS(cPtr, VGAHWPTR(pScrn), ((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); + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), MSS); } } else { if(!cPtr->UseMMIO) { @@ -116,12 +116,12 @@ 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->writeMSS(cPtr, VGAHWPTR(pScrn), ((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); + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), MSS); } } else { if(!cPtr->UseMMIO) { @@ -164,14 +164,14 @@ 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->writeMSS(cPtr, VGAHWPTR(pScrn), ((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); + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), MSS); } } else { CARD32 xy; @@ -236,8 +236,8 @@ 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->writeMSS(cPtr, hwp, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_B)); /* Enable extended palette addressing */ xr80 = cPtr->readXR(cPtr, 0x80); cPtr->writeXR(cPtr, 0x80, xr80 | 0x1); @@ -267,7 +267,7 @@ /* Enable normal palette addressing */ cPtr->writeXR(cPtr, 0x80, xr80); cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); } } else if (IS_Wingine(cPtr)) { outl(DR(0xA), (bg & 0xFFFFFF)); @@ -351,12 +351,12 @@ 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->writeMSS(cPtr, VGAHWPTR(pScrn), ((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); + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), MSS); } } else if (!IS_Wingine(cPtr)) { if (!cPtr->UseMMIO) { Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c:1.2 Wed Dec 6 10:35:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c Mon Oct 1 09:44:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c,v 1.2 2000/12/06 15:35:12 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c,v 1.3 2001/10/01 13:44:04 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -112,7 +112,8 @@ currentMode->mode = pMode; currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; if(cPtr->Flags & ChipsAccelSupport) - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + currentMode->flags |= (cPtr->Flags & ChipsAccelSupport) + ? (DGA_FILL_RECT | DGA_BLIT_RECT) : 0; if(pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if(pMode->Flags & V_INTERLACE) Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c diff -u 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.117 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c:1.110.2.1 Fri May 25 14:15:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c Fri Jan 4 16:22:27 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.110.2.1 2001/05/25 18:15:44 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.117 2002/01/04 21:22:27 tsi Exp $ */ /* * Copyright 1993 by Jon Block <block@frc.com> @@ -569,7 +569,8 @@ OPTION_CRT2_MEM, OPTION_DUAL_REFRESH, OPTION_CRT_CLK_INDX, - OPTION_FP_CLK_INDX + OPTION_FP_CLK_INDX, + OPTION_FP_MODE } CHIPSOpts; static const OptionInfoRec Chips655xxOptions[] = { @@ -596,6 +597,7 @@ { OPTION_FP_CLOCK_8, "FPClock8", OPTV_FREQ, {0}, FALSE }, { OPTION_FP_CLOCK_16, "FPClock16", OPTV_FREQ, {0}, FALSE }, { OPTION_FP_CLOCK_24, "FPClock24", OPTV_FREQ, {0}, FALSE }, + { OPTION_FP_MODE, "FPMode", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -645,6 +647,7 @@ { 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 }, + { OPTION_FP_MODE, "FPMode", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -658,56 +661,67 @@ */ static const char *vgahwSymbols[] = { + "vgaHWAllocDefaultRegs", + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWHBlankKGA", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", - "vgaHWSaveScreen", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", + "vgaHWUnlock", + "vgaHWVBlankKGA", + "vgaHWddc1SetSpeed", NULL }; -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", "cfb8_16ScreenInit", + NULL +}; + +static const char *fbSymbols[] = { "fbScreenInit", "fbPictureInit", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", - "XAAInit", + "XAADestroyInfoRec", "XAAFillSolidRects" , + "XAAInit", "XAAInitDualFramebufferOverlay", "XAAStippleScanlineFuncMSBFirst", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *ddcSymbols[] = { - "xf86PrintEDID", "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; static const char *i2cSymbols[] = { "xf86CreateI2CBusRec", "xf86I2CBusInit", - "xf86I2CProbeAddress", "xf86I2CFindBus", + "xf86I2CProbeAddress", NULL }; @@ -718,6 +732,8 @@ static const char *vbeSymbols[] = { "VBEInit", + "vbeDoEDID", + "vbeFree", NULL }; @@ -763,7 +779,7 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, + LoaderRefSymLists(vgahwSymbols, miscfbSymbols, fbSymbols, xaaSymbols, ramdacSymbols, ddcSymbols, i2cSymbols, shadowSymbols, vbeSymbols, NULL); @@ -1095,6 +1111,7 @@ #if 0 if (xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; + xf86LoaderReqSymLists(int10Symbols, NULL); #if 1 xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); pInt = xf86InitInt10(cPtr->pEnt->index); @@ -1104,6 +1121,7 @@ #endif if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); cPtr->pVbe = VBEInit(NULL,cPtr->pEnt->index); } @@ -1302,7 +1320,7 @@ CHIPSFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); break; } @@ -1342,6 +1360,8 @@ if (cPtr->MMIOBaseVGA) xf86SetOperatingState(RES_SHARED_VGA, cPtr->pEnt->index, ResDisableOpr); + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; return TRUE; } @@ -1356,6 +1376,7 @@ double real; int val, indx; const char *s; + pointer pVbeModule = NULL; vgaHWPtr hwp; CHIPSPtr cPtr = CHIPSPTR(pScrn); @@ -1363,7 +1384,7 @@ CHIPSPanelSizePtr Size = &cPtr->PanelSize; CHIPSMemClockPtr MemClk = &cPtr->MemClock; CHIPSClockPtr SaveClk = &(cPtr->SavedReg.Clock); - resRange linearRes[] = { {ResExcMemBlock|ResBios,0,0},_END }; + resRange linearRes[] = { {ResExcMemBlock|ResBios|ResBus,0,0},_END }; /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -1453,7 +1474,6 @@ /* Set the bits per RGB */ if (pScrn->depth > 1) { - int val; /* Default to 6, is this right for HiQV?? */ pScrn->rgbBits = 6; if (xf86GetOptValInteger(cPtr->Options, OPTION_RGB_BITS, &val)) { @@ -1653,34 +1673,28 @@ && (cPtr->Flags & ChipsFullMMIOSupport) && (cPtr->pEnt->location.type == BUS_PCI)) { - 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"); + 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; + /* + * 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); - } + /* Map the linear framebuffer */ + if (!chipsMapMem(pScrn)) + return FALSE; + + /* Setup the MMIO register functions */ + if (cPtr->MMIOBaseVGA) { + CHIPSSetMmioExtFuncs(cPtr); + CHIPSHWSetMmioFuncs(pScrn, cPtr->MMIOBaseVGA, 0x0); } } else { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, @@ -1708,7 +1722,7 @@ * can result in unexpected behaviour when the config file marks * the primary CRTC as the second screen. */ - if (xf86IsPrimInitDone(pScrn->entityList[0])) { + if (xf86IsPrimInitDone(pScrn->entityList[0])) #else /* * This is an alternative version that determines which is the @@ -1716,9 +1730,10 @@ * It doesn't currently work because there are things that assume * the primary CRTC is initialised first. */ - if (cPtr->pEnt->device->screen == 1) { + if (cPtr->pEnt->device->screen == 1) #endif + { /* This is the second crtc */ cPtr->SecondCrtc = TRUE; cPtr->UseDualChannel = TRUE; @@ -1814,8 +1829,6 @@ * with the Crt2Memory option */ if(cPtr->SecondCrtc == FALSE) { - MessageType from; - int crt2mem = -1, adjust; xf86GetOptValInteger(cPtr->Options, OPTION_CRT2_MEM, &crt2mem); @@ -1858,7 +1871,39 @@ cPtr->IOBase = (unsigned int)(cPtr->SuspendHack.vgaIOBaseFlag ? 0x3D0 : 0x3B0); + /* + * Do DDC here: if VESA BIOS detects an external monitor it + * might switch. SetPanelType() will detect this. + */ + if ((pVbeModule = xf86LoadSubModule(pScrn, "ddc"))) { + Bool ddc_done = FALSE; + xf86MonPtr pMon; + + xf86LoaderReqSymLists(ddcSymbols, NULL); + if (cPtr->pVbe) { + if ((pMon + = xf86PrintEDID(vbeDoEDID(cPtr->pVbe, pVbeModule))) != NULL) { + ddc_done = TRUE; + xf86SetDDCproperties(pScrn,pMon); + } + } + + if (!ddc_done) + if (xf86LoadSubModule(pScrn, "i2c")) { + xf86LoaderReqSymLists(i2cSymbols,NULL); + + if (chips_i2cInit(pScrn)) { + if ((pMon = xf86PrintEDID(xf86DoEDID_DDC2(pScrn->scrnIndex, + cPtr->I2C))) != NULL) + ddc_done = TRUE; + xf86SetDDCproperties(pScrn,pMon); + } + } + if (!ddc_done) + chips_ddc1(pScrn); + } + /*test STN / TFT */ tmp = cPtr->readFR(cPtr, 0x10); @@ -1887,17 +1932,31 @@ } chipsSetPanelType(cPtr); - + from = X_PROBED; + { + Bool fp_mode; + if (xf86GetOptValBool(cPtr->Options, OPTION_FP_MODE, &fp_mode)) { + if (fp_mode) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing FP Mode on\n"); + cPtr->PanelType |= ChipsLCD; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing FP Mode off\n"); + cPtr->PanelType = ~ChipsLCD; + } + from = X_CONFIG; + } + } if ((cPtr->PanelType & ChipsLCD) && (cPtr->PanelType & ChipsCRT)) - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "LCD/CRT\n"); + xf86DrvMsg(pScrn->scrnIndex, from, "LCD/CRT\n"); else if (cPtr->PanelType & ChipsLCD) - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "LCD\n"); + xf86DrvMsg(pScrn->scrnIndex, from, "LCD\n"); else if (cPtr->PanelType & ChipsCRT) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CRT\n"); + xf86DrvMsg(pScrn->scrnIndex, from, "CRT\n"); /* monitor info */ +#if 1 cPtr->Monitor = chipsSetMonitor(pScrn); +#endif } - /* screen size */ /* * In LCD mode / dual mode we want to derive the timing values from @@ -2003,7 +2062,7 @@ /* sync reset ignored on this chipset */ cPtr->SyncResetIgn = TRUE; /* !! */ - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->numClocks = 26; /* Some number */ pScrn->progClock = TRUE; cPtr->ClockType = HiQV_STYLE | TYPE_PROGRAMMABLE; @@ -2042,7 +2101,6 @@ /* Probe the dot clocks */ for (i = 0; i < 3; i++) { unsigned int N,M,PSN,P,VCO_D; - unsigned char tmp; int offset = i * 4; tmp = cPtr->readXR(cPtr,0xC2 + offset); @@ -2320,37 +2378,6 @@ pScrn->monitor->Modes = &ChipsNTSCMode; #endif - if (xf86LoadSubModule(pScrn, "ddc")) { - Bool ddc_done = FALSE; - xf86MonPtr pMon; - - xf86LoaderReqSymLists(ddcSymbols, NULL); - -#ifdef XFree86LOADER - if (cPtr->pVbe) { - if ((pMon = xf86PrintEDID(vbeDoEDID(cPtr->pVbe, NULL))) != NULL) { - ddc_done = TRUE; - xf86SetDDCproperties(pScrn,pMon); - } - } -#endif - - if (!ddc_done) - if (xf86LoadSubModule(pScrn, "i2c")) { - xf86LoaderReqSymLists(i2cSymbols,NULL); - - if (chips_i2cInit(pScrn)) { - xf86MonPtr pMon; - - if ((pMon = xf86PrintEDID(xf86DoEDID_DDC2(pScrn->scrnIndex, - cPtr->I2C))) != NULL) - ddc_done = TRUE; - xf86SetDDCproperties(pScrn,pMon); - } - } - if (!ddc_done) - chips_ddc1(pScrn); - } if (cPtr->Flags & ChipsDualChannelSupport) { if (xf86IsEntityShared(pScrn->entityList[0])) { @@ -2362,7 +2389,7 @@ } /* Put IOSS/MSS back to normal */ cPtr->writeIOSS(cPtr, cPtr->storeIOSS); - cPtr->writeMSS(cPtr, cPtr->storeMSS); + cPtr->writeMSS(cPtr, hwp, cPtr->storeMSS); xf86SetPrimInitDone(pScrn->entityList[0]); } @@ -2381,7 +2408,7 @@ CHIPSClockPtr SaveClk = &(cPtr->SavedReg.Clock); Bool useLinear = FALSE; char *s; - resRange linearRes[] = { {ResExcMemBlock|ResBios,0,0},_END }; + resRange linearRes[] = { {ResExcMemBlock|ResBios|ResBus,0,0},_END }; /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -2693,7 +2720,7 @@ ErrorF("DR[%X] = %X\n",i,cPtr->Regs32[i]); #endif } - linearRes[0].type = ResExcIoSparse | ResBios; + linearRes[0].type = ResExcIoSparse | ResBios | ResBus; linearRes[0].rBase = cPtr->Regs32[0]; linearRes[0].rMask = 0x83FC; if (xf86RegisterResources(cPtr->pEnt->index,linearRes,ResNone)) { @@ -2827,13 +2854,11 @@ (float)(cPtr->MaxClock / 1000.)); } -#ifdef XFree86LOADER if (xf86LoadSubModule(pScrn, "ddc")) { xf86LoaderReqSymLists(ddcSymbols, NULL); if (cPtr->pVbe) xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(cPtr->pVbe, NULL))); } -#endif return TRUE; } @@ -2849,7 +2874,7 @@ CHIPSClockPtr SaveClk = &(cPtr->SavedReg.Clock); Bool useLinear = FALSE; char *s; - resRange linearRes[] = { {ResExcMemBlock|ResBios,0,0},_END }; + resRange linearRes[] = { {ResExcMemBlock|ResBios|ResBus,0,0},_END }; /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -3174,13 +3199,26 @@ } chipsSetPanelType(cPtr); - + from = X_PROBED; + { + Bool fp_mode; + if (xf86GetOptValBool(cPtr->Options, OPTION_FP_MODE, &fp_mode)) { + if (fp_mode) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing FP Mode on\n"); + cPtr->PanelType |= ChipsLCD; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing FP Mode off\n"); + cPtr->PanelType = ~ChipsLCD; + } + from = X_CONFIG; + } + } if ((cPtr->PanelType & ChipsLCD) && (cPtr->PanelType & ChipsCRT)) - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "LCD/CRT\n"); + xf86DrvMsg(pScrn->scrnIndex, from, "LCD/CRT\n"); else if (cPtr->PanelType & ChipsLCD) - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "LCD\n"); + xf86DrvMsg(pScrn->scrnIndex, from, "LCD\n"); else if (cPtr->PanelType & ChipsCRT) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CRT\n"); + xf86DrvMsg(pScrn->scrnIndex, from, "CRT\n"); /* monitor info */ cPtr->Monitor = chipsSetMonitor(pScrn); } @@ -3268,6 +3306,7 @@ "32Bit IO not supported on 65545 PCI\n"); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "\tenabling MMIO\n"); cPtr->UseMMIO = TRUE; + cPtr->IOAddress = cPtr->FbAddress + 0x200000L; } } else { /* XR08: Linear addressing base, not for PCI */ @@ -3362,7 +3401,7 @@ ErrorF("DR[%X] = %X\n",i,cPtr->Regs32[i]); #endif } - linearRes[0].type = ResExcIoSparse; + linearRes[0].type = ResExcIoSparse | ResBios | ResBus; linearRes[0].rBase = cPtr->Regs32[0]; linearRes[0].rMask = 0x83FC; if (xf86RegisterResources(cPtr->pEnt->index,linearRes,ResNone)) { @@ -3399,7 +3438,7 @@ if (cPtr->ClockMulFactor != 1) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Clocks scaled by %d\n", cPtr->ClockMulFactor); - /* We use a programamble clock */ + /* We use a programmable clock */ switch (cPtr->Chipset) { case CHIPS_CT65520: case CHIPS_CT65525: @@ -3426,7 +3465,7 @@ "Using textclock freq: %7.3f.\n", SaveClk->Clock/1000.0); } else - SaveClk->Clock = ((cPtr->PanelType & ChipsLCD) ? + SaveClk->Clock = ((cPtr->PanelType & ChipsLCDProbed) ? LCD_TEXT_CLK_FREQ : CRT_TEXT_CLK_FREQ); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Using programmable clocks\n"); } else { /* TYPE_PROGRAMMABLE */ @@ -3592,13 +3631,11 @@ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Memory clock option not supported for this chipset\n"); -#ifdef XFree86LOADER if (xf86LoadSubModule(pScrn, "ddc")) { xf86LoaderReqSymLists(ddcSymbols, NULL); if (cPtr->pVbe) xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(cPtr->pVbe, NULL))); } -#endif return TRUE; } @@ -3609,12 +3646,13 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; + CHIPSEntPtr cPtrEnt; - if (cPtr->Flags & ChipsDualChannelSupport) + if (cPtr->Flags & ChipsDualChannelSupport) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALOPEN; - + } /* Should we re-save the text mode on each VT enter? */ if(!chipsModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -3639,8 +3677,7 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; + CHIPSEntPtr cPtrEnt; /* Invalidate the cached acceleration registers */ cAcl->planemask = -1; @@ -3648,6 +3685,8 @@ cAcl->bgColor = -1; if (cPtr->Flags & ChipsDualChannelSupport) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; if (cPtr->UseDualChannel) DUALREOPEN; DUALCLOSE; @@ -3666,15 +3705,17 @@ { vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; int i, index, shift ; - + CHIPSEntPtr cPtrEnt; + shift = ((pScrn->depth == 15) && (!(cPtr->Flags & ChipsOverlay8plus16))) ? 3 : 0; - if (cPtr->UseDualChannel) + if (cPtr->UseDualChannel) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALREOPEN; + } for (i = 0; i < numColors; i++) { index = indices[i]; @@ -3695,7 +3736,7 @@ 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->writeMSS(cPtr, hwp, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); for (i = 0; i < numColors; i++) { index = indices[i]; @@ -3709,7 +3750,7 @@ DACDelay(hwp); } cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); } /* This shouldn't be necessary, but we'll play safe. */ @@ -3722,12 +3763,15 @@ { vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; + CHIPSEntPtr cPtrEnt; + int i, index; - if (cPtr->UseDualChannel) + if (cPtr->UseDualChannel) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALREOPEN; + } for (i = 0; i < numColors; i++) { index = indices[i]; @@ -3749,7 +3793,7 @@ 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->writeMSS(cPtr, hwp, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); for (i = 0; i < numColors; i++) { index = indices[i]; @@ -3764,7 +3808,7 @@ } cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); } /* This shouldn't be necessary, but we'll play safe. */ @@ -3780,16 +3824,17 @@ CHIPSPtr cPtr; CHIPSACLPtr cAcl; int ret; + int init_picture = 0; VisualPtr visual; int allocatebase, freespace, currentaddr; unsigned int racflag = 0; unsigned char *FBStart; int height, width, displayWidth; - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; + CHIPSEntPtr cPtrEnt = NULL; #ifdef DEBUG ErrorF("CHIPSScreenInit\n"); #endif + /* * we need to get the ScrnInfoRec for this screen, so let's allocate * one first thing @@ -3829,8 +3874,11 @@ CHIPSHWSetMmioFuncs(pScrn, cPtr->MMIOBaseVGA, 0x0); } - if (cPtr->Flags & ChipsDualChannelSupport) + if (cPtr->Flags & ChipsDualChannelSupport) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALOPEN; + } #if defined(__arm32__) && defined(__NetBSD__) if (strcmp(pScrn->currentMode->name,"PAL") == 0) { @@ -3858,14 +3906,14 @@ MSS = cPtr->readMSS(cPtr); cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | IOSS_PIPE_A)); - cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_A)); + cPtr->writeMSS(cPtr, hwp, ((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)); + cPtr->writeMSS(cPtr, hwp, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); chipsSave(pScrn, &cPtr->VgaSavedReg2, &cPtr->SavedReg2); cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); } else chipsSave(pScrn, &hwp->SavedReg, &cPtr->SavedReg); @@ -3955,8 +4003,7 @@ width,height, pScrn->xDpi, pScrn->yDpi, displayWidth,pScrn->bitsPerPixel); - if (ret) - fbPictureInit (pScreen, 0, 0); + init_picture = 1; break; } @@ -3978,6 +4025,10 @@ } } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); cPtr->BlockHandler = pScreen->BlockHandler; @@ -4084,9 +4135,9 @@ pScrn->virtualY * (pScrn->bitsPerPixel >> 3); if ((cPtr->Flags & ChipsDualChannelSupport) && - (cPtr->SecondCrtc == TRUE)) + (cPtr->SecondCrtc == TRUE)) { currentaddr = allocatebase + cPtrEnt->masterFbMapSize; - else + } else currentaddr = allocatebase; if (serverGeneration == 1) xf86DrvMsg(scrnIndex, X_PROBED, @@ -4295,13 +4346,15 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; + CHIPSEntPtr cPtrEnt; ErrorF("CHIPSSwitchMode\n"); - if (cPtr->UseDualChannel) + if (cPtr->UseDualChannel) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALREOPEN; + } return chipsModeInit(xf86Screens[scrnIndex], mode); } @@ -4312,8 +4365,8 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; + CHIPSEntPtr cPtrEnt; + int Base; vgaHWPtr hwp = VGAHWPTR(pScrn); unsigned char tmp; @@ -4353,8 +4406,11 @@ break; } - if (cPtr->UseDualChannel) + if (cPtr->UseDualChannel) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALREOPEN; + } /* write base to chip */ /* @@ -4379,7 +4435,7 @@ 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->writeMSS(cPtr, hwp, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); chipsFixResume(pScrn); hwp->writeCrtc(hwp, 0x0C, (Base & 0xFF00) >> 8); @@ -4388,7 +4444,7 @@ hwp->writeCrtc(hwp, 0x40, ((Base & 0x0F0000) >> 16) | 0x80); cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); } if (cPtr->Flags & ChipsOverlay8plus16) { @@ -4407,11 +4463,12 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; - + CHIPSEntPtr cPtrEnt; + if(pScrn->vtSema){ /*§§§*/ if (cPtr->Flags & ChipsDualChannelSupport) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; if (cPtr->UseDualChannel) DUALREOPEN; DUALCLOSE; @@ -4430,9 +4487,6 @@ cPtrEnt = pPriv->ptr; cPtrEnt->refCount--; } - if (cPtr->pVbe) - vbeFree(cPtr->pVbe); - cPtr->pVbe = NULL; if (cPtr->AccelInfoRec) XAADestroyInfoRec(cPtr->AccelInfoRec); if (cPtr->CursorInfoRec) @@ -4466,9 +4520,20 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); + if (flags & MODECHECK_FINAL) { + /* Don't subtract FrambufferSize here as it should be subtracted already */ + if ((cPtr->Flags & ChipsOverlay8plus16) + && ((pScrn->videoRam<<10) - pScrn->displayWidth * 3 * pScrn->virtualY + < 0)) + return MODE_MEM; + } /* The tests here need to be expanded */ - if ((mode->Flags & V_INTERLACE) && (cPtr->Flags & ChipsLCD)) - return MODE_BAD; + if ((mode->Flags & V_INTERLACE) && (cPtr->PanelType & ChipsLCD)) + return MODE_NO_INTERLACE; + if ((cPtr->PanelType & ChipsLCD) + && ((cPtr->PanelSize.HDisplay < mode->HDisplay) + || (cPtr->PanelSize.VDisplay < mode->VDisplay))) + return MODE_PANEL; return MODE_OK; } @@ -4490,8 +4555,8 @@ { vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; + CHIPSEntPtr cPtrEnt; + unsigned char dpmsreg, seqreg, lcdoff, tmp; if (!pScrn->vtSema) @@ -4527,8 +4592,11 @@ return; } - if (cPtr->UseDualChannel) + if (cPtr->UseDualChannel) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALREOPEN; + } seqreg |= hwp->readSeq(hwp, 0x01) & ~0x20; hwp->writeSeq(hwp, 0x01, seqreg); @@ -4541,7 +4609,7 @@ } /* Turn off the flat panel */ - if (cPtr->PanelType & ChipsLCD) { + if (cPtr->PanelType & ChipsLCDProbed) { if (IS_HiQV(cPtr)) { if (cPtr->Chipset == CHIPS_CT69030) { #if 0 @@ -4636,17 +4704,19 @@ unsigned char tmp; vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; unsigned char Type = cPtr->ClockType; + CHIPSEntPtr cPtrEnt; Clock->msr = hwp->readMiscOut(hwp)&0xFE; /* save standard VGA clock reg */ switch (Type & GET_STYLE) { case HiQV_STYLE: /* save alternate clock select reg.*/ /* The 69030 FP clock select is at FR01 instead */ - if (cPtr->UseDualChannel) - DUALREOPEN; + if (cPtr->UseDualChannel) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; + DUALREOPEN; + } if (cPtr->Flags & ChipsDualChannelSupport) Clock->fr03 = cPtr->readFR(cPtr, 0x01); @@ -4688,15 +4758,17 @@ { vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; unsigned char Type = cPtr->ClockType; + CHIPSEntPtr cPtrEnt; if (no > (pScrn->numClocks - 1)) return (FALSE); - if (cPtr->UseDualChannel) + if (cPtr->UseDualChannel) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALREOPEN; + } switch (Type & GET_STYLE) { case HiQV_STYLE: @@ -4729,6 +4801,17 @@ * be shared for CRT and LCD. */ chipsSetPanelType(cPtr); + { + Bool fp_m; + if (cPtr->Options + && xf86GetOptValBool(cPtr->Options, OPTION_FP_MODE, &fp_m)) { + if (fp_m) + cPtr->PanelType |= ChipsLCD; + else + cPtr->PanelType = ~ChipsLCD; + } + } + if ((cPtr->PanelType & ChipsLCD) && cPtr->FPclock) Clock->Clock = cPtr->FPclock; else @@ -4788,12 +4871,12 @@ tmp = ((hwp->readMiscOut(hwp) & 0x04) >> 2); return (tmp > 2) ? 2 : tmp; case OLD_STYLE: - if (!(cPtr->PanelType & ChipsLCD)) + if (!(cPtr->PanelType & ChipsLCDProbed)) tmp = hwp->readMiscOut(hwp); else tmp = cPtr->readXR(cPtr, 0x54); if (tmp & 0x08) { - if (!(cPtr->PanelType & ChipsLCD)) + if (!(cPtr->PanelType & ChipsLCDProbed)) tmp = hwp->readFCR(hwp) & 0x03; else tmp = (tmp >> 4) & 0x03; @@ -4804,7 +4887,7 @@ return (tmp + (tmp1 & 0x02)); } case NEW_STYLE: - if (cPtr->PanelType & ChipsLCD) { + if (cPtr->PanelType & ChipsLCDProbed) { tmp = cPtr->readXR(cPtr, 0x54); } else tmp = hwp->readMiscOut(hwp); @@ -5463,12 +5546,11 @@ ChipsNew->CR[0x3C] = (i & 0xC0); } #else - ChipsNew->CR[0x3C] = vgaHWHBlankKGA(mode, ChipsStd, 8, - KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO) << 6; + ChipsNew->CR[0x3C] = vgaHWHBlankKGA(mode, ChipsStd, 8, 0) << 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); + vgaHWHBlankKGA(mode, ChipsStd, 6, 0); + vgaHWVBlankKGA(mode, ChipsStd, 8, 0); ChipsNew->CR[0x40] |= 0x80; @@ -5537,7 +5619,20 @@ ChipsNew->FR[0x08] |= 0x80; /* Alt. CRT Vsync negative */ } } - + if (mode->Flags & (V_PCSYNC | V_NCSYNC)) { + ChipsNew->FR[0x0B] |= 0x20; + if (mode->Flags & V_PCSYNC) { + ChipsNew->FR[0x08] &= 0x7F; /* Alt. CRT Vsync positive */ + ChipsNew->FR[0x08] &= 0xBF; /* Alt. CRT Hsync positive */ + ChipsStd->MiscOutReg &= 0x7F; + ChipsStd->MiscOutReg &= 0xBF; + } else { + ChipsNew->FR[0x08] |= 0x80; /* Alt. CRT Vsync negative */ + ChipsNew->FR[0x08] |= 0x40; /* Alt. CRT Hsync negative */ + ChipsStd->MiscOutReg |= 0x40; + ChipsStd->MiscOutReg |= 0x80; + } + } /* bpp depend */ if ((pScrn->bitsPerPixel == 16) && (!(cPtr->Flags & ChipsOverlay8plus16))) { ChipsNew->XR[0x81] = (ChipsNew->XR[0x81] & 0xF0) | 0x4; @@ -5641,18 +5736,15 @@ - (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; - } } else { cPtr->OverlaySkewX = mode->CrtcHTotal - mode->CrtcHBlankStart - 9; - cPtr->OverlaySkewY = mode->CrtcVTotal - mode->CrtcVSyncEnd - 2; + cPtr->OverlaySkewY = mode->CrtcVTotal - mode->CrtcVSyncEnd - 1; if (mode->Flags & V_INTERLACE) { /* @@ -5762,7 +5854,13 @@ /* Program the registers */ /*vgaHWProtect(pScrn, TRUE);*/ - + if (cPtr->Chipset <= CHIPS_CT69000) { + ChipsNew->FR[0x01] &= ~0x03; + if (cPtr->PanelType & ChipsLCD) + ChipsNew->FR[0x01] |= 0x02; + else + ChipsNew->FR[0x01] |= 0x01; + } if ((cPtr->Flags & ChipsDualChannelSupport) && (!xf86IsEntityShared(pScrn->entityList[0]))) { unsigned char IOSS, MSS, tmpfr01; @@ -5772,12 +5870,12 @@ MSS = cPtr->readMSS(cPtr); cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | IOSS_PIPE_A)); - cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + cPtr->writeMSS(cPtr, hwp, ((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) | + cPtr->writeMSS(cPtr, hwp, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); /* * Hack:: Force Pipe-B on for dual refresh, and off elsewise @@ -5789,7 +5887,7 @@ chipsRestore(pScrn, ChipsStd, ChipsNew, FALSE); ChipsNew->FR[0x01] = tmpfr01; cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); } else { chipsRestore(pScrn, ChipsStd, ChipsNew, FALSE); } @@ -6502,6 +6600,11 @@ ChipsNew->XR[0x05] |= 0x80; /* EDO RAM enable */ break; } + + if (cPtr->PanelType & ChipsLCD) + ChipsNew->XR[0x51] |= 0x02; + else + ChipsNew->XR[0x51] &= ~0x02; /* Program the registers */ /*vgaHWProtect(pScrn, TRUE);*/ @@ -6572,6 +6675,9 @@ * Anyone care to explain to me why ???? */ if (cPtr->Flags & ChipsDualChannelSupport) { + /* Enable pipeline if needed */ + cPtr->writeFR(cPtr, 0x01, ChipsReg->FR[0x01]); + cPtr->writeFR(cPtr, 0x02, ChipsReg->FR[0x02]); vgaHWRestore(pScrn, VgaReg, VGA_SR_MODE | (restoreFonts ? VGA_SR_FONTS : 0)); } else { @@ -6618,13 +6724,13 @@ /* Fix resume again here, as Nozomi seems to need it */ chipsFixResume(pScrn); /*vgaHWProtect(pScrn, FALSE);*/ - +#if 0 /* Enable pipeline if needed */ if (cPtr->Flags & ChipsDualChannelSupport) { cPtr->writeFR(cPtr, 0x01, ChipsReg->FR[0x01]); cPtr->writeFR(cPtr, 0x02, ChipsReg->FR[0x02]); } - +#endif } static void @@ -6706,8 +6812,9 @@ cPtr->writeFR(cPtr, i, Regs->FR[i] & 0xFE); continue ; /* some registers must be set before FR40/FR48 */ } - if ((cPtr->readFR(cPtr, i)) != Regs->FR[i]) + if ((cPtr->readFR(cPtr, i)) != Regs->FR[i]) { cPtr->writeFR(cPtr, i, Regs->FR[i]); + } } /* set the multimedia regs */ @@ -6856,8 +6963,7 @@ { CHIPSPtr cPtr = CHIPSPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; + CHIPSEntPtr cPtrEnt; if (cPtr->Flags & ChipsLinearSupport) { if (cPtr->UseMMIO) { @@ -6888,6 +6994,8 @@ if ((cPtr->Flags & ChipsDualChannelSupport) && (xf86IsEntityShared(pScrn->entityList[0]))) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; if(cPtr->SecondCrtc == FALSE) { Addr = cPtrEnt->masterFbAddress; Map = cPtrEnt->masterFbMapSize; @@ -6907,11 +7015,26 @@ if (cPtr->FbBase == NULL) return FALSE; + } + if (cPtr->Flags & ChipsFullMMIOSupport) { + cPtr->MMIOBaseVGA = xf86MapPciMem(pScrn->scrnIndex, + VIDMEM_MMIO,cPtr->PciTag, + cPtr->IOAddress, 0x2000L); + /* 69030 MMIO Fix. + * + * The hardware lets us map the PipeB data registers + * into the MMIO address space normally occupied by PipeA, + * but it doesn't allow remapping of the index registers. + * So we're forced to map a separate MMIO space for each + * pipe and to toggle between them as necessary. -GHB + */ + if (cPtr->Flags & ChipsDualChannelSupport) + cPtr->MMIOBasePipeB = xf86MapPciMem(pScrn->scrnIndex, + VIDMEM_MMIO,cPtr->PciTag, + cPtr->IOAddress + 0x800000, 0x2000L); + + cPtr->MMIOBasePipeA = cPtr->MMIOBaseVGA; } - if (cPtr->Flags & ChipsFullMMIOSupport) - cPtr->MMIOBaseVGA = xf86MapPciMem(pScrn->scrnIndex, - VIDMEM_MMIO,cPtr->PciTag, - cPtr->IOAddress, 0x2000L); } else { /* In paged mode Base is the VGA window at 0xA0000 */ cPtr->FbBase = hwp->Base; @@ -6960,12 +7083,14 @@ { CHIPSPtr cPtr = CHIPSPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], - CHIPSEntityIndex)->ptr; unsigned char scrn; - - if (cPtr->UseDualChannel) + CHIPSEntPtr cPtrEnt; + + if (cPtr->UseDualChannel) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; DUALREOPEN; + } /* fix things that could be messed up by suspend/resume */ if (!IS_HiQV(cPtr)) @@ -6998,7 +7123,7 @@ 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->writeMSS(cPtr, hwp, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); /* fix things that could be messed up by suspend/resume */ if (!IS_HiQV(cPtr)) @@ -7025,7 +7150,7 @@ } cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); } } @@ -7091,11 +7216,11 @@ 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->writeMSS(cPtr, VGAHWPTR(pScrn), ((cPtr->storeMSS & + MSS_MASK) | MSS_PIPE_B)); cPtr->writeXR(cPtr, 0xA0, cPtr->HWCursorContents & 0xFF); cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), MSS); } } else { HW_DEBUG(0x8); @@ -7182,20 +7307,21 @@ IOSS = cPtr->readIOSS(cPtr); MSS = cPtr->readMSS(cPtr); tmpfr02 = cPtr->readFR(cPtr,0x02); - cPtr->writeFR(cPtr, 0x02, tmpfr02 & 0xCF); /* CRT/FP off */ + 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)); + cPtr->writeMSS(cPtr, hwp, ((MSS & MSS_MASK) | MSS_PIPE_A)); tmpfr01a = cPtr->readFR(cPtr,0x01); - if ((tmpfr01a & 0x3) == 0) + if ((tmpfr01a & 0x3) != 0x01) 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)); + cPtr->writeMSS(cPtr, hwp, ((MSS & MSS_MASK) | MSS_PIPE_B)); tmpfr01b = cPtr->readFR(cPtr,0x01); - if ((tmpfr01b & 0x3) == 0) + if ((tmpfr01b & 0x3) != 0x01) cPtr->writeFR(cPtr, 0x01, ((tmpfr01b & 0xFC) | 0x1)); cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); + cPtr->writeFR(cPtr, 0x02, (tmpfr02 & 0xCF) | 0x10); /* CRT on/FP off*/ } dacmask = hwp->readDacMask(hwp); /* save registers */ @@ -7224,7 +7350,7 @@ if (!chipsTestDACComp(pScrn,0x14,0x14,0x2D)) if (!chipsTestDACComp(pScrn,0x2D,0x2D,0x2D)) type = 0; /* color monitor */ - } else { + } else { if (chipsTestDACComp(pScrn,0x04,0x12,0x04)) if (!chipsTestDACComp(pScrn,0x1E,0x12,0x04)) if (!chipsTestDACComp(pScrn,0x04,0x2D,0x04)) @@ -7248,14 +7374,14 @@ if (cPtr->Flags & ChipsDualChannelSupport) { cPtr->writeIOSS(cPtr, ((IOSS & IOSS_MASK) | IOSS_PIPE_A)); - cPtr->writeMSS(cPtr, ((MSS & MSS_MASK) | MSS_PIPE_A)); + cPtr->writeMSS(cPtr, hwp, ((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->writeMSS(cPtr, hwp, ((MSS & MSS_MASK) | MSS_PIPE_B)); cPtr->writeFR(cPtr, 0x01, tmpfr01b); usleep(1000); cPtr->writeIOSS(cPtr, IOSS); - cPtr->writeMSS(cPtr, MSS); + cPtr->writeMSS(cPtr, hwp, MSS); cPtr->writeFR(cPtr, 0x02, tmpfr02); } @@ -7295,7 +7421,7 @@ if (tmp & 0x10) cPtr->PanelType |= ChipsCRT; if (tmp & 0x20) - cPtr->PanelType |= ChipsLCD; + cPtr->PanelType |= ChipsLCD | ChipsLCDProbed; } else { cPtr->PanelType |= ChipsCRT; } @@ -7306,11 +7432,11 @@ /* LCD */ tmp = cPtr->readFR(cPtr, 0x01); if ((tmp & 0x03) == 0x02) { - cPtr->PanelType |= ChipsLCD; + cPtr->PanelType |= ChipsLCD; } tmp = cPtr->readXR(cPtr,0xD0); if (tmp & 0x01) { - cPtr->PanelType |= ChipsCRT; + cPtr->PanelType |= ChipsCRT; } } } else { @@ -7319,7 +7445,7 @@ /* XR51: DISPLAY TYPE REGISTER */ /* XR51[2]: Display Type, 0 = CRT, 1 = FlatPanel */ if (tmp & 0x04) { - cPtr->PanelType |= ChipsLCD; + cPtr->PanelType |= ChipsLCD | ChipsLCDProbed; } if ((cPtr->readXR(cPtr, 0x06)) & 0x02) { cPtr->PanelType |= ChipsCRT; Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.32 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.33 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.32 Tue May 15 06:19:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h Mon Oct 1 09:44:04 2001 @@ -22,7 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h,v 1.32 2001/05/15 10:19:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h,v 1.33 2001/10/01 13:44:04 eich Exp $ */ #ifndef _CT_DRIVER_H_ @@ -148,6 +148,7 @@ /* Monitor or flat panel type flags */ #define ChipsCRT 0x0010 #define ChipsLCD 0x1000 +#define ChipsLCDProbed 0x2000 #define ChipsTFT 0x0100 #define ChipsDS 0x0200 #define ChipsDD 0x0400 @@ -163,6 +164,8 @@ #define MSS_BOTH 0x0B #define MSS_PIPE_A 0x02 #define MSS_PIPE_B 0x05 +/* Aggregate value of MSS shadow bits -GHB */ +#define MSS_SHADOW 0x07 /* Storage for the registers of the C&T chipsets */ typedef struct { @@ -241,7 +244,7 @@ typedef CARD8 (*chipsReadMRPtr)(CHIPSPtr cPtr, CARD8 index); typedef void (*chipsWriteMRPtr)(CHIPSPtr cPtr, CARD8 index, CARD8 value); typedef CARD8 (*chipsReadMSSPtr)(CHIPSPtr cPtr); -typedef void (*chipsWriteMSSPtr)(CHIPSPtr cPtr, CARD8 value); +typedef void (*chipsWriteMSSPtr)(CHIPSPtr cPtr, vgaHWPtr hwp, CARD8 value); typedef CARD8 (*chipsReadIOSSPtr)(CHIPSPtr cPtr); typedef void (*chipsWriteIOSSPtr)(CHIPSPtr cPtr, CARD8 value); @@ -276,6 +279,8 @@ unsigned char * FbBase; unsigned char * MMIOBase; unsigned char * MMIOBaseVGA; + unsigned char * MMIOBasePipeA; + unsigned char * MMIOBasePipeB; long FbMapSize; unsigned char * ShadowPtr; int ShadowPitch; @@ -440,16 +445,16 @@ if (cPtr->SecondCrtc == TRUE) { \ cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ IOSS_PIPE_B)); \ - cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | \ - MSS_PIPE_B)); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), ((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)); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), ((cPtr->storeMSS & \ + MSS_MASK) | MSS_PIPE_A)); \ cPtrEnt->masterOpen = TRUE; \ cPtrEnt->masterActive = TRUE; \ cPtrEnt->slaveActive = FALSE; \ @@ -457,7 +462,8 @@ } else { \ cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ IOSS_PIPE_A)); \ - cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_A)); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), ((cPtr->storeMSS & \ + MSS_MASK) | MSS_PIPE_A)); \ } \ } @@ -468,8 +474,8 @@ if (! cPtrEnt->slaveActive) { \ cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ IOSS_PIPE_B)); \ - cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | \ - MSS_PIPE_B)); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), ((cPtr->storeMSS & \ + MSS_MASK) | MSS_PIPE_B)); \ cPtrEnt->slaveOpen = TRUE; \ cPtrEnt->slaveActive = TRUE; \ cPtrEnt->masterActive = FALSE; \ @@ -478,8 +484,8 @@ if (! cPtrEnt->masterActive) { \ cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ IOSS_PIPE_A)); \ - cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | \ - MSS_PIPE_A)); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), ((cPtr->storeMSS & \ + MSS_MASK) | MSS_PIPE_A)); \ cPtrEnt->masterOpen = TRUE; \ cPtrEnt->masterActive = TRUE; \ cPtrEnt->slaveActive = FALSE; \ @@ -493,18 +499,20 @@ 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)); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), ((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)); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), ((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); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), cPtr->storeMSS); \ chipsLock(pScrn); \ } else { \ chipsHWCursorOff(cPtr, pScrn); \ @@ -515,7 +523,7 @@ cPtrEnt->slaveOpen = FALSE; \ if (! cPtrEnt->masterActive) { \ cPtr->writeIOSS(cPtr, cPtr->storeIOSS); \ - cPtr->writeMSS(cPtr, cPtr->storeMSS); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), cPtr->storeMSS); \ chipsLock(pScrn); \ } \ } else { \ @@ -523,7 +531,7 @@ cPtrEnt->masterOpen = FALSE; \ if (! cPtrEnt->slaveActive) { \ cPtr->writeIOSS(cPtr, cPtr->storeIOSS); \ - cPtr->writeMSS(cPtr, cPtr->storeMSS); \ + cPtr->writeMSS(cPtr, VGAHWPTR(pScrn), cPtr->storeMSS); \ chipsLock(pScrn); \ } \ } \ Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.6 Wed May 9 15:57:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c Mon Oct 1 09:44:04 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.6 2001/05/09 19:57:05 dbateman Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c,v 1.7 2001/10/01 13:44:04 eich Exp $ */ /* * The functions in this file are used to read/write the C&T extension register @@ -156,7 +156,7 @@ } static void -chipsStdWriteMSS(CHIPSPtr cPtr, CARD8 value) +chipsStdWriteMSS(CHIPSPtr cPtr, vgaHWPtr hwp, CARD8 value) { outb(CHIPS_MSS, value); } @@ -244,8 +244,25 @@ } static void -chipsMmioWriteMSS(CHIPSPtr cPtr, CARD8 value) +chipsMmioWriteMSS(CHIPSPtr cPtr, vgaHWPtr hwp, CARD8 value) { + /* 69030 MMIO Fix. + * + * <value> determines which MMIOBase to use; either + * Pipe A or Pipe B. -GHB + */ + if ((value & MSS_SHADOW) == MSS_PIPE_B) + cPtr->MMIOBaseVGA = cPtr->MMIOBasePipeB; + else + cPtr->MMIOBaseVGA = cPtr->MMIOBasePipeA; + + hwp->MMIOBase = cPtr->MMIOBaseVGA; + + /* Since our Pipe constants don't set bit 3 of MSS, the value + * written here has no effect on the hardware's behavior. It + * does allow us to use the value returned by readMSS() to key + * the above logic, though. -GHB + */ chipsmoutb(CHIPS_MMIO_MSS, 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.7 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c:1.7 Tue May 15 06:19:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c Mon Oct 1 09:44:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.7 2001/05/15 10:19:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.9 2001/10/01 13:44:04 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -167,6 +167,9 @@ CARD32 videoStatus; Time offTime; Time freeTime; + Bool doubleBuffer; + Bool manualDoubleBuffer; + int currentBuffer; } CHIPSPortPrivRec, *CHIPSPortPrivPtr; @@ -184,7 +187,6 @@ CHIPSHiQVSync(pScrn); mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c | 0x6)); - switch (pScrn->depth) { case 8: cPtr->writeMR(cPtr, 0x3D, 0x00); @@ -269,7 +271,10 @@ pPriv->colorKey = cPtr->videoKey; pPriv->videoStatus = 0; - + pPriv->doubleBuffer = TRUE; + pPriv->manualDoubleBuffer = FALSE; + pPriv->currentBuffer = 0; + /* gotta uninit this someplace */ REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); @@ -402,7 +407,7 @@ } static void -CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shadow) { CHIPSPortPrivPtr pPriv = (CHIPSPortPrivPtr)data; CHIPSPtr cPtr = CHIPSPTR(pScrn); @@ -410,7 +415,7 @@ REGION_EMPTY(pScrn->pScreen, &pPriv->clip); CHIPSHiQVSync(pScrn); - if(exit) { + if(shadow) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c & 0xFE)); @@ -601,6 +606,35 @@ return new_linear; } +static int +CHIPSSetCurrentPlaybackBuffer(CHIPSPtr cPtr, int n) +{ + + CARD8 mr20; + mr20 = cPtr->readMR(cPtr, 0x20); + mr20 &= ~0x1B; + if (!n) mr20 |= 0x10; + cPtr->writeMR(cPtr, 0x22, mr20); + return n; +} + +static int +CHIPSWaitGetNextFrame(CHIPSPtr cPtr) +{ + volatile CARD8 mr20; + volatile CARD8 mr21; + + mr20 = cPtr->readMR(cPtr, 0x20); + while (1) { + mr21 = cPtr->readMR(cPtr, 0x21); + if (!(mr20 & (1 << 5)) || !(mr21 & 1)) + break; + } + mr20 &= ~0x4; + mr20 = cPtr->readMR(cPtr, 0x20); + return (mr21 & 2)? 0 : 1; +} + static void CHIPSDisplayVideo( ScrnInfoPtr pScrn, @@ -611,56 +645,70 @@ int x1, int y1, int x2, int y2, BoxPtr dstBox, short src_w, short src_h, - short drw_w, short drw_h + short drw_w, short drw_h, + Bool triggerBufSwitch ){ CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); DisplayModePtr mode = pScrn->currentMode; - unsigned char tmp; + unsigned char tmp, m1f, m1e; + int buffer = pPriv->currentBuffer; CHIPSHiQVSync(pScrn); tmp = cPtr->readXR(cPtr, 0xD0); cPtr->writeXR(cPtr, 0xD0, (tmp | 0x10)); - tmp = cPtr->readMR(cPtr, 0x1E); - tmp &= 0xE0; /* Set Zoom and Direction */ + m1e = cPtr->readMR(cPtr, 0x1E); + m1e &= 0xE0; /* Set Zoom and Direction */ if ((!(cPtr->PanelType & ChipsLCD)) && (mode->Flags & V_INTERLACE)) - tmp |= 0x10; - cPtr->writeMR(cPtr, 0x1E, tmp); - tmp = cPtr->readMR(cPtr, 0x1F); - tmp = (tmp & 0x14); /* Mask reserved bits, unset interpolation */ + m1e |= 0x10; + + m1f = cPtr->readMR(cPtr, 0x1F); + m1f = (m1f & 0x14); /* Mask reserved bits, unset interpolation */ switch(id) { case 0x35315652: /* RGB15 */ - tmp |= 0x09; + m1f |= 0x09; break; case 0x36315652: /* RGB16 */ - tmp |= 0x08; + m1f |= 0x08; break; case FOURCC_YV12: /* YV12 */ - /* tmp |= 0x03 */ - tmp |= 0x00; + /* m1f |= 0x03 */ + m1f |= 0x00; break; case FOURCC_YUY2: /* YUY2 */ default: - tmp |= 0x00; /* Do nothing here */ + m1f |= 0x00; /* Do nothing here */ break; } - cPtr->writeMR(cPtr, 0x1F, tmp); + offset += (x1 >> 15) & ~0x01; + /* Setup Pointer 1 */ + if (!buffer || pPriv->manualDoubleBuffer || !pPriv->doubleBuffer) { + cPtr->writeMR(cPtr, 0x22, (offset & 0xF8)); + cPtr->writeMR(cPtr, 0x23, ((offset >> 8) & 0xFF)); + cPtr->writeMR(cPtr, 0x24, ((offset >> 16) & 0xFF)); + } + /* Setup Pointer 2 */ + if ((buffer && !pPriv->manualDoubleBuffer) || !pPriv->doubleBuffer) { + cPtr->writeMR(cPtr, 0x25, (offset & 0xF8)); + cPtr->writeMR(cPtr, 0x26, ((offset >> 8) & 0xFF)); + cPtr->writeMR(cPtr, 0x27, ((offset >> 16) & 0xFF)); + } + + + tmp = cPtr->readMR(cPtr, 0x04); + if (pPriv->doubleBuffer && !pPriv->manualDoubleBuffer && triggerBufSwitch) + tmp |= 0x18; + cPtr->writeMR(cPtr, 0x04, tmp); + tmp = cPtr->readMR(cPtr, 0x20); tmp &= 0xC3; + if (pPriv->doubleBuffer && !pPriv->manualDoubleBuffer && triggerBufSwitch) + tmp |= ((1 << 2 | 1 << 5) | ((buffer) ? (1 << 4) : 0)); 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)); - cPtr->writeMR(cPtr, 0x24, ((offset >> 16) & 0xFF)); - /* Setup Pointer 2 */ - cPtr->writeMR(cPtr, 0x25, (offset & 0xF8)); - cPtr->writeMR(cPtr, 0x26, ((offset >> 8) & 0xFF)); - cPtr->writeMR(cPtr, 0x27, ((offset >> 16) & 0xFF)); cPtr->writeMR(cPtr, 0x28, ((width >> 2) - 1)); /* Width */ cPtr->writeMR(cPtr, 0x34, ((width >> 2) - 1)); @@ -688,25 +736,21 @@ /* Horizontal Zoom */ if (drw_w > src_w) { - tmp = cPtr->readMR(cPtr, 0x1F); - cPtr->writeMR(cPtr, 0x1F, (tmp | 0x20)); /* set H-interpolation */ - tmp = cPtr->readMR(cPtr, 0x1E); - cPtr->writeMR(cPtr, 0x1E, (tmp | 0x04)); + m1f = m1f | 0x20; /* set H-interpolation */ + m1e = m1e | 0x04; tmp = cPtr->VideoZoomMax * src_w / drw_w; cPtr->writeMR(cPtr, 0x32, tmp); } /* Vertical Zoom */ if (drw_h > src_h) { -#if 1 - tmp = cPtr->readMR(cPtr, 0x1F); - cPtr->writeMR(cPtr, 0x1F, (tmp | 0xc0)); /* set V-interpolation */ -#endif - tmp = cPtr->readMR(cPtr, 0x1E); - cPtr->writeMR(cPtr, 0x1E, (tmp | 0x08)); + m1f = m1f | 0xc0; + m1e = m1e | 0x08; /* set V-interpolation */ tmp = cPtr->VideoZoomMax * src_h / drw_h ; cPtr->writeMR(cPtr, 0x33, tmp); } + cPtr->writeMR(cPtr, 0x1F, m1f); + cPtr->writeMR(cPtr, 0x1E, m1e); tmp = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (tmp | 0x7)); @@ -734,7 +778,7 @@ int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; - + if(drw_w > 16384) drw_w = 16384; /* Clip */ @@ -761,6 +805,8 @@ dstPitch = ((width << 1) + 15) & ~15; new_size = ((dstPitch * height) + bpp - 1) / bpp; + if (pPriv->doubleBuffer) + new_size <<= 1; switch(id) { case FOURCC_YV12: /* YV12 */ @@ -774,8 +820,15 @@ break; } - if(!(pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear, new_size))) + if(!(pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear, new_size))) { + if (pPriv->doubleBuffer && + (pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear, + new_size >> 1))) { + new_size >>= 1; + pPriv->doubleBuffer = FALSE; + } else return BadAlloc; + } /* copy data */ top = y1 >> 16; @@ -784,6 +837,11 @@ left <<= 1; offset = pPriv->linear->offset * bpp; + if (!pPriv->manualDoubleBuffer) + pPriv->currentBuffer = CHIPSWaitGetNextFrame(cPtr); + if(pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (new_size * bpp) >> 1; + dst_start = cPtr->FbBase + offset + left + (top * dstPitch); switch(id) { @@ -813,12 +871,15 @@ REGION_RECTS(clipBoxes)); } -offset += top * dstPitch; + offset += top * dstPitch; CHIPSDisplayVideo(pScrn, id, offset, width, height, dstPitch, - x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h, TRUE); pPriv->videoStatus = CLIENT_VIDEO_ON; + if (pPriv->manualDoubleBuffer) + pPriv->currentBuffer ^= 1; + return Success; } @@ -1047,10 +1108,14 @@ dstBox.y1 -= pScrn->frameY0; dstBox.y2 -= pScrn->frameY0; + if (portPriv->doubleBuffer) + portPriv->currentBuffer = CHIPSSetCurrentPlaybackBuffer(cPtr,0); + else + portPriv->currentBuffer = 0; 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); + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h, FALSE); XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, REGION_NUM_RECTS(clipBoxes), Index: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h:1.1 --- /dev/null Fri Jan 18 15:25:21 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h Fri Nov 16 16:13:34 2001 @@ -0,0 +1,450 @@ +/* $XConsortium: AsmMacros.h /main/13 1996/10/25 11:33:12 kaleb $ */ +/* + * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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 + * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION 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 David Wexelblat shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from David Wexelblat. + * + */ +/* + * Copyright 1997 + * Digital Equipment Corporation. All rights reserved. + * This software is furnished under license and may be used and copied only in + * accordance with the following terms and conditions. Subject to these + * conditions, you may download, copy, install, use, modify and distribute + * this software in source and/or binary form. No title or ownership is + * transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce and retain + * this copyright notice and list of conditions as they appear in the source + * file. + * + * 2) No right is granted to use any trade name, trademark, or logo of Digital + * Equipment Corporation. Neither the "Digital Equipment Corporation" name + * nor any trademark or logo of Digital Equipment Corporation may be used + * to endorse or promote products derived from this software without the + * prior written permission of Digital Equipment Corporation. + * + * 3) This software is provided "AS-IS" and any express or implied warranties, + * including but not limited to, any implied warranties of merchantability, + * fitness for a particular purpose, or non-infringement are disclaimed. In + * no event shall DIGITAL be liable for any damages whatsoever, and in + * particular, DIGITAL shall not be liable for special, indirect, + * consequential, or incidental damages or damages for + * lost profits, loss of revenue or loss of use, whether such damages arise + * in contract, + * negligence, tort, under statute, in equity, at law or otherwise, even if + * advised of the possibility of such damage. + * + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 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 +#define outb(p,v) _outb((v),(p)) +#define outw(p,v) _outw((v),(p)) +#define outl(p,v) _outl((v),(p)) +#else +#if defined(__sparc__) +#ifndef ASI_PL +#define ASI_PL 0x88 +#endif + +static __inline__ void +outb(port, val) +unsigned long port; +char val; +{ + __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); +} + +static __inline__ void +outw(port, val) +unsigned long port; +char val; +{ + __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); +} + +static __inline__ void +outl(port, val) +unsigned long port; +char val; +{ + __asm__ __volatile__("sta %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); +} + +static __inline__ unsigned int +inb(port) +unsigned long port; +{ + unsigned char ret; + __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); + return ret; +} + +static __inline__ unsigned int +inw(port) +unsigned long port; +{ + unsigned char ret; + __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); + return ret; +} + +static __inline__ unsigned int +inl(port) +unsigned long port; +{ + unsigned char ret; + __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); + return ret; +} +#else +#ifdef __arm32__ +unsigned int IOPortBase; /* Memory mapped I/O port area */ + +static __inline__ void +outb(port, val) + short port; + char val; +{ + if ((unsigned short)port >= 0x400) return; + + *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val; +} + +static __inline__ void +outw(port, val) + short port; + short val; +{ + if ((unsigned short)port >= 0x400) return; + + *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val; +} + +static __inline__ void +outl(port, val) + short port; + int val; +{ + if ((unsigned short)port >= 0x400) return; + + *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val; +} + +static __inline__ unsigned int +inb(port) + short port; +{ + if ((unsigned short)port >= 0x400) return((unsigned int)-1); + + return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase)); +} + +static __inline__ unsigned int +inw(port) + short port; +{ + if ((unsigned short)port >= 0x400) return((unsigned int)-1); + + return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase)); +} + +static __inline__ unsigned int +inl(port) + short port; +{ + if ((unsigned short)port >= 0x400) return((unsigned int)-1); + + return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase)); +} +#else /* __arm32__ */ +#if defined(Lynx) && defined(__powerpc__) +extern unsigned char *ioBase; + +static volatile void +eieio() +{ + __asm__ __volatile__ ("eieio"); +} + +static void +outb(port, value) +short port; +unsigned char value; +{ + *(uchar *)(ioBase + port) = value; eieio(); +} + +static void +outw(port, value) +short port; +unsigned short value; +{ + *(unsigned short *)(ioBase + port) = value; eieio(); +} + +static void +outl(port, value) +short port; +unsigned long value; +{ + *(unsigned long *)(ioBase + port) = value; eieio(); +} + +static unsigned char +inb(port) +short port; +{ + unsigned char val; + + val = *((unsigned char *)(ioBase + port)); eieio(); + return(val); +} + +static unsigned short +inw(port) +short port; +{ + unsigned short val; + + val = *((unsigned short *)(ioBase + port)); eieio(); + return(val); +} + +static unsigned long +inl(port) +short port; +{ + unsigned long val; + + val = *((unsigned long *)(ioBase + port)); eieio(); + return(val); +} + +#else +#if defined(__FreeBSD__) && defined(__alpha__) + +#include <sys/types.h> + +extern void outb(u_int32_t port, u_int8_t val); +extern void outw(u_int32_t port, u_int16_t val); +extern void outl(u_int32_t port, u_int32_t val); +extern u_int8_t inb(u_int32_t port); +extern u_int16_t inw(u_int32_t port); +extern u_int32_t inl(u_int32_t port); + +#else +#ifdef GCCUSESGAS +static __inline__ void +outb(port, val) +short port; +char val; +{ + __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ void +outw(port, val) +short port; +short val; +{ + __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ void +outl(port, val) +short port; +unsigned int val; +{ + __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ unsigned int +inb(port) +short port; +{ + unsigned char ret; + __asm__ __volatile__("inb %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inw(port) +short port; +{ + unsigned short ret; + __asm__ __volatile__("inw %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inl(port) +short port; +{ + unsigned int ret; + __asm__ __volatile__("inl %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +#else /* GCCUSESGAS */ + +static __inline__ void +outb(port, val) + short port; + char val; +{ + __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port)); +} + +static __inline__ void +outw(port, val) + short port; + short val; +{ + __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port)); +} + +static __inline__ void +outl(port, val) + short port; + unsigned int val; +{ + __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port)); +} + +static __inline__ unsigned int +inb(port) + short port; +{ + unsigned int ret; + __asm__ __volatile__("in%B0 (%1)" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inw(port) + short port; +{ + unsigned int ret; + __asm__ __volatile__("in%W0 (%1)" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inl(port) + short port; +{ + unsigned int ret; + __asm__ __volatile__("in%L0 (%1)" : + "=a" (ret) : + "d" (port)); + return ret; +} + +#endif /* GCCUSESGAS */ +#endif /* Lynx && __powerpc__ */ +#endif /* arm32 */ +#endif /* linux && __sparc__ */ +#endif /* linux && __alpha__ */ +#endif /* __FreeBSD__ && __alpha__ */ + +#if defined(linux) || defined(__arm32__) || (defined(Lynx) && defined(__powerpc__)) + +#define intr_disable() +#define intr_enable() + +#else + +static __inline__ void +intr_disable() +{ + __asm__ __volatile__("cli"); +} + +static __inline__ void +intr_enable() +{ + __asm__ __volatile__("sti"); +} + +#endif /* else !linux && !__arm32__ */ + +#else /* __GNUC__ */ + +#if defined(_MINIX) && defined(_ACK) + +/* inb, outb, inw and outw are defined in the library */ +/* ... but I've no idea if the same is true for inl & outl */ + +u8_t inb(U16_t); +void outb(U16_t, U8_t); +u16_t inw(U16_t); +void outw(U16_t, U16_t); +u32_t inl(U16_t); +void outl(U16_t, U32_t); + +#else /* not _MINIX and _ACK */ + +# if defined(__STDC__) && (__STDC__ == 1) +# ifndef NCR +# define asm __asm +# endif +# endif +# ifdef SVR4 +# include <sys/types.h> +# ifndef __USLC__ +# define __USLC__ +# endif +# endif +#ifndef SCO325 +# include <sys/inline.h> +#else +# include "../common/scoasm.h" +#endif +#define intr_disable() asm("cli") +#define intr_enable() asm("sti") + +#endif /* _MINIX and _ACK */ +#endif /* __GNUC__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/chips/util/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/util/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/drivers/chips/util/Imakefile:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/chips/util/Imakefile:1.2 Sat Jul 25 12:55:43 1998 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/util/Imakefile Fri Nov 16 16:13:34 2001 @@ -1,13 +1,16 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/Imakefile,v 1.2 1998/07/25 16:55:43 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/Imakefile,v 1.3 2001/11/16 21:13:34 tsi Exp $ -INCLUDES = -I../../../SuperProbe - +SRCS = dRegs.c mRegs.c modClock.c +OBJS = dRegs.o mRegs.o modClock.o PROGS = dRegs mRegs modClock memClock AllTarget(ProgramTargetName($(PROGS))) NormalProgramTarget(dRegs,dRegs.o,NullParameter,NullParameter,NullParameter) NormalProgramTarget(mRegs,mRegs.o,NullParameter,NullParameter,NullParameter) NormalProgramTarget(modClock,modClock.o,NullParameter,NullParameter,NullParameter) -LinkFile(memClock,modClock) + +memClock: modClock + RemoveFile($@) + $(LN) $? $@ DependTarget() 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.4.1 xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c:1.6.4.1 Fri May 25 14:15:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c Fri Nov 16 16:13:34 2001 @@ -4,14 +4,14 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c,v 1.6.4.1 2001/05/25 18:15:45 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c,v 1.9 2001/11/16 21:13:34 tsi Exp $ */ #ifdef __NetBSD__ # include <sys/types.h> # include <machine/pio.h> # include <machine/sysarch.h> #else -# ifdef SVR4 +# if defined(SVR4) && defined(i386) # include <sys/types.h> # ifdef NCR /* broken NCR <sys/sysi86.h> */ @@ -42,7 +42,7 @@ # define SET_IOPL() i386_iopl(3) # define RESET_IOPL() i386_iopl(0) #else -# ifdef SVR4 +# if defined(SVR4) && defined(i386) # ifndef SI86IOPL # define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL) # define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0) @@ -51,21 +51,21 @@ # define RESET_IOPL() sysi86(SI86IOPL,0) # endif # else -# ifndef Lynx +# ifdef linux # define SET_IOPL() iopl(3) # define RESET_IOPL() iopl(0) # else -# define SET_IOPL() 0 -# define RESET_IOPL() 0 +# define SET_IOPL() (void)0 +# define RESET_IOPL() (void)0 # endif # endif #endif -void main(void) +int main(void) { int i, HTotal, HDisplay, HSyncStart, HSyncEnd, - VTotal, VDisplay, VSyncStart, VSyncEnd, Clock; - unsigned char storeReg, bpp, shift, IOSS, MSS, again; + VTotal, VDisplay, VSyncStart, VSyncEnd; + unsigned char storeReg, bpp, shift, IOSS = 0, MSS = 0, again = 0; unsigned short port; int isHiQV = 0; int is69030 = 0; @@ -250,12 +250,11 @@ HTotal = ((inb(0x3D5)&0xFF) + 5) << shift; outb(0x3D4,1); HDisplay = ((inb(0x3D5)&0xFF) + 1) << shift; - outb(0x3D4,2); + outb(0x3D4,4); HSyncStart = ((inb(0x3D5)&0xFF) + 1) << shift; - outb(0x3D4,3); + outb(0x3D4,5); HSyncEnd = inb(0x3D5)&0x1F; outb(0x3D4,5); - HSyncEnd |= (inb(0x3D5)&0x80) >> 2; HSyncEnd += HSyncStart >> shift; HSyncEnd <<= shift; @@ -271,6 +270,7 @@ VSyncStart |= (inb(0x3D5)&0x80) << 2; outb(0x3D4,0x12); VDisplay |= inb(0x3D5)&0xFF; + VDisplay += 1; outb(0x3D4,0x10); VSyncStart |= inb(0x3D5)&0xFF; @@ -301,7 +301,5 @@ } } RESET_IOPL(); + return 0; } - - - Index: xc/programs/Xserver/hw/xfree86/drivers/chips/util/mRegs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/util/mRegs.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/chips/util/mRegs.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/chips/util/mRegs.c:1.5 Mon Oct 23 08:10:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/util/mRegs.c Fri Nov 16 16:13:34 2001 @@ -4,14 +4,14 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/mRegs.c,v 1.5 2000/10/23 12:10:13 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/mRegs.c,v 1.6 2001/11/16 21:13:34 tsi Exp $ */ #ifdef __NetBSD__ # include <sys/types.h> # include <machine/pio.h> # include <machine/sysarch.h> #else -# ifdef SVR4 +# if defined(SVR4) && defined(i386) # include <sys/types.h> # ifdef NCR /* broken NCR <sys/sysi86.h> */ @@ -42,7 +42,7 @@ # define SET_IOPL() i386_iopl(3) # define RESET_IOPL() i386_iopl(0) #else -# ifdef SVR4 +# if defined(SVR4) && defined(i386) # ifndef SI86IOPL # define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL) # define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0) @@ -51,12 +51,12 @@ # define RESET_IOPL() sysi86(SI86IOPL,0) # endif # else -# ifndef Lynx +# ifdef linux # define SET_IOPL() iopl(3) # define RESET_IOPL() iopl(0) # else -# define SET_IOPL() 0 -# define RESET_IOPL() 0 +# define SET_IOPL() (void)0 +# define RESET_IOPL() (void)0 # endif # endif #endif @@ -65,10 +65,10 @@ int main(int argc, char** argv) { - int i, value, index; + int i, value, index = 0; char c, cport; char* str; - unsigned int port, port1; + unsigned int port, port1 = 0; int query = 0; if(argc < 2) { @@ -86,8 +86,7 @@ printf(" vv is in hexadecimal or '?' for query\n"); } - if(SET_IOPL()) - return -1; + SET_IOPL(); for(i = 1; i < argc; i++){ value = 0; @@ -146,7 +145,7 @@ break; } if ((cport != 'Z') && (cport != 'Y')) index = inb(port); - while (c = *str++){ + while ((c = *str++)) { if (c == '?') { query = 1; } Index: xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c:1.5 Wed May 9 15:57:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c Fri Nov 16 16:13:34 2001 @@ -1,11 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c,v 1.5 2001/05/09 19:57:06 dbateman Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c,v 1.6 2001/11/16 21:13:34 tsi Exp $ */ #ifdef __NetBSD__ # include <sys/types.h> # include <machine/pio.h> # include <machine/sysarch.h> #else -# ifdef SVR4 +# if defined(SVR4) && defined(i386) # include <sys/types.h> # ifdef NCR /* broken NCR <sys/sysi86.h> */ @@ -39,7 +39,7 @@ # define SET_IOPL() i386_iopl(3) # define RESET_IOPL() i386_iopl(0) #else -# ifdef SVR4 +# if defined(SVR4) && defined(i386) # ifndef SI86IOPL # define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL) # define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0) @@ -48,12 +48,12 @@ # define RESET_IOPL() sysi86(SI86IOPL,0) # endif # else -# ifndef Lynx +# ifdef linux # define SET_IOPL() iopl(3) # define RESET_IOPL() iopl(0) # else -# define SET_IOPL() 0 -# define RESET_IOPL() 0 +# define SET_IOPL() (void)0 +# define RESET_IOPL() (void)0 # endif # endif #endif @@ -100,7 +100,7 @@ unsigned int M, N, P, PSN, PSNx; - double bestError, abest = 42, bestFout; + double bestError = 0, abest = 42, bestFout = 0; double Fvco, Fout; double error, aerror; @@ -196,7 +196,6 @@ } if (abest < tolerance) { - unsigned char tmp, idx; printf ("best: M=%d N=%d P=%d PSN=%d\n", *bestM, *bestN, *bestP, *bestPSN); if (bestFout > 1.0e6) @@ -230,7 +229,7 @@ if (IS_MemClk(ClockType)) { printf ("XRCC = 0x%02X\n", M - 2); printf ("XRCD = 0x%02X\n", N - 2); - printf ("XRCE = 0x%02X\n", (0x80 | P * 16 + (PSN == 1))); + printf ("XRCE = 0x%02X\n", (0x80 | (P * 16 + (PSN == 1)))); outb(0x3D6, 0xCE); /* Select Fix MClk before */ tmp = inb(0x3D7); Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h:1.7 Fri May 4 15:05:35 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h Mon Oct 1 09:44:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.7 2001/05/04 19:05:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.8 2001/10/01 13:44:05 eich Exp $ */ /* (c) Itai Nahshon */ @@ -77,6 +77,7 @@ /* MMIO Base for BitBLT operation. This is IOBase for 5446 and 7548, IOBase+0x100 for 5480 */ unsigned char * BLTBase; + CARD32 transRop; /* XXX For XF86Config based mem configuration */ CARD32 sr0f, sr17; } AlpRec, *AlpPtr; Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.20 Fri May 4 15:05:35 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c Fri Jan 4 16:22:29 2002 @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.20 2001/05/04 19:05:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.26 2002/01/04 21:22:29 tsi Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -155,53 +155,53 @@ */ static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWHandleColormaps", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWddc1SetSpeed", + "vgaHWSetMmioFuncs", + "vgaHWSetStdFuncs", + "vgaHWUnlock", NULL }; -#ifdef XFree86LOADER - -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", + NULL +}; + +static const char *fbSymbols[] = { "fbScreenInit", "fbPictureInit", NULL }; -#endif - static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *int10Symbols[] = { - "xf86InitInt10", "xf86FreeInt10", + "xf86InitInt10", NULL }; @@ -210,14 +210,10 @@ NULL }; -#define ALPuseI2C 0 - static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", -#if ALPuseI2C "xf86DoEDID_DDC2", -#endif + "xf86SetDDCproperties", NULL }; @@ -262,7 +258,7 @@ if (!setupDone) { setupDone = TRUE; LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, - ramdacSymbols,int10Symbols, + miscfbSymbols, ramdacSymbols,int10Symbols, ddcSymbols, i2cSymbols, shadowSymbols, NULL); } return (pointer)1; @@ -758,7 +754,7 @@ * XXX Check if this is correct */ if (!pCir->UseMMIO) { - pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; + pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT | RAC_FB; xf86SetOperatingState(resVgaMemShared, pCir->pEnt->index,ResUnusedOpr); } else { xf86SetOperatingState(RES_SHARED_VGA, pCir->pEnt->index, ResUnusedOpr); @@ -896,7 +892,7 @@ break; } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* XXX Set HW cursor use */ @@ -1090,7 +1086,7 @@ AlpFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); break; } @@ -1464,6 +1460,7 @@ CirPtr pCir; AlpPtr pAlp; int i, ret; + int init_picture = 0; VisualPtr visual; int displayWidth,width,height; unsigned char * FbBase = NULL; @@ -1582,6 +1579,7 @@ width,height, pScrn->xDpi, pScrn->yDpi, displayWidth,pScrn->bitsPerPixel); + init_picture = 1; break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1592,7 +1590,6 @@ } if (!ret) return FALSE; - fbPictureInit (pScreen, 0, 0); #ifdef ALP_DEBUG ErrorF("AlpScreenInit after depth dependent init\n"); @@ -1613,6 +1610,10 @@ } } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit (pScreen, 0, 0); + miInitializeBackingStore(pScreen); /* @@ -1807,9 +1808,10 @@ /* Should we re-save the text mode on each VT enter? */ if (!(ret = AlpModeInit(pScrn, pScrn->currentMode))) - return FALSE; + return FALSE; - pCir->InitAccel(pScrn); + if (!pCir->NoAccel) + pCir->InitAccel(pScrn); return ret; } Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.6 Thu Feb 15 12:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c Mon Oct 1 09:44:05 2001 @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.6 2001/02/15 17:39:27 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -91,16 +91,14 @@ dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8; source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8; if (dest > source) { - decrement = 1; + decrement = 1 << 8; dest += hh * pitch + ww; source += hh * pitch + ww; } WAIT; - outb(0x3CE, 0x30); - outb(0x3CF, decrement); - outb(0x3CE, 0x31); + outw(0x3CE, decrement | 0x30); /* Width */ outw(0x3CE, ((ww << 8) & 0xff00) | 0x20); Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.6 Thu Feb 15 12:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c Mon Oct 1 09:44:05 2001 @@ -1,7 +1,7 @@ /* (c) Itai Nahshon */ +#define DEBUG +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.7 2001/10/01 13:44:05 eich 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" #include "xf86_ansic.h" @@ -18,23 +18,23 @@ #ifdef DEBUG #define minb(p) \ - ErrorF("minb(%X)\n", p),\ - MMIO_IN8(pCir->chip.alp->BLTBase, (p)) + (ErrorF("minb(%X)\n", p),\ + MMIO_IN8(pCir->chip.alp->BLTBase, (p))) #define moutb(p,v) \ - ErrorF("moutb(%X)\n", p),\ - MMIO_OUT8(pCir->chip.alp->BLTBase, (p),(v)) + (ErrorF("moutb(%X, %X)\n", 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))) + (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)) + { ErrorF("moutb(%X, %X)\n", p,v);\ + MMIO_OUT8(hwp->MMIOBase, (hwp->MMIOOffset + (p)),(v));} #define minl(p) \ - ErrorF("minl(%X)\n", p),\ - MMIO_IN32(pCir->chip.alp->BLTBase, (p)) + (ErrorF("minl(%X)\n", p),\ + MMIO_IN32(pCir->chip.alp->BLTBase, (p))) #define moutl(p,v) \ - ErrorF("moutl(%X)\n", p),\ - MMIO_OUT32(pCir->chip.alp->BLTBase, (p),(v)) + (ErrorF("moutl(%X, %X)\n", p,v),\ + MMIO_OUT32(pCir->chip.alp->BLTBase, (p),(v))) #else #define minb(p) MMIO_IN8(pCir->chip.alp->BLTBase, (p)) #define moutb(p,v) MMIO_OUT8(pCir->chip.alp->BLTBase, (p),(v)) @@ -65,9 +65,7 @@ }; #define WAIT while(minl(0x40) & pCir->chip.alp->waitMsk){}; -#define WAIT_1 while(minl(0x40) & 0x1){}; - -#define SetupForRop(rop) moutb(0x1A, translated_rop[rop]) +#define WAIT_1 while((minl(0x40)) & 0x1){}; static void AlpSync(ScrnInfoPtr pScrn) { @@ -87,9 +85,9 @@ int pitch = pCir->pitch; WAIT; - - SetupForRop(rop); + pCir->chip.alp->transRop = translated_rop[rop] << 16; + #ifdef ALP_DEBUG ErrorF("AlpSetupForScreenToScreenCopy xdir=%d ydir=%d rop=%x planemask=%x trans_color=%x\n", xdir, ydir, rop, planemask, trans_color); @@ -124,7 +122,7 @@ moutl(0x08, (hh << 16) | ww); /* source */ moutl(0x14, source & 0x3fffff); - moutl(0x18, 0x0d0000 | decrement); + moutl(0x18, pCir->chip.alp->transRop | decrement); /* dest */ write_mem_barrier(); @@ -153,8 +151,6 @@ WAIT; - SetupForRop(rop); - #ifdef ALP_DEBUG ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n", color, rop, planemask); @@ -164,7 +160,9 @@ /* Set dest pitch */ moutl(0x0C, pitch & 0x1fff); - moutl(0x18, (0xC0|((pScrn->bitsPerPixel - 8) << 1)) | 0x040d0000); + moutl(0x18, (((pScrn->bitsPerPixel - 8) << 1)) + | translated_rop[rop] << 16 + | 0x040000C0); } static void @@ -249,6 +247,7 @@ switch (pCir->Chipset) { case PCI_CHIP_GD5480: + case PCI_CHIP_GD5446: pCir->chip.alp->BLTBase = pCir->IOBase + 0x100; break; default: Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.19 xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.19 Fri May 4 15:05:35 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h Fri Jan 4 16:26:54 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.19 2001/05/04 19:05:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.20 2002/01/04 21:26:54 tsi Exp $ */ /* (c) Itai Nahshon */ @@ -15,54 +15,54 @@ struct alpRec; typedef struct { - ScrnInfoPtr pScrn; - CARD32 properties; - pciVideoPtr PciInfo; - PCITAG PciTag; + ScrnInfoPtr pScrn; + CARD32 properties; + pciVideoPtr PciInfo; + PCITAG PciTag; union { - struct lgRec *lg; - struct alpRec *alp; + struct lgRec *lg; + struct alpRec *alp; } chip; - EntityInfoPtr pEnt; - int Chipset; - int ChipRev; - int Rounding; - int BppShift; - Bool HasFBitBlt; - CARD32 IOAddress; - CARD32 FbAddress; + EntityInfoPtr pEnt; + int Chipset; + int ChipRev; + int Rounding; + int BppShift; + Bool HasFBitBlt; + CARD32 IOAddress; + CARD32 FbAddress; unsigned char * IOBase; unsigned char * FbBase; - long FbMapSize; - long IoMapSize; - int MinClock; - int MaxClock; - Bool NoAccel; - Bool HWCursor; - Bool UseMMIO; + long FbMapSize; + long IoMapSize; + int MinClock; + int MaxClock; + Bool NoAccel; + Bool HWCursor; + Bool UseMMIO; XAAInfoRecPtr AccelInfoRec; xf86CursorInfoPtr CursorInfoRec; - int DGAnumModes; - DGAModePtr DGAModes; - Bool DGAactive; - Bool (*DGAModeInit)(ScrnInfoPtr, DisplayModePtr); - int DGAViewportStatus; - I2CBusPtr I2CPtr1; - I2CBusPtr I2CPtr2; + int DGAnumModes; + DGAModePtr DGAModes; + Bool DGAactive; + Bool (*DGAModeInit)(ScrnInfoPtr, DisplayModePtr); + int DGAViewportStatus; + I2CBusPtr I2CPtr1; + I2CBusPtr I2CPtr2; CloseScreenProcPtr CloseScreen; - Bool CursorIsSkewed; - Bool shadowFB; - int rotate; - int ShadowPitch; - unsigned char * ShadowPtr; - void (*PointerMoved)(int index, int x, int y); - int pitch; - - unsigned char ** ScanlineColorExpandBuffers; - void (* InitAccel)(ScrnInfoPtr); - int offscreen_size; - int offscreen_offset; + Bool CursorIsSkewed; + Bool shadowFB; + int rotate; + int ShadowPitch; + unsigned char * ShadowPtr; + void (*PointerMoved)(int index, int x, int y); + int pitch; + + unsigned char ** ScanlineColorExpandBuffers; + void (*InitAccel)(ScrnInfoPtr); + int offscreen_size; + int offscreen_offset; OptionInfoPtr Options; } CirRec, *CirPtr; Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c:1.6 Sun Apr 1 10:00:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c Mon Oct 1 09:44:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.6 2001/04/01 14:00:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */ /* * Copyright 2000 by Egbert Eich * @@ -78,7 +78,6 @@ if (!pCir->DGAnumModes) { - ErrorF("DGAINIT\n"); pMode = firstMode = pScrn->modes; while (pMode) { newmodes = xrealloc(modes, (num + 1) * sizeof (DGAModeRec)); Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c:1.67 xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c:1.68 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c:1.67 Tue May 15 06:19:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c Wed Jun 13 19:34:09 2001 @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.67 2001/05/15 10:19:37 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.68 2001/06/13 23:34:09 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -116,13 +116,13 @@ */ static const char *alpSymbols[] = { - "AlpProbe", "AlpAvailableOptions", + "AlpProbe", NULL }; static const char *lgSymbols[] = { - "LgProbe", "LgAvailableOptions", + "LgProbe", NULL }; @@ -401,9 +401,7 @@ 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/lg_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.37 xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.41 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.37 Fri May 4 15:05:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c Fri Jan 4 16:22:29 2002 @@ -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.37 2001/05/04 19:05:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.41 2002/01/04 21:22:29 tsi Exp $ */ #define EXPERIMENTAL @@ -169,40 +169,39 @@ */ static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWHandleColormaps", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWddc1SetSpeed", + "vgaHWUnlock", NULL }; static const char *fbSymbols[] = { "fbScreenInit", + "fbPictureInit", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; @@ -210,10 +209,10 @@ static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", #if LGuseI2C "xf86DoEDID_DDC2", #endif + "xf86SetDDCproperties", NULL }; @@ -224,8 +223,8 @@ }; static const char *int10Symbols[] = { - "xf86InitInt10", "xf86FreeInt10", + "xf86InitInt10", NULL }; @@ -721,7 +720,7 @@ pCir->HWCursor = FALSE; } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* XXX Set HW cursor use */ @@ -864,7 +863,7 @@ LgFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); break; } @@ -1424,8 +1423,6 @@ if (!ret) return FALSE; - fbPictureInit(pScreen, 0, 0); - #ifdef LG_DEBUG ErrorF("LgScreenInit after depth dependent init\n"); #endif @@ -1444,6 +1441,10 @@ } } } + + /* must be after RGB ordering fixed */ + + fbPictureInit(pScreen, 0, 0); miInitializeBackingStore(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c:1.3 Wed Apr 19 12:57:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c Mon Jan 7 13:46:04 2002 @@ -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_accel.c,v 1.3 2000/04/19 16:57:43 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_accel.c,v 1.4 2002/01/07 18:46:04 dawes Exp $ */ #include "vgaHW.h" #include "xf86.h" @@ -35,10 +35,7 @@ #include "cyrix.h" #include "miline.h" #include "xf86_libc.h" - -#ifndef __GNUC__ -#define __inline__ /**/ -#endif +#include "compiler.h" /* size of color expand source area (embedded in frame buffer) */ #define CYRIXexpandSize 32768 Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.19 Fri May 4 15:05:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c Fri Jan 4 16:22:29 2002 @@ -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.19 2001/05/04 19:05:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.24 2002/01/04 21:22:29 tsi Exp $ */ #include "fb.h" #include "mibank.h" @@ -141,25 +141,31 @@ }; static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWHandleColormaps", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", + "vgaHWUnlock", NULL }; static const char *fbSymbols[] = { "fbScreenInit", + "fbPictureInit", NULL }; -static const char *racSymbols[] = { - "xf86RACInit", +static const char *xaaSymbols[] = { + "XAACreateInfoRec", + "XAADestroyInfoRec", NULL }; @@ -198,7 +204,7 @@ if (!setupDone) { setupDone = TRUE; xf86AddDriver(&CYRIX, module, 0); - LoaderRefSymLists(vgahwSymbols, fbSymbols, racSymbols, NULL); + LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, NULL); return (pointer)TRUE; } @@ -309,7 +315,9 @@ */ if ((numDevSections = xf86MatchDevice(CYRIX_DRIVER_NAME, &devSections)) <= 0) { +#ifdef DEBUG xf86ErrorFVerb(3,"%s: No Device section found.\n",CYRIX_NAME); +#endif /* * There's no matching device section in the config file, so quit * now. @@ -433,8 +441,6 @@ int videoram; int i; ClockRangePtr clockRanges; - char *mod = NULL; - const char *Sym = NULL; CARD32 physbase, padsize; int CYRIXisOldChipRevision; int device_step, device_revision; @@ -598,7 +604,7 @@ } } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Allocate the CYRIXRec driverPrivate */ @@ -671,8 +677,8 @@ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Found %s chip\n", pScrn->chipset); - if (pScrn->memPhysBase != 0) { - pCyrix->FbAddress = pScrn->memPhysBase; + if (pCyrix->pEnt->device->MemBase != 0) { + pCyrix->FbAddress = pCyrix->pEnt->device->MemBase; from = X_CONFIG; } else { from = X_PROBED; @@ -682,8 +688,8 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", (unsigned long)pCyrix->FbAddress); - if (pScrn->ioBase != 0) { - pCyrix->IOAccelAddress = pScrn->ioBase; + if (pCyrix->pEnt->device->IOBase != 0) { + pCyrix->IOAccelAddress = pCyrix->pEnt->device->IOBase; from = X_CONFIG; } else { from = X_PROBED; @@ -695,7 +701,7 @@ /* HW bpp matches reported bpp */ pCyrix->HwBpp = pScrn->bitsPerPixel; - if (pScrn->videoRam != 0) { + if (pCyrix->pEnt->device->videoRam != 0) { pScrn->videoRam = pCyrix->pEnt->device->videoRam; from = X_CONFIG; } else { @@ -777,35 +783,24 @@ /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); - /* Load bpp-specific modules */ switch (pScrn->bitsPerPixel) { case 1: case 4: case 8: pCyrix->EngineOperation |= 0x00; - mod = "fb"; - Sym = "fbScreenInit"; break; case 16: pCyrix->EngineOperation |= 0x01; - mod = "fb"; - Sym = "fbScreenInit"; break; } - - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { - CYRIXFreeRec(pScrn); - return FALSE; - } - xf86LoaderReqSymbols(Sym, NULL); - - if (!xf86LoadSubModule(pScrn, "rac")) { + /* Load fb module */ + if (xf86LoadSubModule(pScrn, "fb") == NULL) { CYRIXFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(racSymbols, NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); /* Load XAA if needed */ if (!pCyrix->NoAccel) { @@ -813,6 +808,7 @@ CYRIXFreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(xaaSymbols, NULL); switch (pScrn->displayWidth * pScrn->bitsPerPixel / 8) { case 512: @@ -1017,8 +1013,6 @@ if (!ret) return FALSE; - fbPictureInit (pScreen, 0, 0); - xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -1038,6 +1032,9 @@ Cyrix1bppColorMap(pScrn); } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); + if (pScrn->depth < 8) { miBankInfoPtr pBankInfo; @@ -1225,8 +1222,7 @@ static void CYRIXFreeScreen(int scrnIndex, int flags) { - if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) - vgaHWFreeHWRec(xf86Screens[scrnIndex]); + vgaHWFreeHWRec(xf86Screens[scrnIndex]); CYRIXFreeRec(xf86Screens[scrnIndex]); } @@ -1257,7 +1253,6 @@ unsigned char temp; if (enter) { - /*VGAHW_UNLOCK(vgaIOBase);*/ GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE; /* Unprotect CRTC[0-7] */ @@ -1277,7 +1272,6 @@ /* Protect CRTC[0-7] */ outb(vgaIOBase + 4, 0x11); temp = inb(vgaIOBase + 5); outb(vgaIOBase + 5, (temp & 0x7F) | 0x80); - /*VGAHW_LOCK(vgaIOBase);*/ GX_REG(DC_UNLOCK) = 0; } } Index: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c diff -u xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.30 xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.38 --- xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.30 Fri May 4 15:05:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c Sat Oct 27 23:33:29 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.30 2001/05/04 19:05:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.38 2001/10/28 03:33:29 tsi Exp $ */ /* * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> @@ -23,6 +23,7 @@ #ifdef USE_AFB #include "afb.h" #endif +#include "cfb24_32.h" #include "xf86Resources.h" #include "xf86RAC.h" @@ -56,16 +57,17 @@ char **argv); static Bool FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen); static void * FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size); + CARD32 *size, void *closure); +static void FBDevPointerMoved(int index, int x, int y); 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 +enum { FBDEV_ROTATE_NONE=0, FBDEV_ROTATE_CW=270, FBDEV_ROTATE_UD=180, FBDEV_ROTATE_CCW=90 }; + +/*static ShadowUpdateProc updateFuncs[] = + { shadowUpdatePacked, shadowUpdateRotate8_270, shadowUpdateRotate8_180, shadowUpdateRotate8_90, + shadowUpdatePacked, shadowUpdateRotate16_270, shadowUpdateRotate16_180, shadowUpdateRotate16_90, + shadowUpdatePacked, shadowUpdateRotate32_270, shadowUpdateRotate32_180, shadowUpdateRotate32_90 }; */ /* -------------------------------------------------------------------- */ @@ -77,7 +79,7 @@ static int pix24bpp = 0; #define VERSION 4000 -#define FBDEV_NAME "FBDev" +#define FBDEV_NAME "FBDEV" #define FBDEV_DRIVER_NAME "fbdev" #define FBDEV_MAJOR_VERSION 0 #define FBDEV_MINOR_VERSION 1 @@ -107,17 +109,13 @@ /* Supported options */ typedef enum { OPTION_SHADOW_FB, -#if 0 OPTION_ROTATE, -#endif OPTION_FBDEV } FBDevOpts; 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 } }; @@ -131,11 +129,16 @@ }; static const char *cfbSymbols[] = { - "fbScreenInit", "cfb24_32ScreenInit", NULL }; +static const char *fbSymbols[] = { + "fbScreenInit", + "fbPictureInit", + NULL +}; + static const char *shadowSymbols[] = { "shadowAlloc", "shadowInit", @@ -144,25 +147,35 @@ }; static const char *fbdevHWSymbols[] = { - "fbdevHWProbe", "fbdevHWInit", + "fbdevHWProbe", "fbdevHWSetVideoModes", "fbdevHWUseBuildinMode", - "fbdevHWGetName", "fbdevHWGetDepth", "fbdevHWGetLineLength", + "fbdevHWGetName", + "fbdevHWGetType", "fbdevHWGetVidmem", + "fbdevHWLinearOffset", + "fbdevHWLoadPalette", + "fbdevHWMapVidmem", + "fbdevHWUnmapVidmem", /* colormap */ "fbdevHWLoadpalette", /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", + "fbdevHWModeInit", + "fbdevHWRestore", + "fbdevHWSwitchMode", "fbdevHWValidMode", + + "fbdevHWDPMSSet", + NULL }; @@ -194,7 +207,8 @@ if (!setupDone) { setupDone = TRUE; xf86AddDriver(&FBDEV, module, 0); - LoaderRefSymLists(afbSymbols, cfbSymbols, shadowSymbols, NULL); + LoaderRefSymLists(afbSymbols, cfbSymbols, + fbSymbols, shadowSymbols, NULL); return (pointer)1; } else { if (errmaj) *errmaj = LDR_ONCEONLY; @@ -213,11 +227,10 @@ int fboff; int lineLength; unsigned char* shadowmem; -#if 0 int rotate; -#endif Bool shadowFB; CloseScreenProcPtr CloseScreen; + void (*PointerMoved)(int index, int x, int y); EntityInfoPtr pEnt; /* DGA info */ DGAModePtr pDGAMode; @@ -364,10 +377,9 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags) { FBDevPtr fPtr; - int default_depth; - char *mod = NULL, *s; - const char *reqSym = NULL; - Gamma zeros = {0.0, 0.0, 0.0}; + int default_depth, fbbpp; + const char *mod = NULL, *s; + const char **syms = NULL; if (flags & PROBE_DETECT) return FALSE; @@ -398,9 +410,8 @@ /* open device */ if (!fbdevHWInit(pScrn,NULL,xf86FindOptionValue(fPtr->pEnt->device->options,"fbdev"))) return FALSE; - default_depth = fbdevHWGetDepth(pScrn); - if (!xf86SetDepthBpp(pScrn, default_depth, default_depth, default_depth, - Support24bppFb | Support32bppFb)) + default_depth = fbdevHWGetDepth(pScrn,&fbbpp); + if (!xf86SetDepthBpp(pScrn, default_depth, default_depth, fbbpp,0)) return FALSE; xf86PrintDepthBpp(pScrn); @@ -427,7 +438,13 @@ return FALSE; } - xf86SetGamma(pScrn,zeros); + { + Gamma zeros = {0.0, 0.0, 0.0}; + + if (!xf86SetGamma(pScrn,zeros)) { + return FALSE; + } + } pScrn->progClock = TRUE; pScrn->rgbBits = 8; @@ -447,31 +464,30 @@ /* use shadow framebuffer by default */ fPtr->shadowFB = xf86ReturnOptValBool(fPtr->Options, OPTION_SHADOW_FB, TRUE); -#if 0 - /* rotation (doesn't work yet) */ - fPtr->rotate = 0; + /* rotation */ + fPtr->rotate = FBDEV_ROTATE_NONE; if ((s = xf86GetOptValString(fPtr->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { fPtr->shadowFB = TRUE; - fPtr->rotate = 1; + fPtr->rotate = FBDEV_ROTATE_CW; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen clockwise\n"); } else if(!xf86NameCmp(s, "CCW")) { fPtr->shadowFB = TRUE; - fPtr->rotate = 3; + fPtr->rotate = FBDEV_ROTATE_CCW; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen counter clockwise\n"); } else if(!xf86NameCmp(s, "UD")) { fPtr->shadowFB = TRUE; - fPtr->rotate = 2; + fPtr->rotate = FBDEV_ROTATE_UD; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Rotating screen counter clockwise\n"); + "Rotating screen upside down\n"); } else { @@ -481,7 +497,6 @@ "Valid options are \"CW\", \"CCW\" or \"UD\"\n"); } } -#endif /* select video modes */ @@ -509,7 +524,7 @@ else /* FIXME: this doesn't work for all cases, e.g. when each scanline has a padding which is independent from the depth (controlfb) */ - pScrn->displayWidth = fbdevHWGetLineLength(pScrn)/(fbdevHWGetDepth(pScrn) >> 3); + pScrn->displayWidth = fbdevHWGetLineLength(pScrn)/(fbdevHWGetDepth(pScrn,NULL) >> 3); xf86PrintModes(pScrn); @@ -521,24 +536,27 @@ { case FBDEVHW_PLANES: mod = "afb"; - reqSym = "afbScreenInit"; + syms = afbSymbols; break; case FBDEVHW_PACKED_PIXELS: - mod = "fb"; - reqSym = "fbScreenInit"; - xf86LoaderReqSymbols("fbPictureInit", NULL); - switch (pScrn->bitsPerPixel) { case 8: case 16: case 32: + mod = "fb"; + syms = fbSymbols; break; case 24: if (pix24bpp == 32) { mod = "xf24_32bpp"; - reqSym = "cfb24_32ScreenInit"; + syms = cfbSymbols; + } + else + { + mod = "fb"; + syms = fbSymbols; } break; default: @@ -573,7 +591,9 @@ FBDevFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols(reqSym, NULL); + if (mod && syms) { + xf86LoaderReqSymLists(syms, NULL); + } /* Load shadow if needed */ if (fPtr->shadowFB) { @@ -595,8 +615,8 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; FBDevPtr fPtr = FBDEVPTR(pScrn); VisualPtr visual; + int init_picture = 0; int ret,flags,width,height; - ShadowUpdateProc fun; TRACE_ENTER("FBDevScreenInit"); @@ -610,50 +630,63 @@ pScrn->offset.red,pScrn->offset.green,pScrn->offset.blue); #endif - if (NULL == (fPtr->fbmem = fbdevHWMapVidmem(pScrn))) + if (NULL == (fPtr->fbmem = fbdevHWMapVidmem(pScrn))) { + xf86DrvMsg(scrnIndex,X_ERROR,"Map vid mem failed\n"); return FALSE; + } fPtr->fboff = fbdevHWLinearOffset(pScrn); fbdevHWSave(pScrn); - if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) + if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) { + xf86DrvMsg(scrnIndex,X_ERROR,"Mode init failed\n"); return FALSE; - + } fbdevHWSaveScreen(pScreen, SCREEN_SAVER_ON); fbdevHWAdjustFrame(scrnIndex,0,0,0); /* mi layer */ miClearVisualTypes(); if (pScrn->bitsPerPixel > 8) { - if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, TrueColor)) + if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, TrueColor)) { + xf86DrvMsg(scrnIndex,X_ERROR,"Set visual types failed\n"); return FALSE; + } } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) + pScrn->rgbBits, pScrn->defaultVisual)) { + xf86DrvMsg(scrnIndex,X_ERROR,"Set visual types failed\n"); return FALSE; + } } - if (!miSetPixmapDepths()) + if (!miSetPixmapDepths()) { + xf86DrvMsg(scrnIndex,X_ERROR,"Set pixmap depths failed\n"); return FALSE; + } -#if 0 - if(fPtr->rotate==3 || fPtr->rotate==1) + if(fPtr->rotate==FBDEV_ROTATE_CW || fPtr->rotate==FBDEV_ROTATE_CCW) { height = pScrn->virtualX; - width = pScrn->virtualY; + width = pScrn->displayWidth = pScrn->virtualY; } else { -#endif height = pScrn->virtualY; width = pScrn->virtualX; -#if 0 } -#endif + + if(fPtr->rotate && !fPtr->PointerMoved) { + fPtr->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = FBDevPointerMoved; + } /* shadowfb */ if (fPtr->shadowFB) { if ((fPtr->shadowmem = shadowAlloc(width, height, - pScrn->bitsPerPixel)) == NULL) + pScrn->bitsPerPixel)) == NULL) { + xf86DrvMsg(scrnIndex,X_ERROR, + "Allocation of shadow memory failed\n"); return FALSE; + } fPtr->fbstart = fPtr->shadowmem; } else { @@ -665,7 +698,6 @@ { #ifdef USE_AFB case FBDEVHW_PLANES: -#if 0 if (fPtr->rotate) { xf86DrvMsg(scrnIndex, X_ERROR, @@ -673,11 +705,10 @@ ret = FALSE; break; } -#endif if (fPtr->shadowFB) { xf86DrvMsg(scrnIndex, X_ERROR, - "Internal error: Shadwo framebuffer not supported for afb\n"); + "Internal error: Shadow framebuffer not supported for afb\n"); ret = FALSE; break; } @@ -688,22 +719,13 @@ #endif case FBDEVHW_PACKED_PIXELS: switch (pScrn->bitsPerPixel) { - case 24: - if (pix24bpp == 32) - { - ret = cfb24_32ScreenInit - (pScreen, fPtr->fbstart, width, height, - pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); - break; - } case 8: case 16: + case 24: case 32: 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"); + init_picture = 1; break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -761,35 +783,28 @@ } } -#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) + /* must be after RGB ordering fixed */ + if (init_picture && !fbPictureInit(pScreen, NULL, 0)) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "RENDER extension initialisation failed.\n"); + + if (fPtr->shadowFB && + (!shadowSetup(pScreen) || !shadowAdd(pScreen, NULL, + fPtr->rotate ? shadowUpdateRotatePacked : shadowUpdatePacked, + FBDevWindowLinear, fPtr->rotate, NULL)) ) { xf86DrvMsg(scrnIndex, X_ERROR, - "Internal error: rotate not supported for %dbpp.\n", - pScrn->bitsPerPixel); - return FALSE; + "Shadow framebuffer initialization failed.\n"); + return FALSE; } if (!fPtr->rotate) -#endif FBDevDGAInit(pScrn, pScreen); -#if 0 - else - xf86DrvMsg(scrnIndex, X_WARNING, - "Rotated display, disabling DGA\n"); -#endif + else { + xf86DrvMsg(scrnIndex, X_INFO, "Rotated display, disabling DGA\n"); + + if (pScrn->bitsPerPixel == 24) + xf86DrvMsg(scrnIndex, X_WARNING, "Rotation might be broken in 24 bpp\n"); + } xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); @@ -870,17 +885,26 @@ fbdevHWUnmapVidmem(pScrn); if (fPtr->shadowmem) xfree(fPtr->shadowmem); - if (fPtr->pDGAMode) + if (fPtr->pDGAMode) { xfree(fPtr->pDGAMode); + fPtr->pDGAMode = NULL; + fPtr->nDGAMode = 0; + } pScrn->vtSema = FALSE; pScreen->CloseScreen = fPtr->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } + + +/*********************************************************************** + * Shadow stuff + ***********************************************************************/ + static void * FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; FBDevPtr fPtr = FBDEVPTR(pScrn); @@ -891,6 +915,44 @@ *size = fPtr->lineLength = fbdevHWGetLineLength(pScrn); return ((CARD8 *)fPtr->fbmem + fPtr->fboff + row * fPtr->lineLength + offset); +} + +static void +FBDevPointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + FBDevPtr fPtr = FBDEVPTR(pScrn); + int newX, newY; + + switch (fPtr->rotate) + { + case FBDEV_ROTATE_CW: + /* 90 degrees CW rotation. */ + newX = pScrn->pScreen->height - y - 1; + newY = x; + break; + + case FBDEV_ROTATE_CCW: + /* 90 degrees CCW rotation. */ + newX = y; + newY = pScrn->pScreen->width - x - 1; + break; + + case FBDEV_ROTATE_UD: + /* 180 degrees UD rotation. */ + newX = pScrn->pScreen->width - x - 1; + newY = pScrn->pScreen->height - y - 1; + break; + + default: + /* No rotation. */ + newX = x; + newY = y; + break; + } + + /* Pass adjusted pointer coordinates to wrapped PointerMoved function. */ + (*fPtr->PointerMoved)(index, newX, newY); } Index: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man diff -u xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man:1.2 Sat Jan 27 13:20:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man Tue Oct 2 11:57:32 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man,v 1.2 2001/01/27 18:20:47 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man,v 1.3 2001/10/02 15:57:32 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH FBDEV __drivermansuffix__ __vendorversion__ @@ -49,8 +49,12 @@ 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. +Enable or disable use of the shadow framebuffer layer. Default: on. +.TP +.BI "Option \*qRotate\*q \*q" string \*q +Enable rotation of the display. The supported values are "CW" (clockwise, +90 degrees), "UD" (upside down, 180 degrees) and "CCW" (counter clockwise, +270 degrees). Implies use of the shadow framebuffer layer. Default: off. .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__), fbdevhw(__drivermansuffix__) Index: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c:1.28 --- xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c:1.24 Wed May 16 02:48:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c Fri Jan 4 16:22:30 2002 @@ -45,7 +45,7 @@ * Support static loading. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c,v 1.24 2001/05/16 06:48:08 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c,v 1.28 2002/01/04 21:22:30 tsi Exp $ */ #include "xaa.h" #include "xf86Cursor.h" @@ -213,9 +213,7 @@ static const char *fbSymbols[] = { "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif NULL }; @@ -250,14 +248,6 @@ static Bool setupDone = FALSE; pointer ret; int errmaj2 = 0, errmin2 = 0; - - /* This module should be loaded only once, but check to be sure. */ - - if (xf86ServerIsOnlyDetecting()) - { - xf86AddDriver(&GLIDE, module, 0); - return (pointer)1; - } if (!setupDone) { @@ -299,6 +289,8 @@ } setupDone = TRUE; + /* This module should be loaded only once */ + *errmaj = LDR_ONCEONLY; xf86AddDriver(&GLIDE, module, 0); /* @@ -522,7 +514,7 @@ } } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Allocate the GLIDERec driverPrivate */ @@ -714,10 +706,6 @@ if (!ret) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { @@ -730,6 +718,9 @@ visual->blueMask = pScrn->mask.blue; } } + + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); miInitializeBackingStore(pScreen); xf86SetBlackWhitePixels(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.34.2.1 xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.35 --- xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.34.2.1 Fri May 25 07:19:31 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile Fri May 25 07:19:58 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.34.2.1 2001/05/25 11:19:31 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.35 2001/05/25 11:19:58 alanh Exp $ XCOMM XCOMM This is an Imakefile for the GLINT driver. XCOMM Index: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.11 xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.11 Tue May 8 15:31:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 Sat Aug 18 07:37:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.11 2001/05/08 19:31:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.12 2001/08/18 11:37:30 alanh Exp $ */ STATUS as of Tue, 8 May 2001 19:01:39 +0200 @@ -23,22 +23,24 @@ - Bitmap Writes using direct FIFO writes with or without FIFO Disconnect. - Pixmap Writes using direct FIFO writes with or without FIFO Disconnect. * Appian J2000 second head initialization. - * Dual head : The console fonts will get trashed, but dual head works. * Xv : Hardware video scaler : - Needs checking on a big endian machine. - - Needs acceleration to work. - - Clipping supported trough the alpha channel in depth 15 and 24 - and with an overlay key color in depth 8 and 16. + - Needs acceleration to work - there is a hardware bug in YV12 mode. - Support both dual head and single head, trough gamma or permedia3. + - NOTE: depth 15 and 16 currently broken as I can't figure out the + colorKey equation. From the docs it needs to be padded to 8bits per RGB, + but that doesn't seem to work either. FIXME. - Attributes are : - FILTER : None, Partial (X only) or Full filtering. - - MIRROR : X and/or Y Axis mirroring. - - ALPHA : + - COLORKEY : Speaks for itself + - DOUBLE_BUFFER : Speaks for itself + - AUTOPAINT_COLORKEY : Speaks for itself + - MIRROR : X and/or Y Axis mirroring. (NOT DONE) + - ALPHA : (NOT DONE) - 0 -> FB Only - 1 -> 25% Video, 75% FB - 2 -> 75% Video, 25% FB - 3 -> Video Only - - [TODO] VIDEOKEY : Overlay Key Color for clipping in depth 8 and 16. * DRI : Work is underway. Not Working : @@ -51,14 +53,6 @@ - Render extension initialization. - CPUToScreenTexture. - CPUToScreenAlphaTexture. - * [NEED FIX] Xv has still some minor problems : - - depth 8 does not work, but then it may be the app i am using. - - when using 2D accels there is some unstability in the video display. I - guess this is because there is then not enough bandwith to do the - copying of the data in time. After a time of the above, the images - becomes black. It will come back once stopvideo is called. - [FIX] i will disable VideoOverlay each 25 frames, this causes a flicker, - but at least it will bing the image back. * [WORK IS UNDERWAY] DRI/OpenGL (only together with a gamma chip) : - DRI support should be ok, but accelerated openGL is not yet supported. - The accelerated OpenGL library supposes we are using a gamma together @@ -66,24 +60,12 @@ Known problems : - * Console gets broken when using dual headed mode. The culprit seems to be - the vga graphics index & port (GraphicsIndexReg : 0x63ce, GraphicsPort : - 0x3cf). I had to use IO acces for both these two, because if not, console - fonts would get trashed even in mono headed mode. - [FIX] Well, if you really need the console and are running linux, just use - vesafb, it will be a bit slower, but the fonts will no more become - corrupt. Maybe i will even try writting a specific fbdev for the pm3, - which will be much faster and have more functionality. - [FIX2] try : consolechars -d, it should reload the console fonts. * [FIXED] R-B inversion. Sometimes, all of a sudden, it seems as the RGB order gets changed. going to console and back solves this. Well, this is partly fixed, but still appears under very heavy load. - * [FIXED] When moving a window around a lot quickly, the video outputs dies. - Well, this is partly fixed, but still appears under very heavy load. - => [NOTE] If this two still happens, try disabling the Hardware cursor, with + => [NOTE] If this still happens, try disabling the Hardware cursor, with the "SWCursor" option to your device XF86Config section. - * Sometimes there are blue transparent garbage in the form of small - horizontal bands, few pixels high, and more pixels width, maybe 64pixels ? - This may be a hardware bug. + => [NOTE2] Or, try starting the Xserver with the -nosilk option. Sven Luther <luther@dpt-info.u-strasbg.fr> +Alan Hourihane <alanh@fairlite.demon.co.uk> Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.48.2.1 xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.54 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.48.2.1 Thu May 24 16:12:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h Sat Dec 8 11:01:52 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.48.2.1 2001/05/24 20:12:47 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.54 2001/12/08 16:01:52 alanh Exp $ */ /* * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * @@ -35,6 +35,7 @@ #include "xf86cmap.h" #include "xf86i2c.h" #include "xf86DDC.h" +#include "xf86xv.h" #ifdef XF86DRI #include "xf86drm.h" #include "sarea.h" @@ -162,6 +163,11 @@ CARD32 PM3_AreaStippleMode; CARD32 PM3_VideoControl; int InFifoSpace; +#ifdef XvExtension + void (*VideoTimerCallback)(ScrnInfoPtr, Time); + XF86VideoAdaptorPtr adaptor; + int videoKey; +#endif #ifdef XF86DRI Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; @@ -173,6 +179,7 @@ GLINTRegRec DRContextRegs; #endif OptionInfoPtr Options; + Bool PM3_UsingSGRAM; } GLINTRec, *GLINTPtr; /* Defines for PCI data */ @@ -189,6 +196,10 @@ ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_PERMEDIA2V) #define PCI_VENDOR_3DLABS_CHIP_PERMEDIA3 \ ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_PERMEDIA3) +#define PCI_VENDOR_3DLABS_CHIP_PERMEDIA4 \ + ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_PERMEDIA4) +#define PCI_VENDOR_3DLABS_CHIP_R4 \ + ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_R4) #define PCI_VENDOR_3DLABS_CHIP_300SX \ ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_300SX) #define PCI_VENDOR_3DLABS_CHIP_500TX \ @@ -197,6 +208,8 @@ ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_MX) #define PCI_VENDOR_3DLABS_CHIP_GAMMA \ ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_GAMMA) +#define PCI_VENDOR_3DLABS_CHIP_GAMMA2 \ + ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_GAMMA2) #define PCI_VENDOR_3DLABS_CHIP_DELTA \ ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_DELTA) @@ -211,6 +224,7 @@ void Permedia2Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void Permedia2Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool Permedia2Init(ScrnInfoPtr pScrn, DisplayModePtr mode); +void Permedia2PreInit(ScrnInfoPtr pScrn); Bool Permedia2AccelInit(ScreenPtr pScreen); void Permedia2Sync(ScrnInfoPtr pScrn); void Permedia2InitializeEngine(ScrnInfoPtr pScrn); @@ -237,6 +251,7 @@ void Permedia3EnableOffscreen(ScreenPtr pScreen); void Permedia3Sync(ScrnInfoPtr pScrn); void DualPermedia3Sync(ScrnInfoPtr pScrn); +void Permedia3InitVideo(ScreenPtr pScreen); void TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void TXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); @@ -319,6 +334,7 @@ void GLINTAdjustFrame(int scrnIndex, int x, int y, int flags); extern int partprodPermedia[]; +extern const char *GLINTint10Symbols[]; Bool GLINTDGAInit(ScreenPtr pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man:1.3 Mon Mar 19 17:50:28 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man Mon Dec 17 15:52:32 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.3 2001/03/19 22:50:28 alanh Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.5 2001/12/17 20:52:32 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH GLINT __drivermansuffix__ __vendorversion__ @@ -21,9 +21,9 @@ .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. +driver supports 3Dlabs (GLINT MX, GLINT 500TX, GLINT 300SX, GLINT GAMMA, +GLINT DELTA, GLINT GAMMA2, Permedia, Permedia 2, Permedia 2v, Permedia 3, R4) +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 @@ -36,7 +36,8 @@ section, and will override the auto-detection: .PP .RS 4 -"ti_pm2", "ti_pm", "pm3", "pm2v", "pm2", "pm", "500tx", "mx", "gamma". +"ti_pm2", "ti_pm", "r4", "pm3", "pm2v", "pm2", "pm", "300sx", "500tx", "mx", +"gamma", "gamma2", "delta" .RE .PP The driver will try to auto-detect the amount of video memory present for all @@ -81,8 +82,7 @@ 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. +Enable or disable use of the shadow framebuffer layer. .RB ( Note: This disables hardware acceleration.) Default: off. .TP @@ -103,10 +103,6 @@ .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 Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c:1.3 Tue Apr 10 16:33:30 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c Sun Dec 16 16:36:50 2001 @@ -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.3 2001/04/10 20:33:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c,v 1.4 2001/12/16 21:36:50 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -42,10 +42,6 @@ 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 = { @@ -57,11 +53,7 @@ GLINT_Sync, GLINT_FillRect, GLINT_BlitRect, -#if 0 - GLINT_BlitTransRect -#else NULL -#endif }; Bool @@ -101,7 +93,7 @@ currentMode->mode = pMode; currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; if(!pGlint->NoAccel) - currentMode->flags |= DGA_FILL_RECT /*| DGA_BLIT_RECT*/; + currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; if(pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if(pMode->Flags & V_INTERLACE) @@ -259,22 +251,6 @@ SET_SYNC_FLAG(pGlint->AccelInfoRec); } } - - -#if 0 -static void -GLINT_BlitTransRect( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty, - unsigned long color -){ - /* this one should be separate since the XAA function would - prohibit usage of ~0 as the key */ -} -#endif - static Bool GLINT_OpenFramebuffer( Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c diff -u 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.144 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c:1.125.2.4 Tue May 29 07:32:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c Fri Jan 4 16:22:30 2002 @@ -28,7 +28,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen, * Siemens Nixdorf Informationssysteme and Appian Graphics. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.125.2.4 2001/05/29 11:32:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.144 2002/01/04 21:22:30 tsi Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -45,6 +45,7 @@ #include "xf86RAC.h" #include "xf86Resources.h" #include "xf86int10.h" +#include "dixstruct.h" #include "vbe.h" #include "compiler.h" @@ -66,7 +67,6 @@ #include "extensions/dpms.h" #define DEBUG 0 -#define PM3Video 1 #if DEBUG # define TRACE_ENTER(str) ErrorF("glint: " str " %d\n",pScrn->scrnIndex) @@ -130,15 +130,20 @@ static SymTabRec GLINTVGAChipsets[] = { { PCI_VENDOR_TI_CHIP_PERMEDIA2, "ti_pm2" }, { PCI_VENDOR_TI_CHIP_PERMEDIA, "ti_pm" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, "pm4" }, + { PCI_VENDOR_3DLABS_CHIP_R4, "r4" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, "pm3" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, "pm2v" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, "pm2" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA, "pm" }, + {-1, NULL } }; static PciChipsets GLINTVGAPciChipsets[] = { { PCI_VENDOR_TI_CHIP_PERMEDIA2, PCI_VENDOR_TI_CHIP_PERMEDIA2, RES_SHARED_VGA }, { PCI_VENDOR_TI_CHIP_PERMEDIA, PCI_VENDOR_TI_CHIP_PERMEDIA, NULL }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, RES_SHARED_VGA }, + { PCI_VENDOR_3DLABS_CHIP_R4, PCI_VENDOR_3DLABS_CHIP_R4, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, RES_SHARED_VGA }, @@ -148,8 +153,11 @@ static SymTabRec GLINTChipsets[] = { { PCI_VENDOR_3DLABS_CHIP_GAMMA, "gamma" }, + { PCI_VENDOR_3DLABS_CHIP_GAMMA2, "gamma2" }, { PCI_VENDOR_TI_CHIP_PERMEDIA2, "ti_pm2" }, { PCI_VENDOR_TI_CHIP_PERMEDIA, "ti_pm" }, + { PCI_VENDOR_3DLABS_CHIP_R4, "r4" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, "pm4" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, "pm3" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, "pm2v" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, "pm2" }, @@ -163,8 +171,11 @@ static PciChipsets GLINTPciChipsets[] = { { PCI_VENDOR_3DLABS_CHIP_GAMMA, PCI_VENDOR_3DLABS_CHIP_GAMMA, NULL }, + { PCI_VENDOR_3DLABS_CHIP_GAMMA2, PCI_VENDOR_3DLABS_CHIP_GAMMA2, NULL }, { PCI_VENDOR_TI_CHIP_PERMEDIA2, PCI_VENDOR_TI_CHIP_PERMEDIA2, RES_SHARED_VGA }, { PCI_VENDOR_TI_CHIP_PERMEDIA, PCI_VENDOR_TI_CHIP_PERMEDIA, NULL }, + { PCI_VENDOR_3DLABS_CHIP_R4, PCI_VENDOR_3DLABS_CHIP_R4, RES_SHARED_VGA }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, RES_SHARED_VGA }, @@ -185,7 +196,8 @@ OPTION_OVERLAY, OPTION_SHADOW_FB, OPTION_FBDEV, - OPTION_FLATPANEL + OPTION_FLATPANEL, + OPTION_VIDEO_KEY } GLINTOpts; static const OptionInfoRec GLINTOptions[] = { @@ -198,6 +210,7 @@ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FLATPANEL, "UseFlatPanel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -215,42 +228,40 @@ }; static const char *xf8_32bppSymbols[] = { + "cfb8_32ScreenInit", "xf86Overlay8Plus32Init", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAFillSolidRects", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", "XAAPolyLines", "XAAPolySegment", - "XAAFillSolidRects", + "XAAScreenIndex", NULL }; static const char *fbSymbols[] = { - "cfb8_32ScreenInit", + "fbBres", "fbPictureInit", "fbScreenInit", - "fbBres", NULL }; static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86SetDDCproperties", NULL }; static const char *i2cSymbols[] = { "xf86CreateI2CBusRec", "xf86DestroyI2CBusRec", + "xf86DestroyI2CDevRec", "xf86I2CBusInit", "xf86I2CDevInit", "xf86I2CProbeAddress", @@ -271,12 +282,30 @@ NULL }; +static const char *ramdacSymbols[] = { + "IBMramdac526CalculateMNPCForClock", + "IBMramdac640CalculateMNPCForClock", + "IBMramdacProbe", + "RamDacCreateInfoRec", + "RamDacDestroyInfoRec", + "RamDacFreeRec", + "RamDacGetHWIndex", + "RamDacHandleColormaps", + "RamDacInit", + "TIramdacCalculateMNPForClock", + "TIramdacLoadPalette", + "TIramdacProbe", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + "xf86InitCursor", + NULL +}; + + static const char *fbdevHWSymbols[] = { - "fbdevHWInit", "fbdevHWFreeRec", + "fbdevHWInit", "fbdevHWProbe", - "fbdevHWFreeRec", - "fbdevHWGetName", "fbdevHWUseBuildinMode", "fbdevHWGetDepth", @@ -286,23 +315,23 @@ "fbdevHWLoadPalette", /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", + "fbdevHWMapMMIO", + "fbdevHWMapVidmem", "fbdevHWModeInit", + "fbdevHWRestore", "fbdevHWSave", + "fbdevHWSwitchMode", "fbdevHWUnmapMMIO", "fbdevHWUnmapVidmem", - "fbdevHWMapMMIO", - "fbdevHWMapVidmem", + "fbdevHWValidMode", NULL }; -static const char *int10Symbols[] = { +const char *GLINTint10Symbols[] = { "xf86FreeInt10", "xf86InitInt10", NULL @@ -312,27 +341,23 @@ static const char *drmSymbols[] = { "drmAddBufs", "drmAddMap", - "drmCtlAddCommand", "drmCtlInstHandler", + "drmFreeVersion", "drmGetInterruptFromBusID", + "drmGetVersion", "drmMapBufs", - "drmMarkBufs", "drmUnmapBufs", - "drmFreeVersion", - "drmGetVersion", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", + "DRIGetDrawableIndex", "DRIQueryVersion", + "DRIScreenInit", "GlxSetVisualConfigs", NULL }; @@ -368,8 +393,8 @@ xf86AddDriver(&GLINT, module, 0); LoaderRefSymLists(fbSymbols, ddcSymbols, i2cSymbols, xaaSymbols, xf8_32bppSymbols, - shadowSymbols, fbdevHWSymbols, int10Symbols, - vbeSymbols, + shadowSymbols, fbdevHWSymbols, GLINTint10Symbols, + vbeSymbols, ramdacSymbols, #ifdef XF86DRI drmSymbols, driSymbols, #endif @@ -575,9 +600,7 @@ GLINTProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; -#ifdef XFree86LOADER if (xf86LoadSubModule(pScrn, "vbe")) -#endif { pVbe = VBEInit(NULL,index); vbeDoEDID(pVbe, NULL); @@ -737,6 +760,7 @@ } else /* Only claim other chips when GAMMA is used */ if ((pPci->chipType == PCI_CHIP_GAMMA) || + (pPci->chipType == PCI_CHIP_GAMMA2) || (pPci->chipType == PCI_CHIP_DELTA)) { while (*checkusedPci != NULL) { int eIndex; @@ -845,6 +869,7 @@ linep = &partprod500TX[0]; break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: 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 @@ -856,6 +881,7 @@ linep = &partprod500TX[0]; break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: linep = &partprodPermedia[0]; break; } @@ -946,6 +972,7 @@ ClockRangePtr clockRanges; char *mod = NULL; const char *s; + const char **syms = NULL; TRACE_ENTER("GLINTPreInit"); @@ -1002,8 +1029,10 @@ pPci = xf86GetPciInfoForEntity(pEnt->index); if ( (pPci->chipType == PCI_CHIP_MX) || (pPci->chipType == PCI_CHIP_PERMEDIA) || + (pPci->chipType == PCI_CHIP_TI_PERMEDIA) || (pPci->chipType == PCI_CHIP_500TX) || (pPci->chipType == PCI_CHIP_300SX) || + (pPci->chipType == PCI_CHIP_R4) || (pPci->chipType == PCI_CHIP_PERMEDIA3) ) { pGlint->MultiChip = pPci->chipType; if (pGlint->numMultiDevices >= GLINT_MAX_MULTI_DEVICES) { @@ -1024,6 +1053,7 @@ pciVideoPtr pPci = xf86GetPciInfoForEntity(pEnt->index); if ( ((pPci->chipType == PCI_CHIP_GAMMA) || + (pPci->chipType == PCI_CHIP_GAMMA2) || (pPci->chipType == PCI_CHIP_DELTA)) && (pGlint->numMultiDevices == 0) ) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1037,6 +1067,7 @@ pciVideoPtr pPci = xf86GetPciInfoForEntity(pEnt->index); if ((pPci->chipType != PCI_CHIP_GAMMA) && + (pPci->chipType != PCI_CHIP_GAMMA2) && (pPci->chipType != PCI_CHIP_DELTA)) { GLINTProbeDDC(pScrn, pGlint->pEnt->index); return TRUE; @@ -1059,15 +1090,14 @@ * We support both 24bpp and 32bpp layouts, so indicate that. */ if (FBDevProbed) { - int default_depth; + int default_depth, fbbpp; if (!fbdevHWInit(pScrn,NULL,xf86FindOptionValue(pGlint->pEnt->device->options,"fbdev"))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "fbdevHWInit failed!\n"); return FALSE; } - default_depth = fbdevHWGetDepth(pScrn); - if (!xf86SetDepthBpp(pScrn, default_depth, default_depth, default_depth, - Support24bppFb | Support32bppFb)) + default_depth = fbdevHWGetDepth(pScrn,&fbbpp); + if (!xf86SetDepthBpp(pScrn, default_depth, default_depth, fbbpp,0)) return FALSE; } else { if (!xf86SetDepthBpp(pScrn, 8, 0, 0, Support24bppFb | Support32bppFb @@ -1133,7 +1163,7 @@ } } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Collect all of the relevant option flags (fill in pScrn->options) */ @@ -1175,6 +1205,16 @@ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\" - acceleration disabled\n"); } + if(xf86GetOptValInteger(pGlint->Options, OPTION_VIDEO_KEY, + &(pGlint->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", + pGlint->videoKey); + } else { + /* Needs 8bit values for all modes */ + pGlint->videoKey = (1 << 16) | + (1 << 8) | + ((pScrn->mask.blue - 1) << 0); + } /* Check whether to use the FBDev stuff and fill in the rest of pScrn */ if (xf86ReturnOptValBool(pGlint->Options, OPTION_FBDEV, FALSE)) { @@ -1386,12 +1426,17 @@ /* We have to boot some multiple head type boards here */ GLINTMapMem(pScrn); switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: Permedia3PreInit(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VPreInit(pScrn); break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: + case PCI_VENDOR_TI_CHIP_PERMEDIA2: + Permedia2PreInit(pScrn); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: switch (pGlint->MultiChip) { case PCI_CHIP_PERMEDIA3: @@ -1412,7 +1457,8 @@ int temp, base3copro, offset; if( (basedelta & 0x20000) ^ (basecopro & 0x20000) ) { - if (pGlint->MultiChip == PCI_CHIP_PERMEDIA) { + if ((pGlint->MultiChip == PCI_CHIP_PERMEDIA) || + (pGlint->MultiChip == PCI_CHIP_TI_PERMEDIA)) { offset = 0x20; /* base4 */ } else { offset = 0x1c; /* base3 */ @@ -1490,13 +1536,17 @@ pScrn->videoRam = (((GLINT_READ_REG(PMMemConfig) >> 29) & 0x03) + 1) * 2048; break; + case PCI_VENDOR_3DLABS_CHIP_R4: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_DELTA: case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: switch (pGlint->MultiChip) { case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Attached Rasterizer is GLINT Permedia\n"); pScrn->videoRam = (((GLINT_READ_REG(PMMemConfig)>>29) & @@ -1526,6 +1576,11 @@ "Attached Rasterizer is Permedia3\n"); pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); break; + case PCI_CHIP_R4: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Attached Rasterizer is R4\n"); + pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); + break; } xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Number of Rasterizers attached is %d\n", @@ -1542,8 +1597,9 @@ /* OVERRIDE videoRam/FbMapSize, for Multiply connected chips to GAMMA */ pGlint->MultiAperture = FALSE; - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMultiDevices == 2) ) { + if ( ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA2)) && + (pGlint->numMultiDevices == 2) ) { CARD32 chipconfig; CARD32 size = 0; CARD32 temp; @@ -1590,6 +1646,8 @@ if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); + /* Let's check what type of DAC we have and reject if necessary */ switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: @@ -1627,7 +1685,14 @@ return FALSE; } break; + case PCI_VENDOR_3DLABS_CHIP_R4: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + if (pScrn->bitsPerPixel == 24) { + xf86DrvMsg(pScrn->scrnIndex, from, + "-depth 24 -pixmap24 not supported by this chip.\n"); + return FALSE; + } pGlint->FIFOSize = 120; maxheight = 4096; maxwidth = 4096; @@ -1694,6 +1759,7 @@ pGlint->FIFOSize = 15; switch (pGlint->MultiChip) { case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: maxheight = 1024; maxwidth = 1536; GLINTProbeIBMramdac(pScrn); @@ -1735,6 +1801,7 @@ } break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: pGlint->FIFOSize = 32; if (pScrn->bitsPerPixel == 24) { xf86DrvMsg(pScrn->scrnIndex, from, @@ -1804,7 +1871,8 @@ } } if (!pGlint->RamDac) { - if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) { + if ((pGlint->MultiChip == PCI_CHIP_PERMEDIA3) || + (pGlint->MultiChip == PCI_CHIP_R4)) { pGlint->RefClock = 14318; pGlint->RamDacRec = RamDacCreateInfoRec(); pGlint->RamDacRec->ReadDAC = Permedia2vInIndReg; @@ -1830,12 +1898,13 @@ /* Initialize the card through int10 interface if needed */ if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA && + pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA2 && pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_DELTA && - !xf86IsPrimaryPci(pGlint->PciInfo)) { + !xf86IsPrimaryPci(pGlint->PciInfo) && !pGlint->FBDev) { if ( xf86LoadSubModule(pScrn, "int10")){ xf86Int10InfoPtr pInt; - xf86LoaderReqSymLists(int10Symbols, NULL); + xf86LoaderReqSymLists(GLINTint10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); pInt = xf86InitInt10(pGlint->pEnt->index); xf86FreeInt10(pInt); @@ -1889,7 +1958,8 @@ if ( (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && - (pGlint->MultiChip == PCI_CHIP_PERMEDIA)) ) { + ((pGlint->MultiChip == PCI_CHIP_PERMEDIA) || + (pGlint->MultiChip == PCI_CHIP_TI_PERMEDIA))) ) { switch (pScrn->bitsPerPixel) { case 8: pGlint->MaxClock = 200000; @@ -1924,6 +1994,10 @@ } } if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_R4) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA2) && + (pGlint->MultiChip == PCI_CHIP_R4)) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) pGlint->MaxClock = 300000; @@ -1953,6 +2027,10 @@ /* Select valid modes from those available */ if ((pGlint->NoAccel) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_R4) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA2) && + (pGlint->MultiChip == PCI_CHIP_R4)) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { /* @@ -2094,6 +2172,7 @@ pGlint->bppalign = 0; break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_MX: @@ -2103,6 +2182,7 @@ pGlint->bppalign = 0; break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: pGlint->pprod = partprodPermedia[pScrn->displayWidth >> 5]; pGlint->bppalign = bppand[(pScrn->bitsPerPixel>>3)-1]; break; @@ -2110,7 +2190,8 @@ break; } - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + if ( ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA2)) && (pGlint->numMultiDevices == 2) ) { int bytesPerPixel, realWidthBytes, inputXSpanBytes; CARD32 postMultiply, productEnable, use16xProduct, inputXSpan; @@ -2212,22 +2293,25 @@ case 16: case 24: mod = "fb"; + syms = fbSymbols; break; case 32: if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { - if (xf86LoadSubModule(pScrn, "xf8_32bpp") == NULL) { - GLINTFreeRec(pScrn); - return FALSE; - } else - xf86LoaderReqSymLists(xf8_32bppSymbols,NULL); - } else + mod = "xf8_32bpp"; + syms = xf8_32bppSymbols; + } else { mod = "fb"; + syms = fbSymbols; + } break; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { GLINTFreeRec(pScrn); return FALSE; } + if (mod && syms) { + xf86LoaderReqSymLists(syms, NULL); + } /* Load XAA if needed */ if (!pGlint->NoAccel) { @@ -2252,14 +2336,18 @@ GLINTFreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(ddcSymbols, NULL); /* Load I2C if needed */ if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_R4) || (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2)) { if (xf86LoadSubModule(pScrn, "i2c")) { I2CBusPtr pBus; + xf86LoaderReqSymLists(i2cSymbols, NULL); if ((pBus = xf86CreateI2CBusRec())) { pBus->BusName = "DDC"; pBus->scrnIndex = pScrn->scrnIndex; @@ -2407,6 +2495,8 @@ Permedia2VSave(pScrn, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: Permedia3Save(pScrn, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2421,6 +2511,7 @@ (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_500TX: @@ -2438,9 +2529,11 @@ (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaSave(pScrn, glintReg); (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); break; + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: if (pGlint->numMultiDevices == 2) { ACCESSCHIP2(); @@ -2483,6 +2576,8 @@ ret = Permedia2VInit(pScrn, mode); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: ret = Permedia3Init(pScrn, mode, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2495,6 +2590,7 @@ ret = TXInit(pScrn, mode, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_MX: @@ -2508,8 +2604,10 @@ ret = TXInit(pScrn, mode, glintReg); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: ret = PermediaInit(pScrn, mode); break; + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: if (pGlint->numMultiDevices == 2) { ACCESSCHIP2(); @@ -2540,6 +2638,8 @@ Permedia2VRestore(pScrn, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: Permedia3Restore(pScrn, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2554,6 +2654,7 @@ (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_500TX: @@ -2571,9 +2672,11 @@ (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaRestore(pScrn, glintReg); (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: if (pGlint->numMultiDevices == 2) { ACCESSCHIP2(); @@ -2623,10 +2726,8 @@ Permedia2VRestore(pScrn, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: -#ifdef PM3Video - TRACE("PM3Video : VideoLeaveVT"); - Permedia3VideoLeaveVT(pScrn); -#endif + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: Permedia3Restore(pScrn, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2641,6 +2742,7 @@ (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_MX: @@ -2658,14 +2760,12 @@ (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaRestore(pScrn, glintReg); (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: -#ifdef PM3Video - TRACE("PM3Video : VideoLeaveVT"); - Permedia3VideoLeaveVT(pScrn); -#endif if (pGlint->numMultiDevices == 2) { ACCESSCHIP2(); Permedia3Restore(pScrn, glintReg2); @@ -2691,6 +2791,7 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); int ret, displayWidth; + int init_picture = 0; unsigned char *FBStart; VisualPtr visual; @@ -2812,8 +2913,7 @@ pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit(pScreen, 0, 0); + init_picture = 1; break; case 32: if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR) @@ -2826,8 +2926,7 @@ pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit(pScreen, 0, 0); + init_picture = 1; } break; default: @@ -2865,6 +2964,9 @@ } } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit(pScreen, 0, 0); if (!pGlint->NoAccel) { switch (pGlint->Chipset) { @@ -2874,6 +2976,8 @@ Permedia2AccelInit(pScreen); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: Permedia3AccelInit(pScreen); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2885,6 +2989,7 @@ TXAccelInit(pScreen); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_500TX: @@ -2895,8 +3000,10 @@ SXAccelInit(pScreen); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaAccelInit(pScreen); break; + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: Permedia3AccelInit(pScreen); break; @@ -2923,6 +3030,10 @@ else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_R4) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA2) && + (pGlint->MultiChip == PCI_CHIP_R4)) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) Permedia2vHWCursorInit(pScreen); @@ -2943,6 +3054,10 @@ return FALSE; if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_R4) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA2) && + (pGlint->MultiChip == PCI_CHIP_R4)) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, @@ -3006,6 +3121,9 @@ } #endif + pScrn->memPhysBase = pGlint->FbAddress; + pScrn->fbOffset = 0; + pGlint->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = GLINTCloseScreen; pScreen->SaveScreen = GLINTSaveScreen; @@ -3021,18 +3139,18 @@ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoInit(pScreen); break; -#ifdef PM3Video case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: - TRACE("PM3Video : VideoInit"); - Permedia3VideoInit(pScreen); + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: + Permedia3InitVideo(pScreen); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: switch (pGlint->MultiChip) { + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: - TRACE("PM3Video : VideoInit"); - Permedia3VideoInit(pScreen); + Permedia3InitVideo(pScreen); } -#endif } #if 0 @@ -3067,6 +3185,8 @@ Permedia2InitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: Permedia3InitializeEngine(pScrn); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -3081,6 +3201,7 @@ SXInitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_500TX: @@ -3091,8 +3212,10 @@ SXInitializeEngine(pScrn); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaInitializeEngine(pScrn); break; + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: Permedia3InitializeEngine(pScrn); break; @@ -3145,17 +3268,22 @@ GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: 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_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: base = (y * pScrn->displayWidth + x) >> pGlint->BppShift; GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; } @@ -3194,18 +3322,6 @@ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoEnterVT(pScrn); break; -#ifdef PM3Video - case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: - TRACE("PM3Video : VideoEnterVT"); - Permedia3VideoEnterVT(pScrn); - break; - case PCI_VENDOR_3DLABS_CHIP_GAMMA: - switch (pGlint->MultiChip) { - case PCI_CHIP_PERMEDIA3: - TRACE("PM3Video : VideoEnterVT"); - Permedia3VideoEnterVT(pScrn); - } -#endif } if (!pGlint->NoAccel) { @@ -3216,6 +3332,8 @@ Permedia2InitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: Permedia3InitializeEngine(pScrn); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -3230,6 +3348,7 @@ SXInitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_500TX: @@ -3240,8 +3359,10 @@ SXInitializeEngine(pScrn); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaInitializeEngine(pScrn); break; + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: Permedia3InitializeEngine(pScrn); break; @@ -3305,17 +3426,6 @@ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoUninit(pScrn); break; -#ifdef PM3Video - case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: - TRACE("PM3Video : VideoUninit"); - Permedia3VideoUninit(pScrn); - case PCI_VENDOR_3DLABS_CHIP_GAMMA: - switch (pGlint->MultiChip) { - case PCI_CHIP_PERMEDIA3: - TRACE("PM3Video : VideoUninit"); - Permedia3VideoUninit(pScrn); - } -#endif } if (pScrn->vtSema) { @@ -3389,6 +3499,8 @@ * side appears if not aligned properly */ switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: @@ -3448,6 +3560,8 @@ switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_TI_CHIP_PERMEDIA: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: @@ -3462,10 +3576,13 @@ case PCI_VENDOR_3DLABS_CHIP_MX: break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: temp = GLINT_READ_REG(PMVideoControl); if (unblank) temp |= 1; else temp &= 0xFFFFFFFE; @@ -3500,6 +3617,11 @@ pScreen->BlockHandler = pGlint->BlockHandler; (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); pScreen->BlockHandler = GLINTBlockHandler; + + if(pGlint->VideoTimerCallback) { + UpdateCurrentTime(); + (*pGlint->VideoTimerCallback)(pScrn, currentTime.milliseconds); + } } #ifdef DEBUG @@ -3651,6 +3773,8 @@ logbytesperaccess = 2; break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: logbytesperaccess = 4; break; case PCI_VENDOR_3DLABS_CHIP_300SX: @@ -3663,6 +3787,7 @@ logbytesperaccess = 3; break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA2: case PCI_VENDOR_3DLABS_CHIP_DELTA: switch (pGlint->MultiChip) { case PCI_CHIP_500TX: @@ -3675,8 +3800,10 @@ logbytesperaccess = 3; break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: logbytesperaccess = 2; break; + case PCI_CHIP_R4: case PCI_CHIP_PERMEDIA3: logbytesperaccess = 4; break; Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h diff -u 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.31 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h:1.26.2.1 Thu May 24 16:12:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h Sat Dec 8 11:01:52 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.26.2.1 2001/05/24 20:12:47 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.31 2001/12/08 16:01:52 alanh Exp $ */ /* * glint register file @@ -29,12 +29,18 @@ #define PCI_CHIP_3DLABS_GAMMA 0x08 #define PCI_CHIP_3DLABS_PERMEDIA2V 0x09 #define PCI_CHIP_3DLABS_PERMEDIA3 0x0A +#define PCI_CHIP_3DLABS_PERMEDIA4 0x0C +#define PCI_CHIP_3DLABS_R4 0x0D +#define PCI_CHIP_3DLABS_GAMMA2 0x0E #define PCI_CHIP_TI_PERMEDIA 0x3d04 /* The boards we know */ #define IS_GLORIAXXL ((pGlint->PciInfo->subsysVendor == 0x1048) && \ (pGlint->PciInfo->subsysCard == 0x0a42)) +#define IS_GLORIASYNERGY ((pGlint->PciInfo->subsysVendor == 0x1048) && \ + (pGlint->PciInfo->subsysCard == 0x0a32)) + #define IS_GMX2000 ((pGlint->PciInfo->subsysVendor == 0x3d3d) && \ (pGlint->PciInfo->subsysCard == 0x0106)) @@ -44,6 +50,32 @@ #define IS_JPRO ((pGlint->PciInfo->subsysVendor == 0x1097) && \ (pGlint->PciInfo->subsysCard == 0x3db3)) +/* COMPAQ OEM VX1 PCI + * subsys == 0x0121 if VGA is enabled + * subsys == 0x000a if VGA has never been enabled + */ +#define IS_PCI_QVX1 (pGlint->PciInfo->subsysVendor == 0x3d3d && \ + ((pGlint->PciInfo->subsysCard == 0x0121) || \ + (pGlint->PciInfo->subsysCard == 0x000a))) + +/* COMPAQ OEM VX1 AGP + * subsys == 0x0144 if VGA is enabled + * subsys == 0x000c if VGA has never been enabled + */ +#define IS_AGP_QVX1 (pGlint->PciInfo->subsysVendor == 0x3d3d && \ + ((pGlint->PciInfo->subsysCard == 0x0144) || \ + (pGlint->PciInfo->subsysCard == 0x000c))) + +#define IS_QVX1 (IS_PCI_QVX1 || IS_AGP_QVX1) + +#define IS_ELSA_SYNERGY ((pGlint->PciInfo->subsysVendor == 0x1048) && \ + (pGlint->PciInfo->subsysCard == 0x0a32)) + +/* COMPAQ OEM Permedia 2V with VGA disable jumper - 0x13e9 ? */ +#define IS_QPM2V ((pGlint->PciInfo->subsysVendor == 0x13e9) && \ + ((pGlint->PciInfo->subsysCard == 0x0100) || \ + (pGlint->PciInfo->subsysCard == 0x0002))) + /********************************************** * GLINT 500TX Configuration Region Registers * ***********************************************/ @@ -1240,7 +1272,8 @@ #define REPLICATE(r) \ { \ if (pScrn->bitsPerPixel == 16) { \ - r = ((r & 0xFFFF) << 16) | (r & 0xFFFF); \ + r &= 0xFFFF; \ + r |= (r<<16); \ } else \ if (pScrn->bitsPerPixel == 8) { \ r &= 0xFF; \ Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c diff -u 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.31 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c:1.29.2.1 Wed May 30 07:42:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c Sat Oct 27 23:33:30 2001 @@ -30,7 +30,7 @@ * * Permedia 2 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.29.2.1 2001/05/30 11:42:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.31 2001/10/28 03:33:30 tsi Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -1386,7 +1386,6 @@ GLINTPtr pGlint = GLINTPTR(pScrn); int skipleft, dwords, count; CARD32* srcp; - Bool FastTexLoad; GLINT_WAIT(3); DO_PLANEMASK(planemask); @@ -1397,23 +1396,9 @@ GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); } - FastTexLoad = TRUE; dwords = w; - if((rop != GXcopy) || (planemask != ~0)) - FastTexLoad = FALSE; - - if (!FastTexLoad) { - if((skipleft = (long)src & 0x03L)) { - skipleft /= (bpp>>3); - - x -= skipleft; - w += skipleft; - src = (unsigned char*)((long)src & ~0x03L); - } - } - - if(FastTexLoad) { + if((rop == GXcopy) && (planemask == ~0)) { int address; GLINT_WAIT(1); @@ -1452,6 +1437,15 @@ GLINT_WAIT(1); GLINT_WRITE_REG(UNIT_ENABLE, FBWriteMode); } else { + if((skipleft = (long)src & 0x03L)) { + skipleft /= (bpp>>3); + + x -= skipleft; + w += skipleft; + + src = (unsigned char*)((long)src & ~0x03L); + } + Permedia2SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h); GLINT_WAIT(6); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c diff -u 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.26 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c:1.23.2.1 Thu May 24 16:12:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c Thu Dec 6 10:16:40 2001 @@ -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.23.2.1 2001/05/24 20:12:48 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c,v 1.26 2001/12/06 15:16:40 tsi Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -477,4 +477,30 @@ *scl = (v & ClkIn) > 0; *sda = (v & DataIn) > 0; +} + +void +Permedia2PreInit(ScrnInfoPtr pScrn) +{ +#if defined(__alpha__) + GLINTPtr pGlint = GLINTPTR(pScrn); + + /* + * On Alpha, we have to init secondary PM2 cards, since + * int10 cannot be run on the OEMed cards with VGA disable + * jumpers. + */ + if (!xf86IsPrimaryPci(pGlint->PciInfo)) { + if ( IS_GLORIASYNERGY ) { + + /* PM2DAC_CalculateMNPCForClock(80000, 14318, &m, &n, &p); */ + Permedia2OutIndReg(pScrn, PM2DACIndexMemClockM, 0x00, 0x7b); + Permedia2OutIndReg(pScrn, PM2DACIndexMemClockN, 0x00, 0x0b); + Permedia2OutIndReg(pScrn, PM2DACIndexMemClockP, 0x00, 0x09); + + GLINT_SLOW_WRITE_REG( 0x20, PMBootAddress); + GLINT_SLOW_WRITE_REG( 0xe6002021, PMMemConfig); + } + } +#endif /* __alpha__ */ } Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.19 Fri May 4 15:05:38 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c Sat Aug 18 07:41:44 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.19 2001/05/04 19:05:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c,v 1.22 2001/08/18 11:41:44 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -501,7 +501,7 @@ }; /* Forward */ -static void StopVideoStream(PortPrivPtr pPPriv, Bool exit); +static void StopVideoStream(PortPrivPtr pPPriv, Bool shutdown); static void RestoreVideoStd(AdaptorPrivPtr pAPriv); static Bool xvipcHandshake(PortPrivPtr pPPriv, int op, Bool block); @@ -1298,7 +1298,7 @@ */ static void -StopVideoStream(PortPrivPtr pPPriv, Bool exit) +StopVideoStream(PortPrivPtr pPPriv, Bool shutdown) { AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; GLINTPtr pGlint = GLINTPTR(pAPriv->pScrn); @@ -1317,7 +1317,7 @@ pPPriv->StreamOn = FALSE; - if (exit) + if (shutdown) FreeCookies(pPPriv); if (VideoOn > VIDEO_OFF && pGlint->NoAccel) @@ -1350,12 +1350,12 @@ } if (!pAPriv->Port[0].StreamOn && !pAPriv->Port[1].StreamOn) { - if (exit) + if (shutdown) xf86I2CWriteByte(&pAPriv->Port[1].I2CDev, 0x61, 0xC2); xf86I2CWriteByte(&pAPriv->Port[0].I2CDev, 0x11, 0x00); } - if (exit) { + if (shutdown) { FreeBuffers(pPPriv); FreeCookies(pPPriv); @@ -1972,16 +1972,16 @@ } static void -Permedia2StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +Permedia2StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { PortPrivPtr pPPriv = (PortPrivPtr) data; AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; GLINTPtr pGlint = GLINTPTR(pScrn); DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "StopVideo port=%d, exit=%d\n", PORTNUM(pPPriv), exit)); + "StopVideo port=%d, shutdown=%d\n", PORTNUM(pPPriv), shutdown)); - if (exit) { + if (shutdown) { if (PORTNUM(pPPriv) < 2) { StopVideoStream(pPPriv, TRUE); RestoreVideoStd(pAPriv); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.26 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.27 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.26 Wed May 16 03:56:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c Wed Nov 28 16:53:01 2001 @@ -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.26 2001/05/16 07:56:07 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.27 2001/11/28 21:53:01 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -74,6 +74,30 @@ return(actualclock); } +static void +Permedia2VPreInitSecondary(ScrnInfoPtr pScrn) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + /* 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); +} + void Permedia2VPreInit(ScrnInfoPtr pScrn) { @@ -86,24 +110,24 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Appian Jeronimo Pro 4x8mb board detected and initialized.\n"); - /* disable MCLK */ - Permedia2vOutIndReg(pScrn, PM2VDACRDMClkControl, 0x00, 0); + Permedia2VPreInitSecondary(pScrn); + } - /* 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); +#if defined(__alpha__) + /* + * On Alpha, we have to init secondary PM2V cards, since + * int10 cannot be run on the OEMed cards with VGA disable + * jumpers. + */ + if (!xf86IsPrimaryPci(pGlint->PciInfo)) { + if ( IS_QPM2V ) { + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "PM2V secondary: initializing\n"); + Permedia2VPreInitSecondary(pScrn); + } } +#endif /* __alpha__ */ } Bool @@ -389,11 +413,26 @@ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorMode, 0x00, 0x11); } +static void Permedia2vLoadCursorCallback(ScrnInfoPtr pScrn); + static void Permedia2vHideCursor(ScrnInfoPtr pScrn) { + GLINTPtr pGlint = GLINTPTR(pScrn); + /* Disable cursor - X11 mode */ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorMode, 0x00, 0x10); + + /* + * For some reason, we need to clear the image as well as disable + * the cursor on PM2V, but not on PM3. The problem is noticeable + * only when running multi-head, as you can see the cursor get + * "left behind" on the screen it is leaving... + */ + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) { + memset(pGlint->HardwareCursorPattern, 0, 1024); + pGlint->LoadCursorCallback = Permedia2vLoadCursorCallback; + } } static void Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.25 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.25 Wed Apr 18 05:24:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c Mon Nov 19 19:09:13 2001 @@ -26,7 +26,7 @@ * * Permedia 3 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.25 2001/04/18 09:24:47 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.29 2001/11/20 00:09:13 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -58,6 +58,29 @@ # define TRACE(str) #endif +#define PM3_WRITEMASK \ + (pGlint->PM3_UsingSGRAM ? PM3FBHardwareWriteMask : PM3FBSoftwareWriteMask ) +#define PM3_OTHERWRITEMASK \ + (pGlint->PM3_UsingSGRAM ? PM3FBSoftwareWriteMask : PM3FBHardwareWriteMask ) + +#ifndef XF86DRI +#define PM3_PLANEMASK(planemask) \ +{ \ + if (planemask != pGlint->planemask) { \ + pGlint->planemask = planemask; \ + REPLICATE(planemask); \ + GLINT_WRITE_REG(planemask, PM3_WRITEMASK); \ + } \ +} +#else +#define PM3_PLANEMASK(planemask) \ + { \ + pGlint->planemask = planemask; \ + REPLICATE(planemask); \ + GLINT_WRITE_REG(planemask, PM3_WRITEMASK); \ + } +#endif + /* Clipping */ static void Permedia3SetClippingRectangle(ScrnInfoPtr pScrn, int x, int y, int w, int h); @@ -129,6 +152,13 @@ GLINT_SLOW_WRITE_REG(3, BroadcastMask); } + /* Disable LocalBuffer. Fixes stripes problems when + * doing screen-to-screen copies */ + GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LBDestReadMode); + GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LBDestReadEnables); + GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LBSourceReadMode); + GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LBWriteMode); + /* Host out PreInit */ /* Set filter mode to enable sync tag & data output */ GLINT_SLOW_WRITE_REG(0x400, FilterMode); @@ -271,7 +301,7 @@ TRACE("Permedia3InitializeEngine : PixelSize"); /* LogicalOpUnit Initialization */ - GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); + GLINT_SLOW_WRITE_REG(0xffffffff, PM3_OTHERWRITEMASK); /* FBWriteUnit Initialization */ GLINT_SLOW_WRITE_REG( @@ -309,7 +339,7 @@ >4095?4095: 8 * pGlint->FbMapSize / (pScrn->bitsPerPixel * pScrn->displayWidth)), PM3SizeOfFramebuffer); - GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); + GLINT_SLOW_WRITE_REG(0xffffffff, PM3_WRITEMASK); TRACE("Permedia3InitializeEngine : FBHardwareWriteMask & SizeOfFramebuffer"); /* Color Format */ switch (pScrn->depth) { @@ -591,7 +621,7 @@ pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; GLINT_WAIT(2); - DO_PLANEMASK(planemask); + PM3_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); TRACE_EXIT("Permedia3SetupForScreenToScreenCopy"); @@ -650,21 +680,32 @@ (pScrn->displayWidth <= 1600)) { pGlint->AccelInfoRec->SubsequentSolidFillRect = Permedia3SubsequentFillRectSolid32bpp; - GLINT_WRITE_REG(color, PM3FBBlockColor); + if (pGlint->PM3_UsingSGRAM) { + GLINT_WRITE_REG(color, PM3FBBlockColor); + } else { + pGlint->PM3_Render2D |= PM3Render2D_SpanOperation; + GLINT_WRITE_REG(color, PM3ForegroundColor); + } } else { pGlint->AccelInfoRec->SubsequentSolidFillRect = Permedia3SubsequentFillRectSolid; /* Can't do block fills at 8bpp either */ if ((rop == GXcopy) && (pScrn->bitsPerPixel == 16)) { - GLINT_WRITE_REG(color, PM3FBBlockColor); + if (pGlint->PM3_UsingSGRAM) { + GLINT_WRITE_REG(color, PM3FBBlockColor); + } else { + pGlint->PM3_Render2D |= PM3Render2D_SpanOperation; + GLINT_WRITE_REG(color, PM3ForegroundColor); + } } else { pGlint->PM3_Render2D |= PM3Render2D_SpanOperation; - GLINT_WRITE_REG(color, PM3ForegroundColor); + GLINT_WRITE_REG(color, PM3ForegroundColor); } } - if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) + PM3_PLANEMASK(planemask); + if (((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) + || ((planemask != 0xffffffff) && !(pGlint->PM3_UsingSGRAM))) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; - DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); TRACE_EXIT("Permedia3SetupForFillRectSolid"); } @@ -766,7 +807,7 @@ GLINT_WRITE_REG((patterny & 0xFF0000) >> 16, AreaStipplePattern6); GLINT_WRITE_REG((patterny & 0xFF000000) >> 24, AreaStipplePattern7); GLINT_WRITE_REG(fg, PM3ForegroundColor); - DO_PLANEMASK(planemask); + PM3_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); TRACE_EXIT("Permedia3SetupForMono8x8PatternFill"); } @@ -823,7 +864,7 @@ } else GLINT_WAIT(3); GLINT_WRITE_REG(fg, PM3ForegroundColor); - DO_PLANEMASK(planemask); + PM3_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); } @@ -918,7 +959,7 @@ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; GLINT_WAIT(2); - DO_PLANEMASK(planemask); + PM3_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); TRACE_EXIT("Permedia3SetupForScanlineImageWrite"); } @@ -1050,7 +1091,7 @@ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; GLINT_WAIT(6); - DO_PLANEMASK(planemask); + PM3_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); @@ -1135,7 +1176,7 @@ } else GLINT_WAIT(7); GLINT_WRITE_REG(fg, PM3ForegroundColor); - DO_PLANEMASK(planemask); + PM3_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); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.30 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.24 Wed May 16 03:56:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c Mon Dec 10 16:11:00 2001 @@ -26,7 +26,7 @@ * this work is sponsored by Appian Graphics. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.24 2001/05/16 07:56:07 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.30 2001/12/10 21:11:00 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -34,6 +34,7 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" +#include "xf86int10.h" #include "glint_regs.h" #include "pm3_regs.h" @@ -77,7 +78,6 @@ * 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 */ /* Test first 32MB */ @@ -94,7 +94,7 @@ } /* Ok, we're satisfied we've got 32MB, let's test the second lot */ - if (size == i) { + if ((size + 1) == i) { for(i=0;i<32;i++) { /* Clear first 32MB */ MMIO_OUT32(pGlint->FbBase, i*1024*1024, 0); @@ -159,12 +159,129 @@ return(actualclock); } +static unsigned long +PM4DAC_CalculateClock +( + unsigned long req_clock, /* In kHz units */ + unsigned long ref_clock, /* In kHz units */ + unsigned char *param_m, /* ClkPreScale */ + unsigned char *param_n, /* ClkFeedBackScale */ + unsigned char *param_p /* ClkPostScale */ + ) +{ +#define INITIALFREQERR 10000 + + long fMinVCO = 200000; /* min fVCO is 200MHz (in 10000Hz units) */ + long fMaxVCO = 400000; /* max fVCO is 400MHz (in 10000Hz units) */ + unsigned long int M, N, P; + unsigned long int fVCO; + unsigned long int ActualClock; + int Error; + int LowestError = INITIALFREQERR; + short bFoundFreq = FALSE; + int cInnerLoopIterations = 0; + int LoopCount; + + /* + * Actual Equations: + * fVCO = (ref_clock * M)/(N+1) + * PIXELCLOCK = fVCO/(1<<p) + * 200 <= fVCO <= 400 + * 24 <= N <= 80 + * 1 <= M <= 15 + * 0 <= P <= 3 + * 1Mhz < ref_clock/(N+1) <= 2Mhz - not used + * For refclk == 14.318 we have the tighter equations: + * 32 <= N <= 80 + * 3 <= M <= 12 + * Notes: + * The spec says that the PLLs will only do 260Mhz, but I have assumed 300Mhz 'cos + * 260Mhz is a crap limit. + */ + +#define P4RD_PLL_MIN_P 0 +#define P4RD_PLL_MAX_P 3 +#define P4RD_PLL_MIN_M 1 +#define P4RD_PLL_MAX_M 12 +#define P4RD_PLL_MIN_N 24 +#define P4RD_PLL_MAX_N 80 + + for(P = P4RD_PLL_MIN_P; P <= P4RD_PLL_MAX_P; ++P) { + unsigned long int fVCOLowest, fVCOHighest; + + /* it's pointless going through the main loop if all values of + * N produce an fVCO outside the acceptable range */ + + M = P4RD_PLL_MIN_M; + N = ((M + 1) * (1 << P) * req_clock) / ref_clock; + + fVCOLowest = (ref_clock * N) / (M + 1); + + M = P4RD_PLL_MAX_M; + N = ((M + 1) * (1 << P) * req_clock) / ref_clock; + + fVCOHighest = (ref_clock * N) / (M + 1); + + if(fVCOHighest < fMinVCO || fVCOLowest > fMaxVCO) + continue; + + for(M = P4RD_PLL_MIN_M; M <= P4RD_PLL_MAX_M; ++M, ++cInnerLoopIterations) + { + N = ((M + 1) * (1 << P) * req_clock) / ref_clock; + + if(N > P4RD_PLL_MAX_N || N < P4RD_PLL_MIN_N) + continue; + + /* we can expect rounding errors in calculating M, which will always be rounded down. */ + /* So we'll checkout our calculated value of M along with (M+1) */ + + for(LoopCount = (N == P4RD_PLL_MAX_N) ? 1 : 2; --LoopCount >= 0; ++N) + { + fVCO = (ref_clock * N) / (M + 1); + + if( (fVCO >= fMinVCO) && (fVCO <= fMaxVCO) ) + { + ActualClock = (fVCO / (1 << P)); + + Error = ActualClock - req_clock; + + if(Error < 0) + Error = -Error; + + /* It is desirable that we use the lowest value of M if the*/ + /* frequencies are the same.*/ + if(Error < LowestError || (Error == LowestError && M < *param_m)) + { + bFoundFreq = TRUE; + LowestError = Error; + *param_m = M; + *param_n = N; + *param_p = P; + if(Error == 0) + goto Done; + } + } + } + } + } + +Done: + if(bFoundFreq) + ActualClock = (ref_clock * (*param_n)) / (((*param_m) + 1) * (1 << (*param_p))); + else + ActualClock = 0; + + return(ActualClock); +} + void Permedia3PreInit(ScrnInfoPtr pScrn) { GLINTPtr pGlint = GLINTPTR(pScrn); + CARD32 LocalMemCaps; TRACE_ENTER("Permedia3PreInit"); + if (IS_J2000) { unsigned char m,n,p; unsigned long clockused; @@ -206,6 +323,51 @@ PM3RD_SClkControl_ENABLE); } +#if defined(__alpha__) + /* + * On Alpha, we have to "int10" secondary VX1 cards early; + * otherwise, some information taken from registers, like + * memory size, is incorrect. + */ + if (!xf86IsPrimaryPci(pGlint->PciInfo)) { + if ( IS_QVX1 ) { + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VX1 secondary enabling VGA before int10\n"); + + /* Enable VGA on the current card. */ + pciWriteByte( pGlint->PciTag, 0xf8, 0 ); + pciWriteByte( pGlint->PciTag, 0xf4, 0 ); + pciWriteByte( pGlint->PciTag, 0xfc, 0 ); + + /* The card we are on should be VGA-enabled now, so run int10. */ + if (xf86LoadSubModule(pScrn, "int10")) { + xf86Int10InfoPtr pInt; + + xf86LoaderReqSymLists(GLINTint10Symbols, NULL); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); + pInt = xf86InitInt10(pGlint->pEnt->index); + xf86FreeInt10(pInt); + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VX1 secondary disabling VGA after int10\n"); + + /* Finally, disable VGA on the current card. */ + pciWriteByte( pGlint->PciTag, 0xf8, 0x70 ); + pciWriteByte( pGlint->PciTag, 0xf4, 0x01 ); + pciWriteByte( pGlint->PciTag, 0xfc, 0x00 ); + } + } +#endif /* __alpha__ */ + + /* If we have SDRAM instead of SGRAM, we have to do some things + differently in the FillRectSolid code. */ + LocalMemCaps = GLINT_READ_REG(PM3LocalMemCaps); + pGlint->PM3_UsingSGRAM = !(LocalMemCaps & PM3LocalMemCaps_NoWriteMask); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %s memory\n", + pGlint->PM3_UsingSGRAM ? "SGRAM" : "SDRAM"); + TRACE_EXIT("Permedia3PreInit"); } @@ -296,8 +458,29 @@ unsigned long clockused; /* Let's program the dot clock */ - clockused = PM3DAC_CalculateClock(mode->Clock, - pGlint->RefClock, &m,&n,&p); + switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + case PCI_VENDOR_3DLABS_CHIP_R4: + clockused = PM4DAC_CalculateClock(mode->Clock, + pGlint->RefClock, &m,&n,&p); + break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + clockused = PM3DAC_CalculateClock(mode->Clock, + pGlint->RefClock, &m,&n,&p); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + clockused = PM3DAC_CalculateClock(mode->Clock, + pGlint->RefClock, &m,&n,&p); + break; + case PCI_CHIP_R4: + clockused = PM4DAC_CalculateClock(mode->Clock, + pGlint->RefClock, &m,&n,&p); + break; + } + break; + } STOREDAC(PM3RD_DClk0PreScale, m); STOREDAC(PM3RD_DClk0FeedbackScale, n); STOREDAC(PM3RD_DClk0PostScale, p); @@ -342,7 +525,7 @@ case 24: temp3 |= PM3RD_MiscControl_DIRECTCOLOR_ENABLE; STOREDAC(PM2VDACRDPixelSize, 0x04); - STOREDAC(PM2VDACRDColorFormat, 0x60); + STOREDAC(PM2VDACRDColorFormat, 0x20); break; case 32: temp3 |= PM3RD_MiscControl_DIRECTCOLOR_ENABLE; @@ -509,9 +692,7 @@ LOCO *colors, VisualPtr pVisual ){ -#if 0 /* NOT YET */ GLINTPtr pGlint = GLINTPTR(pScrn); -#endif int i, index, shift = 0, j, repeat = 1; if (pScrn->depth == 15) { @@ -527,14 +708,11 @@ Permedia2WriteData(pScrn, colors[index].green); Permedia2WriteData(pScrn, colors[index].blue); } - /* for video i/o */ -#if 0 /* NOT YET */ GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | ((colors[index].green & 0xFF) << 8) | ((colors[index].blue & 0xFF) << 16), PM3LUTData); -#endif } } @@ -546,9 +724,7 @@ LOCO *colors, VisualPtr pVisual ){ -#if 0 /* NOT YET */ GLINTPtr pGlint = GLINTPTR(pScrn); -#endif int i, index, j; for(i = 0; i < numColors; i++) { @@ -559,13 +735,11 @@ 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++) { Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.7 Tue May 8 15:31:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h Mon Nov 19 19:09:15 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.7 2001/05/08 19:31:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.9 2001/11/20 00:09:15 alanh Exp $ */ /* * glint register file @@ -90,6 +90,7 @@ #define PM3MemBypassWriteMask 0x1008 #define PM3MemScratch 0x1010 #define PM3LocalMemCaps 0x1018 + #define PM3LocalMemCaps_NoWriteMask (1<<28) #define PM3LocalMemTimings 0x1020 #define PM3LocalMemControl 0x1028 #define PM3LocalMemRefresh 0x1030 @@ -915,6 +916,8 @@ #define PM3TextureIndexMode1 0xb340 #define PM3TextureIndexMode1And 0xb3d0 #define PM3TextureIndexMode1Or 0xb3d8 +#define PM3TextureLODBiasS 0x8450 +#define PM3TextureLODBiasT 0x8458 /* ... */ #define PM3TextureMapSize 0xb428 #define PM3TextureMapWidth0 0x8580 Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c:1.6 Tue May 8 15:31:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c Sat Oct 27 23:33:30 2001 @@ -1,185 +1,149 @@ /* - * Permedia 3 Xv Driver + * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales. * - * Copyright (C) 2001 Sven Luther <luther@dpt-info.u-strasbg.fr> + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * - * Based on work of Michael H. Schimek <m.schimek@netway.at> + * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Sven Luther <luther@dpt-info.u-strasbg.fr> */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.6 2001/05/08 19:31:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.8 2001/10/28 03:33:30 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" +#include "xf86Resources.h" #include "xf86_ansic.h" -#include "xf86Pci.h" +#include "compiler.h" #include "xf86PciInfo.h" -#include "xf86Xinput.h" +#include "xf86Pci.h" #include "xf86fbman.h" -#include "xf86xv.h" -#include "Xv.h" #include "regionstr.h" -#include "xaa.h" -#include "xaalocal.h" +#include "glint.h" #include "glint_regs.h" #include "pm3_regs.h" -#include "glint.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" -#define DEBUG(x) -#define USE_HARDWARE_COPY 1 -#define SUPPORT_CLIPPING 1 -#define BLACKNESS_WORKAROUND 1 +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 -#ifndef XvExtension +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 -void Permedia3VideoInit(ScreenPtr pScreen) {} -void Permedia3VideoUninit(ScrnInfoPtr pScrn) {} -void Permedia3VideoEnterVT(ScrnInfoPtr pScrn) {} -void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) {} +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) +#ifndef XvExtension +void Permedia3InitVideo(ScreenPtr pScreen) {} +void Permedia3ResetVideo(ScrnInfoPtr pScrn) {} #else -#undef MIN -#undef ABS -#undef CLAMP -#undef ENTRIES - -#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 +static XF86VideoAdaptorPtr Permedia3SetupImageVideo(ScreenPtr); +static void Permedia3InitOffscreenImages(ScreenPtr); +static void Permedia3StopVideo(ScrnInfoPtr, pointer, Bool); +static int Permedia3SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int Permedia3GetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void Permedia3QueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, unsigned int *, pointer); +static int Permedia3PutImage( ScrnInfoPtr, + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static int Permedia3QueryImageAttributes(ScrnInfoPtr, + int, unsigned short *, unsigned short *, int *, int *); +static void Permedia3VideoTimerCallback(ScrnInfoPtr pScrn, Time time); - /* 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; +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -static AdaptorPrivPtr AdaptorPrivList = NULL; +static Atom xvColorKey, xvDoubleBuffer, xvAutopaintColorKey, xvFilter; -/* - * 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). - */ +void Permedia3InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + GLINTPtr pGlint = GLINTPTR(pScrn); + int num_adaptors; + + /* Because of bugs in the PM3 when uploading images via the + * bypass to the framebuffer, we always have to use the accelerator. + */ + if (pGlint->NoAccel) + return; -#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. - */ + newAdaptor = Permedia3SetupImageVideo(pScreen); + Permedia3InitOffscreenImages(pScreen); -#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 - */ + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); -static XF86AttributeRec -ScalerAttributes[] = -{ - { XvSettable | XvGettable, 0, 2, XV_FILTER }, - { XvSettable | XvGettable, 0, 3, XV_MIRROR }, - { XvSettable | XvGettable, 0, 3, XV_ALPHA }, -}; + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } -#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); -static Atom xvFilter, xvMirror, xvAlpha; + if(newAdaptors) + xfree(newAdaptors); +} +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = +{ + { + 0, + "XV_IMAGE", + 2047, 2047, + {1, 1} + } +}; -/* Scaler */ +#define NUM_FORMATS 4 -static XF86VideoEncodingRec -ScalerEncodings[] = +static XF86VideoFormatRec Formats[NUM_FORMATS] = { - { 0, "XV_IMAGE", 2047, 2047, { 1, 1 }}, + {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }; + +#define NUM_ATTRIBUTES 4 -static XF86VideoFormatRec -ScalerVideoFormats[] = +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { - { 8, TrueColor }, /* Dithered */ - { 15, TrueColor }, - { 16, TrueColor }, - { 24, TrueColor }, + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}, + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"}, + {XvSettable | XvGettable, 0, 2, "XV_FILTER"}, }; /* @@ -190,9 +154,10 @@ #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 + +#define NUM_IMAGES 15 -static XF86ImageRec -ScalerImages[] = +static XF86ImageRec Images[NUM_IMAGES] = { /* Planar YVU 4:2:0 (emulated) */ { LE4CC('Y','V','1','2'), XvYUV, NoOrder, GUID4CC('Y','V','1','2'), @@ -269,135 +234,277 @@ 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) +#define MAX_BUFFERS 2 + +typedef struct { + FBAreaPtr area[MAX_BUFFERS]; + RegionRec clip; + CARD32 colorKey; + CARD32 videoStatus; + Time offTime; + Time freeTime; + int Video_Shift; + int Format; + Bool ramdacOn; + Bool doubleBuffer; + Bool autopaintColorKey; + int Filter; + int sx, sy; + int offset[MAX_BUFFERS]; + int buffer; +} GLINTPortPrivRec, *GLINTPortPrivPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (GLINTPortPrivPtr)((GLINTPTR(pScrn))->adaptor->pPortPrivates[0].ptr) + +#define RAMDAC_WRITE(data,index) \ +do{ \ + GLINT_WRITE_REG(((index)>>8)&0xff, PM3RD_IndexHigh); \ + GLINT_WRITE_REG((index)&0xff, PM3RD_IndexLow); \ + GLINT_WRITE_REG(data, PM3RD_IndexedData); \ +}while(0) + +void Permedia3ResetVideo(ScrnInfoPtr pScrn) { - PortPrivPtr pPPriv = (PortPrivPtr) Buffer->devPrivate.ptr; - int i = -1; + GLINTPtr pGlint = GLINTPTR(pScrn); + GLINTPortPrivPtr pPriv = pGlint->adaptor->pPortPrivates[0].ptr; - /* Find the buffer that is being removed */ - for (i = 0; i < MAX_BUFFERS && pPPriv->Buffer[i] != Buffer; i++); - if (i >= MAX_BUFFERS) return; - - if (i == pPPriv->display) pPPriv->display = -1; - if (i == pPPriv->copy) pPPriv->copy = -1; - pPPriv->Buffer[i] = NULL; + GLINT_WAIT(15); + GLINT_WRITE_REG(0xfff0|(0xffff<<16), PM3VideoOverlayFifoControl); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, PM3VideoOverlayMode); + pPriv->ramdacOn = FALSE; + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, PM3RD_VideoOverlayControl); + RAMDAC_WRITE((pPriv->colorKey&0xff0000)>>16, PM3RD_VideoOverlayKeyR); + RAMDAC_WRITE((pPriv->colorKey&0x00ff00)>>8, PM3RD_VideoOverlayKeyG); + RAMDAC_WRITE(pPriv->colorKey&0x0000ff, PM3RD_VideoOverlayKeyB); + GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE, PM3VideoOverlayUpdate); } -static void -FreeBuffers(PortPrivPtr pPPriv, Bool from_timer) + +static XF86VideoAdaptorPtr +Permedia3SetupImageVideo(ScreenPtr pScreen) { - int i = -1; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GLINTPtr pGlint = GLINTPTR(pScrn); + XF86VideoAdaptorPtr adapt; + GLINTPortPrivPtr pPriv; - if (!from_timer) { - if (pPPriv->TimerInUse) { - pPPriv->TimerInUse = FALSE; - TimerCancel(pPPriv->Timer); - } - } + if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(GLINTPortPrivRec) + + sizeof(DevUnion)))) + return NULL; - pPPriv->display = -1; - pPPriv->copy = -1; - for (i=0; i < MAX_BUFFERS; i++) - if (pPPriv->Buffer[i]) { - xf86FreeOffscreenArea (pPPriv->Buffer[i]); - pPPriv->Buffer[i] = NULL; - } + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "Permedia3 Backend Scaler"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + pPriv = (GLINTPortPrivPtr)(&adapt->pPortPrivates[1]); + adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = Permedia3StopVideo; + adapt->SetPortAttribute = Permedia3SetPortAttribute; + adapt->GetPortAttribute = Permedia3GetPortAttribute; + adapt->QueryBestSize = Permedia3QueryBestSize; + adapt->PutImage = Permedia3PutImage; + adapt->QueryImageAttributes = Permedia3QueryImageAttributes; + + /* FIXME : depth 15 and 16 doesn't work here */ + pPriv->colorKey = pGlint->videoKey; + pPriv->videoStatus = 0; + pPriv->buffer = 0; /* double buffer (or maybe triple later) */ + pPriv->doubleBuffer = TRUE; + pPriv->autopaintColorKey = TRUE; + pPriv->Filter = PM3VideoOverlayMode_FILTER_FULL; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pGlint->adaptor = adapt; + + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + xvFilter = MAKE_ATOM("XV_FILTER"); + + Permedia3ResetVideo(pScrn); + + return adapt; } + -static CARD32 -TimerCallback(OsTimerPtr pTim, CARD32 now, pointer p) +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) { - PortPrivPtr pPPriv = (PortPrivPtr) p; + int *dataA, *dataB; + int num; - if (pPPriv->StopDelay >= 0) { - if (!(pPPriv->StopDelay--)) { - FreeBuffers(pPPriv, TRUE); - pPPriv->TimerInUse = FALSE; - } - } + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; - if (pPPriv->TimerInUse) - return pPPriv->Instant; + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; - return 0; /* Cancel */ + 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 int -AllocateBuffers(PortPrivPtr pPPriv, int w_bpp, int h) +static void +Permedia3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; - int i = -1; - - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "We try to allocate a %dx%d buffer.\n", w_bpp, h)); - /* we start a timer to free the buffers if they are nto used within - * 5 seconds (pPPriv->Delay * pPPriv->Instant) */ - pPPriv->StopDelay = pPPriv->Delay; - if (!pPPriv->TimerInUse) { - pPPriv->TimerInUse = TRUE; - TimerSet(pPPriv->Timer, 0, 80, TimerCallback, pAPriv); - } - - 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); + GLINTPtr pGlint = GLINTPTR(pScrn); + GLINTPortPrivPtr pPriv = (GLINTPortPrivPtr)data; + int i; + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if(shutdown) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->ramdacOn = FALSE; + GLINT_WAIT(4); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, + PM3RD_VideoOverlayControl); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + } + for (i = 0; i < (pPriv->doubleBuffer ? 2 : 1); i++) { + if(pPriv->area[i]) { + xf86FreeOffscreenArea(pPriv->area[i]); + pPriv->area[i] = NULL; + } + } + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } +} + +static int +Permedia3SetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +){ + GLINTPortPrivPtr pPriv = (GLINTPortPrivPtr)data; + GLINTPtr pGlint = GLINTPTR(pScrn); + + if (attribute == xvDoubleBuffer) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; + } + else if (attribute == xvColorKey) + { + pPriv->colorKey = value; + GLINT_WAIT(9); + RAMDAC_WRITE((value & 0xff0000)>>16, PM3RD_VideoOverlayKeyR); + RAMDAC_WRITE((value & 0x00ff00)>>8, PM3RD_VideoOverlayKeyG); + RAMDAC_WRITE((value & 0x0000ff), PM3RD_VideoOverlayKeyB); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } + else if (attribute == xvAutopaintColorKey) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->autopaintColorKey = value; + } + else if (attribute == xvFilter) + { + if ((value < 0) || (value > 2)) + return BadValue; + switch (value) { + case 0: + pPriv->Filter = PM3VideoOverlayMode_FILTER_OFF; + break; + case 1: + pPriv->Filter = PM3VideoOverlayMode_FILTER_FULL; + break; + case 2: + pPriv->Filter = PM3VideoOverlayMode_FILTER_PARTIAL; + break; } - 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; + else + return BadMatch; + + return Success; } -/* - * Xv interface - */ +static int +Permedia3GetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + GLINTPortPrivPtr pPriv = (GLINTPortPrivPtr)data; + + if (attribute == xvDoubleBuffer) + *value = (pPriv->doubleBuffer) ? 1 : 0; + else if (attribute == xvColorKey) + *value = pPriv->colorKey; + else if (attribute == xvAutopaintColorKey) + *value = (pPriv->autopaintColorKey) ? 1 : 0; + else if (attribute == xvFilter) + *value = pPriv->Filter >> 14; + else + return BadMatch; + + return Success; +} -#if USE_HARDWARE_COPY +static void +Permedia3QueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + if(vid_w > (drw_w << 3)) + drw_w = vid_w >> 3; + if(vid_h > (drw_h << 3)) + drw_h = vid_h >> 3; + + *p_w = drw_w; + *p_h = drw_h; +} + static void -HWCopySetup(PortPrivPtr pPPriv, int x, int y, int w, int h) +HWCopySetup(ScrnInfoPtr pScrn, int x, int y, int w, int h) { - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; GLINTPtr pGlint = GLINTPTR(pScrn); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "x = %d, y = %d, w = %d, h = %d.\n", x, y, w, h)); GLINT_WAIT(4); GLINT_WRITE_REG(0xffffffff, FBHardwareWriteMask); @@ -418,37 +525,41 @@ PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); } + static void -HWCopyYV12(PortPrivPtr pPPriv, CARD8 *Y, int w, int h) +HWCopyYV12(ScrnInfoPtr pScrn, CARD8 *Y, int w, int h) { - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; GLINTPtr pGlint = GLINTPTR(pScrn); - int Y_size = w * h; - CARD8 *V = Y + Y_size; - CARD8 *U = V + (Y_size >> 2); + int size = w * h; + CARD8 *V = Y + size; + CARD8 *U = V + (size >> 2); CARD32 *dst; - int dwords, i, x; + int pass2 = 0; + int dwords, i, x = 0; + + dwords = size >> 1; - dwords = Y_size >> 1; + w >>= 1; - x = 0; while (dwords >= pGlint->FIFOSize) { dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - for (i = pGlint->FIFOSize - 1; i; i--, Y += 2, U++, V++, dst++, x++) { - /* mmm, i don't know if this is really needed, as we perform - * endianess inversion as usual, let's check it before removing */ -#if X_BYTE_ORDER == X_BIG_ENDIAN - *dst = V[0] + (Y[1] << 8) + (U[0] << 16) + (Y[0] << 24); -#else - *dst = Y[0] + (U[0] << 8) + (Y[1] << 16) + (V[0] << 24); -#endif - if (x == w>>1) { U -= w>>1; V -= w>>1; } - if (x == w) x = 0; + for (i = pGlint->FIFOSize - 1; i; i--, Y += 2, x++) { + if (x == w) { + x = 0; + if (pass2 == 0) + pass2 = 1; + else + if (pass2 == 1) { + pass2 = 0; + U += w; + V += w; + } + } + *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); } dwords -= pGlint->FIFOSize - 1; } @@ -458,125 +569,112 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - for (i = dwords; i; i--, Y += 2, U++, V++, dst++, x++) { - /* mmm, i don't know if this is really needed, as we perform - * endianess inversion as usual, let's check it before removing */ -#if X_BYTE_ORDER == X_BIG_ENDIAN - *dst = V[0] + (Y[1] << 8) + (U[0] << 16) + (Y[0] << 24); -#else - *dst = Y[0] + (U[0] << 8) + (Y[1] << 16) + (V[0] << 24); -#endif - if (x == w>>1) { U -= w>>1; V -= w>>1; } - if (x == w) x = 0; + for (i = dwords; i; i--, Y += 2, x++) { + if (x == w) { + x = 0; + if (pass2 == 0) + pass2 = 1; + else + if (pass2 == 1) { + pass2 = 0; + U += w; + V += w; + } + } + *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); } } } + static void -HWCopyFlat(PortPrivPtr pPPriv, CARD8 *src, int w, int h) +HWCopyFlat(ScrnInfoPtr pScrn, CARD8 *src, int w, int h) { - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; GLINTPtr pGlint = GLINTPTR(pScrn); - int size = w * h; - int pitch = pScrn->displayWidth<<pPPriv->FB_Shift; - CARD32 *dst; + GLINTPortPrivPtr pPriv = pGlint->adaptor->pPortPrivates[0].ptr; + int pitch = pScrn->displayWidth; CARD8 *tmp_src; - int dwords, i; + int dwords; if (w == pitch) { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "HWCopyFlat : src = %08x, w = pitch = %d, h = %d.\n", - src, w, h)); - dwords = size >> pPPriv->Video_Shift; - while (dwords >= pGlint->FIFOSize) { - dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + dwords = (w * h) >> (2 - pPriv->Video_Shift); + while(dwords >= pGlint->FIFOSize) { GLINT_WAIT(pGlint->FIFOSize); - GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - for (i = pGlint->FIFOSize - 1; i; i--, dst++, src++) *dst = *src; + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)src, pGlint->FIFOSize - 1); dwords -= pGlint->FIFOSize - 1; - } - if (dwords) { - dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + src += pGlint->FIFOSize - 1; + } + if(dwords) { GLINT_WAIT(dwords + 1); - GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - for (i = dwords; i; i--, dst++, src++) *dst = *src; - } + GLINT_WRITE_REG(((dwords - 1) << 16)|(0x15 << 4) |0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)src, dwords); + } } else { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "HWCopyFlat : src = %08x, w = %d, pitch = %d, h = %d.\n", - src, w, pitch, h)); - while (h) { - tmp_src = src; - dwords = w >> pPPriv->Video_Shift; - while (dwords >= pGlint->FIFOSize) { - dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + while (h--) { + tmp_src = src; + dwords = w >> (2 - pPriv->Video_Shift); + while(dwords >= pGlint->FIFOSize) { GLINT_WAIT(pGlint->FIFOSize); - GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - for (i = pGlint->FIFOSize - 1; i; i--, dst++, src++) *dst = *src; + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)src, pGlint->FIFOSize - 1); dwords -= pGlint->FIFOSize - 1; - } - if (dwords) { - dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + src += pGlint->FIFOSize - 1; + } + if(dwords) { GLINT_WAIT(dwords + 1); - GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - for (i = dwords; i; i--, dst++, src++) *dst = *src; - } - src = tmp_src + pitch; - } + GLINT_WRITE_REG(((dwords-1)<<16)|(0x15<<4) | 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)src, dwords); + } + src = tmp_src + (w << pPriv->Video_Shift); + } } } -#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) +static FBAreaPtr +Permedia3AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area, int width, int height) { - if (width == pitch) { - memcpy(dst, src, width * height); - return; - } + ScreenPtr pScreen; + FBAreaPtr new_area; - while (height > 0) { - memcpy(dst, src, width); - dst += pitch; - src += width; - height--; - } + if (area) { + if ((area->box.x2 - area->box.x1 >= width) && + (area->box.y2 - area->box.y1 >= height)) + return area; + + if (xf86ResizeOffscreenArea(area, width, height)) + return area; + + xf86FreeOffscreenArea(area); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_area = xf86AllocateOffscreenArea(pScreen, width, height, pScrn->bitsPerPixel / 8, NULL, NULL, NULL); + + if (!new_area) { + int max_width, max_height; + + xf86QueryLargestOffscreenArea(pScreen, &max_width, &max_height, pScrn->bitsPerPixel / 8, 0, PRIORITY_EXTREME); + + if (max_width < width || max_height < height) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_area = xf86AllocateOffscreenArea(pScreen, width, height, pScrn->bitsPerPixel / 8, NULL, NULL, NULL); + } + + return new_area; } -#endif #define FORMAT_RGB8888 PM3VideoOverlayMode_COLORFORMAT_RGB8888 #define FORMAT_RGB4444 PM3VideoOverlayMode_COLORFORMAT_RGB4444 @@ -594,153 +692,73 @@ #define FORMAT_VUY422 PM3VideoOverlayMode_COLORFORMAT_VUY422 #define FORMAT_YUV422 PM3VideoOverlayMode_COLORFORMAT_YUV422 -#define RAMDAC_WRITE(data,index) \ -do{ \ - mem_barrier(); \ - GLINT_WAIT(3); \ - mem_barrier(); \ - GLINT_WRITE_REG(((index)>>8)&0xff, PM3RD_IndexHigh); \ - mem_barrier(); \ - GLINT_WRITE_REG((index)&0xff, PM3RD_IndexLow); \ - mem_barrier(); \ - GLINT_WRITE_REG(data, PM3RD_IndexedData); \ - mem_barrier(); \ -}while(0) - -#define RAMDAC_WRITE_OLD(data,index) \ - Permedia2vOutIndReg(pScrn, index, 0x00, data) - /* Notice, have to check that we dont overflow the deltas here ... */ static void compute_scale_factor( - unsigned int* src_w, unsigned int* dst_w, + short* src_w, short* dst_w, unsigned int* shrink_delta, unsigned int* zoom_delta) { + /* NOTE: If we don't return reasonable values here then the video + * unit can potential shut off and won't display an image until re-enabled. + * Seems as though the zoom_delta is o.k, and I've not had the problem. + * The 'shrink_delta' is prone to this the most - FIXME ! */ + if (*src_w >= *dst_w) { + *src_w &= ~0x3; *dst_w &= ~0x3; - *shrink_delta = (((*src_w << 16) / *dst_w) & 0x0ffffff0) + 0x10; + *shrink_delta = (((*src_w << 16) / *dst_w) + 0x0f) & 0x0ffffff0; *zoom_delta = 1<<16; + if ( ((*shrink_delta * *dst_w) >> 16) & 0x03 ) + *shrink_delta += 0x10; } else { - if (*src_w & 0x3) *src_w = (*src_w & ~0x3) + 4; + *src_w &= ~0x3; + *dst_w &= ~0x3; + *zoom_delta = (((*src_w << 16) / *dst_w) + 0x0f) & 0x0001fff0; *shrink_delta = 1<<16; - for (;*dst_w > *src_w; (*dst_w)--) { - *zoom_delta = (*src_w << 16) / *dst_w; - if (((((*zoom_delta&0xf)+1) * *dst_w * *dst_w) >> 16) < *src_w) { - *zoom_delta = ((*zoom_delta & ~0xf) + 0x10) & 0x0001fff0; - return; - } - } - *zoom_delta = 1<<16; + if ( ((*zoom_delta * *dst_w) >> 16) & 0x03 ) + *zoom_delta += 0x10; } } static void -BeginOverlay(PortPrivPtr pPPriv, int display) -{ - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; +Permedia3DisplayVideo( + ScrnInfoPtr pScrn, + int id, + int offset, + short width, short height, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned int src_x = pPPriv->vx, dst_x = pPPriv->dx; - unsigned int src_y = pPPriv->vy, dst_y = pPPriv->dy; - unsigned int src_w = pPPriv->vw, dst_w = pPPriv->dw; - unsigned int src_h = pPPriv->vh, dst_h = pPPriv->dh; - unsigned int shrink_delta, zoom_delta; -#if BLACKNESS_WORKAROUND - static int Frames = 50; -#endif - unsigned int stride = - (pScrn->displayWidth << pPPriv->FB_Shift) >> pPPriv->Video_Shift; + GLINTPortPrivPtr portPriv = pGlint->adaptor->pPortPrivates[0].ptr; + unsigned int shrink, zoom; + unsigned int newx1, newx2; /* Let's overlay only to visible parts of the screen */ - if (pPPriv->dx < pScrn->frameX0) { - dst_w = dst_w - pScrn->frameX0 + dst_x; - dst_x = 0; - src_w = dst_w * pPPriv->vw / pPPriv->dw; - src_x = src_x + pPPriv->vw - src_w; - } else if (pScrn->frameX0 > 0) dst_x = dst_x - pScrn->frameX0; - if (pPPriv->dy < pScrn->frameY0) { - dst_h = dst_h - pScrn->frameY0 + pPPriv->dy; - dst_y = 0; - src_h = dst_h * pPPriv->vh / pPPriv->dh; - src_y = src_y + pPPriv->vh - src_h; - } else if (pScrn->frameY0 > 0) dst_y = dst_y - pScrn->frameY0; - if (dst_x + dst_w > (pScrn->frameX1 - pScrn->frameX0)) { - unsigned int old_w = dst_w; - dst_w = pScrn->frameX1 - pScrn->frameX0 - dst_x; - src_w = dst_w * src_w / old_w; - } - if (dst_y + dst_h > (pScrn->frameY1 - pScrn->frameY0)) { - unsigned int old_h = dst_h; - dst_h = pScrn->frameY1 - pScrn->frameY0 - dst_y; - src_h = dst_h * src_h / old_h; + if (dstBox->x1 == 0) { + x1 = drw_w - dstBox->x2; + drw_w = dstBox->x2; + } + if (dstBox->x2 == pScrn->frameX1) { + x2 = drw_w - (dstBox->x2 - dstBox->x1); + drw_w = (dstBox->x2 - dstBox->x1); } /* Let's adjust the width of source and dest to be compliant with * the Permedia3 overlay unit requirement, and compute the X deltas. */ - compute_scale_factor(&src_w, &dst_w, &shrink_delta, &zoom_delta); - -#if BLACKNESS_WORKAROUND - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "BeginOverlay %d (buffer %d)\n", Frames, display)); -#else - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "BeginOverlay (buffer %d)\n", display)); -#endif - if (src_w != pPPriv->vw) - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "BeginOverlay : Padding video width to 4 pixels %d->%d.\n", - pPPriv->vw, src_w)); - if (dst_w != pPPriv->dw) - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "BeginOverlay : Scaling destination width from %d to %d.\n" - "\tThe scaling factor is to high, and may cause problems.\n", - pPPriv->dw, dst_w)); - - if (display != -1) pPPriv->display = display; - -#if BLACKNESS_WORKAROUND - if (++Frames>25) { - Frames = 0; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Registers (1) : %08x, %08x, %08x, %08x, %08x.\n", - GLINT_READ_REG(PM3VideoOverlayFifoControl), - GLINT_READ_REG(PM3VideoOverlayMode), - GLINT_READ_REG(PM3VideoOverlayBase0), - GLINT_READ_REG(PM3VideoOverlayBase1), - GLINT_READ_REG(PM3VideoOverlayBase2))); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Registers (2) : %08x, %08x, %08x, %08x.\n", - GLINT_READ_REG(PM3VideoOverlayStride), - GLINT_READ_REG(PM3VideoOverlayWidth), - GLINT_READ_REG(PM3VideoOverlayHeight), - GLINT_READ_REG(PM3VideoOverlayOrigin))); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Registers (3) : %08x, %08x, %08x, %08x.\n", - GLINT_READ_REG(PM3VideoOverlayYDelta), - GLINT_READ_REG(PM3VideoOverlayShrinkXDelta), - GLINT_READ_REG(PM3VideoOverlayZoomXDelta), - GLINT_READ_REG(PM3VideoOverlayIndex))); - GLINT_WAIT(8); - GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, - PM3VideoOverlayMode); - } else GLINT_WAIT(7); -#else - GLINT_WAIT(7); -#endif - GLINT_WRITE_REG(3|(12<<16), PM3VideoOverlayFifoControl); - /* Updating the Video Overlay Source Image Parameters */ - GLINT_WRITE_REG( - pPPriv->BufferBase[pPPriv->display]>>pPPriv->Video_Shift, - PM3VideoOverlayBase+(pPPriv->display*8)); - GLINT_WRITE_REG(pPPriv->Format | - PM3VideoOverlayMode_BUFFERSYNC_MANUAL | - PM3VideoOverlayMode_FLIP_VIDEO | - /* Filtering & Mirroring Attributes */ - pPPriv->OverlayMode | - PM3VideoOverlayMode_ENABLE, - PM3VideoOverlayMode); - /* Let's set the source stride. */ - GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(stride), + newx1 = src_w; newx2 = drw_w; + compute_scale_factor(&src_w, &drw_w, &shrink, &zoom); + dstBox->x2 -= (newx2 - drw_w); + + /* We do a long wait here - for everything that needs to be written */ + GLINT_WAIT(39); + GLINT_WRITE_REG(offset>>portPriv->Video_Shift, + portPriv->buffer ? PM3VideoOverlayBase1 : PM3VideoOverlayBase0); + /* Let's set the source pitch. */ + GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(pScrn->displayWidth<< + (pScrn->bitsPerPixel>>4) >>portPriv->Video_Shift), PM3VideoOverlayStride); /* Let's set the position and size of the visible part of the source. */ GLINT_WRITE_REG(PM3VideoOverlayWidth_WIDTH(src_w), @@ -748,834 +766,553 @@ GLINT_WRITE_REG(PM3VideoOverlayHeight_HEIGHT(src_h), PM3VideoOverlayHeight); GLINT_WRITE_REG( - PM3VideoOverlayOrigin_XORIGIN(src_x) | - PM3VideoOverlayOrigin_YORIGIN(src_y), + PM3VideoOverlayOrigin_XORIGIN(x1) | + PM3VideoOverlayOrigin_YORIGIN(y1), PM3VideoOverlayOrigin); - - GLINT_WAIT(5); /* Scale the source to the destinationsize */ - if (src_h == dst_h) { + if (src_h == drw_h) { GLINT_WRITE_REG( PM3VideoOverlayYDelta_NONE, PM3VideoOverlayYDelta); } else { GLINT_WRITE_REG( - PM3VideoOverlayYDelta_DELTA(src_h,dst_h), + PM3VideoOverlayYDelta_DELTA(src_h,drw_h), PM3VideoOverlayYDelta); - } - GLINT_WRITE_REG(shrink_delta, PM3VideoOverlayShrinkXDelta); - GLINT_WRITE_REG(zoom_delta, PM3VideoOverlayZoomXDelta); - GLINT_WRITE_REG(pPPriv->display, PM3VideoOverlayIndex); - GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE, - PM3VideoOverlayUpdate); - - - /* Now set the ramdac video overlay region and mode */ - if ((pPPriv->ramdac_x != dst_x) || (pPPriv->ramdac_w != dst_w)) { - RAMDAC_WRITE((dst_x&0xff), PM3RD_VideoOverlayXStartLow); - RAMDAC_WRITE((dst_x&0xf00)>>8, PM3RD_VideoOverlayXStartHigh); - RAMDAC_WRITE(((dst_x+dst_w)&0xff), PM3RD_VideoOverlayXEndLow); - RAMDAC_WRITE(((dst_x+dst_w)&0xf00)>>8,PM3RD_VideoOverlayXEndHigh); - pPPriv->ramdac_x = dst_x; - pPPriv->ramdac_w = dst_w; - } - if ((pPPriv->ramdac_y != dst_y) || (pPPriv->ramdac_h != dst_h)) { - RAMDAC_WRITE((dst_y&0xff), PM3RD_VideoOverlayYStartLow); - RAMDAC_WRITE((dst_y&0xf00)>>8, PM3RD_VideoOverlayYStartHigh); - RAMDAC_WRITE(((dst_y+dst_h)&0xff), PM3RD_VideoOverlayYEndLow); - RAMDAC_WRITE(((dst_y+dst_h)&0xf00)>>8,PM3RD_VideoOverlayYEndHigh); - pPPriv->ramdac_y = dst_y; - pPPriv->ramdac_h = dst_h; - } - - if (!pPPriv->ramdac_on) { - if (pPPriv->OverlayAlpha<(3<<6)) { - RAMDAC_WRITE(pPPriv->OverlayAlpha, PM3RD_VideoOverlayBlend); - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_BLEND | - PM3RD_VideoOverlayControl_BLENDSRC_REGISTER, - PM3RD_VideoOverlayControl); - } else { -#if SUPPORT_CLIPPING - switch (pScrn->depth) { - case 8: - case 16: - RAMDAC_WRITE((pPPriv->ColorKey&0xff0000)>>16, - PM3RD_VideoOverlayKeyR); - RAMDAC_WRITE((pPPriv->ColorKey&0x00ff00)>>8, - PM3RD_VideoOverlayKeyG); - RAMDAC_WRITE(pPPriv->ColorKey&0x0000ff, - PM3RD_VideoOverlayKeyB); - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_MAINKEY | - PM3RD_VideoOverlayControl_KEY_COLOR, - PM3RD_VideoOverlayControl); - break; - case 15: - RAMDAC_WRITE(0x1, PM3RD_VideoOverlayKeyR); - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_MAINKEY | - PM3RD_VideoOverlayControl_KEY_ALPHA, - PM3RD_VideoOverlayControl); - break; - case 24: - RAMDAC_WRITE(0xff, PM3RD_VideoOverlayKeyR); - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_MAINKEY | - PM3RD_VideoOverlayControl_KEY_ALPHA, - PM3RD_VideoOverlayControl); - break; - } -#else - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_ALWAYS, - PM3RD_VideoOverlayControl); -#endif - } - pPPriv->ramdac_on = TRUE; - } - - pPPriv->Buffer[pPPriv->display]->RemoveAreaCallback = - RemoveBufferCallback; - if (display != -1) pPPriv->copy = -1; -} - -#if SUPPORT_CLIPPING - -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; } - - return TRUE; -} -static void Clip (PortPrivPtr pPPriv, RegionPtr clipBoxes) -{ - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; - - /* Let's handle the clipping here. */ - if(!RegionsEqual(&pPPriv->clip, clipBoxes)) { - REGION_COPY(pScrn->pScreen, &pPPriv->clip, clipBoxes); - if (pPPriv->OverlayAlpha<(3<<6)) { - XAAFillSolidRects(pScrn, pPPriv->OverlayAlpha<<24, GXcopy, - 0xff000000, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - } else { - switch (pScrn->depth) { - case 8: /* CI8 */ - XAAFillSolidRects(pScrn, pPPriv->ColorKey, - GXcopy, 0xffffffff, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - break; - case 15: /* RGB5551 */ - XAAFillSolidRects(pScrn, 0xffffffff, GXcopy, 0x80008000, - REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); - break; - case 16: /* RGB565 */ - XAAFillSolidRects(pScrn, pPPriv->ColorKey, GXcopy, - 0xffffffff, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - break; - case 24: /* RGB8888 */ - XAAFillSolidRects(pScrn, 0xffffffff, GXcopy, - 0xff000000, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - break; - } - } + if (src_w == drw_w) { + GLINT_WRITE_REG(1<<16, PM3VideoOverlayShrinkXDelta); + GLINT_WRITE_REG(1<<16, PM3VideoOverlayZoomXDelta); + } else { + GLINT_WRITE_REG(shrink, PM3VideoOverlayShrinkXDelta); + GLINT_WRITE_REG(zoom, PM3VideoOverlayZoomXDelta); } -} -#endif + GLINT_WRITE_REG(portPriv->buffer, PM3VideoOverlayIndex); -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, + /* Now set the ramdac video overlay region and mode */ + RAMDAC_WRITE((dstBox->x1&0xff), PM3RD_VideoOverlayXStartLow); + RAMDAC_WRITE((dstBox->x1&0xf00)>>8, PM3RD_VideoOverlayXStartHigh); + RAMDAC_WRITE((dstBox->x2&0xff), PM3RD_VideoOverlayXEndLow); + RAMDAC_WRITE((dstBox->x2&0xf00)>>8,PM3RD_VideoOverlayXEndHigh); + RAMDAC_WRITE((dstBox->y1&0xff), PM3RD_VideoOverlayYStartLow); + RAMDAC_WRITE((dstBox->y1&0xf00)>>8, PM3RD_VideoOverlayYStartHigh); + RAMDAC_WRITE((dstBox->y2&0xff), PM3RD_VideoOverlayYEndLow); + RAMDAC_WRITE((dstBox->y2&0xf00)>>8,PM3RD_VideoOverlayYEndHigh); + + GLINT_WRITE_REG(portPriv->Video_Shift << 5 | + portPriv->Format | + portPriv->Filter | + PM3VideoOverlayMode_BUFFERSYNC_MANUAL | + PM3VideoOverlayMode_FLIP_VIDEO | + PM3VideoOverlayMode_ENABLE, PM3VideoOverlayMode); -} -/* ReputImage is used if only the destination position or - * the clipboxes change. */ -static int -Permedia3ReputImage(ScrnInfoPtr pScrn, - short drw_x, short drw_y, - RegionPtr clipBoxes, pointer data) -{ - PortPrivPtr pPPriv = (PortPrivPtr) data; - - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "ReputImage %d,%d.\n", drw_x, drw_y)); -#if !SUPPORT_CLIPPING - /* If the clip region is not a rectangle */ - if (REGION_SIZE(clipBoxes) != 0) { - StopOverlay (pPPriv, FALSE); - return Success; - } -#endif - - /* If the buffer was freed, we cannot overlay it. */ - if (pPPriv->display == -1) { - StopOverlay (pPPriv, FALSE); - return Success; - } - - /* Check that the dst area is some part of the visible screen. */ - if ((drw_x + pPPriv->dw) < pScrn->frameX0 || - (drw_y + pPPriv->dh) < pScrn->frameY0 || - drw_x > pScrn->frameX1 || drw_y > pScrn->frameY1) { - return Success; + if (!portPriv->ramdacOn) { + RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_KEY_COLOR | + PM3RD_VideoOverlayControl_MODE_MAINKEY | + PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED, + PM3RD_VideoOverlayControl); + portPriv->ramdacOn = TRUE; } - /* Copy the destinations coordinates */ - pPPriv->dx = drw_x; - pPPriv->dy = drw_y; - -#if SUPPORT_CLIPPING - /* Clipping */ - Clip (pPPriv, clipBoxes); -#endif - - /* Restart the overlay */ - BeginOverlay(pPPriv, -1); - - return Success; + GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE, + PM3VideoOverlayUpdate); } -static int -Permedia3PutImage(ScrnInfoPtr pScrn, - short src_x, short src_y, short drw_x, short drw_y, - short src_w, short src_h, short drw_w, short drw_h, - int id, unsigned char *buf, short width, short height, - Bool sync, RegionPtr clipBoxes, pointer data) -{ - PortPrivPtr pPPriv = (PortPrivPtr) data; -#if !USE_HARDWARE_COPY - GLINTPtr pGlint = GLINTPTR(pScrn); +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 +){ +#if 0 + 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; - } + GLINTPortPrivPtr pPriv = (GLINTPortPrivPtr)data; + INT32 x1, x2, y1, y2; + int pitch; + int i; + int w_bpp, bpp; + Bool copy_flat = TRUE; + BoxRec dstBox; - /* Let's find the image format and Video_Shift values */ - switch (id) { + /* Let's find the image format and Video_Shift values */ + switch (id) { case LE4CC('Y','V','1','2'): - pPPriv->Format = FORMAT_YUV422; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_YUV422; + pPriv->Video_Shift = 1; copy_flat = FALSE; break; case LE4CC('Y','U','Y','2'): - pPPriv->Format = FORMAT_YUV422; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_YUV422; + pPriv->Video_Shift = 1; break; case LE4CC('U','Y','V','Y'): - pPPriv->Format = FORMAT_VUY422; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_VUY422; + pPriv->Video_Shift = 1; break; case LE4CC('Y','U','V','A'): - pPPriv->Format = FORMAT_YUV444; - pPPriv->Video_Shift = 2; + pPriv->Format = FORMAT_YUV444; + pPriv->Video_Shift = 2; break; case LE4CC('V','U','Y','A'): - pPPriv->Format = FORMAT_VUY444; - pPPriv->Video_Shift = 2; + pPriv->Format = FORMAT_VUY444; + pPriv->Video_Shift = 2; break; case 0x41: /* RGBA 8:8:8:8 */ - pPPriv->Format = FORMAT_RGB8888; - pPPriv->Video_Shift = 2; + pPriv->Format = FORMAT_RGB8888; + pPriv->Video_Shift = 2; break; case 0x42: /* RGB 5:6:5 */ - pPPriv->Format = FORMAT_RGB565; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_RGB565; + pPriv->Video_Shift = 1; break; case 0x43: /* RGB 1:5:5:5 */ - pPPriv->Format = FORMAT_RGB5551; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_RGB5551; + pPriv->Video_Shift = 1; break; case 0x44: /* RGB 4:4:4:4 */ - pPPriv->Format = FORMAT_RGB4444; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_RGB4444; + pPriv->Video_Shift = 1; break; case 0x46: /* RGB 2:3:3 */ - pPPriv->Format = FORMAT_RGB332; - pPPriv->Video_Shift = 0; + pPriv->Format = FORMAT_RGB332; + pPriv->Video_Shift = 0; break; case 0x47: /* BGRA 8:8:8:8 */ - pPPriv->Format = FORMAT_BGR8888; - pPPriv->Video_Shift = 2; + pPriv->Format = FORMAT_BGR8888; + pPriv->Video_Shift = 2; break; case 0x48: /* BGR 5:6:5 */ - pPPriv->Format = FORMAT_BGR565; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_BGR565; + pPriv->Video_Shift = 1; break; case 0x49: /* BGR 1:5:5:5 */ - pPPriv->Format = FORMAT_BGR5551; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_BGR5551; + pPriv->Video_Shift = 1; break; case 0x4A: /* BGR 4:4:4:4 */ - pPPriv->Format = FORMAT_BGR4444; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_BGR4444; + pPriv->Video_Shift = 1; break; case 0x4C: /* BGR 2:3:3 */ - pPPriv->Format = FORMAT_BGR332; - pPPriv->Video_Shift = 0; + pPriv->Format = FORMAT_BGR332; + pPriv->Video_Shift = 0; break; - default: + default: return XvBadAlloc; } - /* Now we allocate a buffer, if it is needed */ - w_bpp = (width << pPPriv->Video_Shift) >> pPPriv->FB_Shift; - if ((copy = AllocateBuffers(pPPriv, w_bpp, height)) == -1) - return XvBadAlloc; - - /* Let's copy the image to the framebuffer */ -#if USE_HARDWARE_COPY - /* Erm, ... removing this log message will make the server crash. */ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Hardware image upload.\n")); - HWCopySetup(pPPriv, pPPriv->Buffer[copy]->box.x1, - pPPriv->Buffer[copy]->box.y1, w_bpp, height); - if (copy_flat) HWCopyFlat(pPPriv, buf, width, height); - else HWCopyYV12(pPPriv, buf, width, height); -#else - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Software image upload (1).\n")); - pPPriv->Sync(pScrn); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Software image upload (2).\n")); - if (copy_flat) CopyFlat(buf, - (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[copy], - width << pPPriv->FB_Shift, height, - pScrn->displayWidth << pPPriv->FB_Shift); - else CopyYV12(buf, - (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[copy]), - width, height, pScrn->displayWidth << pPPriv->FB_Shift); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Software image upload (3).\n")); - pPPriv->Sync(pScrn); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Software image upload (4).\n")); + /* 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; + + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, 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; + + w_bpp = (width << pPriv->Video_Shift) >> (pScrn->bitsPerPixel >> 4); + + for (i = 0; i < (pPriv->doubleBuffer ? 2 : 1); i++) { + if (!(pPriv->area[i] = + Permedia3AllocateMemory(pScrn,pPriv->area[i],w_bpp,src_h))) + return BadAlloc; + + pPriv->offset[i] = (pPriv->area[i]->box.x1 * bpp) + + (pPriv->area[i]->box.y1 * pitch); + } + + HWCopySetup(pScrn, pPriv->area[pPriv->buffer]->box.x1, + pPriv->area[pPriv->buffer]->box.y1, w_bpp, src_h); + + if (copy_flat) + HWCopyFlat(pScrn, buf, src_w, src_h); + else + HWCopyYV12(pScrn, buf, src_w, src_h); + + /* paint the color key */ + if(pPriv->autopaintColorKey && !RegionsEqual(&pPriv->clip, clipBoxes)) { + /* update cliplist */ + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); +#if 0 + GLINT_WAIT(1); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + pPriv->ramdacOn = FALSE; #endif + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); + } -#if SUPPORT_CLIPPING - /* Clipping*/ - Clip (pPPriv, clipBoxes); -#endif + Permedia3Sync(pScrn); + + Permedia3DisplayVideo(pScrn, id, pPriv->offset[pPriv->buffer], width,height, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); - /* We start the overlay */ - BeginOverlay(pPPriv, copy); + /* Switch buffer on next run - double buffer */ + if (pPriv->doubleBuffer) { + if (!pPriv->buffer) + pPriv->buffer = 1; + else + pPriv->buffer = 0; + } - /* We sync the chip again (if needed). */ - if (sync) pPPriv->Sync(pScrn); + pPriv->videoStatus = CLIENT_VIDEO_ON; 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)); +static int +Permedia3QueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + int size, tmp; + + if(*w > 2047) *w = 2047; + if(*h > 2047) *h = 2047; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_YV12: /* YV12 */ + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + default: /* RGB15, RGB16, YUY2 */ + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + + return size; +} + +/****************** Offscreen stuff ***************/ + +typedef struct { + FBAreaPtr area; + Bool isOn; + int Video_Shift; + int Format; + Bool ramdacOn; +} OffscreenPrivRec, * OffscreenPrivPtr; + +static int +Permedia3AllocateSurface( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +){ + FBAreaPtr area; + int fbpitch, bpp; + OffscreenPrivPtr pPriv; + + if((w > 2047) || (h > 2047)) + return BadAlloc; + + w = (w + 1) & ~1; + bpp = pScrn->bitsPerPixel >> 3; + fbpitch = bpp * pScrn->displayWidth; + + if(!(area = Permedia3AllocateMemory(pScrn, NULL, w, h))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if(!(surface->offsets = xalloc(sizeof(int)))) { + xf86FreeOffscreenArea(area); + return BadAlloc; + } + if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->offsets); + xf86FreeOffscreenArea(area); + return BadAlloc; + } + + pPriv->area = area; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->offsets[0] = (area->box.x1 * bpp) + (area->box.y1 * fbpitch); + surface->devPrivate.ptr = (pointer)pPriv; - REGION_EMPTY(pScrn->pScreen, &pPPriv->clip); - StopOverlay(pPPriv, cleanup); - - if (cleanup) { - FreeBuffers(pPPriv, FALSE); - } + return Success; } -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; +static int +Permedia3StopSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) { + GLINTPtr pGlint = GLINTPTR(surface->pScrn); + pPriv->ramdacOn = FALSE; + GLINT_WAIT(4); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, + PM3RD_VideoOverlayControl); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + pPriv->isOn = FALSE; } - 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)); +static int +Permedia3FreeSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) + Permedia3StopSurface(surface); + xf86FreeOffscreenArea(pPriv->area); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); 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 +Permedia3GetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +){ + return Permedia3GetPortAttribute(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); } 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; +Permedia3SetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +){ + return Permedia3SetPortAttribute(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} - return pitch * *height; +static int +Permedia3DisplaySurface( + XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + RegionPtr clipBoxes +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + GLINTPortPrivPtr portPriv = pGlint->adaptor->pPortPrivates[0].ptr; + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) + { + return Success; + } - default: - for (i = 0; i < ENTRIES(ScalerImages); i++) - if (ScalerImages[i].id == id) - break; + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; - if (i >= ENTRIES(ScalerImages)) + /* Let's find the image format and Video_Shift values */ + switch (surface->id) { + case LE4CC('Y','V','1','2'): + pPriv->Format = FORMAT_YUV422; + pPriv->Video_Shift = 1; break; - - pitch = *width * (ScalerImages[i].bits_per_pixel >> 3); - - if (pitches) - pitches[0] = pitch; + case LE4CC('Y','U','Y','2'): + pPriv->Format = FORMAT_YUV422; + pPriv->Video_Shift = 1; + break; + case LE4CC('U','Y','V','Y'): + pPriv->Format = FORMAT_VUY422; + pPriv->Video_Shift = 1; + break; + case LE4CC('Y','U','V','A'): + pPriv->Format = FORMAT_YUV444; + pPriv->Video_Shift = 2; + break; + case LE4CC('V','U','Y','A'): + pPriv->Format = FORMAT_VUY444; + pPriv->Video_Shift = 2; + break; + case 0x41: /* RGBA 8:8:8:8 */ + pPriv->Format = FORMAT_RGB8888; + pPriv->Video_Shift = 2; + break; + case 0x42: /* RGB 5:6:5 */ + pPriv->Format = FORMAT_RGB565; + pPriv->Video_Shift = 1; + break; + case 0x43: /* RGB 1:5:5:5 */ + pPriv->Format = FORMAT_RGB5551; + pPriv->Video_Shift = 1; + break; + case 0x44: /* RGB 4:4:4:4 */ + pPriv->Format = FORMAT_RGB4444; + pPriv->Video_Shift = 1; + break; + case 0x46: /* RGB 2:3:3 */ + pPriv->Format = FORMAT_RGB332; + pPriv->Video_Shift = 0; + break; + case 0x47: /* BGRA 8:8:8:8 */ + pPriv->Format = FORMAT_BGR8888; + pPriv->Video_Shift = 2; + break; + case 0x48: /* BGR 5:6:5 */ + pPriv->Format = FORMAT_BGR565; + pPriv->Video_Shift = 1; + break; + case 0x49: /* BGR 1:5:5:5 */ + pPriv->Format = FORMAT_BGR5551; + pPriv->Video_Shift = 1; + break; + case 0x4A: /* BGR 4:4:4:4 */ + pPriv->Format = FORMAT_BGR4444; + pPriv->Video_Shift = 1; + break; + case 0x4C: /* BGR 2:3:3 */ + pPriv->Format = FORMAT_BGR332; + pPriv->Video_Shift = 0; + break; + default: + return XvBadAlloc; + } - return pitch * *height; + Permedia3DisplayVideo(pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); + + pPriv->isOn = TRUE; + /* we've prempted the XvImage stream so set its free timer */ + if(portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + pGlint->VideoTimerCallback = Permedia3VideoTimerCallback; } - return 0; + return Success; } -static void -DeleteAdaptorPriv(AdaptorPrivPtr pAPriv) +static void +Permedia3InitOffscreenImages(ScreenPtr pScreen) { - FreeBuffers(pAPriv->pPort, FALSE); + XF86OffscreenImagePtr offscreenImages; - TimerFree(pAPriv->pPort->Timer); + /* need to free this someplace */ + if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; - xfree(pAPriv); + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | + VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = Permedia3AllocateSurface; + offscreenImages[0].free_surface = Permedia3FreeSurface; + offscreenImages[0].display = Permedia3DisplaySurface; + offscreenImages[0].stop = Permedia3StopSurface; + offscreenImages[0].setAttribute = Permedia3SetSurfaceAttribute; + offscreenImages[0].getAttribute = Permedia3GetSurfaceAttribute; + offscreenImages[0].max_width = 2047; + offscreenImages[0].max_height = 2047; + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); } -static AdaptorPrivPtr -NewAdaptorPriv(ScrnInfoPtr pScrn) +static void +Permedia3VideoTimerCallback(ScrnInfoPtr pScrn, Time time) { - AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) xcalloc(1, sizeof(AdaptorPrivRec)); - PortPrivPtr pPPriv = (PortPrivPtr) xcalloc(1, sizeof(PortPrivRec)); GLINTPtr pGlint = GLINTPTR(pScrn); + GLINTPortPrivPtr pPriv = pGlint->adaptor->pPortPrivates[0].ptr; 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; + if(pPriv->videoStatus & TIMER_MASK) { + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < time) { + pPriv->ramdacOn = FALSE; + GLINT_WAIT(4); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, + PM3RD_VideoOverlayControl); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = time + FREE_DELAY; } - 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); - } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < time) { + for (i = 0; i < (pPriv->doubleBuffer ? 2 : 1); i++) { + if(pPriv->area[i]) { + xf86FreeOffscreenArea(pPriv->area[i]); + pPriv->area[i] = NULL; + } + } + pPriv->videoStatus = 0; + pGlint->VideoTimerCallback = NULL; + } + } + } else /* shouldn't get here */ + pGlint->VideoTimerCallback = NULL; } -#endif /* XvExtension */ +#endif /* !XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c diff -u 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.23 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c:1.21.2.2 Tue May 29 07:32:23 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c Tue May 29 07:23:38 2001 @@ -28,7 +28,7 @@ * * Permedia accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c,v 1.21.2.2 2001/05/29 11:32:23 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c,v 1.23 2001/05/29 11:23:38 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c diff -u 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.10 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c:1.9.2.1 Thu May 24 16:12:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c Thu May 24 15:55:05 2001 @@ -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.9.2.1 2001/05/24 20:12:48 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c,v 1.10 2001/05/24 19:55:05 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c diff -u 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.8 --- xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c:1.6.2.1 Tue May 29 07:32:23 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c Sat Oct 27 23:33:30 2001 @@ -28,7 +28,7 @@ * * GLINT 300SX accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c,v 1.6.2.1 2001/05/29 11:32:23 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c,v 1.8 2001/10/28 03:33:30 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -63,13 +63,11 @@ int transparency_color); static void SXSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h); +#if 0 static void SXWriteBitmap(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 SXSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, - int x2,int y2); -static void SXDisableClipping(ScrnInfoPtr pScrn); static void SXWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int rop, unsigned int planemask, int trans, @@ -79,6 +77,10 @@ static void SXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); static void SXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +#endif +static void SXSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, + int x2,int y2); +static void SXDisableClipping(ScrnInfoPtr pScrn); static void SXLoadCoord(ScrnInfoPtr pScrn, int x, int y, int w, int h, int a, int d); static void SXSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, @@ -422,6 +424,7 @@ GLINT_WRITE_REG(PrimitiveTrapezoid, Render); } +#if 0 static void SXSetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, @@ -511,6 +514,7 @@ } } } +#endif void SXSetupForMono8x8PatternFill( ScrnInfoPtr pScrn, @@ -571,6 +575,7 @@ GLINT_WRITE_REG(AreaStippleEnable | PrimitiveTrapezoid, Render); } +#if 0 static void SXWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, @@ -767,6 +772,7 @@ CHECKCLIPPING; SET_SYNC_FLAG(infoRec); } +#endif static void SXPolylinesThinSolidWrapper( Index: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c diff -u 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.28 --- xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c:1.26.2.2 Wed May 30 06:08:19 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c Wed May 30 06:07:56 2001 @@ -28,7 +28,7 @@ * * GLINT 500TX / MX accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.26.2.2 2001/05/30 10:08:19 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.28 2001/05/30 10:07:56 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c diff -u 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.15 --- xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c:1.13.2.2 Tue May 29 07:32:23 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c Tue May 29 07:23:38 2001 @@ -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.13.2.2 2001/05/29 11:32:23 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c,v 1.15 2001/05/29 11:23:38 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.20 Fri May 4 15:05:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c Fri Jan 4 16:22:31 2002 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.20 2001/05/04 19:05:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.25 2002/01/04 21:22:31 tsi Exp $ */ /* All drivers should typically include these */ @@ -176,11 +176,10 @@ "vgaHWFreeHWRec", "vgaHWGetHWRec", "vgaHWGetIOBase", - "vgaHWLock", + "vgaHWGetIndex", "vgaHWProtect", "vgaHWRestore", "vgaHWSave", - "vgaHWUnlock", NULL }; @@ -191,27 +190,24 @@ }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *ddcSymbols[] = { - "xf86PrintEDID", "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; @@ -221,12 +217,14 @@ NULL }; +/* XXX The vbe module isn't currently loaded. */ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", NULL }; +/* XXX The int10 module isn't currently loaded. */ static const char *int10Symbols[] = { "xf86InitInt10", "xf86FreeInt10", @@ -523,7 +521,6 @@ int bytesPerPixel; ClockRangePtr clockRanges; MessageType from; - char *mod = NULL; CARD32 iobase; char *ramdac = NULL; CARD32 tmpl, tmph, tmp; @@ -630,7 +627,7 @@ bytesPerPixel = pScrn->bitsPerPixel / 8; - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Collect all of the relevant option flags (fill in pScrn->options) */ @@ -858,7 +855,6 @@ /* see if we can find a flatpanel */ if (!pI128->FlatPanel && mon) { - int i; for (i=0; i<4; i++) if (mon->det_mon[i].type == DS_NAME) { if (strncmp((char *)mon->det_mon[i].section.name, @@ -1148,16 +1144,11 @@ /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { - I128FreeRec(pScrn); - return FALSE; - } - if (!xf86LoadSubModule(pScrn, "fb")) { I128FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); /* Load XAA if needed */ if (!pI128->NoAccel) { @@ -1266,6 +1257,7 @@ default: /* Unknown board... */ break; } + break; case PCI_CHIP_I128_T2R: switch ((pI128->PciInfo->subsysCard) & 0xFFF7) { case 0x00: /* 4MB card, no daughtercard */ @@ -1568,7 +1560,7 @@ /* Initialize HW cursor layer. Must follow software cursor initialization*/ if (pI128->HWCursor) { - Bool ret = TRUE; + ret = TRUE; switch(pI128->RamdacType) { case TI3025_DAC: ret = I128TIHWCursorInit(pScrn); break; @@ -1984,8 +1976,7 @@ if (pI128->RamdacType == TI3025_DAC) return; - pI128->mem.rbase_g[IDXL_I] = IBMRGB_sync; MB; - snc = pI128->mem.rbase_g[DATA_I]; + snc = pI128->mem.rbase_g[CRT_1CON]; switch (PowerManagementMode) { @@ -2006,8 +1997,7 @@ snc &= ~0x30; break; } - pI128->mem.rbase_g[IDXL_I] = IBMRGB_sync; MB; - pI128->mem.rbase_g[DATA_I] = snc; MB; + pI128->mem.rbase_g[CRT_1CON] = snc; MB; } void Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.30 xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.35 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.30 Tue May 15 06:19:38 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c Fri Jan 4 16:22:31 2002 @@ -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.30 2001/05/15 10:19:38 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c,v 1.35 2002/01/04 21:22:31 tsi Exp $ */ /* * Authors: @@ -197,39 +197,36 @@ }; static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWSave", /* Added */ - "vgaHWRestore", /* Added */ - "vgaHWProtect", + "vgaHWGetIOBase", + "vgaHWGetIndex", + "vgaHWHBlankKGA", "vgaHWInit", + "vgaHWLock", "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", + "vgaHWSaveScreen", "vgaHWSetMmioFuncs", - "vgaHWGetIOBase", - "vgaHWLock", "vgaHWUnlock", - "vgaHWFreeHWRec", - "vgaHWSaveScreen", - "vgaHWHandleColormaps", + "vgaHWUnmapMem", + "vgaHWVBlankKGA", 0 }; -static const char *fbSymbols[] = { -#ifdef USE_FB - "fbScreenInit", - "fbPictureInit", -#else +static const char *cfbSymbols[] = { "cfbScreenInit", "cfb16ScreenInit", "cfb24ScreenInit", "cfb32ScreenInit", -#endif - "cfb8_32ScreenInit", - "cfb24_32ScreenInit", NULL }; -static const char *xf8_32bppSymbols[] = { - "xf86Overlay8Plus32Init", +static const char *fbSymbols[] = { + "fbScreenInit", + "fbPictureInit", NULL }; @@ -237,23 +234,20 @@ "XAADestroyInfoRec", "XAACreateInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", NULL }; @@ -298,9 +292,8 @@ * might refer to. */ LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, - xf8_32bppSymbols, ramdacSymbols, vbeSymbols, - NULL /* ddcsymbols */, NULL /* i2csymbols */, NULL /* shadowSymbols */, - NULL /* fbdevsymbols */, NULL); + cfbSymbols, ramdacSymbols, vbeSymbols, + NULL); /* * The return value must be non-NULL on success even though there @@ -459,6 +452,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -540,6 +534,22 @@ } xf86PrintDepthBpp(pScrn); + /* Process the options */ + xf86CollectOptions(pScrn, NULL); + 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(pI740->Options, OPTION_DAC_6BIT, FALSE) && + pScrn->bitsPerPixel>8) { + OptionInfoPtr ptr; + ptr=xf86TokenToOptinfo(pI740->Options, OPTION_DAC_6BIT); + ptr->found=FALSE; + } + + pScrn->rgbBits=8; if (xf86ReturnOptValBool(pI740->Options, OPTION_DAC_6BIT, FALSE)) pScrn->rgbBits=6; @@ -558,27 +568,12 @@ } } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; hwp = VGAHWPTR(pScrn); pI740->cpp = pScrn->bitsPerPixel/8; - /* Process the options */ - xf86CollectOptions(pScrn, NULL); - 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(pI740->Options, OPTION_DAC_6BIT, FALSE) && - pScrn->bitsPerPixel>8) { - OptionInfoPtr ptr; - ptr=xf86TokenToOptinfo(pI740->Options, OPTION_DAC_6BIT); - ptr->found=FALSE; - } - /* We have to use PIO to probe, because we haven't mappend yet */ I740SetPIOAccess(pI740); @@ -773,7 +768,7 @@ I740FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit","fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); #else switch (pScrn->bitsPerPixel) { case 8: @@ -805,6 +800,7 @@ I740FreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(xaaSymbols, NULL); } if (!xf86ReturnOptValBool(pI740->Options, OPTION_SW_CURSOR, FALSE)) { @@ -1533,9 +1529,6 @@ pScrn->bitsPerPixel); return FALSE; } -#ifdef USE_FB - fbPictureInit(pScreen,0,0); -#endif xf86SetBlackWhitePixels(pScreen); @@ -1553,6 +1546,10 @@ } } +#ifdef USE_FB + /* must be after RGB ordering set */ + fbPictureInit(pScreen,0,0); +#endif miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.14 xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.14 Tue Jan 23 19:06:20 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile Thu Oct 4 14:28:21 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.14 2001/01/24 00:06:20 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.18 2001/10/04 18:28:21 alanh Exp $ XCOMM XCOMM This is the Imakefile for the i810 driver. XCOMM @@ -7,18 +7,20 @@ #include <Server.tmpl> #if BuildXF86DRI -DRISRCS = i810_dri.c -DRIOBJS = i810_dri.o +DRISRCS = i810_dri.c i810_hwmc.c i830_dri.c +DRIOBJS = i810_dri.o i810_hwmc.o i830_dri.o DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \ -I$(XF86OSSRC)/linux/drm/kernel -I$(TOP)/include DRIDEFINES = $(GLX_DEFINES) #endif SRCS = i810_driver.c i810_cursor.c i810_accel.c i810_io.c \ - i810_memory.c i810_wmark.c i810_dga.c i810_video.c $(DRISRCS) + i810_memory.c i810_wmark.c i810_dga.c i810_video.c \ + i830_driver.c $(DRISRCS) OBJS = i810_driver.o i810_cursor.o i810_accel.o i810_io.o \ - i810_memory.o i810_wmark.o i810_dga.o i810_video.o $(DRIOBJS) + i810_memory.o i810_wmark.o i810_dga.o i810_video.o \ + i830_driver.o $(DRIOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -36,6 +38,8 @@ #endif DEFINES = $(DRIDEFINES) +LinkSourceFile(i830_3d_reg.h, $(GLXLIBSRC)/mesa/src/drv/i830) + #if MakeHasPosixVariableSubstitutions SubdirLibraryRule($(OBJS)) #endif @@ -64,5 +68,8 @@ InstallDriverSDKNonExecFile(i810_memory.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_wmark.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_reg.h,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_dri.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_dri.h,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_driver.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKObjectModule(i810,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/i810/README diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/README:1.1 xc/programs/Xserver/hw/xfree86/drivers/i810/README:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/i810/README:1.1 Thu Mar 2 11:07:48 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/README Sat Oct 27 23:33:31 2001 @@ -7,7 +7,8 @@ * Intel 810 motherboards: i810, i810-dc100, - i810e. + i810e, + i830m. 2. Features @@ -19,8 +20,10 @@ * Support for high resolution video modes up to 1600x1200. * Fully programmable clock supported. * Robust text mode restore for VT switching. + * Xv surfaces for YUV Video display and scaling. + * XvMC hardware motion compensation for MPEG decoding. + * Hardware accelerated 3D for i830m - 3. Technical Notes * Hardware acceleration is not possible in 32 bit per pixel depth, @@ -32,9 +35,7 @@ 4. Reported Working Video Cards - * Intel evaluation hardware - i810, i810-dc100 and i810e. - * Tyan Tomcat Motherboard. - * HappyPC set-top box. + * i810, i810-dc100, i810e, i815, i815e, i830m. 5. Configuration @@ -44,8 +45,15 @@ Section "Device" Identifier "i810" + VideoRam 16384 EndSection + The VideoRam option is optional and determines how much system + memory will be used for graphics purposes. The i810 uses system + memory for all graphics memory due to the shared memory nature + of the chipset. 16-64MB is the recommended range depending on + available system resources. + If you have problems with auto-detection, you can specify: DacSpeed - in MHz @@ -59,9 +67,18 @@ Note: the i810 X server detects whether your motherboard has display cache video memory. This memory is has reduced bandwidth - compared to normal system memory, and isn't used by the server. The - main function of this memory is for ancillary buffers (eg. z buffer) - in a forthcoming 3d capable server. + compared to normal system memory, and isn't used by the server for + normal operation. The main function of this memory is for + ancillary buffers (eg. z buffer) in a 3d capable server. + + + In order to make use of the XvMC extension you will need to specify: + Option "XvMCSurfaces" "6" + or + Option "XvMCSurfaces" "7" + in the device section. Note that the memory for XvMC is preallocated and + unavailable for general graphics use. At this time there are no generally + available XvMC capable Mpeg decoders. 6. Driver Options @@ -71,7 +88,6 @@ 7. Known Limitations - - No 3d support in this release. - No 32bpp support in this driver. - Running Two Xservers on different VT's is not supported at this time. @@ -91,3 +107,4 @@ http://support.intel.com/support/graphics/intel810/linuxinstal.htm +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/README,v 1.4 2001/10/28 03:33:31 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.21 xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.21 Fri May 18 20:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h Mon Jan 14 13:43:51 2002 @@ -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.21 2001/05/19 00:26:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.29 2002/01/14 18:43:51 dawes Exp $ */ /* * Authors: @@ -33,6 +33,8 @@ * */ +/* #define I830DEBUG */ + #ifndef _I810_H_ #define _I810_H_ @@ -44,6 +46,8 @@ #include "xaa.h" #include "xf86Cursor.h" #include "xf86xv.h" +#include "xf86int10.h" +#include "vgaHW.h" #ifdef XF86DRI #include "xf86drm.h" @@ -53,6 +57,7 @@ #include "dri.h" #include "GL/glxint.h" #include "i810_dri.h" +#include "i830_dri.h" #endif @@ -60,9 +65,252 @@ #define I810_NAME "I810" #define I810_DRIVER_NAME "i810" #define I810_MAJOR_VERSION 1 -#define I810_MINOR_VERSION 0 +#define I810_MINOR_VERSION 1 #define I810_PATCHLEVEL 0 +#ifdef __GNUC__ +#define PFX __FILE__,__LINE__,__FUNCTION__ +#define FUNCTION_NAME __FUNCTION__ +#else +#define PFX __FILE__,__LINE__,"" +#define FUNCTION_NAME "" +#endif + +#ifdef I830DEBUG +#define MARKER() fprintf(stderr,"\n### %s:%d: >>> %s <<< ###\n\n",__FILE__,__LINE__,__FUNCTION__) +#define DPRINTF DPRINTF_stub +#else /* #ifdef I830DEBUG */ +#define MARKER() +/* this is a real ugle hack to get the compiler to optimize the debugging statements into oblivion */ +#define DPRINTF if(0) DPRINTF_stub +#endif /* #ifdef I830DEBUG */ + +#define KB(x) ((x) * 1024) +#define MB(x) ((x) * KB(1024)) + +/* I830 Video BIOS support */ + +/* This code is Heavily based upon the VESA driver written by: + * Paulo C~^Aésar Pereira de Andrade <pcpa@conectiva.com.br> */ + +typedef struct _VBEInfoBlock VBEInfoBlock; +typedef struct _ModeInfoBlock ModeInfoBlock; +typedef struct _CRTCInfoBlock CRTCInfoBlock; +typedef struct _VBT_header VBTHeader; +typedef struct _BIOSDataBlock BIOSDataBlock; + +#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) + +typedef struct _VESARec +{ + xf86Int10InfoPtr pInt; + EntityInfoPtr pEnt; + CARD16 major, minor; + VBEInfoBlock *vbeInfo; + GDevPtr device; + pciVideoPtr pciInfo; + PCITAG pciTag; + CARD16 maxBytesPerScanline; + int mapPhys, mapOff, mapSize; /* video memory */ + void *base, *VGAbase; + CARD8 *state, *pstate; /* SVGA state */ + int statePage, stateSize, stateMode; + int page; + CARD8 *block; + int pix24bpp; + CARD32 *pal, *savedPal; + CARD8 *fonts; + xf86MonPtr monitor; + Bool shadowFB, primary; + CARD8 *shadowPtr; + CARD32 windowAoffset; +} VESARec, *VESAPtr; + +typedef struct _ModeInfoData +{ + int mode; + ModeInfoBlock *data; + CRTCInfoBlock *block; +} ModeInfoData; + +#if !defined(__GNUC__) && !defined(__attribute__) +#define __attribute__(a) +#endif + +/* + * 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)); + +/* + * 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)); + +/* + * 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 */ +typedef struct _VESApmi +{ + int seg_tbl; + int tbl_off; + int tbl_len; +} VESApmi; + +/* Functions */ +const OptionInfoRec *I830BIOSAvailableOptions(int chipid, int busid); +ModeInfoBlock *I830VESAGetModeInfo(ScrnInfoPtr pScrn, int mode); +void I830BIOSProbeDDC(ScrnInfoPtr pScrn, int index); +void I830VESAFreeModeInfo(ModeInfoBlock *block); +Bool I830BIOSPreInit(ScrnInfoPtr pScrn, int flags); +void I830BIOSSaveRegisters(ScrnInfoPtr pScrn); +void I830BIOSSetRegisters(ScrnInfoPtr pScrn, int mode); +Bool I830VESAGetVBEMode(ScrnInfoPtr pScrn, int *mode); +Bool I830VESASetVBEMode(ScrnInfoPtr pScrn, int mode, CRTCInfoBlock *block); +Bool I830VESASaveRestore(ScrnInfoPtr pScrn, int function); +Bool I830VESASetGetLogicalScanlineLength(ScrnInfoPtr pScrn, int command, + int width, int *pixels, int *bytes, + int *max); +int I830VESASetGetDACPaletteFormat(ScrnInfoPtr pScrn, int bits); +CARD32 *I830VESASetGetPaletteData(ScrnInfoPtr pScrn, Bool set, int first, + int num, CARD32 *data, Bool secondary, + Bool wait_retrace); +Bool I830BIOSInitializeFirstMode(int scrnIndex); +Bool I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, + int argc, char **argv); +Bool I830VESASetDisplayStart(ScrnInfoPtr pScrn, int x, int y, + Bool wait_retrace); +void I830BIOSAdjustFrame(int scrnIndex, int x, int y, int flags); +void I830BIOSFreeScreen(int scrnIndex, int flags); +void I830BIOSLeaveVT(int scrnIndex, int flags); +Bool I830BIOSEnterVT(int scrnIndex, int flags); +Bool I830BIOSSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +Bool I830BIOSSaveScreen(ScreenPtr pScreen, Bool unblack); +Bool I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen); + +#define SCANWID_SET 0 +#define SCANWID_GET 1 +#define SCANWID_SET_BYTES 2 +#define SCANWID_GET_MAX 3 +#define I830VESASetLogicalScanline(pScrn, width) \ + I830VESASetGetLogicalScanlineLength(pScrn, SCANWID_SET, \ + width, NULL, NULL, NULL) +#define I830VESASetLogicalScanlineBytes(pScrn, width) \ + I830VESASetGetLogicalScanlineLength(pScrn, width, SCANWID_SET_BYTES, \ + NULL, NULL, NULL) +#define I830VESAGetLogicalScanline(pScrn, pixels, bytes, max) \ + I830VESASetGetLogicalScanlineLength(pScrn, SCANWID_GET, NULL, \ + pixels, bytes, max) +#define I830VESAGetMaxLogicalScanline(pScrn, pixels, bytes, max) \ + I830VESASetGetLogicalScanlineLength(pScrn, SCANWID_GET_MAX, \ + NULL, pixels, bytes, max) + +#define MODE_QUERY 0 +#define MODE_SAVE 1 +#define MODE_RESTORE 2 + +#define SET_SAVED_MODE 1 +#define SET_CURRENT_MODE 2 + +/* HWMC Surfaces */ +#define I810_MAX_SURFACES 7 +#define I810_MAX_SUBPICTURES 2 +#define I810_TOTAL_SURFACES 9 + /* Globals */ typedef struct _I810Rec *I810Ptr; @@ -80,6 +328,18 @@ unsigned pitch, unsigned size); +typedef enum { + OPTION_NOACCEL, + OPTION_SW_CURSOR, + OPTION_COLOR_KEY, + OPTION_CACHE_LINES, + OPTION_DAC_6BIT, + OPTION_DRI, + OPTION_NO_DDC, + OPTION_STRETCH, + OPTION_CENTER, + OPTION_XVMC_SURFACES +} I810Opts; /* Linear region allocated in framebuffer. */ @@ -132,6 +392,58 @@ } I810RegRec, *I810RegPtr; +typedef struct +{ + unsigned int LprbTail; + unsigned int LprbHead; + unsigned int LprbStart; + unsigned int LprbLen; + + unsigned int Fence[8]; + + unsigned int VideoClk_VGA0_M1M2N; + unsigned int VideoClk_VGA1_M1M2N; + unsigned int VideoClk_PostDiv; + unsigned int fpa_0; + unsigned int fpa_1; + unsigned int dpll_a; + unsigned int dpll_b; + + unsigned int LMI_FIFO_Watermark; + unsigned int LMI_FIFO_Watermark2; + + unsigned int HTotal_A; + unsigned int HBlank_A; + unsigned int HSync_A; + unsigned int VTotal_A; + unsigned int VBlank_A; + unsigned int VSync_A; + unsigned int Bclrpat_A; + unsigned int PipeASRC; + + unsigned int HTotal_B; + unsigned int HBlank_B; + unsigned int HSync_B; + unsigned int VTotal_B; + unsigned int VBlank_B; + unsigned int VSync_B; + unsigned int Bclrpat_B; + unsigned int PipeBSRC; + + unsigned int PipeAConf; + unsigned int PipeBConf; + unsigned int DspACntr; + unsigned int DspAStride; + unsigned int DspABase; + unsigned int DspBCntr; + unsigned int DspBStride; + unsigned int DspBBase; + + unsigned int adpa; + unsigned int dv0a; + unsigned int dv0b; +} I830RegRec, *I830RegPtr; + typedef struct _I810Rec { unsigned char *MMIOBase; unsigned char *FbBase; @@ -150,7 +462,8 @@ I810MemRange TexMem; I810MemRange Scratch; I810MemRange BufferMem; - + I810MemRange ContextMem; + I810MemRange MC; int auxPitch; int auxPitchBits; @@ -161,6 +474,8 @@ unsigned long OverlayPhysical; unsigned long OverlayStart; int colorKey; + int surfaceAllocation[I810_TOTAL_SURFACES]; + int numSurfaces; DGAModePtr DGAModes; int numDGAModes; @@ -200,6 +515,10 @@ I810RegRec SavedReg; I810RegRec ModeReg; + + I830RegRec i830_SavedReg; + I830RegRec i830_ModeReg; + XAAInfoRecPtr AccelInfoRec; xf86CursorInfoPtr CursorInfoRec; CloseScreenProcPtr CloseScreen; @@ -223,16 +542,28 @@ unsigned long backHandle; unsigned long zHandle; unsigned long cursorHandle; + unsigned long xvmcHandle; unsigned long sysmemHandle; Bool agpAcquired; drmHandle buffer_map; drmHandle ring_map; drmHandle overlay_map; + drmHandle mc_map; + drmHandle xvmcContext; #endif Bool agpAcquired2d; XF86VideoAdaptorPtr adaptor; OptionInfoPtr Options; + + /* Stolen memory support */ + unsigned long StolenSize; + Bool StolenOnly; + + /* Video BIOS support */ + VESAPtr vesa; + + int configured_device; } I810Rec; #define I810PTR(p) ((I810Ptr)((p)->driverPrivate)) @@ -241,6 +572,14 @@ #define I810_BACK 1 #define I810_DEPTH 2 +extern const char *I810vgahwSymbols[]; +extern const char *I810ramdacSymbols[]; +extern const char *I810int10Symbols[]; +extern const char *I810vbeSymbols[]; +extern const char *I810ddcSymbols[]; +extern const char *I810fbSymbols[]; +extern const char *I810xaaSymbols[]; + extern Bool I810DRIScreenInit(ScreenPtr pScreen); extern void I810DRICloseScreen(ScreenPtr pScreen); extern Bool I810DRIFinishScreenInit(ScreenPtr pScreen); @@ -299,7 +638,60 @@ extern Bool I810DGAInit(ScreenPtr pScreen); extern void I810InitVideo(ScreenPtr pScreen); +extern void I810InitMC(ScreenPtr pScreen); +extern const OptionInfoRec *I810AvailableOptions(int chipid, int busid); + +extern Bool I810MapMem(ScrnInfoPtr pScrn); +extern Bool I810UnmapMem(ScrnInfoPtr pScrn); +extern void I810SetRingRegs(ScrnInfoPtr pScrn); + +/* I830 specific functions */ +extern void I830EmitInvarientState(ScrnInfoPtr pScrn); + +extern Bool I830DRIScreenInit(ScreenPtr pScreen); +extern void I830DRICloseScreen(ScreenPtr pScreen); +extern Bool I830DRIFinishScreenInit(ScreenPtr pScreen); +extern Bool I830InitDma(ScrnInfoPtr pScrn); +extern Bool I830CleanupDma(ScrnInfoPtr pScrn); +extern Bool I830AccelInit(ScreenPtr pScreen); +extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, + int ydir, int rop, + unsigned int planemask, + int trans_color); +extern void I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, + int srcY, int dstX, int dstY, + int w, int h); +extern void I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask); +extern void I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, + int w, int h); + +/* Debug functions */ +extern char *i810_outreg_get_addr_name(unsigned int addr, int size); +extern void i810_outreg_decode_register(unsigned int addr, unsigned int val, int size); +extern void I830PrintAllRegisters(I830RegPtr i810Reg); +extern void I830ReadAllRegisters(I810Ptr pI810, I830RegPtr i810Reg); +void DPRINTF_stub (const char *filename,int line,const char *function,const char *fmt, ...); + +/* BIOS debug macro */ +#define xf86ExecX86int10_wrapper(pInt, pScrn) do \ + { \ + if(I810_DEBUG & DEBUG_VERBOSE_BIOS) \ + { \ + ErrorF("\n\n\n\nExecuting (ax == 0x%x) BIOS call\n", pInt->ax); \ + ErrorF("Checking Error state before execution\n"); \ + I810PrintErrorState(pScrn); \ + } \ + xf86ExecX86int10(pInt); \ + if(I810_DEBUG & DEBUG_VERBOSE_BIOS) \ + { \ + ErrorF("Checking Error state after execution\n"); \ + usleep(50000); \ + I810PrintErrorState(pScrn); \ + } \ + } while(0) + #define minb(p) *(volatile CARD8 *)(pI810->MMIOBase + (p)) #define moutb(p,v) *(volatile CARD8 *)(pI810->MMIOBase + (p)) = (v) @@ -315,49 +707,67 @@ pI810->LpRing.tail = outring; \ OUTREG(LP_RING + RING_TAIL, outring); \ } - -#ifdef __GNUC__ -#define LP_RING_MESSAGE(n) \ - ErrorF("BEGIN_LP_RING %d in %s\n", n, __FUNCTION__) -#else -#define LP_RING_MESSAGE(n) \ - ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__) -#endif -#define BEGIN_LP_RING(n) \ - unsigned int outring, ringmask; \ - volatile unsigned char *virt; \ - if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) I810Sync( pScrn ); \ +#define DO_RING_IDLE() do \ + { \ + int _head; \ + int _tail; \ + int _i; \ + do \ + { \ + _head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; \ + _tail = INREG(LP_RING + RING_TAIL) & TAIL_ADDR; \ + for(_i = 0; _i < 65535; _i++); \ + } \ + while(_head != _tail); \ + } while(0) + +#define BEGIN_LP_RING(n) \ + unsigned int outring, ringmask; \ + volatile unsigned char *virt; \ + if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) DO_RING_IDLE(); \ if (pI810->LpRing.space < n*4) I810WaitLpRing( pScrn, n*4, 0); \ - pI810->LpRing.space -= n*4; \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - LP_RING_MESSAGE(n); \ - outring = pI810->LpRing.tail; \ - ringmask = pI810->LpRing.tail_mask; \ - virt = pI810->LpRing.virtual_start; + pI810->LpRing.space -= n*4; \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME); \ + outring = pI810->LpRing.tail; \ + ringmask = pI810->LpRing.tail_mask; \ + virt = pI810->LpRing.virtual_start; /* Memory mapped register access macros */ #define INREG8(addr) *(volatile CARD8 *)(pI810->MMIOBase + (addr)) #define INREG16(addr) *(volatile CARD16 *)(pI810->MMIOBase + (addr)) #define INREG(addr) *(volatile CARD32 *)(pI810->MMIOBase + (addr)) -#define OUTREG8(addr, val) do { \ - *(volatile CARD8 *)(pI810->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ - ErrorF( "OUTREG8(%x, %x)\n", addr, val); \ -} while (0) - -#define OUTREG16(addr, val) do { \ - *(volatile CARD16 *)(pI810->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ - ErrorF( "OUTREG16(%x, %x)\n", addr, val); \ -} while (0) - -#define OUTREG(addr, val) do { \ - *(volatile CARD32 *)(pI810->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ - ErrorF( "OUTREG(%x, %x)\n", addr, val); \ -} while (0) +#define OUTREG8(addr, val) do \ + { \ + *(volatile CARD8 *)(pI810->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ + char *_name = i810_outreg_get_addr_name(addr, 8); \ + ErrorF( "OUTREG8(%s, %x, %x) in %s\n", _name, addr, val, FUNCTION_NAME); \ + i810_outreg_decode_register(addr, val, 8); \ + } \ + } while (0) + +#define OUTREG16(addr, val) do \ + { \ + *(volatile CARD16 *)(pI810->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ + char *_name = i810_outreg_get_addr_name(addr, 16); \ + ErrorF( "OUTREG16(%s, %x, %x) in %s\n", _name, addr, val, FUNCTION_NAME); \ + i810_outreg_decode_register(addr, val, 16); \ + } \ + } while (0) + +#define OUTREG(addr, val) do \ + { \ + *(volatile CARD32 *)(pI810->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ + char *_name = i810_outreg_get_addr_name(addr, 32); \ + ErrorF( "OUTREG(%s, %x, %x) in %s\n", _name, addr, val, FUNCTION_NAME); \ + i810_outreg_decode_register(addr, val, 32); \ + } \ + } while (0) /* To remove all debugging, make sure I810_DEBUG is defined as a * preprocessor symbol, and equal to zero. @@ -377,8 +787,8 @@ #define DEBUG_VERBOSE_CURSOR 0x40 #define DEBUG_ALWAYS_SYNC 0x80 #define DEBUG_VERBOSE_DRI 0x100 +#define DEBUG_VERBOSE_BIOS 0x200 - /* Size of the mmio region. */ #define I810_REG_SIZE 0x80000 @@ -400,11 +810,8 @@ pI810->PciInfo->chipType == PCI_CHIP_I810_DC100 || \ pI810->PciInfo->chipType == PCI_CHIP_I810_E) #define IS_I815(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I815) +#define IS_I830(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I830_M) #endif - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c:1.11 Fri Sep 15 19:25:48 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c Thu Oct 4 14:28:21 2001 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c,v 1.11 2000/09/15 23:25:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c,v 1.12 2001/10/04 18:28:21 alanh Exp $ */ /* * Authors: @@ -214,7 +214,6 @@ return XAAInit(pScreen, infoPtr); } - int I810WaitLpRing( ScrnInfoPtr pScrn, int n, int timeout_millis ) { @@ -650,4 +649,397 @@ /* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */ ADVANCE_LP_RING(); +} + +/* I830 Accel Functions */ + +static void I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, + int pattx, int patty, + int fg, int bg, int rop, + unsigned int planemask); +static void I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, + int pattx, int patty, + int x, int y, int w, int h); + +static void I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int mask); + +static void I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, + int skipleft ); + +static void I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); + + +/* The following function sets up the supported acceleration. Call it + * from the FbInit() function in the SVGA driver, or before ScreenInit + * in a monolithic server. + */ +Bool +I830AccelInit(ScreenPtr pScreen) +{ + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I810Ptr pI810 = I810PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) ErrorF("I830AccelInit\n"); + + pI810->AccelInfoRec = infoPtr = XAACreateInfoRec(); + if (!infoPtr) return FALSE; + + pI810->bufferOffset = 0; + infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE; + + /* Use the same sync function as the I810. + */ + infoPtr->Sync = I810Sync; + + /* Everything else is different enough to justify different functions */ + { + infoPtr->SolidFillFlags = NO_PLANEMASK; + infoPtr->SetupForSolidFill = I830SetupForSolidFill; + infoPtr->SubsequentSolidFillRect = I830SubsequentSolidFillRect; + } + + { + infoPtr->ScreenToScreenCopyFlags = (NO_PLANEMASK | NO_TRANSPARENCY); + + infoPtr->SetupForScreenToScreenCopy = I830SetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = I830SubsequentScreenToScreenCopy; + } + + { + infoPtr->SetupForMono8x8PatternFill = I830SetupForMono8x8PatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = + I830SubsequentMono8x8PatternFillRect; + + infoPtr->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_ORIGIN | + BIT_ORDER_IN_BYTE_MSBFIRST | + NO_PLANEMASK); + + } + + if(pI810->Scratch.Size != 0) { + int i; + int width = ((pScrn->displayWidth + 31) & ~31) / 8; + int nr_buffers = pI810->Scratch.Size / width; + unsigned char *ptr = pI810->FbBase + pI810->Scratch.Start; + + pI810->NumScanlineColorExpandBuffers = nr_buffers; + pI810->ScanlineColorExpandBuffers = (unsigned char **) + xnfcalloc( nr_buffers, sizeof (unsigned char *) ); + + for (i = 0 ; i < nr_buffers ; i++, ptr += width) + pI810->ScanlineColorExpandBuffers[i] = ptr; + + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + (NO_PLANEMASK | + ROP_NEEDS_SOURCE | + BIT_ORDER_IN_BYTE_MSBFIRST); + + infoPtr->ScanlineColorExpandBuffers = (unsigned char **) + xnfcalloc( 1, sizeof (unsigned char *) ); + infoPtr->NumScanlineColorExpandBuffers = 1; + + infoPtr->ScanlineColorExpandBuffers[0] = + pI810->ScanlineColorExpandBuffers[0]; + pI810->nextColorExpandBuf = 0; + + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + I830SetupForScanlineCPUToScreenColorExpandFill; + + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + I830SubsequentScanlineCPUToScreenColorExpandFill; + + infoPtr->SubsequentColorExpandScanline = + I830SubsequentColorExpandScanline; + } + + I810SelectBuffer(pScrn, I810_FRONT); + + return XAAInit(pScreen, infoPtr); +} + +void +I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask) +{ + I810Ptr pI810 = I810PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "I830SetupForFillRectSolid color: %x rop: %x mask: %x\n", + color, rop, planemask); + + pI810->BR[13] = ((i810PatternRop[rop] << 16) | + (pScrn->displayWidth * pI810->cpp)); + + pI810->BR[16] = color; + + switch (pScrn->bitsPerPixel) { + case 8: break; + case 16: pI810->BR[13] |= (1<<24); break; + case 32: pI810->BR[13] |= ((1<<25)|(1<<24)); break; + } +} + +void +I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) +{ + I810Ptr pI810 = I810PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "I830SubsequentFillRectSolid %d,%d %dx%d\n", + x,y,w,h); + + { + BEGIN_LP_RING(6); + + if(pScrn->bitsPerPixel == 32) { + OUT_RING(COLOR_BLT_CMD | COLOR_BLT_WRITE_ALPHA | COLOR_BLT_WRITE_RGB); + } else { + OUT_RING(COLOR_BLT_CMD); + } + OUT_RING(pI810->BR[13]); + OUT_RING((h << 16) | (w * pI810->cpp)); + OUT_RING(pI810->bufferOffset + (y * pScrn->displayWidth + x) * + pI810->cpp); + OUT_RING(pI810->BR[16]); + OUT_RING(0); + + ADVANCE_LP_RING(); + } +} + +void +I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, + unsigned int planemask, int transparency_color) +{ + I810Ptr pI810 = I810PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "I830SetupForScreenToScreenCopy %d %d %x %x %d\n", + xdir, ydir, rop, planemask, transparency_color); + + pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); + pI810->BR[13] |= i810Rop[rop] << 16; + + switch (pScrn->bitsPerPixel) { + case 8: break; + case 16: pI810->BR[13] |= (1<<24); break; + case 32: pI810->BR[13] |= ((1<<25)|(1<<24)); break; + } + +} + +void +I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x1, int src_y1, + int dst_x1, int dst_y1, int w, int h) +{ + I810Ptr pI810 = I810PTR(pScrn); + int dst_x2, dst_y2; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "I830SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n", + src_x1,src_y1,dst_x1,dst_y1,w,h); + + dst_x2 = dst_x1 + w; + dst_y2 = dst_y1 + h; + + { + BEGIN_LP_RING(8); + + if(pScrn->bitsPerPixel == 32) { + OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + } else { + OUT_RING(XY_SRC_COPY_BLT_CMD); + } + OUT_RING(pI810->BR[13]); + OUT_RING((dst_y1 << 16) | (dst_x1 & 0xffff)); + OUT_RING((dst_y2 << 16) | (dst_x2 & 0xffff)); + OUT_RING(pI810->bufferOffset); + OUT_RING((src_y1 << 16) | (src_x1 & 0xffff)); + OUT_RING(pI810->BR[13] & 0xFFFF); + OUT_RING(pI810->bufferOffset); + + ADVANCE_LP_RING(); + } +} + +static void +I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, + int fg, int bg, int rop, + unsigned int planemask) +{ + I810Ptr pI810 = I810PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "I830SetupFor8x8PatternColorExpand\n"); + + pI810->BR[16] = pattx; + pI810->BR[17] = patty; + pI810->BR[18] = bg; + pI810->BR[19] = fg; + + pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); /* In bytes */ + pI810->BR[13] |= i810PatternRop[rop] << 16; + if (bg == -1) pI810->BR[13] |= (1<<28); + + switch (pScrn->bitsPerPixel) { + case 8: break; + case 16: pI810->BR[13] |= (1<<24); break; + case 32: pI810->BR[13] |= ((1<<25)|(1<<24)); break; + } + +} + +static void +I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, + int x, int y, int w, int h) +{ + I810Ptr pI810 = I810PTR(pScrn); + int x1, x2, y1, y2; + + x1 = x; + x2 = x + w; + y1 = y; + y2 = y + h; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "I830Subsequent8x8PatternColorExpand\n"); + + { + BEGIN_LP_RING( 10 ); + + if(pScrn->bitsPerPixel == 32) { + OUT_RING(XY_MONO_PAT_BLT_CMD | XY_MONO_PAT_BLT_WRITE_ALPHA | + XY_MONO_PAT_BLT_WRITE_RGB | + ((patty << 8) & XY_MONO_PAT_VERT_SEED) | + ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); + } else { + OUT_RING(XY_MONO_PAT_BLT_CMD | + ((patty << 8) & XY_MONO_PAT_VERT_SEED) | + ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); + } + OUT_RING(pI810->BR[13]); + OUT_RING((y1 << 16) | x1); + OUT_RING((y2 << 16) | x2); + OUT_RING(pI810->bufferOffset); + OUT_RING(pI810->BR[18]); /* bg */ + OUT_RING(pI810->BR[19]); /* fg */ + OUT_RING(pI810->BR[16]); /* pattern data */ + OUT_RING(pI810->BR[17]); + OUT_RING(0); + ADVANCE_LP_RING(); + } +} + +static void +I830GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); + XAAInfoRecPtr infoPtr = pI810->AccelInfoRec; + + if (pI810->nextColorExpandBuf == pI810->NumScanlineColorExpandBuffers) + I810Sync( pScrn ); + + infoPtr->ScanlineColorExpandBuffers[0] = + pI810->ScanlineColorExpandBuffers[pI810->nextColorExpandBuf]; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "using color expand buffer %d\n", + pI810->nextColorExpandBuf); + + pI810->nextColorExpandBuf++; +} + +static void +I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask) +{ + I810Ptr pI810 = I810PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n", + fg,bg,rop,planemask); + + /* Fill out register values */ + pI810->BR[13] = (pScrn->displayWidth * pI810->cpp); + pI810->BR[13] |= i810Rop[rop] << 16; + if (bg == -1) pI810->BR[13] |= (1<<29); + + switch (pScrn->bitsPerPixel) { + case 8: break; + case 16: pI810->BR[13] |= (1<<24); break; + case 32: pI810->BR[13] |= ((1<<25)|(1<<24)); break; + } + + pI810->BR[18] = bg; + pI810->BR[19] = fg; + + I830GetNextScanlineColorExpandBuffer( pScrn ); +} + +static void +I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, + int skipleft) +{ + I810Ptr pI810 = I810PTR(pScrn); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF("I830SubsequentScanlineCPUToScreenColorExpandFill " + "%d,%d %dx%x %d\n", + x,y,w,h,skipleft); + + /* Fill out register values */ + pI810->BR[9] = (pI810->bufferOffset + + (y * pScrn->displayWidth + x) * pI810->cpp); + pI810->BR[11] = ((1 << 16) | w); +} + +static void +I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + I810Ptr pI810 = I810PTR(pScrn); + + pI810->BR[12] = (pI810->AccelInfoRec->ScanlineColorExpandBuffers[0] - + pI810->FbBase); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "I830SubsequentColorExpandScanline %d (addr %x)\n", + bufno, + pI810->BR[12]); + + { + BEGIN_LP_RING( 8 ); + + if(pScrn->bitsPerPixel == 32) { + OUT_RING(XY_MONO_SRC_BLT_CMD | XY_MONO_SRC_BLT_WRITE_ALPHA | + XY_MONO_SRC_BLT_WRITE_RGB); + } else { + OUT_RING(XY_MONO_SRC_BLT_CMD); + } + OUT_RING(pI810->BR[13]); + OUT_RING(0); /* x1 = 0, y1 = 0 */ + OUT_RING(pI810->BR[11]); /* x2 = w, y2 = 1 */ + OUT_RING(pI810->BR[9]); /* dst addr */ + OUT_RING(pI810->BR[12]); /* src addr */ + OUT_RING( pI810->BR[18]); /* bg */ + OUT_RING( pI810->BR[19]); /* fg */ + + ADVANCE_LP_RING(); + } + + /* Advance to next scanline. + */ + pI810->BR[9] += pScrn->displayWidth * pI810->cpp; + I830GetNextScanlineColorExpandBuffer( pScrn ); } Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c:1.2 Tue Feb 22 23:47:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c Wed Oct 10 10:08:36 2001 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c,v 1.2 2000/02/23 04:47:15 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c,v 1.4 2001/10/10 14:08:36 alanh Exp $ */ /* * Authors: @@ -48,8 +48,6 @@ static void I810SetCursorColors(ScrnInfoPtr pScrn, int bg, int fb); static Bool I810UseHWCursor(ScreenPtr pScrn, CursorPtr pCurs); - - Bool I810CursorInit(ScreenPtr pScreen) { @@ -69,7 +67,8 @@ HARDWARE_CURSOR_INVERT_MASK | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64); + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | + 0); infoPtr->SetCursorColors = I810SetCursorColors; infoPtr->SetCursorPosition = I810SetCursorPosition; @@ -89,9 +88,6 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I810Ptr pI810 = I810PTR(pScrn); -/* if (pScrn->currentMode->Flags&V_DBLSCAN) */ -/* return FALSE; */ - if (!pI810->CursorPhysical) return FALSE; return TRUE; } @@ -101,88 +97,148 @@ I810Ptr pI810 = I810PTR(pScrn); CARD8 *pcurs = (CARD8 *)(pI810->FbBase + pI810->CursorStart); int x, y; - + for (y = 0; y < 64; y++) { for (x = 0; x < 64 / 4; x++) { *pcurs++ = *src++; } } } - -void -I810SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { - I810Ptr pI810 = I810PTR(pScrn); - int flag; - if (I810_DEBUG & DEBUG_VERBOSE_CURSOR) - ErrorF( "I810SetCursorPosition %d %d\n", x, y); +#define CURACNTR 0x70080 +#define CURSORA_DISABLE 0 +#define CURSORA_MODE_64_3C (1<<2) +#define CURSORA_MODE_64_AND_XOR ((1<<2)|(1)) +#define CURSORA_MODE_64_4C ((1<<2)|(1<<1)) +#define CURSORA_MODE_64_32BPP_AND_XOR ((1<<2)|(1<<1)|(1)) +#define CURSORA_MODE_64_32BPP_ARGB ((1<<5)|(1<<2)|(1<<1)|(1)) +#define CURSORA_RESERVED ((1<<31)|(1<<30)|(1<<29)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|(1<<7)|(1<<6)|(1<<4)) +#define CURABASE 0x70084 - x += pI810->CursorOffset; - - if (x >= 0) flag = CURSOR_X_POS; - else { - flag = CURSOR_X_NEG; - x=-x; - } +void +I810SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + I810Ptr pI810 = I810PTR(pScrn); + int flag; - OUTREG8( CURSOR_X_LO, x&0xFF); - OUTREG8( CURSOR_X_HI, (((x >> 8) & 0x07) | flag)); +#if 0 + DPRINTF (PFX, + "%s %d %d\n" + "--> CURACNTR == 0x%.8x\n" + "--> CURBCNTR == 0x%.8x\n", + __FUNCTION__,x,y, + INREG (0x70080), + INREG (0x700C0)); +#endif + /* FIXME: hack to get around disappearing cursor problems. + * don't know why this work though. */ + if (IS_I830 (pI810)) + { + INREG (0x70080); + INREG (0x700C0); + } + + x += pI810->CursorOffset; + + if (x >= 0) flag = CURSOR_X_POS; + else { + flag = CURSOR_X_NEG; + x=-x; + } + + OUTREG8( CURSOR_X_LO, x&0xFF); + OUTREG8( CURSOR_X_HI, (((x >> 8) & 0x07) | flag)); + + if (y >= 0) flag = CURSOR_Y_POS; + else { + flag = CURSOR_Y_NEG; + y=-y; + } + OUTREG8( CURSOR_Y_LO, y&0xFF); + OUTREG8( CURSOR_Y_HI, (((y >> 8) & 0x07) | flag)); - if (y >= 0) flag = CURSOR_Y_POS; - else { - flag = CURSOR_Y_NEG; - y=-y; - } - OUTREG8( CURSOR_Y_LO, y&0xFF); - OUTREG8( CURSOR_Y_HI, (((y >> 8) & 0x07) | flag)); + /* FIXME */ + OUTREG(CURABASE, pI810->CursorPhysical); } static void -I810ShowCursor(ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR(pScrn); - unsigned char tmp; - - OUTREG( CURSOR_BASEADDR, pI810->CursorPhysical); - OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C); +I810ShowCursor(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); + unsigned char tmp; + CARD32 temp; - tmp = INREG8( PIXPIPE_CONFIG_0 ); - tmp |= HW_CURSOR_ENABLE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); + if(IS_I830(pI810)) { + temp = INREG(CURACNTR); + temp &= CURSORA_RESERVED; + temp |= CURSORA_MODE_64_AND_XOR; + OUTREG(CURACNTR, temp); + OUTREG(CURABASE, pI810->CursorPhysical); + } else { + OUTREG( CURSOR_BASEADDR, pI810->CursorPhysical); + OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C); + + tmp = INREG8( PIXPIPE_CONFIG_0 ); + tmp |= HW_CURSOR_ENABLE; + OUTREG8( PIXPIPE_CONFIG_0, tmp); + } } static void -I810HideCursor(ScrnInfoPtr pScrn) { - unsigned char tmp; - I810Ptr pI810 = I810PTR(pScrn); +I810HideCursor(ScrnInfoPtr pScrn) +{ + unsigned char tmp; + CARD32 temp; + I810Ptr pI810 = I810PTR(pScrn); - tmp=INREG8( PIXPIPE_CONFIG_0 ); - tmp &= ~HW_CURSOR_ENABLE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); -} + if(IS_I830(pI810)) { + temp = INREG(CURACNTR); + temp &= CURSORA_RESERVED; + temp |= CURSORA_DISABLE; + OUTREG(CURACNTR, temp); + OUTREG(CURABASE, pI810->CursorPhysical); + } else { + tmp=INREG8( PIXPIPE_CONFIG_0 ); + tmp &= ~HW_CURSOR_ENABLE; + OUTREG8( PIXPIPE_CONFIG_0, tmp); + } +} + +#define CURAPALET0 0x70090 +#define CURAPALET1 0x70094 +#define CURAPALET2 0x70098 +#define CURAPALET3 0x7009c static void -I810SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { - int tmp; - I810Ptr pI810 = I810PTR(pScrn); +I810SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) +{ + int tmp; + I810Ptr pI810 = I810PTR(pScrn); - tmp=INREG8(PIXPIPE_CONFIG_0); - tmp |= EXTENDED_PALETTE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); - - pI810->writeStandard(pI810, DACMASK, 0xFF); - pI810->writeStandard(pI810, DACWX, 0x04); - - pI810->writeStandard(pI810, DACDATA, (bg & 0x00FF0000) >> 16); - pI810->writeStandard(pI810, DACDATA, (bg & 0x0000FF00) >> 8); - pI810->writeStandard(pI810, DACDATA, (bg & 0x000000FF)); - - pI810->writeStandard(pI810, DACDATA, (fg & 0x00FF0000) >> 16); - pI810->writeStandard(pI810, DACDATA, (fg & 0x0000FF00) >> 8); - pI810->writeStandard(pI810, DACDATA, (fg & 0x000000FF)); - - tmp=INREG8( PIXPIPE_CONFIG_0 ); - tmp &= ~EXTENDED_PALETTE; - OUTREG8( PIXPIPE_CONFIG_0, tmp ); + if(IS_I830(pI810)) { + OUTREG(CURAPALET0, bg & 0x00ffffff); + OUTREG(CURAPALET1, fg & 0x00ffffff); + OUTREG(CURAPALET2, fg & 0x00ffffff); + OUTREG(CURAPALET3, bg & 0x00ffffff); + } else { + tmp=INREG8(PIXPIPE_CONFIG_0); + tmp |= EXTENDED_PALETTE; + OUTREG8( PIXPIPE_CONFIG_0, tmp); + + pI810->writeStandard(pI810, DACMASK, 0xFF); + pI810->writeStandard(pI810, DACWX, 0x04); + + pI810->writeStandard(pI810, DACDATA, (bg & 0x00FF0000) >> 16); + pI810->writeStandard(pI810, DACDATA, (bg & 0x0000FF00) >> 8); + pI810->writeStandard(pI810, DACDATA, (bg & 0x000000FF)); + + pI810->writeStandard(pI810, DACDATA, (fg & 0x00FF0000) >> 16); + pI810->writeStandard(pI810, DACDATA, (fg & 0x0000FF00) >> 8); + pI810->writeStandard(pI810, DACDATA, (fg & 0x000000FF)); + + tmp=INREG8( PIXPIPE_CONFIG_0 ); + tmp &= ~EXTENDED_PALETTE; + OUTREG8( PIXPIPE_CONFIG_0, tmp ); + } } - Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c:1.2 Sun Sep 17 19:18:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c Wed Oct 10 10:08:37 2001 @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c,v 1.2 2000/09/17 23:18:19 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c,v 1.4 2001/10/10 14:08:37 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -43,8 +43,10 @@ static void I810_SetViewport(ScrnInfoPtr, int, int, int); static void I810_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void I810_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +#if 0 static void I810_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); +#endif static DGAFunctionRec I810DGAFuncs = { @@ -73,6 +75,8 @@ int Bpp = pScrn->bitsPerPixel >> 3; int num = 0; + MARKER(); + pMode = firstMode = pScrn->modes; while(pMode) { @@ -145,20 +149,24 @@ int index = pScrn->pScreen->myNum; I810Ptr pI810 = I810PTR(pScrn); + MARKER(); + if(!pMode) { /* restore the original mode */ + DPRINTF (PFX,"Restoring original mode (from DGA mode)\n"); if(pI810->DGAactive) { pScrn->currentMode = I810SavedDGAModes[index]; - I810SwitchMode(index, pScrn->currentMode, 0); - I810AdjustFrame(index, 0, 0, 0); + pScrn->SwitchMode(index, pScrn->currentMode, 0); + pScrn->AdjustFrame(index, 0, 0, 0); pI810->DGAactive = FALSE; } } else { if(!pI810->DGAactive) { + DPRINTF (PFX,"Setting DGA mode\n"); I810SavedDGAModes[index] = pScrn->currentMode; pI810->DGAactive = TRUE; } - I810SwitchMode(index, pMode->mode, 0); + pScrn->SwitchMode(index, pMode->mode, 0); } return TRUE; @@ -170,6 +178,8 @@ ){ I810Ptr pI810 = I810PTR(pScrn); + MARKER(); + return pI810->DGAViewportStatus; } @@ -182,8 +192,10 @@ I810Ptr pI810 = I810PTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - I810AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + MARKER(); + pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + /* wait for retrace */ while((hwp->readST01(hwp) & 0x08)); while(!(hwp->readST01(hwp) & 0x08)); @@ -199,6 +211,8 @@ ){ I810Ptr pI810 = I810PTR(pScrn); + MARKER(); + if(pI810->AccelInfoRec) { (*pI810->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); (*pI810->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); @@ -212,6 +226,8 @@ ){ I810Ptr pI810 = I810PTR(pScrn); + MARKER(); + if(pI810->AccelInfoRec) { (*pI810->AccelInfoRec->Sync)(pScrn); } @@ -226,6 +242,8 @@ ){ I810Ptr pI810 = I810PTR(pScrn); + MARKER(); + if(pI810->AccelInfoRec) { int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; int ydir = (srcy < dsty) ? -1 : 1; @@ -238,7 +256,7 @@ } } - +#if 0 static void I810_BlitTransRect( ScrnInfoPtr pScrn, @@ -247,10 +265,13 @@ int dstx, int dsty, unsigned long color ){ + + MARKER(); + /* this one should be separate since the XAA function would prohibit usage of ~0 as the key */ } - +#endif static Bool I810_OpenFramebuffer( @@ -263,11 +284,18 @@ ){ I810Ptr pI810 = I810PTR(pScrn); + MARKER(); + *name = NULL; /* no special device */ *mem = (unsigned char*)pI810->LinearAddr; *size = pI810->FbMapSize; *offset = 0; *flags = DGA_NEED_ROOT; + + DPRINTF (PFX, + " mem == 0x%.8x (pI810->LinearAddr)\n" + "size == %lu (pI810->FbMapSize)\n", + *mem,*size); return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.21 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.21 Fri May 18 20:26:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c Fri Dec 21 16:04:36 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.21 2001/05/19 00:26:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.25 2001/12/21 21:04:36 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -82,6 +82,8 @@ info.front_offset = 0; info.back_offset = pI810->BackBuffer.Start; info.depth_offset = pI810->DepthBuffer.Start; + info.overlay_offset = pI810->OverlayStart; + info.overlay_physical = pI810->OverlayPhysical; info.w = pScrn->virtualX; info.h = pScrn->virtualY; info.pitch = pI810->auxPitch; @@ -337,11 +339,11 @@ drmVersionPtr version = drmGetVersion(pI810->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor < 1) { + version->version_minor < 2) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "[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] i810.o kernel module version is %d.%d.%d but version 1.2 or greater is needed.\n" "[dri] Disabling DRI.\n", version->version_major, version->version_minor, @@ -367,6 +369,7 @@ pI810->backHandle = 0; pI810->zHandle = 0; pI810->cursorHandle = 0; + pI810->xvmcHandle = 0; pI810->sysmemHandle = 0; pI810->agpAcquired = FALSE; pI810->dcacheHandle = 0; @@ -431,6 +434,26 @@ sysmem_size = sysmem_size - 2*back_size; } + /* Max size is 48 without XvMC, 41 with 6 surfaces, 40 with 7 surfaces */ + if(pI810->numSurfaces && (pI810->numSurfaces == 6)) { + if(sysmem_size > (pI810->FbMapSize - 7*1024*1024)) { + sysmem_size = (pI810->FbMapSize - 7*1024*1024); + 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); + } + } + if(pI810->numSurfaces && (pI810->numSurfaces == 7)) { + if(sysmem_size > (pI810->FbMapSize - 8*1024*1024)) { + sysmem_size = (pI810->FbMapSize - 8*1024*1024); + 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); + } + } + if(sysmem_size > pI810->FbMapSize) { sysmem_size = pI810->FbMapSize; @@ -543,6 +566,55 @@ return FALSE; } +/* Allocate 7 or 8MB for XvMC this is setup as follows to best use tiled + regions and required surface pitches. (Numbers are adjusted if the + AGP region is only 32MB + For numSurfaces == 6 + 44 - 48MB = 4MB Fence, 8 Tiles wide + 43 - 44MB = 1MB Fence, 8 Tiles wide + 42 - 43MB = 1MB Fence, 4 Tiles wide + 41 - 42MB = 1MB Fence, 4 Tiles wide + For numSurfaces == 7 + 44 - 48MB = 4MB Fence, 8 Tiles wide + 43 - 44MB = 1MB Fence, 8 Tiles wide + 42.5 - 43MB = 0.5MB Fence, 8 Tiles wide + 42 - 42.5MB = 0.5MB Fence, 4 Tiles wide + 40 - 42MB = 2MB Fence, 4 Tiles wide + */ + if(pI810->numSurfaces) { + if(pI810->numSurfaces == 6) { + pI810->MC.Size = 7*1024*1024; + pI810->MC.Start = pI810->FbMapSize - 7*1024*1024; + + } + if(pI810->numSurfaces == 7) { + pI810->MC.Size = 8*1024*1024; + pI810->MC.Start = pI810->FbMapSize - 8*1024*1024; + } + drmAgpAlloc(pI810->drmSubFD, pI810->MC.Size, 0, NULL, &agpHandle); + pI810->xvmcHandle = agpHandle; + + if (agpHandle != 0) { + if (drmAgpBind(pI810->drmSubFD, agpHandle, pI810->MC.Start) == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "GART: Allocated 7MB for HWMC\n"); + pI810->MC.End = pI810->MC.Start + pI810->MC.Size; + } + else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: HWMC bind failed\n"); + pI810->MC.Start = 0; + pI810->MC.Size = 0; + pI810->MC.End = 0; + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: HWMC alloc failed\n"); + pI810->MC.Start = 0; + pI810->MC.Size = 0; + pI810->MC.End = 0; + } + pI810->xvmcContext = 0; + } + drmAgpAlloc(pI810->drmSubFD, 4096, 2, (unsigned long *)&pI810->CursorPhysical, &agpHandle); pI810->cursorHandle = agpHandle; @@ -566,13 +638,11 @@ pI810->CursorPhysical = 0; } - /* Steal some of the excess cursor space for the overlay regs, - * then allocate 202*2 pages for the overlay buffers. + /* Steal some of the excess cursor space for the overlay regs. */ pI810->OverlayPhysical = pI810->CursorPhysical + 1024; pI810->OverlayStart = pI810->CursorStart + 1024; - /* drmAddMap happens later to preserve index order */ @@ -586,6 +656,57 @@ i810_pitches[pitch_idx], 8*1024*1024); + + /* These are for HWMC surfaces */ + if(pI810->numSurfaces == 6) { + I810SetTiledMemory(pScrn, 3, + pI810->MC.Start, + 512, + 1024*1024); + + I810SetTiledMemory(pScrn, 4, + pI810->MC.Start + 1024*1024, + 512, + 1024*1024); + + I810SetTiledMemory(pScrn, 5, + pI810->MC.Start + 1024*1024*2, + 1024, + 1024*1024); + + I810SetTiledMemory(pScrn, 6, + pI810->MC.Start + 1024*1024*3, + 1024, + 4*1024*1024); + } + if(pI810->numSurfaces == 7) { + I810SetTiledMemory(pScrn, 3, + pI810->MC.Start, + 512, + 2*1024*1024); + + I810SetTiledMemory(pScrn, 4, + pI810->MC.Start + 2*1024*1024, + 512, + 512*1024); + + I810SetTiledMemory(pScrn, 5, + pI810->MC.Start + 2*1024*1024 + 512*1024, + 1024, + 512*1024); + + I810SetTiledMemory(pScrn, 6, + pI810->MC.Start + 3*1024*1024, + 1024, + 1*1024*1024); + + I810SetTiledMemory(pScrn, 7, + pI810->MC.Start + 4*1024*1024, + 1024, + 4*1024*1024); + + } + pI810->auxPitch = i810_pitches[pitch_idx]; pI810->auxPitchBits = i810_pitch_flags[pitch_idx]; pI810->SavedDcacheMem = pI810->DcacheMem; @@ -774,6 +895,7 @@ if(pI810->backHandle) drmAgpFree(pI810->drmSubFD, pI810->backHandle); if(pI810->zHandle) drmAgpFree(pI810->drmSubFD, pI810->zHandle); if(pI810->cursorHandle) drmAgpFree(pI810->drmSubFD, pI810->cursorHandle); + if(pI810->xvmcHandle) drmAgpFree(pI810->drmSubFD, pI810->xvmcHandle); if(pI810->sysmemHandle) drmAgpFree(pI810->drmSubFD, pI810->sysmemHandle); if(pI810->agpAcquired == TRUE) drmAgpRelease(pI810->drmSubFD); @@ -781,6 +903,7 @@ pI810->backHandle = 0; pI810->zHandle = 0; pI810->cursorHandle = 0; + pI810->xvmcHandle = 0; pI810->sysmemHandle = 0; pI810->agpAcquired = FALSE; pI810->dcacheHandle = 0; @@ -835,8 +958,6 @@ oldContextType == DRI_2D_CONTEXT && newContextType == DRI_2D_CONTEXT) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("I810DRISwapContext (in)\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.5 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h:1.5 Wed Mar 21 12:02:23 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h Thu Oct 4 14:28:21 2001 @@ -1,10 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.5 2001/03/21 17:02:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.6 2001/10/04 18:28:21 alanh Exp $ */ #ifndef _I810_DRI_ #define _I810_DRI_ -#include "xf86drm.h" -#include "xf86drmI810.h" +#include <xf86drm.h> +#include <xf86drmI810.h> #define I810_MAX_DRAWABLES 256 Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c diff -u 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.65 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c:1.49.2.1 Wed May 23 16:21:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Wed Jan 9 11:02:29 2002 @@ -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.49.2.1 2001/05/23 20:21:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.65 2002/01/09 16:02:29 dawes Exp $ */ /* * Authors: @@ -71,7 +71,6 @@ /* Required Functions: */ static void I810Identify(int flags); -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); @@ -102,7 +101,8 @@ { PCI_CHIP_I810, "i810"}, { PCI_CHIP_I810_DC100, "i810-dc100"}, { PCI_CHIP_I810_E, "i810e"}, - { PCI_CHIP_I815, "i815"}, + { PCI_CHIP_I815, "i815"}, + { PCI_CHIP_I830_M, "i830M"}, { -1, NULL } }; @@ -110,20 +110,11 @@ { PCI_CHIP_I810, PCI_CHIP_I810, RES_SHARED_VGA }, { PCI_CHIP_I810_DC100, PCI_CHIP_I810_DC100, RES_SHARED_VGA }, { PCI_CHIP_I810_E, PCI_CHIP_I810_E, RES_SHARED_VGA }, - { PCI_CHIP_I815, PCI_CHIP_I815, RES_SHARED_VGA }, + { PCI_CHIP_I815, PCI_CHIP_I815, RES_SHARED_VGA }, + { PCI_CHIP_I830_M, PCI_CHIP_I830_M, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; -typedef enum { - OPTION_NOACCEL, - OPTION_SW_CURSOR, - OPTION_COLOR_KEY, - OPTION_CACHE_LINES, - OPTION_DAC_6BIT, - OPTION_DRI, - OPTION_NO_DDC -} I810Opts; - static const OptionInfoRec I810Options[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, @@ -132,105 +123,118 @@ { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE}, { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, { OPTION_NO_DDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_XVMC_SURFACES, "XvMCSurfaces", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE} }; -static const char *vgahwSymbols[] = { +const char *I810vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWSave", - "vgaHWRestore", - "vgaHWProtect", + "vgaHWGetIOBase", + "vgaHWGetIndex", + "vgaHWHandleColormaps", "vgaHWInit", + "vgaHWLock", "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", + "vgaHWSaveScreen", "vgaHWSetMmioFuncs", - "vgaHWGetIOBase", - "vgaHWLock", "vgaHWUnlock", - "vgaHWFreeHWRec", - "vgaHWSaveScreen", - "vgaHWHandleColormaps", - 0 -}; - -static const char *fbSymbols[] = { - "fbScreenInit", + "vgaHWUnmapMem", NULL }; -static const char *miscSymbols[] = { - "GetTimeInMillis", +const char *I810fbSymbols[] = { + "fbPictureInit", + "fbScreenInit", NULL }; -static const char *vbeSymbols[] = { +const char *I810vbeSymbols[] = { "VBEInit", "vbeDoEDID", "vbeFree", NULL }; -static const char *ddcSymbols[] = { +const char *I810ddcSymbols[] = { "xf86PrintEDID", "xf86SetDDCproperties", NULL }; -static const char *xaaSymbols[] = { - "XAADestroyInfoRec", +const char *I810int10Symbols[] = { + "xf86ExecX86int10", + "xf86InitInt10", + "xf86Int10AllocPages", + "xf86int10Addr", + NULL +}; + +const char *I810xaaSymbols[] = { + "XAACachePlanarMonoStipple", "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAFillSolidRects" "XAAInit", - "XAAStippleScanlineFuncLSBFirst", "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", "XAAScreenIndex", + "XAAStippleScanlineFuncLSBFirst", NULL }; -static const char *ramdacSymbols[] = { - "xf86InitCursor", +const char *I810ramdacSymbols[] = { "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; +#ifdef XFree86LOADER #ifdef XF86DRI static const char *drmSymbols[] = { - "drmAvailable", "drmAddBufs", "drmAddMap", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", "drmAgpAcquire", - "drmAgpRelease", - "drmAgpEnable", "drmAgpAlloc", - "drmAgpFree", "drmAgpBind", - "drmI810CleanupDma", - "drmI810InitDma", + "drmAgpEnable", + "drmAgpFree", + "drmAgpRelease", + "drmAvailable", + "drmAuthMagic", + "drmCreateContext", + "drmCtlInstHandler", + "drmDestroyContext", "drmFreeVersion", + "drmGetInterruptFromBusID", "drmGetVersion", + "drmI810CleanupDma", + "drmI810InitDma", + "drmI830CleanupDma", + "drmI830InitDma", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", - "DRILock", - "DRIUnlock", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", + "DRIGetContext", + "DRIGetDrawableIndex", "DRIGetSAREAPrivate", - "DRIGetContext", + "DRILock", "DRIQueryVersion", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; #endif +#endif #ifndef I810_DEBUG @@ -291,20 +295,17 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(vgahwSymbols, - fbSymbols, - xaaSymbols, - ramdacSymbols, - miscSymbols, + LoaderRefSymLists(I810vgahwSymbols, + I810fbSymbols, + I810xaaSymbols, + I810ramdacSymbols, #ifdef XF86DRI drmSymbols, driSymbols, #endif - vbeSymbols, - ddcSymbols, - NULL /* i2csymbols */, - NULL /* shadowSymbols */, - NULL /* fbdevsymbols */, + I810vbeSymbols, + I810ddcSymbols, + I810int10Symbols, NULL); /* @@ -355,9 +356,11 @@ xf86PrintChipsets(I810_NAME, "Driver for Intel i810 chipset", I810Chipsets); } -static const OptionInfoRec * +const OptionInfoRec * I810AvailableOptions(int chipid, int busid) { + const OptionInfoRec *pOptions; + if ((pOptions = I830BIOSAvailableOptions (chipid,busid))) return pOptions; return I810Options; } /* @@ -402,20 +405,40 @@ /* Allocate new ScrnInfoRec and claim the slot */ if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], I810PciChipsets, 0, 0, 0, 0, 0))){ - pScrn->driverVersion = I810_VERSION; - pScrn->driverName = I810_DRIVER_NAME; - pScrn->name = I810_NAME; - pScrn->Probe = I810Probe; - pScrn->PreInit = I810PreInit; - pScrn->ScreenInit = I810ScreenInit; - pScrn->SwitchMode = I810SwitchMode; - pScrn->AdjustFrame = I810AdjustFrame; - pScrn->EnterVT = I810EnterVT; - pScrn->LeaveVT = I810LeaveVT; - pScrn->FreeScreen = I810FreeScreen; - pScrn->ValidMode = I810ValidMode; - foundScreen = TRUE; - } + EntityInfoPtr pEnt; + + pEnt = xf86GetEntityInfo(usedChips[i]); + + if (pEnt->chipset == PCI_CHIP_I830_M) { + pScrn->driverVersion = I810_VERSION; + pScrn->driverName = I810_DRIVER_NAME; + pScrn->name = I810_NAME; + pScrn->Probe = I810Probe; + pScrn->PreInit = I830BIOSPreInit; + pScrn->ScreenInit = I830BIOSScreenInit; + pScrn->SwitchMode = I830BIOSSwitchMode; + pScrn->AdjustFrame = I830BIOSAdjustFrame; + pScrn->EnterVT = I830BIOSEnterVT; + pScrn->LeaveVT = I830BIOSLeaveVT; + pScrn->FreeScreen = I830BIOSFreeScreen; + pScrn->ValidMode = I810ValidMode; + foundScreen = TRUE; + } else { + pScrn->driverVersion = I810_VERSION; + pScrn->driverName = I810_DRIVER_NAME; + pScrn->name = I810_NAME; + pScrn->Probe = I810Probe; + pScrn->PreInit = I810PreInit; + pScrn->ScreenInit = I810ScreenInit; + pScrn->SwitchMode = I810SwitchMode; + pScrn->AdjustFrame = I810AdjustFrame; + pScrn->EnterVT = I810EnterVT; + pScrn->LeaveVT = I810LeaveVT; + pScrn->FreeScreen = I810FreeScreen; + pScrn->ValidMode = I810ValidMode; + foundScreen = TRUE; + } + } } xfree(usedChips); @@ -431,6 +454,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -447,6 +471,7 @@ } if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL,index))) { + xf86LoaderReqSymLists(I810vbeSymbols, NULL); MonInfo = vbeDoEDID(pVbe, NULL); xf86PrintEDID( MonInfo ); xf86SetDDCproperties(pScrn, MonInfo); @@ -494,7 +519,7 @@ /* The vgahw module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; - xf86LoaderReqSymLists(vgahwSymbols, NULL); + xf86LoaderReqSymLists(I810vgahwSymbols, NULL); /* Allocate a vgaHWRec */ if (!vgaHWGetHWRec(pScrn)) return FALSE; @@ -547,7 +572,7 @@ if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; hwp = VGAHWPTR(pScrn); @@ -642,6 +667,15 @@ xf86DrvMsg(pScrn->scrnIndex, from, "IO registers at addr 0x%lX\n", (unsigned long)pI810->MMIOAddr); + /* AGP GART support is required. Don't proceed any further if it isn't + * present. + */ + if (!xf86AgpGARTSupported()) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "AGP GART support is not available. Make sure your kernel has\n" + "\tagpgart support or that the agpgart kernel module is loaded.\n"); + return FALSE; + } /* Find out memory bus frequency. */ @@ -801,13 +835,14 @@ I810FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); + xf86LoaderReqSymLists(I810fbSymbols, NULL); if (!xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) { I810FreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(I810xaaSymbols, NULL); } if (!xf86ReturnOptValBool(pI810->Options, OPTION_SW_CURSOR, FALSE)) { @@ -815,7 +850,7 @@ I810FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(ramdacSymbols, NULL); + xf86LoaderReqSymLists(I810ramdacSymbols, NULL); } if (xf86GetOptValInteger(pI810->Options, OPTION_COLOR_KEY, &(pI810->colorKey))) @@ -828,6 +863,29 @@ (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); } + + if (xf86GetOptValInteger(pI810->Options, OPTION_XVMC_SURFACES, + &(pI810->numSurfaces))) + { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "%d XvMC Surfaces Requested.\n", + pI810->numSurfaces); + if(pI810->numSurfaces > 7) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Using 7 XvMC Surfaces (Maximum Allowed).\n"); + pI810->numSurfaces = 7; + } + if(pI810->numSurfaces < 6) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Using 6 XvMC Surfaces (Minimum Allowed).\n"); + pI810->numSurfaces = 6; + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "XvMC is Disabled: use XvMCSurfaces config option to enable.\n"); + pI810->numSurfaces = 0; + } + + /* We wont be using the VGA access after the probe */ { resRange vgaio[] = { {ResShrIoBlock,0x3B0,0x3BB}, @@ -868,7 +926,7 @@ -static Bool +Bool I810MapMem(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); @@ -891,7 +949,7 @@ return TRUE; } -static Bool +Bool I810UnmapMem(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); @@ -969,9 +1027,9 @@ * in the generic VGA portion. */ if (saveFonts) - vgaHWSave(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_FONTS); + vgaHWSave(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_FONTS|VGA_SR_CMAP); else - vgaHWSave(pScrn, vgaReg, VGA_SR_MODE); + vgaHWSave(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_CMAP); /* * The port I/O code necessary to read in the extended registers @@ -1019,10 +1077,15 @@ { vgaHWPtr hwp; I810Ptr pI810; - + CARD32 temp; + hwp = VGAHWPTR(pScrn); pI810 = I810PTR(pScrn); DoSave(pScrn, &hwp->SavedReg, &pI810->SavedReg, TRUE); + + temp = INREG(MEMMODE); + temp |= 4; + OUTREG(MEMMODE, temp); } @@ -1153,9 +1216,9 @@ * restore clock-select bits. */ if (restoreFonts) - vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS|VGA_SR_MODE); + vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS|VGA_SR_MODE|VGA_SR_CMAP); else - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_CMAP); hwp->writeCrtc(hwp, EXT_VERT_TOTAL, i810Reg->ExtVertTotal); hwp->writeCrtc(hwp, EXT_VERT_DISPLAY, i810Reg->ExtVertDispEnd); @@ -1258,9 +1321,9 @@ if (!(vgaReg->Attribute[0x10] & 0x1)) { usleep(50000); if (restoreFonts) - vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS|VGA_SR_MODE); + vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS|VGA_SR_MODE|VGA_SR_CMAP); else - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_CMAP); } vgaHWProtect(pScrn, FALSE); @@ -1272,7 +1335,7 @@ } -static void +void I810SetRingRegs( ScrnInfoPtr pScrn ) { unsigned int itemp; I810Ptr pI810 = I810PTR(pScrn); @@ -1286,7 +1349,11 @@ OUTREG(LP_RING + RING_START, itemp ); itemp = INREG(LP_RING + RING_LEN); - itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); + if (IS_I830 (pI810)) { + itemp &= ~(I830_RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); + } else { + itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); + } itemp |= ((pI810->LpRing.mem.Size-4096) | RING_NO_REPORT | RING_VALID); OUTREG(LP_RING + RING_LEN, itemp ); } @@ -1358,7 +1425,7 @@ i810Reg->VideoClk2_N = (n_best-2) & 0x3FF; i810Reg->VideoClk2_DivisorSel = (p_best << 4); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting dot clock to %.1lf MHz " + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting dot clock to %.1lf MHz " "[ 0x%x 0x%x 0x%x ] " "[ %d %d %d ]\n", CALC_VCLK(m_best,n_best,p_best), @@ -1719,27 +1786,46 @@ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Framebuffer allocation failed\n"); return FALSE; - } + } else + DPRINTF (PFX, + "Frame buffer at 0x%.8x (%luk, %lu bytes)\n", + pI810->FrontBuffer.Start, + pI810->FrontBuffer.Size / 1024, + pI810->FrontBuffer.Size); memset( &(pI810->LpRing), 0, sizeof( I810RingBuffer ) ); if(I810AllocLow( &(pI810->LpRing.mem), &(pI810->SysMem), 16*4096 )) { - if (I810_DEBUG & DEBUG_VERBOSE_MEMORY) - ErrorF( "ring buffer at local %lx\n", - pI810->LpRing.mem.Start); + DPRINTF (PFX, + "Ring buffer at 0x%.8x (%luk, %lu bytes)\n", + pI810->LpRing.mem.Start, + pI810->LpRing.mem.Size / 1024, + pI810->LpRing.mem.Size); pI810->LpRing.tail_mask = pI810->LpRing.mem.Size - 1; pI810->LpRing.virtual_start = pI810->FbBase + pI810->LpRing.mem.Start; pI810->LpRing.head = 0; pI810->LpRing.tail = 0; pI810->LpRing.space = 0; + } else { + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Ring buffer allocation failed\n"); + return (FALSE); } - + if ( I810AllocLow( &pI810->Scratch, &(pI810->SysMem), 64*1024 ) || I810AllocLow( &pI810->Scratch, &(pI810->SysMem), 16*1024 ) ) { + DPRINTF (PFX, + "Scratch memory at 0x%.8x (%luk, %lu bytes)\n", + pI810->Scratch.Start, + pI810->Scratch.Size / 1024, + pI810->Scratch.Size); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Allocated Scratch Memory\n"); + } else { + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Scratch memory allocation failed\n"); + return (FALSE); } - + pI810->DoneFrontAlloc = TRUE; return TRUE; } @@ -1927,6 +2013,12 @@ */ pI810->directRenderingEnabled = I810DRIFinishScreenInit(pScreen); } +#ifdef XvMCExtension + if (pI810->directRenderingEnabled) { + /* Initialize the hardware motion compensation code */ + I810InitMC(pScreen); + } +#endif #endif if (pI810->directRenderingEnabled) { Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_drm.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_drm.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_drm.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_drm.c:1.1 Thu Mar 2 11:07:50 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_drm.c Fri Jan 18 15:25:26 2002 @@ -1,59 +0,0 @@ -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86Resources.h" -#include "xf86_ansic.h" -#include "compiler.h" -#include "xf86PciInfo.h" -#include "xf86Pci.h" -#include "xf86Priv.h" -#include "i810.h" - -#ifndef XFree86LOADER -#include <sys/stat.h> -#include <sys/mman.h> -#endif - -#include "xf86drm.h" -#include "drm.h" -#include "i810_drm_public.h" - -Bool I810drmCleanupDma(ScrnInfoPtr pScrn) -{ - I810Ptr pI810 = I810PTR(pScrn); - drm_i810_init_t init; - - memset(&init, 0, sizeof(drm_i810_init_t)); - init.func = I810_CLEANUP_DMA; - - if(ioctl(pI810->drmSubFD, DRM_IOCTL_I810_INIT, &init)) { - ErrorF("I810 Dma Cleanup Failed\n"); - return FALSE; - } - - return TRUE; -} - -Bool I810drmInitDma(ScrnInfoPtr pScrn) -{ - I810Ptr pI810 = I810PTR(pScrn); - I810RingBuffer *ring = &(pI810->LpRing); - - drm_i810_init_t init; - - memset(&init, 0, sizeof(drm_i810_init_t)); - init.func = I810_INIT_DMA; - init.ring_map_idx = 6; - init.buffer_map_idx = 5; - init.ring_start = ring->mem.Start; - init.ring_end = ring->mem.End; - init.ring_size = ring->mem.Size; - init.sarea_priv_offset = sizeof(XF86DRISAREARec); - ErrorF("I810 Dma Initialization start\n"); - - if(ioctl(pI810->drmSubFD, DRM_IOCTL_I810_INIT, &init)) { - ErrorF("I810 Dma Initialization Failed\n"); - return FALSE; - } - ErrorF("I810 Dma Initialization done\n"); - return TRUE; -} Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c:1.3 --- /dev/null Fri Jan 18 15:25:26 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c Tue Dec 4 16:17:56 2001 @@ -0,0 +1,417 @@ +/*************************************************************************** + +Copyright 2000 Intel Corporation. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * i810_hwmc.c: i810 HWMC Driver + * + * Authors: + * Matt Sottek <matthew.j.sottek@intel.com> + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c,v 1.3 2001/12/04 21:17:56 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 "i810.h" +#include "i810_dri.h" + +#include "xf86xv.h" +#include "xf86xvmc.h" +#include "Xv.h" +#include "XvMC.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" + +int I810XvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, + int *num_priv, long **priv ); +void I810XvMCDestroyContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext); + +int I810XvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, + int *num_priv, long **priv ); +void I810XvMCDestroySurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf); + +int I810XvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSurf, + int *num_priv, long **priv ); +void I810XvMCDestroySubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSurf); + + +typedef struct { + drmContext drmcontext; + unsigned int fbBase; + unsigned int OverlayOffset; + unsigned int OverlaySize; + unsigned int SurfacesOffset; + unsigned int SurfacesSize; + char busIdString[10]; + char pad[2]; +} I810XvMCCreateContextRec; + + +static int yv12_subpicture_index_list[2] = +{ + FOURCC_IA44, + FOURCC_AI44 +}; + +static XF86MCImageIDList yv12_subpicture_list = +{ + 2, + yv12_subpicture_index_list +}; + +static XF86MCSurfaceInfoRec i810_YV12_mpg2_surface = +{ + FOURCC_YV12, + XVMC_CHROMA_FORMAT_420, + 0, + 720, + 576, + 720, + 576, + XVMC_MPEG_2, + XVMC_OVERLAID_SURFACE | XVMC_SUBPICTURE_INDEPENDENT_SCALING | + XVMC_INTRA_UNSIGNED, + &yv12_subpicture_list +}; + +static XF86MCSurfaceInfoRec i810_YV12_mpg1_surface = +{ + FOURCC_YV12, + XVMC_CHROMA_FORMAT_420, + 0, + 720, + 576, + 720, + 576, + XVMC_MPEG_1, + XVMC_OVERLAID_SURFACE | XVMC_SUBPICTURE_INDEPENDENT_SCALING | + XVMC_INTRA_UNSIGNED, + &yv12_subpicture_list +}; + +static XF86MCSurfaceInfoPtr ppSI[2] = +{ + (XF86MCSurfaceInfoPtr)&i810_YV12_mpg2_surface, + (XF86MCSurfaceInfoPtr)&i810_YV12_mpg1_surface +}; + +/* List of subpicture types that we support */ +static XF86ImageRec ia44_subpicture = XVIMAGE_IA44; +static XF86ImageRec ai44_subpicture = XVIMAGE_AI44; + +static XF86ImagePtr i810_subpicture_list[2] = +{ + (XF86ImagePtr)&ia44_subpicture, + (XF86ImagePtr)&ai44_subpicture +}; + +/* Fill in the device dependent adaptor record. + * This is named "I810 Video Overlay" because this code falls under the + * XV extenstion, the name must match or it won't be used. + * + * Surface and Subpicture - see above + * Function pointers to functions below + */ +static XF86MCAdaptorRec pAdapt = +{ + "I810 Video Overlay", /* name */ + 2, /* num_surfaces */ + ppSI, /* surfaces */ + 2, /* num_subpictures */ + i810_subpicture_list, /* subpictures */ + (xf86XvMCCreateContextProcPtr)I810XvMCCreateContext, + (xf86XvMCDestroyContextProcPtr)I810XvMCDestroyContext, + (xf86XvMCCreateSurfaceProcPtr)I810XvMCCreateSurface, + (xf86XvMCDestroySurfaceProcPtr)I810XvMCDestroySurface, + (xf86XvMCCreateSubpictureProcPtr)I810XvMCCreateSubpicture, + (xf86XvMCDestroySubpictureProcPtr)I810XvMCDestroySubpicture +}; + +static XF86MCAdaptorPtr ppAdapt[1] = +{ + (XF86MCAdaptorPtr)&pAdapt +}; + +/************************************************************************** + * + * I810InitMC + * + * Initialize the hardware motion compenstation extention for this + * hardware. The initialization routines want the address of the pointers + * to the structures, not the address of the structures. This means we + * allocate (or create static?) the pointer memory and pass that + * address. This seems a little convoluted. + * + * We need to allocate memory for the device depended adaptor record. + * This is what holds the pointers to all our device functions. + * + * We need to map the overlay registers into the drm. + * + * We need to map the surfaces into the drm. + * + * Inputs: + * Screen pointer + * + * Outputs: + * None, this calls the device independent screen initialization + * function. + * + * Revisions: + * + **************************************************************************/ +void I810InitMC(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I810Ptr pI810 = I810PTR(pScrn); + int i; + + /* Clear the Surface Allocation */ + for(i=0; i<I810_MAX_SURFACES; i++) { + pI810->surfaceAllocation[i] = 0; + } + + /* Cursor is at a page boundary, Overlay regs are not, don't forget */ + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->CursorStart, + 4096, DRM_AGP, 0, &pI810->overlay_map) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(overlay) failed\n"); + return; + } + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->MC.Start, + pI810->MC.Size, DRM_AGP, 0, &pI810->mc_map) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(MC) failed\n"); + return; + } + xf86XvMCScreenInit(pScreen, 1, ppAdapt); +} + +/************************************************************************** + * + * I810XvMCCreateContext + * + * Some info about the private data: + * + * Set *num_priv to the number of 32bit words that make up the size of + * of the data that priv will point to. + * + * *priv = (long *) xcalloc (elements, sizeof(element)) + * *num_priv = (elements * sizeof(element)) >> 2; + * + **************************************************************************/ + +int I810XvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, + int *num_priv, long **priv ) +{ + I810Ptr pI810 = I810PTR(pScrn); + DRIInfoPtr pDRIInfo = pI810->pDRIInfo; + I810XvMCCreateContextRec *contextRec; + + + if(!pI810->directRenderingEnabled) { + xf86DrvMsg(X_ERROR, pScrn->scrnIndex, + "I810XvMCCreateContext: Cannot use XvMC without DRI!\n"); + return BadAlloc; + } + + /* Context Already in use! */ + if(pI810->xvmcContext) { + xf86DrvMsg(X_WARNING, pScrn->scrnIndex, + "I810XvMCCreateContext: 2 XvMC Contexts Attempted, not supported.\n"); + return BadAlloc; + } + + *priv = xcalloc(1,sizeof(I810XvMCCreateContextRec)); + contextRec = (I810XvMCCreateContextRec *)*priv; + + if(!*priv) { + *num_priv = 0; + return(BadAlloc); + } + + *num_priv = sizeof(I810XvMCCreateContextRec) >> 2; + if(drmCreateContext(pI810->drmSubFD, &(contextRec->drmcontext) ) < 0) { + xf86DrvMsg(X_ERROR, pScrn->scrnIndex, + "I810XvMCCreateContext: Unable to create DRMContext!\n"); + xfree(*priv); + return(BadAlloc); + } + + drmAuthMagic(pI810->drmSubFD, pContext->flags); + + pI810->xvmcContext = contextRec->drmcontext; + contextRec->fbBase = pScrn->memPhysBase; + + /* Overlay Regs are at 1024 offset into the Cursor Space */ + contextRec->OverlayOffset = pI810->CursorStart; + contextRec->OverlaySize = 4096; + + contextRec->SurfacesOffset = pI810->MC.Start; + contextRec->SurfacesSize = pI810->MC.Size; + strncpy (contextRec->busIdString, pDRIInfo->busIdString, 9); + + return Success; +} + + +int I810XvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, + int *num_priv, long **priv ) +{ + I810Ptr pI810 = I810PTR(pScrn); + int i; + + *priv = (long *)xcalloc(2,sizeof(long)); + + if(!*priv) { + xf86DrvMsg(X_ERROR, pScrn->scrnIndex, + "I810XvMCCreateSurface: Unable to allocate memory!\n"); + *num_priv = 0; + return (BadAlloc); + } + *num_priv = 2; + + /* Surface Arrangement is different based on 6 or 7 Surfaces */ + if(pI810->numSurfaces == 6) { + for(i=0; i<pI810->numSurfaces; i++) { + if(!pI810->surfaceAllocation[i]) { + pI810->surfaceAllocation[i] = pSurf->surface_id; + /* Y data starts at 2MB offset, each surface is 576k */ + (*priv)[0] = (2*1024*1024 + 576*1024 * i); + /* UV data starts at 0 offset, each set is 288k */ + (*priv)[1] = (576*512 * i); + return Success; + } + } + } + if(pI810->numSurfaces == 7) { + for(i=0; i<pI810->numSurfaces; i++) { + if(!pI810->surfaceAllocation[i]) { + pI810->surfaceAllocation[i] = pSurf->surface_id; + /* Y data starts at 2.5MB offset, each surface is 576k */ + (*priv)[0] = (2*1024*1024 + 512*1024 + 576*1024 * i); + /* UV data starts at 0 offset, each set is 288k */ + (*priv)[1] = (576*512 * i); + return Success; + } + } + } + (*priv)[0] = 0; + (*priv)[1] = 0; + return BadAlloc; +} + +int I810XvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp, + int *num_priv, long **priv ) +{ + I810Ptr pI810 = I810PTR(pScrn); + int i; + + *priv = (long *)xcalloc(1,sizeof(long)); + + if(!*priv) { + xf86DrvMsg(X_ERROR, pScrn->scrnIndex, + "I810XvMCCreateSubpicture: Unable to allocate memory!\n"); + *num_priv = 0; + return (BadAlloc); + } + *num_priv = 1; + + if(pI810->numSurfaces == 6) { + for(i=6; i<8; i++) { + if(!pI810->surfaceAllocation[i]) { + pI810->surfaceAllocation[i] = pSubp->subpicture_id; + /* Subpictures are after the Y surfaces in memory */ + (*priv)[0] = (2*1024*1024 + 576*1024 * i); + return Success; + } + } + } + if(pI810->numSurfaces == 7) { + for(i=7; i<9; i++) { + if(!pI810->surfaceAllocation[i]) { + pI810->surfaceAllocation[i] = pSubp->subpicture_id; + /* Subpictures are after the Y surfaces in memory */ + (*priv)[0] = (2*1024*1024 + 512*1024 + 576*1024 * i); + return Success; + } + } + } + + (*priv)[0] = 0; + return BadAlloc; +} + +void I810XvMCDestroyContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext) +{ + I810Ptr pI810 = I810PTR(pScrn); + + drmDestroyContext(pI810->drmSubFD,pI810->xvmcContext); + pI810->xvmcContext = 0; +} + +void I810XvMCDestroySurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf) +{ + I810Ptr pI810 = I810PTR(pScrn); + int i; + + for(i=0; i<I810_MAX_SURFACES; i++) { + if(pI810->surfaceAllocation[i] == pSurf->surface_id) { + pI810->surfaceAllocation[i] = 0; + return; + } + } + return; +} + +void I810XvMCDestroySubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp) +{ + I810Ptr pI810 = I810PTR(pScrn); + int i; + + for(i=pI810->numSurfaces; i<I810_MAX_SURFACES + I810_MAX_SUBPICTURES; i++) { + if(pI810->surfaceAllocation[i] == pSubp->subpicture_id) { + pI810->surfaceAllocation[i] = 0; + return; + } + } + return; +} + + + + + + Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c:1.18 Sat Dec 2 10:25:38 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c Tue Jan 8 19:37:30 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.18 2000/12/02 15:25:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.23 2002/01/09 00:37:30 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -39,165 +39,243 @@ #include "i810.h" #include "i810_reg.h" -int I810AllocLow( I810MemRange *result, I810MemRange *pool, int size ) +int I810AllocLow (I810MemRange *result,I810MemRange *pool,int size) { - if (size > pool->Size) return 0; + if (size > pool->Size) return (0); pool->Size -= size; result->Size = size; result->Start = pool->Start; result->End = pool->Start += size; - return 1; + + return (1); } -int I810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ) +int I810AllocHigh (I810MemRange *result,I810MemRange *pool,int size) { - if (size > pool->Size) return 0; + if (size > pool->Size) return (0); pool->Size -= size; result->Size = size; result->End = pool->End; result->Start = pool->End -= size; - return 1; + + return (1); } -int I810AllocateGARTMemory( ScrnInfoPtr pScrn ) +int I810AllocateGARTMemory (ScrnInfoPtr pScrn) { unsigned long size = pScrn->videoRam * 1024; - I810Ptr pI810 = I810PTR(pScrn); + I810Ptr pI810 = I810PTR (pScrn); int key; long tom = 0; unsigned long physical; - if (!xf86AgpGARTSupported()) - return FALSE; - - if (!xf86AcquireGART(pScrn->scrnIndex)) - return FALSE; + if (pI810->StolenOnly == TRUE && pI810->StolenSize) + { + pI810->SysMem.Start = 0; + pI810->SysMem.Size = pI810->StolenSize; + pI810->SysMem.End = pI810->StolenSize; + pI810->SavedSysMem = pI810->SysMem; + pI810->agpAcquired2d = TRUE; + + pI810->CursorPhysical = 0; + pI810->CursorStart = 0; + + pI810->HwcursKey = -1; + pI810->DcacheKey = -1; + pI810->VramKey = -1; + + return (TRUE); + } + + if (!xf86AgpGARTSupported () || !xf86AcquireGART (pScrn->scrnIndex)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "AGP GART support is either not available or cannot be used.\n" + "\tMake sure your kernel has agpgart support or has the\n" + "\tagpgart module loaded.\n"); + return (FALSE); + } /* This allows the 2d only Xserver to regen */ pI810->agpAcquired2d = TRUE; - - /* Treat the gart like video memory - we assume we own all that is - * there, so ignore EBUSY errors. Don't try to remove it on - * failure, either, as other X server may be using it. - */ - - if ((key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 0, NULL)) == -1) - return FALSE; - - pI810->VramOffset = 0; - pI810->VramKey = key; - - if (!xf86BindGARTMemory(pScrn->scrnIndex, key, 0)) - return FALSE; - - - pI810->SysMem.Start = 0; - pI810->SysMem.Size = size; - pI810->SysMem.End = size; - pI810->SavedSysMem = pI810->SysMem; - - tom = pI810->SysMem.End; - - pI810->DcacheMem.Start = 0; - pI810->DcacheMem.End = 0; - pI810->DcacheMem.Size = 0; - pI810->CursorPhysical = 0; - - /* Dcache - half the speed of normal ram, so not really useful for - * a 2d server. Don't bother reporting its presence. This is - * mapped in addition to the requested amount of system ram. - */ - size = 1024 * 4096; - /* Keep it 512K aligned for the sake of tiled regions. - */ - tom += 0x7ffff; - tom &= ~0x7ffff; - - if ((key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 1, NULL)) != -1) { - pI810->DcacheOffset= tom; - pI810->DcacheKey = key; - if (!xf86BindGARTMemory(pScrn->scrnIndex, key, tom)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Allocation of %d bytes for DCACHE failed\n", size); - pI810->DcacheKey = -1; - } else { - pI810->DcacheMem.Start = tom; - pI810->DcacheMem.Size = size; - pI810->DcacheMem.End = pI810->DcacheMem.Start + pI810->DcacheMem.Size; - tom = pI810->DcacheMem.End; - } - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "No physical memory available for %d bytes of DCACHE\n", - size); - pI810->DcacheKey = -1; - } - - - /* Mouse cursor -- The i810 (crazy) needs a physical address in - * system memory from which to upload the cursor. We get this from - * the agpgart module using a special memory type. + if (IS_I830 (pI810)) + { + /* + * The I830 is slightly different from the I810/I815, it has no + * dcache and it has stolen memory by default in its gtt. All + * additional memory must go after it. + */ + + int offset,alloc_size; + + DPRINTF (PFX, + "size == %luk (%lu bytes == pScrn->videoRam)\n" + "pI810->StolenSize == %luk (%lu bytes)\n", + size/1024,size, + pI810->StolenSize/1024,pI810->StolenSize); + + alloc_size = size; + if (alloc_size <= pI810->StolenSize) + offset = alloc_size = 0; + else + { + alloc_size -= pI810->StolenSize; /* Stolen size is in bytes */ + offset = pI810->StolenSize; + } + + if (alloc_size) + { + if ((key = xf86AllocateGARTMemory (pScrn->scrnIndex,alloc_size,0,NULL)) == -1) + return (FALSE); + + DPRINTF (PFX, + "alloc_size == %luk (%lu bytes)\n" + " key == 0x%.8x\n" + " offset == 0x%.8x\n", + alloc_size/1024,alloc_size, + key,offset); + + if (!xf86BindGARTMemory (pScrn->scrnIndex,key,offset)) + return (FALSE); + + pI810->VramOffset = offset; + pI810->VramKey = key; + } + else pI810->VramKey = -1; + + pI810->SysMem.Start = 0; + pI810->SysMem.Size = size; + pI810->SysMem.End = size; + pI810->SavedSysMem = pI810->SysMem; + pI810->DcacheKey = -1; + + tom = size <= pI810->StolenSize ? pI810->StolenSize : pI810->SysMem.End; + } + else + { + /* + * I810/I815 + * + * Treat the gart like video memory - we assume we own all that is + * there, so ignore EBUSY errors. Don't try to remove it on + * failure, either, as other X server may be using it. + */ + + if ((key = xf86AllocateGARTMemory (pScrn->scrnIndex,size,0,NULL)) == -1) + return (FALSE); + + pI810->VramOffset = 0; + pI810->VramKey = key; + + if (!xf86BindGARTMemory (pScrn->scrnIndex,key,0)) + return (FALSE); + + pI810->SysMem.Start = 0; + pI810->SysMem.Size = size; + pI810->SysMem.End = size; + pI810->SavedSysMem = pI810->SysMem; + + tom = pI810->SysMem.End; + + pI810->DcacheMem.Start = 0; + pI810->DcacheMem.End = 0; + pI810->DcacheMem.Size = 0; + pI810->CursorPhysical = 0; + + /* + * Dcache - half the speed of normal ram, so not really useful for + * a 2d server. Don't bother reporting its presence. This is + * mapped in addition to the requested amount of system ram. + */ + + size = 1024 * 4096; + + /* + * Keep it 512K aligned for the sake of tiled regions. + */ + + tom += 0x7ffff; + tom &= ~0x7ffff; + + if ((key = xf86AllocateGARTMemory (pScrn->scrnIndex,size,1,NULL)) != -1) + { + pI810->DcacheOffset = tom; + pI810->DcacheKey = key; + if (!xf86BindGARTMemory (pScrn->scrnIndex,key,tom)) + { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Allocation of %d bytes for DCACHE failed\n",size); + pI810->DcacheKey = -1; + } + else + { + pI810->DcacheMem.Start = tom; + pI810->DcacheMem.Size = size; + pI810->DcacheMem.End = pI810->DcacheMem.Start + pI810->DcacheMem.Size; + tom = pI810->DcacheMem.End; + } + } + else + { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"No physical memory available for %d bytes of DCACHE\n",size); + pI810->DcacheKey = -1; + } + } + + /* + * Mouse cursor -- The i810 (crazy) needs a physical address in + * system memory from which to upload the cursor. We get this from + * the agpgart module using a special memory type. */ - /* 4k for the cursor is excessive, I'm going to steal 3k for - * overlay registers later + /* + * 4k for the cursor is excessive, I'm going to steal 3k for + * overlay registers later */ size = 4096; - - if ((key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 2, - &physical)) == -1) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "No physical memory available for HW cursor\n"); - pI810->HwcursKey = -1; - } else { - pI810->HwcursOffset= tom; - pI810->HwcursKey = key; - if (!xf86BindGARTMemory(pScrn->scrnIndex, key, tom)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Allocation of %d bytes for HW cursor failed\n", - size); - pI810->HwcursKey = -1; - } else { - pI810->CursorPhysical = physical; - pI810->CursorStart = tom; - tom += size; - } - } - /* Overlay register buffer -- Just like the cursor, the i810 needs a - * physical address in system memory from which to upload the overlay - * registers. + if ((key = xf86AllocateGARTMemory (pScrn->scrnIndex,size,2,&physical)) == -1) + { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"No physical memory available for HW cursor\n"); + pI810->HwcursKey = -1; + pI810->CursorStart = 0; + } + else + { + pI810->HwcursOffset = tom; + pI810->HwcursKey = key; + if (!xf86BindGARTMemory (pScrn->scrnIndex,key,tom)) + { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Allocation of %d bytes for HW cursor failed\n",size); + pI810->HwcursKey = -1; + } + else + { + pI810->CursorPhysical = physical; + pI810->CursorStart = tom; + tom += size; + } + } + + /* + * Overlay register buffer -- Just like the cursor, the i810 needs a + * physical address in system memory from which to upload the overlay + * registers. */ - if (pI810->CursorStart != 0) { - pI810->OverlayPhysical = pI810->CursorPhysical + 1024; - pI810->OverlayStart = pI810->CursorStart + 1024; - } - - pI810->GttBound = 1; - return TRUE; -} + if (pI810->CursorStart != 0) + { + pI810->OverlayPhysical = pI810->CursorPhysical + 1024; + pI810->OverlayStart = pI810->CursorStart + 1024; + } -#if 0 -void I810FreeGARTMemory( ScrnInfoPtr pScrn ) -{ -#ifdef linux - I810Ptr pI810 = I810PTR(pScrn); + pI810->GttBound = 1; - if (pI810->gartfd != -1) { - close( pI810->gartfd ); - pI810->gartfd = -1; - } -#endif + return (TRUE); } -#endif - - /* Tiled memory is good... really, really good... * * Need to make it less likely that we miss out on this - probably @@ -205,149 +283,173 @@ * of the first memory segment, or perhaps allocate a discontigous * framebuffer to get more alignment 'sweet spots'. */ -void I810SetTiledMemory(ScrnInfoPtr pScrn, - int nr, - unsigned start, - unsigned pitch, - unsigned size) +void I810SetTiledMemory (ScrnInfoPtr pScrn,int nr,unsigned int start,unsigned int pitch,unsigned int size) { - I810Ptr pI810 = I810PTR(pScrn); + I810Ptr pI810 = I810PTR (pScrn); I810RegPtr i810Reg = &pI810->ModeReg; CARD32 val; + CARD32 fence_mask = 0; - if (nr < 0 || nr > 7) { - xf86DrvMsg(X_WARNING, pScrn->scrnIndex, - "I810SetTiledMemory - fence %d out of range\n", nr); - return; - } + if (nr < 0 || nr > 7) + { + xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s - fence %d out of range\n","I810SetTiledMemory",nr); + return; + } i810Reg->Fence[nr] = 0; - if (start & ~FENCE_START_MASK) { - xf86DrvMsg(X_WARNING, pScrn->scrnIndex, - "I810SetTiledMemory %d: start (%x) is not 512k aligned\n", - nr, start); - return; - } - if (start % size) { - xf86DrvMsg(X_WARNING, pScrn->scrnIndex, - "I810SetTiledMemory %d: start (%x) is not size (%x) aligned\n", - nr, start, size); - return; - } + fence_mask = IS_I830 (pI810) ? ~I830_FENCE_START_MASK : ~FENCE_START_MASK; - if (pitch & 127) { - xf86DrvMsg(X_WARNING, pScrn->scrnIndex, - "I810SetTiledMemory %d: pitch (%x) not a multiple of 128 bytes\n", - nr, pitch); - return; - } + if (start & fence_mask) + { + xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: start (%x) is not 512k aligned\n","I810SetTiledMemory",nr,start); + return; + } + + if (start % size) + { + xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: start (%x) is not size (%x) aligned\n","I810SetTiledMemory",nr,start,size); + return; + } + + if (pitch & 127) + { + xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: pitch (%x) not a multiple of 128 bytes\n","I810SetTiledMemory",nr,pitch); + return; + } val = (start | FENCE_X_MAJOR | FENCE_VALID); - - switch (size) { - case (512*1024): val |= FENCE_SIZE_512K; break; - case (1024*1024): val |= FENCE_SIZE_1M; break; - case (2*1024*1024): val |= FENCE_SIZE_2M; break; - case (4*1024*1024): val |= FENCE_SIZE_4M; break; - case (8*1024*1024): val |= FENCE_SIZE_8M; break; - case (16*1024*1024): val |= FENCE_SIZE_16M; break; - case (32*1024*1024): val |= FENCE_SIZE_32M; break; - default: - xf86DrvMsg(X_WARNING, pScrn->scrnIndex, - "I810SetTiledMemory %d: illegal size (0x%x)\n", size); - return; - } - switch (pitch/128) { - case 1: val |= FENCE_PITCH_1; break; - case 2: val |= FENCE_PITCH_2; break; - case 4: val |= FENCE_PITCH_4; break; - case 8: val |= FENCE_PITCH_8; break; - case 16: val |= FENCE_PITCH_16; break; - case 32: val |= FENCE_PITCH_32; break; - default: - xf86DrvMsg(X_WARNING, pScrn->scrnIndex, - "%d: illegal size (0x%x)\n", size); - return; - } + if (IS_I830 (pI810)) + { + switch (size) + { + case KB (512): val |= FENCE_SIZE_512K; break; + case MB (1): val |= FENCE_SIZE_1M; break; + case MB (2): val |= FENCE_SIZE_2M; break; + case MB (4): val |= FENCE_SIZE_4M; break; + case MB (8): val |= FENCE_SIZE_8M; break; + case MB (16): val |= FENCE_SIZE_16M; break; + case MB (32): val |= FENCE_SIZE_32M; break; + case MB (64): val |= FENCE_SIZE_64M; break; + default: + xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: illegal size (0x%x)\n","I810SetTiledMemory",nr,size); + return; + } + + switch (pitch / 128) + { + case 1: val |= FENCE_PITCH_1; break; + case 2: val |= FENCE_PITCH_2; break; + case 4: val |= FENCE_PITCH_4; break; + case 8: val |= FENCE_PITCH_8; break; + case 16: val |= FENCE_PITCH_16; break; + case 32: val |= FENCE_PITCH_32; break; + case 64: val |= FENCE_PITCH_64; break; + default: + xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: illegal size (0x%x)\n","I810SetTiledMemory",nr,size); + return; + } + } + else + { + switch (size) + { + case KB (512): val |= FENCE_SIZE_512K; break; + case MB (1): val |= FENCE_SIZE_1M; break; + case MB (2): val |= FENCE_SIZE_2M; break; + case MB (4): val |= FENCE_SIZE_4M; break; + case MB (8): val |= FENCE_SIZE_8M; break; + case MB (16): val |= FENCE_SIZE_16M; break; + case MB (32): val |= FENCE_SIZE_32M; break; + default: + xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: illegal size (0x%x)\n","I810SetTiledMemory",nr,size); + return; + } + + switch (pitch / 128) + { + case 1: val |= FENCE_PITCH_1; break; + case 2: val |= FENCE_PITCH_2; break; + case 4: val |= FENCE_PITCH_4; break; + case 8: val |= FENCE_PITCH_8; break; + case 16: val |= FENCE_PITCH_16; break; + case 32: val |= FENCE_PITCH_32; break; + default: + xf86DrvMsg (X_WARNING,pScrn->scrnIndex,"%s %d: illegal size (0x%x)\n","I810SetTiledMemory",nr,size); + return; + } + } i810Reg->Fence[nr] = val; } -Bool -I810BindGARTMemory( ScrnInfoPtr pScrn ) +Bool I810BindGARTMemory (ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR(pScrn); + I810Ptr pI810 = I810PTR (pScrn); - if (xf86AgpGARTSupported() && !pI810->directRenderingEnabled && - !pI810->GttBound) { - if (!xf86AcquireGART(pScrn->scrnIndex)) - return FALSE; - if (!xf86BindGARTMemory(pScrn->scrnIndex, pI810->VramKey, - pI810->VramOffset)) - return FALSE; - if (pI810->DcacheKey != -1) { - if (!xf86BindGARTMemory(pScrn->scrnIndex, pI810->DcacheKey, - pI810->DcacheOffset)) - return FALSE; - } - if (pI810->HwcursKey != -1) { - if (!xf86BindGARTMemory(pScrn->scrnIndex, pI810->HwcursKey, - pI810->HwcursOffset)) - return FALSE; - } - pI810->GttBound = 1; - } - return TRUE; + if (pI810->StolenOnly == TRUE) return (TRUE); + + if (xf86AgpGARTSupported () && !pI810->directRenderingEnabled && !pI810->GttBound) + { + if (!xf86AcquireGART (pScrn->scrnIndex)) + return (FALSE); + + if (pI810->VramKey != -1 && !xf86BindGARTMemory (pScrn->scrnIndex,pI810->VramKey,pI810->VramOffset)) + return (FALSE); + + if (pI810->DcacheKey != -1 && !xf86BindGARTMemory (pScrn->scrnIndex,pI810->DcacheKey,pI810->DcacheOffset)) + return (FALSE); + + if (pI810->HwcursKey != -1 && !xf86BindGARTMemory (pScrn->scrnIndex,pI810->HwcursKey,pI810->HwcursOffset)) + return (FALSE); + + pI810->GttBound = 1; + } + + return (TRUE); } -Bool -I810UnbindGARTMemory( ScrnInfoPtr pScrn ) +Bool I810UnbindGARTMemory (ScrnInfoPtr pScrn) { - I810Ptr pI810 = I810PTR(pScrn); + I810Ptr pI810 = I810PTR (pScrn); - if (xf86AgpGARTSupported() && !pI810->directRenderingEnabled && - pI810->GttBound) { - if (!xf86UnbindGARTMemory(pScrn->scrnIndex, pI810->VramKey)) - return FALSE; - if (pI810->DcacheKey != -1) { - if (!xf86UnbindGARTMemory(pScrn->scrnIndex, pI810->DcacheKey)) - return FALSE; - } - if (pI810->HwcursKey != -1) { - if (!xf86UnbindGARTMemory(pScrn->scrnIndex, pI810->HwcursKey)) - return FALSE; - } - if (!xf86ReleaseGART(pScrn->scrnIndex)) - return FALSE; - pI810->GttBound = 0; - } - return TRUE; + if (pI810->StolenOnly == TRUE) return (TRUE); + + if (xf86AgpGARTSupported () && !pI810->directRenderingEnabled && pI810->GttBound) + { + if (pI810->VramKey != -1 && !xf86UnbindGARTMemory (pScrn->scrnIndex,pI810->VramKey)) + return (FALSE); + + if (pI810->DcacheKey != -1 && !xf86UnbindGARTMemory (pScrn->scrnIndex,pI810->DcacheKey)) + return (FALSE); + + if (pI810->HwcursKey != -1 && !xf86UnbindGARTMemory (pScrn->scrnIndex,pI810->HwcursKey)) + return (FALSE); + + if (!xf86ReleaseGART (pScrn->scrnIndex)) + return (FALSE); + + pI810->GttBound = 0; + } + + return (TRUE); } -int -I810CheckAvailableMemory(ScrnInfoPtr pScrn) +int I810CheckAvailableMemory (ScrnInfoPtr pScrn) { AgpInfoPtr agpinf; int maxPages; - - if (!xf86AgpGARTSupported()) - return -1; - - if (!xf86AcquireGART(pScrn->scrnIndex)) - return -1; - - if ((agpinf = xf86GetAGPInfo(pScrn->scrnIndex)) == NULL) - return -1; - if (!xf86ReleaseGART(pScrn->scrnIndex)) - return -1; + if (!xf86AgpGARTSupported () || + !xf86AcquireGART (pScrn->scrnIndex) || + (agpinf = xf86GetAGPInfo (pScrn->scrnIndex)) == NULL || + !xf86ReleaseGART (pScrn->scrnIndex)) + return (-1); maxPages = agpinf->totalPages - agpinf->usedPages; - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, - "I810CheckAvailableMemory: %dk available\n", maxPages * 4); + xf86DrvMsgVerb (pScrn->scrnIndex,X_INFO,2,"%s: %dk available\n","I810CheckAvailableMemory",maxPages * 4); - return maxPages * 4; + return (maxPages * 4); } Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h:1.4 Tue Sep 26 11:57:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h Sat Oct 27 23:33:32 2001 @@ -1,4 +1,4 @@ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.6 2001/10/28 03:33:32 tsi Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -25,7 +25,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.4 2000/09/26 15:57:12 tsi Exp $ */ /* * Authors: @@ -218,6 +217,11 @@ #define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */ #define VCLK2_VCO_N 0x600a #define VCLK2_VCO_DIV_SEL 0x6012 + +#define VCLK_DIVISOR_VGA0 0x6000 +#define VCLK_DIVISOR_VGA1 0x6004 +#define VCLK_POST_DIV 0x6010 + #define POST_DIV_SELECT 0x70 #define POST_DIV_1 0x00 #define POST_DIV_2 0x10 @@ -302,6 +306,7 @@ * - what does it all mean? */ #define FWATER_BLC 0x20d8 +#define FWATER_BLC2 0x20dc #define MM_BURST_LENGTH 0x00700000 #define MM_FIFO_WATERMARK 0x0001F000 #define LM_BURST_LENGTH 0x00000700 @@ -313,6 +318,8 @@ #define FENCE 0x2000 #define FENCE_NR 8 +#define I830_FENCE_START_MASK 0x07f80000 + #define FENCE_START_MASK 0x03F80000 #define FENCE_X_MAJOR 0x00000000 #define FENCE_Y_MAJOR 0x00001000 @@ -324,6 +331,7 @@ #define FENCE_SIZE_8M 0x00000400 #define FENCE_SIZE_16M 0x00000500 #define FENCE_SIZE_32M 0x00000600 +#define FENCE_SIZE_64M 0x00000700 #define FENCE_PITCH_MASK 0x00000070 #define FENCE_PITCH_1 0x00000000 #define FENCE_PITCH_2 0x00000010 @@ -331,6 +339,7 @@ #define FENCE_PITCH_8 0x00000030 #define FENCE_PITCH_16 0x00000040 #define FENCE_PITCH_32 0x00000050 +#define FENCE_PITCH_64 0x00000060 #define FENCE_VALID 0x00000001 @@ -395,6 +404,7 @@ #define RING_LEN 0x0C #define RING_NR_PAGES 0x000FF000 +#define I830_RING_NR_PAGES 0x001FF000 #define RING_REPORT_MASK 0x00000006 #define RING_REPORT_64K 0x00000002 #define RING_REPORT_128K 0x00000004 @@ -560,3 +570,245 @@ #define CS_USE_CTX0 0 #define CS_USE_CTX1 (1<<0) +/* I830 CRTC registers */ +#define HTOTAL_A 0x60000 +#define HBLANK_A 0x60004 +#define HSYNC_A 0x60008 +#define VTOTAL_A 0x6000c +#define VBLANK_A 0x60010 +#define VSYNC_A 0x60014 +#define PIPEASRC 0x6001c +#define BCLRPAT_A 0x60020 + +#define HTOTAL_B 0x61000 +#define HBLANK_B 0x61004 +#define HSYNC_B 0x61008 +#define VTOTAL_B 0x6100c +#define VBLANK_B 0x61010 +#define VSYNC_B 0x61014 +#define PIPEBSRC 0x6101c +#define BCLRPAT_B 0x61020 + +#define DPLL_A 0x06014 +#define DPLL_B 0x06018 +#define FPA0 0x06040 +#define FPA1 0x06044 + +#define I830_HTOTAL_MASK 0xfff0000 +#define I830_HACTIVE_MASK 0x7ff + +#define I830_HBLANKEND_MASK 0xfff0000 +#define I830_HBLANKSTART_MASK 0xfff + +#define I830_HSYNCEND_MASK 0xfff0000 +#define I830_HSYNCSTART_MASK 0xfff + +#define I830_VTOTAL_MASK 0xfff0000 +#define I830_VACTIVE_MASK 0x7ff + +#define I830_VBLANKEND_MASK 0xfff0000 +#define I830_VBLANKSTART_MASK 0xfff + +#define I830_VSYNCEND_MASK 0xfff0000 +#define I830_VSYNCSTART_MASK 0xfff + +#define I830_PIPEA_HORZ_MASK 0x7ff0000 +#define I830_PIPEA_VERT_MASK 0x7ff + +#define ADPA 0x61100 +#define ADPA_DAC_ENABLE (1<<31) +#define ADPA_DAC_DISABLE 0 +#define ADPA_PIPE_A_SELECT 0 +#define ADPA_USE_VGA_HVPOLARITY (1<<15) +#define ADPA_SETS_HVPOLARITY 0 +#define ADPA_VSYNC_CNTL_DISABLE (1<<11) +#define ADPA_VSYNC_CNTL_ENABLE 0 +#define ADPA_HSYNC_CNTL_DISABLE (1<<10) +#define ADPA_HSYNC_CNTL_ENABLE 0 +#define ADPA_VSYNC_ACTIVE_HIGH (1<<4) +#define ADPA_VSYNC_ACTIVE_LOW 0 +#define ADPA_HSYNC_ACTIVE_HIGH (1<<3) +#define ADPA_HSYNC_ACTIVE_LOW 0 + + +#define DV0A 0x61120 +#define DV0A_DISABLE (1<<31) + +#define DV0B 0x61140 +#define DV0B_DISABLE (1<<31) + + +#define PIPEACONF 0x70008 +#define PIPEACONF_ENABLE (1<<31) +#define PIPEACONF_DISABLE 0 +#define PIPEACONF_DOUBLE_WIDE (1<<30) +#define PIPEACONF_SINGLE_WIDE 0 +#define PIPEACONF_PIPE_UNLOCKED 0 +#define PIPEACONF_PIPE_LOCKED (1<<25) +#define PIPEACONF_PALETTE 0 +#define PIPEACONF_GAMMA (1<<24) + +#define PIPEBCONF 0x71008 +#define PIPEBCONF_ENABLE (1<<31) +#define PIPEBCONF_DISABLE 0 +#define PIPEBCONF_GAMMA (1<<24) +#define PIPEBCONF_PALETTE 0 + +#define DSPACNTR 0x70180 +#define DSPACNTR_PLANE_A_ENABLE (1<<31) +#define DSPACNTR_PLANE_A_DISABLE 0 +#define DSPACNTR_GAMMA_ENABLE (1<<30) +#define DSPACNTR_GAMMA_DISABLE 0 +#define DSPACNTR_8BPP (1<<27) +#define DSPACNTR_16BPP ((1<<26)|(1<<28)) +#define DSPACNTR_32BPP_NO_ALPHA ((1<<27)|(1<<28)) +#define DSPACNTR_32BPP ((1<<26)|(1<<27)|(1<<28)) +#define DSPACNTR_STEREO_ENABLE (1<<25) +#define DSPACNTR_STEREO_DISABLE 0 +#define DSPACNTR_SEL_PIPE_A 0 +#define DSPACNTR_SEL_PIPE_B (1<<24) +#define DSPACNTR_SRC_KEY_ENABLE (1<<22) +#define DSPACNTR_SRC_KEY_DISABLE 0 +#define DSPACNTR_LINE_DOUBLE (1<<20) +#define DSPACNTR_NO_LINE_DOUBLE 0 +#define DSPACNTR_STEREO_POLARITY_FIRST 0 +#define DSPACNTR_STEREO_POLARITY_SECOND (1<<18) + +#define DSPABASE 0x70184 +#define DSPASTRIDE 0x70188 + +#define DSPBCNTR 0x71180 +#define DSPBCNTR_PLANE_B_ENABLE (1<<31) +#define DSPBCNTR_PLANE_B_DISABLE 0 +#define DSPBCNTR_GAMMA_ENABLE (1<<30) +#define DSPBCNTR_GAMMA_DISABLE 0 +#define DSPBCNTR_8BPP (1<<27) +#define DSPBCNTR_16BPP ((1<<26)|(1<<28)) +#define DSPBCNTR_32BPP_NO_ALPHA ((1<<27)|(1<<28)) +#define DSPBCNTR_32BPP ((1<<26)|(1<<27)|(1<<28)) +#define DSPBCNTR_STEREO_ENABLE (1<<25) +#define DSPBCNTR_STEREO_DISABLE 0 +#define DSPBCNTR_SEL_PIPE_A 0 +#define DSPBCNTR_SEL_PIPE_B (1<<24) +#define DSPBCNTR_SRC_KEY_ENABLE (1<<22) +#define DSPBCNTR_SRC_KEY_DISABLE 0 +#define DSPBCNTR_LINE_DOUBLE (1<<20) +#define DSPBCNTR_NO_LINE_DOUBLE 0 +#define DSPBCNTR_STEREO_POLARITY_FIRST 0 +#define DSPBCNTR_STEREO_POLARITY_SECOND (1<<18) +#define DSPBCNTR_ALPHA_TRANS_ENABLE (1<<15) +#define DSPBCNTR_ALPHA_TRANS_DISABLE 0 +#define DSPBCNTR_SPRITE_ABOVE_DISPLAYA 0 +#define DSPBCNTR_SPRITE_ABOVE_OVERLAY (1) + +#define DSPBBASE 0x71184 +#define DSPBSTRIDE 0x71188 + +/* Various masks for reserved bits, etc. */ +#define I830_FWATER1_MASK (~((1<<11)|(1<<10)|(1<<9)| \ + (1<<8)|(1<<26)|(1<<25)|(1<<24)|(1<<5)|(1<<4)|(1<<3)| \ + (1<<2)|(1<<1)|1|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))) +#define I830_FWATER2_MASK ~(0) + +#define DV0A_RESERVED ((1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1) +#define DV0B_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1) +#define VGA0_N_DIVISOR_MASK ((1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)) +#define VGA0_M1_DIVISOR_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)) +#define VGA0_M2_DIVISOR_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1) +#define VGA0_M1M2N_RESERVED ~(VGA0_N_DIVISOR_MASK|VGA0_M1_DIVISOR_MASK|VGA0_M2_DIVISOR_MASK) +#define VGA0_POSTDIV_MASK ((1<<7)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1) +#define VGA1_POSTDIV_MASK ((1<<15)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)) +#define VGA_POSTDIV_RESERVED ~(VGA0_POSTDIV_MASK|VGA1_POSTDIV_MASK|(1<<7)|(1<<15)) +#define DPLLA_POSTDIV_MASK ((1<<23)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)) +#define DPLLA_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<22)|(1<<15)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1) +#define ADPA_RESERVED ((1<<2)|(1<<1)|1|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)) +#define SUPER_WORD 32 +#define BURST_A_MASK ((1<<11)|(1<<10)|(1<<9)|(1<<8)) +#define BURST_B_MASK ((1<<26)|(1<<25)|(1<<24)) +#define WATER_A_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1) +#define WATER_B_MASK ((1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)) +#define WATER_RESERVED ((1<<31)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<7)|(1<<6)) +#define PIPEACONF_RESERVED ((1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff) +#define PIPEBCONF_RESERVED ((1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff) +#define DSPACNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0xffff) +#define DSPBCNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0x7ffe) + +#define I830_GMCH_CTRL 0x52 + +#define I830_GMCH_ENABLED 0x4 +#define I830_GMCH_MEM_MASK 0x1 +#define I830_GMCH_MEM_64M 0x1 +#define I830_GMCH_MEM_128M 0 + +#define I830_GMCH_GMS_MASK 0x70 +#define I830_GMCH_GMS_DISABLED 0x00 +#define I830_GMCH_GMS_LOCAL 0x10 +#define I830_GMCH_GMS_STOLEN_512 0x20 +#define I830_GMCH_GMS_STOLEN_1024 0x30 +#define I830_GMCH_GMS_STOLEN_8192 0x40 + +#define I830_RDRAM_CHANNEL_TYPE 0x03010 +#define I830_RDRAM_ND(x) (((x) & 0x20) >> 5) +#define I830_RDRAM_DDT(x) (((x) & 0x18) >> 3) + +/* BLT commands */ +#define COLOR_BLT_CMD ((2<<29)|(0x40<<22)|(0x3)) +#define COLOR_BLT_WRITE_ALPHA (1<<21) +#define COLOR_BLT_WRITE_RGB (1<<20) + +#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|(0x4)) +#define XY_COLOR_BLT_WRITE_ALPHA (1<<21) +#define XY_COLOR_BLT_WRITE_RGB (1<<20) + +#define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22)|1) + +#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) +#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) +#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) + +#define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|0x4) +#define SRC_COPY_BLT_WRITE_ALPHA (1<<21) +#define SRC_COPY_BLT_WRITE_RGB (1<<20) + +#define XY_MONO_PAT_BLT_CMD ((0x2<<29)|(0x52<<22)|0x7) +#define XY_MONO_PAT_VERT_SEED ((1<<10)|(1<<9)|(1<<8)) +#define XY_MONO_PAT_HORT_SEED ((1<<14)|(1<<13)|(1<<12)) +#define XY_MONO_PAT_BLT_WRITE_ALPHA (1<<21) +#define XY_MONO_PAT_BLT_WRITE_RGB (1<<20) + +#define XY_MONO_SRC_BLT_CMD ((0x2<<29)|(0x54<<22)|(0x6)) +#define XY_MONO_SRC_BLT_WRITE_ALPHA (1<<21) +#define XY_MONO_SRC_BLT_WRITE_RGB (1<<20) + +/* 3d state */ +#define STATE3D_FOG_MODE ((3<<29)|(0x1d<<24)|(0x89<<16)|2) +#define FOG_MODE_VERTEX (1<<31) +#define STATE3D_MAP_COORD_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8c<<16)) +#define DISABLE_TEX_TRANSFORM (1<<28) +#define TEXTURE_SET(x) (x<<29) +#define STATE3D_RASTERIZATION_RULES ((3<<29)|(0x07<<24)) +#define POINT_RASTER_ENABLE (1<<15) +#define POINT_RASTER_OGL (1<<13) +#define STATE3D_VERTEX_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8b<<16)) +#define DISABLE_VIEWPORT_TRANSFORM (1<<31) +#define DISABLE_PERSPECTIVE_DIVIDE (1<<29) + +#define MI_SET_CONTEXT (0x18<<23) +#define CTXT_NO_RESTORE (1) +#define CTXT_PALETTE_SAVE_DISABLE (1<<3) +#define CTXT_PALETTE_RESTORE_DISABLE (1<<2) + +/* Dword 0 */ +#define MI_VERTEX_BUFFER (0x17<<23) +#define MI_VERTEX_BUFFER_IDX(x) (x<<20) +#define MI_VERTEX_BUFFER_PITCH(x) (x<<13) +#define MI_VERTEX_BUFFER_WIDTH(x) (x<<6) +/* Dword 1 */ +#define MI_VERTEX_BUFFER_DISABLE (1) + +#define STATE3D_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x01<<16)) + +/* STATE3D_FOG_MODE stuff */ +#define ENABLE_FOG_SOURCE (1<<27) +#define ENABLE_FOG_CONST (1<<24) +#define ENABLE_FOG_DENSITY (1<<23) Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.17 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.17 Wed Apr 18 10:52:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c Tue Dec 4 16:17:56 2001 @@ -23,7 +23,7 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.17 2001/04/18 14:52:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.21 2001/12/04 21:17:56 tsi Exp $ */ /* * i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich. @@ -81,8 +81,9 @@ static Atom xvBrightness, xvContrast, xvColorKey; -#define IMAGE_MAX_WIDTH 720 -#define IMAGE_MAX_HEIGHT 576 +#define IMAGE_MAX_WIDTH 1440 +#define IMAGE_FAST_WIDTH 720 +#define IMAGE_MAX_HEIGHT 1080 #define Y_BUF_SIZE (IMAGE_MAX_WIDTH * IMAGE_MAX_HEIGHT) #define OVERLAY_UPDATE(p) OUTREG(0x30000, p | 0x80000000); @@ -502,7 +503,7 @@ } static void -I810StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +I810StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { I810PortPrivPtr pPriv = (I810PortPrivPtr)data; I810Ptr pI810 = I810PTR(pScrn); @@ -511,7 +512,7 @@ REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - if(exit) { + if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { overlay->OV0CMD &= 0xFFFFFFFE; OVERLAY_UPDATE(pI810->OverlayPhysical); @@ -749,6 +750,13 @@ break; } + /* wide video formats (>720 pixels) are special */ + if( swidth > IMAGE_FAST_WIDTH ) { + overlay->OV0CONF = 1; /* one 1440 pixel line buffer */ + } else { + overlay->OV0CONF = 0; /* two 720 pixel line buffers */ + } + overlay->SHEIGHT = height | (height << 15); overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1; overlay->DWINSZ = ((dstBox->y2 - dstBox->y1) << 16) | @@ -949,9 +957,10 @@ I810PortPrivPtr pPriv = (I810PortPrivPtr)data; INT32 x1, x2, y1, y2; int srcPitch, dstPitch; - int top, left, npixels, nlines, size; + int top, left, npixels, nlines, size, loops; BoxRec dstBox; + /* Clip */ x1 = src_x; x2 = src_x + src_w; @@ -1004,9 +1013,19 @@ pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * height >> 1); - /* wait for the last rendered buffer to be flipped in */ - while (((INREG(DOV0STA)&0x00100000)>>20) != pPriv->currentBuf); + /* Make sure this buffer isn't in use */ + loops = 0; + while (loops < 1000000) { + if(((INREG(DOV0STA)&0x00100000)>>20) == pPriv->currentBuf) { + break; + } + loops++; + } + if(loops >= 1000000) { + pPriv->currentBuf = !pPriv->currentBuf; + } + /* buffer swap */ if (pPriv->currentBuf == 0) pPriv->currentBuf = 1; @@ -1063,13 +1082,19 @@ ){ int size, tmp; - if(*w > 720) *w = 720; - if(*h > 576) *h = 576; + if(*w > IMAGE_MAX_WIDTH) *w = IMAGE_MAX_WIDTH; + if(*h > IMAGE_MAX_HEIGHT) *h = IMAGE_MAX_HEIGHT; *w = (*w + 1) & ~1; if(offsets) offsets[0] = 0; switch(id) { + /* IA44 is for XvMC only */ + case FOURCC_IA44: + case FOURCC_AI44: + if(pitches) pitches[0] = *w; + size = *w * *h; + break; case FOURCC_YV12: case FOURCC_I420: *h = (*h + 1) & ~1; Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c:1.4 Fri Sep 8 18:43:06 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c Mon Nov 26 13:55:48 2001 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c,v 1.4 2000/09/08 22:43:06 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c,v 1.6 2001/11/26 18:55:48 dawes Exp $ */ /* * Authors: @@ -40,9 +40,6 @@ unsigned int wm; }; -#define XCONFIG_PROBED "()" -#define NAME "i810" - struct wm_info i810_wm_8_100[] = { { 0, 0x22003000 }, { 25.2, 0x22003000 }, @@ -295,7 +292,7 @@ if (i == nr) i--; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "chose watermark 0x%x: (tab.freq %.1f)\n", tab[i].wm, tab[i].freq); Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c:1.3 --- /dev/null Fri Jan 18 15:25:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c Tue Jan 8 19:37:30 2002 @@ -0,0 +1,1679 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c,v 1.3 2002/01/09 00:37:30 dawes Exp $ */ +/************************************************************************** + +Copyright 2001 VA Linux Systems Inc., Fremont, California. + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +on the rights to use, copy, modify, merge, publish, distribute, sub +license, and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + + +**************************************************************************/ + +/* Author: Jeff Hartmann <jhartmann@valinux.com> + */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Priv.h" + +#include "xf86PciInfo.h" +#include "xf86Pci.h" + +#include "windowstr.h" + +#include "GL/glxtokens.h" + +#include "i810.h" +#include "i830_dri.h" +#include "i830_3d_reg.h" + +static char I830KernelDriverName[] = "i830"; +static char I830ClientDriverName[] = "i830"; + +static Bool I830InitVisualConfigs(ScreenPtr pScreen); +static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual, + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore); +static void I830DestroyContext(ScreenPtr pScreen, drmContext hwContext, + DRIContextType contextStore); +static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType readContextType, + void *readContextStore, + DRIContextType writeContextType, + void *writeContextStore); +static void I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); +static void I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index); + +extern void GlxSetVisualConfigs(int nconfigs, + __GLXvisualConfig *configs, + void **configprivs); + +static int i830_pitches[] = { + 512, + 1024, + 2048, + 4096, + 8192, + 0 +}; + +Bool I830CleanupDma(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); + Bool ret_val; + + ret_val = drmI830CleanupDma(pI810->drmSubFD); + if (ret_val == FALSE) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Cleanup Failed\n"); + return ret_val; +} + +Bool I830InitDma(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); + I810RingBuffer *ring = &(pI810->LpRing); + I830DRIPtr pI830DRI=(I830DRIPtr)pI810->pDRIInfo->devPrivate; + drmI830Init info; + Bool ret_val; + + info.start = ring->mem.Start; + info.end = ring->mem.End; + info.size = ring->mem.Size; + + info.mmio_offset = (unsigned int)pI830DRI->regs; + info.buffers_offset = (unsigned int)pI810->buffer_map; + + info.sarea_off = sizeof(XF86DRISAREARec); + + info.front_offset = 0; + info.back_offset = pI810->BackBuffer.Start; + info.depth_offset = pI810->DepthBuffer.Start; + info.w = pScrn->virtualX; + info.h = pScrn->virtualY; + info.pitch = pI810->auxPitch; + info.pitch_bits = pI810->auxPitchBits; + info.cpp = pI810->cpp; + + ret_val = drmI830InitDma(pI810->drmSubFD, &info); + if(ret_val == FALSE) ErrorF("i830 Dma Initialization Failed\n"); + return ret_val; +} + +static Bool +I830InitVisualConfigs(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I810Ptr pI810 = I810PTR(pScrn); + int numConfigs = 0; + __GLXvisualConfig *pConfigs = 0; + I810ConfigPrivPtr pI810Configs = 0; + I810ConfigPrivPtr *pI810ConfigPtrs = 0; + int accum, stencil, db, depth; + int i; + + switch (pScrn->bitsPerPixel) { + case 8: + case 24: + break; + + case 16: + numConfigs = 8; + + pConfigs = (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), numConfigs); + if (!pConfigs) + return FALSE; + + pI810Configs = (I810ConfigPrivPtr) xcalloc(sizeof(I810ConfigPrivRec), numConfigs); + if (!pI810Configs) { + xfree(pConfigs); + return FALSE; + } + + pI810ConfigPtrs = (I810ConfigPrivPtr *) xcalloc(sizeof(I810ConfigPrivPtr), numConfigs); + if (!pI810ConfigPtrs) { + xfree(pConfigs); + xfree(pI810Configs); + return FALSE; + } + + for (i=0; i<numConfigs; i++) + pI810ConfigPtrs[i] = &pI810Configs[i]; + + i = 0; + depth = 1; + 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].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 = 16; + } + else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + pConfigs[i].doubleBuffer = db ? TRUE : 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; + i++; + } + } + } + assert(i == numConfigs); + break; + + case 32: + numConfigs = 8; + + pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig), + numConfigs ); + if ( !pConfigs ) { + return FALSE; + } + + pI810Configs = (I810ConfigPrivPtr)xcalloc( sizeof(I810ConfigPrivRec), + numConfigs ); + if ( !pI810Configs ) { + xfree( pConfigs ); + return FALSE; + } + + pI810ConfigPtrs = (I810ConfigPrivPtr*) + xcalloc(sizeof(I810ConfigPrivPtr), + numConfigs); + if ( !pI810ConfigPtrs ) { + xfree( pConfigs ); + xfree( pI810Configs ); + return FALSE; + } + + for ( i = 0 ; i < numConfigs ; i++ ) { + pI810ConfigPtrs[i] = &pI810Configs[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 = 0xff000000;; + 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; + } + 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].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" ); + return FALSE; + } + break; + + } + pI810->numVisualConfigs = numConfigs; + pI810->pVisualConfigs = pConfigs; + pI810->pVisualConfigsPriv = pI810Configs; + GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pI810ConfigPtrs); + return TRUE; +} + + +static unsigned int mylog2(unsigned int n) +{ + unsigned int log2 = 1; + while (n>1) n >>= 1, log2++; + return log2; +} + + +Bool I830DRIScreenInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I810Ptr pI810 = I810PTR(pScrn); + DRIInfoPtr pDRIInfo; + I830DRIPtr pI830DRI; + unsigned long tom; + unsigned long agpHandle; + int sysmem_size = 0; + int back_size = 0; + int bufs; + int i; + + /* Hardware 3D rendering only implemented for 16bpp and 32 bpp */ + if (((pScrn->bitsPerPixel / 8) != 2 && pScrn->depth != 16) && + (pScrn->bitsPerPixel / 8) != 4) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Direct rendering only supported in 16 and 32 bpp modes\n"); + return FALSE; + } + + /* 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] %s failed (libdri.a too old)\n","I830DRIScreenInit"); + 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] %s 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", + "I830DRIScreenInit", major, minor, patch); + return FALSE; + } + } + + pDRIInfo = DRICreateInfoRec(); + if (!pDRIInfo) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRICreateInfoRec failed. Disabling DRI.\n"); + return FALSE; + } + + pI810->pDRIInfo = pDRIInfo; + pI810->LockHeld = 0; + + pDRIInfo->drmDriverName = I830KernelDriverName; + pDRIInfo->clientDriverName = I830ClientDriverName; + pDRIInfo->busIdString = xalloc(64); + + sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", + ((pciConfigPtr)pI810->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pI810->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pI810->PciInfo->thisCard)->funcnum); + pDRIInfo->ddxDriverMajorVersion = I830_MAJOR_VERSION; + pDRIInfo->ddxDriverMinorVersion = I830_MINOR_VERSION; + pDRIInfo->ddxDriverPatchVersion = I830_PATCHLEVEL; + pDRIInfo->frameBufferPhysicalAddress = pI810->LinearAddr; + pDRIInfo->frameBufferSize = (((pScrn->displayWidth * + pScrn->virtualY * pI810->cpp) + + 4096 - 1) / 4096) * 4096; + + pDRIInfo->frameBufferStride = pScrn->displayWidth*pI810->cpp; + pDRIInfo->ddxDrawableTableEntry = I830_MAX_DRAWABLES; + + if (SAREA_MAX_DRAWABLES < I830_MAX_DRAWABLES) + pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; + else + pDRIInfo->maxDrawableTableEntry = I830_MAX_DRAWABLES; + + if (sizeof(XF86DRISAREARec)+sizeof(I830SAREARec)>SAREA_MAX) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] Data does not fit in SAREA\n"); + return FALSE; + } + /* This is a hack for now. We have to have more than a 4k page here + * because of the size of the state. However, the state should be + * in a per-context mapping. This will be added in the Mesa 3.5 port + * of the I830 driver. + */ + pDRIInfo->SAREASize = SAREA_MAX; + + if (!(pI830DRI = (I830DRIPtr)xcalloc(sizeof(I830DRIRec),1))) { + DRIDestroyInfoRec(pI810->pDRIInfo); + pI810->pDRIInfo=0; + return FALSE; + } + pDRIInfo->devPrivate = pI830DRI; + pDRIInfo->devPrivateSize = sizeof(I830DRIRec); + pDRIInfo->contextSize = sizeof(I830DRIContextRec); + + pDRIInfo->CreateContext = I830CreateContext; + pDRIInfo->DestroyContext = I830DestroyContext; + pDRIInfo->SwapContext = I830DRISwapContext; + pDRIInfo->InitBuffers = I830DRIInitBuffers; + pDRIInfo->MoveBuffers = I830DRIMoveBuffers; + pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + + /* 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, "[dri] DRIScreenInit failed. Disabling DRI.\n"); + xfree(pDRIInfo->devPrivate); + pDRIInfo->devPrivate=0; + DRIDestroyInfoRec(pI810->pDRIInfo); + pI810->pDRIInfo=0; + return FALSE; + } + + /* Check the i830 DRM version */ + { + drmVersionPtr version = drmGetVersion(pI810->drmSubFD); + if (version) { + if (version->version_major != 1 || + version->version_minor < 2) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] %s failed because of a version mismatch.\n" + "[dri] i830.o kernel module version is %d.%d.%d but version 1.2 or greater is needed.\n" + "[dri] Disabling DRI.\n", + "I830DRIScreenInit", + version->version_major, + version->version_minor, + version->version_patchlevel); + I830DRICloseScreen(pScreen); + drmFreeVersion(version); + return FALSE; + } + drmFreeVersion(version); + } + } + + pI830DRI->regsSize=I830_REG_SIZE; + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->MMIOAddr, + pI830DRI->regsSize, DRM_REGISTERS, 0, &pI830DRI->regs)<0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", + pI830DRI->regs); + + pI810->backHandle = 0; + pI810->zHandle = 0; + pI810->cursorHandle = 0; + pI810->sysmemHandle = 0; + pI810->agpAcquired = FALSE; + + /* Agp Support - Need this just to get the framebuffer. + */ + if(drmAgpAcquire(pI810->drmSubFD) < 0) { + 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, "[agp] drmAgpEnable failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + memset (&pI810->BackBuffer, 0, sizeof(I810MemRange)); + memset (&pI810->DepthBuffer, 0, sizeof(I810MemRange)); + pI810->CursorPhysical = 0; + + back_size = (((pScrn->displayWidth * + pScrn->virtualY * pI810->cpp) + + 4096 - 1) / 4096) * 4096; + + sysmem_size = pScrn->videoRam * 1024; + + /* The 1 meg here is for texture space and the ring buffer. */ + if(sysmem_size < (3 * back_size + 0x100000)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] Not enough memory to contain front, back, and depth buffers.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] You need at least %dK of VideoRam for this configuration.\n", + (3 * back_size + 0x100000) / 1024); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + sysmem_size = sysmem_size - 2*back_size; + + if(sysmem_size > pI810->FbMapSize) { + sysmem_size = pI810->FbMapSize; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] User requested more memory then fits in the agp aperture\n" + "[dri] Truncating to %d bytes of memory\n", + sysmem_size); + } + + sysmem_size -= 4096; /* remove 4k for the hw cursor */ + + if(sysmem_size < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] Not enough memory to contain front, back, and depth buffers.\n" + "[dri] Disabling DRI.\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle); + pI810->backHandle = agpHandle; + + if (agpHandle != 0) { + if(drmAgpBind(pI810->drmSubFD, agpHandle, pI810->BackOffset) == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] Bound backbuffer memory\n"); + + pI810->BackBuffer.Start = pI810->BackOffset; + pI810->BackBuffer.Size = back_size; + pI810->BackBuffer.End = (pI810->BackBuffer.Start + + pI810->BackBuffer.Size); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Unable to bind backbuffer\n"); + DRICloseScreen(pScreen); + return FALSE; + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] Unable to allocate backbuffer memory\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + drmAgpAlloc(pI810->drmSubFD, back_size, 0, + NULL, &agpHandle); + pI810->zHandle = agpHandle; + + if(agpHandle != 0) { + if(drmAgpBind(pI810->drmSubFD, agpHandle, pI810->DepthOffset) == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Bound depthbuffer memory\n"); + pI810->DepthBuffer.Start = pI810->DepthOffset; + pI810->DepthBuffer.Size = back_size; + pI810->DepthBuffer.End = (pI810->DepthBuffer.Start + + pI810->DepthBuffer.Size); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] Unable to bind depthbuffer\n"); + DRICloseScreen(pScreen); + return FALSE; + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] Unable to allocate depthbuffer memory\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + /* Now allocate and bind the agp space. This memory will include the + * regular framebuffer as well as texture memory. + */ + { + int offset, alloc_size; + + alloc_size = sysmem_size; + + if(alloc_size <= pI810->StolenSize) { + /* We are cheating here. We really should not scale the sysmem_size. + * However we always have at least stolen size here. */ + alloc_size = 0; + offset = 0; + sysmem_size = pI810->StolenSize; + } else { + alloc_size -= pI810->StolenSize; /* Stolen size is in bytes */ + offset = pI810->StolenSize; + } + + if(alloc_size) { + drmAgpAlloc(pI810->drmSubFD, alloc_size, 0, NULL, &agpHandle); + if (agpHandle == 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpAlloc failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } + if (drmAgpBind(pI810->drmSubFD, agpHandle, offset) != 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpBind failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + pI810->sysmemHandle = agpHandle; + } else { + pI810->sysmemHandle = 0; + } + + pI810->SysMem.Start = 0; + pI810->SysMem.Size = sysmem_size; + pI810->SysMem.End = sysmem_size; + pI810->SavedSysMem = pI810->SysMem; + + if(sysmem_size <= pI810->StolenSize) { + tom = pI810->StolenSize; + } else { + tom = pI810->SysMem.End; + } + + } + + drmAgpAlloc(pI810->drmSubFD, 4096, 2, + (unsigned long *)&pI810->CursorPhysical, &agpHandle); + pI810->cursorHandle = agpHandle; + + if (agpHandle != 0) { + 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, "[agp] GART: cursor bind failed\n"); + pI810->CursorPhysical = 0; + } + } + else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: cursor alloc failed\n"); + pI810->CursorPhysical = 0; + } + + /* Steal some of the excess cursor space for the overlay regs, + * then allocate 202*2 pages for the overlay buffers. + */ + pI810->OverlayPhysical = pI810->CursorPhysical + 1024; + pI810->OverlayStart = pI810->CursorStart + 1024; + + /* drmAddMap happens later to preserve index order */ + + /* The tiled registers always describe 8 meg regions, even if + * the actually memory used is less than 8 meg (which is the normal + * case.) + */ + + { + int can_tile, i; + +#define Elements(x) sizeof(x)/sizeof(*x) + + for(i = 0, can_tile = 0; i < Elements(i830_pitches) ; i++) { + if((pScrn->displayWidth * pI810->cpp) == i830_pitches[i]) + can_tile = 1; + } + + if(can_tile) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Activating Tiled Memory\n"); + I810SetTiledMemory(pScrn, 1, + pI810->DepthBuffer.Start, + pScrn->displayWidth * pI810->cpp, + 8*1024*1024); + + I810SetTiledMemory(pScrn, 2, + pI810->BackBuffer.Start, + pScrn->displayWidth * pI810->cpp, + 8*1024*1024); + } + } + + pI810->auxPitch = pScrn->displayWidth; + pI810->auxPitchBits = 0; + + pI830DRI->backbufferSize = pI810->BackBuffer.Size; + + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BackBuffer.Start, + pI810->BackBuffer.Size, DRM_AGP, 0, + &pI830DRI->backbuffer) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(backbuffer) failed. Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + pI830DRI->depthbufferSize = pI810->DepthBuffer.Size; + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->DepthBuffer.Start, + pI810->DepthBuffer.Size, DRM_AGP, 0, + &pI830DRI->depthbuffer) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(depthbuffer) failed. Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + /* Allocate FrontBuffer etc. */ + I810AllocateFront(pScrn); + + /* Allocate memory for the logical context, 32k is fine for right now */ + I810AllocHigh( &(pI810->ContextMem), &(pI810->SysMem), + 32768 ); + + /* Allocate buffer memory */ + I810AllocHigh( &(pI810->BufferMem), &(pI810->SysMem), + I830_DMA_BUF_NR * I830_DMA_BUF_SZ); + + xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] Buffer map : %lx\n", + pI810->BufferMem.Start); + + if (pI810->BufferMem.Start == 0 || + pI810->BufferMem.End - pI810->BufferMem.Start > + I830_DMA_BUF_NR * I830_DMA_BUF_SZ) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[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, "[drm] drmAddMap(buffer_map) failed. Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + pI830DRI->agp_buffers = pI810->buffer_map; + pI830DRI->agp_buf_size = pI810->BufferMem.Size; + + 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, "[drm] drmAddMap(ring_map) failed. Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + /* Use the rest of memory for textures. */ + pI830DRI->textureSize = pI810->SysMem.Size; + + i = mylog2(pI830DRI->textureSize / I830_NR_TEX_REGIONS); + + if (i < I830_LOG_MIN_TEX_REGION_SIZE) + i = I830_LOG_MIN_TEX_REGION_SIZE; + + pI830DRI->logTextureGranularity = i; + pI830DRI->textureSize = (pI830DRI->textureSize >> i) << i; /* truncate */ + + if(pI830DRI->textureSize < 512*1024) { + ErrorF("Less then 512k for textures\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + I810AllocLow( &(pI810->TexMem), &(pI810->SysMem), + pI830DRI->textureSize); + + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->TexMem.Start, + pI810->TexMem.Size, DRM_AGP, 0, + &pI830DRI->textures) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(textures) failed. Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + if((bufs = drmAddBufs(pI810->drmSubFD, + I830_DMA_BUF_NR, + I830_DMA_BUF_SZ, + DRM_AGP_BUFFER, pI810->BufferMem.Start)) <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] failure adding %d %d byte DMA buffers\n", + I830_DMA_BUF_NR, + I830_DMA_BUF_SZ); + DRICloseScreen(pScreen); + return FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n", + bufs, I830_DMA_BUF_SZ); + + + xf86EnablePciBusMaster(pI810->PciInfo, TRUE); + + I830InitDma(pScrn); + + /* Okay now initialize the dma engine */ +#if 1 + if (!pI830DRI->irq) { + pI830DRI->irq = drmGetInterruptFromBusID(pI810->drmSubFD, + ((pciConfigPtr)pI810->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pI810->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pI810->PciInfo->thisCard)->funcnum); + if((drmCtlInstHandler(pI810->drmSubFD, pI830DRI->irq)) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] failure adding irq handler, there is a device already using that irq\n" + "[drm] Consider rearranging your PCI cards\n"); + DRICloseScreen(pScreen); + return FALSE; + } + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] dma control initialized, using IRQ %d\n", + pI830DRI->irq); +#endif + + pI830DRI=(I830DRIPtr)pI810->pDRIInfo->devPrivate; + pI830DRI->deviceID=pI810->PciInfo->chipType; + pI830DRI->width=pScrn->virtualX; + pI830DRI->height=pScrn->virtualY; + pI830DRI->mem=pScrn->videoRam*1024; + pI830DRI->cpp=pI810->cpp; + + pI830DRI->fbOffset=pI810->FrontBuffer.Start; + pI830DRI->fbStride=pI810->auxPitch; + + pI830DRI->bitsPerPixel = pScrn->bitsPerPixel; + + + pI830DRI->textureOffset=pI810->TexMem.Start; + + pI830DRI->backOffset=pI810->BackBuffer.Start; + pI830DRI->depthOffset=pI810->DepthBuffer.Start; + + pI830DRI->ringOffset=pI810->LpRing.mem.Start; + pI830DRI->ringSize=pI810->LpRing.mem.Size; + + pI830DRI->auxPitch = pI810->auxPitch; + pI830DRI->auxPitchBits = pI810->auxPitchBits; + pI830DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); + + if (!(I830InitVisualConfigs(pScreen))) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] I830InitVisualConfigs failed. Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n" ); + pI810->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + + return TRUE; +} + +void +I830DRICloseScreen(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I810Ptr pI810 = I810PTR(pScrn); + + I830CleanupDma(pScrn); + + if(pI810->backHandle) drmAgpFree(pI810->drmSubFD, pI810->backHandle); + if(pI810->zHandle) drmAgpFree(pI810->drmSubFD, pI810->zHandle); + if(pI810->cursorHandle) drmAgpFree(pI810->drmSubFD, pI810->cursorHandle); + if(pI810->sysmemHandle) drmAgpFree(pI810->drmSubFD, pI810->sysmemHandle); + + if(pI810->agpAcquired == TRUE) drmAgpRelease(pI810->drmSubFD); + + pI810->backHandle = 0; + pI810->zHandle = 0; + pI810->cursorHandle = 0; + pI810->sysmemHandle = 0; + pI810->agpAcquired = FALSE; + + + DRICloseScreen(pScreen); + + if (pI810->pDRIInfo) { + if (pI810->pDRIInfo->devPrivate) { + xfree(pI810->pDRIInfo->devPrivate); + pI810->pDRIInfo->devPrivate=0; + } + DRIDestroyInfoRec(pI810->pDRIInfo); + pI810->pDRIInfo=0; + } + if (pI810->pVisualConfigs) xfree(pI810->pVisualConfigs); + if (pI810->pVisualConfigsPriv) xfree(pI810->pVisualConfigsPriv); +} + +static Bool +I830CreateContext(ScreenPtr pScreen, VisualPtr visual, + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore) +{ + return TRUE; +} + +static void +I830DestroyContext(ScreenPtr pScreen, drmContext hwContext, + DRIContextType contextStore) +{ +} + + +Bool +I830DRIFinishScreenInit(ScreenPtr pScreen) +{ + I830SAREARec *sPriv = (I830SAREARec *)DRIGetSAREAPrivate(pScreen); + memset( sPriv, 0, sizeof(sPriv) ); + return DRIFinishScreenInit(pScreen); +} + +void +I830DRISwapContext(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 && + oldContextType == DRI_2D_CONTEXT && + newContextType == DRI_2D_CONTEXT) + { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + if (I810_DEBUG & DEBUG_VERBOSE_DRI) + ErrorF("i830DRISwapContext (in)\n"); + + pI810->LockHeld = 1; + I810RefreshRing( pScrn ); + } + else if (syncType == DRI_2D_SYNC && + oldContextType == DRI_NO_CONTEXT && + newContextType == DRI_2D_CONTEXT) + { + pI810->LockHeld = 0; + if (I810_DEBUG & DEBUG_VERBOSE_DRI) + ErrorF("i830DRISwapContext (out)\n"); + } + else if (I810_DEBUG & DEBUG_VERBOSE_DRI) + ErrorF("i830DRISwapContext (other)\n"); +} + +static void +I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I810Ptr pI810 = I810PTR(pScrn); + BoxPtr pbox = REGION_RECTS(prgn); + int nbox = REGION_NUM_RECTS(prgn); + + if (I810_DEBUG & DEBUG_VERBOSE_DRI) + ErrorF( "I830DRIInitBuffers\n"); + + I830SetupForSolidFill(pScrn, 0, GXcopy, -1); + while (nbox--) { + I810SelectBuffer(pScrn, I810_BACK); + I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + pbox->x2-pbox->x1, pbox->y2-pbox->y1); + pbox++; + } + + /* Clear the depth buffer - uses 0xffff rather than 0. + */ + pbox = REGION_RECTS(prgn); + nbox = REGION_NUM_RECTS(prgn); + + I810SelectBuffer(pScrn, I810_DEPTH); + + switch (pScrn->bitsPerPixel) { + case 16: I830SetupForSolidFill(pScrn, 0xffff, GXcopy, -1); break; + case 32: I830SetupForSolidFill(pScrn, 0xffffff, GXcopy, -1); break; + } + + while (nbox--) { + I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + pbox->x2-pbox->x1, pbox->y2-pbox->y1); + pbox++; + } + + I810SelectBuffer(pScrn, I810_FRONT); + pI810->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 +I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index) +{ + ScreenPtr pScreen = pParent->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I810Ptr pI810 = I810PTR(pScrn); + BoxPtr pboxTmp, pboxNext, pboxBase; + DDXPointPtr pptTmp, pptNew2; + int xdir, ydir; + + int screenwidth = pScrn->virtualX; + int screenheight = pScrn->virtualY; + + BoxPtr pbox = REGION_RECTS(prgnSrc); + int nbox = REGION_NUM_RECTS(prgnSrc); + + BoxPtr pboxNew1 = 0; + BoxPtr pboxNew2 = 0; + DDXPointPtr pptNew1 = 0; + 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 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; + } + + /* SelectBuffer isn't really a good concept for the i810. + */ + I810EmitFlush(pScrn); + I830SetupForScreenToScreenCopy(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 ( 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", + x1, y1, w, h, dx, dy); + + I810SelectBuffer(pScrn, I810_BACK); + I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); + I810SelectBuffer(pScrn, I810_DEPTH); + I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); + } + I810SelectBuffer(pScrn, I810_FRONT); + I810EmitFlush(pScrn); + + if (pboxNew2) { + DEALLOCATE_LOCAL(pptNew2); + DEALLOCATE_LOCAL(pboxNew2); + } + if (pboxNew1) { + DEALLOCATE_LOCAL(pptNew1); + DEALLOCATE_LOCAL(pboxNew1); + } + + pI810->AccelInfoRec->NeedToSync = TRUE; +} + +/* Completely Initialize the first context */ +void +I830EmitInvarientState(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); + I830DRIPtr pI830DRI = (I830DRIPtr)pI810->pDRIInfo->devPrivate; + CARD32 ctx_addr, vtx_addr, vtx1_addr, temp; + BEGIN_LP_RING( 128 ); + + ctx_addr = pI810->ContextMem.Start; + /* Align to a 2k boundry */ + ctx_addr = ((ctx_addr + 2048 - 1) / 2048) * 2048; + + /* Carve out some context memory for the vertex buffers, if we ever + * use these directly, we will need to change this + */ + vtx_addr = ctx_addr + 8192; + vtx1_addr = ctx_addr + 16384; + + OUT_RING(MI_SET_CONTEXT); + OUT_RING(ctx_addr | + CTXT_NO_RESTORE | + CTXT_PALETTE_SAVE_DISABLE | + CTXT_PALETTE_RESTORE_DISABLE); + + /* Zero pitch and width make the vertex buffer match vertex format */ + OUT_RING(MI_VERTEX_BUFFER | + MI_VERTEX_BUFFER_IDX(0) | + MI_VERTEX_BUFFER_PITCH(0) | + MI_VERTEX_BUFFER_WIDTH(0)); + OUT_RING(vtx_addr); + + /* Setting zero pitch and width is undefined so we have to set these to + * one, even though we just disable this buffer. + */ + + OUT_RING(MI_VERTEX_BUFFER | + MI_VERTEX_BUFFER_IDX(1) | + MI_VERTEX_BUFFER_PITCH(1) | + MI_VERTEX_BUFFER_WIDTH(1)); + OUT_RING(vtx1_addr | + MI_VERTEX_BUFFER_DISABLE); + + OUT_RING(STATE3D_AA_CMD | + AA_LINE_ECAAR_WIDTH_ENABLE | + AA_LINE_ECAAR_WIDTH_1_0 | + AA_LINE_REGION_WIDTH_ENABLE | + AA_LINE_REGION_WIDTH_1_0 | + AA_LINE_DISABLE); + + OUT_RING(STATE3D_BUF_INFO_CMD); + OUT_RING(BUF_3D_ID_COLOR_BACK | + BUF_3D_USE_FENCE | + BUF_3D_PITCH((pI810->cpp * pScrn->displayWidth) / 4)); + OUT_RING(BUF_3D_ADDR(pI830DRI->backOffset)); + + OUT_RING(STATE3D_BUF_INFO_CMD); + OUT_RING(BUF_3D_ID_DEPTH | + BUF_3D_USE_FENCE | + BUF_3D_PITCH((pI810->cpp * pScrn->displayWidth) / 4)); + OUT_RING(BUF_3D_ADDR(pI830DRI->depthOffset)); + + OUT_RING(STATE3D_COLOR_FACTOR); + OUT_RING(0); + + OUT_RING(STATE3D_COLOR_FACTOR_CMD(0)); + OUT_RING(0); + + OUT_RING(STATE3D_COLOR_FACTOR_CMD(1)); + OUT_RING(0); + + OUT_RING(STATE3D_COLOR_FACTOR_CMD(2)); + OUT_RING(0); + + OUT_RING(STATE3D_COLOR_FACTOR_CMD(3)); + OUT_RING(0); + + OUT_RING(STATE3D_CONST_BLEND_COLOR_CMD); + OUT_RING(0); + + OUT_RING(STATE3D_DFLT_DIFFUSE_CMD); + OUT_RING(0); + + OUT_RING(STATE3D_DFLT_SPEC_CMD); + OUT_RING(0); + + OUT_RING(STATE3D_DFLT_Z_CMD); + OUT_RING(0); + + switch(pScrn->bitsPerPixel) { + case 15: + temp = DEPTH_FRMT_16_FIXED | COLR_BUF_RGB555; + break; + case 16: + temp = DEPTH_FRMT_16_FIXED | COLR_BUF_RGB565; + break; + case 32: + temp = DEPTH_FRMT_24_FIXED_8_OTHER | COLR_BUF_ARGB8888; + break; + default: + temp = DEPTH_FRMT_16_FIXED | COLR_BUF_RGB565; + break; + } + + OUT_RING(STATE3D_DST_BUF_VARS_CMD); + OUT_RING(DSTORG_HORT_BIAS(0x8) | + DSTORG_VERT_BIAS(0x8) | + DEPTH_IS_Z | + temp); + + OUT_RING(STATE3D_DRAW_RECT_CMD); + OUT_RING(DRAW_RECT_DIS_DEPTH_OFS); + OUT_RING(0); + OUT_RING((pI830DRI->height<<16) | + pI830DRI->width); + OUT_RING(0); + + OUT_RING(STATE3D_ENABLES_1_CMD | + DISABLE_LOGIC_OP | + DISABLE_STENCIL_TEST | + DISABLE_DEPTH_BIAS | + DISABLE_SPEC_ADD | + I830_DISABLE_FOG | + DISABLE_ALPHA_TEST | + DISABLE_COLOR_BLEND | + DISABLE_DEPTH_TEST); + + OUT_RING(STATE3D_ENABLES_2_CMD | + DISABLE_STENCIL_WRITE | + ENABLE_TEX_CACHE | + ENABLE_DITHER | + ENABLE_COLOR_MASK | + ENABLE_COLOR_WRITE | + ENABLE_DEPTH_WRITE); + + OUT_RING(STATE3D_FOG_COLOR_CMD | + FOG_COLOR_RED(0) | + FOG_COLOR_GREEN(0) | + FOG_COLOR_BLUE(0)); + + OUT_RING(STATE3D_FOG_MODE); + OUT_RING(FOG_MODE_VERTEX | + ENABLE_FOG_CONST | + ENABLE_FOG_SOURCE | + ENABLE_FOG_DENSITY); + OUT_RING(0); + OUT_RING(0); + + OUT_RING(STATE3D_INDPT_ALPHA_BLEND_CMD | + DISABLE_INDPT_ALPHA_BLEND | + ENABLE_ALPHA_BLENDFUNC | + ABLENDFUNC_ADD | + ENABLE_SRC_ABLEND_FACTOR | + SRC_ABLEND_FACT(BLENDFACT_ONE) | + ENABLE_DST_ABLEND_FACTOR | + SRC_ABLEND_FACT(BLENDFACT_ZERO)); + + /* I need to come back to texture state */ + OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(0) | + TEXPIPE_COLOR | + TEXBLEND_ARG1 | + TEXBLENDARG_MODIFY_PARMS | + TEXBLENDARG_DIFFUSE); + OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(1) | + TEXPIPE_COLOR | + TEXBLEND_ARG1 | + TEXBLENDARG_MODIFY_PARMS | + TEXBLENDARG_DIFFUSE); + OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(2) | + TEXPIPE_COLOR | + TEXBLEND_ARG1 | + TEXBLENDARG_MODIFY_PARMS | + TEXBLENDARG_DIFFUSE); + OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(3) | + TEXPIPE_COLOR | + TEXBLEND_ARG1 | + TEXBLENDARG_MODIFY_PARMS | + TEXBLENDARG_DIFFUSE); + + OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(0) | + TEXPIPE_ALPHA | + TEXBLEND_ARG1 | + TEXBLENDARG_MODIFY_PARMS | + TEXBLENDARG_DIFFUSE); + OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(1) | + TEXPIPE_ALPHA | + TEXBLEND_ARG1 | + TEXBLENDARG_MODIFY_PARMS | + TEXBLENDARG_DIFFUSE); + OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(2) | + TEXPIPE_ALPHA | + TEXBLEND_ARG1 | + TEXBLENDARG_MODIFY_PARMS | + TEXBLENDARG_DIFFUSE); + OUT_RING(STATE3D_MAP_BLEND_ARG_CMD(3) | + TEXPIPE_ALPHA | + TEXBLEND_ARG1 | + TEXBLENDARG_MODIFY_PARMS | + TEXBLENDARG_DIFFUSE); + + OUT_RING(STATE3D_MAP_BLEND_OP_CMD(0) | + TEXPIPE_COLOR | + ENABLE_TEXOUTPUT_WRT_SEL | + TEXOP_OUTPUT_CURRENT | + DISABLE_TEX_CNTRL_STAGE | + TEXOP_SCALE_1X | + TEXOP_MODIFY_PARMS | + TEXOP_LAST_STAGE | + TEXBLENDOP_ARG1); + OUT_RING(STATE3D_MAP_BLEND_OP_CMD(0) | + TEXPIPE_ALPHA | + ENABLE_TEXOUTPUT_WRT_SEL | + TEXOP_OUTPUT_CURRENT | + TEXOP_SCALE_1X | + TEXOP_MODIFY_PARMS | + TEXBLENDOP_ARG1); + + OUT_RING(STATE3D_MAP_COORD_SETBIND_CMD); + OUT_RING(TEXBIND_SET3(TEXCOORDSRC_DEFAULT) | + TEXBIND_SET2(TEXCOORDSRC_DEFAULT) | + TEXBIND_SET1(TEXCOORDSRC_DEFAULT) | + TEXBIND_SET0(TEXCOORDSRC_DEFAULT)); + + OUT_RING(STATE3D_MAP_COORD_SET_CMD | + MAP_UNIT(0) | + TEXCOORDS_ARE_IN_TEXELUNITS | + TEXCOORDTYPE_CARTESIAN | + ENABLE_ADDR_V_CNTL | + ENABLE_ADDR_U_CNTL | + TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP) | + TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP)); + OUT_RING(STATE3D_MAP_COORD_SET_CMD | + MAP_UNIT(1) | + TEXCOORDS_ARE_IN_TEXELUNITS | + TEXCOORDTYPE_CARTESIAN | + ENABLE_ADDR_V_CNTL | + ENABLE_ADDR_U_CNTL | + TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP) | + TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP)); + OUT_RING(STATE3D_MAP_COORD_SET_CMD | + MAP_UNIT(2) | + TEXCOORDS_ARE_IN_TEXELUNITS | + TEXCOORDTYPE_CARTESIAN | + ENABLE_ADDR_V_CNTL | + ENABLE_ADDR_U_CNTL | + TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP) | + TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP)); + OUT_RING(STATE3D_MAP_COORD_SET_CMD | + MAP_UNIT(3) | + TEXCOORDS_ARE_IN_TEXELUNITS | + TEXCOORDTYPE_CARTESIAN | + ENABLE_ADDR_V_CNTL | + ENABLE_ADDR_U_CNTL | + TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP) | + TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP)); + + OUT_RING(STATE3D_MAP_TEX_STREAM_CMD | + MAP_UNIT(0) | + DISABLE_TEX_STREAM_BUMP | + ENABLE_TEX_STREAM_COORD_SET | + TEX_STREAM_COORD_SET(0) | + ENABLE_TEX_STREAM_MAP_IDX | + TEX_STREAM_MAP_IDX(0)); + OUT_RING(STATE3D_MAP_TEX_STREAM_CMD | + MAP_UNIT(1) | + DISABLE_TEX_STREAM_BUMP | + ENABLE_TEX_STREAM_COORD_SET | + TEX_STREAM_COORD_SET(1) | + ENABLE_TEX_STREAM_MAP_IDX | + TEX_STREAM_MAP_IDX(1)); + OUT_RING(STATE3D_MAP_TEX_STREAM_CMD | + MAP_UNIT(2) | + DISABLE_TEX_STREAM_BUMP | + ENABLE_TEX_STREAM_COORD_SET | + TEX_STREAM_COORD_SET(2) | + ENABLE_TEX_STREAM_MAP_IDX | + TEX_STREAM_MAP_IDX(2)); + OUT_RING(STATE3D_MAP_TEX_STREAM_CMD | + MAP_UNIT(3) | + DISABLE_TEX_STREAM_BUMP | + ENABLE_TEX_STREAM_COORD_SET | + TEX_STREAM_COORD_SET(3) | + ENABLE_TEX_STREAM_MAP_IDX | + TEX_STREAM_MAP_IDX(3)); + + OUT_RING(STATE3D_MAP_FILTER_CMD | + MAP_UNIT(0) | + ENABLE_CHROMA_KEY_PARAMS | + ENABLE_MIP_MODE_FILTER | + MIPFILTER_NEAREST | + ENABLE_MAG_MODE_FILTER | + ENABLE_MIN_MODE_FILTER | + MAG_FILTER(FILTER_NEAREST) | + MIN_FILTER(FILTER_NEAREST)); + OUT_RING(STATE3D_MAP_FILTER_CMD | + MAP_UNIT(1) | + ENABLE_CHROMA_KEY_PARAMS | + ENABLE_MIP_MODE_FILTER | + MIPFILTER_NEAREST | + ENABLE_MAG_MODE_FILTER | + ENABLE_MIN_MODE_FILTER | + MAG_FILTER(FILTER_NEAREST) | + MIN_FILTER(FILTER_NEAREST)); + OUT_RING(STATE3D_MAP_FILTER_CMD | + MAP_UNIT(2) | + ENABLE_CHROMA_KEY_PARAMS | + ENABLE_MIP_MODE_FILTER | + MIPFILTER_NEAREST | + ENABLE_MAG_MODE_FILTER | + ENABLE_MIN_MODE_FILTER | + MAG_FILTER(FILTER_NEAREST) | + MIN_FILTER(FILTER_NEAREST)); + OUT_RING(STATE3D_MAP_FILTER_CMD | + MAP_UNIT(3) | + ENABLE_CHROMA_KEY_PARAMS | + ENABLE_MIP_MODE_FILTER | + MIPFILTER_NEAREST | + ENABLE_MAG_MODE_FILTER | + ENABLE_MIN_MODE_FILTER | + MAG_FILTER(FILTER_NEAREST) | + MIN_FILTER(FILTER_NEAREST)); + + OUT_RING(STATE3D_MAP_INFO_COLR_CMD); + OUT_RING(MAP_INFO_TEX(0) | + MAPSURF_32BIT | + MT_32BIT_ARGB8888 | + MAP_INFO_OUTMUX_F0F1F2F3 | + MAP_INFO_VERTLINESTRIDEOFS_0 | + MAP_INFO_FORMAT_2D | + MAP_INFO_USE_FENCE); + OUT_RING(MAP_INFO_HEIGHT(0) | + MAP_INFO_WIDTH(0)); + OUT_RING(MAP_INFO_BASEADDR(pI810->TexMem.Start)); + OUT_RING(MAP_INFO_DWORD_PITCH(31)); + OUT_RING(MAP_INFO_DFLT_COLR(0)); + + OUT_RING(STATE3D_MAP_INFO_COLR_CMD); + OUT_RING(MAP_INFO_TEX(1) | + MAPSURF_32BIT | + MT_32BIT_ARGB8888 | + MAP_INFO_OUTMUX_F0F1F2F3 | + MAP_INFO_VERTLINESTRIDEOFS_0 | + MAP_INFO_FORMAT_2D | + MAP_INFO_USE_FENCE); + OUT_RING(MAP_INFO_HEIGHT(0) | + MAP_INFO_WIDTH(0)); + OUT_RING(MAP_INFO_BASEADDR(pI810->TexMem.Start)); + OUT_RING(MAP_INFO_DWORD_PITCH(31)); + OUT_RING(MAP_INFO_DFLT_COLR(0)); + + OUT_RING(STATE3D_MAP_INFO_COLR_CMD); + OUT_RING(MAP_INFO_TEX(2) | + MAPSURF_32BIT | + MT_32BIT_ARGB8888 | + MAP_INFO_OUTMUX_F0F1F2F3 | + MAP_INFO_VERTLINESTRIDEOFS_0 | + MAP_INFO_FORMAT_2D | + MAP_INFO_USE_FENCE); + OUT_RING(MAP_INFO_HEIGHT(0) | + MAP_INFO_WIDTH(0)); + OUT_RING(MAP_INFO_BASEADDR(pI810->TexMem.Start)); + OUT_RING(MAP_INFO_DWORD_PITCH(31)); + OUT_RING(MAP_INFO_DFLT_COLR(0)); + + OUT_RING(STATE3D_MAP_INFO_COLR_CMD); + OUT_RING(MAP_INFO_TEX(3) | + MAPSURF_32BIT | + MT_32BIT_ARGB8888 | + MAP_INFO_OUTMUX_F0F1F2F3 | + MAP_INFO_VERTLINESTRIDEOFS_0 | + MAP_INFO_FORMAT_2D | + MAP_INFO_USE_FENCE); + OUT_RING(MAP_INFO_HEIGHT(0) | + MAP_INFO_WIDTH(0)); + OUT_RING(MAP_INFO_BASEADDR(pI810->TexMem.Start)); + OUT_RING(MAP_INFO_DWORD_PITCH(31)); + OUT_RING(MAP_INFO_DFLT_COLR(0)); + + OUT_RING(STATE3D_MAP_LOD_CNTL_CMD | + MAP_UNIT(0) | + ENABLE_TEXLOD_BIAS | + MAP_LOD_BIAS(0)); + OUT_RING(STATE3D_MAP_LOD_CNTL_CMD | + MAP_UNIT(1) | + ENABLE_TEXLOD_BIAS | + MAP_LOD_BIAS(0)); + OUT_RING(STATE3D_MAP_LOD_CNTL_CMD | + MAP_UNIT(2) | + ENABLE_TEXLOD_BIAS | + MAP_LOD_BIAS(0)); + OUT_RING(STATE3D_MAP_LOD_CNTL_CMD | + MAP_UNIT(3) | + ENABLE_TEXLOD_BIAS | + MAP_LOD_BIAS(0)); + + OUT_RING(STATE3D_MAP_LOD_LIMITS_CMD | + MAP_UNIT(0) | + ENABLE_MAX_MIP_LVL | + ENABLE_MIN_MIP_LVL | + LOD_MAX(0) | + LOD_MIN(0)); + OUT_RING(STATE3D_MAP_LOD_LIMITS_CMD | + MAP_UNIT(1) | + ENABLE_MAX_MIP_LVL | + ENABLE_MIN_MIP_LVL | + LOD_MAX(0) | + LOD_MIN(0)); + OUT_RING(STATE3D_MAP_LOD_LIMITS_CMD | + MAP_UNIT(2) | + ENABLE_MAX_MIP_LVL | + ENABLE_MIN_MIP_LVL | + LOD_MAX(0) | + LOD_MIN(0)); + OUT_RING(STATE3D_MAP_LOD_LIMITS_CMD | + MAP_UNIT(3) | + ENABLE_MAX_MIP_LVL | + ENABLE_MIN_MIP_LVL | + LOD_MAX(0) | + LOD_MIN(0)); + + OUT_RING(STATE3D_MAP_COORD_TRANSFORM); + OUT_RING(DISABLE_TEX_TRANSFORM | TEXTURE_SET(0)); + OUT_RING(STATE3D_MAP_COORD_TRANSFORM); + OUT_RING(DISABLE_TEX_TRANSFORM | TEXTURE_SET(1)); + OUT_RING(STATE3D_MAP_COORD_TRANSFORM); + OUT_RING(DISABLE_TEX_TRANSFORM | TEXTURE_SET(2)); + OUT_RING(STATE3D_MAP_COORD_TRANSFORM); + OUT_RING(DISABLE_TEX_TRANSFORM | TEXTURE_SET(3)); + + /* End texture state */ + + OUT_RING(STATE3D_MODES_1_CMD | + ENABLE_COLR_BLND_FUNC | + BLENDFUNC_ADD | + ENABLE_SRC_BLND_FACTOR | + ENABLE_DST_BLND_FACTOR | + SRC_BLND_FACT(BLENDFACT_ONE) | + DST_BLND_FACT(BLENDFACT_ZERO)); + + OUT_RING(STATE3D_MODES_2_CMD | + ENABLE_GLOBAL_DEPTH_BIAS | + GLOBAL_DEPTH_BIAS(0) | + ENABLE_ALPHA_TEST_FUNC | + ALPHA_TEST_FUNC(COMPAREFUNC_ALWAYS) | + ALPHA_REF_VALUE(0)); + + OUT_RING(STATE3D_MODES_3_CMD | + ENABLE_DEPTH_TEST_FUNC | + DEPTH_TEST_FUNC(COMPAREFUNC_LESS) | + ENABLE_ALPHA_SHADE_MODE | + ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) | + ENABLE_FOG_SHADE_MODE | + FOG_SHADE_MODE(SHADE_MODE_LINEAR) | + ENABLE_SPEC_SHADE_MODE | + SPEC_SHADE_MODE(SHADE_MODE_LINEAR) | + ENABLE_COLOR_SHADE_MODE | + COLOR_SHADE_MODE(SHADE_MODE_LINEAR) | + ENABLE_CULL_MODE | + CULLMODE_NONE); + + OUT_RING(STATE3D_MODES_4_CMD | + ENABLE_LOGIC_OP_FUNC | + LOGIC_OP_FUNC(LOGICOP_COPY) | + ENABLE_STENCIL_TEST_MASK | + STENCIL_TEST_MASK(0xff) | + ENABLE_STENCIL_WRITE_MASK | + STENCIL_WRITE_MASK(0xff)); + + OUT_RING(STATE3D_MODES_5_CMD | + ENABLE_SPRITE_POINT_TEX | + SPRITE_POINT_TEX_OFF | + FLUSH_RENDER_CACHE | + FLUSH_TEXTURE_CACHE | + ENABLE_FIXED_LINE_WIDTH | + FIXED_LINE_WIDTH(0x2) | + ENABLE_FIXED_POINT_WIDTH | + FIXED_POINT_WIDTH(1)); + + OUT_RING(STATE3D_RASTER_RULES_CMD | + ENABLE_POINT_RASTER_RULE | + OGL_POINT_RASTER_RULE | + ENABLE_LINE_STRIP_PROVOKE_VRTX | + ENABLE_TRI_FAN_PROVOKE_VRTX | + ENABLE_TRI_STRIP_PROVOKE_VRTX | + LINE_STRIP_PROVOKE_VRTX(1) | + TRI_FAN_PROVOKE_VRTX(2) | + TRI_STRIP_PROVOKE_VRTX(2)); + + OUT_RING(STATE3D_SCISSOR_ENABLE_CMD | + DISABLE_SCISSOR_RECT); + + OUT_RING(STATE3D_SCISSOR_RECT_0_CMD); + OUT_RING(0); + OUT_RING(0); + + OUT_RING(STATE3D_STENCIL_TEST_CMD | + ENABLE_STENCIL_PARMS | + STENCIL_FAIL_OP(STENCILOP_KEEP) | + STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_KEEP) | + STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_KEEP) | + ENABLE_STENCIL_TEST_FUNC | + STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS) | + ENABLE_STENCIL_REF_VALUE | + STENCIL_REF_VALUE(0)); + + OUT_RING(VRTX_FORMAT_NTEX(1)); + + OUT_RING(STATE3D_VERTEX_FORMAT_2_CMD | + VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) | + VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) | + VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) | + VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D) | + VRTX_TEX_SET_4_FMT(TEXCOORDFMT_2D) | + VRTX_TEX_SET_5_FMT(TEXCOORDFMT_2D) | + VRTX_TEX_SET_6_FMT(TEXCOORDFMT_2D) | + VRTX_TEX_SET_7_FMT(TEXCOORDFMT_2D)); + + OUT_RING(STATE3D_VERTEX_TRANSFORM); + OUT_RING(DISABLE_VIEWPORT_TRANSFORM | + DISABLE_PERSPECTIVE_DIVIDE); + + OUT_RING(STATE3D_W_STATE_CMD); + OUT_RING(MAGIC_W_STATE_DWORD1); + OUT_RING(0x3f800000 /* 1.0 in IEEE float */); + + ADVANCE_LP_RING(); +} Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h:1.2 --- /dev/null Fri Jan 18 15:25:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h Sat Oct 27 23:33:33 2001 @@ -0,0 +1,120 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.2 2001/10/28 03:33:33 tsi Exp $ */ + +#ifndef _I830_DRI_H +#define _I830_DRI_H + +#include <xf86drm.h> +#include <xf86drmI830.h> + +#define I830_MAX_DRAWABLES 256 + +#define I830_MAJOR_VERSION 1 +#define I830_MINOR_VERSION 0 +#define I830_PATCHLEVEL 0 + +#define I830_REG_SIZE 0x80000 + +typedef struct _I830DRIRec { + drmHandle regs; + drmSize regsSize; + drmAddress regsMap; + + drmSize backbufferSize; + drmHandle backbuffer; + + drmSize depthbufferSize; + drmHandle depthbuffer; + + drmHandle textures; + int textureSize; + + drmHandle agp_buffers; + drmSize agp_buf_size; + + int deviceID; + int width; + int height; + int mem; + int cpp; + int bitsPerPixel; + int fbOffset; + int fbStride; + + int backOffset; + int depthOffset; + + int auxPitch; + int auxPitchBits; + + int logTextureGranularity; + int textureOffset; + + /* For non-dma direct rendering. + */ + int ringOffset; + int ringSize; + + drmBufMapPtr drmBufs; + int irq; + int sarea_priv_offset; +} I830DRIRec, *I830DRIPtr; + +typedef struct { + /* Nothing here yet */ + int dummy; +} I830ConfigPrivRec, *I830ConfigPrivPtr; + +typedef struct { + /* Nothing here yet */ + int dummy; +} I830DRIContextRec, *I830DRIContextPtr; + +/* Warning: If you change the SAREA structure you must change the kernel + * structure as well */ + +typedef struct _I830TexRegion { + 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 */ +} I830TexRegion; + +typedef struct _I830SAREA { + unsigned int ContextState[I830_CTX_SETUP_SIZE]; + unsigned int BufferState[I830_DEST_SETUP_SIZE]; + unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE]; + unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE]; + unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT]; + unsigned int Palette[2][256]; + unsigned int dirty; + + unsigned int nbox; + XF86DRIClipRectRec boxes[I830_NR_SAREA_CLIPRECTS]; + + /* 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. + */ + + I830TexRegion texList[I830_NR_TEX_REGIONS+1]; + /* Last elt is sentinal */ + int texAge; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + int ctxOwner; /* last context to upload state */ + + int vertex_prim; +} I830SAREARec, *I830SAREAPtr; + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c:1.7 --- /dev/null Fri Jan 18 15:25:27 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c Tue Jan 8 13:59:29 2002 @@ -0,0 +1,2519 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.7 2002/01/08 18:59:29 dawes Exp $ */ +/************************************************************************** + +Copyright 2001 VA Linux Systems Inc., Fremont, California. + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +on the rights to use, copy, modify, merge, publish, distribute, sub +license, and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + + +**************************************************************************/ + +/* Author: Jeff Hartmann <jhartmann@valinux.com> + */ + +/* Heavily based on the VESA driver written by: + * Paulo César Pereira de Andrade <pcpa@conectiva.com.br> + */ + +/* + * Changes: + * + * 23/08/2001 Abraham van der Merwe <abraham@2d3d.co.za> + * - Fixed display timing bug (mode information for some + * modes were not initialized correctly) + * - Added workarounds for GTT corruptions (I don't adjust + * the pitches for 1280x and 1600x modes so we don't + * need extra memory) + * - The code will now default to 60Hz if LFP is connected + * - Added different refresh rate setting code to work + * around 0x4f02 BIOS bug + * - BIOS workaround for some mode sets (I use legacy BIOS + * calls for setting those) + * - Removed 0x4f04, 0x01 (save state) BIOS call which causes + * LFP to malfunction (do some house keeping and restore + * modes ourselves instead - not perfect, but at least the + * LFP is working now) + * - Several other smaller bug fixes + * + * 06/09/2001 Abraham van der Merwe <abraham@2d3d.co.za> + * - Preliminary local memory support (works without agpgart) + * - DGA fixes (the code were still using i810 mode sets, etc.) + * - agpgart fixes + * + * 18/09/2001 + * - Proper local memory support (should work correctly now + * with/without agpgart module) + * - more agpgart fixes + * - got rid of incorrect GTT adjustments + * + * 09/10/2001 + * - Changed the DPRINTF() variadic macro to an ANSI C compatible + * version + * + * 10/10/2001 + * - Fixed DPRINTF_stub(). I forgot the __...__ macros in there + * instead of the function arguments :P + * - Added a workaround for the 1600x1200 bug (Text mode corrupts + * when you exit from any 1600x1200 mode and 1280x1024@85Hz. I + * suspect this is a BIOS bug (hence the 1280x1024@85Hz case). + * For now I'm switching to 800x600@60Hz then to 80x25 text mode + * and then restoring the registers - very ugly indeed. + * + * 15/10/2001 + * - Improved 1600x1200 mode set workaround. The previous workaround + * was causing mode set problems later on. + * + * 18/10/2001 + * - Fixed a bug in I830BIOSLeaveVT() which caused a bug when you + * switched VT's + */ + +#include "xf86.h" +#include "xf86_ansic.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86RAC.h" +#include "xf86cmap.h" +#include "compiler.h" +#include "mibstore.h" +#include "vgaHW.h" +#include "mipointer.h" +#include "micmap.h" + +#include "fb.h" +#include "miscstruct.h" +#include "xf86xv.h" +#include "Xv.h" +#include "vbe.h" + +#include "i810.h" + +#ifdef XF86DRI +#include "dri.h" +#endif + +#define BIT(x) (1 << (x)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define NB_OF(x) (sizeof (x) / sizeof (*x)) + +static SymTabRec I830BIOSChipsets[] = { + { PCI_CHIP_I830_M, "i830"}, + { -1, NULL } +}; + +static PciChipsets I830BIOSPciChipsets[] = { + { PCI_CHIP_I830_M, PCI_CHIP_I830_M, RES_SHARED_VGA }, + { -1, -1, RES_UNDEFINED } +}; + +static OptionInfoRec I830BIOSOptions[] = { + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, + { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE}, + { OPTION_STRETCH, "Stretch", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_CENTER, "Center", OPTV_BOOLEAN, {0}, FALSE}, + { -1, NULL, OPTV_NONE, {0}, FALSE} +}; + + +static VBEInfoBlock *I830VESAGetVBEInfo(ScrnInfoPtr pScrn); +static Bool I830BIOSGetRec(ScrnInfoPtr pScrn); +static void I830BIOSFreeRec(ScrnInfoPtr pScrn); +static void SaveFonts(ScrnInfoPtr pScrn); +static void RestoreFonts(ScrnInfoPtr pScrn); +static Bool I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); +static void I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, + int PowerManagementMode, + int flags); + +#ifdef I830DEBUG +void DPRINTF_stub (const char *filename,int line,const char *function,const char *fmt, ...) { + va_list ap; + fprintf (stderr, + "\n##############################################\n" + "*** In function %s, on line %d, in file %s ***\n", + function,line,filename); + va_start (ap,fmt); + vfprintf (stderr,fmt,ap); + va_end (ap); + fprintf (stderr, + "##############################################\n\n"); + fflush (stderr); +} +#else /* #ifdef I830DEBUG */ +void DPRINTF_stub (const char *filename,int line,const char *function,const char *fmt, ...) { + /* do nothing */ +} +#endif /* #ifdef I830DEBUG */ + +const OptionInfoRec * +I830BIOSAvailableOptions(int chipid, int busid) +{ + int i; + + for(i = 0; I830BIOSPciChipsets[i].PCIid > 0; i++) { + if(chipid == I830BIOSPciChipsets[i].PCIid) return I830BIOSOptions; + } + return NULL; +} + +static VBEInfoBlock * +I830VESAGetVBEInfo(ScrnInfoPtr pScrn) +{ + I810Ptr pI810; + VESAPtr pVesa; + VBEInfoBlock *block = NULL; + int i, pStr, pModes; + char *str; + CARD16 major, minor, *modes; + + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + + bzero(pVesa->block, sizeof(VBEInfoBlock)); + + 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_wrapper(pVesa->pInt, pScrn); + + 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; +} + +ModeInfoBlock * I830VESAGetModeInfo (ScrnInfoPtr pScrn,int mode) +{ + I810Ptr pI810; + VESAPtr pVesa; + ModeInfoBlock *block = NULL; + + pI810 = I810PTR (pScrn); + pVesa = pI810->vesa; + + bzero (pVesa->block,sizeof (ModeInfoBlock)); + + 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_wrapper (pVesa->pInt,pScrn); + 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); + } + else memcpy (&block->PhysBasePtr,pVesa->block + 40,216); + + return (block); +} + +static Bool +I830BIOSGetRec(ScrnInfoPtr pScrn) +{ + I810Ptr pI810; + + if(pScrn->driverPrivate) return TRUE; + pI810 = pScrn->driverPrivate = xnfcalloc(sizeof(I810Rec), 1); + pI810->vesa = xcalloc(sizeof(VESARec), 1); + return TRUE; +} + +static void +I830BIOSFreeRec(ScrnInfoPtr pScrn) +{ + I810Ptr pI810; + VESAPtr pVesa; + DisplayModePtr mode; + + if(!pScrn) return; + if(!pScrn->driverPrivate) return; + + pI810 = I810PTR(pScrn); + mode = pScrn->modes; + pVesa = pI810->vesa; + + if (mode) { + do { + if(mode->Private) { + ModeInfoData *data = (ModeInfoData*)mode->Private; + + if(data->block) xfree(data->block); + xfree(data); + mode->Private = NULL; + } + mode = mode->next; + } while(mode && mode != pScrn->modes); + } + + if(pVesa->monitor) xfree(pVesa->monitor); + if(pVesa->vbeInfo) xfree(pVesa->vbeInfo); + if(pVesa->pal) xfree(pVesa->pal); + if(pVesa->savedPal) xfree(pVesa->savedPal); + if(pVesa->fonts) xfree(pVesa->fonts); + xfree(pScrn->driverPrivate); + pScrn->driverPrivate=0; +} + +void +I830BIOSProbeDDC(ScrnInfoPtr pScrn, int index) +{ + vbeInfoPtr pVbe; + + if (xf86LoadSubModule(pScrn, "vbe")) { + pVbe = VBEInit(NULL,index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + } +} + +void +I830VESAFreeModeInfo(ModeInfoBlock *block) +{ + xfree(block); +} + +static Bool +I830DetectDisplayDevice(ScrnInfoPtr pScrn) +{ + I810Ptr pI810; + VESAPtr pVesa; + + pI810 = I810PTR (pScrn); + pVesa = pI810->vesa; + + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x5f64; + pVesa->pInt->bx = 0x0100; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + + if (pVesa->pInt->ax != 0x005f) + { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Failed to detect active display devices\n"); + return (FALSE); + } + + pI810->configured_device = pVesa->pInt->cx; + +#define PIPEA_CRT_ACTIVE 0x01 +#define PIPEA_LCD_ACTIVE 0x08 + /* Anything on Pipe A? */ + if (pVesa->pInt->cx & 0xff) + { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Currently active displays on Pipe A:\n"); + + if (pVesa->pInt->cx & PIPEA_CRT_ACTIVE) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," CRT\n"); + + if (pVesa->pInt->cx & 0x02) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," TV child device\n"); + + if (pVesa->pInt->cx & 0x04) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," DFP child device\n"); + + if (pVesa->pInt->cx & PIPEA_LCD_ACTIVE) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," LFP (Local Flat Panel) child device\n"); + + if (pVesa->pInt->cx & 0xf0) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," Some unknown display devices may also be present\n"); + } + +#define PIPEB_CRT_ACTIVE 0x0100 +#define PIPEB_LCD_ACTIVE 0x0800 + /* Anything on Pipe B? */ + if (pVesa->pInt->cx & 0xff00) + { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Currently active displays on Pipe B:\n"); + + if (pVesa->pInt->cx & PIPEB_CRT_ACTIVE) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," CRT\n"); + + if (pVesa->pInt->cx & 0x0200) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," TV child device\n"); + + if (pVesa->pInt->cx & 0x0400) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," DFP child device\n"); + + if (pVesa->pInt->cx & PIPEB_LCD_ACTIVE) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," LFP (Local Flat Panel) child device\n"); + + if (pVesa->pInt->cx & 0xf000) + xf86DrvMsg (pScrn->scrnIndex,X_INFO," Some unknown display devices may also be present\n"); + } + + return (TRUE); +} + +static int I830DetectMemory (ScrnInfoPtr pScrn) +{ + I810Ptr pI810; + VESAPtr pVesa; + PCITAG bridge; + CARD16 gmch_ctrl; + int memsize; + + pI810 = I810PTR (pScrn); + pVesa = pI810->vesa; + + bridge = pciTag (0,0,0); /* This is always the host bridge */ + gmch_ctrl = pciReadWord (bridge,I830_GMCH_CTRL); + + switch (gmch_ctrl & I830_GMCH_GMS_MASK) + { + case I830_GMCH_GMS_STOLEN_512: + memsize = KB (512); + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"detected %dK stolen memory.\n",memsize / 1024); + break; + case I830_GMCH_GMS_STOLEN_1024: + memsize = MB (1); + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"detected %dK stolen memory.\n",memsize / 1024); + break; + case I830_GMCH_GMS_STOLEN_8192: + memsize = MB (8); + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"detected %dK stolen memory.\n",memsize / 1024); + break; + case I830_GMCH_GMS_LOCAL: + /* I'd like to use the VGA controller registers here, but MMIOBase isn't + * yet, so for now, we'll just use the BIOS instead... */ + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x5f10; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + memsize = pVesa->pInt->cx * KB (1); + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"detected %dK local memory.\n",memsize / 1024); + break; + default: + /* not that this is possible, but anyway (: */ + memsize = 0; + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"no video memory detected.\n"); + } + + return (memsize); +} + +Bool I830BIOSPreInit (ScrnInfoPtr pScrn,int flags) +{ + vgaHWPtr hwp; + I810Ptr pI810; + MessageType from; + rgb defaultWeight = { 0, 0, 0 }; + VESAPtr pVesa; + VBEInfoBlock *vbe; + DisplayModePtr pMode,tmp; + ModeInfoBlock *mode; + ModeInfoData *data = NULL; + vbeInfoPtr pVbe; + pointer pVbeModule,pDDCModule; + int mem; + int flags24; + int i = 0; + + if(pScrn->numEntities != 1) return (FALSE); + + /* The vgahw module should be loaded here when needed */ + if (!xf86LoadSubModule (pScrn,"vgahw")) return (FALSE); + xf86LoaderReqSymLists (I810vgahwSymbols,NULL); + + /* Load int10 module */ + if (!xf86LoadSubModule (pScrn,"int10")) return (FALSE); + xf86LoaderReqSymLists (I810int10Symbols,NULL); + + /* Allocate a vgaHWRec */ + if (!vgaHWGetHWRec (pScrn)) return (FALSE); + + /* Allocate driverPrivate */ + if (!I830BIOSGetRec (pScrn)) return (FALSE); + + pI810 = I810PTR (pScrn); + pI810->pEnt = xf86GetEntityInfo (pScrn->entityList[0]); + + if (pI810->pEnt->location.type != BUS_PCI) return (FALSE); + + if (flags & PROBE_DETECT) + { + I830BIOSProbeDDC (pScrn,pI810->pEnt->index); + return (TRUE); + } + + pI810->PciInfo = xf86GetPciInfoForEntity (pI810->pEnt->index); + pI810->PciTag = pciTag (pI810->PciInfo->bus,pI810->PciInfo->device,pI810->PciInfo->func); + + if (xf86RegisterResources (pI810->pEnt->index,0,ResNone)) + return (FALSE); + + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; + pScrn->monitor = pScrn->confScreen->monitor; + pScrn->progClock = TRUE; + pScrn->rgbBits = 8; + + flags24 = Support32bppFb | PreferConvert24to32 | SupportConvert24to32; + + if (!xf86SetDepthBpp (pScrn,8,8,8,flags24)) return (FALSE); + switch (pScrn->depth) + { + case 8: + case 15: + case 16: + case 24: + break; + default: + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Given depth (%d) is not supported by I830 driver\n",pScrn->depth); + return (FALSE); + } + xf86PrintDepthBpp (pScrn); + + if (!xf86SetWeight (pScrn,defaultWeight,defaultWeight)) + return (FALSE); + if (!xf86SetDefaultVisual (pScrn,-1)) + return (FALSE); + + hwp = VGAHWPTR (pScrn); + pI810->cpp = pScrn->bitsPerPixel / 8; + + /* Process the options */ + xf86CollectOptions (pScrn,NULL); + xf86ProcessOptions (pScrn->scrnIndex,pScrn->options,I830BIOSOptions); + + /* We have to use PIO to probe, because we haven't mapped yet */ + I810SetPIOAccess (pI810); + + pVesa = pI810->vesa; + + /* Initialize Vesa record */ + + if ((pVesa->pInt = xf86InitInt10(pI810->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); + } + + /* Set the Chipset and ChipRev, allowing config file entries to override. */ + if (pI810->pEnt->device->chipset && *pI810->pEnt->device->chipset) + { + pScrn->chipset = pI810->pEnt->device->chipset; + from = X_CONFIG; + } + else if (pI810->pEnt->device->chipID >= 0) + { + pScrn->chipset = (char *) xf86TokenToString (I830BIOSChipsets,pI810->pEnt->device->chipID); + from = X_CONFIG; + xf86DrvMsg (pScrn->scrnIndex,X_CONFIG,"ChipID override: 0x%04X\n",pI810->pEnt->device->chipID); + } + else + { + from = X_PROBED; + pScrn->chipset = (char *) xf86TokenToString (I830BIOSChipsets,pI810->PciInfo->chipType); + } + + if (pI810->pEnt->device->chipRev >= 0) + xf86DrvMsg (pScrn->scrnIndex,X_CONFIG,"ChipRev override: %d\n",pI810->pEnt->device->chipRev); + + xf86DrvMsg (pScrn->scrnIndex,from,"Chipset: \"%s\"\n",(pScrn->chipset != NULL) ? pScrn->chipset : "Unknown i810"); + + if (pI810->pEnt->device->MemBase != 0) + { + pI810->LinearAddr = pI810->pEnt->device->MemBase; + from = X_CONFIG; + } + else + { + if (pI810->PciInfo->memBase[1] != 0) + { + pI810->LinearAddr = pI810->PciInfo->memBase[0] & 0xFF000000; + from = X_PROBED; + } + else + { + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"No valid FB address in PCI config space\n"); + I830BIOSFreeRec (pScrn); + return (FALSE); + } + } + + xf86DrvMsg (pScrn->scrnIndex,from,"Linear framebuffer at 0x%lX\n",(unsigned long) pI810->LinearAddr); + + if (pI810->pEnt->device->IOBase != 0) + { + pI810->MMIOAddr = pI810->pEnt->device->IOBase; + from = X_CONFIG; + } + else + { + if (pI810->PciInfo->memBase[1]) + { + pI810->MMIOAddr = pI810->PciInfo->memBase[1] & 0xFFF80000; + from = X_PROBED; + } + else + { + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"No valid MMIO address in PCI config space\n"); + I830BIOSFreeRec (pScrn); + return (FALSE); + } + } + + xf86DrvMsg (pScrn->scrnIndex,from,"IO registers at addr 0x%lX\n",(unsigned long) pI810->MMIOAddr); + + { + PCITAG bridge; + CARD16 gmch_ctrl; + + bridge = pciTag (0,0,0); /* This is always the host bridge */ + gmch_ctrl = pciReadWord (bridge,I830_GMCH_CTRL); + if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) + { + pI810->FbMapSize = 0x7000000; + pI810->DepthOffset = 0x7000000; + pI810->BackOffset = 0x7800000; + } + else + { + pI810->FbMapSize = 0x3000000; + pI810->DepthOffset = 0x3000000; + pI810->BackOffset = 0x3800000; + } + } + + /* FIXME: Get rid of StolenSize/StolenOnly */ + pI810->StolenSize = I830DetectMemory (pScrn); + + /* Default to stolen/local memory size or 8MB whichever is bigger */ + if (!pI810->pEnt->device->videoRam) + { + from = X_DEFAULT; + pScrn->videoRam = pI810->StolenSize / 1024; + if (pScrn->videoRam < 8192) pScrn->videoRam = 8192; + } + else + { + from = X_DEFAULT; + pScrn->videoRam = pI810->pEnt->device->videoRam; + } + + mem = I810CheckAvailableMemory (pScrn); + pI810->StolenOnly = FALSE; + + DPRINTF (PFX, + "Available memory: %dk\n" + "Requested memory: %dk (see XF86Config-4)\n", + mem,pScrn->videoRam); + + if (mem < 0) + { + xf86DrvMsg (pScrn->scrnIndex,X_WARNING, + "/dev/agpgart is either not available, or no memory " + "is available\nfor allocation. Using stolen memory only.\n"); + pScrn->videoRam = pI810->StolenSize / 1024; + pI810->StolenOnly = TRUE; + } + + xf86DrvMsg (pScrn->scrnIndex,from,"Will alloc AGP framebuffer: %d kByte\n",pScrn->videoRam); + + /* + * If the driver can do gamma correction, it should call xf86SetGamma() here. + */ + + { + Gamma zeros = { 0.0, 0.0, 0.0 }; + + if (!xf86SetGamma (pScrn,zeros)) return (FALSE); + } + + if (!I830DetectDisplayDevice (pScrn)) + { + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Couldn't detect display devices.\n"); + return (FALSE); + } + + vbe = I830VESAGetVBEInfo(pScrn); + pVesa->major = (unsigned)(vbe->VESAVersion >> 8); + pVesa->minor = vbe->VESAVersion & 0xff; + pVesa->vbeInfo = vbe; + + /* Load vbe module */ + if((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL) return FALSE; + xf86LoaderReqSymLists(I810vbeSymbols, NULL); + if((pVbe = VBEInit(pVesa->pInt, pVesa->pEnt->index)) == NULL) return FALSE; + + /* Load ddc module */ + if((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) return FALSE; + xf86LoaderReqSymLists(I810ddcSymbols, NULL); + + if((pVesa->monitor = vbeDoEDID(pVbe, pDDCModule)) != NULL) { + xf86PrintEDID(pVesa->monitor); + } + + /* unload modules */ + xf86UnloadSubModule(pVbeModule); + xf86UnloadSubModule(pDDCModule); + /* Set display resolution */ + xf86SetDpi(pScrn, 0, 0); + +#define VIDEO_BIOS_SCRATCH 0x18 + + /* Enable hot keys by writing the proper value to GR18 */ + { + CARD8 gr18; + gr18 = pI810->readControl(pI810, GRX, VIDEO_BIOS_SCRATCH); + gr18 &= ~0x80; /* Clear Hot key bit so that Video BIOS performs + * the hot key servicing */ + pI810->writeControl(pI810, GRX, VIDEO_BIOS_SCRATCH, gr18); + } + + if((pScrn->monitor->DDC = pVesa->monitor) != NULL) + xf86SetDDCproperties(pScrn, pVesa->monitor); + + /* New way of processing video modes */ + for (i = 0; i <= 0x7f; i++) + { + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x5f28; + pVesa->pInt->bx = 0x8000 | i; + pVesa->pInt->cx = 0x8000; /* Current display device */ + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + + if(pVesa->pInt->ax != 0x005f) continue; + + if ((mode = I830VESAGetModeInfo (pScrn,i)) == NULL) continue; + + if (!(mode->ModeAttributes & (1 << 0)) || /* supported in the configured hardware */ + !(mode->ModeAttributes & (1 << 4)) || /* text mode */ + (pScrn->bitsPerPixel != 1 && !(mode->ModeAttributes & (1 << 3))) || /* monochrome */ + (mode->BitsPerPixel > 8 && (mode->RedMaskSize + mode->GreenMaskSize + mode->BlueMaskSize != pScrn->depth)) || + /* only linear mode, but no PhysBasePtr */ + ((mode->ModeAttributes & (1 << 6)) && (mode->ModeAttributes & (1 << 7)) && !mode->PhysBasePtr) || + ((mode->ModeAttributes & (1 << 6)) && !(mode->ModeAttributes & (1 << 7))) || mode->BitsPerPixel != pScrn->bitsPerPixel) + { + I830VESAFreeModeInfo (mode); + continue; + } + + pMode = xcalloc (sizeof (DisplayModeRec),1); + pMode->prev = pMode->next = NULL; + + pMode->status = MODE_OK; + pMode->type = M_T_DEFAULT; /*M_T_BUILTIN;*/ + + /* for adjust frame */ + pMode->HDisplay = mode->XResolution; + pMode->VDisplay = mode->YResolution; + + data = xcalloc (sizeof (ModeInfoData),1); + data->mode = i; + data->data = mode; + pMode->PrivSize = sizeof (ModeInfoData); + pMode->Private = (INT32*) data; + + if (pScrn->modePool == NULL) + { + pScrn->modePool = pMode; + pMode->next = pMode->prev = pMode; + } + else + { + tmp = pScrn->modePool; + tmp->prev = pMode; + while (tmp->next != pScrn->modePool) tmp = tmp->next; + tmp->next = pMode; + pMode->prev = tmp; + pMode->next = pScrn->modePool; + } + } + + if (pScrn->modePool == NULL) return FALSE; + + for (i = 0; pScrn->modePool != NULL && pScrn->display->modes[i] != NULL; i++) + { + pMode = pScrn->modePool; + + do + { + DisplayModePtr next = pMode->next; + int width, height; + + if (sscanf (pScrn->display->modes[i],"%dx%d",&width,&height) == 2 && + width == pMode->HDisplay && height == pMode->VDisplay) + { + pMode->name = strdup(pScrn->display->modes[i]); + + pMode->prev->next = pMode->next; + pMode->next->prev = pMode->prev; + + if (pScrn->modes == NULL) + { + pScrn->modes = pMode; + pMode->next = pMode->prev = pMode; + } + else + { + tmp = pScrn->modes; + tmp->prev = pMode; + while (tmp->next != pScrn->modes) tmp = tmp->next; + pMode->prev = tmp; + tmp->next = pMode; + pMode->next = pScrn->modes; + } + + if (pMode == pScrn->modePool) + pScrn->modePool = next == pMode ? NULL : next; + break; + } + + pMode = next; + } + while (pMode != pScrn->modePool && pScrn->modePool != NULL); + } + + if (pScrn->modes == NULL) + { + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"No matching modes found in configuration file.\n"); + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Only the following modes are supported by the BIOS in this bpp:\n"); + pMode = pScrn->modePool; + do + { + data = (ModeInfoData *) pMode->Private; + mode = data->data; + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"%dx%d\n",mode->XResolution,mode->YResolution); + pMode = pMode->next; + } + while (pMode != pScrn->modePool); + + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Please choose one of these modes.\n"); + + return (FALSE); + } + + tmp = pScrn->modes; + do + { + mode = ((ModeInfoData *) tmp->Private)->data; + if (mode->XResolution > pScrn->virtualX) + { + pScrn->virtualX = mode->XResolution; + pVesa->maxBytesPerScanline = mode->BytesPerScanline; + } + if (mode->YResolution > pScrn->virtualY) + pScrn->virtualY = mode->YResolution; + } + while ((tmp = tmp->next) != pScrn->modes); + + if (pVesa->monitor != NULL) + { + DisplayModePtr tmp; + int dotclock = 0; + float hsync,vrefresh; + + pMode = pScrn->modes; + do + { + for (tmp = pScrn->monitor->Modes; tmp != NULL; tmp = tmp->next) + if (!strcmp (pMode->name,tmp->name) && dotclock < tmp->Clock) + { +#ifdef I830DEBUG + fprintf (stderr,"##############################################\n"); + { + char flags[256]; + + *flags = '\0'; + + if (tmp->HSkew) sprintf (flags,"%s hskew %d",flags,tmp->HSkew); + if (tmp->VScan) sprintf (flags,"%s vscan %d",flags,tmp->VScan); + if (tmp->Flags & V_INTERLACE) strcat (flags," interlace"); + if (tmp->Flags & V_CSYNC) strcat (flags," composite"); + if (tmp->Flags & V_DBLSCAN) strcat (flags," doublescan"); + if (tmp->Flags & V_BCAST) strcat (flags," bcast"); + if (tmp->Flags & V_PHSYNC) strcat (flags," +hsync"); + if (tmp->Flags & V_NHSYNC) strcat (flags," -hsync"); + if (tmp->Flags & V_PVSYNC) strcat (flags," +vsync"); + if (tmp->Flags & V_NVSYNC) strcat (flags," -vsync"); + if (tmp->Flags & V_PCSYNC) strcat (flags," +csync"); + if (tmp->Flags & V_NCSYNC) strcat (flags," -csync"); + fprintf (stderr, + "Modeline \"%s\" %6.2f %d %d %d %d %d %d %d %d%s\n", + tmp->name, + tmp->Clock / 1000.0, + tmp->HDisplay,tmp->HSyncStart,tmp->HSyncEnd,tmp->HTotal, + tmp->VDisplay,tmp->VSyncStart,tmp->VSyncEnd,tmp->VTotal, + flags); + } + fprintf (stderr,"##############################################\n"); +#endif + + pMode->Clock = tmp->Clock; + pMode->HDisplay = tmp->HDisplay; + pMode->HSyncStart = tmp->HSyncStart; + pMode->HSyncEnd = tmp->HSyncEnd; + pMode->HTotal = tmp->HTotal; + pMode->HSkew = tmp->HSkew; + pMode->VDisplay = tmp->VDisplay; + pMode->VSyncStart = tmp->VSyncStart; + pMode->VSyncEnd = tmp->VSyncEnd; + pMode->VTotal = tmp->VTotal; + pMode->VScan = tmp->VScan; + pMode->Flags = tmp->Flags; + + dotclock = tmp->Clock; + } + + data->mode |= 1 << 11; /* FIXME: What is this used for? */ + + data = (ModeInfoData *) pMode->Private; + data->block = xcalloc (sizeof (CRTCInfoBlock),1); + data->block->HorizontalTotal = pMode->HTotal; + data->block->HorizontalSyncStart = pMode->HSyncStart; + data->block->HorizontalSyncEnd = pMode->HSyncEnd; + data->block->VerticalTotal = pMode->VTotal; + data->block->VerticalSyncStart = pMode->VSyncStart; + data->block->VerticalSyncEnd = pMode->VSyncEnd; + data->block->Flags = pMode->Flags; + data->block->PixelClock = pMode->Clock * 1000; + + hsync = 0; + if (pMode->HSync > 0.0) + hsync = pMode->HSync; + else if (pMode->HTotal > 0) + hsync = (float) pMode->Clock / (float) pMode->HTotal; + + vrefresh = 0; + if (pMode->VTotal > 0) vrefresh = hsync * 1000.0 / pMode->VTotal; + if (pMode->Flags & V_INTERLACE) vrefresh *= 2.0; + if (pMode->Flags & V_DBLSCAN) vrefresh /= 2.0; + if (pMode->VScan > 1) vrefresh /= pMode->VScan; + if (pMode->VRefresh > 0.0) vrefresh = pMode->VRefresh; + + pMode->HSync = hsync; + pMode->VRefresh = vrefresh; + + DPRINTF (PFX, + "pMode->HSync == %.1f KHz\n" + "pMode->VRefresh == %.1f Hz\n", + pMode->HSync, + pMode->VRefresh); + + data->block->RefreshRate = vrefresh; + + /* do some very primitive rounding to the nearest integer */ + if ((vrefresh - data->block->RefreshRate) * 10.0 >= 5.0) + data->block->RefreshRate++; + + data->block->RefreshRate *= 100; + } + while (pMode != pScrn->modes); + } + + DPRINTF (PFX, + "data->block->HorizontalTotal = %lu\n" + "data->block->HorizontalSyncStart = %lu\n" + "data->block->HorizontalSyncEnd = %lu\n" + "data->block->VerticalTotal = %lu\n" + "data->block->VerticalSyncStart = %lu\n" + "data->block->VerticalSyncEnd = %lu\n" + "data->block->Flags = %lu\n" + "data->block->PixelClock = %lu\n" + "data->block->RefreshRate = %lu\n", + data->block->HorizontalTotal, + data->block->HorizontalSyncStart, + data->block->HorizontalSyncEnd, + data->block->VerticalTotal, + data->block->VerticalSyncStart, + data->block->VerticalSyncEnd, + data->block->Flags, + data->block->PixelClock, + data->block->RefreshRate); + + pScrn->currentMode = pScrn->modes; + +#ifdef XF86DRI + /* Need to find largest sized mode then pick the best pitch, this allows us to use tiled memory. */ + { + int maxXResolution = 0; + int calc_pitch; +#if 0 + int i,i830_pitches[] = { 512, 1024, 2048, 4096, 8192 }; +#endif + + pMode = pScrn->modes; + do + { + if (pMode->HDisplay > maxXResolution) maxXResolution = pMode->HDisplay; + pMode = pMode->next; + } + while (pMode != pScrn->modes); + + calc_pitch = 0; + +/* FIXME: why isn't this working? */ +#if 0 + for (i = 0; i < NB_OF (i830_pitches); i++) + if ((maxXResolution * pI810->cpp) <= i830_pitches[i]) + { + calc_pitch = i830_pitches[i] / pI810->cpp; + break; + } +#endif + + pScrn->displayWidth = calc_pitch ? calc_pitch : pScrn->virtualX; + if (pScrn->virtualY * pScrn->displayWidth * pI810->cpp > pI810->StolenSize) + { + xf86DrvMsg (pScrn->scrnIndex,X_WARNING,"Pitch is bigger than local/stolen size. Defaulting\n\tto original display width\n"); + pScrn->displayWidth = pScrn->virtualX; + } + + DPRINTF (PFX, + "calc_pitch == %lu\n" + "pScrn->displayWidth == %lu\n" + "virtualX == %lu\n" + "virtualY == %lu\n" + "Memory needed: %lu x %lu x %lu == %luK\n", + calc_pitch, + pScrn->displayWidth, + pScrn->virtualX, + pScrn->virtualY, + pScrn->virtualY,MAX(pScrn->displayWidth,pScrn->virtualX),pI810->cpp, + (pScrn->virtualY * MAX(pScrn->displayWidth,pScrn->virtualX) * pI810->cpp) / 1024); + } +#endif /* XF86DRI */ + + if (pScrn->modes == NULL) return FALSE; + + /* Further validate the mode */ + mode = ((ModeInfoData *) pScrn->modes->Private)->data; + switch (mode->MemoryModel) + { + case 0x0: /* Text mode */ + case 0x1: /* CGA graphics */ + case 0x2: /* Hercules graphics */ + case 0x3: /* Planar */ + case 0x5: /* Non-chain 4, 256 color */ + case 0x7: /* YUV */ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Unsupported Memory Model: %d",mode->MemoryModel); + return FALSE; + case 0x4: /* Packed pixel */ + case 0x6: /* Direct Color */ + break; + } + + xf86PrintModes (pScrn); + + /* Load the required sub modules */ + if (!xf86LoadSubModule (pScrn,"fb")) + { + I830BIOSFreeRec (pScrn); + return FALSE; + } + + xf86LoaderReqSymLists(I810fbSymbols, NULL); + + if (!xf86ReturnOptValBool(I810AvailableOptions(0,0), OPTION_NOACCEL, FALSE)) { + if (!xf86LoadSubModule(pScrn, "xaa")) { + I830BIOSFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(I810xaaSymbols, NULL); + } + + if (!xf86ReturnOptValBool(I810AvailableOptions(0,0), OPTION_SW_CURSOR, FALSE)) { + if (!xf86LoadSubModule(pScrn, "ramdac")) { + I830BIOSFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(I810ramdacSymbols, NULL); + } + + /* We wont be using the VGA access after the probe */ + { + resRange vgaio[] = { {ResShrIoBlock,0x3B0,0x3BB}, + {ResShrIoBlock,0x3C0,0x3DF}, + _END }; + resRange vgamem[] = {{ResShrMemBlock,0xA0000,0xAFFFF}, + {ResShrMemBlock,0xB8000,0xBFFFF}, + {ResShrMemBlock,0xB0000,0xB7FFF}, + _END }; + + I810SetMMIOAccess(pI810); + xf86SetOperatingState(vgaio, pI810->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(vgamem, pI810->pEnt->index, ResDisableOpr); + } + + return TRUE; +} + +/* + * Just adapted from the std* functions in vgaHW.c + */ + +static void +WriteAttr(int index, int value) +{ + CARD8 tmp; + + tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + + index |= 0x20; + outb(VGA_ATTR_INDEX, index); + outb(VGA_ATTR_DATA_W, value); +} + +static int +ReadAttr(int index) +{ + CARD8 tmp; + + tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + + index |= 0x20; + outb(VGA_ATTR_INDEX, index); + return (inb(VGA_ATTR_DATA_R)); +} + +#define WriteMiscOut(value) outb(VGA_MISC_OUT_W, value) +#define ReadMiscOut() inb(VGA_MISC_OUT_R) +#define WriteSeq(index, value) outb(VGA_SEQ_INDEX, index);\ + outb(VGA_SEQ_DATA, value) + +static int +ReadSeq(int index) +{ + outb(VGA_SEQ_INDEX, index); + + return (inb(VGA_SEQ_DATA)); +} + +#define WriteGr(index, value) outb(VGA_GRAPH_INDEX, index);\ + outb(VGA_GRAPH_DATA, value) +static int +ReadGr(int index) +{ + outb(VGA_GRAPH_INDEX, index); + + return (inb(VGA_GRAPH_DATA)); +} + +static void +SeqReset(Bool start) +{ + if(start) { + WriteSeq(0x00, 0x01); /* Synchronous Reset */ + } else { + WriteSeq(0x00, 0x03); /* End Reset */ + } +} + +static void +SaveFonts(ScrnInfoPtr pScrn) +{ + I810Ptr pI810; + VESAPtr pVesa; + unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4, scrn; + + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + + if(pVesa->fonts != NULL) return; + + /* If in graphics mode, don't save anything */ + attr10 = ReadAttr(0x10); + if(attr10 & 0x01) return; + + pVesa->fonts = xalloc(16384); + + /* save the registers that are needed here */ + miscOut = ReadMiscOut(); + gr4 = ReadGr(0x04); + gr5 = ReadGr(0x05); + gr6 = ReadGr(0x06); + seq2 = ReadSeq(0x02); + seq4 = ReadSeq(0x04); + + /* Force into colour mode */ + WriteMiscOut(miscOut | 0x01); + + scrn = ReadSeq(0x01) | 0x20; + SeqReset(TRUE); + WriteSeq(0x01, scrn); + SeqReset(FALSE); + + WriteAttr(0x10, 0x01); /* graphics mode */ + + /*font1 */ + WriteSeq(0x02, 0x04); /* write to plane 2 */ + WriteSeq(0x04, 0x06); /* enable plane graphics */ + WriteGr(0x04, 0x02); /* read plane 2 */ + WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ + WriteGr(0x06, 0x05); /* set graphics */ + slowbcopy_frombus(pVesa->VGAbase, pVesa->fonts, 8192); + + /* font2 */ + WriteSeq(0x02, 0x08); /* write to plane 3 */ + WriteSeq(0x04, 0x06); /* enable plane graphics */ + WriteGr(0x04, 0x03); /* read plane 3 */ + WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ + WriteGr(0x06, 0x05); /* set graphics */ + slowbcopy_frombus(pVesa->VGAbase, pVesa->fonts + 8192, 8192); + + scrn = ReadSeq(0x01) & ~0x20; + SeqReset(TRUE); + WriteSeq(0x01, scrn); + SeqReset(FALSE); + + /* Restore clobbered registers */ + WriteAttr(0x10, attr10); + WriteSeq(0x02, seq2); + WriteSeq(0x04, seq4); + WriteGr(0x04, gr4); + WriteGr(0x05, gr5); + WriteGr(0x06, gr6); + WriteMiscOut(miscOut); +} + +static void +RestoreFonts(ScrnInfoPtr pScrn) +{ + I810Ptr pI810; + VESAPtr pVesa; + unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4, scrn; + + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + + if(pVesa->fonts == NULL) return; + + /* save the registers that are needed here */ + miscOut = ReadMiscOut(); + attr10 = ReadAttr(0x10); + gr1 = ReadGr(0x01); + gr3 = ReadGr(0x03); + gr4 = ReadGr(0x04); + gr5 = ReadGr(0x05); + gr6 = ReadGr(0x06); + gr8 = ReadGr(0x08); + seq2 = ReadSeq(0x02); + seq4 = ReadSeq(0x04); + + /* Force into colour mode */ + WriteMiscOut(miscOut | 0x01); + + scrn = ReadSeq(0x01) | 0x20; + SeqReset(TRUE); + WriteSeq(0x01, scrn); + SeqReset(FALSE); + + WriteAttr(0x10, 0x01); /* graphics mode */ + + WriteSeq(0x02, 0x04); /* write to plane 2 */ + WriteSeq(0x04, 0x06); /* enable plane graphics */ + WriteGr(0x04, 0x02); /* read plane 2 */ + WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ + WriteGr(0x06, 0x05); /* set graphics */ + slowbcopy_tobus(pVesa->fonts, pVesa->VGAbase, 8192); + + WriteSeq(0x02, 0x08); /* write to plane 3 */ + WriteSeq(0x04, 0x06); /* enable plane graphics */ + WriteGr(0x04, 0x03); /* read plane 3 */ + WriteGr(0x05, 0x00); /* write mode 0, read mode 0 */ + WriteGr(0x06, 0x05); /* set graphics */ + slowbcopy_tobus(pVesa->fonts + 8192, pVesa->VGAbase, 8192); + + scrn = ReadSeq(0x01) & ~0x20; + SeqReset(TRUE); + WriteSeq(0x01, scrn); + SeqReset(FALSE); + + /* restore the registers that were changed */ + WriteMiscOut(miscOut); + WriteAttr(0x10, attr10); + WriteGr(0x01, gr1); + WriteGr(0x03, gr3); + WriteGr(0x04, gr4); + WriteGr(0x05, gr5); + WriteGr(0x06, gr6); + WriteGr(0x08, gr8); + WriteSeq(0x02, seq2); + WriteSeq(0x04, seq4); +} + +/* End font code */ + +void +I830BIOSSaveRegisters(ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR(pScrn); + I830RegPtr i830Reg = &pI810->i830_SavedReg; + int i; + + for (i = 0 ; i < 8 ; i++) + i830Reg->Fence[i] = INREG(FENCE+i*4); + + i830Reg->LprbTail = INREG(LP_RING + RING_TAIL); + i830Reg->LprbHead = INREG(LP_RING + RING_HEAD); + i830Reg->LprbStart = INREG(LP_RING + RING_START); + i830Reg->LprbLen = INREG(LP_RING + RING_LEN); + + if ((i830Reg->LprbTail & TAIL_ADDR) != (i830Reg->LprbHead & HEAD_ADDR) && + i830Reg->LprbLen & RING_VALID) { + I810PrintErrorState( pScrn ); + FatalError( "Active ring not flushed\n"); + } +} + +static void I830SetRingRegisters(ScrnInfoPtr pScrn, I830RegPtr i830Reg) +{ + I810Ptr pI810 = I810PTR(pScrn); + unsigned int temp; + + /* First disable the ring buffer (Need to wait for empty first?, if so + * should probably do it before entering this section) + */ + temp = INREG(LP_RING + RING_LEN); + temp &= ~RING_VALID_MASK; + OUTREG(LP_RING + RING_LEN, temp ); + + /* Set up the low priority ring buffer. + */ + OUTREG(LP_RING + RING_TAIL, 0 ); + OUTREG(LP_RING + RING_HEAD, 0 ); + + pI810->LpRing.head = 0; + pI810->LpRing.tail = 0; + + temp = INREG(LP_RING + RING_START); + temp &= ~(START_ADDR); + temp |= i830Reg->LprbStart; + OUTREG(LP_RING + RING_START, temp ); + + temp = INREG(LP_RING + RING_LEN); + temp &= ~(I830_RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); + temp |= i830Reg->LprbLen; + OUTREG(LP_RING + RING_LEN, temp ); +} + +static void I830SetFenceRegisters(ScrnInfoPtr pScrn, I830RegPtr i830Reg) +{ + I810Ptr pI810 = I810PTR(pScrn); + int i; + + for (i = 0 ; i < 8 ; i++) { + OUTREG( FENCE+i*4, i830Reg->Fence[i] ); + if (I810_DEBUG & DEBUG_VERBOSE_VGA) + ErrorF("Fence Register : %x\n", i830Reg->Fence[i]); + } +} + +void +I830BIOSSetRegisters(ScrnInfoPtr pScrn, int mode) +{ + I810Ptr pI810 = I810PTR(pScrn); + I830RegPtr i830Reg; + + if(mode == SET_SAVED_MODE) { + i830Reg = &pI810->i830_SavedReg; + } else { + i830Reg = &pI810->i830_ModeReg; + } + + I830SetRingRegisters(pScrn, i830Reg); + I830SetFenceRegisters(pScrn, i830Reg); +} + +Bool +I830VESAGetVBEMode(ScrnInfoPtr pScrn, int *mode) +{ + I810Ptr pI810; + VESAPtr pVesa; + + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x4f03; + + xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); + + if (pVesa->pInt->ax == 0x4f) { + *mode = pVesa->pInt->bx; + + return TRUE; + } + + return FALSE; +} + +/* At the moment some of the BIOS vesa mode sets doesn't seem to work, so + * we set those modes using the legacy BIOS calls */ +Bool I830VESASetVBEMode (ScrnInfoPtr pScrn,int mode,CRTCInfoBlock *block) +{ + I810Ptr pI810; + VESAPtr pVesa; + + pI810 = I810PTR (pScrn); + pVesa = pI810->vesa; + + DPRINTF(PFX,"Setting mode 0x%.8x\n",mode); + + pVesa->pInt->num = 0x10; + switch (mode) + { + case 0x0118: + pVesa->pInt->ax = 0x0054; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + return (TRUE); + case 0x011a: + pVesa->pInt->ax = 0x0049; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + return (TRUE); + case 0x4003: + case 0x03: + pVesa->pInt->ax = 0x0003; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + return (TRUE); + default: + pVesa->pInt->ax = 0x4f02; + pVesa->pInt->bx = mode & ~(1 << 11); +/* This doesn't work. The BIOS is f**cked */ +#if 0 + if (block != NULL) + { + 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); + } +#endif + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + return (pVesa->pInt->ax == 0x004f); + } +} + +Bool I830VESASaveRestore (ScrnInfoPtr pScrn,int function) +{ + I810Ptr pI810; + VESAPtr pVesa; + + pI810 = I810PTR (pScrn); + pVesa = pI810->vesa; + + if(MODE_QUERY < 0 || function > MODE_RESTORE) return (FALSE); + + /* Insure that if the Ring is active we are Synced */ + +#if 0 + if(pI810->AccelInfoRec != NULL) + { + I810RefreshRing (pScrn); + I810Sync (pScrn); + } +#endif + + /* FIXME: Workaround for 1600x1200 mode set problem */ +#if 1 + if (function == MODE_RESTORE) { + int thisMode; + I830VESAGetVBEMode (pScrn,&thisMode); + + DPRINTF (PFX,"Current mode: 0x%.8x\n",thisMode); + + thisMode &= 0xff; + + if (thisMode == 0x3a || thisMode == 0x4a || thisMode == 0x4b || thisMode == 0x5a || /* 1600x1200 */ + thisMode == 0x38 || thisMode == 0x48 || thisMode == 0x49 || thisMode == 0x58) { /* 1280x1024 */ + DPRINTF (PFX,"Doing 1600x1200 / 1280x1024 mode hack\n"); + + /* first we restore everything the way we're supposed to do it */ + I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); + RestoreFonts (pScrn); + I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); + + /* now we fake a 800x600x8 mode save and restore */ + I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); + I830BIOSSaveRegisters (pScrn); + SaveFonts (pScrn); + I830VESASetVBEMode (pScrn,0xc032,NULL); + I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); + RestoreFonts (pScrn); + I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); + I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); + + return (TRUE); + } + } +#endif + +#if 1 + /* This is a workaround that is needed to avoid a bug in VESA Save/Restore, + * I will remove it as soon as the problem is fixed in the BIOS. + * Basically it is a problem with 0x4f04 in that it corrupts the + * GATT table after it has been executed. We are working around this + * by just setting the BIOS mode to the save one. This is not completely + * correct behavior, especially since it doesn't reset all the registers + * to their correct state (if something other than the BIOS has set the + * mode.) + */ + + if(function == MODE_RESTORE) { + I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); + RestoreFonts (pScrn); + I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); + I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); + return (TRUE); + } +#endif + + /* Save the accel and fence state */ + if(function == MODE_SAVE) I830BIOSSaveRegisters (pScrn); + + /* 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 */ + I830VESAGetVBEMode (pScrn,&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_wrapper (pVesa->pInt,pScrn); + if(pVesa->pInt->ax != 0x4f) 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); + } + DPRINTF (PFX, + "BIOS returned bx == %d\n" + "therefore I need npages == %d (4k pages)\n", + pVesa->pInt->bx,npages); + } + } + +#if 0 + /* Save/Restore Super VGA state */ + if(function != MODE_QUERY) + { + int ax_reg = 0; + + 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_wrapper (pVesa->pInt,pScrn); + ax_reg = pVesa->pInt->ax; + } + + if(function == MODE_RESTORE) + { + I830VESASetVBEMode (pScrn,pVesa->stateMode,NULL); + RestoreFonts (pScrn); + I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); + } + + 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); + } + } + } +#endif + + /* Now that the modes setup, we can do our I830 specific fu */ + if(function == MODE_RESTORE) I830BIOSSetRegisters (pScrn,SET_SAVED_MODE); + + return (TRUE); +} + +Bool +I830VESASetGetLogicalScanlineLength(ScrnInfoPtr pScrn, int command, int width, + int *pixels, int *bytes, int *max) +{ + I810Ptr pI810; + VESAPtr pVesa; + + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + + if(command < SCANWID_SET || command > SCANWID_GET_MAX) + return FALSE; + + 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_wrapper(pVesa->pInt, pScrn); + + if(pVesa->pInt->ax != 0x4f) + 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; +} + +int +I830VESASetGetDACPaletteFormat(ScrnInfoPtr pScrn, int bits) +{ + I810Ptr pI810; + VESAPtr pVesa; + + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x4f08; + if(!bits) pVesa->pInt->bx = 0x01; + else pVesa->pInt->bx = (bits & 0x00ff) << 8; + xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); + + if(pVesa->pInt->ax != 0x4f) return 0; + + return (bits != 0 ? bits : (pVesa->pInt->bx >> 8) & 0x00ff); +} + +static Bool I830VESASetMode (ScrnInfoPtr pScrn,DisplayModePtr pMode) +{ + I810Ptr pI810; + VESAPtr pVesa; + ModeInfoData *data; + int mode; + + pI810 = I810PTR (pScrn); + pVesa = pI810->vesa; + + data = (ModeInfoData *) pMode->Private; + + /* Always Enable Linear Addressing */ + mode = data->mode | (1 << 15) | (1 << 14); + +#ifdef XF86DRI + if(pI810->directRenderingEnabled) + { + DRILock (screenInfo.screens[pScrn->scrnIndex],0); + pI810->LockHeld = 1; + } +#endif + + if (I830VESASetVBEMode (pScrn,mode,data->block) == FALSE) + { + if ((data->block || (data->mode & (1 << 11))) && + I830VESASetVBEMode (pScrn,(mode & ~(1 << 11)),NULL) == TRUE) + { + xf86DrvMsg (pScrn->scrnIndex,X_WARNING,"Set VBE Mode rejected this modeline. Trying current mode instead!\n"); + DPRINTF (PFX,"OOPS!\n"); + xfree (data->block); + data->block = NULL; + data->mode &= ~(1 << 11); + } + else + { + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Set VBE Mode failed!\n"); + return (FALSE); + } + } + + /* test if CRT display is present */ + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x5f55; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + + /* is this a CRT? */ + if (pVesa->pInt->ax == 0x005f && pVesa->pInt->bx != 0x0002) + { + DPRINTF (PFX, + "data->data = {\n" + " XResolution: %d\n" + " YResolution: %d\n" + "}\n", + data->data->XResolution,data->data->YResolution); + if (data->block != NULL) + DPRINTF (PFX, + "data->block = {\n" + " HorizontalTotal: %d\n" + " HorizontalSyncStart: %d\n" + " HorizontalSyncEnd: %d\n" + " VerticalTotal: %d\n" + " VerticalSyncStart: %d\n" + " VerticalSyncEnd: %d\n" + " Flags: %d\n" + " PixelClock: %d\n" + " RefreshRate: %d\n" + "}\n", + data->block->HorizontalTotal,data->block->HorizontalSyncStart,data->block->HorizontalSyncEnd, + data->block->VerticalTotal,data->block->VerticalSyncStart,data->block->VerticalSyncEnd, + data->block->Flags,data->block->PixelClock,data->block->RefreshRate / 100); + + /* make double sure it's not an LCD */ + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x5f64; + pVesa->pInt->bx = 0x0100; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + if (data->data != NULL && data->block != NULL && pVesa->pInt->ax == 0x005f && !(pVesa->pInt->cx & 0x0008)) + { + int i; + static const int VesaRefresh[] = { 43, 56, 60, 70, 72, 75, 85, 100, 120, -1 }; + + for (i = 0; VesaRefresh[i] != -1 && VesaRefresh[i] != data->block->RefreshRate / 100; i++) ; + + if (VesaRefresh[i] == data->block->RefreshRate / 100) + { + DPRINTF (PFX, + "Setting refresh rate to %dHz for mode %d\n", + VesaRefresh[i], + mode & 0xff); + + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x5f05; + pVesa->pInt->bx = mode & 0xff; + pVesa->pInt->cx = 1 << i; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + + if (pVesa->pInt->ax != 0x5f) + xf86DrvMsg (pScrn->scrnIndex,X_WARNING,"Failed to set refresh rate to %dHz!\n",VesaRefresh[i]); + } + } + } + + if (data->data->XResolution != pScrn->displayWidth) + I830VESASetLogicalScanline (pScrn,pScrn->displayWidth); + + if (pScrn->bitsPerPixel >= 8 && pVesa->vbeInfo->Capabilities[0] & 0x01) + I830VESASetGetDACPaletteFormat (pScrn,8); + + I830BIOSSetRegisters (pScrn,SET_CURRENT_MODE); + I810SetRingRegs (pScrn); + +#ifdef XF86DRI + if (pI810->directRenderingEnabled) + { + DRIUnlock (screenInfo.screens[pScrn->scrnIndex]); + pI810->LockHeld = 0; + } +#endif + + pScrn->vtSema = TRUE; + return (TRUE); +} + +CARD32 * +I830VESASetGetPaletteData(ScrnInfoPtr pScrn, Bool set, int first, int num, + CARD32 *data, Bool secondary, Bool wait_retrace) +{ + I810Ptr pI810; + VESAPtr pVesa; + + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + + 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_wrapper(pVesa->pInt, pScrn); + + 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; +} + +Bool +I830BIOSInitializeFirstMode(int scrnIndex) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + I810Ptr pI810 = I810PTR(pScrn); + VESAPtr pVesa = pI810->vesa; + I830RegPtr i830Reg = &pI810->i830_ModeReg; + int i; + + for (i = 0 ; i < 8 ; i++) + i830Reg->Fence[i] = 0; + + /* Setup the ring buffer */ + i830Reg->LprbTail = 0; + i830Reg->LprbHead = 0; + i830Reg->LprbStart = pI810->LpRing.mem.Start; + + if (i830Reg->LprbStart) + i830Reg->LprbLen = ((pI810->LpRing.mem.Size-4096) | + RING_NO_REPORT | RING_VALID); + else + i830Reg->LprbLen = RING_INVALID; + + /* save current video state */ + if(!I830VESASaveRestore(pScrn, MODE_SAVE)) return FALSE; + pVesa->savedPal = I830VESASetGetPaletteData(pScrn, FALSE, 0, 256, + NULL, FALSE, FALSE); + + /* set first video mode */ + if(!I830VESASetMode(pScrn, pScrn->currentMode)) + return FALSE; + + I830BIOSAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + return TRUE; +} + +#ifdef I830DEBUG +static void dump_DSPACNTR (ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR (pScrn); + unsigned int tmp; + + /* Display A Control */ + tmp = INREG (0x70180); + fprintf (stderr,"Display A Plane Control Register (0x%.8x)\n",tmp); + + if (tmp & BIT(31)) + fprintf (stderr," Display Plane A (Primary) Enable\n"); + else + fprintf (stderr," Display Plane A (Primary) Disabled\n"); + + if (tmp & BIT(30)) + fprintf (stderr," Display A pixel data is gamma corrected\n"); + else + fprintf (stderr," Display A pixel data bypasses gamma correction logic (default)\n"); + + switch ((tmp & 0x3c000000) >> 26) /* bit 29:26 */ + { + case 0x00: + case 0x01: + case 0x03: + fprintf (stderr," Reserved\n"); + break; + case 0x02: + fprintf (stderr," 8-bpp Indexed\n"); + break; + case 0x04: + fprintf (stderr," 15-bit (5-5-5) pixel format (Targa compatible)\n"); + break; + case 0x05: + fprintf (stderr," 16-bit (5-6-5) pixel format (XGA compatible)\n"); + break; + case 0x06: + fprintf (stderr," 32-bit format (X:8:8:8)\n"); + break; + case 0x07: + fprintf (stderr," 32-bit format (8:8:8:8)\n"); + break; + default: + fprintf (stderr," Unknown - Invalid register value maybe?\n"); + } + + if (tmp & BIT(25)) + fprintf (stderr," Stereo Enable\n"); + else + fprintf (stderr," Stereo Disable\n"); + + if (tmp & BIT(24)) + fprintf (stderr," Display A, Pipe B Select\n"); + else + fprintf (stderr," Display A, Pipe A Select\n"); + + if (tmp & BIT(22)) + fprintf (stderr," Source key is enabled\n"); + else + fprintf (stderr," Source key is disabled\n"); + + switch ((tmp & 0x00300000) >> 20) /* bit 21:20 */ + { + case 0x00: + fprintf (stderr," No line duplication\n"); + break; + case 0x01: + fprintf (stderr," Line/pixel Doubling\n"); + break; + case 0x02: + case 0x03: + fprintf (stderr," Reserved\n"); + break; + } + + if (tmp & BIT(18)) + fprintf (stderr," Stereo output is high during second image\n"); + else + fprintf (stderr," Stereo output is high during first image\n"); +} + +static void dump_DSPBCNTR (ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR (pScrn); + unsigned int tmp; + + /* Display B/Sprite Control */ + tmp = INREG (0x71180); + fprintf (stderr,"Display B/Sprite Plane Control Register (0x%.8x)\n",tmp); + + if (tmp & BIT(31)) + fprintf (stderr," Display B/Sprite Enable\n"); + else + fprintf (stderr," Display B/Sprite Disable\n"); + + if (tmp & BIT(30)) + fprintf (stderr," Display B pixel data is gamma corrected\n"); + else + fprintf (stderr," Display B pixel data bypasses gamma correction logic (default)\n"); + + switch ((tmp & 0x3c000000) >> 26) /* bit 29:26 */ + { + case 0x00: + case 0x01: + case 0x03: + fprintf (stderr," Reserved\n"); + break; + case 0x02: + fprintf (stderr," 8-bpp Indexed\n"); + break; + case 0x04: + fprintf (stderr," 15-bit (5-5-5) pixel format (Targa compatible)\n"); + break; + case 0x05: + fprintf (stderr," 16-bit (5-6-5) pixel format (XGA compatible)\n"); + break; + case 0x06: + fprintf (stderr," 32-bit format (X:8:8:8)\n"); + break; + case 0x07: + fprintf (stderr," 32-bit format (8:8:8:8)\n"); + break; + default: + fprintf (stderr," Unknown - Invalid register value maybe?\n"); + } + + if (tmp & BIT(25)) + fprintf (stderr," Stereo is enabled and both start addresses are used in a two frame sequence\n"); + else + fprintf (stderr," Stereo disable and only a single start address is used\n"); + + if (tmp & BIT(24)) + fprintf (stderr," Display B/Sprite, Pipe B Select\n"); + else + fprintf (stderr," Display B/Sprite, Pipe A Select\n"); + + if (tmp & BIT(22)) + fprintf (stderr," Sprite source key is enabled\n"); + else + fprintf (stderr," Sprite source key is disabled (default)\n"); + + switch ((tmp & 0x00300000) >> 20) /* bit 21:20 */ + { + case 0x00: + fprintf (stderr," No line duplication\n"); + break; + case 0x01: + fprintf (stderr," Line/pixel Doubling\n"); + break; + case 0x02: + case 0x03: + fprintf (stderr," Reserved\n"); + break; + } + + if (tmp & BIT(18)) + fprintf (stderr," Stereo output is high during second image\n"); + else + fprintf (stderr," Stereo output is high during first image\n"); + + if (tmp & BIT(15)) + fprintf (stderr," Alpha transfer mode enabled\n"); + else + fprintf (stderr," Alpha transfer mode disabled\n"); + + if (tmp & BIT(0)) + fprintf (stderr," Sprite is above overlay\n"); + else + fprintf (stderr," Sprite is above display A (default)\n"); +} + +static void dump_registers (ScrnInfoPtr pScrn) +{ + I810Ptr pI810 = I810PTR (pScrn); + unsigned int i; + fprintf (stderr,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); + + dump_DSPACNTR (pScrn); + dump_DSPBCNTR (pScrn); + + fprintf (stderr,"0x71400 == 0x%.8x\n",INREG(0x71400)); + fprintf (stderr,"0x70008 == 0x%.8x\n",INREG(0x70008)); + for (i = 0x71410; i <= 0x71428; i += 4) + fprintf (stderr,"0x%x == 0x%.8x\n",i,INREG(i)); + + fprintf (stderr,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); +} +#endif + +Bool +I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +{ + ScrnInfoPtr pScrn; + vgaHWPtr hwp; + I810Ptr pI810; + VESAPtr pVesa; + VisualPtr visual; + + pScrn = xf86Screens[pScreen->myNum]; + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + hwp = VGAHWPTR(pScrn); + + miClearVisualTypes(); + if(!xf86SetDefaultVisual(pScrn, -1)) return FALSE; + if(pScrn->bitsPerPixel > 8) { + if(!miSetVisualTypes(pScrn->depth, TrueColorMask, + pScrn->rgbBits, TrueColor)) return FALSE; + } else { + if(!miSetVisualTypes(pScrn->depth, + miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + } + if (!miSetPixmapDepths()) return FALSE; + +#ifdef XF86DRI + /* + * Setup DRI after visuals have been established, but before cfbScreenInit + * is called. cfbScreenInit will eventually call into the drivers + * InitGLXVisuals call back. + */ + + if (!xf86ReturnOptValBool(I810AvailableOptions(0,0), OPTION_NOACCEL, + FALSE) && + xf86ReturnOptValBool(I810AvailableOptions(0,0), OPTION_DRI, TRUE)) { + pI810->directRenderingEnabled = I830DRIScreenInit(pScreen); + } else { + pI810->directRenderingEnabled = FALSE; + } +#else + pI810->directRenderingEnabled = FALSE; + if(!I810AllocateGARTMemory( pScrn )) + return FALSE; + if(!I810AllocateFront(pScrn)) + return FALSE; +#endif + + DPRINTF(PFX,"assert( if(!I810MapMem(pScrn)) )\n"); + if(!I810MapMem(pScrn)) return FALSE; + + pScrn->memPhysBase = (unsigned long)pI810->FbBase; + pScrn->fbOffset = 0; + + vgaHWSetMmioFuncs(hwp, pI810->MMIOBase, 0); + vgaHWGetIOBase(hwp); + DPRINTF(PFX,"assert( if(!vgaHWMapMem(pScrn)) )\n"); + if(!vgaHWMapMem(pScrn)) return FALSE; + + /* Handle Setup of the mode here */ + DPRINTF(PFX,"assert( if(!(I830BIOSInitializeFirstMode(scrnIndex))) )\n"); + if(!(I830BIOSInitializeFirstMode(scrnIndex))) return FALSE; + + DPRINTF(PFX,"assert( if(!fbScreenInit(pScreen, ...) )\n"); + if(!fbScreenInit(pScreen, pI810->FbBase + pScrn->fbOffset, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel)) + return FALSE; + + if(pScrn->bitsPerPixel > 8) { + /* Fixup RGB ordering */ + visual = pScreen->visuals + pScreen->numVisuals; + while(--visual >= pScreen->visuals) { + if((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } + } + + xf86SetBlackWhitePixels(pScreen); + +#ifdef XF86DRI + if(pI810->LpRing.mem.Start == 0 && pI810->directRenderingEnabled) { + pI810->directRenderingEnabled = 0; + I830DRICloseScreen(pScreen); + } + + if(!pI810->directRenderingEnabled) { + pI810->DoneFrontAlloc = FALSE; + DPRINTF(PFX,"assert( if(!I810AllocateGARTMemory( pScrn )) )\n"); + if(!I810AllocateGARTMemory( pScrn )) + return FALSE; + DPRINTF(PFX,"assert( if(!I810AllocateFront(pScrn)) )\n"); + if(!I810AllocateFront(pScrn)) + return FALSE; + } +#endif + + I810DGAInit(pScreen); + + DPRINTF(PFX,"assert( if(!xf86InitFBManager(pScreen, &(pI810->FbMemBox))) )\n"); + if(!xf86InitFBManager(pScreen, &(pI810->FbMemBox))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to init memory manager\n"); + return FALSE; + } + + if(!xf86ReturnOptValBool(I830BIOSOptions, OPTION_NOACCEL, FALSE)) { + if(pI810->LpRing.mem.Size != 0) { + I810SetRingRegs( pScrn ); + + if(!I830AccelInit(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware acceleration initialization failed\n"); + } + } + } + + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + + if(!xf86ReturnOptValBool(I830BIOSOptions, OPTION_SW_CURSOR, FALSE)) + { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Initializing HW Cursor\n"); + if(!I810CursorInit(pScreen)) + xf86DrvMsg (pScrn->scrnIndex,X_ERROR,"Hardware cursor initialization failed\n"); + } + else xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Initializing SW Cursor!\n"); + + DPRINTF(PFX,"assert( if(!miCreateDefColormap(pScreen)) )\n"); + if(!miCreateDefColormap(pScreen)) return FALSE; + + DPRINTF(PFX,"assert( if(!vgaHWHandleColormaps(pScreen)) )\n"); + if(!vgaHWHandleColormaps(pScreen)) return FALSE; + +#ifdef DPMSExtension + xf86DPMSInit(pScreen, I830DisplayPowerManagementSet, 0); +#endif + + /* Init video here - Not supported as of yet */ + +#ifdef XF86DRI + if(pI810->directRenderingEnabled) { + pI810->directRenderingEnabled = I830DRIFinishScreenInit(pScreen); + if(!pI810->directRenderingEnabled) { + pI810->agpAcquired2d = FALSE; + } + } +#endif + + if(pI810->directRenderingEnabled) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Enabled\n"); + /* Setup 3D engine */ +#ifdef XF86DRI + I830EmitInvarientState(pScrn); +#if 0 + I830EmitInvarientState2(pScrn); +#endif +#endif + } 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; + } + } + + pScreen->SaveScreen = I830BIOSSaveScreen; + pI810->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = I830BIOSCloseScreen; + + if (serverGeneration == 1) + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); +/* +#ifdef I830DEBUG + dump_registers (pScrn); +#endif +*/ + return TRUE; +} + +Bool +I830VESASetDisplayStart(ScrnInfoPtr pScrn, int x, int y, Bool wait_retrace) +{ + I810Ptr pI810; + VESAPtr pVesa; + + pI810 = I810PTR(pScrn); + pVesa = pI810->vesa; + + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x4f07; + pVesa->pInt->bx = wait_retrace ? 0x80 : 0x00; + pVesa->pInt->cx = x; + pVesa->pInt->dx = y; + xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); + + if(pVesa->pInt->ax != 0x4f) return FALSE; + return TRUE; +} + +void +I830BIOSAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScrn; + + pScrn = xf86Screens[scrnIndex]; + I830VESASetDisplayStart(pScrn, x, y, TRUE); +} + +void +I830BIOSFreeScreen(int scrnIndex, int flags) +{ + I830BIOSFreeRec(xf86Screens[scrnIndex]); + if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) + vgaHWFreeHWRec(xf86Screens[scrnIndex]); +} + +void +I830BIOSLeaveVT (int scrnIndex,int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + vgaHWPtr hwp = VGAHWPTR (pScrn); +#if defined(XF86DRI) || 0 + I810Ptr pI810 = I810PTR (pScrn); +#endif + + DPRINTF (PFX,"Leave VT\n"); + +#ifdef XF86DRI + if (pI810->directRenderingEnabled) { + DPRINTF (PFX,"calling dri lock\n"); + DRILock (screenInfo.screens[scrnIndex],0); + pI810->LockHeld = 1; + } +#endif + +#if 0 + if (pI810->AccelInfoRec != NULL) { + DPRINTF (PFX,"syncing ring buffer\n"); + I810Sync (pScrn); + DO_RING_IDLE (); + } +#endif + + I830VESASaveRestore (pScrn,MODE_RESTORE); + + if (!I810UnbindGARTMemory (pScrn)) return; + + vgaHWLock(hwp); +} + +Bool +I830BIOSEnterVT (int scrnIndex,int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + I810Ptr pI810 = I810PTR (pScrn); + + DPRINTF (PFX,"Enter VT\n"); + + if (!I810BindGARTMemory (pScrn)) return FALSE; + +#ifdef XF86DRI + if (pI810->directRenderingEnabled) { + DPRINTF (PFX,"calling dri unlock\n"); + DRIUnlock (screenInfo.screens[scrnIndex]); + pI810->LockHeld = 0; + } +#endif + + /* FIXME: Is this really necessary? */ +#if 0 + VESAPtr pVesa = pI810->vesa; + /* Switch to configured display device */ + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x5f64; + pVesa->pInt->bx = 0x0001; + pVesa->pInt->cx = (CARD16) pI810->configured_device; + xf86ExecX86int10_wrapper (pVesa->pInt,pScrn); + + if (pVesa->pInt->ax != 0x005f) { + xf86DrvMsg (pScrn->scrnIndex,X_INFO,"Failed to switch to configured display device\n"); + return FALSE; + } +#endif + + if (!I830VESASetMode (pScrn,pScrn->currentMode)) + return FALSE; + + I830BIOSAdjustFrame (scrnIndex,pScrn->frameX0,pScrn->frameY0,0); + +#if 1 + if (pI810->AccelInfoRec != NULL) { + DPRINTF (PFX,"syncing ring buffer\n"); + I810Sync (pScrn); + DO_RING_IDLE (); + } +#endif + + return TRUE; +} + +Bool +I830BIOSSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +{ + DPRINTF (PFX,"mode == %s\n",mode); + return I830VESASetMode(xf86Screens[scrnIndex], mode); +} + +Bool +I830BIOSSaveScreen(ScreenPtr pScreen, Bool unblack) +{ + return vgaHWSaveScreen(pScreen, unblack); +} + +static void +I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, + int flags) +{ + I810Ptr pI810 = I810PTR(pScrn); + VESAPtr pVesa = pI810->vesa; + + pVesa->pInt->num = 0x10; + pVesa->pInt->ax = 0x4f10; + + switch (PowerManagementMode) { + case DPMSModeOn: pVesa->pInt->bx = 0x0001; break; + case DPMSModeStandby: pVesa->pInt->bx = 0x0101; break; + case DPMSModeSuspend: pVesa->pInt->bx = 0x0201; break; + case DPMSModeOff: pVesa->pInt->bx = 0x0401; break; + default: pVesa->pInt->bx = 0x0001; break; + } + + xf86ExecX86int10_wrapper(pVesa->pInt, pScrn); +} + +Bool +I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + vgaHWPtr hwp = VGAHWPTR(pScrn); + I810Ptr pI810 = I810PTR(pScrn); + VESAPtr pVesa = pI810->vesa; + XAAInfoRecPtr infoPtr = pI810->AccelInfoRec; + +#ifdef XF86DRI + if (pI810->directRenderingEnabled) { + I830DRICloseScreen(pScreen); + pI810->directRenderingEnabled = FALSE; + } +#endif + + if (pScrn->vtSema == TRUE) { + if(pI810->AccelInfoRec) { + I810Sync(pScrn); + DO_RING_IDLE(); + } + I830VESASaveRestore(pScrn, MODE_RESTORE); + I830VESASetGetPaletteData(pScrn, TRUE, 0, 256, + pVesa->savedPal, FALSE, TRUE); + I810UnbindGARTMemory(pScrn); + vgaHWLock(hwp); + } + + I810UnmapMem(pScrn); + vgaHWUnmapMem(pScrn); + + if(pI810->ScanlineColorExpandBuffers) { + xfree(pI810->ScanlineColorExpandBuffers); + pI810->ScanlineColorExpandBuffers = 0; + } + + if(infoPtr) { + if(infoPtr->ScanlineColorExpandBuffers) + xfree(infoPtr->ScanlineColorExpandBuffers); + XAADestroyInfoRec(infoPtr); + pI810->AccelInfoRec=0; + } + + if(pI810->CursorInfoRec) { + xf86DestroyCursorInfoRec(pI810->CursorInfoRec); + pI810->CursorInfoRec=0; + } + + /* Free all allocated video ram. + */ + pI810->SysMem = pI810->SavedSysMem; + pI810->DcacheMem = pI810->SavedDcacheMem; + pI810->DoneFrontAlloc = FALSE; + + xf86GARTCloseScreen(scrnIndex); + + pScrn->vtSema=FALSE; + pScreen->CloseScreen = pI810->CloseScreen; + return (*pScreen->CloseScreen)(scrnIndex, pScreen); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.15 Wed May 16 02:48:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c Wed Nov 7 23:15:31 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.15 2001/05/16 06:48:09 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.18 2001/11/08 04:15:31 tsi Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -147,39 +147,33 @@ }; static const char *fbSymbols[] = { - "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif + "fbScreenInit", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", "XAAInit", - "XAAScreenIndex", NULL }; static const char *fbdevHWSymbols[] = { - "fbdevHWInit", - "fbdevHWUseBuildinMode", - "fbdevHWGetDepth", - "fbdevHWGetVidmem", - "fbdevHWLoadPalette", - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", + "fbdevHWGetVidmem", + "fbdevHWInit", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", + "fbdevHWLoadPalette", + "fbdevHWMapVidmem", "fbdevHWModeInit", + "fbdevHWSave", + "fbdevHWSwitchMode", "fbdevHWUnmapMMIO", "fbdevHWUnmapVidmem", - "fbdevHWMapMMIO", - "fbdevHWMapVidmem", + "fbdevHWUseBuildinMode", + "fbdevHWValidMode", NULL }; @@ -260,7 +254,7 @@ static void IMSTTIdentify(int flags) { - xf86PrintChipsets("imstt", "driver (version " DRIVER_VERSION " for IMS TwinTurbo chipsets ", + xf86PrintChipsets("IMSTT", "driver (version " DRIVER_VERSION " for IMS TwinTurbo chipsets ", IMSTTChipsets); } @@ -550,8 +544,10 @@ pScrn->currentMode = pScrn->modes; xf86PrintModes(pScrn); xf86SetDpi(pScrn, 0, 0); + + if (!xf86LoadSubModule(pScrn, "fb")) + return FALSE; - xf86LoadSubModule(pScrn, "fb"); xf86LoaderReqSymLists(fbSymbols, NULL); if (!xf86LoadSubModule(pScrn, "xaa")) @@ -798,10 +794,6 @@ return FALSE; } -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - if (pScrn->bitsPerPixel > 8) { visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { @@ -815,6 +807,8 @@ } } } + + fbPictureInit (pScreen, 0, 0); xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.75 xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.79 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.75 Fri May 4 15:05:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h Fri Jan 11 10:42:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.75 2001/05/04 19:05:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.79 2002/01/11 15:42:57 dawes Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -108,7 +108,7 @@ #define MGA_MODULE_DATA mgaModuleData #define MGA_DRIVER_NAME "mga" #define MGA_MAJOR_VERSION 1 -#define MGA_MINOR_VERSION 0 +#define MGA_MINOR_VERSION 1 #define MGA_PATCHLEVEL 0 typedef struct { @@ -142,6 +142,8 @@ typedef struct { int brightness; int contrast; + Bool doubleBuffer; + unsigned char currentBuffer; FBLinearPtr linear; RegionRec clip; CARD32 colorKey; @@ -237,6 +239,7 @@ EntityInfoPtr pEnt; MGABiosInfo Bios; MGABios2Info Bios2; + CARD8 BiosOutputMode; pciVideoPtr PciInfo; PCITAG PciTag; xf86AccessRec Access; @@ -259,7 +262,6 @@ unsigned long BiosAddress; MessageType BiosFrom; unsigned char * IOBase; - unsigned char * IOBaseDense; unsigned char * FbBase; unsigned char * ILOADBase; unsigned char * FbStart; @@ -352,6 +354,7 @@ #endif XF86VideoAdaptorPtr adaptor; Bool SecondCrtc; + Bool SecondOutput; GDevPtr device; /* The hardware's real SrcOrg */ int realSrcOrg; @@ -482,15 +485,36 @@ #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); +void MGACRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void MGACRTC2SetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo); +void MGACRTC2SetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY); + +void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void MGACRTC2GetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo); +void MGACRTC2GetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY); -double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out); -void printDac(ScrnInfoPtr pScrn); +double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out); +void MGAprintDac(ScrnInfoPtr pScrn); + +#ifdef USEMGAHAL +/************ ESC Call Definition ***************/ +typedef struct { + char *function; + void (*funcptr)(ScrnInfoPtr pScrn, unsigned long *param, char *out, DisplayModePtr pMode); +} MGAEscFuncRec, *MGAEscFuncPtr; + +typedef struct { + char function[32]; + unsigned long parameters[32]; +} EscCmdStruct; + +extern LPMGAMODEINFO pMgaModeInfo[2]; +extern MGAMODEINFO TmpMgaModeInfo[2]; + +extern void MGAExecuteEscCmd(ScrnInfoPtr pScrn, char *cmdline , char *sResult, DisplayModePtr pMode); +void FillDisplayModeStruct(DisplayModePtr pMode, LPMGAMODEINFO pModeInfo); +/************************************************/ +#endif + #endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man:1.3 Thu May 10 17:53:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man Mon Dec 17 15:52:32 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man,v 1.3 2001/05/10 21:53:48 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man,v 1.4 2001/12/17 20:52:32 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH MGA __drivermansuffix__ __vendorversion__ @@ -112,8 +112,7 @@ 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. +Enable or disable use of the shadow framebuffer layer. Default: off. .TP .BI "Option \*qSyncOnGreen\*q \*q" boolean \*q Enable or disable combining the sync signals with the green signal. Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c:1.9 Sun Jun 25 08:46:00 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c Fri Dec 14 14:59:51 2001 @@ -2,7 +2,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ in this Software without prior written authorization from The Open Group. ********************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c,v 1.9 2000/06/25 12:46:00 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c,v 1.10 2001/12/14 19:59:51 dawes Exp $ */ #include "X.h" Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.46 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.49 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.46 Fri Apr 6 12:51:19 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c Fri Jan 11 10:42:57 2002 @@ -1,8 +1,8 @@ /* - * MGA-1064, MGA-G100, MGA-G200, MGA-G400 RAMDAC driver + * MGA-1064, MGA-G100, MGA-G200, MGA-G400, MGA-G550 RAMDAC driver */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.46 2001/04/06 16:51:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.49 2002/01/11 15:42:57 dawes Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -110,6 +110,7 @@ post_div_max = 7; break; case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: ref_freq = 27050.5; feed_div_min = 7; feed_div_max = 127; @@ -210,8 +211,8 @@ /* The actual frequency output by the clock */ double f_pll; - if(MGAISG450(pMga)) { - G450SetPLLFreq(pScrn, f_out); + if(MGAISGx50(pMga)) { + MGAG450SetPLLFreq(pScrn, f_out); return; } @@ -327,10 +328,11 @@ pReg->Option2 = 0x0000007; break; case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: #ifdef USEMGAHAL MGA_HAL(break;); #endif - if (MGAISG450(pMga)) + if (MGAISGx50(pMga)) break; if(pMga->Dac.maxPixelClock == 360000) { /* G400 MAX */ @@ -523,7 +525,7 @@ if (mode->Flags & V_DBLSCAN) pVga->CRTC[9] |= 0x80; - if(MGAISG450(pMga)) { + if(MGAISGx50(pMga)) { OUTREG(MGAREG_ZORG, 0); } @@ -543,9 +545,9 @@ /* Writing values to crtc2[] array */ if (pMga->SecondCrtc) { - CRTC2Get(pScrn, &ModeInfo); - CRTC2GetPitch(pScrn, &ModeInfo); - CRTC2GetDisplayStart(pScrn, &ModeInfo,0,0,0); + MGACRTC2Get(pScrn, &ModeInfo); + MGACRTC2GetPitch(pScrn, &ModeInfo); + MGACRTC2GetDisplayStart(pScrn, &ModeInfo,0,0,0); } return(TRUE); } @@ -573,7 +575,6 @@ } pal++; } - pMga->PaletteLoadCallback = NULL; } @@ -589,7 +590,7 @@ if((pMga->CurrentLayout.Overlay8Plus24) && (pVisual->nplanes != 8)) return; - if(pMga->Chipset == PCI_CHIP_MGAG400){ + if(pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550){ /* load them at the retrace in the block handler instead to work around some problems with static on the screen */ while(numColors--) { @@ -672,7 +673,7 @@ (i == 0x1c) || ((i >= 0x1f) && (i <= 0x29)) || ((i >= 0x30) && (i <= 0x37)) || - (MGAISG450(pMga) && + (MGAISGx50(pMga) && ((i == 0x2c) || (i == 0x2d) || (i == 0x2e) || (i == 0x4c) || (i == 0x4d) || (i == 0x4e)))) continue; @@ -683,14 +684,14 @@ should be correct already */ optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK; - if (!MGAISG450(pMga)) { + if (!MGAISGx50(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) + if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK, mgaReg->Option3); } @@ -715,11 +716,12 @@ /* Second Crtc */ xMODEINFO ModeInfo; +MGA_NOT_HAL( /* Enable Dual Head */ - CRTC2Set(pScrn, &ModeInfo); - EnableSecondOutPut(pScrn, &ModeInfo); - CRTC2SetPitch(pScrn, &ModeInfo); - CRTC2SetDisplayStart(pScrn, &ModeInfo,0,0,0); + MGACRTC2Set(pScrn, &ModeInfo); + MGAEnableSecondOutPut(pScrn, &ModeInfo); + MGACRTC2SetPitch(pScrn, &ModeInfo); + MGACRTC2SetDisplayStart(pScrn, &ModeInfo,0,0,0); for (i = 0x80; i <= 0xa0; i ++) { if (i== 0x8d) { @@ -727,9 +729,11 @@ continue; } outMGAdac(i, mgaReg->dac2[ i - 0x80]); - } - } /* endif pMga->SecondCrtc */ + } +); /* MGA_NOT_HAL */ + } + #ifdef DEBUG ErrorF("Setting DAC:"); for (i=0; i<DACREGSIZE; i++) { @@ -797,7 +801,7 @@ mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG); mgaReg->Option2 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION2); - if (pMga->Chipset == PCI_CHIP_MGAG400) + if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) mgaReg->Option3 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION3); ); /* MGA_NOT_HAL */ @@ -850,6 +854,14 @@ outMGAdac(MGA1064_CURSOR_CTL, 0x03); } +static void +MGAGShowCursorG100(ScrnInfoPtr pScrn) +{ + MGAPtr pMga = MGAPTR(pScrn); + /* Enable cursor - X-Windows mode */ + outMGAdac(MGA1064_CURSOR_CTL, 0x01); +} + static void MGAGHideCursor(ScrnInfoPtr pScrn) { @@ -875,6 +887,7 @@ OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_YHI, (y & 0xF00) >> 8); } + static void MGAGSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { @@ -891,6 +904,22 @@ outMGAdac(MGA1064_CURSOR_COL1_BLUE, (fg & 0x000000FF)); } +static void +MGAGSetCursorColorsG100(ScrnInfoPtr pScrn, int bg, int fg) +{ + MGAPtr pMga = MGAPTR(pScrn); + + /* Background color */ + outMGAdac(MGA1064_CURSOR_COL1_RED, (bg & 0x00FF0000) >> 16); + outMGAdac(MGA1064_CURSOR_COL1_GREEN, (bg & 0x0000FF00) >> 8); + outMGAdac(MGA1064_CURSOR_COL1_BLUE, (bg & 0x000000FF)); + + /* Foreground color */ + outMGAdac(MGA1064_CURSOR_COL2_RED, (fg & 0x00FF0000) >> 16); + outMGAdac(MGA1064_CURSOR_COL2_GREEN, (fg & 0x0000FF00) >> 8); + outMGAdac(MGA1064_CURSOR_COL2_BLUE, (fg & 0x000000FF)); +} + static Bool MGAGUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs) { @@ -998,6 +1027,7 @@ /* * MGAGRamdacInit + * Handle broken G100 special. */ static void MGAGRamdacInit(ScrnInfoPtr pScrn) @@ -1009,11 +1039,17 @@ MGAdac->CursorOffscreenMemSize = 1024; MGAdac->CursorMaxWidth = 64; MGAdac->CursorMaxHeight = 64; - MGAdac->SetCursorColors = MGAGSetCursorColors; MGAdac->SetCursorPosition = MGAGSetCursorPosition; MGAdac->LoadCursorImage = MGAGLoadCursorImage; MGAdac->HideCursor = MGAGHideCursor; - MGAdac->ShowCursor = MGAGShowCursor; + if ((pMga->Chipset == PCI_CHIP_MGAG100) + || (pMga->Chipset == PCI_CHIP_MGAG100)) { + MGAdac->SetCursorColors = MGAGSetCursorColorsG100; + MGAdac->ShowCursor = MGAGShowCursorG100; + } else { + MGAdac->SetCursorColors = MGAGSetCursorColors; + MGAdac->ShowCursor = MGAGShowCursor; + } MGAdac->UseHWCursor = MGAGUseHWCursor; MGAdac->CursorFlags = #if X_BYTE_ORDER == X_LITTLE_ENDIAN @@ -1040,6 +1076,7 @@ MGAdac->maxPixelClock = 220000; break; case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: /* We don't know the new pins format but we know that the maxclock / 4 is where the RamdacType was in the old pins format */ Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c:1.14 Tue Nov 2 18:12:00 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c Mon Dec 10 18:02:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c,v 1.14 1999/11/02 23:12:00 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c,v 1.15 2001/12/10 23:02:33 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -278,7 +278,7 @@ memcpy(&pMga->CurrentLayout, &SavedLayouts[index], sizeof(MGAFBLayout)); pScrn->currentMode = pMga->CurrentLayout.mode; - MGASwitchMode(index, pScrn->currentMode, 0); + pScrn->SwitchMode(index, pScrn->currentMode, 0); MGAAdjustFrame(index, pScrn->frameX0, pScrn->frameY0, 0); pMga->DGAactive = FALSE; } else { @@ -297,7 +297,7 @@ pMga->CurrentLayout.Overlay8Plus24 = FALSE; /* MGAModeInit() will set the mode field */ - MGASwitchMode(index, pMode->mode, 0); + pScrn->SwitchMode(index, pMode->mode, 0); } return TRUE; Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c:1.1 Thu Apr 5 13:42:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c Fri Jan 11 10:42:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.1 2001/04/05 17:42:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.4 2002/01/11 15:42:57 dawes Exp $ */ /********************************************************************* * G450: This is for Dual Head. * Matrox Graphics @@ -140,7 +140,7 @@ /* 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) +void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) { @@ -166,7 +166,7 @@ CARD32 ulDispHeight = pModeInfo->ulDispHeight; #ifdef DEBUG - ErrorF("ENTER CRTC2Get\n"); + ErrorF("ENTER MGACRTC2Get\n"); #endif tmpModeInfo = *pModeInfo; @@ -238,14 +238,14 @@ pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset; #ifdef DEBUG - ErrorF("EXIT CRTC2Get\n"); + ErrorF("EXIT MGACRTC2Get\n"); #endif } /* Set CRTC 2*/ /* Writes to the hardware */ -void CRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +void MGACRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) { @@ -253,7 +253,7 @@ MGARegPtr pReg = &pMga->ModeReg; #ifdef DEBUG - ErrorF("ENTER CRTC2Set\n"); + ErrorF("ENTER MGACRTC2Set\n"); #endif @@ -275,14 +275,14 @@ OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2VSYNC]); #ifdef DEBUG - ErrorF("EXIT CRTC2Set\n"); + ErrorF("EXIT MGACRTC2Set\n"); #endif } - /* Set CRTC2 on Second OutPut*/ -void EnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +/* Set CRTC2 on the right output */ +void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) { CARD8 ucByte, ucXDispCtrl; CARD32 ulC2CTL, ulStatusReg; @@ -290,7 +290,7 @@ MGARegPtr pReg; pReg = &pMga->ModeReg; #ifdef DEBUG - ErrorF("ENTER EnableSecondOutPut\n"); + ErrorF("ENTER MGAEnableSecondOutPut\n"); #endif @@ -306,7 +306,7 @@ ulC2CTL &= ~(C2CTL_PIXCLKSEL_MASK | C2CTL_PIXCLKSELH_MASK); - ulC2CTL |= C2CTL_PIXCLKSEL_VIDEOPLL; + ulC2CTL |= C2CTL_PIXCLKSEL_VIDEOPLL; OUTREG( MGAREG_C2CTL, ulC2CTL); @@ -332,17 +332,30 @@ ucByte &= ~0x40; pReg->DacRegs[MGA1064_GEN_IO_DATA]= ucByte; outMGAdac (MGA1064_GEN_IO_DATA, ucByte); + + /* Since G550 can swap outputs at BIOS initialisation, we must check which + * DAC is 'logically' used as the secondary (don't assume its DAC2 anymore) */ + + ulC2CTL = INREG(MGAREG_C2CTL); + ucXDispCtrl = inMGAdac(MGA1064_DISP_CTL); + + ucXDispCtrl &= ~XDISPCTRL_DAC2OUTSEL_MASK; + ucXDispCtrl |= XDISPCTRL_DAC2OUTSEL_CRTC2; + + if (!pMga->SecondOutput) { + /* Route Crtc2 on Output1 */ + ucXDispCtrl &= ~XDISPCTRL_DAC2OUTSEL_MASK; + ucXDispCtrl |= XDISPCTRL_DAC2OUTSEL_CRTC1; + ulC2CTL |= C2CTL_CRTCDACSEL_CRTC2; + } + else { + /* Route Crtc2 on Output2*/ + ucXDispCtrl &= ~XDISPCTRL_DAC2OUTSEL_MASK; + ucXDispCtrl |= XDISPCTRL_DAC2OUTSEL_CRTC2; + ulC2CTL &= ~C2CTL_CRTCDACSEL_MASK; + } - - - /* Route Crtc2 on Dac2*/ - ulC2CTL = INREG( MGAREG_C2CTL); - ucXDispCtrl = inMGAdac( MGA1064_DISP_CTL); - - ucXDispCtrl &= ~XDISPCTRL_DAC2OUTSEL_MASK; - ucXDispCtrl |= XDISPCTRL_DAC2OUTSEL_CRTC2; - - /* Enable CRTC2*/ + /* Enable CRTC2*/ ulC2CTL |= C2_EN_M; pReg->dac2[ MGA1064_DISP_CTL - 0x80] = ucXDispCtrl; @@ -379,7 +392,7 @@ #ifdef DEBUG - ErrorF("EXIT EnableSecondOutPut\n"); + ErrorF("EXIT MGAEnableSecondOutPut\n"); #endif } @@ -387,7 +400,7 @@ -void CRTC2GetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +void MGACRTC2GetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) { CARD32 ulOffset; MGAPtr pMga = MGAPTR(pScrn); @@ -395,7 +408,7 @@ pReg = &pMga->ModeReg; #ifdef DEBUG - ErrorF("ENTER CRTC2GetPitch\n"); + ErrorF("ENTER MGACRTC2GetPitch\n"); #endif @@ -408,17 +421,20 @@ case 32: ulOffset = pModeInfo->ulFBPitch * 4; break; + default: /* Muffle compiler */ + ulOffset = pModeInfo->ulFBPitch; + break; } pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset; #ifdef DEBUG - ErrorF("EXIT CRTC2GetPitch\n"); + ErrorF("EXIT MGACRTC2GetPitch\n"); #endif } -void CRTC2SetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +void MGACRTC2SetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) { MGAPtr pMga = MGAPTR(pScrn); @@ -440,7 +456,7 @@ /* Set Display Start*/ /* base in bytes*/ -void CRTC2GetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY) +void MGACRTC2GetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY) { CARD32 ulAddress; @@ -449,7 +465,7 @@ pReg = &pMga->ModeReg; #ifdef DEBUG - ErrorF("ENTER CRTC2GetDisplayStart\n"); + ErrorF("ENTER MGACRTC2GetDisplayStart\n"); #endif @@ -469,23 +485,23 @@ pReg->crtc2[MGAREG2_C2STARTADD0] = ulAddress + base; #ifdef DEBUG - ErrorF("EXIT CRTC2GetDisplayStart\n"); + ErrorF("EXIT MGACRTC2GetDisplayStart\n"); #endif } -void CRTC2SetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY) +void MGACRTC2SetDisplayStart (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"); + ErrorF("ENTER MGACRTC2SetDisplayStart\n"); #endif OUTREG(MGAREG2_C2STARTADD0, pReg->crtc2[MGAREG2_C2STARTADD0]); #ifdef DEBUG - ErrorF("EXIT CRTC2GetDisplayStart\n"); + ErrorF("EXIT MGACRTC2GetDisplayStart\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.21 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c:1.21 Wed May 2 11:06:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c Wed Sep 26 08:59:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.21 2001/05/02 15:06:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.22 2001/09/26 12:59:17 alanh Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. @@ -817,6 +817,7 @@ init.sarea_priv_offset = sizeof(XF86DRISAREARec); switch ( pMga->Chipset ) { + case PCI_CHIP_MGAG550: case PCI_CHIP_MGAG400: init.chipset = MGA_CARD_TYPE_G400; break; @@ -898,7 +899,8 @@ MGADRIPtr pMGADRI; MGADRIServerPrivatePtr pMGADRIServer; - switch ( pMga->Chipset ) { + switch(pMga->Chipset) { + case PCI_CHIP_MGAG550: case PCI_CHIP_MGAG400: case PCI_CHIP_MGAG200: #if 0 @@ -906,8 +908,7 @@ #endif break; default: - xf86DrvMsg( pScrn->scrnIndex, X_ERROR, - "[drm] Direct rendering only supported with AGP G200/G400 cards!\n" ); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Direct rendering only supported with G200/G400/G550 AGP\n"); return FALSE; } @@ -1156,7 +1157,8 @@ return FALSE; } - switch ( pMga->Chipset ) { + switch(pMga->Chipset) { + case PCI_CHIP_MGAG550: case PCI_CHIP_MGAG400: pMGADRI->chipset = MGA_CARD_TYPE_G400; break; Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c diff -u 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.214 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c:1.202.2.2 Mon May 28 10:23:38 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c Mon Jan 7 16:50:11 2002 @@ -45,7 +45,7 @@ * Added digital screen option for first head */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.202.2.2 2001/05/28 14:23:38 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.214 2002/01/07 21:50:11 dawes Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -174,6 +174,7 @@ { PCI_CHIP_MGAG200, "mgag200" }, { PCI_CHIP_MGAG200_PCI, "mgag200 PCI" }, { PCI_CHIP_MGAG400, "mgag400" }, + { PCI_CHIP_MGAG550, "mgag550" }, {-1, NULL } }; @@ -187,6 +188,7 @@ { PCI_CHIP_MGAG200, PCI_CHIP_MGAG200, RES_SHARED_VGA }, { PCI_CHIP_MGAG200_PCI, PCI_CHIP_MGAG200_PCI, RES_SHARED_VGA }, { PCI_CHIP_MGAG400, PCI_CHIP_MGAG400, RES_SHARED_VGA }, + { PCI_CHIP_MGAG550, PCI_CHIP_MGAG550, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -263,105 +265,92 @@ */ static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", + "vgaHWSetMmioFuncs", + "vgaHWUnlock", + "vgaHWUnmapMem", "vgaHWddc1SetSpeed", NULL }; -static const char *cfbSymbols[] = { - "cfb8_32ScreenInit", - NULL -}; - static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; static const char *xf8_32bppSymbols[] = { + "cfb8_32ScreenInit", "xf86Overlay8Plus32Init", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", - "XAACreateInfoRec", - "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", "XAACachePlanarMonoStipple", - "XAAScreenIndex", + "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAFallbackOps", "XAAFillSolidRects", + "XAAInit", "XAAMoveDWORDS", + "XAAScreenIndex", + "XAA_888_plus_PICT_a8_to_8888", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; #ifdef XF86DRI static const char *drmSymbols[] = { - "drmAvailable", "drmAddBufs", "drmAddMap", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", - "drmFreeVersion", - "drmGetVersion", - "drmMap", - "drmUnmap", - "drmMapBufs", - "drmUnmapBufs", "drmAgpAcquire", - "drmAgpRelease", - "drmAgpEnable", "drmAgpAlloc", - "drmAgpFree", "drmAgpBind", - "drmAgpUnbind", + "drmAgpDeviceId", + "drmAgpEnable", + "drmAgpFree", "drmAgpGetMode", - "drmAgpBase", - "drmAgpSize", + "drmAgpRelease", + "drmAgpUnbind", "drmAgpVendorId", - "drmAgpDeviceId", - "drmMGAInitDMA", + "drmFreeVersion", + "drmGetVersion", "drmMGACleanupDMA", - "drmMGAFlushDMA", "drmMGAEngineReset", + "drmMGAFlushDMA", + "drmMGAInitDMA", + "drmMapBufs", + "drmMap", + "drmUnmap", + "drmUnmapBufs", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", "DRILock", - "DRIUnlock", - "DRIGetSAREAPrivate", - "DRIGetContext", "DRIQueryVersion", - "DRIAdjustFrame", - "DRIOpenFullScreen", - "DRICloseFullScreen", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; @@ -370,11 +359,12 @@ #define MGAuseI2C 1 static const char *ddcSymbols[] = { - "xf86PrintEDID", "xf86DoEDID_DDC1", #if MGAuseI2C "xf86DoEDID_DDC2", #endif + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; @@ -392,12 +382,13 @@ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", NULL }; static const char *int10Symbols[] = { - "xf86InitInt10", "xf86FreeInt10", + "xf86InitInt10", NULL }; @@ -405,26 +396,25 @@ "fbdevHWInit", "fbdevHWUseBuildinMode", - "fbdevHWGetDepth", "fbdevHWGetVidmem", /* colormap */ "fbdevHWLoadPalette", /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", "fbdevHWModeInit", + "fbdevHWRestore", "fbdevHWSave", + "fbdevHWSwitchMode", + "fbdevHWValidMode", - "fbdevHWUnmapMMIO", - "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", + "fbdevHWUnmapMMIO", + "fbdevHWUnmapVidmem", NULL }; @@ -432,16 +422,16 @@ #ifdef USEMGAHAL static const char *halSymbols[] = { "MGACloseLibrary", - "MGASaveVgaState", + "MGAGetBOARDHANDLESize", + "MGAGetHardwareInfo", + "MGAOpenLibrary", "MGARestoreVgaState", - "MGASetVgaMode", + "MGASaveVgaState", "MGASetMode", + "MGASetVgaMode", "MGAValidateMode", "MGAValidateVideoParameters", - "MGAGetBOARDHANDLESize", - "MGAGetHardwareInfo", - "MGAOpenLibrary", - NULL + NULL }; #endif #ifdef XFree86LOADER @@ -484,7 +474,7 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, + LoaderRefSymLists(vgahwSymbols, xaaSymbols, xf8_32bppSymbols, ramdacSymbols, ddcSymbols, i2cSymbols, shadowSymbols, fbdevHWSymbols, vbeSymbols, @@ -672,7 +662,7 @@ * as sharable. */ pEnt = xf86GetEntityInfo(usedChips[i]); - if (pEnt->chipset == PCI_CHIP_MGAG400) { + if (pEnt->chipset == PCI_CHIP_MGAG400 || pEnt->chipset == PCI_CHIP_MGAG550) { MGAEntPtr pMgaEnt = NULL; DevUnion *pPriv; @@ -749,6 +739,9 @@ pMga = MGAPTR(pScrn); pBios = &pMga->Bios; pBios2 = &pMga->Bios2; + + /* Get the output mode set by the BIOS */ + xf86ReadBIOS(pMga->BiosAddress, 0x7ff1, &pMga->BiosOutputMode, sizeof(CARD8)); /* * If the BIOS address was probed, it was found from the PCI config @@ -931,6 +924,7 @@ "Assuming 4096 KB\n"); return 4096; case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: if(biosInfo) { switch((biosInfo >> 10) & 0x07) { case 0: @@ -1192,7 +1186,6 @@ double real; int bytesPerPixel; ClockRangePtr clockRanges; - const char *reqSym = NULL; const char *s; int flags24; MGAEntPtr pMgaEnt = NULL; @@ -1305,54 +1298,39 @@ /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; -#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(xf86IsEntityShared(pScrn->entityList[0]) && - xf86IsPrimInitDone(pScrn->entityList[0])) { - /* This is the second crtc */ - pMga->SecondCrtc = TRUE; - pMga->HWCursor = FALSE; - pScrn->AdjustFrame = MGAAdjustFrameCrtc2; - pMgaEnt->pScrn_2 = pScrn; + * In case of DualHead, we need to determine if we are the 'master' head or the 'slave' + * head. In order to do that, at the end of the first initialisation, PrimInit is set as + * DONE to the shared entity. So that the second initialisation knows that something has + * been done before it. This always assume that the first device initialised is the master + * head, and the second the slave. + * + */ + if (xf86IsEntityShared(pScrn->entityList[0])) { /* dual-head mode */ + + if (!xf86IsPrimInitDone(pScrn->entityList[0])) { /* Is it the first initialisation? */ + /* First CRTC */ + pMga->SecondCrtc = FALSE; + pMga->HWCursor = TRUE; + pMgaEnt->pScrn_1 = pScrn; + } + else { + /* Second CRTC */ + pMga->SecondCrtc = TRUE; + pMga->HWCursor = FALSE; + pMgaEnt->pScrn_2 = pScrn; + pScrn->AdjustFrame = MGAAdjustFrameCrtc2; + } #ifdef XF86DRI pMga->GetQuiescence = MGAGetQuiescenceShared; #endif - } else { + } else { /* single-head mode */ pMga->SecondCrtc = FALSE; pMga->HWCursor = TRUE; - if (xf86IsEntityShared(pScrn->entityList[0])) { - pMgaEnt->pScrn_1 = pScrn; -#ifdef XF86DRI - pMga->GetQuiescence = MGAGetQuiescenceShared; -#endif - } else { #ifdef XF86DRI - pMga->GetQuiescence = MGAGetQuiescence; + pMga->GetQuiescence = MGAGetQuiescence; #endif - } - } -#else - /* - * This is an alternative version that determines which is the secondary - * CRTC from the screen field in pMga->device. It doesn't currently - * work becasue there are things that assume the primary CRTC is - * initialised first. - */ - if (pMga->device->screen == 1) { - /* This is the second CRTC */ - pMga->SecondCrtc = TRUE; - pMga->HWCursor = FALSE; - pScrn->AdjustFrame = MGAAdjustFrameCrtc2; - } else { - pMga->SecondCrtc = FALSE; - pMga->HWCursor = TRUE; } -#endif /* * The first thing we should figure out is the depth, bpp, etc. @@ -1413,7 +1391,7 @@ bytesPerPixel = pScrn->bitsPerPixel / 8; - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Collect all of the relevant option flags (fill in pScrn->options) */ @@ -1431,6 +1409,7 @@ xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); pInt = xf86InitInt10(pMga->pEnt->index); if (pInt) pMga->softbooted = TRUE; @@ -1470,15 +1449,18 @@ } #ifdef USEMGAHAL - 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 { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Matrox HAL module not found - using builtin mode setup instead\n"); - pMga->HALLoaded = FALSE; - } + if (HAL_CHIPSETS) { + if (!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 { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Matrox HAL module not loaded " + "- using builtin mode setup instead\n"); + pMga->HALLoaded = FALSE; + } + } #endif /* @@ -1649,6 +1631,7 @@ case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: MGAGSetupFuncs(pScrn); break; } @@ -1733,7 +1716,6 @@ } } - #if !defined(__powerpc__) /* * Find the BIOS base. Get it from the PCI config if possible. Otherwise @@ -1771,8 +1753,38 @@ * Read the BIOS data struct */ +#if defined(__alpha__) + /* + * Some old Digital-OEMed Matrox Millennium I cards have a VGA + * disable switch. If the disable is on, we can't read the BIOS, + * and pMga->BiosAddress = 0x0. The disable switch is needed to + * allow multi-head operation with brain-dead console code... ;-} + */ + + if ((pMga->BiosAddress == 0) && !xf86IsPrimaryPci(pMga->PciInfo)) + xf86DrvMsg(pScrn->scrnIndex, pMga->BiosFrom, + "BIOS not found, skipping read\n"); + else +#endif MGAReadBios(pScrn); + /* Since the BIOS can swap DACs during the initialisation of G550, we need to + * store which DAC this instance of the driver is taking care of. This is done + * by checking a flag stored in the ROM by the BIOS at a fixed address. */ + + if (!pMga->SecondCrtc) + pMga->SecondOutput = FALSE; + else + pMga->SecondOutput = TRUE; + + if (pMga->Chipset == PCI_CHIP_MGAG550) { + if (!pMga->SecondCrtc) { + pMga->SecondOutput = (pMga->BiosOutputMode & 0x1) ? TRUE : FALSE; + } else { + pMga->SecondOutput = (pMga->BiosOutputMode & 0x1) ? FALSE : TRUE; + } + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "MGABios.RamdacType = 0x%x\n", pMga->Bios.RamdacType); #endif /* !__powerpc__ */ @@ -1845,6 +1857,7 @@ /* Normal Handling of video ram etc */ pMga->FbMapSize = pScrn->videoRam * 1024; switch(pMga->Chipset) { + case PCI_CHIP_MGAG550: case PCI_CHIP_MGAG400: case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: @@ -1929,7 +1942,8 @@ if(pMga->SecondCrtc == TRUE) { /* Override on 2nd crtc */ - if (pMga->ChipRev >= 0x80) { /* G450 */ + if ((pMga->ChipRev >= 0x80) || (pMga->Chipset == PCI_CHIP_MGAG550)) { + /* G450, G550 */ pMga->MaxClock = 234000; } else { pMga->MaxClock = 135000; @@ -2009,6 +2023,7 @@ case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: maxPitch = 4096; break; } @@ -2072,7 +2087,7 @@ if (digital1) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Digital screen detected on first head.\n"); - mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL2; + mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL1; } else if (tv1) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV detected on first head.\n"); @@ -2302,16 +2317,14 @@ MGAFreeRec(pScrn); return FALSE; } - reqSym = "cfb8_32ScreenInit"; + xf86LoaderReqSymLists(xf8_32bppSymbols, NULL); } else { if (!xf86LoadSubModule(pScrn, "fb")) { MGAFreeRec(pScrn); return FALSE; } - reqSym = "fbScreenInit"; - xf86LoaderReqSymbols("fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); } - xf86LoaderReqSymbols(reqSym, NULL); /* Load XAA if needed */ @@ -2417,14 +2430,6 @@ if (pMga->IOBase == NULL) return FALSE; -#ifdef __alpha__ - pMga->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, - VIDMEM_MMIO | VIDMEM_MMIO_32BIT, - pMga->PciTag, pMga->IOAddress, 0x4000); - if (pMga->IOBaseDense == NULL) - return FALSE; -#endif - pMga->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pMga->PciTag, pMga->FbAddress, pMga->FbMapSize); @@ -2680,7 +2685,7 @@ } else { pMga->pMgaModeInfo->flOutput = MGAMODEINFO_FORCE_PITCH; if (digital1) { - pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_DIGITAL2; + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_DIGITAL1; } else if (tv1) { pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_TV; } else { @@ -2728,13 +2733,36 @@ " Make sure to validate the mode before.\n"); return FALSE; } + ); /* MGA_HAL */ + /* getting around bugs in the HAL lib. MATROX: hint, hint */ 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); - } + 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: + 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); + outMGAdac(MGA1064_CURSOR_CTL, 0x00); + } + if (pMga->Overlay8Plus24 == TRUE) { + outMGAdac(MGA1064_MUL_CTL, MGA1064_MUL_CTL_32bits); + outMGAdac(MGA1064_COL_KEY_MSK_LSB,0xFF); + outMGAdac(MGA1064_COL_KEY_LSB,pMga->colorKey); + outMGAdac(MGA1064_COL_KEY_MSK_MSB,0xFF); + outMGAdac(MGA1064_COL_KEY_MSB,0xFF); + } + break; + default: + break; + } ); /* MGA_HAL */ #endif MGA_NOT_HAL((*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE)); @@ -2760,6 +2788,45 @@ return TRUE; } +static +void MGARestoreSecondCrtc(ScrnInfoPtr pScrn) +{ + MGAPtr pMga = MGAPTR(pScrn); + + if (MGAISGx50(pMga)) { + /* Force to return in clone mode */ + if (pMga->SecondOutput) { + CARD8 ucXDispCtrl = inMGAdac(MGA1064_DISP_CTL); + + ucXDispCtrl &= ~0x0c; /* dac2outsel mask */ + ucXDispCtrl |= 0x04; /* dac2 -> crtc1 */ + + outMGAdac(MGA1064_DISP_CTL, ucXDispCtrl); + + } else { + CARD8 ucXDispCtrl = inMGAdac(MGA1064_DISP_CTL); + CARD32 ulC2CTL = INREG(MGAREG_C2CTL); + + ucXDispCtrl &= ~0x0c; /* dac2outsel mask */ + ucXDispCtrl |= 0x5; /* dac1outsel -> crtcdacsel, dac2 -> crtc1 */ + ulC2CTL &= ~0x00100000; /* crtcdacsel -> crtc1 */ + + outMGAdac(MGA1064_DISP_CTL, ucXDispCtrl); + OUTREG(MGAREG_C2CTL, ulC2CTL); + } + + } else { + /* Force to close second crtc */ + CARD32 ulC2CTL = INREG(MGAREG_C2CTL); + + ulC2CTL &= ~0x1; /* crtc2 disabled */ + + OUTREG(MGAREG_C2CTL, ulC2CTL); + } + + return; +} + /* * Restore the initial (text) mode. */ @@ -2774,7 +2841,10 @@ if (pScrn->pScreen != NULL) MGAStormSync(pScrn); - if(pMga->SecondCrtc == TRUE) return; + if(pMga->SecondCrtc) { + MGARestoreSecondCrtc(pScrn); + return; + } /* Only restore text mode fonts/text for the primary card */ vgaHWProtect(pScrn, TRUE); @@ -2834,7 +2904,9 @@ int width, height, displayWidth; MGAEntPtr pMgaEnt = NULL; int f; +#ifdef XF86DRI MessageType driFrom = X_DEFAULT; +#endif /* * First get the ScrnInfoRec @@ -2916,6 +2988,7 @@ #ifdef USEMGAHAL MGA_HAL( /* There is a problem in the HALlib: set soft reset bit */ + /* MATROX: hint, hint */ if (!pMga->Primary && !pMga->FBDev && (pMga->PciInfo->subsysCard == PCI_CARD_MILL_G200_SG) ) { OUTREG(MGAREG_Reset, 1); @@ -2950,6 +3023,7 @@ case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW, pMga->FbCursorOffset >> 10); outMGAdac(MGA1064_CURSOR_BASE_ADR_HI, pMga->FbCursorOffset >> 18); break; @@ -3097,8 +3171,6 @@ ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit (pScreen, 0, 0); } if (!ret) @@ -3120,6 +3192,10 @@ } } + /* must be after RGB ordering fixed */ + if (!pMga->Overlay8Plus24) + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); pMga->BlockHandler = pScreen->BlockHandler; @@ -3231,9 +3307,6 @@ /* For the second head, work around display problem. */ if (pMga->SecondCrtc) { MGACrtc2FillStrip(pScrn); - } else { - /* shut second head */ - outMGAdac(0xa0,0x08); } /* Done */ @@ -3274,7 +3347,7 @@ (3 - pMga->BppShifts[(pLayout->bitsPerPixel >> 3) - 1]); if (pLayout->bitsPerPixel == 24) { - if (pMga->Chipset == PCI_CHIP_MGAG400) + if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) Base &= ~1; /* Not sure why */ Base *= 3; } @@ -3348,10 +3421,6 @@ } #endif - if (!pMga->SecondCrtc) { - outMGAdac(0xa0,0x08); - } - if (!MGAModeInit(pScrn, pScrn->currentMode)) return FALSE; MGAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -3384,6 +3453,16 @@ return TRUE; } +#define RESTORE_TEXTMODE_ON_DVI(x) \ + if (MGAISGx50(x) && \ + (ISDIGITAL1(x) || ISDIGITAL2(x))) { \ + /* Reset DUALDVI register */ \ + outMGAdac(MGA1064_DVI_PIPE_CTL, 0x0); \ + /* Set Panel mode between 20 and 54 MHz */ \ + outMGAdac(MGA1064_PAN_CTL, 0x7); \ + } + + /* * This is called when VT switching away from the X server. Its job is * to restore the previous (text) mode. @@ -3397,14 +3476,11 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); - MGAPtr pMga = MGAPTR(pScrn); #ifdef XF86DRI + MGAPtr pMga = MGAPTR(pScrn); ScreenPtr pScreen; #endif - /* Close second Crtc */ - outMGAdac(0xa0, 0x08); - MGARestore(pScrn); vgaHWLock(hwp); @@ -3416,7 +3492,9 @@ DRILock(pScreen, 0); } #endif - +#ifdef USEMGAHAL + MGA_HAL( RESTORE_TEXTMODE_ON_DVI(pMga); ); +#endif } @@ -3435,9 +3513,9 @@ vgaHWPtr hwp = VGAHWPTR(pScrn); MGAPtr pMga = MGAPTR(pScrn); MGAEntPtr pMgaEnt = NULL; - - MGA_NOT_HAL(outMGAdac(0xa0, 0x08)); - +#ifdef USEMGAHAL + MGA_HAL( RESTORE_TEXTMODE_ON_DVI(pMga); ); +#endif if (pScrn->vtSema) { if (pMga->FBDev) { fbdevHWRestore(pScrn); Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c:1.2 Thu Apr 5 13:42:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c Fri Jan 11 10:42:57 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.2 2001/04/05 17:42:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.5 2002/01/11 15:42:57 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -260,9 +260,9 @@ /* Pixel PLL */ if (!pMga->SecondCrtc) - OUTREG8(0x3c00, 0x4f); + OUTREG8(0x3c00, 0x4f); /* Pixel PLL */ else - OUTREG8(0x3c00, 0x8f); + OUTREG8(0x3c00, 0x8c); /* Video PLL */ ulFallBackCounter = 0; @@ -291,7 +291,7 @@ } -double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out) +double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out) { Bool bFoundValidPLL; Bool bLocked; @@ -357,17 +357,23 @@ ulMNP = 0; /* For pixel pll */ - ucMisc = INREG8(0x1FCC); - OUTREG8(0x1fc2, (CARD8)(ucMisc | CLKSEL_MGA)); + if (!pMga->SecondCrtc) { + 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)*/ +#if 0 + for(ucS = 0; !bFoundValidPLL && (ucS < 0x40); ucS += 8) +#endif { -/* ulTryMNP &= 0xffffffc7;*/ -/* ulTryMNP |= (CARD32)ucS;*/ +#if 0 + ulTryMNP &= 0xffffffc7; + ulTryMNP |= (CARD32)ucS; +#endif bLocked = TRUE; if((ulMNPTable[ulIndex] & 0xff00) < 0x300 || Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.20 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.20 Wed Mar 21 12:02:24 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h Wed Sep 26 08:59:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.20 2001/03/21 17:02:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.21 2001/09/26 12:59:17 alanh Exp $ */ #ifndef _MGA_MACROS_H_ #define _MGA_MACROS_H_ @@ -94,7 +94,9 @@ #ifdef USEMGAHAL #define HAL_CHIPSETS ((pMga->Chipset == PCI_CHIP_MGAG200_PCI) || \ (pMga->Chipset == PCI_CHIP_MGAG200) || \ - (pMga->Chipset == PCI_CHIP_MGAG400)) + (pMga->Chipset == PCI_CHIP_MGAG400) || \ + (pMga->Chipset == PCI_CHIP_MGAG550)) + #define MGA_HAL(x) { \ MGAPtr pMga = MGAPTR(pScrn); \ if (pMga->HALLoaded && HAL_CHIPSETS) { x; } \ @@ -107,6 +109,7 @@ #define MGA_NOT_HAL(x) { x; } #endif -#define MGAISG450(x) ( ((x)->Chipset == PCI_CHIP_MGAG400) && ((x)->ChipRev >= 0x80) ) +#define MGAISGx50(x) ( (((x)->Chipset == PCI_CHIP_MGAG400) && ((x)->ChipRev >= 0x80)) || \ + ((x)->Chipset == PCI_CHIP_MGAG550) ) #endif /* _MGA_MACROS_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h:1.1 Thu Mar 6 18:16:01 1997 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h Wed Jul 25 11:05:06 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h,v 1.1 1997/03/06 23:16:01 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h,v 1.2 2001/07/25 15:05:06 dawes Exp $ */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define CATNAME(prefix,subname) prefix##subname #else #define CATNAME(prefix,subname) prefix/**/subname Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h:1.17 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h:1.17 Wed Apr 25 10:23:00 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h Wed Sep 26 08:59:18 2001 @@ -2,7 +2,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.17 2001/04/25 14:23:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.18 2001/09/26 12:59:18 alanh Exp $ */ @@ -317,6 +317,7 @@ #define MGA1064_CUR_YHI 0x0f /* MGA1064 indirect registers */ +#define MGA1064_DVI_PIPE_CTL 0x03 #define MGA1064_CURSOR_BASE_ADR_LOW 0x04 #define MGA1064_CURSOR_BASE_ADR_HI 0x05 #define MGA1064_CURSOR_CTL 0x06 @@ -403,6 +404,8 @@ #define MGA1064_DISP_CTL 0x8a #define MGA1064_SYNC_CTL 0x8b #define MGA1064_PWR_CTL 0xa0 +#define MGA1064_PAN_CTL 0xa2 + /* Using crtc2 */ #define MGAREG2_C2CTL 0x10 #define MGAREG2_C2HPARAM 0x14 Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.91 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.96 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.91 Thu May 10 17:53:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c Thu Dec 6 10:54:52 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.91 2001/05/10 21:53:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.96 2001/12/06 15:54:52 keithp Exp $ */ /* All drivers should typically include these */ @@ -102,12 +102,14 @@ static void MGANAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int skipleft); +#if X_BYTE_ORDER == X_LITTLE_ENDIAN 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 flags, int phase); +#endif void MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn); #if PSZ == 8 void Mga16RestoreAccelState(ScrnInfoPtr pScrn); @@ -582,6 +584,9 @@ pMga->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; + pMga->RenderTime = 0; + pMga->LinearScratch = 0; + pMga->MaxFastBlitY = 0; pMga->MaxBlitDWORDS = 0x40000 >> 5; @@ -596,6 +601,7 @@ USE_RECTS_FOR_LINES; break; case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: if(pMga->SecondCrtc == TRUE) { pMga->HasFBitBlt = FALSE; } @@ -603,7 +609,8 @@ /* fallthrough */ case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: - doRender = TRUE; + if (pMga->SecondCrtc == FALSE) + doRender = TRUE; pMga->AccelFlags = TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND; @@ -712,11 +719,7 @@ if(pMga->ILOADBase) { pMga->ColorExpandBase = pMga->ILOADBase; } else { -#ifdef __alpha__ - pMga->ColorExpandBase = pMga->IOBaseDense; -#else pMga->ColorExpandBase = pMga->IOBase; -#endif } infoPtr->SetupForScanlineCPUToScreenColorExpandFill = MGANAME(SetupForScanlineCPUToScreenColorExpandFill); @@ -794,7 +797,9 @@ infoPtr->ScanlineCPUToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->SolidFillFlags |= NO_PLANEMASK; infoPtr->SolidLineFlags |= NO_PLANEMASK; +#if X_BYTE_ORDER == X_LITTLE_ENDIAN infoPtr->DashedLineFlags |= NO_PLANEMASK; +#endif infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK; infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->FillSolidRectsFlags |= NO_PLANEMASK; @@ -951,7 +956,7 @@ #ifdef RENDER if(doRender && ((pScrn->bitsPerPixel == 32) || (pScrn->bitsPerPixel == 16))) { - if(pMga->Chipset == PCI_CHIP_MGAG400) { + if(pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) { infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE; infoPtr->SetupForCPUToScreenAlphaTexture = MGASetupForCPUToScreenAlphaTexture; @@ -1161,6 +1166,7 @@ pMga->AccelFlags &= ~CLIPPER_ON; switch(pMga->Chipset) { + case PCI_CHIP_MGAG550: case PCI_CHIP_MGAG400: case PCI_CHIP_MGAG200: case PCI_CHIP_MGAG200_PCI: @@ -1861,6 +1867,7 @@ } } +#if X_BYTE_ORDER == X_LITTLE_ENDIAN /***************************\ | Dashed Lines | @@ -1971,6 +1978,7 @@ } } +#endif /* X_BYTE_ORDER == X_LITTLE_ENDIAN */ #if PSZ != 24 Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c diff -u 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.29 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c:1.24.2.1 Thu May 31 22:24:18 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c Wed Dec 26 09:54:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.24.2.1 2001/06/01 02:24:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.29 2001/12/26 14:54:04 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -63,7 +63,7 @@ #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -static Atom xvBrightness, xvContrast, xvColorKey; +static Atom xvBrightness, xvContrast, xvColorKey, xvDoubleBuffer; void MGAInitVideo(ScreenPtr pScreen) { @@ -77,7 +77,8 @@ (pMga->SecondCrtc == FALSE) && ((pMga->Chipset == PCI_CHIP_MGAG200) || (pMga->Chipset == PCI_CHIP_MGAG200_PCI) || - (pMga->Chipset == PCI_CHIP_MGAG400))) + (pMga->Chipset == PCI_CHIP_MGAG400) || + (pMga->Chipset == PCI_CHIP_MGAG550))) { if((pMga->Overlay8Plus24 || pMga->TexturedVideo) && (pScrn->bitsPerPixel != 24)) @@ -145,13 +146,14 @@ {15, DirectColor}, {16, DirectColor}, {24, DirectColor} }; -#define NUM_ATTRIBUTES_OVERLAY 3 +#define NUM_ATTRIBUTES_OVERLAY 4 static XF86AttributeRec Attributes[NUM_ATTRIBUTES_OVERLAY] = { {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_CONTRAST"}, + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"} }; #define NUM_IMAGES 4 @@ -190,7 +192,7 @@ static XF86VideoAdaptorPtr -MGAAllocAdaptor(ScrnInfoPtr pScrn) +MGAAllocAdaptor(ScrnInfoPtr pScrn, Bool doublebuffer) { XF86VideoAdaptorPtr adapt; MGAPtr pMga = MGAPTR(pScrn); @@ -215,12 +217,15 @@ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); xvContrast = MAKE_ATOM("XV_CONTRAST"); xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); pPriv->colorKey = pMga->videoKey; pPriv->videoStatus = 0; pPriv->brightness = 0; pPriv->contrast = 128; pPriv->lastPort = -1; + pPriv->doubleBuffer = doublebuffer; + pPriv->currentBuffer = 0; pMga->adaptor = adapt; pMga->portPrivate = pPriv; @@ -235,7 +240,7 @@ MGAPtr pMga = MGAPTR(pScrn); XF86VideoAdaptorPtr adapt; - adapt = MGAAllocAdaptor(pScrn); + adapt = MGAAllocAdaptor(pScrn, TRUE); adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; @@ -246,9 +251,10 @@ adapt->pFormats = Formats; adapt->nPorts = 1; adapt->pAttributes = Attributes; - if (pMga->Chipset == PCI_CHIP_MGAG400) { + if (pMga->Chipset == PCI_CHIP_MGAG400 || + pMga->Chipset == PCI_CHIP_MGAG550) { adapt->nImages = 4; - adapt->nAttributes = 3; + adapt->nAttributes = 4; } else { adapt->nImages = 3; adapt->nAttributes = 1; @@ -281,7 +287,7 @@ XF86VideoAdaptorPtr adapt; MGAPtr pMga = MGAPTR(pScrn); - adapt = MGAAllocAdaptor(pScrn); + adapt = MGAAllocAdaptor(pScrn, FALSE); adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = 0; @@ -294,7 +300,8 @@ adapt->pAttributes = NULL; adapt->nAttributes = 0; adapt->pImages = Images; - if (pMga->Chipset == PCI_CHIP_MGAG400) + if (pMga->Chipset == PCI_CHIP_MGAG400 || + pMga->Chipset == PCI_CHIP_MGAG550) adapt->nImages = 4; else adapt->nImages = 3; @@ -495,6 +502,11 @@ outMGAdac(0x57, (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue); REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else + if(attribute == xvDoubleBuffer) { + if((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; } else return BadMatch; return Success; @@ -516,6 +528,9 @@ if(attribute == xvContrast) { *value = pPriv->contrast; } else + if(attribute == xvDoubleBuffer) { + *value = pPriv->doubleBuffer ? 1 : 0; + } else if(attribute == xvColorKey) { *value = pPriv->colorKey; } else return BadMatch; @@ -681,11 +696,15 @@ CHECK_DMA_QUIESCENT(pMga, pScrn); - /* got 64 scanlines to do it in */ - tmp = INREG(MGAREG_VCOUNT) + 64; - if(tmp > pScrn->currentMode->VDisplay) - tmp -= pScrn->currentMode->VDisplay; + /* got 48 scanlines to do it in */ + tmp = INREG(MGAREG_VCOUNT) + 48; + /* FIXME always change it in vertical retrace use CrtcV ?*/ + if(tmp > pScrn->currentMode->CrtcVTotal) + tmp -= 49; /* too bad */ + else + tmp = pScrn->currentMode->CrtcVTotal -1; + tmp = pScrn->currentMode->VDisplay +1; /* enable accelerated 2x horizontal zoom when pixelclock >135MHz */ hzoom = (pScrn->currentMode->Clock > 135000) ? 1 : 0; @@ -883,8 +902,12 @@ break; } - if(!(pPriv->linear = MGAAllocateMemory(pScrn, pPriv->linear, new_size))) + if(!(pPriv->linear = MGAAllocateMemory(pScrn, pPriv->linear, + pPriv->doubleBuffer ? (new_size << 1) : new_size))) + { return BadAlloc; + } + pPriv->currentBuffer ^= 1; /* copy data */ top = y1 >> 16; @@ -893,6 +916,8 @@ left <<= 1; offset = pPriv->linear->offset * bpp; + if(pPriv->doubleBuffer) + offset += pPriv->currentBuffer * new_size * bpp; dst_start = pMga->FbStart + offset + left + (top * dstPitch); if(pMga->TexturedVideo && pMga->AccelInfoRec->NeedToSync && @@ -1212,7 +1237,7 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); - int num = (pMga->Chipset == PCI_CHIP_MGAG400) ? 2 : 1; + int num = (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) ? 2 : 1; XF86OffscreenImagePtr offscreenImages; /* need to free this someplace */ @@ -1230,7 +1255,7 @@ offscreenImages[0].getAttribute = MGAGetSurfaceAttribute; offscreenImages[0].max_width = 1024; offscreenImages[0].max_height = 1024; - offscreenImages[0].num_attributes = (num == 1) ? 1 : 3; + offscreenImages[0].num_attributes = (num == 1) ? 1 : 4; offscreenImages[0].attributes = Attributes; if(num == 2) { @@ -1245,7 +1270,7 @@ offscreenImages[1].getAttribute = MGAGetSurfaceAttribute; offscreenImages[1].max_width = 1024; offscreenImages[1].max_height = 1024; - offscreenImages[1].num_attributes = 3; + offscreenImages[1].num_attributes = 4; offscreenImages[1].attributes = Attributes; } Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h:1.17 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h:1.17 Fri Nov 3 13:46:11 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h Mon Oct 1 09:44:07 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.h,v 1.17 2000/11/03 18:46:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h,v 1.19 2001/10/01 13:44:07 eich Exp $ */ /* * The original Precision Insight driver for @@ -52,6 +52,9 @@ #include "vbe.h" +/* Needed by the Shadow Framebuffer */ +#include "shadow.h" + /* Drivers that need to access the PCI config space directly need this */ #include "xf86Pci.h" @@ -107,7 +110,7 @@ extern Bool neo_I2CInit(ScrnInfoPtr pScrn); /* in neo_shadow.c */ -void neoShadowUpdate (ScreenPtr pScreen, PixmapPtr pShadow, RegionPtr damage); +void neoShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf); void neoPointerMoved(int index, int x, int y); void neoRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void neoRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); @@ -233,6 +236,7 @@ Bool progLcdStretch; Bool progLcdStretchOpt; Bool overrideValidate; + Bool strangeLockups; /* registers */ NeoRegRec NeoModeReg; NeoRegRec NeoSavedReg; Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c:1.4 Mon Sep 25 19:57:08 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c Mon Oct 1 09:44:07 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_2090.c,v 1.4 2000/09/25 23:57:08 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c,v 1.5 2001/10/01 13:44:07 eich Exp $ */ /* * The original Precision Insight driver for @@ -132,7 +132,7 @@ infoPtr->SubsequentSolidFillRect = Neo2090SubsequentSolidFillRect; - if (nPtr->NeoChipset == PCI_CHIP_NM2093) { + if (nPtr->NeoChipset == PCI_CHIP_NM2093 && !nPtr->strangeLockups) { /* * We do CPUToScreenColorExpand (ab)using the Scanline functions: * the neo chipsets need byte padding however we can only do dword Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c:1.7 Fri Oct 6 08:31:02 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c Mon Oct 1 09:44:07 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_2097.c,v 1.7 2000/10/06 12:31:02 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c,v 1.8 2001/10/01 13:44:07 eich Exp $ */ /* * The original Precision Insight driver for @@ -154,30 +154,32 @@ infoPtr->SubsequentSolidFillRect = Neo2097SubsequentSolidFillRect; - /* cpu to screen color expansion */ - /* - * We do CPUToScreenColorExpand (ab)using the Scanline functions: - * the neo chipsets need byte padding however we can only do dword - * padding. Fortunately the graphics engine doesn't choke if we - * transfer up to 3 bytes more than it wants. - */ - infoPtr->ScanlineColorExpandBuffers = - (unsigned char **)xnfalloc(sizeof(char*)); - infoPtr->ScanlineColorExpandBuffers[0] = (unsigned char *)(nPtr->NeoMMIOBase + 0x100000); - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK | + if (!nPtr->strangeLockups) { + /* cpu to screen color expansion */ + /* + * We do CPUToScreenColorExpand (ab)using the Scanline functions: + * the neo chipsets need byte padding however we can only do dword + * padding. Fortunately the graphics engine doesn't choke if we + * transfer up to 3 bytes more than it wants. + */ + infoPtr->ScanlineColorExpandBuffers = + (unsigned char **)xnfalloc(sizeof(char*)); + infoPtr->ScanlineColorExpandBuffers[0] = (unsigned char *)(nPtr->NeoMMIOBase + 0x100000); + infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK | #ifdef NEO_DO_CLIPPING - LEFT_EDGE_CLIPPING | + LEFT_EDGE_CLIPPING | #endif - CPU_TRANSFER_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST ); - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - Neo2097SetupScanlineForCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - Neo2097SubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - Neo2097SubsequentColorExpandScanline; - + CPU_TRANSFER_PAD_DWORD | + BIT_ORDER_IN_BYTE_MSBFIRST ); + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + Neo2097SetupScanlineForCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + Neo2097SubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = + Neo2097SubsequentColorExpandScanline; + } + #if 0 /* 8x8 pattern fills */ infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK @@ -190,22 +192,24 @@ Neo2097SubsequentMono8x8PatternFill; #endif - /* image writes */ - infoPtr->ScanlineImageWriteFlags = CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - NO_TRANSPARENCY | - NO_PLANEMASK; - - infoPtr->SetupForScanlineImageWrite = - Neo2097SetupForScanlineImageWrite; - infoPtr->SubsequentScanlineImageWriteRect = - Neo2097SubsequentScanlineImageWriteRect; - infoPtr->SubsequentImageWriteScanline = - Neo2097SubsequentImageWriteScanline; - infoPtr->NumScanlineImageWriteBuffers = 1; - infoPtr->ScanlineImageWriteBuffers = infoPtr->ScanlineColorExpandBuffers; - - + if (nPtr->strangeLockups) { + /* image writes */ + infoPtr->ScanlineImageWriteFlags = ( CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + NO_TRANSPARENCY | + NO_PLANEMASK ); + + infoPtr->SetupForScanlineImageWrite = + Neo2097SetupForScanlineImageWrite; + infoPtr->SubsequentScanlineImageWriteRect = + Neo2097SubsequentScanlineImageWriteRect; + infoPtr->SubsequentImageWriteScanline = + Neo2097SubsequentImageWriteScanline; + infoPtr->NumScanlineImageWriteBuffers = 1; + infoPtr->ScanlineImageWriteBuffers = + infoPtr->ScanlineColorExpandBuffers; + } + /* * Setup some global variables */ Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.13 Mon Jan 22 15:12:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c Sat Oct 27 23:33:42 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.13 2001/01/22 20:12:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c,v 1.15 2001/10/28 03:33:42 tsi Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. @@ -54,12 +54,15 @@ int ydir, int rop, unsigned int planemask, int trans_color); +#ifdef NOT_BROKEN static void Neo2200SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h); +#else static void Neo2200SubsequentScreenToScreenCopyBroken(ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h); +#endif static void Neo2200SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void Neo2200SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, @@ -139,7 +142,11 @@ infoPtr->SetupForScreenToScreenCopy = Neo2200SetupForScreenToScreenCopy; infoPtr->SubsequentScreenToScreenCopy +#ifdef NOT_BROKEN + = Neo2200SubsequentScreenToScreenCopy; +#else = Neo2200SubsequentScreenToScreenCopyBroken; +#endif /* solid filled rectangles */ infoPtr->SolidFillFlags = NO_PLANEMASK; @@ -155,27 +162,29 @@ * padding. Fortunately the graphics engine doesn't choke if we * transfer up to 3 bytes more than it wants. */ - - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK | + if (!nPtr->strangeLockups) { + + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK | #ifdef NEO_DO_CLIPPING - LEFT_EDGE_CLIPPING | + LEFT_EDGE_CLIPPING | #endif - SCANLINE_PAD_DWORD | - CPU_TRANSFER_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST ); - infoPtr->ScanlineColorExpandBuffers = - (unsigned char **)xnfalloc(sizeof(char*)); - infoPtr->ScanlineColorExpandBuffers[0] = - (unsigned char *)(nPtr->NeoMMIOBase + 0x100000); - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - Neo2200SetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - Neo2200SubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - Neo2200SubsequentColorExpandScanline; - + SCANLINE_PAD_DWORD | + CPU_TRANSFER_PAD_DWORD | + BIT_ORDER_IN_BYTE_MSBFIRST ); + infoPtr->ScanlineColorExpandBuffers = + (unsigned char **)xnfalloc(sizeof(char*)); + infoPtr->ScanlineColorExpandBuffers[0] = + (unsigned char *)(nPtr->NeoMMIOBase + 0x100000); + infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + Neo2200SetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + Neo2200SubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = + Neo2200SubsequentColorExpandScanline; + } + #if 0 /* 8x8 pattern fills */ infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK @@ -277,7 +286,6 @@ NEOACLPtr nAcl = NEOACLPTR(pScrn); nAcl->tmpBltCntlFlags = (NEO_BC3_SKIP_MAPPING | neo2200Rop[rop]); - /* set blt control */ WAIT_ENGINE_IDLE(); /*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/ @@ -287,6 +295,7 @@ | (nAcl->Pitch & 0xffff)); } +#ifdef NOT_BROKEN static void Neo2200SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, int srcY, @@ -327,6 +336,8 @@ } } +#else /* NOT_BROKEN */ + static void Neo2200SubsequentScreenToScreenCopyBroken(ScrnInfoPtr pScrn, int srcX, int srcY, @@ -337,26 +348,39 @@ NEOACLPtr nAcl = NEOACLPTR(pScrn); if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { - if ((((dstX < 64) && ((srcX + w) == pScrn->displayWidth)) || + if ((((dstX < 64) && ((srcX + w + 64) >= pScrn->displayWidth)) || ((dstX == 0) && (w > (pScrn->displayWidth - 64)))) && (w > 64)) { +#define COPY_64 \ + OUTREG(NEOREG_SRCSTARTOFF,\ + (srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth));\ + OUTREG(NEOREG_DSTSTARTOFF,\ + (dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth));\ + OUTREG(NEOREG_XYEXT, (h<<16) | (64)); +#define COPY_W \ + OUTREG(NEOREG_SRCSTARTOFF,\ + (srcY * nAcl->Pitch) + (srcX1 * nAcl->PixelWidth));\ + OUTREG(NEOREG_DSTSTARTOFF,\ + (dstY * nAcl->Pitch) + (dstX1 * nAcl->PixelWidth));\ + OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); + int srcX1 = srcX + 64; int dstX1 = dstX + 64; w -= 64; /* start with upper left corner */ WAIT_ENGINE_IDLE(); OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEOREG_SRCSTARTOFF, - (srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth)); - OUTREG(NEOREG_DSTSTARTOFF, - (dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth)); - OUTREG(NEOREG_XYEXT, (h<<16) | (64)); - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_SRCSTARTOFF, - (srcY * nAcl->Pitch) + (srcX1 * nAcl->PixelWidth)); - OUTREG(NEOREG_DSTSTARTOFF, - (dstY * nAcl->Pitch) + (dstX1 * nAcl->PixelWidth)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); + if (srcX < dstX) { + COPY_W; + WAIT_ENGINE_IDLE(); + COPY_64; + } else { + COPY_64; + WAIT_ENGINE_IDLE(); + COPY_W; + } +#undef COPY_W +#undef COPY_64 } else { /* start with upper left corner */ WAIT_ENGINE_IDLE(); @@ -369,36 +393,47 @@ } } else { if (((((dstX + w) > (pScrn->displayWidth - 64)) && (srcX == 0)) - || (((dstX + w) == pScrn->displayWidth) + || (((dstX + w + 64) >= pScrn->displayWidth) && (w > (pScrn->displayWidth - 64)))) && (w > 64)) { +#define COPY_64 \ + OUTREG(NEOREG_SRCSTARTOFF, \ + ((srcY+h-1) * nAcl->Pitch) + ((srcX1+64-1) \ + * nAcl->PixelWidth)); \ + OUTREG(NEOREG_DSTSTARTOFF, \ + ((dstY+h-1) * nAcl->Pitch) + ((dstX1+64-1) \ + * nAcl->PixelWidth)); \ + OUTREG(NEOREG_XYEXT, (h<<16) | (64 & 0xffff)); +#define COPY_W \ + OUTREG(NEOREG_SRCSTARTOFF, \ + ((srcY+h-1) * nAcl->Pitch) + ((srcX + w -1) \ + * nAcl->PixelWidth)); \ + OUTREG(NEOREG_DSTSTARTOFF, \ + ((dstY+h-1) * nAcl->Pitch) + ((dstX + w -1) \ + * nAcl->PixelWidth)); \ + OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); + int srcX1, dstX1; w -= 64; srcX1 = srcX + w; dstX1 = dstX + w; /* start with lower right corner */ -#if 1 WAIT_ENGINE_IDLE(); OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags | NEO_BC0_X_DEC | NEO_BC0_DST_Y_DEC | NEO_BC0_SRC_Y_DEC)); - OUTREG(NEOREG_SRCSTARTOFF, - ((srcY+h-1) * nAcl->Pitch) + ((srcX1+64-1) - * nAcl->PixelWidth)); - OUTREG(NEOREG_DSTSTARTOFF, - ((dstY+h-1) * nAcl->Pitch) + ((dstX1+64-1) - * nAcl->PixelWidth)); - OUTREG(NEOREG_XYEXT, (h<<16) | (64 & 0xffff)); -#endif - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_SRCSTARTOFF, - ((srcY+h-1) * nAcl->Pitch) + ((srcX + w -1) - * nAcl->PixelWidth)); - OUTREG(NEOREG_DSTSTARTOFF, - ((dstY+h-1) * nAcl->Pitch) + ((dstX + w -1) - * nAcl->PixelWidth)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); + if (srcX < dstX) { + COPY_64; + WAIT_ENGINE_IDLE(); + COPY_W; + } else { + COPY_W; + WAIT_ENGINE_IDLE(); + COPY_64; + } +#undef COPY_W +#undef COPY_64 } else { /* start with lower right corner */ WAIT_ENGINE_IDLE(); @@ -417,6 +452,7 @@ } } +#endif /* NOT_BROKEN */ static void Neo2200SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, @@ -505,6 +541,7 @@ { NEOPtr nPtr = NEOPTR(pScrn); NEOACLPtr nAcl = NEOACLPTR(pScrn); + #ifdef NEO_DO_CLIPPING w = (w + 31) & ~31; #else Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c:1.7 Fri Nov 3 13:46:11 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c Sat Oct 27 23:33:42 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_cursor.c,v 1.7 2000/11/03 18:46:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_cursor.c,v 1.8 2001/10/28 03:33:42 tsi Exp $ */ /* * The original Precision Insight driver for @@ -243,7 +243,6 @@ neoUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) { NEOACLPtr nAcl = NEOACLPTR(xf86Screens[pScr->myNum]); - NEOPtr nPtr = NEOPTR(xf86Screens[pScr->myNum]); return(nAcl->UseHWCursor && !nAcl->NoCursorMode); } Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c:1.3 Tue Oct 17 17:36:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c Mon Oct 1 09:44:07 2001 @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c,v 1.3 2000/10/17 21:36:15 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c,v 1.4 2001/10/01 13:44:07 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -76,7 +76,7 @@ imlines = (pScrn->videoRam * 1024) / (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); - pixlines = (imlines > 1024) ? 1024 : imlines; + pixlines = (imlines > 1024 && !pNEO->noAccel) ? 1024 : imlines; pMode = firstMode = pScrn->modes; @@ -95,7 +95,8 @@ currentMode->mode = pMode; currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if (!pNEO->noAccel) + currentMode->flags |= (DGA_FILL_RECT | DGA_BLIT_RECT); if(pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if(pMode->Flags & V_INTERLACE) Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.52 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.59 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.52 Tue May 15 06:19:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c Fri Nov 30 07:11:57 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.52 2001/05/15 10:19:39 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.59 2001/11/30 12:11:57 eich Exp $ */ /* * The original Precision Insight driver for @@ -77,9 +77,6 @@ /* Needed by Resources Access Control (RAC) */ #include "xf86RAC.h" -/* Needed by the Shadow Framebuffer */ -#include "shadow.h" - /* int10 */ #include "xf86int10.h" #include "vbe.h" @@ -128,7 +125,7 @@ static Bool neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void neoSave(ScrnInfoPtr pScrn); static void neoRestore(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, - NeoRegPtr NeoReg, Bool restoreFonts); + NeoRegPtr NeoReg, Bool restoreText); static void neoLock(ScrnInfoPtr pScrn); static void neoUnlock(ScrnInfoPtr pScrn); static Bool neoMapMem(ScrnInfoPtr pScrn); @@ -166,14 +163,14 @@ { 640, 400, 0x20 }, { 640, 480, 0x21 }, { 800, 600, 0x23 }, - { 1024, 768, 0x25 }, + { 1024, 768, 0x25 } }; static biosMode bios15[] = { { 320, 200, 0x2D }, { 640, 480, 0x30 }, { 800, 600, 0x33 }, - { 1024, 768, 0x36 }, + { 1024, 768, 0x36 } }; static biosMode bios16[] = { @@ -182,7 +179,7 @@ { 300, 400, 0x43 }, { 640, 480, 0x31 }, { 800, 600, 0x34 }, - { 1024, 768, 0x37 }, + { 1024, 768, 0x37 } }; static biosMode bios24[] = { @@ -191,6 +188,46 @@ { 1024, 768, 0x38 } }; +static DisplayModeRec neo800x480Mode = { + NULL, /* prev */ + NULL, /* next */ + "800x480", /* identifier of this mode */ + MODE_OK, /* mode status */ + M_T_BUILTIN, /* mode type */ + 35260, /* Clock frequency */ + 800, /* HDisplay */ + 856, /* HSyncStart */ + 1040, /* HSyncEnd */ + 1056, /* HTotal */ + 0, /* HSkew */ + 480, /* VDisplay */ + 480, /* VSyncStart */ + 486, /* VSyncEnd */ + 488, /* VTotal */ + 0, /* VScan */ + V_PHSYNC | V_PVSYNC, /* Flags */ + -1, /* ClockIndex */ + 35260, /* SynthClock */ + 800, /* CRTC HDisplay */ + 800, /* CRTC HBlankStart */ + 856, /* CRTC HSyncStart */ + 1040, /* CRTC HSyncEnd */ + 872, /* CRTC HBlankEnd */ + 1048, /* CRTC HTotal */ + 0, /* CRTC HSkew */ + 480, /* CRTC VDisplay */ + 480, /* CRTC VBlankStart */ + 480, /* CRTC VSyncStart */ + 486, /* CRTC VSyncEnd */ + 487, /* CRTC VBlankEnd */ + 488, /* CRTC VTotal */ + FALSE, /* CrtcHAdjusted */ + FALSE, /* CrtcVAdjusted */ + 0, /* PrivSize */ + NULL, /* Private */ + 0.0, /* HSync */ + 0.0 /* VRefresh */ +}; /* * This contains the functions needed by the server after loading the driver @@ -262,7 +299,9 @@ OPTION_PROG_LCD_MODE_REGS, OPTION_PROG_LCD_MODE_STRETCH, OPTION_OVERRIDE_VALIDATE_MODE, - OPTION_ROTATE + OPTION_ROTATE, + OPTION_DISPLAY_HEIGHT_480, + OPTION_STRANGE_LOCKUPS } NEOOpts; static const OptionInfoRec NEO_2070_Options[] = { @@ -297,6 +336,9 @@ { OPTION_LCD_STRETCH,"NoStretch", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PCI_BURST, "pciBurst", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_STRANGE_LOCKUPS, "StrangeLockups", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DISPLAY_HEIGHT_480, "DisplayHeight480", + OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PROG_LCD_MODE_REGS, "progLcdModeRegs", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PROG_LCD_MODE_STRETCH, "progLcdModeStretch", @@ -316,49 +358,53 @@ */ static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", + "vgaHWSetStdFuncs", + "vgaHWUnlock", + "vgaHWddc1SetSpeed", NULL }; static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *shadowSymbols[] = { "shadowInit", -#if 0 - "ShadowFBInit", -#endif NULL }; static const char *ddcSymbols[] = { - "xf86PrintEDID", "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; @@ -612,9 +658,10 @@ int linearSize = 1024; int maxWidth = 1024; int maxHeight = 1024; - unsigned char type, display; + unsigned char type, dpy; int w; int apertureSize; + Bool height_480 = FALSE; char *s; if (flags & PROBE_DETECT) { @@ -707,7 +754,7 @@ /* Determine the panel type */ VGAwGR(0x09,0x26); type = VGArGR(0x21); - display = VGArGR(0x20); + dpy = VGArGR(0x20); /* Determine panel width -- used in NeoValidMode. */ w = VGArGR(0x20); @@ -743,12 +790,14 @@ nPtr->NeoPanelHeight = 480; break; } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Panel is a %dx%d %s %s display\n", nPtr->NeoPanelWidth, nPtr->NeoPanelHeight, (type & 0x02) ? "color" : "monochrome", (type & 0x10) ? "TFT" : "dual scan"); + switch (nPtr->NeoChipset){ case NM2070: bppSupport = NoDepth24Support; @@ -904,6 +953,8 @@ return FALSE; } + nPtr->strangeLockups = TRUE; + /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ @@ -937,6 +988,10 @@ nPtr->progLcdStretchOpt = TRUE; xf86GetOptValBool(nPtr->Options, OPTION_OVERRIDE_VALIDATE_MODE, &nPtr->overrideValidate); + xf86GetOptValBool(nPtr->Options, OPTION_DISPLAY_HEIGHT_480,&height_480); + xf86GetOptValBool(nPtr->Options, OPTION_STRANGE_LOCKUPS, + &nPtr->strangeLockups); + nPtr->rotate = 0; if ((s = xf86GetOptValString(nPtr->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { @@ -960,6 +1015,12 @@ } } + if (height_480 && nPtr->NeoPanelWidth == 800) { + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, + "Overriding Panel height: Set to 480\n"); + nPtr->NeoPanelHeight = 480; + } + if (nPtr->internDisp && nPtr->externDisp) xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, "Simultaneous LCD/CRT display mode\n"); @@ -970,8 +1031,8 @@ xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, "Internal LCD only display mode\n"); else { - nPtr->internDisp = ((display & 0x02) == 0x02); - nPtr->externDisp = ((display & 0x01) == 0x01); + nPtr->internDisp = ((dpy & 0x02) == 0x02); + nPtr->externDisp = ((dpy & 0x01) == 0x01); if (nPtr->internDisp && nPtr->externDisp) xf86DrvMsg(pScrn->scrnIndex,X_PROBED, "Simultaneous LCD/CRT display mode\n"); @@ -1005,6 +1066,9 @@ xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, "MMIO mode disabled\n"); if (nPtr->onPciBurst) xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, "using PCI Burst mode\n"); + if (nPtr->strangeLockups) + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, + "Option StrangeLockups set: disabling some acceleration\n"); if (nPtr->shadowFB) { if (nPtr->noLinear) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -1077,7 +1141,7 @@ } else if (nPtr->pEnt->location.type == BUS_ISA) { unsigned int addr; - resRange linearRes[] = { {ResExcMemBlock|ResBios,0,0},_END }; + resRange linearRes[] = { {ResExcMemBlock|ResBios|ResBus,0,0},_END }; if (!nPtr->NeoLinearAddr) { VGAwGR(0x09,0x26); @@ -1144,6 +1208,11 @@ else nPtr->NeoCursorMem = 0; apertureSize = (pScrn->videoRam * 1024) - nPtr->NeoCursorMem; + + if ((nPtr->NeoPanelWidth == 800) && (nPtr->NeoPanelHeight == 480)) { + neo800x480Mode.next = pScrn->monitor->Modes; + pScrn->monitor->Modes = &neo800x480Mode; +} /* * For external displays, limit the width to 1024 pixels or less. */ @@ -1190,7 +1259,7 @@ RETURN; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); if (!nPtr->noLinear) { if (!xf86LoadSubModule(pScrn, "xaa")) @@ -1210,7 +1279,6 @@ RETURN; xf86LoaderReqSymLists(ramdacSymbols, NULL); } - return TRUE; } #undef RETURN @@ -1228,6 +1296,7 @@ if (nPtr->NeoHWCursorShown) NeoShowCursor(pScrn); NEOAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + return TRUE; } @@ -1237,7 +1306,7 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; NEOPtr nPtr = NEOPTR(pScrn); - + /* Invalidate the cached acceleration registers */ if (nPtr->NeoHWCursorShown) NeoHideCursor(pScrn); @@ -1370,8 +1439,6 @@ if (!ret) return FALSE; - fbPictureInit(pScreen, 0, 0); - if (pScrn->depth > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; @@ -1387,6 +1454,9 @@ } } + /* must be after RGB ordering fixed */ + fbPictureInit(pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); if (!nPtr->shadowFB) @@ -1728,8 +1798,10 @@ return(MODE_OK); break; case 800 : - if (mode->VDisplay == 600) + if (mode->VDisplay == 600) return(MODE_OK); + if ((mode->VDisplay == 480) && (nPtr->NeoPanelHeight == 480)) + return(MODE_OK); break; case 640 : if (mode->VDisplay == 480) @@ -1972,7 +2044,7 @@ } if (noProgramShadowRegs) { - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Not programming shadow registers\n"); + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,"Not programming shadow registers\n"); if (nPtr->NeoSavedReg.reg){ for (i = 0x40; i <= 0x59; i++) { VGAwCR(i, nPtr->NeoSavedReg.reg->CR[i]); @@ -2007,33 +2079,67 @@ VGAwCR(0x4F,0xA0); break; case 800 : - VGAwCR(0x40,0x7F); - VGAwCR(0x41,0x63); - VGAwCR(0x42,0x02); - VGAwCR(0x43,0x6C); - VGAwCR(0x44,0x1C); - VGAwCR(0x45,0x72); - VGAwCR(0x46,0xE0); - VGAwCR(0x47,0x58); - VGAwCR(0x48,0x0C); - VGAwCR(0x49,0x57); - VGAwCR(0x4A,0x73); - VGAwCR(0x4B,0x3D); - VGAwCR(0x4C,0x31); - VGAwCR(0x4D,0x01); - VGAwCR(0x4E,0x36); - VGAwCR(0x4F,0x1E); - if (nPtr->NeoChipset != NM2070) { - VGAwCR(0x50,0x6B); - VGAwCR(0x51,0x4F); - VGAwCR(0x52,0x0E); - VGAwCR(0x53,0x58); - VGAwCR(0x54,0x88); - VGAwCR(0x55,0x33); - VGAwCR(0x56,0x27); - VGAwCR(0x57,0x16); - VGAwCR(0x58,0x2C); - VGAwCR(0x59,0x94); + switch (nPtr->NeoPanelHeight) { + case 600: + VGAwCR(0x40,0x7F); + VGAwCR(0x41,0x63); + VGAwCR(0x42,0x02); + VGAwCR(0x43,0x6C); + VGAwCR(0x44,0x1C); + VGAwCR(0x45,0x72); + VGAwCR(0x46,0xE0); + VGAwCR(0x47,0x58); + VGAwCR(0x48,0x0C); + VGAwCR(0x49,0x57); + VGAwCR(0x4A,0x73); + VGAwCR(0x4B,0x3D); + VGAwCR(0x4C,0x31); + VGAwCR(0x4D,0x01); + VGAwCR(0x4E,0x36); + VGAwCR(0x4F,0x1E); + if (nPtr->NeoChipset != NM2070) { + VGAwCR(0x50,0x6B); + VGAwCR(0x51,0x4F); + VGAwCR(0x52,0x0E); + VGAwCR(0x53,0x58); + VGAwCR(0x54,0x88); + VGAwCR(0x55,0x33); + VGAwCR(0x56,0x27); + VGAwCR(0x57,0x16); + VGAwCR(0x58,0x2C); + VGAwCR(0x59,0x94); + } + break; + case 480: + VGAwCR(0x40,0x7F); + VGAwCR(0x41,0x63); + VGAwCR(0x42,0x02); + VGAwCR(0x43,0x6B); + VGAwCR(0x44,0x1B); + VGAwCR(0x45,0x72); + VGAwCR(0x46,0xE0); + VGAwCR(0x47,0x1C); + VGAwCR(0x48,0x00); + VGAwCR(0x49,0x57); + VGAwCR(0x4A,0x73); + VGAwCR(0x4B,0x3E); + VGAwCR(0x4C,0x31); + VGAwCR(0x4D,0x01); + VGAwCR(0x4E,0x36); + VGAwCR(0x4F,0x1E); + VGAwCR(0x50,0x6B); + VGAwCR(0x51,0x4F); + VGAwCR(0x52,0x0E); + VGAwCR(0x53,0x57); + VGAwCR(0x54,0x87); + VGAwCR(0x55,0x33); + VGAwCR(0x56,0x27); + VGAwCR(0x57,0x16); + VGAwCR(0x58,0x2C); + VGAwCR(0x59,0x94); + break; + break; + /* Not done */ } break; case 1024 : @@ -2087,7 +2193,7 @@ static void neoRestore(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, NeoRegPtr restore, - Bool restoreFonts) + Bool restoreText) { NEOPtr nPtr = NEOPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -2154,8 +2260,8 @@ /* * This function handles restoring the generic VGA registers. */ vgaHWRestore(pScrn, VgaReg, - VGA_SR_MODE | VGA_SR_CMAP - | (restoreFonts ? VGA_SR_FONTS : 0)); + VGA_SR_MODE + | (restoreText ? (VGA_SR_FONTS | VGA_SR_CMAP) : 0)); VGAwGR(0x0E, restore->ExtCRTDispAddr); VGAwGR(0x0F, restore->ExtCRTOffset); @@ -2505,7 +2611,15 @@ break; case 800 : NeoNew->PanelHorizCenterReg2 = hoffset; - NeoNew->PanelVertCenterReg4 = voffset; + switch (mode->VDisplay) { + case 600: + NeoNew->PanelVertCenterReg4 = voffset; + break; + case 480: + /* Not sure if this is correct */ + NeoNew->PanelVertCenterReg3 = voffset; + break; + } break; case 1024 : NeoNew->PanelHorizCenterReg5 = hoffset; @@ -2744,6 +2858,7 @@ VGAwGR(0x09,0x26); if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); if ((pVbe = VBEInit(NULL,nPtr->pEnt->index))) { ret = xf86SetDDCproperties( pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_shadow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_shadow.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_shadow.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_shadow.c:1.2 Fri Nov 3 13:46:11 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_shadow.c Wed Jun 13 22:23:49 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_shadow.c,v 1.2 2000/11/03 18:46:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_shadow.c,v 1.3 2001/06/14 02:23:49 keithp Exp $ */ /* Copyright (c) 1999, 2000 The XFree86 Project Inc. @@ -16,8 +16,9 @@ #include "neo.h" void -neoShadowUpdate (ScreenPtr pScreen, PixmapPtr pShadow, RegionPtr damage) +neoShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf) { + RegionPtr damage = &pBuf->damage; ScrnInfoPtr pScrn; pScrn = xf86Screens[pScreen->myNum]; Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man:1.2 Sat Jan 27 13:20:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man Mon Dec 17 15:52:32 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man,v 1.2 2001/01/27 18:20:51 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man,v 1.3 2001/12/17 20:52:32 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH NEOMAGIC __drivermansuffix__ __vendorversion__ @@ -71,8 +71,7 @@ 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. +Enable or disable use of the shadow framebuffer layer. Default: off. .PP .B Note .br Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.3 Fri May 4 15:05:42 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h Wed Dec 19 16:31:21 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.3 2001/05/04 19:05:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h,v 1.8 2001/12/19 21:31:21 dawes Exp $ */ #ifndef __NEWPORT_H__ #define __NEWPORT_H__ @@ -12,6 +12,7 @@ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" +#include "compiler.h" #include "xf86Resources.h" #include "xf86cmap.h" @@ -27,6 +28,20 @@ #define NEWPORT_BASE_OFFSET 0x0040000 #define NEWPORT_MAX_BOARDS 4 +#if 0 +# define DEBUG 1 +#endif + +#ifdef DEBUG +# define TRACE_ENTER(str) ErrorF("newport: " str " %d\n",pScrn->scrnIndex) +# define TRACE_EXIT(str) ErrorF("newport: " str " done\n") +# define TRACE(str) ErrorF("newport trace: " str "\n") +#else +# define TRACE_ENTER(str) +# define TRACE_EXIT(str) +# define TRACE(str) +#endif + typedef struct { unsigned busID; int bitplanes; @@ -44,11 +59,20 @@ CloseScreenProcPtr CloseScreen; /* newport register backups: */ + npireg_t txt_drawmode0; /* Rex3 drawmode0 register */ npireg_t txt_drawmode1; /* Rex3 drawmode1 register */ + npireg_t txt_wrmask; /* Rex3 write mask register */ + npireg_t txt_smask1x; /* Rex3 screen mask 1 registers */ + npireg_t txt_smask1y; + npireg_t txt_smask2x; /* Rex3 screen mask 2 registers */ + npireg_t txt_smask2y; + npireg_t txt_clipmode; /* Rex3 clip mode register */ + unsigned short txt_vc2ctrl; /* VC2 control register */ - CARD8 txt_xmap9_cfg0; /* 0. Xmap9's control register */ - CARD8 txt_xmap9_cfg1; /* 1. Xmap9's control register */ - CARD8 txt_xmap9_mi; /* Xmap9's mode index register */ + CARD8 txt_xmap9_cfg0; /* 0. Xmap9's control register */ + CARD8 txt_xmap9_cfg1; /* 1. Xmap9's control register */ + CARD8 txt_xmap9_mi; /* Xmap9s' mode index register */ + CARD32 txt_xmap9_mod0; /* Xmap9s' mode 0 register */ LOCO txt_colormap[256]; OptionInfoPtr Options; } NewportRec, *NewportPtr; @@ -62,6 +86,11 @@ void NewportWait(NewportRegsPtr pNewportRegs); void NewportBfwait(NewportRegsPtr pNewportRegs); void NewportXmap9SetModeRegister(NewportRegsPtr pNewportRegs, CARD8 address, CARD32 mode); +CARD32 NewportXmap9GetModeRegister(NewportRegsPtr pNewportRegs, unsigned chip, CARD8 address); +void NewportBackupRex3( ScrnInfoPtr pScrn); +void NewportRestoreRex3( ScrnInfoPtr pScrn); +void NewportBackupXmap9s( ScrnInfoPtr pScrn); +void NewportRestoreXmap9s( ScrnInfoPtr pScrn); /* newort_cmap.c */ void NewportLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, @@ -71,5 +100,6 @@ /* newport_shadow.c */ void NewportRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void NewportRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); #endif /* __NEWPORT_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man:1.2 Sat Jan 27 13:20:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man Fri Nov 23 14:50:45 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man,v 1.2 2001/01/27 18:20:51 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man,v 1.3 2001/11/23 19:50:45 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH NEWPORT __drivermansuffix__ __vendorversion__ @@ -19,7 +19,8 @@ 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. +does not support the XZ boards. It supports both the 8bit and 24bit versions +of the Newport. .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this @@ -37,4 +38,4 @@ XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS Authors: -Guido Guenther \fIguido.guenther@gmx.net\fP +Guido GÜnther \fIagx@sigxcpu.org\fP Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c:1.1 Fri Dec 1 14:47:59 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c Fri Nov 23 14:50:45 2001 @@ -1,7 +1,7 @@ /* * Id: newport_cmap.c,v 1.1 2000/11/29 20:58:10 agx Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c,v 1.1 2000/12/01 19:47:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_cmap.c,v 1.2 2001/11/23 19:50:45 dawes Exp $ */ #include "newport.h" @@ -66,11 +66,11 @@ npireg_t tmp; NewportBfwait(pNewportRegs); - pNewportRegs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | + pNewportRegs->set.dcbmode = (NPORT_DMODE_ACM0 | NCMAP_PROTOCOL | NPORT_DMODE_SENDIAN | NPORT_DMODE_ECINC | NCMAP_REGADDR_AREG | NPORT_DMODE_W2); pNewportRegs->set.dcbdata0.hwords.s1 = addr; - pNewportRegs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | + pNewportRegs->set.dcbmode = (NPORT_DMODE_ACM0 | NCMAP_PROTOCOL | NCMAP_REGADDR_PBUF | NPORT_DMODE_W3); tmp = pNewportRegs->set.dcbdata0.all; color->red = (tmp >> 24) & 0xff; Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.10 Wed May 16 02:48:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c Fri Jan 4 16:22:33 2002 @@ -5,7 +5,7 @@ * * This driver is based on the newport.c & newport_con.c kernel code * - * (c) 2000 Guido Guenther <guido.guenther@gmx.net> + * (c) 2000,2001 Guido Guenther <agx@sigxcpu.org> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,7 +30,7 @@ * Project. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.10 2001/05/16 06:48:09 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.19 2002/01/04 21:22:33 tsi Exp $ */ /* function prototypes, common data structures & generic includes */ #include "newport.h" @@ -53,11 +53,11 @@ #include "Xv.h" #define VERSION 4000 -#define NEWPORT_NAME "Newport" +#define NEWPORT_NAME "NEWPORT" #define NEWPORT_DRIVER_NAME "newport" #define NEWPORT_MAJOR_VERSION 0 #define NEWPORT_MINOR_VERSION 1 -#define NEWPORT_PATCHLEVEL 1 +#define NEWPORT_PATCHLEVEL 3 /* Prototypes ------------------------------------------------------- */ @@ -101,10 +101,8 @@ /* List of Symbols from other modules that this module references */ static const char *fbSymbols[] = { - "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif + "fbScreenInit", NULL }; @@ -298,6 +296,7 @@ switch( pScrn->depth ) { /* check if the returned depth is one we support */ case 8: + case 24: /* OK */ break; default: @@ -345,7 +344,7 @@ pNewport = NEWPORTPTR(pScrn); pNewport->busID = busID; - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Fill in pScrn->options) */ @@ -366,7 +365,7 @@ from=X_PROBED; xf86DrvMsg(pScrn->scrnIndex, from, - "Newport Graphics Revisions: Board: %d, Rex3: %d, Cmap: %c, Xmap9: %d\n", + "Newport Graphics Revisions: Board: %d, Rex3: %c, Cmap: %c, Xmap9: %c\n", pNewport->board_rev, pNewport->rex3_rev, pNewport->cmap_rev, pNewport->xmap9_rev); @@ -388,7 +387,8 @@ } /* Set up clock ranges that are alway ok */ - /* XXX: Should use the correct data from the specs(which specs?) here */ + + /* XXX: Use information from VC2 here */ clockRanges = xnfalloc(sizeof(ClockRange)); clockRanges->next = NULL; clockRanges->minClock = 10000; @@ -491,10 +491,6 @@ if(!ret) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - /* we need rgb ordering if bitsPerPixel > 8 */ if (pScrn->bitsPerPixel > 8) { for (i = 0, visual = pScreen->visuals; @@ -510,6 +506,8 @@ } } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -530,7 +528,8 @@ return FALSE; /* Initialise shadow frame buffer */ - ShadowFBInit(pScreen, &NewportRefreshArea8); + ShadowFBInit(pScreen, (pNewport->Bpp == 1) ? &NewportRefreshArea8 : + &NewportRefreshArea24); #ifdef XvExtension { @@ -636,29 +635,76 @@ if (width != 1280 || height != 1024) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ "Width = %d and height = %d is not supported by by this driver\n", width, height); + return FALSE; } - pScrn->vtSema=TRUE; + pScrn->vtSema = TRUE; /* first backup the necessary registers... */ - pNewport->txt_drawmode1 = pNewportRegs->set.drawmode1; + NewportBackupRex3(pScrn); pNewport->txt_vc2ctrl = NewportVc2Get( pNewportRegs, VC2_IREG_CONTROL); NewportBackupPalette(pScrn); - + if( pNewport->Bpp == 3) { /* at 24bpp we have to backup some more registers */ + NewportBackupXmap9s( pScrn ); + } /* ...then setup the hardware */ - /* - * XXX: set the frambuffer layout to either 24 or 8 bpp here - more specs needed - * XXX: Lazy mode on: simply rely on the prom since it does such a good job - */ - if( pNewport->Bpp == 1) { - pNewport->drawmode1 = pNewport->txt_drawmode1; - } - + pNewport->drawmode1 = DM1_RGBPLANES | + NPORT_DMODE1_CCLT | + NPORT_DMODE1_CCEQ | + NPORT_DMODE1_CCGT | + NPORT_DMODE1_LOSRC; + if( pNewport->Bpp == 1) { /* 8bpp */ + pNewport->drawmode1 |= NPORT_DMODE1_DD8 | + NPORT_DMODE1_HD8 | + NPORT_DMODE1_RWPCKD; + } else { /* 24bpp */ + CARD32 mode = 0L; + + /* tell the xmap9s that we are using 24bpp */ + NewportBfwait(pNewport->pNewportRegs); + pNewportRegs->set.dcbmode = (DCB_XMAP_ALL | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_CONFIG | NPORT_DMODE_W1 ); + pNewportRegs->set.dcbdata0.bytes.b3 &= ~(XM9_8_BITPLANES | XM9_PUPMODE); + NewportBfwait(pNewport->pNewportRegs); + /* set up the mode register for 24bpp */ + mode = XM9_MREG_PIX_SIZE_24BPP | XM9_MREG_PIX_MODE_RGB1 + | XM9_MREG_GAMMA_BYPASS; + NewportXmap9SetModeRegister( pNewportRegs , 0, mode); + /* select the set up mode register */ + NewportBfwait(pNewport->pNewportRegs); + pNewportRegs->set.dcbmode = (DCB_XMAP_ALL | W_DCB_XMAP9_PROTOCOL | + XM9_CRS_MODE_REG_INDEX | NPORT_DMODE_W1 ); + pNewportRegs->set.dcbdata0.bytes.b3 = 0; + + pNewport->drawmode1 |= + /* set drawdepth to 24 bit */ + NPORT_DMODE1_DD24 | + /* turn on RGB mode */ + NPORT_DMODE1_RGBMD | + /* turn on 8888 = RGBA pixel packing */ + NPORT_DMODE1_HD32 | NPORT_DMODE1_RWPCKD; + } + /* blank the framebuffer */ + NewportWait(pNewportRegs); + pNewportRegs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_DOSETUP | + NPORT_DMODE0_STOPX | NPORT_DMODE0_STOPY | + NPORT_DMODE0_BLOCK); + pNewportRegs->set.drawmode1 = pNewport->drawmode1 | + NPORT_DMODE1_FCLR | + NPORT_DMODE1_RGBMD; + pNewportRegs->set.colorvram = 0; + pNewportRegs->set.xystarti = 0; + pNewportRegs->go.xyendi = ( (1279+64) << 16) | 1023; + + /* default drawmode */ + NewportWait(pNewportRegs); + pNewportRegs->set.drawmode1 = pNewport->drawmode1; + return TRUE; } /* - * This will acutally restore the saved state + * This will actually restore the saved state * (either when switching back to a VT or when the server is going down) * Closing is true if the X server is really going down */ @@ -669,9 +715,12 @@ NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; /* Restore backed up registers */ - pNewportRegs->set.drawmode1 = pNewport->txt_drawmode1; - NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, pNewport->txt_vc2ctrl); - NewportRestorePalette(pScrn); + NewportRestoreRex3( pScrn ); + NewportVc2Set( pNewportRegs, VC2_IREG_CONTROL, pNewport->txt_vc2ctrl ); + NewportRestorePalette( pScrn ); + if( pNewport->Bpp == 3) { + NewportRestoreXmap9s( pScrn); + } } @@ -683,14 +732,15 @@ FILE* cpuinfo; char line[80]; unsigned hasNewport = 0; - cpuinfo = fopen("/proc/cpuinfo","r"); - while(fgets(line,80,cpuinfo) != NULL) { - if(strstr(line, "SGI Indy") != NULL) { - hasNewport = 1; - break; + if ((cpuinfo = fopen("/proc/cpuinfo", "r"))) { + while(fgets(line, 80, cpuinfo) != NULL) { + if(strstr(line, "SGI Indy") != NULL) { + hasNewport = 1; + break; + } } + fclose(cpuinfo); } - fclose(cpuinfo); probedIDs[0] = 0; return hasNewport; @@ -711,12 +761,13 @@ pNewport->bitplanes = ((pNewport->board_rev > 1) && (tmp & 0x80)) ? 8 : 24; cmap_rev = tmp & 7; pNewport->cmap_rev = (char)('A'+(cmap_rev ? (cmap_rev+1):0)); - pNewport->rex3_rev = (pNewportRegs->cset.ustat) & 7; + pNewport->rex3_rev = (char)('A'+(pNewportRegs->cset.ustat & 7)); pNewportRegs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL | XM9_CRS_REVISION | NPORT_DMODE_W1); - pNewport->xmap9_rev = (pNewportRegs->set.dcbdata0.bytes.b3) & 7; + pNewport->xmap9_rev = (char)('A'+(pNewportRegs->set.dcbdata0.bytes.b3 & 7)); + /* XXX: read possible modes from VC2 here */ return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c:1.1 Fri Dec 1 14:48:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c Fri Dec 21 10:37:23 2001 @@ -1,7 +1,7 @@ /* * Id: newport_regs.c,v 1.3 2000/11/29 20:58:10 agx Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c,v 1.1 2000/12/01 19:48:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.c,v 1.6 2001/12/21 15:37:23 tsi Exp $ */ #include "newport.h" @@ -67,3 +67,110 @@ XM9_CRS_MODE_REG_DATA | NPORT_DMODE_W4 ); pNewportRegs->set.dcbdata0.all = (address << 24) | ( mode & 0xffffff ); } + +CARD32 +NewportXmap9GetModeRegister(NewportRegsPtr pNewportRegs, unsigned chip, CARD8 address) +{ + CARD32 dcbaddr, i, val, mode = 0; + CARD8 index = ( address << 2 ); + + if(chip) + dcbaddr = DCB_XMAP1; + else + dcbaddr = DCB_XMAP0; + + /* we have to read one byte at at time */ + for( i = 0; i < 4; i++ ) { + NewportXmap9FifoWait( pNewportRegs, dcbaddr); + + pNewportRegs->set.dcbmode = ( dcbaddr | W_DCB_XMAP9_PROTOCOL | + XM9_CRS_MODE_REG_INDEX | NPORT_DMODE_W1 ); + pNewportRegs->set.dcbdata0.bytes.b3 = (index | i); + pNewportRegs->set.dcbmode = ( dcbaddr | W_DCB_XMAP9_PROTOCOL | + XM9_CRS_MODE_REG_DATA | NPORT_DMODE_W1 ); + val = pNewportRegs->set.dcbdata0.bytes.b3; + mode |= (val << ( i * 8 ) ); + } + return mode; +} + +void +NewportBackupRex3( ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + pNewport->txt_drawmode0 = pNewportRegs->set.drawmode0; + pNewport->txt_drawmode1 = pNewportRegs->set.drawmode1; + pNewport->txt_wrmask = pNewportRegs->set.wrmask; + pNewport->txt_smask1x = pNewportRegs->cset.smask1x; + pNewport->txt_smask1y = pNewportRegs->cset.smask1y; + pNewport->txt_smask2x = pNewportRegs->cset.smask2x; + pNewport->txt_smask2y = pNewportRegs->cset.smask2y; + pNewport->txt_clipmode = pNewportRegs->cset.clipmode; +} + +void +NewportRestoreRex3( ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + pNewportRegs->set.drawmode0 = pNewport->txt_drawmode0; + pNewportRegs->set.drawmode1 = pNewport->txt_drawmode1; + pNewportRegs->set.wrmask = pNewport->txt_wrmask; + pNewportRegs->cset.smask1x = pNewport->txt_smask1x; + pNewportRegs->cset.smask1y = pNewport->txt_smask1y; + pNewportRegs->cset.smask2x = pNewport->txt_smask2x; + pNewportRegs->cset.smask2y = pNewport->txt_smask2y; + pNewportRegs->cset.clipmode = pNewport->txt_clipmode; +} + +void NewportBackupXmap9s( ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + NewportBfwait(pNewport->pNewportRegs); + /* config of xmap0 */ + pNewportRegs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_CONFIG | NPORT_DMODE_W1 ); + pNewport->txt_xmap9_cfg0 = pNewportRegs->set.dcbdata0.bytes.b3; + NewportBfwait(pNewport->pNewportRegs); + /* config of xmap1 */ + pNewportRegs->set.dcbmode = (DCB_XMAP1 | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_CONFIG | NPORT_DMODE_W1 ); + pNewport->txt_xmap9_cfg1 = pNewportRegs->set.dcbdata0.bytes.b3; + NewportBfwait(pNewport->pNewportRegs); + /* mode index register of xmap0 */ + pNewportRegs->set.dcbmode = (DCB_XMAP0 | R_DCB_XMAP9_PROTOCOL | + XM9_CRS_MODE_REG_INDEX | NPORT_DMODE_W1 ); + pNewport->txt_xmap9_mi = pNewportRegs->set.dcbdata0.bytes.b3; + /* mode register 0 of xmap 0 */ + pNewport->txt_xmap9_mod0 = NewportXmap9GetModeRegister(pNewportRegs, 0, 0); +} + +void NewportRestoreXmap9s( ScrnInfoPtr pScrn) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = NEWPORTREGSPTR(pScrn); + + /* mode register 0 */ + NewportXmap9SetModeRegister( pNewportRegs , 0, pNewport->txt_xmap9_mod0 ); + NewportBfwait(pNewport->pNewportRegs); + /* mode index register */ + pNewportRegs->set.dcbmode = (DCB_XMAP_ALL | W_DCB_XMAP9_PROTOCOL | + XM9_CRS_MODE_REG_INDEX | NPORT_DMODE_W1 ); + pNewportRegs->set.dcbdata0.bytes.b3 = pNewport->txt_xmap9_mi; + NewportBfwait(pNewport->pNewportRegs); + /* cfg xmap0 */ + pNewportRegs->set.dcbmode = (DCB_XMAP0 | W_DCB_XMAP9_PROTOCOL | + XM9_CRS_CONFIG | NPORT_DMODE_W1 ); + pNewportRegs->set.dcbdata0.bytes.b3 = pNewport->txt_xmap9_cfg0; + NewportBfwait(pNewport->pNewportRegs); + /* cfg xmap1 */ + pNewportRegs->set.dcbmode = (DCB_XMAP1 | W_DCB_XMAP9_PROTOCOL | + XM9_CRS_CONFIG | NPORT_DMODE_W1 ); + pNewportRegs->set.dcbdata0.bytes.b3 = pNewport->txt_xmap9_cfg1; +} + Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h:1.1 Fri Dec 1 14:48:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h Fri Nov 23 14:50:45 2001 @@ -4,7 +4,7 @@ * Register Layouts of the various newport chips * mostly as found in linux/include/asm/newport.h */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h,v 1.1 2000/12/01 19:48:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_regs.h,v 1.2 2001/11/23 19:50:45 dawes Exp $ */ typedef volatile unsigned long npireg_t; @@ -131,6 +131,8 @@ #define NPORT_DMODE0_YSTR 0x00800000 npireg_t lsmode; /* Mode for line stipple ops */ +#define NPORT_LSMODE_REPMASK 0x0000ff00 +#define NPORT_LSMODE_LENMASK 0x0f000000 npireg_t lspattern; /* Pattern for line stipple ops */ npireg_t lspatsave; /* Backup save pattern */ npireg_t zpattern; /* Pixel zpattern */ @@ -189,7 +191,7 @@ npireg_t hostrw0; npireg_t hostrw1; npireg_t dcbmode; -#define NPORT_DMODE_WMASK 0x00000003 +#define NPORT_DMODE_WMASK 0x00000003 /* dataWidth of data being transfered */ #define NPORT_DMODE_W4 0x00000000 #define NPORT_DMODE_W1 0x00000001 #define NPORT_DMODE_W2 0x00000002 @@ -235,6 +237,8 @@ npireg_t topscan; npireg_t xywin; npireg_t clipmode; +#define NPORT_SMASKXOFF 4096 +#define NPORT_SMASKYOFF 4096 #define NPORT_CMODE_SM0 0x00000001 #define NPORT_CMODE_SM1 0x00000002 #define NPORT_CMODE_SM2 0x00000004 @@ -331,12 +335,12 @@ /* Controlling the color map on Newport. */ #define NCMAP_REGADDR_AREG 0x00000000 -#define NCMAP_REGADDR_ALO 0x00000000 -#define NCMAP_REGADDR_AHI 0x00000010 -#define NCMAP_REGADDR_PBUF 0x00000020 -#define NCMAP_REGADDR_CREG 0x00000030 -#define NCMAP_REGADDR_SREG 0x00000040 -#define NCMAP_REGADDR_RREG 0x00000060 +#define NCMAP_REGADDR_ALO 0x00000000 /* address register low */ +#define NCMAP_REGADDR_AHI 0x00000010 /* address register high */ +#define NCMAP_REGADDR_PBUF 0x00000020 /* color palette buffer */ +#define NCMAP_REGADDR_CREG 0x00000030 /* command register */ +#define NCMAP_REGADDR_SREG 0x00000040 /* color buffer register */ +#define NCMAP_REGADDR_RREG 0x00000060 /* revision register */ #define NCMAP_PROTOCOL (0x00008000 | 0x00040000 | 0x00800000) /* Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c:1.1 Fri Dec 1 14:48:02 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c Fri Nov 23 14:50:45 2001 @@ -1,7 +1,7 @@ /* * Id: newport_shadow.c,v 1.3 2000/11/29 20:58:10 agx Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c,v 1.1 2000/12/01 19:48:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_shadow.c,v 1.2 2001/11/23 19:50:45 dawes Exp $ */ #include "newport.h" @@ -15,13 +15,13 @@ #define RA8_PIXELS 4 /* burst 4 pixels each time */ #define RA8_PIXEL_SHIFT 2 /* 4 Pixels on each burst */ -#define RA8_MASK 0xffc /* move to 4Byte boundary */ +#define RA8_MASK 0xffc /* move to 4 byte boundary */ + TRACE_ENTER("NewportRefreshArea8"); NewportWait(pNewportRegs); - pNewportRegs->set.drawmode1 = pNewport->drawmode1 | (NPORT_DMODE1_RWPCKD | \ - (NPORT_DMODE1_HDMASK & NPORT_DMODE1_HD8)); - pNewportRegs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | \ - NPORT_DMODE0_CHOST); + pNewportRegs->set.drawmode0 = (NPORT_DMODE0_DRAW | + NPORT_DMODE0_BLOCK | + NPORT_DMODE0_CHOST); while(num--) { NewportWait(pNewportRegs); x = pbox->x1 & RA8_MASK; /* move x to 4 byte boundary */ @@ -43,5 +43,42 @@ } pbox++; } + TRACE_EXIT("NewportRefreshArea8"); } +void +NewportRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + NewportPtr pNewport = NEWPORTPTR(pScrn); + NewportRegsPtr pNewportRegs = pNewport->pNewportRegs; + int dx, dy; + CARD8 *src, *base; + CARD32 dest; + + TRACE_ENTER("NewportRefreshArea24"); + NewportWait(pNewportRegs); + + /* block transfers */ + pNewportRegs->set.drawmode0 = (NPORT_DMODE0_DRAW | + NPORT_DMODE0_BLOCK | + NPORT_DMODE0_CHOST); + + while(num--) { + base = (CARD8*)pNewport->ShadowPtr + pbox->y1 * pNewport->ShadowPitch + pbox->x1 * 3; + + pNewportRegs->set.xystarti = (pbox->x1 << 16) | pbox->y1; + pNewportRegs->set.xyendi = (pbox->x2 << 16) | pbox->y2; + + for ( dy = pbox->y1; dy <= pbox->y2; dy++) { + src = base; + for ( dx = pbox->x1 ; dx <= pbox->x2 ; dx++) { + dest = src[0] | src[1] << 8 | src[2] << 16; + pNewportRegs->go.hostrw0 = dest; + src+=3; + } + base += pNewport->ShadowPitch; + } + pbox++; + } + TRACE_EXIT("NewportRefreshArea24"); +} Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man:1.4 xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man:1.4 Sun Feb 18 18:47:29 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man Mon Dec 17 15:52:33 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man,v 1.4 2001/02/18 23:47:29 mvojkovi Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man,v 1.7 2001/12/17 20:52:33 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH NV __drivermansuffix__ __vendorversion__ @@ -39,7 +39,12 @@ NV10 .TP 22 .B GeForce2, QUADRO2 -NV11 & NV15 +NV11 & NV15 (except GeForce2 Go, which is +.B NOT +supported) +.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 @@ -70,8 +75,7 @@ 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. +Enable or disable use of the shadow framebuffer layer. Default: off. .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_const.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_const.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_const.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_const.h:1.4 Tue Oct 24 18:45:08 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_const.h Thu Dec 6 19:09:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_const.h,v 1.4 2000/10/24 22:45:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_const.h,v 1.6 2001/12/07 00:09:55 mvojkovi Exp $ */ #ifndef __NV_CONST_H__ #define __NV_CONST_H__ @@ -8,9 +8,7 @@ #define NV_DRIVER_NAME "nv" #define NV_MAJOR_VERSION 1 #define NV_MINOR_VERSION 0 -#define NV_PATCHLEVEL 0 - -#define NV_USE_FB +#define NV_PATCHLEVEL 1 #ifdef DEBUG_PRINT #define DEBUG(x) x Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.3 Mon Jan 22 16:32:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c Mon Dec 17 17:17:55 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.3 2001/01/22 21:32:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c,v 1.5 2001/12/17 22:17:55 mvojkovi Exp $ */ #include "nv_include.h" @@ -42,7 +42,7 @@ */ #define TRANSPARENT_PIXEL 0 #define ConvertToRGB555(c) \ -( (( c & 0xf80000 ) >> 9 ) | (( c & 0xf800 ) >> 6 ) | (( c & 0xf8) >> 3 ) |0x8000) +(((c & 0xf80000) >> 9 ) | ((c & 0xf800) >> 6 ) | ((c & 0xf8) >> 3 ) | 0x8000) static void ConvertCursor(NVPtr pNv, unsigned int* src, unsigned short *dst) { @@ -54,14 +54,22 @@ m = *src++; for ( j = 0; j < MAX_CURS; j++ ) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + if ( m & 0x80000000) + *dst = ( b & 0x80000000) ? pNv->curFg : pNv->curBg; + else + *dst = TRANSPARENT_PIXEL; + b <<= 1; + m <<= 1; +#else if ( m & 1 ) *dst = ( b & 1) ? pNv->curFg : pNv->curBg; else *dst = TRANSPARENT_PIXEL; - - dst++; b >>= 1; m >>= 1; +#endif + dst++; } } } @@ -69,17 +77,13 @@ static void LoadCursor(ScrnInfoPtr pScrn, unsigned short *tmp) { - int *image, i, numInts, save; + int *image, i, numInts; NVPtr pNv = NVPTR(pScrn); numInts = (MAX_CURS*MAX_CURS*2) / sizeof(int); image = (int *)tmp; - /* Hide cursor, saving its current display state */ - save = pNv->riva.ShowHideCursor(&pNv->riva, 0); for (i = 0; i < numInts; i++) pNv->riva.CURSOR[i] = image[i]; - /* Restore cursor display state */ - pNv->riva.ShowHideCursor(&pNv->riva, save); } static void @@ -104,12 +108,9 @@ { NVPtr pNv = NVPTR(pScrn); - if (pScrn->vtSema) - { - pNv->riva.ShowHideCursor(&pNv->riva, 0); - *(pNv->riva.CURSORPOS) = (x & 0xFFFF) | (y << 16); - pNv->riva.ShowHideCursor(&pNv->riva, 1); - } + pNv->riva.ShowHideCursor(&pNv->riva, 0); + *(pNv->riva.CURSORPOS) = (x & 0xFFFF) | (y << 16); + pNv->riva.ShowHideCursor(&pNv->riva, 1); } static void @@ -118,21 +119,22 @@ NVPtr pNv = NVPTR(pScrn); unsigned short fore, back; - if (pScrn->vtSema) - { - fore = ConvertToRGB555(fg); - back = ConvertToRGB555(bg); + fore = ConvertToRGB555(fg); + back = ConvertToRGB555(bg); + +#if X_BYTE_ORDER == X_BIG_ENDIAN + fore = (fore << 8) | (fore >> 8); + back = (back << 8) | (back >> 8); +#endif + + if (pNv->curFg != fore || pNv->curBg != back) { + unsigned short tmp[MAX_CURS*MAX_CURS]; - if (pNv->curFg != fore || pNv->curBg != back) - { - unsigned short tmp[MAX_CURS*MAX_CURS]; - - pNv->curFg = fore; - pNv->curBg = back; + pNv->curFg = fore; + pNv->curBg = back; - ConvertCursor(pNv, pNv->curImage, tmp); - LoadCursor(pScrn, tmp); - } + ConvertCursor(pNv, pNv->curImage, tmp); + LoadCursor(pScrn, tmp); } } Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.10 Sun Feb 18 18:47:29 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c Tue Dec 11 14:42:01 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.10 2001/02/18 23:47:29 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c,v 1.15 2001/12/11 19:42:01 mvojkovi Exp $ */ #include "nv_include.h" @@ -35,20 +35,25 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { int i; - int horizDisplay = (mode->CrtcHDisplay/8) - 1; - int horizStart = (mode->CrtcHSyncStart/8) - 1; - int horizEnd = (mode->CrtcHSyncEnd/8) - 1; - int horizTotal = (mode->CrtcHTotal/8) - 1; - int vertDisplay = mode->CrtcVDisplay - 1; - int vertStart = mode->CrtcVSyncStart - 1; - int vertEnd = mode->CrtcVSyncEnd - 1; - int vertTotal = mode->CrtcVTotal - 2; + int horizDisplay = (mode->CrtcHDisplay/8) - 1; + int horizStart = (mode->CrtcHSyncStart/8) - 1; + int horizEnd = (mode->CrtcHSyncEnd/8) - 1; + int horizTotal = (mode->CrtcHTotal/8) - 5; + int horizBlankStart = (mode->CrtcHDisplay/8) - 1; + int horizBlankEnd = (mode->CrtcHTotal/8) - 1; + int vertDisplay = mode->CrtcVDisplay - 1; + int vertStart = mode->CrtcVSyncStart - 1; + int vertEnd = mode->CrtcVSyncEnd - 1; + int vertTotal = mode->CrtcVTotal - 2; + int vertBlankStart = mode->CrtcVDisplay - 1; + int vertBlankEnd = mode->CrtcVTotal - 1; + NVPtr pNv = NVPTR(pScrn); NVRegPtr nvReg = &pNv->ModeReg; NVFBLayout *pLayout = &pNv->CurrentLayout; vgaRegPtr pVga; - + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVDACInit\n")); /* @@ -62,54 +67,73 @@ /* * Set all CRTC values. */ + + if(mode->Flags & V_INTERLACE) + vertTotal |= 1; - pVga->CRTC[0x0] = Set8Bits(horizTotal - 4); + pVga->CRTC[0x0] = Set8Bits(horizTotal); pVga->CRTC[0x1] = Set8Bits(horizDisplay); - pVga->CRTC[0x2] = Set8Bits(horizDisplay); - pVga->CRTC[0x3] = SetBitField(horizTotal,4:0,4:0) - | SetBit(7); + pVga->CRTC[0x2] = Set8Bits(horizBlankStart); + pVga->CRTC[0x3] = SetBitField(horizBlankEnd,4:0,4:0) + | SetBit(7); pVga->CRTC[0x4] = Set8Bits(horizStart); - pVga->CRTC[0x5] = SetBitField(horizTotal,5:5,7:7) - | SetBitField(horizEnd,4:0,4:0); + pVga->CRTC[0x5] = SetBitField(horizBlankEnd,5:5,7:7) + | SetBitField(horizEnd,4:0,4:0); pVga->CRTC[0x6] = SetBitField(vertTotal,7:0,7:0); pVga->CRTC[0x7] = SetBitField(vertTotal,8:8,0:0) - | SetBitField(vertDisplay,8:8,1:1) - | SetBitField(vertStart,8:8,2:2) - | SetBitField(vertDisplay,8:8,3:3) - | SetBit(4) - | SetBitField(vertTotal,9:9,5:5) - | SetBitField(vertDisplay,9:9,6:6) - | SetBitField(vertStart,9:9,7:7); - pVga->CRTC[0x9] = SetBitField(vertDisplay,9:9,5:5) - | SetBit(6) - | ((mode->Flags & V_DBLSCAN) ? 0x80 : 0x00); + | SetBitField(vertDisplay,8:8,1:1) + | SetBitField(vertStart,8:8,2:2) + | SetBitField(vertBlankStart,8:8,3:3) + | SetBit(4) + | SetBitField(vertTotal,9:9,5:5) + | SetBitField(vertDisplay,9:9,6:6) + | SetBitField(vertStart,9:9,7:7); + pVga->CRTC[0x9] = SetBitField(vertBlankStart,9:9,5:5) + | SetBit(6) + | ((mode->Flags & V_DBLSCAN) ? 0x80 : 0x00); pVga->CRTC[0x10] = Set8Bits(vertStart); pVga->CRTC[0x11] = SetBitField(vertEnd,3:0,3:0) | SetBit(5); pVga->CRTC[0x12] = Set8Bits(vertDisplay); - pVga->CRTC[0x13] = 0xFF & - ((pLayout->displayWidth/8)*(pLayout->bitsPerPixel/8)); - pVga->CRTC[0x15] = Set8Bits(vertDisplay); - pVga->CRTC[0x16] = Set8Bits(vertTotal + 1); + pVga->CRTC[0x13] = ((pLayout->displayWidth/8)*(pLayout->bitsPerPixel/8)); + pVga->CRTC[0x15] = Set8Bits(vertBlankStart); + pVga->CRTC[0x16] = Set8Bits(vertBlankEnd); + + nvReg->screen = SetBitField(horizBlankEnd,6:6,4:4) + | SetBitField(vertBlankStart,10:10,3:3) + | SetBitField(vertStart,10:10,2:2) + | SetBitField(vertDisplay,10:10,1:1) + | SetBitField(vertTotal,10:10,0:0); + + nvReg->horiz = SetBitField(horizTotal,8:8,0:0) + | SetBitField(horizDisplay,8:8,1:1) + | SetBitField(horizBlankStart,8:8,2:2) + | SetBitField(horizStart,8:8,3:3); + + nvReg->extra = SetBitField(vertTotal,11:11,0:0) + | SetBitField(vertDisplay,11:11,2:2) + | SetBitField(vertStart,11:11,4:4) + | SetBitField(vertBlankStart,11:11,6:6); + + if(mode->Flags & V_INTERLACE) { + horizTotal = (horizTotal >> 1) & ~1; + nvReg->interlace = Set8Bits(horizTotal); + nvReg->horiz |= SetBitField(horizTotal,8:8,4:4); + } else { + nvReg->interlace = 0xff; /* interlace off */ + } + /* * Initialize DAC palette. */ if(pLayout->bitsPerPixel != 8 ) { - if (pNv->riva.Architecture == 3) - for (i = 0; i < 256; i++) - { - pVga->DAC[i*3] = i >> 2; - pVga->DAC[(i*3)+1] = i >> 2; - pVga->DAC[(i*3)+2] = i >> 2; - } - else - for (i = 0; i < 256; i++) - { - pVga->DAC[i*3] = i; - pVga->DAC[(i*3)+1] = i; - pVga->DAC[(i*3)+2] = i; - } + for (i = 0; i < 256; i++) + { + pVga->DAC[i*3] = i; + pVga->DAC[(i*3)+1] = i; + pVga->DAC[(i*3)+2] = i; + } } /* @@ -120,22 +144,17 @@ i = pLayout->depth; else i = 32; + if(pNv->riva.Architecture >= NV_ARCH_10) + pNv->riva.CURSOR = (U032 *)(pNv->FbStart + pNv->riva.CursorStart); + pNv->riva.CalcStateExt(&pNv->riva, nvReg, i, pLayout->displayWidth, mode->CrtcHDisplay, - horizDisplay, - horizStart, - horizEnd, - horizTotal, pScrn->virtualY, - vertDisplay, - vertStart, - vertEnd, - vertTotal, mode->Clock, - mode->Flags & V_DBLSCAN); + mode->Flags); return (TRUE); } @@ -146,9 +165,12 @@ { NVPtr pNv = NVPTR(pScrn); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVDACRestore\n")); + pNv->riva.LoadStateExt(&pNv->riva, nvReg); +#if defined(__powerpc__) + restoreFonts = FALSE; +#endif vgaHWRestore(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE | (restoreFonts? VGA_SR_FONTS : 0)); - pNv->riva.LoadStateExt(&pNv->riva, nvReg); } /* @@ -180,6 +202,10 @@ pVga = &VGAHWPTR(pScrn)->ModeReg; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVDACLoadPalette\n")); + + if((pNv->riva.Architecture == NV_ARCH_03) && + (pNv->CurrentLayout.depth != 8)) + return; switch(pNv->CurrentLayout.depth) { case 15: Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.66 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.81 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.66 Tue May 15 06:19:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c Fri Jan 4 16:22:33 2002 @@ -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.66 2001/05/15 10:19:39 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.81 2002/01/04 21:22:33 tsi Exp $ */ #include "nv_include.h" @@ -88,29 +88,40 @@ /* Supported chipsets */ static SymTabRec NVChipsets[] = { { NV_CHIP_RIVA128, "RIVA128" }, - { NV_CHIP_TNT, "RIVATNT" }, - { NV_CHIP_TNT2, "RIVATNT2" }, - { NV_CHIP_TNT2_A, "RIVATNT2 (A)" }, - { NV_CHIP_TNT2_B, "RIVATNT2 (B)" }, - { NV_CHIP_UTNT2, "RIVATNT2 (Ultra)" }, - { NV_CHIP_VTNT2, "RIVATNT2 (Vanta)" }, - { NV_CHIP_UVTNT2, "RIVATNT2 M64" }, - { NV_CHIP_ITNT2, "RIVATNT2 (Integrated)" }, + { NV_CHIP_TNT, "RIVA TNT" }, + { NV_CHIP_TNT2, "RIVA TNT2" }, + { NV_CHIP_UTNT2, "RIVA TNT2 Ultra" }, + { NV_CHIP_VTNT2, "Vanta" }, + { NV_CHIP_UVTNT2, "RIVA TNT2 M64" }, + { NV_CHIP_ITNT2, "Aladdin TNT2" }, { NV_CHIP_GEFORCE256, "GeForce 256" }, { NV_CHIP_GEFORCEDDR, "GeForce DDR" }, { NV_CHIP_QUADRO, "Quadro" }, - { NV_CHIP_GEFORCE2GTS, "GeForce2 GTS"}, - { NV_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)"}, - { NV_CHIP_GEFORCE2ULTRA,"GeForce2 ultra"}, - { NV_CHIP_QUADRO2PRO, "Quadro 2 Pro"}, - { NV_CHIP_GEFORCE2MX, "GeForce2 MX"}, - { NV_CHIP_GEFORCE2MXDDR, "GeForce2 MX DDR"}, - { NV_CHIP_QUADRO2MXR, "Quadro 2 MXR"}, - { NV_CHIP_GEFORCE2GO, "GeForce 2 Go"}, + { NV_CHIP_GEFORCE2GTS, "GeForce2 GTS/Pro"}, + { NV_CHIP_GEFORCE2GTS_1,"GeForce2 Ti"}, + { NV_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra"}, + { NV_CHIP_QUADRO2PRO, "Quadro2 Pro"}, + { NV_CHIP_GEFORCE2MX, "GeForce2 MX/MX 400"}, + { NV_CHIP_GEFORCE2MXDDR, "GeForce2 MX 100/200"}, + { NV_CHIP_0x0170, "0x0170" }, + { NV_CHIP_0x0171, "0x0171" }, + { NV_CHIP_0x0172, "0x0172" }, + { NV_CHIP_0x0173, "0x0173" }, + { NV_CHIP_0x0174, "0x0174" }, + { NV_CHIP_0x0175, "0x0175" }, + { NV_CHIP_0x0178, "0x0178" }, + { NV_CHIP_0x017A, "0x017A" }, + { NV_CHIP_0x017B, "0x017B" }, + { NV_CHIP_0x017C, "0x017C" }, + { NV_CHIP_IGEFORCE2, "GeForce2 Integrated"}, + { NV_CHIP_QUADRO2MXR, "Quadro2 MXR"}, + { NV_CHIP_GEFORCE2GO, "GeForce2 Go"}, { NV_CHIP_GEFORCE3, "GeForce3"}, - { NV_CHIP_GEFORCE3_1, "GeForce3 (rev 1)"}, - { NV_CHIP_GEFORCE3_2, "GeForce3 (rev 2)"}, - { NV_CHIP_GEFORCE3_3, "GeForce3 (rev 3)"}, + { NV_CHIP_GEFORCE3_1, "GeForce3 Ti 200"}, + { NV_CHIP_GEFORCE3_2, "GeForce3 Ti 500"}, + { NV_CHIP_QUADRO_DDC, "Quadro DDC"}, + { NV_CHIP_0x0250, "0x0250"}, + { NV_CHIP_0x0258, "0x0258"}, {-1, NULL } }; @@ -118,8 +129,6 @@ { NV_CHIP_RIVA128, NV_CHIP_RIVA128, RES_SHARED_VGA }, { NV_CHIP_TNT, NV_CHIP_TNT, RES_SHARED_VGA }, { NV_CHIP_TNT2, NV_CHIP_TNT2, RES_SHARED_VGA }, - { NV_CHIP_TNT2_A, NV_CHIP_TNT2_A, RES_SHARED_VGA }, - { NV_CHIP_TNT2_B, NV_CHIP_TNT2_B, RES_SHARED_VGA }, { NV_CHIP_UTNT2, NV_CHIP_UTNT2, RES_SHARED_VGA }, { NV_CHIP_VTNT2, NV_CHIP_VTNT2, RES_SHARED_VGA }, { NV_CHIP_UVTNT2, NV_CHIP_UVTNT2, RES_SHARED_VGA }, @@ -133,12 +142,25 @@ { NV_CHIP_QUADRO2PRO, NV_CHIP_QUADRO2PRO, RES_SHARED_VGA }, { NV_CHIP_GEFORCE2MX, NV_CHIP_GEFORCE2MX, RES_SHARED_VGA }, { NV_CHIP_GEFORCE2MXDDR, NV_CHIP_GEFORCE2MXDDR, RES_SHARED_VGA }, + { NV_CHIP_0x0170, NV_CHIP_0x0170, RES_SHARED_VGA }, + { NV_CHIP_0x0171, NV_CHIP_0x0171, RES_SHARED_VGA }, + { NV_CHIP_0x0172, NV_CHIP_0x0172, RES_SHARED_VGA }, + { NV_CHIP_0x0173, NV_CHIP_0x0173, RES_SHARED_VGA }, + { NV_CHIP_0x0174, NV_CHIP_0x0174, RES_SHARED_VGA }, + { NV_CHIP_0x0175, NV_CHIP_0x0175, RES_SHARED_VGA }, + { NV_CHIP_0x0178, NV_CHIP_0x0178, RES_SHARED_VGA }, + { NV_CHIP_0x017A, NV_CHIP_0x017A, RES_SHARED_VGA }, + { NV_CHIP_0x017B, NV_CHIP_0x017B, RES_SHARED_VGA }, + { NV_CHIP_0x017C, NV_CHIP_0x017C, RES_SHARED_VGA }, + { NV_CHIP_IGEFORCE2, NV_CHIP_IGEFORCE2, RES_SHARED_VGA }, { NV_CHIP_QUADRO2MXR, NV_CHIP_QUADRO2MXR, RES_SHARED_VGA }, { NV_CHIP_GEFORCE2GO, NV_CHIP_GEFORCE2GO, RES_SHARED_VGA }, { NV_CHIP_GEFORCE3, NV_CHIP_GEFORCE3, RES_SHARED_VGA }, { NV_CHIP_GEFORCE3_1, NV_CHIP_GEFORCE3_1, RES_SHARED_VGA }, { NV_CHIP_GEFORCE3_2, NV_CHIP_GEFORCE3_2, RES_SHARED_VGA }, - { NV_CHIP_GEFORCE3_3, NV_CHIP_GEFORCE3_3, RES_SHARED_VGA }, + { NV_CHIP_QUADRO_DDC, NV_CHIP_QUADRO_DDC, RES_SHARED_VGA }, + { NV_CHIP_0x0250, NV_CHIP_0x0250, RES_SHARED_VGA }, + { NV_CHIP_0x0258, NV_CHIP_0x0258, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -152,51 +174,42 @@ */ static const char *vgahwSymbols[] = { + "vgaHWDPMSSet", + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", + "vgaHWGetIndex", "vgaHWInit", - "vgaHWProtect", - "vgaHWGetIOBase", - "vgaHWMapMem", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", + "vgaHWUnlock", "vgaHWddc1SetSpeed", - "vgaHWDPMSSet", NULL }; -#ifndef NV_USE_FB -static const char *cfbSymbols[] = { - "cfbScreenInit", - "cfb16ScreenInit", - "cfb24ScreenInit", - "cfb32ScreenInit", - "cfbBresS", - "cfb16BresS", - "cfb32BresS", - NULL -}; -#else static const char *fbSymbols[] = { - "fbScreenInit", - "fbBres", "fbPictureInit", + "fbScreenInit", NULL }; -#endif static const char *xaaSymbols[] = { - "XAADestroyInfoRec", + "XAACopyROP", "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAFallbackOps", "XAAInit", + "XAAPatternROP", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; @@ -208,6 +221,7 @@ #if NVuseI2C "xf86DoEDID_DDC2", #endif + "xf86SetDDCproperties", NULL }; @@ -233,24 +247,20 @@ "fbdevHWInit", "fbdevHWUseBuildinMode", - "fbdevHWGetDepth", "fbdevHWGetVidmem", /* colormap */ "fbdevHWLoadPalette", /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", "fbdevHWModeInit", "fbdevHWSave", + "fbdevHWSwitchMode", + "fbdevHWValidMode", - "fbdevHWUnmapMMIO", - "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", @@ -258,8 +268,8 @@ }; static const char *int10Symbols[] = { - "xf86InitInt10", "xf86FreeInt10", + "xf86InitInt10", NULL }; @@ -381,12 +391,7 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(vgahwSymbols, xaaSymbols, -#ifndef NV_USE_FB - cfbSymbols, -#else - fbSymbols, -#endif + LoaderRefSymLists(vgahwSymbols, xaaSymbols, fbSymbols, ramdacSymbols, shadowSymbols, i2cSymbols, ddcSymbols, vbeSymbols, fbdevHWSymbols, int10Symbols, NULL); @@ -653,8 +658,6 @@ NVUnmapMem(pScrn); vgaHWUnmapMem(pScrn); - if (pNv->pInt) - xf86FreeInt10(pNv->pInt); if (pNv->AccelInfoRec) XAADestroyInfoRec(pNv->AccelInfoRec); if (pNv->CursorInfoRec) @@ -769,9 +772,7 @@ xf86SetDDCproperties(pScrn,MonInfo); } vbeFree(pVbe); - } else - xf86FreeInt10(pNv->pInt); - pNv->pInt = NULL; + } } return MonInfo; } @@ -839,8 +840,6 @@ int i; int bytesPerPixel; ClockRangePtr clockRanges; - char *mod = NULL; - const char *reqSym = NULL; const char *s; if (flags & PROBE_DETECT) { @@ -885,19 +884,14 @@ pNv->Primary = xf86IsPrimaryPci(pNv->PciInfo); -#ifndef __alpha__ /* Initialize the card through int10 interface if needed */ -#if 0 - if ( !pNv->Primary &&) -#endif - if (xf86LoadSubModule(pScrn, "int10")){ - + if (xf86LoadSubModule(pScrn, "int10")){ xf86LoaderReqSymLists(int10Symbols, NULL); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); - pNv->pInt = xf86InitInt10(pNv->pEnt->index); - } +#if !defined(__alpha__) && !defined(__powerpc__) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); + pNv->pInt = xf86InitInt10(pNv->pEnt->index); #endif + } { resRange vgaio[] = { {ResShrIoBlock,0x3B0,0x3BB}, @@ -1045,7 +1039,7 @@ return FALSE; } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Collect all of the relevant option flags (fill in pScrn->options) */ @@ -1217,39 +1211,23 @@ return FALSE; } - switch (pNv->Chipset) { - case NV_CHIP_RIVA128: + switch (pNv->Chipset & 0x0ff0) { + case 0x0010: NV3Setup(pScrn); break; - - case NV_CHIP_TNT: - case NV_CHIP_TNT2: - case NV_CHIP_TNT2_A: - case NV_CHIP_TNT2_B: - case NV_CHIP_UTNT2: - case NV_CHIP_VTNT2: - case NV_CHIP_UVTNT2: - case NV_CHIP_ITNT2: + case 0x0020: + case 0x00A0: NV4Setup(pScrn); break; - - case NV_CHIP_GEFORCE256: - case NV_CHIP_GEFORCEDDR: - case NV_CHIP_QUADRO: - case NV_CHIP_GEFORCE2GTS: - case NV_CHIP_GEFORCE2GTS_1: - case NV_CHIP_GEFORCE2ULTRA: - case NV_CHIP_QUADRO2PRO: - case NV_CHIP_GEFORCE2MX: - case NV_CHIP_GEFORCE2MXDDR: - case NV_CHIP_QUADRO2MXR: - case NV_CHIP_GEFORCE2GO: + case 0x0100: + case 0x0110: + case 0x0150: + case 0x0170: + case 0x01A0: NV10Setup(pScrn); break; - case NV_CHIP_GEFORCE3: - case NV_CHIP_GEFORCE3_1: - case NV_CHIP_GEFORCE3_2: - case NV_CHIP_GEFORCE3_3: + case 0x0200: + case 0x0250: NV20Setup(pScrn); break; } @@ -1280,8 +1258,11 @@ pNv->FbMapSize = pScrn->videoRam * 1024; +#if !defined(__powerpc__) /* Read and print the Monitor DDC info */ pScrn->monitor->DDC = NVdoDDC(pScrn); +#endif + #if 0 /* * This code was for testing. It will be removed as soon @@ -1355,7 +1336,12 @@ clockRanges->minClock = pNv->MinClock; clockRanges->maxClock = pNv->MaxClock; clockRanges->clockIndex = -1; /* programmable */ - clockRanges->interlaceAllowed = TRUE; + if(((pNv->Chipset & 0x0ff0) <= 0x0100) || + ((pNv->Chipset & 0x0ff0) == 0x0150)) + { + clockRanges->interlaceAllowed = TRUE; + } else /* Chips after NV15 (including NV11) do not support interlaced */ + clockRanges->interlaceAllowed = FALSE; clockRanges->doubleScanAllowed = TRUE; /* @@ -1402,7 +1388,7 @@ * driver and if the driver doesn't provide code to set them. They * are not pre-initialised at all. */ - xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + xf86SetCrtcForModes(pScrn, 0); /* Set the current mode to the first in the list */ pScrn->currentMode = pScrn->modes; @@ -1419,33 +1405,6 @@ * section. */ -#ifndef NV_USE_FB - /* 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; - default: - xf86FreeInt10(pNv->pInt); - return FALSE; - } - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { - xf86FreeInt10(pNv->pInt); - NVFreeRec(pScrn); - return FALSE; - } - - xf86LoaderReqSymbols(reqSym, NULL); -#else if (xf86LoadSubModule(pScrn, "fb") == NULL) { xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); @@ -1453,7 +1412,6 @@ } xf86LoaderReqSymLists(fbSymbols, NULL); -#endif /* Load XAA if needed */ if (!pNv->NoAccel) { @@ -1493,6 +1451,9 @@ pNv->CurrentLayout.weight.blue = pScrn->weight.blue; pNv->CurrentLayout.mode = pScrn->currentMode; + xf86FreeInt10(pNv->pInt); + + pNv->pInt = NULL; return TRUE; } @@ -1610,6 +1571,18 @@ if ( pNv->Restore ) (*pNv->Restore)(pScrn, vgaReg, nvReg, FALSE); +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* turn on LFB swapping */ + { + unsigned char tmp; + + VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x46); + tmp = VGA_RD08(pNv->riva.PCIO, 0x3d5); + tmp |= (1 << 7); + VGA_WR08(pNv->riva.PCIO, 0x3d5, tmp); + } +#endif + NVResetGraphics(pScrn); vgaHWProtect(pScrn, FALSE); @@ -1656,6 +1629,7 @@ VisualPtr visual; unsigned char *FBStart; int width, height, displayWidth; + BoxRec AvailFBArea; /* * First get the ScrnInfoRec @@ -1728,18 +1702,16 @@ /* Setup the visuals we support. */ if ((pScrn->bitsPerPixel > 8) && (pNv->riva.Architecture == NV_ARCH_03)) { - if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, + if (!miSetVisualTypes(pScrn->depth, TrueColorMask, 8, pScrn->defaultVisual)) return FALSE; } else { if (!miSetVisualTypes(pScrn->depth, - miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) + miGetDefaultVisualMask(pScrn->depth), 8, + pScrn->defaultVisual)) return FALSE; } -#ifdef NV_USE_FB - if (!miSetPixmapDepths ()) return FALSE; -#endif + if (!miSetPixmapDepths ()) return FALSE; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Visuals set up\n")); @@ -1769,30 +1741,13 @@ } switch (pScrn->bitsPerPixel) { -#ifndef NV_USE_FB 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; -#else - case 8: - case 16: - case 32: - ret = fbScreenInit(pScreen, FBStart, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + ret = fbScreenInit(pScreen, FBStart, width, height, + pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit (pScreen, 0, 0); break; -#endif default: xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in NVScreenInit\n", @@ -1820,12 +1775,21 @@ } } + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- B & W\n")); if(!pNv->ShadowFB) /* hardware cursor needs to wrap this layer */ NVDGAInit(pScreen); + + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = (min(pNv->FbUsableSize, 32*1024*1024)) / + (pScrn->displayWidth * pScrn->bitsPerPixel / 8); + xf86InitFBManager(pScreen, &AvailFBArea); if (!pNv->NoAccel) NVAccelInit(pScreen); @@ -1933,7 +1897,12 @@ vgaRegPtr vgaReg = &pVga->SavedReg; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVSave\n")); - vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP|VGA_SR_MODE|VGA_SR_FONTS); +#if defined(__powerpc__) + /* The console driver will have to save the fonts, we can't */ + vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE); +#else + vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE | VGA_SR_FONTS); +#endif pNv->riva.UnloadStateExt(&pNv->riva, nvReg); } Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h:1.10 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h:1.10 Tue Mar 27 20:17:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h Thu Dec 6 19:09:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.10 2001/03/28 01:17:43 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.11 2001/12/07 00:09:56 mvojkovi Exp $ */ #ifndef __NV_INCLUDE_H__ #define __NV_INCLUDE_H__ @@ -35,20 +35,7 @@ #include "dixstruct.h" #include "scrnintstr.h" -#ifndef NV_USE_FB -/* - * If using cfb, cfb.h is required. Select the others for the bpp values - * the driver supports. - */ -#define PSZ 8 /* needed for cfb.h */ -#include "cfb.h" -#undef PSZ -#include "cfb16.h" -#include "cfb24.h" -#include "cfb32.h" -#else #include "fb.h" -#endif #include "xaa.h" #include "xf86cmap.h" Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.9 Tue Mar 27 20:17:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c Tue Oct 30 14:38: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_setup.c,v 1.9 2001/03/28 01:17:43 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.11 2001/10/30 19:38:29 mvojkovi Exp $ */ #include "nv_include.h" @@ -217,7 +217,7 @@ mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; pNv->riva.PRAMDAC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, - regBase+0x00680000, 0x00001000); + regBase+0x00680000, 0x00003000); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PRAMDAC %x\n", pNv->riva.PRAMDAC)); pNv->riva.PFB = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00100000, 0x00001000); @@ -255,7 +255,7 @@ pNv->PciTag, regBase+0x000C0000, 0x00001000); - RivaGetConfig(&pNv->riva); + RivaGetConfig(pNv); pNv->Dac.maxPixelClock = pNv->riva.MaxVClockFreqKHz; Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.24 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.24 Tue May 8 20:39:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h Thu Dec 6 19:09:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.24 2001/05/09 00:39:51 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.29 2001/12/07 00:09:56 mvojkovi Exp $ */ #ifndef __NV_STRUCT_H__ #define __NV_STRUCT_H__ @@ -98,10 +98,6 @@ CARD32 BgColor; int Rotate; NVFBLayout CurrentLayout; - GCPtr CurrentGC; -#ifdef NV_USE_FB - DrawablePtr CurrentDrawable; -#endif /* Cursor */ unsigned short curFg, curBg; unsigned int curImage[MAX_CURS*2]; @@ -129,11 +125,11 @@ void NVRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void NVPointerMoved(int index, int x, int y); +int RivaGetConfig(NVPtr); + #define NV_CHIP_RIVA128 ((PCI_VENDOR_NVIDIA_SGS << 16)| PCI_CHIP_RIVA128) #define NV_CHIP_TNT ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_TNT) #define NV_CHIP_TNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_TNT2) -#define NV_CHIP_TNT2_A ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_TNT2_A) -#define NV_CHIP_TNT2_B ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_TNT2_B) #define NV_CHIP_UTNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_UTNT2) #define NV_CHIP_VTNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_VTNT2) #define NV_CHIP_UVTNT2 ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_UVTNT2) @@ -143,6 +139,17 @@ #define NV_CHIP_QUADRO ((PCI_VENDOR_NVIDIA << 16)| PCI_CHIP_QUADRO) #define NV_CHIP_GEFORCE2MX ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2MX) #define NV_CHIP_GEFORCE2MXDDR ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2MXDDR) +#define NV_CHIP_IGEFORCE2 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_IGEFORCE2) +#define NV_CHIP_0x0170 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0170) +#define NV_CHIP_0x0171 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0171) +#define NV_CHIP_0x0172 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0172) +#define NV_CHIP_0x0173 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0173) +#define NV_CHIP_0x0174 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0174) +#define NV_CHIP_0x0175 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0175) +#define NV_CHIP_0x0178 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0178) +#define NV_CHIP_0x017A ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x017A) +#define NV_CHIP_0x017B ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x017B) +#define NV_CHIP_0x017C ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x017C) #define NV_CHIP_QUADRO2MXR ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO2MXR) #define NV_CHIP_GEFORCE2GO ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GO) #define NV_CHIP_GEFORCE2GTS ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GTS) @@ -152,6 +159,8 @@ #define NV_CHIP_GEFORCE3 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3) #define NV_CHIP_GEFORCE3_1 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_1) #define NV_CHIP_GEFORCE3_2 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_2) -#define NV_CHIP_GEFORCE3_3 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_3) +#define NV_CHIP_QUADRO_DDC ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO_DDC) +#define NV_CHIP_0x0250 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0250) +#define NV_CHIP_0x0258 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0x0258) #endif /* __NV_STRUCT_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c:1.2 Sun Apr 1 10:00:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c Thu Dec 13 20:20:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c,v 1.2 2001/04/01 14:00:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c,v 1.6 2001/12/14 01:20:44 mvojkovi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -251,10 +251,8 @@ NVPtr pNv = NVPTR(pScrn); int num_adaptors; - if (pNv->AccelInfoRec && pNv->AccelInfoRec->FillSolidRects && - (pScrn->bitsPerPixel != 8) && (pNv->riva.Architecture >= NV_ARCH_10)) + if((pScrn->bitsPerPixel != 8) && (pNv->riva.Architecture >= NV_ARCH_10)) { - overlayAdaptor = NVSetupImageVideo(pScreen); if(overlayAdaptor) @@ -387,96 +385,7 @@ } 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, @@ -509,10 +418,7 @@ /* 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)); + xf86XVFillKeyHelper(pScrnInfo->pScreen, pPriv->colorKey, clipBoxes); } pRiva->PMC[(0x8900/4) + buffer] = offset; @@ -745,16 +651,27 @@ s1 = src1; s2 = src2; s3 = src3; i = w; while(i > 4) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + dst[0] = (s1[0] << 24) | (s1[1] << 8) | (s3[0] << 16) | s2[0]; + dst[1] = (s1[2] << 24) | (s1[3] << 8) | (s3[1] << 16) | s2[1]; + dst[2] = (s1[4] << 24) | (s1[5] << 8) | (s3[2] << 16) | s2[2]; + dst[3] = (s1[6] << 24) | (s1[7] << 8) | (s3[3] << 16) | s2[3]; +#else 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); +#endif dst += 4; s2 += 4; s3 += 4; s1 += 8; i -= 4; } while(i--) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + dst[0] = (s1[0] << 24) | (s1[1] << 8) | (s3[0] << 16) | s2[0]; +#else dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); +#endif dst++; s2++; s3++; s1 += 2; } @@ -832,7 +749,8 @@ dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!NVClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height)) + if(!xf86XVClipVideoHelper(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, + width, height)) return Success; dstBox.x1 -= pScrnInfo->frameX0; @@ -1159,7 +1077,7 @@ dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!NVClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, + if(!xf86XVClipVideoHelper(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, surface->width, surface->height)) { return Success; @@ -1173,7 +1091,7 @@ pPriv->currentBuffer = 0; NVPutOverlayImage (pScrnInfo, surface->offsets[0], surface->id, - surface->pitches[0], &dstBox, xa, xb, ya, yb, + surface->pitches[0], &dstBox, xa, ya, xb, yb, surface->width, surface->height, src_w, src_h, drw_w, drw_h, clipBoxes); Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.22 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.22 Sat Mar 31 15:32:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c Wed Sep 19 19:40:06 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.22 2001/03/31 20:32:13 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.24 2001/09/19 23:40:06 mvojkovi Exp $ */ #include "nv_include.h" #include "xaalocal.h" @@ -551,7 +551,6 @@ XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; NVPtr pNv = NVPTR(pScrn); - BoxRec AvailFBArea; pNv->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -559,14 +558,6 @@ /* fill out infoPtr here */ infoPtr->Flags = LINEAR_FRAMEBUFFER | PIXMAP_CACHE | OFFSCREEN_PIXMAPS; - /* Initialize pixmap cache */ - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (min(pNv->FbUsableSize, 32*1024*1024)) / - (pScrn->displayWidth * pScrn->bitsPerPixel / 8); - xf86InitFBManager(pScreen, &AvailFBArea); - /* sync */ infoPtr->Sync = NVSync; @@ -596,8 +587,12 @@ NVSubsequentMono8x8PatternFillRect; /* Color expansion */ - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = +#if X_BYTE_ORDER == X_BIG_ENDIAN + BIT_ORDER_IN_BYTE_MSBFIRST | +#else BIT_ORDER_IN_BYTE_LSBFIRST | +#endif NO_PLANEMASK | CPU_TRANSFER_PAD_DWORD | LEFT_EDGE_CLIPPING | Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h:1.1 Sun Aug 1 03:21:00 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h Mon Nov 19 10:33:41 2001 @@ -20,14 +20,12 @@ * SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h,v 1.1 1999/08/01 07:21:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nvvga.h,v 1.2 2001/11/19 15:33:41 tsi Exp $ */ #ifndef __NVVGA_H__ #define __NVVGA_H__ -#ifndef __RIVA_HW_H__ #include "riva_hw.h" -#endif #define PALETTE_SIZE 256 Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.13 Tue Mar 27 20:17:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c Mon Dec 17 17:17:55 2001 @@ -36,12 +36,15 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.13 2001/03/28 01:17:43 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.21 2001/12/17 22:17:55 mvojkovi Exp $ */ #include "nv_local.h" +#include "compiler.h" +#include "nv_include.h" +#include "nvreg.h" #include "riva_hw.h" #include "riva_tbl.h" -#include "compiler.h" + /* * This file is an OS-agnostic file used to make RIVA 128 and RIVA TNT * operate identically (except TNT has more memory and better 3D quality. @@ -1152,17 +1155,9 @@ int bpp, int width, int hDisplaySize, - int hDisplay, - int hStart, - int hEnd, - int hTotal, int height, - int vDisplay, - int vStart, - int vEnd, - int vTotal, int dotClock, - int doubleScan + int flags ) { int pixelDepth, VClk, m, n, p; @@ -1188,7 +1183,7 @@ chip); state->cursor0 = 0x00; state->cursor1 = 0x78; - if (doubleScan) + if (flags & V_DBLSCAN) state->cursor1 |= 2; state->cursor2 = 0x00000000; state->pllsel = 0x10010100; @@ -1206,7 +1201,7 @@ chip); state->cursor0 = 0x00; state->cursor1 = 0xFC; - if (doubleScan) + if (flags & V_DBLSCAN) state->cursor1 |= 2; state->cursor2 = 0x00000000; state->pllsel = 0x10000700; @@ -1221,11 +1216,11 @@ &(state->arbitration0), &(state->arbitration1), chip); - state->cursor0 = 0x00; - state->cursor1 = 0xFC; - if (doubleScan) + state->cursor0 = 0x80 | (chip->CursorStart >> 17); + state->cursor1 = (chip->CursorStart >> 11) << 2; + state->cursor2 = chip->CursorStart >> 24; + if (flags & V_DBLSCAN) state->cursor1 |= 2; - state->cursor2 = 0x00000000; state->pllsel = 0x10000700; state->config = chip->PFB[0x00000200/4]; state->general = bpp == 16 ? 0x00101100 : 0x00100100; @@ -1237,13 +1232,7 @@ state->general |= 0x00000030; state->vpll = (p << 16) | (n << 8) | m; - state->screen = ((hTotal & 0x040) >> 2) - | ((vDisplay & 0x400) >> 7) - | ((vStart & 0x400) >> 8) - | ((vDisplay & 0x400) >> 9) - | ((vTotal & 0x400) >> 10); state->repaint0 = (((width/8)*pixelDepth) & 0x700) >> 3; - state->horiz = hTotal < 260 ? 0x00 : 0x01; state->pixel = pixelDepth > 2 ? 3 : pixelDepth; state->offset0 = state->offset1 = @@ -1449,7 +1438,12 @@ chip->PGRAPH[0x00000864/4] = state->pitch3; chip->PGRAPH[0x000009A4/4] = chip->PFB[0x00000200/4]; chip->PGRAPH[0x000009A8/4] = chip->PFB[0x00000204/4]; + chip->PRAMDAC[0x0000052C/4] = 0x00000101; + chip->PRAMDAC[0x0000252C/4] = 0x00000001; } + chip->PRAMDAC[0x00000404/4] |= (1 << 25); + chip->PRAMDAC[0x00002404/4] |= (1 << 25); + chip->PMC[0x00008704/4] = 1; chip->PMC[0x00008140/4] = 0; chip->PMC[0x00008920/4] = 0; @@ -1457,6 +1451,15 @@ chip->PMC[0x00008908/4] = 0x01ffffff; chip->PMC[0x0000890C/4] = 0x01ffffff; + chip->PFB[0x00000240/4] = 0; + chip->PFB[0x00000244/4] = 0; + chip->PFB[0x00000248/4] = 0; + chip->PFB[0x0000024C/4] = 0; + chip->PFB[0x00000250/4] = 0; + chip->PFB[0x00000254/4] = 0; + chip->PFB[0x00000258/4] = 0; + chip->PFB[0x0000025C/4] = 0; + chip->PGRAPH[0x00000B00/4] = chip->PFB[0x00000240/4]; chip->PGRAPH[0x00000B04/4] = chip->PFB[0x00000244/4]; chip->PGRAPH[0x00000B08/4] = chip->PFB[0x00000248/4]; @@ -1537,6 +1540,7 @@ /* * Load HW mode state. */ + VGA_WR08(chip->PCIO, 0x03D4, 0x19); VGA_WR08(chip->PCIO, 0x03D5, state->repaint0); VGA_WR08(chip->PCIO, 0x03D4, 0x1A); @@ -1555,7 +1559,12 @@ VGA_WR08(chip->PCIO, 0x03D5, state->cursor0); VGA_WR08(chip->PCIO, 0x03D4, 0x31); VGA_WR08(chip->PCIO, 0x03D5, state->cursor1); - chip->PRAMDAC[0x00000300/4] = state->cursor2; + VGA_WR08(chip->PCIO, 0x03D4, 0x2F); + VGA_WR08(chip->PCIO, 0x03D5, state->cursor2); + VGA_WR08(chip->PCIO, 0x03D4, 0x39); + VGA_WR08(chip->PCIO, 0x03D5, state->interlace); + VGA_WR08(chip->PCIO, 0x03D4, 0x41); + VGA_WR08(chip->PCIO, 0x03D5, state->extra); chip->PRAMDAC[0x00000508/4] = state->vpll; chip->PRAMDAC[0x0000050C/4] = state->pllsel; chip->PRAMDAC[0x00000600/4] = state->general; @@ -1606,7 +1615,12 @@ state->cursor0 = VGA_RD08(chip->PCIO, 0x03D5); VGA_WR08(chip->PCIO, 0x03D4, 0x31); state->cursor1 = VGA_RD08(chip->PCIO, 0x03D5); - state->cursor2 = chip->PRAMDAC[0x00000300/4]; + VGA_WR08(chip->PCIO, 0x03D4, 0x2F); + state->cursor2 = VGA_RD08(chip->PCIO, 0x03D5); + VGA_WR08(chip->PCIO, 0x03D4, 0x39); + state->interlace = VGA_RD08(chip->PCIO, 0x03D5); + VGA_WR08(chip->PCIO, 0x03D4, 0x41); + state->extra = VGA_RD08(chip->PCIO, 0x03D5); state->vpll = chip->PRAMDAC[0x00000508/4]; state->pllsel = chip->PRAMDAC[0x0000050C/4]; state->general = chip->PRAMDAC[0x00000600/4]; @@ -1832,7 +1846,7 @@ break; } } - chip->CrystalFreqKHz = (chip->PEXTDEV[0x00000000/4] & 0x00000020) ? 13500 : 14318; /* this was reversed, not sure that it is right this way either (HCS) */ + chip->CrystalFreqKHz = (chip->PEXTDEV[0x00000000/4] & 0x00000040) ? 14318 : 13500; chip->CURSOR = &(chip->PRAMIN[0x00008000/4 - 0x0800/4]); chip->CURSORPOS = &(chip->PRAMDAC[0x0300/4]); chip->VBLANKENABLE = &(chip->PGRAPH[0x0140/4]); @@ -1915,14 +1929,26 @@ } static void nv10GetConfig ( - RIVA_HW_INST *chip + NVPtr pNv ) { + RIVA_HW_INST *chip = &pNv->riva; + +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* turn on big endian register access */ + chip->PMC[0x00000004/4] = 0x01000001; +#endif + /* * Fill in chip configuration. */ - switch ((chip->PFB[0x0000020C/4] >> 20) & 0x000000FF) - { + if(pNv->Chipset == NV_CHIP_IGEFORCE2) { + int amt = pciReadLong(pciTag(0, 0, 1), 0x7C); + + chip->RamAmountKBytes = (((amt >> 6) & 31) + 1) * 1024; + } else { + switch ((chip->PFB[0x0000020C/4] >> 20) & 0x000000FF) + { case 0x02: chip->RamAmountKBytes = 1024 * 2; break; @@ -1947,6 +1973,7 @@ default: chip->RamAmountKBytes = 1024 * 16; break; + } } switch ((chip->PFB[0x00000000/4] >> 3) & 0x00000003) { @@ -1957,8 +1984,11 @@ chip->RamBandwidthKBytesPerSec = 1000000; break; } - chip->CrystalFreqKHz = (chip->PEXTDEV[0x00000000/4] & 0x00000040) ? 14318 : 13500; - chip->CURSOR = &(chip->PRAMIN[0x00010000/4 - 0x0800/4]); + chip->CrystalFreqKHz = (chip->PEXTDEV[0x0000/4] & (1 << 6)) ? 14318 : + (chip->PEXTDEV[0x0000/4] & (1 << 22)) ? 27000 : + 13500; + chip->CursorStart = (chip->RamAmountKBytes - 128) * 1024; + chip->CURSOR = NULL; /* can't set this here */ chip->CURSORPOS = &(chip->PRAMDAC[0x0300/4]); chip->VBLANKENABLE = &(chip->PCRTC[0x0140/4]); chip->VBLANK = &(chip->PCRTC[0x0100/4]); @@ -1979,9 +2009,10 @@ } int RivaGetConfig ( - RIVA_HW_INST *chip + NVPtr pNv ) { + RIVA_HW_INST *chip = &pNv->riva; /* * Save this so future SW know whats it's dealing with. */ @@ -1999,7 +2030,7 @@ break; case NV_ARCH_10: case NV_ARCH_20: - nv10GetConfig(chip); + nv10GetConfig(pNv); break; default: return (-1); Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.10 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.10 Tue Feb 20 19:42:58 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h Mon Oct 8 18:28:53 2001 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.10 2001/02/21 00:42:58 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.15 2001/10/08 22:28:53 mvojkovi Exp $ */ #ifndef __RIVA_HW_H__ #define __RIVA_HW_H__ #define RIVA_SW_VERSION 0x00010003 @@ -60,8 +60,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BB]; U032 Rop3; } RivaRop; @@ -71,8 +75,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BD]; U032 Shape; U032 reserved03[0x001]; @@ -86,8 +94,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BB]; U032 TopLeft; U032 WidthHeight; @@ -98,8 +110,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop[1]; +#endif U032 reserved01[0x0BC]; U032 Color; U032 reserved03[0x03E]; @@ -112,8 +128,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BB]; U032 TopLeftSrc; U032 TopLeftDst; @@ -125,8 +145,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop[1]; +#endif U032 reserved01[0x0BC]; U032 TopLeft; U032 WidthHeight; @@ -140,8 +164,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BB]; U032 reserved03[(0x040)-1]; U032 Color1A; @@ -202,8 +230,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BC]; U032 TextureOffset; U032 TextureFormat; @@ -228,8 +260,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BB]; U032 ColorKey; U032 TextureOffset; @@ -262,8 +298,12 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop[1]; +#endif U032 reserved01[0x0BC]; U032 Color; /* source color 0304-0307*/ U032 Reserved02[0x03e]; @@ -293,16 +333,24 @@ typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BE]; U032 Offset; } RivaSurface; typedef volatile struct { U032 reserved00[4]; +#if X_BYTE_ORDER == X_BIG_ENDIAN + U032 FifoFree; +#else U016 FifoFree; U016 Nop; +#endif U032 reserved01[0x0BD]; U032 Pitch; U032 RenderBufferOffset; @@ -336,6 +384,7 @@ U032 VBlankBit; U032 FifoFreeCount; U032 FifoEmptyCount; + U032 CursorStart; /* * Non-FIFO registers. */ @@ -360,7 +409,7 @@ * Common chip functions. */ int (*Busy)(struct _riva_hw_inst *); - void (*CalcStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *,int,int,int,int,int,int,int,int,int,int,int,int,int,int); + void (*CalcStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *,int,int,int,int,int,int); void (*LoadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *); void (*UnloadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *); void (*SetStartAddress)(struct _riva_hw_inst *,U032); @@ -393,9 +442,11 @@ U032 bpp; U032 width; U032 height; + U032 interlace; U032 repaint0; U032 repaint1; U032 screen; + U032 extra; U032 pixel; U032 horiz; U032 arbitration0; @@ -416,10 +467,7 @@ U032 pitch2; U032 pitch3; } RIVA_HW_STATE; -/* - * External routines. - */ -int RivaGetConfig(RIVA_HW_INST *); + /* * FIFO Free Count. Should attempt to yield processor if RIVA is busy. */ Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.7 Tue Feb 20 19:42:58 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h Wed Sep 19 19:40:06 2001 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.7 2001/02/21 00:42:58 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.8 2001/09/19 23:40:06 mvojkovi Exp $ */ /* @@ -844,29 +844,45 @@ {0x00000501, 0x01FFFFFF}, {0x00000502, 0x00000002}, {0x00000503, 0x00000002}, - {0x00000508, 0x01008043}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x00000508, 0x01088043}, +#else + {0x00000508, 0x01008043}, +#endif {0x0000050A, 0x00000000}, {0x0000050B, 0x00000000}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x0000050C, 0x01088019}, +#else {0x0000050C, 0x01008019}, +#endif {0x0000050E, 0x00000000}, {0x0000050F, 0x00000000}, -#if 1 - {0x00000510, 0x01008018}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x00000510, 0x01088018}, #else - {0x00000510, 0x01008044}, + {0x00000510, 0x01008018}, #endif {0x00000512, 0x00000000}, {0x00000513, 0x00000000}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x00000514, 0x01088021}, +#else {0x00000514, 0x01008021}, +#endif {0x00000516, 0x00000000}, {0x00000517, 0x00000000}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x00000518, 0x0108805F}, +#else {0x00000518, 0x0100805F}, +#endif {0x0000051A, 0x00000000}, {0x0000051B, 0x00000000}, -#if 1 - {0x0000051C, 0x0100804B}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x0000051C, 0x0108804B}, #else - {0x0000051C, 0x0100804A}, + {0x0000051C, 0x0100804B}, #endif {0x0000051E, 0x00000000}, {0x0000051F, 0x00000000}, @@ -882,10 +898,18 @@ {0x00000529, 0x00000D01}, {0x0000052A, 0x11401140}, {0x0000052B, 0x00000000}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x0000052C, 0x00080058}, +#else {0x0000052C, 0x00000058}, +#endif {0x0000052E, 0x11401140}, {0x0000052F, 0x00000000}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x00000530, 0x00080059}, +#else {0x00000530, 0x00000059}, +#endif {0x00000532, 0x11401140}, {0x00000533, 0x00000000}, {0x00000534, 0x0000005A}, @@ -897,7 +921,11 @@ {0x0000053C, 0x00000093}, {0x0000053E, 0x11401140}, {0x0000053F, 0x00000000}, +#if X_BYTE_ORDER == X_BIG_ENDIAN + {0x00000540, 0x0308A01C}, +#else {0x00000540, 0x0300A01C}, +#endif {0x00000542, 0x11401140}, {0x00000543, 0x00000000} }; Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.9 Wed May 16 02:48:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c Fri Jun 15 17:22:54 2001 @@ -3,7 +3,7 @@ * * accelerator functions for X */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.9 2001/05/16 06:48:10 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.10 2001/06/15 21:22:54 dawes Exp $ */ @@ -30,17 +30,17 @@ * defines */ -#define waitfifo(size) do { int c=0; \ - while ((c++<0xfffff)&&((verite_in8(iob+FIFOINFREE)&0x1f)<size)) /* if(!(c%0xffff))ErrorF("#1# !0x%x! -- ",verite_in8(iob+FIFOINFREE)) */; \ - if (c >= 0xfffff) { \ +#define waitfifo(size) do { int _c=0; \ + while ((_c++<0xfffff)&&((verite_in8(iob+FIFOINFREE)&0x1f)<size)) /* if(!(_c%0xffff))ErrorF("#1# !0x%x! -- ",verite_in8(iob+FIFOINFREE)) */; \ + if (_c >= 0xfffff) { \ ErrorF("RENDITION: Input fifo full (1) FIFO in == %d\n",verite_in8(iob+FIFOINFREE)&0x1f); \ return; \ } \ } while (0) -#define waitfifo2(size, rv) do { int c=0; \ - while ((c++<0xfffff)&&((verite_in8(iob+FIFOINFREE)&0x1f)<size)) /* if(!(c%0xffff))ErrorF("#2# !0x%x! -- ",verite_in8(iob+FIFOINFREE)) */; \ - if (c >= 0xfffff) { \ +#define waitfifo2(size, rv) do { int _c=0; \ + while ((_c++<0xfffff)&&((verite_in8(iob+FIFOINFREE)&0x1f)<size)) /* if(!(_c%0xffff))ErrorF("#2# !0x%x! -- ",verite_in8(iob+FIFOINFREE)) */; \ + if (_c >= 0xfffff) { \ ErrorF("RENDITION: Input fifo full (2) FIFO in ==%d\n",verite_in8(iob+FIFOINFREE)&0x1f); \ RENDITIONAccelNone(pScreenInfo); \ pRendition->board.accel=0; \ Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.42 xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.46 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.42 Wed May 16 02:48:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c Wed Nov 7 23:15:32 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.42 2001/05/16 06:48:10 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.46 2001/11/08 04:15:32 tsi Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -69,7 +69,7 @@ #undef DEBUG -#define RENDITION_NAME "Rendition" +#define RENDITION_NAME "RENDITION" #define RENDITION_DRIVER_NAME "rendition" #define RENDITION_VERSION_NAME "4.0" #define RENDITION_VERSION_MAJOR 4 @@ -130,67 +130,58 @@ }; static const char *vgahwSymbols[]={ + "vgaHWBlankScreen", + "vgaHWDPMSSet", + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", "vgaHWGetIOBase", - "vgaHWMapMem", - "vgaHWUnmapMem", + "vgaHWGetIndex", "vgaHWLock", - "vgaHWFreeHWRec", - "vgaHWSaveScreen", - "vgaHWSave", + "vgaHWMapMem", + "vgaHWProtect", "vgaHWRestore", - "vgaHWGetIndex", - "vgaHWDPMSSet", - "vgaHWBlankScreen", + "vgaHWSave", + "vgaHWSaveScreen", + "vgaHWUnlock", "vgaHWHandleColormaps", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *xaaSymbols[] = { "XAACreateInfoRec", - "XAACursorInfoRec", - "XAACursorInit", "XAADestroyInfoRec", "XAAInit", - "XAAPixmapIndex", - "XAAQueryBestSize", - "XAAReverseBitOrder", - "XAARestoreCursor", - "XAAScreenIndex", - "XAAStippleScanlineFuncMSBFirst", - "XAAGlyphScanlineFuncLSBFirst", - "XAAWarpCursor", NULL }; static const char *ddcSymbols[] = { - "xf86PrintEDID", "xf86DoEDID_DDC1", + "xf86PrintEDID", NULL }; static const char *int10Symbols[] = { + "xf86FreeInt10", "xf86InitInt10", NULL }; -static const char *fbSymbols[]={ +static const char *miscfbSymbols[]={ "xf1bppScreenInit", "xf4bppScreenInit", + NULL +}; + +static const char *fbSymbols[]={ "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif NULL }; @@ -202,6 +193,7 @@ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", NULL }; @@ -238,8 +230,8 @@ if (!Initialised) { Initialised=TRUE; xf86AddDriver(&RENDITION, Module, 0); - LoaderRefSymLists(vgahwSymbols, ramdacSymbols, fbSymbols, - xaaSymbols, ddcSymbols, int10Symbols, + LoaderRefSymLists(vgahwSymbols, ramdacSymbols, miscfbSymbols, + fbSymbols, xaaSymbols, ddcSymbols, int10Symbols, shadowfbSymbols, vbeSymbols, NULL); return (pointer)TRUE; } @@ -306,12 +298,12 @@ /* Find the config file Device sections that match this * driver, and return if there are none. */ - if ((numDevSections=xf86MatchDevice(RENDITION_NAME, &devSections)) <= 0) + if ((numDevSections=xf86MatchDevice(RENDITION_DRIVER_NAME, &devSections)) <= 0) return FALSE; /* PCI BUS */ if (xf86GetPciVideoInfo()) { - numUsed=xf86MatchPciInstances(RENDITION_NAME, PCI_VENDOR_RENDITION, + numUsed=xf86MatchPciInstances(RENDITION_DRIVER_NAME, PCI_VENDOR_RENDITION, renditionChipsets, renditionPCIchipsets, devSections, numDevSections, drv, &usedChips); @@ -563,7 +555,7 @@ if (!xf86LoadSubModule(pScreenInfo, "fb")) return FALSE; - xf86LoaderReqSymbols("fbScreenInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); /* determine colour weights */ pScreenInfo->rgbBits=8; @@ -1179,10 +1171,6 @@ if (!Inited) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - if (pScreenInfo->bitsPerPixel > 8) { /* Fixup RGB ordering */ visual=pScreen->visuals+pScreen->numVisuals; @@ -1237,6 +1225,9 @@ } } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); @@ -1520,5 +1511,6 @@ pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.12 Mon Jun 19 11:01:02 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c Sat Jun 30 18:41:48 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c,v 1.12 2000/06/19 15:01:02 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c,v 1.13 2001/06/30 22:41:48 tsi Exp $ */ /* * includes */ @@ -9,7 +9,9 @@ #include "vloaduc.h" #include "vos.h" - +#if defined(SCO) || defined(SCO325) +#define PATH_MAX 1024 +#endif /* * global data Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.7 Fri May 4 15:05:42 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h Sat Oct 27 23:33:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h,v 1.7 2001/05/04 19:05:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h,v 1.8 2001/10/28 03:33:44 tsi Exp $ */ #ifndef _VTYPES_H_ #define _VTYPES_H_ @@ -9,6 +9,7 @@ */ #include "Xmd.h" +#include "xf86Pci.h" /* @@ -158,9 +159,9 @@ */ typedef struct _renditionRec { - struct verite_board_t board; /* information on the board */ - struct verite_modeinfo_t mode; /* information on the mode */ - int pcitag; /* tag for the PCI config space */ + struct verite_board_t board; /* information on the board */ + struct verite_modeinfo_t mode; /* information on the mode */ + PCITAG pcitag; /* tag for the PCI config space */ pciVideoPtr PciInfo; /* PCI config data */ EntityInfoPtr pEnt; /* entity information */ CloseScreenProcPtr CloseScreen; /* wrap CloseScreen */ Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:1.10 Thu Feb 15 12:50:35 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c Sat Oct 27 23:33:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c,v 1.10 2001/02/15 17:50:35 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c,v 1.11 2001/10/28 03:33:44 tsi Exp $ */ /* * file vvga.c * @@ -46,6 +46,8 @@ * functions */ +#if 0 +#if defined(SAVEVGA) || defined(XSERVER) static void verite_resetvga(void) { @@ -96,8 +98,6 @@ setvgareg(0x3c4, c, mode3.seq[c]); } - - static void verite_loadvgafont(void) { @@ -149,8 +149,8 @@ /* restore the standard vga register values */ verite_resetvga(); } - - +#endif +#endif void verite_textmode(struct verite_board_t *board) Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:1.5 Thu Feb 15 12:50:35 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h Sat Oct 27 23:33:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h,v 1.5 2001/02/15 17:50:35 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h,v 1.6 2001/10/28 03:33:44 tsi Exp $ */ /* * file vvga.h * @@ -25,8 +25,12 @@ void verite_textmode(struct verite_board_t *board); void verite_savetextmode(struct verite_board_t *board); #ifdef VVGA_INTERNAL +#if 0 +#if defined(SAVEVGA) || defined(XSERVER) static void verite_resetvga(void); static void verite_loadvgafont(void); +#endif +#endif static void verite_restoretextmode(struct verite_board_t *board); static void verite_restorepalette(void); #endif Index: xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile:1.9 --- /dev/null Fri Jan 18 15:25:31 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile Fri Jul 6 03:52:01 2001 @@ -0,0 +1,60 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile,v 1.9 2001/07/06 07:52:01 keithp Exp $ */ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = s3_driver.c s3_IBMRGB.c s3_Trio64DAC.c s3_accel_newmmio.c \ + s3_accel_pio.c s3_cursor.c s3_bios.c s3_video.c s3_dga.c \ + s3_Ti.c + +OBJS = s3_driver.o s3_IBMRGB.o s3_Trio64DAC.o s3_accel_newmmio.o \ + s3_accel_pio.o s3_cursor.o s3_bios.o s3_video.o s3_dga.o \ + s3_Ti.o + +#if defined(XF86DriverSDK) +INCLUDES = -I. -I../../include +#else +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/mfb \ + -I$(XF86SRC)/xaa -I$(SERVERSRC)/cfb \ + -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ + -I$(XF86SRC)/xf24_32bpp -I$(SERVERSRC)/Xext \ + -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ + -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ + -I$(XF86SRC)/fbdevhw -I$(XF86SRC)/ddc \ + -I$(XF86SRC)/i2c -I$(XF86OSSRC)/vbe \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ + -I$(EXTINCSRC) -I$(SERVERSRC)/render +#endif + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +NormalAsmObjectRule() + +ModuleObjectRule() +ObjectModuleTarget(s3, $(OBJS)) + +InstallObjectModule(s3,$(MODULEDIR),drivers) + +DependTarget() + +ObjectFromSpecialSource(s3_accel_pio, s3_accel, -DS3_GENERIC) +ObjectFromSpecialSource(s3_accel_newmmio, s3_accel, -DS3_NEWMMIO) +SpecialCObjectRule(s3_video,$(_NOOP_), -DS3_NEWMMIO) + +InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3.h,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_reg.h,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_driver.c,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_accel.c,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_cursor.c,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_video.c,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_dga.c,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_bios.c,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_Trio64DAC.c,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_IBMRGB.c,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(s3_Ti.c,$(DRIVERSDKDIR)/drivers/s3) + Index: xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h:1.6 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h Mon Jul 2 06:46:04 2001 @@ -0,0 +1,263 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h,v 1.6 2001/07/02 10:46:04 alanh Exp $ */ + +/* + * + * Copyright 1995-1997 The XFree86 Project, Inc. + * + */ + +#ifndef _NEWMMIO_H_ +#define _NEWMMIO_H_ + +#include <Xmd.h> + + +#define int16 CARD16 +#define int32 CARD32 + +#define S3_NEWMMIO_VGABASE (S3_NEWMMIO_REGBASE + 0x8000) + +typedef struct { int16 vendor_ID; int16 device_ID; } pci_id; +typedef struct { int16 cmd; int16 devsel; } cmd_devsel; + +typedef struct { + pci_id pci_ident; + cmd_devsel cmd_device_sel; + int32 class_code; + int32 dummy5; + int32 base0; + char dummy1[0x20-sizeof(int32)]; + int32 bios_base; + char dummy2[0x3c - 0x32]; +} pci_conf_regs; + + +typedef struct { int16 filler; int16 adv_f_cntl; } adv_f_cntl; + +typedef struct { + int32 cur_point; + char dummy1[4]; + int32 dest_stp; + char dummy2[4]; + int32 err_term; + char dummy3[4]; + int32 command; + int32 short_stroke; + int32 bkgd_color; + int32 frgd_color; + int32 wrt_mask; + int32 rd_mask; + int32 color_cmp; + int32 col_mix; + int32 sciss_topleft; + int32 sciss_botright; + int32 pix_mult; + int32 mult_misc; + int32 axis_pcnt; +} packed_enhanced_regs; + +typedef struct { + int32 prim_stream_cntl; + int32 col_chroma_key_cntl; + char dummy1[0x8190 - 0x8184-sizeof(int32)]; + int32 second_stream_cntl; + int32 chroma_key_upper_bound; + int32 second_stream_stretch; + char dummy2[0x81a0 - 0x8198-sizeof(int32)]; + int32 blend_cntl; + char dummy3[0x81c0 - 0x81a0-sizeof(int32)]; + int32 prim_fbaddr0; + int32 prim_fbaddr1; + int32 prim_stream_stride; + int32 double_buffer; + int32 second_fbaddr0; + int32 second_fbaddr1; + int32 second_stream_stride; + int32 opaq_overlay_cntl; + int32 k1; + int32 k2; + int32 dda_vert; + int32 streams_fifo; + int32 prim_start_coord; + int32 prim_window_size; + int32 second_start_coord; + int32 second_window_size; +} streams_proc_regs; + +typedef struct { char atr_cntl_ind; char attr_cntl_dat; char misc_out; + char viseo_enable; } v3c0; +typedef struct { char seq_index; char seq_data; char dac_mask; + char dac_rd_index; } v3c4; +typedef struct { char dac_wr_index; char dac_data; char feature_cntl; + char filler; } v3c8; +typedef struct v3cc { char misc_out; char filler; char graph_cntl_index; + char graph_cntl_data; } v3cc; +typedef struct { + v3c0 v3c0_regs; + v3c4 v3c4_regs; + v3c8 v3c8_regs; + v3cc v3cc_regs; +} vga_3c_regs; + +typedef struct { char crt_index; char crt_data; int16 filler; } v3d4; +typedef struct { int16 filler1; char feature_cntl; char filler2;} v3d8; + +typedef struct { + int32 filler; + v3d4 v3d4_regs; + v3d8 v3d8_regs; +} vga_3bd_regs ; + +typedef struct { + int32 subsystem_csr; + int32 dummy; + adv_f_cntl adv_func_cntl; +} subsys_regs; + + +typedef struct { + int32 cur_x; + char filler1[0x8ae8 - 0x86e8 - sizeof(int32)]; + int32 dy_axstep; + char filler2[0x8ee8 - 0x8ae8 - sizeof(int32)]; + int32 dx_diastep; + char filler3[0x92e8 - 0x8ee8 - sizeof(int32)]; + int32 line_err; + char filler33[0x96e8 - 0x92e8 - sizeof(int32)]; + int32 mj_ax_pcnt; + char filler4[0x9ae8 - 0x96e8 - sizeof(int32)]; + int32 gp_stat; + char filler5[0x9ee8 - 0x9ae8 - sizeof(int32)]; + int32 stroke_vectrans; + char filler6[0xa2e8 - 0x9ee8 - sizeof(int32)]; + int32 back_color; + char filler7[0xa6e8 - 0xa2e8 - sizeof(int32)]; + int32 fore_col; + char filler8[0xaae8 - 0xa6e8 - sizeof(int32)]; + int32 bitplane_wmask; + char filler88[0xaee8 - 0xaae8 - sizeof(int32)]; + int32 bitplane_rmask; + char filler9[0xb2e8 - 0xaee8 - sizeof(int32)]; + int32 color_compare; + char filler10[0xb6e8 - 0xb2e8 - sizeof(int32)]; + int32 back_mix; + char filler101[0xbae8 - 0xb6e8 - sizeof(int32)]; + int32 fore_mix; + char filler11[0xbee8 - 0xbae8 - sizeof(int32)]; + int32 r_reg_data; + char filler12[0xe2e8 - 0xbee8 - sizeof(int32)]; + int32 pixel_data_transfer; +} enhanced_regs; + +typedef struct { + int32 lpb_mode; + int32 lpb_fifostat; + int32 lpb_intflags; + int32 lpb_fb0addr; + int32 lpb_fb1addr; + int32 lpb_direct_addr; + int32 lpb_direct_data; + int32 lpb_gpio; + int32 lpb_serial_port; + int32 lpb_input_winsize; + int32 lpb_data_offsets; + int32 lpb_hor_decimctl; + int32 lpb_vert_decimctl; + int32 lpb_line_stride; + int32 lpb_output_fifo; +} lpbus_regs; + +typedef struct { + int32 img[0x8000/4]; + union { pci_conf_regs regs; + char dummy[0x100]; + } pci_regs; + union { packed_enhanced_regs regs; + char dummy[0x80]; + } pk_enh_regs; + union { streams_proc_regs regs; + char dummy[0x82e8-0x8180]; + } streams_regs; + union { int32 cur_y; + char dummy[0x83b0 - 0x82e8]; + } cur_y; + union { vga_3bd_regs regs; + char dummy[0x83c0 - 0x83b0]; + } v3b_regs; + union { vga_3c_regs regs; + char dummy[0x83d0 - 0x83c0]; + } v3c_regs; + union { vga_3bd_regs regs; + char dummy[0x8504 - 0x83d0]; + } v3d_regs; + union { subsys_regs regs; + char dummy[0x86e8 - 0x8504]; + } subs_regs; + union { enhanced_regs regs; + char dummy[0xff00 - 0x86e8]; + } enh_regs; + union { lpbus_regs regs; + char dummy[0xff5c - 0xff00]; + } lbp_regs; +} mm_trio_regs ; + +#define mmtr volatile mm_trio_regs * + +#define s3MmioMem (pS3->MMIOBase) + +#define IMG_TRANS (((mmtr)s3MmioMem)->img) + +#define SET_WRT_MASK(msk) ((mmtr)s3MmioMem)->pk_enh_regs.regs.wrt_mask = (msk) +#define SET_RD_MASK(msk) ((mmtr)s3MmioMem)->pk_enh_regs.regs.rd_mask = (msk) +#define SET_FRGD_COLOR(col) ((mmtr)s3MmioMem)->pk_enh_regs.regs.frgd_color = (col) +#define SET_BKGD_COLOR(col) ((mmtr)s3MmioMem)->pk_enh_regs.regs.bkgd_color = (col) +#define SET_COLOR_CMP(col) ((mmtr)s3MmioMem)->pk_enh_regs.regs.color_cmp = (col) +#define SET_FRGD_MIX(fmix) ((mmtr)s3MmioMem)->enh_regs.regs.fore_mix = (fmix) +#define SET_BKGD_MIX(bmix) ((mmtr)s3MmioMem)->enh_regs.regs.back_mix = (bmix) +#define SET_PIX_CNTL(val) ((mmtr)s3MmioMem)->pk_enh_regs.regs.pix_mult = (val) | (MULT_MISC2 << 16) +#define SET_MIN_AXIS_PCNT(min) ((mmtr)s3MmioMem)->enh_regs.regs.r_reg_data = (min) & 0xffff +#define SET_MAJ_AXIS_PCNT(maj) ((mmtr)s3MmioMem)->enh_regs.regs.mj_ax_pcnt = (maj) +#define SET_CURPT(c_x, c_y) ((mmtr)s3MmioMem)->pk_enh_regs.regs.cur_point = ((c_y)&0xffff) | ((c_x) << 16) +#define SET_CUR_X(c_x) ((mmtr)s3MmioMem)->enh_regs.regs.cur_x = (c_x) +#define SET_CUR_Y(c_y) ((mmtr)s3MmioMem)->cur_y.cur_y = (c_y) +#define SET_DESTSTP(x,y) ((mmtr)s3MmioMem)->pk_enh_regs.regs.dest_stp = ((y)&0xffff) | ((x) << 16) +#define SET_AXIS_PCNT(maj, min) ((mmtr)s3MmioMem)->pk_enh_regs.regs.axis_pcnt = ((min)&0xffff) | ((maj) << 16) +#define SET_CMD(c_d) { mem_barrier(); ((mmtr)s3MmioMem)->pk_enh_regs.regs.command = (c_d); } +#define SET_ERR_TERM(e) ((mmtr)s3MmioMem)->pk_enh_regs.regs.err_term = (e) +#define SET_SCISSORS(x1,y1,x2,y2) {\ + ((mmtr)s3MmioMem)->pk_enh_regs.regs.sciss_topleft = ((y1)&0xffff) | ((x1) << 16);\ + ((mmtr)s3MmioMem)->pk_enh_regs.regs.sciss_botright = ((y2)&0xffff) | ((x2) << 16);\ + } +#define SET_SCISSORS_RB(x,y) ((mmtr)s3MmioMem)->pk_enh_regs.regs.sciss_botright = ((y)&0xffff) | ((x) << 16) +#define SET_SCISSORS_L(l) ((mmtr)s3MmioMem)->pk_enh_regs.regs.sciss_topleft = ((l) << 16); +#define SET_MULT_MISC(val) ((mmtr)s3MmioMem)->pk_enh_regs.regs.mult_misc = (val) + + +/* + * reads from GP_STAT + */ +#if !defined(__alpha__) +#define INB_GP_STAT() ((((mmtr)s3MmioMem)->enh_regs.regs.gp_stat) & 0xff) +#define INW_GP_STAT() ((((mmtr)s3MmioMem)->enh_regs.regs.gp_stat)) +#else +#define INB_GP_STAT() inb(GP_STAT) +#define INW_GP_STAT() inw(GP_STAT) +#endif + +#define SET_PIX_TRANS_L(val) ((mmtr)s3MmioMem)->img[0] = (val) +#define SET_MIX(b,f) ((mmtr)s3MmioMem)->pk_enh_regs.regs.col_mix = ((b) << 16) | (f) + + +#define WaitQueue(v) \ + if(!(pS3->PCIRetry)) { \ + mem_barrier(); \ + while(inb(GP_STAT) & (0x0100 >> (v))); \ + } + +#define CMD_REG_WIDTH 0x200 /* select 32bit command register */ + +#define WaitQueue16_32(n16,n32) \ + if((pS3->s3Bpp) <= 2) { WaitQueue(n16); } \ + else { WaitQueue(n32); } + +#endif /* _NEWMMIO_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h:1.14 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h Fri Sep 28 03:45:21 2001 @@ -0,0 +1,245 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h,v 1.14 2001/09/28 07:45:21 alanh Exp $ */ + + +#ifndef _S3_H +#define _S3_H + +#include "xf86.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xf86RamDac.h" +#include "xaa.h" +#include "vbe.h" +#include "xf86_ansic.h" +#include "vgaHW.h" + + +#include "xf86xv.h" +#include "Xv.h" +#include "fourcc.h" + + +#ifndef S3_USEFB +#define PSZ 8 +#include "cfb.h" +#undef PSZ +#include "cfb16.h" +#include "cfb24.h" +#include "cfb32.h" +#endif + +typedef struct _S3RegRec { + unsigned char cr31, cr32, cr33, cr34, cr3a, cr3b, cr3c; + unsigned char cr3b2, cr3c2; + unsigned char cr40, cr42, cr43, cr44, cr45; + unsigned char cr50, cr51, cr53, cr54, cr55, cr58, cr59, cr5a, + cr5d, cr5e; + unsigned char cr60, cr61, cr62, cr65, cr66, cr67, cr6d; + unsigned char s3save[10]; + unsigned char s3syssave[46]; + unsigned char dacregs[0x101]; + unsigned char color_stack[8]; + unsigned char clock; +} S3RegRec, *S3RegPtr; + + +typedef struct { + unsigned char brightness; + unsigned char contrast; + FBAreaPtr area; + RegionRec clip; + CARD32 colorKey; + CARD32 videoStatus; + Time offTime; + Time freeTime; + int lastPort; +} S3PortPrivRec, *S3PortPrivPtr; + + +typedef struct { + int bitsPerPixel; + int depth; + int displayWidth; + int pixel_code; + int pixel_bytes; + DisplayModePtr mode; +} S3FBLayout; + + +typedef struct _S3Rec { + pciVideoPtr PciInfo; + PCITAG PciTag; + EntityInfoPtr pEnt; + CARD32 IOAddress; + CARD32 FBAddress; + unsigned char * FBBase; + unsigned char * MMIOBase; + unsigned long videoRam; + OptionInfoPtr Options; + unsigned int Flags; + Bool NoAccel; + Bool SWCursor; + Bool SlowDRAMRefresh; + Bool SlowDRAM; + Bool SlowEDODRAM; + Bool SlowVRAM; + Bool S3NewMMIO; + Bool PCIRetry; + Bool ColorExpandBug; + + XAAInfoRecPtr pXAA; + xf86CursorInfoPtr pCurs; + xf86Int10InfoPtr pInt10; + vbeInfoPtr pVBE; + XF86VideoAdaptorPtr adaptor; + S3PortPrivPtr portPrivate; + + DGAModePtr DGAModes; + int numDGAModes; + Bool DGAactive; + int DGAViewportStatus; + + S3FBLayout CurrentLayout; + + RamDacHelperRecPtr RamDac; + RamDacRecPtr RamDacRec; + + int vgaCRIndex, vgaCRReg; + + int s3Bpp, s3BppDisplayWidth, HDisplay; + int mclk, MaxClock; + int pixMuxShift; + + int Chipset, ChipRev; + int RefClock; + + int s3ScissB, s3ScissR; + unsigned short BltDir; + int trans_color; + int FBCursorOffset; + + S3RegRec SavedRegs; + S3RegRec ModeRegs; + + unsigned char SAM256; + + void (*DacPreInit)(ScrnInfoPtr pScrn); + void (*DacInit)(ScrnInfoPtr pScrn, + DisplayModePtr mode); + void (*DacSave)(ScrnInfoPtr pScrn); + void (*DacRestore)(ScrnInfoPtr pScrn); + Bool (*CursorInit)(ScreenPtr pScreen); + + void (*LoadPalette)(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, + VisualPtr pVisual); + + Bool (*CloseScreen)(int, ScreenPtr); + + unsigned char *imageBuffer; + int imageWidth; + int imageHeight; +} S3Rec, *S3Ptr; + +#define S3PTR(p) ((S3Ptr)((p)->driverPrivate)) + + +#define DRIVER_NAME "s3" +#define DRIVER_VERSION "0.3.5" +#define VERSION_MAJOR 0 +#define VERSION_MINOR 3 +#define PATCHLEVEL 5 +#define S3_VERSION ((VERSION_MAJOR << 24) | \ + (VERSION_MINOR << 16) | PATCHLEVEL) + + + + +/* + * Prototypes + */ + +Bool S3AccelInit(ScreenPtr pScreen); +Bool S3AccelInitNewMMIO(ScreenPtr pScreen); +Bool S3AccelInitPIO(ScreenPtr pScreen); +Bool S3DGAInit(ScreenPtr pScreen); +Bool S3SwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +int S3GetRefClock(ScrnInfoPtr pScrn); + +void S3InitVideo(ScreenPtr pScreen); +void S3InitStreams(ScrnInfoPtr pScrn, DisplayModePtr mode); + +/* IBMRGB */ +extern RamDacSupportedInfoRec IBMRamdacs[]; +Bool S3ProbeIBMramdac(ScrnInfoPtr pScrn); +void S3IBMRGB_PreInit(ScrnInfoPtr pScrn); +void S3IBMRGB_Init(ScrnInfoPtr pScrn, DisplayModePtr mode); +void S3IBMRGB_Save(ScrnInfoPtr pScrn); +void S3IBMRGB_Restore(ScrnInfoPtr pScrn); +Bool S3IBMRGB_CursorInit(ScreenPtr pScreen); + +/* TRIO64 */ +Bool S3Trio64DACProbe(ScrnInfoPtr pScrn); +void S3Trio64DAC_PreInit(ScrnInfoPtr pScrn); +void S3Trio64DAC_Init(ScrnInfoPtr pScrn, DisplayModePtr mode); +void S3Trio64DAC_Save(ScrnInfoPtr pScrn); +void S3Trio64DAC_Restore(ScrnInfoPtr pScrn); + +/* Ti */ +Bool S3TiDACProbe(ScrnInfoPtr pScrn); +void S3TiDAC_PreInit(ScrnInfoPtr pScrn); +void S3TiDAC_Init(ScrnInfoPtr pScrn, DisplayModePtr mode); +void S3TiDAC_Save(ScrnInfoPtr pScrn); +void S3TiDAC_Restore(ScrnInfoPtr pScrn); +void S3TiLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, + VisualPtr pVisual); +Bool S3Ti_CursorInit(ScreenPtr pScreen); +void S3OutTiIndReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char mask, + unsigned char data); + +/* s3 gen cursor */ +Bool S3_CursorInit(ScreenPtr pScreen); + +#define TRIO64_RAMDAC 0x8811 +#define TI3025_RAMDAC 0x3025 +#define TI3020_RAMDAC 0x3020 + +#define BIOS_BSIZE 1024 +#define BIOS_BASE 0xc0000 + +/* + * Chip...Sets... + */ + +#define S3_964_SERIES() ((pS3->Chipset == PCI_CHIP_964_0) || \ + (pS3->Chipset == PCI_CHIP_964_1)) +#define S3_TRIO_SERIES() ((pS3->Chipset == PCI_CHIP_TRIO) || \ + (pS3->Chipset == PCI_CHIP_AURORA64VP)) + +#endif /* _S3_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c:1.3 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c Sat Oct 27 23:33:44 2001 @@ -0,0 +1,544 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c,v 1.3 2001/10/28 03:33:44 tsi Exp $ */ + + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "compiler.h" + +#include "IBM.h" + +#include "s3.h" + + +#define IBMRGB_WRITE_ADDR 0x3C8 /* CR55 low bit == 0 */ +#define IBMRGB_RAMDAC_DATA 0x3C9 /* CR55 low bit == 0 */ +#define IBMRGB_PIXEL_MASK 0x3C6 /* CR55 low bit == 0 */ +#define IBMRGB_READ_ADDR 0x3C7 /* CR55 low bit == 0 */ +#define IBMRGB_INDEX_LOW 0x3C8 /* CR55 low bit == 1 */ +#define IBMRGB_INDEX_HIGH 0x3C9 /* CR55 low bit == 1 */ +#define IBMRGB_INDEX_DATA 0x3C6 /* CR55 low bit == 1 */ +#define IBMRGB_INDEX_CONTROL 0x3C7 /* CR55 low bit == 1 */ + + +void S3OutIBMRGBIndReg(ScrnInfoPtr pScrn, CARD32 reg, + unsigned char mask, unsigned char data) +{ + S3Ptr pS3 = S3PTR(pScrn); + unsigned char tmp, tmp2 = 0x00; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xfc; + outb(vgaCRReg, tmp | 0x01); + + outb(IBMRGB_INDEX_LOW, reg); + + if (mask != 0x00) + tmp2 = inb(IBMRGB_INDEX_DATA) & mask; + outb(IBMRGB_INDEX_DATA, tmp2 | data); + + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, tmp); +} + + +unsigned char S3InIBMRGBIndReg(ScrnInfoPtr pScrn, CARD32 reg) +{ + S3Ptr pS3 = S3PTR(pScrn); + unsigned char tmp, ret; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xfc; + outb(vgaCRReg, tmp | 0x01); + + outb(IBMRGB_INDEX_LOW, reg); + ret = inb(IBMRGB_INDEX_DATA); + + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, tmp); + + return ret; +} + + +void S3IBMWriteAddress(ScrnInfoPtr pScrn, CARD32 index) +{ + outb(IBMRGB_WRITE_ADDR, index); +} + +void S3IBMWriteData(ScrnInfoPtr pScrn, unsigned char data) +{ + outb(IBMRGB_INDEX_DATA, data); +} + +void S3IBMReadAddress(ScrnInfoPtr pScrn, CARD32 index) +{ + outb(IBMRGB_READ_ADDR, index); +} + +unsigned char S3IBMReadData(ScrnInfoPtr pScrn) +{ + return inb(IBMRGB_RAMDAC_DATA); +} + + +Bool S3ProbeIBMramdac(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + + if (pS3->Chipset != PCI_CHIP_968) + return FALSE; + + pS3->RamDacRec = RamDacCreateInfoRec(); + pS3->RamDacRec->ReadDAC = S3InIBMRGBIndReg; + pS3->RamDacRec->WriteDAC = S3OutIBMRGBIndReg; + pS3->RamDacRec->ReadAddress = S3IBMReadAddress; + pS3->RamDacRec->WriteAddress = S3IBMWriteAddress; + pS3->RamDacRec->ReadData = S3IBMReadData; + pS3->RamDacRec->WriteData = S3IBMWriteData; + pS3->RamDacRec->LoadPalette = NULL; + + if (!RamDacInit(pScrn, pS3->RamDacRec)) { + RamDacDestroyInfoRec(pS3->RamDacRec); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "RamDacInit failed\n"); + return FALSE; + } + + pS3->RamDac = IBMramdacProbe(pScrn, IBMRamdacs); + if (pS3->RamDac) + return TRUE; + + return FALSE; +} + +void S3ProgramIBMRGBClock(ScrnInfoPtr pScrn, int clk, unsigned char m, + unsigned char n, unsigned char df) +{ + S3OutIBMRGBIndReg(pScrn, IBMRGB_misc_clock, ~1, 1); + + S3OutIBMRGBIndReg(pScrn, IBMRGB_m0+2*clk, 0, (df<<6)|(m&0x3f)); + S3OutIBMRGBIndReg(pScrn, IBMRGB_n0+2*clk, 0, n); + + S3OutIBMRGBIndReg(pScrn, IBMRGB_pll_ctrl2, 0xf0, clk); + S3OutIBMRGBIndReg(pScrn, IBMRGB_pll_ctrl1, 0xf8, 3); +} + + +void S3IBMRGBSetClock(ScrnInfoPtr pScrn, long freq, int clk, long dacspeed, + long fref) +{ + volatile double ffreq, fdacspeed, ffref; + volatile int df, n, m, max_n, min_df; + volatile int best_m=69, best_n=17, best_df=0; + volatile double diff, mindiff; + +#define FREQ_MIN 16250 +#define FREQ_MAX dacspeed + + if (freq < FREQ_MIN) + ffreq = FREQ_MIN / 1000.0; + else if (freq > FREQ_MAX) + ffreq = FREQ_MAX / 1000.0; + else + ffreq = freq / 1000.0; + + fdacspeed = dacspeed / 1e3; + ffref = fref / 1e3; + + ffreq /= ffref; + ffreq *= 16; + mindiff = ffreq; + + if (freq <= dacspeed/4) + min_df = 0; + else if (freq <= dacspeed/2) + min_df = 1; + else + min_df = 2; + + for (df=0; df<4; df++) { + ffreq /= 2; + mindiff /= 2; + if (df < min_df) + continue; + + if (df < 3) + max_n = fref / 1000 / 2; + else + max_n = fref / 1000; + if (max_n > 31) + max_n = 31; + + for (n=2; n <= max_n; n++) { + m = (int)(ffreq * n + 0.5) - 65; + if (m < 0) + m = 0; + else if (m > 63) + m = 63; + diff = (m+65.0)/n-ffreq; + if (diff < 0) + diff = -diff; + if (diff < mindiff) { + mindiff = diff; + best_n = n; + best_m = m; + best_df = df; + } + } + } + + S3ProgramIBMRGBClock(pScrn, clk, best_m, best_n, best_df); +} + +void S3IBMRGB_Restore(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr restore = &pS3->SavedRegs; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + int i; + + for(i=0; i<0x100; i++) + S3OutIBMRGBIndReg(pScrn, i, 0, restore->dacregs[i]); + + outb(vgaCRIndex, 0x22); + outb(vgaCRReg, restore->dacregs[0x100]); +} + + +void S3IBMRGB_Save(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr save = &pS3->SavedRegs; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + int i; + + for (i=0; i<0x100; i++) + save->dacregs[i] = S3InIBMRGBIndReg(pScrn, i); + + outb(vgaCRIndex, 0x22); + save->dacregs[0x100] = inb(vgaCRReg); +} + + +void S3IBMRGB_PreInit(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char cr55, tmp; + + outb(vgaCRIndex, 0x43); + tmp = inb(vgaCRReg); + outb(vgaCRReg, tmp & ~0x02); + + outb(vgaCRIndex, 0x55); + cr55 = inb(vgaCRReg); + outb(vgaCRReg, (cr55 & ~0x03) | 0x01); /* set rs2 */ + + tmp = inb(IBMRGB_INDEX_CONTROL); + outb(IBMRGB_INDEX_CONTROL, tmp & ~1); + outb(IBMRGB_INDEX_HIGH, 0); + + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, cr55 & ~0x03); + + { + int m, n, df, mclk=0; + + m = S3InIBMRGBIndReg(pScrn, IBMRGB_sysclk_vco_div); + n = S3InIBMRGBIndReg(pScrn, IBMRGB_sysclk_ref_div) & 0x1f; + df = m >> 6; + m &= 0x3f; + if (!n) { + m = 0; + n = 1; + } + mclk = ((pS3->RefClock*100 * (m+65)) / n / (8 >> df) + 50) / 100; + pS3->mclk = mclk; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MCLK %1.3f MHz\n", + mclk / 1000.0); + } +} + + +void S3IBMRGB_Init(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + S3Ptr pS3 = S3PTR(pScrn); + unsigned char tmp, blank; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + S3IBMRGBSetClock(pScrn, mode->Clock, 2, pS3->MaxClock, + pS3->RefClock); + + outb(0x3c4, 1); + blank = inb(0x3c5); + outb(0x3c5, blank | 0x20); + + S3OutIBMRGBIndReg(pScrn, IBMRGB_misc_clock, 0xf0, 0x03); + S3OutIBMRGBIndReg(pScrn, IBMRGB_sync, 0, 0); + S3OutIBMRGBIndReg(pScrn, IBMRGB_hsync_pos, 0, 0); + S3OutIBMRGBIndReg(pScrn, IBMRGB_pwr_mgmt, 0, 0); + S3OutIBMRGBIndReg(pScrn, IBMRGB_dac_op, ~8, 0); + S3OutIBMRGBIndReg(pScrn, IBMRGB_dac_op, ~2, 2); + S3OutIBMRGBIndReg(pScrn, IBMRGB_pal_ctrl, 0, 0); + S3OutIBMRGBIndReg(pScrn, IBMRGB_misc1, ~0x43, 1); + S3OutIBMRGBIndReg(pScrn, IBMRGB_misc2, 0, 0x47); + + outb(vgaCRIndex, 0x22); + tmp = inb(vgaCRReg); + if (pS3->s3Bpp == 1) + outb(vgaCRReg, tmp | 8); + else + outb(vgaCRReg, tmp & ~8); + + outb(vgaCRIndex, 0x65); + outb(vgaCRReg, 0x00); /* ! 528 */ + + outb(vgaCRIndex, 0x40); + outb(vgaCRReg, 0x11); + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, 0x00); + + switch (pScrn->depth) { + case 8: + S3OutIBMRGBIndReg(pScrn, IBMRGB_pix_fmt, 0xf8, 3); + S3OutIBMRGBIndReg(pScrn, IBMRGB_8bpp, 0, 0); + break; + case 15: + S3OutIBMRGBIndReg(pScrn, IBMRGB_pix_fmt, 0xf8, 4); + S3OutIBMRGBIndReg(pScrn, IBMRGB_16bpp, 0, 0xc0); + break; + case 16: + S3OutIBMRGBIndReg(pScrn, IBMRGB_pix_fmt, 0xf8, 4); + S3OutIBMRGBIndReg(pScrn, IBMRGB_16bpp, 0, 0xc2); + break; + } + + outb(vgaCRIndex, 0x66); + tmp = inb(vgaCRReg) & 0xf8; + outb(vgaCRReg, tmp); + + outb(vgaCRIndex, 0x58); + tmp = (inb(vgaCRReg) & 0xbf) | 0x40; + outb(vgaCRReg, tmp); + + outb(vgaCRIndex, 0x67); + outb(vgaCRReg, 0x11); + + switch (pScrn->bitsPerPixel) { + case 8: + tmp = 0x21; + break; + case 16: + tmp = 0x10; + break; + } + outb(vgaCRIndex, 0x6d); + outb(vgaCRReg, tmp); + + outb(0x3c4, 1); + outb(0x3c5, blank); +} + + +/* hardware cursor */ + +static void S3IBMRGBSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xfc; + outb(vgaCRReg, tmp | 0x01); + + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_col1_r); + outb(IBMRGB_INDEX_DATA, (bg & 0x00ff0000) >> 16); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_col1_g); + outb(IBMRGB_INDEX_DATA, (bg & 0x0000ff00) >> 8); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_col1_b); + outb(IBMRGB_INDEX_DATA, (bg & 0x000000ff)); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_col2_r); + outb(IBMRGB_INDEX_DATA, (fg & 0x00ff0000) >> 16); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_col2_g); + outb(IBMRGB_INDEX_DATA, (fg & 0x0000ff00) >> 8); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_col2_b); + outb(IBMRGB_INDEX_DATA, (fg & 0x000000ff)); + + outb(vgaCRReg, tmp); +} + + +static void S3IBMRGBSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xfc; + outb(vgaCRReg, tmp | 0x01); + + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_xl); + outb(IBMRGB_INDEX_DATA, x); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_xh); + outb(IBMRGB_INDEX_DATA, x >> 8); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_yl); + outb(IBMRGB_INDEX_DATA, y); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_yh); + outb(IBMRGB_INDEX_DATA, y >> 8); + + outb(vgaCRReg, tmp); +} + + +static void S3IBMRGBHideCursor(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + S3OutIBMRGBIndReg(pScrn, IBMRGB_curs, ~3, 0x00); +} + + +static void S3IBMRGBShowCursor(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x55); + tmp = (inb(vgaCRReg) & 0xdf) | 0x20; + outb(vgaCRReg, tmp); + + outb(vgaCRIndex, 0x45); + tmp = inb(vgaCRReg) & ~0x20; + outb(vgaCRReg, tmp); + + S3OutIBMRGBIndReg(pScrn, IBMRGB_curs, 0, 0x27); +} + + +static void S3IBMRGBLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp, tmp2; + register int i; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xfc; + outb(vgaCRReg, tmp | 0x01); + + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_hot_x); + outb(IBMRGB_INDEX_DATA, 0); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_hot_y); + outb(IBMRGB_INDEX_DATA, 0); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_xl); + outb(IBMRGB_INDEX_DATA, 0xff); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_xh); + outb(IBMRGB_INDEX_DATA, 0x7f); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_yl); + outb(IBMRGB_INDEX_DATA, 0xff); + outb(IBMRGB_INDEX_LOW, IBMRGB_curs_yh); + outb(IBMRGB_INDEX_DATA, 0x7f); + + tmp2 = inb(IBMRGB_INDEX_CONTROL) & 0xfe; + outb(IBMRGB_INDEX_CONTROL, tmp2 | 1); /* enable auto increment */ + + outb(IBMRGB_INDEX_HIGH, (unsigned char) (IBMRGB_curs_array >> 8)); + outb(IBMRGB_INDEX_LOW, (unsigned char) (IBMRGB_curs_array)); + + for (i=0; i<1024; i++) + outb(IBMRGB_INDEX_DATA, *image++); + + outb(IBMRGB_INDEX_HIGH, 0); + outb(IBMRGB_INDEX_CONTROL, tmp2); /* disable auto increment */ + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, tmp); +} + + +static Bool S3IBMRGBUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) +{ + return TRUE; +} + + +Bool S3IBMRGB_CursorInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + xf86CursorInfoPtr pCurs; + + if (!(pCurs = pS3->pCurs = xf86CreateCursorInfoRec())) + return FALSE; + + pCurs->MaxWidth = 64; + pCurs->MaxHeight = 64; + pCurs->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 | + HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | + HARDWARE_CURSOR_NIBBLE_SWAPPED | + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST; + + pCurs->SetCursorColors = S3IBMRGBSetCursorColors; + pCurs->SetCursorPosition = S3IBMRGBSetCursorPosition; + pCurs->LoadCursorImage = S3IBMRGBLoadCursorImage; + pCurs->HideCursor = S3IBMRGBHideCursor; + pCurs->ShowCursor = S3IBMRGBShowCursor; + pCurs->UseHWCursor = S3IBMRGBUseHWCursor; + + return xf86InitCursor(pScreen, pCurs); +} + + Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c:1.4 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c Sat Oct 27 23:33:44 2001 @@ -0,0 +1,753 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c,v 1.4 2001/10/28 03:33:44 tsi Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "compiler.h" + +#include "TI.h" + +#include "s3.h" + + +#define TI_WRITE_ADDR 0x3C8 /* CR55 low bit == 0 */ +#define TI_RAMDAC_DATA 0x3C9 /* CR55 low bit == 0 */ +#define TI_PIXEL_MASK 0x3C6 /* CR55 low bit == 0 */ +#define TI_READ_ADDR 0x3C7 /* CR55 low bit == 0 */ +#define TI_INDEX_REG 0x3C6 /* CR55 low bit == 1 */ +#define TI_DATA_REG 0x3C7 /* CR55 low bit == 1 */ + +#define TIDAC_output_clock_select 0x1b +#define TIDAC_auxiliary_ctrl 0x29 +#define TIDAC_general_io_ctrl 0x2a +#define TIDAC_general_io_data 0x2b +#define TIDAC_cursor_color_0_red 0x23 +#define TIDAC_cursor_color_0_green 0x24 +#define TIDAC_cursor_color_0_blue 0x25 +#define TIDAC_cursor_color_1_red 0x26 +#define TIDAC_cursor_color_1_green 0x27 +#define TIDAC_cursor_color_1_blue 0x28 +#define TIDAC_cursor_x_low 0x00 +#define TIDAC_cursor_x_high 0x01 +#define TIDAC_cursor_y_low 0x02 +#define TIDAC_cursor_y_high 0x03 +#define TIDAC_cursor_ram_addr_low 0x08 +#define TIDAC_cursor_ram_addr_high 0x09 +#define TIDAC_cursor_ram_data 0x0a + + +#define TI_REF_FREQ 14.31818 /* 3025 only */ + +#undef FREQ_MIN +#define FREQ_MIN 12000 +#define FREQ_MAX 220000 + + + +void S3OutTiIndReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char mask, + unsigned char data) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp, tmp1, tmp2 = 0x00; + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xfc; + outb(vgaCRReg, tmp | 0x01); + tmp1 = inb(TI_INDEX_REG); + outb(TI_INDEX_REG, reg); + + if (mask != 0x00) + tmp2 = inb(TI_DATA_REG) & mask; + outb(TI_DATA_REG, tmp2 | data); + + outb(TI_INDEX_REG, tmp1); + outb(vgaCRReg, tmp); +} + + +unsigned char S3InTiIndReg(ScrnInfoPtr pScrn, CARD32 reg) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp, tmp1, ret; + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xfc; + outb(vgaCRReg, tmp | 0x01); + tmp1 = inb(TI_INDEX_REG); + outb(TI_INDEX_REG, reg); + + ret = inb(TI_DATA_REG); + + outb(TI_INDEX_REG, tmp1); + outb(vgaCRReg, tmp); + + return ret; +} + + +Bool S3TiDACProbe(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int found = 0; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char cr55, cr45, cr43, cr5c; + unsigned char TIndx, TIndx2, TIdata; + + if (!S3_964_SERIES()) + return FALSE; + + outb(vgaCRIndex, 0x43); + cr43 = inb(vgaCRReg); + outb(vgaCRReg, cr43 & ~0x02); + + outb(vgaCRIndex, 0x45); + cr45 = inb(vgaCRReg); + + outb(vgaCRIndex, 0x55); + cr55 = inb(vgaCRReg); + outb(vgaCRReg, (cr55 & 0xfc) | 0x01); + + TIndx = inb(TI_INDEX_REG); + outb(TI_INDEX_REG, TIDAC_id); + if(inb(TI_DATA_REG) == 0x20) { + found = TI3020_RAMDAC; + cr43 &= ~0x02; + cr45 &= ~0x20; + } else { + outb(vgaCRIndex, 0x5c); + cr5c = inb(vgaCRReg); + outb(vgaCRReg, cr5c & 0xdf); + TIndx2 = inb(TI_INDEX_REG); + outb(TI_INDEX_REG, TIDAC_ind_curs_ctrl); + TIdata = inb(TI_DATA_REG); + outb(TI_DATA_REG, TIdata & 0x7f); + + outb(TI_INDEX_REG, TIDAC_id); + if (inb(TI_DATA_REG) == 0x25) { + found = TI3025_RAMDAC; + cr43 &= ~0x02; + cr45 &= ~0x20; + } + + outb(TI_INDEX_REG, TIDAC_ind_curs_ctrl); + outb(TI_DATA_REG, TIdata); + outb(TI_INDEX_REG, TIndx2); + outb(vgaCRIndex, 0x5c); + outb(vgaCRReg, cr5c); + } + + outb(TI_INDEX_REG, TIndx); + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, cr55); + + outb(vgaCRIndex, 0x45); + outb(vgaCRReg, cr45); + + outb(vgaCRIndex, 0x43); + outb(vgaCRReg, cr43); + + if (found) { + RamDacInit(pScrn, pS3->RamDacRec); + pS3->RamDac = RamDacHelperCreateInfoRec(); + pS3->RamDac->RamDacType = found; + return TRUE; + } + + return FALSE; +} + + +void S3TiDAC_Save(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr save = &pS3->SavedRegs; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) { + unsigned char cr5c; + + outb(vgaCRIndex, 0x5c); + cr5c = inb(vgaCRReg); + outb(vgaCRReg, cr5c & 0xdf); + + save->dacregs[TIDAC_ind_curs_ctrl] = + S3InTiIndReg(pScrn, TIDAC_ind_curs_ctrl); + S3OutTiIndReg(pScrn, TIDAC_ind_curs_ctrl, 0x7f, 0x00); + } + + save->dacregs[TIDAC_true_color_ctrl] = + S3InTiIndReg(pScrn, TIDAC_true_color_ctrl); + save->dacregs[TIDAC_multiplex_ctrl] = + S3InTiIndReg(pScrn, TIDAC_multiplex_ctrl); + save->dacregs[TIDAC_clock_select] = + S3InTiIndReg(pScrn, TIDAC_clock_select); + save->dacregs[TIDAC_output_clock_select] = + S3InTiIndReg(pScrn, TIDAC_output_clock_select); + save->dacregs[TIDAC_general_ctrl] = + S3InTiIndReg(pScrn, TIDAC_general_ctrl); + save->dacregs[TIDAC_auxiliary_ctrl] = + S3InTiIndReg(pScrn, TIDAC_auxiliary_ctrl); + S3OutTiIndReg(pScrn, TIDAC_general_io_ctrl, 0x00, 0x1f); + save->dacregs[TIDAC_general_io_data] = + S3InTiIndReg(pScrn, TIDAC_general_io_data); + + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) { + save->dacregs[0x0e] = S3InTiIndReg(pScrn, 0x0e); + save->dacregs[TIDAC_misc_ctrl] = + S3InTiIndReg(pScrn, TIDAC_misc_ctrl); + S3OutTiIndReg(pScrn, TIDAC_pll_addr, 0x00, 0x00); + save->dacregs[0x40] = S3InTiIndReg(pScrn, TIDAC_pll_pixel_data); + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, + save->dacregs[0x40]); + save->dacregs[0x41] = S3InTiIndReg(pScrn, TIDAC_pll_pixel_data); + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, + save->dacregs[0x41]); + save->dacregs[0x42] = S3InTiIndReg(pScrn, TIDAC_pll_pixel_data); + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, + save->dacregs[0x42]); + save->dacregs[0x43] = S3InTiIndReg(pScrn, TIDAC_pll_memory_data); + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, + save->dacregs[0x43]); + save->dacregs[0x44] = S3InTiIndReg(pScrn, TIDAC_pll_memory_data); + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, + save->dacregs[0x44]); + save->dacregs[0x45] = S3InTiIndReg(pScrn, TIDAC_pll_memory_data); + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, + save->dacregs[0x45]); + save->dacregs[0x46] = S3InTiIndReg(pScrn, TIDAC_pll_loop_data); + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, + save->dacregs[0x46]); + save->dacregs[0x47] = S3InTiIndReg(pScrn, TIDAC_pll_loop_data); + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, + save->dacregs[0x47]); + save->dacregs[0x48] = S3InTiIndReg(pScrn, TIDAC_pll_loop_data); + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, + save->dacregs[0x48]); + } +} + + +void S3TiDAC_Restore(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr restore = &pS3->SavedRegs; + + S3OutTiIndReg(pScrn, TIDAC_true_color_ctrl, 0x00, + restore->dacregs[TIDAC_true_color_ctrl]); + S3OutTiIndReg(pScrn, TIDAC_multiplex_ctrl, 0x00, + restore->dacregs[TIDAC_multiplex_ctrl]); + S3OutTiIndReg(pScrn, TIDAC_clock_select, 0x00, + restore->dacregs[TIDAC_clock_select]); + S3OutTiIndReg(pScrn, TIDAC_output_clock_select, 0x00, + restore->dacregs[TIDAC_output_clock_select]); + S3OutTiIndReg(pScrn, TIDAC_general_ctrl, 0x00, + restore->dacregs[TIDAC_general_ctrl]); + S3OutTiIndReg(pScrn, TIDAC_auxiliary_ctrl, 0x00, + restore->dacregs[TIDAC_auxiliary_ctrl]); + S3OutTiIndReg(pScrn, TIDAC_general_io_ctrl, 0x00, 0x1f); + S3OutTiIndReg(pScrn, TIDAC_general_io_data, 0x00, + restore->dacregs[TIDAC_general_io_data]); + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) { + S3OutTiIndReg(pScrn, TIDAC_pll_addr, 0x00, + restore->dacregs[TIDAC_pll_addr]); + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, + restore->dacregs[0x40]); + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, + restore->dacregs[0x41]); + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, + restore->dacregs[0x42]); + + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, + restore->dacregs[0x43]); + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, + restore->dacregs[0x44]); + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, + restore->dacregs[0x45] | 0x80); + + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, + restore->dacregs[0x46]); + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, + restore->dacregs[0x47]); + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, + restore->dacregs[0x48]); + + S3OutTiIndReg(pScrn, 0x0e, 0x00, restore->dacregs[0x0e]); + S3OutTiIndReg(pScrn, TIDAC_misc_ctrl, 0x00, + restore->dacregs[TIDAC_misc_ctrl]); + } + + S3OutTiIndReg(pScrn, TIDAC_ind_curs_ctrl, 0x00, + restore->dacregs[TIDAC_ind_curs_ctrl]); +} + + +void S3TiDAC_PreInit(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + int mclk, m, n, p, mcc, cr5c; + + outb(vgaCRIndex, 0x5c); + cr5c = inb(vgaCRReg); + outb(vgaCRReg, cr5c & 0xdf); + + S3OutTiIndReg(pScrn, TIDAC_pll_addr, 0x00, 0x00); + n = S3InTiIndReg(pScrn, TIDAC_pll_memory_data) & 0x7f; + S3OutTiIndReg(pScrn, TIDAC_pll_addr, 0x00, 0x01); + m = S3InTiIndReg(pScrn, TIDAC_pll_memory_data) & 0x7f; + S3OutTiIndReg(pScrn, TIDAC_pll_addr, 0x00, 0x02); + p = S3InTiIndReg(pScrn, TIDAC_pll_memory_data) & 0x03; + mcc = S3InTiIndReg(pScrn, TIDAC_clock_ctrl); + if (mcc & 0x08) + mcc = (mcc & 0x07) * 2 + 2; + else + mcc = 1; + + mclk = ((1431818 * ((m+2) * 8)) / (n+2) / (1 << p) / mcc + 50) / 100; + pS3->mclk = mclk; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MCLK %1.3f MHz\n", + mclk / 1000.0); + + outb(vgaCRIndex, 0x5c); + outb(vgaCRReg, cr5c); +} + + +static void S3TiDACCalcNMP(long freq, int *calc_n, int *calc_m, int *calc_p) +{ + double ffreq; + int n, m, p; + int best_n=32, best_m=32; + double diff, mindiff; + + if (freq < FREQ_MIN) + ffreq = FREQ_MIN / 1000.0; + else if (freq > FREQ_MAX) + ffreq = FREQ_MAX / 1000.0; + else + ffreq = freq / 1000.0; + + for (p=0; p<4 && ffreq<110.0; p++) + ffreq *= 2; +#if FREQ_MIN < 110000/8 + if (p == 4) { + ffreq /= 2; + p--; + } +#endif + + ffreq /= TI_REF_FREQ; + + mindiff = ffreq; + + for (n=1; n<=(int)(TI_REF_FREQ/0.5 - 2); n++) { + m = (int)(ffreq * (n+2) / 8.0 + 0.5) - 2; + if (m < 1) + m = 1; + else if (m > 127) + m = 127; + + diff = ((m+2) * 8) / (n+2.0) - ffreq; + if (diff < 0) + diff = -diff; + + if (diff < mindiff) { + mindiff = diff; + best_n = n; + best_m = m; + } + } + + *calc_n = best_n; + *calc_m = best_m; + *calc_p = p; +} + + +static void S3TiDACProgramClock(ScrnInfoPtr pScrn, int clk, + unsigned char n, unsigned char m, + unsigned char p) +{ + S3OutTiIndReg(pScrn, TIDAC_pll_addr, 0x00, 0x00); + + if (clk != TIDAC_pll_memory_data) { + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, n); + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, m); + S3OutTiIndReg(pScrn, TIDAC_pll_pixel_data, 0x00, p | 0x08); + + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, 0x01); + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, 0x01); + S3OutTiIndReg(pScrn, TIDAC_pll_loop_data, 0x00, p > 0 ? p : 1); + S3OutTiIndReg(pScrn, TIDAC_misc_ctrl, 0x00, 0x80 | 0x40 | 0x04); + + S3OutTiIndReg(pScrn, TIDAC_clock_select, 0x00, 0x05); + } else { + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, n); + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, m); + S3OutTiIndReg(pScrn, TIDAC_pll_memory_data, 0x00, p | 0x80); + } +} + + +void S3TiDACSetClock(ScrnInfoPtr pScrn, long freq, int clk) +{ + int m, n, p; + + S3TiDACCalcNMP(freq, &n, &m, &p); + + S3TiDACProgramClock(pScrn, clk, n, m, p); +} + + + +void S3TiDAC_Init(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + S3Ptr pS3 = S3PTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr pVga = &hwp->ModeReg; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp, tmp1, tmp2; + + S3TiDACSetClock(pScrn, mode->Clock, 2); + outb(vgaCRIndex, 0x42); + tmp = inb(vgaCRReg) & 0xf0; + outb(vgaCRReg, tmp | 0x02); + usleep(150000); + + outb(0x3c4, 1); + tmp2 = inb(0x3c5); + outb(0x3c5, tmp2 | 0x20); /* blank */ + + tmp = pVga->MiscOutReg; + pVga->MiscOutReg |= 0xc0; + tmp1 = 0x00; + if (!(tmp & 0x80)) + tmp1 |= 0x02; + if (!(tmp & 0x40)) + tmp1 |= 0x01; + + S3OutTiIndReg(pScrn, TIDAC_general_ctrl, 0x00, tmp1); + S3OutTiIndReg(pScrn, 0x0e, 0x00, 0x00); + + /* XXX do 3020 input_clock_sel */ + + outb(vgaCRIndex, 0x65); + /* XXX 3025 */ + outb(vgaCRReg, 0x00); + + /* XXX 3025 */ + outb(vgaCRIndex, 0x40); + outb(vgaCRReg, 0x11); + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, 0x00); + + if (pScrn->bitsPerPixel > 8) + S3OutTiIndReg(pScrn, TIDAC_auxiliary_ctrl, 0x00, 0x00); + else + S3OutTiIndReg(pScrn, TIDAC_auxiliary_ctrl, 0x00, 0x01); + + switch (pScrn->depth) { + case 8: + S3OutTiIndReg(pScrn, TIDAC_output_clock_select, 0x00, + 0x4b); + outb(vgaCRIndex, 0x66); + tmp = inb(vgaCRReg); + if (mode->Clock > 80000) + outb(vgaCRReg, (tmp & 0xf8) | 0x02); + else + outb(vgaCRReg, (tmp & 0xf8) | 0x03); + break; + case 16: + S3OutTiIndReg(pScrn, TIDAC_output_clock_select, 0x00, + 0x4a); + outb(vgaCRIndex, 0x66); + tmp = inb(vgaCRReg); + if (mode->Clock > 80000) + outb(vgaCRReg, (tmp & 0xf8) | 0x01); + else + outb(vgaCRReg, (tmp & 0xf8) | 0x02); + break; + case 24: + S3OutTiIndReg(pScrn, TIDAC_output_clock_select, 0x00, + (0x40 | 0x08 | 0x01)); + outb(vgaCRIndex, 0x66); + tmp = inb(vgaCRReg); + if (mode->Clock > 80000) + outb(vgaCRReg, (tmp & 0xf8) | 0x00); + else + outb(vgaCRReg, (tmp & 0xf8) | 0x01); + break; + } + + outb(vgaCRIndex, 0x58); + tmp = inb(vgaCRReg); + outb(vgaCRReg, (tmp & 0xbf) | 0x40); + + switch(pScrn->depth) { + case 8: + S3OutTiIndReg(pScrn, TIDAC_true_color_ctrl, 0x00, 0x80); + S3OutTiIndReg(pScrn, TIDAC_multiplex_ctrl, 0x00, 0x1c); + break; + case 15: + S3OutTiIndReg(pScrn, TIDAC_true_color_ctrl, 0x00, 0x4c); + S3OutTiIndReg(pScrn, TIDAC_multiplex_ctrl, 0x00, 0x04); + S3OutTiIndReg(pScrn, TIDAC_key_ctrl, 0x00, 0x01); + break; + case 16: + S3OutTiIndReg(pScrn, TIDAC_true_color_ctrl, 0x00, 0x4d); + S3OutTiIndReg(pScrn, TIDAC_multiplex_ctrl, 0x00, 0x04); + S3OutTiIndReg(pScrn, TIDAC_key_ctrl, 0x00, 0x01); + break; + case 24: + S3OutTiIndReg(pScrn, TIDAC_true_color_ctrl, 0x00, 0x4e); + S3OutTiIndReg(pScrn, TIDAC_multiplex_ctrl, 0x00, 0x04); + S3OutTiIndReg(pScrn, TIDAC_key_ctrl, 0x00, 0x01); + break; + } + + S3OutTiIndReg(pScrn, TIDAC_general_io_ctrl, 0x00, 0x1f); + S3OutTiIndReg(pScrn, TIDAC_general_io_data, 0x00, 0x01); + S3OutTiIndReg(pScrn, TIDAC_general_io_ctrl, 0x00, 0x00); + S3OutTiIndReg(pScrn, TIDAC_misc_ctrl, 0xf0, (0x04 | 0x08)); + + outb(vgaCRIndex, 0x6d); + if (pS3->s3Bpp == 1) + if (mode->Clock > 80000) + outb(vgaCRReg, 0x02); + else + outb(vgaCRReg, 0x03); + else if (pS3->s3Bpp == 2) + if (mode->Clock > 80000) + outb(vgaCRReg, 0x00); + else + outb(vgaCRReg, 0x01); + else + outb(vgaCRReg, 0x00); + + S3OutTiIndReg(pScrn, TIDAC_sense_test, 0x00, 0x00); + + if (pS3->s3Bpp > 1) + { + int j; + + outb(0x3c6, 0xff); + outb(0x3c8, 0x00); + for(j=0; j<768; j++) { + outb(0x3c9, j); + outb(0x3c9, j); + outb(0x3c9, j); + } + } + + outb(0x3c4, 1); + outb(0x3c5, tmp2); /* unblank */ +} + + +void S3TiLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, + VisualPtr pVisual) +{ + int i; + + outb(0x3c6, 0xff); + outb(0x3c8, 0x00); + + for (i=0; i<768; i++) { + outb(0x3c9, i); + usleep(1000); + outb(0x3c9, i); + usleep(1000); + outb(0x3c9, i); + usleep(1000); + } +} + + + +/* hardware cursor */ + +static void S3TiSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + S3OutTiIndReg(pScrn, TIDAC_cursor_color_0_red, 0x00, + (bg & 0x00FF0000) >> 16); + S3OutTiIndReg(pScrn, TIDAC_cursor_color_0_green, 0x00, + (bg & 0x0000FF00) >> 8); + S3OutTiIndReg(pScrn, TIDAC_cursor_color_0_blue, 0x00, + (bg & 0x000000FF)); + + S3OutTiIndReg(pScrn, TIDAC_cursor_color_1_red, 0x00, + (fg & 0x00FF0000) >> 16); + S3OutTiIndReg(pScrn, TIDAC_cursor_color_1_green, 0x00, + (fg & 0x0000FF00) >> 8); + S3OutTiIndReg(pScrn, TIDAC_cursor_color_1_blue, 0x00, + (fg & 0x000000FF)); + +} + + +static void S3TiSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + S3OutTiIndReg(pScrn, TIDAC_cursor_x_low, 0x00, x & 0xff); + S3OutTiIndReg(pScrn, TIDAC_cursor_x_high, 0x00, (x >> 8) & 0x0f); + S3OutTiIndReg(pScrn, TIDAC_cursor_y_low, 0x00, y & 0xff); + S3OutTiIndReg(pScrn, TIDAC_cursor_y_high, 0x00, (y >> 8) & 0x0f); +} + + +static void S3TiHideCursor(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + S3OutTiIndReg(pScrn, TIDAC_ind_curs_ctrl, (unsigned char) + ~(0x40 | 0x10), 0x00); +} + + +static void S3TiShowCursor(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xdf; + outb(vgaCRReg, tmp | 0x20); + + outb(vgaCRIndex, 0x45); + tmp = inb(vgaCRReg) & 0xdf; + outb(vgaCRReg, tmp | 0x20); + + S3OutTiIndReg(pScrn, TIDAC_ind_curs_ctrl, (unsigned char) + ~(0x40 | 0x10), (0x40 | 0x10)); +} + + +static void S3TiLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp, tmp1; + register int i; +#if 0 + register unsigned char *mask = image + 1; +#endif + + /* unlock sys regs */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg) & 0xfc; + outb(vgaCRReg, tmp | 0x01); + tmp1 = inb(TI_INDEX_REG); + + outb(TI_INDEX_REG, TIDAC_cursor_ram_addr_low); + outb(TI_DATA_REG, 0x00); + outb(TI_INDEX_REG, TIDAC_cursor_ram_addr_high); + outb(TI_DATA_REG, 0x00); + outb(TI_INDEX_REG, TIDAC_cursor_ram_data); + +#if 0 + for (i=0; i<512; i++, mask+=2) + outb(TI_DATA_REG, *mask); + for (i=0; i<512; i++, image+=2) + outb(TI_DATA_REG, *image); +#else + for (i=0; i<1024; i++) { + outb(TI_DATA_REG, *image); + image++; + } +#endif + + outb(TI_INDEX_REG, tmp1); + + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, tmp); +} + + + +static Bool S3TiUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) +{ + return TRUE; +} + + + +Bool S3Ti_CursorInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + xf86CursorInfoPtr pCurs; + + if (!(pCurs = pS3->pCurs = xf86CreateCursorInfoRec())) + return FALSE; + + pCurs->MaxWidth = 64; + pCurs->MaxHeight = 64; + pCurs->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 | + HARDWARE_CURSOR_NIBBLE_SWAPPED | + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST; + + pCurs->SetCursorColors = S3TiSetCursorColors; + pCurs->SetCursorPosition = S3TiSetCursorPosition; + pCurs->LoadCursorImage = S3TiLoadCursorImage; + pCurs->HideCursor = S3TiHideCursor; + pCurs->ShowCursor = S3TiShowCursor; + pCurs->UseHWCursor = S3TiUseHWCursor; + + return xf86InitCursor(pScreen, pCurs); +} Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c:1.4 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c Sat Oct 27 23:33:44 2001 @@ -0,0 +1,388 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c,v 1.4 2001/10/28 03:33:44 tsi Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "compiler.h" + +#include "s3.h" + +/* this is really quite dumb */ +Bool S3Trio64DACProbe(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + + if (!S3_TRIO_SERIES()) + return FALSE; + + RamDacInit(pScrn, pS3->RamDacRec); + + pS3->RamDac = RamDacHelperCreateInfoRec(); + pS3->RamDac->RamDacType = TRIO64_RAMDAC; + + return TRUE; +} + + +void S3Trio64DAC_Save(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr save = &pS3->SavedRegs; + + save->dacregs[0] = inb(0x3cc); + + outb(0x3c4, 0x08); + save->dacregs[1] = inb(0x3c5); + outb(0x3c5, 0x06); + + outb(0x3c4, 0x09); + save->dacregs[2] = inb(0x3c5); + outb(0x3c4, 0x0a); + save->dacregs[3] = inb(0x3c5); + outb(0x3c4, 0x0b); + save->dacregs[4] = inb(0x3c5); + outb(0x3c4, 0x0d); + save->dacregs[5] = inb(0x3c5); + outb(0x3c4, 0x15); + save->dacregs[6] = inb(0x3c5) & 0xfe; + outb(0x3c5, save->dacregs[6]); + + outb(0x3c4, 0x18); + save->dacregs[7] = inb(0x3c5); + outb(0x3c4, 0x10); + save->dacregs[8] = inb(0x3c5); + outb(0x3c4, 0x11); + save->dacregs[9] = inb(0x3c5); + outb(0x3c4, 0x12); + save->dacregs[10] = inb(0x3c5); + outb(0x3c4, 0x13); + save->dacregs[11] = inb(0x3c5); + outb(0x3c4, 0x1a); + save->dacregs[12] = inb(0x3c5); + outb(0x3c4, 0x1b); + save->dacregs[13] = inb(0x3c5); + + if (pS3->Chipset == PCI_CHIP_AURORA64VP) { + int i; + + for (i=0x1a; i <= 0x6f; i++) { + outb(0x3c4, i); + save->dacregs[i] = inb(0x3c5); + } + } + + outb(0x3c4, 0x08); + outb(0x3c5, 0x00); +} + + +void S3Trio64DAC_Restore(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr restore = &pS3->SavedRegs; + unsigned char tmp; + + outb(0x3c2, restore->dacregs[0]); + outb(0x3c4, 0x08); + outb(0x3c5, 0x06); + + outb(0x3c4, 0x09); + outb(0x3c5, restore->dacregs[2]); + outb(0x3c4, 0x0a); + outb(0x3c5, restore->dacregs[3]); + outb(0x3c4, 0x0b); + outb(0x3c5, restore->dacregs[4]); + outb(0x3c4, 0x0d); + outb(0x3c5, restore->dacregs[5]); + + outb(0x3c4, 0x10); + outb(0x3c5, restore->dacregs[8]); + outb(0x3c4, 0x11); + outb(0x3c5, restore->dacregs[9]); + outb(0x3c4, 0x12); + outb(0x3c5, restore->dacregs[10]); + outb(0x3c4, 0x13); + outb(0x3c5, restore->dacregs[11]); + outb(0x3c4, 0x1a); + outb(0x3c5, restore->dacregs[12]); + outb(0x3c4, 0x1b); + outb(0x3c5, restore->dacregs[13]); + outb(0x3c4, 0x15); + tmp = inb(0x3c5); + outb(0x3c4, tmp & ~0x20); + outb(0x3c4, tmp | 0x20); + outb(0x3c4, tmp & ~0x20); + + outb(0x3c4, 0x15); + outb(0x3c5, restore->dacregs[6]); + outb(0x3c4, 0x18); + outb(0x3c5, restore->dacregs[7]); + + if (pS3->Chipset == PCI_CHIP_AURORA64VP) { + int i; + + for (i = 0x1a; i <= 0x6f; i++) { + outb(0x3c4, i); + outb(0x3c5, restore->dacregs[i]); + } + } + + outb(0x3c4, 0x08); + outb(0x3c5, restore->dacregs[1]); +} + + +static void +S3TrioCalcClock(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) +{ + double ffreq, ffreq_min, ffreq_max; + double div, diff, best_diff; + unsigned int m; + unsigned char n1, n2, best_n1=18, best_n2=2, best_m=127; + +#define BASE_FREQ 14.31818 + ffreq = freq / 1000.0 / BASE_FREQ; + ffreq_min = freq_min / 1000.0 / BASE_FREQ; + ffreq_max = freq_max / 1000.0 / BASE_FREQ; + + if (ffreq < ffreq_min / (1<<max_n2)) { + ErrorF("invalid frequency %1.3f Mhz [freq >= %1.3f Mhz]\n", + ffreq*BASE_FREQ, ffreq_min*BASE_FREQ/(1<<max_n2)); + ffreq = ffreq_min / (1<<max_n2); + } + if (ffreq > ffreq_max / (1<<min_n2)) { + ErrorF("invalid frequency %1.3F Mhz [freq <= %1.3f Mhz]\n", + ffreq*BASE_FREQ, ffreq_max*BASE_FREQ/(1<<min_n2)); + ffreq = ffreq_max / (1<<min_n2); + } + + best_diff = ffreq; + + for(n2=min_n2; n2<=max_n2; n2++) { + for(n1=min_n1+2; n1<=max_n1+2; n1++) { + m = (int)(ffreq*n1*(1<<n2)+0.5); + if (m<min_m+2 || m > 127+2) + continue; + div = (double)(m)/(double)(n1); + if ((div >= ffreq_min) && + (div <= ffreq_max)) { + diff = ffreq - div / (1<<n2); + if (diff < 0.0) + diff = -diff; + if (diff < best_diff) { + best_diff = diff; + best_m = m; + best_n1 = n1; + best_n2 = n2; + } + } + } + } + + if (max_n1 == 63) + *ndiv = (best_n1 - 2) | (best_n2 << 6); + else + *ndiv = (best_n1 - 2) | (best_n2 << 5); + *mdiv = best_m - 2; +} + + +void S3TrioSetPLL(ScrnInfoPtr pScrn, int clk, unsigned char m, + unsigned char n) +{ + unsigned char tmp; + int index2; + + if (clk < 2) { + tmp = inb(0x3cc); + outb(0x3c2, (tmp & 0xf3) | (clk << 2)); + } else { + tmp = inb(0x3cc); + outb(0x3c2, tmp | 0x0c); + + outb(0x3c4, 0x08); + outb(0x3c5, 0x06); /* unlock extended CR9-18 */ + + if (clk != 10) { + outb(0x3c4, 0x12); + outb(0x3c5, n); + outb(0x3c4, 0x13); + outb(0x3c5, m); + + outb(0x3c4, 0x15); + tmp = inb(0x3c5) & ~0x21; + outb(0x3c5, tmp | 0x02); + outb(0x3c5, tmp | 0x22); + outb(0x3c5, tmp | 0x02); + } else { + index2 = 0x10; + outb(0x3c4, 0x10); + outb(0x3c5, n); + outb(0x3c4, 0x11); + outb(0x3c5, m); + outb(0x3c4, 0x1a); + outb(0x3c5, n); + + outb(0x3c4, 0x15); + tmp = inb(0x3c5) & ~0x21; + outb(0x3c5, tmp | 0x01); + outb(0x3c5, tmp | 0x21); + outb(0x3c5, tmp | 0x01); + outb(0x3c5, tmp); + } + + outb(0x3c4, 0x08); + outb(0x3c5, 0x00); /* lock em */ + } +} + + +void S3TrioSetClock(ScrnInfoPtr pScrn, long freq, int clk, int min_m, + int min_n1, int max_n1, int min_n2, int max_n2, + int pll_type, long freq_min, long freq_max) +{ + unsigned char m, n; + + S3TrioCalcClock(freq, min_m, min_n1, max_n1, min_n2, max_n2, + freq_min, freq_max, &m, &n); + + /* XXX for pll_type == TRIO */ + S3TrioSetPLL(pScrn, clk, m, n); +} + +void S3Trio64DAC_PreInit(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + unsigned char SR8, SR27, SR28; + int m, n, n1, n2, mclk; + + outb(0x3c4, 0x08); + SR8 = inb(0x3c5); + outb(0x3c5, 0x06); + + outb(0x3c4, 0x11); + m = inb(0x3c5); + outb(0x3c4, 0x10); + n = inb(0x3c5); + + m &= 0x7f; + n1 = n & 0x1f; + n2 = (n >> 5) & 0x03; + mclk = ((1431818 * (m+2)) / (n1+2) / (1<<n2)+50)/100; + if (pS3->Chipset == PCI_CHIP_AURORA64VP) { + outb(0x3c4, 0x27); + SR27 = inb(0x3c5); + outb(0x3c4, 0x28); + SR28 = inb(0x3c5); + mclk /= ((SR27 >> 2) & 0x03) + 1; + } + pS3->mclk = mclk; + + outb(0x3c4, 0x08); + outb(0x3c5, SR8); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MCLK %1.3f Mhz\n", + mclk / 1000.0); +} + + +void S3Trio64DAC_Init(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + S3Ptr pS3 = S3PTR(pScrn); + int pixmux=0, invert_vclk=0, sr8, sr15, sr18, cr33; + unsigned char blank, tmp; + + if (pS3->Chipset == PCI_CHIP_AURORA64VP) + S3TrioSetClock(pScrn, mode->Clock, 2, 1, 1, 63, 0, 3, 2, + 135000, 270000); + else + S3TrioSetClock(pScrn, mode->Clock, 2, 1, 1, 31, 0, 3, 2, + 135000, 270000); + + outb(0x3c4, 1); + blank = inb(0x3c5); + outb(0x3c5, blank | 0x20); /* blank the screen */ + + outb(0x3c4, 0x08); + sr8 = inb(0x3c5); + outb(0x3c5, 0x06); + + outb(0x3c4, 0x0d0); + tmp = inb(0x3c5) & ~1; + outb(0x3c5, tmp); + + outb(0x3c4, 0x15); + sr15 = inb(0x3c5) & ~0x10; + + outb(0x3c4, 0x18); + sr18 = inb(0x3c5) & ~0x80; + outb(pS3->vgaCRIndex, 0x33); + cr33 = inb(pS3->vgaCRReg) & ~0x28; + + /* ! pixmux */ + switch (pScrn->depth) { + case 8: + break; + case 15: + cr33 |= 0x08; + pixmux = 0x30; + break; + case 16: + cr33 |= 0x08; + pixmux = 0x50; + break; + case 32: + pixmux = 0xd0; + break; + } + + outb(pS3->vgaCRReg, cr33); + + outb(pS3->vgaCRIndex, 0x67); + outb(pS3->vgaCRReg, pixmux | invert_vclk); + + outb(0x3c4, 0x15); + outb(0x3c5, sr15); + outb(0x3c4, 0x18); + outb(0x3c5, sr18); + + if (pS3->Chipset == PCI_CHIP_AURORA64VP) { + outb(0x3c4, 0x28); + outb(0x3c5, 0x00); + } + + outb(0x3c4, 0x08); + outb(0x3c5, sr8); + + outb(0x3c4, 1); + outb(0x3c5, blank); /* unblank the screen */ +} Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c:1.2 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c Sat Oct 27 23:33:44 2001 @@ -0,0 +1,612 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c,v 1.2 2001/10/28 03:33:44 tsi Exp $ */ + + +#include "xf86.h" + +#include "miline.h" + +#include "s3.h" +#include "s3_reg.h" + + +#if 0 +static Bool NicePattern; +static int DashPatternSize; +#define MAX_LINE_PATTERN_LENGTH 512 +#define LINE_PATTERN_START ((MAX_LINE_PATTERN_LENGTH >> 5) - 1) +static CARD32 DashPattern[MAX_LINE_PATTERN_LENGTH >> 5]; +#endif + + +static void S3Sync(ScrnInfoPtr pScrn) +{ + WaitIdle(); +} + +static void S3SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask) +{ + S3Ptr pS3 = S3PTR(pScrn); + + WaitQueue16_32(4,6); + SET_PIX_CNTL(0); + SET_FRGD_COLOR(color); + SET_FRGD_MIX(FSS_FRGDCOL | s3alu[rop]); + SET_WRT_MASK(planemask); +} + +static void S3SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, + int w, int h) +{ +#ifdef S3_NEWMMIO + S3Ptr pS3 = S3PTR(pScrn); +#endif + + WaitQueue(5); + SET_CURPT((short)x, (short)y); + SET_AXIS_PCNT(w - 1, h - 1); + SET_CMD(CMD_RECT | DRAW | INC_X | INC_Y | WRTDATA); +} + + +static void S3SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, + int ydir, int rop, + unsigned int planemask, + int trans_color) +{ + S3Ptr pS3 = S3PTR(pScrn); + + pS3->BltDir = CMD_BITBLT | DRAW | WRTDATA; + + if (xdir == 1) + pS3->BltDir |= INC_X; + if (ydir == 1) + pS3->BltDir |= INC_Y; + + pS3->trans_color = trans_color; + + WaitQueue16_32(3,4); + SET_PIX_CNTL(0); + SET_FRGD_MIX(FSS_BITBLT | s3alu[rop]); + SET_WRT_MASK(planemask); +} + + +static void S3SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, + int srcx, int srcy, + int dstx, int dsty, + int w, int h) +{ + S3Ptr pS3 = S3PTR(pScrn); + + w--; + h--; + + if (!(pS3->BltDir & INC_Y)) { + srcy += h; + dsty += h; + } + + if (!(pS3->BltDir & INC_X)) { + srcx += w; + dstx += w; + } + + if (pS3->trans_color == -1) { + WaitQueue(7); + SET_CURPT((short)srcx, (short)srcy); + SET_DESTSTP((short)dstx, (short)dsty); + SET_AXIS_PCNT((short)w, (short)h); + SET_CMD(pS3->BltDir); + } else { + WaitQueue16_32(2,3); + SET_MULT_MISC(CMD_REG_WIDTH | 0x0100); + SET_COLOR_CMP(pS3->trans_color); + + WaitQueue(8); + SET_CURPT((short)srcx, (short)srcy); + SET_DESTSTP((short)dstx, (short)dsty); + SET_AXIS_PCNT((short)w, (short)h); + SET_CMD(pS3->BltDir); + SET_MULT_MISC(CMD_REG_WIDTH); + } +} + + +static void S3SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, + int patx, int paty, + int rop, unsigned int planemask, + int trans_color) +{ + S3Ptr pS3 = S3PTR(pScrn); + + pS3->trans_color = trans_color; + + WaitQueue16_32(3,4); + SET_PIX_CNTL(0); + SET_FRGD_MIX(FSS_BITBLT | s3alu[rop]); + SET_WRT_MASK(planemask); +} + +static void S3SubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, + int patx, int paty, + int x, int y, + int w, int h) +{ + S3Ptr pS3 = S3PTR(pScrn); + + if (pS3->trans_color == -1) { + WaitQueue(7); + SET_CURPT((short)patx, (short)paty); + SET_DESTSTP((short)x, (short)y); + SET_AXIS_PCNT(w - 1, h - 1); + SET_CMD(CMD_PFILL | DRAW | INC_Y | INC_X | WRTDATA); + } else { + WaitQueue16_32(2,3); + SET_MULT_MISC(CMD_REG_WIDTH | 0x0100); + SET_COLOR_CMP(pS3->trans_color); + + WaitQueue(8); + SET_CURPT((short)patx, (short)paty); + SET_DESTSTP((short)x, (short)y); + SET_AXIS_PCNT(w - 1, h - 1); + SET_CMD(CMD_PFILL | DRAW | INC_Y | INC_X | WRTDATA); + SET_MULT_MISC(CMD_REG_WIDTH); + } +} + +#ifdef S3_NEWMMIO +static void S3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask) +{ + S3Ptr pS3 = S3PTR(pScrn); + + WaitQueue16_32(3,4); + if (bg == -1) { + if (pS3->ColorExpandBug) { + SET_MIX(FSS_FRGDCOL | s3alu[rop], BSS_BKGDCOL | MIX_XOR); + SET_BKGD_COLOR(0); + } else + SET_MIX(FSS_FRGDCOL | s3alu[rop], BSS_BKGDCOL | MIX_DST); + } else { + SET_MIX(FSS_FRGDCOL | s3alu[rop], BSS_BKGDCOL | s3alu[rop]); + SET_BKGD_COLOR(bg); + } + + WaitQueue16_32(3,5); + SET_FRGD_COLOR(fg); + SET_WRT_MASK(planemask); + SET_PIX_CNTL(MIXSEL_EXPPC); +} + + +static void S3SubsequentCPUToScreenColorExpandFill32(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, + int skipleft) +{ + S3Ptr pS3 = S3PTR(pScrn); + + WaitQueue(4); + SET_CURPT((short)x, (short)y); + SET_AXIS_PCNT((short)w-1, (short)h-1); + + WaitIdle(); + SET_CMD(CMD_RECT | BYTSEQ | _32BIT | PCDATA | DRAW | + PLANAR | INC_Y | INC_X | WRTDATA); +} +#endif + +#if 0 +#ifndef S3_NEWMMIO + +static void S3SetupForScanlineImageWriteNoMMIO(ScrnInfoPtr pScrn, int rop, + unsigned int planemask, + int trans_color, + int bpp, int depth) +{ + S3Ptr pS3 = S3PTR(pScrn); + + WaitQueue16_32(3,4) + SET_FRGD_MIX(FSS_PCDATA | s3alu[rop]); + SET_WRT_MASK(planemask); + SET_PIX_CNTL(0); +} + +static void S3SubsequentScanlineImageWriteRectNoMMIO(ScrnInfoPtr pScrn, + int x, int y, + int w, int h, + int skipleft) +{ + S3Ptr pS3 = S3PTR(pScrn); + + pS3->imageWidth = w; + pS3->imageHeight = h; + + WaitQueue(5); + SET_CURPT((short)x, (short)y); + SET_AXIS_PCNT((short)w-1, (short)h-1); + WaitIdle(); + SET_CMD(CMD_RECT | BYTSEQ | _16BIT | INC_Y | INC_X | DRAW | + PCDATA | WRTDATA); +} + + +static void S3SubsequentImageWriteScanlineNoMMIO(ScrnInfoPtr pScrn, + int bufno) +{ + S3Ptr pS3 = S3PTR(pScrn); + int i, j; + int w, h; + CARD16 *src = (CARD16 *)&pS3->imageBuffer; + + w = pS3->imageWidth * pS3->s3Bpp; + h = pS3->imageHeight; + + for(j=0; j<h; j++) { + for(i=0; i<(w & ~1); ) { + /* XXX not for 32bpp */ + SET_PIX_TRANS_W(ldw_u(src)); + src++; + i += 2; + } + } +} + +#endif +#endif + + +static void S3SetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask) +{ + S3Ptr pS3 = S3PTR(pScrn); + + WaitQueue16_32(4,6); + SET_PIX_CNTL(0); + SET_FRGD_COLOR(color); + SET_FRGD_MIX(FSS_FRGDCOL | s3alu[rop]); + SET_WRT_MASK(planemask); +} + + +static void S3SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, + int x, int y, + int major, int minor, + int err, int len, int octant) +{ +#ifdef S3_NEWMMIO + S3Ptr pS3 = S3PTR(pScrn); +#endif + unsigned short cmd; + int error, e1, e2; + + error = minor + err; + e1 = major; + e2 = minor - major; + + if (major) { + cmd = CMD_LINE | DRAW | WRTDATA | LASTPIX; + + if (octant & YMAJOR) + cmd |= YMAJAXIS; + if (!(octant & XDECREASING)) + cmd |= INC_X; + if (!(octant & YDECREASING)) + cmd |= INC_Y; + + WaitQueue(7); + SET_CURPT((short)x, (short)y); + SET_ERR_TERM((short)error); + SET_DESTSTP((short)e2, (short)e1); + SET_MAJ_AXIS_PCNT((short)len); + SET_CMD(cmd); + } else { + WaitQueue(4); + SET_CURPT((short)x, (short)y); + SET_MAJ_AXIS_PCNT((short)len-1); + SET_CMD(CMD_LINE | DRAW | LINETYPE | WRTDATA | VECDIR_270); + } +} + + + +static void S3SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, + int x, int y, int len, int dir) +{ + if (dir == DEGREES_0) + S3SubsequentSolidFillRect(pScrn, x, y, len, 1); + else + S3SubsequentSolidFillRect(pScrn, x, y, 1, len); +} + + +#if 0 + +static void S3SetupForDashedLine(ScrnInfoPtr pScrn, + int fg, int bg, + int rop, unsigned int planemask, + int len, unsigned char *pattern) +{ +#ifdef S3_NEWMMIO + S3Ptr pS3 = S3PTR(pScrn); + + S3SetupForCPUToScreenColorExpandFill(pScrn, bg, fg, rop, planemask); +#endif + + WaitQueue(4); + + NicePattern = FALSE; + + if (len <= 32) { + register CARD32 scratch = DashPattern[LINE_PATTERN_START]; + + if (len & (len - 1)) { + while (len < 16) { + scratch |= (scratch >> len); + len <<= 1; + } + scratch |= (scratch >> len); + DashPattern[LINE_PATTERN_START] = scratch; + } else { + switch (len) { + case 2: + scratch |= scratch >> 2; + case 4: + scratch |= scratch >> 4; + case 8: + scratch |= scratch >> 8; + case 16: + scratch |= scratch >> 16; + DashPattern[LINE_PATTERN_START] = scratch; + case 32: + NicePattern = TRUE; + default: + break; + } + } + } + + DashPatternSize = len; +} + + +static void S3SubsequentDashedBresenhamLine32(ScrnInfoPtr pScrn, + int x, int y, + int absmaj, int absmin, + int err, int len, + int octant, int phase) +{ +#ifdef S3_NEWMMIO + S3Ptr pS3 = S3PTR(pScrn); +#endif + register int count = (len + 31) >> 5; + register CARD32 pattern; + int error, e1, e2; + + error = absmin + err; + e1 = absmaj; + e2 = absmin - absmaj; + + if (err) { + unsigned short cmd = _32BIT | PLANAR | WRTDATA | DRAW | + PCDATA | LASTPIX | CMD_LINE; + + if (octant & YMAJOR) + cmd |= YMAJAXIS; + if (!(octant & XDECREASING)) + cmd |= INC_X; + if (!(octant & YDECREASING)) + cmd |= INC_Y; + + WaitQueue(7); + SET_CURPT((short)x, (short)y); + SET_ERR_TERM((short)error); + SET_DESTSTP((short)e2, (short)e1); + SET_MAJ_AXIS_PCNT((short)len); + SET_CMD(cmd); + } else { + if (octant & YMAJOR) { + WaitQueue(4); + SET_CURPT((short)x, (short)y); + SET_MAJ_AXIS_PCNT((short)len - 1); + + if (octant & YDECREASING) { + SET_CMD(_32BIT | PLANAR | WRTDATA | DRAW | + CMD_LINE | LINETYPE | VECDIR_090); + } else { + SET_CMD(_32BIT | PLANAR | WRTDATA | DRAW | + CMD_LINE | LINETYPE | VECDIR_270); + } + } else { + if (octant & XDECREASING) { + WaitQueue(4); + SET_CURPT((short)x, (short)y); + SET_MAJ_AXIS_PCNT((short)len - 1); + SET_CMD(_32BIT | PLANAR | WRTDATA | DRAW | + PCDATA | CMD_LINE | LINETYPE | VECDIR_180); + } else { + WaitQueue(4); + SET_CURPT((short)x, (short)y); + SET_MAJ_AXIS_PCNT((short)len - 1); + SET_CMD(_32BIT | PLANAR | WRTDATA | DRAW | + PCDATA | CMD_RECT | INC_Y | INC_X); + } + } + } + + if (NicePattern) { +#ifdef S3_NEWMMIO + register CARD32 *dest = (CARD32*)&IMG_TRANS; +#endif + + pattern = (phase) ? (DashPattern[LINE_PATTERN_START] << phase) | + (DashPattern[LINE_PATTERN_START] >> (32 - phase)) : + DashPattern[LINE_PATTERN_START]; + +#ifdef S3_NEWMMIO + while (count & ~0x03) { + dest[0] = dest[1] = dest[2] = dest[3] = pattern; + dest += 4; + count -= 4; + } + switch (count) { + case 1: + dest[0] = pattern; + break; + case 2: + dest[0] = dest[1] = pattern; + break; + case 3: + dest[0] = dest[1] = dest[2] = pattern; + break; + } +#else + + while (count--) + SET_PIX_TRANS_L(pattern); +#endif + } else if (DashPatternSize < 32) { + register int offset = phase; + + while (count--) { + SET_PIX_TRANS_L((DashPattern[LINE_PATTERN_START] << offset) | + (DashPattern[LINE_PATTERN_START] >> + (DashPatternSize - offset))); + offset += 32; + while (offset > DashPatternSize) + offset -= DashPatternSize; + } + } else { + int offset = phase; + register unsigned char *srcp = (unsigned char *)(DashPattern) + + (MAX_LINE_PATTERN_LENGTH >> 3) - 1; + register CARD32 *scratch; + int scratch2, shift; + + while (count--) { + shift = DashPatternSize - offset; + scratch = (CARD32*)(srcp - (offset >> 3) - 3); + scratch2 = offset & 0x07; + + if (shift & ~31) { + if (scratch2) { + pattern = (*scratch << scratch2) | + (*(scratch - 1) >> (32 - scratch2)); + } else + pattern = *scratch; + } else { + pattern = (*((CARD32*)(srcp - 3)) >> shift) | + (*scratch << scratch2); + } + SET_PIX_TRANS_L(pattern); + offset += 32; + while (offset >= DashPatternSize) + offset -= DashPatternSize; + } + } +} + +#endif + +#ifdef S3_NEWMMIO +Bool S3AccelInitNewMMIO(ScreenPtr pScreen) +#else +Bool S3AccelInitPIO(ScreenPtr pScreen) +#endif +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + XAAInfoRecPtr pXAA; + + if (pS3->Chipset == PCI_CHIP_968) + pS3->ColorExpandBug = TRUE; + else + pS3->ColorExpandBug = FALSE; + + if (!(pXAA = XAACreateInfoRec())) + return FALSE; + + pS3->pXAA = pXAA; + + pXAA->Flags = (PIXMAP_CACHE | OFFSCREEN_PIXMAPS | + LINEAR_FRAMEBUFFER); + + pXAA->Sync = S3Sync; + + pXAA->SetupForSolidFill = S3SetupForSolidFill; + pXAA->SubsequentSolidFillRect = S3SubsequentSolidFillRect; + + pXAA->SetupForScreenToScreenCopy = S3SetupForScreenToScreenCopy; + pXAA->SubsequentScreenToScreenCopy = S3SubsequentScreenToScreenCopy; + + pXAA->SetupForColor8x8PatternFill = S3SetupForColor8x8PatternFill; + pXAA->SubsequentColor8x8PatternFillRect = S3SubsequentColor8x8PatternFillRect; + +#ifdef S3_NEWMMIO + pXAA->SetupForCPUToScreenColorExpandFill = + S3SetupForCPUToScreenColorExpandFill; + pXAA->SubsequentCPUToScreenColorExpandFill = + S3SubsequentCPUToScreenColorExpandFill32; + pXAA->ColorExpandBase = (void *) &IMG_TRANS; + pXAA->ColorExpandRange = 0x8000; + pXAA->CPUToScreenColorExpandFillFlags = CPU_TRANSFER_PAD_DWORD | + BIT_ORDER_IN_BYTE_MSBFIRST | + SCANLINE_PAD_DWORD; +#endif + +#if 0 +#ifndef S3_NEWMMIO + pXAA->ScanlineImageWriteFlags = NO_TRANSPARENCY; + pXAA->SetupForScanlineImageWrite = + S3SetupForScanlineImageWriteNoMMIO; + pXAA->SubsequentScanlineImageWriteRect = + S3SubsequentScanlineImageWriteRectNoMMIO; + pXAA->SubsequentImageWriteScanline = + S3SubsequentImageWriteScanlineNoMMIO; + pXAA->NumScanlineImageWriteBuffers = 1; + pXAA->ScanlineImageWriteBuffers = &pS3->imageBuffer; +#endif +#endif + + pXAA->SetupForSolidLine = S3SetupForSolidLine; + pXAA->SubsequentSolidBresenhamLine = S3SubsequentSolidBresenhamLine; + pXAA->SubsequentSolidHorVertLine = S3SubsequentSolidHorVertLine; + pXAA->SolidBresenhamLineErrorTermBits = 12; +#if 0 + /* kinda buggy... and its faster without it */ + pXAA->SetupForDashedLine = S3SetupForDashedLine; + pXAA->SubsequentDashedBresenhamLine = S3SubsequentDashedBresenhamLine32; + pXAA->DashPatternMaxLength = MAX_LINE_PATTERN_LENGTH; +#endif + + return XAAInit(pScreen, pXAA); +} Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c:1.2 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c Wed Jul 11 03:45:35 2001 @@ -0,0 +1,83 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_bios.c,v 1.2 2001/07/11 07:45:35 alanh Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "compiler.h" + +#include "s3.h" + + +static unsigned char *find_bios_string(int BIOSbase, char *match1, char *match2) +{ + static unsigned char bios[BIOS_BSIZE]; + static int init=0; + int i, j, l1, l2; + + if (!init) { + init = 1; + if (xf86ReadBIOS(BIOSbase, 0, bios, BIOS_BSIZE) != BIOS_BSIZE) + return NULL; + if ((bios[0] != 0x55) || (bios[1] != 0xaa)) + return NULL; + } + if (match1 == NULL) + return NULL; + + l1 = strlen(match1); + if (match2 != NULL) + l2 = strlen(match2); + else + l2 = 0; + + for (i=0; i<BIOS_BSIZE; i++) + if (bios[i] == match1[0] && !memcmp(&bios[i], match1, l1)) { + if (match2 == NULL) + return &bios[i+l1]; + else + for(j=i+l1; (j<BIOS_BSIZE-l2) && bios[j]; j++) + if (bios[j] == match2[0] && + !memcmp(&bios[j], match2, l2)) + return &bios[j+l2]; + } + + return NULL; +} + + +int S3GetRefClock(ScrnInfoPtr pScrn) +{ + int RefClock = 16000; /* default */ + + if (find_bios_string(BIOS_BASE, "Number Nine Visual Technology", + "Motion 771") != NULL) + RefClock = 16000; + + return RefClock; +} Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c:1.1 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c Mon Jul 2 06:46:04 2001 @@ -0,0 +1,226 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c,v 1.1 2001/07/02 10:46:04 alanh Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "compiler.h" + +#include "s3.h" +#include "s3_reg.h" + + +static void S3SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned short packfg, packbg; + + switch (pS3->s3Bpp) { + case 1: + /* XXX Trio series only */ + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4a); + outb(vgaCRReg, fg); + outb(vgaCRReg, fg); + + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4b); + outb(vgaCRReg, bg); + outb(vgaCRReg, bg); + + break; + case 2: + /* XXX depth 16 */ + packfg = ((fg & 0x00f80000) >> 19) | ((fg & 0x0000fc00) >> 5) | + ((fg & 0x000000f8) << 8); + packbg = ((bg & 0x00f80000) >> 19) | ((bg & 0x0000fc00) >> 5) | + ((bg & 0x000000f8) << 8); + + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4a); + outb(vgaCRReg, packfg); + outb(vgaCRReg, packfg >> 8); + + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4b); + outb(vgaCRReg, packbg); + outb(vgaCRReg, packbg >> 8); + + break; + default: + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4a); + outb(vgaCRReg, (fg & 0x00ff0000) >> 16); + outb(vgaCRReg, (fg & 0x0000ff00) >> 8); + outb(vgaCRReg, (fg & 0x000000ff)); + + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4b); + outb(vgaCRReg, (bg & 0x00ff0000) >> 16); + outb(vgaCRReg, (bg & 0x0000ff00) >> 8); + outb(vgaCRReg, (bg & 0x000000ff)); + + break; + } +} + + +static void S3SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x46); + outb(vgaCRReg, x >> 8); + outb(vgaCRIndex, 0x47); + outb(vgaCRReg, x); + + outb(vgaCRIndex, 0x49); + outb(vgaCRReg, y); + outb(vgaCRIndex, 0x48); + outb(vgaCRReg, y >> 8); +} + + +static void S3HideCursor(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp; + + outb(vgaCRIndex, 0x45); + tmp = inb(vgaCRReg); + outb(vgaCRReg, tmp & ~0x01); +} + + +static void S3ShowCursor(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char tmp; + + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x55); + tmp = inb(vgaCRReg); + outb(vgaCRReg, tmp | 0x10); + + outb(vgaCRIndex, 0x4c); + outb(vgaCRReg, pS3->FBCursorOffset >> 8); + outb(vgaCRIndex, 0x4d); + outb(vgaCRReg, pS3->FBCursorOffset); + + outb(vgaCRIndex, 0x45); + tmp = inb(vgaCRReg); + outb(vgaCRReg, tmp | 0x01); +} + + +static void S3LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + unsigned char cr45; + + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + WaitIdle(); + + VerticalRetraceWait(); + + outb(vgaCRIndex, 0x45); + cr45 = inb(vgaCRReg); + outb(vgaCRReg, cr45 & 0xfe); + + outb(vgaCRIndex, 0x46); + outb(vgaCRReg, 0xff); + outb(vgaCRIndex, 0x47); + outb(vgaCRReg, 0x7f); + outb(vgaCRIndex, 0x49); + outb(vgaCRReg, 0xff); + outb(vgaCRIndex, 0x4e); + outb(vgaCRReg, 0x3f); + outb(vgaCRIndex, 0x4f); + outb(vgaCRReg, 0x3f); + outb(vgaCRIndex, 0x48); + outb(vgaCRReg, 0x7f); + + memcpy(pS3->FBBase + (pS3->FBCursorOffset * 1024), image, 1024); + + VerticalRetraceWait(); + + outb(vgaCRIndex, 0x45); + outb(vgaCRReg, cr45); +} + + +static Bool S3UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) +{ + return TRUE; +} + + +Bool S3_CursorInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + xf86CursorInfoPtr pCurs; + + if (!(pCurs = pS3->pCurs = xf86CreateCursorInfoRec())) + return FALSE; + + pCurs->MaxWidth = 64; + pCurs->MaxHeight = 64; + pCurs->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 | + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST; + + pCurs->SetCursorColors = S3SetCursorColors; + pCurs->SetCursorPosition = S3SetCursorPosition; + pCurs->LoadCursorImage = S3LoadCursorImage; + pCurs->HideCursor = S3HideCursor; + pCurs->ShowCursor = S3ShowCursor; + pCurs->UseHWCursor = S3UseHWCursor; + + return xf86InitCursor(pScreen, pCurs); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_dga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_dga.c:1.1 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_dga.c Mon Jul 2 06:46:04 2001 @@ -0,0 +1,318 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_dga.c,v 1.1 2001/07/02 10:46:04 alanh Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "dgaproc.h" + +#include "s3.h" +#include "s3_reg.h" + + +static Bool S3_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode); +static int S3_GetViewport(ScrnInfoPtr pScrn); +static void S3_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags); +static void S3_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, + unsigned long color); +static void S3_BltRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, + int dstx, int dsty); +static Bool S3_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, + unsigned char **mem, int *size, int *offset, + int *flags); +static void S3_Sync(ScrnInfoPtr pScrn); + + +static DGAFunctionRec S3_DGAFuncs = { + S3_OpenFramebuffer, + NULL, + S3_SetMode, + S3_SetViewport, + S3_GetViewport, + S3_Sync, + S3_FillRect, + S3_BltRect, + NULL +}; + + +static DGAModePtr S3SetupDGAMode(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) +{ + S3Ptr pS3 = S3PTR(pScrn); + DGAModePtr newmodes = NULL, currentMode; + DisplayModePtr pMode, firstMode; + int otherPitch, Bpp = bitsPerPixel >> 3; + Bool oneMore; + + pMode = firstMode = pScrn->modes; + + 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: + + currentMode = modes + *num; + (*num)++; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS; + if (pixmap) + currentMode->flags |= DGA_PIXMAP_AVAILABLE; + if (pS3->pXAA) + 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 = depth; + currentMode->bitsPerPixel = bitsPerPixel; + currentMode->red_mask = red; + currentMode->green_mask = green; + currentMode->blue_mask = blue; + currentMode->visualClass = visualClass; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 8; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = (unsigned char*)pS3->FBAddress; + + if (oneMore) { + 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; + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + + oneMore = FALSE; + goto SECOND_PASS; + } else { + currentMode->bytesPerScanline = (((otherPitch * Bpp) + 3) & ~3L); + + currentMode->imageWidth = otherPitch; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + + } + + pMode = pMode->next; + + if (pMode == firstMode) + break; + + } + + return modes; +} + + + +Bool S3DGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + DGAModePtr modes = NULL; + int num = 0; + + modes = S3SetupDGAMode(pScrn, modes, &num, 8, 8, + (pScrn->bitsPerPixel == 8), + ((pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth), + 0, 0, 0, PseudoColor); + + modes = S3SetupDGAMode(pScrn, modes, &num, 16, 15, + (pScrn->bitsPerPixel == 16), + ((pScrn->depth != 15) + ? 0 : pScrn->displayWidth), + 0x7c00, 0x03e0, 0x001f, TrueColor); + + modes = S3SetupDGAMode(pScrn, modes, &num, 16, 15, + (pScrn->bitsPerPixel == 16), + ((pScrn->depth != 15) + ? 0 : pScrn->displayWidth), + 0x7c00, 0x03e0, 0x001f, DirectColor); + + modes = S3SetupDGAMode(pScrn, modes, &num, 16, 16, + (pScrn->bitsPerPixel == 16), + ((pScrn->depth != 16) + ? 0 : pScrn->displayWidth), + 0xf800, 0x07e0, 0x001f, TrueColor); + + modes = S3SetupDGAMode(pScrn, modes, &num, 16, 16, + (pScrn->bitsPerPixel == 16), + ((pScrn->depth != 16) + ? 0 : pScrn->displayWidth), + 0xf800, 0x07e0, 0x001f, DirectColor); + + modes = S3SetupDGAMode(pScrn, modes, &num, 32, 24, + (pScrn->bitsPerPixel == 32), + ((pScrn->bitsPerPixel != 32) + ? 0 : pScrn->displayWidth), + 0xff0000, 0x00ff00, 0x0000ff, TrueColor); + + modes = S3SetupDGAMode(pScrn, modes, &num, 32, 24, + (pScrn->bitsPerPixel == 32), + ((pScrn->bitsPerPixel != 32) + ? 0 : pScrn->displayWidth), + 0xff0000, 0x00ff00, 0x0000ff, DirectColor); + + pS3->numDGAModes = num; + pS3->DGAModes = modes; + + return DGAInit(pScreen, &S3_DGAFuncs, modes, num); +} + + +static Bool S3_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) +{ + S3Ptr pS3 = S3PTR(pScrn); + static S3FBLayout SavedLayouts[MAXSCREENS]; + int indx = pScrn->pScreen->myNum; + + if (!pMode) { + if (pS3->DGAactive) { + memcpy(&pS3->CurrentLayout, &SavedLayouts[indx], + sizeof(S3FBLayout)); + pS3->DGAactive = TRUE; + } + + pS3->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel; + pS3->CurrentLayout.depth = pMode->depth; + pS3->CurrentLayout.displayWidth = (pMode->bytesPerScanline / + (pMode->bitsPerPixel >> 3)); + pS3->CurrentLayout.pixel_bytes = pMode->bitsPerPixel / 8; + pS3->CurrentLayout.pixel_code = (pMode->bitsPerPixel != 16 ? + pMode->bitsPerPixel : + pMode->depth); + + S3SwitchMode(indx, pMode->mode, 0); + } + + return TRUE; +} + + +static int S3_GetViewport(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + + return pS3->DGAViewportStatus; +} + + +static void S3_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) +{ + S3Ptr pS3 = S3PTR(pScrn); + + pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags); + pS3->DGAViewportStatus = 0; +} + + +static void S3_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, + unsigned long color) +{ + S3Ptr pS3 = S3PTR(pScrn); + + if (pS3->pXAA) { + (*pS3->pXAA->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); + (*pS3->pXAA->SubsequentSolidFillRect)(pScrn, x, y, w, h); + SET_SYNC_FLAG(pS3->pXAA); + } +} + + +static void S3_BltRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, + int dstx, int dsty) +{ + S3Ptr pS3 = S3PTR(pScrn); + + if (pS3->pXAA) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pS3->pXAA->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, + GXcopy, (CARD32)(~0), -1); + (*pS3->pXAA->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, + dstx, dsty, w, h); + SET_SYNC_FLAG(pS3->pXAA); + } +} + + +static Bool S3_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, + unsigned char **mem, int *size, int *offset, + int *flags) +{ + S3Ptr pS3 = S3PTR(pScrn); + + *name = NULL; + *mem = (unsigned char*)pS3->FBAddress; + *size = (pScrn->videoRam * 1024); + *offset = 0; + *flags = 0; + + return TRUE; +} + + +static void S3_Sync(ScrnInfoPtr pScrn) +{ + WaitIdle(); +} Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c:1.7 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c Wed Dec 26 17:24:19 2001 @@ -0,0 +1,1880 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI 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. + * + * + * Credits: + * Thomas Roell <roell@informatik.tu-muenchen.de> + * Mark Vojkovich <markv@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * - and others for their work on the 3.x S3 driver + * + * Dominik Behr + * - for various hardware donations + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c,v 1.7 2001/12/26 22:24:19 dawes Exp $ */ + + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xf86Version.h" +#include "xf86Resources.h" +#include "xf86fbman.h" +#include "xf86cmap.h" +#include "compiler.h" +#include "xaa.h" +#include "mipointer.h" +#include "micmap.h" +#include "mibstore.h" +#include "fb.h" + +#include "IBM.h" +#include "TI.h" + +#include "s3.h" +#include "s3_reg.h" + +#define TRIO64_RAMDAC 0x8811 + + +short s3alu[16] = +{ + MIX_0, + MIX_AND, + MIX_SRC_AND_NOT_DST, + MIX_SRC, + MIX_NOT_SRC_AND_DST, + MIX_DST, + MIX_XOR, + MIX_OR, + MIX_NOR, + MIX_XNOR, + MIX_NOT_DST, + MIX_SRC_OR_NOT_DST, + MIX_NOT_SRC, + MIX_NOT_SRC_OR_DST, + MIX_NAND, + MIX_1, +}; + + +/* + * Prototypes + */ +static const OptionInfoRec * S3AvailableOptions(int chipid, int busid); +static void S3Identify(int flags); +static Bool S3Probe(DriverPtr drv, int flags); +static Bool S3PreInit(ScrnInfoPtr pScrn, int flags); +static Bool S3EnterVT(int scrnIndex, int flags); +static void S3LeaveVT(int scrnIndex, int flags); +static void S3Save(ScrnInfoPtr pScrn); +static Bool S3ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, + char **argv); +static Bool S3MapMem(ScrnInfoPtr pScrn); +static void S3UnmapMem(ScrnInfoPtr pScrn); +static Bool S3ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void S3AdjustFrame(int scrnIndex, int x, int y, int flags); +Bool S3CloseScreen(int scrnIndex, ScreenPtr pScreen); +Bool S3SaveScreen(ScreenPtr pScreen, int mode); +static void S3FreeScreen(int scrnIndex, int flags); +static void S3GenericLoadPalette(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, + VisualPtr pVisual); +static void S3Restore(ScrnInfoPtr pScrn); +void S3BankZero(ScrnInfoPtr pScrn); +void S3Regdump(ScrnInfoPtr pScrn); +static void S3DisplayPowerManagementSet(ScrnInfoPtr pScrn, + int PowerManagementMode, int flags); + + + +DriverRec S3 = +{ + S3_VERSION, + DRIVER_NAME, + S3Identify, + S3Probe, + S3AvailableOptions, + NULL, + 0 +}; + +/* supported chipsets */ +static SymTabRec S3Chipsets[] = { + { PCI_CHIP_964_0, "964-0"}, + { PCI_CHIP_964_1, "964-1"}, + { PCI_CHIP_968, "968" }, + { PCI_CHIP_TRIO, "Trio32/64" }, + { PCI_CHIP_AURORA64VP, "Aurora64V+" }, + { -1, NULL } +}; + + +static PciChipsets S3PciChipsets[] = { + { PCI_CHIP_964_0, PCI_CHIP_964_0, RES_SHARED_VGA }, + { PCI_CHIP_964_1, PCI_CHIP_964_1, RES_SHARED_VGA }, + { PCI_CHIP_968, PCI_CHIP_968, RES_SHARED_VGA }, + { PCI_CHIP_TRIO, PCI_CHIP_TRIO, RES_SHARED_VGA }, + { PCI_CHIP_AURORA64VP, PCI_CHIP_AURORA64VP, RES_SHARED_VGA }, + { -1, -1, RES_UNDEFINED } +}; + +typedef enum { + OPTION_NOACCEL, + OPTION_SWCURS, + OPTION_SLOW_DRAM_REFRESH, + OPTION_SLOW_DRAM, + OPTION_SLOW_EDODRAM, + OPTION_SLOW_VRAM +} S3Opts; + +static OptionInfoRec S3Options[] = { + { OPTION_NOACCEL, "noaccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SWCURS, "swcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SLOW_DRAM_REFRESH, "slow_dram_refresh", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SLOW_DRAM, "slow_dram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SLOW_EDODRAM, "slow_edodram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SLOW_VRAM, "slow_vram", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + +RamDacSupportedInfoRec IBMRamdacs[] = { + { IBM524_RAMDAC }, + { IBM524A_RAMDAC }, + { -1 } +}; + +#define S3_USEFB + +#ifdef S3_USEFB +static const char *fbSymbols[] = { + "fbScreenInit", + NULL +}; +#else +static const char *cfbSymbols[] = { + "cfbScreenInit", + "cfb16ScreenInit", + "cfb24ScreenInit", + "cfb32ScreenInit", + NULL +}; +#endif + +static const char *vgaHWSymbols[] = { + "vgaHWGetHWRec", + "vgaHWFreeHWRec", + "vgaHWGetIOBase", + "vgaHWSave", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWMapMem", + "vgaHWUnmapMem", + "vgaHWSaveScreen", + "vgaHWLock", + "vgaHWInit", + "vgaHWDPMSSet", + NULL +}; + +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; + +static const char *int10Symbols[] = { + "xf86ExecX86int10", + "xf86FreeInt10", + "xf86InitInt10", + "xf86Int10AllocPages", + "xf86Int10FreePages", + NULL +}; + +static const char *ramdacSymbols[] = { + "xf86InitCursor", + "xf86CreateCursorInfoRec", + "RamDacInit", + "RamDacCreateInfoRec", + "RamDacDestroyInfoRec", + "RamDacHelperCreateInfoRec", + "RamDacGetHWIndex", + "IBMramdacProbe", + "IBMramdac526CalculateMNPCForClock", + "IBMramdac526SetBpp", + NULL +}; + +static const char *xaaSymbols[] = { + "XAADestroyInfoRec", + "XAACreateInfoRec", + "XAAInit", + NULL +}; + + +#ifdef XFree86LOADER + +MODULESETUPPROTO(S3Setup); + +static XF86ModuleVersionInfo S3VersRec = { + "s3", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0, 0, 0, 0} +}; + + +XF86ModuleData s3ModuleData = { &S3VersRec, S3Setup, NULL }; + +pointer S3Setup (pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + xf86AddDriver(&S3, module, 0); + LoaderRefSymLists(vgaHWSymbols, + vbeSymbols, int10Symbols, ramdacSymbols, +#ifdef S3_USEFB + fbSymbols, +#else + cfbSymbols, +#endif + xaaSymbols, + NULL); + return (pointer) 1; + } else { + if (errmaj) + *errmaj = LDR_ONCEONLY; + return NULL; + } +} + +#endif /* XFree86LOADER */ + + +static Bool S3GetRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate) + return TRUE; + + pScrn->driverPrivate = xnfcalloc(sizeof(S3Rec), 1); + + return TRUE; +} + +static void S3FreeRec(ScrnInfoPtr pScrn) +{ + if (!pScrn->driverPrivate) + return; + + xfree(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; +} + +static const OptionInfoRec * S3AvailableOptions(int chipid, int busid) +{ + return S3Options; +} + +static void S3Identify(int flags) +{ + xf86PrintChipsets("S3", "driver (version " DRIVER_VERSION " for S3 chipset", + S3Chipsets); +} + +static Bool S3Probe(DriverPtr drv, int flags) +{ + GDevPtr *devSections; + int i, *usedChips, numDevSections, numUsed; + Bool foundScreen = FALSE; + + /* sanity check */ + if ((numDevSections = xf86MatchDevice("s3", &devSections)) <= 0) + return FALSE; + + /* XXX do ISA later... some day in the distant future... */ + numUsed = xf86MatchPciInstances("s3", PCI_VENDOR_S3, + S3Chipsets, S3PciChipsets, + 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 = xf86AllocateScreen(drv, 0); + + pScrn->driverVersion = VERSION_MAJOR; + pScrn->driverName = DRIVER_NAME; + pScrn->name = "s3"; + pScrn->Probe = S3Probe; + pScrn->PreInit = S3PreInit; + pScrn->ScreenInit = S3ScreenInit; + pScrn->SwitchMode = S3SwitchMode; + pScrn->AdjustFrame = S3AdjustFrame; + pScrn->EnterVT = S3EnterVT; + pScrn->LeaveVT = S3LeaveVT; + pScrn->FreeScreen = S3FreeScreen; + + foundScreen = TRUE; + + xf86ConfigActivePciEntity(pScrn, usedChips[i], S3PciChipsets, + NULL, NULL, NULL, NULL, NULL); + } + + xfree(usedChips); + + return foundScreen; +} + +static Bool S3PreInit(ScrnInfoPtr pScrn, int flags) +{ + EntityInfoPtr pEnt; + S3Ptr pS3; + vgaHWPtr hwp; + ClockRangePtr clockRanges; + rgb zeros = {0, 0, 0}; + Gamma gzeros = {0.0, 0.0, 0.0}; + int i, vgaCRIndex, vgaCRReg; + unsigned char tmp; + + if (flags & PROBE_DETECT) + return FALSE; + + if (!xf86LoadSubModule(pScrn, "vgahw")) + return FALSE; + + xf86LoaderReqSymLists(vgaHWSymbols, NULL); + + if (!vgaHWGetHWRec(pScrn)) + return FALSE; + + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); + + pScrn->monitor = pScrn->confScreen->monitor; + + if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb | Support32bppFb)) + return FALSE; + + switch (pScrn->depth) { + case 8: + case 15: + case 16: + case 24: + case 32: + /* OK */ + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this driver\n", + pScrn->depth); + return FALSE; + } + + xf86PrintDepthBpp(pScrn); + + if (pScrn->depth > 8) { + if (!xf86SetWeight(pScrn, zeros, zeros)) + return FALSE; + } + + if (!xf86SetDefaultVisual(pScrn, -1)) + return FALSE; + + pScrn->progClock = TRUE; + + if (!S3GetRec(pScrn)) + return FALSE; + + pS3 = S3PTR(pScrn); + + pS3->s3Bpp = (pScrn->bitsPerPixel >> 3); + + xf86CollectOptions(pScrn, NULL); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, S3Options); + + if (xf86ReturnOptValBool(S3Options, OPTION_NOACCEL, FALSE)) { + pS3->NoAccel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - acceleration disabled\n"); + } else + pS3->NoAccel = FALSE; + if (xf86ReturnOptValBool(S3Options, OPTION_SWCURS, FALSE)) { + pS3->SWCursor = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: SWCursor - using software cursor\n"); + } else + pS3->SWCursor = FALSE; + if (xf86ReturnOptValBool(S3Options, OPTION_SLOW_DRAM_REFRESH, FALSE)) { + pS3->SlowDRAMRefresh = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Slow DRAM Refresh enabled\n"); + } else + pS3->SlowDRAMRefresh = FALSE; + if (xf86ReturnOptValBool(S3Options, OPTION_SLOW_DRAM, FALSE)) { + pS3->SlowDRAM = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Slow DRAM enabled\n"); + } else + pS3->SlowDRAM = FALSE; + if (xf86ReturnOptValBool(S3Options, OPTION_SLOW_EDODRAM, FALSE)) { + pS3->SlowEDODRAM = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Slow EDO DRAM enabled\n"); + } else + pS3->SlowEDODRAM = FALSE; + if (xf86ReturnOptValBool(S3Options, OPTION_SLOW_DRAM, FALSE)) { + pS3->SlowVRAM = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Slow VRAM enabled\n"); + } else + pS3->SlowVRAM = FALSE; + + if (pScrn->numEntities > 1) { + S3FreeRec(pScrn); + return FALSE; + } + + pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + if (pEnt->resources) { + xfree(pEnt); + S3FreeRec(pScrn); + return FALSE; + } + + if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); + pS3->pInt10 = xf86InitInt10(pEnt->index); + } + + if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); + pS3->pVBE = VBEInit(pS3->pInt10, pEnt->index); + } + + if (!xf86SetGamma(pScrn, gzeros)) + return FALSE; + + pS3->PciInfo = xf86GetPciInfoForEntity(pEnt->index); + xf86RegisterResources(pEnt->index, NULL, ResNone); + xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); + + if (pEnt->device->chipset && *pEnt->device->chipset) { + pScrn->chipset = pEnt->device->chipset; + pS3->Chipset = xf86StringToToken(S3Chipsets, pScrn->chipset); + } else if (pEnt->device->chipID >= 0) { + pS3->Chipset = pEnt->device->chipID; + pScrn->chipset = (char *)xf86TokenToString(S3Chipsets, + pS3->Chipset); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", + pS3->Chipset); + } else { + pS3->Chipset = pS3->PciInfo->chipType; + pScrn->chipset = (char *)xf86TokenToString(S3Chipsets, + pS3->Chipset); + } + if (pEnt->device->chipRev >= 0) { + pS3->ChipRev = pEnt->device->chipRev; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", + pS3->ChipRev); + } else + pS3->ChipRev = pS3->PciInfo->chipRev; + + xfree(pEnt); + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Chipset: \"%s\"\n", pScrn->chipset); + + pS3->PciTag = pciTag(pS3->PciInfo->bus, pS3->PciInfo->device, + pS3->PciInfo->func); + + switch (pS3->Chipset) { + case PCI_CHIP_964_0: + case PCI_CHIP_964_1: + case PCI_CHIP_TRIO: + case PCI_CHIP_AURORA64VP: /* ??? */ + pS3->S3NewMMIO = FALSE; + break; + case PCI_CHIP_968: + pS3->S3NewMMIO = TRUE; + break; + } + + pS3->FBAddress = pS3->PciInfo->memBase[0]; + if (pS3->S3NewMMIO) + pS3->IOAddress = pS3->FBAddress + S3_NEWMMIO_REGBASE; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Framebuffer @ 0x%x\n", + pS3->FBAddress); + if (pS3->S3NewMMIO) + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO @ 0x%x\n", + pS3->IOAddress); + + pS3->PCIRetry = FALSE; /* not supported yet */ + + pS3->vgaCRIndex = vgaCRIndex = hwp->IOBase + 4; + pS3->vgaCRReg = vgaCRReg = hwp->IOBase + 5; + + /* unlock sys regs */ + outb(vgaCRIndex, 0x38); + outb(vgaCRReg, 0x48); + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + + outb(vgaCRIndex, 0x40); + tmp = inb(vgaCRReg) | 0x01; + outb(vgaCRReg, tmp); + outb(vgaCRIndex, 0x35); + tmp = inb(vgaCRReg) & ~0x30; + outb(vgaCRReg, tmp); + + outb(0x3c4, 0x08); + outb(0x3c5, 0x06); + outb(vgaCRIndex, 0x33); + tmp = (inb(vgaCRReg) & ~(0x2 | 0x10 | 0x40)) | 0x20; + outb(vgaCRReg, tmp); + + /* unprotect CRTC[0-7] */ + outb(vgaCRIndex, 0x11); + tmp = inb(vgaCRReg) & 0x7f; + outb(vgaCRReg, tmp); + + /* wake up */ + outb(0x46e8, 0x10); + outb(0x102, 0x01); + outb(0x46e8, 0x08); + + if (!pScrn->videoRam) { + /* probe videoram */ + outb(vgaCRIndex, 0x36); + tmp = inb(vgaCRReg); + + switch ((tmp & 0xe0) >> 5) { + case 0: + pScrn->videoRam = 4096; + break; + case 2: + pScrn->videoRam = 3072; + break; + case 3: + pScrn->videoRam = 8192; + break; + case 4: + pScrn->videoRam = 2048; + break; + case 5: + pScrn->videoRam = 6144; + break; + case 6: + pScrn->videoRam = 1024; + break; + } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "videoRam = %d Kb\n", pScrn->videoRam); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "videoRam = %d Kb\n", pScrn->videoRam); + } + + if (!xf86LoadSubModule(pScrn, "ramdac")) + return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); + + pScrn->rgbBits = 8; /* set default */ + + /* probe for dac */ + if (S3TiDACProbe(pScrn)) { + pS3->DacPreInit = S3TiDAC_PreInit; + pS3->DacInit = S3TiDAC_Init; + pS3->DacSave = S3TiDAC_Save; + pS3->DacRestore = S3TiDAC_Restore; +#if 0 + /* FIXME, cursor is drawn in wrong position */ + pS3->CursorInit = S3Ti_CursorInit; +#endif + pS3->MaxClock = 135000; + pScrn->rgbBits = 8; + if (pScrn->bitsPerPixel > 8) + pS3->LoadPalette = S3TiLoadPalette; + else + pS3->LoadPalette = S3GenericLoadPalette; + } + if (S3ProbeIBMramdac(pScrn)) { + pS3->DacPreInit = S3IBMRGB_PreInit; + pS3->DacInit = S3IBMRGB_Init; + pS3->DacSave = S3IBMRGB_Save; + pS3->DacRestore = S3IBMRGB_Restore; + pS3->CursorInit = S3IBMRGB_CursorInit; + pS3->RamDac->SetBpp = IBMramdac526SetBpp; + pS3->MaxClock = 170000; + pScrn->rgbBits = 8; + pS3->LoadPalette = S3GenericLoadPalette; + } + if (S3Trio64DACProbe(pScrn)) { + pS3->DacPreInit = S3Trio64DAC_PreInit; + pS3->DacInit = S3Trio64DAC_Init; + pS3->DacSave = S3Trio64DAC_Save; + pS3->DacRestore = S3Trio64DAC_Restore; +#if 0 + pS3->CursorInit = S3_CursorInit; /* FIXME broken */ +#endif + switch(pScrn->bitsPerPixel) { + case 8: + pS3->MaxClock = 135000; + break; + case 16: + pS3->MaxClock = 80000; + break; + case 24: + case 32: + pS3->MaxClock = 50000; + break; + } + pScrn->rgbBits = 6; + pS3->LoadPalette = S3GenericLoadPalette; + } + + if (pS3->RamDac == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Ramdac probe failed\n"); + return FALSE; + } + + if (pS3->SWCursor) + pS3->CursorInit = NULL; + + pS3->RefClock = S3GetRefClock(pScrn); + + if (pS3->DacPreInit) + pS3->DacPreInit(pScrn); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "RefClock: %d\n", + pS3->RefClock); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Max pixel clock at this depth is %d Mhz\n", + pS3->MaxClock / 1000); + + clockRanges = xnfcalloc(sizeof(ClockRange), 1); + clockRanges->next = NULL; + clockRanges->minClock = 16000; /* guess */ + clockRanges->maxClock = pS3->MaxClock; + clockRanges->clockIndex = -1; + clockRanges->interlaceAllowed = FALSE; /* not yet */ + clockRanges->doubleScanAllowed = FALSE; /* not yet */ + + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, + pScrn->display->modes, clockRanges, + NULL, 256, 2048, pScrn->bitsPerPixel, + 128, 2048, pScrn->virtualX, + pScrn->display->virtualY, pScrn->videoRam * 1024, + LOOKUP_BEST_REFRESH); + + if (i == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "no valid modes left\n"); + S3FreeRec(pScrn); + return FALSE; + } + + xf86PruneDriverModes(pScrn); + + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "no valid modes found\n"); + S3FreeRec(pScrn); + return FALSE; + } + + xf86SetCrtcForModes(pScrn, 0); + pScrn->currentMode = pScrn->modes; + xf86PrintModes(pScrn); + xf86SetDpi(pScrn, 0, 0); + +#ifdef S3_USEFB + xf86LoadSubModule(pScrn, "fb"); + xf86LoaderReqSymbols("fbScreenInit", NULL); +#else + { + switch (pScrn->bitsPerPixel) { + case 8: + xf86LoadSubModule(pScrn, "cfb"); + xf86LoaderReqSymbols("cfbScreenInit", NULL); + break; + case 16: + xf86LoadSubModule(pScrn, "cfb16"); + xf86LoaderReqSymbols("cfb16ScreenInit", NULL); + break; + case 24: + xf86LoadSubModule(pScrn, "cfb24"); + xf86LoaderReqSymbols("cfb24ScreenInit", NULL); + break; + case 32: + xf86LoadSubModule(pScrn, "cfb32"); + xf86LoaderReqSymbols("cfb32ScreenInit", NULL); + break; + } + } +#endif + + if (!xf86LoadSubModule(pScrn, "xaa")) + return FALSE; + xf86LoaderReqSymLists(xaaSymbols, NULL); + + return TRUE; +} + + +static Bool S3ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, + char **argv) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + + pScrn->fbOffset = 0; + + if (!S3MapMem(pScrn)) { + S3FreeRec(pScrn); + return FALSE; + } + + S3Save(pScrn); + + vgaHWBlankScreen(pScrn, TRUE); + + if (!S3ModeInit(pScrn, pScrn->currentMode)) + return FALSE; +#if 0 + S3Regdump(pScrn); +#endif + + S3SaveScreen(pScreen, SCREEN_SAVER_ON); + + miClearVisualTypes(); + 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 (); + +#ifdef S3_USEFB + if (!fbScreenInit(pScreen, pS3->FBBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel)) + return FALSE; +#else + { + int ret; + + switch(pScrn->bitsPerPixel) { + case 8: + ret = cfbScreenInit(pScreen, pS3->FBBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + case 16: + ret = cfb16ScreenInit(pScreen, pS3->FBBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + case 24: + ret = cfb24ScreenInit(pScreen, pS3->FBBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + case 32: + ret = cfb32ScreenInit(pScreen, pS3->FBBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + } + if (!ret) + return FALSE; + } +#endif + + xf86SetBlackWhitePixels(pScreen); + + if (pScrn->bitsPerPixel > 8) { + VisualPtr pVis; + + pVis = pScreen->visuals + pScreen->numVisuals; + while (--pVis >= pScreen->visuals) { + if ((pVis->class | DynamicClass) == DirectColor) { + pVis->offsetRed = pScrn->offset.red; + pVis->offsetGreen = pScrn->offset.green; + pVis->offsetBlue = pScrn->offset.blue; + pVis->redMask = pScrn->mask.red; + pVis->greenMask = pScrn->mask.green; + pVis->blueMask = pScrn->mask.blue; + } + } + } + + S3DGAInit(pScreen); + + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + + if (!pS3->NoAccel) { + if (pS3->S3NewMMIO) { + if (S3AccelInitNewMMIO(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using NewMMIO\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Acceleration initialization failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n"); + } + } else { + if (S3AccelInitPIO(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using PIO\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Acceleration initialization failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n"); + } + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled by option\n"); + } + + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + + /* hw cursor setup */ + if (pS3->CursorInit) { + if (pS3->CursorInit(pScreen)) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using HW cursor\n"); + else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "HW cursor initialization failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using SW cursor\n"); + } + } else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using SW cursor\n"); + + + + + if (!miCreateDefColormap(pScreen)) + return FALSE; + + if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, pS3->LoadPalette, NULL, + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + + vgaHWBlankScreen(pScrn, FALSE); + + pScreen->SaveScreen = S3SaveScreen; + pS3->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = S3CloseScreen; + + xf86DPMSInit(pScreen, S3DisplayPowerManagementSet, 0); + +#if 0 + S3InitVideo(pScreen); +#endif + return TRUE; +} + + + + +static void S3Save(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr save = &pS3->SavedRegs; + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr pVga = &hwp->SavedReg; + RamDacHWRecPtr pRAMDAC; + RamDacRegRecPtr RAMDACreg; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + int i; + unsigned char cr5c = 0; + + pRAMDAC = RAMDACHWPTR(pScrn); + RAMDACreg = &pRAMDAC->SavedReg; + + S3BankZero(pScrn); + + save->clock = inb(0x3cc); + + vgaHWSave(pScrn, pVga, VGA_SR_ALL); + + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) { + outb(vgaCRIndex, 0x5c); + cr5c = inb(vgaCRReg); + } + + pS3->DacSave(pScrn); + + for(i=0; i<5; i++) { + outb(vgaCRIndex, 0x30 + i); + save->s3save[i] = inb(vgaCRReg); + outb(vgaCRIndex, 0x38 + i); + save->s3save[5 + i] = inb(vgaCRReg); + } + + for (i=0; i<16; i++) { + outb(vgaCRIndex, 0x40 + i); + save->s3syssave[i] = inb(vgaCRReg); + } + + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4a); + for(i=0; i<4; i++) { + save->color_stack[i] = inb(vgaCRReg); + outb(vgaCRReg, save->color_stack[i]); + } + + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4b); + for(i=4; i<8; i++) { + save->color_stack[i] = inb(vgaCRReg); + outb(vgaCRReg, save->color_stack[i]); + } + + for(i=0; i<16; i++) { + for (i=0; i<16; i++) { + if (!((1 << i) & 0x673b)) + continue; + outb(vgaCRIndex, 0x50 + i); + save->s3syssave[i + 16] = inb(vgaCRReg); + } + } + + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) + save->s3syssave[0x0c + 16] = cr5c; + + for(i=32; i<46; i++) { + outb(vgaCRIndex, 0x40 + i); + save->s3syssave[i] = inb(vgaCRReg); + } +} + + +Bool S3SaveScreen(ScreenPtr pScreen, int mode) +{ + return vgaHWSaveScreen(pScreen, mode); +} + + +static void S3FreeScreen(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + + vgaHWFreeHWRec(pScrn); + + S3FreeRec(pScrn); +} + + +Bool S3CloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + S3Ptr pS3 = S3PTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + + if (pScrn->vtSema) { + vgaHWUnlock(hwp); + S3Restore(pScrn); + vgaHWLock(hwp); + S3UnmapMem(pScrn); + } + + if (pS3->DGAModes) + xfree(pS3->DGAModes); + pS3->DGAModes = NULL; + + pScrn->vtSema = FALSE; + pScreen->CloseScreen = pS3->CloseScreen; + + return (*pScreen->CloseScreen)(scrnIndex, pScreen); +} + + +Bool S3SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +{ + return S3ModeInit(xf86Screens[scrnIndex], mode); +} + + +static void S3GenericLoadPalette(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, + VisualPtr pVisual) +{ + int i, index; + + for (i=0; i<numColors; i++) { + index = indicies[i]; + outb(0x3c8, index); + outb(0x3c9, colors[index].red); + outb(0x3c9, colors[index].green); + outb(0x3c9, colors[index].blue); + } +} + + +static Bool S3MapMem(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + + if (pS3->S3NewMMIO) { + pS3->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, + pS3->PciTag, pS3->IOAddress, + S3_NEWMMIO_REGSIZE); + if (!pS3->MMIOBase) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not map MMIO\n"); + return FALSE; + } + } + + pS3->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + pS3->PciTag, pS3->FBAddress, + pScrn->videoRam * 1024); + if (!pS3->FBBase) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not map framebuffer\n"); + return FALSE; + } + + pS3->FBCursorOffset = pScrn->videoRam - 1; + + return TRUE; +} + + +static void S3UnmapMem(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + + if (pS3->S3NewMMIO) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pS3->MMIOBase, + S3_NEWMMIO_REGSIZE); + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pS3->FBBase, + pScrn->videoRam * 1024); + + return; +} + + +static int S3GetPixMuxShift(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int shift = 0; + + if (pS3->Chipset == PCI_CHIP_968) + shift = 1; /* XXX IBMRGB */ + else if (pS3->Chipset == PCI_CHIP_TRIO) + shift = -(pS3->s3Bpp >> 1); + + return shift; +} + +static Bool S3ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr new = &pS3->ModeRegs; + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr pVga = &hwp->ModeReg; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + int vgaIOBase = hwp->IOBase; + int r, n, m; + unsigned char tmp; + + pS3->pixMuxShift = S3GetPixMuxShift(pScrn); + + pS3->s3BppDisplayWidth = pScrn->displayWidth * pS3->s3Bpp; + pS3->HDisplay = mode->HDisplay; + + pS3->s3ScissB = ((pScrn->videoRam * 1024) / pS3->s3BppDisplayWidth) - 1; + pS3->s3ScissR = pScrn->displayWidth - 1; + + if (mode->HTotal == mode->CrtcHTotal) { + if (pS3->pixMuxShift > 0) { + /* XXX hack */ + mode->Flags |= V_PIXMUX; + + mode->CrtcHTotal >>= pS3->pixMuxShift; + mode->CrtcHDisplay >>= pS3->pixMuxShift; + mode->CrtcHSyncStart >>= pS3->pixMuxShift; + mode->CrtcHSyncEnd >>= pS3->pixMuxShift; + mode->CrtcHSkew >>= pS3->pixMuxShift; + } else if (pS3->pixMuxShift < 0) { + mode->Flags |= V_PIXMUX; + + mode->CrtcHTotal <<= -pS3->pixMuxShift; + mode->CrtcHDisplay <<= -pS3->pixMuxShift; + mode->CrtcHSyncStart <<= -pS3->pixMuxShift; + mode->CrtcHSyncEnd <<= -pS3->pixMuxShift; + mode->CrtcHSkew <<= -pS3->pixMuxShift; + } + } + + if (!vgaHWInit(pScrn, mode)) + return FALSE; + + pVga->MiscOutReg |= 0x0c; + pVga->Sequencer[0] = 0x03; + pVga->CRTC[19] = pS3->s3BppDisplayWidth >> 3; + pVga->CRTC[23] = 0xe3; + pVga->Attribute[0x11] = 0xff; + + if (vgaIOBase == 0x3b0) + pVga->MiscOutReg &= 0xfe; + else + pVga->MiscOutReg |= 0x01; + + /* ok i give up also, i'm writing in here */ + + vgaHWProtect(pScrn, TRUE); + + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) { + outb(vgaCRIndex, 0x5c); + tmp = inb(vgaCRReg); + outb(vgaCRReg, tmp & 0xdf); + + S3OutTiIndReg(pScrn, TIDAC_ind_curs_ctrl, 0x7f, 0x00); + } + + pS3->DacInit(pScrn, mode); + + outb(0x3c2, pVga->MiscOutReg); + + for(r=1; r<5; r++) { + outw(0x3c4, (pVga->Sequencer[r] << 8) | r); + } + + for(r=0; r<25; r++) + outw(vgaCRIndex, (pVga->CRTC[r] << 8) | r); + + for(r=0; r<9; r++) { + outw(0x3ce, (pVga->Graphics[r] << 8) | r); + } + + inb(vgaIOBase + 0x0a); + + for(r=0; r<16; r++) { + outb(0x3c0, r); + outb(0x3c0, pVga->Attribute[r]); + } + for(r=16; r<21; r++) { + outb(0x3c0, r | 0x20); + outb(0x3c0, pVga->Attribute[r]); + } + + + new->cr31 = 0x8d; + outb(vgaCRIndex, 0x31); + outb(vgaCRReg, new->cr31); + + new->cr32 = 0x00; + outb(vgaCRIndex, 0x32); + outb(vgaCRReg, new->cr32); + + outb(vgaCRIndex, 0x33); + new->cr33 = inb(vgaCRReg) | 0x20; + if ((pS3->Chipset == PCI_CHIP_964_0) || + (pS3->Chipset == PCI_CHIP_964_1)) + new->cr33 = 0x20; + outb(vgaCRReg, new->cr33); + + new->cr34 = 0x10; + outb(vgaCRIndex, 0x34); + outb(vgaCRReg, new->cr34); + + if (pS3->SlowDRAMRefresh) + new->cr3a = 0xb7; + else + new->cr3a = 0xb5; + outb(vgaCRIndex, 0x3a); + outb(vgaCRReg, new->cr3a); + + if (pS3->Chipset != PCI_CHIP_AURORA64VP) { + new->cr3b = (pVga->CRTC[0] + pVga->CRTC[4] + 1) / 2; + outb(vgaCRIndex, 0x3b); + outb(vgaCRReg, new->cr3b); + } + + new->cr3c = pVga->CRTC[0] / 2; + outb(vgaCRIndex, 0x3c); + outb(vgaCRReg, new->cr3c); + + outb(vgaCRIndex, 0x40); + tmp = inb(vgaCRReg); + new->cr40 = (tmp & 0xf2) | 0x05; + outb(vgaCRReg, new->cr40); + + outb(vgaCRIndex, 0x43); + switch (pScrn->bitsPerPixel) { + case 24: + case 32: + new->cr43 = inb(vgaCRReg); + break; + case 15: + case 16: + if ((pS3->RamDac->RamDacType == IBM524_RAMDAC) || + (pS3->RamDac->RamDacType == IBM524A_RAMDAC) || + (pS3->RamDac->RamDacType == TI3025_RAMDAC)) + new->cr43 = 0x10; + else if (pS3->RamDac->RamDacType == TRIO64_RAMDAC) + new->cr43 = 0x09; + break; + case 8: + default: + new->cr43 = 0x00; + break; + } + outb(vgaCRReg, new->cr43); + + new->cr44 = 0x00; + outb(vgaCRIndex, 0x44); + outb(vgaCRReg, new->cr44); + + outb(vgaCRIndex, 0x45); + new->cr45 = inb(vgaCRReg) & 0xf2; + outb(vgaCRReg, new->cr45); + + outb(vgaCRIndex, 0x50); + tmp = inb(vgaCRReg) & ~0xf1; + switch (pScrn->bitsPerPixel) { + case 8: + break; + case 16: + tmp |= 0x10; + break; + case 24: + tmp |= 0x20; + break; + case 32: + tmp |= 0x30; + break; + } + + switch (pScrn->displayWidth) { + case 640: + tmp |= 0x40; + break; + case 800: + tmp |= 0x80; + break; + case 1152: + tmp |= 0x01; + break; + case 1280: + tmp |= 0xc0; + break; + case 1600: + tmp |= 0x81; + break; + } + new->cr50 = tmp; + outb(vgaCRReg, new->cr50); + + + outb(vgaCRIndex, 0x51); + new->cr51 = (inb(vgaCRReg) & 0xc0) | + ((pS3->s3BppDisplayWidth >> 7) & 0x30); + outb(vgaCRReg, new->cr51); + + outb(vgaCRIndex, 0x53); + new->cr53 = inb(vgaCRReg); + if (pS3->S3NewMMIO) + new->cr53 |= 0x18; + else + new->cr53 &= ~0x18; + outb(vgaCRReg, new->cr53); + + n = 255; + outb(vgaCRIndex, 0x54); + { + int clock2, mclk; + + clock2 = mode->Clock * pS3->s3Bpp; + if (pScrn->videoRam < 2048) + clock2 *= 2; + mclk = pS3->mclk; + m = (int)((mclk/1000.0*.72+16.867)*89.736/(clock2/1000.0+39)-21.1543); + if (pScrn->videoRam < 2048) + m /= 2; + if (m >31) + m = 31; + else if (m < 0) { + m = 0; + n = 16; + } + } + new->cr54 = m << 3; + outb(vgaCRReg, new->cr54); + + if (n < 0) + n = 0; + else if (n > 255) + n = 255; + outb(vgaCRIndex, 0x60); + new->cr60 = n; + outb(vgaCRReg, new->cr60); + + outb(vgaCRIndex, 0x55); + new->cr55 = (inb(vgaCRReg) & 0x08) | 0x40; + outb(vgaCRReg, new->cr55); + + outb(vgaCRIndex, 0x5e); + new->cr5e = (((mode->CrtcVTotal - 2) & 0x400) >> 10) | + (((mode->CrtcVDisplay - 1) & 0x400) >> 9) | + (((mode->CrtcVSyncStart) & 0x400) >> 8) | + (((mode->CrtcVSyncStart) & 0x400) >> 6) | 0x40; + outb(vgaCRReg, new->cr5e); + + { + int i; + unsigned int j; + + i = ((((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8) | + ((((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7) | + ((((mode->CrtcHSyncStart >> 3) - 1) & 0x100) >> 6) | + ((mode->CrtcHSyncStart & 0x800) >> 7); + if ((mode->CrtcHSyncEnd >> 3) - (mode->CrtcHSyncStart >> 3) > 64) + i |= 0x08; + if ((mode->CrtcHSyncEnd >> 3) - (mode->CrtcHSyncStart >> 3) > 32) + i |= 0x20; + + outb(vgaCRIndex, 0x3b); + j = ((pVga->CRTC[0] + ((i & 0x01) << 8) + + pVga->CRTC[4] + ((i & 0x10) << 4) + 1) / 2); + + if (j - (pVga->CRTC[4] + ((i & 0x10) << 4)) < 4) { + if (pVga->CRTC[4] + ((i & 0x10) << 4) + 4 <= pVga->CRTC[0] + ((i & 0x01) << 8)) + j = pVga->CRTC[4] + ((i & 0x10) << 4) + 4; + else + j = pVga->CRTC[0] + ((i & 0x01) << 8) + 1; + } + if (pS3->Chipset == PCI_CHIP_AURORA64VP) { + outb(vgaCRReg, 0x00); + i &= ~0x40; + } else { + new->cr3b = j & 0xff; + outb(vgaCRReg, new->cr3b); + i |= (j & 0x100) >> 2; + } + + outb(vgaCRIndex, 0x3c); + new->cr3c = (pVga->CRTC[0] + ((i & 0x01) << 8)) / 2; + outb(vgaCRReg, new->cr3c); + + outb(vgaCRIndex, 0x5d); + new->cr5d = (inb(vgaCRReg) & 0x80) | i; + outb(vgaCRReg, new->cr5d); + } + + { + int i; + + if (pScrn->videoRam > 1024) + i = mode->HDisplay * pS3->s3Bpp / 8 + 1; + else + i = mode->HDisplay * pS3->s3Bpp / 4 + 1; + + outb(vgaCRIndex, 0x61); + tmp = 0x80 | (inb(vgaCRReg) & 0x60) | (i >> 8); + new->cr61 = tmp; + outb(vgaCRReg, new->cr61); + outb(vgaCRIndex, 0x62); + new->cr62 = i & 0xff; + outb(vgaCRReg, new->cr62); + } + + outb(vgaCRIndex, 0x42); + new->cr42 = inb(vgaCRReg) & ~0x20; + outb(vgaCRReg, new->cr42); + + if (pS3->Chipset == PCI_CHIP_968) { + unsigned char a; + + outb(vgaCRIndex, 0x67); + a = inb(vgaCRReg) & 0xfe; +#if 0 + switch (pScrn->depth) { + case 8: + break; + case 15: + a |= (3 << 4); + break; + case 16: + a |= (5 << 4); + a |= (3 << 2); /* streams */ + break; + case 24: + a |= (13 << 4); + a |= (3 << 2); /* streams */ + break; + } +#endif + outb(vgaCRReg, a); + + outb(vgaCRIndex, 0x6d); + outb(vgaCRReg, 0x00); + } + + if ((pS3->Chipset == PCI_CHIP_964_0) || + (pS3->Chipset == PCI_CHIP_964_1)) { + unsigned char bdelay; + + outb(vgaCRIndex, 0x6d); + bdelay = inb(vgaCRReg); + + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) { + if (pS3->s3Bpp == 1) { + if (mode->Clock > 80000) + bdelay = 0x02; + else + bdelay = 0x03; + } else if (pS3->s3Bpp == 2) { + if (mode->Clock > 80000) + bdelay = 0x00; + else + bdelay = 0x01; + } else + bdelay = 0x00; + } + + outb(vgaCRReg, bdelay); + } + + outb(vgaCRIndex, 0x66); + new->cr66 = inb(vgaCRReg); + if (pS3->S3NewMMIO) + new->cr66 |= 0x88; + else + new->cr66 |= 0x80; + outb(vgaCRReg, new->cr66); + + if (pS3->SlowVRAM) { + /* + * some Diamond Stealth 64 VRAM cards have a problem with + * VRAM timing, increas -RAS low timing from 3.5 MCLKs + * to 4.5 MCLKs + */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + outb(vgaCRIndex, 0x68); + tmp = inb(vgaCRReg); + if (tmp & 0x30) /* 3.5 MCLKs */ + outb(vgaCRReg, tmp & 0xef); /* 4.5 MCLKs */ + } + + if (pS3->SlowDRAM) { + /* + * fixes some pixel errors for a SPEA Trio64V+ card + * increas -RAS precharge timing from 2.5 MCLKs + * to 3.5 MCLKs + */ + outb(vgaCRIndex, 0x39); + outb(vgaCRReg, 0xa5); + outb(vgaCRIndex, 0x68); + tmp = inb(vgaCRReg) & 0xf7; + outb(vgaCRReg, tmp); /* 3.5 MCLKs */ + } + + if (pS3->SlowEDODRAM) { + /* + * fixes some pixel errors for a SPEA Trio64V+ card + * increas from 1-cycle to 2-cycle EDO mode + */ + outb(vgaCRIndex, 0x39); + + outb(vgaCRReg, 0xa5); + outb(vgaCRIndex, 0x36); + tmp = inb(vgaCRReg); + if (!(tmp & 0x0c)) /* 1-cycle EDO */ + outb(vgaCRReg, tmp | 0x08); /* 2-cycle EDO */ + } + + if (pS3->Chipset == PCI_CHIP_AURORA64VP) { + outb(0x3c4, 0x08); + outb(0x3c5, 0x06); +#if 0 + outb(0x3c4, 0x54); + outb(0x3c5, 0x10); + outb(0x3c4, 0x55); + outb(0x3c5, 0x00); + outb(0x3c4, 0x56); + outb(0x3c5, 0x1c); + outb(0x3c4, 0x57); + outb(0x3c5, 0x00); +#else + outb(0x3c4, 0x54); + outb(0x3c5, 0x1f); + outb(0x3c4, 0x55); + outb(0x3c5, 0x1f); + outb(0x3c4, 0x56); + outb(0x3c5, 0x1f); + outb(0x3c4, 0x57); + outb(0x3c5, 0x1f); +#endif + + outb(0x3c4, 0x08); + outb(0x3c5, 0x00); + } + + pScrn->AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + vgaHWProtect(pScrn, FALSE); + + if (pScrn->displayWidth == 1024) + outw(ADVFUNC_CNTL, 0x0007); + else + outw(ADVFUNC_CNTL, 0x0003); + + outb(0x3c6, 0x00); + + outw(SUBSYS_CNTL, 0x8000 | 0x1000); + outw(SUBSYS_CNTL, 0x4000 | 0x1000); + + inw(SUBSYS_STAT); + + outw(0xbee8, 0x5000 | 0x0004 | 0x000c); + + outb(0x3c6, 0xff); + + new->cr59 = pS3->FBAddress >> 24; + new->cr5a = pS3->FBAddress >> 16; + + if (pScrn->videoRam <= 1024) + new->cr58 = 0x15; + else if (pScrn->videoRam <= 2048) + new->cr58 = 0x16; + else + new->cr58 = 0x17; + + if (pS3->Chipset == PCI_CHIP_968) + new->cr58 = 0x52; + else if ((pS3->Chipset == PCI_CHIP_964_0) || + (pS3->Chipset == PCI_CHIP_964_1)) + new->cr58 |= 0x40; + + outb(vgaCRIndex, 0x59); + outb(vgaCRReg, new->cr59); + outb(vgaCRIndex, 0x5a); + outb(vgaCRReg, new->cr5a); + outb(vgaCRIndex, 0x58); + outb(vgaCRReg, new->cr58); + + WaitQueue(5); + SET_SCISSORS(0, 0, pS3->s3ScissR, pS3->s3ScissB); + + outb(vgaCRIndex, 0x6f); + +#if 0 + if (((pScrn->bitsPerPixel == 16) || + (pScrn->bitsPerPixel == 24)) && (pS3->S3NewMMIO)) + S3InitStreams(pScrn, mode); +#endif + + return TRUE; +} + + +static Bool S3EnterVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + vgaHWPtr hwp = VGAHWPTR(pScrn); + + vgaHWUnlock(hwp); + + if (!S3ModeInit(pScrn, pScrn->currentMode)) + return FALSE; + + return TRUE; +} + + +static void S3Restore(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr restore = &pS3->SavedRegs; + vgaHWPtr hwp = VGAHWPTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + int i; + + vgaHWProtect(pScrn, TRUE); + + WaitQueue(8); + + S3BankZero(pScrn); + + outw(ADVFUNC_CNTL, 0x0000); + + if (pS3->S3NewMMIO) { + outb(vgaCRIndex, 0x53); + outb(vgaCRReg, 0x00); + } + + pS3->DacRestore(pScrn); + + if (pS3->RamDac->RamDacType == TI3025_RAMDAC) { + outb(vgaCRIndex, 0x5c); + outb(vgaCRReg, restore->s3syssave[0x0c + 16]); + } + + for(i=32; i<46; i++) { + outb(vgaCRIndex, 0x40 + i); + outb(vgaCRReg, restore->s3syssave[i]); + } + + for(i=0; i<16; i++) { + if (!((1 << i) & 0x673b)) + continue; + outb(vgaCRIndex, 0x50 + i); + outb(vgaCRReg, restore->s3syssave[i+16]); + } + + for(i=0; i<5; i++) { + outb(vgaCRIndex, 0x30 + i); + outb(vgaCRReg, restore->s3save[i]); + outb(vgaCRIndex, 0x38 + i); + outb(vgaCRReg, restore->s3save[i + 5]); + } + + for(i=0; i<16; i++) { + outb(vgaCRIndex, 0x40 + i); + outb(vgaCRReg, restore->s3syssave[i]); + } + + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4a); + for(i=0; i<4; i++) + outb(vgaCRReg, restore->color_stack[i]); + + outb(vgaCRIndex, 0x45); + inb(vgaCRReg); + outb(vgaCRIndex, 0x4b); + for(i=4; i<8; i++) + outb(vgaCRReg, restore->color_stack[i]); + + vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_ALL); + + outb(0x3c2, restore->clock); + + vgaHWProtect(pScrn, FALSE); + +} + + +static void S3LeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + vgaHWPtr hwp = VGAHWPTR(pScrn); + + S3Restore(pScrn); + vgaHWLock(hwp); + + return; +} + + +static void S3AdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + S3Ptr pS3 = S3PTR(pScrn); + S3RegPtr regs = &pS3->ModeRegs; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + int base, orig_base; + unsigned char tmp; + + if (x > pScrn->displayWidth - pS3->HDisplay) + x = pScrn->displayWidth - pS3->HDisplay; + + orig_base = (y * pScrn->displayWidth + x) * pS3->s3Bpp; + base = (orig_base >> 2) & ~1; + + /* for IBMRGB and TI only */ + if (pS3->RamDac->RamDacType == IBM524A_RAMDAC) + { + int px, py, a; + + miPointerPosition(&px, &py); + + if (pS3->s3Bpp == 1) + a = 4 - 1; + else + a = 8 - 1; + if (px-x > pS3->HDisplay/2) + base = ((orig_base + a*4) >> 2) & ~1; + base &= ~a; + } + + outb(vgaCRIndex, 0x31); + outb(vgaCRReg, ((base & 0x030000) >> 12) | regs->cr31); + regs->cr51 &= ~0x03; + regs->cr51 |= ((base & 0x0c0000) >> 18); + outb(vgaCRIndex, 0x51); + tmp = (inb(vgaCRReg) & ~0x03) | (regs->cr51 & 0x03); + outb(vgaCRReg, tmp); + + outw(vgaCRIndex, (base & 0x00ff00) | 0x0c); + outw(vgaCRIndex, ((base & 0x00ff) << 8) | 0x0d); +} + + +void S3Regdump(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + +#if 1 + outb(vgaCRIndex, 0x31); + ErrorF("cr31 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x32); + ErrorF("cr32 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x33); + ErrorF("cr33 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x34); + ErrorF("cr34 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x3a); + ErrorF("cr3a = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x3b); + ErrorF("cr3b = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x3c); + ErrorF("cr3c = 0x%x\n", inb(vgaCRReg)); + + outb(vgaCRIndex, 0x40); + ErrorF("cr40 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x42); + ErrorF("cr42 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x43); + ErrorF("cr43 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x44); + ErrorF("cr44 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x45); + ErrorF("cr45 = 0x%x\n", inb(vgaCRReg)); + + outb(vgaCRIndex, 0x50); + ErrorF("cr50 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x51); + ErrorF("cr51 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x53); + ErrorF("cr53 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x54); + ErrorF("cr54 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x55); + ErrorF("cr55 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x58); + ErrorF("cr58 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x59); + ErrorF("cr59 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x5a); + ErrorF("cr5a = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x5d); + ErrorF("cr5d = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x5e); + ErrorF("cr5e = 0x%x\n", inb(vgaCRReg)); + + outb(vgaCRIndex, 0x60); + ErrorF("cr60 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x61); + ErrorF("cr61 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x62); + ErrorF("cr62 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x65); + ErrorF("cr65 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x66); + ErrorF("cr66 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x67); + ErrorF("cr67 = 0x%x\n", inb(vgaCRReg)); + outb(vgaCRIndex, 0x6d); + ErrorF("cr6d = 0x%x\n", inb(vgaCRReg)); + +#else + { + int j; + + for(j=0; j<0x100; j++) { + outb(vgaCRIndex, j); + ErrorF("CRTC 0x%x = 0x%x\n", j, inb(vgaCRReg)); + } + } +#endif + +#if 0 + ErrorF("DAC regs\n"); + + { + int j; + + for(j=0; j<0x100; j++) + ErrorF("0x%x = 0x%x\n", j, S3InTiIndReg(pScrn, j)); +#if 0 + outb(vgaCRIndex, 0x22); + ErrorF("cr22 = 0x%x\n", inb(vgaCRReg)); +#endif + } +#endif +} + + +void S3BankZero(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + unsigned char tmp; + int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; + + outb(vgaCRIndex, 0x35); + tmp = inb(vgaCRReg) & 0xf0; + outb(vgaCRReg, tmp); + + outb(vgaCRIndex, 0x51); + tmp = inb(vgaCRReg) & 0xf3; + outb(vgaCRReg, tmp); +} + + + +static void S3DisplayPowerManagementSet(ScrnInfoPtr pScrn, + int PowerManagementMode, int flags) +{ + vgaHWDPMSSet(pScrn, PowerManagementMode, flags); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_reg.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_reg.h:1.1 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_reg.h Mon Jul 2 06:46:04 2001 @@ -0,0 +1,262 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_reg.h,v 1.1 2001/07/02 10:46:04 alanh Exp $ */ + +#ifndef _S3_REG_H +#define _S3_REG_H + +#include "compiler.h" + +extern short s3alu[16]; + +#define S3_NEWMMIO_REGBASE 0x1000000 /* 16MB */ +#define S3_NEWMMIO_REGSIZE 0x10000 /* 64KB */ + +#define ADVFUNC_CNTL 0x4ae8 +#define SUBSYS_STAT 0x42e8 +#define SUBSYS_CNTL 0x42e8 +#define CUR_Y 0x82e8 +#define CUR_X 0x86e8 +#define CUR_Y2 0x82ea +#define CUR_X2 0x86ea +#define DESTY_AXSTP 0x8ae8 +#define DESTX_DIASTP 0x8ee8 +#define DESTY_AXSTP2 0x8aea +#define DESTX_DIASTP2 0x8eea +#define ERR_TERM 0x92e8 +#define ERR_TERM2 0x92ea +#define MAJ_AXIS_PCNT 0x96e8 +#define MAJ_AXIS_PCNT2 0x96ea +#define GP_STAT 0x9ae8 +#define CMD 0x9ae8 +#define CMD2 0x9aea +#define BKGD_COLOR 0xa2e8 +#define FRGD_COLOR 0xa6e8 +#define WRT_MASK 0xaae8 +#define RD_MASK 0xaee8 +#define COLOR_CMP 0xb2e8 +#define BKGD_MIX 0xb6e8 +#define FRGD_MIX 0xbae8 +#define MULTIFUNC_CNTL 0xbee8 +#define PIX_TRANS 0xe2e8 +#define PIX_TRANS_EXT 0xe2ea + +/* Graphics Processor Status Register */ +#define GPBUSY 0x0200 + +/* Command Register */ +#define CMD_NOP 0x0000 +#define CMD_LINE 0x2000 +#define CMD_RECT 0x4000 +#define CMD_RECTV1 0x6000 +#define CMD_RECTV2 0x8000 +#define CMD_LINEAF 0xa000 +#define CMD_BITBLT 0xc000 +#define CMD_PFILL 0xe000 +#define CMD_OP_MSK 0xf000 +#define BYTSEQ 0x1000 +#define _16BIT 0x0200 +#define _32BIT 0x0400 +#define PCDATA 0x0100 +#define INC_Y 0x0080 +#define YMAJAXIS 0x0040 +#define INC_X 0x0020 +#define DRAW 0x0010 +#define LINETYPE 0x0008 +#define LASTPIX 0x0004 +#define PLANAR 0x0002 +#define WRTDATA 0x0001 + + +/* Background Mix Register */ +#define BSS_BKGDCOL 0x0000 +#define BSS_FRGDCOL 0x0020 +#define BSS_PCDATA 0x0040 +#define BSS_BITBLT 0x0060 + +/* Foreground Mix Register */ +#define FSS_BKGDCOL 0x0000 +#define FSS_FRGDCOL 0x0020 +#define FSS_PCDATA 0x0040 +#define FSS_BITBLT 0x0060 + +#define PIX_CNTL 0xa000 +#define MIN_AXIS_PCNT 0x0000 + +/* Pixel Control Register */ +#define MIXSEL_EXPPC 0x0080 + +#define SCISSORS_T 0x1000 +#define SCISSORS_L 0x2000 +#define SCISSORS_B 0x3000 +#define SCISSORS_R 0x4000 +#define MULT_MISC2 0xd000 +#define MULT_MISC 0xe000 + + +#define MIX_MASK 0x001f + +#define MIX_NOT_DST 0x0000 +#define MIX_0 0x0001 +#define MIX_1 0x0002 +#define MIX_DST 0x0003 +#define MIX_NOT_SRC 0x0004 +#define MIX_XOR 0x0005 +#define MIX_XNOR 0x0006 +#define MIX_SRC 0x0007 +#define MIX_NAND 0x0008 +#define MIX_NOT_SRC_OR_DST 0x0009 +#define MIX_SRC_OR_NOT_DST 0x000a +#define MIX_OR 0x000b +#define MIX_AND 0x000c +#define MIX_SRC_AND_NOT_DST 0x000d +#define MIX_NOT_SRC_AND_DST 0x000e +#define MIX_NOR 0x000f + +#define MIX_MIN 0x0010 +#define MIX_DST_MINUS_SRC 0x0011 +#define MIX_SRC_MINUS_DST 0x0012 +#define MIX_PLUS 0x0013 +#define MIX_MAX 0x0014 +#define MIX_HALF__DST_MINUS_SRC 0x0015 +#define MIX_HALF__SRC_MINUS_DST 0x0016 +#define MIX_AVERAGE 0x0017 +#define MIX_DST_MINUS_SRC_SAT 0x0018 +#define MIX_SRC_MINUS_DST_SAT 0x001a +#define MIX_HALF__DST_MINUS_SRC_SAT 0x001c +#define MIX_HALF__SRC_MINUS_DST_SAT 0x001e +#define MIX_AVERAGE_SAT 0x001f + +/* + * Short Stroke Vector Transfer Register (The angular Defs also apply to +the + * Command Register + */ +#define VECDIR_000 0x0000 +#define VECDIR_045 0x0020 +#define VECDIR_090 0x0040 +#define VECDIR_135 0x0060 +#define VECDIR_180 0x0080 +#define VECDIR_225 0x00a0 +#define VECDIR_270 0x00c0 +#define VECDIR_315 0x00e0 +#define SSVDRAW 0x0010 + + +#define S3_OUTW(p,n) outw(p, n) +#define S3_OUTL(p,n) outl(p, n) +#define S3_OUTW32(p,n) if (pS3->s3Bpp > 2) { \ + outw(p, n); \ + outw(p, (n) >> 16); \ + } else outw(p, n) + + +#define WaitIdle() do { \ + mem_barrier(); \ + while(inw(GP_STAT) & GPBUSY); \ + } while(0) + + +#ifdef S3_NEWMMIO +#include "newmmio.h" + +/* + * streams regs + */ +#define SET_BLEND_CNTL(val) ((mmtr)s3MmioMem)->streams_regs.regs.blend_cntl = (val) +#define SET_PSTREAM_CNTL(val) ((mmtr)s3MmioMem)->streams_regs.regs.prim_stream_cntl = (val) +#define SET_PSTREAM_FBADDR(val) ((mmtr)s3MmioMem)->streams_regs.regs.prim_fbaddr0 = (val) +#define SET_PSTREAM_STRIDE(val) ((mmtr)s3MmioMem)->streams_regs.regs.prim_stream_stride = (val) +#define SET_PSTREAM_START(val) ((mmtr)s3MmioMem)->streams_regs.regs.prim_start_coord = (val) +#define SET_PSTREAM_WIND(val) ((mmtr)s3MmioMem)->streams_regs.regs.prim_window_size = (val) +#define SET_SSTREAM_CNTL(val) ((mmtr)s3MmioMem)->streams_regs.regs.second_stream_cntl = (val) +#define SET_SSTRETCH(val) ((mmtr)s3MmioMem)->streams_regs.regs.second_stream_stretch = (val) +#define SET_SSTREAM_FBADDR(val) ((mmtr)s3MmioMem)->streams_regs.regs.second_fbaddr0 = (val) +#define SET_SSTREAM_STRIDE(val) ((mmtr)s3MmioMem)->streams_regs.regs.second_stream_stride = (val) +#define SET_SSTREAM_START(val) ((mmtr)s3MmioMem)->streams_regs.regs.second_start_coord = (val) +#define SET_SSTREAM_WIND(val) ((mmtr)s3MmioMem)->streams_regs.regs.second_window_size = (val) +#define SET_K1_VSCALE(val) ((mmtr)s3MmioMem)->streams_regs.regs.k1 = (val) +#define SET_K2_VSCALE(val) ((mmtr)s3MmioMem)->streams_regs.regs.k2 = (val) +#define SET_DDA_VERT(val) ((mmtr)s3MmioMem)->streams_regs.regs.dda_vert = (val) +#define SET_CHROMA_KEY(val) ((mmtr)s3MmioMem)->streams_regs.regs.col_chroma_key_cntl = (val) +#define SET_DOUBLE_BUFFER(val) ((mmtr)s3MmioMem)->streams_regs.regs.double_buffer = (val) +#define SET_OPAQUE_OVERLAY(val) ((mmtr)s3MmioMem)->streams_regs.regs.opaq_overlay_cntl = (val) + +#else + +#define CMD_REG_WIDTH 0x0000 + +#define WaitQueue(n) do { \ + mem_barrier(); \ + while(inb(GP_STAT) & (0x0100 >> (n))); \ + } while (0) + +#define WaitQueue16_32(n16,n32) \ + if (pS3->s3Bpp <= 2) { \ + WaitQueue(n16); \ + } else { \ + WaitQueue(n32); \ + } + +#define VerticalRetraceWait() \ + { \ + outb(vgaCRIndex, 0x17); \ + if (inb(vgaCRReg) & 0x80) { \ + while ((inb(vgaCRIndex-4+0x0a) & 0x08) == 0x00); \ + while ((inb(vgaCRIndex-4+0x0a) & 0x08) == 0x08); \ + } \ + } + +/* accel commands */ + +#define SET_PIX_CNTL(val) S3_OUTW(MULTIFUNC_CNTL, PIX_CNTL | (val)) + +#define SET_FRGD_COLOR(col) S3_OUTW32(FRGD_COLOR, col) +#define SET_BKGD_COLOR(col) S3_OUTW32(BKGD_COLOR, col) + +#define SET_FRGD_MIX(fmix) S3_OUTW(FRGD_MIX, (fmix)) +#define SET_WRT_MASK(mask) S3_OUTW32(WRT_MASK, mask) + +#define SET_CUR_X(cur_x) S3_OUTW(CUR_X, cur_x) +#define SET_CUR_Y(cur_y) S3_OUTW(CUR_Y, cur_y) +#define SET_CUR_X2(cur_x) S3_OUTW(CUR_X2, cur_x) +#define SET_CUR_Y2(cur_y) S3_OUTW(CUR_Y2, cur_y) + +#define SET_CURPT(cur_x, cur_y) { \ + SET_CUR_X(cur_x); \ + SET_CUR_Y(cur_y); \ + } + +#define SET_DESTSTP(x,y) { \ + S3_OUTW(DESTX_DIASTP, x); \ + S3_OUTW(DESTY_AXSTP, y); \ + } + +#define SET_AXIS_PCNT(maj, min) { \ + S3_OUTW(MAJ_AXIS_PCNT, maj); \ + S3_OUTW(MULTIFUNC_CNTL, MIN_AXIS_PCNT | (min)); \ + } + +#define SET_CMD(cmd) S3_OUTW(CMD, cmd) + +#define SET_SCISSORS(x1,y1,x2,y2) { \ + S3_OUTW(MULTIFUNC_CNTL, SCISSORS_T | (y1)); \ + S3_OUTW(MULTIFUNC_CNTL, SCISSORS_L | (x1)); \ + S3_OUTW(MULTIFUNC_CNTL, SCISSORS_R | (x2)); \ + S3_OUTW(MULTIFUNC_CNTL, SCISSORS_B | (y2)); \ + } + +#define SET_MULT_MISC(val) S3_OUTW(MULTIFUNC_CNTL, MULT_MISC | (val)) + +#define SET_COLOR_CMP(color) S3_OUTW32(COLOR_CMP, color) + +#define SET_PIX_TRANS_W(val) S3_OUTW(PIX_TRANS, val) + +#define SET_PIX_TRANS_L(val) outl(PIX_TRANS, val) + +#define SET_ERR_TERM(err) S3_OUTW(ERR_TERM, err) +#define SET_ERR_TERM2(err) S3_OUTW(ERR_TERM2, err) + +#define SET_MAJ_AXIS_PCNT(maj) S3_OUTW(MAJ_AXIS_PCNT, maj) +#endif + + +#endif /* _S3_REG_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c:1.2 --- /dev/null Fri Jan 18 15:25:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c Wed Aug 15 07:54:27 2001 @@ -0,0 +1,669 @@ +/* + * Copyright 2001 Ani Joshi <ajoshi@unixbox.com> + * + * XFree86 4.x driver for S3 chipsets + * + * + * 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 Ani Joshi not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Ani Joshi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c,v 1.2 2001/08/15 11:54:27 tsi Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +#include "compiler.h" + +#include "s3.h" +#include "s3_reg.h" + + +#define CLIENT_VIDEO_ON 0x04 +#define S3_MAX_PORTS 1 +#define NUM_FORMATS_OVERLAY 4 +#define NUM_FORMATS_TEXTURE 4 + + +static XF86VideoAdaptorPtr S3AllocAdaptor(ScrnInfoPtr pScrn); +static XF86VideoAdaptorPtr S3SetupImageVideoOverlay(ScreenPtr); +static int S3SetPortAttributeOverlay(ScrnInfoPtr, Atom, INT32, pointer); +static int S3GetPortAttributeOverlay(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void S3StopVideo(ScrnInfoPtr, pointer, Bool); +static void S3QueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, + unsigned int *, unsigned int *, pointer); +static int S3PutImage(ScrnInfoPtr, short, short, short, short, short, + short, short, short, int, unsigned char*, short, + short, Bool, RegionPtr, pointer); +static int S3QueryImageAttributes(ScrnInfoPtr, int, unsigned short *, + unsigned short *, int *, int *); +static void S3ResetVideoOverlay(ScrnInfoPtr); + + + +void S3InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + + if (((pScrn->bitsPerPixel == 16) || + (pScrn->bitsPerPixel == 24)) && (pS3->S3NewMMIO)) { + newAdaptor = S3SetupImageVideoOverlay(pScreen); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using overlay video\n"); + } else + return; + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); +} + + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[2] = +{ + { /* overlay limit */ + 0, + "XV_IMAGE", + 1024, 1024, + {1, 1} + }, + { /* texture limit */ + 0, + "XV_IMAGE", + 2046, 2046, + {1, 1} + } +}; + + + + +static XF86VideoFormatRec Formats[NUM_FORMATS_TEXTURE] = +{ + /*{15, TrueColor},*/ {16, TrueColor}, {24, TrueColor} /* , + {15, DirectColor}*/, {16, DirectColor}, {24, DirectColor} +}; + + + +#define NUM_IMAGES 3 + +static XF86ImageRec Images[NUM_IMAGES] = +{ + XVIMAGE_YUY2, + /* As in mga, YV12 & I420 are converted to YUY2 on the fly by */ + /* copy over conversion. */ + XVIMAGE_YV12, + XVIMAGE_I420 + /* XVIMAGE_UYVY */ +}; + + + +static int S3SetPortAttributeOverlay(ScrnInfoPtr pScrn, Atom attribute, + INT32 value, pointer data) +{ + return BadMatch; +} + + +static int S3GetPortAttributeOverlay(ScrnInfoPtr pScrn, Atom attribute, + INT32 *value, pointer data) +{ + return BadMatch; +} + + + +static void S3QueryBestSize(ScrnInfoPtr pScrn, Bool motion, short vid_w, + short vid_h, short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data) +{ + *p_w = drw_w; + *p_h = drw_h; +} + + + +static void S3CopyData(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 S3CopyMungedData(unsigned char *src1, unsigned char *src2, + unsigned char *src3, 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++) { + dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | + (src3[i] << 8) | (src2[i] << 24); + } + dst += dstPitch; + src1 += srcPitch; + if(j & 1) { + src2 += srcPitch2; + src3 += srcPitch2; + } + } +} + + + +static void S3ResetVideoOverlay(ScrnInfoPtr pScrn) +{ +} + + +static XF86VideoAdaptorPtr S3AllocAdaptor(ScrnInfoPtr pScrn) +{ + S3Ptr pS3 = S3PTR(pScrn); + XF86VideoAdaptorPtr adapt; + S3PortPrivPtr pPriv; + int i; + + if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) + return NULL; + + if(!(pPriv = xcalloc(1, sizeof(S3PortPrivRec) + + (sizeof(DevUnion) * S3_MAX_PORTS)))) + { + xfree(adapt); + return NULL; + } + + adapt->pPortPrivates = (DevUnion*)(&pPriv[1]); + + for(i = 0; i < S3_MAX_PORTS; i++) + adapt->pPortPrivates[i].val = i; + + pPriv->colorKey = (1 << pScrn->offset.red) | (1 << pScrn->offset.green) | + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); + + pPriv->videoStatus = 0; + pPriv->lastPort = -1; + + pS3->adaptor = adapt; + pS3->portPrivate = pPriv; + + return adapt; +} + + +static XF86VideoAdaptorPtr S3SetupImageVideoOverlay(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + XF86VideoAdaptorPtr adapt; + + adapt = S3AllocAdaptor(pScrn); + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "S3 Backend Scaler"; + adapt->nEncodings = 1; + adapt->pEncodings = &DummyEncoding[0]; + adapt->nFormats = NUM_FORMATS_OVERLAY; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pAttributes = NULL /*Attributes*/; + adapt->nImages = 3; + adapt->nAttributes = 0; + + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = S3StopVideo; + /* Empty Attrib functions - required anyway */ + adapt->SetPortAttribute = S3SetPortAttributeOverlay; + adapt->GetPortAttribute = S3GetPortAttributeOverlay; + adapt->QueryBestSize = S3QueryBestSize; + adapt->PutImage = S3PutImage; + adapt->QueryImageAttributes = S3QueryImageAttributes; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &(pS3->portPrivate->clip), NullBox, 0); + + S3ResetVideoOverlay(pScrn); + + return adapt; +} + + + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} + + + +static Bool S3ClipVideo(BoxPtr dst, INT32 *x1, INT32 *x2, INT32 *y1, INT32 *y2, + 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); + 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(*x1 >= *x2) return FALSE; + + 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; + } + 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 S3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3PortPrivPtr pPriv = pS3->portPrivate; + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if (exit) { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) + SET_BLEND_CNTL(0x01000000); + + if (pPriv->area) { + xf86FreeOffscreenArea(pPriv->area); + pPriv->area = NULL; + } + + pPriv->videoStatus = 0; + } +} + + +static FBAreaPtr S3AllocateMemory(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 S3DisplayVideoOverlay(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) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3PortPrivPtr pPriv = pS3->portPrivate; + int tmp; + + if (drw_w == src_w) + tmp = 0; + else + tmp = 2; + + SET_SSTREAM_CNTL(tmp << 28 | 0x01000000 | + ((((src_w-1)<<1)-(drw_w-1)) & 0xfff)); + SET_SSTRETCH(((src_w - 1) & 0x7ff) | (((src_w-drw_w) & 0x7ff) << 16)); + SET_BLEND_CNTL(0x05000000); + SET_SSTREAM_FBADDR(offset & 0x3fffff); + SET_SSTREAM_STRIDE(pitch & 0xfff); + + SET_K1_VSCALE(src_h - 1); + SET_K2_VSCALE((src_h - drw_h) & 0x7ff); + + SET_DDA_VERT((((~drw_h)-1)) & 0xfff); + + SET_SSTREAM_START(((dstBox->x1 +1) << 16) | (dstBox->y1 +1)); + SET_SSTREAM_WIND(( ((drw_w-1) << 16) | (drw_h ) ) & 0x7ff07ff); + + SET_CHROMA_KEY(0x10000000 | + ((pScrn->weight.red-1) << 24) | + ((pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red) << + (16 + 8-pScrn->weight.red) | + ((pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green) << + (8 + 8-pScrn->weight.green) | + ((pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue) << + (8-pScrn->weight.blue)); +} + + +static int S3PutImage(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) +{ + S3Ptr pS3 = S3PTR(pScrn); + S3PortPrivPtr pPriv = pS3->portPrivate; + INT32 x1, x2, y1, y2; + unsigned char *dst_start; + int pitch, new_h, offset, offset2=0, offset3=0; + int srcPitch, srcPitch2=0, dstPitch; + int top, left, npixels, nlines; + BoxRec dstBox; + CARD32 tmp; + static int once = 1; + static int once2 = 1; + + /* 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; + + if(!S3ClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) + return Success; + + /*if(!pMga->TexturedVideo) {*/ + 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_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + offset2 = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + offset3 = (srcPitch2 * (height >> 1)) + offset2; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + srcPitch = (width << 1); + break; + } + + if(!(pPriv->area = S3AllocateMemory(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; + dst_start = pS3->FBBase + offset + left + (top * dstPitch); + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + tmp = ((top >> 1) * srcPitch2) + (left >> 2); + offset2 += tmp; + offset3 += tmp; + if(id == FOURCC_I420) { + tmp = offset2; + offset2 = offset3; + offset3 = tmp; + } + nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + S3CopyMungedData(buf + (top * srcPitch) + (left >> 1), + buf + offset2, buf + offset3, dst_start, + srcPitch, srcPitch2, dstPitch, nlines, npixels); + once2 = 0; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + buf += (top * srcPitch) + left; + nlines = ((y2 + 0xffff) >> 16) - top; + S3CopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + once = 0; + break; + } + + /* update cliplist */ + if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + (*pS3->pXAA->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + offset += left + (top * dstPitch); + S3DisplayVideoOverlay(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 S3QueryImageAttributes(ScrnInfoPtr pScrn, int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets) +{ + int size, tmp; + + *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; +} + + + +void S3InitStreams(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + S3Ptr pS3 = S3PTR(pScrn); + unsigned int pst_wind = (mode->HDisplay-1) << 16 | (mode->VDisplay); + + SET_PSTREAM_CNTL(0x05000000 & 0x77000000); + SET_CHROMA_KEY(0x00); + SET_SSTREAM_CNTL(0x03000000); + SET_BLEND_CNTL(0x01000000); + SET_PSTREAM_STRIDE((pScrn->displayWidth * 2) & 0x0fff); + SET_SSTREAM_STRIDE(0x01); + SET_OPAQUE_OVERLAY(0x40000000); + SET_PSTREAM_START(0x00010001); + SET_PSTREAM_WIND(pst_wind & 0x07ff07ff); + SET_SSTREAM_START(0x07ff07ff); + SET_SSTREAM_WIND(0x00010001); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/README diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/README:1.9 xc/programs/Xserver/hw/xfree86/drivers/s3virge/README:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/README:1.9 Wed Jun 14 17:57:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/README Wed Nov 21 17:43:00 2001 @@ -24,6 +24,8 @@ - "Rotate" " cw "|" ccw " Rotate the screen CW - clockwise or CCW - counter clockwise. Disables HW Acceleration and HW Cursor, uses ShadowFB. Default: no rotation. +- "XVideo" Disable XVideo support by using the off option. This changes FIFO + settings which prevent screen noise for high-res modes. Default: on Video memory: @@ -82,6 +84,8 @@ Debug: - "ShowCache" Enable or disable viewing offscreen cache memory. A development debug option. Default: off. +- "mx_cr3a_fix" Enable or disable a cr3a fix added for ViRGE MX. + Default: on. -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/README,v 1.9 2000/06/14 21:57:54 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/README,v 1.10 2001/11/21 22:43:00 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.19 xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.19 Thu Feb 8 22:23:29 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES Mon Jan 14 13:02:58 2002 @@ -1,7 +1,7 @@ S3 ViRGE 4.0 devel notes rev: -3 Jan 2001 KJB +10 Jan 2002 KJB Function Implemented @@ -23,6 +23,55 @@ Status ------ +1/10/02 +Ver 1.8.3 +DGA fix, buffer pointer used wrong value. Submitted for 4.2.0 (late). + +Ver 1.8.2 +DPMS testing (display DPMS status, disable MX LCD panel), DGA testing. + +11/11/01 KJB +Ver 1.8.1 +ViRGE MX (& GX2) fix to CR63 for problems with modes < 1024x768 from +max <sunmax@libero.it>. Submitted for 4.2.0. + +11/5/01 KJB +Ver 1.8.0 +ViRGE MX & GX2 XVideo changes. Fix overlap/color keying on MX, fix +and enable GX2 XVideo. +Submitted for 4.2.0. + +11/4/01 KJB +Ver 1.7.0 +Bump version for 4.2.0. Update man and README. + +11/3/01 KJB +Ver 1.6.16 +Pre-4.2.0 patch. cr3a fix, virge mx xvideo support, xvideo disable option +(helps with high res modes on dx and screen noise), remove accel solid +fill rect for trio3d, bring over some trio3d and mx fixes from 4.0.3 test +drivers. Includes VERBLEV bump to 5 to remove register dumps in log file. + +Ver 1.6.15 +Experimental - Scanline color expand - GX2 + +9/21/01 KJB +Ver 1.6.14 +ModeInit - cr3a for MX/GX2, don't clear reserved bit 0x40 (revert change). +Back out previous cr3a patch for testing. + +9/18/01 KJB +Ver 1.6.13 +Option "xvideo" added. Add patch provided by Sven Menke +<Menke@SLAC.Stanford.EDU> for XV support on MX (slight changes to logic). + +Ver 1.6.12 +Adam J. Richter's cr3a fix (possibly temporary). + +5/30/01 KJB +Ver 1.6.10 +Disable MaxHValue & MaxVValue setting. + 1/03/01 KJB Ver 1.6.0 Revert ViRGE to pre-Xv changes. ViRGE DX still supports Xv, but changes @@ -264,4 +313,4 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES,v 1.19 2001/02/09 03:23:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES,v 1.21 2002/01/14 18:02:58 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.7 Mon Feb 14 14:20:50 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h Wed Jul 25 11:05:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h,v 1.7 2000/02/14 19:20:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h,v 1.8 2001/07/25 15:05:06 dawes Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -362,16 +362,6 @@ } while(0) -#if 0 - -#ifndef NULL -#define NULL 0 - -#endif /* NULL */ - - -#endif /* 0 */ - Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.27 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.27 Fri May 4 15:05:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h Wed Nov 21 17:43:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.27 2001/05/04 19:05:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.29 2001/11/21 22:43:00 dawes Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -283,6 +283,8 @@ /* hardware cursor enabled */ Bool hwcursor; Bool UseFB; + Bool mx_cr3a_fix; + Bool XVideo; /* ViRGE options -end- */ /***********************/ /* ViRGE specifics -end- */ @@ -329,8 +331,8 @@ #define PVERB5(arg) ErrorF(arg) #define VERBLEV 1 #else -#define PVERB5(arg) xf86ErrorFVerb(2, arg) -#define VERBLEV 2 +#define PVERB5(arg) xf86ErrorFVerb(5, arg) +#define VERBLEV 5 #endif Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c:1.21 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c:1.21 Tue Nov 28 15:59:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c Thu Dec 13 13:01:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c,v 1.21 2000/11/28 20:59:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c,v 1.23 2001/12/13 18:01:50 eich Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -26,7 +26,6 @@ */ #include "s3v.h" -#include "s3v_macros.h" #include "miline.h" /* cfb includes are in s3v.h */ @@ -104,11 +103,15 @@ infoPtr->Sync = S3VAccelSync; - /* Solid filled rects */ - infoPtr->SetupForSolidFill = - S3VSetupForSolidFill; - infoPtr->SubsequentSolidFillRect = - S3VSubsequentSolidFillRect; + /* Problem reports with solid fill on trio3d */ + if(!S3_TRIO_3D_SERIES(ps3v->Chipset)) + { + /* Solid filled rects */ + infoPtr->SetupForSolidFill = + S3VSetupForSolidFill; + infoPtr->SubsequentSolidFillRect = + S3VSubsequentSolidFillRect; + } /* Screen to screen copies */ infoPtr->SetupForScreenToScreenCopy = @@ -125,7 +128,7 @@ infoPtr->Mono8x8PatternFillFlags = NO_TRANSPARENCY | HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_LSBFIRST; + BIT_ORDER_IN_BYTE_MSBFIRST; #ifndef __alpha__ Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c:1.6 Fri Mar 31 15:13:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c Mon Jan 14 13:02:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c,v 1.6 2000/03/31 20:13:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c,v 1.7 2002/01/14 18:02:58 dawes Exp $ */ /* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. @@ -350,7 +350,7 @@ S3VPtr ps3v = S3VPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)ps3v->FBBase; + *mem = (unsigned char*)ps3v->PciInfo->memBase[0]; *size = ps3v->videoRambytes; *offset = 0; *flags = DGA_NEED_ROOT; Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c diff -u 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.81 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.74.2.2 Mon May 28 04:40:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c Mon Jan 14 13:02:58 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.74.2.2 2001/05/28 08:40:10 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.81 2002/01/14 18:02:58 dawes Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -112,10 +112,10 @@ #define S3VIRGE_NAME "S3VIRGE" #define S3VIRGE_DRIVER_NAME "s3virge" -#define S3VIRGE_VERSION_NAME "1.6.0" +#define S3VIRGE_VERSION_NAME "1.8.3" #define S3VIRGE_VERSION_MAJOR 1 -#define S3VIRGE_VERSION_MINOR 6 -#define S3VIRGE_PATCHLEVEL 0 +#define S3VIRGE_VERSION_MINOR 8 +#define S3VIRGE_PATCHLEVEL 3 #define S3VIRGE_DRIVER_VERSION ((S3VIRGE_VERSION_MAJOR << 24) | \ (S3VIRGE_VERSION_MINOR << 16) | \ S3VIRGE_PATCHLEVEL) @@ -207,11 +207,16 @@ OPTION_HWCURSOR, OPTION_SHADOW_FB, OPTION_ROTATE, - OPTION_FB_DRAW + OPTION_FB_DRAW, + OPTION_MX_CR3A_FIX, + OPTION_XVIDEO } S3VOpts; static const OptionInfoRec S3VOptions[] = { + /* int token, const char* name, OptionValueType type, + ValueUnion value, Bool found. + */ { 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 }, @@ -233,7 +238,9 @@ { OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, - { OPTION_FB_DRAW, "UseFB", OPTV_BOOLEAN, {0}, TRUE }, + { OPTION_FB_DRAW, "UseFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_MX_CR3A_FIX, "mxcr3afix", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_XVIDEO, "XVideo", OPTV_BOOLEAN, {0}, FALSE }, {-1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -245,22 +252,24 @@ * 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 - * ...LOADER define. */ static const char *vgahwSymbols[] = { + "vgaHWBlankScreen", + "vgaHWCopyReg", "vgaHWGetHWRec", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWSave", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWLock", + "vgaHWMapMem", "vgaHWProtect", "vgaHWRestore", - "vgaHWMapMem", - "vgaHWUnmapMem", - "vgaHWInit", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWLock", + "vgaHWSetMmioFuncs", + "vgaHWSetStdFuncs", + "vgaHWUnmapMem", /* not used by ViRGE (at the moment :( ) */ /* "vgaHWUnlock", @@ -270,20 +279,23 @@ }; static const char *xaaSymbols[] = { + "XAACopyROP", + "XAACopyROP_PM", "XAADestroyInfoRec", "XAACreateInfoRec", + "XAAFillSolidRects", + "XAAHelpPatternROP", + "XAAHelpSolidROP", "XAAInit", - /* - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - */ NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", + "xf86InitCursor", +#if 0 "xf86DestroyCursorInfoRec", +#endif NULL }; @@ -291,6 +303,7 @@ "xf86PrintEDID", "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86SetDDCproperties", NULL }; @@ -313,14 +326,11 @@ }; static const char *fbSymbols[] = { - "fbScreenInit", - "fbBres", "fbPictureInit", + "fbScreenInit", NULL }; -#ifdef XFree86LOADER - static const char *int10Symbols[] = { "xf86InitInt10", "xf86FreeInt10", @@ -340,6 +350,8 @@ NULL }; +#ifdef XFree86LOADER + static MODULESETUPPROTO(s3virgeSetup); static XF86ModuleVersionInfo S3VVersRec = @@ -663,7 +675,7 @@ } } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Allocate the S3VRec driverPrivate */ @@ -865,6 +877,30 @@ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Using fb.\n"); } + if (xf86IsOptionSet(ps3v->Options, OPTION_MX_CR3A_FIX)) + { + if (xf86GetOptValBool(ps3v->Options, OPTION_MX_CR3A_FIX ,&ps3v->mx_cr3a_fix)) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "%s mx_cr3a_fix.\n", + ps3v->mx_cr3a_fix ? "Enabling (default)" : "Disabling"); + } + else + { + ps3v->mx_cr3a_fix = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "mx_cr3a_fix.\n"); + } + + if (xf86IsOptionSet(ps3v->Options, OPTION_XVIDEO)) + { + if (xf86GetOptValBool(ps3v->Options, OPTION_XVIDEO ,&ps3v->XVideo)) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "%s XVideo.\n", + ps3v->XVideo ? "Enabling (default)" : "Disabling"); + } + else + { + ps3v->XVideo = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "XVideo allowed (depends on chipset).\n"); + } + /* Find the PCI slot for this screen */ /* * XXX Ignoring the Type list for now. It might be needed when @@ -1267,7 +1303,7 @@ if (ps3v->LCDClk) { lcdclk = ps3v->LCDClk; } else { - int n1, n2, sr12, sr13, sr29; + unsigned char sr12, sr13, sr29; VGAOUT8(0x3c4, 0x12); sr12 = VGAIN8(0x3c5); VGAOUT8(0x3c4, 0x13); @@ -1328,6 +1364,9 @@ * don't exceed the chipset's limit if pScrn->maxHValue and * pScrn->maxVValue are set. */ + + /* todo - The virge limit is 2048 vertical & horizontal */ + /* pixels, not clock register settings. */ /* true for all ViRGE? */ pScrn->maxHValue = 2048; pScrn->maxVValue = 2048; @@ -1635,6 +1674,8 @@ VGAOUT8(vgaCRReg, cr66 | 0x80); VGAOUT8(vgaCRIndex, 0x3a); cr3a = VGAIN8(vgaCRReg); + save->CR3A = cr3a; + VGAOUT8(vgaCRReg, cr3a | 0x80); /* VGA_SR_MODE saves mode info only, no fonts, no colormap */ @@ -1663,8 +1704,14 @@ save->CR34 = VGAIN8(vgaCRReg); VGAOUT8(vgaCRIndex, 0x36); save->CR36 = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRIndex, 0x3a); - save->CR3A = VGAIN8(vgaCRReg); + + /* workaround cr3a corruption */ + if( !(ps3v->mx_cr3a_fix)) + { + VGAOUT8(vgaCRIndex, 0x3a); + save->CR3A = VGAIN8(vgaCRReg); + } + if (!S3_TRIO_3D_SERIES(ps3v->Chipset)) { VGAOUT8(vgaCRIndex, 0x40); save->CR40 = VGAIN8(vgaCRReg); @@ -1710,7 +1757,7 @@ VGAOUT8(vgaCRIndex, 0x86); save->CR86 = VGAIN8(vgaCRReg); } - if (S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + if ((ps3v->Chipset == S3_ViRGE_GX2) || S3_ViRGE_MX_SERIES(ps3v->Chipset) ) { VGAOUT8(vgaCRIndex, 0x7B); save->CR7B = VGAIN8(vgaCRReg); @@ -1763,7 +1810,10 @@ if (S3_ViRGE_GX2_SERIES(ps3v->Chipset) || S3_ViRGE_MX_SERIES(ps3v->Chipset)) { VGAOUT8(0x3c4, 0x29); save->SR29 = VGAIN8(0x3c5); - /* SR 54,55,56,57 undocumented for MX & GX2. Was this supposed to be CR? */ + } + /* SR 54,55,56,57 undocumented for GX2. Was this supposed to be CR? */ + /* (These used to be part of the above if() */ + if (S3_ViRGE_MX_SERIES(ps3v->Chipset)) { VGAOUT8(0x3c4, 0x54); save->SR54 = VGAIN8(0x3c5); VGAOUT8(0x3c4, 0x55); @@ -1814,12 +1864,34 @@ if (xf86GetVerbosity() > 1) { /* Debug */ + /* Which chipsets? */ + if ( + /* virge */ + ps3v->Chipset == S3_ViRGE || + /* VX */ + S3_ViRGE_VX_SERIES(ps3v->Chipset) || + /* DX & GX */ + ps3v->Chipset == S3_ViRGE_DXGX || + /* GX2 & Trio3D_2X */ + /* S3_ViRGE_GX2_SERIES(ps3v->Chipset) || */ + /* Trio3D_2X */ + /* S3_TRIO_3D_2X_SERIES(ps3v->Chipset) */ + /* MX & MX+ */ + /* S3_ViRGE_MX_SERIES(ps3v->Chipset) || */ + /* MX+ only */ + /* S3_ViRGE_MXP_SERIES(ps3v->Chipset) || */ + /* Trio3D */ + ps3v->Chipset == S3_TRIO_3D + ) + { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, "MMPR regs: %08x %08x %08x %08x\n", INREG(FIFO_CONTROL_REG), INREG(MIU_CONTROL_REG), INREG(STREAMS_TIMEOUT_REG), INREG(MISC_TIMEOUT_REG)); + } PVERB5("\n\nViRGE driver: saved current video mode. Register dump:\n\n"); } @@ -1890,7 +1962,7 @@ static void S3VWriteMode (ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, S3VRegPtr restore) { - unsigned char tmp, cr3a, cr66, cr67; + unsigned char tmp, cr3a=0, cr66, cr67; vgaHWPtr hwp = VGAHWPTR(pScrn); S3VPtr ps3v = S3VPTR(pScrn); @@ -1967,10 +2039,18 @@ /* Other mode timing and extended regs */ VGAOUT8(vgaCRIndex, 0x34); VGAOUT8(vgaCRReg, restore->CR34); - if (!S3_TRIO_3D_SERIES(ps3v->Chipset)) { - VGAOUT8(vgaCRIndex, 0x40); - VGAOUT8(vgaCRReg, restore->CR40); - } + if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + /* S3_ViRGE_MX_SERIES(ps3v->Chipset) || CR40 reserved on MX */ + S3_ViRGE_MXP_SERIES(ps3v->Chipset) || + S3_ViRGE_VX_SERIES(ps3v->Chipset) || + /* S3_TRIO_3D_2X_SERIES(ps3v->Chipset) * included in GX2 series */ + ps3v->Chipset == S3_ViRGE_DXGX || + ps3v->Chipset == S3_ViRGE + ) + { + VGAOUT8(vgaCRIndex, 0x40); + VGAOUT8(vgaCRReg, restore->CR40); + } if (S3_ViRGE_MX_SERIES(ps3v->Chipset)) { VGAOUT8(vgaCRIndex, 0x41); VGAOUT8(vgaCRReg, restore->CR41); @@ -2004,7 +2084,8 @@ VGAOUT8(vgaCRIndex, 0x86); VGAOUT8(vgaCRReg, restore->CR86); } - if (ps3v->Chipset == S3_ViRGE_GX2) { + if ( (ps3v->Chipset == S3_ViRGE_GX2) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) ) { VGAOUT8(vgaCRIndex, 0x7B); VGAOUT8(vgaCRReg, restore->CR7B); VGAOUT8(vgaCRIndex, 0x7D); @@ -2048,6 +2129,8 @@ if (S3_ViRGE_GX2_SERIES(ps3v->Chipset) || S3_ViRGE_MX_SERIES(ps3v->Chipset)) { VGAOUT8(0x3c4, 0x29); VGAOUT8(0x3c5, restore->SR29); + } + if (S3_ViRGE_MX_SERIES(ps3v->Chipset)) { VGAOUT8(0x3c4, 0x54); VGAOUT8(0x3c5, restore->SR54); VGAOUT8(0x3c4, 0x55); @@ -2065,6 +2148,7 @@ VGAOUT8(0x3c4, 0x15); tmp = VGAIN8(0x3c5) & ~0x21; + /* databook either 0x3 or 0x20, but not both?? */ VGAOUT8(0x3c5, tmp | 0x03); VGAOUT8(0x3c5, tmp | 0x23); VGAOUT8(0x3c5, tmp | 0x03); @@ -2093,9 +2177,18 @@ cr66 = VGAIN8(vgaCRReg); VGAOUT8(vgaCRReg, cr66 | 0x80); VGAOUT8(vgaCRIndex, 0x3a); - cr3a = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, cr3a | 0x80); + /* workaround cr3a corruption */ + if( ps3v->mx_cr3a_fix ) + { + VGAOUT8(vgaCRReg, restore->CR3A | 0x80); + } + else + { + cr3a = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, cr3a | 0x80); + } + /* And finally, we init the STREAMS processor if we have CR67 indicate 24bpp * We also restore FIFO and TIMEOUT memory controller registers. (later...) */ @@ -2157,8 +2250,14 @@ VGAOUT8(vgaCRIndex, 0x66); VGAOUT8(vgaCRReg, cr66); VGAOUT8(vgaCRIndex, 0x3a); - VGAOUT8(vgaCRReg, cr3a); + /* workaround cr3a corruption */ + if( ps3v->mx_cr3a_fix ) + VGAOUT8(vgaCRReg, restore->CR3A); + else + VGAOUT8(vgaCRReg, cr3a); + + if (xf86GetVerbosity() > 1) { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, "ViRGE driver: done restoring mode, dumping CR registers:\n"); @@ -2467,6 +2566,11 @@ } } } + + /* must be after RGB ordering fixed */ + if (ps3v->UseFB) + fbPictureInit (pScreen, 0, 0); + /* Initialize acceleration layer */ if (!ps3v->NoAccel) { if(pScrn->bitsPerPixel == 32) { @@ -2630,8 +2734,6 @@ ret = FALSE; break; } - if (ret) - fbPictureInit (pScreen, 0, 0); } else { @@ -2756,7 +2858,9 @@ /* MXTESTME */ || S3_ViRGE_MX_SERIES(ps3v->Chipset) ) { if(ps3v->pci_burst) - new->CR3A = (tmp & 0x38) | 0x10; /* ENH 256, PCI burst */ + /*new->CR3A = (tmp & 0x38) | 0x10; / ENH 256, PCI burst */ + /* Don't clear reserved bits... */ + new->CR3A = (tmp & 0x7f) | 0x10; /* ENH 256, PCI burst */ else new->CR3A = tmp | 0x90; /* ENH 256, no PCI burst! */ } @@ -2791,7 +2895,9 @@ if( S3_ViRGE_GX2_SERIES(ps3v->Chipset) || S3_ViRGE_MX_SERIES(ps3v->Chipset) ) { - new->CR63 = 0x08; + /* Changed from 0x08 based on reports that this */ + /* prevents MX from running properly below 1024x768 */ + new->CR63 = 0x10; } else { @@ -2854,7 +2960,14 @@ new->CR65 = 0x00; /* CR65_2 must be zero, doc seems to be wrong */ new->CR54 = 0x00; - if (!S3_TRIO_3D_SERIES(ps3v->Chipset)) { + if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + /* S3_ViRGE_MX_SERIES(ps3v->Chipset) || CR40 reserved on MX */ + S3_ViRGE_MXP_SERIES(ps3v->Chipset) || + S3_ViRGE_VX_SERIES(ps3v->Chipset) || + /* S3_TRIO_3D_2X_SERIES(ps3v->Chipset) * included in GX2 series */ + ps3v->Chipset == S3_ViRGE_DXGX || + ps3v->Chipset == S3_ViRGE + ) { VGAOUT8(vgaCRIndex, 0x40); new->CR40 = VGAIN8(vgaCRReg) & ~0x01; } @@ -3085,16 +3198,28 @@ /* XV support needs STREAMS in depth 16 */ ps3v->NeedSTREAMS = TRUE; S3VInitSTREAMS(pScrn, new->STREAMS, mode); - /*new->MMPR0 = 0xc000; / Adjust FIFO slots */ - new->MMPR0 = 0x107c02; /* Adjust FIFO slots, overlay */ + if( ps3v->XVideo ) + { + new->MMPR0 = 0x107c02; /* Adjust FIFO slots, overlay */ + } + else + { + new->MMPR0 = 0xc000; /* Adjust FIFO slots */ + } } else if (pScrn->bitsPerPixel == 24) { new->CR67 = 0xd0 | 0x0c; /* Flag STREAMS proc. required */ ps3v->NeedSTREAMS = TRUE; S3VInitSTREAMS(pScrn, new->STREAMS, mode); - /*new->MMPR0 = 0xc000; / Adjust FIFO slots */ - new->MMPR0 = 0x107c02; /* Adjust FIFO slots, overlay */ + if( ps3v->XVideo ) + { + new->MMPR0 = 0x107c02; /* Adjust FIFO slots, overlay */ + } + else + { + new->MMPR0 = 0xc000; /* Adjust FIFO slots */ + } } else if (pScrn->bitsPerPixel == 32) { new->CR67 = 0xd0 | 0x0c; @@ -3323,6 +3448,7 @@ new->CR68 = VGAIN8(vgaCRReg); new->CR69 = 0; + /* Flat panel centering and expansion registers */ if (S3_ViRGE_MX_SERIES(ps3v->Chipset) && (ps3v->lcd_center)) { new->SR54 = 0x10 ; new->SR55 = 0x80 ; @@ -3372,6 +3498,7 @@ vgaHWLock(hwp); S3VUnmapMem(pScrn); } + if (ps3v->AccelInfoRec) XAADestroyInfoRec(ps3v->AccelInfoRec); if (ps3v->DGAModes) Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.3 Thu Feb 8 22:23:30 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c Wed Nov 21 17:43:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.3 2001/02/09 03:23:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.5 2001/11/21 22:43:00 dawes Exp $ */ /* Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. @@ -106,11 +106,13 @@ (pScrn->bitsPerPixel == 16) ) && - ((ps3v->Chipset == S3_ViRGE_DXGX) /* || */ - /* S3_ViRGE_GX2_SERIES(ps3v->Chipset) || */ + ((ps3v->Chipset == S3_ViRGE_DXGX) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) || + S3_ViRGE_GX2_SERIES(ps3v->Chipset) /* || */ /* (ps3v->Chipset == S3_ViRGE) */ ) && !ps3v->NoAccel + && ps3v->XVideo ) { #if 0 @@ -625,7 +627,7 @@ static void -S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { S3VPtr ps3v = S3VPTR(pScrn); S3VPortPrivPtr pPriv = ps3v->portPrivate; @@ -646,28 +648,21 @@ REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - if(exit) { + if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { -#if 0 - /*OUTREG(MGAREG_BESCTL, 0);*/ - /*OUTREG(SSTREAM_CONTROL_REG, 0x02000000);*/ - - OUTREG(SSTREAM_CONTROL_REG, 0); - /*OUTREG(SSTREAM_STRIDE_REG, 0 );*/ - - /*OUTREG(K1_VSCALE_REG, 0 ); - OUTREG(K2_VSCALE_REG, 0 ); - */ - OUTREG(DDA_VERT_REG, 0 ); - - /*OUTREG(SSTREAM_START_REG, ((dstBox->x1 +1) << 16) | (dstBox->y1 +1)); - OUTREG(SSTREAM_WINDOW_SIZE_REG, 0); - */ -#endif - if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) ) + if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) + ) { - OUTREG(SSTREAM_CONTROL_REG, 0); + /* Aaarg... It .. won't.. go .. away! */ + /* So let's be creative, make the overlay really */ + /* small and near an edge. */ + /* Size of 0 leaves a window sized vertical stripe */ + /* Size of 1 leaves a single pixel.. */ + OUTREG(SSTREAM_WINDOW_SIZE_REG, 1); + /* And hide it at 0,0 */ + OUTREG(SSTREAM_START_REG, 0 ); } else { @@ -839,30 +834,27 @@ else tmp =2; /* YCbCr-16 */ - if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) ) - { - OUTREG(SSTREAM_CONTROL_REG, - tmp << 28 | 0x05000000 | 0x800000 | - ((((src_w-1)<<1)-(drw_w-1)) & 0xfff) - ); - } - else - { - OUTREG(SSTREAM_CONTROL_REG, - tmp << 28 | 0x01000000 | - ((((src_w-1)<<1)-(drw_w-1)) & 0xfff) - ); - } + OUTREG(SSTREAM_CONTROL_REG, + tmp << 28 | 0x01000000 | + ((((src_w-1)<<1)-(drw_w-1)) & 0xfff) + ); OUTREG(SSTREAM_STRETCH_REG, - ((src_w - 1) & 0x7ff) | (((src_w-drw_w) & 0x7ff) << 16) + ((src_w - 1) & 0x7ff) | (((src_w-drw_w-1) & 0x7ff) << 16) ); /* Color key on primary */ - if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) ) + if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) + ) { - /*OUTREG(BLEND_CONTROL_REG, 0x00000000)*/ - ; + /* 100% of secondary, no primary */ + /* gx2/mx can both blend while keying, need to */ + /* select secondary here, otherwise all you'll get */ + /* from the primary is the color key. (And setting */ + /* 0 here gives you black... no primary or secondary. */ + /* Discovered that the hard way!) */ + OUTREG(BLEND_CONTROL_REG, 0x20 ); } else { @@ -875,7 +867,8 @@ OUTREG(K1_VSCALE_REG, src_h-1 ); OUTREG(K2_VSCALE_REG, (src_h - drw_h) & 0x7ff ); - if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) ) + if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) ) { /* enable vert interp. & bandwidth saving - gx2 */ OUTREG(DDA_VERT_REG, (((~drw_h)-1) & 0xfff ) | @@ -894,14 +887,13 @@ ( ((drw_w-1) << 16) | (drw_h ) ) & 0x7ff07ff ); - /*cep*/ - if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) ) + if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) + ) { OUTREG(COL_CHROMA_KEY_CONTROL_REG, - /* color key ON */ - /*0xc0000000 | */ - /*0x40000000 | */ - 0x40000000 | + /* color key ON - keying on primary */ + 0x40000000 | /* # bits to compare */ ((pScrn->weight.red-1) << 24) | @@ -934,7 +926,8 @@ ); } - if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) ) + if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) ) { VGAOUT8(vgaCRIndex, 0x92); VGAOUT8(vgaCRReg, (((pitch + 7) / 8) >> 8) | 0x80); Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man:1.2 Sat Jan 27 13:20:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man Wed Nov 21 17:43:00 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man,v 1.2 2001/01/27 18:20:52 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man,v 1.3 2001/11/21 22:43:00 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH s3virge __drivermansuffix__ __vendorversion__ @@ -98,6 +98,10 @@ Rotate the screen CW - clockwise or CCW - counter clockwise. Disables HW Acceleration and HW Cursor, uses ShadowFB. Default: no rotation. +.TP +.BR "Option \*qXVideo\*q [\*q" boolean \*q] +Disable XVideo support by using the off option. This changes FIFO +settings which prevent screen noise for high-res modes. Default: on .PP The following video memory @@ -208,6 +212,9 @@ .BI "Option \*qShowCache\*q [\*q" boolean \*q] Enable or disable viewing offscreen cache memory. A development debug option. Default: off. +.TP +.BI "Option \*qmx_cr3a_fix\*q [\*q" boolean \*q] +Enable or disable a cr3a fix added for ViRGE MX. Default: on. .SH SEE ALSO XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) Index: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.5 Tue Feb 13 16:15:19 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile Mon Dec 10 18:02:33 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.5 2001/02/13 21:15:19 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.6 2001/12/10 23:02:33 dawes Exp $ /* * * Copyright 1995-1998 The XFree86 Project, Inc. @@ -76,6 +76,5 @@ 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.man diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.4 xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.4 Fri May 18 19:35:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man Mon Dec 17 15:52:33 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.4 2001/05/18 23:35:32 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.5 2001/12/17 20:52:33 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH SAVAGE __drivermansuffix__ __vendorversion__ @@ -75,8 +75,7 @@ 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 +Enable or disable use of the shadow framebuffer layer. This option disables acceleration. Default: off. .TP .BI "Option \*qLCDClock\*q \*q" frequency \*q Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.10 Fri May 18 19:35:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c Thu Dec 13 13:01:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.10 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.14 2001/12/13 18:01:50 eich Exp $ */ /* * @@ -261,6 +261,7 @@ case S3_SAVAGE4: case S3_PROSAVAGE: + case S3_SUPERSAVAGE: /* Disable BCI */ OUTREG(0x48C18, INREG(0x48C18) & 0x3FF0); /* Program shadow status update */ @@ -435,7 +436,7 @@ xaaptr->Mono8x8PatternFillFlags = 0 | HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN - | BIT_ORDER_IN_BYTE_LSBFIRST + | BIT_ORDER_IN_BYTE_MSBFIRST ; if( psav->Chipset == S3_SAVAGE4 ) xaaptr->Mono8x8PatternFillFlags |= NO_TRANSPARENCY; @@ -508,11 +509,9 @@ | SCANLINE_PAD_DWORD | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING + | ROP_NEEDS_SOURCE ; - if( psav->Chipset == S3_SAVAGE4 ) - xaaptr->ScanlineCPUToScreenColorExpandFillFlags |= ROP_NEEDS_SOURCE; - xaaptr->SetupForScanlineCPUToScreenColorExpandFill = SavageSetupForCPUToScreenColorExpandFill; xaaptr->SubsequentScanlineCPUToScreenColorExpandFill = @@ -913,10 +912,10 @@ mix = XAAHelpPatternROP( pScrn, &fg, &bg, planemask, &rop ); cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP - | BCI_CMD_DEST_GBD | BCI_CMD_PAT_MONO; + | BCI_CMD_DEST_GBD; if( mix & ROP_PAT ) - cmd |= BCI_CMD_SEND_COLOR; + cmd |= BCI_CMD_SEND_COLOR | BCI_CMD_PAT_MONO; if (bg == -1) cmd |= BCI_CMD_PAT_TRANSPARENT; @@ -959,8 +958,11 @@ BCI_SEND(psav->SavedBgColor); BCI_SEND(BCI_X_Y(x, y)); BCI_SEND(BCI_W_H(w, h)); - BCI_SEND(pattern0); - BCI_SEND(pattern1); + if( psav->SavedBciCmd & BCI_CMD_PAT_MONO ) + { + BCI_SEND(pattern0); + BCI_SEND(pattern1); + } } @@ -1163,6 +1165,7 @@ /* Routines for debugging. */ + unsigned long writedw( unsigned long addr, unsigned long value ) { @@ -1208,11 +1211,11 @@ *videobuffer++ = color; break; case 16: - *(unsigned short*)videobuffer = color; + *(CARD16 *)videobuffer = color; videobuffer += 2; break; case 32: - *(unsigned long*)videobuffer = color; + *(CARD32 *)videobuffer = color; videobuffer += 4; break; } Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h:1.1 Fri Dec 1 20:16:11 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h Mon Oct 1 09:44:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.1 2000/12/02 01:16:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.2 2001/10/01 13:44:09 eich Exp $ */ #ifndef _S3BCI_H_ #define _S3BCI_H_ @@ -77,12 +77,12 @@ #define BCI_BD_GET_STRIDE(bd) ((bd) & 0xFFFF) #define BCI_BD_SET_STRIDE(bd, st) ((bd) |= ((st) & 0xFFFF)) -#define BCI_W_H(w, h) (((h) << 16) | ((w) & 0xFFF)) -#define BCI_X_Y(x, y) (((y) << 16) | ((x) & 0xFFF)) -#define BCI_X_W(x, y) (((w) << 16) | ((x) & 0xFFF)) -#define BCI_CLIP_LR(l, r) (((r) << 16) | ((l) & 0xFFF)) -#define BCI_CLIP_TL(t, l) (((t) << 16) | ((l) & 0xFFF)) -#define BCI_CLIP_BR(b, r) (((b) << 16) | ((r) & 0xFFF)) +#define BCI_W_H(w, h) ((((h) << 16) | (w)) & 0x0FFF0FFF) +#define BCI_X_Y(x, y) ((((y) << 16) | (x)) & 0x0FFF0FFF) +#define BCI_X_W(x, y) ((((w) << 16) | (x)) & 0x0FFF0FFF) +#define BCI_CLIP_LR(l, r) ((((r) << 16) | (l)) & 0x0FFF0FFF) +#define BCI_CLIP_TL(t, l) ((((t) << 16) | (l)) & 0x0FFF0FFF) +#define BCI_CLIP_BR(b, r) ((((b) << 16) | (r)) & 0x0FFF0FFF) #define BCI_LINE_X_Y(x, y) (((y) << 16) | ((x) & 0xFFFF)) #define BCI_LINE_STEPS(diag, axi) (((axi) << 16) | ((diag) & 0xFFFF)) Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.4 Fri May 18 19:35:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c Fri Nov 2 11:24:51 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.4 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.6 2001/11/02 16:24:51 alanh Exp $ */ /* * Hardware cursor support for S3 Savage 4.0 driver. Taken with @@ -69,7 +69,7 @@ ((psav->Chipset != S3_SAVAGE4) && (inCRReg(0x18) & 0x80) && (inCRReg(0x15) & 0x50) ) || - (psav->Chipset == S3_SAVAGE_MX) + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; @@ -128,6 +128,7 @@ * loading the cursor. */ volatile unsigned int i = ALT_STATUS_WORD0; + (void)i; /* Not to be optimised out */ } } @@ -197,7 +198,7 @@ (psav->CursorInfoRec->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP); if( - (psav->Chipset == S3_SAVAGE_MX) || + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || (pScrn->depth == 24) || ((pScrn->depth == 8) && bNeedExtra) ) Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.19 Fri May 18 19:35:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c Fri Nov 2 11:24:51 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.19 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.24 2001/11/02 16:24:51 alanh Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -80,10 +80,10 @@ #define iabs(a) ((int)(a)>0?(a):(-(a))) #define DRIVER_NAME "savage" -#define DRIVER_VERSION "1.1.16" +#define DRIVER_VERSION "1.1.20" #define VERSION_MAJOR 1 #define VERSION_MINOR 1 -#define PATCHLEVEL 16 +#define PATCHLEVEL 20 #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \ (VERSION_MINOR << 16) | \ PATCHLEVEL) @@ -121,9 +121,17 @@ { 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" }, + { PCI_CHIP_S3TWISTER_P, "ProSavage PN133" }, + { PCI_CHIP_S3TWISTER_K, "ProSavage KN133" }, + { PCI_CHIP_SUPSAV_MX128, "SuperSavage/MX 128" }, + { PCI_CHIP_SUPSAV_MX64, "SuperSavage/MX 64" }, + { PCI_CHIP_SUPSAV_MX64C, "SuperSavage/MX 64C" }, + { PCI_CHIP_SUPSAV_IX128SDR, "SuperSavage/IX 128" }, + { PCI_CHIP_SUPSAV_IX128DDR, "SuperSavage/IX 128" }, + { PCI_CHIP_SUPSAV_IX64SDR, "SuperSavage/IX 64" }, + { PCI_CHIP_SUPSAV_IX64DDR, "SuperSavage/IX 64" }, + { PCI_CHIP_SUPSAV_IXCSDR, "SuperSavage/IXC 64" }, + { PCI_CHIP_SUPSAV_IXCDDR, "SuperSavage/IXC 64" }, { -1, NULL } }; @@ -132,7 +140,8 @@ { S3_SAVAGE4, "Savage4" }, { S3_SAVAGE2000, "Savage2000" }, { S3_SAVAGE_MX, "MobileSavage" }, - { S3_PROSAVAGE, "ProSavage/Twister" }, + { S3_PROSAVAGE, "ProSavage" }, + { S3_SUPERSAVAGE, "SuperSavage" }, { -1, NULL } }; @@ -151,6 +160,15 @@ { 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 }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_MX128, RES_SHARED_VGA }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_MX64, RES_SHARED_VGA }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_MX64C, RES_SHARED_VGA }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_IX128SDR, RES_SHARED_VGA }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_IX128DDR, RES_SHARED_VGA }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_IX64SDR, RES_SHARED_VGA }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_IX64DDR, RES_SHARED_VGA }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_IXCSDR, RES_SHARED_VGA }, + { S3_SUPERSAVAGE, PCI_CHIP_SUPSAV_IXCDDR, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -168,7 +186,8 @@ OPTION_SHADOW_FB, OPTION_ROTATE, OPTION_USEBIOS, - OPTION_SHADOW_STATUS + OPTION_SHADOW_STATUS, + OPTION_VIDEORAM } SavageOpts; @@ -182,51 +201,66 @@ { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_LCDCLOCK, "LCDClock", OPTV_FREQ, {0}, FALSE }, { OPTION_SHADOW_STATUS, "ShadowStatus", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VIDEORAM, "VideoRAM", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; static const char *vgaHWSymbols[] = { + "vgaHWBlankScreen", + "vgaHWCopyReg", "vgaHWGetHWRec", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWSave", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWLock", "vgaHWProtect", "vgaHWRestore", - "vgaHWMapMem", - "vgaHWUnmapMem", - "vgaHWInit", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWLock", + "vgaHWSetMmioFuncs", + "vgaHWSetStdFuncs", + "vgaHWUnmapMem", + "vgaHWddc1SetSpeed", #if 0 - "vgaHWUnlock", "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWUnlock", #endif NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", +#if 0 "xf86DestroyCursorInfoRec", +#endif + "xf86InitCursor", NULL }; static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", +#if 0 "vbeFree", +#endif NULL }; static const char *vbeOptSymbols[] = { "vbeModeInit", "VBESetVBEMode", + "VBEGetVBEInfo", + "VBEFreeVBEInfo", NULL }; static const char *ddcSymbols[] = { - "xf86InterpretEDID", + "xf86DoEDID_DDC1", + "xf86DoEDID_DDC2", + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; @@ -241,10 +275,12 @@ "XAACopyROP_PM", "XAACreateInfoRec", "XAADestroyInfoRec", + "XAAFillSolidRects", "XAAHelpPatternROP", +#if 0 "XAAHelpSolidROP", +#endif "XAAInit", - "XAAFillSolidRects", "XAAScreenIndex", NULL }; @@ -256,16 +292,19 @@ static const char *int10Symbols[] = { "xf86ExecX86int10", +#if 0 "xf86FreeInt10", +#endif "xf86InitInt10", "xf86Int10AllocPages", "xf86Int10FreePages", + "xf86int10Addr", NULL }; static const char *fbSymbols[] = { - "fbScreenInit", "fbPictureInit", + "fbScreenInit", NULL }; @@ -297,7 +336,7 @@ setupDone = TRUE; xf86AddDriver(&SAVAGE, module, 0); LoaderRefSymLists(vgaHWSymbols, fbSymbols, ramdacSymbols, - xaaSymbols, shadowSymbols, vbeSymbols, + xaaSymbols, shadowSymbols, vbeSymbols, vbeOptSymbols, int10Symbols, i2cSymbols, ddcSymbols, NULL); return (pointer) 1; } else { @@ -824,6 +863,13 @@ xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n", psav->UseBIOS ? "U" : "Not u" ); + pScrn->videoRam = 0; + if( xf86GetOptValInteger(psav->Options, OPTION_VIDEORAM, &pScrn->videoRam ) ) + { + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: VideoRAM %dkB\n", pScrn->videoRam ); + } + psav->LCDClock = 0.0; if( xf86GetOptValFreq( psav->Options, OPTION_LCDCLOCK, OPTUNITS_MHZ, &psav->LCDClock ) ) xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, @@ -856,9 +902,6 @@ if (xf86LoadSubModule(pScrn, "vbe")) { xf86LoaderReqSymLists(vbeSymbols, NULL); -#ifdef XFree86LOADER - LoaderRefSymLists(vbeOptSymbols, NULL); -#endif psav->pVbe = VBEInit(psav->pInt10, pEnt->index); } @@ -911,8 +954,10 @@ hwp = VGAHWPTR(pScrn); - if (!SavageMapMMIO(pScrn)) + if (!SavageMapMMIO(pScrn)) { + vbeFree(psav->pVbe); return FALSE; + } vgaHWGetIOBase(hwp); vgaIOBase = hwp->IOBase; @@ -941,8 +986,10 @@ { Gamma zeros = {0.0, 0.0, 0.0}; - if (!xf86SetGamma(pScrn, zeros)) + if (!xf86SetGamma(pScrn, zeros)) { + vbeFree(psav->pVbe); return FALSE; + } } /* Unlock system registers. */ @@ -956,11 +1003,23 @@ /* Compute the amount of video memory and offscreen memory. */ psav->MemOffScreen = 0; + + if( psav->pVbe ) + { + /* If VBE is available, it is the best judge of onboard memory. */ + + VbeInfoBlock* vib; + + vib = VBEGetVBEInfo( psav->pVbe ); + pScrn->videoRam = vib->TotalMemory * 64; + VBEFreeVBEInfo( vib ); + } + if (!pScrn->videoRam) { static unsigned char RamSavage3D[] = { 8, 4, 4, 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 }; + static unsigned char RamSavageNB[] = { 0, 2, 4, 8, 16, 32, 16, 2 }; switch( psav->Chipset ) { case S3_SAVAGE3D: @@ -988,6 +1047,14 @@ pScrn->videoRam = RamSavageMX[ (config1 & 0x0E) >> 1 ] * 1024; break; + case S3_SUPERSAVAGE: + vbeFree(psav->pVbe); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Cannot determine video RAM for SuperSavage chips.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Please set Option \"VideoRAM\" \"xxxxx\" in XF86Config.\n"); + return FALSE; + case S3_PROSAVAGE: pScrn->videoRam = RamSavageNB[ (config1 & 0xE0) >> 5 ] * 1024; break; @@ -1077,6 +1144,7 @@ case S3_SAVAGE4: case S3_PROSAVAGE: + case S3_SUPERSAVAGE: psav->WaitQueue = WaitQueue4; psav->WaitIdle = WaitIdle4; psav->WaitIdleEmpty = WaitIdleEmpty4; @@ -1091,36 +1159,38 @@ /* Do the DDC dance. */ - ddc = xf86LoadSubModule(pScrn, "ddc"); - if (ddc) { + if( psav->Chipset != S3_PROSAVAGE ) { + ddc = xf86LoadSubModule(pScrn, "ddc"); + if (ddc) { #if 0 - xf86MonPtr pMon = NULL; + xf86MonPtr pMon = NULL; #endif - - xf86LoaderReqSymLists(ddcSymbols, NULL); + + 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 + 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); - } + if (!SavageDDC1(pScrn->scrnIndex)) { + if ( xf86LoadSubModule(pScrn, "i2c") ) { + xf86LoaderReqSymLists(i2cSymbols,NULL); + if (SavageI2CInit(pScrn)) { + CARD32 temp = (INREG(DDC_REG)); + OUTREG(DDC_REG,(temp | 0x13)); + xf86SetDDCproperties(pScrn,xf86PrintEDID( + xf86DoEDID_DDC2(pScrn->scrnIndex,psav->I2C))); + OUTREG(DDC_REG,temp); + } + } } - } + } } /* Savage ramdac speeds */ @@ -1170,7 +1240,7 @@ /* Check LCD panel information */ - if( psav->Chipset == S3_SAVAGE_MX ) + if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { unsigned char cr6b = hwp->readCrtc( hwp, 0x6b ); @@ -1257,6 +1327,7 @@ if (i == -1) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86ValidateModes failure\n"); SavageFreeRec(pScrn); + vbeFree(psav->pVbe); return FALSE; } @@ -1265,6 +1336,7 @@ if (i == 0 || pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); SavageFreeRec(pScrn); + vbeFree(psav->pVbe); return FALSE; } @@ -1287,7 +1359,6 @@ else /*if( xf86Verbose )*/ { - int i; SavageModeEntryPtr pmt; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, @@ -1318,14 +1389,16 @@ if (xf86LoadSubModule(pScrn, "fb") == NULL) { SavageFreeRec(pScrn); + vbeFree(psav->pVbe); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); if( !psav->NoAccel ) { if( !xf86LoadSubModule(pScrn, "xaa") ) { SavageFreeRec(pScrn); + vbeFree(psav->pVbe); return FALSE; } xf86LoaderReqSymLists(xaaSymbols, NULL ); @@ -1334,6 +1407,7 @@ if (psav->hwcursor) { if (!xf86LoadSubModule(pScrn, "ramdac")) { SavageFreeRec(pScrn); + vbeFree(psav->pVbe); return FALSE; } xf86LoaderReqSymLists(ramdacSymbols, NULL); @@ -1342,11 +1416,13 @@ if (psav->shadowFB) { if (!xf86LoadSubModule(pScrn, "shadowfb")) { SavageFreeRec(pScrn); + vbeFree(psav->pVbe); return FALSE; } xf86LoaderReqSymLists(shadowSymbols, NULL); } - + vbeFree(psav->pVbe); + return TRUE; } @@ -1516,7 +1592,7 @@ /* Save flat panel expansion regsters. */ - if( psav->Chipset == S3_SAVAGE_MX ) { + if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { int i; for( i = 0; i < 8; i++ ) { VGAOUT8(0x3c4, 0x54+i); @@ -1532,7 +1608,7 @@ VGAOUT8(vgaCRReg, cr3a | 0x80); /* now save MIU regs */ - if( psav->Chipset != S3_SAVAGE_MX ) { + if( ! S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { save->MMPR0 = INREG(FIFO_CONTROL_REG); save->MMPR1 = INREG(MIU_CONTROL_REG); save->MMPR2 = INREG(STREAMS_TIMEOUT_REG); @@ -1629,7 +1705,7 @@ /* Patch CR79. These values are magical. */ - if( psav->Chipset != S3_SAVAGE_MX ) + if( !S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { VGAOUT8(vgaCRIndex, 0x6d); cr6d = VGAIN8(vgaCRReg); @@ -1676,7 +1752,7 @@ } if( (psav->Chipset != S3_SAVAGE2000) && - (psav->Chipset != S3_SAVAGE_MX) ) + !S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) VGAOUT16(vgaCRIndex, (cr79 << 8) | 0x79); /* Make sure 16-bit memory access is enabled. */ @@ -1785,7 +1861,7 @@ VGAOUT8(0x3c5, restore->SR15); /* Restore flat panel expansion regsters. */ - if( psav->Chipset == S3_SAVAGE_MX ) { + if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { int i; for( i = 0; i < 8; i++ ) { VGAOUT8(0x3c4, 0x54+i); @@ -1928,7 +2004,7 @@ if (Entering) SavageGEReset(pScrn,0,__LINE__,__FILE__); - if( psav->Chipset != S3_SAVAGE_MX ) + if( !S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { VerticalRetraceWait(); OUTREG(FIFO_CONTROL_REG, restore->MMPR0); @@ -2080,6 +2156,7 @@ { ScrnInfoPtr pScrn; SavagePtr psav; + EntityInfoPtr pEnt; int ret; TRACE(("SavageScreenInit()\n")); @@ -2087,6 +2164,9 @@ pScrn = xf86Screens[pScreen->myNum]; psav = SAVPTR(pScrn); + pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + psav->pVbe = VBEInit(NULL, pEnt->index); + SavageEnableMMIO(pScrn); if (!SavageMapFB(pScrn)) @@ -2096,7 +2176,7 @@ psav->ShadowPhysical = psav->FrameBufferBase + psav->CursorKByte*1024 + 4096 - 32; - psav->ShadowVirtual = (unsigned long*) + psav->ShadowVirtual = (CARD32 *) (psav->FBBase + psav->CursorKByte*1024 + 4096 - 32); xf86DrvMsg( pScrn->scrnIndex, X_PROBED, @@ -2159,6 +2239,9 @@ } } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); + if( !psav->NoAccel ) { SavageInitAccel(pScreen); } @@ -2268,9 +2351,6 @@ pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit (pScreen, 0, 0); - return ret; } @@ -2373,7 +2453,7 @@ break; case 15: if( - (psav->Chipset == S3_SAVAGE_MX) || + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || ((psav->Chipset == S3_SAVAGE2000) && (dclk >= 230000)) ) new->CR67 = 0x30; /* 15bpp, 2 pixel/clock */ @@ -2382,7 +2462,7 @@ break; case 16: if( - (psav->Chipset == S3_SAVAGE_MX) || + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || ((psav->Chipset == S3_SAVAGE2000) && (dclk >= 230000)) ) new->CR67 = 0x50; /* 16bpp, 2 pixel/clock */ @@ -2417,7 +2497,6 @@ if( (pmt->Width == mode->HDisplay) && (pmt->Height == mode->VDisplay) ) { - int j; int jDelta = 99; int jBest = 0; @@ -2592,7 +2671,7 @@ else new->CR50 |= 0xc1; /* Use GBD */ - if( psav->Chipset == S3_SAVAGE_MX ) + if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) new->CR33 = 0x00; else new->CR33 = 0x08; @@ -2634,6 +2713,10 @@ TRACE(("SavageCloseScreen\n")); + if (psav->pVbe) + vbeFree(psav->pVbe); + psav->pVbe = NULL; + if( psav->AccelInfoRec ) { XAADestroyInfoRec( psav->AccelInfoRec ); psav->AccelInfoRec = NULL; @@ -2890,7 +2973,7 @@ } else psav->WaitIdleEmpty(psav); - if (from_timeout && (psav->Chipset != S3_SAVAGE_MX) ) { + if (from_timeout && !S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { fifo_control = INREG(FIFO_CONTROL_REG); miu_control = INREG(MIU_CONTROL_REG); streams_timeout = INREG(STREAMS_TIMEOUT_REG); @@ -2919,6 +3002,7 @@ break; case S3_SAVAGE4: case S3_PROSAVAGE: + case S3_SUPERSAVAGE: success = (ALT_STATUS_WORD0 & 0x0081ffff) == 0x00800000; break; case S3_SAVAGE2000: @@ -2936,7 +3020,7 @@ /* At this point, the FIFO is empty and the engine is idle. */ - if (from_timeout && (psav->Chipset != S3_SAVAGE_MX) ) { + if (from_timeout && !S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) { OUTREG(FIFO_CONTROL_REG, fifo_control); OUTREG(MIU_CONTROL_REG, miu_control); OUTREG(STREAMS_TIMEOUT_REG, streams_timeout); @@ -3073,6 +3157,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.10 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.10 Fri May 18 19:35:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h Thu Aug 9 15:14:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.10 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.11 2001/08/09 19:14:13 dawes Exp $ */ #ifndef SAVAGE_VGAHWMMIO_H #define SAVAGE_VGAHWMMIO_H @@ -95,7 +95,7 @@ unsigned char* MapBaseDense; unsigned char* FBBase; unsigned char* FBStart; - unsigned long volatile * ShadowVirtual; + CARD32 volatile * ShadowVirtual; Bool PrimaryVidMapped; int dacSpeedBpp; Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.4 Fri May 18 19:35:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c Thu Aug 9 15:14:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.4 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.5 2001/08/09 19:14:13 dawes Exp $ */ #include "savage_driver.h" #include "xaarop.h" @@ -92,7 +92,7 @@ BCI_GET_PTR; int i, j, count, reset; unsigned int cmd; - unsigned int * srcp; + CARD32 * srcp; /* We aren't using planemask at all here... */ @@ -127,10 +127,10 @@ for (j = 0; j < h; j ++) { BCI_SEND(BCI_X_Y(x, y+j)); BCI_SEND(BCI_W_H(w, 1)); - srcp = (unsigned int*) src; + srcp = (CARD32 *) src; for (i = count; i > 0; srcp ++, i --) { /* We have to invert the bits in each byte. */ - unsigned long u = *srcp; + CARD32 u = *srcp; u = ((u & 0x0f0f0f0f) << 4) | ((u & 0xf0f0f0f0) >> 4); u = ((u & 0x33333333) << 2) | ((u & 0xcccccccc) >> 2); u = ((u & 0x55555555) << 1) | ((u & 0xaaaaaaaa) >> 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.8 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h:1.8 Tue May 15 06:19:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h Sun Nov 4 17:17:48 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.8 2001/05/15 10:19:39 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.10 2001/11/04 22:17:48 alanh Exp $ */ #ifndef _SAVAGE_REGS_H #define _SAVAGE_REGS_H @@ -11,11 +11,24 @@ #ifndef PCI_CHIP_S3TWISTER_K #define PCI_CHIP_S3TWISTER_K 0x8d02 #endif +#ifndef PCI_CHIP_SUPSAV_MX128 +#define PCI_CHIP_SUPSAV_MX128 0x8c22 +#define PCI_CHIP_SUPSAV_MX64 0x8c24 +#define PCI_CHIP_SUPSAV_MX64C 0x8c26 +#define PCI_CHIP_SUPSAV_IX128SDR 0x8c2a +#define PCI_CHIP_SUPSAV_IX128DDR 0x8c2b +#define PCI_CHIP_SUPSAV_IX64SDR 0x8c2c +#define PCI_CHIP_SUPSAV_IX64DDR 0x8c2d +#define PCI_CHIP_SUPSAV_IXCSDR 0x8c2e +#define PCI_CHIP_SUPSAV_IXCDDR 0x8c2f +#endif #define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) #define S3_SAVAGE4_SERIES(chip) ((chip==S3_SAVAGE4) || (chip==S3_PROSAVAGE)) +#define S3_SAVAGE_MOBILE_SERIES(chip) ((chip==S3_SAVAGE_MX) || (chip==S3_SUPERSAVAGE)) + #define S3_SAVAGE_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000)) @@ -29,6 +42,7 @@ S3_SAVAGE_MX, S3_SAVAGE4, S3_PROSAVAGE, + S3_SUPERSAVAGE, S3_SAVAGE2000, S3_LAST }; Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.3 Fri May 18 19:35:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c Wed Nov 21 17:43:01 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.3 2001/05/18 23:35:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.7 2001/11/21 22:43:01 dawes Exp $ */ #include "Xv.h" #include "dix.h" @@ -115,8 +115,6 @@ {XvSettable | XvGettable, -180, 180, "XV_HUE"} }; -#define NUM_IMAGES 7 - #define FOURCC_RV16 0x36315652 #define FOURCC_RV15 0x35315652 #define FOURCC_Y211 0x31313259 @@ -132,7 +130,7 @@ */ -static XF86ImageRec Images[NUM_IMAGES] = +static XF86ImageRec Images[] = { XVIMAGE_YUY2, XVIMAGE_YV12, @@ -190,6 +188,8 @@ } }; +#define NUM_IMAGES (sizeof(Images)/sizeof(Images[0])) + typedef struct { int brightness; /* -128 .. 127 */ CARD32 contrast; /* 0 .. 255 */ @@ -237,7 +237,7 @@ /* * 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. + * The new engine is in the 2000, MX, IX, and Super. */ @@ -420,6 +420,7 @@ VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); if( (psav->Chipset == S3_SAVAGE_MX) || + (psav->Chipset == S3_SUPERSAVAGE) || (psav->Chipset == S3_SAVAGE2000) ) { jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1; @@ -495,6 +496,7 @@ VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); if( (psav->Chipset == S3_SAVAGE_MX) || + (psav->Chipset == S3_SUPERSAVAGE) || (psav->Chipset == S3_SAVAGE2000) ) jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS; else @@ -525,9 +527,9 @@ int num_adaptors; xf86ErrorFVerb(XVTRACE,"SavageInitVideo\n"); -xf86Break1(); if( (psav->Chipset == S3_SAVAGE_MX) || + (psav->Chipset == S3_SUPERSAVAGE) || (psav->Chipset == S3_SAVAGE2000) ) { @@ -966,7 +968,7 @@ } static void -SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; /*SavagePtr psav = SAVPTR(pScrn); */ @@ -977,7 +979,7 @@ SavageStreamsOff( pScrn ); - if(exit) { + if(shutdown) { if(pPriv->area) { xf86FreeOffscreenArea(pPriv->area); pPriv->area = NULL; Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt:1.5 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt:1.5 Thu Feb 15 13:20:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt Thu Dec 20 16:35:37 2001 @@ -1,3 +1,45 @@ +-------------------------------------------------------------------------------- + Silicon Motion Driver for XFree86 4.1.0 + Alpha Release 1.3.1cz, 11/12/2001 +------------------------------------------------------------------------------- + +Extensions: + +- gamma correction for 24 bit true color mode. + +Known problems: + +- gamma correction does not work for 16 bit true color mode: + LoadPalette gets a gamma correction color table for 5:6:5 RGB, + whereas the SMI RAMDAC wants a 8:8:8 RGB color table. + +- gamma correction only implemented for the Lynx3DM + +- StopVideo don't work. The graphics controller continues to write + into the capture buffer + +Fixed bugs (or new bugs :) ): + +- in SMI_ScreenInit frame buffer size calculation for video changed. + + +-------------------------------------------------------------------------------- + Silicon Motion Driver for XFree86 4.1.0 + Alpha Release 1.3.0cz, 10/26/2001 +------------------------------------------------------------------------------- + +Fixed bugs: + +- XAA: clipping rectangle was clipped to visible screen, so offscreen + pixmaps could not been drawn at with accelerated drawing functions. + +Extensions: + +- smi_video: partly rewritten. + - Support for 7111 + - interlaced video via + - XF86Config Option "Interlaced" or + - attribute XV_INTERLACED -------------------------------------------------------------------------------- Silicon Motion Driver for XFree86 4.0.2 @@ -68,7 +110,7 @@ Fixed bugs: -#640 - X Windows shift to the right when start X Windows or apply Rotation. +#640 - X windows shift to the right when start X or apply Rotation. -------------------------------------------------------------------------------- Silicon Motion Driver for XFree86 4.0.1 @@ -89,7 +131,7 @@ Fixed bugs: #687 - Blue rectangle appears when video is clipped on thr right edge of screen. -#735 - When resume from sleep, X Windows does not wake up. +#735 - When resume from sleep, X does not wake up. -------------------------------------------------------------------------------- Silicon Motion Driver for XFree86 4.0.1 @@ -186,4 +228,4 @@ 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.5 2001/02/15 18:20:33 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt,v 1.7 2001/12/20 21:35:37 eich Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man:1.3 Thu Feb 15 13:20:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man Thu Dec 20 16:35:38 2001 @@ -1,5 +1,5 @@ .\" 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 $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man,v 1.4 2001/12/20 21:35:38 eich Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH siliconmotion __drivermansuffix__ __vendorversion__ @@ -95,6 +95,9 @@ .BI "Option \*qByteSwap\*q \*q" boolean \*q Turn on byte swapping for capturing using SMI demo board. Default: off. .TP +.BI "Option \*qInterlaced\*q \*q" boolean \*q +Turn on interlaced video capturing. 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. @@ -196,4 +199,5 @@ Harald Koenig, Sebastien Marineau, Mark Vojkovich, -Frido Garritsen. +Frido Garritsen, +Corvin Zahn. Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.6 Tue May 15 06:19:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h Thu Dec 20 16:35:38 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.h,v 1.6 2001/05/15 10:19:40 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.8 2001/12/20 21:35:38 eich Exp $ */ #ifndef _SMI_H #define _SMI_H @@ -95,6 +95,9 @@ CARD8 CR90[16], CR9F_2; CARD8 CRA0[14]; CARD8 smiDACMask, smiDacRegs[256][3]; + /* CZ 2.11.2001: for gamma correction */ + CARD8 CCR66; + /* end CZ */ CARD8 smiFont[8192]; CARD32 DPR10, DPR1C, DPR20, DPR24, DPR28, DPR2C, DPR30, DPR3C, DPR40, DPR44; @@ -240,11 +243,13 @@ #ifdef XvExtension int videoKey; /* Video chroma key */ Bool ByteSwap; /* Byte swap for ZV port */ + Bool interlaced; /* True: Interlaced Video */ /* XvExtension */ XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter structure */ void (*BlockHandler)(int i, pointer blockData, pointer pTimeout, pointer pReadMask); + GCPtr videoGC; #endif OptionInfoPtr Options; CARD8 DACmask; @@ -266,7 +271,7 @@ "(%d)\n", __LINE__); xf86Break1() #define DEBUG(arg) xf86ErrorFVerb arg #else - #define VERBLEV 2 + #define VERBLEV 4 #define ENTER_PROC(PROCNAME) #define DEBUG_PROC(PROCNAME) #define LEAVE_PROC(PROCNAME) @@ -322,9 +327,10 @@ /******************************************************************************/ /* 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); +void SMI_CommonCalcClock(int scrnIndex, 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); /* smi_i2c */ Bool SMI_I2CInit(ScrnInfoPtr pScrn); @@ -333,6 +339,7 @@ Bool SMI_AccelInit(ScreenPtr pScrn); void SMI_AccelSync(ScrnInfoPtr pScrn); void SMI_GEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file); +void SMI_EngineReset(ScrnInfoPtr); /* smi_hwcurs.c */ Bool SMI_HWCursorInit(ScreenPtr 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.4 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.4 Thu Feb 15 13:20:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c Thu Dec 20 16:35:38 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_accel.c,v 1.4 2001/02/15 18:20:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.6 2001/12/20 21:35:38 eich Exp $ */ #include "smi.h" @@ -35,7 +35,6 @@ #include "xaarop.h" #include "servermd.h" -static void SMI_EngineReset(ScrnInfoPtr); static void SMI_SetupForScreenToScreenCopy(ScrnInfoPtr, int, int, int, unsigned int, int); @@ -73,9 +72,9 @@ XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SMIPtr pSmi = SMIPTR(pScrn); - BoxRec AvailFBArea; + /*BoxRec AvailFBArea;*/ Bool ret; - int numLines, maxLines; + /*int numLines, maxLines;*/ ENTER_PROC("SMI_AccelInit"); @@ -197,6 +196,10 @@ SMI_EngineReset(pScrn); + + /* CZ 18.06.2001: moved to smi_driver.c before the NoAccel question + to have offscreen framebuffer in NoAccel mode */ +#if 0 maxLines = pSmi->FBReserved / (pSmi->width * pSmi->Bpp); if (pSmi->rotate) { @@ -221,6 +224,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FrameBuffer Box: %d,%d - %d,%d\n", AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2); xf86InitFBManager(pScreen, &AvailFBArea); +#endif ret = XAAInit(pScreen, infoPtr); if (ret && pSmi->shadowFB) /* #671 */ @@ -245,7 +249,7 @@ { if (pSmi->GEResetCnt++ < 10 || xf86GetVerbosity() > 1) { - ErrorF("\tSMI_GEReset called from %s line %d\n", file, line); + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"\tSMI_GEReset called from %s line %d\n", file, line); } } else @@ -277,7 +281,7 @@ LEAVE_PROC("SMI_AccelSync"); } -static void +void SMI_EngineReset(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); @@ -878,10 +882,12 @@ DEBUG((VERBLEV, "left=%d top=%d right=%d bottom=%d\n", left, top, right, bottom)); + /* CZ 26.10.2001: this code prevents offscreen pixmaps being drawn ??? left = max(left, 0); top = max(top, 0); right = min(right, pSmi->width); bottom = min(bottom, pSmi->height); + */ if (pScrn->bitsPerPixel == 24) { Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c:1.1 Tue Nov 28 15:59:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c Fri Nov 30 07:11:59 2001 @@ -26,16 +26,16 @@ 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_dac.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c,v 1.2 2001/11/30 12:11:59 eich Exp $ */ #include "smi.h" #define BASE_FREQ 14.31818 /* MHz */ 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) +SMI_CommonCalcClock(int scrnIndex, 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) { double div, diff, best_diff; unsigned int m; @@ -48,13 +48,13 @@ if (ffreq < ffreq_min / (1 << max_n2)) { - ErrorF("invalid frequency %1.3f MHz [freq >= %1.3f MHz]\n", + xf86DrvMsg(scrnIndex,X_WARNING,"invalid frequency %1.3f MHz [freq >= %1.3f MHz]\n", ffreq * BASE_FREQ, ffreq_min * BASE_FREQ / (1 << max_n2)); ffreq = ffreq_min / (1 << max_n2); } if (ffreq > ffreq_max / (1 << min_n2)) { - ErrorF("invalid frequency %1.3f MHz [freq <= %1.3f MHz]\n", + xf86DrvMsg(scrnIndex,X_WARNING,"invalid frequency %1.3f MHz [freq <= %1.3f MHz]\n", ffreq * BASE_FREQ, ffreq_max * BASE_FREQ / (1 << min_n2)); ffreq = ffreq_max / (1 << min_n2); } Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c diff -u 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.20 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.12.2.1 Fri May 25 14:15:46 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c Fri Jan 4 16:22:34 2002 @@ -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.12.2.1 2001/05/25 18:15:46 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.20 2002/01/04 21:22:34 tsi Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -82,12 +82,12 @@ static void SMI_ProbeDDC(ScrnInfoPtr pScrn, int index); -#define SILICONMOTION_NAME "Silicon Motion" +#define SILICONMOTION_NAME "Silicon Motion" #define SILICONMOTION_DRIVER_NAME "siliconmotion" -#define SILICONMOTION_VERSION_NAME "1.2.2" +#define SILICONMOTION_VERSION_NAME "1.3.1" #define SILICONMOTION_VERSION_MAJOR 1 -#define SILICONMOTION_VERSION_MINOR 2 -#define SILICONMOTION_PATCHLEVEL 2 +#define SILICONMOTION_VERSION_MINOR 3 +#define SILICONMOTION_PATCHLEVEL 1 #define SILICONMOTION_DRIVER_VERSION ( (SILICONMOTION_VERSION_MAJOR << 24) \ | (SILICONMOTION_VERSION_MINOR << 16) \ | (SILICONMOTION_PATCHLEVEL) \ @@ -153,6 +153,9 @@ #ifdef XvExtension OPTION_VIDEOKEY, OPTION_BYTESWAP, + /* CZ 26.10.2001: interlaced video */ + OPTION_INTERLACED, + /* end CZ */ #endif OPTION_USEBIOS, OPTION_ZOOMONLCD, @@ -177,6 +180,9 @@ #ifdef XvExtension { OPTION_VIDEOKEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, { OPTION_BYTESWAP, "ByteSwap", OPTV_BOOLEAN, {0}, FALSE }, + /* CZ 26.10.2001: interlaced video */ + { OPTION_INTERLACED, "Interlaced", OPTV_BOOLEAN, {0}, FALSE }, + /* end CZ */ #endif { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ZOOMONLCD, "ZoomOnLCD", OPTV_BOOLEAN, {0}, FALSE }, @@ -190,41 +196,46 @@ * Note that vgahwSymbols and xaaSymbols are referenced outside the * XFree86LOADER define in later code, so are defined outside of that * define here also. - * fbSymbols and ramdacSymbols are only referenced from within the - * ...LOADER define. */ static const char *vgahwSymbols[] = { + "vgaHWCopyReg", "vgaHWGetHWRec", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWSave", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWLock", + "vgaHWMapMem", "vgaHWProtect", "vgaHWRestore", - "vgaHWMapMem", - "vgaHWUnmapMem", - "vgaHWInit", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWLock", + "vgaHWSetMmioFuncs", + "vgaHWSetStdFuncs", + "vgaHWUnmapMem", + "vgaHWddc1SetSpeed", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", + "XAACopyROP", "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAFallbackOps", + "XAAFillSolidRects", "XAAInit", - "XAAOverlayFBfuncs", + "XAAPatternROP", + "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", - "xf86CursorScreenIndex", + "xf86InitCursor", NULL }; @@ -233,17 +244,19 @@ "xf86PrintEDID", "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86SetDDCproperties", NULL }; static const char *i2cSymbols[] = { "xf86CreateI2CBusRec", + "xf86CreateI2CDevRec", "xf86DestroyI2CBusRec", + "xf86DestroyI2CDevRec", "xf86I2CBusInit", - "xf86CreateI2CDevRec", + "xf86I2CDevInit", "xf86I2CWriteByte", - "xf86DestroyI2CDevRec", NULL }; @@ -255,9 +268,9 @@ static const char *int10Symbols[] = { - "xf86InitInt10", "xf86ExecX86int10", "xf86FreeInt10", + "xf86InitInt10", NULL }; @@ -272,8 +285,8 @@ static const char *fbSymbols[] = { #ifdef USE_FB - "fbScreenInit", "fbPictureInit", + "fbScreenInit", #else "cfbScreenInit", "cfb16ScreenInit", @@ -614,7 +627,7 @@ return(FALSE); } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Collect all of the relevant option flags (fill in pScrn->options) */ @@ -801,6 +814,18 @@ { pSmi->ByteSwap = FALSE; } + + /* CZ 26.10.2001: interlaced video */ + if (xf86ReturnOptValBool(pSmi->Options, OPTION_INTERLACED, FALSE)) + { + pSmi->interlaced = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Interlaced enabled.\n"); + } + else + { + pSmi->interlaced = FALSE; + } + /* end CZ */ #endif if (xf86GetOptValBool(pSmi->Options, OPTION_USEBIOS, &pSmi->useBIOS)) @@ -834,13 +859,7 @@ LEAVE_PROC("SMI_PreInit"); return(FALSE); } - - if (xf86LoadSubModule(pScrn, "int10")) - { - xf86LoaderReqSymLists(int10Symbols, NULL); - pSmi->pInt = xf86InitInt10(pEnt->index); - } - + if (xf86LoadSubModule(pScrn, "vbe")) { xf86LoaderReqSymLists(vbeSymbols, NULL); @@ -1302,6 +1321,10 @@ SMI_RefreshArea(pScrn, 1, &box); } + /* Reset the grapics engine */ + if (!pSmi->NoAccel) + SMI_EngineReset(pScrn); + LEAVE_PROC("SMI_EnterVT"); return(ret); } @@ -1455,6 +1478,12 @@ } } + /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ + if (pSmi->Chipset == SMI_LYNX3DM) { + save->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66); + } + /* end CZ */ + save->DPR10 = READ_DPR(pSmi, 0x10); save->DPR1C = READ_DPR(pSmi, 0x1C); save->DPR20 = READ_DPR(pSmi, 0x20); @@ -1480,12 +1509,12 @@ pSmi->ModeStructInit = TRUE; } - if (pSmi->useBIOS && (pSmi->pInt != NULL)) + if (pSmi->useBIOS && (pSmi->pVbe != NULL)) { - pSmi->pInt->num = 0x10; - pSmi->pInt->ax = 0x0F00; - xf86ExecX86int10(pSmi->pInt); - save->mode = pSmi->pInt->ax & 0x007F; + pSmi->pVbe->pInt10->num = 0x10; + pSmi->pVbe->pInt10->ax = 0x0F00; + xf86ExecX86int10(pSmi->pVbe->pInt10); + save->mode = pSmi->pVbe->pInt10->ax & 0x007F; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Current mode 0x%02X.\n", save->mode); } @@ -1525,13 +1554,14 @@ /* Wait for engine to become idle */ WaitIdle(); - if (pSmi->useBIOS && (pSmi->pInt != NULL) && (restore->mode != 0)) + if (pSmi->useBIOS && (pSmi->pVbe->pInt10 != NULL) + && (restore->mode != 0)) { - pSmi->pInt->num = 0x10; - pSmi->pInt->ax = restore->mode | 0x80; + pSmi->pVbe->pInt10->num = 0x10; + pSmi->pVbe->pInt10->ax = restore->mode | 0x80; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode 0x%02X\n", restore->mode); - xf86ExecX86int10(pSmi->pInt); + xf86ExecX86int10(pSmi->pVbe->pInt10); /* Enable linear mode. */ outb(VGA_SEQ_INDEX, 0x18); @@ -1653,6 +1683,12 @@ } } + /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ + if (pSmi->Chipset == SMI_LYNX3DM) { + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, restore->CCR66); + } + /* end CZ */ + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, 0x00); WRITE_DPR(pSmi, 0x10, restore->DPR10); @@ -1932,7 +1968,8 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SMIPtr pSmi = SMIPTR(pScrn); - + EntityInfoPtr pEnt; + ENTER_PROC("SMI_ScreenInit"); /* Map MMIO regs and framebuffer */ @@ -1942,9 +1979,14 @@ return(FALSE); } + pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + /* Save the chip/graphics state */ SMI_Save(pScrn); - + + if (!pSmi->pVbe) { + pSmi->pVbe = VBEInit(NULL, pEnt->index); + } /* Zero the frame buffer, #258 */ memset(pSmi->FBBase, 0, pSmi->videoRAMBytes); @@ -2031,20 +2073,59 @@ } } +#ifdef USE_FB + /* must be after RGB ordering fixed */ + fbPictureInit(pScreen, 0, 0); +#endif + + /* CZ 18.06.2001: moved here from smi_accel.c to have offscreen + framebuffer in NoAccel mode */ + { + int numLines, maxLines; + BoxRec AvailFBArea; + + maxLines = pSmi->FBReserved / (pSmi->width * pSmi->Bpp); + if (pSmi->rotate) { + numLines = maxLines; + } else { + /* CZ 3.11.2001: What does the following code? see also smi_video.c aaa line 1226 */ +/*#if defined(XvExtension) && SMI_USE_VIDEO */ +#if 0 + numLines = ((pSmi->FBReserved - pSmi->width * pSmi->Bpp + * pSmi->height) * 25 / 100 + pSmi->width + * pSmi->Bpp - 1) / (pSmi->width * pSmi->Bpp); + numLines += pSmi->height; +#else + numLines = maxLines; +#endif + } + + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pSmi->width; + AvailFBArea.y2 = numLines; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "FrameBuffer Box: %d,%d - %d,%d\n", + AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, + AvailFBArea.y2); + xf86InitFBManager(pScreen, &AvailFBArea); + } + /* end CZ */ + + /* Initialize acceleration layer */ - if (!pSmi->NoAccel) - { - if (!SMI_AccelInit(pScreen)) - { - LEAVE_PROC("SMI_ScreenInit"); - return(FALSE); + if (!pSmi->NoAccel) { + if (!SMI_AccelInit(pScreen)) { + LEAVE_PROC("SMI_ScreenInit"); + return(FALSE); } } + miInitializeBackingStore(pScreen); - + /* hardware cursor needs to wrap this layer */ - SMI_DGAInit(pScreen); - + SMI_DGAInit(pScreen); + /* Initialise cursor functions */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -2086,8 +2167,9 @@ /* Initialize colormap layer. Must follow initialization of the default * colormap. And SetGamma call, else it will load palette with solid white. */ - if (!xf86HandleColormaps(pScreen, 256, 6, SMI_LoadPalette, NULL, - CMAP_RELOAD_ON_MODE_SWITCH)) + /* CZ 2.11.2001: CMAP_PALETTED_TRUECOLOR for gamma correction */ + if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, SMI_LoadPalette, NULL, + CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR)) { LEAVE_PROC("SMI_ScreenInit"); return(FALSE); @@ -2102,14 +2184,14 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed!\n"); } - SMI_InitVideo(pScreen); + SMI_InitVideo(pScreen); /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); } - + LEAVE_PROC("SMI_ScreenInit"); return(TRUE); } @@ -2214,10 +2296,6 @@ return(FALSE); } -#ifdef USE_FB - if (ret) - fbPictureInit(pScreen, 0, 0); -#endif LEAVE_PROC("SMI_InternalScreenInit"); return(ret); } @@ -2461,6 +2539,29 @@ } } + + /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ + new->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66); + if (pSmi->Chipset == SMI_LYNX3DM) { + switch (pScrn->bitsPerPixel) { + case 8: + new->CCR66 = (new->CCR66 & 0xF3) | 0x00; /* 6 bits-RAM */ + break; + case 16: + new->CCR66 = (new->CCR66 & 0xF3) | 0x00; /* 6 bits-RAM */ + /* no Gamma correction in 16 Bit mode (s. Release.txt 1.3.1) */ + break; + case 24: + case 32: + new->CCR66 = (new->CCR66 & 0xF3) | 0x04; /* Gamma correct ON */ + break; + default: + LEAVE_PROC("SMI_ModeInit"); + return(FALSE); + } + } + /* end CZ */ + outb(VGA_SEQ_INDEX, 0x30); if (inb(VGA_SEQ_DATA) & 0x01) { @@ -2469,8 +2570,9 @@ if (pSmi->MCLK > 0) { - SMI_CommonCalcClock(pSmi->MCLK, 1, 1, 31, 0, 2, pSmi->minClock, - pSmi->maxClock, &new->SR6A, &new->SR6B); + SMI_CommonCalcClock(pScrn->scrnIndex,pSmi->MCLK, + 1, 1, 31, 0, 2, pSmi->minClock, + pSmi->maxClock, &new->SR6A, &new->SR6B); } else { @@ -2675,9 +2777,10 @@ { xfree(pSmi->DGAModes); } - if (pSmi->pInt != NULL) + if (pSmi->pVbe != NULL) { - xf86FreeInt10(pSmi->pInt); + vbeFree(pSmi->pVbe); + pSmi->pVbe = NULL; } #ifdef XvExtension if (pSmi->ptrAdaptor != NULL) @@ -2691,7 +2794,9 @@ #endif if (pSmi->I2C != NULL) { - xf86DestroyI2CBusRec(pSmi->I2C, TRUE, TRUE); + xf86DestroyI2CBusRec(pSmi->I2C, FALSE, TRUE); + xfree(pSmi->I2C); + pSmi->I2C = NULL; } /* #670 */ if (pSmi->pSaveBuffer) @@ -2796,6 +2901,8 @@ for(i = 0; i < numColors; i++) { + DEBUG((VERBLEV, "pal[%d] = %d %d %d\n", indicies[i], + colors[indicies[i]].red, colors[indicies[i]].green, colors[indicies[i]].blue)); VGAOUT8(pSmi, VGA_DAC_WRITE_ADDR, indicies[i]); VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].red); VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].green); @@ -2987,31 +3094,31 @@ } #if 1 /* PDR#735 */ - if (pSmi->pInt != NULL) + if (pSmi->pVbe->pInt10 != NULL) { - pSmi->pInt->ax = 0x4F10; + pSmi->pVbe->pInt10->ax = 0x4F10; switch (PowerManagementMode) { case DPMSModeOn: - pSmi->pInt->bx = 0x0001; + pSmi->pVbe->pInt10->bx = 0x0001; break; case DPMSModeStandby: - pSmi->pInt->bx = 0x0101; + pSmi->pVbe->pInt10->bx = 0x0101; break; case DPMSModeSuspend: - pSmi->pInt->bx = 0x0201; + pSmi->pVbe->pInt10->bx = 0x0201; break; case DPMSModeOff: - pSmi->pInt->bx = 0x0401; + pSmi->pVbe->pInt10->bx = 0x0401; break; } - pSmi->pInt->cx = 0x0000; - pSmi->pInt->num = 0x10; - xf86ExecX86int10(pSmi->pInt); - if (pSmi->pInt->ax == 0x004F) + pSmi->pVbe->pInt10->cx = 0x0000; + pSmi->pVbe->pInt10->num = 0x10; + xf86ExecX86int10(pSmi->pVbe->pInt10); + if (pSmi->pVbe->pInt10->ax == 0x004F) { pSmi->CurrentDPMS = PowerManagementMode; #if 1 /* PDR#835 */ @@ -3132,6 +3239,7 @@ { pVbe = VBEInit(NULL, index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c:1.1 Tue Nov 28 15:59:20 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c Thu Dec 20 16:35:39 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_i2c.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c,v 1.2 2001/12/20 21:35:39 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -37,6 +37,17 @@ #include "vgaHW.h" #include "smi.h" + +#undef VERBLEV +#undef ENTER_PROC +#undef DEBUG_PROC +#undef LEAVE_PROC +#undef DEBUG +#define VERBLEV 2 +#define ENTER_PROC(PROCNAME) +#define DEBUG_PROC(PROCNAME) +#define LEAVE_PROC(PROCNAME) +#define DEBUG(arg) static void SMI_I2CPutBits(I2CBusPtr b, int clock, int data) Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.4 Sat Mar 3 17:26:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c Thu Dec 20 16:35:39 2001 @@ -3,6 +3,7 @@ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved. +Copyright (C) 2001 Corvin Zahn. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -26,30 +27,88 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.4 2001/03/03 22:26:13 tsi Exp $ */ +/* +this is a heavy modified version of the V1.2.2 original siliconmotion driver. +- SAA7111 support +- supports attributes: XV_ENCODING, XV_BRIGHTNESS, XV_CONTRAST, + XV_SATURATION, XV_HUE, XV_COLORKEY, XV_INTERLACED +- bug fixes +- tries not to use acceleration functions (if USE_XAA = 0) +- interlaced video for double vertical resolution + +Author of changes: Corvin Zahn <zahn@zac.de> +Date: 2.11.2001 +*/ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.6 2001/12/20 21:35:39 eich Exp $ */ + #include "smi.h" #include "smi_video.h" + +/* + +new attribute: + +XV_INTERLACED = 0: only one field of an interlaced video signal is displayed: + -> half vertical resolution, but no comb like artifacts from + moving vertical edges +XV_INTERLACED = 1: both fields of an interlaced video signal are displayed: + -> full vertical resolution, but comb like artifacts from + moving vertical edges + +The default value can be set with the driver option Interlaced + +*/ + + + + +#undef MIN +#undef ABS +#undef CLAMP +#undef ENTRIES + +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define ABS(n) (((n) < 0) ? -(n) : (n)) +#define CLAMP(v, min, max) (((v) < (min)) ? (min) : MIN(v, max)) + +#define ENTRIES(array) (sizeof(array) / sizeof((array)[0])) #define nElems(x) (sizeof(x) / sizeof(x[0])) + #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) #if defined(XvExtension) && SMI_USE_VIDEO +/* USE_XAA = 1: use XAA functions for color key rectangle fill, + USE_XAA = 0: use xf86XVFillKeyHelper for color key rectangle fill, + needs common/xf86xv.c >= 1.30, + common/xf86xv.h >= 1.22, + loader/xf86sym.c >= 1.194 */ +#define USE_XAA 1 + #include "dixstruct.h" +#if USE_XAA #include "xaa.h" #include "xaalocal.h" +#endif + +static int SMI_AddEncoding(XF86VideoEncodingPtr enc, int i, + int norm, int input, int channel); +static void SMI_BuildEncodings(SMI_PortPtr p); + static XF86VideoAdaptorPtr SMI_SetupVideo(ScreenPtr pScreen); static void SMI_ResetVideo(ScrnInfoPtr pScrn); #if SMI_USE_CAPTURE -static int SMI_GetVideo(ScrnInfoPtr pScrn, +static int SMI_PutVideo(ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, pointer data); #endif -static void SMI_StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit); +static void SMI_StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown); static int SMI_SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data); static int SMI_GetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, @@ -76,8 +135,8 @@ static void SMI_BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadMask); static void SMI_WaitForSync(ScrnInfoPtr pScrn); -static int SMI_SendI2C(ScrnInfoPtr pScrn, CARD8 device, char *devName, - SMI_I2CDataPtr i2cData); +/*static int SMI_SendI2C(ScrnInfoPtr pScrn, CARD8 device, char *devName, + SMI_I2CDataPtr i2cData);*/ static void SMI_InitOffscreenImages(ScreenPtr pScreen); static FBAreaPtr SMI_AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area, @@ -99,93 +158,87 @@ static int SMI_StopSurface(XF86SurfacePtr surface); static int SMI_GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 *value); static int SMI_SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 value); + +static int SetAttr(ScrnInfoPtr pScrn, int i, int value); +static int SetAttrSAA7110(ScrnInfoPtr pScrn, int i, int value); +static int SetAttrSAA7111(ScrnInfoPtr pScrn, int i, int value); + +/** + * Atoms + */ + +static Atom xvColorKey; +static Atom xvEncoding; +static Atom xvBrightness, xvContrast, xvSaturation, xvHue; +static Atom xvInterlaced; -static Atom xvColorKey, xvBrightness; /******************************************************************************\ ** ** -** X V E X T E N S I O N I N T E R F A C E ** +** C A P A B I L I T I E S ** ** ** \******************************************************************************/ -void SMI_InitVideo(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SMIPtr psmi = SMIPTR(pScrn); - XF86VideoAdaptorPtr *ptrAdaptors, *newAdaptors = NULL; - XF86VideoAdaptorPtr newAdaptor = NULL; - int numAdaptors; - ENTER_PROC("SMI_InitVideo"); +/**************************************************************************/ +/* input channels */ - numAdaptors = xf86XVListGenericAdaptors(pScrn, &ptrAdaptors); +#define N_COMPOSITE_CHANNELS 4 +#define N_SVIDEO_CHANNELS 2 - if ( (psmi->rotate == 0) - && !psmi->NoAccel - ) - { - newAdaptor = SMI_SetupVideo(pScreen); - SMI_InitOffscreenImages(pScreen); - } +#define N_VIDEO_INPUTS 2 +typedef enum _VideoInput { COMPOSITE, SVIDEO } VideoInput; - if (newAdaptor != NULL) - { - if (numAdaptors == 0) - { - numAdaptors = 1; - ptrAdaptors = &newAdaptor; - } - else - { - newAdaptors = xalloc((numAdaptors + 1) * - sizeof(XF86VideoAdaptorPtr*)); - if (newAdaptors != NULL) - { - memcpy(newAdaptors, ptrAdaptors, - numAdaptors * sizeof(XF86VideoAdaptorPtr)); - newAdaptors[numAdaptors++] = newAdaptor; - ptrAdaptors = newAdaptors; - } - } - } - if (numAdaptors != 0) - { - xf86XVScreenInit(pScreen, ptrAdaptors, numAdaptors); - } +/**************************************************************************/ +/* video input formats */ - if (newAdaptors != NULL) - { - xfree(newAdaptors); - } +typedef struct _VideoInputDataRec { + char* name; +} VideoInputDataRec; - LEAVE_PROC("SMI_InitVideo"); -} +static VideoInputDataRec VideoInputs[] = { + { "composite" }, + { "svideo" } +}; -/******************************************************************************\ -** ** -** C A P A B I L I T I E S ** -** ** -\******************************************************************************/ -static XF86VideoEncodingRec SMI_VideoEncodings[] = -{ -#if SMI_USE_CAPTURE - { - SMI_VIDEO_VIDEO, /* id */ - "XV_VIDEO", /* name */ - 1024, 1024, /* width, height */ - {1, 1} /* rate */ - }, -#endif - { - SMI_VIDEO_IMAGE, /* id */ - "XV_IMAGE", /* name */ - 1024, 1024, /* width, height */ - {1, 1} /* rate */ - }, +/**************************************************************************/ +/* video norms */ + +#define N_VIDEO_NORMS 3 +typedef enum _VideoNorm { PAL, NTSC, SECAM } VideoNorm; + +typedef struct _VideoNormDataRec { + char* name; + unsigned long Wt; + unsigned long Wa; + unsigned long Ht; + unsigned long Ha; + unsigned long HStart; + unsigned long VStart; + XvRationalRec rate; +} VideoNormDataRec; + + +static VideoNormDataRec VideoNorms[] = +{ + /* PAL-BDGHI */ + {"pal", 864, 704, 625, 576, 16, 16, { 1, 50 }}, + /* NTSC */ + {"ntsc", 858, 704, 525, 480, 21, 8, { 1001, 60000 }}, + /* SECAM (not tested) */ + {"secam", 864, 7040, 625, 576, 31, 16, { 1, 50 }}, }; + +/**************************************************************************/ +/* number of (generated) XV_ENCODING vaulues */ +#define N_ENCODINGS ((N_VIDEO_NORMS) * (N_COMPOSITE_CHANNELS + N_SVIDEO_CHANNELS)) + + +/**************************************************************************/ + static XF86VideoFormatRec SMI_VideoFormats[] = { { 15, TrueColor }, /* depth, class */ @@ -193,20 +246,35 @@ { 24, TrueColor }, /* depth, class */ }; -static XF86AttributeRec SMI_VideoAttributes[] = -{ - { - XvSettable | XvGettable, /* flags */ - 0x000000, 0xFFFFFF, /* min_value, max_value */ - "XV_COLORKEY" /* name */ - }, - { - XvSettable | XvGettable, /* flags */ - -128, 127, /* min_value, max_value */ - "XV_BRIGHTNESS" /* name */ - }, + +/**************************************************************************/ + +/** + * Attributes + */ + +#define XV_ENCODING_NAME "XV_ENCODING" +#define XV_BRIGHTNESS_NAME "XV_BRIGHTNESS" +#define XV_CONTRAST_NAME "XV_CONTRAST" +#define XV_SATURATION_NAME "XV_SATURATION" +#define XV_HUE_NAME "XV_HUE" +#define XV_COLORKEY_NAME "XV_COLORKEY" +#define XV_INTERLACED_NAME "XV_INTERLACED" + + +/* fixed order! */ +static XF86AttributeRec SMI_VideoAttributes[N_ATTRS] = { + {XvSettable | XvGettable, 0, N_ENCODINGS-1, XV_ENCODING_NAME}, + {XvSettable | XvGettable, 0, 255, XV_BRIGHTNESS_NAME}, + {XvSettable | XvGettable, 0, 127, XV_CONTRAST_NAME}, + {XvSettable | XvGettable, 0, 127, XV_SATURATION_NAME}, + {XvSettable | XvGettable, -128, 127, XV_HUE_NAME}, + {XvSettable | XvGettable, 0x000000, 0xFFFFFF, XV_COLORKEY_NAME}, + {XvSettable | XvGettable, 0, 1, XV_INTERLACED_NAME}, }; + +/**************************************************************************/ static XF86ImageRec SMI_VideoImages[] = { XVIMAGE_YUY2, @@ -289,34 +357,432 @@ XvTopToBottom /* scaline_order */ }, }; + + +/**************************************************************************/ + +/** + * SAA7111 video decoder register values + */ + + +/** SAA7111 control sequences for selecting one out of four + composite input channels */ +static I2CByte SAA7111CompositeChannelSelect[N_COMPOSITE_CHANNELS][4] = { + { 0x02, 0xC0, 0x09, 0x4A}, /* CVBS AI11 */ + { 0x02, 0xC1, 0x09, 0x4A}, /* CVBS AI12 */ + { 0x02, 0xC2, 0x09, 0x4A}, /* CVBS AI21 */ + { 0x02, 0xC3, 0x09, 0x4A}, /* CVBS AI22 */ +}; + + +/** SAA7111 control sequences for selecting one out of two + s-video input channels */ +static I2CByte SAA7111SVideoChannelSelect[N_SVIDEO_CHANNELS][4] = { + { 0x02, 0xC6, 0x09, 0xCA}, /* Y/C AI11/AI21 */ + { 0x02, 0xC7, 0x09, 0xCA}, /* Y/C AI12/AI22 */ +}; -SMI_I2CDataRec data_SAA7110[] = + +/** SAA7111 control sequences for selecting one out of three + video norms */ +static I2CByte SAA7111VideoStd[3][8] = { + {0x06, 108, 0x07, 108, 0x08, 0x09, 0x0E, 0x01}, /* PAL */ + {0x06, 107, 0x07, 107, 0x08, 0x49, 0x0E, 0x01}, /* NTSC */ + {0x06, 108, 0x07, 108, 0x08, 0x01, 0x0E, 0x51} /* SECAM */ +}; + + + +static I2CByte SAA7110InitData[] = { /* Configuration */ - { 0x00, 0x4C }, { 0x01, 0x3C }, { 0x02, 0x00 }, { 0x03, 0xEF }, - { 0x04, 0xBD }, { 0x05, 0xE2 }, { 0x06, 0x00 }, { 0x07, 0x00 }, - { 0x08, 0xF8 }, { 0x09, 0xF8 }, { 0x0A, 0x60 }, { 0x0B, 0x60 }, - { 0x0C, 0x00 }, { 0x0D, 0x80 }, { 0x0E, 0x18 }, { 0x0F, 0xD9 }, - { 0x10, 0x00 }, { 0x11, 0x2B }, { 0x12, 0x40 }, { 0x13, 0x40 }, - { 0x14, 0x42 }, { 0x15, 0x1A }, { 0x16, 0xFF }, { 0x17, 0xDA }, - { 0x18, 0xE6 }, { 0x19, 0x90 }, { 0x20, 0xD9 }, { 0x21, 0x16 }, - { 0x22, 0x40 }, { 0x23, 0x40 }, { 0x24, 0x80 }, { 0x25, 0x40 }, - { 0x26, 0x80 }, { 0x27, 0x4F }, { 0x28, 0xFE }, { 0x29, 0x01 }, - { 0x2A, 0xCF }, { 0x2B, 0x0F }, { 0x2C, 0x03 }, { 0x2D, 0x01 }, - { 0x2E, 0x83 }, { 0x2F, 0x03 }, { 0x30, 0x40 }, { 0x31, 0x35 }, - { 0x32, 0x02 }, { 0x33, 0x8C }, { 0x34, 0x03 }, + 0x00, 0x4C, 0x01, 0x3C, 0x02, 0x00, 0x03, 0xEF, + 0x04, 0xBD, 0x05, 0xE2, 0x06, 0x00, 0x07, 0x00, + 0x08, 0xF8, 0x09, 0xF8, 0x0A, 0x60, 0x0B, 0x60, + 0x0C, 0x00, 0x0D, 0x80, 0x0E, 0x18, 0x0F, 0xD9, + 0x10, 0x00, 0x11, 0x2B, 0x12, 0x40, 0x13, 0x40, + 0x14, 0x42, 0x15, 0x1A, 0x16, 0xFF, 0x17, 0xDA, + 0x18, 0xE6, 0x19, 0x90, 0x20, 0xD9, 0x21, 0x16, + 0x22, 0x40, 0x23, 0x40, 0x24, 0x80, 0x25, 0x40, + 0x26, 0x80, 0x27, 0x4F, 0x28, 0xFE, 0x29, 0x01, + 0x2A, 0xCF, 0x2B, 0x0F, 0x2C, 0x03, 0x2D, 0x01, + 0x2E, 0x83, 0x2F, 0x03, 0x30, 0x40, 0x31, 0x35, + 0x32, 0x02, 0x33, 0x8C, 0x34, 0x03, /* NTSC */ - { 0x11, 0x2B }, { 0x0F, 0xD9 }, + 0x11, 0x2B, 0x0F, 0xD9, /* RCA input connector */ - { 0x06, 0x00 }, { 0x0E, 0x18 }, { 0x20, 0xD9 }, { 0x21, 0x16 }, - { 0x22, 0x40 }, { 0x2C, 0x03 }, + 0x06, 0x00, 0x0E, 0x18, 0x20, 0xD9, 0x21, 0x16, + 0x22, 0x40, 0x2C, 0x03, + +}; + + +static I2CByte SAA7111InitData[] = +{ + 0x11, 0x1D, /* 0D D0=1: automatic colour killer off + D1=0: DMSD data to YUV output + D2=1: output enable H/V sync on + D3=1: output enable YUV data on */ + 0x02, 0xC0, /* Mode 0 */ + 0x03, 0x23, /* automatic gain */ + 0x04, 0x00, /* */ + 0x05, 0x00, /* */ + 0x06, 108, /* hor sync begin */ + 0x07, 108, /* hor sync stop */ + 0x08, 0x88, /* sync control: + D1-0=00: VNOI = normal mode + D2=0: PLL closed + D3=1: VTR mode + D7=1: automatic field detection */ + 0x09, 0x41, /* 4A luminance control */ + 0x0A, 0x80, /* brightness = 128 (CCIR level) */ + 0x0B, 0x40, /* contrast = 1.0 */ + 0x0C, 0x40, /* crominance = 1.0 (CCIR level) */ + 0x0D, 0x00, /* hue = 0 */ + 0x0E, 0x01, /* chroma bandwidth = nominal + fast colour time constant = nominal + chrom comp filter on + colour standard PAL BGHI, NTSC M */ + 0x10, 0x48, /* luminance delay compensation = 0 + VRLN = 1 + fine pos of hs = 0 + output format = YUV 422 */ + 0x12, 0x00, /* 20 D5=1: VPO in tristate */ + 0x13, 0x00, + 0x15, 0x00, + 0x16, 0x00, + 0x17, 0x00, - { 0xFF, 0xFF } }; + +/**************************************************************************/ + +/** + * generates XF86VideoEncoding[i] with video norm norm, video input format + * input and video input channel channel + */ +static int +SMI_AddEncoding(XF86VideoEncodingPtr enc, int i, + int norm, int input, int channel) +{ + char* norm_string; + char* input_string; + char channel_string[20]; + + ENTER_PROC("SMI_AddEncoding"); + + norm_string = VideoNorms[norm].name; + input_string = VideoInputs[input].name; + sprintf(channel_string, "%d", channel); + enc[i].id = i; + enc[i].name = xalloc(strlen(norm_string) + + strlen(input_string) + + strlen(channel_string)+3); + if (NULL == enc[i].name) { + LEAVE_PROC("SMI_AddEncoding"); + return -1; + } + enc[i].width = VideoNorms[norm].Wa; + enc[i].height = VideoNorms[norm].Ha; + enc[i].rate = VideoNorms[norm].rate; + sprintf(enc[i].name,"%s-%s-%s", norm_string, input_string, channel_string); + + LEAVE_PROC("SMI_AddEncoding"); + return 0; +} + + +/** + * builds XF86VideoEncodings with all legal combinations of video norm, + * video input format and video input channel + */ +static void +SMI_BuildEncodings(SMI_PortPtr p) +{ + int ch, n; + + ENTER_PROC("SMI_BuildEncodings"); + + /* allocate memory for encoding array */ + p->enc = xalloc(sizeof(XF86VideoEncodingRec) * N_ENCODINGS); + if (NULL == p->enc) + goto fail; + memset(p->enc,0,sizeof(XF86VideoEncodingRec) * N_ENCODINGS); + /* allocate memory for video norm array */ + p->norm = xalloc(sizeof(int) * N_ENCODINGS); + if (NULL == p->norm) + goto fail; + memset(p->norm,0,sizeof(int) * N_ENCODINGS); + /* allocate memory for video input format array */ + p->input = xalloc(sizeof(int) * N_ENCODINGS); + if (NULL == p->input) + goto fail; + memset(p->input,0,sizeof(int) * N_ENCODINGS); + /* allocate memory for video channel number array */ + p->channel = xalloc(sizeof(int) * N_ENCODINGS); + if (NULL == p->channel) + goto fail; + memset(p->channel,0,sizeof(int) * N_ENCODINGS); + + /* fill arrays */ + p->nenc = 0; + for (ch = 0; ch < N_COMPOSITE_CHANNELS; ch++) { + for (n = 0; n < N_VIDEO_NORMS; n++) { + SMI_AddEncoding(p->enc, p->nenc, n, COMPOSITE, ch); + p->norm[p->nenc] = n; + p->input[p->nenc] = COMPOSITE; + p->channel[p->nenc] = ch; + p->nenc++; + } + } + for (ch = 0; ch < N_SVIDEO_CHANNELS; ch++) { + for (n = 0; n < N_VIDEO_NORMS; n++) { + SMI_AddEncoding(p->enc, p->nenc, n, SVIDEO, ch); + p->norm[p->nenc] = n; + p->input[p->nenc] = SVIDEO; + p->channel[p->nenc] = ch; + p->nenc++; + } + } + LEAVE_PROC("SMI_BuildEncodings"); + return; + + fail: + if (p->input) xfree(p->input); + p->input = NULL; + if (p->norm) xfree(p->norm); + p->norm = NULL; + if (p->channel) xfree(p->channel); + p->channel = NULL; + if (p->enc) xfree(p->enc); + p->enc = NULL; + p->nenc = 0; + LEAVE_PROC("SMI_BuildEncodings"); +} + + /******************************************************************************\ +** ** +** X V E X T E N S I O N I N T E R F A C E ** +** ** +\******************************************************************************/ + +void +SMI_InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SMIPtr psmi = SMIPTR(pScrn); + XF86VideoAdaptorPtr *ptrAdaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int numAdaptors; + + ENTER_PROC("SMI_InitVideo"); + + numAdaptors = xf86XVListGenericAdaptors(pScrn, &ptrAdaptors); + + DEBUG((VERBLEV, "numAdaptors=%d\n", numAdaptors)); + + if (psmi->rotate == 0) + { + newAdaptor = SMI_SetupVideo(pScreen); + DEBUG((VERBLEV, "newAdaptor=%p\n", newAdaptor)); + SMI_InitOffscreenImages(pScreen); + } + + if (newAdaptor != NULL) + { + if (numAdaptors == 0) + { + numAdaptors = 1; + ptrAdaptors = &newAdaptor; + } + else + { + newAdaptors = xalloc((numAdaptors + 1) * + sizeof(XF86VideoAdaptorPtr*)); + if (newAdaptors != NULL) + { + memcpy(newAdaptors, ptrAdaptors, + numAdaptors * sizeof(XF86VideoAdaptorPtr)); + newAdaptors[numAdaptors++] = newAdaptor; + ptrAdaptors = newAdaptors; + } + } + } + + if (numAdaptors != 0) + { + DEBUG((VERBLEV, "ScreenInit\n")); + xf86XVScreenInit(pScreen, ptrAdaptors, numAdaptors); + } + + if (newAdaptors != NULL) + { + xfree(newAdaptors); + } + + LEAVE_PROC("SMI_InitVideo"); +} + + +/*************************************************************************/ + +/* + * Video codec controls + */ + +/** + * scales value value of attribute i to range min, max + */ +static int +Scale(int i, int value, int min, int max) +{ + return min + (value - SMI_VideoAttributes[i].min_value) * (max - min) / + (SMI_VideoAttributes[i].max_value - SMI_VideoAttributes[i].min_value); +} + +/** + * sets video decoder attributes channel, encoding, brightness, contrast, saturation, hue + */ +static int +SetAttr(ScrnInfoPtr pScrn, int i, int value) +{ + if (i < XV_ENCODING || i > XV_HUE) + return BadMatch; + + /* clamps value to attribute range */ + value = CLAMP(value, SMI_VideoAttributes[i].min_value, + SMI_VideoAttributes[i].max_value); + +#if 0 + if (pPPriv->I2CDev == SAA7110) { + return SetAttrSAA7110(pScrn, i, value); + } + else if (pPPriv->I2CDev == SAA7111) { +#endif + return SetAttrSAA7111(pScrn, i, value); +#if 0 + } + else { + return XvBadAlloc; + } +#endif + + return Success; +} + + +/** + * sets SAA7110 video decoder attributes channel, encoding, brightness, contrast, saturation, hue + */ +static int +SetAttrSAA7110(ScrnInfoPtr pScrn, int i, int value) +{ + /* not supported */ + return XvBadAlloc; +} + + +/** + * sets SAA7111 video decoder attributes channel, encoding, + * brightness, contrast, saturation, hue + */ +static int +SetAttrSAA7111(ScrnInfoPtr pScrn, int i, int value) +{ + SMIPtr pSmi = SMIPTR(pScrn); + SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; + + if (i == XV_ENCODING) { + int norm; + int input; + int channel; + norm = pPort->norm[value]; + input = pPort->input[value]; + channel = pPort->channel[value]; + + DEBUG((VERBLEV, "SetAttribute XV_ENCODING: %d. norm=%d input=%d channel=%d\n", + value, norm, input, channel)); + + /* set video norm */ + if (!xf86I2CWriteVec(&(pPort->I2CDev), SAA7111VideoStd[norm], + ENTRIES(SAA7111VideoStd[norm]) / 2)) { + return XvBadAlloc; + } + /* set video input format and channel */ + if (input == COMPOSITE) { + if (!xf86I2CWriteVec(&(pPort->I2CDev), + SAA7111CompositeChannelSelect[channel], + ENTRIES(SAA7111CompositeChannelSelect[channel]) / 2)) { + return XvBadAlloc; + } + } + else { + if (!xf86I2CWriteVec(&(pPort->I2CDev), + SAA7111SVideoChannelSelect[channel], + ENTRIES(SAA7111SVideoChannelSelect[channel]) / 2)) { + return XvBadAlloc; + } + } + } + else if (i >= XV_BRIGHTNESS && i <= XV_HUE) { + int slave_adr = 0; + + switch (i) { + + case XV_BRIGHTNESS: + DEBUG((VERBLEV, "SetAttribute XV_BRIGHTNESS: %d\n", value)); + slave_adr = 0x0a; + break; + + case XV_CONTRAST: + DEBUG((VERBLEV, "SetAttribute XV_CONTRAST: %d\n", value)); + slave_adr = 0x0b; + break; + + case XV_SATURATION: + DEBUG((VERBLEV, "SetAttribute XV_SATURATION: %d\n", value)); + slave_adr = 0x0c; + break; + + case XV_HUE: + DEBUG((VERBLEV, "SetAttribute XV_HUE: %d\n", value)); + slave_adr = 0x0d; + break; + + default: + return XvBadAlloc; + } + if (!xf86I2CWriteByte(&(pPort->I2CDev), slave_adr, (value & 0xff))) + return XvBadAlloc; + } + else { + return BadMatch; + } + + pPort->Attribute[i] = value; + + /* debug: show registers */ + { + I2CByte i2c_bytes[32]; + int i; + xf86I2CReadBytes(&(pPort->I2CDev), 0, i2c_bytes, 32); + DEBUG((VERBLEV, "SAA7111 Registers\n")); + for (i=0; i<32; i++) { + DEBUG((VERBLEV, "%02X=%02X ", i, i2c_bytes[i])); + if ((i&7) == 7) DEBUG((VERBLEV, "\n")); + } + } + + return Success; +} + + +/******************************************************************************\ ** ** ** V I D E O M A N A G E M E N T ** ** ** @@ -331,7 +797,6 @@ SMIPtr pSmi = SMIPTR(pScrn); SMI_PortPtr smiPortPtr; XF86VideoAdaptorPtr ptrAdaptor; - int i; ENTER_PROC("SMI_SetupVideo"); @@ -358,21 +823,27 @@ ptrAdaptor->name = "Silicon Motion Lynx Series Video Engine"; - ptrAdaptor->nEncodings = nElems(SMI_VideoEncodings); - ptrAdaptor->pEncodings = SMI_VideoEncodings; + ptrAdaptor->nPorts = 1; + ptrAdaptor->pPortPrivates = (DevUnion*) &ptrAdaptor[1]; + ptrAdaptor->pPortPrivates[0].ptr = (pointer) &ptrAdaptor->pPortPrivates[1]; + + smiPortPtr = (SMI_PortPtr) ptrAdaptor->pPortPrivates[0].ptr; + + SMI_BuildEncodings(smiPortPtr); + ptrAdaptor->nEncodings = smiPortPtr->nenc; + ptrAdaptor->pEncodings = smiPortPtr->enc; +#if 0 + /* aaa whats this? */ for (i = 0; i < nElems(SMI_VideoEncodings); i++) { SMI_VideoEncodings[i].width = pSmi->lcdWidth; SMI_VideoEncodings[i].height = pSmi->lcdHeight; } +#endif ptrAdaptor->nFormats = nElems(SMI_VideoFormats); ptrAdaptor->pFormats = SMI_VideoFormats; - ptrAdaptor->nPorts = 1; - ptrAdaptor->pPortPrivates = (DevUnion*) &ptrAdaptor[1]; - ptrAdaptor->pPortPrivates[0].ptr = (pointer) &ptrAdaptor->pPortPrivates[1]; - ptrAdaptor->nAttributes = nElems(SMI_VideoAttributes); ptrAdaptor->pAttributes = SMI_VideoAttributes; @@ -380,9 +851,9 @@ ptrAdaptor->pImages = SMI_VideoImages; #if SMI_USE_CAPTURE - ptrAdaptor->PutVideo = NULL; + ptrAdaptor->PutVideo = SMI_PutVideo; ptrAdaptor->PutStill = NULL; - ptrAdaptor->GetVideo = SMI_GetVideo; + ptrAdaptor->GetVideo = NULL; ptrAdaptor->GetStill = NULL; #else ptrAdaptor->PutVideo = NULL; @@ -397,18 +868,51 @@ ptrAdaptor->PutImage = SMI_PutImage; ptrAdaptor->QueryImageAttributes = SMI_QueryImageAttributes; - smiPortPtr = (SMI_PortPtr) ptrAdaptor->pPortPrivates[0].ptr; - smiPortPtr->colorKey = pSmi->videoKey; + smiPortPtr->Attribute[XV_COLORKEY] = pSmi->videoKey; + smiPortPtr->Attribute[XV_INTERLACED] = pSmi->interlaced; smiPortPtr->videoStatus = 0; - smiPortPtr->brightness = 0; + +#if 0 + /* aaa does not work ? */ + if (xf86I2CProbeAddress(pSmi->I2C, SAA7111)) + { + LEAVE_PROC("SMI_SetupVideo"); + return(NULL); + } + DEBUG((VERBLEV, "SAA7111 detected\n")); +#endif + + smiPortPtr->I2CDev.DevName = "SAA 7111A"; + smiPortPtr->I2CDev.SlaveAddr = SAA7111; + smiPortPtr->I2CDev.pI2CBus = pSmi->I2C; + + if (!xf86I2CDevInit(&(smiPortPtr->I2CDev))) + { + LEAVE_PROC("SMI_SetupVideo"); + return(NULL); + } + DEBUG((VERBLEV, "SAA7111 intialized\n")); + + if (!xf86I2CWriteVec(&(smiPortPtr->I2CDev), SAA7111InitData, ENTRIES(SAA7111InitData) / 2)) + { + LEAVE_PROC("SMI_SetupVideo"); + return(NULL); + } + REGION_INIT(pScreen, &smiPortPtr->clip, NullBox, 0); pSmi->ptrAdaptor = ptrAdaptor; pSmi->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = SMI_BlockHandler; + + xvEncoding = MAKE_ATOM(XV_ENCODING_NAME); + xvHue = MAKE_ATOM(XV_HUE_NAME); + xvSaturation = MAKE_ATOM(XV_SATURATION_NAME); + xvBrightness = MAKE_ATOM(XV_BRIGHTNESS_NAME); + xvContrast = MAKE_ATOM(XV_CONTRAST_NAME); - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvColorKey = MAKE_ATOM(XV_COLORKEY_NAME); + xvInterlaced = MAKE_ATOM(XV_INTERLACED_NAME); SMI_ResetVideo(pScrn); @@ -416,47 +920,55 @@ return(ptrAdaptor); } + static void SMI_ResetVideo( ScrnInfoPtr pScrn ) { SMIPtr pSmi = SMIPTR(pScrn); - SMI_PortPtr ptrPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; + SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; int r, g, b; ENTER_PROC("SMI_ResetVideo"); + SetAttr(pScrn, XV_ENCODING, 0); /* Encoding = pal-composite-0 */ + SetAttr(pScrn, XV_BRIGHTNESS, 128); /* Brightness = 128 (CCIR level) */ + SetAttr(pScrn, XV_CONTRAST, 71); /* Contrast = 71 (CCIR level) */ + SetAttr(pScrn, XV_SATURATION, 64); /* Color saturation = 64 (CCIR level) */ + SetAttr(pScrn, XV_HUE, 0); /* Hue = 0 */ + switch (pScrn->depth) { case 8: - WRITE_VPR(pSmi, 0x04, ptrPort->colorKey & 0x00FF); + WRITE_VPR(pSmi, 0x04, pPort->Attribute[XV_COLORKEY] & 0x00FF); WRITE_VPR(pSmi, 0x08, 0); break; case 15: case 16: - WRITE_VPR(pSmi, 0x04, ptrPort->colorKey & 0xFFFF); + WRITE_VPR(pSmi, 0x04, pPort->Attribute[XV_COLORKEY] & 0xFFFF); WRITE_VPR(pSmi, 0x08, 0); break; default: - r = (ptrPort->colorKey & pScrn->mask.red) >> pScrn->offset.red; - g = (ptrPort->colorKey & pScrn->mask.green) >> pScrn->offset.green; - b = (ptrPort->colorKey & pScrn->mask.blue) >> pScrn->offset.blue; + r = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.red) >> pScrn->offset.red; + g = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.green) >> pScrn->offset.green; + b = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.blue) >> pScrn->offset.blue; WRITE_VPR(pSmi, 0x04, ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)); WRITE_VPR(pSmi, 0x08, 0); break; } - WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (ptrPort->brightness << 24)); + WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (pPort->Attribute[XV_BRIGHTNESS] << 24)); LEAVE_PROC("SMI_ResetVideo"); } + #if SMI_USE_CAPTURE static int -SMI_GetVideo( +SMI_PutVideo( ScrnInfoPtr pScrn, short vid_x, short vid_y, @@ -470,18 +982,37 @@ pointer data ) { - SMI_PortPtr ptrPort = (SMI_PortPtr) data; + SMI_PortPtr pPort = (SMI_PortPtr) data; SMIPtr pSmi = SMIPTR(pScrn); CARD32 vid_pitch, vid_address; CARD32 vpr00, cpr00; int xscale, yscale; BoxRec dstBox; INT32 x1, y1, x2, y2; + int norm; int areaHeight, width, height, fbPitch; int top, left; + + ENTER_PROC("SMI_PutVideo"); - ENTER_PROC("SMI_GetVideo"); + DEBUG((VERBLEV, "Interlaced Video %d\n", pPort->Attribute[XV_INTERLACED])); + if (!pPort->Attribute[XV_INTERLACED]) { + /* no interlace: lines will be doubled */ + vid_h /= 2; + } + + /* field start aaa*/ + norm = pPort->norm[pPort->Attribute[XV_ENCODING]]; + vid_x += VideoNorms[norm].HStart; + vid_y += VideoNorms[norm].VStart; + /* only even values allowed (UV-phase) */ + vid_x &= ~1; + + DEBUG((VERBLEV, "vid_x=%d vid_y=%d drw_x=%d drw_y=%d " + "vid_w=%d vid_h=%d drw_w=%d drw_h=%d\n", + vid_x, vid_y, drw_x, drw_y, vid_w, vid_h, drw_w, drw_h)); + x1 = vid_x; y1 = vid_y; x2 = vid_x + vid_w; @@ -495,40 +1026,96 @@ dstBox.x2 = drw_x + drw_w; dstBox.y2 = drw_y + drw_h; +#if 1 if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) +#else + if (!xf86XVClipVideoHelper(&dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, + height)) +#endif { - LEAVE_PROC("SMI_GetVideo"); + LEAVE_PROC("SMI_PutVideo"); return(Success); } + DEBUG((VERBLEV, "Clip: x1=%d y1=%d x2=%d y2=%d\n", x1 >> 16, y1 >> 16, x2 >> 16, y2 >> 16)); + dstBox.x1 -= pScrn->frameX0; dstBox.y1 -= pScrn->frameY0; dstBox.x2 -= pScrn->frameX0; dstBox.y2 -= pScrn->frameY0; - if (ptrPort->i2cDevice == 0) - { - if (SMI_SendI2C(pScrn, SAA7110, "SAA7110", data_SAA7110) == Success) - { - ptrPort->i2cDevice = SAA7110; - } - else - { - xf86FreeOffscreenArea(ptrPort->area); - ptrPort->area = NULL; - LEAVE_PROC("SMI_GetVideo"); - return(BadAlloc); - } - } - vid_pitch = (vid_w * 2 + 7) & ~7; vpr00 = READ_VPR(pSmi, 0x00) & ~0x0FF000FF; cpr00 = READ_CPR(pSmi, 0x00) & ~0x000FFF00; - vpr00 |= 0x0110000E; - cpr00 |= 0x00000001; + /* vpr00: + Bit 2..0 = 6: Video Window I Format = YUV4:2:2 + Bit 3 = 1: Video Window I Enable = enabled + Bit 4 = 0: Video Window I YUV Averaging = disabled + Bit 5 = 0: Video Window I Hor. Replication = disabled + Bit 6 = 0: Video Window I data doubling = disabled + Bit 14..8 = 0: Video Window II = disabled + Bit 18..16 = 0: Graphics Data Format = 8-bit index + Bit 19 = 0: Top Video Window Select = window I + Bit 20 = 1: Color Key for Window I = enabled + Bit 21 = 0: Vertical Interpolation = s. below + Bit 22 = 0: Flicker Reduction for TV Modes = disabled + Bit 23 = 0: Fixed Vertical Interpolation = disabled + Bit 24 = 1: Select Video Window I Source Addr = + Bit 25 = 0: Enable V0FIFO to fetch 8-Bit color data = disabled + Bit 26 = 0: + Bit 27 = 1: Color Key for Window II = disabled + Bit 31..28 = reserved + */ + if (pPort->Attribute[XV_INTERLACED]) { + /* + Bit 21 = 0: Vertical Interpolation = disabled + Bit 24 = 0: Select Video Window I Source Addr = 0 + */ + vpr00 |= 0x0010000E; + } + else { + /* + Bit 21 = 10: Vertical Interpolation = enabled + Bit 24 = 1: Select Video Window I Source Addr = 1 + 1= Video window I source addr = capture port buffer ? + */ + vpr00 |= 0x0130000E; + } + + /* cpr00: + Bit 0 = 1: Video Capture Enable = enabled + Bit 8 = 0: Capture Control = continous + Bit 9 = 0: Double Buffer Enable = s. below + Bit 10 = 0: Interlace Data Capture = s. below + Bit 13..11 = 0: Frame Skip Enable = s. below + Bit 15..14 = 0: Video Capture Input Format = YUV4:2:2 + Bit 17..16 = 0: Enable Hor. Reduction = s. below + Bit 19..18 = 0: Enable Vert. Reduction = s. below + Bit 21..20 = 0: Enable Hor. Filtering = s. below + Bit 22 = 0: HREF Polarity = high active + Bit 23 = 0: VREF Polarity = high active + Bit 24 = 1: Field Detection Method VSYNC edge = rising + */ + if (pPort->Attribute[XV_INTERLACED]) { + /* + Bit 9 = 1: Double Buffer Enable = enabled + Bit 10 = 1: Interlace Data Capture = enabled + Bit 13..11 = 0: Frame Skip Enable = no skip + */ + cpr00 |= 0x01000601; + } + else { + /* + Bit 9 = 0: Double Buffer Enable = disabled + Bit 10 = 0: Interlace Data Capture = disabled + Bit 13..11 = 010: Frame Skip Enable = skip every other frame + */ + cpr00 |= 0x01000801; + } + if (pSmi->ByteSwap) cpr00 |= 0x00004000; @@ -590,8 +1177,10 @@ do { areaHeight = (vid_pitch * height + fbPitch - 1) / fbPitch; - ptrPort->area = SMI_AllocateMemory(pScrn, ptrPort->area, areaHeight); - if (ptrPort->area == NULL) + DEBUG((VERBLEV, "SMI_AllocateMemory: vid_pitch=%d height=%d fbPitch=%d areaHeight=%d\n", + vid_pitch, height, fbPitch, areaHeight)); + pPort->area = SMI_AllocateMemory(pScrn, pPort->area, areaHeight); + if (pPort->area == NULL) { if ((cpr00 & 0x000C0000) == 0) { @@ -626,75 +1215,128 @@ } else { - LEAVE_PROC("SMI_GetVideo"); + DEBUG((VERBLEV, "allocate error\n")); + LEAVE_PROC("SMI_PutVideo"); return(BadAlloc); } } } } - while (ptrPort->area == NULL); + while (pPort->area == NULL); - vid_address = (ptrPort->area->box.y1 * fbPitch) + ((y1 >> 16) * vid_pitch); + DEBUG((VERBLEV, "xscale==%d yscale=%d width=%d height=%d\n", + xscale, yscale, width, height)); - if (!RegionsEqual(&ptrPort->clip, clipBoxes)) - { - REGION_COPY(pScreen, &ptrPort->clip, clipBoxes); - XAAFillSolidRects(pScrn, ptrPort->colorKey, GXcopy, ~0, + /* aaa whats this ----------------------v ? + vid_address = (pPort->area->box.y1 * fbPitch) + ((y1 >> 16) * vid_pitch);*/ + vid_address = (pPort->area->box.y1 * fbPitch); + + DEBUG((VERBLEV, "test RegionsEqual\n")); + if (!RegionsEqual(&pPort->clip, clipBoxes)) + { + DEBUG((VERBLEV, "RegionCopy\n")); + REGION_COPY(pScreen, &pPort->clip, clipBoxes); +#if USE_XAA + XAAFillSolidRects(pScrn, pPort->Attribute[XV_COLORKEY], GXcopy, ~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); +#else + DEBUG((VERBLEV, "FillKey\n")); + xf86XVFillKeyHelper(pScrn->pScreen, pPort->Attribute[XV_COLORKEY], clipBoxes); +#endif + } left = x1 >> 16; top = y1 >> 16; width = (x2 - x1) >> 16; height = (y2 - y1) >> 16; - if (ptrPort->i2cDevice == SAA7110) - { - left += 79; - top += 12; - } OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) & ~0x04); WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) | 0x00200000); SMI_WaitForSync(pScrn); + /* Video Window I Left and Top Boundaries */ WRITE_VPR(pSmi, 0x14, dstBox.x1 + (dstBox.y1 << 16)); + /* Video Window I Right and Bottom Boundaries */ WRITE_VPR(pSmi, 0x18, dstBox.x2 + (dstBox.y2 << 16)); + /* Video Window I Source Width and Offset */ WRITE_VPR(pSmi, 0x20, (vid_pitch / 8) + ((vid_pitch / 8) << 16)); + /* Video Window I Stretch Factor */ WRITE_VPR(pSmi, 0x24, (xscale << 8) + yscale); + if (pPort->Attribute[XV_INTERLACED]) { + /* Video Window II Left and Top Boundaries */ + WRITE_VPR(pSmi, 0x28, dstBox.x1 + (dstBox.y1 << 16)); + /* Video Window II Right and Bottom Boundaries */ + WRITE_VPR(pSmi, 0x2C, dstBox.x2 + (dstBox.y2 << 16)); + /* Video Window II Source Width and Offset */ + WRITE_VPR(pSmi, 0x34, (vid_pitch / 8) + ((vid_pitch / 8) << 16)); + /* Video Window II Stretch Factor */ + WRITE_VPR(pSmi, 0x38, (xscale << 8) + yscale); + + /* Video Window I Source Start Address */ + WRITE_VPR(pSmi, 0x1C, vid_address / 8); + /* Video Window II Source Start Address */ + WRITE_VPR(pSmi, 0x30, vid_address / 8); + + /* Video Window I Source Start Address */ + WRITE_VPR(pSmi, 0x48, vid_address / 8); + /* Video Window II Source Start Address */ + WRITE_VPR(pSmi, 0x4C, vid_address / 8 + vid_pitch / 8); + + /* Video Source Clipping Control */ + WRITE_CPR(pSmi, 0x04, left + ((top/2) << 16)); + /* Video Source Capture Size Control */ + WRITE_CPR(pSmi, 0x08, width + ((height/2) << 16)); + /* Capture Port Buffer I Source Start Address */ + WRITE_CPR(pSmi, 0x0C, vid_address / 8); + /* Capture Port Buffer II Source Start Address */ + WRITE_CPR(pSmi, 0x10, vid_address / 8 + vid_pitch / 8); + /* Capture Port Source Offset Address */ + WRITE_CPR(pSmi, 0x14, 2*(vid_pitch / 8) + ((2*(vid_pitch / 8)) << 16)); + } + else { + /* Video Source Clipping Control */ WRITE_CPR(pSmi, 0x04, left + (top << 16)); + /* Video Source Capture Size Control */ WRITE_CPR(pSmi, 0x08, width + (height << 16)); + /* Capture Port Buffer I Source Start Address */ WRITE_CPR(pSmi, 0x0C, vid_address / 8); + /* Capture Port Buffer II Source Start Address */ WRITE_CPR(pSmi, 0x10, vid_address / 8); + /* Capture Port Source Offset Address */ WRITE_CPR(pSmi, 0x14, (vid_pitch / 8) + ((vid_pitch / 8) << 16)); + } WRITE_CPR(pSmi, 0x00, cpr00); WRITE_VPR(pSmi, 0x00, vpr00); - ptrPort->videoStatus = CLIENT_VIDEO_ON; - LEAVE_PROC("SMI_GetVideo"); + pPort->videoStatus = CLIENT_VIDEO_ON; + DEBUG((VERBLEV, "SMI_PutVideo success\n")); + LEAVE_PROC("SMI_PutVideo"); return(Success); } #endif + static void SMI_StopVideo( ScrnInfoPtr pScrn, pointer data, - Bool exit + Bool shutdown ) { - SMI_PortPtr ptrPort = (SMI_PortPtr) data; + SMI_PortPtr pPort = (SMI_PortPtr) data; SMIPtr pSmi = SMIPTR(pScrn); ENTER_PROC("SMI_StopVideo"); - REGION_EMPTY(pScrn->pScreen, &ptrPort->clip); + REGION_EMPTY(pScrn->pScreen, &pPort->clip); - if (exit) + if (shutdown) { - if (ptrPort->videoStatus & CLIENT_VIDEO_ON) + if (pPort->videoStatus & CLIENT_VIDEO_ON) { WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x01000008); #if SMI_USE_CAPTURE @@ -703,26 +1345,27 @@ /* #864 OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) | 0x04); */ #endif } - if (ptrPort->area != NULL) + if (pPort->area != NULL) { - xf86FreeOffscreenArea(ptrPort->area); - ptrPort->area = NULL; + xf86FreeOffscreenArea(pPort->area); + pPort->area = NULL; } - ptrPort->videoStatus = 0; - ptrPort->i2cDevice = 0; + pPort->videoStatus = 0; + /* pPort->i2cDevice = 0;aaa*/ } else { - if (ptrPort->videoStatus & CLIENT_VIDEO_ON) + if (pPort->videoStatus & CLIENT_VIDEO_ON) { - ptrPort->videoStatus |= OFF_TIMER; - ptrPort->offTime = currentTime.milliseconds + OFF_DELAY; + pPort->videoStatus |= OFF_TIMER; + pPort->offTime = currentTime.milliseconds + OFF_DELAY; } } LEAVE_PROC("SMI_StopVideo"); } + static int SMI_SetPortAttribute( ScrnInfoPtr pScrn, @@ -731,16 +1374,16 @@ pointer data ) { - SMI_PortPtr ptrPort = (SMI_PortPtr) data; + int res; + SMI_PortPtr pPort = (SMI_PortPtr) data; SMIPtr pSmi = SMIPTR(pScrn); ENTER_PROC("SMI_SetPortAttribute"); - if (attribute == xvColorKey) - { + if (attribute == xvColorKey) { int r, g, b; - ptrPort->colorKey = value; + pPort->Attribute[XV_COLORKEY] = value; switch (pScrn->depth) { case 8: @@ -760,29 +1403,36 @@ ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)); break; } + res = Success; } - - else if (attribute == xvBrightness) - { - if ((value < -128) || (value > 127)) - { - LEAVE_PROC("SMI_SetPortAttribute"); - return(BadValue); + else if (attribute == xvInterlaced) { + pPort->Attribute[XV_INTERLACED] = (value != 0); + res = Success; } - ptrPort->brightness = value; - WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (value << 24)); + else if (attribute == xvEncoding) { + res = SetAttr(pScrn, XV_ENCODING, value); } - - else - { - LEAVE_PROC("SMI_SetPortAttribute"); - return(BadMatch); + else if (attribute == xvBrightness) { + res = SetAttr(pScrn, XV_BRIGHTNESS, value); + } + else if (attribute == xvContrast) { + res = SetAttr(pScrn, XV_CONTRAST, value); + } + else if (attribute == xvSaturation) { + res = SetAttr(pScrn, XV_SATURATION, value); + } + else if (attribute == xvHue) { + res = SetAttr(pScrn, XV_HUE, value); + } + else { + res = BadMatch; } LEAVE_PROC("SMI_SetPortAttribute"); - return(Success); + return(res); } + static int SMI_GetPortAttribute( ScrnInfoPtr pScrn, @@ -791,19 +1441,22 @@ pointer data ) { - SMI_PortPtr ptrPort = (SMI_PortPtr) data; + SMI_PortPtr pPort = (SMI_PortPtr) data; ENTER_PROC("SMI_GetPortAttribute"); - - if (attribute == xvColorKey) - { - *value = ptrPort->colorKey; - } + if (attribute == xvEncoding) + *value = pPort->Attribute[XV_ENCODING]; else if (attribute == xvBrightness) - { - *value = ptrPort->brightness; - } + *value = pPort->Attribute[XV_BRIGHTNESS]; + else if (attribute == xvContrast) + *value = pPort->Attribute[XV_CONTRAST]; + else if (attribute == xvSaturation) + *value = pPort->Attribute[XV_SATURATION]; + else if (attribute == xvHue) + *value = pPort->Attribute[XV_HUE]; + else if (attribute == xvColorKey) + *value = pPort->Attribute[XV_COLORKEY]; else { @@ -815,6 +1468,7 @@ return(Success); } + static void SMI_QueryBestSize( ScrnInfoPtr pScrn, @@ -838,6 +1492,7 @@ LEAVE_PROC("SMI_QueryBestSize"); } + static int SMI_PutImage( ScrnInfoPtr pScrn, @@ -859,7 +1514,7 @@ ) { SMIPtr pSmi = SMIPTR(pScrn); - SMI_PortPtr ptrPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; + SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; INT32 x1, y1, x2, y2; int bpp = 0; int fbPitch, srcPitch, srcPitch2 = 0, dstPitch, areaHeight; @@ -942,8 +1597,8 @@ } areaHeight = ((dstPitch * height) + fbPitch - 1) / fbPitch; - ptrPort->area = SMI_AllocateMemory(pScrn, ptrPort->area, areaHeight); - if (ptrPort->area == NULL) + pPort->area = SMI_AllocateMemory(pScrn, pPort->area, areaHeight); + if (pPort->area == NULL) { LEAVE_PROC("SMI_PutImage"); return(BadAlloc); @@ -954,7 +1609,7 @@ nPixels = ((((x2 + 0xFFFF) >> 16) + 1) & ~1) - left; left *= bpp; - offset = (ptrPort->area->box.y1 * fbPitch) + (top * dstPitch); + offset = (pPort->area->box.y1 * fbPitch) + (top * dstPitch); dstStart = pSmi->FBBase + offset + left; switch (id) @@ -979,22 +1634,28 @@ break; } - if (!RegionsEqual(&ptrPort->clip, clipBoxes)) + if (!RegionsEqual(&pPort->clip, clipBoxes)) { - REGION_COPY(pScreen, &ptrPort->clip, clipBoxes); - XAAFillSolidRects(pScrn, ptrPort->colorKey, GXcopy, ~0, + REGION_COPY(pScreen, &pPort->clip, clipBoxes); +#if USE_XAA + XAAFillSolidRects(pScrn, pPort->Attribute[XV_COLORKEY], GXcopy, ~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); +#else + /*aaa*/ + return(BadAlloc); +#endif } SMI_DisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); - ptrPort->videoStatus = CLIENT_VIDEO_ON; + pPort->videoStatus = CLIENT_VIDEO_ON; LEAVE_PROC("SMI_PutImage"); return(Success); } + static int SMI_QueryImageAttributes( ScrnInfoPtr pScrn, @@ -1089,6 +1750,7 @@ return(size); } + /******************************************************************************\ ** ** ** S U P P O R T F U N C T I O N S ** @@ -1167,12 +1829,13 @@ INT32 height ) { - INT32 vscale, hscale, delta; + INT32 vscale, hscale; BoxPtr extents = REGION_EXTENTS(pScrn, reg); int diff; ENTER_PROC("SMI_ClipVideo"); + DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); /* PDR#941 */ extents->x1 = max(extents->x1, pScrn->frameX0); extents->y1 = max(extents->y1, pScrn->frameY0); @@ -1183,6 +1846,8 @@ *x1 <<= 16; *y1 <<= 16; *x2 <<= 16; *y2 <<= 16; + DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + diff = extents->x1 - dst->x1; if (diff > 0) { @@ -1211,6 +1876,8 @@ *y2 -= diff * vscale; } + DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + if (*x1 < 0) { diff = (-*x1 + hscale - 1) / hscale; @@ -1225,6 +1892,9 @@ *y1 += diff * vscale; } + DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + +#if 0 /* aaa was macht dieser code? */ delta = *x2 - (width << 16); if (delta > 0) { @@ -1240,6 +1910,9 @@ dst->y2 -= diff; *y2 -= diff * vscale; } +#endif + + DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); if ((*x1 >= *x2) || (*y1 >= *y2)) { @@ -1257,6 +1930,8 @@ REGION_UNINIT(pScrn, &clipReg); } + DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); + LEAVE_PROC("SMI_ClipVideo"); return(TRUE); } @@ -1356,36 +2031,37 @@ ScreenPtr pScreen = screenInfo.screens[i]; ScrnInfoPtr pScrn = xf86Screens[i]; SMIPtr pSmi = SMIPTR(pScrn); - SMI_PortPtr ptrPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; + SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr; pScreen->BlockHandler = pSmi->BlockHandler; (*pScreen->BlockHandler)(i, blockData, pTimeout, pReadMask); pScreen->BlockHandler = SMI_BlockHandler; - if (ptrPort->videoStatus & TIMER_MASK) + if (pPort->videoStatus & TIMER_MASK) { UpdateCurrentTime(); - if (ptrPort->videoStatus & OFF_TIMER) + if (pPort->videoStatus & OFF_TIMER) { - if (ptrPort->offTime < currentTime.milliseconds) + if (pPort->offTime < currentTime.milliseconds) { WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008); - ptrPort->videoStatus = FREE_TIMER; - ptrPort->freeTime = currentTime.milliseconds + FREE_DELAY; + pPort->videoStatus = FREE_TIMER; + pPort->freeTime = currentTime.milliseconds + FREE_DELAY; } } else { - if (ptrPort->freeTime < currentTime.milliseconds) + if (pPort->freeTime < currentTime.milliseconds) { - xf86FreeOffscreenArea(ptrPort->area); - ptrPort->area = NULL; + xf86FreeOffscreenArea(pPort->area); + pPort->area = NULL; } - ptrPort->videoStatus = 0; + pPort->videoStatus = 0; } } } +#if 0 static int SMI_SendI2C( ScrnInfoPtr pScrn, @@ -1407,6 +2083,7 @@ } dev = xf86CreateI2CDevRec(); + ErrorF("zz %x\n",dev); if (dev == NULL) { LEAVE_PROC("SMI_SendI2C"); @@ -1437,6 +2114,7 @@ LEAVE_PROC("SMI_SendI2C"); return(status); } +#endif /******************************************************************************\ ** ** @@ -1496,13 +2174,13 @@ { if ((area->box.y2 - area->box.y1) >= numLines) { - LEAVE_PROC("SMI_AllocateMemory"); + LEAVE_PROC("SMI_AllocateMemory (area->box.y2 - area->box.y1) >= numLines ok"); return(area); } if (xf86ResizeOffscreenArea(area, pScrn->displayWidth, numLines)) { - LEAVE_PROC("SMI_AllocateMemory"); + LEAVE_PROC("SMI_AllocateMemory xf86ResizeOffscreenArea ok"); return(area); } @@ -1519,9 +2197,11 @@ xf86QueryLargestOffscreenArea(pScreen, &maxW, &maxH, 0, FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME); + DEBUG((VERBLEV, "QueryLargestOffscreenArea maxW=%d maxH=%d displayWidth=%d numlines=%d\n", + maxW, maxH, pScrn->displayWidth, numLines)); if ((maxW < pScrn->displayWidth) || (maxH < numLines)) { - LEAVE_PROC("SMI_AllocateMemory"); + LEAVE_PROC("SMI_AllocateMemory (maxW < pScrn->displayWidth) || (maxH < numLines)"); return(NULL); } @@ -1530,6 +2210,7 @@ 0, NULL, NULL, NULL); } + DEBUG((VERBLEV, "area = %p\n", area)); LEAVE_PROC("SMI_AllocateMemory"); return(area); } @@ -1738,7 +2419,7 @@ { SMI_OffscreenPtr ptrOffscreen = (SMI_OffscreenPtr) surface->devPrivate.ptr; SMIPtr pSmi = SMIPTR(surface->pScrn); - SMI_PortPtr ptrPort = pSmi->ptrAdaptor->pPortPrivates[0].ptr; + SMI_PortPtr pPort = pSmi->ptrAdaptor->pPortPrivates[0].ptr; INT32 x1, y1, x2, y2; BoxRec dstBox; @@ -1766,8 +2447,13 @@ dstBox.x2 -= surface->pScrn->frameX0; dstBox.y2 -= surface->pScrn->frameY0; - XAAFillSolidRects(surface->pScrn, ptrPort->colorKey, GXcopy, ~0, +#if USE_XAA + XAAFillSolidRects(surface->pScrn, pPort->Attribute[XV_COLORKEY], GXcopy, ~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); +#else + /*aaa*/ + return(BadAlloc); +#endif SMI_ResetVideo(surface->pScrn); SMI_DisplayVideo(surface->pScrn, surface->id, surface->offsets[0], @@ -1775,12 +2461,12 @@ y2, &dstBox, vid_w, vid_h, drw_w, drw_h); ptrOffscreen->isOn = TRUE; - if (ptrPort->videoStatus & CLIENT_VIDEO_ON) + if (pPort->videoStatus & CLIENT_VIDEO_ON) { - REGION_EMPTY(pScrn->pScreen, &ptrPort->clip); + REGION_EMPTY(pScrn->pScreen, &pPort->clip); UpdateCurrentTime(); - ptrPort->videoStatus = FREE_TIMER; - ptrPort->freeTime = currentTime.milliseconds + FREE_DELAY; + pPort->videoStatus = FREE_TIMER; + pPort->freeTime = currentTime.milliseconds + FREE_DELAY; } LEAVE_PROC("SMI_DisplaySurface"); Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.2 Sat Mar 3 17:26:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h Thu Dec 20 16:35:39 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.h,v 1.2 2001/03/03 22:26:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.3 2001/12/20 21:35:39 eich Exp $ */ #ifndef _SMI_VIDEO_H #define _SMI_VIDEO_H @@ -50,18 +50,39 @@ #define TIMER_MASK (OFF_TIMER | FREE_TIMER) #define SAA7110 0x9C +#define SAA7111 0x48 +/* + * Attributes + */ + +#define N_ATTRS 7 + +#define XV_ENCODING 0 +#define XV_BRIGHTNESS 1 +#define XV_CONTRAST 2 +#define XV_SATURATION 3 +#define XV_HUE 4 +#define XV_COLORKEY 5 +#define XV_INTERLACED 6 + typedef struct { FBAreaPtr area; RegionRec clip; - CARD32 colorKey; - CARD32 brightness; + /* Attributes */ + CARD32 Attribute[N_ATTRS]; CARD32 videoStatus; Time offTime; Time freeTime; - int i2cDevice; + I2CDevRec I2CDev; + /* Encodings */ + XF86VideoEncodingPtr enc; + int *input; + int *norm; + int *channel; + int nenc,cenc; } SMI_PortRec, *SMI_PortPtr; typedef struct Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.22 xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.22 Wed May 16 09:43:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h Thu Jan 17 04:57:29 2002 @@ -20,12 +20,12 @@ * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, + * 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.h,v 1.22 2001/05/16 13:43:17 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.25 2002/01/17 09:57:29 eich Exp $ */ #ifndef _SIS_H #define _SIS_H_ @@ -37,6 +37,7 @@ #include "compiler.h" #include "xaa.h" #include "vgaHW.h" +#include "vbe.h" #ifdef XF86DRI #include "xf86drm.h" @@ -70,10 +71,13 @@ #define CRT2_TV 0x00000020 #define CRT2_VGA 0x00000040 #define CRT2_ENABLE 0x00000070 +#define DISPTYPE_DISP2 (CRT2_LCD | CRT2_TV | CRT2_VGA) /* TW */ +#define LCD_640x480 0x00000080 /* TW */ #define LCD_800x600 0x00000100 #define LCD_1024x768 0x00000200 #define LCD_1280x1024 0x00000400 -#define LCD_TYPE 0x00000700 +#define LCD_1280x960 0x00000800 /* TW */ +#define LCD_TYPE 0x00000F80 /* TW */ #define TV_NTSC 0x00001000 #define TV_PAL 0x00002000 #define TV_HIVISION 0x00004000 @@ -82,15 +86,25 @@ #define TV_SVIDEO 0x00020000 #define TV_SCART 0x00040000 #define TV_INTERFACE 0x00070000 +#define DISPTYPE_CRT1 0x00080000 /* TW: CRT1 connected and used */ +#define DISPTYPE_DISP1 DISPTYPE_CRT1 /* TW */ #define VB_301 0x00100000 #define VB_302 0x00200000 #define VB_303 0x00400000 +#define VB_301B 0x00800000 /* TW */ #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 VB_VIDEOBRIDGE (VB_301|VB_301B|VB_302|VB_303|VB_LVDS|VB_CHRONTEL) /* TW */ +#define VB_NOLCD 0x04000000 /* TW */ +#define VB_LCDA 0x08000000 /* TW */ +#define SINGLE_MODE 0x10000000 /* TW: CRT1 or CRT2; old: 0x00000000 */ +#define VB_DISPMODE_SINGLE SINGLE_MODE /* TW */ +#define MIRROR_MODE 0x20000000 /* TW: CRT1 + CRT2 */ +#define VB_DISPMODE_MIRROR MIRROR_MODE /* TW */ +#define DUALVIEW_MODE 0x40000000 /* TW: CRT1 + CRT2 independent (not used) */ +/* #define SIMU_MODE 0x10000000 */ /* TW */ +/* #define MM_MODE 0x20000000 */ /* TW */ +#define DISPLAY_MODE 0x70000000 /* TW: Mask; old 0x30000000 */ #define MASK_DISPTYPE_CRT2 0x04 /* Connect LCD */ #define MASK_DISPTYPE_LCD 0x02 /* Connect LCD */ #define MASK_DISPTYPE_TV 0x01 /* Connect TV */ @@ -123,7 +137,7 @@ EntityInfoPtr pEnt; int Chipset; int ChipRev; - unsigned long FbAddress; /* VRAM physical address */ + unsigned long FbAddress; /* VRAM physical address */ unsigned char * FbBase; /* VRAM linear address */ CARD32 IOAddress; /* MMIO physical address */ @@ -139,6 +153,7 @@ int MaxClock; int Flags; /* HW config flags */ long FbMapSize; + unsigned long maxxfbmem; /* limit fb memory X is to use to this (KB) */ DGAModePtr DGAModes; int numDGAModes; Bool DGAactive; @@ -148,6 +163,7 @@ Bool HWCursor; Bool UsePCIRetry; Bool TurboQueue; + int VESA; int ForceCRT2Type; Bool ValidWidth; Bool FastVram; @@ -177,10 +193,12 @@ Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSave3)(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 (*SiSRestore3)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSRestoreLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSRestoreChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, @@ -231,7 +249,38 @@ ScreenBlockHandlerProcPtr BlockHandler; OptionInfoPtr Options; - + unsigned char LCDon; + Bool Blank; + unsigned char BIOSModeSave; + int CRT1off; /* TW: 1=CRT1 off, 0=CRT1 on */ + CARD16 LCDheight; /* TW: Vertical resolution of LCD panel */ + vbeInfoPtr pVbe; /* TW: all following for VESA switching with 630+LVDS */ + CARD16 vesamajor; + CARD16 vesaminor; + VbeInfoBlock *vbeInfo; + int UseVESA; + xf86MonPtr monitor; + CARD16 maxBytesPerScanline; + CARD32 *pal, *savedPal; + int mapPhys, mapOff, mapSize; + int statePage, stateSize, stateMode; + CARD8 *fonts; + CARD8 *state, *pstate; + void *base, *VGAbase; } SISRec, *SISPtr; + +typedef struct _ModeInfoData { + int mode; + VbeModeInfoBlock *data; + VbeCRTCInfoBlock *block; +} ModeInfoData; + +typedef struct _sisModeInfoPtr { + int width; + int height; + int bpp; + int n; + struct _sisModeInfoPtr *next; +} sisModeInfoRec, *sisModeInfoPtr; #endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man:1.3 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man Thu Jan 10 14:05:43 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.3 2001/04/19 12:40:33 alanh Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.6 2002/01/10 19:05:43 eich Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH SIS __drivermansuffix__ __vendorversion__ @@ -14,17 +14,97 @@ .fi .SH DESCRIPTION .B sis -is an XFree86 driver for SiS video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. +is an XFree86 driver for SiS video cards. The driver is accelerated, and +provides support for 8, 16 and 24 colordepths. XVideo, Render and other +extensions are supported as well. .SH SUPPORTED HARDWARE The .B sis -driver supports... +driver supports PCI and AGP video cards based on the following chipsets: +.PP +.B SIS5597 +.B SIS5598 +.B SIS530 +.B SIS6326 +.B SIS300 +.B SIS540 +.B SIS630 .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 will auto-detect the amount of video memory present for all +chips, but in the 6326 case, it will limit the memory size to 4MB. This +is because of a bug (in docs at least). You can override this using the +.B \*qVideoRAM\*q +option in the device section if your board has more than +4MB and you need to use it (maybe with cursor problems). +.PP +If you have problems getting high resolutions because of dot clock +limitations, try using the +.B \*qDacSpeed\*q +option, also in the device section. +.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 \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: on. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +The opposite of HWCursor. Default: off. +.TP +.BI "Option \*qNoXVideo*q \*q" boolean \*q +Disable XV (XVideo) extension support. Default: off. +.TP +.BI "Option \*qSetMClk\*q \*q" integer \*q +Set the memory clock. Value in MHz. Default: autodetect. +.TP +.BI "Option \*qPciRetry\*q \*q" boolean \*q +Enable or disable PCI retries. Default: on. +.TP +.BI "Option \*qTurboQueue\*q \*q" boolean \*q +Enable or disable TurboQueue mode. Default: off for SIS530, on for the +others +.TP +.BI "Option \*qFastVram\*q \*q" boolean \*q +Enable or disable FastVram mode. Default: on. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +Rotate the display clockwise. This mode is unaccelerated, and uses +the Shadow Frame Buffer layer. +Default: no rotation. +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the display counterclockwise. This mode is unaccelerated, and +uses the Shadow Frame Buffer layer. +Default: no rotation. +.TP +.BI "Option \*qForceCRT2Type\*q \*qstring\*q" +Force display type to one of: TV, LCD or VGA. Default: auto detect. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. Default: off. +.TP +.BI "Option \*qNoXVideo\*q \*q" boolean \*q +Enable or disable use of the video scaler. Default: off. +.TP +.BI "Option \*qVESA\*q \*q" boolean \*q +Force use of VESA BIOS initialization on or off. +Default: If option is not set: chipset dependent. +.TP +.BI "Option \*qMaxXFBMem\*q \*q" integer \*q +Amount of video memory to use for X. This option is useful to reserve +some memory from the top of the video memory for 3D. Under Linux 3D +memory is currently handled by the sisfb kernel driver. +Default: use all video memory for X. .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS -Authors include: ... +Authors include: Alan Hourihane, Mike Chapman, Juanjo Santamarta, Mitani +Hiroshi, David Thomas, Sung-Ching Lin, Ademar Reis Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.7 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c Fri Jan 11 10:37:32 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.7 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.11 2002/01/11 15:37:32 dawes Exp $ */ /* * @@ -60,6 +60,7 @@ static void SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int x, int y, int w, int h); +#if 0 static void SiSSetupForColorPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, unsigned int planemask, @@ -78,7 +79,7 @@ static void SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int skipleft); - +#endif static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); @@ -86,13 +87,13 @@ int x, int y, int w, int h, int skipleft); static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); - +#if 0 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); - +#endif static void SiSInitializeAccelerator(ScrnInfoPtr pScrn) { @@ -107,6 +108,7 @@ XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); + int topFB; int reservedFbSize; int UsableFbSize; unsigned char *AvailBufBase; @@ -165,36 +167,32 @@ #if 0 /* 8x8 color pattern fill ---seems not useful by xaa */ infoPtr->SetupForColor8x8PatternFill = - SiSSetupForColorPatternFill; + SiSSetupForColorPatternFill; infoPtr->SubsequentColor8x8PatternFillRect = - SiSSubsequentColorPatternFill; + SiSSubsequentColorPatternFill; infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS ; -#endif + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS ; -#if 0 /* Screen To Screen Color Expand */ infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpand; + SiSSetupForScreenToScreenColorExpand; infoPtr->SubsequentScreenToScreenColorExpandFill = - SiSSubsequentScreenToScreenColorExpand; -#endif + SiSSubsequentScreenToScreenColorExpand; -#if 0 /* CPU To Screen Color Expand ---implement another instead of this one! */ infoPtr->SetupForCPUToScreenColorExpandFill = - SiSSetupForCPUToScreenColorExpand; + SiSSetupForCPUToScreenColorExpand; infoPtr->SubsequentCPUToScreenColorExpandFill = - SiSSubsequentCPUToScreenColorExpand; + 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 ; + BIT_ORDER_IN_BYTE_MSBFIRST | + NO_TRANSPARENCY | + SYNC_AFTER_COLOR_EXPAND | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS ; #endif /* per-scanline color expansion*/ @@ -207,11 +205,11 @@ 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; + 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; @@ -219,41 +217,58 @@ 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; + SCANLINE_PAD_DWORD | + LEFT_EDGE_CLIPPING | + NO_PLANEMASK| + NO_TRANSPARENCY | + NO_GXCOPY | + SYNC_AFTER_IMAGE_WRITE; #endif /* 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; + + /* TW: check if maxxfbmem must contain TurboQueue and HWCursor */ + topFB = pSiS->maxxfbmem; + if ((topFB) + >= (pSiS->FbMapSize) + - ((pSiS->TurboQueue) ? (1024*512) : 0) + - ((pSiS->HWCursor) ? 4096 : 0)) { + topFB = pSiS->FbMapSize; + /* TurboQueue len is always 512k */ + if (pSiS->TurboQueue) topFB -= 1024*512; + /* HWCursor len is always 4096 */ + if (pSiS->HWCursor) topFB -= 4096; + } + reservedFbSize = (pSiS->ColorExpandBufferNumber + * pSiS->PerColorExpandBufferSize); + /* TW: New for MaxXFBmem Option */ + UsableFbSize = topFB - reservedFbSize; + /* Layout: + * |--------------++++++++++++++++++++^******==========~~~~~~~~~~~~| + * UsableFbSize ColorExpandBuffers | Heap HWCursor TurboQueue + * topFB + */ 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; + 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 = 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); + "Frame Buffer From (%d,%d) To (%d,%d)\n", + Avail.x1, Avail.y1, Avail.x2, Avail.y2); xf86InitFBManager(pScreen, &Avail); - + return(XAAInit(pScreen, infoPtr)); } @@ -496,7 +511,7 @@ PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n", x, y, len, dir)); - + len--; /* starting point is included! */ dstbase = 0; if ((y >= 2048) || ((y + len) >= 2048)) { dstbase = pSiS->scrnOffset * y; @@ -606,6 +621,7 @@ SiSDoCMD } +#if 0 static void SiSSetupForColorPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, @@ -696,7 +712,6 @@ pSiS->DoColorExpand = TRUE; } -#if 0 static void SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, @@ -759,8 +774,8 @@ }; } -int srcpitch; -int xcurrent, ycurrent; +static int srcpitch; +static int xcurrent, ycurrent; static void SiSSubsequentScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) @@ -812,6 +827,7 @@ } } +#if 0 static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth) { @@ -823,7 +839,7 @@ { return; } - +#endif #ifdef DEBUG static void Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.3 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h Fri Jan 11 10:37:33 2002 @@ -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.3 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.5 2002/01/11 15:37:33 dawes Exp $ */ /* Definitions for the SIS engine communication. */ @@ -75,19 +75,24 @@ /* 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 */ -int CmdQueLen; +/* TW: BR(16)+2 = 0x8242 */ +static int CmdQueLen; + #define SiSIdle \ + { \ + while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ 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); \ + } +/* TW: (do three times, because 2D engine seems quite unsure about whether or not it's idle) */ #define SiSSetupSRCBase(base) \ if (CmdQueLen <= 0) SiSIdle;\ Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:1.2 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c Thu Jan 10 14:05:43 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c,v 1.2 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c,v 1.3 2002/01/10 19:05:43 eich Exp $ */ /* * Acceleration for SiS530 SiS620. @@ -63,7 +63,8 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); BoxRec AvailFBArea; - int offset=0; + int offset = 0; + int topFB; int OffscreenAvailable, BLTPatternOffscreenSize; pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); @@ -124,15 +125,22 @@ infoPtr->SubsequentScreenToScreenColorExpandFill = SiS2SubsequentScreenToScreenColorExpandFill; #endif - - if (pSiS->TurboQueue) offset = 32768; - if (pSiS->HWCursor) offset = 16384; - if (pSiS->HWCursor && pSiS->TurboQueue) offset = 65536; + { + /* + * |......~~~~~~~~~~~~~~~~=================| + * 0/32k TurboQueue 0/32k HWCursor + */ + if (pSiS->HWCursor && pSiS->TurboQueue) + offset = 65536; + else if (pSiS->TurboQueue || pSiS->HWCursor) + offset = 32768; + } + topFB = (pSiS->maxxfbmem >= pSiS->FbMapSize - offset) ? + pSiS->maxxfbmem : pSiS->FbMapSize - offset; /* CPU To screen color expansion indirect method */ - OffscreenAvailable = pSiS->FbMapSize - pScrn->displayWidth * pScrn->virtualY - * (pScrn->bitsPerPixel / 8) ; - OffscreenAvailable -= offset; + OffscreenAvailable = topFB - pScrn->displayWidth * pScrn->virtualY + * (pScrn->bitsPerPixel / 8) ; BLTPatternOffscreenSize = 2 * (((pScrn->virtualX + 31)/32) * 4); if (OffscreenAvailable < BLTPatternOffscreenSize) { xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 0, @@ -148,16 +156,14 @@ NO_PLANEMASK; pSiS->XAAScanlineColorExpandBuffers[0] = - pSiS->FbBase + pSiS->FbMapSize - offset - - (((pScrn->virtualX + 31)/32) * 4); + pSiS->FbBase + topFB - (((pScrn->virtualX + 31)/32) * 4); pSiS->XAAScanlineColorExpandBuffers[1] = - pSiS->FbBase + pSiS->FbMapSize - offset - - (((pScrn->virtualX + 31)/32) * 4)*2; + pSiS->FbBase + topFB - (((pScrn->virtualX + 31)/32) * 4)*2; infoPtr->NumScanlineColorExpandBuffers = 2; infoPtr->ScanlineColorExpandBuffers = pSiS->XAAScanlineColorExpandBuffers; - offset += BLTPatternOffscreenSize; + topFB -= BLTPatternOffscreenSize; infoPtr->SetupForScanlineCPUToScreenColorExpandFill = SiS2SetupForScreenToScreenColorExpandFill; @@ -170,8 +176,7 @@ AvailFBArea.x1 = 0; AvailFBArea.y1 = 0; AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (pSiS->FbMapSize - offset) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); + AvailFBArea.y2 = topFB / (pScrn->displayWidth * pScrn->bitsPerPixel / 8); xf86InitFBManager(pScreen, &AvailFBArea); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.20 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c Thu Jan 10 14:05:43 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.20 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.23 2002/01/10 19:05:43 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -29,12 +29,14 @@ static void SiSSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h); +#if 0 static void SiSSetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn, 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 ); +#endif static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, int left, int top, int right, int bottom); static void SiSDisableClipping (ScrnInfoPtr pScrn); @@ -53,7 +55,7 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); BoxRec AvailFBArea; - int offset; + int offset, topFB; pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); if (!infoPtr) @@ -130,11 +132,14 @@ offset = 262144; else offset = 0; - AvailFBArea.y2 = (pSiS->FbMapSize - offset) / (pScrn->displayWidth * + + topFB = (pSiS->maxxfbmem >= (pSiS->FbMapSize - offset)) ? + pSiS->maxxfbmem : pSiS->FbMapSize - offset; + AvailFBArea.y2 = (topFB) / (pScrn->displayWidth * pScrn->bitsPerPixel / 8); - if (AvailFBArea.y2 < 0) - AvailFBArea.y2 = 32767; + if (AvailFBArea.y2 < 0) + AvailFBArea.y2 = 32767; xf86InitFBManager(pScreen, &AvailFBArea); @@ -153,6 +158,7 @@ { SISPtr pSiS = SISPTR(pScrn); + sisBLTSync; sisSETFGCOLOR(color); sisSETBGCOLOR(color); sisSETROP(XAACopyROP[rop]); @@ -178,10 +184,10 @@ op |= sisCLIPINTRN | sisCLIPENABL; destaddr *= (pScrn->bitsPerPixel / 8); + sisBLTSync; sisSETHEIGHTWIDTH(h-1, w * (pScrn->bitsPerPixel/8)-1); sisSETDSTADDR(destaddr); sisSETCMD(op); - SiSSync(pScrn); } static void @@ -190,6 +196,7 @@ int transparency_color) { SISPtr pSiS = SISPTR(pScrn); + sisBLTSync; sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, pScrn->displayWidth * pScrn->bitsPerPixel / 8); sisSETROP(XAACopyROP[rop]); @@ -233,11 +240,11 @@ destaddr += (pScrn->bitsPerPixel/8)-1; } + sisBLTSync; sisSETSRCADDR(srcaddr); sisSETDSTADDR(destaddr); sisSETHEIGHTWIDTH(h-1, w * (pScrn->bitsPerPixel/8)-1); sisSETCMD(op); - SiSSync(pScrn); } static void @@ -246,20 +253,21 @@ { SISPtr pSiS = SISPTR(pScrn); unsigned int *patternRegPtr; - int i ; + int i; int dstpitch; - int mix = XAAHelpPatternROP(pScrn, &fg, &bg, planemask, &rop); - int isTransparent = (bg == -1); + + (void)XAAHelpPatternROP(pScrn, &fg, &bg, planemask, &rop); dstpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ; + sisBLTSync; sisSETBGCOLOR(bg); sisSETFGCOLOR(fg); - sisSETROPFG(rop); - if (!isTransparent) { + if (bg != -1) { sisSETROPBG(0xcc); /* copy */ } else { sisSETROPBG(0xAA); /* dst */ } + sisSETROPFG(rop); sisSETPITCH(0, dstpitch); sisSETSRCADDR(0); patternRegPtr = (unsigned int *)sisSETPATREG(); @@ -289,6 +297,7 @@ op |= sisCLIPINTRN | sisCLIPENABL; dstaddr = ( y * pScrn->displayWidth + x ) * pScrn->bitsPerPixel / 8; + sisBLTSync; patternRegPtr = sisSETPATREG(); srcPatternRegPtr = (unsigned char *)pSiS->sisPatternReg ; shift = 8 - patternx ; @@ -306,8 +315,9 @@ sisSETDSTADDR(dstaddr); sisSETHEIGHTWIDTH(h-1, w*(pScrn->bitsPerPixel/8)-1); sisSETCMD(op); - SiSSync(pScrn); } + +#if 0 /* * setup for screen-to-screen color expansion */ @@ -326,6 +336,7 @@ */ /* becareful with rop */ + sisBLTSync; if (isTransparent) { sisSETBGCOLOR(bg); sisSETFGCOLOR(fg); @@ -369,6 +380,7 @@ */ destpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ; srcpitch = ((w + 31)& ~31) /8 ; + sisBLTSync; sisSETPITCH(srcpitch, destpitch); widthTodo = w ; do { @@ -381,14 +393,15 @@ destaddr += ww*pScrn->bitsPerPixel / 8 ; widthTodo -= ww ; } while ( widthTodo > 0 ) ; - SiSSync(pScrn); } +#endif static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, int left, int top, int right, int bottom) { SISPtr pSiS = SISPTR(pScrn); + sisBLTSync; sisSETCLIPTOP(left,top); sisSETCLIPBOTTOM(right,bottom); pSiS->ClipEnabled = TRUE; @@ -406,6 +419,7 @@ { SISPtr pSiS = SISPTR(pScrn); + sisBLTSync; sisSETFGCOLOR(color); sisSETBGCOLOR(0); sisSETROP(XAACopyROP[rop]); /* dst */ @@ -444,13 +458,14 @@ K2 = minor<<1; err = (minor<<1) - major; + sisBLTSync; sisSETXStart(x1); sisSETYStart(y1); sisSETLineSteps((short)K1,(short)K2); sisSETLineErrorTerm((short)err); sisSETLineMajorCount((short)major); sisSETCMD(op); -/* SiSSync(pScrn);*/ +/* sisBLTSync;*/ } @@ -466,6 +481,7 @@ op |= sisCLIPINTRN | sisCLIPENABL; destaddr *= (pScrn->bitsPerPixel / 8); + sisBLTSync; sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, pScrn->displayWidth * pScrn->bitsPerPixel / 8); @@ -476,5 +492,4 @@ sisSETDSTADDR(destaddr); sisSETCMD(op); - SiSSync(pScrn); } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c:1.8 Thu Apr 19 10:11:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c Thu Jan 17 05:49:35 2002 @@ -1,14 +1,17 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c,v 1.8 2001/04/19 14:11:37 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c,v 1.15 2002/01/17 10:49:35 eich Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" +#include "xf86_OSproc.h" #include "sis.h" #include "sis_regs.h" #include "sis_bios.h" +PDEBUG(static int scrnidx;) -UShort DRAMType[17][5]={{0x0C,0x0A,0x02,0x40,0x39},{0x0D,0x0A,0x01,0x40,0x48}, +#if 0 +static 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}, @@ -17,8 +20,9 @@ {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}}; +#endif -UShort MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static 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, @@ -27,7 +31,7 @@ 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, +static 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, @@ -36,7 +40,7 @@ 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, +static 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, @@ -45,7 +49,7 @@ 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, +static 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, @@ -57,30 +61,33 @@ 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 }}; +static UShort ModeIndex_640x480[] = {0x2E, 0x44, 0x45, 0x62}; +static UShort ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35}; +static UShort ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36}; +static UShort ModeIndex_800x600[] = {0x30, 0x47, 0x48, 0x63}; +static UShort ModeIndex_1024x768[] = {0x38, 0x4A, 0x4B, 0x64}; +static UShort ModeIndex_1280x1024[] = {0x3A, 0x4D, 0x4E, 0x65}; +static UShort ModeIndex_1600x1200[] = {0x3C, 0x3D, 0x3E, 0x66}; +static UShort ModeIndex_1920x1440[] = {0x68, 0x69, 0x6A, 0x6B}; +static UShort RefreshRate[8][8] = { + {60, 72, 75, 85, 100, 120, 160, 200}, /* 640x480 */ + {56, 60, 72, 75, 85, 100, 120, 160}, /* 800x600 */ + {43, 60, 70, 75, 85, 100, 120, 0}, /* 1024x768 */ + {43, 60, 75, 85, 0, 0, 0, 0}, /* 1280x1024 */ + {60, 65, 70, 75, 85, 0, 0, 0}, /* 1600x1200 */ + {60, 0 , 0 , 0 , 0 , 0 , 0 , 0 }, /* 720x480 */ + {50, 0 , 0 , 0 , 0 , 0 , 0 , 0 }, /* 720x576 */ + {60, 0 , 0 , 0 , 0 , 0 , 0 , 0 }}; /* 1920x1440 */ +#define MODEID_OFF 0x449 -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}, +static UShort StResInfo[5][2]={{640,400},{640,350},{720,400},{720,350},{640,480}}; +static 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, +static 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, @@ -90,7 +97,7 @@ 0x60,0x14,0x3D,0x63,0x4F, 0x027,0xFFFC,0x6A}; -UShort HiTVSt1Timing[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65, +static 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, @@ -100,7 +107,7 @@ 0x60,0x04,0x86,0xAF,0x5D, 0xE,0xFFFC,0x2D}; -UShort HiTVSt2Timing[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x64, +static 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, @@ -110,7 +117,7 @@ 0x60,0x14,0x3D,0x63,0x4F, 0x27,0xFFFC,0x6A}; -UShort HiTVTextTiming[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65, +static 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, @@ -120,7 +127,7 @@ 0x60,0x04,0x96,0x72,0x5C, 0x11,0xFFFC,0x32}; -UShort HiTVGroup3Data[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x5F, +static 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, @@ -129,7 +136,7 @@ 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, +static 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, @@ -138,7 +145,7 @@ 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, +static 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, @@ -148,7 +155,7 @@ 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; -UShort NTSCTiming[61]={0x017,0x01D,0x003,0x009,0x005,0x006,0x00C,0x00C, +static 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, @@ -158,7 +165,7 @@ 0x060,0x014,0x050,0x000,0x040, 0x00044,0x002DB,0x0003B}; /* Ajust xxx */ -UShort PALTiming[61]={ 0x019,0x052,0x035,0x06E,0x004,0x038,0x03D,0x070, +static 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, @@ -168,7 +175,8 @@ 0x060,0x014,0x063,0x000,0x040, 0x0003E,0x002E1,0x00028}; /* Ajust xxx */ -UShort NTSCGroup3Data[63]= {0x000,0x014,0x015,0x025,0x055,0x015,0x00B,0x089, +#if 0 +static 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, @@ -177,7 +185,7 @@ 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, +static 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, @@ -185,33 +193,43 @@ 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, +static 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}; +#endif -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 UShort P3c4,P3d4,P3c0,P3ce,P3c2,P3ca,P3c6,P3c7,P3c8,P3c9,P3da; +static UShort CRT1VCLKLen; /*VCLKData table length of bytes of each entry*/ +#if 0 +static UShort flag_clearbuffer; /*0: no clear frame buffer 1:clear frame buffer*/ +static int RAMType; +#endif +static int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,VCLKData; +#if 0 +static int MCLKData, ECLKData; +#endif +static int REFIndex,ModeType; +static UShort IF_DEF_LVDS; +static UShort IF_DEF_HiVision; +static UShort IF_DEF_CH7005; +static UShort VBInfo, SetFlag,RVBHCFACT,RVBHCMAX,VGAVT,VGAHT,VT,HT,VGAVDE,VGAHDE; +static UShort VDE,HDE,RVBHRS,NewFlickerMode,RY1COE,RY2COE,RY3COE,RY4COE; +static UShort LCDResInfo,LCDTypeInfo,LCDInfo,VCLKLen; +static UShort LCDHDES,LCDVDES; +static UShort DDC_Port; +static UShort DDC_Index; +static UShort DDC_DataShift; +static UShort DDC_DeviceAddr; +#if 0 +static UShort DDC_Flag; +#endif +static UShort DDC_ReadAddr; +#if 0 +static UShort DDC_Buffer; +#endif static Bool SearchModeID(ULong ROMAddr, UShort ModeNo); static Bool CheckMemorySize(ULong ROMAddr); @@ -234,7 +252,7 @@ static void DisplayOn(void); static void DisplayOff(void); static void SetReg3(UShort port, UShort data); -static UShort GetReg1(UShort port, UShort index); +/* static UShort SiSGetReg1(UShort port, UShort index); */ static UShort GetReg2(UShort port); static UShort GetModeIDLength(ULong ROMAddr, UShort ModeNo); static UShort GetRefindexLength(ULong ROMAddr, UShort ModeNo); @@ -246,7 +264,6 @@ 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); @@ -287,6 +304,8 @@ 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 void SetRegAND (UShort Port,UShort Index,UShort DataAND); +static void SetRegOR (UShort Port,UShort Index,UShort DataOR); static UShort GetVGAHT2(void); static void SetGroup2(UShort BaseAddr,ULong ROMAddr, UShort ModeNo); static void SetGroup3(UShort BaseAddr,ULong ROMAddr); @@ -296,17 +315,19 @@ 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 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 Bool IsDualEdge301B(UShort BaseAddr); +static Bool IsVAMode301B (UShort BaseAddr); +static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4Reg); +static void PresetScratchregister(UShort P3d4Reg); +/* static Bool GetLCDDDCInfo(ScrnInfoPtr pScrn); */ +/* static void SetTVSystem(void); */ static void LongWait(void); -static void VBLongWait(void); -static Bool WaitVBRetrace(UShort BaseAddr); +/* 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); @@ -324,16 +345,8 @@ static void DDC2Delay(void); static UShort CheckACK(void); -Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) +void SiSRegInit(UShort BaseAddr) { - 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; @@ -345,13 +358,36 @@ P3c8=BaseAddr+0x18; P3c9=BaseAddr+0x19; P3da=BaseAddr+0x2A; +} + +Bool SiSBIOSSetMode(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; + + SiSRegInit(BaseAddr); /* TW: Set global SiS Regs definitions */ + + + ModeNo = SiSCalcModeIndex(pScrn, mode); + if (!ModeNo) return FALSE; + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Mode # 0x%2.2x\n",ModeNo); + + SiSSetReg1(P3c4,0x05,0x86); /* TW: Unlock regs */ - ModeNo = CalcModeIndex(pScrn, mode); + PDEBUG(scrnidx = pScrn->scrnIndex); + Rate = CalcRefreshRate(pScrn, mode); - SetReg1(P3d4, 0x33, Rate); + SiSSetReg1(P3d4, 0x33, Rate); - SetReg1(P3c4, 0x20, 0xa1); - SetReg1(P3c4, 0x1E, 0x5A); + /* TW: Enable PCI adressing (0x80) & MMIO enable (0x1) & ? (0x40) */ + SiSSetReg1(P3c4, 0x20, 0xa1); + /* TW: Enable 2D (0x42) & 3D accelerator (0x18) */ + SiSSetReg1(P3c4, 0x1E, 0x5A); if(pSiS->VBFlags & VB_LVDS) IF_DEF_LVDS = 1; @@ -362,7 +398,6 @@ else IF_DEF_CH7005 = 0; - /* ynlai begin */ IF_DEF_HiVision=0; /* ynlai end */ @@ -371,7 +406,7 @@ /* replace GetSenseStatus,SetTVSystem,SetDisplayInfo */ DisplayOff(); - SetReg1(P3c4,0x05,0x86); /* 1.Openkey */ + SiSSetReg1(P3c4,0x05,0x86); /* 1.Openkey */ temp=SearchModeID(ROMAddr,ModeNo); /* 2.Get ModeID Table */ if(temp==0) return(0); @@ -382,10 +417,13 @@ temp=CheckMemorySize(ROMAddr); /* 3.Check memory size */ if(temp==0) return(0); - cr30flag=(UChar)GetReg1(P3d4,0x30); + + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VBInfo = 0x%x\n", VBInfo)); + + cr30flag=(UChar)SiSGetReg1(P3d4,0x30); if(((cr30flag&0x01)==1)||((cr30flag&0x02)==0)){ /* if cr30 d[0]=1 or d[1]=0 set crt1 */ - SetReg1(P3d4,0x34,ModeNo); + SiSSetReg1(P3d4,0x34,ModeNo); /* set CR34->CRT1 ModeNofor CRT2 FIFO */ GetModePtr(ROMAddr,ModeNo); /* 4.GetModePtr */ SetSeqRegs(ROMAddr); /* 5.SetSeqRegs */ @@ -407,11 +445,13 @@ SetCRT1FIFO(ROMAddr); } SetCRT1ModeRegs(ROMAddr, ModeNo); - if( (pSiS->Chipset == PCI_CHIP_SIS630) || (pSiS->Chipset == PCI_CHIP_SIS540) ) - SetInterlace(ROMAddr,ModeNo); + /* if( (pSiS->Chipset == PCI_CHIP_SIS630) || (pSiS->Chipset == PCI_CHIP_SIS540) ) */ /* TW: wrong */ + if( (pSiS->Chipset != PCI_CHIP_SIS630) && (pSiS->Chipset != PCI_CHIP_SIS540) && + (pSiS->Chipset != PCI_CHIP_SIS300) ) + SetInterlace(ROMAddr,ModeNo); LoadDAC(ROMAddr); } - cr31flag=(UChar)GetReg1(P3d4,0x31); + cr31flag=(UChar)SiSGetReg1(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 */ @@ -424,6 +464,8 @@ SetPitch(pScrn, BaseAddr); /* 16.SetPitch */ WaitVertical(); DisplayOn(); /* 17.DisplayOn */ + SiSGetSetModeID(pScrn,ModeNo); + return TRUE; } @@ -457,7 +499,7 @@ memorysize=memorysize>MemorySizeShift; memorysize++; /* Get memory size */ - temp=GetReg1(P3c4,0x14); /* Get DRAM Size */ + temp=SiSGetReg1(P3c4,0x14); /* Get DRAM Size */ temp=temp&0x3F; temp++; @@ -471,7 +513,7 @@ StandTable=*((UShort *)(ROMAddr+0x202)); /* Get First 0x202 */ /* StandTable Offset */ - if(ModeNo<=13) { + if(ModeNo<=0x13) { /* TW: this was decimal 13, which is definitely wrong! */ index=*((UChar *)(ROMAddr+ModeIDOffset+0x03)); /* si+St_ModeFlag */ } else { @@ -486,7 +528,7 @@ UChar SRdata; UShort i; - SetReg1(P3c4,0x00,0x03); /* Set SR0 */ + SiSSetReg1(P3c4,0x00,0x03); /* Set SR0 */ StandTable=StandTable+0x05; SRdata=*((UChar *)(ROMAddr+StandTable)); /* Get SR01 from file */ if(IF_DEF_LVDS==1){ @@ -506,11 +548,13 @@ } } SRdata=SRdata|0x20; - SetReg1(P3c4,0x01,SRdata); /* Set SR1 */ + SiSSetReg1(P3c4,0x01,SRdata); /* Set SR1 */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SeqReg 1 -> 0x%x\n", SRdata)); 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 */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SeqReg %x -> 0x%x\n", i, SRdata)); + SiSSetReg1(P3c4,i,SRdata); /* Set SR2 3 4 */ } } @@ -521,6 +565,7 @@ StandTable++; Miscdata=*((UChar *)(ROMAddr+StandTable)); /* Get Misc from file */ SetReg3(P3c2,Miscdata); /* Set Misc(3c2) */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "MiscReg -> 0x%x\n", Miscdata)); } static void SetCRTCRegs(ULong ROMAddr) @@ -528,14 +573,15 @@ UChar CRTCdata; UShort i; - CRTCdata=(UChar)GetReg1(P3d4,0x11); + CRTCdata=(UChar)SiSGetReg1(P3d4,0x11); CRTCdata=CRTCdata&0x7f; - SetReg1(P3d4,0x11,CRTCdata); /* Unlock CRTC */ + SiSSetReg1(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) */ + SiSSetReg1(P3d4,i,CRTCdata); /* Set CRTC(3d4) */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "CRTReg %x -> 0x%x\n", i, CRTCdata)); } } @@ -564,6 +610,7 @@ GetReg2(P3da); /* reset 3da */ SetReg3(P3c0,i); /* set index */ SetReg3(P3c0,ARdata); /* set data */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "AttReg index %d -> 0x%x\n", i, ARdata)); } GetReg2(P3da); /* reset 3da */ @@ -581,12 +628,13 @@ for(i=0;i<=0x08;i++) { StandTable++; GRdata=*((UChar *)(ROMAddr+StandTable)); /* Get GR from file */ - SetReg1(P3ce,i,GRdata); /* Set GR(3ce) */ + SiSSetReg1(P3ce,i,GRdata); /* Set GR(3ce) */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "GRCReg %x -> 0x%x\n", i, GRdata)); } if(ModeType>ModeVGA){ - GRdata=(UChar)GetReg1(P3ce,0x05); + GRdata=(UChar)SiSGetReg1(P3ce,0x05); GRdata=GRdata&0xBF; - SetReg1(P3ce,0x05,GRdata); + SiSSetReg1(P3ce,0x05,GRdata); } } @@ -594,7 +642,7 @@ { UShort i; - for(i=0x0A;i<=0x0E;i++) SetReg1(P3c4,i,0x00); /* Clear SR0A-SR0E */ + for(i=0x0A;i<=0x0E;i++) SiSSetReg1(P3c4,i,0x00); /* Clear SR0A-SR0E */ } @@ -606,7 +654,7 @@ if(ModeNo<0x14) return(FALSE); /* Mode No <= 13h then return */ - index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ + index=SiSGetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ index=index&0x0F; /* Frame rate index */ if(index!=0) index--; REFIndex=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ @@ -636,6 +684,7 @@ temp=0x2F; temp=temp|sync; SetReg3(P3c2,temp); /* Set Misc(3c2) */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "Setsync 0x%x\n", temp)); } static void SetCRT1CRTC(ULong ROMAddr) @@ -647,44 +696,47 @@ index=*((UChar *)(ROMAddr+REFIndex+0x02)) & 0x3F; /* Get index */ CRT1Table=*((UShort *)(ROMAddr+0x204)); /* Get CRT1Table */ CRT1Table=CRT1Table+index*CRT1Len; + + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "CRT1CRT: CRT1Table %x index %d CRT1Len %d REFIndex %x", + CRT1Table, index, CRT1Len, REFIndex)); - data=(UChar)GetReg1(P3d4,0x11); + data=(UChar)SiSGetReg1(P3d4,0x11); data=data&0x7F; - SetReg1(P3d4,0x11,data); /* Unlock CRTC */ + SiSSetReg1(P3d4,0x11,data); /* Unlock CRTC */ CRT1Table--; for(i=0;i<=0x05;i++) { CRT1Table++; data=*((UChar *)(ROMAddr+CRT1Table)); - SetReg1(P3d4,i,data); + SiSSetReg1(P3d4,i,data); } for(i=0x06;i<=0x07;i++) { CRT1Table++; data=*((UChar *)(ROMAddr+CRT1Table)); - SetReg1(P3d4,i,data); + SiSSetReg1(P3d4,i,data); } for(i=0x10;i<=0x12;i++) { CRT1Table++; data=*((UChar *)(ROMAddr+CRT1Table)); - SetReg1(P3d4,i,data); + SiSSetReg1(P3d4,i,data); } for(i=0x15;i<=0x16;i++) { CRT1Table++; data=*((UChar *)(ROMAddr+CRT1Table)); - SetReg1(P3d4,i,data); + SiSSetReg1(P3d4,i,data); } for(i=0x0A;i<=0x0C;i++) { CRT1Table++; data=*((UChar *)(ROMAddr+CRT1Table)); - SetReg1(P3c4,i,data); + SiSSetReg1(P3c4,i,data); } CRT1Table++; - data=*((UChar *)(ROMAddr+CRT1Table)); + data=*((UChar *)(ROMAddr+CRT1Table)); data=data&0xE0; - SetReg1(P3c4,0x0E,data); + SiSSetReg1(P3c4,0x0E,data); - data=(UChar)GetReg1(P3d4,0x09); + data=(UChar)SiSGetReg1(P3d4,0x09); data=data&0xDF; i=*((UChar *)(ROMAddr+CRT1Table)); i=i&0x01; @@ -693,9 +745,9 @@ i=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); i=i&DoubleScanMode; if(i) data=data|0x80; - SetReg1(P3d4,0x09,data); + SiSSetReg1(P3d4,0x09,data); - if(ModeType>0x03) SetReg1(P3d4,0x14,0x4F); + if(ModeType>0x03) SiSSetReg1(P3d4,0x14,0x4F); } static void SetCRT1Offset(ULong ROMAddr) @@ -705,11 +757,13 @@ UShort DisplayUnit; temp=*((UChar *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(offset) ModeInfo %x\n", temp)); temp=temp>>4; /* index */ ScreenOffset=*((UShort *)(ROMAddr+0x206)); /* ScreenOffset */ temp=*((UChar *)(ROMAddr+ScreenOffset+temp)); /* data */ temp2=*((UShort *)(ROMAddr+REFIndex+0x00)); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(offset) Infoflag %x\n", temp2)); temp2=temp2&InterlaceMode; if(temp2) temp=temp<<1; temp2=ModeType-ModeEGA; @@ -727,14 +781,16 @@ temp2=temp; temp=temp>>8; /* ah */ temp=temp&0x0F; - i=GetReg1(P3c4,0x0E); + i=SiSGetReg1(P3c4,0x0E); i=i&0xF0; i=i|temp; - SetReg1(P3c4,0x0E,i); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1Offset) 0e = 0x%x\n", i)); + SiSSetReg1(P3c4,0x0E,i); temp=(UChar)temp2; temp=temp&0xFF; /* al */ - SetReg1(P3d4,0x13,temp); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1Offset) 13 = 0x%x\n", temp)); + SiSSetReg1(P3d4,0x13,temp); temp2=*((UShort *)(ROMAddr+REFIndex+0x00)); temp2=temp2&InterlaceMode; @@ -745,7 +801,8 @@ al=DisplayUnit&0x00ff; if(al==0) ah=ah+1; else ah=ah+2; - SetReg1(P3c4,0x10,ah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1Offset) 10 = 0x%x\n", ah)); + SiSSetReg1(P3c4,0x10,ah); } static void SetCRT1VCLK(ULong ROMAddr) @@ -753,19 +810,22 @@ UShort i; UChar index,data; - index=*((UChar *)(ROMAddr+REFIndex+0x03)) & 0x3F; + index=*((UChar *)(ROMAddr+REFIndex+0x03)) & 0x3F; CRT1VCLKLen=GetVCLKLen(ROMAddr); data=index*CRT1VCLKLen; VCLKData=*((UShort *)(ROMAddr+0x208)); VCLKData=VCLKData+data; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLKData %x CRT1VCLKLen %x index %x data %x SiS_BIOS_REFIndex %x\n", + VCLKData, CRT1VCLKLen, index, data, REFIndex)); - SetReg1(P3c4,0x31,0); + SiSSetReg1(P3c4,0x31,0); for(i=0x2B;i<=0x2C;i++) { data=*((UChar *)(ROMAddr+VCLKData)); - SetReg1(P3c4,i,data); + SiSSetReg1(P3c4,i,data); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1VCLK) Reg %x -> 0x%x\n", i, data)); VCLKData++; } - SetReg1(P3c4,0x2D,0x80); + SiSSetReg1(P3c4,0x2D,0x80); } @@ -786,30 +846,33 @@ data=data&InterlaceMode; if(data) data2=data2|0x20; - SetReg1(P3c4,0x06,data2); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1ModeRegs) 06 -> 0x%x\n", data2)); + SiSSetReg1(P3c4,0x06,data2); - data=GetReg1(P3c4,0x01); + data=SiSGetReg1(P3c4,0x01); data=data&0xF7; data2=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); data2=data2&HalfDCLK; if(data2) data=data|0x08; - SetReg1(P3c4,0x01,data); + SiSSetReg1(P3c4,0x01,data); - data=GetReg1(P3c4,0x0F); + data=SiSGetReg1(P3c4,0x0F); data=data&0xF7; data2=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); data2=data2&LineCompareOff; if(data2) data=data|0x08; - SetReg1(P3c4,0x0F,data); + SiSSetReg1(P3c4,0x0F,data); - data=GetReg1(P3c4,0x21); + data=SiSGetReg1(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); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1ModeRegs) 21 -> 0x%x\n", data)); + SiSSetReg1(P3c4,0x21,data); } +/* TW: values identical to sisfb */ static void SetVCLKState(ULong ROMAddr, UShort ModeNo) { UShort data,data2; @@ -822,26 +885,28 @@ VCLKData=*((UShort *)(ROMAddr+0x208)); VCLKData=VCLKData+data+(CRT1VCLKLen-2); VCLK=*((UShort *)(ROMAddr+VCLKData)); + if(ModeNo<=0x13) VCLK=0; + + data=SiSGetReg1(P3c4,0x07); + data=data&0x7B; + if(VCLK>150) data=data|0x80; /* VCLK > 150; TW: was >= */ + SiSSetReg1(P3c4,0x07,data); + + data=SiSGetReg1(P3c4,0x32); + data=data&0xD7; + if(VCLK>=150) data=data|0x08; /* VCLK > 150 */ + SiSSetReg1(P3c4,0x32,data); + + data2=0x03; + if(VCLK>=135) data2=0x02; /* TW: was > */ + if(VCLK>=160) data2=0x01; /* TW: was > */ + if(VCLK>260) data2=0x00; - 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); + data=SiSGetReg1(P3c4,0x07); + data=data&0xFC; + data=data|data2; + SiSSetReg1(P3c4,0x07,data); } static void LoadDAC(ULong ROMAddr) @@ -944,21 +1009,21 @@ { UShort data; - data=GetReg1(P3c4,0x01); + data=SiSGetReg1(P3c4,0x01); data=data&0xDF; - SetReg1(P3c4,0x01,data); + SiSSetReg1(P3c4,0x01,data); } static void DisplayOff(void) { UShort data; - data=GetReg1(P3c4,0x01); + data=SiSGetReg1(P3c4,0x01); data=data|0x20; - SetReg1(P3c4,0x01,data); + SiSSetReg1(P3c4,0x01,data); } -void SetReg1(UShort port, UShort index, UShort data) +void SiSSetReg1(UShort port, UShort index, UShort data) { outb(port ,(UChar)(index & 0xff)); port++; @@ -970,7 +1035,7 @@ outb(port, (UChar)(data & 0xff)); } -static UShort GetReg1(UShort port, UShort index) +UShort SiSGetReg1(UShort port, UShort index) { UChar data; @@ -1041,7 +1106,7 @@ ULong Temp; UShort data,Temp2; - Temp = (ULong)GetReg1(P3d4, 0x01); + Temp = (ULong)SiSGetReg1(P3d4, 0x01); Temp++; Temp=Temp*8; @@ -1053,16 +1118,16 @@ Temp2 &= InterlaceMode; if(Temp2 == 0) data=0x0000; - SetReg1(P3d4,0x19,data); + SiSSetReg1(P3d4,0x19,data); - Temp = (ULong)GetReg1(P3d4, 0x1A); + Temp = (ULong)SiSGetReg1(P3d4, 0x1A); Temp2= (UShort)(Temp & 0xFC); - SetReg1(P3d4,0x1A,(UShort)Temp); + SiSSetReg1(P3d4,0x1A,(UShort)Temp); - Temp = (ULong)GetReg1(P3c4, 0x0f); + Temp = (ULong)SiSGetReg1(P3c4, 0x0f); Temp2= (UShort)Temp & 0xBF; if(ModeNo==0x37) Temp2=Temp2|0x40; - SetReg1(P3d4,0x1A,(UShort)Temp2); + SiSSetReg1(P3d4,0x1A,(UShort)Temp2); } static void SetCRT1FIFO(ULong ROMAddr) @@ -1078,7 +1143,7 @@ VCLK=*((UShort *)(ROMAddr+VCLKData)); /* Get VCLK */ MCLKOffset=*((UShort *)(ROMAddr+0x20C)); - index=GetReg1(P3c4,0x3A); + index=SiSGetReg1(P3c4,0x1A); /* TW: was 0x3A - WRONG! */ index=index&07; MCLKOffset=MCLKOffset+index*5; MCLK=*((UChar *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ @@ -1111,14 +1176,14 @@ bl++; if(bl>0x13) { - data=GetReg1(P3c4,0x16); + data=SiSGetReg1(P3c4,0x16); data=data>>6; if(data!=0) { data--; data=data<<6; - data2=GetReg1(P3c4,0x16); + data2=SiSGetReg1(P3c4,0x16); data2=(data2&0x3f)|data; - SetReg1(P3c4,0x16,data2); + SiSSetReg1(P3c4,0x16,data2); } else bl=0x13; } @@ -1128,23 +1193,23 @@ ah=bl; ah=ah<<4; ah=ah|0x0f; - SetReg1(P3c4,0x08,ah); + SiSSetReg1(P3c4,0x08,ah); data=bl; data=data&0x10; data=data<<1; - data2=GetReg1(P3c4,0x0F); + data2=SiSGetReg1(P3c4,0x0F); data2=data2&0x9f; data2=data2|data; - SetReg1(P3c4,0x0F,data2); + SiSSetReg1(P3c4,0x0F,data2); data=bl+3; if(data>0x0f) data=0x0f; - SetReg1(P3c4,0x3b,0x00); - data2=GetReg1(P3c4,0x09); + SiSSetReg1(P3c4,0x3b,0x00); + data2=SiSGetReg1(P3c4,0x09); data2=data2&0xF0; data2=data2|data; - SetReg1(P3c4,0x09,data2); + SiSSetReg1(P3c4,0x09,data2); } static UShort CalcDelay(ULong ROMAddr,UShort key) @@ -1158,9 +1223,9 @@ 42,4,45,6,55,8, 75,12}; UChar ThTiming[]= {1,2,2,3,0,1,1,2}; - data=GetReg1(P3c4,0x16); + data=SiSGetReg1(P3c4,0x16); data=data>>6; - data2=GetReg1(P3c4,0x14); + data2=SiSGetReg1(P3c4,0x14); data2=(data2>>4)&0x0C; data=data|data2; data=data<1; @@ -1174,7 +1239,7 @@ } data2=0; - data=GetReg1(P3c4,0x18); + data=SiSGetReg1(P3c4,0x18); if(data&0x02) data2=data2|0x01; if(data&0x20) data2=data2|0x02; if(data&0x40) data2=data2|0x04; @@ -1186,7 +1251,7 @@ static void SetCRT1FIFO2(ULong ROMAddr) { UShort index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; - UShort ah,bl,B; + UShort ah,bl=0,B; ULong eax; index=*((UChar *)(ROMAddr+REFIndex+0x03)); @@ -1197,24 +1262,27 @@ VCLK=*((UShort *)(ROMAddr+VCLKData)); /* Get VCLK */ MCLKOffset=*((UShort *)(ROMAddr+0x20C)); - index=GetReg1(P3c4,0x1A); + index=SiSGetReg1(P3c4,0x1A); index=index&07; MCLKOffset=MCLKOffset+index*5; MCLK=*((UShort *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(FIFO2) VCLK %x MCLK %x ModeType %x\n", VCLK, MCLK, ModeType)); + 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; + case 0 : colorth=1; break; /* TW: was 1 - WRONG */ + case 1 : colorth=2; break; /* TW: was 1 - WRONG */ + case 2 : colorth=4; break; /* TW: was 2 - WRONG */ + case 3 : colorth=4; break; /* TW: was 2 - WRONG */ + case 4 : colorth=6; break; /* TW: was 3 - WRONG */ + case 5 : colorth=8; break; /* TW: was 4 - WRONG */ } do{ /*==============*/ B=(CalcDelay2(ROMAddr,0)*VCLK*colorth); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1FIFO2) CalcDelay returned %x\n", B)); if (B%(16*MCLK) == 0) { B=B/(16*MCLK); @@ -1227,22 +1295,24 @@ } if(bl>0x13) { - data=GetReg1(P3c4,0x15); + data=SiSGetReg1(P3c4,0x15); data=data&0xf0; if(data!=0xb0) { data=data+0x20; if(data==0xa0) data=0x30; - data2=GetReg1(P3c4,0x15); + data2=SiSGetReg1(P3c4,0x15); data2=(data2&0x0f)|data; - SetReg1(P3c4,0x15,data2); + SiSSetReg1(P3c4,0x15,data2); } else bl=0x13; } /*==============*/ } while(bl>0x13); + + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT1FIFO2) Threshold %x\n", bl)); - data2=GetReg1(P3c4,0x15); + data2=SiSGetReg1(P3c4,0x15); data2=(data2&0xf0)>>4; data2=data2<<24; @@ -1251,44 +1321,60 @@ eax=GetReg3(0xcfc); eax=eax&0x0f0ffffff; eax=eax|data2; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED,"(CRT1FIFO2) Reg 4 cfc -> 0x%x\n", eax)); SetReg4(0xcfc,eax); /* ========================*/ ah=bl; ah=ah<<4; ah=ah|0x0f; - SetReg1(P3c4,0x08,ah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED,"(CRT1FIFO2) 08 -> 0x%x\n", ah)); + SiSSetReg1(P3c4,0x08,ah); data=bl; data=data&0x10; data=data<<1; - data2=GetReg1(P3c4,0x0F); - data2=data2&0x9f; + data2=SiSGetReg1(P3c4,0x0F); + data2=data2&0x9f; /* TW: x: 0x9f (works) sisfb: 0xdf */ data2=data2|data; - SetReg1(P3c4,0x0F,data2); - + SiSSetReg1(P3c4,0x0F,data2); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED,"(CRT1FIFO2) 0f -> | 0x%x\n", data)); + + SiSSetReg1(P3c4,0x3b,0x09); /* TW: x: 00 sisfb: 09 (works) */ + data=bl+3; if(data>0x0f) data=0x0f; - SetReg1(P3c4,0x3b,0x00); - data2=GetReg1(P3c4,0x09); - data2=data2&0xF0; + data2=SiSGetReg1(P3c4,0x09); + data2=data2&0xF0; /* TW: x: 0xf0 (works) sisfb: 0x80 */ data2=data2|data; - SetReg1(P3c4,0x09,data2); + SiSSetReg1(P3c4,0x09,data2); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED,"(CRT1FIFO2) 09 -> | 0x%x\n", data)); } static UShort CalcDelay2(ULong ROMAddr,UShort key) { UShort data,index; +#if 0 /* x driver values */ 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}; +#endif + +#if 1 /* TW: sisfb values - better */ + static UChar LatencyFactor[] = + { 97, 88, 86, 79, 77, 00, + 00, 87, 85, 78, 76, 54, + 97, 88, 86, 79, 77, 00, + 00, 79, 77, 70, 68, 48, + }; +#endif index=0; - data=GetReg1(P3c4,0x14); + data=SiSGetReg1(P3c4,0x14); if(data&0x80) index=index+12; - data=GetReg1(P3c4,0x15); + data=SiSGetReg1(P3c4,0x15); data=(data&0xf0)>>4; if(data&0x01) index=index+6; @@ -1320,18 +1406,18 @@ 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); + SiSSetReg1(P3d4, 0x13, HDisplay); + temp = (SiSGetReg1(P3c4, 0x0E) & 0xF0) | (HDisplay>>8); + SiSSetReg1(P3c4, 0x0E, temp); - SetReg1(Port, 0x24, 1); - SetReg1(Port, 0x07, HDisplay); - temp = (GetReg1(Port, 0x09) & 0xF0) | (HDisplay>>8); - SetReg1(Port, 0x09, temp); - + SiSSetReg1(Port, 0x24, 1); + SiSSetReg1(Port, 0x07, HDisplay); + temp = (SiSGetReg1(Port, 0x09) & 0xF0) | (HDisplay>>8); + SiSSetReg1(Port, 0x09, temp); } -static UShort CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) + +UShort SiSCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) { UShort i = (pScrn->bitsPerPixel+7)/8 - 1; UShort ModeIndex = 0; @@ -1358,11 +1444,15 @@ case 1600: ModeIndex = ModeIndex_1600x1200[i]; break; + case 1920: + ModeIndex = ModeIndex_1920x1440[i]; + break; } return(ModeIndex); } +/* TW: Calc CRT1 Refresh Rate (to be written to CR33) */ static UShort CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode) { SISPtr pSiS = SISPTR(pScrn); @@ -1390,6 +1480,9 @@ case 1600: Index = 4; break; + case 1920: + Index = 7; + break; case 720: if(mode->VDisplay == 480) Index = 5; @@ -1401,7 +1494,7 @@ while(RefreshRate[Index][i] != 0) { if(temp == RefreshRate[Index][i]) - { + { Rate=i+1; break; } @@ -1410,6 +1503,8 @@ } if(pSiS->VBFlags & CRT2_VGA) Rate |= Rate << 4; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, + "(CalcRate) temp=%d, Index=%d, Rate=%d\n", temp, Index, Rate)); return(Rate); } @@ -1439,38 +1534,38 @@ if(((temp&0x02)==0) && ((VBInfo&CRT2DisplayFlag)==0)) return(FALSE); SaveCRT2Info(ModeNo); - DisableBridge(BaseAddr); - UnLockCRT2(BaseAddr); - SetDefCRT2ExtRegs(BaseAddr); + SiSDisableBridge(BaseAddr); + SiSUnLockCRT2(BaseAddr); + SetDefCRT2ExtRegs(BaseAddr); SetCRT2ModeRegs(BaseAddr,ModeNo); if(IF_DEF_LVDS==0) { if(VBInfo&CRT2DisplayFlag){ - LockCRT2(BaseAddr); + SiSLockCRT2(BaseAddr); return 0; } } GetCRT2Data(ROMAddr,ModeNo); if(IF_DEF_LVDS==1) { - GetLVDSDesData(ROMAddr,ModeNo); + GetLVDSDesData(ROMAddr,ModeNo); } SetGroup1(BaseAddr,ROMAddr,ModeNo,pScrn); if(IF_DEF_LVDS==0) { - SetGroup2(BaseAddr,ROMAddr,ModeNo); + SetGroup2(BaseAddr,ROMAddr,ModeNo); SetGroup3(BaseAddr,ROMAddr); SetGroup4(BaseAddr,ROMAddr,ModeNo); SetGroup5(BaseAddr,ROMAddr); } else { - if(IF_DEF_CH7005==1) SetCHTVReg(ROMAddr,ModeNo); + if(IF_DEF_CH7005==1) SetCHTVReg(ROMAddr,ModeNo); ModCRT1CRTC(ROMAddr,ModeNo); SetCRT2ECLK(ROMAddr,ModeNo); } EnableCRT2(); - EnableBridge(BaseAddr); + SiSEnableBridge(BaseAddr); if(IF_DEF_LVDS==0) { /* SetLockRegs(); */ } - LockCRT2(BaseAddr); + SiSLockCRT2(BaseAddr); return 1; } @@ -1482,15 +1577,17 @@ 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); + SiSSetReg1(Part1Port,0x02,0x40); + SiSSetReg1(Part4Port,0x10,0x80); + temp=(UChar)SiSGetReg1(P3c4,0x16); temp=temp&0xC3; - SetReg1(P3d4,0x35,temp); + SiSSetReg1(P3d4,0x35,temp); } else { - SetReg1(P3d4,0x32,0x02); - SetReg1(Part1Port,0x02,0x00); + /* TW: Set VB to SVIDEO and clear eg. CRT1 and LCD ?! */ + /* Why touch this? CR32 should be read only */ + /* SiSSetReg1(P3d4,0x32,0x02); */ + SiSSetReg1(Part1Port,0x02,0x00); } } @@ -1510,7 +1607,7 @@ } if(ModeNo<0x14) return(0); /* Mode No <= 13h then return */ - index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ + index=SiSGetReg1(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--; @@ -1560,9 +1657,10 @@ } } while(index>=0); REFIndex=REFIndex-ulRefIndexLength; /* rate size */ - + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "RefIndex after GetRatePtrCRT2: %x\n", REFIndex)); if((SetFlag&ProgrammingCRT2)){ temp1=AjustCRT2Rate(ROMAddr); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "RefIndex after AdjustCRT2Rate: %x\n", REFIndex)); }else{ temp1=0; } @@ -1658,61 +1756,118 @@ UShort temp1,temp2,temp3; temp1=(VBInfo&SetInSlaveMode)>>8; temp2=~(SetInSlaveMode>>8); - temp3=(UChar)GetReg1(P3d4,0x31); + temp3=(UChar)SiSGetReg1(P3d4,0x31); temp3=((temp3&temp2)|temp1); - SetReg1(P3d4,0x31,(UShort)temp3); - temp3=(UChar)GetReg1(P3d4,0x35); + SiSSetReg1(P3d4,0x31,(UShort)temp3); + temp3=(UChar)SiSGetReg1(P3d4,0x35); temp3=temp3&0xF3; - SetReg1(P3d4,0x35,(UShort)temp3); + SiSSetReg1(P3d4,0x35,(UShort)temp3); } static void DisableLockRegs(void) { UChar temp3; - temp3=(UChar)GetReg1(P3c4,0x32); + temp3=(UChar)SiSGetReg1(P3c4,0x32); temp3=temp3&0xDF; - SetReg1(P3c4,0x32,(UShort)temp3); + SiSSetReg1(P3c4,0x32,(UShort)temp3); } static void DisableCRT2(void) { UChar temp3; - temp3=(UChar)GetReg1(P3c4,0x1E); + temp3=(UChar)SiSGetReg1(P3c4,0x1E); temp3=temp3&0xDF; - SetReg1(P3c4,0x1E,(UShort)temp3); + SiSSetReg1(P3c4,0x1E,(UShort)temp3); } -void DisableBridge(UShort BaseAddr) +void SiSDisableBridge(UShort BaseAddr) { + if(IF_DEF_LVDS==0) { + SiSDisableBridge301(BaseAddr); + } else { + SiSDisableBridgeLVDS(BaseAddr); + } +} + +void SiSDisableBridge301(UShort BaseAddr) /* TW: needed for external X driver using VESA */ +{ UChar temp3,part2_02,part2_05; - UShort Part2Port,Part1Port=0; + 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); + part2_02=(UChar)SiSGetReg1(Part2Port,0x02); + part2_05=(UChar)SiSGetReg1(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); + SiSSetReg1(Part2Port,0x02,0x38); + SiSSetReg1(Part2Port,0x05,0xFF); + temp3=(UChar)SiSGetReg1(Part2Port,0x00); temp3=temp3&0xDF; - SetReg1(Part2Port,0x00,(UShort)temp3); - SetReg1(Part2Port,0x02,part2_02); - SetReg1(Part2Port,0x05,part2_05); + SiSSetReg1(Part2Port,0x00,(UShort)temp3); + SiSSetReg1(Part2Port,0x02,part2_02); + SiSSetReg1(Part2Port,0x05,part2_05); DisableCRT2(); - } - else { +} + +void SiSDisableBridge301B(UShort BaseAddr) /* TW: needed for external X driver using VESA */ +{ + UChar temp3; + UShort Part4Port,Part2Port=0; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + + SetRegANDOR (P3c4,0x11,0xF7,0x08); + + SetRegAND(P3c4, 0x32, 0xDF); + if ((!(IsDualEdge301B(BaseAddr))) && (!(IsVAMode301B(BaseAddr)))) + temp3 = 0x7F; + else if ((!(IsDualEdge301B(BaseAddr))) && (IsVAMode301B(BaseAddr))) + temp3 = 0xBF; + else temp3 = 0x3F; + SetRegAND (Part4Port,0x1F,temp3); +} + +void SiSDisableBridgeLVDS(UShort BaseAddr) /* TW: needed for external X driver using VESA */ +{ + UShort Part2Port,Part1Port=0; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + DisableLockRegs(); DisableCRT2(); - UnLockCRT2(BaseAddr); + SiSUnLockCRT2(BaseAddr); SetRegANDOR(Part1Port,0x02,0xFF,0x40); /*et Part1Port ,index 2, D6=1, */ - } } +static Bool IsDualEdge301B(UShort BaseAddr) +{ +#if 0 /* TW: This is only for SiS315 */ + UShort flag; + flag = SiSGetReg1(P3d4,0x38); + if (flag & EnableDualEdge) + return (0); + else +#endif + return (1); +} + +static Bool IsVAMode301B (UShort BaseAddr) +{ +#if 0 /* TW: This is only for SiS315 */ + UShort flag; + + flag = SiSGetReg1(P3d4,0x38); + if ((flag & EnableDualEdge) && (flag & SetToLCDA)) + return (0); + else +#endif + return (1); +} + + static void GetCRT2Data(ULong ROMAddr,UShort ModeNo) { if(IF_DEF_LVDS==0){ /*301 */ @@ -1732,15 +1887,18 @@ GetResInfo(ROMAddr,ModeNo); GetCRT2Ptr(ROMAddr,ModeNo); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "BIOSIndex: 0x%x, ModeNo 0x%x\n", REFIndex, ModeNo)); + tempax=*((UShort *)(ROMAddr+REFIndex)); tempax=tempax&0x0FFF; VGAHT=tempax; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS VGAHT: 0x%x\n", tempax)); tempax=*((UShort *)(ROMAddr+REFIndex+1)); tempax=tempax>>4; tempax=tempax&0x07FF; VGAVT=tempax; -/* VGAVT=518; */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS VGAVT: 0x%x\n", tempax)); tempax=*((UShort *)(ROMAddr+REFIndex+3)); tempax=tempax&0x0FFF; @@ -1749,7 +1907,9 @@ tempbx=tempbx&0x07FF; HT=tempax; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS LCDHT: 0x%x\n", tempax)); VT=tempbx; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS LCDVT: 0x%x\n", tempbx)); if(IF_DEF_TRUMPION==0){ if(VBInfo&SetCRT2ToLCD){ @@ -1763,7 +1923,7 @@ }else{ tempax=1280; tempbx=1024; - } + } HDE=tempax; VDE=tempbx; } @@ -1944,8 +2104,10 @@ REFIndex=GetLVDSDesPtr(ROMAddr,ModeNo); tempax=*((UShort *)(ROMAddr+REFIndex)); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDSDes ROMData 1: %x\n", tempax)); tempax=tempax&0x0FFF; LCDHDES=tempax; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDSDes LCDHDES: %x\n", tempax)); if(LCDInfo&LCDNonExpanding){ /*hw walk-a-round */ if(LCDResInfo>=Panel1024x768){ @@ -1956,9 +2118,11 @@ } tempax=*((UShort *)(ROMAddr+REFIndex+1)); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDSDes ROMData 2: %x\n", tempax)); tempax=tempax>>4; tempax=tempax&0x07FF; LCDVDES=tempax; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDSDes LCDVDES: %x\n", tempax)); REFIndex=old_REFIndex; /*pop di */ return; @@ -2081,14 +2245,14 @@ } } -void UnLockCRT2(UShort BaseAddr) +void SiSUnLockCRT2(UShort BaseAddr) { UChar temp3; UShort Part1Port; Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - temp3=(UChar)GetReg1(Part1Port,0x24); + temp3=(UChar)SiSGetReg1(Part1Port,0x24); temp3=temp3|0x01; - SetReg1(Part1Port,0x24,(UShort)temp3); + SiSSetReg1(Part1Port,0x24,(UShort)temp3); } static void SetCRT2ModeRegs(UShort BaseAddr,UShort ModeNo) @@ -2100,7 +2264,7 @@ 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); + SiSSetReg1(Part1Port,j,0); } tempcl=ModeType; @@ -2119,10 +2283,10 @@ if(VBInfo&CRT2DisplayFlag){ tempah=0; } - SetReg1(Part1Port,0,tempah); + SiSSetReg1(Part1Port,0,tempah); - if(IF_DEF_LVDS==0) { + if(IF_DEF_LVDS==0) { /* (TW) 301 */ tempah=0x01; if(!(VBInfo&SetInSlaveMode)){ tempah=(tempah|0x02); @@ -2137,7 +2301,7 @@ if(VBInfo&CRT2DisplayFlag){ tempah=0; } - SetReg1(Part1Port,0x01,tempah); + SiSSetReg1(Part1Port,0x01,tempah); tempah=tempah>>5; if((ModeType==ModeVGA)&&(!(VBInfo&SetInSlaveMode))){ @@ -2152,10 +2316,10 @@ } } - temp3=(UChar)GetReg1(Part4Port,0x0D); + temp3=(UChar)SiSGetReg1(Part4Port,0x0D); temp3=temp3&(~0x0BF); temp3=temp3|tempah; - SetReg1(Part4Port,0x0D,(UShort)temp3); + SiSSetReg1(Part4Port,0x0D,(UShort)temp3); /* ynlai begin */ tempah=0; @@ -2175,10 +2339,10 @@ } if(LCDResInfo==Panel1280x1024) tempah=tempah|0x80; if(LCDResInfo==Panel1280x960) tempah=tempah|0x80; - SetReg1(Part4Port,0x0C,(UShort)temp3); + SiSSetReg1(Part4Port,0x0C,(UShort)temp3); /* ynlai end */ } - else { + else { /* (TW) - LVDS */ tempah=0; if(!(VBInfo&SetInSlaveMode)){ tempah=tempah|0x02; @@ -2187,7 +2351,22 @@ if(VBInfo&CRT2DisplayFlag){ tempah=0; } - SetReg1(Part1Port,0x01,tempah); + + /* + * @@@ bits 5,6,7 cause my display to go goofy. This cannot be + * correct. Therefore we leave it as it is. I need to get in touch + * with somebody at SiS who can explain to me how to set up + * this register. + */ +#if 0 + SiSSetReg1(Part1Port,0x01,tempah); +#endif + +/* TW start */ +/* In kernel sisfb, the following is done instead of the line "#if 0"-ed above: + (has no visual effect, therefore I assume it's good for something) */ + SetRegANDOR(Part1Port, 0x2e, 0xF0, tempah); +/* TW end */ } } @@ -2218,54 +2397,85 @@ SetCRT2Sync(BaseAddr,ROMAddr,ModeNo); temp1=(VGAHT-1)&0x0FF; /*BTVGA2HT 0x08,0x09 */ - SetReg1(Part1Port,0x08,temp1); + SiSSetReg1(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); + SiSSetReg1(Part1Port,0x0A,temp1); /*temp1=((VGAHDE+12)&0xFF00)>>8; Wrong */ - /*SetReg1(Part1Port,0x0C,temp1); */ - + /*SiSSetReg1(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; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0b -> 0x%x\n", temp1)); + SiSSetReg1(Part1Port,0x0B,(UShort)(temp1&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 */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0c -> 0x%x\n", tempah)); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0d -> 0x%x\n", tempcl)); + SiSSetReg1(Part1Port,0x0C,tempah); + SiSSetReg1(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 */ + } + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0e -> 0x%x\n", tempah)); + SiSSetReg1(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 */ + } + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 0f -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x0F,tempah); /*BTVGA2VDEE 0x0F,0x12 */ tempah=((tempbx&0xFF00)<<3)>>8; tempah=tempah|((tempcx&0xFF00)>>8); - SetReg1(Part1Port,0x12,tempah); - + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 12 -> 0x%x\n", tempah)); + SiSSetReg1(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); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 10 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x10,tempah); tempbh=(tempbx&0xFF00)>>8; tempah=((tempbh<<4)&0x0FF)|(tempcx&0x0F); - SetReg1(Part1Port,0x11,tempah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 11 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x11,tempah); + /* TW: new */ + if (IF_DEF_LVDS==0) { + tempah = 0x20; + if (LCDResInfo == Panel1280x1024) + tempah = 0x20; + if (LCDResInfo == Panel1280x960) + tempah = 0x24; + if (VBInfo & SetCRT2ToTV) + tempah = 0x08; + if (VBInfo & SetCRT2ToHiVisionTV) { + if (VBInfo & SetInSlaveMode) + tempah = 0x2c; + else + tempah = 0x20; + } + } else { + tempah = 0x20; + } + /* TW end */ + /* TW: old comment: */ + /* @@@ This can't be right! For now we just leave it as it is */ + /* TW: This is right - with the new code above! */ +#if 1 SetRegANDOR(Part1Port,0x13,~0x03C,tempah); +#endif /*lines below are newly added for LVDS */ tempax=LCDHDES; @@ -2289,25 +2499,32 @@ tempax=tempcx; tempax=tempax>>3; /*BPLHRS */ tempah=tempax&0x0FF; - SetReg1(Part1Port,0x14,tempah); /*Part1_14h */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 14 -> 0x%x\n", tempah)); + SiSSetReg1(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 */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 15 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x15,tempah); /*Part1_15h */ tempbx=lcdhdee; /*lcdhdee */ tempcx=LCDHDES; /*lcdhdes */ tempah=(tempcx&0xFF); tempah=tempah&0x07; /*BPLHDESKEW */ - SetReg1(Part1Port,0x1A,tempah); /*Part1_1Ah */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1a -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x1A,tempah); /*Part1_1Ah */ tempcx=tempcx>>3; /*BPLHDES */ tempah=(tempcx&0xFF); - SetReg1(Part1Port,0x16,tempah); /*Part1_16h */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 16 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x16,tempah); /*Part1_16h */ + if (tempbx&0x07) + tempbx=tempbx+8; tempbx=tempbx>>3; /*BPLHDEE */ tempah=tempbx&0xFF; - SetReg1(Part1Port,0x17,tempah); /*Part1_17h */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 17 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x17,tempah); /*Part1_17h */ tempcx=VGAVT; tempbx=VGAVDE; @@ -2335,13 +2552,15 @@ tempbx=tempbx-tempax; } tempah=tempbx&0xFF; - SetReg1(Part1Port,0x18,tempah); /*Part1_18h */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 18 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x18,tempah); /*Part1_18h */ tempcx=tempcx>>3; tempcx=tempcx+tempbx; tempcx++; /*BPLVRE */ tempah=tempcx&0xFF; tempah=tempah&0x0F; tempah=tempah|0x030; + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 19 -> 0x%x\n", tempah)); SetRegANDOR(Part1Port,0x19,~0x03F,tempah); /*Part1_19h */ tempbh=(tempbx&0xFF00)>>8; tempbh=tempbh&0x07; @@ -2352,7 +2571,9 @@ if(tempbx!=VDE){ tempah=tempah|0x40; } + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1a -> 0x%x\n", tempah)); SetRegANDOR(Part1Port,0x1A,0x07,tempah); /*Part1_1Ah */ + tempecx=VGAVT; tempebx=VDE; tempeax=VGAVDE; @@ -2367,7 +2588,9 @@ tempebx=tempebx&0x03F; } tempah=(UShort)(tempebx&0x0FF); - SetReg1(Part1Port,0x1E,tempah); /*Part1_1Eh */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1e -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x1E,tempah); /*Part1_1Eh */ + tempbx=temppush2; /* p bx temppush2 BPLVDEE */ tempcx=temppush1; /*pop cx temppush1 NPLVDES */ tempbh=(tempbx&0xFF00)>>8; @@ -2377,11 +2600,14 @@ tempch=(tempcx&0xFF00)>>8; tempch=tempch&0x07; tempah=tempah|tempch; - SetReg1(Part1Port,0x1D,tempah); /*Part1_1Dh */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1d -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x1D,tempah); /*Part1_1Dh */ tempah=tempbx&0xFF; - SetReg1(Part1Port,0x1C,tempah); /*Part1_1Ch */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1c -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x1C,tempah); /*Part1_1Ch */ tempah=tempcx&0xFF; - SetReg1(Part1Port,0x1B,tempah); /*Part1_1Bh */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1b -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x1B,tempah); /*Part1_1Bh */ tempecx=VGAHDE; tempebx=HDE; @@ -2402,7 +2628,8 @@ tempax=(UShort)(tempeax&0x00FFFF); tempcx=tempax; tempah=tempcx&0x0FF; - SetReg1(Part1Port,0x1F,tempah); /*Part1_1Fh */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 1f -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x1F,tempah); /*Part1_1Fh */ tempbx=VDE; tempbx--; /*BENPLACCEND */ if(SetFlag&EnableLVDSDDA){ @@ -2413,9 +2640,11 @@ tempch=(tempcx&0xFF00)>>8; tempch=tempch&0x07; tempah=tempah|tempch; - SetReg1(Part1Port,0x20,tempah); /*Part1_20h */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 20 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x20,tempah); /*Part1_20h */ tempah=tempbx&0xFF; - SetReg1(Part1Port,0x21,tempah); /*Part1_21h */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 21 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x21,tempah); /*Part1_21h */ tempecx=tempecx>>16; /*BPLHCFACT */ temp1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ if(temp1&HalfDCLK){ @@ -2423,9 +2652,11 @@ } tempcx=(UShort)(tempecx&0x0FFFF); tempah=(tempcx&0xFF00)>>8; - SetReg1(Part1Port,0x22,tempah); /*Part1_22h */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 22 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x22,tempah); /*Part1_22h */ tempah=tempcx&0x0FF; - SetReg1(Part1Port,0x23,tempah); /*Part1_23h */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(grp1) 23 -> 0x%x\n", tempah)); + SiSSetReg1(Part1Port,0x23,tempah); /*Part1_23h */ if(IF_DEF_TRUMPION==1){ tempal=(UShort)*((UChar *)(ROMAddr+ModeIDOffset+0x05)); /* si+St_ResInfo */ if(ModeNo>0x13){ @@ -2468,12 +2699,12 @@ GetCRT1Ptr(ROMAddr); temp1=(VGAHT-1)&0x0FF; /* BTVGA2HT 0x08,0x09 */ - SetReg1(Part1Port,0x08,temp1); + SiSSetReg1(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); + SiSSetReg1(Part1Port,0x0A,temp1); temp1=VGAHDE+12; /* bx BTVGA@HRS 0x0B,0x0C */ temp2=(VGAHT-VGAHDE)>>2; /* cx */ @@ -2491,21 +2722,21 @@ tempch=(tempch&0x04)<<(6-2); tempcl=((tempcl|tempch)-1)<<3; } - SetReg1(Part1Port,0x0B,(UShort)(temp1&0x0FF)); + SiSSetReg1(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 */ + SiSSetReg1(Part1Port,0x0C,tempah); + SiSSetReg1(Part1Port,0x0D,tempcl); /* BTVGA2HRE 0x0D */ tempcx=(VGAVT-1); tempah=tempcx&0x0FF; - SetReg1(Part1Port,0x0E,tempah); /* BTVGA2TV 0x0E,0x12 */ + SiSSetReg1(Part1Port,0x0E,tempah); /* BTVGA2TV 0x0E,0x12 */ tempbx=VGAVDE-1; tempah=tempbx&0x0FF; - SetReg1(Part1Port,0x0F,tempah); /* BTVGA2VDEE 0x0F,0x12 */ + SiSSetReg1(Part1Port,0x0F,tempah); /* BTVGA2VDEE 0x0F,0x12 */ tempah=((tempbx&0xFF00)<<3)>>8; tempah=tempah|((tempcx&0xFF00)>>8); - SetReg1(Part1Port,0x12,tempah); + SiSSetReg1(Part1Port,0x12,tempah); tempbx=(VGAVT+VGAVDE)>>1; /* BTVGA2VRS 0x10,0x11 */ tempcx=((VGAVT-VGAVDE)>>4)+tempbx+1; /* BTVGA2VRE 0x11 */ @@ -2526,10 +2757,10 @@ tempcx=(tempcx&0xFF00)|(tempcl&0x00FF); } tempah=tempbx&0x0FF; - SetReg1(Part1Port,0x10,tempah); + SiSSetReg1(Part1Port,0x10,tempah); tempbh=(tempbx&0xFF00)>>8; tempah=((tempbh<<4)&0x0FF)|(tempcx&0x0F); - SetReg1(Part1Port,0x11,tempah); + SiSSetReg1(Part1Port,0x11,tempah); if( pSiS->Chipset == PCI_CHIP_SIS300 ){ tempah=0x10; @@ -2568,7 +2799,7 @@ tempax=(tempax/tempcl)-5; tempbl=tempax; tempah=0xFF; /* set MAX HT */ - SetReg1(Part1Port,0x03,tempah); + SiSSetReg1(Part1Port,0x03,tempah); tempax=VGAHDE; /* 0x04 Horizontal Display End */ if(temp1&HalfDCLK){ @@ -2576,7 +2807,7 @@ } tempax=(tempax/tempcl)-1; tempbh=tempax; - SetReg1(Part1Port,0x04,tempax); + SiSSetReg1(Part1Port,0x04,tempax); tempah=tempbh; if(VBInfo&SetCRT2ToTV){ @@ -2588,8 +2819,8 @@ if(resinfo==7) tempah=tempah-2; } /* ynlai end */ - SetReg1(Part1Port,0x05,tempah); /* 0x05 Horizontal Display Start */ - SetReg1(Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ + SiSSetReg1(Part1Port,0x05,tempah); /* 0x05 Horizontal Display Start */ + SiSSetReg1(Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ /* 0x07 horizontal Retrace Start */ /* ynlai begin */ if(IF_DEF_HiVision==1) { @@ -2638,12 +2869,12 @@ } } } - SetReg1(Part1Port,0x07,tempah); /* 0x07 Horizontal Retrace Start */ + SiSSetReg1(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 */ + SiSSetReg1(Part1Port,0x08,0); /* 0x08 Horizontal Retrace End */ + SiSSetReg1(Part1Port,0x18,0x03); /* 0x18 SR08 */ + SiSSetReg1(Part1Port,0x19,0); /* 0x19 SR0C */ + SiSSetReg1(Part1Port,0x09,0xFF); /* 0x09 Set Max VT */ tempcx=0x121; tempcl=0x21; @@ -2654,8 +2885,8 @@ if(tempbx==405) tempbx=400; tempbx--; tempah=tempbx&0x0FF; - SetReg1(Part1Port,0x0E,tempah); - SetReg1(Part1Port,0x10,tempah); /* 0x10 vertical Blank Start */ + SiSSetReg1(Part1Port,0x0E,tempah); + SiSSetReg1(Part1Port,0x10,tempah); /* 0x10 vertical Blank Start */ tempbh=(tempbx&0xFF00)>>8; if(tempbh&0x01){ tempcl=tempcl|0x0A; @@ -2668,12 +2899,12 @@ tempcl=tempcl|0x040; tempah=tempah|0x020; } - SetReg1(Part1Port,0x0B,tempah); + SiSSetReg1(Part1Port,0x0B,tempah); if(tempbh&0x04){ tempch=tempch|0x06; } - SetReg1(Part1Port,0x11,0); /* 0x11 Vertival Blank End */ + SiSSetReg1(Part1Port,0x11,0); /* 0x11 Vertival Blank End */ tempax=VGAVT-tempbx; /* 0x0C Vertical Retrace Start */ tempax=tempax>>2; @@ -2686,7 +2917,7 @@ tempbx=tempbx+40; } tempah=(tempbx&0x0FF); - SetReg1(Part1Port,0x0C,tempah); + SiSSetReg1(Part1Port,0x0C,tempah); tempbh=(tempbx&0xFF00)>>8; if(tempbh&0x01){ tempcl=tempcl|0x04; @@ -2702,23 +2933,23 @@ tempax=(tempax>>2)+1; tempbx=tempbx+tempax; tempah=(tempbx&0x0FF)&0x0F; - SetReg1(Part1Port,0x0D,tempah); /* 0x0D vertical Retrace End */ + SiSSetReg1(Part1Port,0x0D,tempah); /* 0x0D vertical Retrace End */ tempbl=tempbx&0x0FF; if(tempbl&0x10){ tempch=tempch|0x020; } tempah=tempcl; - SetReg1(Part1Port,0x0A,tempah); /* 0x0A CR07 */ + SiSSetReg1(Part1Port,0x0A,tempah); /* 0x0A CR07 */ tempah=tempch; - SetReg1(Part1Port,0x17,tempah); /* 0x17 SR0A */ + SiSSetReg1(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 */ + SiSSetReg1(Part1Port,0x16,tempah); /* 0x16 SR01 */ + SiSSetReg1(Part1Port,0x0F,0); /* 0x0F CR14 */ + SiSSetReg1(Part1Port,0x12,0); /* 0x12 CR17 */ + SiSSetReg1(Part1Port,0x1A,0); /* 0x1A SR0E */ REFIndex=OldREFIndex; /* pop di */ } @@ -2730,9 +2961,10 @@ 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)); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT2Offset) offset %x\n", offset)); + SiSSetReg1(Part1Port,0x07,(UShort)(offset&0xFF)); + SiSSetReg1(Part1Port,0x09,(UShort)((offset&0xFF00)>>8)); + SiSSetReg1(Part1Port,0x03,(UShort)(((offset>>3)&0xFF)+1)); } static UShort GetOffset(ULong ROMAddr) @@ -2770,6 +3002,19 @@ UShort oldREFIndex,CRT1ModeNo,oldModeIDOffset; long int longtemp; +#if 1 /* TW: sisfb values - better */ + static UShort LatencyFactor[] = { 97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */ + 00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */ + 97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */ + 00, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */ + 80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */ + 00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */ + 86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */ + 00, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */ + }; +#endif + +#if 0 /* TW: x driver values */ 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 */ @@ -2778,19 +3023,22 @@ 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 */ +#endif oldREFIndex=REFIndex; /* push REFIndex(CRT2 now) */ oldModeIDOffset=ModeIDOffset; /* push ModeIDOffset */ - CRT1ModeNo=(UChar)GetReg1(P3d4,0x34); /* get CRT1 ModeNo */ + CRT1ModeNo=(UChar)SiSGetReg1(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); + PDEBUG(xf86DrvMsg(0, X_PROBED, + "(FIFO) VCLK %x MCLK %x Colorth=%d\n", temp1, temp3, temp2)); temp=((UShort)(temp1*temp2)/temp3); /* temp->bx */ - temp1=(UChar)GetReg1(P3c4,0x14); /* SR_14 */ + temp1=(UChar)SiSGetReg1(P3c4,0x14); /* SR_14 */ temp1=temp1>>6; temp1=temp1<<1; if(temp1==0) temp1=1; @@ -2798,13 +3046,18 @@ longtemp=temp1-temp; +#if 1 /* X driver code */ temp2=(UShort)((28*16)/(int)longtemp); /* temp2->cx */ if(!((temp2*(int)longtemp)==(28*16))) temp2++; +#else /* sisfb code - WRONG! */ + temp2=(UShort)((int)longtemp/(28*16)); /* temp2->cx */ + if(!((temp2*(28*16)==(int)longtemp))) temp2++; +#endif if( pSiS->Chipset == PCI_CHIP_SIS300 ){ temp1=CalcDelayVB(); }else{ /* for Trojan and Spartan */ - flag=(UChar)GetReg1(P3c4,0x14); /* SR_14 */ + flag=(UChar)SiSGetReg1(P3c4,0x14); /* SR_14 */ if(flag&0x80){ latencyindex=12; /* 128 bit */ }else{ @@ -2820,38 +3073,47 @@ latencyindex=latencyindex + (flag>>5); temp1= LatencyFactor[latencyindex]; temp1=temp1+15; - flag=(UChar)GetReg1(P3c4,0x14); /* SR_14 */ + flag=(UChar)SiSGetReg1(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) + 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 */ + } + + /* ynlai begin */ + if(IF_DEF_HiVision==1) { if(temp2<10) temp2=10; } + else { if(IF_DEF_LVDS==1) { if(temp2<8) temp2=8; } + /* TW: LVDS doesn't like values < 8 */ + else { if(temp2<6) temp2=6;} } + /* ynlai end */ + if(temp2>0x14) temp2=0x14; - temp1=(UChar)GetReg1(Part1Port,0x02); /* part1port index 02 */ + + temp1=(UChar)SiSGetReg1(Part1Port,0x01); /* part1port index 01 */ temp1=(temp1&(~0x1F))|temp2; - SetReg1(Part1Port,0x02,temp1); + /* TW: temp2 was 0x16 and made calculations void! */ + SiSSetReg1(Part1Port,0x01,temp1); + + temp1=(UChar)SiSGetReg1(Part1Port,0x02); /* part1port index 02 */ + temp1=(temp1&(~0x1F))|temp2; + SiSSetReg1(Part1Port,0x02,temp1); } static UShort GetVCLK(ULong ROMAddr,UShort ModeNo) @@ -2944,7 +3206,8 @@ UShort tsoftsetting,temp3; tsoftsetting=*((UChar *)(ROMAddr+0x52)); if(!(tsoftsetting&SoftDramType)){ - temp3=(UChar)GetReg1(P3c4,0x3A); + temp3=(UChar)SiSGetReg1(P3c4,0x1A); + /* TW: 0x1A was 0x3A = POWER_ON_TRAP_III ? WRONG! */ tsoftsetting=temp3; } tsoftsetting=tsoftsetting&0x07; @@ -2959,7 +3222,7 @@ 55,4,54,6,66,8,90,12, 42,4,45,6,55,8,75,12}; - tempah=(UChar)GetReg1(P3c4,0x18); /* SR_18 */ + tempah=(UChar)SiSGetReg1(P3c4,0x18); /* SR_18 */ tempah=tempah&0x62; tempah=tempah>>1; tempal=tempah; @@ -2969,9 +3232,9 @@ temp1=ThTiming[tempal]; /* temp1->cl */ - tempbx=(UChar)GetReg1(P3c4,0x16); /* SR_16 */ + tempbx=(UChar)SiSGetReg1(P3c4,0x16); /* SR_16 */ tempbx=tempbx>>6; - tempah=(UChar)GetReg1(P3c4,0x14); /* SR_14 */ + tempah=(UChar)SiSGetReg1(P3c4,0x14); /* SR_14 */ tempah=((tempah>>4)&0x0C); tempbx=((tempbx|tempah)<<1); @@ -3037,10 +3300,20 @@ else { /* LVDS */ if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); else tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); - if(IF_DEF_CH7005==1) { + +/* TW: The following looks like nonsense: + * First, check if system HAS as CHRONTEL, then check if CRT2 is LCD + * if CRT2 is LCD, do NOTHING and accept tempal as index. + * Otherwise (if no CHRONTEL _exists_), read index from tables. + * What's the difference between a system that has CHRONTEL but CRT2 is LCD and + * a machine without CHRONTEL but with CRT2 = LCD, too? + * (If the first 2 ifs are put together with &&, return value is wrong.) + */ + if ((IF_DEF_CH7005==1)) { if(!(VBInfo&SetCRT2ToLCD)) { + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLK (CH) tempal = %x\n", tempal)); tempal=tempal&0x1f; - tempbx=0; + tempbx=0; if(VBInfo&SetPALTV) tempbx=tempbx+2; if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; tempbx=tempbx<<1; @@ -3051,15 +3324,19 @@ } } else { + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLK (else) tempal = %x (%x %x %x)\n", + tempal, LCDResInfo, Panel800x600, Panel1024x768)); tempal=tempal>>6; if(LCDResInfo==Panel800x600) tempal=LVDSXlat1VCLK[tempal]; else if(LCDResInfo==Panel1024x768) tempal=LVDSXlat2VCLK[tempal]; else tempal=LVDSXlat3VCLK[tempal]; } } + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLK tempal = %x, REFIndex=%d\n", tempal, REFIndex)); VCLKLen=GetVCLKLen(ROMAddr); tempal=tempal*VCLKLen; tempal=tempal+(*((UShort *)(ROMAddr+0x208))); /* VCLKData */ + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "VCLKData = %x\n", tempal)); return ((UShort)tempal); } @@ -3083,7 +3360,9 @@ 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; @@ -3099,9 +3378,10 @@ temp=*((UShort *)(ROMAddr+REFIndex)); /* di+Ext_InfoFlag */ tempah=(temp>>8)&0x0C0; } - temp1=(UChar)GetReg1(Part1Port,0x19); /* part1port index 02 */ + temp1=(UChar)SiSGetReg1(Part1Port,0x19); /* part1port index 02 */ temp1=(temp1&(~0x0C0))|tempah; - SetReg1(Part1Port,0x19,temp1); + SiSSetReg1(Part1Port,0x19,temp1); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "(CRT2Sync) 19 -> | %x\n", tempah)); } static void GetCRT1Ptr(ULong ROMAddr) @@ -3117,9 +3397,27 @@ static void SetRegANDOR(UShort Port,UShort Index,UShort DataAND,UShort DataOR) { UShort temp1; - temp1=GetReg1(Port,Index); /* part1port index 02 */ + temp1=SiSGetReg1(Port,Index); /* part1port index 02 */ temp1=(temp1&(DataAND))|DataOR; - SetReg1(Port,Index,temp1); + SiSSetReg1(Port,Index,temp1); +} + +static void SetRegAND (UShort Port, UShort Index, UShort DataAND) +{ + UShort temp; + + temp=SiSGetReg1(Port,Index); /* Part1Port index 02 */ + temp=temp&DataAND; + SiSSetReg1(Port,Index,temp); +} + +static void SetRegOR (UShort Port, UShort Index, UShort DataOR) +{ + UShort temp; + + temp=SiSGetReg1(Port,Index); /* Part1Port index 02 */ + temp=temp|DataOR; + SiSSetReg1(Port,Index,temp); } static UShort GetVGAHT2(void) @@ -3182,25 +3480,25 @@ temp2=NTSCTiming; } } - SetReg1(Part2Port,0x0,tempah); + SiSSetReg1(Part2Port,0x0,tempah); for(i=0x31;i<=0x34;i++,temp1++){ - SetReg1(Part2Port,i,*(UChar *)temp1); + SiSSetReg1(Part2Port,i,*(UChar *)temp1); } for(i=0x01,j=0;i<=0x2D;i++,j++){ - SetReg1(Part2Port,i,temp2[j]); + SiSSetReg1(Part2Port,i,temp2[j]); } for(i=0x39;i<=0x45;i++,j++){ - SetReg1(Part2Port,i,temp2[j]); /* di->temp2[j] */ + SiSSetReg1(Part2Port,i,temp2[j]); /* di->temp2[j] */ } - tempah=GetReg1(Part2Port,0x0A); + tempah=SiSGetReg1(Part2Port,0x0A); tempah=tempah|NewFlickerMode; - SetReg1(Part2Port,0x0A,tempah); + SiSSetReg1(Part2Port,0x0A,tempah); - SetReg1(Part2Port,0x35,RY1COE); - SetReg1(Part2Port,0x36,RY2COE); - SetReg1(Part2Port,0x37,RY3COE); - SetReg1(Part2Port,0x38,RY4COE); + SiSSetReg1(Part2Port,0x35,RY1COE); + SiSSetReg1(Part2Port,0x36,RY2COE); + SiSSetReg1(Part2Port,0x37,RY3COE); + SiSSetReg1(Part2Port,0x38,RY4COE); /* ynlai begin */ if(IF_DEF_HiVision==1) tempax=950; @@ -3213,16 +3511,16 @@ tempax=tempax>>2; tempah=(tempax&0xFF00)>>8; tempah=tempah+temp2[0]; - SetReg1(Part2Port,0x01,tempah); + SiSSetReg1(Part2Port,0x01,tempah); tempah=tempax&0x00FF; tempah=tempah+temp2[1]; - SetReg1(Part2Port,0x02,tempah); + SiSSetReg1(Part2Port,0x02,tempah); } /* begin end */ tempcx=HT-1; tempah=tempcx&0xFF; - SetReg1(Part2Port,0x1B,tempah); + SiSSetReg1(Part2Port,0x1B,tempah); tempah=(tempcx&0xFF00)>>8; SetRegANDOR(Part2Port,0x1D,~0x0F,(UChar)tempah); @@ -3241,7 +3539,7 @@ tempbx=temp2[j]; tempbx=tempbx+tempcx; tempah=tempbx&0xFF; - SetReg1(Part2Port,0x24,tempah); + SiSSetReg1(Part2Port,0x24,tempah); tempah=(tempbx&0xFF00)>>8; tempah=(tempah<<4)&0xFF; SetRegANDOR(Part2Port,0x25,~0x0F0,tempah); @@ -3258,7 +3556,7 @@ tempcx=tempcx+temp2[++j]; tempah=tempcx&0xFF; - SetReg1(Part2Port,0x27,tempah); + SiSSetReg1(Part2Port,0x27,tempah); tempah=(((tempcx&0xFF00)>>8)<<4)&0xFF; SetRegANDOR(Part2Port,0x28,~0x0F0,tempah); @@ -3282,7 +3580,7 @@ tempcx=tempax-1; } tempah=tempcx&0xFF; - SetReg1(Part2Port,0x2E,tempah); + SiSSetReg1(Part2Port,0x2E,tempah); tempbx=VDE; if(VGAVDE==360){ @@ -3306,7 +3604,7 @@ if(VBInfo&SetInSlaveMode) if(ModeNo==0x2f) tempah=tempah+1; /* ynlai end */ - SetReg1(Part2Port,0x2F,tempah); + SiSSetReg1(Part2Port,0x2F,tempah); tempah=(tempcx&0xFF00)>>8; tempbh=(tempbx&0xFF00)>>8; @@ -3321,7 +3619,7 @@ } } /* ynlai end */ - SetReg1(Part2Port,0x30,tempah); + SiSSetReg1(Part2Port,0x30,tempah); tempbh=0; tempbx=tempbx&0xFF; @@ -3369,13 +3667,13 @@ tempah=tempax&0xFF; } - SetReg1(Part2Port,0x44,tempah); + SiSSetReg1(Part2Port,0x44,tempah); tempah=tempbh; SetRegANDOR(Part2Port,0x45,~0x03F,tempah); if(IF_DEF_HiVision==1) { if(!(VBInfo&SetInSlaveMode)) { - SetReg1(Part2Port,0x0B,0x00); + SiSSetReg1(Part2Port,0x0B,0x00); } } @@ -3390,30 +3688,30 @@ } } } - SetReg1(Part2Port,0x0B,tempah); + SiSSetReg1(Part2Port,0x0B,tempah); tempbx=HDE-1; /* RHACTE=HDE-1 */ tempah=tempbx&0xFF; - SetReg1(Part2Port,0x2C,tempah); + SiSSetReg1(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); + SiSSetReg1(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); + SiSSetReg1(Part2Port,0x19,tempah); tempah=(tempcx&0xFF00)>>8; tempah=(tempah<<5)&0xFF; if(LCDInfo&LCDRGB18Bit){ tempah=tempah|0x10; } - SetReg1(Part2Port,0x1A,tempah); + SiSSetReg1(Part2Port,0x1A,tempah); tempcx++; if(LCDResInfo==Panel1024x768){ @@ -3432,65 +3730,65 @@ tempbx=tempbx-tempax; /* lcdvdee */ tempah=tempcx&0xFF; /* RVEQ1EQ=lcdvdes */ - SetReg1(Part2Port,0x05,tempah); + SiSSetReg1(Part2Port,0x05,tempah); tempah=tempbx&0xFF; /* RVEQ2EQ=lcdvdee */ - SetReg1(Part2Port,0x06,tempah); + SiSSetReg1(Part2Port,0x06,tempah); tempah=(tempbx&0xFF00)>>8; tempah=(tempah<<3)&0xFF; tempah=tempah|((tempcx&0xFF00)>>8); - SetReg1(Part2Port,0x02,tempah); + SiSSetReg1(Part2Port,0x02,tempah); tempcx=(VT-VDE)>>4; /* (VT-VDE)>>4 */ tempbx=(VT+VDE)>>1; tempah=tempbx&0xFF; /* RTVACTEE=lcdvrs */ - SetReg1(Part2Port,0x04,tempah); + SiSSetReg1(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); + SiSSetReg1(Part2Port,0x01,tempah); - tempah=GetReg1(Part2Port,0x09); + tempah=SiSGetReg1(Part2Port,0x09); tempah=tempah&0xF0; - SetReg1(Part2Port,0x09,tempah); + SiSSetReg1(Part2Port,0x09,tempah); - tempah=GetReg1(Part2Port,0x0A); + tempah=SiSGetReg1(Part2Port,0x0A); tempah=tempah&0xF0; - SetReg1(Part2Port,0x0A,tempah); + SiSSetReg1(Part2Port,0x0A,tempah); tempcx=(HT-HDE)>>2; /* (HT-HDE)>>2 */ tempbx=(HDE+7); /* lcdhdee */ tempah=tempbx&0xFF; /* RHEQPLE=lcdhdee */ - SetReg1(Part2Port,0x23,tempah); + SiSSetReg1(Part2Port,0x23,tempah); tempah=(tempbx&0xFF00)>>8; SetRegANDOR(Part2Port,0x25,~0x0F,tempah); - SetReg1(Part2Port,0x1F,0x07); /* RHBLKE=lcdhdes */ - tempah=GetReg1(Part2Port,0x20); + SiSSetReg1(Part2Port,0x1F,0x07); /* RHBLKE=lcdhdes */ + tempah=SiSGetReg1(Part2Port,0x20); tempah=tempah&0x0F; - SetReg1(Part2Port,0x20,tempah); + SiSSetReg1(Part2Port,0x20,tempah); tempbx=tempbx+tempcx; tempah=tempbx&0xFF; /* RHBURSTS=lcdhrs */ - SetReg1(Part2Port,0x1C,tempah); + SiSSetReg1(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); + SiSSetReg1(Part2Port,0x21,tempah); - tempah=GetReg1(Part2Port,0x17); + tempah=SiSGetReg1(Part2Port,0x17); tempah=tempah&0xFB; - SetReg1(Part2Port,0x17,tempah); + SiSSetReg1(Part2Port,0x17,tempah); - tempah=GetReg1(Part2Port,0x18); + tempah=SiSGetReg1(Part2Port,0x18); tempah=tempah&0xDF; - SetReg1(Part2Port,0x18,tempah); + SiSSetReg1(Part2Port,0x18,tempah); return; } @@ -3502,14 +3800,14 @@ UShort modeflag; Part3Port=BaseAddr+IND_SIS_CRT2_PORT_12; /* ynlai begin */ - SetReg1(Part3Port,0x00,0x00); + SiSSetReg1(Part3Port,0x00,0x00); if(VBInfo&SetPALTV){ - SetReg1(Part3Port,0x13,0xFA); - SetReg1(Part3Port,0x14,0xC8); + SiSSetReg1(Part3Port,0x13,0xFA); + SiSSetReg1(Part3Port,0x14,0xC8); } else { - SetReg1(Part3Port,0x13,0xF6); - SetReg1(Part3Port,0x14,0xBF); + SiSSetReg1(Part3Port,0x13,0xF6); + SiSSetReg1(Part3Port,0x14,0xBF); } if(IF_DEF_HiVision==1) { tempdi=HiTVGroup3Data; @@ -3521,7 +3819,7 @@ } } for(i=0;i<=0x3E;i++){ - SetReg1(Part3Port,i,tempdi[i]); + SiSSetReg1(Part3Port,i,tempdi[i]); } } /* ynlai end */ @@ -3552,19 +3850,19 @@ tempax=tempax|0x08000; } tempah=(tempax&0xFF00)>>8; - SetReg1(Part4Port,0x0C,tempah); + SiSSetReg1(Part4Port,0x0C,tempah); tempah=RVBHCFACT; - SetReg1(Part4Port,0x13,tempah); + SiSSetReg1(Part4Port,0x13,tempah); tempbx=RVBHCMAX; tempah=tempbx&0xFF; - SetReg1(Part4Port,0x14,tempah); + SiSSetReg1(Part4Port,0x14,tempah); tempbh=(((tempbx&0xFF00)>>8)<<7)&0xFF; tempcx=VGAHT-1; tempah=tempcx&0xFF; - SetReg1(Part4Port,0x16,tempah); + SiSSetReg1(Part4Port,0x16,tempah); tempch=(((tempcx&0xFF00)>>8)<<3)&0xFF; tempbh=tempbh|tempch; @@ -3573,10 +3871,10 @@ tempcx=tempcx-5; } tempah=tempcx&0xFF; - SetReg1(Part4Port,0x17,tempah); + SiSSetReg1(Part4Port,0x17,tempah); tempbh=tempbh|((tempcx&0xFF00)>>8); tempah=tempbh; - SetReg1(Part4Port,0x15,tempah); + SiSSetReg1(Part4Port,0x15,tempah); tempcx=VBInfo; tempbx=VGAHDE; @@ -3620,7 +3918,7 @@ tempcx=RVBHRS; tempah=tempcx&0xFF; - SetReg1(Part4Port,0x18,tempah); + SiSSetReg1(Part4Port,0x18,tempah); tempeax=VGAVDE; tempcx=tempcx|0x04000; @@ -3639,14 +3937,14 @@ tempah=tempebx&0xFF; - SetReg1(Part4Port,0x1B,tempah); + SiSSetReg1(Part4Port,0x1B,tempah); tempah=(tempebx&0xFF00)>>8; - SetReg1(Part4Port,0x1A,tempah); + SiSSetReg1(Part4Port,0x1A,tempah); tempebx=tempebx>>16; tempah=tempebx&0xFF; tempah=(tempah<<4)&0xFF; tempah=tempah|((tempcx&0xFF00)>>8); - SetReg1(Part4Port,0x19,tempah); + SiSSetReg1(Part4Port,0x19,tempah); SetCRT2VCLK(BaseAddr,ROMAddr,ModeNo); } @@ -3659,19 +3957,19 @@ Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); - SetReg1(Part4Port,0x0A,0x01); + SiSSetReg1(Part4Port,0x0A,0x01); tempah=*((UChar *)(ROMAddr+vclk2ptr+0x01)); /* di+1 */ - SetReg1(Part4Port,0x0B,tempah); + SiSSetReg1(Part4Port,0x0B,tempah); tempah=*((UChar *)(ROMAddr+vclk2ptr+0x00)); /* di */ - SetReg1(Part4Port,0x0A,tempah); - SetReg1(Part4Port,0x12,0x00); + SiSSetReg1(Part4Port,0x0A,tempah); + SiSSetReg1(Part4Port,0x12,0x00); tempah=0x08; if(VBInfo&SetCRT2ToRAMDAC){ tempah=tempah|0x020; } - temp1=GetReg1(Part4Port,0x12); + temp1=SiSGetReg1(Part4Port,0x12); tempah=tempah|temp1; - SetReg1(Part4Port,0x12,tempah); + SiSSetReg1(Part4Port,0x12,tempah); } static void SetGroup5(UShort BaseAddr,ULong ROMAddr) @@ -3693,9 +3991,9 @@ static void EnableCRT2(void) { UShort temp1; - temp1=GetReg1(P3c4,0x1E); + temp1=SiSGetReg1(P3c4,0x1E); temp1=temp1|0x20; - SetReg1(P3c4,0x1E,temp1); /* SR 1E */ + SiSSetReg1(P3c4,0x1E,temp1); /* SR 1E */ } static void LoadDAC2(ULong ROMAddr,UShort Part5Port) @@ -3795,53 +4093,104 @@ SetReg3(Pdata,(UShort)bl); } -void LockCRT2(UShort BaseAddr) +void SiSLockCRT2(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=SiSGetReg1(Part1Port,0x24); temp1=temp1&0xFE; - SetReg1(Part1Port,0x24,temp1); + SiSSetReg1(Part1Port,0x24,temp1); } +#if 0 static void SetLockRegs(void) { UShort temp1; if((VBInfo&SetInSlaveMode)&&(!(VBInfo&SetCRT2ToRAMDAC))){ - VBLongWait(); - temp1=GetReg1(P3c4,0x32); + VBLongWait(); + temp1=SiSGetReg1(P3c4,0x32); temp1=temp1|0x20; - SetReg1(P3c4,0x32,temp1); - VBLongWait(); + SiSSetReg1(P3c4,0x32,temp1); + VBLongWait(); + } +} +#endif + +void SiSEnableBridge(UShort BaseAddr) +{ + UShort Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + + if(IF_DEF_LVDS==0) { + SiSEnableBridge301(BaseAddr); + } else { + SiSEnableBridgeLVDS(BaseAddr); + } } -void EnableBridge(UShort BaseAddr) +void SiSEnableBridge301(UShort BaseAddr) { UShort part2_02,part2_05; - UShort Part2Port; + UShort Part2Port, Part1Port; Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - 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); + part2_02=(UChar)SiSGetReg1(Part2Port,0x02); + part2_05=(UChar)SiSGetReg1(Part2Port,0x05); + SiSSetReg1(Part2Port,0x02,0x38); + SiSSetReg1(Part2Port,0x05,0xFF); LongWait(); SetRegANDOR(Part2Port,0x00,~0x0E0,0x020); /* WaitVBRetrace(BaseAddr); */ - SetReg1(Part2Port,0x02,part2_02); - SetReg1(Part2Port,0x05,part2_05); + SiSSetReg1(Part2Port,0x02,part2_02); + SiSSetReg1(Part2Port,0x05,part2_05); } - else { + +/* TW: New for 301b (used externally only yet) */ +void SiSEnableBridge301B(UShort BaseAddr) +{ + UShort temp, tempah; + UShort Part4Port,Part2Port,Part1Port; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + + SetRegANDOR(P3c4,0x11,0xFB,0x00); + + SetRegANDOR(Part2Port,0x00,0x1F,0x20); + LongWait(); + + temp=SiSGetReg1(Part1Port,0x2E); + if (!(temp&0x80)) SetRegOR(Part1Port,0x2E,0x80); + if ((!(IsDualEdge301B(BaseAddr))) && (!(IsVAMode301B(BaseAddr)))) + tempah=0x80; + else if ((!(IsDualEdge301B(BaseAddr))) && (IsVAMode301B(BaseAddr))) + tempah=0x40; + else tempah=0xC0; + SetRegOR(Part4Port,0x1F,tempah); +} + +void SiSEnableBridgeLVDS(UShort BaseAddr) +{ + UShort Part2Port, Part1Port; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + EnableCRT2(); - UnLockCRT2(BaseAddr); -/* SetRegANDOR(Part1Port,0x02,~0x040,0x0); */ - } + SiSUnLockCRT2(BaseAddr); + /* TW: new 10/2/01 */ + SetRegANDOR(Part1Port,0x02,~0x040,0x0); + if (BridgeInSlave ()) { + SetRegANDOR (Part1Port, 0x01, 0x1F, 0x00); + } else { + SetRegANDOR (Part1Port, 0x01, 0x1F, 0x40); + } + /* TW end */ } static void GetVBInfo(UShort BaseAddr,ULong ROMAddr) @@ -3853,15 +4202,15 @@ tempbl=tempbx&ModeInfoFlag; ModeType=tempbl; tempbx=0; - flag1=GetReg1(P3c4,0x38); /* call BridgeisOn */ + flag1=SiSGetReg1(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); + tempbl=SiSGetReg1(P3d4,0x30); + tempbh=SiSGetReg1(P3d4,0x31); tempah=((SetCHTVOverScan>>8)|(SetInSlaveMode>>8)|(DisableCRT2Display>>8)); tempah=tempah^0xFF; @@ -3903,7 +4252,7 @@ if(tempbl&SetCRT2ToLCD) tempbl=tempbl&(SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); } - tempah=GetReg1(P3d4,0x31); + tempah=SiSGetReg1(P3d4,0x31); if(tempah&(CRT2DisplayFlag>>8)){ if(!(tempbl&(SwitchToCRT2|SetSimuScanMode))){ tempbx=SetSimuScanMode|CRT2DisplayFlag; @@ -3949,7 +4298,7 @@ } } if(IF_DEF_CH7005==1) { - tempah=GetReg1(P3d4,0x35); + tempah=SiSGetReg1(P3d4,0x35); if(tempah&TVOverScan) VBInfo=VBInfo|SetCHTVOverScan; } } @@ -3963,9 +4312,9 @@ if(IF_DEF_LVDS==1){ return 1; } - flag1=GetReg1(P3c4,0x38); /* call BridgeisOn */ + flag1=SiSGetReg1(P3c4,0x38); /* call BridgeisOn */ if(!(flag1&0x20)){ return 0;} - flag1=GetReg1(Part1Port,0x0); + flag1=SiSGetReg1(Part1Port,0x0); if(flag1&0x0a0){ return 1; }else{ @@ -3976,7 +4325,7 @@ static Bool BridgeInSlave(void) { UShort flag1; - flag1=GetReg1(P3d4,0x31); + flag1=SiSGetReg1(P3d4,0x31); if(flag1&(SetInSlaveMode>>8)){ return 1; }else{ @@ -3984,11 +4333,11 @@ } } -static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4) +static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4Reg) { UShort tempah,tempbh,tempflag; - tempah=(UChar)GetReg1(P3d4,0x36); + tempah=(UChar)SiSGetReg1(P3d4Reg,0x36); tempbh=tempah; tempah=tempah&0x0F; /* if(tempah!=0) tempah--; */ @@ -3997,7 +4346,7 @@ tempbh=tempbh>>4; LCDTypeInfo=tempbh; - tempah=(UChar)GetReg1(P3d4,0x37); + tempah=(UChar)SiSGetReg1(P3d4Reg,0x37); LCDInfo=tempah; if(IF_DEF_LVDS==1){ @@ -4040,54 +4389,66 @@ }else{ SetFlag=SetFlag|LCDVESATiming; } + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SetFlag=0x%x, LCDTypeInfo=%d, LCDResInfo=%d, LCDInfo=0x%x\n", + SetFlag, LCDTypeInfo, LCDResInfo, LCDInfo)); + return 1; } -static void PresetScratchregister(UShort P3d4) +static void PresetScratchregister(UShort P3d4Reg) { - SetReg1(P3d4,0x37,0x00); + SiSSetReg1(P3d4Reg,0x37,0x00); } +#if 0 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 */ + SiSSetReg1(P3d4,0x36,tempah); /* cr 36 0:no LCD 1:1024x768 2:1280x1024 */ if(tempah>0) return 1; else return 0; } +#endif +#if 0 static void SetTVSystem(void) { UShort tempah; - tempah=GetReg1(P3c4,0x38); /* SR 38 */ + tempah=SiSGetReg1(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; } +#endif 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; - } + + i = SiSGetReg1(P3c4, 0x1F); + if (!(i & 0xC0)) { + + for(i=0; i<0xFFFF; i++) { + if(!(inSISREG(P3da) & 0x08)) + break; + } + for(i=0; i<0xFFFF; i++) { + if((inSISREG(P3da) & 0x08)) + break; + } + } } +#if 0 static void VBLongWait(void) { UShort regsr1f,tempah,temp; - regsr1f=GetReg1(P3c4,0x1F); + regsr1f=SiSGetReg1(P3c4,0x1F); tempah=regsr1f&(~0xC0); - SetReg1(P3c4,0x1F,tempah); + SiSSetReg1(P3c4,0x1F,tempah); for(temp=1;temp>0;){ temp=GetReg2(P3da); @@ -4098,31 +4459,33 @@ temp=temp&0x08; } - SetReg1(P3c4,0x1F,regsr1f); + SiSSetReg1(P3c4,0x1F,regsr1f); return; } +#endif +#if 0 static Bool WaitVBRetrace(UShort BaseAddr) { UShort temp; UShort Part1Port; Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - temp=GetReg1(Part1Port,0x00); + temp=SiSGetReg1(Part1Port,0x00); if(!(temp&0x80)){ return 0; } for(temp=0;temp==0;){ - temp=GetReg1(Part1Port,0x25); + temp=SiSGetReg1(Part1Port,0x25); temp=temp&0x01; } for(;temp>0;){ - temp=GetReg1(Part1Port,0x25); + temp=SiSGetReg1(Part1Port,0x25); temp=temp&0x01; } return 1; } - +#endif static void ModCRT1CRTC(ULong ROMAddr,UShort ModeNo) { @@ -4134,36 +4497,43 @@ REFIndex=OldREFIndex; return; } - tempah=(UChar)GetReg1(P3d4,0x11);/*unlock cr0-7 */ + tempah=(UChar)SiSGetReg1(P3d4,0x11);/*unlock cr0-7 */ tempah=tempah&0x7F; - SetReg1(P3d4,0x11,tempah); + SiSSetReg1(P3d4,0x11,tempah); tempah=*((UChar *)(ROMAddr+REFIndex)); - SetReg1(P3d4,0x0,tempah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data 0: %x\n", tempah)); + SiSSetReg1(P3d4,0x0,tempah); REFIndex++; for(i=0x02;i<=0x05;REFIndex++,i++){ tempah=*((UChar *)(ROMAddr+REFIndex)); - SetReg1(P3d4,i,tempah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); + SiSSetReg1(P3d4,i,tempah); } for(i=0x06;i<=0x07;REFIndex++,i++){ tempah=*((UChar *)(ROMAddr+REFIndex)); - SetReg1(P3d4,i,tempah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); + SiSSetReg1(P3d4,i,tempah); } for(i=0x10;i<=0x11;REFIndex++,i++){ tempah=*((UChar *)(ROMAddr+REFIndex)); - SetReg1(P3d4,i,tempah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); + SiSSetReg1(P3d4,i,tempah); } for(i=0x15;i<=0x16;REFIndex++,i++){ tempah=*((UChar *)(ROMAddr+REFIndex)); - SetReg1(P3d4,i,tempah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); + SiSSetReg1(P3d4,i,tempah); } for(i=0x0A;i<=0x0C;REFIndex++,i++){ tempah=*((UChar *)(ROMAddr+REFIndex)); - SetReg1(P3c4,i,tempah); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); + SiSSetReg1(P3c4,i,tempah); } tempah=*((UChar *)(ROMAddr+REFIndex)); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "LVDS Data: %x\n", tempah)); tempah=tempah&0x0E0; - SetReg1(P3c4,0x0E,tempah); + SiSSetReg1(P3c4,0x0E,tempah); tempah=*((UChar *)(ROMAddr+REFIndex)); tempah=tempah&0x01; @@ -4199,16 +4569,18 @@ } tempal=0x02B; if(!(VBInfo&SetInSlaveMode)){ - tempal=tempal+3; + tempal=tempal+3; } - SetReg1(P3c4,0x05,0x86); - tempah=*((UChar *)(ROMAddr+REFIndex)); - SetReg1(P3c4,tempal,tempah); + SiSSetReg1(P3c4,0x05,0x86); + tempah=*((UChar *)(ROMAddr+REFIndex)); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SetCRT2ECLK: Reg %x -> 0x%x\n", tempal, tempah)); + SiSSetReg1(P3c4,tempal,tempah); tempah=*((UChar *)(ROMAddr+REFIndex+1)); - tempal++; - SetReg1(P3c4,tempal,tempah); tempal++; - SetReg1(P3c4,tempal,0x80); + PDEBUG(xf86DrvMsg(scrnidx, X_PROBED, "SetCRT2ECLK: Reg %x -> 0x%x\n", tempal, tempah)); + SiSSetReg1(P3c4,tempal,tempah); + tempal++; + SiSSetReg1(P3c4,tempal,0x80); REFIndex=OldREFIndex; return; } @@ -4227,14 +4599,14 @@ 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; @@ -4244,13 +4616,13 @@ tempptr=*((UShort *)(ROMAddr+LVDSDesPtrData+tempbx)); tempptr=tempptr+tempal; return(tempptr); - + } static Bool GetLVDSCRT1Ptr(ULong ROMAddr,UShort ModeNo) { - UShort tempal,tempbx,modeflag1; - UShort LVDSCRT1DataPtr,Flag; + UShort tempal,tempbx,modeflag1; + UShort LVDSCRT1DataPtr,Flag; if(!(VBInfo&SetInSlaveMode)){ /* return 0; */ @@ -4262,7 +4634,7 @@ Flag=0; tempbx=12; if(VBInfo&SetPALTV) tempbx=tempbx+2; - if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; } } if(Flag) { @@ -4285,7 +4657,7 @@ } -static void SetCHTVReg(ULong ROMAddr,UShort ModeNo) +static void SetCHTVReg(ULong ROMAddr,UShort ModeNo) { UShort old_REFIndex,temp,tempbx,tempcl; @@ -4293,84 +4665,84 @@ GetCHTVRegPtr(ROMAddr,ModeNo); if(VBInfo&SetPALTV) { - SetCH7005(0x4304); - SetCH7005(0x6909); - } + SiSSetCH7005(0x4304); + SiSSetCH7005(0x6909); + } else { - SetCH7005(0x0304); - SetCH7005(0x7109); + SiSSetCH7005(0x0304); + SiSSetCH7005(0x7109); } temp=*((UShort *)(ROMAddr+REFIndex+0x00)); tempbx=((temp&0x00FF)<<8)|0x00; - SetCH7005(tempbx); + SiSSetCH7005(tempbx); temp=*((UShort *)(ROMAddr+REFIndex+0x01)); tempbx=((temp&0x00FF)<<8)|0x07; - SetCH7005(tempbx); + SiSSetCH7005(tempbx); temp=*((UShort *)(ROMAddr+REFIndex+0x02)); tempbx=((temp&0x00FF)<<8)|0x08; - SetCH7005(tempbx); + SiSSetCH7005(tempbx); temp=*((UShort *)(ROMAddr+REFIndex+0x03)); tempbx=((temp&0x00FF)<<8)|0x0A; - SetCH7005(tempbx); + SiSSetCH7005(tempbx); temp=*((UShort *)(ROMAddr+REFIndex+0x04)); tempbx=((temp&0x00FF)<<8)|0x0B; - SetCH7005(tempbx); + SiSSetCH7005(tempbx); - SetCH7005(0x2801); - SetCH7005(0x3103); - SetCH7005(0x003D); - SetCHTVRegANDOR(0x0010,0x1F); + SiSSetCH7005(0x2801); + SiSSetCH7005(0x3103); + SiSSetCH7005(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); + 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); + 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); + 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); + 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; + REFIndex=old_REFIndex; } static void SetCHTVRegANDOR(UShort tempax,UShort tempbh) @@ -4379,12 +4751,12 @@ tempal=tempax&0x00FF; tempah=(tempax>>8)&0x00FF; - tempbl=GetCH7005(tempal); - tempbl=(((tempbl&tempbh)|tempah)<<8|tempal); - SetCH7005(tempbl); + tempbl=SiSGetCH7005(tempal); + tempbl=(((tempbl&tempbh)|tempah)<<8|tempal); + SiSSetCH7005(tempbl); } -static void GetCHTVRegPtr(ULong ROMAddr,UShort ModeNo) +static void GetCHTVRegPtr(ULong ROMAddr,UShort ModeNo) { UShort tempbx,tempal,tempcl,CHTVRegDataPtr; @@ -4396,7 +4768,7 @@ 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; @@ -4404,10 +4776,10 @@ CHTVRegDataPtr=*((UShort *)(ROMAddr+ADR_CHTVRegDataPtr)); REFIndex=*((UShort *)(ROMAddr+CHTVRegDataPtr+tempbx)); REFIndex=REFIndex+tempal; - } + } } -void SetCH7005(UShort tempbx) +void SiSSetCH7005(UShort tempbx) { UShort tempah,temp; @@ -4416,18 +4788,18 @@ DDC_DataShift=0x00; DDC_DeviceAddr=0xEA; - SetSwitchDDC2(); + SetSwitchDDC2(); SetStart(); tempah=DDC_DeviceAddr; - temp=WriteDDC2Data(tempah); - tempah=tempbx&0x00FF; - temp=WriteDDC2Data(tempah); - tempah=(tempbx&0xFF00)>>8; - temp=WriteDDC2Data(tempah); - SetStop(); + temp=WriteDDC2Data(tempah); + tempah=tempbx&0x00FF; + temp=WriteDDC2Data(tempah); + tempah=(tempbx&0xFF00)>>8; + temp=WriteDDC2Data(tempah); + SetStop(); } -UShort GetCH7005(UShort tempbx) +UShort SiSGetCH7005(UShort tempbx) { UShort tempah; @@ -4437,7 +4809,7 @@ DDC_DeviceAddr=0xEA; DDC_ReadAddr=tempbx; - SetSwitchDDC2(); + SetSwitchDDC2(); SetStart(); tempah=DDC_DeviceAddr; WriteDDC2Data(tempah); @@ -4449,8 +4821,8 @@ tempah=tempah|0x01; if(WriteDDC2Data(tempah)) { } - tempah=ReadDDC2Data(tempah); - SetStop(); + tempah=ReadDDC2Data(tempah); + SetStop(); return(tempah); } @@ -4460,72 +4832,72 @@ SetSCLKHigh(); for(i=0;i<1000;i++) { - GetReg1(DDC_Port,0x05); + SiSGetReg1(DDC_Port,0x05); } SetSCLKLow(); for(i=0;i<1000;i++) { - GetReg1(DDC_Port,0x05); + SiSGetReg1(DDC_Port,0x05); } } static void SetStart(void) { - SetSCLKLow(); + SetSCLKLow(); SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ - SetSCLKHigh(); + SetSCLKHigh(); SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ - SetSCLKHigh(); + SetSCLKHigh(); } static void SetStop(void) { - SetSCLKLow(); + SetSCLKLow(); SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ - SetSCLKHigh(); + SetSCLKHigh(); SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ - SetSCLKHigh(); + SetSCLKHigh(); } static UShort WriteDDC2Data(UShort tempax) -{ +{ UShort i,flag; flag=0x80; - for(i=0;i<8;i++) { - SetSCLKLow(); + for(i=0;i<8;i++) { + SetSCLKLow(); if(tempax&flag) { - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); } else { - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); } - SetSCLKHigh(); + SetSCLKHigh(); flag=flag>>1; } return(CheckACK()); } static UShort ReadDDC2Data(UShort tempax) -{ +{ UShort i,temp,getdata; getdata=0; - for(i=0;i<8;i++) { + for(i=0;i<8;i++) { getdata=getdata<<1; SetSCLKLow(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); SetSCLKHigh(); - temp=GetReg1(DDC_Port,DDC_Index); + temp=SiSGetReg1(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(); + DDC2Delay(); } @@ -4535,17 +4907,17 @@ SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x01); /* SetSCLKLow() */ do { - temp=GetReg1(DDC_Port,DDC_Index); + temp=SiSGetReg1(DDC_Port,DDC_Index); } while(!(temp&0x01)); - DDC2Delay(); -} + DDC2Delay(); +} static void DDC2Delay(void) { UShort i; - for(i=0;i<DDC2DelayTime;i++) { - GetReg1(P3c4,0x05); + for(i=0;i<DDC2DelayTime;i++) { + SiSGetReg1(P3c4,0x05); } } @@ -4554,10 +4926,26 @@ UShort tempah; SetSCLKLow(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); SetSCLKHigh(); - tempah=GetReg1(DDC_Port,DDC_Index); + tempah=SiSGetReg1(DDC_Port,DDC_Index); SetSCLKLow(); if(tempah&0x01) return(1); else return(0); +} + +unsigned char SiSGetSetModeID(ScrnInfoPtr pScrn, unsigned char id) +{ + unsigned char ret; + + unsigned char* base = xf86MapVidMem(pScrn->scrnIndex, + VIDMEM_MMIO, 0, 0x2000); + ret = *(base + MODEID_OFF); + + /* id != 0xff means: set mode */ + if (id != 0xff) + *(base + MODEID_OFF) = id; + xf86UnMapVidMem(pScrn->scrnIndex,base,0x2000); + + return ret; } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h:1.4 Thu Apr 19 10:11:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h Thu Jan 17 04:57:29 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h,v 1.4 2001/04/19 14:11:37 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h,v 1.8 2002/01/17 09:57:29 eich Exp $ */ typedef unsigned long ULong; typedef unsigned short UShort; @@ -52,7 +52,7 @@ #define ECLKindex3 0x0300 #define ECLKindex4 0x0400 -#define SetSimuScanMode 0x0001 +#define SetSimuScanMode 0x0001 /* CR 30 */ #define SwitchToCRT2 0x0002 #define SetCRT2ToTV 0x009C #define SetCRT2ToAVIDEO 0x0004 @@ -61,7 +61,7 @@ #define SetCRT2ToLCD 0x0020 #define SetCRT2ToRAMDAC 0x0040 #define SetCRT2ToHiVisionTV 0x0080 -#define SetNTSCTV 0x0000 +#define SetNTSCTV 0x0000 /* CR 31 */ #define SetPALTV 0x0100 #define SetInSlaveMode 0x0200 #define SetNotSimuMode 0x0400 @@ -198,11 +198,21 @@ #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); +Bool SiSBIOSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); +void SiSRegInit(UShort BaseAddr); +UShort SiSCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); +void SiSSetReg1(UShort port, UShort index, UShort data); +UShort SiSGetReg1(UShort port, UShort index); +void SiSDisableBridge(UShort BaseAddr); +void SiSDisableBridgeLVDS(UShort BaseAddr); +void SiSDisableBridge301(UShort BaseAddr); +void SiSDisableBridge301B(UShort BaseAddr); +void SiSUnLockCRT2(UShort BaseAddr); +void SiSLockCRT2(UShort BaseAddr); +void SiSEnableBridge(UShort BaseAddr); +void SiSEnableBridgeLVDS(UShort BaseAddr); +void SiSEnableBridge301(UShort BaseAddr); +void SiSEnableBridge301B(UShort BaseAddr); +void SiSSetCH7005(UShort tempbx); +UShort SiSGetCH7005(UShort tempbx); +unsigned char SiSGetSetModeID(ScrnInfoPtr pScrn, unsigned char id); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.5 Mon May 7 17:59:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c Fri Sep 28 03:47:22 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_cursor.c,v 1.5 2001/05/07 21:59:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.6 2001/09/28 07:47:22 alanh Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -95,10 +95,18 @@ x_preset = (-x); x = 0; } + if (y < 0) { y_preset = (-y); y = 0; } + + /* are we in interlaced/doublescan mode? */ + if (pScrn->currentMode->Flags & V_INTERLACE) + y /= 2; + else if (pScrn->currentMode->Flags & V_DBLSCAN) + y *= 2; + outw(VGA_SEQ_INDEX, (x&0xFF)<<8 | 0x1A); outw(VGA_SEQ_INDEX, (x&0xFF00) | 0x1B); outw(VGA_SEQ_INDEX, (y&0xFF)<<8 | 0x1D); @@ -125,6 +133,13 @@ y_preset = (-y); y = 0; } + + /* are we in interlaced/doublescan mode? */ + if (pScrn->currentMode->Flags & V_INTERLACE) + y /= 2; + else if (pScrn->currentMode->Flags & V_DBLSCAN) + y *= 2; + sis300SetCursorPositionX(x, x_preset) sis300SetCursorPositionY(y, y_preset) if (pSiS->VBFlags & CRT2_ENABLE) { @@ -215,8 +230,6 @@ 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) @@ -259,7 +272,7 @@ PDEBUG(ErrorF("HW Cursor Init\n")); infoPtr = xf86CreateCursorInfoRec(); if(!infoPtr) - return FALSE; + return FALSE; pSiS->CursorInfoPtr = infoPtr; @@ -282,7 +295,7 @@ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64; - break; + break; default: infoPtr->SetCursorPosition = SiSSetCursorPosition; infoPtr->ShowCursor = SiSShowCursor; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.19 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c Thu Jan 17 04:57:30 2002 @@ -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.19 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.24 2002/01/17 09:57:30 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -47,9 +47,11 @@ static void SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS301BSave(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 SiS301BRestore(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, @@ -64,10 +66,10 @@ 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}; +static unsigned short ch7005idx[0x11]={0x00,0x07,0x08,0x0a,0x0b,0x04,0x09,0x20,0x21,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}; int -compute_vclk( +SiScompute_vclk( int Clock, int *out_n, int *out_dn, @@ -164,7 +166,7 @@ } *out_n = best_n; *out_dn = best_dn; - PDEBUG(ErrorF("compute_vclk: Clock=%d, n=%d, dn=%d, div=%d, sbit=%d," + PDEBUG(ErrorF("SiScompute_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; @@ -218,8 +220,8 @@ if (pSiS->Chipset == PCI_CHIP_SIS5597 || pSiS->Chipset == PCI_CHIP_SIS6326){ int low_N = 2; int high_N = 5; - int PSN = 1; + PSN = 1; P = 1; if (target < MAX_VCO_5597 / 2) P = 2; @@ -251,7 +253,7 @@ error = (target - Fout) / target; aerror = (error < 0) ? -error : error; -/* if (aerror < abest && abest > TOLERANCE) {*/ +/* if (aerror < abest && abest > TOLERANCE) */ if (aerror < abest) { abest = aerror; bestError = error; @@ -353,7 +355,7 @@ SISPtr pSiS = SISPTR(pScrn); int vgaIOBase; int i,max; - + PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n")); @@ -445,8 +447,8 @@ int vgaIOBase; int i,max; - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n")); + PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n")); vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; @@ -457,24 +459,43 @@ for (i = 0x06; i <= max; i++) { outb(VGA_SEQ_INDEX, i); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "XR%02X Contents - %02X \n", i, inb(VGA_SEQ_DATA)); sisReg->sisRegs3C4[i] = inb(VGA_SEQ_DATA); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "XR%02X Contents - %02X \n", i,sisReg->sisRegs3C4[i]); } for (i=0x19; i<0x40; i++) { inSISIDXREG(pSiS->RelIO+CROFFSET, i, sisReg->sisRegs3D4[i]); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "3D4-%02X Contents - %02X \n", i,sisReg->sisRegs3D4[i]); } /*sisReg->sisRegs3C2 = inb(0x3CC);*/ sisReg->sisRegs3C2 = inb(pSiS->RelIO+0x4c); - 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->SiSSave2)(pScrn, sisReg); +#if 1 /* TW: Saving bridge data not yet needed; will possibly be when fixing VESA scaling problem */ + if (!pSiS->UseVESA) { /* TW: No need for touching the bridge registers when using VESA */ +#endif + if ((pSiS->VBFlags & VB_LVDS)) /* && (pSiS->VBFlags & CRT2_LCD)) */ + (*pSiS->SiSSaveLVDS)(pScrn, sisReg); + if ((pSiS->VBFlags & (VB_CHRONTEL))) /* | CRT2_TV))==(VB_CHRONTEL|CRT2_TV)) */ + (*pSiS->SiSSaveChrontel)(pScrn,sisReg); +#if 1 + } +#endif + if ((pSiS->VBFlags & (VB_301|VB_303))) /* && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) */ + (*pSiS->SiSSave2)(pScrn, sisReg); +#if 1 + if (!pSiS->UseVESA) { /* TW: Don't touch the 301B/302 when using VESA (PRILIMINARY) */ +#endif + if ((pSiS->VBFlags & (VB_301B|VB_302))) /* && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) */ + (*pSiS->SiSSave3)(pScrn, sisReg); +#if 1 + } +#endif + + if ((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_LCD)) + pSiS->BIOSModeSave = SiSGetSetModeID(pScrn,0xFF); } static void @@ -485,47 +506,83 @@ int i,max, temp; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n"); + "SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)\n"); vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; - outw(VGA_SEQ_INDEX, 0x8605); - inSISIDXREG(VGA_SEQ_INDEX, 0x1E, temp); - if (temp & 0x42) { + outw(VGA_SEQ_INDEX, 0x8605); /* Unlock registers */ + + /* TW: Wait for accellerator to finish on-going drawing operations. */ + xf86DrvMsg(0, X_PROBED, "Before wait\n"); + outb(VGA_SEQ_INDEX, 0x1E); + temp = inb(VGA_SEQ_DATA); + if (temp & (0x40|0x10)) { /* TW: 0x40 = 2D, 0x10 = 3D enabled*/ while ( (MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; - } + while ( (MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; + } /* TW: do it twice as in sis300_accel.h */ + xf86DrvMsg(0, X_PROBED, "After wait\n"); max=0x3D; for (i = 0x19; i < 0x40; i++) { outSISIDXREG(pSiS->RelIO+CROFFSET, i, sisReg->sisRegs3D4[i]); } if (pSiS->Chipset != PCI_CHIP_SIS300) { - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x1A, sisReg->sisRegs3D4[0x19]); - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x19, sisReg->sisRegs3D4[0x1A]); + unsigned char val; + inSISIDXREG(pSiS->RelIO+CROFFSET,0x1A,val); + if (val == sisReg->sisRegs3D4[0x19]) + outSISIDXREG(pSiS->RelIO+CROFFSET, 0x1A, sisReg->sisRegs3D4[0x19]); + inSISIDXREG(pSiS->RelIO+CROFFSET,0x19,val); + if (val == sisReg->sisRegs3D4[0x1A]) + outSISIDXREG(pSiS->RelIO+CROFFSET, 0x19, sisReg->sisRegs3D4[0x1A]); + } + + /* On 630, set SR20 | 0x20 if accellerators are on */ /*0x40*/ + if ((pSiS->Chipset == PCI_CHIP_SIS630) && (sisReg->sisRegs3C4[0x1e] & 0x50)) { + sisReg->sisRegs3C4[0x20] |= 0x20; + outb(VGA_SEQ_INDEX, 0x20); + outb(VGA_SEQ_DATA, sisReg->sisRegs3C4[0x20]); + /* outw(VGA_SEQ_INDEX, sisReg->sisRegs3C4[0x20] << 8 | 0x20); */ + } + + /* TW: If TQ is switched on, don't switch it off ever again */ + if (!pSiS->NoAccel) { + if (pSiS->TurboQueue) { + temp = (pScrn->videoRam/64) - 8; + sisReg->sisRegs3C4[0x26] = temp & 0xFF; + sisReg->sisRegs3C4[0x27] = ((temp >> 8) & 3) | 0xF0; + } } - if ((pSiS->Chipset == PCI_CHIP_SIS630) && (sisReg->sisRegs3C4[0x1e] & 0x40)) - outw(VGA_SEQ_INDEX, sisReg->sisRegs3C4[0x20] << 8 | 0x20); - for (i = 0x06; i <= max; i++) { - outb(VGA_SEQ_INDEX,i); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,4, - "XR%X Contents - %02X ", i, inb(VGA_SEQ_DATA)); - - outb(VGA_SEQ_DATA,sisReg->sisRegs3C4[i]); - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,4, - "Restore to - %02X Read after - %02X\n", - sisReg->sisRegs3C4[i], inb(VGA_SEQ_DATA)); + outb(VGA_SEQ_INDEX,i); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "XR%X Contents - %02X ", i, inb(VGA_SEQ_DATA)); + outb(VGA_SEQ_DATA,sisReg->sisRegs3C4[i]); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "Restore to - %02X Read after - %02X\n", + sisReg->sisRegs3C4[i], inb(VGA_SEQ_DATA)); } - - 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->SiSRestore2)(pScrn, sisReg); +#if 1 /* TW: Saving bridge data not yet needed; will possibly be when fixing VESA scaling problem */ + if (!pSiS->UseVESA) { /* TW: No need for touching the bridge registers when using VESA */ +#endif + if ((pSiS->VBFlags & VB_LVDS)) /* && (pSiS->VBFlags & CRT2_LCD)) */ + (*pSiS->SiSRestoreLVDS)(pScrn, sisReg); + if ((pSiS->VBFlags & (VB_CHRONTEL))) /* | CRT2_TV))==(VB_CHRONTEL|CRT2_TV)) */ + (*pSiS->SiSRestoreChrontel)(pScrn,sisReg); +#if 1 + } +#endif + if ((pSiS->VBFlags & (VB_301|VB_303))) /* && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) */ + (*pSiS->SiSRestore2)(pScrn, sisReg); +#if 1 + if (!pSiS->UseVESA) { /* TW: Don't touch the 301B/302 when using VESA */ +#endif + if ((pSiS->VBFlags & (VB_301B|VB_302))) /* && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) */ + (*pSiS->SiSRestore3)(pScrn, sisReg); +#if 1 + } +#endif /*outb(0x3C2, sisReg->sisRegs3C2);*/ outb(pSiS->RelIO+0x42, sisReg->sisRegs3C2); @@ -533,6 +590,10 @@ /* MemClock needs this to take effect */ outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ + + if ((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_LCD)) + SiSGetSetModeID(pScrn,pSiS->BIOSModeSave); + } static void @@ -559,6 +620,29 @@ } static void +SiS301BSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + 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 */ +} + +static void SiSLVDSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); @@ -582,7 +666,7 @@ inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); } for (i=0; i<0x11; i++) - sisReg->ch7005[i]=GetCH7005(ch7005idx[i]); + sisReg->ch7005[i]=SiSGetCH7005(ch7005idx[i]); sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ } @@ -593,8 +677,8 @@ SISPtr pSiS = SISPTR(pScrn); unsigned char temp, temp1; - DisableBridge(pSiS->RelIO+0x30); - UnLockCRT2(pSiS->RelIO+0x30); + SiSDisableBridge301(pSiS->RelIO+0x30); + SiSUnLockCRT2(pSiS->RelIO+0x30); /* SetCRT2ModeRegs() */ outSISIDXREG(pSiS->RelIO+0x04, 4, 0); @@ -607,7 +691,7 @@ if (!(sisReg->sisRegs3D4[0x30] & 0x03) && (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - LockCRT2(pSiS->RelIO+0x30); + SiSLockCRT2(pSiS->RelIO+0x30); return; } SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); @@ -622,6 +706,59 @@ 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 */ + + SiSEnableBridge301(pSiS->RelIO+0x30); + SiSLockCRT2(pSiS->RelIO+0x30); +} + +/* TW: Preliminary - do the same as for 301 */ +static void +SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + SISPtr pSiS = SISPTR(pScrn); + unsigned char temp, temp1; + + SiSDisableBridge301B(pSiS->RelIO+0x30); + SiSUnLockCRT2(pSiS->RelIO+0x30); + + /* SetCRT2ModeRegs() */ + outSISIDXREG(pSiS->RelIO+0x04, 4, 0); + outSISIDXREG(pSiS->RelIO+0x04, 5, 0); + outSISIDXREG(pSiS->RelIO+0x04, 6, 0); + outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); + outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); + outSISIDXREG(pSiS->RelIO+0x14, 0x0D, sisReg->VBPart4[0x0D]); + outSISIDXREG(pSiS->RelIO+0x14, 0x0C, sisReg->VBPart4[0x0C]); + + if (!(sisReg->sisRegs3D4[0x30] & 0x03) && + (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ + SiSLockCRT2(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)) { @@ -637,8 +774,8 @@ orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ - EnableBridge(pSiS->RelIO+0x30); - LockCRT2(pSiS->RelIO+0x30); + SiSEnableBridge301B(pSiS->RelIO+0x30); + SiSLockCRT2(pSiS->RelIO+0x30); } static void @@ -646,8 +783,8 @@ { SISPtr pSiS = SISPTR(pScrn); - DisableBridge(pSiS->RelIO+0x30); - UnLockCRT2(pSiS->RelIO+0x30); + SiSDisableBridgeLVDS(pSiS->RelIO+0x30); + SiSUnLockCRT2(pSiS->RelIO+0x30); /* SetCRT2ModeRegs() */ outSISIDXREG(pSiS->RelIO+0x04, 4, 0); @@ -658,7 +795,7 @@ if (!(sisReg->sisRegs3D4[0x30] & 0x03) && (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - LockCRT2(pSiS->RelIO+0x30); + SiSLockCRT2(pSiS->RelIO+0x30); return; } SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); @@ -666,8 +803,8 @@ orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ - EnableBridge(pSiS->RelIO+0x30); - LockCRT2(pSiS->RelIO+0x30); + SiSEnableBridgeLVDS(pSiS->RelIO+0x30); + SiSLockCRT2(pSiS->RelIO+0x30); } static void @@ -677,12 +814,12 @@ int i; unsigned short wtemp; - DisableBridge(pSiS->RelIO+0x30); - UnLockCRT2(pSiS->RelIO+0x30); + SiSDisableBridgeLVDS(pSiS->RelIO+0x30); + SiSUnLockCRT2(pSiS->RelIO+0x30); for (i=0; i<0x11; i++) { wtemp = ((sisReg->ch7005[i]) << 8) + (ch7005idx[i] & 0x00FF); - SetCH7005(wtemp); + SiSSetCH7005(wtemp); } /* SetCRT2ModeRegs() */ @@ -694,7 +831,7 @@ if (!(sisReg->sisRegs3D4[0x30] & 0x03) && (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - LockCRT2(pSiS->RelIO+0x30); + SiSLockCRT2(pSiS->RelIO+0x30); return; } SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); @@ -702,10 +839,23 @@ orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ - EnableBridge(pSiS->RelIO+0x30); - LockCRT2(pSiS->RelIO+0x30); + SiSEnableBridgeLVDS(pSiS->RelIO+0x30); + SiSLockCRT2(pSiS->RelIO+0x30); } +/* TW: Restores CRT2 output registers (needs to be called before VESARestore) */ +void +SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg) +{ + SISPtr pSiS = SISPTR(pScrn); + + outw(VGA_SEQ_INDEX, 0x8605); /* Unlock registers */ + + outSISIDXREG(pSiS->RelIO+CROFFSET, 0x33, sisReg->sisRegs3D4[0x33]); + usleep(2000); + outSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, sisReg->sisRegs3D4[0x30]); + outSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, sisReg->sisRegs3D4[0x31]); +} unsigned int @@ -1213,10 +1363,12 @@ pSiS->MaxClock = SiSMemBandWidth(pScrn); pSiS->SiSSave = SiS300Save; pSiS->SiSSave2 = SiS301Save; + pSiS->SiSSave3 = SiS301BSave; pSiS->SiSSaveLVDS = SiSLVDSSave; pSiS->SiSSaveChrontel = SiSChrontelSave; pSiS->SiSRestore = SiS300Restore; pSiS->SiSRestore2 = SiS301Restore; + pSiS->SiSRestore3 = SiS301BRestore; pSiS->SiSRestoreLVDS = SiSLVDSRestore; pSiS->SiSRestoreChrontel= SiSChrontelRestore; pSiS->LoadCRT2Palette = SiS301LoadPalette; @@ -1226,10 +1378,12 @@ pSiS->MaxClock = SiSMemBandWidth(pScrn); pSiS->SiSSave = SiS300Save; pSiS->SiSSave2 = SiS301Save; + pSiS->SiSSave3 = SiS301BSave; pSiS->SiSSaveLVDS = SiSLVDSSave; pSiS->SiSSaveChrontel = SiSChrontelSave; pSiS->SiSRestore = SiS300Restore; pSiS->SiSRestore2 = SiS301Restore; + pSiS->SiSRestore3 = SiS301BRestore; pSiS->SiSRestoreLVDS = SiSLVDSRestore; pSiS->SiSRestoreChrontel= SiSChrontelRestore; pSiS->LoadCRT2Palette = SiS301LoadPalette; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h:1.2 Thu Apr 19 10:11:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h Thu Jan 17 04:57:30 2002 @@ -1,5 +1,5 @@ -/* $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, +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.4 2002/01/17 09:57:30 eich Exp $ */ +int SiScompute_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); @@ -11,4 +11,5 @@ void SiSIODump(ScrnInfoPtr pScrn); int SiSMemBandWidth(ScrnInfoPtr pScrn); int SiSMclk(SISPtr pSiS); +void SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.2 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c Thu Jan 10 14:05:45 2002 @@ -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.2 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.3 2002/01/10 19:05:45 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -43,8 +43,10 @@ static void SIS_SetViewport(ScrnInfoPtr, int, int, int); static void SIS_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void SIS_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +#if 0 static void SIS_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); +#endif static DGAFunctionRec SISDGAFuncs = { @@ -180,17 +182,18 @@ OldDisplayWidth[index] = pScrn->displayWidth; pSIS->DGAactive = TRUE; - } + } - pScrn->displayWidth = pMode->bytesPerScanline / - (pMode->bitsPerPixel >> 3); + pScrn->displayWidth = pMode->bytesPerScanline / + (pMode->bitsPerPixel >> 3); - (*pScrn->SwitchMode)(index, pMode->mode, 0); + (*pScrn->SwitchMode)(index, pMode->mode, 0); } + return TRUE; } -static int +static int SIS_GetViewport( ScrnInfoPtr pScrn ){ @@ -258,7 +261,7 @@ } } - +#if 0 static void SIS_BlitTransRect( ScrnInfoPtr pScrn, @@ -270,7 +273,7 @@ /* this one should be separate since the XAA function would prohibit usage of ~0 as the key */ } - +#endif static Bool SIS_OpenFramebuffer( @@ -285,7 +288,7 @@ *name = NULL; /* no special device */ *mem = (unsigned char*)pSIS->FbAddress; - *size = pSIS->FbMapSize; + *size = pSIS->maxxfbmem; *offset = 0; *flags = DGA_NEED_ROOT; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c diff -u 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.20 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c:1.15.2.1 Tue May 22 17:25:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c Fri Dec 14 19:59:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.15.2.1 2001/05/22 21:25:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.20 2001/12/15 00:59:11 dawes Exp $ */ /* modified from tdfx_dri.c, mga_dri.c */ @@ -15,6 +15,7 @@ #include "sis.h" #include "sis_dri.h" +#include "xf86drmSiS.h" #define BR(x) (0x8200 | (x) << 2) #define SiSIdle \ @@ -22,8 +23,6 @@ while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ MMIO_IN16(pSiS->IOBase, 0x8240); -extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); - extern void GlxSetVisualConfigs( int nconfigs, __GLXvisualConfig *configs, @@ -180,6 +179,9 @@ SISPtr pSIS = SISPTR(pScrn); DRIInfoPtr pDRIInfo; SISDRIPtr pSISDRI; +#if 000 + drmVersionPtr version; +#endif /* Check that the GLX, DRI, and DRM modules have been loaded by testing * for canonical symbols in each module. */ Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c diff -u 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.78 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c:1.64.2.1 Tue May 22 17:25:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c Thu Jan 17 05:49:35 2002 @@ -24,8 +24,10 @@ * Juanjo Santamarta <santamarta@ctv.es>, * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. + * + * Fixes for 630 chipsets: Thomas Winischhofer. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.64.2.1 2001/05/22 21:25:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.78 2002/01/17 10:49:35 eich Exp $ */ #include "fb.h" #include "xf1bpp.h" @@ -96,9 +98,17 @@ static Bool SISUnmapMem(ScrnInfoPtr pScrn); static void SISSave(ScrnInfoPtr pScrn); static void SISRestore(ScrnInfoPtr pScrn); +static void SISVESARestore(ScrnInfoPtr pScrn); static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void SISModifyModeInfo(DisplayModePtr mode); -static void SiSPreSetMode(ScrnInfoPtr pScrn); +static void SiSPreSetMode(ScrnInfoPtr pScrn, int LockAfterwards); +static void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg, int LockAfterwards); +static Bool SiSSetVESAMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); +static void SiSBuildVesaModeList(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe); +static UShort CalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void SISBridgeRestore(ScrnInfoPtr pScrn); +unsigned char SISSearchCRT1Rate(DisplayModePtr mode); +static void SISVESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); void SiSOptions(ScrnInfoPtr pScrn); const OptionInfoRec * SISAvailableOptions(int chipid, int busid); @@ -150,7 +160,6 @@ { 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" }, @@ -183,38 +192,78 @@ 0x8220,0x8224,0x8228,0x822C,0x8230,0x8234,0x8238,0x823C, 0x8240, 0x8300}; +/* TW: The following was re-included because there are BIOSes out there that + * report incomplete mode lists. These are BIOS versions <2.01.2x + * NOTE: Mode numbers for 1280, 1600 and 1920 are unofficial but they work here! + * TW: VBE 3.0 on SiS630 does not support 24 fpp modes (only 32fpp when depth = 24); + */ + /* 8 16 24 32 */ +static UShort VESAModeIndex_640x480[] = {0x100, 0x111, 0x112, 0x13a}; +static UShort VESAModeIndex_720x480[] = {0x000, 0x000, 0x000, 0x000}; +static UShort VESAModeIndex_720x576[] = {0x000, 0x000, 0x000, 0x000}; +static UShort VESAModeIndex_800x600[] = {0x103, 0x114, 0x115, 0x13b}; +static UShort VESAModeIndex_1024x768[] = {0x105, 0x117, 0x118, 0x13c}; +static UShort VESAModeIndex_1280x1024[] = {0x107, 0x11a, 0x11b, 0x13d}; +static UShort VESAModeIndex_1600x1200[] = {0x13e, 0x13f, 0x000, 0x140}; +static UShort VESAModeIndex_1920x1440[] = {0x141, 0x142, 0x000, 0x143}; + +static struct _sis_vrate { + CARD16 idx; + CARD16 xres; + CARD16 yres; + CARD16 refresh; +} sisx_vrate[] = { + {1, 640, 480, 60}, {2, 640, 480, 72}, {3, 640, 480, 75}, {4, 640, 480, 85}, + {5, 640, 480, 100}, {6, 640, 480, 120}, {7, 640, 480, 160}, {8, 640, 480, 200}, + {1, 720, 480, 60}, {1, 720, 576, 50}, + {1, 800, 600, 56}, {2, 800, 600, 60}, {3, 800, 600, 72}, {4, 800, 600, 75}, + {5, 800, 600, 85}, {6, 800, 600, 100}, {7, 800, 600, 120}, {8, 800, 600, 160}, + {1, 1024, 768, 43}, {2, 1024, 768, 60}, {3, 1024, 768, 70}, {4, 1024, 768, 75}, + {5, 1024, 768, 85}, {6, 1024, 768, 100}, {7, 1024, 768, 120}, + {1, 1280, 1024, 43}, {2, 1280, 1024, 60}, {3, 1280, 1024, 75}, {4, 1280, 1024, 85}, + {1, 1600, 1200, 60}, {2, 1600, 1200, 65}, {3, 1600, 1200, 70}, {4, 1600, 1200, 75}, + {5, 1600, 1200, 85}, + {1, 1920, 1440, 60}, + {0, 0, 0, 0} +}; + + +sisModeInfoPtr SISVesaModeList = NULL; + static const char *xaaSymbols[] = { - "XAADestroyInfoRec", - "XAACreateInfoRec", - "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", "XAACopyROP", - "XAAHelpPatternROP", + "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAFillSolidRects", + "XAAHelpPatternROP", + "XAAInit", NULL }; static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWSave", - "vgaHWRestore", - "vgaHWProtect", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", + "vgaHWUnlock", NULL }; -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", + NULL +}; + +static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; @@ -224,10 +273,16 @@ NULL }; +static const char *ramdacSymbols[] = { + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + "xf86InitCursor", + NULL +}; static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", + "xf86SetDDCproperties", NULL }; @@ -237,43 +292,40 @@ NULL }; +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; + #ifdef XF86DRI static const char *drmSymbols[] = { - "drmAddBufs", "drmAddMap", - "drmAvailable", - "drmCtlAddCommand", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", - "drmMapBufs", - "drmMarkBufs", - "drmUnmapBufs", "drmAgpAcquire", - "drmAgpRelease", - "drmAgpEnable", "drmAgpAlloc", - "drmAgpFree", + "drmAgpBase", "drmAgpBind", + "drmAgpEnable", + "drmAgpFree", "drmAgpGetMode", - "drmAgpBase", - "drmAgpSize", + "drmAgpRelease", + "drmCtlInstHandler", + "drmGetInterruptFromBusID", "drmSiSAgpInit", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIQueryVersion", "DRICreateInfoRec", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", + "DRIGetSAREAPrivate", "DRILock", + "DRIQueryVersion", + "DRIScreenInit", "DRIUnlock", - "DRIGetSAREAPrivate", - "DRIGetContext", "GlxSetVisualConfigs", NULL }; @@ -309,11 +361,12 @@ setupDone = TRUE; xf86AddDriver(&SIS, module, 0); LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, xaaSymbols, - shadowSymbols, + miscfbSymbols, shadowSymbols, ramdacSymbols, + vbeSymbols, #ifdef XF86DRI - drmSymbols, driSymbols, + drmSymbols, driSymbols, #endif - NULL); + NULL); return (pointer)TRUE; } @@ -343,6 +396,12 @@ static void SISFreeRec(ScrnInfoPtr pScrn) { + SISPtr pSiS = SISPTR(pScrn); + + if (pSiS->pstate) xfree(pSiS->pstate); + pSiS->pstate = NULL; + if (pSiS->pVbe) vbeFree(pSiS->pVbe); + pSiS->pVbe = NULL; if (pScrn->driverPrivate == NULL) return; xfree(pScrn->driverPrivate); @@ -352,37 +411,54 @@ static void SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { + SISPtr pSiS = SISPTR(pScrn); unsigned char extDDC_PCR; unsigned char crtc17 = 0; - unsigned char seq1 = 0 ; + unsigned char seq1 = 0; int vgaIOBase = VGAHWPTR(pScrn)->IOBase; - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,"SISDisplayPowerManagementSet(%d)\n",PowerManagementMode); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SISDisplayPowerManagementSet(%d)\n",PowerManagementMode); + outb(vgaIOBase + 4, 0x17); crtc17 = inb(vgaIOBase + 5); + /* enable access to extended sequencer registers */ + outw(VGA_SEQ_INDEX, 0x8605); outb(VGA_SEQ_INDEX, 0x11); - extDDC_PCR = inb(VGA_SEQ_DATA) & ~0xC0; + extDDC_PCR = inb(VGA_SEQ_DATA); + /* if not blanked obtain state of LCD blank flags set by BIOS */ + if (!pSiS->Blank) + pSiS->LCDon = extDDC_PCR; + /* erase LCD blank flags */ + extDDC_PCR &= ~0xC; + switch (PowerManagementMode) { case DPMSModeOn: /* HSync: On, VSync: On */ seq1 = 0x00 ; + /* don't just unblanking; use LCD state set by BIOS */ + extDDC_PCR |= (pSiS->LCDon & 0x0C); + pSiS->Blank = FALSE; crtc17 |= 0x80; break; case DPMSModeStandby: /* HSync: Off, VSync: On */ seq1 = 0x20 ; - extDDC_PCR |= 0x40; + extDDC_PCR |= 0x8; + pSiS->Blank = TRUE; break; case DPMSModeSuspend: /* HSync: On, VSync: Off */ seq1 = 0x20 ; - extDDC_PCR |= 0x80; + extDDC_PCR |= 0x8; + pSiS->Blank = TRUE; break; case DPMSModeOff: /* HSync: Off, VSync: Off */ seq1 = 0x20 ; - extDDC_PCR |= 0xC0; + extDDC_PCR |= 0xC; + pSiS->Blank = TRUE; /* DPMSModeOff is not supported with ModeStandby | ModeSuspend */ /* need same as the generic VGA function */ crtc17 &= ~0x80; @@ -551,14 +627,15 @@ SISPtr pSiS; MessageType from; int vgaIOBase; - int i; unsigned char unlock; + unsigned long int i; ClockRangePtr clockRanges; char *mod = NULL; const char *Sym = NULL; int pix24flags; vbeInfoPtr pVbe; + VbeInfoBlock *vbe; if (flags & PROBE_DETECT) { if (xf86LoadSubModule(pScrn, "vbe")) { @@ -645,9 +722,15 @@ if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); + /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; + /* TW: ---EGBERT: Remove this before committing !*/ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Unofficial driver (16.01.02) by Thomas Winischhofer\n"); + /* * Set the Chipset and ChipRev, allowing config file entries to * override. @@ -697,13 +780,24 @@ * 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 | + switch (pSiS->Chipset) { + case PCI_CHIP_SIS530: + pix24flags = Support32bppFb | Support24bppFb | SupportConvert24to32 | SupportConvert32to24; - if (pSiS->Chipset == PCI_CHIP_SIS6326) - pix24flags |= PreferConvert32to24; + break; + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + pix24flags = Support32bppFb | SupportConvert24to32; + break; + default: + pix24flags = Support24bppFb | + SupportConvert32to24 | PreferConvert32to24; + break; + } if (!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) - return FALSE; + return FALSE; /* Check that the returned depth is one we support */ switch (pScrn->depth) { @@ -766,7 +860,7 @@ } } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; /* Set the bits per RGB for 8bpp mode */ @@ -821,6 +915,7 @@ pSiS->IOAddress = pSiS->PciInfo->memBase[1] & 0xFFFFFFF0; } + from = X_PROBED; xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pSiS->IOAddress); @@ -847,50 +942,100 @@ pScrn->videoRam = 4096; xf86DrvMsg(pScrn->scrnIndex, from, "Limiting VideoRAM to %d KB\n", pScrn->videoRam); - } else + } else xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d KB\n", pScrn->videoRam); + /* + * TW: New option: limit size of framebuffer memory for avoiding + * clash with DRI: + * Kernel framebuffer driver (sisfb) starts its memory heap + * at 8MB if it detects more VideoRAM than that(otherwise at 4MB). + * Therefore a setting of 8192 is recommended if DRI is + * to be used when there's more than 8MB video RAM available. + * This option can be left out if DRI is not to be used. + * Attention: TurboQueue and HWCursor should use videoRam value, + * not FbMapSize; these two are always located at the very top + * of the videoRAM. Both are already initialized by framebuffer + * driver, so they should not wander around while starting X. + */ + pSiS->FbMapSize = pScrn->videoRam * 1024; + /* TW: Touching FbMapSize doesn't work; now use maxxfbmem in accel*.c */ + + if (pSiS->maxxfbmem) { + if (pSiS->maxxfbmem > pSiS->FbMapSize) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Invalid MaxXFBMem setting. Using all VideoRAM for framebuffer\n"); + pSiS->maxxfbmem = pSiS->FbMapSize; + } + } else pSiS->maxxfbmem = pSiS->FbMapSize; + /* TW: Detect video bridge */ SISVGAPreInit(pScrn); + /* TW: Detect CRT2-LCD and LCD size */ SISLCDPreInit(pScrn); + /* TW: Detect CRT2-TV and PAL/NTSC mode */ SISTVPreInit(pScrn); - SISCRT2PreInit(pScrn); + /* TW: Detect CRT2-VGA */ + SISCRT2PreInit(pScrn); + /* TW: Eventually overrule detected CRT2 type */ 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; + { + case CRT2_TV: + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD | CRT2_VGA); + if (pSiS->VBFlags & VB_VIDEOBRIDGE) + pSiS->VBFlags = pSiS->VBFlags | CRT2_TV; else - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV); + 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; + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_VGA); + if (pSiS->VBFlags & VB_VIDEOBRIDGE) + pSiS->VBFlags = pSiS->VBFlags | CRT2_LCD; else - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD); + 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; + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_LCD); + if (pSiS->VBFlags & VB_VIDEOBRIDGE) + pSiS->VBFlags = pSiS->VBFlags | CRT2_VGA; else - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_VGA); + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_VGA); break; - } + default: + pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA); + } + + /* TW: Check if CRT1 used (or needed; this if no CRT2 detected) */ + if (pSiS->VBFlags & VB_VIDEOBRIDGE) { + if (!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) + pSiS->CRT1off = 0; + } + else /* TW: no video bridge? Then we NEED CRT1! */ + pSiS->CRT1off = 0; + + /* TW: Determine CRT1<>CRT2 mode */ + if (pSiS->VBFlags & DISPTYPE_DISP2) { + if (pSiS->CRT1off) /* TW: CRT2 only */ + pSiS->VBFlags |= VB_DISPMODE_SINGLE; + else /* TW: CRT1 and CRT2 - mirror image */ + pSiS->VBFlags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1); + } else /* TW: CRT1 only */ + pSiS->VBFlags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1); SISDACPreInit(pScrn); + /* Lock extended registers */ outw(VGA_SEQ_INDEX, (unlock << 8) | 0x05); /* Set the min pixel clock */ @@ -925,7 +1070,7 @@ else pSiS->MaxClock = speed; from = X_CONFIG; - } + } xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n", pSiS->MaxClock / 1000); @@ -959,7 +1104,7 @@ pScrn->bitsPerPixel * 8, 128, 4096, pScrn->display->virtualX, pScrn->display->virtualY, - pSiS->FbMapSize, + pSiS->maxxfbmem, LOOKUP_BEST_REFRESH); if (i == -1) { @@ -1002,8 +1147,7 @@ case 24: case 32: mod = "fb"; - Sym = "fbScreenInit"; - break; + break; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { @@ -1011,7 +1155,13 @@ return FALSE; } - xf86LoaderReqSymbols(Sym, NULL); + if (mod) { + if (Sym) { + xf86LoaderReqSymbols(Sym, NULL); + } else { + xf86LoaderReqSymLists(fbSymbols, NULL); + } + } if (!xf86LoadSubModule(pScrn, "i2c")) { SISFreeRec(pScrn); @@ -1048,17 +1198,39 @@ } xf86LoaderReqSymLists(ddcSymbols, NULL); +/* TW: Now load and initialize VBE module. The default behavior + * for SiS630 with SiS301B, SiS302 or LVDS/CHRONTEL bridge + * is to use VESA for mode switching. This can be overruled + * with the option "VESA". + */ + { - Bool ret; - if (xf86LoadSubModule(pScrn, "vbe")) { - if ((pVbe = VBEInit(NULL,pSiS->pEnt->index))) { - ret = xf86SetDDCproperties(pScrn, - xf86PrintEDID(vbeDoEDID(pVbe,NULL))); - vbeFree(pVbe); - } - } + Bool ret; + pSiS->UseVESA=0; + if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); + if ((pSiS->pVbe = VBEInit(NULL,pSiS->pEnt->index))) { + ret = xf86SetDDCproperties(pScrn, + xf86PrintEDID(vbeDoEDID(pSiS->pVbe,NULL))); + if ( (pSiS->VESA == 1) + || ( (pSiS->VESA != 0) + && (pSiS->Chipset == PCI_CHIP_SIS630) + && (pSiS->VBFlags & (VB_301B|VB_302|VB_LVDS|VB_CHRONTEL))) ) { + vbe = VBEGetVBEInfo(pSiS->pVbe); + pSiS->vesamajor = (unsigned)(vbe->VESAVersion >> 8); + pSiS->vesaminor = vbe->VESAVersion & 0xff; + pSiS->vbeInfo = vbe; + SiSBuildVesaModeList(pScrn, pSiS->pVbe, vbe); + VBEFreeVBEInfo(vbe); + pSiS->UseVESA = 1; + /* TW: from now, use VESA functions for mode switching */ + } + } } - + vbeFree(pSiS->pVbe); + pSiS->pVbe = NULL; + } + #if 0 if (!ret && pSiS->ddc1Read) xf86SetDDCProperties(xf86PrintEDID(xf86DoEDID_DDC1( @@ -1083,7 +1255,7 @@ /* * Map IO registers to virtual address space - */ + */ #if !defined(__alpha__) mmioFlags = VIDMEM_MMIO; #else @@ -1148,7 +1320,6 @@ return TRUE; } - /* * This function saves the video state. */ @@ -1166,12 +1337,47 @@ vgaHWSave(pScrn, vgaReg, VGA_SR_ALL); (*pSiS->SiSSave)(pScrn, sisReg); + if(pSiS->UseVESA) SISVESASaveRestore(pScrn, MODE_SAVE); +} + +static void +SISVESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) +{ + SISPtr pSiS; + + pSiS = SISPTR(pScrn); + + if (pSiS->vesamajor > 1 + && (function == MODE_SAVE || pSiS->pstate)) { + if (function == MODE_RESTORE) + memcpy(pSiS->state, pSiS->pstate, pSiS->stateSize); + ErrorF("VBESaveRestore\n"); + if ((VBESaveRestore(pSiS->pVbe,function, + (pointer)&pSiS->state, + &pSiS->stateSize,&pSiS->statePage))) { + if (function == MODE_SAVE) { + /* don't rely on the memory not being touched */ + if (pSiS->pstate == NULL) + pSiS->pstate = xalloc(pSiS->stateSize); + memcpy(pSiS->pstate, pSiS->state, pSiS->stateSize); + } + ErrorF("VBESaveRestore done with success\n"); + return; + } + ErrorF("VBESaveRestore done\n"); + } else { + if (function == MODE_SAVE) + (void)VBEGetVBEMode(pSiS->pVbe, &pSiS->stateMode); + else + VBESetVBEMode(pSiS->pVbe, pSiS->stateMode, NULL); + } } /* * Initialise a new mode. This is currently still using the old * "initialise struct, restore/write struct to HW" model. That could * be changed. + * TW: Why? */ static Bool @@ -1183,41 +1389,81 @@ SISRegPtr sisReg; vgaHWUnlock(hwp); - + SISModifyModeInfo(mode); - - /* Initialise the ModeReg values */ - if (!vgaHWInit(pScrn, mode)) - return FALSE; - pScrn->vtSema = TRUE; - if (!(*pSiS->ModeInit)(pScrn, mode)) - return FALSE; - - PDEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "HDisplay: %d, VDisplay: %d \n", - mode->HDisplay, mode->VDisplay)); - - /* Program the registers */ - vgaHWProtect(pScrn, TRUE); - vgaReg = &hwp->ModeReg; - sisReg = &pSiS->ModeReg; - - vgaReg->Attribute[0x10] = 0x01; - if (pScrn->bitsPerPixel > 8) - vgaReg->Graphics[0x05] = 0x00; - - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - - 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); + /* TW: Initialize SiS Port Reg definitions for externally used + * sis_bios functions. + */ + SiSRegInit(pSiS->RelIO+0x30); - vgaHWProtect(pScrn, FALSE); + if (pSiS->UseVESA) { /* With VESA: */ + /* + * This order is required: + * The video bridge needs to be adjusted before the + * BIOS is run as the BIOS sets up CRT2 according to + * these register settings. + * After the BIOS is run, the bridges and turboqueue + * registers need to be readjusted as the BIOS may + * very probably have messed them up. + */ + SiSPreSetMode(pScrn, 1); + /* TW: mode was pScrn->currentMode - VidModeExt did not work! */ + if (!SiSSetVESAMode(pScrn, mode)) + return FALSE; + SiSPreSetMode(pScrn, 1); + SiSPostSetMode(pScrn, &pSiS->ModeReg, 1); + + /* Prepare the register contents */ + if (!(*pSiS->ModeInit)(pScrn, mode)) + return FALSE; + + pScrn->vtSema = TRUE; + + /* Program the registers */ + vgaHWProtect(pScrn, TRUE); + (*pSiS->SiSRestore)(pScrn, &pSiS->ModeReg); + vgaHWProtect(pScrn, FALSE); + PDEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "HDisplay: %d, VDisplay: %d \n", + mode->HDisplay, mode->VDisplay)); + + } else { /* Without VESA: */ + /* Initialise the ModeReg values */ + if (!vgaHWInit(pScrn, mode)) + return FALSE; + + if (!(*pSiS->ModeInit)(pScrn, mode)) + return FALSE; + + pScrn->vtSema = TRUE; + + PDEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "HDisplay: %d, VDisplay: %d \n", + mode->HDisplay, mode->VDisplay)); + + /* Program the registers */ + vgaHWProtect(pScrn, TRUE); + vgaReg = &hwp->ModeReg; + sisReg = &pSiS->ModeReg; + + vgaReg->Attribute[0x10] = 0x01; + if (pScrn->bitsPerPixel > 8) + vgaReg->Graphics[0x05] = 0x00; + + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + + if ( (pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540) ) { + SiSPreSetMode(pScrn, 0); + if (!SiSBIOSSetMode(pScrn, mode)) + return FALSE; + } + else (*pSiS->SiSRestore)(pScrn, sisReg); + + vgaHWProtect(pScrn, FALSE); + } /* Reserved for debug * @@ -1227,11 +1473,40 @@ return TRUE; } +static Bool +SiSSetVESAMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) +{ + SISPtr pSiS; + int mode; + + pSiS = SISPTR(pScrn); + + if (!(mode = CalcVESAModeIndex(pScrn, pMode))) return FALSE; + ErrorF("mode: %x\n",mode); + + mode |= 1 << 15; /* TW: Don't clear framebuffer */ + mode |= 1 << 14; /* TW: always use linear adressing */ + + if (VBESetVBEMode(pSiS->pVbe, mode, NULL) == FALSE) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Setting mode 0x%x failed\n", + mode & 0x0fff); + return (FALSE); + } + + if (pMode->HDisplay != pScrn->virtualX) + VBESetLogicalScanline(pSiS->pVbe, pScrn->virtualX); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Setting mode 0x%x succeeded\n", + mode & 0x0fff); + + return (TRUE); +} + + /* * Restore the initial (text) mode. */ -static void +static void SISRestore(ScrnInfoPtr pScrn) { vgaHWPtr hwp; @@ -1253,8 +1528,29 @@ vgaHWProtect(pScrn, FALSE); } +static void +SISVESARestore(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + + if(pSiS->UseVESA) SISVESASaveRestore(pScrn, MODE_RESTORE); +} + +/* TW: Restore bridge output registers - to be called BEFORE VESARestore */ +static void +SISBridgeRestore(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + + if ( (pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540) ) { -/* Mandatory + SiSRestoreBridge(pScrn, &pSiS->SavedReg); + } +} + +/* Mandatory * This gets called at the start of each server generation */ static Bool SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) @@ -1264,13 +1560,13 @@ vgaHWPtr hwp; SISPtr pSiS; int ret; + int init_picture = 0; VisualPtr visual; unsigned long OnScreenSize; int height, width, displayWidth; unsigned char *FBStart; - - /* + /* * First get the ScrnInfoRec */ pScrn = xf86Screens[pScreen->myNum]; @@ -1281,6 +1577,9 @@ pSiS = SISPTR(pScrn); + if (pSiS->UseVESA) + pSiS->pVbe = VBEInit(NULL,pSiS->pEnt->index); + /* Map the VGA memory and get the VGA IO base */ if (!vgaHWMapMem(pScrn)) return FALSE; @@ -1333,12 +1632,13 @@ if (pScrn->bitsPerPixel > 8) { if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, pScrn->defaultVisual)) - return FALSE; + return FALSE; + } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) - return FALSE; + return FALSE; } width = pScrn->virtualX; @@ -1361,8 +1661,8 @@ } if (!miSetPixmapDepths()) - return FALSE; - + return FALSE; + { static int GlobalHWQueueLength = 0; @@ -1398,7 +1698,7 @@ height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - fbPictureInit(pScreen, 0, 0); + init_picture = 1; break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1413,7 +1713,6 @@ return FALSE; } - if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; @@ -1431,6 +1730,9 @@ SIS1bppColorMap(pScrn); } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit(pScreen, 0, 0); if (!pSiS->ShadowFB) /* hardware cursor needs to wrap this layer */ SISDGAInit(pScreen); xf86SetBlackWhitePixels(pScreen); @@ -1487,7 +1789,7 @@ ShadowFBInit(pScreen, refreshArea); } - + xf86DPMSInit(pScreen, (DPMSSetProcPtr)SISDisplayPowerManagementSet, 0); #ifdef XvExtension @@ -1547,14 +1849,7 @@ Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - SISPtr pSiS = SISPTR(pScrn); - if ((pSiS->Chipset == PCI_CHIP_SIS300) || - (pSiS->Chipset == PCI_CHIP_SIS630) || - (pSiS->Chipset == PCI_CHIP_SIS540)) - return SiSSetMode(xf86Screens[scrnIndex], mode); - else - return SISModeInit(xf86Screens[scrnIndex], mode); + return SISModeInit(xf86Screens[scrnIndex], mode); } /* @@ -1562,7 +1857,7 @@ * displayed location in the video memory. */ /* Usually mandatory */ -void +void SISAdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; @@ -1576,6 +1871,11 @@ pSiS = SISPTR(pScrn); vgaIOBase = VGAHWPTR(pScrn)->IOBase; + if (pSiS->UseVESA) { + /* TW: Let BIOS adjust frame if using VESA */ + VBESetDisplayStart(pSiS->pVbe, x, y, TRUE); + } + else { outb(VGA_SEQ_INDEX, 0x05); /* Unlock Registers */ SR5State = inb(VGA_SEQ_DATA); outw(VGA_SEQ_INDEX, 0x8605); @@ -1613,13 +1913,13 @@ "3C5/0Dh set to hex %2X, base 0x%x\n", temp, base)); outb(VGA_SEQ_DATA, temp); if (pSiS->VBFlags) { -/* UnLockCRT2(pSiS->RelIO); */ - UnLockCRT2(pSiS->RelIO+0x30); +/* SiSUnLockCRT2(pSiS->RelIO); */ + SiSUnLockCRT2(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)); -/* LockCRT2(pSiS->RelIO); */ - LockCRT2(pSiS->RelIO+0x30); +/* SiSLockCRT2(pSiS->RelIO); */ + SiSLockCRT2(pSiS->RelIO+0x30); } break; default: @@ -1632,6 +1932,9 @@ } outw(VGA_SEQ_INDEX, (SR5State << 8) | 0x05); /* Relock Registers */ + + } /* if not VESA */ + } /* @@ -1639,6 +1942,7 @@ * to reinitialise the video mode. * * We may wish to unmap video/MMIO memory too. + * (TW: This might be dangerous with TQ) */ /* Mandatory */ @@ -1646,37 +1950,23 @@ SISEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - SISPtr pSiS = SISPTR(pScrn); - #ifdef XF86DRI - ScreenPtr pScreen; + SISPtr pSiS = SISPTR(pScrn); #endif -#ifdef XF86DRI - if (pSiS->directRenderingEnabled) { - pScreen = screenInfo.screens[scrnIndex]; - DRIUnlock(pScreen); - } -#endif + if (!SISModeInit(pScrn, pScrn->currentMode)) + return FALSE; - /* 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 (!SiSSetMode(pScrn, pScrn->currentMode)) - return FALSE; - } - else - if (!SISModeInit(pScrn, pScrn->currentMode)) - return FALSE; - SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - + +#ifdef XF86DRI /* TW: this is to be done AFTER switching the mode */ + if (pSiS->directRenderingEnabled) + DRIUnlock(screenInfo.screens[scrnIndex]); +#endif + return TRUE; } - /* * This is called when VT switching away from the X server. Its job is * to restore the previous (text) mode. @@ -1690,22 +1980,37 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); + SISPtr pSiS; #ifdef XF86DRI ScreenPtr pScreen; - SISPtr pSiS; #endif - SISRestore(pScrn); - vgaHWLock(hwp); - -#ifdef XF86DRI pSiS = SISPTR(pScrn); + +#ifdef XF86DRI /* TW: to be done before mode change */ if (pSiS->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRILock(pScreen, 0); } #endif + + SISBridgeRestore(pScrn); + + if (pSiS->UseVESA) { + /* TW: This is a q&d work-around for a BIOS bug. In case we disabled CRT2, + * VBESaveRestore() does not re-enable CRT1. So we set any mode now, + * because VBESetVBEMode correctly restores CRT1. Afterwards, we + * can call VBESaveRestore to restore original mode. + */ + if ( (pSiS->VBFlags & VB_VIDEOBRIDGE) && (!(pSiS->VBFlags & DISPTYPE_DISP2)) ) + VBESetVBEMode(pSiS->pVbe, (SISVesaModeList->n) | 0xc000, NULL); + SISVESARestore(pScrn); + } + + SISRestore(pScrn); + + vgaHWLock(hwp); } @@ -1731,9 +2036,20 @@ #endif if (pScrn->vtSema) { - if (pCursorInfo) + if (pCursorInfo) pCursorInfo->HideCursor(pScrn); - SISRestore(pScrn); + SISBridgeRestore(pScrn); + if (pSiS->UseVESA) { + /* TW: This is a q&d work-around for a BIOS bug. In case we disabled CRT2, + * VBESaveRestore() does not re-enable CRT1. So we set any mode now, + * because VBESetVBEMode correctly restores CRT1. Afterwards, we + * can call VBESaveRestore to restore original mode. + */ + if ( (pSiS->VBFlags & VB_VIDEOBRIDGE) && (!(pSiS->VBFlags & DISPTYPE_DISP2))) + VBESetVBEMode(pSiS->pVbe, (SISVesaModeList->n) | 0xc000, NULL); + SISVESARestore(pScrn); + } + SISRestore(pScrn); vgaHWLock(hwp); SISUnmapMem(pScrn); } @@ -1766,6 +2082,22 @@ static int SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SISPtr pSiS = SISPTR(pScrn); + + if (pSiS->UseVESA) { + if (CalcVESAModeIndex(pScrn, mode)) + return (MODE_OK); + else + return (MODE_BAD); + } + if ((pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540)) { + if (SiSCalcModeIndex(pScrn, mode) < 0x14) + return (MODE_BAD); + } + return(MODE_OK); } @@ -1775,6 +2107,29 @@ static Bool SISSaveScreen(ScreenPtr pScreen, int mode) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + if ((pScrn != NULL) && pScrn->vtSema) { + + SISPtr pSiS = SISPTR(pScrn); + /* enable access to extended sequencer registers */ + outw(VGA_SEQ_INDEX, 0x8605); + outb(VGA_SEQ_INDEX, 0x11); + /* if not blanked obtain state of LCD blank flags set by BIOS */ + if (!pSiS->Blank) { + unsigned char val; + val = inb(VGA_SEQ_DATA); + pSiS->LCDon = val; + } + if (!xf86IsUnblank(mode)) { + pSiS->Blank = TRUE; + outb(VGA_SEQ_DATA, (pSiS->LCDon | 0x8)); + } else { + pSiS->Blank = FALSE; + /* don't just unblanking; use LCD state set by BIOS */ + outb(VGA_SEQ_DATA, (pSiS->LCDon)); + } + } + return vgaHWSaveScreen(pScreen, mode); } @@ -1845,52 +2200,292 @@ mode->CrtcVBlankEnd--; } -void SiSPreSetMode(ScrnInfoPtr pScrn) +void SiSPreSetMode(ScrnInfoPtr pScrn, int LockAfterwards) { - SISPtr pSiS = SISPTR(pScrn); - unsigned char usScratchCR30, usScratchCR31; - unsigned short SR26, SR27; - unsigned long temp; - int vbflag; - - usScratchCR30 = usScratchCR31 = 0; + SISPtr pSiS = SISPTR(pScrn); + unsigned char usScratchCR30, usScratchCR31; + unsigned char usScratchCR32, usScratchCR33; + unsigned short SR26, SR27; + unsigned char SR5State; + unsigned long temp; + int vbflag; + + outb(VGA_SEQ_INDEX, 0x05); /* Unlock Registers */ + SR5State = inb(VGA_SEQ_DATA); + outw(VGA_SEQ_INDEX, 0x8605); + + usScratchCR30 = usScratchCR31 = usScratchCR33 = 0; outb(SISCR, 0x31); - usScratchCR31 = inb(SISCR+1) & 0x06; - vbflag=pSiS->VBFlags; + usScratchCR31 = inb(SISCR+1); + outb(SISCR, 0x33); /* TW: CRT1 refresh rate index */ + usScratchCR33 = inb(SISCR+1); + outb(SISCR, 0x32); /* TW: Bridge connection info */ + usScratchCR32 = inb(SISCR+1); + outb(SISCR, 0x30); + usScratchCR30 = inb(SISCR+1); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bridge registers were 30=0x%02x, 31=0x%02x, 32=0x%02x, 33=0x%02x (VBFlags = 0x%x)\n", + usScratchCR30, usScratchCR31, usScratchCR32, usScratchCR33, pSiS->VBFlags); + usScratchCR30 = 0; + usScratchCR31 &= ~0x60; /* TW: clear VB_Drivermode & VB_OutputDisable */ + + 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_HIVISION) + usScratchCR30 |= 0x80; + else if (vbflag & TV_SVIDEO) + usScratchCR30 |= 0x08; + else if (vbflag & TV_AVIDEO) + usScratchCR30 |= 0x04; + else if (vbflag & TV_SCART) + usScratchCR30 |= 0x10; + if (vbflag & TV_PAL) + usScratchCR31 |= 0x01; + else + usScratchCR31 &= ~0x01; +#if 0 /* TW: Old code */ + 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; +#endif + usScratchCR30 |= 0x01; + usScratchCR31 &= ~0x04; + break; + case CRT2_LCD: + usScratchCR30 |= 0x21; + usScratchCR31 |= 0x02; + break; + case CRT2_VGA: + usScratchCR30 |= 0x41; + break; + default: /* TW: When CRT2Type is NONE, we can calculate a proper rate for CRT1 */ + usScratchCR30 |= 0x00; + usScratchCR31 |= 0x20; /* TW: VB_OUTPUT_DISABLE */ + if (pSiS->UseVESA) + usScratchCR33 = SISSearchCRT1Rate(pScrn->currentMode); + } + /* + * TW: for VESA: no DRIVERMODE, otherwise + * -) CRT2 will not be initialized correctly when using mode + * where LCD has to scale + * -) CRT1 will have too low rate + */ + if (pSiS->UseVESA) usScratchCR31 &= ~0x40; + else usScratchCR31 |= 0x40; /* 0x40=drivermode */ + + SiSSetReg1(SISCR, 0x30, usScratchCR30); + SiSSetReg1(SISCR, 0x31, usScratchCR31); + SiSSetReg1(SISCR, 0x33, usScratchCR33); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Bridge registers set to 30=0x%02x, 31=0x%02x, 33=0x%02x\n", + usScratchCR30, usScratchCR31, usScratchCR33); + + /* Set Turbo Queue as 512K */ + /* TW: This is done here _and_ in SiS300Init() because SiS300Init() only + * sets up structure but structure is not written to hardware (using + * SiS300Restore) on SiS630, 300, 540 (unless VESA is used). + */ + if (!pSiS->NoAccel) { + if (pSiS->TurboQueue) { + temp = (pScrn->videoRam/64) - 8; + SR26 = temp & 0xFF; + SR27 = ((temp >> 8) & 3) | 0xF0; + SiSSetReg1(SISSR, 0x26, SR26); + SiSSetReg1(SISSR, 0x27, SR27); + } + } + + if (LockAfterwards) + outw(VGA_SEQ_INDEX, (SR5State << 8) | 0x05); /* Relock Registers */ +} - 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: - usScratchCR30 |= 0x41; - usScratchCR31 |= 0x40; - break; - default: - usScratchCR30 |= 0x00; - usScratchCR31 |= 0x60; +/* TW: This doesn't work yet. Switching CRT1 off this way causes a white screen on CRT2 */ +void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg, int LockAfterwards) +{ +#if 0 + SISPtr pSiS = SISPTR(pScrn); + unsigned char usScratchCR17; + unsigned char SR5State; + + outb(VGA_SEQ_INDEX, 0x05); /* Unlock Registers */ + SR5State = inb(VGA_SEQ_DATA); + outw(VGA_SEQ_INDEX, 0x8605); + + if ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) && + pScrn->bitsPerPixel == 8) + pSiS->CRT1off = 0; + + xf86DrvMsg(0, X_PROBED, "CRT1off %d\n", pSiS->CRT1off); + + outb(SISCR, 0x17); + usScratchCR17 = inb(SISCR+1); + + xf86DrvMsg(0, X_PROBED, "CR17 was 0x%2x\n", usScratchCR17); + if (pSiS->CRT1off) + usScratchCR17 &= ~0x80; /* sisReg->sisRegs3D4[0x17] &= ~0x80; */ + else + usScratchCR17 |= 0x80; /* sisReg->sisRegs3D4[0x17] |= 0x80; */ + + xf86DrvMsg(0, X_PROBED, "CR17 set to 0x%2x\n", usScratchCR17); + /*SiSSetReg1(SISCR, 0x17, usScratchCR17); */ + + if (LockAfterwards) + outw(VGA_SEQ_INDEX, (SR5State << 8) | 0x05); /* Relock Registers */ +#endif +} + +static void +SiSBuildVesaModeList(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe) +{ + int i = 0; + while (vbe->VideoModePtr[i] != 0xffff) { + sisModeInfoPtr m; + VbeModeInfoBlock *mode; + int id = vbe->VideoModePtr[i++]; + int bpp; + + if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) + continue; + + bpp = mode->BitsPerPixel; + /* TW: Doesn't work on SiS630 VBE 3.0: */ + /* mode->GreenMaskSize + mode->BlueMaskSize + + mode->RedMaskSize; */ + + m = xnfcalloc(sizeof(sisModeInfoRec),1); + m->width = mode->XResolution; + m->height = mode->YResolution; + m->bpp = bpp; + m->n = id; + m->next = SISVesaModeList; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n", + m->n, m->width, m->height, m->bpp); + + SISVesaModeList = m; + + VBEFreeModeInfo(mode); } - SetReg1(SISCR, 0x30, usScratchCR30); - SetReg1(SISCR, 0x31, usScratchCR31); - - /* Set Turbo Queue as 512K */ - if (!pSiS->NoAccel) { - if (pSiS->TurboQueue) { - temp = (pScrn->videoRam/64) - 8; - SR26 = temp & 0xFF; - SR27 = ((temp >> 8) & 3) | 0xF0; - SetReg1(SISSR, 0x26, SR26); - SetReg1(SISSR, 0x27, SR27); - } - } } + +static UShort CalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + sisModeInfoPtr m = SISVesaModeList; + UShort i = (pScrn->bitsPerPixel+7)/8 - 1; /* bitsperpixel was depth */ + UShort ModeIndex = 0; + + while (m) { + if (pScrn->bitsPerPixel == m->bpp + && mode->HDisplay == m->width + && mode->VDisplay == m->height) + return m->n; + m = m->next; + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "No valid BIOS VESA mode found for %dx%dx%d; searching built-in table.\n", + mode->HDisplay, mode->VDisplay, pScrn->bitsPerPixel); + + switch(mode->HDisplay) + { + case 640: + ModeIndex = VESAModeIndex_640x480[i]; + break; + case 720: + if(mode->VDisplay == 480) + ModeIndex = VESAModeIndex_720x480[i]; + else + ModeIndex = VESAModeIndex_720x576[i]; + break; + case 800: + ModeIndex = VESAModeIndex_800x600[i]; + break; + case 1024: + ModeIndex = VESAModeIndex_1024x768[i]; + break; + case 1280: + ModeIndex = VESAModeIndex_1280x1024[i]; + break; + case 1600: + ModeIndex = VESAModeIndex_1600x1200[i]; + break; + case 1920: + ModeIndex = VESAModeIndex_1920x1440[i]; + break; + } + + if (!ModeIndex) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "No valid mode found for %dx%dx%d in built-in table either.", + mode->HDisplay, mode->VDisplay, pScrn->bitsPerPixel); + + return(ModeIndex); +} + +/* TW: Calculate CR33 (rate index) for CRT1 if CRT2 is disabled. + Calculation is done using currentmode structure, therefore + it is recommended to set VertRefresh and HorizSync to correct + values in Config file. + */ +unsigned char SISSearchCRT1Rate(DisplayModePtr mode) +{ + float hsync, refresh = 0; + int i = 0; + unsigned short xres=mode->HDisplay; + unsigned short yres=mode->VDisplay; + unsigned char index; + + if (mode->HSync > 0.0) + hsync = mode->HSync; + else if (mode->HTotal > 0) + hsync = (float)mode->Clock / (float)mode->HTotal; + else + hsync = 0.0; + if (mode->VTotal > 0) + refresh = hsync * 1000.0 / mode->VTotal; + if (mode->Flags & V_INTERLACE) { + refresh *= 2.0; + } + if (mode->Flags & V_DBLSCAN) { + refresh /= 2.0; + } + if (mode->VScan > 1) { + refresh /= mode->VScan; + } + if (mode->VRefresh > 0.0) + refresh = mode->VRefresh; + if (hsync == 0 || refresh == 0) + return 0x02; /* TW: Default mode index */ + else { + index = 0; + while ((sisx_vrate[i].idx != 0) && (sisx_vrate[i].xres <= xres)) { + if ((sisx_vrate[i].xres == xres) + && (sisx_vrate[i].yres == yres)) { + if (sisx_vrate[i].refresh == refresh) { + index = sisx_vrate[i].idx; + break; + } else if (sisx_vrate[i].refresh > refresh) { + if ((sisx_vrate[i].refresh - refresh) <= 2) { + index = sisx_vrate[i].idx; + } else if (((refresh - sisx_vrate[i - 1].refresh) <= 2) + && (sisx_vrate[i].idx != 1)) { + index = sisx_vrate[i - 1].idx; + } + break; + } + } + i++; + } + if (index > 0) + return index; + else + return 0x02; /* TW: Default Rate index */ + } +} + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.7 Wed May 16 09:43:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c Thu Jan 17 04:57:30 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.7 2001/05/16 13:43:17 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.10 2002/01/17 09:57:30 eich Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -17,7 +17,9 @@ OPTION_FORCE_CRT2TYPE, OPTION_SHADOW_FB, OPTION_ROTATE, - OPTION_NOXVIDEO + OPTION_NOXVIDEO, + OPTION_VESA, + OPTION_MAXXFBMEM } SISOpts; static const OptionInfoRec SISOptions[] = { @@ -33,6 +35,8 @@ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_NOXVIDEO, "NoXvideo", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, -1 }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -63,7 +67,10 @@ pSiS->HWCursor = TRUE; pSiS->Rotate = FALSE; pSiS->ShadowFB = FALSE; - pSiS->NoXvideo = FALSE; + pSiS->VESA = -1; + pSiS->NoXvideo = FALSE; + pSiS->maxxfbmem = 0; + switch(pSiS->Chipset) { case PCI_CHIP_SIS530: pSiS->TurboQueue = FALSE; /* FIXME ? */ @@ -138,12 +145,14 @@ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE); if (strptr != NULL) { - if (!xf86strcmp(strptr,"TV")) + if (!strcmp(strptr,"TV")) pSiS->ForceCRT2Type = CRT2_TV; - if (!xf86strcmp(strptr,"LCD")) + if (!strcmp(strptr,"LCD")) pSiS->ForceCRT2Type = CRT2_LCD; - if (!xf86strcmp(strptr,"VGA")) + if (!strcmp(strptr,"VGA")) pSiS->ForceCRT2Type = CRT2_VGA; + if (!strcmp(strptr,"NONE")) + pSiS->ForceCRT2Type = 0; if (pSiS->ForceCRT2Type != CRT2_DEFAULT) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, @@ -192,6 +201,42 @@ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo Extension Disabled\n"); } + /* VESA */ + /* + * This option is for overriding the default behavior. + * By default it depends on the chipset/video bridge + * combination if the VESA BIOS code is used to prevent + * the "melting" screen effect due to lack of nowledge + * about programming details. + * You will normally not need this option. + */ + { + Bool val; + + if (xf86GetOptValBool(pSiS->Options, OPTION_VESA, &val)) { + if (val) + pSiS->VESA = 1; + else + pSiS->VESA = 0; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "VESA usage %s\n", + val ? "enabled":"disabled"); + } + } + /* With the option "MaxXFBMem" you can limit the amount of video memory X + * uses for screen and off-screen buffers. This option should be used if + * you intend to use DRI/DRM. The framebuffer driver required for DRM will + * start its memory heap at 8MB if it detects more than that. So, if you + * limit the amount of memory X uses, you avoid a clash between the framebuffer + * driver and X as regards overwriting memory portions of each other. + * The amount is to be specified in KB. + */ + if (xf86GetOptValULong(pSiS->Options, OPTION_MAXXFBMEM, + &pSiS->maxxfbmem)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Framebuffer memory limited to %d KB\n", pSiS->maxxfbmem); + pSiS->maxxfbmem *= 1024; + } } const OptionInfoRec * Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.3 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c Thu Jan 17 04:57:30 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.3 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.6 2002/01/17 09:57:30 eich Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -9,66 +9,148 @@ #include "sis_regs.h" #include "sis_vb.h" +/* TW: Detect CRT2-LCD and LCD size */ void SISLCDPreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - int temp; - - - if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) - return; - - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); - if (temp & 0x08) - pSiS->VBFlags |= CRT2_LCD; - - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); - if (temp == 1) - pSiS->VBFlags |= LCD_800x600; - if (temp == 2) - pSiS->VBFlags |= LCD_1024x768; - if (temp == 3) - pSiS->VBFlags |= LCD_1280x1024; + int CR32, SR17, CR36; + + if (!(pSiS->VBFlags & VB_VIDEOBRIDGE)) + return; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, CR32); + inSISIDXREG(pSiS->RelIO+SROFFSET, 0x17, SR17); + + if ( (SR17 & 0x0F) && (pSiS->Chipset != PCI_CHIP_SIS300) ) { + if ( (SR17 & 0x01) && (!pSiS->CRT1off) ) + pSiS->CRT1off = 0; + else { + if (SR17 & 0x0E) + pSiS->CRT1off = 1; + else + pSiS->CRT1off = 0; + } + if (SR17 & 0x02) + pSiS->VBFlags |= CRT2_LCD; + } else { + if ( (CR32 & 0x20) && (!pSiS->CRT1off) ) + pSiS->CRT1off = 0; + else { + if (CR32 & 0x5F) + pSiS->CRT1off = 1; + else + pSiS->CRT1off = 0; + } + if (CR32 & 0x08) + pSiS->VBFlags |= CRT2_LCD; + } + + if (pSiS->VBFlags & CRT2_LCD) { + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, CR36); + switch (CR36) { + case 1: + pSiS->VBFlags |= LCD_800x600; + pSiS->LCDheight = 600; + break; + case 2: + pSiS->VBFlags |= LCD_1024x768; + pSiS->LCDheight = 768; + break; + case 3: + pSiS->VBFlags |= LCD_1280x1024; + pSiS->LCDheight = 1024; + break; + case 4: + pSiS->VBFlags |= LCD_1280x960; /* TW */ + pSiS->LCDheight = 960; + break; + case 5: + pSiS->VBFlags |= LCD_640x480; /* TW */ + pSiS->LCDheight = 480; + break; + default: + pSiS->VBFlags |= LCD_1024x768; /* TW */ + pSiS->LCDheight = 768; + break; + } + } } - + +/* TW: Detect CRT2-TV connector type and PAL/NTSC flag */ void SISTVPreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - int temp; - - 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; - + int CR32, CR38, SR16, SR17; + + if (!(pSiS->VBFlags & VB_VIDEOBRIDGE)) + return; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, CR32); + inSISIDXREG(pSiS->RelIO+SROFFSET, 0x17, SR17); + + if ( (SR17 & 0x0F) && (pSiS->Chipset != PCI_CHIP_SIS300) ) { + if (SR17 & 0x04) /* { */ /* TW: Determine TV type even if not using TV output */ + pSiS->VBFlags |= CRT2_TV; + + if (SR17 & 0x20) + pSiS->VBFlags |= TV_SVIDEO; + else if (SR17 & 0x10) + pSiS->VBFlags |= TV_AVIDEO; + inSISIDXREG(pSiS->RelIO+SROFFSET, 0x16, SR16); + if (SR16 & 0x20) + pSiS->VBFlags |= TV_PAL; + else + pSiS->VBFlags |= TV_NTSC; + /* } */ + } else { + if (CR32 & 0x47) /* { */ + pSiS->VBFlags |= CRT2_TV; + if (CR32 & 0x04) + pSiS->VBFlags |= TV_SCART; + else if (CR32 & 0x02) + pSiS->VBFlags |= TV_SVIDEO; + else if (CR32 & 0x01) + pSiS->VBFlags |= TV_AVIDEO; + else if (CR32 & 0x40) + pSiS->VBFlags |= (TV_SVIDEO | TV_HIVISION); + inSISIDXREG(pSiS->RelIO+SROFFSET, 0x38, CR38); + if (CR38 & 0x01) + pSiS->VBFlags |= TV_PAL; + else + pSiS->VBFlags |= TV_NTSC; + /* } */ + } + + /* TW: This is old code: */ + + /* TW: Reading PAL/NTSC flag from 0x31 is not a good idea. We'd + * better read this from POWER_ON_TRAP (0x38) some day. */ +#if 0 inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); if (temp & 0x01) - pSiS->VBFlags |= TV_PAL; + pSiS->VBFlags |= TV_PAL; else - pSiS->VBFlags |= TV_NTSC; + pSiS->VBFlags |= TV_NTSC; +#endif } - -void SISCRT2PreInit(ScrnInfoPtr pScrn) + + /* TW: Detect CRT2-VGA */ + void SISCRT2PreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - int temp; - - if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) - return; - - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); - if (temp & 0x10) - pSiS->VBFlags |= CRT2_VGA; - - return; - + int SR17, CR32; + + if (!(pSiS->VBFlags & VB_VIDEOBRIDGE)) + return; + + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, CR32); + inSISIDXREG(pSiS->RelIO+SROFFSET, 0x17, SR17); + + if ( (SR17 & 0x0F) && (pSiS->Chipset != PCI_CHIP_SIS300) ) { + if (SR17 & 0x08) + pSiS->VBFlags |= CRT2_VGA; + } else { + if (CR32 & 0x10) + pSiS->VBFlags |= CRT2_VGA; + } } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.4 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h Thu Jan 17 04:57:30 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.4 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.5 2002/01/17 09:57:30 eich Exp $ */ /* CR30 VBInfo = CR31:CR30 */ #define SET_SIMU_SCAN_MODE 0x0001 @@ -12,13 +12,13 @@ #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_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 DRIVER_MODE 0x4000 typedef struct _SiS301Reg { CARD8 *VBPart1; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.7 Thu Apr 19 08:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c Thu Jan 17 04:57:30 2002 @@ -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.7 2001/04/19 12:40:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.12 2002/01/17 09:57:30 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -44,7 +44,7 @@ #define Pidx 3 #define PSNidx 4 #define Fref 14318180 -/* stability constraints for internal VCO -- MAX_VCO also determines +/* stability constraints for internal VCO -- MAX_VCO also determines * the maximum Video pixel clock */ #define MIN_VCO Fref #define MAX_VCO 135000000 @@ -82,10 +82,12 @@ (*pSiS->SiSSave)(pScrn, pReg); - outw(VGA_SEQ_INDEX, 0x8605); - pSiS->scrnOffset = pScrn->displayWidth * pScrn->bitsPerPixel / 8; + outw(VGA_SEQ_INDEX, 0x8605); + + pReg->sisRegs3C4[0x06] &= 0x01; + if ((mode->Flags & V_INTERLACE)==0) { offset = pScrn->displayWidth >> 3; pReg->sisRegs3C4[0x06] &= 0xDF; @@ -201,7 +203,7 @@ /* Set vclk */ - if (compute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { + if (SiScompute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { switch (pSiS->Chipset) { case PCI_CHIP_SIS5597: case PCI_CHIP_SIS6326: @@ -220,7 +222,7 @@ } } else { - /* if compute_vclk cannot handle the request clock try sisCalcClock! */ + /* if SiScompute_vclk cannot handle the request clock try sisCalcClock! */ SiSCalcClock(pScrn, clock, 2, vclk); switch (pSiS->Chipset) { case PCI_CHIP_SIS5597: @@ -390,6 +392,13 @@ return(TRUE); } +/* TW: Initialize various regs for mode. This is done to + * structure, not hardware. (SiSRestore would write + * structure to hardware registers.) + * This function is not used on SiS300, 540, 630 (unless + * VESA is used for mode switching); on these chips, + * the BIOS emulation (sis_bioc.s) does the job. + */ Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) { @@ -398,7 +407,7 @@ vgaRegPtr vgaReg = &VGAHWPTR(pScrn)->ModeReg; int vgaIOBase; unsigned short temp; - int offset; + int offset=0; int clock = mode->Clock; unsigned int vclk[5]; @@ -416,8 +425,11 @@ (*pSiS->SiSSave)(pScrn, pReg); + pSiS->scrnOffset = pScrn->displayWidth * ((pScrn->bitsPerPixel+7)/8); + outw(VGA_SEQ_INDEX, 0x8605); + /* TW: The following MUST be done even with VESA */ pReg->sisRegs3C4[6] &= ~GENMASK(4:2); switch (pScrn->bitsPerPixel) { @@ -442,37 +454,35 @@ pReg->sisRegs3C4[6] |= ((4 << 2) | 0x03); break; } - - pSiS->scrnOffset = pScrn->displayWidth * ((pScrn->bitsPerPixel+7)/8); - - 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; + if (!pSiS->UseVESA) { /* TW: Don't do the following when using VESA (NEW) */ + 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] = + pReg->sisRegs3C4[0x0A] = /* Extended Vertical Overflow */ GETBITSTR(mode->CrtcVTotal -2, 10:10, 0:0) | GETBITSTR(mode->CrtcVDisplay -1, 10:10, 1:1) | GETBITSTR(mode->CrtcVBlankStart , 10:10, 2:2) | @@ -480,129 +490,191 @@ GETBITSTR(mode->CrtcVBlankEnd , 8:8, 4:4) | GETBITSTR(mode->CrtcVSyncEnd , 4:4, 5:5) ; - /* Extended Horizontal Overflow */ - pReg->sisRegs3C4[0x0B] = + pReg->sisRegs3C4[0x0B] = /* Extended Horizontal Overflow */ 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] |= + pReg->sisRegs3C4[0x0C] &= 0xF8; + pReg->sisRegs3C4[0x0C] |= GETBITSTR(mode->CrtcHBlankEnd >> 3, 7:6, 1:0) | GETBITSTR(mode->CrtcHSyncEnd >> 3, 5:5, 2:2) ; - /* Screen Offset */ - vgaReg->CRTC[0x13] = GETVAR8(offset); - pReg->sisRegs3C4[0x0E] &= 0xF0; - pReg->sisRegs3C4[0x0E] |= GETBITS(offset, 11:8); - - /* line compare */ - if (mode->CrtcHDisplay > 0) - pReg->sisRegs3C4[0x0F] |= 0x08; - else - pReg->sisRegs3C4[0x0F] &= 0xF7; - pReg->sisRegs3C4[0x10] = - ((mode->CrtcHDisplay *((pScrn->bitsPerPixel+7)/8) + 63) >> 6)+1; - - /* Enable Linear */ - pReg->sisRegs3C4[0x20] |= 0x81; + vgaReg->CRTC[0x13] = GETVAR8(offset); /* Screen Offset */ + pReg->sisRegs3C4[0x0E] &= 0xF0; + pReg->sisRegs3C4[0x0E] |= GETBITS(offset, 11:8); + + if (mode->CrtcHDisplay > 0) /* line compare */ + pReg->sisRegs3C4[0x0F] |= 0x08; + else + pReg->sisRegs3C4[0x0F] &= 0xF7; - /* 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; - } - 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 ; - - /* 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; - } /* 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->sisRegs3C4[0x10] = + ((mode->CrtcHDisplay *((pScrn->bitsPerPixel+7)/8) + 63) >> 6)+1; + } /* VESA */ +/* TW: Enable PCI adressing (0x80) & MMIO enable (0x1) & ? (0x20) */ + pReg->sisRegs3C4[0x20] = 0xA1; +/* TW: Enable 3D accelerator & ? */ +/* TW: 0x42 enables 2D accellerator (done below), 0x18 enables 3D engine */ +/* pReg->sisRegs3C4[0x1E] = 0x18; */ +/* TW: !!! now done according to NoAccel setting !!! */ + + if (!pSiS->UseVESA) { /* TW: clocks have surely been set by VESA, so don't touch them now */ + if (SiScompute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { /* Set vclk */ + 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 { + /* if SiScompute_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 ; + + /* 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; + } /* 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 */ + } /* VESA */ + +/* TW: Now initialize TurboQueue. TB is always located at the very top of + the videoRAM (notably NOT the x framebuffer memory, which can/should + be limited when using DRI) +*/ if (!pSiS->NoAccel) { - pReg->sisRegs3C4[0x1E] |= 0x42; - if (pSiS->TurboQueue) { /* set Turbo Queue as 512k */ - temp = ((pScrn->videoRam/64)-4); + pReg->sisRegs3C4[0x1E] |= 0x42; /* TW: Enable 2D accellerator */ + pReg->sisRegs3C4[0x1E] |= 0x18; /* TW: Enable 3D accellerator */ + if (pSiS->TurboQueue) { /* set Turbo Queue as 512k */ + temp = ((pScrn->videoRam/64)-8); /* TW: 8=512k, 4=256k, 2=128k, 1=64k */ pReg->sisRegs3C4[0x26] = temp & 0xFF; - pReg->sisRegs3C4[0x27] = ((temp >> 8) & 3) || 0xF0; - } + pReg->sisRegs3C4[0x27] = + (pReg->sisRegs3C4[0x27] & 0xfc) | (((temp >> 8) & 3) | 0xF0); + } /* TW: line above new for saving D2&3 of state register */ } - /* 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); + if (!pSiS->UseVESA) { + /* 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); } +/* TW: Detect video bridge and set VBFlags accordingly */ void SISVGAPreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); int temp; - unsigned short usOffsetHigh, usOffsetLow, vBiosVersion; + char BIOSversion[]="x.xx.xx\0"; + unsigned short usOffsetHigh, usOffsetLow, vBiosRevision; unsigned long ROMAddr = (unsigned long) SISPTR(pScrn)->BIOS; + + for (temp = 0; temp < 7; temp++) { + BIOSversion[temp] = *((unsigned char *)(ROMAddr+temp+0x06)); + } - usOffsetHigh = *((unsigned char *)(ROMAddr+0x08)) - 0x30; - usOffsetLow = *((unsigned char *)(ROMAddr+0x09)) - 0x30; - vBiosVersion = usOffsetHigh << 4 | usOffsetLow; - if (vBiosVersion < 0x02) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Video BIOS version %s detected\n", BIOSversion); + + usOffsetHigh = *((unsigned char *)(ROMAddr+0x08)) - 0x30; + usOffsetLow = *((unsigned char *)(ROMAddr+0x09)) - 0x30; + vBiosRevision = usOffsetHigh << 4 | usOffsetLow; +#if 0 /* TW: What's this good for? Check the BIOS revision???? That can't be correct! */ + if (vBiosRevision < 0x02) { outSISIDXREG(pSiS->RelIO+CROFFSET, 0x37, 0); inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); temp &= 0x07; outSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); } +#endif outb(SISPART4, 0x00); temp = inb(SISPART4+1) & 0x0F; pSiS->VBFlags = 0; /*reset*/ - if (temp == 1) - pSiS->VBFlags|=VB_301; /*301*/ - else if (temp == 2) + if (temp == 1) { + outb(SISPART4, 0x01); /* TW: new for 301b; support is yet incomplete */ + temp = inb(SISPART4+1) & 0xff; + if (temp >= 0xB0) { + pSiS->VBFlags|=VB_301B; /* TW: 301b */ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected SiS301B video bridge\n"); + } else { + pSiS->VBFlags|=VB_301; /*301*/ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected SiS301 video bridge\n"); + } + outb(SISPART4, 0x23); /* TW: new */ + temp = inb(SISPART4+1) & 0xff; + if (!(temp & 0x02)) { + pSiS->VBFlags|=VB_NOLCD; /* TW: flag yet unused */ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "[SiS301: NoLCD flag detected]\n"); + } + } + else if (temp == 2) { pSiS->VBFlags|=VB_302; /*302*/ - else if (temp == 3) + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected SiS302(B) video bridge\n"); + outb(SISPART4, 0x38); /* TW: new; LCDA (?) support - yet incomplete */ + temp = inb(SISPART4+1) & 0xff; + if (temp == 0x03) { + pSiS->VBFlags|=VB_LCDA; /* TW: flag yet unused */ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "[SiS302: LCDA flag detected]\n"); + } + } + else if (temp == 3) { pSiS->VBFlags|=VB_303; /*303*/ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected SiS303 video bridge\n"); + } else { outb(SISCR, 0x37); temp = ((inb(SISCR+1))>>1) & 0x07; - if ((temp == 2) || (temp == 3) || (temp == 4)) + if ((temp == 2) || (temp == 3) || (temp == 4)) { pSiS->VBFlags |= VB_LVDS; - if (temp == 4) + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LVDS video bridge (Type %d)\n", temp); + } + if ((temp == 4) || (temp == 5)) { pSiS->VBFlags |= VB_CHRONTEL; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected CHRONTEL 7500 VGA->TV converter (Type %d)\n", temp); + } + if (temp == 3) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected TRUMPION TV converter. This device is not supported yet.\n"); + } + if ((temp < 2) || (temp > 5)) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected unknown bridge type (%d)\n", temp); + } } switch (pSiS->Chipset) { Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.3 Wed May 16 09:43:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c Thu Jan 17 04:57:30 2002 @@ -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.3 2001/05/16 13:43:17 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.6 2002/01/17 09:57:30 eich Exp $ */ /* * sis_video.c: SIS Xv driver. Based on the mga Xv driver by Mark Vojkovich @@ -167,11 +167,13 @@ return inb(pSIS->RelIO + index_offset+1); } +#if 0 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); } +#endif /* VBlank */ static CARD8 vblank_active_CRT1(SISPtr pSIS) @@ -498,15 +500,21 @@ /* set display mode */ /* TODO: support CRT2-only mode */ - if(pSIS->VBFlags) { + if(pSIS->VBFlags & VB_DISPMODE_MIRROR) { /* TW: CRT1 + CRT2 */ pPriv->displayMode = DISPMODE_MIRROR; setsrregmask (pSIS, 0x06, 0x80, 0xc0); setsrregmask (pSIS, 0x32, 0x80, 0xc0); } else { - pPriv->displayMode = DISPMODE_SINGLE1; - setsrregmask (pSIS, 0x06, 0x00, 0xc0); - setsrregmask (pSIS, 0x32, 0x00, 0xc0); + if (pSIS->VBFlags & DISPTYPE_DISP1) { /* TW: CRT1 only */ + pPriv->displayMode = DISPMODE_SINGLE1; + setsrregmask (pSIS, 0x06, 0x00, 0xc0); + setsrregmask (pSIS, 0x32, 0x00, 0xc0); + } else { /* TW: CRT2 only */ + pPriv->displayMode = DISPMODE_SINGLE2; + setsrregmask (pSIS, 0x06, 0x00, 0xc0); /* No idea... do the same as for CRT1 now */ + setsrregmask (pSIS, 0x32, 0x00, 0xc0); + } } SISResetVideo(pScrn); @@ -612,17 +620,25 @@ static void -set_scale_factor(SISOverlayPtr pOverlay) +set_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn) { + SISPtr pSIS = SISPTR(pScrn); CARD32 I=0; int dstW = pOverlay->dstBox.x2 - pOverlay->dstBox.x1; int dstH = pOverlay->dstBox.y2 - pOverlay->dstBox.y1; int srcW = pOverlay->srcW; int srcH = pOverlay->srcH; - + CARD16 LCDheight = pSIS->LCDheight; + CARD16 SCREENheight = pScrn->currentMode->VDisplay; + int srcPitch = pOverlay->pitch; + /* TW: Scale image due to idiotic VESA modes that scale CRT2 _and_ CRT1 */ + if ( (pSIS->UseVESA) && (pSIS->VBFlags & CRT2_LCD) ) { + dstH = (dstH * LCDheight) / SCREENheight; + } + if (dstW == srcW) { pOverlay->HUSF = 0x00; pOverlay->IntBit = 0x05; @@ -995,9 +1011,9 @@ set_line_buf_size (&overlay); /* set scale factor */ - set_scale_factor (&overlay); + set_scale_factor (&overlay, pScrn); - if(pPriv->displayMode == DISPMODE_SINGLE2) { + if( (pPriv->displayMode == DISPMODE_SINGLE2) ) { index = 1; overlay.VBlankActiveFunc = vblank_active_CRT2; overlay.GetScanLineFunc = get_scanline_CRT2; @@ -1011,7 +1027,7 @@ MIRROR: setvideoregmask (pSIS, Index_VI_Control_Misc2, index, 0x01); - + /* set scale temporarily */ { int dstW = overlay.dstBox.x2 - overlay.dstBox.x1; @@ -1043,7 +1059,7 @@ /* enable overlay */ setvideoregmask (pSIS, Index_VI_Control_Misc0, 0x02, 0x02); - if((pPriv->displayMode == DISPMODE_MIRROR) && (index == 0)) { + if(((pPriv->displayMode == DISPMODE_MIRROR) && (index == 0))) { index = 1; overlay.VBlankActiveFunc = vblank_active_CRT2; overlay.GetScanLineFunc = get_scanline_CRT2; @@ -1053,14 +1069,14 @@ static void -SISStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +SISStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { SISPortPrivPtr pPriv = (SISPortPrivPtr)data; SISPtr pSIS = SISPTR(pScrn); REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - if(exit) { + if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { close_overlay(pSIS, pPriv); } Index: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c:1.4 Wed May 16 02:48:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c Mon Oct 1 09:44: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/suncg14/cg14_driver.c,v 1.4 2001/05/16 06:48:10 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c,v 1.6 2001/10/01 13:44:10 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -323,7 +323,7 @@ deal with depth *********************/ - if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) { + if (!xf86SetDepthBpp(pScrn, 32, 0, 32, Support32bppFb)) { return FALSE; } else { /* Check that the returned depth is one we support */ @@ -479,10 +479,6 @@ if (!ret) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); @@ -503,6 +499,11 @@ } } } + +#ifdef RENDER + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); +#endif /* Initialise cursor functions */ miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); Index: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c:1.7 Fri May 18 12:03:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c Mon Oct 1 09:44:10 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.7 2001/05/18 16:03:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c,v 1.8 2001/10/01 13:44:10 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -332,7 +332,7 @@ deal with depth *********************/ - if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) { + if (!xf86SetDepthBpp(pScrn, 32, 0, 32, Support32bppFb)) { return FALSE; } else { /* Check that the returned depth is one we support */ Index: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c:1.5 Wed May 16 02:48:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c Tue Aug 7 03:04:51 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_driver.c,v 1.5 2001/05/16 06:48:11 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c,v 1.6 2001/08/07 07:04:51 keithp Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -551,14 +551,6 @@ if (!ret) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - - miInitializeBackingStore(pScreen); - xf86SetBackingStore(pScreen); - xf86SetSilkenMouse(pScreen); - xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -575,6 +567,15 @@ } } } + +#ifdef RENDER + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); +#endif + + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); /* Initialise cursor functions */ miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.20.2.1 xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.20.2.1 Tue May 22 17:25:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile Mon May 21 17:43:55 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.20.2.1 2001/05/22 21:25:45 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.21 2001/05/21 21:43:55 dawes Exp $ XCOMM XCOMM This is the Imakefile for the TDFX driver. XCOMM Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.23.2.1 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.23.2.1 Tue May 22 17:25:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h Fri Aug 17 22:51:13 2001 @@ -5,7 +5,7 @@ Copyright: 1998,1999 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.23.2.1 2001/05/22 21:25:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.25 2001/08/18 02:51:13 dawes Exp $ */ #ifndef _TDFX_H_ #define _TDFX_H_ @@ -109,7 +109,9 @@ unsigned int vidpll; unsigned int dacmode; unsigned int vgainit0; + unsigned int vgainit1; unsigned int miscinit0; + unsigned int miscinit1; unsigned int screensize; unsigned int stride; unsigned int cursloc; @@ -150,6 +152,7 @@ EntityInfoPtr pEnt; int numChips; PCITAG PciTag[MAXCHIPS]; + Bool Primary; int HasSGRAM; int PciCnt; int PrevDrawState; Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c:1.19 Thu Apr 5 17:29:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c Sat Oct 27 23:33:49 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.19 2001/04/05 21:29:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.20 2001/10/28 03:33:49 tsi Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -897,9 +897,9 @@ 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)); + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, ((((w+31)/32)*4) & 0x3FFF) | BIT(20)); #else - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF); + 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); Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c diff -u 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.23 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c:1.22.2.1 Tue May 22 17:25:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c Mon May 21 17:43:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.22.2.1 2001/05/22 21:25:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.23 2001/05/21 21:43:55 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c diff -u 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.87 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c:1.75.2.2 Wed May 23 09:29:28 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c Fri Jan 4 16:22:35 2002 @@ -1,3 +1,5 @@ +#define USE_INT10 1 +#define USE_PCIVGAIO 1 /************************************************************************** @@ -25,7 +27,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.75.2.2 2001/05/23 13:29:28 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.87 2002/01/04 21:22:35 tsi Exp $ */ /* * Authors: @@ -187,55 +189,43 @@ }; static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWSave", /* Added */ - "vgaHWRestore", /* Added */ - "vgaHWProtect", - "vgaHWInit", - "vgaHWMapMem", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", + "vgaHWGetIndex", + "vgaHWInit", "vgaHWLock", - "vgaHWUnlock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSeqReset", - "vgaHWHandleColormaps", + "vgaHWUnlock", 0 }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", - "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", + "xf86SetDDCproperties", NULL }; -#ifdef XFree86LOADER static const char *fbSymbols[] = { - "fbScreenInit", "fbPictureInit", - NULL -}; - -static const char *xf8_32bppSymbols[] = { - "xf86Overlay8Plus32Init", + "fbScreenInit", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", "XAAReverseBitOrder", NULL }; @@ -243,48 +233,43 @@ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", + NULL +}; + +static const char *int10Symbols[] = { + "xf86FreeInt10", + "xf86InitInt10", NULL }; #ifdef XF86DRI static const char *drmSymbols[] = { - "drmAddBufs", "drmAddMap", - "drmAvailable", - "drmCtlAddCommand", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", - "drmMapBufs", - "drmMarkBufs", - "drmUnmapBufs", "drmFreeVersion", "drmGetVersion", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", - "DRILock", - "DRIUnlock", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", "DRIGetSAREAPrivate", - "DRIGetContext", + "DRILock", + "DRIMoveBuffersHelper", "DRIQueryVersion", - "DRIAdjustFrame", - "DRIOpenFullScreen", - "DRICloseFullScreen", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; #endif +#ifdef XFree86LOADER + static MODULESETUPPROTO(tdfxSetup); static XF86ModuleVersionInfo tdfxVersRec = @@ -324,7 +309,7 @@ * might refer to. */ LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, - xf8_32bppSymbols, ramdacSymbols, vbeSymbols, + ramdacSymbols, vbeSymbols, int10Symbols, #ifdef XF86DRI drmSymbols, driSymbols, #endif @@ -388,9 +373,7 @@ TDFXProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; -#ifdef XFree86LOADER if (xf86LoadSubModule(pScrn, "vbe")) -#endif { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); @@ -442,7 +425,7 @@ /* Allocate new ScrnInfoRec and claim the slot */ pScrn = NULL; if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - TDFXPciChipsets, 0, 0, 0, 0, 0))) { + TDFXPciChipsets, NULL, NULL, NULL, NULL, NULL))) { pScrn->driverVersion = TDFX_VERSION; pScrn->driverName = TDFX_DRIVER_NAME; @@ -492,17 +475,29 @@ /* set memory interface delay values and enable refresh */ /* these apply to all RAM vendors */ dramInit1 = 0x0; - if (pTDFX->ChipType==PCI_CHIP_BANSHEE) - dramInit1 |= 7<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; - else - dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; + 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; dramInit1 &= ~SST_MCTL_TYPE_SDRAM; dramInit1 |= dramInit1_strap; - pTDFX->writeLong(pTDFX, DRAMINIT1, dramInit1); + /* Some information about the timing register (for later debugging) */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "DRAMINIT1 read 0x%x, programming 0x%x (not Banshee)\n", + pTDFX->readLong(pTDFX, DRAMINIT1), dramInit1); + + /* + * Here we don't whack the timing register on the Banshee boards as the + * BIOS has done a perfectly good job. As Banshee boards were made by + * different manufacturers we don't touch this, but carry on whacking it + * for Voodoo3 and Voodoo5 boards, as we've never had a problem with them. + * I guess this could be removed for all boards as we probably shouldn't + * be doing this to the V3/V5 boards too. + */ + if (pTDFX->ChipType != PCI_CHIP_BANSHEE) + pTDFX->writeLong(pTDFX, DRAMINIT1, dramInit1); + /* determine memory size from strapping pins (dramInit0 and dramInit1) */ dramInit0_strap = pTDFX->readLong(pTDFX, DRAMINIT0); @@ -591,6 +586,8 @@ pTDFX->numChips++; } } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXFindChips: found %d chip(s)\n", pTDFX->numChips); /* Disable the secondary chips for now */ pTDFX->numChips=1; } @@ -607,24 +604,48 @@ mem0base=pciReadLong(pTDFX->PciTag[0], CFG_MEM0BASE); mem1base=pciReadLong(pTDFX->PciTag[0], CFG_MEM1BASE); initbits=pciReadLong(pTDFX->PciTag[0], CFG_INIT_ENABLE); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXInitChips: numchips = %d\n", pTDFX->numChips); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXInitChips: cfgbits = 0x%08lx, initbits = 0x%08lx\n", + cfgbits, initbits); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXInitChips: mem0base = 0x%08lx, mem1base = 0x%08lx\n", + mem0base, mem1base); mem0size=32*1024*1024; /* Registers are always 32MB */ mem1size=pScrn->videoRam*1024*2; /* Linear mapping is 2x memory */ + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXInitChips: mem0size = 0x%08lx, mem1size = 0x%08lx\n", + mem0size, mem1size); mem0bits=TDFXSizeToCfg(mem0size); mem1bits=TDFXSizeToCfg(mem1size)<<4; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXInitChips: mem0bits = 0x%08lx, mem1bits = 0x%08lx\n", + mem0bits, mem1bits); cfgbits=(cfgbits&~(0xFF))|mem0bits|mem1bits; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXInitChips: cfgbits = 0x%08lx\n", cfgbits); for (i=0; i<pTDFX->numChips; i++) { initbits|=BIT(10); pciWriteLong(pTDFX->PciTag[i], CFG_INIT_ENABLE, initbits); v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND); +#if 0 if (!i) pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x3); else pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x2); +#endif pTDFX->MMIOAddr[i]=mem0base+i*mem0size; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXInitChips: MMIOAddr[%d] = 0x%08lx\n", + i, pTDFX->MMIOAddr[i]); 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, pTDFX->LinearAddr[i]); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "TDFXInitChips: LinearAddr[%d] = 0x%08lx\n", + i, pTDFX->LinearAddr[i]); pTDFX->LinearAddr[i]&=0xFFFFFF00; pciWriteLong(pTDFX->PciTag[i], CFG_PCI_DECODE, cfgbits); initbits&=~BIT(10); @@ -683,9 +704,12 @@ /* Allocate a vgaHWRec */ if (!vgaHWGetHWRec(pScrn)) return FALSE; +#if USE_INT10 #if !defined(__powerpc__) if (xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; + + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Softbooting the board (through the int10 interface).\n"); pInt = xf86InitInt10(pTDFX->pEnt->index); @@ -702,9 +726,11 @@ } } #endif +#endif match=pTDFX->PciInfo=xf86GetPciInfoForEntity(pTDFX->pEnt->index); TDFXFindChips(pScrn, match); + pTDFX->Primary = xf86IsPrimaryPci(pTDFX->PciInfo); if (xf86RegisterResources(pTDFX->pEnt->index, NULL, ResExclusive)) { TDFXFreeRec(pScrn); @@ -714,7 +740,12 @@ * We don't need VGA resources during OPERATING state. However I'm * not sure if they are disabled. */ - xf86SetOperatingState(RES_SHARED_VGA, pTDFX->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(RES_SHARED_VGA, pTDFX->pEnt->index, ResDisableOpr); +#if 0 + pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; + pScrn->racMemFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; +#endif +#if 0 #if 1 /* Is VGA memory disabled during OPERATING state? */ @@ -723,6 +754,7 @@ #else pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; #endif +#endif #if 0 /* @@ -774,7 +806,7 @@ } } - /* We use a programamble clock */ + /* We use a programmable clock */ pScrn->progClock = TRUE; pTDFX->cpp = pScrn->bitsPerPixel/8; @@ -970,13 +1002,14 @@ TDFXFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); if (!xf86ReturnOptValBool(pTDFX->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) { TDFXFreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(xaaSymbols, NULL); } if (!xf86GetOptValBool(pTDFX->Options, OPTION_SHOWCACHE, &(pTDFX->ShowCache))) { @@ -1005,6 +1038,7 @@ xf86LoaderReqSymLists(ramdacSymbols, NULL); } +#if USE_INT10 #if !defined(__powerpc__) /* Load DDC if needed */ /* This gives us DDC1 - we should be able to get DDC2B using i2c */ @@ -1018,11 +1052,14 @@ if (xf86LoadSubModule(pScrn, "vbe")) { xf86MonPtr pMon; vbeInfoPtr pVbe = VBEInit(NULL,pTDFX->pEnt->index); + + xf86LoaderReqSymLists(vbeSymbols, NULL); pMon = vbeDoEDID(pVbe, NULL); vbeFree(pVbe); xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon)); } #endif +#endif if (xf86ReturnOptValBool(pTDFX->Options, OPTION_USE_PIO, FALSE)) { pTDFX->usePIO=TRUE; @@ -1110,42 +1147,34 @@ return TRUE; } -#ifdef DEBUG static void PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs) { #ifdef TRACE int i; TDFXPtr pTDFX; + vgaHWPtr pHW = VGAHWPTR(pScrn); + vgaRegPtr pVga = &VGAHWPTR(pScrn)->ModeReg; + pTDFX = TDFXPTR(pScrn); -#if 0 +#if 1 ErrorF("VGA Registers\n"); -#ifdef VB_PCI_IO - ErrorF("Using PCI I/O Registers\n"); -#endif - ErrorF("MiscOutReg = %x versus %x\n", inb(VGA_REG(0x3cc)), regs->std.MiscOutReg); - ErrorF("Noclock is %d\n", regs->std.NoClock); + ErrorF("MiscOutReg = %x versus %x\n", pHW->readMiscOut(pHW), pVga->MiscOutReg); + ErrorF("EnableReg = %x\n", pHW->readEnable(pHW)); for (i=0; i<25; i++) { - outb(VGA_REG(0x3D4), i); - ErrorF("CRTC[%d]=%d versus %d\n", i, inb(VGA_REG(0x3D5)), regs->std.CRTC[i]); + int x; + x = pHW->readCrtc(pHW, i); + ErrorF("CRTC[%d]=%d versus %d\n", i, x, pVga->CRTC[i]); } - if (!vgaIOBase) - vgaIOBase = (inb(VGA_REG(0x3cc)) & 0x1) ? 0x3D0 : 0x3B0; for (i=0; i<21; i++) { - inb(VGA_REG(vgaIOBase+0xA)); - outb(VGA_REG(0x3C0), i); - ErrorF("Attribute[%d]=%d versus %d\n", i, inb(VGA_REG(0x3C1)), regs->std.Attribute[i]); + ErrorF("Attribute[%d]=%d versus %d\n", i, pHW->readAttr(pHW, i), pVga->Attribute[i]); } - inb(VGA_REG(vgaIOBase+0xA)); - outb(VGA_REG(0x3C0), BIT(5)); for (i=0; i<9; i++) { - outb(VGA_REG(0x3CE), i); - ErrorF("Graphics[%d]=%d versus %d\n", i, inb(VGA_REG(0x3CF)), regs->std.Graphics[i]); + ErrorF("Graphics[%d]=%d versus %d\n", i, pHW->readGr(pHW, i), pVga->Graphics[i]); } for (i=0; i<5; i++) { - outb(VGA_REG(0x3C4), i); - ErrorF("Sequencer[%d]=%d versus %d\n", i, inb(VGA_REG(0x3C5)), regs->std.Sequencer[i]); + ErrorF("Sequencer[%d]=%d versus %d\n", i, pHW->readSeq(pHW, i), pVga->Sequencer[i]); } #endif #if 1 @@ -1153,6 +1182,9 @@ ErrorF("VidCfg = %x versus %x\n", pTDFX->readLong(pTDFX, VIDPROCCFG), regs->vidcfg); ErrorF("DACmode = %x versus %x\n", pTDFX->readLong(pTDFX, DACMODE), regs->dacmode); ErrorF("Vgainit0 = %x versus %x\n", pTDFX->readLong(pTDFX, VGAINIT0), regs->vgainit0); + ErrorF("Vgainit1 = %x versus %x\n", pTDFX->readLong(pTDFX, VGAINIT1), regs->vgainit1); + ErrorF("Miscinit0 = %x versus %x\n", pTDFX->readLong(pTDFX, MISCINIT0), regs->miscinit0); + ErrorF("Miscinit1 = %x versus %x\n", pTDFX->readLong(pTDFX, MISCINIT1), regs->miscinit1); ErrorF("DramInit0 = %x\n", pTDFX->readLong(pTDFX, DRAMINIT0)); ErrorF("DramInit1 = %x\n", pTDFX->readLong(pTDFX, DRAMINIT1)); ErrorF("VidPLL = %x versus %x\n", pTDFX->readLong(pTDFX, PLLCTRL0), regs->vidpll); @@ -1166,7 +1198,6 @@ #endif #endif } -#endif /* * TDFXSave -- @@ -1190,14 +1221,18 @@ * This function will handle creating the data structure and filling * in the generic VGA portion. */ - if (saveFonts) + if (saveFonts && pTDFX->Primary) { + /* Enable legacy VGA to access font memory. */ + dummy = pTDFX->readLong(pTDFX, VGAINIT0); + pTDFX->writeLong(pTDFX, VGAINIT0, dummy & ~SST_VGA0_LEGACY_DECODE); vgaHWSave(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_FONTS); - else + pTDFX->writeLong(pTDFX, VGAINIT0, dummy); + } else vgaHWSave(pScrn, vgaReg, VGA_SR_MODE); tdfxReg->ExtVga[0] = hwp->readCrtc(hwp, 0x1a); tdfxReg->ExtVga[1] = hwp->readCrtc(hwp, 0x1b); - tdfxReg->vgainit0=pTDFX->readLong(pTDFX, VGAINIT0); + tdfxReg->miscinit1=pTDFX->readLong(pTDFX, MISCINIT1); tdfxReg->vidcfg=pTDFX->readLong(pTDFX, VIDPROCCFG); tdfxReg->vidpll=pTDFX->readLong(pTDFX, PLLCTRL0); tdfxReg->dacmode=pTDFX->readLong(pTDFX, DACMODE); @@ -1219,6 +1254,7 @@ } while (count++<100 && dummy!=i); tdfxReg->dactable[i]=TDFXReadLongMMIO(pTDFX, DACDATA); } + PrintRegisters(pScrn, tdfxReg); } static void @@ -1230,6 +1266,17 @@ TDFXTRACE("TDFXSave start\n"); hwp = VGAHWPTR(pScrn); pTDFX = TDFXPTR(pScrn); + /* Make sure VGA functionality is enabled */ + pTDFX->SavedReg.vgainit0=pTDFX->readLong(pTDFX, VGAINIT0); +#if 0 + pTDFX->SavedReg.vgainit1=pTDFX->readLong(pTDFX, VGAINIT1); +#endif + pTDFX->writeLong(pTDFX, VGAINIT0, pTDFX->ModeReg.vgainit0); +#if 0 + pTDFX->writeLong(pTDFX, VGAINIT1, pTDFX->ModeReg.vgainit1); +#endif + vgaHWEnable(hwp); + DoSave(pScrn, &hwp->SavedReg, &pTDFX->SavedReg, TRUE); } @@ -1248,9 +1295,13 @@ vgaHWProtect(pScrn, TRUE); - if (restoreFonts) + if (restoreFonts && pTDFX->Primary) { + /* Enable legacy VGA to access font memory. */ + dummy = pTDFX->readLong(pTDFX, VGAINIT0); + pTDFX->writeLong(pTDFX, VGAINIT0, dummy & ~SST_VGA0_LEGACY_DECODE); vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS|VGA_SR_MODE); - else + pTDFX->writeLong(pTDFX, VGAINIT0, dummy); + } else vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); hwp->writeCrtc(hwp, 0x1a, tdfxReg->ExtVga[0]); @@ -1265,14 +1316,12 @@ TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP0MAX, tdfxReg->clip0max); 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 { @@ -1285,8 +1334,15 @@ dummy=TDFXReadLongMMIO(pTDFX, DACDATA); } while (count++<100 && dummy!=tdfxReg->dactable[i]); } + pTDFX->writeLong(pTDFX, VGAINIT0, tdfxReg->vgainit0); +#if 0 + pTDFX->writeLong(pTDFX, VGAINIT1, tdfxReg->vgainit1); + pTDFX->writeLong(pTDFX, MISCINIT1, tdfxReg->miscinit1); +#endif + vgaHWProtect(pScrn, FALSE); pTDFX->sync(pScrn); + PrintRegisters(pScrn, tdfxReg); } static void @@ -1415,7 +1471,102 @@ } #endif +#if 0 static Bool +TDFXInitWithBIOSData(ScrnInfoPtr pScrn) +{ + TDFXPtr pTDFX; + unsigned char *bios = NULL; + int offset1, offset2; + int i; + CARD32 uint[9]; + + pTDFX=TDFXPTR(pScrn); + + if (pTDFX->initDone) + return TRUE; + + if (pTDFX->Primary) { + uint[0] = pTDFX->readLong(pTDFX, PCIINIT0); + uint[1] = pTDFX->readLong(pTDFX, MISCINIT0); + uint[2] = pTDFX->readLong(pTDFX, MISCINIT1); + uint[3] = pTDFX->readLong(pTDFX, DRAMINIT0); + uint[4] = pTDFX->readLong(pTDFX, DRAMINIT1); + uint[5] = pTDFX->readLong(pTDFX, AGPINIT); + uint[6] = pTDFX->readLong(pTDFX, PLLCTRL1); + uint[7] = pTDFX->readLong(pTDFX, PLLCTRL2); + for (i = 0; i < 8; i++) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Primary UINT32[%d] is 0x%08lx\n", i, uint[i]); + } + return TRUE; + } + +#define T_B_SIZE (64 * 1024) + bios = xcalloc(T_B_SIZE, 1); + if (!bios) + return FALSE; + + if (!xf86ReadPciBIOS(0, pTDFX->PciTag[0], 1, bios, T_B_SIZE)) { +#if 0 + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Bad BIOS read.\n"); + xfree(bios); + return FALSE; +#endif + } + + if (bios[0] != 0x55 || bios[1] != 0xAA) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Bad BIOS signature.\n"); + xfree(bios); + return FALSE; + } + + offset1 = bios[0x50] | (bios[0x51] << 8); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offset 1 is (0x%04x)\n", offset1); + offset2 = bios[offset1] | (bios[offset1 + 1] << 8); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offset 2 is (0x%04x)\n", offset2); + + for (i = 0; i < 9; i++) { + int o; + + o = offset2 + i * 4; + uint[i] = bios[o] | (bios[o+1] << 8) | (bios[o+2] << 16) | (bios[o+3] << 24); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UINT32[%d] is 0x%08lx\n", i, uint[i]); + } + +#if 1 + uint[0] = 0x0584fb04; + uint[1] = 0x00000000; + uint[2] = 0x03000001; + uint[3] = 0x0c17a9e9; + uint[4] = 0x00202031; + uint[5] = 0x8000049e; + uint[6] = 0x00003a05; + uint[7] = 0x00000c00; +#endif + + pTDFX->writeLong(pTDFX, PCIINIT0, uint[0]); + pTDFX->writeLong(pTDFX, MISCINIT0, uint[1]); + pTDFX->writeLong(pTDFX, MISCINIT1, uint[2]); + pTDFX->writeLong(pTDFX, DRAMINIT0, uint[3]); + pTDFX->writeLong(pTDFX, DRAMINIT1, uint[4]); + pTDFX->writeLong(pTDFX, AGPINIT, uint[5]); + pTDFX->writeLong(pTDFX, PLLCTRL1, uint[6]); + pTDFX->writeLong(pTDFX, PLLCTRL2, uint[7]); +#if 0 + pTDFX->writeLong(pTDFX, DRAMCOMMAND, uint[8]); +#endif + + /* reset */ + pTDFX->writeLong(pTDFX, MISCINIT0, 0xF3); + pTDFX->writeLong(pTDFX, MISCINIT0, uint[1]); + + xfree(bios); + return TRUE; +} +#endif + + +static Bool TDFXInitVGA(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; @@ -1425,17 +1576,22 @@ pTDFX=TDFXPTR(pScrn); if (pTDFX->initDone) return TRUE; pTDFX->initDone=TRUE; + tdfxReg = &pTDFX->ModeReg; tdfxReg->vgainit0 = 0; tdfxReg->vgainit0 |= SST_VGA0_EXTENSIONS; tdfxReg->vgainit0 |= SST_WAKEUP_3C3 << SST_VGA0_WAKEUP_SELECT_SHIFT; - if (pTDFX->usePIO) { - tdfxReg->vgainit0 |= SST_VGA0_ENABLE_DECODE << SST_VGA0_LEGACY_DECODE_SHIFT; - } +#if USE_PCIVGAIO + tdfxReg->vgainit0 |= SST_VGA0_LEGACY_DECODE; +#endif tdfxReg->vgainit0 |= SST_ENABLE_ALT_READBACK << SST_VGA0_CONFIG_READBACK_SHIFT; tdfxReg->vgainit0 |= SST_CLUT_SELECT_8BIT << SST_VGA0_CLUT_SELECT_SHIFT; tdfxReg->vgainit0 |= BIT(12); +#if 0 + tdfxReg->vgainit1 |= 0; + tdfxReg->miscinit1 = 0; +#endif tdfxReg->vidcfg = SST_VIDEO_PROCESSOR_EN | SST_CURSOR_X11 | SST_DESKTOP_EN | (pTDFX->cpp-1)<<SST_DESKTOP_PIXEL_FORMAT_SHIFT; @@ -1460,7 +1616,6 @@ TDFXTRACE("TDFXSetMode start\n"); - TDFXInitVGA(pScrn); pTDFX = TDFXPTR(pScrn); tdfxReg = &pTDFX->ModeReg; pVga = &VGAHWPTR(pScrn)->ModeReg; @@ -1784,10 +1939,14 @@ } /* Give the cmd fifo at least */ /* CMDFIFO_PAGES pages, but no more than */ - /* 255. We give 4096 bytes to the cursor */ - fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12; + /* 64. NOTE: Don't go higher than 64, as */ + /* there is suspect code in Glide3 ! */ + fifoSize = ((64 <= CMDFIFO_PAGES) ? 64 : CMDFIFO_PAGES) << 12; + + /* We give 4096 bytes to the cursor */ cursorSize = 4096; pTDFX->cursorOffset = 0; + pTDFX->fifoOffset = pTDFX->cursorOffset + cursorSize; pTDFX->fifoSize = fifoSize; /* Now, place the front buffer, forcing */ @@ -1859,7 +2018,9 @@ TDFXPtr pTDFX; VisualPtr visual; BoxRec MemBox; +#ifdef XF86DRI MessageType driFrom = X_DEFAULT; +#endif int scanlines; TDFXTRACE("TDFXScreenInit start\n"); @@ -1871,8 +2032,16 @@ pScrn->memPhysBase = (int)pTDFX->LinearAddr[0]; if (!pTDFX->usePIO) TDFXSetMMIOAccess(pTDFX); + +#if USE_PCIVGAIO + hwp->PIOOffset = pTDFX->PIOBase[0] - 0x300; +#endif vgaHWGetIOBase(hwp); - if (!vgaHWMapMem(pScrn)) return FALSE; + /* Map VGA memory only for primary cards (to save/restore textmode data). */ + if (pTDFX->Primary) { + if (!vgaHWMapMem(pScrn)) + return FALSE; + } pTDFX->stride = pScrn->displayWidth*pTDFX->cpp; @@ -1880,8 +2049,18 @@ pTDFX->pixmapCacheLinesMin = ((720*480*pTDFX->cpp) + pTDFX->stride - 1)/pTDFX->stride; + if (pTDFX->ChipType > PCI_CHIP_VOODOO3) { + if ((pTDFX->pixmapCacheLinesMin + pScrn->virtualY) > 4095) + pTDFX->pixmapCacheLinesMin = 4095 - pScrn->virtualY; + } else { + if ((pTDFX->pixmapCacheLinesMin + pScrn->virtualY) > 2047) + pTDFX->pixmapCacheLinesMin = 2047 - pScrn->virtualY; + } + allocateMemory(pScrn); + pScrn->fbOffset = pTDFX->fbOffset; + #if 0 if (pTDFX->numChips>1) { if (xf86ReturnOptValBool(pTDFX->Options, OPTION_NO_SLI, FALSE)) { @@ -1919,8 +2098,8 @@ * 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); + "Minimum %d, Maximum %d lines of offscreen memory available\n", + pTDFX->pixmapCacheLinesMin, pTDFX->pixmapCacheLinesMax); MemBox.y1 = 0; MemBox.x1 = 0; @@ -1929,6 +2108,10 @@ pTDFX->maxClip = MemBox.x2 | (MemBox.y2 << 16); +#if 0 + TDFXInitWithBIOSData(pScrn); +#endif + TDFXInitVGA(pScrn); TDFXSave(pScrn); if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -1970,7 +2153,6 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; - fbPictureInit (pScreen, 0, 0); break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1992,6 +2174,9 @@ } } } + + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); xf86SetBlackWhitePixels(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c:1.4 Thu Apr 5 17:29:17 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c Sat Oct 27 23:33:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.4 2001/04/05 21:29:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.5 2001/10/28 03:33:50 tsi Exp $ */ /* Voodoo Banshee driver version 1.0.2 @@ -60,7 +60,7 @@ #if X_BYTE_ORDER == X_BIG_ENDIAN static unsigned int TDFXSwap(TDFXPtr pTDFX, unsigned int val) { switch (pTDFX->cpp) { - case 1: + default: return val; case 2: return ((val & 0x00ff00ff) << 8) | Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c diff -u 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.16 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c:1.15.2.1 Tue May 22 17:25:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c Mon May 21 17:43:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.15.2.1 2001/05/22 21:25:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.16 2001/05/21 21:43:55 dawes Exp $ */ #include "xf86.h" Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h diff -u 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.11 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h:1.9.2.1 Tue May 22 17:25:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h Tue Jun 5 11:54:15 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.9.2.1 2001/05/22 21:25:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.11 2001/06/05 15:54:15 alanh Exp $ */ #ifndef _TDFX_FIFO_H_ @@ -11,7 +11,7 @@ typedef short int16; typedef char int8; -#define CMDFIFO_PAGES 255 +#define CMDFIFO_PAGES 64 #define PROPSAREADATA \ volatile int fifoPtr; \ Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c diff -u 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.15 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c:1.10.2.1 Tue May 22 17:25:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c Tue Jul 31 20:44:54 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.10.2.1 2001/05/22 21:25:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.15 2001/08/01 00:44:54 tsi Exp $ */ #include "xf86.h" #include "tdfx.h" @@ -32,6 +32,9 @@ #define TDFX_MAX_OVERLAY_PORTS 1 #define TDFX_MAX_TEXTURE_PORTS 32 +#define GET_PORT_PRIVATE(pScrn) \ + (TDFXPortPrivPtr)((TDFXPTR(pScrn))->overlayAdaptor->pPortPrivates[0].ptr) + /* Doesn't matter what screen we use */ #define DummyScreen screenInfo.screens[0] @@ -62,6 +65,8 @@ static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); +static void TDFXInitOffscreenImages(ScreenPtr); + /* * ADAPTOR INFORMATION */ @@ -127,13 +132,13 @@ if(pTDFX->cpp == 1) return; - /* Start with the generic adaptors */ - num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); - if(!pTDFX->AccelInfoRec || !pTDFX->AccelInfoRec->FillSolidRects) return; if (!pTDFX->TextureXvideo) { + /* Offscreen support for Overlay only */ + TDFXInitOffscreenImages(pScreen); + /* Overlay adaptor */ newAdaptor = TDFXSetupImageVideoOverlay(pScreen); } else { @@ -141,15 +146,23 @@ newAdaptor = TDFXSetupImageVideoTexture(pScreen); } - /* Add the adaptor to the list */ + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + if(newAdaptor) { - newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) { - if (num_adaptors) memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } + if (!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } } if(num_adaptors) @@ -994,7 +1007,7 @@ buf += (top * srcPitch) + left; nlines = ((yb + 0xffff) >> 16) - top; dst_start += left; - TDFXCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels << 1); + TDFXCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); break; } @@ -1124,3 +1137,207 @@ return new_linear; } +/****************** Offscreen stuff ***************/ + +typedef struct { + FBLinearPtr linear; + Bool isOn; +} OffscreenPrivRec, * OffscreenPrivPtr; + +static int +TDFXAllocateSurface( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +){ + TDFXPtr pTDFX = TDFXPTR(pScrn); + FBLinearPtr linear; + int pitch, fbpitch, size, bpp; + OffscreenPrivPtr pPriv; + + if((w > 2048) || (h > 2048)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + bpp = pScrn->bitsPerPixel >> 3; + fbpitch = bpp * pScrn->displayWidth; + size = ((pitch * h) + bpp - 1) / bpp; + + if(!(linear = TDFXAllocateMemoryLinear(pScrn, NULL, size))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if(!(surface->pitches = xalloc(sizeof(int)))) { + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if(!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + + pPriv->linear = linear; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = pTDFX->fbOffset + (linear->offset * bpp); + surface->devPrivate.ptr = (pointer)pPriv; + + return Success; +} + +static int +TDFXStopSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) { + TDFXPtr pTDFX = TDFXPTR(surface->pScrn); + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + pPriv->isOn = FALSE; + } + + return Success; +} + + +static int +TDFXFreeSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) + TDFXStopSurface(surface); + xf86FreeOffscreenLinear(pPriv->linear); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +TDFXGetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +){ + return TDFXGetPortAttributeOverlay(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} + +static int +TDFXSetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +){ + return TDFXSetPortAttributeOverlay(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} + +static int +TDFXDisplaySurface( + XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + RegionPtr clipBoxes +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr portPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if(!TDFXClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) + { + return Success; + } + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + +#if 0 + TDFXResetVideoOverlay(pScrn); +#endif + + TDFXDisplayVideoOverlay(pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], + x1, y1, x2, &dstBox, src_w, src_h, drw_w, drw_h); + + (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, portPriv->colorKey, + GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + + pPriv->isOn = TRUE; + /* we've prempted the XvImage stream so set its free timer */ + if(portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + pTDFX->VideoTimerCallback = TDFXVideoTimerCallback; + } + + return Success; +} + +static void +TDFXInitOffscreenImages(ScreenPtr pScreen) +{ + XF86OffscreenImagePtr offscreenImages; + + /* need to free this someplace */ + if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; + + offscreenImages[0].image = &OverlayImages[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | + VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = TDFXAllocateSurface; + offscreenImages[0].free_surface = TDFXFreeSurface; + offscreenImages[0].display = TDFXDisplaySurface; + offscreenImages[0].stop = TDFXStopSurface; + offscreenImages[0].setAttribute = TDFXSetSurfaceAttribute; + offscreenImages[0].getAttribute = TDFXGetSurfaceAttribute; + offscreenImages[0].max_width = 2048; + offscreenImages[0].max_height = 2048; + offscreenImages[0].num_attributes = 2; + offscreenImages[0].attributes = OverlayAttributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} Index: xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h:1.17 xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h:1.17 Fri May 4 15:05:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h Wed Nov 21 17:32:58 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.17 2001/05/04 19:05:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h,v 1.18 2001/11/21 22:32:58 alanh Exp $ */ #ifndef _TGA_H_ #define _TGA_H_ @@ -52,6 +52,7 @@ unsigned char * IOBase; unsigned char * ClkBase; /* TGA2 */ unsigned char * DACBase; /* TGA2 */ + unsigned char * HACKBase; /* TGA2 */ long FbMapSize; unsigned long regOffset; Bool NoAccel; @@ -135,6 +136,8 @@ Bool DEC21030Init(ScrnInfoPtr pScrn, DisplayModePtr mode); void write_av9110(ScrnInfoPtr pScrn, unsigned int *); void TGA2SetupMode(ScrnInfoPtr pScrn); +void Ibm561Init(TGAPtr pTga); +void Bt463Init(TGAPtr pTga); /* tga_accel.c */ Bool DEC21030AccelInit(ScreenPtr pScreen); @@ -164,6 +167,8 @@ void IBM561ramdacSave(ScrnInfoPtr pScrn, unsigned char *data); void IBM561ramdacHWInit(ScrnInfoPtr pScrn); void IBM561ramdacRestore(ScrnInfoPtr pScrn, unsigned char *data); +unsigned char IBM561ReadReg(ScrnInfoPtr pScrn, CARD32 reg); +void IBM561WriteReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char data); /* tga_cursor.c */ Bool TGAHWCursorInit(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.12 xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c:1.12 Mon Mar 19 06:00:54 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c Wed Nov 21 17:32:59 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.12 2001/03/19 11:00:54 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.15 2001/11/21 22:32:59 alanh Exp $ */ /* * Copyright 1996,1997 by Alan Hourihane, Wigan, England. @@ -53,7 +53,7 @@ #define CE_BUFSIZE 256 -#define FB_OFFSET(x, y) (((y) * pScrn->displayWidth * (pTga->Bpp)) + (x) * pTga->Bpp) +#define FB_OFFSET(x, y) (((long)(y) * pScrn->displayWidth * (pTga->Bpp)) + (long)(x) * pTga->Bpp) /* prototypes */ @@ -152,7 +152,7 @@ BIT_ORDER_IN_BYTE_LSBFIRST; TGA_AccelInfoRec->NumScanlineColorExpandBuffers = 1; - pTga->buffers[0] = (CARD32 *)malloc(CE_BUFSIZE); + pTga->buffers[0] = (CARD32 *)xnfalloc(CE_BUFSIZE); TGA_AccelInfoRec->ScanlineColorExpandBuffers = (unsigned char **)pTga->buffers; TGA_AccelInfoRec->SetupForScanlineCPUToScreenColorExpandFill = @@ -595,7 +595,7 @@ */ int i = 0; - void (*copy_func)(); + void (*copy_func)(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w); #ifdef PROFILE unsigned int stop, start; #endif @@ -617,14 +617,10 @@ TGA_FAST_WRITE_REG(pTga->current_rop, TGA_RASTEROP_REG); TGA_FAST_WRITE_REG(pTga->current_planemask, TGA_PLANEMASK_REG); -#if 1 if(x2 > x1 && (x1 + w) > x2) copy_func = TGACopyLineBackwards; else copy_func = TGACopyLineForwards; -#else - copy_func = TGACopyLineForwards; -#endif TGA_SAVE_OFFSET(); if(pTga->blitdir == BLIT_FORWARDS) { @@ -657,7 +653,8 @@ int read; unsigned long source_address, destination_address; unsigned int mask_source, mask_destination; - unsigned int cando, cando_mask; + int cando; + unsigned int cando_mask; int source_align, destination_align; int pixel_shift; #ifdef PROFILE @@ -754,7 +751,8 @@ unsigned long a1, a2; unsigned long source_address, destination_address; unsigned int mask_source, mask_destination; - unsigned int cando, cando_mask; + int cando; + unsigned int cando_mask; int source_align, destination_align; int pixel_shift; int read; @@ -814,7 +812,7 @@ tmp_dest_mask <<= 8 / pTga->Bpp; pixel_shift = (8 - source_align) + destination_align; #if 0 - ErrorF("CPY-BWD - premature copy: sa = %d, da = %d, ps =%d\n", + ErrorF("CPY-BWD - preliminary copy: sa = %d, da = %d, ps =%d\n", source_align, destination_align, pixel_shift); #endif TGA_FAST_WRITE_REG(pixel_shift, TGA_PIXELSHIFT_REG); Index: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c:1.13 Sat Feb 17 09:18:30 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c Sat Oct 27 23:33:50 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.13 2001/02/17 14:18:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c,v 1.14 2001/10/28 03:33:50 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -643,7 +643,6 @@ ICS9110ClockSelect(ScrnInfoPtr pScrn, int freq) { unsigned int temp, temp1[6]; - int i; /* There lies an ICS9110 Clock Generator. */ /* ICS9110_CalcClockBits(freq, pll_bits); */ Index: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c:1.54 xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c:1.58 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c:1.54 Fri May 4 15:05:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c Wed Nov 21 17:33:00 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.54 2001/05/04 19:05:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.58 2001/11/21 22:33:00 alanh Exp $ */ /* everybody includes these */ #include "xf86.h" @@ -175,6 +175,34 @@ { -1 } }; +static const char *ramdacSymbols[] = { + "BTramdacProbe", + "RamDacCreateInfoRec", + "RamDacDestroyInfoRec", + "RamDacFreeRec", + "RamDacGetHWIndex", + "RamDacHandleColormaps", + "RamDacInit", + "xf86CreateCursorInfoRec", + "xf86InitCursor", + NULL +}; + +static const char *xaaSymbols[] = { + "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAGCIndex", + "XAAInit", + "XAAScreenIndex", + NULL +}; + +static const char *fbSymbols[] = { + "fbPictureInit", + "fbScreenInit", + NULL +}; + #ifdef XFree86LOADER static MODULESETUPPROTO(tgaSetup); @@ -209,6 +237,8 @@ * by calling LoadSubModule(). */ + LoaderRefSymLists(ramdacSymbols, fbSymbols, xaaSymbols, NULL); + /* * The return value must be non-NULL on success even though there * is no TearDownProc. @@ -426,7 +456,6 @@ MessageType from; int i; ClockRangePtr clockRanges; - char *mod = NULL; pointer Base; if (flags & PROBE_DETECT) return FALSE; @@ -448,6 +477,8 @@ if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); + /* Allocate the TGARec driverPrivate */ if (!TGAGetRec(pScrn)) { return FALSE; @@ -758,17 +789,21 @@ pTga->FbMapSize = pScrn->videoRam * 1024; - if (mod && xf86LoadSubModule(pScrn, "fb") == NULL) { + if (xf86LoadSubModule(pScrn, "fb") == NULL) { TGAFreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(fbSymbols, NULL); + /* Load XAA if needed */ - if (!pTga->NoAccel || pTga->HWCursor) + if (!pTga->NoAccel || pTga->HWCursor) { if (!xf86LoadSubModule(pScrn, "xaa")) { TGAFreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(xaaSymbols, NULL); + } /********************* @@ -1000,6 +1035,27 @@ if (pTga->DACBase == NULL) return FALSE; + /* + * This is a hack specifically for the TGA2 code, as it sometimes + * calculates/uses addresses in TGA2 memory which are NOT mmapped + * by the normal framebuffer code above. This most frequently occurs + * when displaying something close to the top-left corner (in the + * routines CopyLine{Forwards,Backwards}. + * + * This could most likely also be fixed by further modifying the + * code, but it (the code) is ugly enough already... ;-} + * + * So, the workaround is to simply mmap an additional PAGE of + * framebuffer memory in front of the normal mmap to prevent + * SEGVs from happening. + */ + pTga->HACKBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + pTga->PciTag, + (unsigned long)pTga->FbAddress - getpagesize(), + getpagesize()); + if (pTga->HACKBase == NULL) + return FALSE; + return TRUE; } @@ -1030,6 +1086,9 @@ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pTga->DACBase, 0x10000); pTga->DACBase = NULL; + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pTga->HACKBase, getpagesize()); + pTga->HACKBase = NULL; + return TRUE; } @@ -1265,8 +1324,6 @@ 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, @@ -1278,10 +1335,6 @@ if (!ret) return FALSE; - miInitializeBackingStore(pScreen); - xf86SetBackingStore(pScreen); - xf86SetSilkenMouse(pScreen); - xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -1298,6 +1351,14 @@ } } } + + /* must be after RGB ordering fixed */ + + fbPictureInit (pScreen, 0, 0); + + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); /* we should ALWAYS do this */ if (pScrn->bitsPerPixel == 8) { Index: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.15 Thu Feb 15 12:59:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c Sat Oct 27 23:33:51 2001 @@ -23,7 +23,7 @@ * * Trident Blade3D accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.15 2001/02/15 17:59:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.17 2001/10/28 03:33:51 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -41,6 +41,7 @@ #include "xaalocal.h" static void BladeSync(ScrnInfoPtr pScrn); +#if 0 static void BladeSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void BladeSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, @@ -54,6 +55,7 @@ static void BladeSubsequentDashedTwoPointLine( ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags, int phase); +#endif static void BladeSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void BladeSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, @@ -85,12 +87,14 @@ static void BladeSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h); +#if 0 static void BladeSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int rop, unsigned int planemask, int trans_col); static void BladeSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h); +#endif static void BladeSetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); @@ -147,6 +151,18 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); BoxRec AvailFBArea; + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * + pScrn->bitsPerPixel / 8); + if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; + + xf86InitFBManager(pScreen, &AvailFBArea); + + if (pTrident->NoAccel) + return FALSE; + pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); if (!infoPtr) return FALSE; @@ -237,15 +253,6 @@ infoPtr->ImageWriteBase = pTrident->IOBase + 0x10000; infoPtr->ImageWriteRange = 0x10000; - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; - - xf86InitFBManager(pScreen, &AvailFBArea); - return(XAAInit(pScreen, infoPtr)); } @@ -337,6 +344,7 @@ pTrident->Clipping = FALSE; } +#if 0 static void BladeSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) @@ -393,7 +401,6 @@ BLADE_OUT(0x2148, ((-(dmin+e)&0xfff) << 16)); } - static void BladeSubsequentSolidTwoPointLine( ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags) @@ -462,6 +469,7 @@ if (flags & OMIT_LAST) BladeDisableClipping(pScrn); } +#endif static void BladeSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, @@ -620,6 +628,7 @@ BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff)); } +#if 0 static void BladeSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, @@ -657,6 +666,7 @@ TGUI_COMMAND(GE_BLT); CHECKCLIPPING; } +#endif static void BladeSetupForImageWrite( ScrnInfoPtr pScrn, 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.4.1 xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c:1.21.4.1 Thu May 24 05:37:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c Sat Oct 27 23:33:51 2001 @@ -23,7 +23,7 @@ * * Trident 3DImage' accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c,v 1.21.4.1 2001/05/24 09:37:41 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c,v 1.24 2001/10/28 03:33:51 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -42,11 +42,13 @@ static void ImageSync(ScrnInfoPtr pScrn); static void ImageSyncClip(ScrnInfoPtr pScrn); +#if 0 static void ImageSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void ImageSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, int x, int y, int dmaj, int dmin, int e, int len, int octant); +#endif static void ImageSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void ImageSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, @@ -67,12 +69,14 @@ static void ImageSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h); +#if 0 static void ImageSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int rop, unsigned int planemask, int trans_col); static void ImageSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h); +#endif static void ImageSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); @@ -132,6 +136,18 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); BoxRec AvailFBArea; + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * + pScrn->bitsPerPixel / 8); + if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; + + xf86InitFBManager(pScreen, &AvailFBArea); + + if (pTrident->NoAccel) + return FALSE; + pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); if (!infoPtr) return FALSE; @@ -236,15 +252,6 @@ infoPtr->ImageWriteBase = pTrident->IOBase + 0x10000; } - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; - - xf86InitFBManager(pScreen, &AvailFBArea); - return(XAAInit(pScreen, infoPtr)); } @@ -348,6 +355,7 @@ pTrident->Clipping = FALSE; } +#if 0 static void ImageSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) @@ -398,6 +406,7 @@ if (!pTrident->UsePCIRetry) ImageSyncClip(pScrn); } +#endif static void ImageSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, @@ -503,6 +512,7 @@ ImageSyncClip(pScrn); } +#if 0 static void ImageSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, @@ -536,6 +546,7 @@ if (!pTrident->UsePCIRetry) ImageSyncClip(pScrn); } +#endif static void ImageSetupForScanlineCPUToScreenColorExpandFill( Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.40 xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.51 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.40 Tue May 15 06:19:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h Sat Jan 12 19:15:52 2002 @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.40 2001/05/15 10:19:41 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.51 2002/01/13 00:15:52 alanh Exp $ */ #ifndef _TRIDENT_H_ #define _TRIDENT_H_ @@ -34,6 +34,7 @@ #include "xf86i2c.h" #include "xf86int10.h" #include "shadowfb.h" +#include "shadow.h" #include "xf86xv.h" typedef struct { @@ -136,9 +137,18 @@ XF86VideoAdaptorPtr adaptor; int videoKey; int hsync; + int hsync_rskew; int vsync; + int vsync_bskew; + CARD32 videoFlags; + int keyOffset; #endif + int OverrideHsync; + int OverrideVsync; + int OverrideBskew; + int OverrideRskew; OptionInfoPtr Options; + Bool shadowNew; } TRIDENTRec, *TRIDENTPtr; typedef struct { @@ -166,13 +176,22 @@ int mode; } biosMode; +typedef struct { + int x_res; + int y_res; + CARD8 GR5a; + CARD8 GR5c; +} newModes; + /* Prototypes */ Bool TRIDENTClockSelect(ScrnInfoPtr pScrn, int no); Bool TRIDENTSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); void TRIDENTAdjustFrame(int scrnIndex, int x, int y, int flags); Bool TRIDENTDGAInit(ScreenPtr pScreen); - +Bool TRIDENTI2CInit(ScreenPtr pScreen); +void TRIDENTInitVideo(ScreenPtr pScreen); +void TRIDENTResetVideo(ScrnInfoPtr pScrn); unsigned int Tridentddc1Read(ScrnInfoPtr pScrn); void TVGARestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg); void TVGASave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg); @@ -206,8 +225,7 @@ void TridentFindClock(ScrnInfoPtr pScrn, int clock); float CalculateMCLK(ScrnInfoPtr pScrn); void TRIDENTRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void TRIDENTShadowUpdate (ScreenPtr pScreen, PixmapPtr pShadow, - RegionPtr damage); +void TRIDENTShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf); void TRIDENTPointerMoved(int index, int x, int y); void TRIDENTRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void TRIDENTRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); @@ -239,9 +257,9 @@ TGUI9660, TGUI9680, PROVIDIA9682, - PROVIDIA9685, CYBER9382, CYBER9385, + PROVIDIA9685, CYBER9388, CYBER9397, CYBER9397DVD, @@ -257,8 +275,9 @@ CYBERBLADEAI1, CYBERBLADEAI1D, CYBERBLADEE4, - CYBERBLADEXP, - CYBERBLADEXPm + CYBERBLADEXPm8, + CYBERBLADEXPm16, + CYBERBLADEXPAI1 } TRIDENTType; #define UseMMIO (pTrident->NoMMIO == FALSE) @@ -285,8 +304,9 @@ (pTrident->Chipset == CYBERBLADEAI1) || \ (pTrident->Chipset == CYBERBLADEAI1D) || \ (pTrident->Chipset == BLADE3D) || \ - (pTrident->Chipset == CYBERBLADEXP) || \ - (pTrident->Chipset == CYBERBLADEXPm)) + (pTrident->Chipset == CYBERBLADEXPAI1) || \ + (pTrident->Chipset == CYBERBLADEXPm8) || \ + (pTrident->Chipset == CYBERBLADEXPm16)) /* * Trident DAC's @@ -294,6 +314,14 @@ #define TKD8001 0 #define TGUIDAC 1 + +/* + * Video Flags + */ + +#define VID_ZOOM_INV 0x1 +#define VID_ZOOM_MINI 0x2 +#define VID_OFF_SHIFT_4 0x4 #endif /* _TRIDENT_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man:1.2 Sat Jan 27 13:20:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man Sun Jan 13 16:06:59 2002 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man,v 1.2 2001/01/27 18:20:55 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man,v 1.10 2002/01/13 21:06:59 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH TRIDENT __drivermansuffix__ __vendorversion__ @@ -14,12 +14,10 @@ .fi .SH DESCRIPTION .B trident -is an XFree86 driver for Trident video cards. The driver is fully +is an XFree86 driver for Trident video cards. The driver is 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. +1, 4, 8, 15, 16, and 24. Multi-head configurations are supported. +The XvImage extension is supported on TGUI96xx and greater cards. .SH SUPPORTED HARDWARE The .B trident @@ -28,7 +26,9 @@ .TP 12 .B Blade Blade3D, CyberBlade series i1, i7 (DSTN), i1, i1 (DSTN), Ai1, Ai1 (DSTN), -CyberBlade/e4 +CyberBlade/e4, CyberBladeXPm8, CyberBladeXPm16, CyberBladeAi1/XP, BladeXP +NOTE: The XP series are NOT hardware accelerated due to the specifications +of the chip not being released. .TP 12 .B Image 3DImage975, 3DImage985, Cyber9520, Cyber9525, Cyber9397, Cyber9397DVD @@ -39,8 +39,9 @@ .B TGUI 9440AGi, 9660, 9680 .TP 12 -.B 8900 -8900D (ISA) +.B ISA/VLBus +8900C, 8900D, 9000, 9200CXr, Cyber9320, 9400CXi, 9440AGi +These cards have been ported but need furthur testing and may not work. .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this @@ -69,17 +70,38 @@ 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. +Enable or disable use of the shadow framebuffer layer. 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. +.TP +.BI "Option \*qXvHsync\*q \*q" integer \*q +Override the default Horizontal-sync value for the Xv extension. +This is used to center the Xv image on the screen. By default the values +are assigned based on the video card. +Default: 0. +.TP +.BI "Option \*qXvVsync\*q \*q" integer \*q +Override the default Vertical-sync value for the Xv extension. +This is used to center the Xv image on the screen. By default the values +are assigned based on the video card. +Default: 0. +.BI "Option \*qXvBskew\*q \*q" integer \*q +Override the default Bottom skew value for the Xv extension. +This is used to extend the Xv image on the screen at the bottom. By +default the values are assigned based on the video card. +Default: 0. +.TP +.BI "Option \*qXvRskew\*q \*q" integer \*q +Override the default Right skew value for the Xv extension. +This is used to extend the Xv image on the screen at the right. By +default the values are assigned based on the video card. +Default: 0. .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHOR Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.20 Sun Jan 14 16:36:21 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c Mon Sep 24 07:19:10 2001 @@ -23,7 +23,7 @@ * * Trident accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.20 2001/01/14 21:36:21 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.22 2001/09/24 11:19:10 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -71,12 +71,14 @@ static void TridentSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h); +#if 0 static void TridentSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int rop, unsigned int planemask, int trans_col); static void TridentSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, int patterny, int x, int y, int w, int h); +#endif static void TridentSetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, int rop, @@ -115,17 +117,30 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); BoxRec AvailFBArea; + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * + pScrn->bitsPerPixel / 8); + + if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; + + xf86InitFBManager(pScreen, &AvailFBArea); + + if (pTrident->NoAccel) + return FALSE; + pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); if (!infoPtr) return FALSE; - pTrident->InitializeAccelerator = TridentInitializeAccelerator; - TridentInitializeAccelerator(pScrn); - if (!(pTrident->Chipset == TGUI9440AGi && pScrn->bitsPerPixel > 8)) infoPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER; + pTrident->InitializeAccelerator = TridentInitializeAccelerator; + TridentInitializeAccelerator(pScrn); + infoPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES; infoPtr->Sync = TridentSync; @@ -202,16 +217,6 @@ infoPtr->SubsequentColorExpandScanline = TridentSubsequentColorExpandScanline; - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - - if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; - - xf86InitFBManager(pScreen, &AvailFBArea); - return(XAAInit(pScreen, infoPtr)); } @@ -292,15 +297,6 @@ TGUI_CKEY(transparency_color); } - if (rop == GXcopy) { - if ((pTrident->Chipset == PROVIDIA9682) || - (pTrident->Chipset == TGUI9680)) - dst |= FASTMODE; - if (pTrident->Chipset == PROVIDIA9685 || - pTrident->Chipset == CYBER9388) - dst |= 1<<21; - } - TGUI_DRAWFLAG(pTrident->DrawFlag | pTrident->BltScanDirection | SCR2SCR | dst); TGUI_FMIX(XAACopyROP[rop]); } @@ -338,12 +334,7 @@ if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { TGUI_FPATCOL(color); - if (rop == GXcopy) - pTrident->BltScanDirection |= 1<<21; } else { - if ((pTrident->Chipset == PROVIDIA9682 || - pTrident->Chipset == TGUI9680) && rop == GXcopy) - pTrident->BltScanDirection |= FASTMODE; TGUI_FCOLOUR(color); } } @@ -405,12 +396,6 @@ case 8: NiceDashPattern |= NiceDashPattern << 8; } pTrident->BltScanDirection = 0; - if ((pTrident->Chipset == PROVIDIA9682 || - pTrident->Chipset == TGUI9680) && rop == GXcopy) - pTrident->BltScanDirection |= FASTMODE; - if ((pTrident->Chipset == PROVIDIA9685 || - pTrident->Chipset == CYBER9388) && rop == GXcopy) - pTrident->BltScanDirection |= 1<<21; REPLICATE(fg); if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { @@ -467,11 +452,8 @@ REPLICATE(color); TGUI_FMIX(XAAPatternROP[rop]); - if ((pTrident->Chipset == PROVIDIA9682 || - pTrident->Chipset == TGUI9680) && rop == GXcopy) drawflag = FASTMODE; if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { - if (rop == GXcopy) drawflag |= 1<<21; TGUI_FPATCOL(color); } else { drawflag |= PATMONO; @@ -554,11 +536,7 @@ if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { drawflag |= 7<<18; - if (rop == GXcopy) drawflag |= 1<<21; } - if ((pTrident->Chipset == PROVIDIA9682 || - pTrident->Chipset == TGUI9680) && rop == GXcopy) - drawflag |= FASTMODE; TGUI_DRAWFLAG(pTrident->DrawFlag | PAT2SCR | PATMONO | drawflag); TGUI_PATLOC(((patterny * pTrident->PatternLocation) + (patternx * pScrn->bitsPerPixel / 8)) >> 6); @@ -579,6 +557,7 @@ TridentSync(pScrn); } +#if 0 static void TridentSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, @@ -589,10 +568,6 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int drawflag = 0; - if ((pTrident->Chipset == PROVIDIA9682 || - pTrident->Chipset == TGUI9680) && rop == GXcopy) - drawflag |= FASTMODE; - REPLICATE(transparency_color); if (transparency_color != -1) { if (pTrident->Chipset == PROVIDIA9685 || @@ -623,6 +598,7 @@ TGUI_COMMAND(GE_BLT); TridentClearSync(pScrn); } +#endif static void TridentSetupForScanlineCPUToScreenColorExpandFill( @@ -644,9 +620,6 @@ TGUI_BCOLOUR(bg); } - if ((pTrident->Chipset == PROVIDIA9682 || - pTrident->Chipset == TGUI9680) && rop == GXcopy) - drawflag |= FASTMODE; TGUI_SRC_XY(0,0); TGUI_DRAWFLAG(drawflag); TGUI_FMIX(XAACopyROP[rop]); Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c diff -u 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.63 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c:1.45.2.1 Wed May 23 16:33:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c Fri Jan 11 08:06:30 2002 @@ -1,3 +1,4 @@ + /* * Copyright 1992-2000 by Alan Hourihane, Wigan, England. * @@ -21,7 +22,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.45.2.1 2001/05/23 20:33:41 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.63 2002/01/11 13:06:30 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -90,6 +91,13 @@ { 1024, 768, 0x6e } }; +static newModes newModeRegs [] = { + { 320, 200, 0x13, 0x30 }, + { 640, 480, 0x13, 0x61 }, + { 800, 600, 0x13, 0x61 }, + { 1024, 768, 0x3b, 0x63 }, + { 1280, 1024, 0x7b, 0x64 } +}; int TridentFindMode(int xres, int yres, int depth) @@ -139,7 +147,32 @@ } } return mode[size - 1].mode; +} + +static void +TridentFindNewMode(int xres, int yres, CARD8 *gr5a, CARD8 *gr5c) +{ + int xres_s; + int i, size; + size = sizeof(newModeRegs) / sizeof(newModes); + + for (i = 0; i < size; i++) { + if (xres <= newModeRegs[i].x_res) { + xres_s = newModeRegs[i].x_res; + for (; i < size; i++) { + if (newModeRegs[i].x_res != xres_s + || yres <= newModeRegs[i].y_res) { + *gr5a = newModeRegs[i].GR5a; + *gr5c = newModeRegs[i].GR5c; + return; + } + } + } + } + *gr5a = newModeRegs[size - 1].GR5a; + *gr5c = newModeRegs[size - 1].GR5c; + return; } Bool @@ -163,7 +196,7 @@ /* Unprotect */ OUTB(0x3C4, 0x11); - protect = INB(0x3C4); + protect = INB(0x3C5); OUTB(0x3C5, 0x92); OUTB(0x3C4, 0x0B); INB(0x3C5); /* Ensure we are in New Mode */ @@ -183,6 +216,9 @@ (((mode->CrtcVDisplay - 1) & 0x400) >> 6)| 0x08; + pReg->tridentRegs3x4[HorizOverflow] = ((mode->CrtcHTotal & 0x800) >> 11) | + ((mode->CrtcHBlankStart & 0x800)>>7); + if (pTrident->IsCyber) { Bool LCDActive; #ifdef READOUT @@ -197,6 +233,9 @@ LCDActive = (INB(0x3CF) & 0x10); OUTB(0x3CE, CyberEnhance); +#if 0 + pReg->tridentRegs3CE[CyberEnhance] = INB(0x3CF); +#else pReg->tridentRegs3CE[CyberEnhance] = INB(0x3CF) & 0x8F; if (mode->CrtcVDisplay > 768) pReg->tridentRegs3CE[CyberEnhance] |= 0x30; @@ -206,7 +245,7 @@ else if (mode->CrtcVDisplay > 480) pReg->tridentRegs3CE[CyberEnhance] |= 0x10; - +#endif OUTB(0x3CE, CyberControl); pReg->tridentRegs3CE[CyberControl] = INB(0x3CF); @@ -239,6 +278,8 @@ { if (i != 0xff) { pReg->tridentRegs3x4[0x0] = LCD[i].shadow_0; + pReg->tridentRegs3x4[0x1] = regp->CRTC[1]; + pReg->tridentRegs3x4[0x2] = regp->CRTC[2]; pReg->tridentRegs3x4[0x3] = LCD[i].shadow_3; pReg->tridentRegs3x4[0x4] = LCD[i].shadow_4; pReg->tridentRegs3x4[0x5] = LCD[i].shadow_5; @@ -252,10 +293,13 @@ pReg->tridentRegs3x4[0x7] = LCD[i].shadow_7; pReg->tridentRegs3x4[0x10] = LCD[i].shadow_10; pReg->tridentRegs3x4[0x11] = LCD[i].shadow_11; + pReg->tridentRegs3x4[0x12] = regp->CRTC[0x12]; + pReg->tridentRegs3x4[0x15] = regp->CRTC[0x15]; pReg->tridentRegs3x4[0x16] = LCD[i].shadow_16; - if (LCDActive) + if (LCDActive) { pReg->tridentRegs3x4[CRTHiOrd] = LCD[i].shadow_HiOrd; - + } + fullSize = (pScrn->currentMode->HDisplay == LCD[i].display_x) && (pScrn->currentMode->VDisplay == LCD[i].display_y); } @@ -277,6 +321,11 @@ regp->CRTC[0x16] = pReg->tridentRegs3x4[0x16]; } if (LCDActive && !fullSize) { + /* + * Set negative h/vsync polarity to center display nicely + * Seems to work on several systems. + */ + regp->MiscOutReg |= 0xC0; /* * If the LCD is active and we don't fill the entire screen * and the previous mode was stretched we may need help from @@ -348,12 +397,24 @@ pReg->tridentRegs3x4[PreEndFetch] = INB(vgaIOBase + 5); #endif /* set mode */ - pReg->tridentRegs3CE[BiosMode] = TridentFindMode( - pScrn->currentMode->HDisplay, - pScrn->currentMode->VDisplay, - pScrn->depth); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, "Setting BIOS Mode: %x\n", - pReg->tridentRegs3CE[BiosMode]); + if (pTrident->Chipset < CYBERBLADEXPm8) { + pReg->tridentRegs3CE[BiosMode] = TridentFindMode( + pScrn->currentMode->HDisplay, + pScrn->currentMode->VDisplay, + pScrn->depth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, + "Setting BIOS Mode: %x\n", + pReg->tridentRegs3CE[BiosMode]); + } else { + TridentFindNewMode(pScrn->currentMode->HDisplay, + pScrn->currentMode->VDisplay, + &pReg->tridentRegs3CE[BiosNewMode1], + &pReg->tridentRegs3CE[BiosNewMode2]); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, + "Setting BIOS Mode Regs: %x %x\n", + pReg->tridentRegs3CE[BiosNewMode1], + pReg->tridentRegs3CE[BiosNewMode2]); + }; /* no stretch */ pReg->tridentRegs3CE[BiosReg] = 0; @@ -365,48 +426,11 @@ } } - /* 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 CYBERBLADEXPAI1: + case CYBERBLADEXPm8: + case CYBERBLADEXPm16: case CYBERBLADEI7: case CYBERBLADEI7D: case CYBERBLADEI1: @@ -427,6 +451,8 @@ case CYBER9388: if (pScrn->bitsPerPixel >= 8) pReg->tridentRegs3CE[MiscExtFunc] |= 0x10; + else + pReg->tridentRegs3CE[MiscExtFunc] &= ~0x10; if (!pReg->tridentRegs3x4[PreEndControl]) pReg->tridentRegs3x4[PreEndControl] = 0x01; if (!pReg->tridentRegs3x4[PreEndFetch]) @@ -445,7 +471,7 @@ /* Fall Through */ case TGUI9660: case TGUI9680: - if (pTrident->MUX && pScrn->bitsPerPixel == 8 && mode->CrtcHAdjusted) { + if (pTrident->MUX && pScrn->bitsPerPixel == 8) { pReg->tridentRegs3x4[PixelBusReg] |= 0x01; /* 16bit bus */ pReg->tridentRegs3C4[NewMode2] |= 0x02; /* half clock */ pReg->tridentRegsDAC[0x00] |= 0x20; /* mux mode */ @@ -512,7 +538,7 @@ { CARD8 a, b; TGUISetClock(pScrn, clock, &a, &b); - pReg->tridentRegsClock[0x00] = (INB(0x3CC) & 0xF3) | 0x08; + pReg->tridentRegsClock[0x00] = (regp->MiscOutReg & 0xF3) | 0x08; pReg->tridentRegsClock[0x01] = a; pReg->tridentRegsClock[0x02] = b; if (pTrident->MCLK > 0) { @@ -528,7 +554,7 @@ pReg->tridentRegs3x4[LinearAddReg] = 0; if (pTrident->Linear) { /* This is used for VLB, when we support it again in 4.0 */ - if (pTrident->Chipset < PROVIDIA9685) + if (pTrident->Chipset < CYBER9385) pReg->tridentRegs3x4[LinearAddReg] |= ((pTrident->FbAddress >> 24) << 6)| ((pTrident->FbAddress >> 20) & 0x0F); @@ -540,14 +566,22 @@ pReg->tridentRegs3x4[CRTCModuleTest] = (mode->Flags & V_INTERLACE ? 0x84 : 0x80); + OUTB(vgaIOBase+ 4, InterfaceSel); pReg->tridentRegs3x4[InterfaceSel] = INB(vgaIOBase + 5) | 0x40; + OUTB(vgaIOBase+ 4, Performance); - pReg->tridentRegs3x4[Performance] = INB(vgaIOBase + 5) | 0x10; + pReg->tridentRegs3x4[Performance] = INB(vgaIOBase + 5); + + if (pTrident->Chipset < CYBERBLADEXPm8) + pReg->tridentRegs3x4[Performance] |= 0x10; + OUTB(vgaIOBase+ 4, DRAMControl); pReg->tridentRegs3x4[DRAMControl] = INB(vgaIOBase + 5) | 0x10; + if (pTrident->IsCyber && !pTrident->MMIOonly) pReg->tridentRegs3x4[DRAMControl] |= 0x20; + OUTB(vgaIOBase+ 4, AddColReg); pReg->tridentRegs3x4[AddColReg] = INB(vgaIOBase + 5) & 0xEF; pReg->tridentRegs3x4[AddColReg] |= (offset & 0x100) >> 4; @@ -588,9 +622,10 @@ } /* Video */ - pReg->tridentRegs3C4[SSetup] = 0x00; + OUTB(0x3C4,0x20); + pReg->tridentRegs3C4[SSetup] = INB(0x3C5) | 0x4; pReg->tridentRegs3C4[SKey] = 0x00; - pReg->tridentRegs3C4[SPKey] = 0x00; + pReg->tridentRegs3C4[SPKey] = 0xC0; /* restore */ OUTB(0x3C4, 0x11); @@ -637,6 +672,7 @@ OUTW_3C4(NewMode2); OUTW_3x4(CursorControl); OUTW_3x4(CRTHiOrd); + OUTW_3x4(HorizOverflow); OUTW_3x4(AddColReg); OUTW_3x4(GraphEngReg); OUTW_3x4(Performance); @@ -653,7 +689,7 @@ OUTW_3C4(SPKey); OUTW_3x4(PreEndControl); OUTW_3x4(PreEndFetch); - if (pTrident->Chipset >= PROVIDIA9685) OUTW_3x4(Enhancement0); + if (pTrident->Chipset >= CYBER9385) OUTW_3x4(Enhancement0); if (pTrident->Chipset >= BLADE3D) OUTW_3x4(RAMDACTiming); if (pTrident->Chipset == CYBERBLADEE4) OUTW_3x4(New32); if (pTrident->IsCyber) { @@ -661,12 +697,21 @@ OUTW_3CE(VertStretch); OUTW_3CE(HorStretch); - OUTW_3CE(BiosMode); + if (pTrident->Chipset < CYBERBLADEXPm8) { + OUTW_3CE(BiosMode); + } else { + OUTW_3CE(BiosNewMode1); + OUTW_3CE(BiosNewMode2); + }; OUTW_3CE(BiosReg); OUTW_3CE(CyberControl); OUTW_3CE(CyberEnhance); SHADOW_ENABLE(tmp); OUTW_3x4(0x0); + if (pTrident->shadowNew) { + OUTW_3x4(0x1); + OUTW_3x4(0x2); + } OUTW_3x4(0x3); OUTW_3x4(0x4); OUTW_3x4(0x5); @@ -674,6 +719,10 @@ OUTW_3x4(0x7); OUTW_3x4(0x10); OUTW_3x4(0x11); + if (pTrident->shadowNew) { + OUTW_3x4(0x12); + OUTW_3x4(0x15); + } OUTW_3x4(0x16); SHADOW_RESTORE(tmp); } @@ -737,12 +786,13 @@ /* Unprotect registers */ OUTW(0x3C4, ((0xC0 ^ 0x02) << 8) | NewMode1); - OUTW(vgaIOBase + 4, (0x92 << 8) | NewMode1); + OUTW(0x3C4, (0x92 << 8) | Protection); INB_3x4(Offset); INB_3x4(LinearAddReg); INB_3x4(CRTCModuleTest); INB_3x4(CRTHiOrd); + INB_3x4(HorizOverflow); INB_3x4(Performance); INB_3x4(InterfaceSel); INB_3x4(DRAMControl); @@ -756,7 +806,7 @@ INB_3C4(SPKey); INB_3x4(PreEndControl); INB_3x4(PreEndFetch); - if (pTrident->Chipset >= PROVIDIA9685) INB_3x4(Enhancement0); + if (pTrident->Chipset >= CYBER9385) INB_3x4(Enhancement0); if (pTrident->Chipset >= BLADE3D) INB_3x4(RAMDACTiming); if (pTrident->Chipset == CYBERBLADEE4) INB_3x4(New32); if (pTrident->IsCyber) { @@ -764,11 +814,17 @@ INB_3CE(VertStretch); INB_3CE(HorStretch); INB_3CE(BiosMode); + INB_3CE(BiosNewMode1); + INB_3CE(BiosNewMode2); INB_3CE(BiosReg); INB_3CE(CyberControl); INB_3CE(CyberEnhance); SHADOW_ENABLE(tmp); INB_3x4(0x0); + if (pTrident->shadowNew) { + INB_3x4(0x1); + INB_3x4(0x2); + } INB_3x4(0x3); INB_3x4(0x4); INB_3x4(0x5); @@ -776,6 +832,10 @@ INB_3x4(0x7); INB_3x4(0x10); INB_3x4(0x11); + if (pTrident->shadowNew) { + INB_3x4(0x12); + INB_3x4(0x15); + } INB_3x4(0x16); SHADOW_RESTORE(tmp); } @@ -850,6 +910,7 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; + if (x < 0) { OUTW(vgaIOBase + 4, (-x)<<8 | 0x46); x = 0; @@ -958,14 +1019,14 @@ /* New mode */ OUTB(0x3C4, 0x0B); temp = INB(0x3C5); - OUTB(vgaIOBase + 4, NewMode1); - temp = INB(vgaIOBase + 5); - OUTB(vgaIOBase + 5, temp | 0x80); + OUTB(0x3C4, NewMode1); + temp = INB(0x3C5); + OUTB(0x3C5, temp | 0x80); /* Define SDA as input */ OUTW(vgaIOBase + 4, (0x04 << 8) | I2C); - OUTW(vgaIOBase + 4, (temp << 8) | NewMode1); + OUTW(0x3C4, (temp << 8) | NewMode1); /* Wait until vertical retrace is in progress. */ while (INB(vgaIOBase + 0xA) & 0x08); @@ -1000,7 +1061,6 @@ vgaHWPtr hwp = VGAHWPTR(pScrn); TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int i, index; - int sig; for(i = 0; i < numColors; i++) { index = indicies[i]; OUTB(0x3C6, 0xFF); Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.136 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.160 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.136 Tue May 15 06:19:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c Tue Jan 15 13:31:19 2002 @@ -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.136 2001/05/15 10:19:41 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.160 2002/01/15 18:31:19 alanh Exp $ */ #include "xf1bpp.h" #include "xf4bpp.h" @@ -136,7 +136,12 @@ }; static SymTabRec TRIDENTChipsets[] = { + { TVGA9000, "tvga9000" }, + { TVGA9000i, "tvga9000i" }, + { TVGA8900C, "tvga8900c" }, { TVGA8900D, "tvga8900d" }, + { TVGA9200CXr, "tvga9200cxr" }, + { TGUI9400CXi, "tgui9400cxi" }, { CYBER9320, "cyber9320" }, { CYBER9388, "cyber9388" }, { CYBER9397, "cyber9397" }, @@ -161,13 +166,21 @@ { CYBERBLADEI1D, "cyberbladei1d" }, { CYBERBLADEAI1, "cyberbladeAi1" }, { CYBERBLADEAI1D, "cyberbladeAi1d" }, - { CYBERBLADEXP, "cyberbladeXP" }, - { CYBERBLADEXPm, "cyberbladeXPm" }, + { CYBERBLADEXPm8, "cyberbladeXPm/8" }, + { CYBERBLADEXPm16, "cyberbladeXPm/16" }, + { CYBERBLADEXPAI1, "cyberbladeXPAi1" }, { -1, NULL } }; static IsaChipsets TRIDENTISAchipsets[] = { + { TVGA9000, RES_EXCLUSIVE_VGA }, + { TVGA9000i, RES_EXCLUSIVE_VGA }, + { TVGA8900C, RES_EXCLUSIVE_VGA }, { TVGA8900D, RES_EXCLUSIVE_VGA }, + { TVGA9200CXr, RES_EXCLUSIVE_VGA }, + { TGUI9400CXi, RES_EXCLUSIVE_VGA }, + { CYBER9320, RES_EXCLUSIVE_VGA }, + { TGUI9440AGi, RES_EXCLUSIVE_VGA }, { -1, RES_UNDEFINED } }; @@ -196,8 +209,9 @@ { 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 }, + { CYBERBLADEXPm8, PCI_CHIP_9910, RES_SHARED_VGA }, + { CYBERBLADEXPm16, PCI_CHIP_9930, RES_SHARED_VGA }, + { CYBERBLADEXPAI1, PCI_CHIP_8820, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -215,7 +229,11 @@ OPTION_NOMMIO, OPTION_NOPCIBURST, OPTION_CYBER_SHADOW, - OPTION_CYBER_STRETCH + OPTION_CYBER_STRETCH, + OPTION_XV_HSYNC, + OPTION_XV_VSYNC, + OPTION_XV_BSKEW, + OPTION_XV_RSKEW } TRIDENTOpts; static const OptionInfoRec TRIDENTOptions[] = { @@ -232,6 +250,10 @@ { OPTION_MMIO_ONLY, "MMIOonly", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CYBER_SHADOW, "CyberShadow", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CYBER_STRETCH, "CyberStretch", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_XV_HSYNC, "XvHsync", OPTV_INTEGER, {0}, FALSE }, + { OPTION_XV_VSYNC, "XvVsync", OPTV_INTEGER, {0}, FALSE }, + { OPTION_XV_BSKEW, "XvBskew", OPTV_INTEGER, {0}, FALSE }, + { OPTION_XV_RSKEW, "XvRskew", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -255,10 +277,10 @@ 90000, 135000, 135000, - 135000, 170000, - 135000, - 135000, + 170000, + 170000, + 170000, 170000, 170000, 170000, @@ -276,6 +298,7 @@ 230000, 230000, 230000, + 230000, }; static int ClockLimit16bpp[] = { @@ -295,15 +318,16 @@ 40000, 45000, 45000, - 135000, + 90000, + 90000, 135000, 135000, 170000, - 135000, - 135000, 170000, 170000, 170000, + 170000, + 230000, 230000, 230000, 230000, @@ -337,15 +361,16 @@ 25180, 25180, 25180, + 40000, + 40000, 70000, 70000, - 70000, - 85000, - 70000, 70000, - 85000, - 85000, - 85000, + 115000, + 115000, + 115000, + 115000, + 115000, 115000, 115000, 115000, @@ -379,16 +404,14 @@ 25180, 25180, 25180, + 40000, + 40000, 70000, 70000, - 70000, - 85000, - 70000, 70000, - 85000, - 85000, + 115000, + 115000, 115000, - 85000, 115000, 115000, 115000, @@ -403,6 +426,9 @@ 115000, 115000, 115000, + 115000, + 115000, + 115000, }; /* @@ -440,57 +466,72 @@ #endif static const char *xaaSymbols[] = { - "XAADestroyInfoRec", + "XAACopyROP", "XAACreateInfoRec", - "XAAHelpPatternROP", - "XAAHelpSolidROP", + "XAADestroyInfoRec", "XAAFillSolidRects", - "XAACopyROP", - "XAAPatternROP", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", + "XAAPatternROP", "XAAScreenIndex", NULL }; static const char *vgahwSymbols[] = { + "vgaHWBlankScreen", + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", - "vgaHWSaveScreen", - "vgaHWSave", + "vgaHWMapMem", + "vgaHWProtect", "vgaHWRestore", + "vgaHWSave", + "vgaHWSaveScreen", "vgaHWSetMmioFuncs", + "vgaHWUnlock", NULL }; -static const char *fbSymbols[] = { - "fbScreenInit", - "fbPictureInit", +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", NULL }; +static const char *fbSymbols[] = { + "fbPictureInit", + "fbScreenInit", + NULL +}; + +static const char *ramdacSymbols[] = { + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + "xf86InitCursor", + NULL +}; + static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", + "xf86SetDDCproperties", NULL }; static const char *i2cSymbols[] = { - "xf86I2CBusInit", "xf86CreateI2CBusRec", + "xf86I2CBusInit", NULL }; +static const char *int10Symbols[] = { + "xf86ExecX86int10", + "xf86FreeInt10", + "xf86InitInt10", + NULL +}; + static const char *shadowSymbols[] = { "shadowInit", NULL @@ -532,6 +573,7 @@ setupDone = TRUE; xf86AddDriver(&TRIDENT, module, 0); LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, vbeSymbols, + miscfbSymbols, ramdacSymbols, int10Symbols, xaaSymbols, shadowSymbols, NULL); return (pointer)TRUE; } @@ -632,7 +674,7 @@ UpdateCurrentTime(); (*pTrident->VideoTimerCallback)(pScrn, currentTime.milliseconds); } -} +} static const OptionInfoRec * TRIDENTAvailableOptions(int chipid, int busid) @@ -964,15 +1006,8 @@ static int * GetAccelPitchValues(ScrnInfoPtr pScrn) { -#if 0 - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); -#endif int *linePitches = NULL; int lines[4] = { 512, 1024, 2048, 4096 }; /* 9440AGi */ -#if 0 - int lines[sizeof(AvailablePitches[pTrident->Chipset])] = - AvailablePitches[pTrident->Chipset]; -#endif int i, n = 0; for (i = 0; i < 4; i++) { @@ -1012,7 +1047,7 @@ int vgaIOBase; float mclk; double real; - int i, NoClocks; + int i, NoClocks = 16; CARD8 revision; ClockRangePtr clockRanges; char *mod = NULL; @@ -1130,6 +1165,8 @@ if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); + /* * This must happen after pScrn->display has been set because * xf86SetWeight references it. @@ -1243,12 +1280,36 @@ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cyber Stretch enabled\n"); } - pTrident->MUXThreshold = 160000; /* 160MHz */ + pTrident->MUXThreshold = 90000; /* 90MHz */ if (xf86GetOptValInteger(pTrident->Options, OPTION_MUX_THRESHOLD, &pTrident->MUXThreshold)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MUX Threshold set to %d\n", pTrident->MUXThreshold); } + pTrident->OverrideHsync = 0; + if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_HSYNC, + &pTrident->OverrideHsync)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Hsync set to %d\n", + pTrident->OverrideHsync); + } + pTrident->OverrideVsync = 0; + if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_VSYNC, + &pTrident->OverrideVsync)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Vsync set to %d\n", + pTrident->OverrideVsync); + } + pTrident->OverrideRskew = 0; + if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_RSKEW, + &pTrident->OverrideRskew)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Rskew set to %d\n", + pTrident->OverrideRskew); + } + pTrident->OverrideBskew = 0; + if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_BSKEW, + &pTrident->OverrideBskew)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Bskew set to %d\n", + pTrident->OverrideBskew); + } if (xf86ReturnOptValBool(pTrident->Options, OPTION_SHADOW_FB, FALSE)) { if (!pTrident->Linear) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Ignoring Option SHADOW_FB" @@ -1354,6 +1415,8 @@ if (xf86LoadSubModule(pScrn, "vbe")) { xf86MonPtr pMon; vbeInfoPtr pVbe; + + xf86LoaderReqSymLists(vbeSymbols, NULL); pVbe = VBEInit(NULL,pTrident->pEnt->index); pMon = vbeDoEDID(pVbe, NULL); vbeFree(pVbe); @@ -1391,6 +1454,59 @@ OUTB(vgaIOBase + 4, InterfaceSel); switch (pTrident->Chipset) { + case TVGA9000: + case TVGA9000i: + pScrn->progClock = FALSE; + NoClocks = 16; + pTrident->NoMMIO = TRUE; + pTrident->NoAccel = TRUE; + pTrident->HWCursor = FALSE; + chipset = "TVGA9000/9000i"; + ramtype = "Standard DRAM"; + if (pTrident->UsePCIRetry) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry not supported, disabling\n"); + pTrident->UsePCIRetry = FALSE; /* Not Supported */ + pTrident->frequency = NTSC; + break; + case TVGA9100B: + pScrn->progClock = FALSE; + NoClocks = 8; + pTrident->NoMMIO = TRUE; + pTrident->NoAccel = TRUE; + pTrident->HWCursor = FALSE; + chipset = "TVGA9100B"; + ramtype = "Standard DRAM"; + if (pTrident->UsePCIRetry) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry not supported, disabling\n"); + pTrident->UsePCIRetry = FALSE; /* Not Supported */ + pTrident->frequency = NTSC; + break; + case TVGA8900B: + pScrn->progClock = FALSE; + NoClocks = 8; + pTrident->NoMMIO = TRUE; + pTrident->NoAccel = TRUE; + pTrident->HWCursor = FALSE; + chipset = "TVGA8900B"; + ramtype = "Standard DRAM"; + if (pTrident->UsePCIRetry) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry not supported, disabling\n"); + pTrident->UsePCIRetry = FALSE; /* Not Supported */ + pTrident->frequency = NTSC; + break; + case TVGA8900C: + pScrn->progClock = FALSE; + NoClocks = 16; + pTrident->NoMMIO = TRUE; + pTrident->NoAccel = TRUE; + pTrident->HWCursor = FALSE; + chipset = "TVGA8900C"; + ramtype = "Standard DRAM"; + if (pTrident->UsePCIRetry) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry not supported, disabling\n"); + pTrident->UsePCIRetry = FALSE; /* Not Supported */ + pTrident->frequency = NTSC; + break; case TVGA8900D: pScrn->progClock = FALSE; NoClocks = 16; @@ -1404,6 +1520,32 @@ pTrident->UsePCIRetry = FALSE; /* Not Supported */ pTrident->frequency = NTSC; break; + case TVGA9200CXr: + pScrn->progClock = FALSE; + NoClocks = 16; + pTrident->NoMMIO = TRUE; + pTrident->NoAccel = TRUE; + pTrident->HWCursor = FALSE; + chipset = "TVGA9200CXr"; + ramtype = "Standard DRAM"; + if (pTrident->UsePCIRetry) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry not supported, disabling\n"); + pTrident->UsePCIRetry = FALSE; /* Not Supported */ + pTrident->frequency = NTSC; + break; + case TGUI9400CXi: + pScrn->progClock = FALSE; + NoClocks = 16; + pTrident->NoMMIO = TRUE; + pTrident->NoAccel = TRUE; + pTrident->HWCursor = FALSE; + chipset = "TVGA9200CXr"; + ramtype = "Standard DRAM"; + if (pTrident->UsePCIRetry) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry not supported, disabling\n"); + pTrident->UsePCIRetry = FALSE; /* Not Supported */ + pTrident->frequency = NTSC; + break; case TGUI9440AGi: pTrident->ddc1Read = Tridentddc1Read; pTrident->HWCursor = FALSE; @@ -1710,19 +1852,19 @@ pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; break; - case CYBERBLADEXP: + case CYBERBLADEXPm8: pTrident->ddc1Read = Tridentddc1Read; ramtype = "SGRAM"; pTrident->HasSGRAM = TRUE; pTrident->NoAccel = TRUE; /* Disable acceleration */ pTrident->HWCursor = FALSE; - /* pTrident->IsCyber = TRUE; */ + pTrident->IsCyber = TRUE; Support24bpp = TRUE; - chipset = "Cyber/BladeXP"; + chipset = "CyberBladeXPm/8"; pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; break; - case CYBERBLADEXPm: + case CYBERBLADEXPm16: pTrident->ddc1Read = Tridentddc1Read; ramtype = "SGRAM"; pTrident->HasSGRAM = TRUE; @@ -1730,10 +1872,23 @@ pTrident->HWCursor = FALSE; pTrident->IsCyber = TRUE; Support24bpp = TRUE; - chipset = "CyberBlade/XPm"; + chipset = "CyberBladeXPm/16"; pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; break; + case CYBERBLADEXPAI1: + pTrident->ddc1Read = Tridentddc1Read; + ramtype = "SGRAM"; + pTrident->HasSGRAM = TRUE; + pTrident->NoAccel = TRUE; /* Disable acceleration */ + pTrident->HWCursor = FALSE; + pTrident->IsCyber = TRUE; + pTrident->shadowNew = TRUE; + Support24bpp = TRUE; + chipset = "CyberBladeXPAi1"; + pTrident->NewClockCode = TRUE; + pTrident->frequency = NTSC; + break; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pTrident->HWCursor ? "HW" : "SW"); @@ -1777,6 +1932,21 @@ pScrn->videoRam = pTrident->pEnt->device->videoRam; from = X_CONFIG; } else { + if (pTrident->Chipset == CYBERBLADEXPAI1) { + pScrn->videoRam = 16384; /* NOTE: I have no idea what the real + * value is. BIOS takes about 20M RAM + * for its own and vid RAM */ + } else + if (pTrident->Chipset == CYBERBLADEXPm8) { + pScrn->videoRam = 8192; + } else + if (pTrident->Chipset == CYBERBLADEXPm16) { + pScrn->videoRam = 16384; + } else + if (pTrident->Chipset == CYBER9525DVD) { + pScrn->videoRam = 2560; + } else + { OUTB(vgaIOBase + 4, SPR); videoram = INB(vgaIOBase + 5); if (pTrident->Chipset < TGUI9440AGi) @@ -1784,13 +1954,16 @@ else videorammask = 0x0F; switch (videoram & videorammask) { + case 0x01: + pScrn->videoRam = 512; + break; case 0x03: pScrn->videoRam = 1024; break; case 0x04: /* 8MB, but - hw cursor can't store above 4MB */ /* So, we force to 4MB for now */ /* pScrn->videoRam = 8192; */ - /* Appearantly this isn't true for the CYBER9397DVD */ + /* Apparantly 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)) { @@ -1802,8 +1975,6 @@ break; case 0x07: pScrn->videoRam = 2048; - if (pTrident->Chipset == CYBER9525DVD) - pScrn->videoRam = 2560; break; case 0x0F: pScrn->videoRam = 4096; @@ -1815,6 +1986,7 @@ pScrn->videoRam); break; } + } } xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", @@ -1911,6 +2083,8 @@ clockRanges = xnfcalloc(sizeof(ClockRange), 1); clockRanges->next = NULL; if (!pScrn->progClock) { + if (pScrn->videoRam < 1024) + clockRanges->ClockMulFactor = 2; if (pScrn->bitsPerPixel == 16) clockRanges->ClockMulFactor = 2; } @@ -1935,7 +2109,7 @@ } /* Select valid modes from those available */ - if (pTrident->NoAccel) { + if (pTrident->NoAccel || Is3Dchip) { /* * XXX Assuming min pitch 256, max 4096 * XXX Assuming min height 128, max 4096 @@ -2010,22 +2184,18 @@ case 8: pTrident->EngineOperation |= 0x00; mod = "fb"; - Sym = "fbScreenInit"; break; case 16: pTrident->EngineOperation |= 0x01; mod = "fb"; - Sym = "fbScreenInit"; break; case 24: pTrident->EngineOperation |= 0x03; mod = "fb"; - Sym = "fbScreenInit"; break; case 32: pTrident->EngineOperation |= 0x02; mod = "fb"; - Sym = "fbScreenInit"; break; } @@ -2038,9 +2208,13 @@ return FALSE; } - xf86LoaderReqSymbols(Sym, NULL); - if (pScrn->depth > 8) - xf86LoaderReqSymbols("fbPictureInit", NULL); + if (mod) { + if (Sym) { + xf86LoaderReqSymbols(Sym, NULL); + } else { + xf86LoaderReqSymLists(fbSymbols, NULL); + } + } if (!xf86LoadSubModule(pScrn, "i2c")) { if (IsPciCard && UseMMIO) { @@ -2262,8 +2436,9 @@ case CYBERBLADEE4: case CYBER9397: case CYBER9397DVD: - case CYBERBLADEXP: - case CYBERBLADEXPm: + case CYBERBLADEXPm8: + case CYBERBLADEXPm16: + case CYBERBLADEXPAI1: /* Get ready for MUX mode */ if (pTrident->MUX && pScrn->bitsPerPixel == 8 && @@ -2277,6 +2452,18 @@ mode->CrtcHAdjusted = TRUE; } break; + default: + if (pScrn->videoRam < 1024 && + !mode->CrtcHAdjusted) { + mode->CrtcHDisplay <<= 1; + mode->CrtcHSyncStart <<= 1; + mode->CrtcHSyncEnd <<= 1; + mode->CrtcHBlankStart <<= 1; + mode->CrtcHBlankEnd <<= 1; + mode->CrtcHTotal <<= 1; + mode->CrtcHAdjusted = TRUE; + } + break; } vgaHWUnlock(hwp); @@ -2308,7 +2495,6 @@ tridentReg = &pTrident->ModeReg; vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - if (pScrn->progClock) TridentRestore(pScrn, tridentReg); else @@ -2397,6 +2583,7 @@ if (!xf86IsPc98()) { if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Initializing int10\n"); pTrident->Int10 = xf86InitInt10(pTrident->pEnt->index); } @@ -2505,8 +2692,6 @@ ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit (pScreen, 0, 0); break; default: @@ -2539,6 +2724,10 @@ } } + /* must be after RGB ordering fixed */ + if (pScrn->bitsPerPixel > 4) + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); pTrident->BlockHandler = pScreen->BlockHandler; @@ -2576,22 +2765,20 @@ } } - if (!pTrident->NoAccel) { - if (Is3Dchip) { - if ((pTrident->Chipset == CYBERBLADEI7) || - (pTrident->Chipset == CYBERBLADEI7D) || - (pTrident->Chipset == CYBERBLADEI1) || - (pTrident->Chipset == CYBERBLADEI1D) || - (pTrident->Chipset == CYBERBLADEAI1) || - (pTrident->Chipset == CYBERBLADEAI1D) || - (pTrident->Chipset == CYBERBLADEE4) || - (pTrident->Chipset == BLADE3D)) + if (Is3Dchip) { + if ((pTrident->Chipset == CYBERBLADEI7) || + (pTrident->Chipset == CYBERBLADEI7D) || + (pTrident->Chipset == CYBERBLADEI1) || + (pTrident->Chipset == CYBERBLADEI1D) || + (pTrident->Chipset == CYBERBLADEAI1) || + (pTrident->Chipset == CYBERBLADEAI1D) || + (pTrident->Chipset == CYBERBLADEE4) || + (pTrident->Chipset == BLADE3D)) BladeAccelInit(pScreen); else ImageAccelInit(pScreen); - } else { - TridentAccelInit(pScreen); - } + } else { + TridentAccelInit(pScreen); } miInitializeBackingStore(pScreen); @@ -2625,30 +2812,15 @@ pScrn->PointerMoved = TRIDENTPointerMoved; } switch (pScrn->bitsPerPixel) { -#if 1 case 8: pTrident->RefreshArea = TRIDENTRefreshArea8; break; case 16: pTrident->RefreshArea = TRIDENTRefreshArea16; break; case 24: pTrident->RefreshArea = TRIDENTRefreshArea24; break; case 32: pTrident->RefreshArea = TRIDENTRefreshArea32; break; -#else - case 8: shadowInit (pScreen, shadowUpdateRotate8, 0); break; - case 16: shadowInit (pScreen, shadowUpdateRotate16, 0); break; - case 24: shadowInit (pScreen, shadowUpdateRotate32, 0); break; -#endif } } else { pTrident->RefreshArea = TRIDENTRefreshArea; -#if 0 - shadowInit (pScreen, shadowUpdatePacked, 0); -#endif } -#if 1 -#if 0 - ShadowFBInit(pScreen, pTrident->RefreshArea); -#else shadowInit (pScreen, TRIDENTShadowUpdate, 0); -#endif -#endif } xf86DPMSInit(pScreen, (DPMSSetProcPtr)TRIDENTDisplayPowerManagementSet, 0); @@ -2657,7 +2829,7 @@ pScrn->fbOffset = 0; #ifdef XvExtension - if ((pTrident->Chipset >= CYBER9397) && (!pTrident->NoAccel)) + if (pTrident->Chipset >= TGUI9660) TRIDENTInitVideo(pScreen); #endif @@ -2849,20 +3021,27 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->lcdActive && (pTrident->lcdMode != 0xff) - && ((mode->HDisplay > LCD[pTrident->lcdMode].display_x) + + if (pTrident->lcdActive && (pTrident->lcdMode != 0xff)){ + if (((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); + 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); + } + if (((float)mode->HDisplay/(float)mode->VDisplay) > 2.0) { + xf86DrvMsg(scrnIndex,X_INFO, "Removing mode (%dx%d) " + "unusual aspect ratio\n", + mode->HDisplay, + mode->VDisplay); + return(MODE_BAD); + } + } + return (MODE_OK); } /* Do screen blanking */ Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.19 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.19 Tue May 15 07:08:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h Fri Jan 11 08:06:30 2002 @@ -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.19 2001/05/15 11:08:40 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.22 2002/01/11 13:06:30 alanh Exp $ */ #define DEBUG 1 @@ -61,6 +61,7 @@ #define CRTHiOrd 0x27 #define AddColReg 0x29 #define InterfaceSel 0x2A +#define HorizOverflow 0x2B #define GETest 0x2D #define Performance 0x2F #define GraphEngReg 0x36 @@ -106,6 +107,8 @@ #define VertStretch 0x52 #define HorStretch 0x53 #define BiosMode 0x5c +#define BiosNewMode1 0x5a +#define BiosNewMode2 0x5c #define BiosReg 0x5d /* Graphics Engine for 9420/9430 */ @@ -260,6 +263,15 @@ OUTB(0x3CE, reg); \ tridentReg->tridentRegs3CE[reg] = INB(0x3CF); +#define VIDEOOUT(val,reg) \ + if (pTrident->Chipset >= CYBER9397) { \ + OUTW(0x3C4, (val << 8) | reg); \ + } else { \ + OUTB(0x83C8, reg); \ + OUTB(0x83C6, val); \ + } + + #define BLTBUSY(b) \ (b = MMIO_IN8(pTrident->IOBase,GER_STATUS) & GE_BUSY) #define OLDBLTBUSY(b) \ @@ -354,5 +366,5 @@ #define SHADOW_RESTORE(val) \ do {\ OUTB(0x3CE, CyberControl); \ - OUTB(0x3CF,tmp); \ + OUTB(0x3CF,val); \ } while (0); Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c:1.2 Thu Nov 16 14:45:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c Wed Jun 13 22:23:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c,v 1.2 2000/11/16 19:45:01 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c,v 1.3 2001/06/14 02:23:50 keithp Exp $ */ /* Copyright (c) 1999, 2000 The XFree86 Project Inc. @@ -43,8 +43,9 @@ } void -TRIDENTShadowUpdate (ScreenPtr pScreen, PixmapPtr pShadow, RegionPtr damage) +TRIDENTShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf) { + RegionPtr damage = &pBuf->damage; ScrnInfoPtr pScrn; pScrn = xf86Screens[pScreen->myNum]; Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c diff -u 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.21 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c:1.4.2.2 Thu May 24 05:37:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c Sat Jan 12 19:15:52 2002 @@ -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.4.2.2 2001/05/24 09:37:41 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c,v 1.21 2002/01/13 00:15:52 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -50,11 +50,6 @@ #define TIMER_MASK (OFF_TIMER | FREE_TIMER) -#ifndef XvExtension -void TRIDENTInitVideo(ScreenPtr pScreen) {} -void TRIDENTResetVideo(ScrnInfoPtr pScrn) {} -#else - static XF86VideoAdaptorPtr TRIDENTSetupImageVideo(ScreenPtr); static void TRIDENTInitOffscreenImages(ScreenPtr); static void TRIDENTStopVideo(ScrnInfoPtr, pointer, Bool); @@ -68,10 +63,16 @@ static int TRIDENTQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); static void TRIDENTVideoTimerCallback(ScrnInfoPtr pScrn, Time time); +static void tridentSetVideoGamma(TRIDENTPtr pTrident,int value,int brightness); +static void tridentSetVideoContrast(TRIDENTPtr pTrident,int value); +static void tridentSetVideoParameters(TRIDENTPtr pTrident, int brightness, + int saturation, int hue); +void tridentFixFrame(ScrnInfoPtr pScrn, int *fixFrame); + #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -static Atom xvColorKey; +static Atom xvColorKey, xvSaturation, xvBrightness, xvHUE, xvGamma, xvContrast; void TRIDENTInitVideo(ScreenPtr pScreen) { @@ -81,9 +82,28 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int num_adaptors; - if (pTrident->NoAccel || !pTrident->AccelInfoRec->SetupForSolidFill) - return; - + /* + * The following has been tested on: + * + * 9525 : flags: None + * CyberBlade/i7: flags: VID_ZOOM_INV | VID_ZOOM_MINI + * CyberBlade/i1: flags: VID_ZOOM_INV | VID_ZOOM_MINI + * CyberBlade/Ai1: flags: VID_ZOOM_INV + * Cyber 9540 : flags: VID_ZOOM_INV | VID_SHIFT_4 + * CyberXPm8 : flags: VID_ZOOM_INV | VID_SHIFT_4 + * + * When you make changes make sure not to break these + * Add new chipsets to this list. + */ + if (pTrident->Chipset >= BLADE3D) { + pTrident->videoFlags = VID_ZOOM_INV ; + if (pTrident->Chipset <= CYBERBLADEI1D) + pTrident->videoFlags |= VID_ZOOM_MINI; + else if (pTrident->Chipset < CYBERBLADEAI1 /* verified EE */ + || pTrident->Chipset > CYBERBLADEAI1D) + pTrident->videoFlags |= VID_OFF_SHIFT_4; + } + newAdaptor = TRIDENTSetupImageVideo(pScreen); TRIDENTInitOffscreenImages(pScreen); @@ -111,6 +131,13 @@ if(newAdaptors) xfree(newAdaptors); + + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,"XvFlags: %s %s %s\n", + pTrident->videoFlags & VID_ZOOM_INV ? "VID_ZOOM_INV" : "", + pTrident->videoFlags & VID_ZOOM_MINI ? "VID_ZOOM_MINI" : "", + pTrident->videoFlags & VID_OFF_SHIFT_4 ? "VID_OFF_SHIFT_4" + : ""); + } /* client libraries expect an encoding */ @@ -131,11 +158,16 @@ {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }; -#define NUM_ATTRIBUTES 1 +#define NUM_ATTRIBUTES 6 static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { - {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"} + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 187, "XV_SATURATION"}, + {XvSettable | XvGettable, 0, 0x3F, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 360 , "XV_HUE"}, + {XvSettable | XvGettable, -128, 127, "XV_GAMMA"}, + {XvSettable | XvGettable, 0, 7, "XV_CONTRAST"} }; #define NUM_IMAGES 4 @@ -184,9 +216,15 @@ FBLinearPtr linear; RegionRec clip; CARD32 colorKey; + CARD8 Saturation; + CARD8 Brightness; + CARD16 HUE; + INT8 Gamma; + INT8 Contrast; CARD32 videoStatus; Time offTime; Time freeTime; + int fixFrame; } TRIDENTPortPrivRec, *TRIDENTPortPrivPtr; @@ -203,21 +241,36 @@ OUTW(vgaIOBase + 4, 0x008E); OUTW(vgaIOBase + 4, 0x008F); - - OUTW(vgaIOBase + 4, 0x80B9); - OUTW(0x3C4, 0x3037); - OUTW(0x3C4, 0xC057); - OUTW(0x3C4, 0x3420); + if (pTrident->Chipset >= CYBER9397) { + OUTW(vgaIOBase + 4, 0x80B9); + OUTW(0x3C4, 0xC057); + OUTW(0x3C4, 0x3421); + OUTW(0x3C4, 0x3037); + } else { + if (pTrident->Chipset >= PROVIDIA9682) { + OUTB(0x83C8, 0x57); + OUTB(0x83C6, 0xC0); + OUTW(vgaIOBase + 4, 0x24BE); + } else { + OUTB(0x83C8, 0x37); + OUTB(0x83C6, 0x01); + } + } + if (pTrident->Chipset >= CYBERBLADEXPm8) { + OUTW(0x3C4, 0x007A); + OUTW(0x3C4, 0x007D); + } + switch (pScrn->depth) { case 8: - OUTW(0x3C4, (pPriv->colorKey<<8) | 0x50); - OUTW(0x3C4, 0x0051); - OUTW(0x3C4, 0x0052); - OUTW(0x3C4, 0xFF54); - OUTW(0x3C4, 0x0055); - OUTW(0x3C4, 0x0056); + VIDEOOUT(pPriv->colorKey, pTrident->keyOffset); + VIDEOOUT(0x00, (pTrident->keyOffset + 1)); + VIDEOOUT(0x00, (pTrident->keyOffset + 2)); + VIDEOOUT(0xFF, (pTrident->keyOffset + 4)); + VIDEOOUT(0x00, (pTrident->keyOffset + 5)); + VIDEOOUT(0x00, (pTrident->keyOffset + 6)); break; default: red = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red; @@ -226,32 +279,36 @@ switch (pScrn->depth) { case 15: tmp = (red << 10) | (green << 5) | (blue); - OUTW(0x3C4, (tmp & 0xff) << 8 | 0x50); - OUTW(0x3C4, (tmp & 0xff00) | 0x51); - OUTW(0x3C4, 0x0052); - OUTW(0x3C4, 0xFF54); - OUTW(0x3C4, 0xFF55); - OUTW(0x3C4, 0x0056); + VIDEOOUT((tmp & 0xff), pTrident->keyOffset); + VIDEOOUT((tmp & 0xff00)>>8, (pTrident->keyOffset + 1)); + VIDEOOUT(0x00, (pTrident->keyOffset + 2)); + VIDEOOUT(0xFF, (pTrident->keyOffset + 4)); + VIDEOOUT(0xFF, (pTrident->keyOffset + 5)); + VIDEOOUT(0x00, (pTrident->keyOffset + 6)); break; case 16: tmp = (red << 11) | (green << 5) | (blue); - OUTW(0x3C4, (tmp & 0xff) << 8 | 0x50); - OUTW(0x3C4, (tmp & 0xff00) | 0x51); - OUTW(0x3C4, 0x0052); - OUTW(0x3C4, 0xFF54); - OUTW(0x3C4, 0xFF55); - OUTW(0x3C4, 0x0056); + VIDEOOUT((tmp & 0xff), pTrident->keyOffset); + VIDEOOUT((tmp & 0xff00)>>8, (pTrident->keyOffset + 1)); + VIDEOOUT(0x00, (pTrident->keyOffset + 2)); + VIDEOOUT(0xFF, (pTrident->keyOffset + 4)); + VIDEOOUT(0xFF, (pTrident->keyOffset + 5)); + VIDEOOUT(0x00, (pTrident->keyOffset + 6)); break; case 24: - OUTW(0x3C4, (blue<<8) | 0x50); - OUTW(0x3C4, (green<<8) | 0x51); - OUTW(0x3C4, (red<<8) | 0x52); - OUTW(0x3C4, 0xFF54); - OUTW(0x3C4, 0xFF55); - OUTW(0x3C4, 0xFF56); + VIDEOOUT(blue, pTrident->keyOffset); + VIDEOOUT(green, (pTrident->keyOffset + 1)); + VIDEOOUT(red, (pTrident->keyOffset + 2)); + VIDEOOUT(0xFF, (pTrident->keyOffset + 4)); + VIDEOOUT(0xFF, (pTrident->keyOffset + 5)); + VIDEOOUT(0xFF, (pTrident->keyOffset + 6)); break; } } + tridentSetVideoGamma(pTrident,pPriv->Gamma,pPriv->Brightness); + tridentSetVideoContrast(pTrident,pPriv->Contrast); + tridentSetVideoParameters(pTrident,pPriv->Brightness,pPriv->Saturation, + pPriv->HUE); } @@ -295,14 +352,33 @@ adapt->QueryImageAttributes = TRIDENTQueryImageAttributes; pPriv->colorKey = pTrident->videoKey & ((1 << pScrn->depth) - 1); + pPriv->Brightness = 45; + pPriv->Saturation = 80; + pPriv->Contrast = 4; + pPriv->Gamma = 0; + pPriv->HUE = 0; pPriv->videoStatus = 0; - + pPriv->fixFrame = 100; + /* gotta uninit this someplace */ REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); pTrident->adaptor = adapt; xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + if (pTrident->Chipset >= CYBER9397) { + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvHUE = MAKE_ATOM("XV_HUE"); + xvGamma = MAKE_ATOM("XV_GAMMA"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + } + + if (pTrident->Chipset >= PROVIDIA9682) + pTrident->keyOffset = 0x50; + else + pTrident->keyOffset = 0x30; TRIDENTResetVideo(pScrn); @@ -339,99 +415,10 @@ return TRUE; } -/* TRIDENTClipVideo - - - 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 -TRIDENTClipVideo( - BoxPtr dst, - INT32 *x1, - INT32 *x2, - INT32 *y1, - INT32 *y2, - 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); - 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(*x1 >= *x2) return FALSE; - - 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; - } - 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 -TRIDENTStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +TRIDENTStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); TRIDENTPortPrivPtr pPriv = (TRIDENTPortPrivPtr)data; @@ -439,7 +426,7 @@ REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - if(exit) { + if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { OUTW(vgaIOBase + 4, 0x008E); OUTW(vgaIOBase + 4, 0x008F); @@ -458,6 +445,93 @@ } } +#undef PI +#define PI 3.14159265 + +static void +tridentSetVideoContrast(TRIDENTPtr pTrident,int value) +{ + OUTW(0x3C4, (((value & 0x7)|((value & 0x7) << 4)) << 8) | 0xBC); +} + +static void +tridentSetVideoGamma(TRIDENTPtr pTrident,int value,int brightness) +{ + int pivots[] = {0,3,15,63,255}; + + int slope; + int y_0; + float x, x_prev = 0, y, y_prev = 0; + int i; + int exp; + CARD8 i_slopes[4]; + CARD8 intercepts[4]; + + brightness = (brightness - 0x20); + if (value == 0) { + OUTW(0x3C4, 0x80 << 8 | 0xB4); + OUTW(0x3C4, (brightness) << 8 | 0xB8); + OUTW(0x3C4, (brightness) << 8 | 0xB9); + OUTW(0x3C4, (brightness) << 8 | 0xBA); + OUTW(0x3C4, (brightness) << 8 | 0xBB); + return; + } + exp = log(value); + for (i = 0; i < 4; i++) { + x = pivots[i-1] / 255.0; + y = pow(x,exp); + slope = (y - y_prev) / (x - x_prev); + y_0 = y - x * slope; + { + int val = slope; + if (val > 7) + i_slopes[i] = (3 << 4) | (val & 0xf); + else if (val > 3) + i_slopes[i] = (2 << 4) | ((int)(slope / 2) & 0xf); + else if (val > 2) + i_slopes[i] = (1 << 4) | ((int)(slope / 4) & 0xf); + else + i_slopes[i] = ((int)(slope / 8) & 0xf); + } + intercepts[i] = y_0 * 256 / 4; + x_prev = x; + y_prev = y; + } + OUTW(0x3C4, i_slopes[0] << 8 | 0xB4); + OUTW(0x3C4, i_slopes[1] << 8 | 0xB5); + OUTW(0x3C4, i_slopes[2] << 8 | 0xB6); + OUTW(0x3C4, i_slopes[3] << 8 | 0xB7); + OUTW(0x3C4, (intercepts[0] + brightness) << 8 | 0xB8); + OUTW(0x3C4, (intercepts[1] + brightness) << 8 | 0xB9); + OUTW(0x3C4, (intercepts[2] + brightness) << 8 | 0xBA); + OUTW(0x3C4, (intercepts[3] + brightness) << 8 | 0xBB); +} + +static void +tridentSetVideoParameters(TRIDENTPtr pTrident, int brightness, + int saturation, int hue) +{ + double dtmp; + CARD8 sign, tmp, tmp1; + + if (brightness >= 0x20) + brightness -= 0x20; + else + brightness += 0x20; + dtmp = sin((double)hue / 180.0 * PI) * saturation / 12.5; + sign = (dtmp < 0) ? 1 << 1 : 0; + tmp1 = ((int)fabs(dtmp) >> 4) & 0x1; + tmp = brightness << 2 | sign | tmp1; + OUTW(0x3C4, tmp << 8 | 0xB1); + + tmp1 = ((int)fabs(dtmp) & 0x7 ) << 5; + dtmp = cos((double)hue / 180.0 * PI) * saturation / 12.5; + sign = (dtmp < 0) ? 1 << 4 : 0; + tmp1 |= (int)fabs(dtmp) & 0xf; + tmp = sign | tmp1; + OUTW(0x3C4, tmp << 8 | 0xB0); +} + static int TRIDENTSetPortAttribute( ScrnInfoPtr pScrn, @@ -474,9 +548,9 @@ pPriv->colorKey = value; switch (pScrn->depth) { case 8: - OUTW(0x3C4, (pPriv->colorKey<<8) | 0x50); - OUTW(0x3C4, 0x0051); - OUTW(0x3C4, 0x0052); + VIDEOOUT(pPriv->colorKey, pTrident->keyOffset); + VIDEOOUT(0x00, (pTrident->keyOffset + 1)); + VIDEOOUT(0x00, (pTrident->keyOffset + 2)); break; default: red = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red; @@ -485,25 +559,55 @@ switch (pScrn->depth) { case 15: tmp = (red << 10) | (green << 5) | (blue); - OUTW(0x3C4, (tmp&0xff)<<8 | 0x50); - OUTW(0x3C4, (tmp&0xff00) | 0x51); - OUTW(0x3C4, 0x0052); + VIDEOOUT((tmp&0xff), pTrident->keyOffset); + VIDEOOUT((tmp&0xff00)>>8, (pTrident->keyOffset + 1)); + VIDEOOUT(0x00, (pTrident->keyOffset + 2)); break; case 16: tmp = (red << 11) | (green << 5) | (blue); - OUTW(0x3C4, (tmp&0xff)<<8 | 0x50); - OUTW(0x3C4, (tmp&0xff00) | 0x51); - OUTW(0x3C4, 0x0052); + VIDEOOUT((tmp&0xff), pTrident->keyOffset); + VIDEOOUT((tmp&0xff00)>>8, (pTrident->keyOffset + 1)); + VIDEOOUT(0x00, (pTrident->keyOffset + 2)); break; case 24: - OUTW(0x3C4, (blue<<8) | 0x50); - OUTW(0x3C4, (green<<8) | 0x51); - OUTW(0x3C4, (red<<8) | 0x52); + VIDEOOUT(blue, pTrident->keyOffset); + VIDEOOUT(green, (pTrident->keyOffset + 1)); + VIDEOOUT(red, (pTrident->keyOffset + 2)); break; } } REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - } else return BadMatch; + } else if (attribute == xvBrightness) { + if ((value < 0) || (value > 0x3f)) + return BadValue; + pPriv->Brightness = value; + tridentSetVideoParameters(pTrident, pPriv->Brightness, pPriv->Saturation, + pPriv->HUE); + } else if (attribute == xvSaturation) { + if ((value < 0) || (value > 187)) + return BadValue; + pPriv->Saturation = value; + tridentSetVideoParameters(pTrident, pPriv->Brightness, pPriv->Saturation, + pPriv->HUE); + } else if (attribute == xvHUE) { + if ((value < 0) || (value > 360)) + return BadValue; + pPriv->HUE = value; + tridentSetVideoParameters(pTrident, pPriv->Brightness, pPriv->Saturation, + pPriv->HUE); + tridentSetVideoGamma(pTrident,pPriv->Gamma,pPriv->Brightness); + } else if (attribute == xvGamma) { + if ((value < -128) || (value > 127)) + return BadValue; + pPriv->Gamma = value; + tridentSetVideoGamma(pTrident,value,pPriv->Brightness); + } else if (attribute == xvContrast) { + if ((value < 0) || (value > 127)) + return BadValue; + pPriv->Contrast = value; + tridentSetVideoContrast(pTrident,value); + } else + return BadMatch; return Success; } @@ -519,7 +623,18 @@ if(attribute == xvColorKey) { *value = pPriv->colorKey; - } else return BadMatch; + } else if(attribute == xvBrightness) { + *value = pPriv->Brightness; + } else if(attribute == xvSaturation) { + *value = pPriv->Saturation; + } else if (attribute == xvHUE) { + *value = pPriv->HUE; + } else if (attribute == xvGamma) { + *value = pPriv->Gamma; + } else if (attribute == xvContrast) { + *value = pPriv->Contrast; + } else + return BadMatch; return Success; } @@ -651,18 +766,26 @@ switch(id) { case 0x35315652: /* RGB15 */ case 0x36315652: /* RGB16 */ - OUTW(vgaIOBase + 4, 0x22BF); + if (pTrident->Chipset >= CYBER9397) { + OUTW(vgaIOBase + 4, 0x22BF); + } else { + OUTW(vgaIOBase + 4, 0x118F); + } break; case FOURCC_YV12: /* YV12 */ case FOURCC_YUY2: /* YUY2 */ default: - OUTW(vgaIOBase + 4, 0x00BF); + if (pTrident->Chipset >= CYBER9397) { + OUTW(vgaIOBase + 4, 0x00BF); + } else { + OUTW(vgaIOBase + 4, 0x108F); + } break; } tx1 = dstBox->x1 + pTrident->hsync; - tx2 = dstBox->x2 + pTrident->hsync; + tx2 = dstBox->x2 + pTrident->hsync + pTrident->hsync_rskew; ty1 = dstBox->y1 + pTrident->vsync - 2; - ty2 = dstBox->y2 + pTrident->vsync + 2; + ty2 = dstBox->y2 + pTrident->vsync + 2 + pTrident->vsync_bskew; OUTW(vgaIOBase + 4, (tx1 & 0xff) <<8 | 0x86); OUTW(vgaIOBase + 4, (tx1 & 0xff00) | 0x87); @@ -675,27 +798,41 @@ 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); - OUTW(vgaIOBase + 4, ((offset>>3) & 0xff00) | 0x93); - OUTW(vgaIOBase + 4, ((offset>>3) & 0xff0000) >> 8 | 0x94); + if (pTrident->videoFlags & VID_OFF_SHIFT_4) + offset = offset >> 4; + else + offset = offset >> 3; + + OUTW(vgaIOBase + 4, (((width<<1) & 0xff)<<8) | 0x90); + OUTW(vgaIOBase + 4, ((width<<1) & 0xff00) | 0x91); + OUTW(vgaIOBase + 4, ((offset) & 0xff) << 8 | 0x92); + OUTW(vgaIOBase + 4, ((offset) & 0xff00) | 0x93); + OUTW(vgaIOBase + 4, ((offset) & 0xff0000) >> 8 | 0x94); /* Horizontal Zoom */ + if (pTrident->videoFlags & VID_ZOOM_INV) { + if ((pTrident->videoFlags & VID_ZOOM_MINI) && src_w > drw_w) + zoomx2 = (int)((float)drw_w/(float)src_w * 1024) + | (((int)((float)src_w/(float)drw_w) - 1)&7)<<10 | 0x8000; + else + zoomx2 = (int)(float)src_w/(float)drw_w * 1024; + + OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); + OUTW(vgaIOBase + 4, (zoomx2&0x9f00) | 0x81); + } else { if (drw_w == src_w) { OUTW(vgaIOBase + 4, 0x0080); OUTW(vgaIOBase + 4, 0x0081); } else if (drw_w > src_w) { float z; - if (pTrident->Chipset >= BLADE3D) - z = (float)src_w/(float)drw_w; - else - z = (float)drw_w/(float)src_w - 1; + + 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); + OUTW(vgaIOBase + 4, (zoomx1&0x0f)<<10 | (zoomx2&0x0300) |0x81); } else { zoomx1 = ((float)drw_w/(float)src_w); zoomx2 = ( ((float)drw_w/(float)src_w) - (int)zoomx1 ) * 1024; @@ -703,22 +840,32 @@ OUTW(vgaIOBase + 4, (zoomx2&0x0300)| (((int)((float)src_w/(float)drw_w)-1)&7)<<10 | 0x8081); } + } /* Vertical Zoom */ + if (pTrident->videoFlags & VID_ZOOM_INV) { + if ((pTrident->videoFlags & VID_ZOOM_MINI) && src_h > drw_h) + zoomy2 = (int)(( ((float)drw_h/(float)src_h)) * 1024) + | (((int)((float)src_h/(float)drw_h)-1)&7)<<10 + | 0x8000; + else + zoomy2 = ( ((float)src_h/(float)drw_h)) * 1024; + OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); + OUTW(vgaIOBase + 4, (zoomy2&0x9f00) | 0x0083); + } else { if (drw_h == src_h) { OUTW(vgaIOBase + 4, 0x0082); OUTW(vgaIOBase + 4, 0x0083); } else if (drw_h > src_h) { float z; - if (pTrident->Chipset >= BLADE3D) - z = (float)src_h/(float)drw_h; - else - z = (float)drw_h/(float)src_h - 1; + + 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); + OUTW(vgaIOBase + 4, (zoomy1&0x0f)<<10 | (zoomy2&0x0300) |0x83); } else { zoomy1 = ((float)drw_h/(float)src_h); zoomy2 = ( ((float)drw_h/(float)src_h) - (int)zoomy1 ) * 1024; @@ -726,19 +873,38 @@ OUTW(vgaIOBase + 4, (zoomy2&0x0300)| (((int)((float)src_h/(float)drw_h)-1)&7)<<10 | 0x8083); } + } - OUTW(vgaIOBase + 4, 0x0895); - OUTW(vgaIOBase + 4, ((width+2)>>2)<<8 | 0x96); + if (pTrident->Chipset >= CYBER9397) { + int lb = (width+2) >> 2; - OUTW(vgaIOBase + 4, 0x0097); - OUTW(vgaIOBase + 4, 0x00BA); - OUTW(vgaIOBase + 4, 0x00BB); - OUTW(vgaIOBase + 4, 0xFFBC); - OUTW(vgaIOBase + 4, 0xFFBD); - OUTW(vgaIOBase + 4, 0x04BE); + OUTW(vgaIOBase + 4, ((lb & 0x100)>>1) | 0x0895); + OUTW(vgaIOBase + 4, (lb & 0xFF)<<8 | 0x0096); - OUTW(vgaIOBase + 4, 0xD48E); - OUTW(vgaIOBase + 4, 0x208F); + if (src_w > 384) { + OUTW(0x3C4, 0x0497); /* 2x line buffers */ + } else { + OUTW(0x3C4, 0x0097); /* 1x line buffers */ + } + OUTW(vgaIOBase + 4, 0x0097); + OUTW(vgaIOBase + 4, 0x00BA); + OUTW(vgaIOBase + 4, 0x00BB); + OUTW(vgaIOBase + 4, 0xFFBC); + OUTW(vgaIOBase + 4, 0xFFBD); + OUTW(vgaIOBase + 4, 0x04BE); + OUTW(vgaIOBase + 4, 0xD48E); + OUTW(vgaIOBase + 4, 0x208F); + } else { + + OUTW(vgaIOBase + 4, ((((id == FOURCC_YV12) || (id == FOURCC_YUY2)) + ? (width >> 2) : (width >> 6)) << 8) | 0x95); + OUTW(vgaIOBase + 4, ((((id == FOURCC_YV12) || (id == FOURCC_YUY2)) + ? ((width+2) >> 2) : ((width+2) >> 6)) << 8) |0x96); + + OUTW(vgaIOBase + 4, 0x938E); + OUTB(0x83C8, 0x00); + OUTB(0x83C6, 0x95); + } } static int @@ -762,7 +928,7 @@ int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; - + /* Clip */ x1 = src_x; x2 = src_x + src_w; @@ -774,7 +940,8 @@ dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!TRIDENTClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + width, height)) return Success; dstBox.x1 -= pScrn->frameX0; @@ -812,6 +979,7 @@ left <<= 1; offset = pPriv->linear->offset * bpp; + dst_start = pTrident->FbBase + offset + left + (top * dstPitch); switch(id) { @@ -842,14 +1010,14 @@ /* update cliplist */ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + /* update cliplist */ REGION_COPY(pScreen, &pPriv->clip, clipBoxes); - /* draw these */ - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } offset += top * dstPitch; + + tridentFixFrame(pScrn,&pPriv->fixFrame); TRIDENTDisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); @@ -1039,7 +1207,7 @@ dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!TRIDENTClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, surface->width, surface->height)) { return Success; @@ -1052,13 +1220,12 @@ TRIDENTResetVideo(pScrn); + tridentFixFrame(pScrn,&portPriv->fixFrame); TRIDENTDisplayVideo(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)); + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); pPriv->isOn = TRUE; /* we've prempted the XvImage stream so set its free timer */ @@ -1128,4 +1295,122 @@ pTrident->VideoTimerCallback = NULL; } -#endif /* !XvExtension */ + /* Calculate skew offsets for video overlay */ + + +void +tridentFixFrame(ScrnInfoPtr pScrn, int *fixFrame) +{ + + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int vgaIOBase = VGAHWPTR(pScrn)->IOBase; + int HTotal, HSyncStart; + int VTotal, VSyncStart; + int h_off = 0; + int v_off = 0; + unsigned char CRTC[0x11]; + Bool isShadow; + unsigned char shadow = 0; + + if ((*fixFrame)++ < 100) + return; + + *fixFrame = 0; + isShadow = (pTrident->ModeReg.tridentRegs3CE[CyberControl] & 0x81) == 0x81; + + if (isShadow) + SHADOW_ENABLE(shadow); + + OUTB(vgaIOBase + 4, 0x0); + CRTC[0x0] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x4); + CRTC[0x4] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x5); + CRTC[0x5] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x6); + CRTC[0x6] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x7); + CRTC[0x7] = INB(vgaIOBase + 5); + OUTB(vgaIOBase + 4, 0x10); + CRTC[0x10] = INB(vgaIOBase + 5); + + HTotal = CRTC[0] << 3; + VTotal = CRTC[6] + | ((CRTC[7] & (1<<0)) << 8) + | ((CRTC[7] & (1<<5)) << 4); + HSyncStart = (CRTC[4] + + ((CRTC[5] >> 5) & 0x3)) << 3; + VSyncStart = CRTC[0x10] + | ((CRTC[7] & (1<<2)) << 6) + | ((CRTC[7] & (1<<7)) << 2); + + if (isShadow) { + SHADOW_RESTORE(shadow); + 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; + } + } + + pTrident->hsync = (HTotal - HSyncStart) + 23 + h_off; + pTrident->vsync = (VTotal - VSyncStart) - 2 + v_off; + + /* + * HACK !! As awful as this is, it appears to be the only way....Sigh! + * We have XvHsync and XvVsync as options now, which adjust + * at the very end of this function. It'll be helpful for now + * and we can get more data on some of these skew values. + */ + switch (pTrident->Chipset) { + case TGUI9680: + /* Furthur tweaking needed */ +#if 0 + pTrident->hsync -= (mode->CrtcHTotal / 16); +#endif + pTrident->vsync += 2; + break; + case PROVIDIA9682: + /* Furthur tweaking needed */ + pTrident->hsync += 7; + break; + case PROVIDIA9685: + /* Spot on */ + break; + case CYBERBLADEXPm8: + case CYBERBLADEXPm16: + case CYBERBLADEXPAI1: + pTrident->hsync -= 15; + pTrident->hsync_rskew = 3; + break; + case BLADE3D: + if (pScrn->depth == 24) + pTrident->hsync -= 8; + else + pTrident->hsync -= 6; + break; + case CYBERBLADEI7: + case CYBERBLADEI7D: + case CYBERBLADEI1: + case CYBERBLADEI1D: + pTrident->hsync -= 8; + break; + case CYBERBLADEAI1: + pTrident->hsync -= 7; + break; + case CYBERBLADEAI1D: + pTrident->vsync += 2; + pTrident->vsync_bskew = -4; + pTrident->hsync -= 5; + break; + case CYBERBLADEE4: + pTrident->hsync -= 8; + break; + } + pTrident->hsync+=pTrident->OverrideHsync; + pTrident->vsync+=pTrident->OverrideVsync; + pTrident->hsync_rskew+=pTrident->OverrideRskew; + pTrident->vsync_bskew+=pTrident->OverrideBskew; +} + Index: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c:1.18 Tue May 15 06:19:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c Sat Oct 27 23:33:52 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.18 2001/05/15 10:19:41 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c,v 1.20 2001/10/28 03:33:52 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -57,16 +57,17 @@ endn = 255; endm = 63; endk = 2; - if (clock >= 100000) startk = 0; - if (clock < 100000) startk = 1; - if (clock < 50000) startk = 2; + if (clock >= 100000) startk = 0; else + if (clock >= 50000) startk = 1; else + startk = 2; } else { endn = 121; endm = 31; endk = 1; - startk = 0; + if (clock > 50000) startk = 1; else + startk = 0; } freq = clock; Index: xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c:1.3 Tue Oct 26 18:46:59 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c Wed Sep 12 09:50:12 2001 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c,v 1.3 1999/10/26 22:46:59 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c,v 1.5 2001/09/12 13:50:12 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -63,7 +63,10 @@ pReg->tridentRegs3C4[OldMode2] = 0x10; OUTB(0x3C4, 0x0B); INB(0x3C5); /* Back to New Mode */ pReg->tridentRegs3x4[Underline] = 0x40; + if (pTrident->Chipset < TGUI9440AGi) + pReg->tridentRegs3x4[CRTCMode] = 0xA3; } + if (pScrn->videoRam > 512) pReg->tridentRegs3C4[ConfPort2] |= 0x20; else @@ -75,8 +78,11 @@ offset = pScrn->displayWidth >> 4; break; case 8: + if (pScrn->videoRam < 1024) + offset = pScrn->displayWidth >> 3; + else + offset = pScrn->displayWidth >> 4; pReg->tridentRegs3CE[MiscExtFunc] |= 0x02; - offset = pScrn->displayWidth >> 4; break; case 16: pReg->tridentRegs3CE[MiscExtFunc] |= 0x02; @@ -164,6 +170,8 @@ OUTW_3C4(ConfPort2); if (pScrn->bitsPerPixel >= 8) { OUTW_3x4(Underline); + if (pTrident->Chipset < TGUI9440AGi) + OUTW_3x4(CRTCMode); } OUTW_3x4(AddColReg); OUTW_3CE(MiscExtFunc); @@ -209,6 +217,8 @@ if (pScrn->bitsPerPixel >= 8) { INB_3x4(Underline); + if (pTrident->Chipset < TGUI9440AGi) + INB_3x4(CRTCMode); } INB_3x4(LinearAddReg); INB_3x4(FIFOControl); Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dga.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dga.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dga.c:1.1 Wed Dec 6 10:35:24 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dga.c Mon Oct 1 09:44:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dga.c,v 1.1 2000/12/06 15:35:24 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dga.c,v 1.2 2001/10/01 13:44:11 eich Exp $ */ /* * Copyright 2000 by Rainer Keller, <Rainer.Keller@studmail.uni-stuttgart.de>. * @@ -73,7 +73,6 @@ return FALSE; if (!pTseng->DGAnumModes) { - ErrorF("DGAINIT\n"); pMode = firstMode = pScrn->modes; while (pMode) { newmodes = xrealloc(modes, (num + 1) * sizeof (DGAModeRec)); Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.84 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.89 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.84 Fri May 4 15:05:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c Fri Jan 4 16:22:36 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.84 2001/05/04 19:05:48 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.89 2002/01/04 21:22:36 tsi Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -220,47 +220,51 @@ }; static const char *int10Symbols[] = { - "xf86InitInt10", "xf86FreeInt10", + "xf86InitInt10", NULL }; static const char *vgaHWSymbols[] = { - "vgaHWMapMem", - "vgaHWUnmapMem", + "vgaHWFreeHWRec", "vgaHWGetHWRec", "vgaHWGetIOBase", + "vgaHWGetIndex", "vgaHWHandleColormaps", - "vgaHWUnlock", - "vgaHWLock", - "vgaHWSaveScreen", "vgaHWInit", - "vgaHWSave", - "vgaHWRestore", - "vgaHWBlankScreen", - "vgaHWSeqReset", + "vgaHWLock", + "vgaHWMapMem", "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", + "vgaHWSaveScreen", + "vgaHWUnlock", + "vgaHWUnmapMem", NULL }; -static const char* fbSymbols[] = { +static const char* miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", - "fbScreenInit", + NULL +}; + +static const char* fbSymbols[] = { "fbPictureInit", + "fbScreenInit", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", NULL }; @@ -307,8 +311,8 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(vgaHWSymbols, fbSymbols, xaaSymbols, - ramdacSymbols, NULL); + LoaderRefSymLists(vgaHWSymbols, miscfbSymbols, fbSymbols, xaaSymbols, + int10Symbols, ramdacSymbols, NULL); /* * The return value must be non-NULL on success even though there @@ -1100,7 +1104,9 @@ TsengPtr pTseng = TsengPTR(pScrn); if (pTseng->UseLinMem && pTseng->Linmem_1meg) { - TsengDoMemLimit(pScrn, ram, 1024, "in linear mode on this VGA board/bus configuration"); + ram = TsengDoMemLimit(pScrn, ram, 1024, + "in linear mode on " + "this VGA board/bus configuration"); } if (pTseng->UseAccel && pTseng->UseLinMem) { if (Is_W32_any) { @@ -1110,19 +1116,33 @@ * 2*1MB via apertures MBP0 and MBP1 */ if (Is_W32p_cd) - TsengDoMemLimit(pScrn, ram, 2048, "in linear + accelerated mode on W32p rev c and d"); - - TsengDoMemLimit(pScrn, ram, 2048 + 1024, "in linear + accelerated mode on W32/W32i/W32p"); + ram = TsengDoMemLimit(pScrn, ram, 2048, + "in linear + accelerated mode " + "on W32p rev c and d"); + + ram = TsengDoMemLimit(pScrn, ram, 2048 + 1024, + "in linear + accelerated mode " + "on W32/W32i/W32p"); - /* upper 516kb of 4MB linear map used for "externally mapped registers" */ - TsengDoMemLimit(pScrn, ram, 4096 - 516, "in linear + accelerated mode on W32/W32i/W32p"); + /* + * upper 516kb of 4MB linear map used for + * "externally mapped registers" + */ + ram = TsengDoMemLimit(pScrn, ram, 4096 - 516, + "in linear + accelerated mode " + "on W32/W32i/W32p"); } if (Is_ET6K) { - /* upper 8kb used for externally mapped and memory mapped registers */ - TsengDoMemLimit(pScrn, ram, 4096 - 8, "in linear + accelerated mode on ET6000/6100"); + /* + * upper 8kb used for externally mapped and + * memory mapped registers + */ + ram = TsengDoMemLimit(pScrn, ram, 4096 - 8, + "in linear + accelerated mode " + "on ET6000/6100"); } } - TsengDoMemLimit(pScrn, ram, 4096, "on any Tseng card"); + ram = TsengDoMemLimit(pScrn, ram, 4096, "on any Tseng card"); return ram; } @@ -1366,12 +1386,10 @@ { MessageType from; TsengPtr pTseng = TsengPTR(pScrn); - resRange range[] = { {ResExcMemBlock,0,0},_END }; + resRange range[] = { {ResExcMemBlock|ResBus,0,0},_END }; PDEBUG(" TsengGetLinFbAddress\n"); - from = X_PROBED; - /* let config file override Base address */ if (pTseng->pEnt->device->MemBase != 0) { pTseng->LinFbAddress = pTseng->pEnt->device->MemBase; @@ -1410,7 +1428,7 @@ pTseng->UseLinMem = FALSE; return TRUE; } - if (xf86RegisterResources(pTseng->pEnt->index,range,ResNone)) { + if (xf86RegisterResources(pTseng->pEnt->index,NULL,ResNone)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, " Cannot register linear memory." " Using banked mode instead.\n"); @@ -1793,7 +1811,7 @@ pScrn->display->virtualX, pScrn->display->virtualY, pTseng->FbMapSize, - LOOKUP_BEST_REFRESH); /* LOOKUP_CLOSEST_CLOCK | LOOKUP_CLKDIV2 when no programable clock ? */ + LOOKUP_BEST_REFRESH); /* LOOKUP_CLOSEST_CLOCK | LOOKUP_CLKDIV2 when no programmable clock ? */ if (i == -1) { TsengFreeRec(pScrn); @@ -1847,7 +1865,7 @@ TsengFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); break; } @@ -2068,8 +2086,6 @@ pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit(pScreen, 0, 0); break; } @@ -2078,9 +2094,6 @@ xf86SetBlackWhitePixels(pScreen); - if (pScrn->depth >= 8) - TsengDGAInit(pScreen); - if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; @@ -2095,6 +2108,13 @@ } } } + + /* must be after RGB ordering fixed */ + if (pScrn->bitsPerPixel > 4) + fbPictureInit(pScreen, 0, 0); + + if (pScrn->depth >= 8) + TsengDGAInit(pScreen); /* * If banking is needed, initialise an miBankInfoRec (defined in Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c:1.25 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c:1.25 Thu Feb 15 12:54:56 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c Sat Oct 27 23:33:53 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c,v 1.25 2001/02/15 17:54:56 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c,v 1.26 2001/10/28 03:33:53 tsi Exp $ */ @@ -46,8 +46,6 @@ #define RAMDAC_WRITE 0x3c8 #define RAMDAC_RAM 0x3c9 -static unsigned char black_cmap[] = -{0x0, 0x0, 0x0}; static unsigned char white_cmap[] = {0xff, 0xff, 0xff}; @@ -524,9 +522,11 @@ {0x00, 0xa0, 0xc0, 0xe0, 0xe0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +#if 0 static unsigned char CMD_SC15025[] = {0x00, 0xa0, 0xe0, 0x60, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +#endif static unsigned char CMD_MU4910[] = {0x1C, 0xBC, 0xDC, 0xFC, 0xFF, Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c diff -u xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.25 xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.29 --- xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.25 Fri May 4 15:05:49 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c Wed Oct 31 17:50:29 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.25 2001/05/04 19:05:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.29 2001/10/31 22:50:29 tsi Exp $ */ #include "videodev.h" #include "xf86.h" @@ -207,6 +207,8 @@ static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn) { + static int first = 1; + if (-1 == V4L_FD) { V4L_FD = open(V4L_NAME, O_RDWR, 0); @@ -215,7 +217,12 @@ pPPriv->rgb_fbuf.depth = pScrn->bitsPerPixel; pPPriv->rgb_fbuf.bytesperline = pScrn->displayWidth * ((pScrn->bitsPerPixel + 7)/8); pPPriv->rgb_fbuf.base = (pointer)(pScrn->memPhysBase + pScrn->fbOffset); - + if (first) { + first = 0; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + "v4l: memPhysBase=%p\n", pScrn->memPhysBase); + } + switch (pScrn->bitsPerPixel) { case 16: if (pScrn->weight.green == 5) { @@ -459,7 +466,9 @@ short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, pointer data) { +#if 0 PortPrivPtr pPPriv = (PortPrivPtr) data; +#endif DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PS\n")); @@ -468,7 +477,7 @@ } static void -V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { PortPrivPtr pPPriv = (PortPrivPtr) data; int zero=0; @@ -478,9 +487,9 @@ "Xv/StopVideo called with video already off\n")); return; } - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/StopVideo exit=%d\n",exit)); + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/StopVideo shutdown=%d\n",shutdown)); - if (!exit) { + if (!shutdown) { /* just reclipping, we have to stop DMA transfers to the visible screen */ if (VIDEO_RGB == pPPriv->VideoOn) { if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero)) @@ -857,6 +866,7 @@ if (!pPPriv) return FALSE; memset(pPPriv,0,sizeof(PortPrivRec)); + pPPriv->nr = d; /* check device */ if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) || Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man diff -u xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man:1.2.2.1 xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man:1.2.2.1 Tue May 29 18:28:23 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man Tue May 29 18:24:06 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man,v 1.2.2.1 2001/05/29 22:28:23 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man,v 1.3 2001/05/29 22:24:06 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH V4L __drivermansuffix__ __vendorversion__ Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.16.2.2 xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.16.2.2 Mon May 28 17:36:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c Mon Oct 1 09:44:12 2001 @@ -27,7 +27,7 @@ * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.16.2.2 2001/05/28 21:36:43 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.24 2001/10/01 13:44:12 eich Exp $ */ #include "vesa.h" @@ -42,6 +42,10 @@ #include "micmap.h" #include "xf86cmap.h" +/* DPMS */ +#define DPMS_SERVER +#include "extensions/dpms.h" + /* Mandatory functions */ static const OptionInfoRec * VESAAvailableOptions(int chipid, int busid); static void VESAIdentify(int flags); @@ -77,11 +81,11 @@ VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); static void *VESAWindowPlanar(ScreenPtr pScrn, CARD32 row, CARD32 offset, - int mode, CARD32 *size); + int mode, CARD32 *size, void *closure); static void *VESAWindowLinear(ScreenPtr pScrn, CARD32 row, CARD32 offset, - int mode, CARD32 *size); + int mode, CARD32 *size, void *closure); static void *VESAWindowWindowed(ScreenPtr pScrn, CARD32 row, CARD32 offset, - int mode, CARD32 *size); + int mode, CARD32 *size, void *closure); static Bool VESADGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen); @@ -141,18 +145,21 @@ * xf86LoaderReqSymLists(). The purpose is this is to avoid warnings about * unresolved symbols that are not required. */ -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", "afbScreenInit", - "fbScreenInit", - "fbPictureInit", - "cfbScreenInit", "mfbScreenInit", "cfb24_32ScreenInit", NULL }; +static const char *fbSymbols[] = { + "fbPictureInit", + "fbScreenInit", + NULL +}; + static const char *shadowSymbols[] = { "shadowAlloc", "shadowInit", @@ -163,16 +170,36 @@ }; static const char *vbeSymbols[] = { + "VBEBankSwitch", + "VBEFreeModeInfo", + "VBEGetModeInfo", + "VBEGetVBEInfo", + "VBEGetVBEMode", "VBEInit", + "VBESaveRestore", + "VBESetDisplayStart", + "VBESetGetDACPaletteFormat", + "VBESetGetLogicalScanlineLength", + "VBESetGetPaletteData", + "VBESetVBEMode", "vbeDoEDID", + "vbeFree", NULL }; static const char *ddcSymbols[] = { "xf86PrintEDID", "xf86SetDDCproperties", - NULL}; + NULL +}; +#if 0 +static const char *vgahwSymbols[] = { + "vgaHWDPMSSet", + NULL +}; +#endif + #ifdef XFree86LOADER /* Module loader interface */ @@ -207,7 +234,8 @@ { Initialised = TRUE; xf86AddDriver(&VESA, Module, 0); - LoaderRefSymLists(fbSymbols, + LoaderRefSymLists(miscfbSymbols, + fbSymbols, shadowSymbols, vbeSymbols, ddcSymbols, @@ -365,8 +393,8 @@ VESAFreeRec(ScrnInfoPtr pScrn) { VESAPtr pVesa = VESAGetRec(pScrn); - DisplayModePtr mode = pScrn->modes; #if 0 + DisplayModePtr mode = pScrn->modes; /* I am not sure if the modes will ever get freed. * Anyway, the data unknown to other modules is being freed here. */ @@ -422,13 +450,20 @@ pVesa->device = xf86GetDevFromEntity(pScrn->entityList[0], pScrn->entityInstanceList[0]); +#if 0 /* Load vgahw module */ if (!xf86LoadSubModule(pScrn, "vgahw")) return (FALSE); - + + xf86LoaderReqSymLists(vgahwSymbols, NULL); +#endif + /* Load vbe module */ if ((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL) return (FALSE); + + xf86LoaderReqSymLists(vbeSymbols, NULL); + if ((pVesa->pVbe = VBEInit(NULL, pVesa->pEnt->index)) == NULL) return (FALSE); @@ -446,8 +481,10 @@ pScrn->progClock = TRUE; pScrn->rgbBits = 8; - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb)) + if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb)) { + vbeFree(pVesa->pVbe); return (FALSE); + } xf86PrintDepthBpp(pScrn); /* Get the depth24 pixmap format */ @@ -455,12 +492,15 @@ pVesa->pix24bpp = xf86GetBppFromDepth(pScrn, 24); /* color weight */ - if (pScrn->depth > 8 && !xf86SetWeight(pScrn, rzeros, rzeros)) + if (pScrn->depth > 8 && !xf86SetWeight(pScrn, rzeros, rzeros)) { + vbeFree(pVesa->pVbe); return (FALSE); - + } /* visual init */ - if (!xf86SetDefaultVisual(pScrn, -1)) + if (!xf86SetDefaultVisual(pScrn, -1)) { + vbeFree(pVesa->pVbe); return (FALSE); + } xf86SetGamma(pScrn, gzeros); @@ -472,8 +512,10 @@ if (pVesa->major >= 2) { /* Load ddc module */ - if ((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) + if ((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) { + vbeFree(pVesa->pVbe); return (FALSE); + } if ((pVesa->monitor = vbeDoEDID(pVesa->pVbe, pDDCModule)) != NULL) { xf86PrintEDID(pVesa->monitor); @@ -643,6 +685,7 @@ pVesa->mapSize = vbe->TotalMemory * 65536; if (pScrn->modePool == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No matching modes\n"); + vbeFree(pVesa->pVbe); return (FALSE); } for (i = 0; pScrn->modePool != NULL && pScrn->display->modes[i] != NULL; i++) { @@ -757,18 +800,21 @@ if (pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes\n"); + vbeFree(pVesa->pVbe); return (FALSE); } /* options */ xf86CollectOptions(pScrn, NULL); - if (!(pVesa->Options = xalloc(sizeof(VESAOptions)))) + if (!(pVesa->Options = xalloc(sizeof(VESAOptions)))) { + vbeFree(pVesa->pVbe); return FALSE; + } memcpy(pVesa->Options, VESAOptions, sizeof(VESAOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pVesa->Options); /* Use shadow by default */ - if (xf86ReturnOptValBool(pVesa->Options, OPTION_SHADOW_FB, TRUE)) + if (xf86ReturnOptValBool(pVesa->Options, OPTION_SHADOW_FB, TRUE)) pVesa->shadowFB = TRUE; mode = ((ModeInfoData*)pScrn->modes->Private)->data; @@ -784,7 +830,6 @@ case 0x3: /* Planar */ if (pVesa->shadowFB) { mod = "fb"; - reqSym = "fbScreenInit"; pScrn->bitmapBitOrder = BITMAP_BIT_ORDER; xf86LoaderReqSymbols("fbPictureInit", NULL); @@ -809,9 +854,7 @@ case 0x4: /* Packed pixel */ case 0x6: /* Direct Color */ mod = "fb"; - reqSym = "fbScreenInit"; pScrn->bitmapBitOrder = BITMAP_BIT_ORDER; - xf86LoaderReqSymbols("fbPictureInit", NULL); switch (pScrn->bitsPerPixel) { case 8: @@ -827,6 +870,7 @@ default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unsupported bpp: %d", pScrn->bitsPerPixel); + vbeFree(pVesa->pVbe); return FALSE; } break; @@ -838,17 +882,29 @@ mod = "mfb"; reqSym = "mfbScreenInit"; } - if (!xf86LoadSubModule(pScrn, "shadow")) + if (!xf86LoadSubModule(pScrn, "shadow")) { + vbeFree(pVesa->pVbe); return (FALSE); + } xf86LoaderReqSymLists(shadowSymbols, NULL); } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { VESAFreeRec(pScrn); + vbeFree(pVesa->pVbe); return (FALSE); + } + + if (mod) { + if (reqSym) { + xf86LoaderReqSymbols(reqSym, NULL); + } else { + xf86LoaderReqSymLists(fbSymbols, NULL); + } } - xf86LoaderReqSymbols(reqSym, NULL); + vbeFree(pVesa->pVbe); + return (TRUE); } @@ -860,7 +916,11 @@ VisualPtr visual; VbeModeInfoBlock *mode; int flags; + int init_picture = 0; + if ((pVesa->pVbe = VBEInit(NULL, pVesa->pEnt->index)) == NULL) + return (FALSE); + if (pVesa->mapPhys == 0) { mode = ((ModeInfoData*)(pScrn->currentMode->Private))->data; pScrn->videoRam = pVesa->mapSize; @@ -942,7 +1002,7 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return (FALSE); - fbPictureInit(pScreen, 0, 0); + init_picture = 1; } } else { switch (pScrn->bitsPerPixel) { @@ -991,7 +1051,7 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return (FALSE); - fbPictureInit(pScreen, 0, 0); + init_picture = 1; break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1017,6 +1077,10 @@ } } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit(pScreen, 0, 0); + if (pVesa->shadowFB) { ShadowUpdateProc update; ShadowWindowProc window; @@ -1124,6 +1188,7 @@ if (pVesa->pDGAMode) { xfree(pVesa->pDGAMode); pVesa->pDGAMode = NULL; + pVesa->nDGAMode = 0; } pScrn->vtSema = FALSE; @@ -1210,8 +1275,14 @@ pScrn->memPhysBase = pVesa->mapPhys; pScrn->fbOffset = pVesa->mapOff; - pVesa->base = xf86MapVidMem(pScrn->scrnIndex, 0, - pScrn->memPhysBase, pVesa->mapSize); + if (pVesa->mapPhys != 0xa0000 && pVesa->pEnt->location.type == BUS_PCI) + pVesa->base = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + pVesa->pciTag, pScrn->memPhysBase, + pVesa->mapSize); + else + pVesa->base = xf86MapVidMem(pScrn->scrnIndex, 0, + pScrn->memPhysBase, pVesa->mapSize); + if (pVesa->base) { if (pVesa->mapPhys != 0xa0000) pVesa->VGAbase = xf86MapVidMem(pScrn->scrnIndex, 0, @@ -1242,7 +1313,7 @@ void * VESAWindowPlanar(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); @@ -1264,7 +1335,7 @@ static void * VESAWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); @@ -1275,7 +1346,7 @@ static void * VESAWindowWindowed(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); @@ -1397,6 +1468,16 @@ return (inb(VGA_GRAPH_DATA)); } +#define WriteCrtc(index, value) outb(VGA_CRTC_INDEX_OFFSET, index);\ + outb(VGA_CRTC_DATA_OFFSET, value) + +static int +ReadCrtc(int index) +{ + outb(VGA_CRTC_INDEX_OFFSET, index); + return inb(VGA_CRTC_DATA_OFFSET); +} + static void SeqReset(Bool start) { @@ -1652,7 +1733,45 @@ VESADisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode, int flags) { +#if 0 + /* XXX How can this work without the vgahw module being initialized? */ vgaHWDPMSSet(pScrn, mode, flags); +#else + unsigned char seq1 = 0, crtc17 = 0; + + if (!pScrn->vtSema) + return; + + switch (mode) { + case DPMSModeOn: + /* Screen: On; HSync: On, VSync: On */ + seq1 = 0x00; + crtc17 = 0x80; + break; + case DPMSModeStandby: + /* Screen: Off; HSync: Off, VSync: On -- Not Supported */ + seq1 = 0x20; + crtc17 = 0x80; + break; + case DPMSModeSuspend: + /* Screen: Off; HSync: On, VSync: Off -- Not Supported */ + seq1 = 0x20; + crtc17 = 0x80; + break; + case DPMSModeOff: + /* Screen: Off; HSync: Off, VSync: Off */ + seq1 = 0x20; + crtc17 = 0x00; + break; + } + WriteSeq(0x00, 0x01); /* Synchronous Reset */ + seq1 |= ReadSeq(0x01) & ~0x20; + WriteSeq(0x01, seq1); + crtc17 |= ReadCrtc(0x17) & ~0x80; + usleep(10000); + WriteCrtc(0x17, crtc17); + WriteSeq(0x00, 0x03); /* End Reset */ +#endif } Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man:1.2 Sat Jan 27 13:20:56 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man Mon Dec 17 15:52:34 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man,v 1.2 2001/01/27 18:20:56 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man,v 1.3 2001/12/17 20:52:34 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH VESA __drivermansuffix__ __vendorversion__ @@ -43,8 +43,7 @@ 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. +Enable or disable use of the shadow framebuffer layer. Default: on. This option is recommended for performance reasons. .SH "SEE ALSO" Index: xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile:1.12 xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile:1.12 Wed May 16 02:48:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile Mon Oct 1 09:44:12 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile,v 1.12 2001/05/16 06:48:11 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile,v 1.13 2001/10/01 13:44:12 eich Exp $ @@ -16,6 +16,10 @@ OBJS = generic.o +#if defined(AlphaArchitecture) +DEFINES = -DSPECIAL_FB_BYTE_ACCESS +#endif + #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include #else @@ -25,7 +29,7 @@ -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(FONTINCSRC) -I$(XINCLUDESRC)\ -I$(XF86SRC)/rac -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(XF86SRC)/shadowfb + -I$(XF86SRC)/shadowfb -I$(XF86SRC)/int10 #endif #if MakeHasPosixVariableSubstitutions Index: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.54 xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.58 --- xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.54 Wed May 16 02:48:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c Fri Jan 4 17:03:26 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.54 2001/05/16 06:48:11 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.58 2002/01/04 22:03:26 tsi Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -38,6 +38,7 @@ #define DEBUG(x) #include "xf86.h" +#include "xf86_OSproc.h" #include "xf86_ansic.h" #include "compiler.h" #include "vgaHW.h" @@ -55,8 +56,9 @@ #include "xf86RAC.h" #include "xf86Resources.h" +#include "xf86int10.h" -/* Some systems define VGA for their own purposes */ +/* Some systems #define VGA for their own purposes */ #undef VGA /* A few things all drivers should have */ @@ -82,6 +84,9 @@ static void GenericLeaveVT(int, int); static void GenericFreeScreen(int, int); static int VGAFindIsaDevice(GDevPtr dev); +#ifdef SPECIAL_FB_BYTE_ACCESS +static Bool GenericMapMem(ScrnInfoPtr scrp); +#endif static int GenericValidMode(int, DisplayModePtr, Bool, int); @@ -90,9 +95,6 @@ { VGA_VERSION_CURRENT, VGA_DRIVER_NAME, -#if 0 - "Generic VGA driver", -#endif GenericIdentify, GenericProbe, GenericAvailableOptions, @@ -112,25 +114,34 @@ }; static const char *vgahwSymbols[] = { + "vgaHWBlankScreen", + "vgaHWDPMSSet", + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWHandleColormaps", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", + "vgaHWUnlock", + "vgaHWUnmapMem", NULL }; -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", - "fbScreenInit", -#ifdef RENDER + NULL +}; + +static const char *fbSymbols[] = { "fbPictureInit", -#endif + "fbScreenInit", NULL }; @@ -139,6 +150,12 @@ NULL }; +static const char *int10Symbols[] = { + "xf86InitInt10", + "xf86FreeInt10", + NULL +}; + #ifdef XFree86LOADER /* Module loader interface */ @@ -174,8 +191,8 @@ { Initialised = TRUE; xf86AddDriver(&VGA, Module, 0); - LoaderRefSymLists(vgahwSymbols, fbSymbols, shadowfbSymbols, - NULL); + LoaderRefSymLists(vgahwSymbols, miscfbSymbols, fbSymbols, + shadowfbSymbols, int10Symbols,NULL); return (pointer)TRUE; } @@ -456,8 +473,8 @@ static ClockRange GenericClockRange = {NULL, 0, 80000, 0, FALSE, TRUE, 1, 1, 0}; MessageType From; int i, videoRam, Rounding, nModes = 0; - char *Module; - const char *Sym; + const char *Module = NULL; + const char *Sym = NULL; vgaHWPtr pvgaHW; GenericPtr pGenericPriv; EntityInfoPtr pEnt; @@ -473,10 +490,19 @@ if (pEnt->resources) return FALSE; + if (xf86LoadSubModule(pScreenInfo, "int10")) { + xf86Int10InfoPtr pInt; + xf86LoaderReqSymLists(int10Symbols, NULL); + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "initializing int10\n"); + pInt = xf86InitInt10(pEnt->index); + xf86FreeInt10(pInt); + } + + { - resRange unusedmem[] = { {ResShrMemBlock,0xB0000,0xB7FFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, - _END }; + static resRange unusedmem[] = { {ResShrMemBlock,0xB0000,0xB7FFF}, + {ResShrMemBlock,0xB8000,0xBFFFF}, + _END }; /* XXX Should this be "disabled" or "unused"? */ xf86SetOperatingState(unusedmem, pEnt->index, ResUnusedOpr); @@ -492,7 +518,7 @@ { case 1: Module = "xf1bpp"; Sym = "xf1bppScreenInit"; break; case 4: Module = "xf4bpp"; Sym = "xf4bppScreenInit"; break; - default: Module = "fb"; Sym = "fbScreenInit"; break; + default: Module = "fb"; break; } xf86PrintDepthBpp(pScreenInfo); @@ -567,7 +593,6 @@ if (!vgaHWGetHWRec(pScreenInfo)) return FALSE; - pvgaHW = VGAHWPTR(pScreenInfo); pvgaHW->MapSize = 0x00010000; /* Standard 64kB VGA window */ vgaHWGetIOBase(pvgaHW); /* Get VGA I/O base */ @@ -601,19 +626,18 @@ for (i = 0; i < pScreenInfo->numClocks; i++) pScreenInfo->clock[i] = pEnt->device->clock[i]; From = X_CONFIG; - } else if (xf86ReturnOptValBool(pGenericPriv->Options,OPTION_VGA_CLOCKS,FALSE)) { + } else + if (xf86ReturnOptValBool(pGenericPriv->Options,OPTION_VGA_CLOCKS,FALSE)) { pScreenInfo->numClocks = 2; pScreenInfo->clock[0] = 25175; pScreenInfo->clock[1] = 28322; - } else - { + } else { xf86GetClocks(pScreenInfo, 4, GenericClockSelect, GenericProtect, GenericBlankScreen, VGAHW_GET_IOBASE() + 0x0A, 0x08, 1, 28322); From = X_PROBED; } xf86ShowClocks(pScreenInfo, From); - if (pScreenInfo->display->modes && pScreenInfo->display->modes[0]) { /* Set the virtual X rounding (in bits) */ if (pScreenInfo->depth == 8) @@ -670,24 +694,40 @@ /* Set display resolution */ xf86SetDpi(pScreenInfo, 0, 0); - if (xf86ReturnOptValBool(pGenericPriv->Options,OPTION_SHADOW_FB,FALSE)) { - pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + if (xf86ReturnOptValBool(pGenericPriv->Options, OPTION_SHADOW_FB, FALSE)) { pGenericPriv->ShadowFB = TRUE; - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\"\n"); + } +#ifdef SPECIAL_FB_BYTE_ACCESS + if (!pGenericPriv->ShadowFB && (pScreenInfo->depth == 4)) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "Architecture requires special FB access for this depth:" + " ShadowFB enabled\n"); + pGenericPriv->ShadowFB = TRUE; + } +#endif + if (pGenericPriv->ShadowFB) { + pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; Module = "fb"; - Sym = "fbScreenInit"; + Sym = NULL; if (!xf86LoadSubModule(pScreenInfo, "shadowfb")) return FALSE; xf86LoaderReqSymLists(shadowfbSymbols, NULL); } /* Ensure depth-specific entry points are available */ - if (!xf86LoadSubModule(pScreenInfo, Module)) + if (Module && !xf86LoadSubModule(pScreenInfo, Module)) return FALSE; - xf86LoaderReqSymbols(Sym, NULL); + if (Module) { + if (Sym) { + xf86LoaderReqSymbols(Sym, NULL); + } else { + xf86LoaderReqSymLists(fbSymbols, NULL); + } + } /* Only one chipset here */ if (!pScreenInfo->chipset) @@ -880,6 +920,8 @@ } +#ifndef SPECIAL_FB_BYTE_ACCESS + static void GenericRefreshArea4bpp(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { @@ -894,9 +936,9 @@ FBPitch = pScrn->displayWidth >> 3; SRCPitch = pPriv->ShadowPitch >> 2; - pvgaHW->writeGr(pvgaHW, 0x05, 0x00); - pvgaHW->writeGr(pvgaHW, 0x01, 0x00); - pvgaHW->writeGr(pvgaHW, 0x08, 0xFF); + (*pvgaHW->writeGr)(pvgaHW, 0x05, 0x00); + (*pvgaHW->writeGr)(pvgaHW, 0x01, 0x00); + (*pvgaHW->writeGr)(pvgaHW, 0x08, 0xFF); while(num--) { left = pbox->x1 & ~7; @@ -912,7 +954,7 @@ } while(height--) { - pvgaHW->writeSeq(pvgaHW, 0x02, 1); + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1); dstPtr = dst; srcPtr = src; i = width; @@ -942,7 +984,7 @@ srcPtr += 2; } - pvgaHW->writeSeq(pvgaHW, 0x02, 1 << 1); + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1 << 1); dstPtr = dst; srcPtr = src; i = width; @@ -972,7 +1014,7 @@ srcPtr += 2; } - pvgaHW->writeSeq(pvgaHW, 0x02, 1 << 2); + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1 << 2); dstPtr = dst; srcPtr = src; i = width; @@ -1002,7 +1044,7 @@ srcPtr += 2; } - pvgaHW->writeSeq(pvgaHW, 0x02, 1 << 3); + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1 << 3); dstPtr = dst; srcPtr = src; i = width; @@ -1041,6 +1083,183 @@ } +#else + +static void +GenericRefreshArea4bpp(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + GenericPtr pPriv = GenericGetRec(pScrn); + vgaHWPtr pvgaHW = VGAHWPTR(pScrn); + int width, height, FBPitch, left, i, j, SRCPitch, phase; + register CARD32 m; + CARD8 s1, s2, s3, s4; + CARD32 *src, *srcPtr; + int dst, dstPtr; + + FBPitch = pScrn->displayWidth >> 3; + SRCPitch = pPriv->ShadowPitch >> 2; + + (*pvgaHW->writeGr)(pvgaHW, 0x05, 0x00); + (*pvgaHW->writeGr)(pvgaHW, 0x01, 0x00); + (*pvgaHW->writeGr)(pvgaHW, 0x08, 0xFF); + + while(num--) { + left = pbox->x1 & ~7; + width = ((pbox->x2 - left) + 7) >> 3; + height = pbox->y2 - pbox->y1; + src = (CARD32*)pPriv->ShadowPtr + (pbox->y1 * SRCPitch) + (left >> 2); + dst = (pbox->y1 * FBPitch) + (left >> 3); + + if((phase = (long)dst & 3L)) { + phase = 4 - phase; + if(phase > width) phase = width; + width -= phase; + } + + while(height--) { + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1); + dstPtr = dst; + srcPtr = src; + i = width; + j = phase; + while(j--) { + m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); + MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + (m >> 24) | (m >> 15) | (m >> 6) | (m << 3)); + srcPtr += 2; + } + while(i >= 4) { + m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); + s1 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + m = (srcPtr[3] & 0x01010101) | ((srcPtr[2] & 0x01010101) << 4); + s2 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + m = (srcPtr[5] & 0x01010101) | ((srcPtr[4] & 0x01010101) << 4); + s3 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + m = (srcPtr[7] & 0x01010101) | ((srcPtr[6] & 0x01010101) << 4); + s4 = (m >> 24) | (m >> 15) | (m >> 6) | (m << 3); + MMIO_OUT32((CARD32*)pvgaHW->Base,dstPtr, + s1 | (s2 << 8) | (s3 << 16) | (s4 << 24)); + srcPtr += 8; + dstPtr += 4; + i -= 4; + } + while(i--) { + m = (srcPtr[1] & 0x01010101) | ((srcPtr[0] & 0x01010101) << 4); + MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + (m >> 24) | (m >> 15) | (m >> 6) | (m << 3)); + srcPtr += 2; + } + + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1 << 1); + dstPtr = dst; + srcPtr = src; + i = width; + j = phase; + while(j--) { + m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); + MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + (m >> 25) | (m >> 16) | (m >> 7) | (m << 2)); + srcPtr += 2; + } + while(i >= 4) { + m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); + s1 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + m = (srcPtr[3] & 0x02020202) | ((srcPtr[2] & 0x02020202) << 4); + s2 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + m = (srcPtr[5] & 0x02020202) | ((srcPtr[4] & 0x02020202) << 4); + s3 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + m = (srcPtr[7] & 0x02020202) | ((srcPtr[6] & 0x02020202) << 4); + s4 = (m >> 25) | (m >> 16) | (m >> 7) | (m << 2); + MMIO_OUT32((CARD32*)pvgaHW->Base,dstPtr, + s1 | (s2 << 8) | (s3 << 16) | (s4 << 24)); + srcPtr += 8; + dstPtr += 4; + i -= 4; + } + while(i--) { + m = (srcPtr[1] & 0x02020202) | ((srcPtr[0] & 0x02020202) << 4); + MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + (m >> 25) | (m >> 16) | (m >> 7) | (m << 2)); + srcPtr += 2; + } + + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1 << 2); + dstPtr = dst; + srcPtr = src; + i = width; + j = phase; + while(j--) { + m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); + MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + (m >> 26) | (m >> 17) | (m >> 8) | (m << 1)); + srcPtr += 2; + } + while(i >= 4) { + m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); + s1 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + m = (srcPtr[3] & 0x04040404) | ((srcPtr[2] & 0x04040404) << 4); + s2 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + m = (srcPtr[5] & 0x04040404) | ((srcPtr[4] & 0x04040404) << 4); + s3 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + m = (srcPtr[7] & 0x04040404) | ((srcPtr[6] & 0x04040404) << 4); + s4 = (m >> 26) | (m >> 17) | (m >> 8) | (m << 1); + MMIO_OUT32((CARD32*)pvgaHW->Base,dstPtr, + s1 | (s2 << 8) | (s3 << 16) | (s4 << 24)); + srcPtr += 8; + dstPtr += 4; + i -= 4; + } + while(i--) { + m = (srcPtr[1] & 0x04040404) | ((srcPtr[0] & 0x04040404) << 4); + MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + (m >> 26) | (m >> 17) | (m >> 8) | (m << 1)); + srcPtr += 2; + } + + (*pvgaHW->writeSeq)(pvgaHW, 0x02, 1 << 3); + dstPtr = dst; + srcPtr = src; + i = width; + j = phase; + while(j--) { + m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); + MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + (m >> 27) | (m >> 18) | (m >> 9) | m); + srcPtr += 2; + } + while(i >= 4) { + m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); + s1 = (m >> 27) | (m >> 18) | (m >> 9) | m; + m = (srcPtr[3] & 0x08080808) | ((srcPtr[2] & 0x08080808) << 4); + s2 = (m >> 27) | (m >> 18) | (m >> 9) | m; + m = (srcPtr[5] & 0x08080808) | ((srcPtr[4] & 0x08080808) << 4); + s3 = (m >> 27) | (m >> 18) | (m >> 9) | m; + m = (srcPtr[7] & 0x08080808) | ((srcPtr[6] & 0x08080808) << 4); + s4 = (m >> 27) | (m >> 18) | (m >> 9) | m; + MMIO_OUT32((CARD32*)pvgaHW->Base,dstPtr, + s1 | (s2 << 8) | (s3 << 16) | (s4 << 24)); + srcPtr += 8; + dstPtr += 4; + i -= 4; + } + while(i--) { + m = (srcPtr[1] & 0x08080808) | ((srcPtr[0] & 0x08080808) << 4); + MMIO_OUT8((CARD8*)pvgaHW->Base,dstPtr++, + (m >> 27) | (m >> 18) | (m >> 9) | m); + srcPtr += 2; + } + + dst += FBPitch; + src += SRCPitch; + } + + pbox++; + } + +} + +#endif /* SPECIAL_FB_BYTE_ACCESS */ + static Bool GenericScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { @@ -1054,8 +1273,14 @@ pGenericPriv = GenericGetRec(pScreenInfo); /* Map VGA aperture */ +#ifdef SPECIAL_FB_BYTE_ACCESS + if (pGenericPriv->ShadowFB && (pScreenInfo->depth == 4)) { + if (!GenericMapMem(pScreenInfo)) + return FALSE; + } else +#endif if (!vgaHWMapMem(pScreenInfo)) - return FALSE; + return FALSE; /* Initialise graphics mode */ if (!GenericEnterGraphics(pScreen, pScreenInfo)) @@ -1071,7 +1296,7 @@ pScreenInfo->rgbBits, pScreenInfo->defaultVisual)) return FALSE; - miSetPixmapDepths (); + miSetPixmapDepths(); /* Initialise the framebuffer */ switch (pScreenInfo->depth) @@ -1090,6 +1315,8 @@ pScreenInfo->xDpi, pScreenInfo->yDpi, pScreenInfo->displayWidth, pScreenInfo->bitsPerPixel); + if (!Inited) + break; #ifdef RENDER fbPictureInit (pScreen, 0, 0); #endif @@ -1117,6 +1344,8 @@ pScreenInfo->xDpi, pScreenInfo->yDpi, pScreenInfo->displayWidth, pScreenInfo->bitsPerPixel); + if (!Inited) + break; #ifdef RENDER fbPictureInit (pScreen, 0, 0); #endif @@ -1229,3 +1458,27 @@ return MODE_OK; } + +#ifdef SPECIAL_FB_BYTE_ACCESS + +static Bool +GenericMapMem(ScrnInfoPtr scrp) +{ + vgaHWPtr hwp = VGAHWPTR(scrp); + int scr_index = scrp->scrnIndex; + + if (hwp->Base) + return TRUE; + + /* If not set, initialise with the defaults */ + if (hwp->MapSize == 0) + hwp->MapSize = VGA_DEFAULT_MEM_SIZE; + if (hwp->MapPhys == 0) + hwp->MapPhys = VGA_DEFAULT_PHYS_ADDR; + + hwp->Base = xf86MapVidMem(scr_index, VIDMEM_MMIO, + hwp->MapPhys, hwp->MapSize); + return hwp->Base != NULL; +} + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man diff -u xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man:1.2 Sat Jan 27 13:20:56 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man Mon Dec 17 15:52:34 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man,v 1.2 2001/01/27 18:20:56 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man,v 1.3 2001/12/17 20:52:34 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH VGA __drivermansuffix__ __vendorversion__ @@ -53,8 +53,7 @@ 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. +Enable or disable use of the shadow framebuffer layer. 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 Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/README diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/README:1.2 xc/programs/Xserver/hw/xfree86/drivers/vmware/README:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/README:1.2 Thu Apr 5 17:09:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/README Mon Dec 17 15:52:35 2001 @@ -6,7 +6,6 @@ XFree86 license. - VMware SVGA Device Interface and Programming Model -------------------------------------------------- @@ -35,6 +34,23 @@ ---------------------------------- 1. Reading/writing a register: + + The SVGA registers are addressed by an index/value pair of 32 bit + registers in the IO address space. + + The 0710 VMware SVGA chipset (PCI device ID PCI_DEVICE_ID_VMWARE_SVGA) has + its index and value ports hardcoded at: + + index: SVGA_LEGACY_BASE_PORT + 4 * SVGA_INDEX_PORT + value: SVGA_LEGACY_BASE_PORT + 4 * SVGA_VALUE_PORT + + The 0405 VMware SVGA chipset (PCI device ID PCI_DEVICE_ID_VMWARE_SVGA2) + determines its index and value ports as a function of the first base + address register in its PCI configuration space as: + + index: <Base Address Register 0> + SVGA_INDEX_PORT + value: <Base Address Register 0> + SVGA_VALUE_PORT + 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 @@ -43,6 +59,15 @@ Set the index port to the index of the register, using a dword OUT Do a dword OUT to the value port + Example, setting the width to 1024: + + mov eax, SVGA_REG_WIDTH + mov edx, <SVGA Address Port> + out dx, eax + mov eax, 1024 + mov edx, <SVGA Value Port> + out dx, eax + 2. Initialization Check the version number loop: @@ -58,20 +83,43 @@ 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 + Get the device capabilities and frame buffer dimensions + Read SVGA_REG_CAPABILITIES, SVGA_REG_MAX_WIDTH, SVGA_REG_MAX_HEIGHT, + and SVGA_REG_HOST_BITS_PER_PIXEL / SVGA_REG_BITS_PER_PIXEL. + + Note: The capabilities can and do change without the PCI device ID + changing or the SVGA_REG_ID changing. A driver should always check + the capabilities register when loading before expecting any + capabilities-determined feature to be available. See below for a list + of capabilities as of this writing. + + Note: If SVGA_CAP_8BIT_EMULATION is not set, then it is possible that + SVGA_REG_HOST_BITS_PER_PIXEL does not exist and + SVGA_REG_BITS_PER_PIXEL should be read instead. + + Report the Guest Operating System + Write SVGA_REG_GUEST_ID with the appropriate value from <guest_os.h>. + While not required in any way, this is useful information for the + virtual machine to have available for reporting and sanity checking + purposes. SetMode - Set SVGA_REG_WIDTH, SVGA_REG_HEIGHT + Set SVGA_REG_WIDTH, SVGA_REG_HEIGHT, SVGA_REG_BITS_PER_PIXEL 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 + Read SVGA_REG_BYTES_PER_LINE, SVGA_REG_DEPTH, SVGA_REG_PSEUDOCOLOR, + SVGA_REG_RED_MASK, SVGA_REG_GREEN_MASK, SVGA_REG_BLUE_MASK + Note: SVGA_REG_BITS_PER_PIXEL is readonly if + SVGA_CAP_8BIT_EMULATION is not set in the capabilities register. Even + if it is set, values other than 8 and SVGA_REG_HOST_BITS_PER_PIXEL + will be ignored. + Enable SVGA Set SVGA_REG_ENABLE to 1 - (to disable SVGA, set SVGA_REG_ENABLE to 0) + (to disable SVGA, set SVGA_REG_ENABLE to 0. Setting SVGA_REG_ENABLE + to 0 also enables VGA.) Initialize the command FIFO The FIFO is exclusively dword (32-bit) aligned. The first four @@ -85,7 +133,11 @@ mem[SVGA_FIFO_NEXT_CMD] = 16; mem[SVGA_FIFO_STOP] = 16; - Write SVGA_REG_CONFIG_DONE after these values have been set. + Set SVGA_REG_CONFIG_DONE to 1 after these values have been set. + + Note: Setting SVGA_REG_CONFIG_DONE to 0 will stop the device from + reading the FIFO until it is reinitialized and SVGA_REG_CONFIG_DONE is + set to 1 again. 3. SVGA command FIFO protocol The FIFO is empty when SVGA_FIFO_NEXT_CMD == SVGA_FIFO_STOP. The @@ -103,49 +155,78 @@ 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. +4. Cursor + When SVGA_CAP_CURSOR is set, hardware cursor support is available. In + practice, SVGA_CAP_CURSOR will only be set when SVGA_CAP_CURSOR_BYPASS is + also set and drivers supporting a hardware cursor should only worry about + SVGA_CAP_CURSOR_BYPASS and only use the FIFO to define the cursor. See + below for more information. + +5. Pseudocolor + When the read-only register SVGA_REG_PSEUDOCOLOR is 1, the device is in a + colormapped mode whose index width and color width are both SVGA_REG_DEPTH. + Thus far, 8 is the only depth at which pseudocolor is ever used. + + In pseudocolor, the colormap is programmed by writing to the SVGA palette + registers. These start at SVGA_PALETTE_BASE and are interpreted as + follows: + + SVGA_PALETTE_BASE + 3*n - The nth red component + SVGA_PALETTE_BASE + 3*n + 1 - The nth green component + SVGA_PALETTE_BASE + 3*n + 2 - The nth blue component + + And n ranges from 0 to ((1<<SVGA_REG_DEPTH) - 1). + 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. +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. +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. +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. + +Addendum on 11/29/2001 +--------------------- -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. +Actually, after changing any of SVGA_REG_WIDTH, SVGA_REG_HEIGHT, and +SVGA_REG_BITS_PER_PIXEL, all of the registers listed in the 'SetMode' +initialization section above should be reread. Additionally, when changing +modes, it can be convenient to set SVGA_REG_ENABLE to 0, change +SVGA_REG_WIDTH, SVGA_REG_HEIGHT, and SVGA_REG_BITS_PER_PIXEL (if available), +and then set SVGA_REG_ENABLE to 1 again. 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: +The capabilities register (SVGA_REG_CAPABILITIES) is an array of bits that +indicates the capabilities of the SVGA emulation. A driver should check +SVGA_REG_CAPABILITIES every time it loads before relying on any feature that +is only optionally available. - Command Capability - ------- ---------- +Some of the capabilities determine which FIFO commands are available. This +table shows which capability indicates support for which command. + FIFO 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 @@ -172,38 +253,89 @@ SVGA_CMD_DEFINE_CURSOR SVGA_CAP_CURSOR SVGA_CMD_DISPLAY_CURSOR SVGA_CAP_CURSOR SVGA_CMD_MOVE_CURSOR SVGA_CAP_CURSOR + SVGA_CMD_DEFINE_ALPHA_CURSOR SVGA_CAP_ALPHA_CURSOR + +Note: SVGA_CMD_DISPLAY_CURSOR and SVGA_CMD_MOVE_CURSOR should not be used. +Drivers wishing hardware cursor support should use cursor bypass (see below). -The ability to program the cursor directly through the registers -(described in the next section) is indicated by the capability -SVGA_CAP_CURSOR_BYPASS. +Other capabilities indicate other functionality as described below: + SVGA_CAP_CURSOR_BYPASS + The hardware cursor can be drawn via SVGA Registers (without requiring + the FIFO be synchronized and will be drawn potentially before any + outstanding unprocessed FIFO commands). + + Note: Without SVGA_CAP_CURSOR_BYPASS_2, cursors drawn this way still + appear in the guest's framebuffer and need to be turned off before any + save under / overlapping drawing and turned back on after. This can + cause very noticeable cursor flicker. + + SVGA_CAP_CURSOR_BYPASS_2 + Instead of turning the cursor off and back on around any overlapping + drawing, the driver can write SVGA_CURSOR_ON_REMOVE_FROM_FB and + SVGA_CURSOR_ON_RESTORE_TO_FB to SVGA_REG_CURSOR_ON. In almost all + cases these are NOPs and the cursor will be remain visible without + appearing in the guest framebuffer. In 'direct graphics' modes like + Linux host fullscreen local displays, however, the cursor will still + be drawn in the framebuffer, still flicker, and be drawn incorrectly + if a driver does not use SVGA_CURSOR_ON_REMOVE_FROM_FB / RESTORE_TO_FB. + + SVGA_CAP_8BIT_EMULATION + SVGA_REG_BITS_PER_PIXEL is writable and can be set to either 8 or + SVGA_REG_HOST_BITS_PER_PIXEL. Otherwise the only SVGA modes available + inside a virtual machine must match the host's bits per pixel. + + Note: Some versions which lack SVGA_CAP_8BIT_EMULATION also lack the + SVGA_REG_HOST_BITS_PER_PIXEL and a driver should assume + SVGA_REG_BITS_PER_PIXEL is both read-only and initialized to the only + available value if SVGA_CAP_8BIT_EMULATION is not set. + 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. +Starting with GSX Server Beta 3 (after 11/15/2000), hardware cursor support +was added. Actually, both a hardware cursor via the FIFO (SVGA_CAP_CURSOR) +and a hardware cursor via the SVGA registers (SVGA_CAP_CURSOR_BYPASS) were +added. SVGA_CAP_CURSOR was never available without SVGA_CAP_CURSOR_BYPASS and +the FIFO hardware cursor should never be used and may be removed without +warning in the future. + +Cursor bypass is programmed using the two FIFO commands SVGA_CMD_DEFINE_CURSOR +and SVGA_CMD_DEFINE_ALPHA_CURSOR in conjunction with the SVGA registers +SVGA_REG_CURSOR_ID, SVGA_REG_CURSOR_X, SVGA_REG_CURSOR_Y, and +SVGA_REG_CURSOR_ON. + +A driver defines an AND/XOR hardware cursor using SVGA_CMD_DEFINE_CURSOR to +assign an ID and establish the AND and XOR masks with the hardware. A driver +uses SVGA_CMD_DEFINE_ALPHA_CURSOR to define a 32 bit mask whose top 8 bits are +used to blend the cursor image with the pixels it covers. Alpha cursor +support is only available when SVGA_CAP_ALPHA_CURSOR is set. + +Once a cursor is defined, a driver can draw it to the screen at any time by +writing the SVGA_REG_CURSOR_ID register with the ID used when the cursor was +defined, writing SVGA_REG_CURSOR_X and SVGA_REG_CURSOR_Y with the location of +the cursor, and SVGA_CURSOR_ON_SHOW to SVGA_REG_CURSOR_ON. The drawing occurs +when SVGA_REG_CURSOR_ON is written. + +Writing SVGA_CURSOR_ON_HIDE to SVGA_REG_CURSOR_ON will turn the cursor off and +make it vanish from the display and, if present, from the framebuffer. +SVGA_CURSOR_ON_REMOVE_FROM_FB will ensure the cursor is not in the +framebuffer, but will only turn it off if there's no other way to remove it. +SVGA_CURSOR_ON_RESTORE_TO_FB is the complement to +SVGA_CURSOR_ON_REMOVE_FROM_FB. Whenever possible, the device will not put the +cursor in the framebuffer and Remove From / Restore To will be NOPs. + +Note: The cursor must be out of the frame buffer before the driver (or any +agent in the virtual machine) touches an overlapping portion of 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 touched before issuing an accelerated command via the +command FIFO, this case is handled by the SVGA device. + +Note: If SVGA_CAP_CURSOR_BYPASS2 is not present, the driver must use +SVGA_CURSOR_ON_HIDE and SVGA_CURSOR_ON_HIDE to be certain the cursor is out of +the framebuffer. Driver Version Numbers @@ -214,6 +346,17 @@ 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 +Version 10.3 - The version that can also support the 0405 chipset +Version 10.4 - The version that knows about SVGA_CAP_CURSOR_BYPASS2 +Version 10.5 - [Never released or well defined] +Version 10.6 - The version that knows about SVGA_CAP_8BIT_EMULATION +Version 10.7 - The version that knows about SVGA_CAP_ALPHA_CURSOR + +Note that this is merely the convention used by SVGA drivers written and +maintained by VMware, Inc. and describes the capabilities of the driver, not +the virtual hardware. An SVGA driver can only use the intersection of the +functionality it supports and the functionality available in the virtual SVGA +hardware. Frequently Asked Questions @@ -247,11 +390,11 @@ 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. +significance (and encoding) as it does in X. 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 @@ -342,5 +485,31 @@ check FIFO full before updating the next command pointer. +6. My driver tries to switch modes and either nothing happens or the +display becomes completely garbled. What's going on? + +When you change modes, make very sure you reread all of the registers listed +above under SetMode. Getting the pitch (SVGA_REG_BYTES_PER_LINE) incorrect +will cause a heavily garbled display. Also, if you change +SVGA_REG_BITS_PER_PIXEL, make certain that SVGA_CAP_8BIT_EMULATION is present +in the SVGA_REG_CAPABILITIES register. Also, even with 8 bit emulation, the +driver must still use either 8 bpp or SVGA_REG_HOST_BITS_PER_PIXEL bpp, +nothing else. + + +7. Why does my driver's hardware cursor work when my virtual machine is in +window mode, but draw/erase incorrectly or in garbled locations in fullscreen +mode? + +You need to make sure you use SVGA_CURSOR_ON_REMOVE_FROM_FB and +SVGA_CURSOR_ON_RESTORE_TO_FB _every_ time your driver or the virtual machine +touches a region of the framebuffer that overlaps the cursor. If you forget +to remove it then it can show up when doing save-under operations or get mixed +in with other drawing. If you forget to restore it then can disappear. You +also need to make sure SVGA_CAP_CURSOR_BYPASS2 is available, or else you will +have to use SVGA_CURSOR_ON_SHOW and SVGA_CURSOR_ON_HIDE (which will flicker, +even in window mode), or else a software cursor. Newer version of the virtual +SVGA hardware will never put the hardware cursor in the framebuffer while in +window mode, so everything will appear to work correctly there. -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/README,v 1.2 2001/04/05 21:09:37 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/README,v 1.4 2001/12/17 20:52:35 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h:1.3 Wed Apr 25 12:44:58 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h Thu Sep 13 04:36:24 2001 @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.3 2001/04/25 16:44:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.4 2001/09/13 08:36:24 alanh 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 $ + * $Id: svga_reg.h,v 1.16 2001/07/25 22:41:24 mgoodman Exp $ * **********************************************************/ /* @@ -75,6 +75,12 @@ /* This port is deprecated, but retained because of old drivers. */ #define SVGA_LEGACY_ACCEL_PORT 0x3 +/* Legal values for the SVGA_REG_CURSOR_ON register in cursor bypass mode */ +#define SVGA_CURSOR_ON_HIDE 0x0 /* Must be 0 to maintain backward compatibility */ +#define SVGA_CURSOR_ON_SHOW 0x1 /* Must be 1 to maintain backward compatibility */ +#define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 /* Remove the cursor from the framebuffer because we need to see what's under it */ +#define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 /* Put the cursor back in the framebuffer so the user can see it */ + /* * Registers */ @@ -87,7 +93,7 @@ SVGA_REG_MAX_WIDTH = 4, SVGA_REG_MAX_HEIGHT = 5, SVGA_REG_DEPTH = 6, - SVGA_REG_BITS_PER_PIXEL = 7, + SVGA_REG_BITS_PER_PIXEL = 7, /* Current bpp in the guest */ SVGA_REG_PSEUDOCOLOR = 8, SVGA_REG_RED_MASK = 9, SVGA_REG_GREEN_MASK = 10, @@ -109,10 +115,11 @@ 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_HOST_BITS_PER_PIXEL = 28, /* Current bpp in the host */ - SVGA_REG_TOP = 28, /* Must be 1 greater than the last register */ + SVGA_REG_TOP = 30, /* Must be 1 greater than the last register */ - SVGA_PALETTE_BASE = 1024 /* Base of SVGA color map */ + SVGA_PALETTE_BASE = 1024 /* Base of SVGA color map */ }; @@ -127,29 +134,35 @@ #define SVGA_CAP_RASTER_OP 0x0010 #define SVGA_CAP_CURSOR 0x0020 #define SVGA_CAP_CURSOR_BYPASS 0x0040 +#define SVGA_CAP_CURSOR_BYPASS_2 0x0080 +#define SVGA_CAP_8BIT_EMULATION 0x0100 +#define SVGA_CAP_ALPHA_CURSOR 0x0200 /* - * 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 + * Raster op codes (same encoding as X) used by FIFO drivers. + */ + +#define SVGA_ROP_CLEAR 0x00 /* 0 */ +#define SVGA_ROP_AND 0x01 /* src AND dst */ +#define SVGA_ROP_AND_REVERSE 0x02 /* src AND NOT dst */ +#define SVGA_ROP_COPY 0x03 /* src */ +#define SVGA_ROP_AND_INVERTED 0x04 /* NOT src AND dst */ +#define SVGA_ROP_NOOP 0x05 /* dst */ +#define SVGA_ROP_XOR 0x06 /* src XOR dst */ +#define SVGA_ROP_OR 0x07 /* src OR dst */ +#define SVGA_ROP_NOR 0x08 /* NOT src AND NOT dst */ +#define SVGA_ROP_EQUIV 0x09 /* NOT src XOR dst */ +#define SVGA_ROP_INVERT 0x0a /* NOT dst */ +#define SVGA_ROP_OR_REVERSE 0x0b /* src OR NOT dst */ +#define SVGA_ROP_COPY_INVERTED 0x0c /* NOT src */ +#define SVGA_ROP_OR_INVERTED 0x0d /* NOT src OR dst */ +#define SVGA_ROP_NAND 0x0e /* NOT src OR NOT dst */ +#define SVGA_ROP_SET 0x0f /* 1 */ +#define SVGA_ROP_UNSUPPORTED 0x10 +#define SVGA_NUM_SUPPORTED_ROPS 16 +#define SVGA_ROP_ALL 0x0000ffff /* * Memory area offsets (viewed as an array of 32-bit words) @@ -278,7 +291,12 @@ #define SVGA_CMD_MOVE_CURSOR 21 /* FIFO layout: X, Y */ + +#define SVGA_CMD_DEFINE_ALPHA_CURSOR 22 + /* FIFO layout: + ID, Hotspot X, Hotspot Y, Width, Height, + <scanlines> */ -#define SVGA_CMD_MAX 22 +#define SVGA_CMD_MAX 23 #endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h:1.4 Wed Apr 25 12:44:58 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h Mon Jan 7 15:38:29 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h,v 1.4 2001/04/25 16:44:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h,v 1.5 2002/01/07 20:38:29 dawes Exp $ */ /* ********************************************************** * Copyright (C) 1998-2001 VMware, Inc. * All Rights Reserved @@ -56,8 +56,11 @@ typedef long long int64; #endif #else +/* int64/uint64 aren't actually used in the vmware driver. */ +#if 0 #error - Need compiler define for int64/uint64 #endif +#endif typedef unsigned int uint32; typedef unsigned short uint16; @@ -78,7 +81,10 @@ #elif defined(__GNUC__) #define FMT64 "L" #else +/* FMT64 isn't actually used in the vmware driver. */ +#if 0 #error - Need compiler define for FMT64 +#endif #endif typedef uint32 VA; Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c:1.4 Wed May 16 02:48:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c Sat Oct 27 23:33:53 2001 @@ -7,7 +7,7 @@ "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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.8 2001/10/28 03:33:53 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -55,7 +55,7 @@ #define VMWARE_NAME "VMWARE" #define VMWARE_DRIVER_NAME "vmware" #define VMWARE_MAJOR_VERSION 10 -#define VMWARE_MINOR_VERSION 4 +#define VMWARE_MINOR_VERSION 7 #define VMWARE_PATCHLEVEL 0 #define VERSION (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL) @@ -88,6 +88,25 @@ { -1, -1, RES_UNDEFINED } }; +static const char *vgahwSymbols[] = { + "vgaHWGetHWRec", + "vgaHWGetIOBase", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", + "vgaHWSaveScreen", + "vgaHWUnlock", + NULL +}; + +static const char *fbSymbols[] = { + "fbPictureInit", + "fbScreenInit", + NULL +}; + #ifdef XFree86LOADER static XF86ModuleVersionInfo vmwareVersRec = { "vmware", @@ -390,7 +409,7 @@ return FALSE; } -/* xf86LoaderReqSymLists(vgahwSymbols, NULL); */ /* FIXME */ + xf86LoaderReqSymLists(vgahwSymbols, NULL); if (!vgaHWGetHWRec(pScrn)) { return FALSE; @@ -402,39 +421,46 @@ 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 + + if (pVMWARE->vmwareCapability & SVGA_CAP_8BIT_EMULATION) { + pVMWARE->bitsPerPixel = + vmwareReadReg(pVMWARE, SVGA_REG_HOST_BITS_PER_PIXEL); + vmwareWriteReg(pVMWARE, + SVGA_REG_BITS_PER_PIXEL, pVMWARE->bitsPerPixel); + } else { + pVMWARE->bitsPerPixel = + vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); + } + pVMWARE->depth = vmwareReadReg(pVMWARE, SVGA_REG_DEPTH); + 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); pVMWARE->cursorDefined = FALSE; pVMWARE->mouseHidden = FALSE; + if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS_2) { + pVMWARE->cursorRemoveFromFB = SVGA_CURSOR_ON_REMOVE_FROM_FB; + pVMWARE->cursorRestoreToFB = SVGA_CURSOR_ON_RESTORE_TO_FB; + } else { + pVMWARE->cursorRemoveFromFB = SVGA_CURSOR_ON_HIDE; + pVMWARE->cursorRestoreToFB = SVGA_CURSOR_ON_SHOW; + } + + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "caps: 0x%08X\n", pVMWARE->vmwareCapability); 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: @@ -473,22 +499,66 @@ 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; + if (pScrn->bitsPerPixel == 8 && + pVMWARE->vmwareCapability & SVGA_CAP_8BIT_EMULATION) { + vmwareWriteReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL, 8); + pVMWARE->bitsPerPixel = + vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Currently unavailable depth/bpp of %d/%d requested.\n" + "\tThe guest X server must run at the same depth and bpp as the host\n" + "\t(which are currently %d/%d). This is automatically detected. Please\n" + "\tdo not specify a depth on the command line or via the config file.\n", + pScrn->depth, pScrn->bitsPerPixel, + pVMWARE->depth, pVMWARE->bitsPerPixel); + return FALSE; + } } + + /* + * Reread depth and defer reading the colour registers until here + * in case we changed bpp above. + */ + + 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->defaultVisual = vmwareReadReg(pVMWARE, SVGA_REG_PSEUDOCOLOR) ? + PseudoColor : TrueColor; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, + 2, "depth: %d\n", pVMWARE->depth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, + 2, "bpp: %d\n", pVMWARE->bitsPerPixel); + 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, "vis: %d\n", pVMWARE->defaultVisual); + + 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; + } xf86PrintDepthBpp(pScrn); #if 0 @@ -617,12 +687,17 @@ VMWAREFreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(fbSymbols, NULL); +#if 0 + /* XXX This driver doesn't use XAA! */ if (!pVMWARE->noAccel || pVMWARE->hwCursor) { if (!xf86LoadSubModule(pScrn, "xaa")) { VMWAREFreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(xaaSymbols, NULL); } +#endif return TRUE; } @@ -887,10 +962,6 @@ if (!ret) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - /* Override the default mask/offset settings */ if (pScrn->bitsPerPixel > 8) { int i; @@ -909,6 +980,9 @@ } } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); + /* * Wrap the CloseScreen vector and set SaveScreen. */ @@ -1010,11 +1084,13 @@ char buildString[sizeof(VMWAREBuildStr)]; RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr)); - xf86DrvMsg(0, X_PROBED, "%s", buildString); + xf86MsgVerb(X_PROBED, 4, "%s", buildString); numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections); if (numDevSections <= 0) { - xf86DrvMsg(0, X_ERROR, "No vmware driver section\n"); +#ifdef DEBUG + xf86MsgVerb(X_ERROR, 0, "No vmware driver section\n"); +#endif return FALSE; } if (xf86GetPciVideoInfo()) { @@ -1079,6 +1155,9 @@ if (!setupDone) { setupDone = TRUE; xf86AddDriver(&VMWARE, module, 0); + + LoaderRefSymLists(vgahwSymbols, fbSymbols, NULL); + return (pointer)1; } if (errmaj) { Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h:1.2 Wed May 16 02:48:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h Thu Sep 13 04:36:24 2001 @@ -3,7 +3,7 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h,v 1.3 2001/09/13 08:36:24 alanh Exp $ */ #ifndef VMWARE_H #define VMWARE_H @@ -70,6 +70,9 @@ Bool cursorDefined; Bool mouseHidden; + unsigned int cursorRemoveFromFB; + unsigned int cursorRestoreToFB; + unsigned long mmioPhysBase; unsigned long mmioSize; @@ -160,7 +163,8 @@ (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); \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, \ + (vmPtr)->cursorRemoveFromFB); \ } else { \ vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ @@ -195,7 +199,8 @@ (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); \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, \ + (vmPtr)->cursorRestoreToFB); \ } else { \ vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c:1.2 Wed May 16 02:48:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c Wed Sep 5 18:13:10 2001 @@ -7,7 +7,7 @@ "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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c,v 1.3 2001/09/05 22:13:10 keithp Exp $ */ #include "X.h" #include "fb.h" @@ -26,7 +26,6 @@ Pixel bitplane, void *closure) { - BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; VMWAREPtr pVMWARE; CARD8 alu; @@ -36,53 +35,6 @@ 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); @@ -92,14 +44,8 @@ vmwareWriteWordToFIFO(pVMWARE, pbox->y1); vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1); vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1); - vmwareWriteWordToFIFO(pVMWARE, pGC->alu); + vmwareWriteWordToFIFO(pVMWARE, alu); pbox++; - } - if (pboxNew2) { - DEALLOCATE_LOCAL(pboxNew2); - } - if (pboxNew1) { - DEALLOCATE_LOCAL(pboxNew1); } } Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c:1.1 Thu Apr 5 15:29:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c Thu Sep 13 04:36:24 2001 @@ -7,7 +7,7 @@ "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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c,v 1.3 2001/09/13 08:36:24 alanh Exp $ */ #include "vmware.h" #include "cursorstr.h" @@ -254,7 +254,7 @@ 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); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, SVGA_CURSOR_ON_SHOW); } else { vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_MOVE_CURSOR); vmwareWriteWordToFIFO(pVMWARE, x); @@ -404,7 +404,7 @@ *pheight = 64; break; default: - mfbQueryBestSize(class, pwidth, pheight, pScr); + fbQueryBestSize(class, pwidth, pheight, pScr); break; } } @@ -418,7 +418,7 @@ 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); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, SVGA_CURSOR_ON_HIDE); } else { vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR); vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c:1.2 Wed May 16 02:48:12 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c Thu Sep 13 04:36:24 2001 @@ -7,12 +7,10 @@ "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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c,v 1.3 2001/09/13 08:36:24 alanh Exp $ */ #include "X.h" #include "fb.h" -#include "mi.h" -#include "migc.h" #include "vmware.h" GCFuncs vmwareGCFuncs = { Index: xc/programs/Xserver/hw/xfree86/dummylib/Imakefile diff -u xc/programs/Xserver/hw/xfree86/dummylib/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/dummylib/Imakefile:1.3 --- xc/programs/Xserver/hw/xfree86/dummylib/Imakefile:1.2 Thu Nov 16 14:45:02 2000 +++ xc/programs/Xserver/hw/xfree86/dummylib/Imakefile Sat Oct 27 23:33:54 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/Imakefile,v 1.2 2000/11/16 19:45:02 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/Imakefile,v 1.3 2001/10/28 03:33:54 tsi Exp $ #include <Server.tmpl> @@ -13,6 +13,7 @@ verrorfverb.c \ xalloc.c \ xf86allocscripi.c \ + xf86addrestolist.c \ xf86drvmsg.c \ xf86drvmsgverb.c \ xf86errorf.c \ @@ -36,6 +37,7 @@ verrorfverb.o \ xalloc.o \ xf86allocscripi.o \ + xf86addrestolist.o \ xf86drvmsg.o \ xf86drvmsgverb.o \ xf86errorf.o \ Index: xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c:1.1 --- /dev/null Fri Jan 18 15:25:42 2002 +++ xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c Sat Oct 27 23:33:54 2001 @@ -0,0 +1,9 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/xf86addrestolist.c,v 1.1 2001/10/28 03:33:54 tsi Exp $ */ + +#include "xf86.h" + +resPtr +xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex) +{ + return rlist; +} Index: xc/programs/Xserver/hw/xfree86/etc/Imakefile diff -u xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.38.2.1 xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.40 --- xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.38.2.1 Tue May 29 10:41:54 2001 +++ xc/programs/Xserver/hw/xfree86/etc/Imakefile Sun Jun 24 16:19:11 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.38.2.1 2001/05/29 14:41:54 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.40 2001/06/24 20:19:11 herrb Exp $ #include <Server.tmpl> #if SystemV @@ -88,7 +88,7 @@ AllTarget(ProgramTargetName(scanpci)) -NormalProgramTarget(scanpci,scanpci.o,NullParameter,-L../os-support -lxf86_os -L../scanpci -lscanpci -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) +NormalProgramTarget(scanpci,scanpci.o,$(XF86OSSRC)/libxf86_os.a,-L../os-support -lxf86_os -L../scanpci -lscanpci -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) InstallProgram(scanpci,$(BINDIR)) InstallManPage(scanpci,$(MANDIR)) #endif @@ -105,7 +105,7 @@ SRCS4 = pcitweak.c AllTarget(ProgramTargetName(pcitweak)) -NormalProgramTarget(pcitweak,pcitweak.o,NullParameter,-L../os-support -lxf86_os -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) +NormalProgramTarget(pcitweak,pcitweak.o,$(XF86OSSRC)/libxf86_os.a,-L../os-support -lxf86_os -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) InstallProgram(pcitweak,$(BINDIR)) InstallManPage(pcitweak,$(MANDIR)) Index: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh diff -u xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.20.2.4 xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.37 --- xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.20.2.4 Fri Jun 1 13:16:57 2001 +++ xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh Thu Jan 17 15:54:23 2002 @@ -1,13 +1,13 @@ #!/bin/sh # -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.20.2.4 2001/06/01 17:16:57 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.37 2002/01/17 20:54:23 dawes Exp $ # # Copyright © 2000 by Precision Insight, Inc. # Copyright © 2000, 2001 by VA Linux Systems, Inc. -# Portions Copyright © 1996-2000 by The XFree86 Project, Inc. +# Copyright © 1996-2002 by The XFree86 Project, Inc. # -# This script should be used to install XFree86 4.1.0. +# This script should be used to install XFree86 4.2.0. # # Parts of this script are based on the old preinst.sh and postinst.sh # scripts. @@ -20,12 +20,16 @@ # Fallbacks for when the bindist version can't be auto-detected. # These should be updated for each release. -FULLPREFIX=4.1 +FULLPREFIX=4.2 PATCHLEVEL=0 VERSION=$FULLPREFIX.$PATCHLEVEL FULLVERSION=$FULLPREFIX.0 SCRIPTVERSION=$VERSION +# XXX Could get this (and above) version info from imake... +FreetypeCurrent=8 +FreetypeAge=2 + BINDISTFULLPREFIX= BINDISTPATCHLEVEL= BINDISTVERSION= @@ -36,10 +40,26 @@ TESTROOT=/home1/test if [ X"$1" = "X-test" -o X"$XINST_TEST" != X ]; then - ROOTDIR=$TESTROOT if [ X"$1" = "X-test" ]; then shift + case "$1" in + /*) + TESTROOT="$1" + shift + ;; + esac + else + case "$XINST_TEST" in + /*) + TESTROOT="$XINST_TEST" + ;; + esac fi + ROOTDIR=$TESTROOT + echo "" + echo "Running in test mode, with root set to $TESTROOT" + sleep 2 + echo "" if [ ! -d $TESTROOT ]; then echo "$TESTROOT doesn't exist (for test mode)" exit 1 @@ -50,8 +70,6 @@ mkdir $TESTROOT/$i fi done - echo "" - echo "Running in test mode" fi RUNDIR=$ROOTDIR/usr/X11R6 @@ -79,6 +97,10 @@ Xfenc.tgz \ " +UPDDIST=" \ + Xupd.tgz \ + " + UPDATEDIST=" \ Xupdate.tgz \ Xdrivers.tgz \ @@ -218,7 +240,7 @@ Xfnon*) echo "Some large fonts";; Xfscl*) - echo "Scaled fonts (Speedo and Type1)";; + echo "Scaled fonts (Speedo, Type1 and TTF)";; Xhtml*) echo "Docs in HTML";; Xjdoc*) @@ -229,6 +251,8 @@ echo "a.out compatibility libraries";; Xquartz*) echo "Mac OS X Quartz compatible X server";; + Xupd.tgz) + echo "Post-release updates";; *) echo "unknown";; esac @@ -394,13 +418,29 @@ FindDistName() { case "$OsName" in + CYGWIN*) + case "$OsArch" in + i*86) + DistName="Cygwin-ix86" + ;; + *) + Message="Cygwin binaries are only available for ix86 platforms" + ;; + esac + ;; Darwin) case "$OsArch" in Power*) case "$OsVersion" in - 1.[2-9]*) - DistName="Darwin-ppc" + 1.[2-3]*) + DistName="Darwin-ppc-1.x" + ;; + 1.4.* | 5.*) + DistName="Darwin-ppc-5.x" ;; + [6-9].*) + Message="No Darwin/ppc binaries available for this OS version. Try Darwin-ppc-5.x" + ;; *) Message="No Darwin/ppc binaries available for this OS version" ;; @@ -408,8 +448,11 @@ ;; x86*) case "$OsVersion" in - 1.[3-9]*) - DistName="Darwin-ix86" + 1.4.* | 5.*) + DistName="Darwin-ix86-5.x" + ;; + [6-9].*) + Message="No Darwin/ix86 binaries available for this OS version. Try Darwin-ix86-5.x" ;; *) Message="No Darwin/ix86 binaries available for this OS version" @@ -451,6 +494,9 @@ 4.*) DistName="FreeBSD-4.x" ;; + 5.*) + DistName="FreeBSD-5.x" + ;; *) Message="FreeBSD/i386 binaries are not available for this version" ;; @@ -464,6 +510,9 @@ 4.*) DistName="FreeBSD-alpha-4.x" ;; + 5.*) + DistName="FreeBSD-alpha-5.x" + ;; *) Message="FreeBSD/alpha binaries are not available for this version" ;; @@ -509,6 +558,19 @@ ;; esac ;; + ppc) + case "$OsLibcMajor.$OsLibcMinor" in + 6.1) + DistName="Linux-ppc-glibc21" + ;; + 6.*) + Message="No Linux/ppc binaries for glibc 2.$OsLibcMinor. Try Linux-ppc-glibc21" + ;; + *) + Message="No Linux/ppc binaries for this libc version" + ;; + esac + ;; alpha) case "$OsLibcMajor.$OsLibcMinor" in 6.1) @@ -527,7 +589,7 @@ 6.0) DistName="Linux-mips-glibc20" ;; - *) + *) Message="No Linux/Mips binaries for this libc version" ;; esac @@ -547,7 +609,7 @@ 1.[4-9]*) # Check this case "$OsObjFormat" in a.out) - DistName="NetBSD-1.4.1" + DistName="NetBSD-1.4.x" ;; *) DistName="NetBSD-1.5" @@ -568,8 +630,8 @@ case "$OsArch" in i386) case "$OsVersion" in - 2.[89]*) # Check this - DistName="OpenBSD-2.8" + 3.0*) # Check this + DistName="OpenBSD-3.0" ;; *) Message="No OpenBSD/i386 binaries available for this version" @@ -627,10 +689,13 @@ if [ X"$DistName" != X ]; then echo "Binary distribution name is '$DistName'" echo "" + echo "If you don't find a binary distribution with this name, then" + echo "binaries for your platform are not available from XFree86.org." + echo "" else if [ X"$Message" = X ]; then echo "Can't find which binary distribution you should use." - echo "Please send the output of this script to XFree86@XFree86.org" + echo "Please send the output of this script to XFree86@XFree86.org." echo "" else echo "$Message" @@ -689,7 +754,7 @@ ;; esac fi - + # Auto-detect based on what files are present if [ X"$DOUPDATE" = X ]; then @@ -774,6 +839,8 @@ FreeBSD|NetBSD|OpenBSD) echo "" echo "Running ldconfig" + # Make sure the directory isn't group-writable + chmod g-w $RUNDIR/lib /sbin/ldconfig -m $RUNDIR/lib ;; Linux) @@ -793,7 +860,7 @@ echo "" fi done - + echo "" echo "Update installation complete." } @@ -838,10 +905,18 @@ # Make OS-specific adjustments case "$OsName" in -Darwin) +CYGWIN*) SERVDIST="Xxserv.tgz" - EXTRAOPTDIST="Xquartz.tgz" + ;; +Darwin) UPDATEDIST="Xupdate.tgz Xdocupd.tgz" + # On Mac OS X, we require Quartz support + if [ -d /System/Library/Frameworks/ApplicationServices.framework ]; then + SERVDIST="Xxserv.tgz Xquartz.tgz" + else + SERVDIST="Xxserv.tgz" + EXTRAOPTDIST="Xquartz.tgz" + fi ;; FreeBSD|NetBSD|OpenBSD) VARDIST="Xvar.tgz" @@ -923,8 +998,16 @@ fi # Link extract to gnu-tar so it can also be used as a regular tar -rm -f gnu-tar -ln extract gnu-tar +case "$OsName" in +CYGWIN*) + rm -f gnu-tar + ln -s extract.exe gnu-tar + ;; +*) + rm -f gnu-tar + ln extract gnu-tar + ;; +esac EXTRACT=$WDIR/extract TAR=$WDIR/gnu-tar @@ -1212,6 +1295,22 @@ ln -s $XKBDBDIR $RUNDIR/lib/X11/xkb/compiled fi +echo "Checking for post-release updates ..." +for i in $UPDDIST; do + if [ -f $i ]; then + Echo "Do you want to install update $i (`Description $i`)? (y/n) [y] " + read response + case "$response" in + [nN]*) + : skip this one + ;; + *) + (cd $RUNDIR; $EXTRACT $WDIR/$i) + ;; + esac + fi +done + echo "Checking for optional components to install ..." for i in $OPTDIST $EXTRAOPTDIST; do if [ -f $i ]; then @@ -1228,31 +1327,6 @@ fi done -# Need to run ldconfig on some OSs -case "$OsName" in -FreeBSD|NetBSD|OpenBSD) - echo "" - echo "Running ldconfig" - /sbin/ldconfig -m $RUNDIR/lib - ;; -Linux) - echo "" - echo "Running ldconfig" - /sbin/ldconfig $RUNDIR/lib - ;; -esac - -# Run mkfontdir in the local and misc directories to make sure that -# the fonts.dir files are up to date after the installation. -echo "" -for i in $FONTDIRS $EXTRAFONTDIRS; do - if [ -d $RUNDIR/lib/X11/fonts/$i ]; then - Echo "Updating the fonts.dir file in $RUNDIR/lib/X11/fonts/$i..." - $RUNDIR/bin/mkfontdir $RUNDIR/lib/X11/fonts/$i - echo "" - fi -done - # Check if the system has a termcap file TERMCAP1DIR=$ROOTDIR/usr/share TERMCAP2=$ROOTDIR/etc/termcap @@ -1305,7 +1379,7 @@ x/xterm-old \ x/xterm-r5 \ v/vs100" - + if [ -d $TINFODIR ]; then echo "" echo "You appear to have a terminfo directory: $TINFODIR" @@ -1416,6 +1490,64 @@ esac fi +# Create compatibility links for the freetype library on systems where the +# major version gets incremented even though the library is compatible with +# older versions. + +echo "" +echo "Checking if compatibility links for the FreeType2 library are needed ..." +if [ -f $RUNDIR/lib/libfreetype.so.$FreetypeCurrent ]; then + v=`expr $FreetypeCurrent - $FreetypeAge` + while [ $v != $FreetypeCurrent ]; do + if [ ! -f $RUNDIR/lib/libfreetype.so.$v ]; then + rm -f $RUNDIR/lib/libfreetype.so.$v + ln -s libfreetype.so.$FreetypeCurrent $RUNDIR/lib/libfreetype.so.$v + echo "Linking libfreetype.so.$FreetypeCurrent to $RUNDIR/lib/libfreetype.so.$v" + fi + v=`expr $v + 1` + done +fi + +if [ -f $RUNDIR/lib/libfreetype.so.$FreetypeCurrent.0 ]; then + v=`expr $FreetypeCurrent - $FreetypeAge` + while [ $v != $FreetypeCurrent ]; do + if [ ! -f $RUNDIR/lib/libfreetype.so.$v.0 ]; then + rm -f $RUNDIR/lib/libfreetype.so.$v.0 + ln -s libfreetype.so.$FreetypeCurrent.0 $RUNDIR/lib/libfreetype.so.$v.0 + echo "Linking libfreetype.so.$FreetypeCurrent.0 to $RUNDIR/lib/libfreetype.so.$v".0 + fi + v=`expr $v + 1` + done +fi + +# Need to run ldconfig on some OSs +case "$OsName" in +FreeBSD|NetBSD|OpenBSD) + echo "" + echo "Running ldconfig" + # Make sure the directory isn't group-writable + chmod g-w $RUNDIR/lib + /sbin/ldconfig -m $RUNDIR/lib + ;; +Linux) + echo "" + echo "Running ldconfig" + /sbin/ldconfig $RUNDIR/lib + ;; +esac + +# Run mkfontdir in the local and misc directories to make sure that +# the fonts.dir files are up to date after the installation. +echo "" +for i in $FONTDIRS $EXTRAFONTDIRS; do + if [ -d $RUNDIR/lib/X11/fonts/$i ]; then + Echo "Updating the fonts.dir file in $RUNDIR/lib/X11/fonts/$i..." + $RUNDIR/bin/mkfontdir $RUNDIR/lib/X11/fonts/$i + echo "" + fi +done + + if [ -f $RUNDIR/bin/rstartd ]; then echo "" echo "If you are going to use rstart and $RUNDIR/bin isn't in the" @@ -1436,6 +1568,7 @@ ;; esac fi + # Finally, check for old 3.3.x modules that will conflict with 4.x if [ -d $RUNDIR/lib/modules ]; then Index: xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar:1.1 --- /dev/null Fri Jan 18 15:25:42 2002 +++ xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar Sat Oct 27 23:33:55 2001 @@ -0,0 +1,881 @@ +#!/bin/sh +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/apSolaris.shar,v 1.1 2001/10/28 03:33:55 tsi Exp $ +# This is a shell archive (produced by GNU sharutils 4.2c). +# To extract the files from this archive, save it to some FILE, remove +# everything before the `!/bin/sh' line above, then type `sh FILE'. +# +# Made on 2001-10-01 14:53 MDT by <tsi@xfree86.org>. +# Source directory was `/archives'. +# +# Existing files will *not* be overwritten unless `-c' is specified. +# +# This shar contains: +# length mode name +# ------ ---------- ------------------------------------------ +# 1609 -rw-r--r-- aperture/Makefile +# 1659 -rw-r--r-- aperture/README +# 7514 -rw-r--r-- aperture/aperture.c +# 450 -rw-r--r-- aperture/aperture.conf +# 87 -rw-r--r-- aperture/devlink.tab +# 1518 -rw-r--r-- aperture/Makefile.sun4u +# +save_IFS="${IFS}" +IFS="${IFS}:" +gettext_dir=FAILED +locale_dir=FAILED +first_param="$1" +for dir in $PATH +do + if test "$gettext_dir" = FAILED && test -f $dir/gettext \ + && ($dir/gettext --version >/dev/null 2>&1) + then + set `$dir/gettext --version 2>&1` + if test "$3" = GNU + then + gettext_dir=$dir + fi + fi + if test "$locale_dir" = FAILED && test -f $dir/shar \ + && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) + then + locale_dir=`$dir/shar --print-text-domain-dir` + fi +done +IFS="$save_IFS" +if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED +then + echo=echo +else + TEXTDOMAINDIR=$locale_dir + export TEXTDOMAINDIR + TEXTDOMAIN=sharutils + export TEXTDOMAIN + echo="$gettext_dir/gettext -s" +fi +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + shar_n= shar_c=' +' + else + shar_n=-n shar_c= + fi +else + shar_n= shar_c='\c' +fi +$echo $shar_n 'x -' 'lock directory' "\`_sh10724': "$shar_c +if mkdir _sh10724; then + $echo 'created' +else + $echo 'failed to create' + exit 1 +fi +# ============= aperture/Makefile ============== +if test ! -d 'aperture'; then + $echo $echo_n 'x -' 'aperture: '$echo_c + if mkdir 'aperture'; then $echo 'created'; else $echo 'failed to create'; fi +fi +if test -f 'aperture/Makefile' && test "$first_param" != -c; then + $echo 'x -' SKIPPING 'aperture/Makefile' '(file already exists)' +else + $echo 'x -' extracting 'aperture/Makefile' '(text)' + sed 's/^X//' << 'SHAR_EOF' > 'aperture/Makefile' && +X# +X# File: makefile for aperture Framebuffer Driver +X# Author: Doug Anson (danson@lgc.com) +X# Date: 2/15/94 +X# Modified: David Holland (davidh@use.com) +X# Date: 2/23/94 +X# - Changed name, and debugging structure +X# Modified: Marc Aurele La France (tsi@xfree86.org) +X# Date: 2001.06-08 +X# - SPARC support, cleanup and turf aptest. +X# +X# >>NOTE<< Have a look at Makefile.sun4u for sun4u specifics. +X# +X# GNU gcc compiler +X#CC=gcc +X#CFLGS=-fno-builtin -W -Waggregate-return -Wbad-function-cast -Wcast-align \ +X# -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Wformat \ +X# -Wimplicit -Wimport -Wmissing-declarations -Wmissing-prototypes \ +X# -Wnested_externs -Wparentheses -Wpointer-arith -Wredundant-decls \ +X# -Wreturn-type -Wshadow -Wstrict-prototypes -Wswitch -Wtraditional \ +X# -Wtrigraphs -Wuninitialized +X +X# +X# Proworks compiler +XCC=/opt/SUNWspro/bin/cc +XCFLGS=-Xa -xarch=v9 -xnolib -xO3 +X +X# +X# Debug error reporting +X#DEBUG_FLG= +X#DEBUG_FLG=-DAPERTURE_DEBUG +X +X# +X# Files and object declarations +XKERNEL_FLGS=-D_KERNEL -DSUNDDI +XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG) +XCFILES= aperture.c +XOBJS= aperture.o +XDRIVER= aperture +X +X# +X# Make rules +Xall: $(DRIVER) +X +X$(DRIVER): $(OBJS) +X ld -r -o $(DRIVER) $(OBJS) +X +Xinstall: $(DRIVER) +X if [ -f "Makefile.`uname -m`" ]; then \ +X make -f Makefile.`uname -m` install; \ +X else \ +X cp aperture.conf /kernel/drv; \ +X cp $(DRIVER) /kernel/drv; \ +X fi +X +Xadd_drv: +X if [ -f "Makefile.`uname -m`" ]; then \ +X make -f Makefile.`uname -m` add_drv; \ +X else \ +X add_drv /kernel/drv/aperture; +X fi +X +Xclean: +X rm -f *% *.BAK $(OBJS) $(DRIVER) core +X +X.SUFFIXES: .i +X +X.c.i: +X $(CC) -E $(CFLAGS) $*.c > $@ +SHAR_EOF + chmod 0644 'aperture/Makefile' || + $echo 'restore of' 'aperture/Makefile' 'failed' + if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ + && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then + md5sum -c << SHAR_EOF >/dev/null 2>&1 \ + || $echo 'aperture/Makefile:' 'MD5 check failed' +b441bb09109f0d3247890d1833ef6be1 aperture/Makefile +SHAR_EOF + else + shar_count="`LC_ALL=C wc -c < 'aperture/Makefile'`" + test 1609 -eq "$shar_count" || + $echo 'aperture/Makefile:' 'original size' '1609,' 'current size' "$shar_count!" + fi +fi +# ============= aperture/README ============== +if test -f 'aperture/README' && test "$first_param" != -c; then + $echo 'x -' SKIPPING 'aperture/README' '(file already exists)' +else + $echo 'x -' extracting 'aperture/README' '(text)' + sed 's/^X//' << 'SHAR_EOF' > 'aperture/README' && +XFramebuffer apperture driver. +X +XThis driver was written to provide a device that, unlike /dev/mem, allows +Xmmap()'ing of ranges beyond installed memory. +X +XThe original x86-based version of this driver was the corroborative work of +XDoug Anson (danson@lgc.com), and David Holland (davidh@use.com). It has since +Xbeen rewritten to also work on sun4u machines. +X +X +XInstallation instructions: +X +X1) Check the Makefile, for appropriate CC, and CFLAGS definitions. Compiling +X with APERTURE_DEBUG defined means the driver will generate reams of +X debugging output. You'll probably want to leave this off... +X +X2) type 'make'. The driver and test program should compile with out any +X problems. There also should not be any warning messages. +X +X3) Become 'root'. +X +X4) type 'make install' and 'make add_drv'. The screen should look something +X like this: +X +X # make install +X cp aperture aperture.conf /kernel/drv +X # make add_drv +X add_drv /kernel/drv/aperture +X +X On a sun4u machine this will mention the /kernel/drv/sparcv9 directory +X instead of /kernel/drv. +X +X This installs the driver in the system. +X +X5) While as root modify the file /etc/devlink.tab, adding these lines: +X +X# The following entry is for the framebuffer driver +Xtype=ddi_pseudo;name=aperture fbs/\M0 +X +X Add that line exactly as shown. You may also simply add the +X contents of the devlink.tab file supplied to /etc/devlink.tab. +X It contains the lines as well. (Yes, that is a tab between +X aperture, and fbs, not spaces - very important) +X +X6) Perform a reconfiguration boot of the system. +X +X # touch /reconfigure +X # init 6 +X +XBug reports, questions, suggestions, etc can be sent to xfree86@xfree86.org. +SHAR_EOF + chmod 0644 'aperture/README' || + $echo 'restore of' 'aperture/README' 'failed' + if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ + && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then + md5sum -c << SHAR_EOF >/dev/null 2>&1 \ + || $echo 'aperture/README:' 'MD5 check failed' +9a792c50901ed8099a7f60eecd43ef22 aperture/README +SHAR_EOF + else + shar_count="`LC_ALL=C wc -c < 'aperture/README'`" + test 1659 -eq "$shar_count" || + $echo 'aperture/README:' 'original size' '1659,' 'current size' "$shar_count!" + fi +fi +# ============= aperture/aperture.c ============== +if test -f 'aperture/aperture.c' && test "$first_param" != -c; then + $echo 'x -' SKIPPING 'aperture/aperture.c' '(file already exists)' +else + $echo 'x -' extracting 'aperture/aperture.c' '(text)' + sed 's/^X//' << 'SHAR_EOF' > 'aperture/aperture.c' && +X/* +X * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved. +X * +X * Permission is hereby granted, free of charge, to any person obtaining a copy +X * of this software and associated documentation files (the "Software"), to +X * deal in the Software without restriction, including without limitation the +X * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +X * sell copies of the Software, and to permit persons to whom the Software is +X * furnished to do so, subject to the following conditions: +X * +X * The above copyright notice and this permission notice shall be included in +X * all copies or substantial portions of the Software. +X * +X * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +X * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +X * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +X * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +X * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +X * +X * Except as contained in this notice, the name of the XFree86 Project shall +X * not be used in advertising or otherwise to promote the sale, use or other +X * dealings in this Software without prior written authorization from the +X * XFree86 Project. +X */ +X +X/* +X * Aperture driver for Solaris. +X */ +X +X#include <sys/conf.h> +X#include <sys/ddi.h> +X#include <sys/modctl.h> +X#include <sys/open.h> +X#include <sys/stat.h> +X#include <sys/sunddi.h> +X +X#define DEV_IDENT "aperture" +X#define DEV_BANNER "XFree86 aperture driver" +X +X#ifndef D_64BIT +X#define D_64BIT 0 +X#endif +X +X#ifndef NULL +X#define NULL ((void *)0) +X#endif +X +X/* +X * open(9E) +X */ +X/*ARGSUSED*/ +Xstatic int +Xaperture_open +X( +X#ifdef __STDC__ +X dev_t *devp, +X int flag, +X int typ, +X struct cred *cred +X#endif +X) +X#ifndef __STDC__ +X dev_t *devp; +X int flag; +X int typ; +X struct cred *cred; +X#endif +X{ +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering open()\n"); +X +X#endif +X +X if ((typ != OTYP_CHR) || (getminor(*devp))) +X error = EINVAL; +X else +X error = 0; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving open() = %d\n", error); +X +X#endif +X +X return error; +X} +X +X/* +X * mmap(9E) +X */ +X/*ARGSUSED*/ +Xstatic int +Xaperture_mmap +X( +X#ifdef __STDC__ +X dev_t dev, +X off_t off, +X int prot +X#endif +X) +X#ifndef __STDC__ +X dev_t dev; +X off_t off; +X int prot; +X#endif +X{ +X pfn_t pf; +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering mmap(0x%016lx)\n", off); +X +X#endif +X +X pf = btop(off); +X +X /* Deal with mmap(9E) interface limits */ +X error = (int)pf; +X if ((error < 0) || (pf != (pfn_t)error)) +X error = -1; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving mmap() = 0x%08lx", error); +X +X#endif +X +X return error; +X} +X +Xstatic struct cb_ops aperture_cb_ops = +X{ +X aperture_open, /* open */ +X nulldev, /* close */ +X nodev, /* strategy */ +X nodev, /* print */ +X nodev, /* dump */ +X nodev, /* read */ +X nodev, /* write */ +X nodev, /* ioctl */ +X nodev, /* devmap */ +X aperture_mmap, /* mmap */ +X ddi_segmap, /* segmap */ +X nochpoll, /* poll */ +X ddi_prop_op, /* cb_prop_op */ +X 0, /* streamtab */ +X D_NEW | D_MP | D_64BIT /* Driver compatibility flag */ +X}; +X +X +Xstatic dev_info_t *aperture_dip; /* private copy of devinfo pointer */ +X +X/* +X * getinfo(9E) +X */ +X/*ARGSUSED*/ +Xstatic int +Xaperture_getinfo +X( +X#ifdef __STDC__ +X dev_info_t *dip, +X ddi_info_cmd_t infocmd, +X void *arg, +X void **result +X#endif +X) +X#ifndef __STDC__ +X dev_info_t *dip; +X ddi_info_cmd_t infocmd; +X void *arg; +X void **result; +X#endif +X{ +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering getinfo()\n"); +X +X#endif +X +X switch (infocmd) { +X case DDI_INFO_DEVT2DEVINFO: +X *result = aperture_dip; +X error = DDI_SUCCESS; +X break; +X case DDI_INFO_DEVT2INSTANCE: +X *result = NULL; +X error = DDI_SUCCESS; +X break; +X default: +X error = DDI_FAILURE; +X } +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving getinfo() = %d\n", error); +X +X#endif +X +X return error; +X} +X +X/* +X * identify(9E) +X */ +X/*ARGSUSED*/ +Xstatic int +Xaperture_identify +X( +X#ifdef __STDC__ +X dev_info_t *dip +X#endif +X) +X#ifndef __STDC__ +X dev_info_t *dip; +X#endif +X{ +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering identify()\n"); +X +X#endif +X +X if (strcmp(ddi_get_name(dip), DEV_IDENT)) +X error = DDI_NOT_IDENTIFIED; +X else +X error = DDI_IDENTIFIED; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving identify() = %d\n", error); +X +X#endif +X +X return error; +X} +X +X/* +X * attach(9E) +X */ +X/*ARGSUSED*/ +Xstatic int +Xaperture_attach +X( +X#ifdef __STDC__ +X dev_info_t *dip, +X ddi_attach_cmd_t cmd +X#endif +X) +X#ifndef __STDC__ +X dev_info_t *dip; +X ddi_attach_cmd_t cmd; +X#endif +X{ +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering attach()\n"); +X +X#endif +X +X if (cmd != DDI_ATTACH) +X { +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": not attach(, DDI_ATTACH)\n"); +X +X#endif +X +X error = DDI_FAILURE; +X } +X else +X { +X error = ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR, +X ddi_get_instance(dip), NULL, NODESPECIFIC_DEV); +X +X if (error == DDI_SUCCESS) +X { +X aperture_dip = dip; +X ddi_report_dev(dip); +X } +X } +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving attach() = %d\n", error); +X +X#endif +X +X return error; +X} +X +X/* +X * detach(9E) +X */ +Xstatic int +Xaperture_detach +X( +X#ifdef __STDC__ +X dev_info_t *dip, +X ddi_detach_cmd_t cmd +X#endif +X) +X#ifndef __STDC__ +X dev_info_t *dip; +X ddi_detach_cmd_t cmd; +X#endif +X{ +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering detach()\n"); +X +X#endif +X +X if (cmd != DDI_DETACH) +X { +X error = DDI_FAILURE; +X } +X else +X { +X ddi_remove_minor_node(dip, NULL); +X aperture_dip = NULL; +X error = DDI_SUCCESS; +X } +X +X#if APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving detach() = %d\n", error); +X +X#endif +X +X return error; +X} +X +X +Xstatic struct dev_ops aperture_ops = +X{ +X DEVO_REV, /* revision */ +X 0, /* refcnt */ +X aperture_getinfo, /* getinfo */ +X aperture_identify, /* identify */ +X nulldev, /* probe */ +X aperture_attach, /* attach */ +X aperture_detach, /* detach */ +X nodev, /* reset */ +X &aperture_cb_ops, /* driver operations */ +X NULL /* bus operations */ +X}; +X +X +Xstatic struct modldrv modldrv = +X{ +X &mod_driverops, /* mod_ops structure pointer */ +X DEV_BANNER, /* driver banner string */ +X &aperture_ops, /* dev_ops structure pointer */ +X}; +X +X +Xstatic struct modlinkage modlinkage = +X{ +X MODREV_1, /* module API revision */ +X { +X &modldrv, /* module driver structure pointer */ +X NULL /* list termination */ +X } +X}; +X +X +X/* +X * _init(9E) +X */ +Xint +X_init +X( +X#ifdef __STDC__ +X void +X#endif +X) +X{ +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering _init()\n"); +X +X#endif +X +X error = mod_install(&modlinkage); +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving _init() = %d\n", error); +X +X#endif +X +X return error; +X} +X +X/* +X * _info(9E) +X */ +Xint +X_info +X( +X#ifdef __STDC__ +X struct modinfo *modinfop +X#endif +X) +X#ifndef __STDC__ +X struct modinfo *modinfop; +X#endif +X{ +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering _info()\n"); +X +X#endif +X +X error = mod_info(&modlinkage, modinfop); +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving _info() = %d\n", error); +X +X#endif +X +X return error; +X} +X +X/* +X * _fini(9E) +X */ +Xint +X_fini +X( +X#ifdef __STDC__ +X void +X#endif +X) +X{ +X int error; +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": entering _fini()\n"); +X +X#endif +X +X error = mod_remove(&modlinkage); +X +X#ifdef APERTURE_DEBUG +X +X cmn_err(CE_CONT, DEV_IDENT ": leaving _fini() = %d\n", error); +X +X#endif +X +X return error; +X} +SHAR_EOF + chmod 0644 'aperture/aperture.c' || + $echo 'restore of' 'aperture/aperture.c' 'failed' + if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ + && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then + md5sum -c << SHAR_EOF >/dev/null 2>&1 \ + || $echo 'aperture/aperture.c:' 'MD5 check failed' +6b1d5b5fd036811e56982b8f6350c4df aperture/aperture.c +SHAR_EOF + else + shar_count="`LC_ALL=C wc -c < 'aperture/aperture.c'`" + test 7514 -eq "$shar_count" || + $echo 'aperture/aperture.c:' 'original size' '7514,' 'current size' "$shar_count!" + fi +fi +# ============= aperture/aperture.conf ============== +if test -f 'aperture/aperture.conf' && test "$first_param" != -c; then + $echo 'x -' SKIPPING 'aperture/aperture.conf' '(file already exists)' +else + $echo 'x -' extracting 'aperture/aperture.conf' '(text)' + sed 's/^X//' << 'SHAR_EOF' > 'aperture/aperture.conf' && +X# +X# Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com +X# +X# File: aperture.conf +X# Author: Doug Anson (danson@lgc.com) +X# +X# Modified: David Holland (davidh@use.com) +X# Log: Change comments 02/23/94 +X# Change defaults/comments 09/25/94 +X# +X# Modified: Marc Aurele La France (tsi@xfree86.org) +X# Log: SPARC changes 2001.09 +X# +X# Purpose: This conf file is used by the aperture driver. +X# +Xname="aperture" parent="pseudo"; +SHAR_EOF + chmod 0644 'aperture/aperture.conf' || + $echo 'restore of' 'aperture/aperture.conf' 'failed' + if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ + && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then + md5sum -c << SHAR_EOF >/dev/null 2>&1 \ + || $echo 'aperture/aperture.conf:' 'MD5 check failed' +7898b8401e400ad797aa1eb4fb35d492 aperture/aperture.conf +SHAR_EOF + else + shar_count="`LC_ALL=C wc -c < 'aperture/aperture.conf'`" + test 450 -eq "$shar_count" || + $echo 'aperture/aperture.conf:' 'original size' '450,' 'current size' "$shar_count!" + fi +fi +# ============= aperture/devlink.tab ============== +if test -f 'aperture/devlink.tab' && test "$first_param" != -c; then + $echo 'x -' SKIPPING 'aperture/devlink.tab' '(file already exists)' +else + $echo 'x -' extracting 'aperture/devlink.tab' '(text)' + sed 's/^X//' << 'SHAR_EOF' > 'aperture/devlink.tab' && +X# The following entry is for the aperture driver +Xtype=ddi_pseudo;name=aperture fbs/\M0 +SHAR_EOF + chmod 0644 'aperture/devlink.tab' || + $echo 'restore of' 'aperture/devlink.tab' 'failed' + if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ + && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then + md5sum -c << SHAR_EOF >/dev/null 2>&1 \ + || $echo 'aperture/devlink.tab:' 'MD5 check failed' +9711411e1d2caacb420cd58c817b4985 aperture/devlink.tab +SHAR_EOF + else + shar_count="`LC_ALL=C wc -c < 'aperture/devlink.tab'`" + test 87 -eq "$shar_count" || + $echo 'aperture/devlink.tab:' 'original size' '87,' 'current size' "$shar_count!" + fi +fi +# ============= aperture/Makefile.sun4u ============== +if test -f 'aperture/Makefile.sun4u' && test "$first_param" != -c; then + $echo 'x -' SKIPPING 'aperture/Makefile.sun4u' '(file already exists)' +else + $echo 'x -' extracting 'aperture/Makefile.sun4u' '(text)' + sed 's/^X//' << 'SHAR_EOF' > 'aperture/Makefile.sun4u' && +X# +X# File: makefile for aperture Framebuffer Driver +X# Author: Doug Anson (danson@lgc.com) +X# Date: 2/15/94 +X# Modified: David Holland (davidh@use.com) +X# Date: 2/23/94 +X# - Changed name, and debugging structure +X# Modified: Marc Aurele La France (tsi@xfree86.org) +X# Date: 2001.06-08 +X# - SPARC support, cleanup and turf aptest. +X# +X +X# +X# GNU gcc compiler, for when it can generate 64-bit binaries. Apparently +X# GCC 3.0 can, but it has not been tried... +X# +X#CC=gcc +X#CFLGS=-fno-builtin -W -Waggregate-return -Wbad-function-cast -Wcast-align \ +X# -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Wformat \ +X# -Wimplicit -Wimport -Wmissing-declarations -Wmissing-prototypes \ +X# -Wnested_externs -Wparentheses -Wpointer-arith -Wredundant-decls \ +X# -Wreturn-type -Wshadow -Wstrict-prototypes -Wswitch -Wtraditional \ +X# -Wtrigraphs -Wuninitialized +X# (+ whatever is needed to generate 64-bit object) +X +X# +X# Proworks compiler +XCC=/opt/SUNWspro/bin/cc +XCFLGS=-Xa -xarch=v9 -xnolib -xO3 +X +X# +X# Debug error reporting +X#DEBUG_FLG= +X#DEBUG_FLG=-DAPERTURE_DEBUG +X +X# +X# Files and object declarations +XKERNEL_FLGS=-D_KERNEL -DSUNDDI +XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG) +XCFILES= aperture.c +XOBJS= aperture.o +XDRIVER= aperture +X +X# +X# Make rules +Xall: $(DRIVER) +X +X$(DRIVER): $(OBJS) +X ld -r -o $(DRIVER) $(OBJS) +X +Xinstall: $(DRIVER) +X cp aperture.conf /kernel/drv +X cp $(DRIVER) /kernel/drv/sparcv9 +X +Xadd_drv: +X add_drv /kernel/drv/sparcv9/aperture +X +Xclean: +X rm -f *% *.BAK $(OBJS) $(DRIVER) core +X +X.SUFFIXES: .i +X +X.c.i: +X $(CC) -E $(CFLAGS) $*.c > $@ +SHAR_EOF + chmod 0644 'aperture/Makefile.sun4u' || + $echo 'restore of' 'aperture/Makefile.sun4u' 'failed' + if ( md5sum --help </dev/null 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ + && ( md5sum --version </dev/null 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then + md5sum -c << SHAR_EOF >/dev/null 2>&1 \ + || $echo 'aperture/Makefile.sun4u:' 'MD5 check failed' +4e5c934bd99816318d20972318a93ad0 aperture/Makefile.sun4u +SHAR_EOF + else + shar_count="`LC_ALL=C wc -c < 'aperture/Makefile.sun4u'`" + test 1518 -eq "$shar_count" || + $echo 'aperture/Makefile.sun4u:' 'original size' '1518,' 'current size' "$shar_count!" + fi +fi +$echo $shar_n 'x -' 'lock directory' "\`_sh10724': " $shar_c +if rm -fr _sh10724; then + $echo 'removed' +else + $echo 'failed to remove' +fi +exit 0 Index: xc/programs/Xserver/hw/xfree86/etc/extramodes diff -u xc/programs/Xserver/hw/xfree86/etc/extramodes:1.1 xc/programs/Xserver/hw/xfree86/etc/extramodes:1.4 --- xc/programs/Xserver/hw/xfree86/etc/extramodes:1.1 Thu Feb 15 13:20:34 2001 +++ xc/programs/Xserver/hw/xfree86/etc/extramodes Wed Nov 14 17:56:48 2001 @@ -1,12 +1,18 @@ // // 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 $ +// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.4 2001/11/14 22:56:48 dawes Exp $ // -# 1400x1050 @ 60Hz (VESA GFT) hsync: 65.5kHz +# 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz +ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync + +# 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync -# 1400x1050 @ 75Hz (VESA GFT) hsync: 82.2kHz +# 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync + +# 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz +Modeline "1600x1024" 106.910 1600 1620 1640 1670 1024 1027 1030 1067 -hsync -vsync Index: xc/programs/Xserver/hw/xfree86/etc/scanpci.c diff -u xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.81 xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.83 --- xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.81 Sat Jan 6 15:19:12 2001 +++ xc/programs/Xserver/hw/xfree86/etc/scanpci.c Fri Jan 4 17:28:06 2002 @@ -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.81 2001/01/06 20:19:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.83 2002/01/04 22:28:06 tsi Exp $ */ #include "X.h" #include "os.h" @@ -50,14 +50,14 @@ pciVideoPtr *xf86PciVideoInfo = NULL; -void usage(void); -void identify_card(pciConfigPtr pcr, int verbose); -void print_default_class(pciConfigPtr pcr); -void print_bridge_pci_class(pciConfigPtr pcr); -void print_bridge_class(pciConfigPtr pcr); -void print_mach64(pciConfigPtr pcr); -void print_i128(pciConfigPtr pcr); -void print_pcibridge(pciConfigPtr pcr); +static void usage(void); +static void identify_card(pciConfigPtr pcr, int verbose); +static void print_default_class(pciConfigPtr pcr); +static void print_bridge_pci_class(pciConfigPtr pcr); +static void print_mach64(pciConfigPtr pcr); +static void print_i128(pciConfigPtr pcr); +static void print_pcibridge(pciConfigPtr pcr); +static void print_apb(pciConfigPtr pcr); typedef struct { unsigned int Vendor; @@ -67,55 +67,60 @@ } Device[MAX_DEV_PER_VENDOR]; } pciVendorDevFuncInfo; -pciVendorDevFuncInfo vendorDeviceFuncInfo[] = { - { 0x1002, { - { 0x4354, print_mach64 }, - { 0x4358, print_mach64 }, - { 0x4554, print_mach64 }, - { 0x4742, print_mach64 }, - { 0x4744, print_mach64 }, - { 0x4749, print_mach64 }, - { 0x474C, print_mach64 }, - { 0x474D, print_mach64 }, - { 0x474E, print_mach64 }, - { 0x474F, print_mach64 }, - { 0x4750, print_mach64 }, - { 0x4751, print_mach64 }, - { 0x4752, print_mach64 }, - { 0x4753, print_mach64 }, - { 0x4754, print_mach64 }, - { 0x4755, print_mach64 }, - { 0x4756, print_mach64 }, - { 0x4757, print_mach64 }, - { 0x4758, print_mach64 }, - { 0x475A, print_mach64 }, - { 0x4C42, print_mach64 }, - { 0x4C44, print_mach64 }, - { 0x4C47, print_mach64 }, - { 0x4C49, print_mach64 }, - { 0x4C4D, print_mach64 }, - { 0x4C4E, print_mach64 }, - { 0x4C50, print_mach64 }, - { 0x4C52, print_mach64 }, - { 0x4C53, print_mach64 }, - { 0x5654, print_mach64 }, - { 0x5655, print_mach64 }, - { 0x5656, print_mach64 }, +static pciVendorDevFuncInfo vendorDeviceFuncInfo[] = { + { PCI_VENDOR_ATI, { + { PCI_CHIP_MACH64CT, print_mach64 }, + { PCI_CHIP_MACH64CX, print_mach64 }, + { PCI_CHIP_MACH64ET, print_mach64 }, + { PCI_CHIP_MACH64GB, print_mach64 }, + { PCI_CHIP_MACH64GD, print_mach64 }, + { PCI_CHIP_MACH64GI, print_mach64 }, + { PCI_CHIP_MACH64GL, print_mach64 }, + { PCI_CHIP_MACH64GM, print_mach64 }, + { PCI_CHIP_MACH64GN, print_mach64 }, + { PCI_CHIP_MACH64GO, print_mach64 }, + { PCI_CHIP_MACH64GP, print_mach64 }, + { PCI_CHIP_MACH64GQ, print_mach64 }, + { PCI_CHIP_MACH64GR, print_mach64 }, + { PCI_CHIP_MACH64GS, print_mach64 }, + { PCI_CHIP_MACH64GT, print_mach64 }, + { PCI_CHIP_MACH64GU, print_mach64 }, + { PCI_CHIP_MACH64GV, print_mach64 }, + { PCI_CHIP_MACH64GW, print_mach64 }, + { PCI_CHIP_MACH64GX, print_mach64 }, + { PCI_CHIP_MACH64GY, print_mach64 }, + { PCI_CHIP_MACH64GZ, print_mach64 }, + { PCI_CHIP_MACH64LB, print_mach64 }, + { PCI_CHIP_MACH64LD, print_mach64 }, + { PCI_CHIP_MACH64LG, print_mach64 }, + { PCI_CHIP_MACH64LI, print_mach64 }, + { PCI_CHIP_MACH64LM, print_mach64 }, + { PCI_CHIP_MACH64LN, print_mach64 }, + { PCI_CHIP_MACH64LP, print_mach64 }, + { PCI_CHIP_MACH64LQ, print_mach64 }, + { PCI_CHIP_MACH64LR, print_mach64 }, + { PCI_CHIP_MACH64LS, print_mach64 }, + { PCI_CHIP_MACH64VT, print_mach64 }, + { PCI_CHIP_MACH64VU, print_mach64 }, + { PCI_CHIP_MACH64VV, print_mach64 }, { 0x0000, NULL } } }, - { 0x105D, { - { 0x2309, print_i128 }, - { 0x2339, print_i128 }, - { 0x493D, print_i128 }, - { 0x5348, print_i128 }, + { PCI_VENDOR_DIGITAL, { + { PCI_CHIP_DC21050, print_pcibridge}, { 0x0000, NULL } } }, - { 0x1011, { - { 0x0001, print_pcibridge}, + { PCI_VENDOR_NUMNINE, { + { PCI_CHIP_I128, print_i128 }, + { PCI_CHIP_I128_2, print_i128 }, + { PCI_CHIP_I128_T2R, print_i128 }, + { PCI_CHIP_I128_T2R4, print_i128 }, { 0x0000, NULL } } }, + { PCI_VENDOR_SUN, { + { PCI_CHIP_SIMBA, print_apb }, + { 0x0000, NULL } } }, { 0x0000, { { 0x0000, NULL } } } }; -void +static void usage(void) { printf("Usage: scanpci [-v12OfV]\n"); @@ -192,7 +197,7 @@ exit(0); } -void +static void identify_card(pciConfigPtr pcr, int verbose) { @@ -207,7 +212,8 @@ xf86SetupScanPci(&pvnd,&pvd,&pvc); - printf("\npci bus 0x%x cardnum 0x%02x function 0x%04x: vendor 0x%04x device 0x%04x\n", + printf("\npci bus 0x%04x cardnum 0x%02x function 0x%02x:" + " vendor 0x%04x device 0x%04x\n", pcr->busnum, pcr->devnum, pcr->funcnum, pcr->pci_vendor, pcr->pci_device); @@ -239,7 +245,7 @@ if (vdf[i].Vendor == pcr->pci_vendor) { for (j = 0; vdf[i].Device[j].DeviceID; j++) { if (vdf[i].Device[j].DeviceID == pcr->pci_device) { - vdf[i].Device[j].func(pcr); + (*vdf[i].Device[j].func)(pcr); return; } } @@ -263,7 +269,9 @@ } } - for (i = 0; pvc[i].VendorID && pvc[i].VendorID != pcr->pci_subsys_vendor; i++) + for (i = 0; + pvc[i].VendorID && pvc[i].VendorID != pcr->pci_subsys_vendor; + i++) ; if (pvc[i].VendorID) { for (j = 0; pvc[i].Device[j].CardName; j++) { @@ -292,29 +300,20 @@ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, pcr->pci_rev_id); - switch (pcr->pci_base_class) { - case PCI_CLASS_BRIDGE: - switch (pcr->pci_sub_class) { - case PCI_SUBCLASS_BRIDGE_PCI: - print_bridge_pci_class(pcr); - break; - default: - print_bridge_class(pcr); - break; - } - break; - default: + if ((pcr->pci_base_class == PCI_CLASS_BRIDGE) && + (pcr->pci_sub_class == PCI_SUBCLASS_BRIDGE_PCI)) + print_bridge_pci_class(pcr); + else print_default_class(pcr); - break; - } } } -void +static void print_default_class(pciConfigPtr pcr) { if (pcr->pci_bist_header_latency_cache) - printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + printf(" BIST 0x%02x HEADER 0x%02x" + " LATENCY 0x%02x CACHE 0x%02x\n", pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, pcr->pci_cache_line_size); if (pcr->pci_base0) @@ -370,11 +369,13 @@ (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), pcr->pci_baserom & 0x1 ? "" : "not-"); if (pcr->pci_max_min_ipin_iline) - printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x INT_PIN 0x%02x INT_LINE 0x%02x\n", + printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" + " INT_PIN 0x%02x INT_LINE 0x%02x\n", pcr->pci_max_lat, pcr->pci_min_gnt, pcr->pci_int_pin, pcr->pci_int_line); if (pcr->pci_user_config) - printf(" BYTE_0 0x%02x BYTE_1 0x%02x BYTE_2 0x%02x BYTE_3 0x%02x\n", + printf(" BYTE_0 0x%02x BYTE_1 0x%02x" + " BYTE_2 0x%02x BYTE_3 0x%02x\n", (int)pcr->pci_user_config_0, (int)pcr->pci_user_config_1, (int)pcr->pci_user_config_2, (int)pcr->pci_user_config_3); } @@ -384,9 +385,10 @@ #define PCI_B_M_ABORT 0x20 #define PCI_B_VGA_EN 0x08 #define PCI_B_ISA_EN 0x04 +#define PCI_B_SERR_EN 0x02 #define PCI_B_P_ERR 0x01 -void +static void print_bridge_pci_class(pciConfigPtr pcr) { if (pcr->pci_bist_header_latency_cache) @@ -404,24 +406,17 @@ pcr->pci_prefetch_mem_base << 16, (pcr->pci_prefetch_mem_limit << 16) | 0xfffff); printf(" %sFAST_B2B %sSEC_BUS_RST %sM_ABRT %sVGA_EN %sISA_EN" - " %sPERR_EN\n", + " %sSERR_EN %sPERR_EN\n", (pcr->pci_bridge_control & PCI_B_FAST_B_B) ? "" : "NO_", (pcr->pci_bridge_control & PCI_B_SB_RESET) ? "" : "NO_", (pcr->pci_bridge_control & PCI_B_M_ABORT) ? "" : "NO_", (pcr->pci_bridge_control & PCI_B_VGA_EN) ? "" : "NO_", (pcr->pci_bridge_control & PCI_B_ISA_EN) ? "" : "NO_", + (pcr->pci_bridge_control & PCI_B_SERR_EN) ? "" : "NO_", (pcr->pci_bridge_control & PCI_B_P_ERR) ? "" : "NO_"); } -void -print_bridge_class(pciConfigPtr pcr) -{ - if (pcr->pci_bist_header_latency_cache) - printf(" HEADER 0x%02x LATENCY 0x%02x\n", - pcr->pci_header_type, pcr->pci_latency_timer); -} - -void +static void print_mach64(pciConfigPtr pcr) { CARD32 sparse_io = 0; @@ -433,9 +428,11 @@ pcr->pci_status, pcr->pci_command); if (pcr->pci_class_revision) printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", - pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, pcr->pci_rev_id); + pcr->pci_base_class, pcr->pci_sub_class, + pcr->pci_prog_if, pcr->pci_rev_id); if (pcr->pci_bist_header_latency_cache) - printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + printf(" BIST 0x%02x HEADER 0x%02x" + " LATENCY 0x%02x CACHE 0x%02x\n", pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, pcr->pci_cache_line_size); if (pcr->pci_base0) @@ -458,8 +455,10 @@ (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), pcr->pci_baserom & 0x1 ? "" : "not-"); if (pcr->pci_max_min_ipin_iline) - printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x INT_PIN 0x%02x INT_LINE 0x%02x\n", - pcr->pci_max_lat, pcr->pci_min_gnt, pcr->pci_int_pin, pcr->pci_int_line); + printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" + " INT_PIN 0x%02x INT_LINE 0x%02x\n", + pcr->pci_max_lat, pcr->pci_min_gnt, + pcr->pci_int_pin, pcr->pci_int_line); switch (pcr->pci_user_config_0 & 0x03) { case 0: sparse_io = 0x2ec; @@ -476,7 +475,7 @@ pcr->pci_user_config_0 & 0x08 ? "Dis" : "En"); } -void +static void print_i128(pciConfigPtr pcr) { printf(" CardVendor 0x%04x card 0x%04x\n", @@ -486,9 +485,11 @@ pcr->pci_status, pcr->pci_command); if (pcr->pci_class_revision) printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", - pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, pcr->pci_rev_id); + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); if (pcr->pci_bist_header_latency_cache) - printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + printf(" BIST 0x%02x HEADER 0x%02x" + " LATENCY 0x%02x CACHE 0x%02x\n", pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, pcr->pci_cache_line_size); printf(" MW0_AD 0x%08x addr 0x%08x %spre-fetchable\n", @@ -509,11 +510,13 @@ (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), pcr->pci_baserom & 0x1 ? "" : "not-"); if (pcr->pci_max_min_ipin_iline) - printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x INT_PIN 0x%02x INT_LINE 0x%02x\n", - pcr->pci_max_lat, pcr->pci_min_gnt, pcr->pci_int_pin, pcr->pci_int_line); + printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" + " INT_PIN 0x%02x INT_LINE 0x%02x\n", + pcr->pci_max_lat, pcr->pci_min_gnt, + pcr->pci_int_pin, pcr->pci_int_line); } -void +static void print_pcibridge(pciConfigPtr pcr) { if (pcr->pci_status_command) @@ -521,9 +524,11 @@ pcr->pci_status, pcr->pci_command); if (pcr->pci_class_revision) printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", - pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, pcr->pci_rev_id); + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); if (pcr->pci_bist_header_latency_cache) - printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + printf(" BIST 0x%02x HEADER 0x%02x" + " LATENCY 0x%02x CACHE 0x%02x\n", pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer, pcr->pci_cache_line_size); printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x SECLT 0x%02x\n", @@ -541,9 +546,72 @@ (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000), pcr->pci_baserom & 0x1 ? "" : "not-"); if (pcr->pci_max_min_ipin_iline) - printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x INT_PIN 0x%02x INT_LINE 0x%02x\n", - pcr->pci_max_lat, pcr->pci_min_gnt, pcr->pci_int_pin, pcr->pci_int_line); + printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x" + " INT_PIN 0x%02x INT_LINE 0x%02x\n", + pcr->pci_max_lat, pcr->pci_min_gnt, + pcr->pci_int_pin, pcr->pci_int_line); } -#include "xf86getpagesize.c" +static void +print_apb(pciConfigPtr pcr) +{ + int i; + CARD8 io, mem; + printf(" STATUS 0x%04x COMMAND 0x%04x\n", + pcr->pci_status, pcr->pci_command); + printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n", + pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if, + pcr->pci_rev_id); + printf(" HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n", + pcr->pci_header_type, pcr->pci_latency_timer, + pcr->pci_cache_line_size); + printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x SECLT 0x%02x\n", + pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number, + pcr->pci_subordinate_bus_number, pcr->pci_secondary_latency_timer); + printf(" SECSTATUS 0x%04x\n", + pcr->pci_secondary_status); + printf(" %sFAST_B2B %sSEC_BUS_RST %sM_ABRT %sVGA_EN %sISA_EN" + " %sSERR_EN %sPERR_EN\n", + (pcr->pci_bridge_control & PCI_B_FAST_B_B) ? "" : "NO_", + (pcr->pci_bridge_control & PCI_B_SB_RESET) ? "" : "NO_", + (pcr->pci_bridge_control & PCI_B_M_ABORT) ? "" : "NO_", + (pcr->pci_bridge_control & PCI_B_VGA_EN) ? "" : "NO_", + (pcr->pci_bridge_control & PCI_B_ISA_EN) ? "" : "NO_", + (pcr->pci_bridge_control & PCI_B_SERR_EN) ? "" : "NO_", + (pcr->pci_bridge_control & PCI_B_P_ERR) ? "" : "NO_"); + printf(" TICK 0x%08lx SECCNTL 0x%02x\n", (long) + pciReadLong(pcr->tag, 0x00b0), pciReadByte(pcr->tag, 0x00dd)); + printf(" MASTER RETRIES: PRIMARY 0x%02x, SECONDARY 0x%02x\n", + pciReadByte(pcr->tag, 0x00c0), pciReadByte(pcr->tag, 0x00dc)); + printf(" TARGET RETRIES: PIO 0x%02x, DMA 0x%02x\n", + pciReadByte(pcr->tag, 0x00d8), pciReadByte(pcr->tag, 0x00da)); + printf(" TARGET LATENCY: PIO 0x%02x, DMA 0x%02x\n", + pciReadByte(pcr->tag, 0x00d9), pciReadByte(pcr->tag, 0x00db)); + printf(" DMA AFSR 0x%08lx%08lx AFAR 0x%08lx%08lx\n", + (long)pciReadLong(pcr->tag, 0x00cc), + (long) pciReadLong(pcr->tag, 0x00c8), + (long)pciReadLong(pcr->tag, 0x00d4), + (long)pciReadLong(pcr->tag, 0x00d0)); + printf(" PIO AFSR 0x%08lx%08lx AFAR 0x%08lx%08lx\n", + (long)pciReadLong(pcr->tag, 0x00ec), + (long)pciReadLong(pcr->tag, 0x00e8), + (long)pciReadLong(pcr->tag, 0x00f4), + (long)pciReadLong(pcr->tag, 0x00f0)); + printf(" PCI CNTL 0x%08lx%08lx DIAG 0x%08lx%08lx\n", + (long)pciReadLong(pcr->tag, 0x00e4), + (long)pciReadLong(pcr->tag, 0x00e0), + (long)pciReadLong(pcr->tag, 0x00fc), + (long)pciReadLong(pcr->tag, 0x00f8)); + printf(" MAPS: I/O 0x%02x, MEM 0x%02x\n", + (io = pciReadByte(pcr->tag, 0x00de)), + (mem = pciReadByte(pcr->tag, 0x00df))); + for (i = 0; i < 8; i++) + if (io & (1 << i)) + printf(" BUS I/O 0x%06x-0x%06x\n", i << 21, ((i + 1) << 21) - 1); + for (i = 0; i < 8; i++) + if (mem & (1 << i)) + printf(" BUS MEM 0x%08x-0x%08x\n", i << 29, ((i + 1) << 29) - 1); +} + +#include "xf86getpagesize.c" Index: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.4.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.5 --- xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.4.4.1 Thu May 31 18:20:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist Thu May 31 14:39:06 2001 @@ -1,6 +1,6 @@ #!/bin/sh # -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist,v 1.4.4.1 2001/05/31 22:20:25 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist,v 1.5 2001/05/31 18:39:06 dawes Exp $ # Usage() Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-excl:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-excl Mon Jul 2 05:37:18 2001 @@ -0,0 +1,6 @@ +bin/Xnest.exe +bin/Xprt.exe +bin/Xvfb.exe +bin/X +bin/xfs.exe +bin/XWin.exe Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/bin-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1,36 @@ +.XFree86_Version +bin +lib/libdps.a +lib/libdpstk.a +lib/libfntstubs.a +lib/libfreetype.a +lib/libFS.a +lib/libGL.a +lib/libGLU.a +lib/libGLw.a +lib/libICE.a +lib/liboldX.a +lib/libpsres.a +lib/libSM.a +lib/libX11.a +lib/libXau.a +lib/libXaw.a +lib/libXdmcp.a +lib/libXext.a +lib/libXfont.a +lib/libXfontcache.a +lib/libXft.a +lib/libXi.a +lib/libxkbfile.a +lib/libxkbui.a +lib/libXmu.a +lib/libXmuu.a +lib/libXp.a +lib/libXpm.a +lib/libXrandr.a +lib/libXrender.a +lib/libXt.a +lib/libXtst.a +lib/libXv.a +lib/libXxf86misc.a +lib/libXxf86vm.a Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/build-bindist diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/build-bindist:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/build-bindist Mon Jul 2 05:37:18 2001 @@ -0,0 +1,148 @@ +#!/bin/sh +# +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/build-bindist,v 1.1 2001/07/02 09:37:18 alanh Exp $ +# + +Usage() +{ + echo `basename $0` [-l] [-t type] [prefix] from-dir to-dir + exit 1 +} + +args= +createlist=NO +type=list + +while [ $# != 0 ]; do + case $1 in + -l) + createlist=YES + shift + ;; + -t) + shift + type=$1 + shift + ;; + *) + args="$args $1" + shift + ;; + esac +done + +if [ X"$args" != X ]; then + set - $args +fi + +case $# in +3) + PRE=$1 + shift + ;; +2) + PRE=X + ;; +*) + Usage + ;; +esac + +FROMDIR=$1 +TODIR=$2 + +if [ ! -d $FROMDIR ]; then + echo No such dir $FROMDIR + exit 2 +fi + +if [ ! -d $TODIR ]; then + echo No such dir $TODIR + exit 2 +fi + +cd $TODIR +SUBDIRS="`find . -type d ! -name bindist -print`" + +DIRFILE=dir +BINDIR=bindist +EXTRASFILE=extras +TAR="gnu-tar" +TAROPTS="-c -v -z" +TARLOPTS="-t -v -z -i" +CKSUM=md5 +SUMFILE=SUMS.md5 +LISTFILE=FILES + +GenList() +{ + (cd $TODIR/$BINDIR + rm -f $SUMFILE $LISTFILE + for i in *.tgz; do + echo $i + $CKSUM $i >> $SUMFILE + echo $i >> $LISTFILE + echo "------------" >> $LISTFILE + $TAR $TARLOPTS -f $i >> $LISTFILE + echo "" >> $LISTFILE + done + if [ -f $TODIR/$EXTRASFILE ]; then + for i in `cat $TODIR/$EXTRASFILE`; do + $CKSUM `basename $i` >> $SUMFILE + done + fi + ) +} + +if [ ! -d $TODIR/$BINDIR ]; then + mkdir $TODIR/$BINDIR +fi + +if [ $createlist = YES ]; then + GenList + exit 0; +fi + +for d in $SUBDIRS; do + if [ ! -d $TODIR/$d ]; then + echo No such dir $TODIR/$d + exit 2 + fi + (cd $TODIR/$d; + if [ ! -f $DIRFILE ]; then + echo No file $DIRFILE in $TODIR/$d +# exit 3 + else + DEFPREFIX=`cat $DIRFILE` + for i in *-$type; do + name=`basename $i -$type` + tarball=$PRE$name.tgz + echo creating $tarball + lfile="`cat $TODIR/$d/$i`" + if [ -f $name-excl ]; then + xfile="-X $TODIR/$d/$name-excl" + else + xfile="" + fi + if [ -f $name-dir ]; then + PREFIX=`cat $name-dir` + else + PREFIX=$DEFPREFIX + fi + (cd $FROMDIR/$PREFIX + $TAR $TAROPTS -f $TODIR/$BINDIR/$tarball $xfile $lfile + ) + done + fi + if [ -f $EXTRASFILE ]; then + for i in `cat $EXTRASFILE`; do + rm -f $TODIR/$BINDIR/`basename $i` + cp $FROMDIR/$PREFIX/$i $TODIR/$BINDIR + done + fi + ) +done + +# GenList + +exit 0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/dir diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/dir:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/dir Mon Jul 2 05:37:18 2001 @@ -0,0 +1 @@ +usr/X11R6 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-dir diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-dir:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-dir Mon Jul 2 05:37:18 2001 @@ -0,0 +1 @@ +etc/X11 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/etc-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1 @@ +. Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/fsrv-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/fsrv-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/fsrv-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1,2 @@ +bin/xfs.exe +man/man1/xfs.1 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/host.def diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/host.def:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/host.def Mon Jul 2 05:37:18 2001 @@ -0,0 +1,3 @@ +#define InstallEmptyHostDef +#define BuildBindist + Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/lib-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/lib-excl:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/lib-excl Mon Jul 2 05:37:18 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/Cygwin/lib-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/lib-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/lib-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1,2 @@ +lib/X11 +include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/man-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/man-excl:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/man-excl Mon Jul 2 05:37:18 2001 @@ -0,0 +1,2 @@ +man/man1/xfs.1 +man/cat1/xmseconfig.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/man-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/man-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/man-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1 @@ +man Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/nest-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/nest-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/nest-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1 @@ +bin/Xnest.exe Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prog-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prog-excl:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prog-excl Mon Jul 2 05:37:18 2001 @@ -0,0 +1,5 @@ +lib/Server +lib/X11 +lib/lib*.a +lib/modules +include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prog-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prog-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prog-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1,3 @@ +lib +include +lib/X11/config Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prt-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prt-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/prt-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1 @@ +bin/Xprt.exe Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/update-upd diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/update-upd:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/update-upd Mon Jul 2 05:37:18 2001 @@ -0,0 +1,32 @@ +bin/XWin.exe +bin/gccmakedep.exe +bin/mkhtmlindex.exe +bin/rman.exe +bin/pswrap.exe +bin/twm.exe +bin/xedit.exe +bin/xfs.exe +bin/xman.exe +bin/xterm.exe +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/cygwin.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 +lib/libfreetype.a +man/man1/XWin.1x Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/vfb-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/vfb-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/vfb-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1 @@ +bin/Xvfb.exe Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/xserv-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/xserv-list:1.1 --- /dev/null Fri Jan 18 15:25:43 2002 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Cygwin/xserv-list Mon Jul 2 05:37:18 2001 @@ -0,0 +1,2 @@ +bin/XWin.exe +bin/X Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list:1.1.2.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list:1.1.2.2 Thu May 31 18:20:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list Tue Jan 15 16:34:32 2002 @@ -1,2 +1,76 @@ .XFree86_Version bin +lib/libGL.1.2.dylib +lib/libGL.1.dylib +lib/libGL.dylib +lib/libGLU.1.3.dylib +lib/libGLU.1.dylib +lib/libGLU.dylib +lib/libICE.6.3.dylib +lib/libICE.6.dylib +lib/libICE.dylib +lib/libSM.6.0.dylib +lib/libSM.6.dylib +lib/libSM.dylib +lib/libX11.6.2.dylib +lib/libX11.6.dylib +lib/libX11.dylib +lib/libXaw.6.1.dylib +lib/libXaw.6.dylib +lib/libXaw.7.0.dylib +lib/libXaw.7.dylib +lib/libXaw.dylib +lib/libXext.6.4.dylib +lib/libXext.6.dylib +lib/libXext.dylib +lib/libXfont.1.4.dylib +lib/libXfont.1.dylib +lib/libXfont.dylib +lib/libXft.1.1.dylib +lib/libXft.1.dylib +lib/libXft.dylib +lib/libXi.6.0.dylib +lib/libXi.6.dylib +lib/libXi.dylib +lib/libXmu.6.2.dylib +lib/libXmu.6.dylib +lib/libXmu.dylib +lib/libXmuu.1.0.dylib +lib/libXmuu.1.dylib +lib/libXmuu.dylib +lib/libXp.6.2.dylib +lib/libXp.6.dylib +lib/libXp.dylib +lib/libXpm.4.11.dylib +lib/libXpm.4.dylib +lib/libXpm.dylib +lib/libXrandr.1.0.dylib +lib/libXrandr.1.dylib +lib/libXrandr.dylib +lib/libXrender.1.1.dylib +lib/libXrender.1.dylib +lib/libXrender.dylib +lib/libXt.6.0.dylib +lib/libXt.6.dylib +lib/libXt.dylib +lib/libXtst.6.1.dylib +lib/libXtst.6.dylib +lib/libXtst.dylib +lib/libXTrap.6.4.dylib +lib/libXTrap.6.dylib +lib/libXTrap.dylib +lib/libdps.1.0.dylib +lib/libdps.1.dylib +lib/libdps.dylib +lib/libdpstk.1.0.dylib +lib/libdpstk.1.dylib +lib/libdpstk.dylib +lib/libfreetype.6.2.dylib +lib/libfreetype.6.dylib +lib/libfreetype.dylib +lib/liboldX.6.0.dylib +lib/liboldX.6.dylib +lib/liboldX.dylib +lib/libpsres.1.0.dylib +lib/libpsres.1.dylib +lib/libpsres.dylib Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def:1.1.2.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def:1.1.2.2 Thu May 31 18:20:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def Thu May 31 14:47:07 2001 @@ -1,7 +1,7 @@ /* * 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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def,v 1.2 2001/05/31 18:47:07 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-excl:1.1.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-excl:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-excl:1.1.2.1 Mon May 28 02:59:41 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-excl Sat Jun 9 11:48:29 2001 @@ -1,5 +1,5 @@ lib/Server lib/X11 -lib/lib*.so* +lib/lib*.dylib lib/modules include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list:1.1.2.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list:1.1.2.2 Thu May 31 18:20:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list Tue Jan 15 16:34:35 2002 @@ -1,2 +1,76 @@ .XFree86_Version bin +lib/libGL.1.2.dylib +lib/libGL.1.dylib +lib/libGL.dylib +lib/libGLU.1.3.dylib +lib/libGLU.1.dylib +lib/libGLU.dylib +lib/libICE.6.3.dylib +lib/libICE.6.dylib +lib/libICE.dylib +lib/libSM.6.0.dylib +lib/libSM.6.dylib +lib/libSM.dylib +lib/libX11.6.2.dylib +lib/libX11.6.dylib +lib/libX11.dylib +lib/libXaw.6.1.dylib +lib/libXaw.6.dylib +lib/libXaw.7.0.dylib +lib/libXaw.7.dylib +lib/libXaw.dylib +lib/libXext.6.4.dylib +lib/libXext.6.dylib +lib/libXext.dylib +lib/libXfont.1.4.dylib +lib/libXfont.1.dylib +lib/libXfont.dylib +lib/libXft.1.1.dylib +lib/libXft.1.dylib +lib/libXft.dylib +lib/libXi.6.0.dylib +lib/libXi.6.dylib +lib/libXi.dylib +lib/libXmu.6.2.dylib +lib/libXmu.6.dylib +lib/libXmu.dylib +lib/libXmuu.1.0.dylib +lib/libXmuu.1.dylib +lib/libXmuu.dylib +lib/libXp.6.2.dylib +lib/libXp.6.dylib +lib/libXp.dylib +lib/libXpm.4.11.dylib +lib/libXpm.4.dylib +lib/libXpm.dylib +lib/libXrandr.1.0.dylib +lib/libXrandr.1.dylib +lib/libXrandr.dylib +lib/libXrender.1.1.dylib +lib/libXrender.1.dylib +lib/libXrender.dylib +lib/libXt.6.0.dylib +lib/libXt.6.dylib +lib/libXt.dylib +lib/libXtst.6.1.dylib +lib/libXtst.6.dylib +lib/libXtst.dylib +lib/libXTrap.6.4.dylib +lib/libXTrap.6.dylib +lib/libXTrap.dylib +lib/libdps.1.0.dylib +lib/libdps.1.dylib +lib/libdps.dylib +lib/libdpstk.1.0.dylib +lib/libdpstk.1.dylib +lib/libdpstk.dylib +lib/libfreetype.6.2.dylib +lib/libfreetype.6.dylib +lib/libfreetype.dylib +lib/liboldX.6.0.dylib +lib/liboldX.6.dylib +lib/liboldX.dylib +lib/libpsres.1.0.dylib +lib/libpsres.1.dylib +lib/libpsres.dylib Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def:1.1.2.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def:1.1.2.2 Thu May 31 18:20:25 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def Thu May 31 14:47:07 2001 @@ -1,7 +1,7 @@ /* * 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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def,v 1.2 2001/05/31 18:47:07 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-excl:1.1.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-excl:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-excl:1.1.2.1 Mon May 28 02:59:42 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-excl Sat Jun 9 11:48:29 2001 @@ -1,5 +1,5 @@ lib/Server lib/X11 -lib/lib*.so* +lib/lib*.dylib lib/modules include/X11/bitmaps 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list:1.13 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list:1.9.4.2 Fri Jun 1 12:57:39 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list Tue Jan 15 16:34:35 2002 @@ -9,16 +9,14 @@ lib/libICE.so lib/libOSMesa.so.3 lib/libOSMesa.so -lib/libPEX5.so.6 -lib/libPEX5.so lib/libSM.so.6 lib/libSM.so lib/libX11.so.6 lib/libX11.so -lib/libXIE.so.6 -lib/libXIE.so lib/libXThrStub.so.6 lib/libXThrStub.so +lib/libXTrap.so.6 +lib/libXTrap.so lib/libXaw.so.7 lib/libXaw.so.6 lib/libXaw.so @@ -38,6 +36,8 @@ lib/libXp.so lib/libXpm.so.4 lib/libXpm.so +lib/libXrandr.so.1 +lib/libXrandr.so lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6 @@ -48,7 +48,7 @@ lib/libdps.so lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6 +lib/libfreetype.so.8 lib/libfreetype.so lib/liboldX.so.6 lib/liboldX.so 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.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def:1.3.4.1 Thu May 31 18:20:27 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def Thu May 31 14:47:07 2001 @@ -1,7 +1,7 @@ /* * Host.def for building FreeBSD bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def,v 1.3.4.1 2001/05/31 22:20:27 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def,v 1.4 2001/05/31 18:47:07 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/update-upd:1.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/update-upd:1.2.2.1 Thu May 31 18:20:27 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/update-upd Tue Jan 15 16:34:35 2002 @@ -41,7 +41,7 @@ lib/libXft.so.1 lib/libfreetype.a lib/libfreetype.so -lib/libfreetype.so.6 +lib/libfreetype.so.8 man/man1/XFree86.1.gz man/man4/nv.4.gz man/man5/XF86Config.5.gz 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list:1.11 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list:1.7.4.2 Fri Jun 1 12:57:39 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list Tue Jan 15 16:34:35 2002 @@ -3,27 +3,27 @@ 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 lib/libX11.so.6.2 -lib/libXIE.so.6.0 lib/libXThrStub.so.6.0 +lib/libXTrap.so.6.4 lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXext.so.6.4 -lib/libXfont.so.1.3 -lib/libXft.so.1.0 +lib/libXfont.so.1.4 +lib/libXft.so.1.1 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 +lib/libXrandr.so.1.0 +lib/libXrender.so.1.1 lib/libXt.so.6.0 lib/libXtst.so.6.1 lib/libdps.so.1.0 lib/libdpstk.so.1.0 -lib/libfreetype.so.6.0 +lib/libfreetype.so.8.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.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def:1.3.4.1 Thu May 31 18:20:28 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def Thu May 31 14:47:07 2001 @@ -1,7 +1,7 @@ /* * Host.def for building FreeBSD/a.out bindists * - * $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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def,v 1.4 2001/05/31 18:47:07 dawes Exp $ */ #define InstallEmptyHostDef 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.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/update-upd:1.2.2.1 Thu May 31 18:20:28 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/update-upd Tue Jan 15 16:34:35 2002 @@ -32,11 +32,11 @@ lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXfont.a -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a -lib/libfreetype.so.6.0 +lib/libfreetype.so.8.0 man/man1/XFree86.1.gz man/man4/nv.4.gz man/man5/XF86Config.5.gz 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list:1.12 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list:1.8.4.2 Fri Jun 1 12:57:39 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list Tue Jan 15 16:34:36 2002 @@ -12,18 +12,15 @@ lib/libOSMesa.so.3.3 lib/libOSMesa.so.3 lib/libOSMesa.so -lib/libPEX5.so.6.0 -lib/libPEX5.so.6 -lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so -lib/libXIE.so.6.0 -lib/libXIE.so.6 -lib/libXIE.so +lib/libXTrap.so.6.4 +lib/libXTrap.so.6 +lib/libXTrap.so lib/libXaw.so.6.1 lib/libXaw.so.6 lib/libXaw.so.7.0 @@ -32,10 +29,10 @@ lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXfont.so.1 lib/libXfont.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXft.so.1 lib/libXft.so lib/libXi.so.6.0 @@ -53,7 +50,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrender.so.1.0 +lib/libXrandr.so.1.0 +lib/libXrandr.so.1 +lib/libXrandr.so +lib/libXrender.so.1.1 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -68,7 +68,7 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 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.6.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def:1.8 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def:1.6.2.1 Thu May 31 18:20:28 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def Tue Jun 5 19:00:40 2001 @@ -1,7 +1,7 @@ /* * Host.def for building Linux/alpha bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def,v 1.6.2.1 2001/05/31 22:20:28 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def,v 1.8 2001/06/05 23:00:40 dawes Exp $ */ #define InstallEmptyHostDef @@ -9,9 +9,7 @@ /* Need to have glide 3 installed, where available */ -#if LinuxCLibMajorVersion > 5 #define HasGlide3 YES -#endif #define BuildXF86DRI 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.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/update-upd:1.2.2.1 Thu May 31 18:20:28 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/update-upd Tue Jan 15 16:34:36 2002 @@ -39,15 +39,15 @@ lib/libXfont.a lib/libXfont.so lib/libXfont.so.1 -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a lib/libXft.so lib/libXft.so.1 -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a lib/libfreetype.so lib/libfreetype.so.6 -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list:1.12 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list:1.8.4.2 Fri Jun 1 12:57:39 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list Tue Jan 15 16:34:36 2002 @@ -12,18 +12,15 @@ lib/libOSMesa.so.3.3 lib/libOSMesa.so.3 lib/libOSMesa.so -lib/libPEX5.so.6.0 -lib/libPEX5.so.6 -lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so -lib/libXIE.so.6.0 -lib/libXIE.so.6 -lib/libXIE.so +lib/libXTrap.so.6.4 +lib/libXTrap.so.6 +lib/libXTrap.so lib/libXaw.so.6.1 lib/libXaw.so.6 lib/libXaw.so.7.0 @@ -32,10 +29,10 @@ lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXfont.so.1 lib/libXfont.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXft.so.1 lib/libXft.so lib/libXi.so.6.0 @@ -53,7 +50,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrender.so.1.0 +lib/libXrandr.so.1.0 +lib/libXrandr.so.1 +lib/libXrandr.so +lib/libXrender.so.1.1 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -68,7 +68,7 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 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.7.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def:1.9 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def:1.7.2.1 Thu May 31 18:20:29 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def Tue Jun 5 19:00:41 2001 @@ -1,7 +1,7 @@ /* * Host.def for building Linux/ix86 bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def,v 1.7.2.1 2001/05/31 22:20:29 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def,v 1.9 2001/06/05 23:00:41 dawes Exp $ */ #define InstallEmptyHostDef @@ -11,9 +11,9 @@ /* Need to have glide 2 and glide 3 installed, where available */ #define HasGlide2 YES -#if LinuxCLibMajorVersion > 5 + +/* May need to turn this off for libc5 builds */ #define HasGlide3 YES -#endif #define BuildXF86DRI 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.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/update-upd:1.2.2.1 Thu May 31 18:20:29 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/update-upd Tue Jan 15 16:34:36 2002 @@ -39,15 +39,15 @@ lib/libXfont.a lib/libXfont.so lib/libXfont.so.1 -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a lib/libXft.so lib/libXft.so.1 -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a lib/libfreetype.so lib/libfreetype.so.6 -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list:1.11 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list:1.7.4.2 Fri Jun 1 12:57:39 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list Tue Jan 15 16:34:37 2002 @@ -12,18 +12,15 @@ lib/libOSMesa.so.3.3 lib/libOSMesa.so.3 lib/libOSMesa.so -lib/libPEX5.so.6.0 -lib/libPEX5.so.6 -lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so -lib/libXIE.so.6.0 -lib/libXIE.so.6 -lib/libXIE.so +lib/libXTrap.so.6.4 +lib/libXTrap.so.6 +lib/libXTrap.so lib/libXaw.so.6.1 lib/libXaw.so.6 lib/libXaw.so.7.0 @@ -32,10 +29,10 @@ lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXfont.so.1 lib/libXfont.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXft.so.1 lib/libXft.so lib/libXi.so.6.0 @@ -53,7 +50,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrender.so.1.0 +lib/libXrandr.so.1.0 +lib/libXrandr.so.1 +lib/libXrandr.so +lib/libXrender.so.1.1 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -68,7 +68,7 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 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.5.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def:1.5.2.1 Thu May 31 18:20:31 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def Thu May 31 14:47:08 2001 @@ -1,7 +1,7 @@ /* * Host.def for building Linux/m68k bindists * - * $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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def,v 1.6 2001/05/31 18:47:08 dawes Exp $ */ #define InstallEmptyHostDef 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list:1.8 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list:1.4.4.2 Fri Jun 1 12:57:40 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list Tue Jan 15 16:34:37 2002 @@ -12,18 +12,15 @@ lib/libOSMesa.so.3.3 lib/libOSMesa.so.3 lib/libOSMesa.so -lib/libPEX5.so.6.0 -lib/libPEX5.so.6 -lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so -lib/libXIE.so.6.0 -lib/libXIE.so.6 -lib/libXIE.so +lib/libXTrap.so.6.4 +lib/libXTrap.so.6 +lib/libXTrap.so lib/libXaw.so.6.1 lib/libXaw.so.6 lib/libXaw.so.7.0 @@ -32,10 +29,10 @@ lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXfont.so.1 lib/libXfont.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXft.so.1 lib/libXft.so lib/libXi.so.6.0 @@ -53,7 +50,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrender.so.1.0 +lib/libXrandr.so.1.0 +lib/libXrandr.so.1 +lib/libXrandr.so +lib/libXrender.so.1.1 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -68,7 +68,7 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list:1.8 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list:1.4.4.2 Fri Jun 1 12:57:40 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list Tue Jan 15 16:34:38 2002 @@ -12,18 +12,15 @@ lib/libOSMesa.so.3.3 lib/libOSMesa.so.3 lib/libOSMesa.so -lib/libPEX5.so.6.0 -lib/libPEX5.so.6 -lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so.6 lib/libSM.so lib/libX11.so.6.2 lib/libX11.so.6 lib/libX11.so -lib/libXIE.so.6.0 -lib/libXIE.so.6 -lib/libXIE.so +lib/libXTrap.so.6.4 +lib/libXTrap.so.6 +lib/libXTrap.so lib/libXaw.so.6.1 lib/libXaw.so.6 lib/libXaw.so.7.0 @@ -32,10 +29,10 @@ lib/libXext.so.6.4 lib/libXext.so.6 lib/libXext.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXfont.so.1 lib/libXfont.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXft.so.1 lib/libXft.so lib/libXi.so.6.0 @@ -53,7 +50,10 @@ lib/libXpm.so.4.11 lib/libXpm.so.4 lib/libXpm.so -lib/libXrender.so.1.0 +lib/libXrandr.so.1.0 +lib/libXrandr.so.1 +lib/libXrandr.so +lib/libXrender.so.1.1 lib/libXrender.so.1 lib/libXrender.so lib/libXt.so.6.0 @@ -68,7 +68,7 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 lib/libfreetype.so.6 lib/libfreetype.so lib/libpsres.so.1.0 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.4.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def:1.5 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def:1.4.2.1 Thu May 31 18:20:31 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def Thu May 31 14:47:09 2001 @@ -1,7 +1,7 @@ /* * Host.def for building Linux/ppc bindists * - * $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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def,v 1.5 2001/05/31 18:47:09 dawes Exp $ */ #define InstallEmptyHostDef 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.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def:1.3.4.1 Thu May 31 18:20:31 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def Thu May 31 14:47:09 2001 @@ -1,7 +1,7 @@ /* * host.def for building LynxOS binary dists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def,v 1.3.4.1 2001/05/31 22:20:31 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def,v 1.4 2001/05/31 18:47:09 dawes Exp $ */ #define BuildBindist Index: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/update-upd:1.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/update-upd:1.2.2.1 Thu May 31 18:20:31 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/update-upd Tue Jan 15 16:34:38 2002 @@ -41,7 +41,7 @@ lib/libXft.so.1 lib/libfreetype.a lib/libfreetype.so -lib/libfreetype.so.6 +lib/libfreetype.so.8 man/cat1/XFree86.1 man/cat4/nv.4 man/cat5/XF86Config.5 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list:1.8 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list:1.4.4.2 Fri Jun 1 12:57:40 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list Tue Jan 15 16:34:38 2002 @@ -3,25 +3,25 @@ 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 lib/libX11.so.6.2 -lib/libXIE.so.6.0 +lib/libXTrap.so.6.4 lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXext.so.6.4 -lib/libXfont.so.1.3 -lib/libXft.so.1.0 +lib/libXfont.so.1.4 +lib/libXft.so.1.1 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 +lib/libXrandr.so.1.0 +lib/libXrender.so.1.1 lib/libXt.so.6.0 lib/libXtst.so.6.1 lib/libdps.so.1.0 lib/libdpstk.so.1.0 -lib/libfreetype.so.6.0 +lib/libfreetype.so.8.0 lib/liboldX.so.6.0 lib/libpsres.so.1.0 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.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def:1.1.4.1 Thu May 31 18:20:32 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def Thu May 31 14:47:09 2001 @@ -1,7 +1,7 @@ /* * Host.def for building NetBSD bindists * - * $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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def,v 1.2 2001/05/31 18:47:09 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/update-upd:1.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/update-upd:1.2.2.1 Thu May 31 18:20:32 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/update-upd Tue Jan 15 16:34:38 2002 @@ -32,11 +32,11 @@ lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXfont.a -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a -lib/libfreetype.so.6.0 +lib/libfreetype.so.8.0 man/cat1/XFree86.0 man/cat4/nv.0 man/cat5/XF86Config.0 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list:1.13 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list:1.9.4.2 Fri Jun 1 12:57:40 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list Tue Jan 15 16:34:38 2002 @@ -9,18 +9,15 @@ lib/libICE.so lib/libICE.so.6 lib/libICE.so.6.3 -lib/libPEX5.so -lib/libPEX5.so.6 -lib/libPEX5.so.6.0 lib/libSM.so lib/libSM.so.6 lib/libSM.so.6.0 lib/libX11.so lib/libX11.so.6 lib/libX11.so.6.2 -lib/libXIE.so -lib/libXIE.so.6 -lib/libXIE.so.6.0 +lib/libXTrap.so +lib/libXTrap.so.6 +lib/libXTrap.so.6.4 lib/libXaw.so lib/libXaw.so.6 lib/libXaw.so.6.1 @@ -31,10 +28,10 @@ lib/libXext.so.6.4 lib/libXfont.so lib/libXfont.so.1 -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.so lib/libXft.so.1 -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXi.so lib/libXi.so.6 lib/libXi.so.6.0 @@ -50,9 +47,12 @@ lib/libXpm.so lib/libXpm.so.4 lib/libXpm.so.4.11 +lib/libXrandr.so +lib/libXrandr.so.1 +lib/libXrandr.so.1.0 lib/libXrender.so lib/libXrender.so.1 -lib/libXrender.so.1.0 +lib/libXrender.so.1.1 lib/libXt.so lib/libXt.so.6 lib/libXt.so.6.0 @@ -66,8 +66,8 @@ lib/libdpstk.so.1 lib/libdpstk.so.1.0 lib/libfreetype.so -lib/libfreetype.so.6 -lib/libfreetype.so.6.0 +lib/libfreetype.so.8 +lib/libfreetype.so.8.0 lib/liboldX.so lib/liboldX.so.6 lib/liboldX.so.6.0 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.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def:1.3.4.1 Thu May 31 18:20:32 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def Thu May 31 14:47:09 2001 @@ -1,7 +1,7 @@ /* * Host.def for building NetBSD bindists * - * $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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def,v 1.4 2001/05/31 18:47:09 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/update-upd:1.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/update-upd:1.2.2.1 Thu May 31 18:20:32 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/update-upd Tue Jan 15 16:34:38 2002 @@ -39,15 +39,15 @@ lib/libXfont.a lib/libXfont.so lib/libXfont.so.1 -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a lib/libXft.so lib/libXft.so.1 -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a lib/libfreetype.so -lib/libfreetype.so.6 -lib/libfreetype.so.6.0 +lib/libfreetype.so.8 +lib/libfreetype.so.8.0 man/cat1/XFree86.0 man/cat4/nv.0 man/cat5/XF86Config.0 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list:1.16 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list:1.11.4.2 Fri Jun 1 12:57:40 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list Tue Jan 15 19:02:16 2002 @@ -3,26 +3,26 @@ 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 lib/libX11.so.6.2 -lib/libXIE.so.6.0 -lib/libXThrStub.so.6.0 +lib/libXThrStub.so.6.1 +lib/libXTrap.so.6.4 lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXext.so.6.4 -lib/libXfont.so.1.3 -lib/libXft.so.1.0 +lib/libXfont.so.1.4 +lib/libXft.so.1.1 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 +lib/libXrandr.so.1.0 +lib/libXrender.so.1.1 lib/libXt.so.6.0 lib/libXtst.so.6.1 lib/libdps.so.1.0 lib/libdpstk.so.1.0 -lib/libfreetype.so.6.0 +lib/libfreetype.so.8.0 lib/liboldX.so.6.0 lib/libpsres.so.1.0 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.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def:1.3.4.1 Thu May 31 18:20:33 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def Thu May 31 14:47:10 2001 @@ -1,7 +1,7 @@ /* * Host.def for building OpenBSD/ix86 bindists * - * $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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def,v 1.4 2001/05/31 18:47:10 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/update-upd:1.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/update-upd:1.2.2.1 Thu May 31 18:20:33 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/update-upd Tue Jan 15 16:34:39 2002 @@ -32,11 +32,11 @@ lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXfont.a -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a -lib/libfreetype.so.6.0 +lib/libfreetype.so.8.0 man/cat1/XFree86.0 man/cat4/nv.0 man/cat5/XF86Config.0 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.8.2 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list:1.6 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list:1.3.8.2 Fri Jun 1 12:57:40 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list Fri Dec 28 18:36:35 2001 @@ -1,10 +1,9 @@ .XFree86_Version bin lib/libICE.so.6.3 -lib/libPEX5.so.6.0 lib/libSM.so.6.0 lib/libX11.so.6.1 -lib/libXIE.so.6.0 +lib/libXTrap.so.6.4 lib/libXaw.so.6.1 lib/libXext.so.6.3 lib/libXi.so.6.0 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.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def:1.3 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def:1.2.4.1 Thu May 31 18:20:34 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def Thu May 31 14:47:10 2001 @@ -1,7 +1,7 @@ /* * Host.def for building OpenBSD/sparc bindists * - * $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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def,v 1.3 2001/05/31 18:47:10 dawes Exp $ */ #define InstallEmptyHostDef 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list:1.12 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list:1.8.4.2 Fri Jun 1 12:57:41 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list Tue Jan 15 16:34:39 2002 @@ -6,22 +6,20 @@ lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so -lib/libPEX5.so.6.0 -lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so lib/libX11.so.6.2 lib/libX11.so -lib/libXIE.so.6.0 -lib/libXIE.so +lib/libXTrap.so.6.4 +lib/libXTrap.so lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXaw.so lib/libXext.so.6.4 lib/libXext.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXfont.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so @@ -33,7 +31,9 @@ lib/libXp.so lib/libXpm.so.4.11 lib/libXpm.so -lib/libXrender.so.1.0 +lib/libXrandr.so.1.0 +lib/libXrandr.so +lib/libXrender.so.1.1 lib/libXrender.so lib/libXt.so.6.0 lib/libXt.so @@ -43,7 +43,7 @@ lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so 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.4.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def:1.5 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def:1.4.2.1 Thu May 31 18:20:35 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def Thu May 31 14:47:10 2001 @@ -1,7 +1,7 @@ /* * Host.def for building SVR4.0 bindists * - * $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 $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.5 2001/05/31 18:47:10 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/update-upd:1.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/update-upd:1.2.2.1 Thu May 31 18:20:35 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/update-upd Tue Jan 15 16:34:39 2002 @@ -35,13 +35,13 @@ lib/libXaw.so.7.0 lib/libXfont.a lib/libXfont.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a lib/libXft.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a lib/libfreetype.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 man/man1/XFree86.1x man/man4/XF86Config.4 man/man7/nv.7 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list:1.12 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list:1.8.4.2 Fri Jun 1 12:57:41 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list Tue Jan 15 16:34:39 2002 @@ -6,22 +6,20 @@ lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so -lib/libPEX5.so.6.0 -lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so lib/libX11.so.6.2 lib/libX11.so -lib/libXIE.so.6.0 -lib/libXIE.so +lib/libXTrap.so.6.4 +lib/libXTrap.so lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXaw.so lib/libXext.so.6.4 lib/libXext.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXfont.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so @@ -33,7 +31,9 @@ lib/libXp.so lib/libXpm.so.4.11 lib/libXpm.so -lib/libXrender.so.1.0 +lib/libXrandr.so.1.0 +lib/libXrandr.so +lib/libXrender.so.1.1 lib/libXrender.so lib/libXt.so.6.0 lib/libXt.so @@ -43,7 +43,7 @@ lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def diff -u 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.5 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def:1.4.2.1 Thu May 31 18:20:35 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def Thu May 31 14:47:11 2001 @@ -1,7 +1,7 @@ /* * Host.def for building Solaris bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.4.2.1 2001/05/31 22:20:35 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.5 2001/05/31 18:47:11 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/update-upd:1.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/update-upd:1.2.2.1 Thu May 31 18:20:35 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/update-upd Tue Jan 15 16:34:40 2002 @@ -35,13 +35,13 @@ lib/libXaw.so.7.0 lib/libXfont.a lib/libXfont.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a lib/libXft.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a lib/libfreetype.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 man/man1/XFree86.1x man/man4/XF86Config.4 man/man7/nv.7 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.4.2 xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list:1.12 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list:1.8.4.2 Fri Jun 1 12:57:41 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list Tue Jan 15 16:34:40 2002 @@ -6,22 +6,20 @@ lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so -lib/libPEX5.so.6.0 -lib/libPEX5.so lib/libSM.so.6.0 lib/libSM.so lib/libX11.so.6.2 lib/libX11.so -lib/libXIE.so.6.0 -lib/libXIE.so +lib/libXTrap.so.6.4 +lib/libXTrap.so lib/libXaw.so.6.1 lib/libXaw.so.7.0 lib/libXaw.so lib/libXext.so.6.4 lib/libXext.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXfont.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libXft.so lib/libXi.so.6.0 lib/libXi.so @@ -33,7 +31,9 @@ lib/libXp.so lib/libXpm.so.4.11 lib/libXpm.so -lib/libXrender.so.1.0 +lib/libXrandr.so.1.0 +lib/libXrandr.so +lib/libXrender.so.1.1 lib/libXrender.so lib/libXt.so.6.0 lib/libXt.so @@ -43,7 +43,7 @@ lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def diff -u 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.5 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def:1.4.2.1 Thu May 31 18:20:36 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def Thu May 31 14:47:11 2001 @@ -1,7 +1,7 @@ /* * Host.def for building UnixWare bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.4.2.1 2001/05/31 22:20:36 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.5 2001/05/31 18:47:11 dawes Exp $ */ #define InstallEmptyHostDef Index: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/update-upd:1.2.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/update-upd:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/update-upd:1.2.2.1 Thu May 31 18:20:36 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/update-upd Tue Jan 15 16:34:40 2002 @@ -35,13 +35,13 @@ lib/libXaw.so.7.0 lib/libXfont.a lib/libXfont.so -lib/libXfont.so.1.3 +lib/libXfont.so.1.4 lib/libXft.a lib/libXft.so -lib/libXft.so.1.0 +lib/libXft.so.1.1 lib/libfreetype.a lib/libfreetype.so -lib/libfreetype.so.6.0 +lib/libfreetype.so.6.2 man/man1/XFree86.1x man/man4/XF86Config.4 man/man7/nv.7 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras:1.4.4.1 xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras:1.4.4.1 Fri Jun 1 14:34:49 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras Sat Feb 26 20:01:56 2000 @@ -1,4 +1,5 @@ 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/fnts-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-list:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-list:1.4 --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-list:1.3 Thu Dec 14 16:59:51 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-list Fri Dec 28 18:36:37 2001 @@ -1,6 +1,5 @@ lib/X11/fonts/75dpi lib/X11/fonts/misc -lib/X11/fonts/PEX lib/X11/fonts/CID lib/X11/fonts/local lib/X11/fonts/util Index: xc/programs/Xserver/hw/xfree86/etc/bindist/common/fscl-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/fscl-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/common/fscl-list:1.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/fscl-list:1.1 Tue May 27 00:01:19 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/fscl-list Fri Dec 28 18:36:37 2001 @@ -1,2 +1,3 @@ lib/X11/fonts/Speedo lib/X11/fonts/Type1 +lib/X11/fonts/TTF Index: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def:1.9 xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def:1.11 --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def:1.9 Mon Apr 23 11:54:04 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def Wed Jan 16 13:36:01 2002 @@ -6,7 +6,7 @@ * - XFree86 doctools package (requires groff) * - nroff/troff or groff * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def,v 1.9 2001/04/23 15:54:04 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def,v 1.11 2002/01/16 18:36:01 dawes Exp $ */ #define HasSgmlFmt YES @@ -15,10 +15,7 @@ #define HasLatex YES #define BuildSpecsDocs YES -#define SpecsDocDirs BDF CTEXT FSProtocol GL ICCCM ICE \ - /*PEX5*/ PM Render SM X11 XDMCP XIM XLFD \ - XProtocol Xaw Xext Xi Xmu Xserver Xt Xv \ - i18n programs rstart xfs xterm xtrans +#define BuildAllSpecsDocs YES #define InstallHardcopyDocs YES #define HardcopyDocDirs RX XIE XKB XPRINT Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.24 xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.27 --- xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.24 Fri Apr 6 14:16:31 2001 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c Wed Oct 31 17:50:29 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.24 2001/04/06 18:16:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.27 2001/10/31 22:50:29 tsi Exp $ */ /* all driver need this */ #include "xf86.h" @@ -290,7 +290,7 @@ } if (namep) { *namep = xnfalloc(16); - xf86strncpy(*namep,fix.id,16); + strncpy(*namep,fix.id,16); } return fd; } @@ -302,9 +302,7 @@ static int fbdev_open(char *dev, char** namep) { - struct fb_con2fbmap c2m; struct fb_fix_screeninfo fix; - char fbdev[16]; int fd; /* try argument (from XF86Config) first */ @@ -324,7 +322,7 @@ } else { if (namep) { *namep = xnfalloc(16); - xf86strncpy(*namep,fix.id,16); + strncpy(*namep,fix.id,16); } } } @@ -399,10 +397,13 @@ } int -fbdevHWGetDepth(ScrnInfoPtr pScrn) +fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); + if (fbbpp) + *fbbpp = fPtr->var.bits_per_pixel; + if (fPtr->fix.visual == FB_VISUAL_TRUECOLOR || fPtr->fix.visual == FB_VISUAL_DIRECTCOLOR) return fPtr->var.red.length+fPtr->var.green.length+ @@ -807,6 +808,8 @@ case DPMSModeOff: fbmode = 4; break; + default: + return; } if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)fbmode)) @@ -821,7 +824,7 @@ unsigned long unblank; if (!pScrn->vtSema) - return; + return TRUE; unblank = xf86IsUnblank(mode); Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h:1.10 xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h:1.11 --- xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h:1.10 Fri Apr 6 14:16:31 2001 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h Mon Oct 1 09:44:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.10 2001/04/06 18:16:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.11 2001/10/01 13:44:12 eich Exp $ */ #ifndef _FBDEVHW_H_ #define _FBDEVHW_H_ @@ -19,7 +19,7 @@ Bool fbdevHWInit(ScrnInfoPtr pScrn, pciVideoPtr pPci, char *device); char* fbdevHWGetName(ScrnInfoPtr pScrn); -int fbdevHWGetDepth(ScrnInfoPtr pScrn); +int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp); int fbdevHWGetLineLength(ScrnInfoPtr pScrn); int fbdevHWGetType(ScrnInfoPtr pScrn); int fbdevHWGetVidmem(ScrnInfoPtr pScrn); Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c:1.10 xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c:1.12 --- xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c:1.10 Fri Apr 6 14:16:31 2001 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c Sat Oct 27 23:33:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.10 2001/04/06 18:16:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.12 2001/10/28 03:33:55 tsi Exp $ */ #include "xf86.h" #include "xf86cmap.h" @@ -39,7 +39,7 @@ } int -fbdevHWGetDepth(ScrnInfoPtr pScrn) +fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp) { return -1; } @@ -47,6 +47,7 @@ int fbdevHWGetLineLength(ScrnInfoPtr pScrn) { + return -1; /* Should cause something spectacular... */ } int @@ -165,4 +166,5 @@ Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode) { + return FALSE; } Index: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c diff -u xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.9 xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.10 --- xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.9 Mon Jan 22 16:09:37 2001 +++ xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c Thu Dec 20 16:35:40 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.9 2001/01/22 21:09:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c,v 1.10 2001/12/20 21:35:40 eich Exp $ */ #if 1 #include "misc.h" @@ -782,8 +782,10 @@ if (devs_too) { I2CDevPtr d; - while ((d = b->FirstDev) != NULL) - xf86DestroyI2CDevRec(d, unalloc); + while ((d = b->FirstDev) != NULL) { + b->FirstDev = d->NextDev; + xf86DestroyI2CDevRec(d, unalloc); + } } else { if (unalloc) { xf86Msg(X_ERROR, "i2c bug: Attempt to remove I2C bus \"%s\", " Index: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h diff -u xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h:1.7 xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h:1.8 --- xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h:1.7 Mon Jan 22 16:09:40 2001 +++ xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h Thu Jul 19 10:19:40 2001 @@ -2,7 +2,7 @@ * Copyright (C) 1998 Itai Nahshon, Michael Schimek */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h,v 1.7 2001/01/22 21:09:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h,v 1.8 2001/07/19 14:19:40 tsi Exp $ */ #ifndef _XF86I2C_H #define _XF86I2C_H @@ -66,6 +66,7 @@ I2CSlaveAddr SlaveAddr; I2CBusPtr pI2CBus; I2CDevPtr NextDev; + DevUnion DriverPrivate; } I2CDevRec; I2CDevPtr xf86CreateI2CDevRec(void); Index: xc/programs/Xserver/hw/xfree86/input/acecad/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/acecad/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/input/acecad/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/input/acecad/Imakefile:1.4 Sat Aug 14 06:49:59 1999 +++ xc/programs/Xserver/hw/xfree86/input/acecad/Imakefile Mon Aug 13 15:35:00 2001 @@ -1,15 +1,16 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/acecad/Imakefile,v 1.4 1999/08/14 10:49:59 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/acecad/Imakefile,v 1.5 2001/08/13 19:35:00 dawes Exp $ #define IHaveModules #include <Server.tmpl> -SRCS = xf86AceCad.c -OBJS = xf86AceCad.o +SRCS = acecad.c +OBJS = acecad.o -DRIVER = xf86AceCad +DRIVER = acecad INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(XINCLUDESRC) \ + -I$(EXTINCSRC) #if MakeHasPosixVariableSubstitutions SubdirLibraryRule($(OBJS)) Index: xc/programs/Xserver/hw/xfree86/input/acecad/acecad.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/acecad/acecad.c:1.2 --- /dev/null Fri Jan 18 15:25:52 2002 +++ xc/programs/Xserver/hw/xfree86/input/acecad/acecad.c Mon Nov 26 11:25:52 2001 @@ -0,0 +1,916 @@ +/* + * Copyright (c) 2001 Edouard TISSERANT <tissered@esstin.u-nancy.fr> + * Parts inspired from Shane Watts <shane@bofh.asn.au> XFree86 3 Acecad Driver + * Thanks to Emily, from AceCad, For giving me documents. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/acecad/acecad.c,v 1.2 2001/11/26 16:25:52 dawes Exp $ */ + +#define _ACECAD_C_ +/***************************************************************************** + * Standard Headers + ****************************************************************************/ + +#ifdef LINUX_INPUT +#include <asm/types.h> +#include <linux/input.h> +#ifdef BUS_PCI +#undef BUS_PCI +#endif +#ifdef BUS_ISA +#undef BUS_ISA +#endif +#endif + +#include <misc.h> +#include <xf86.h> +#define NEED_XF86_TYPES +#include <xf86_ansic.h> +#include <xf86_OSproc.h> +#include <xisb.h> +#include <xf86Xinput.h> +#include <exevents.h> +#include <xf86Module.h> + +/***************************************************************************** + * Local Headers + ****************************************************************************/ +#include "acecad.h" + +/***************************************************************************** + * Variables without includable headers + ****************************************************************************/ + +/***************************************************************************** + * Local Variables + ****************************************************************************/ + +#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) +#undef read +#define read(a,b,c) xf86ReadSerial((a),(b),(c)) + +/* max number of input events to read in one read call */ +#define MAX_EVENTS 50 + + +static InputDriverRec ACECAD = +{ + 1, + "acecad", + NULL, + AceCadPreInit, + NULL, + NULL, + 0 +}; + + +static XF86ModuleVersionInfo VersionRec = +{ + "acecad", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} +}; + + +static const char *default_options[] = +{ + "BaudRate", "9600", + "StopBits", "1", + "DataBits", "8", + "Parity", "Odd", + "Vmin", "1", + "Vtime", "10", + "FlowControl", "Xoff", + NULL +}; + +XF86ModuleData acecadModuleData = { &VersionRec, SetupProc, TearDownProc}; + +/***************************************************************************** + * Function Definitions + ****************************************************************************/ + +static pointer +SetupProc( pointer module, + pointer options, + int *errmaj, + int *errmin ) +{ + xf86AddInputDriver(&ACECAD, module, 0); + return module; +} + +static void +TearDownProc( pointer p ) +{ +#if 0 + LocalDevicePtr local = (LocalDevicePtr) p; + AceCadPrivatePtr priv = (AceCadPrivatePtr) local->private; + + DeviceOff (local->dev); + + xf86CloseSerial (local->fd); + XisbFree (priv->buffer); + xfree (priv); + xfree (local->name); + xfree (local); +#endif +} + +static int +IsUSBLine(int fd) +{ + int version; + int err; + + SYSCALL(err = ioctl(fd, EVIOCGVERSION, &version)); + + if (!err) { + xf86Msg(X_CONFIG,"Kernel Input driver version is %d.%d.%d\n", + version >> 16, (version >> 8) & 0xff, version & 0xff); + return 1; + } else { + return 0; + } +} + + +static InputInfoPtr +AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + LocalDevicePtr local = xf86AllocateInput(drv, 0); + AceCadPrivatePtr priv = xcalloc (1, sizeof (AceCadPrivateRec)); + int speed; + char *s; + + if ((!local) || (!priv)) + goto SetupProc_fail; + + memset(priv,0,sizeof (AceCadPrivateRec)); + + local->name = dev->identifier; + local->type_name = "AceCad Tablet"; + local->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS; + local->motion_history_proc = xf86GetMotionEvents; + local->control_proc = NULL; + local->close_proc = CloseProc; + local->switch_mode = NULL; + local->conversion_proc = ConvertProc; + local->reverse_conversion_proc = ReverseConvertProc; + local->dev = NULL; + local->private = priv; + local->private_flags = 0; + local->conf_idev = dev; + local->device_control = DeviceControl; + /*local->always_core_feedback = 0;*/ + + xf86CollectInputOptions(local, default_options, NULL); + + xf86OptionListReport(local->options); + + priv->acecadInc = xf86SetIntOption(local->options, "Increment", 0 ); + + local->fd = xf86OpenSerial (local->options); + if (local->fd == -1) + { + xf86Msg(X_ERROR,"AceCad driver unable to open device\n"); + goto SetupProc_fail; + } + xf86ErrorFVerb( 6, "tty port opened successfully\n" ); + + if(IsUSBLine(local->fd)){ + priv->acecadUSB=1; + + local->read_input = USBReadInput; + + if (USBQueryHardware(local) != Success) + { + ErrorF ("Unable to query/initialize AceCad hardware.\n"); + goto SetupProc_fail; + } + } + else{ + priv->acecadUSB=0; + + local->read_input = ReadInput; + + speed = xf86SetIntOption(local->options, "ReportSpeed", 85 ); + + switch (speed) + { + case 120: + priv->acecadReportSpeed = 'Q'; + break; + case 85: + priv->acecadReportSpeed = 'R'; + break; + case 10: + priv->acecadReportSpeed = 'S'; + break; + case 2: + priv->acecadReportSpeed = 'T'; + break; + default: + priv->acecadReportSpeed = 'R'; + speed = 85; + xf86Msg(X_CONFIG, "Acecad Tablet: ReportSpeed possible values:\n 120, 85, 10, 2 \n"); + } + + xf86Msg(X_CONFIG, "Acecad Tablet report %d points/s\n", speed); + + priv->buffer = XisbNew (local->fd, 200); + + /* + * Verify that hardware is attached and fuctional + */ + if (QueryHardware(priv) != Success) + { + xf86Msg(X_ERROR,"Unable to query/initialize AceCad hardware.\n"); + goto SetupProc_fail; + } + } + + s = xf86FindOptionValue(local->options, "Mode"); + if (s && (xf86NameCmp(s, "Relative") == 0)) + { + priv->flags = priv->flags & ~ABSOLUTE_FLAG; + } + else + { + priv->flags = priv->flags | ABSOLUTE_FLAG; + } + + xf86Msg(X_CONFIG, "Acecad Tablet is in %s mode\n",(priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); + DBG (9, XisbTrace (priv->buffer, 1)); + + local->history_size = xf86SetIntOption(local->options , "HistorySize", 0); + + xf86ProcessCommonOptions(local, local->options); + + local->flags |= XI86_CONFIGURED; + + if (local->fd != -1) + { + RemoveEnabledDevice (local->fd); + if (priv->buffer) + { + XisbFree(priv->buffer); + priv->buffer = NULL; + } + xf86CloseSerial(local->fd); + } + RemoveEnabledDevice (local->fd); + local->fd = -1; + return (local); + + /* + * If something went wrong, cleanup and return NULL + */ + SetupProc_fail: + if ((local) && (local->fd)) + xf86CloseSerial (local->fd); + if (local) + xfree (local); + + if ((priv) && (priv->buffer)) + XisbFree (priv->buffer); + if (priv) + xfree (priv); + return (NULL); +} + +static Bool +DeviceControl (DeviceIntPtr dev, int mode) +{ + Bool RetValue; + + switch (mode) + { + case DEVICE_INIT: + DeviceInit (dev); + RetValue = Success; + break; + case DEVICE_ON: + RetValue = DeviceOn( dev ); + break; + case DEVICE_OFF: + RetValue = DeviceOff( dev ); + break; + case DEVICE_CLOSE: + RetValue = DeviceClose( dev ); + break; + default: + RetValue = BadValue; + } + + return( RetValue ); +} + +static Bool +DeviceOn (DeviceIntPtr dev) +{ + char buffer[256]; + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private); + + xf86Msg(X_CONFIG, "Acecad Tablet Device On\n"); + + local->fd = xf86OpenSerial(local->options); + if (local->fd == -1) + { + xf86Msg(X_WARNING, "%s: cannot open input device\n", local->name); + return (!Success); + } + + + if (priv->acecadUSB==0){ + priv->buffer = XisbNew(local->fd, 200); + if (!priv->buffer) + { + xf86CloseSerial(local->fd); + local->fd = -1; + return (!Success); + } + + /*Rets qu'a l'envoyer a la tablette */ + sprintf(buffer, "%s%c%c%c%c", acecad_initstr, priv->acecadReportSpeed ,ACECAD_INCREMENT, 32 + priv->acecadInc, (priv->flags & ABSOLUTE_FLAG)? ACECAD_ABSOLUTE: ACECAD_RELATIVE); + XisbWrite (priv->buffer, (unsigned char *)buffer, strlen(buffer)); + } + + xf86FlushInput(local->fd); + xf86AddEnabledDevice (local); + dev->public.on = TRUE; + return (Success); +} + +static Bool +DeviceOff (DeviceIntPtr dev) +{ + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private); + + + if (local->fd != -1) + { + RemoveEnabledDevice (local->fd); + if (priv->buffer) + { + XisbFree(priv->buffer); + priv->buffer = NULL; + } + xf86CloseSerial(local->fd); + } + + + xf86RemoveEnabledDevice (local); + dev->public.on = FALSE; + return (Success); +} + +static Bool +DeviceClose (DeviceIntPtr dev) +{ + xf86Msg(X_CONFIG, "Acecad Tablet Device Close\n"); + return (Success); +} + +static void +ControlProc(DeviceIntPtr device, + PtrCtrl *ctrl) +{ + xf86Msg(X_CONFIG, "Acecad Tablet Control Proc\n"); +} + +static Bool +DeviceInit (DeviceIntPtr dev) +{ + int rx, ry; + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private); + unsigned char map[] = + {0, 1, 2, 3}; + + xf86Msg(X_CONFIG, "Acecad Tablet Device Init\n"); + + /* 3 boutons */ + if (InitButtonClassDeviceStruct (dev, 3, map) == FALSE) + { + ErrorF ("Unable to allocate AceCad ButtonClassDeviceStruct\n"); + return !Success; + } + + if (InitFocusClassDeviceStruct (dev) == FALSE) + { + ErrorF("Unable to allocate AceCad FocusClassDeviceStruct\n"); + return !Success; + } + + if (InitPtrFeedbackClassDeviceStruct(dev, + ControlProc) == FALSE) { + ErrorF("unable to init ptr feedback\n"); + return !Success; + } + + + /* 3 axes */ + if (InitValuatorClassDeviceStruct (dev, 3, xf86GetMotionEvents, + local->history_size, + ((priv->flags & ABSOLUTE_FLAG)? Absolute: Relative)|OutOfProximity) + == FALSE) + { + ErrorF ("Unable to allocate AceCad ValuatorClassDeviceStruct\n"); + return !Success; + } + else + { + + InitValuatorAxisStruct(dev, + 0, + 0, /* min val */ + priv->acecadMaxX, /* max val */ + 1000, /* resolution */ + 0, /* min_res */ + 1000); /* max_res */ + InitValuatorAxisStruct(dev, + 1, + 0, /* min val */ + priv->acecadMaxY, /* max val */ + 1000, /* resolution */ + 0, /* min_res */ + 1000); /* max_res */ + InitValuatorAxisStruct(dev, + 2, + 0, /* min val */ + priv->acecadMaxZ, /* max val */ + 1000, /* resolution */ + 0, /* min_res */ + 1000); /* max_res */ + + } + + if (InitProximityClassDeviceStruct (dev) == FALSE) + { + ErrorF ("Unable to allocate ProximityClassDeviceStruct\n"); + return !Success; + } + + xf86MotionHistoryAllocate (local); + + + /* On ne peut pas calculer l'increment avant, faute d'ecran pour + connaitre la taille... */ + + if (priv->acecadInc > 95) + priv->acecadInc = 95; + if (priv->acecadInc < 1) + { + /* guess the best increment value given video mode */ + rx=priv->acecadMaxX / screenInfo.screens[0]->width; + ry=priv->acecadMaxY / screenInfo.screens[0]->height; + if (rx < ry) + priv->acecadInc = rx; + else + priv->acecadInc = ry; + if (priv->acecadInc < 1) + priv->acecadInc = 1; + } + + xf86Msg(X_CONFIG, "Acecad Tablet Increment: %d\n",priv->acecadInc); + + return (Success); +} + +static void +ReadInput (LocalDevicePtr local) +{ + int x, y, z; + int prox, buttons; + int is_core_pointer, is_absolute; + AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private); + + /*xf86Msg(X_CONFIG, "Acecad Tablet Read Input\n");*/ + + is_absolute = (priv->flags & ABSOLUTE_FLAG); + is_core_pointer = xf86IsCorePointer(local->dev); + + /* + * set blocking to -1 on the first call because we know there is data to + * read. Xisb automatically clears it after one successful read so that + * succeeding reads are preceeded buy a select with a 0 timeout to prevent + * read from blocking indefinately. + */ + XisbBlockDuration (priv->buffer, -1); + + while (AceCadGetPacket (priv) == Success) + { + x = (int)priv->packet[1] | ((int)priv->packet[2] << 7); + y = (int)priv->packet[3] | ((int)priv->packet[4] << 7); + + if (!(priv->flags & ABSOLUTE_FLAG)) + { + x = priv->packet[0] & XSIGN_BIT? x:-x; + y = priv->packet[0] & YSIGN_BIT? y:-y; + } + else + { + y = priv->acecadMaxY - y ; + } + + + z = ((int)priv->packet[5] << 2) | + (((int)priv->packet[6] & 0x01) << 1) | + (((int)priv->packet[6] & 0x10) >> 4); + + buttons = ((int)priv->packet[0] & 0x07) | + ((int)priv->packet[6] & 0x02 << 2); + + prox = (priv->packet[0] & PROXIMITY_BIT)? 0: 1; + + if (prox) + { + if (!(priv->acecadOldProximity)) + if (!is_core_pointer) + { + /*xf86Msg(X_CONFIG, "Acecad Tablet ProxIN %d %d %d\n",x, y, z);*/ + xf86PostProximityEvent(local->dev, 1, 0, 3 , x, y, z); + } + + if ((is_absolute && ((priv->acecadOldX != x) || (priv->acecadOldY != y) || (priv->acecadOldZ != z))) + || (!is_absolute && (x || y))) + { + if (is_absolute || priv->acecadOldProximity) + { + /*xf86Msg(X_CONFIG, "Acecad Tablet Motion %d %d %d\n", x, y, z);*/ + xf86PostMotionEvent(local->dev, is_absolute, 0, 3, x, y, z); + } + } + + if (priv->acecadOldButtons != buttons) + { + int delta; + + delta = buttons ^ priv->acecadOldButtons; + while(delta) + { + int id; + + id=ffs(delta); + delta &= ~(1 << (id-1)); + + /*xf86Msg(X_CONFIG, "Acecad Tablet Button %d 0x%x\n",id,(buttons&(1<<(id-1))));*/ + xf86PostButtonEvent(local->dev, is_absolute, id, (buttons&(1<<(id-1))), 0, 3, x, y,z); + } + } + + priv->acecadOldButtons = buttons; + priv->acecadOldX = x; + priv->acecadOldY = y; + priv->acecadOldZ = z; + priv->acecadOldProximity = prox; + } + else + { + if (!is_core_pointer) + if (priv->acecadOldProximity) + { + /*xf86Msg(X_CONFIG, "Acecad Tablet ProxOUT %d %d %d\n",x, y, z);*/ + xf86PostProximityEvent(local->dev, 0, 0, 3, x,y,z); + } + priv->acecadOldProximity = 0; + } + } + /*xf86Msg(X_CONFIG, "Acecad Tablet Sortie Read Input\n");*/ +} + +#define set_bit(byte,nb,bit) (bit ? byte | (1<<nb) : byte & (~(1<<nb))) +static void +USBReadInput (LocalDevicePtr local) +{ + int len; + struct input_event * event; + char eventbuf[sizeof(struct input_event) * MAX_EVENTS]; + AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private); + int x = priv->acecadOldX; + int y = priv->acecadOldY; + int z = priv->acecadOldZ; + int prox = priv->acecadOldProximity; + int buttons = priv->acecadOldButtons; + int is_core_pointer; + + is_core_pointer = xf86IsCorePointer(local->dev); + + SYSCALL(len = read(local->fd, eventbuf, sizeof(eventbuf))); + + if (len <= 0) { + ErrorF("Error reading wacom device : %s\n", strerror(errno)); + return; + } + + for (event=(struct input_event *)eventbuf; + event<(struct input_event *)(eventbuf+len); event++) { + + switch (event->type) { + case EV_ABS: + switch (event->code) { + case ABS_X: + x = event->value; + break; + + case ABS_Y: + y = event->value; + break; + + case ABS_PRESSURE: + z = event->value; + break; + + case ABS_MISC: + break; + + } + break; /* EV_ABS */ + + case EV_KEY: + switch (event->code) { + case BTN_TOOL_PEN: + prox = event->value; + break; + + case BTN_TOUCH: + buttons=set_bit(buttons,0,event->value); + break; + + case BTN_STYLUS: + buttons=set_bit(buttons,1,event->value); + break; + + case BTN_STYLUS2: + buttons=set_bit(buttons,2,event->value); + break; + } + break; /* EV_KEY */ + default: + xf86Msg(X_ERROR, "UNKNOWN event->code=%d\n", event->code); + } /* switch event->type */ + + /* ABS_MISC is the event terminator */ + if (event->type != EV_ABS || event->code != ABS_MISC) { + continue; + } + + if (prox) + { + if (!(priv->acecadOldProximity)) + if (!is_core_pointer) + { + xf86PostProximityEvent(local->dev, 1, 0, 3 , x, y, z); + } + + + xf86PostMotionEvent(local->dev, 1, 0, 3, x, y, z); + + if (priv->acecadOldButtons != buttons) + { + int delta; + + delta = buttons ^ priv->acecadOldButtons; + while(delta) + { + int id; + + id=ffs(delta); + delta &= ~(1 << (id-1)); + + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, x, y,z); + } + } + } + else + { + if (!is_core_pointer) + if (priv->acecadOldProximity) + { + xf86PostProximityEvent(local->dev, 0, 0, 3, x,y,z); + } + priv->acecadOldProximity = 0; + } + + priv->acecadOldButtons = buttons; + priv->acecadOldX = x; + priv->acecadOldY = y; + priv->acecadOldZ = z; + priv->acecadOldProximity = prox; + } + /*xf86Msg(X_CONFIG, "Acecad Tablet Sortie Read Input\n");*/ +} + +static void +CloseProc (LocalDevicePtr local) +{ +} + +/* + * The ConvertProc function may need to be tailored for your device. + * This function converts the device's valuator outputs to x and y coordinates + * to simulate mouse events. + */ +static Bool +ConvertProc (LocalDevicePtr local, + int first, + int num, + int v0, + int v1, + int v2, + int v3, + int v4, + int v5, + int *x, + int *y) +{ + AceCadPrivatePtr priv = (AceCadPrivatePtr)(local->private); + + *x = v0 * screenInfo.screens[0]->width / priv->acecadMaxX; + *y = v1 * screenInfo.screens[0]->height / priv->acecadMaxY; + return TRUE; +} + + +static Bool +ReverseConvertProc( LocalDevicePtr local, + int x, + int y, + int *valuators) +{ + AceCadPrivatePtr priv = (AceCadPrivatePtr)(local->private); + + valuators[0] = x * priv->acecadMaxX / screenInfo.screens[0]->width; + valuators[1] = y * priv->acecadMaxY / screenInfo.screens[0]->height; + + return TRUE; +} + + +#define WriteString(str)\ +XisbWrite (priv->buffer, (unsigned char *)(str), strlen(str)) + + +static Bool +QueryHardware (AceCadPrivatePtr priv) +{ + + /* Reset */ + WriteString("z0"); + + /* Wait */ + milisleep (250); + + /* Prompt Mode in order to not be disturbed */ + WriteString(ACECAD_PROMPT_MODE); + + /* Flush */ + while(XisbRead(priv->buffer)>=0); + + /* Ask for Config packet*/ + WriteString(ACECAD_CONFIG); + + /* Read the packet */ + XisbBlockDuration (priv->buffer, 1000000); + NewPacket (priv); + + /*xf86Msg(X_CONFIG, "Acecad Tablet init envoyé \n");*/ + + if ((AceCadGetPacket (priv) == Success)) + { + priv->acecadMaxX = (int)priv->packet[1] + ((int)priv->packet[2] << 7); + priv->acecadMaxY = (int)priv->packet[3] + ((int)priv->packet[4] << 7); + priv->acecadMaxZ = 512; + xf86Msg(X_CONFIG, "Acecad Tablet MaxX:%d MaxY:%d\n",priv->acecadMaxX,priv->acecadMaxY); + } + else + return (!Success); + + /*xf86Msg(X_CONFIG, "Acecad Tablet query hardware fini \n");*/ + return (Success); +} + +#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 +USBQueryHardware (LocalDevicePtr local) +{ + AceCadPrivatePtr priv = (AceCadPrivatePtr) local->private; + unsigned long bit[EV_MAX][NBITS(KEY_MAX)]; + int i, j; + int abs[5]; + char name[256] = "Unknown"; + + ioctl(local->fd, EVIOCGNAME(sizeof(name)), name); + xf86Msg(X_CONFIG, "Kernel Input device name: \"%s\"\n", 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: + priv->acecadMaxX = abs[2]; + break; + + case ABS_Y: + priv->acecadMaxY = abs[2]; + break; + + case ABS_PRESSURE: + priv->acecadMaxZ = abs[2]; + break; + } + } + } + } + + xf86Msg(X_CONFIG, "Acecad Tablet MaxX:%d MaxY:%d MaxZ:%d\n",priv->acecadMaxX,priv->acecadMaxY,priv->acecadMaxZ); + return (Success); +} + +static void +NewPacket (AceCadPrivatePtr priv) +{ + priv->packeti = 0; +} + +static Bool +AceCadGetPacket (AceCadPrivatePtr priv) +{ + int count = 0; + int c = 0; + + while((c = XisbRead(priv->buffer))>=0 ) + { + + /* + * fail after 500 bytes so the server doesn't hang forever if a + * device sends bad data. + */ + if (count++ > 500) + { + NewPacket (priv); + return (!Success); + } + + if (c & PHASING_BIT) + { + NewPacket(priv); + + /*xf86Msg(X_CONFIG, "Push %2.2x\n",(char) c);*/ + XisbBlockDuration (priv->buffer, 10000); + priv->packet[priv->packeti++] = c; + count=ACECAD_PACKET_SIZE-1; + while(count-- && (c = XisbRead(priv->buffer))>=0) + { + /*xf86Msg(X_CONFIG, "Push %2.2x\n",(char) c);*/ + priv->packet[priv->packeti++] = c; + } + XisbBlockDuration (priv->buffer, 0); + if(c > 0) + return (Success); + } + } + return (!Success); +} Index: xc/programs/Xserver/hw/xfree86/input/acecad/acecad.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/acecad/acecad.h:1.1 --- /dev/null Fri Jan 18 15:25:52 2002 +++ xc/programs/Xserver/hw/xfree86/input/acecad/acecad.h Mon Aug 13 15:35:00 2001 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2001 Edouard TISSERANT <tissered@esstin.u-nancy.fr> + * Parts inspired from Shane Watts <shane@bofh.asn.au> Xfree 3 Acecad Driver + * Thanks to Emily, from AceCad, For giving me documents. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/acecad/acecad.h,v 1.1 2001/08/13 19:35:00 dawes Exp $ */ + +#ifndef _ACECAD_H_ +#define _ACECAD_H_ + +/****************************************************************************** + * Definitions + * structs, typedefs, #defines, enums + *****************************************************************************/ +#define ACECAD_PACKET_SIZE 7 + +#define ACECAD_CONFIG "a" /* Send configuration (max coords) */ + +#define ACECAD_ABSOLUTE 'F' /* Absolute mode */ +#define ACECAD_RELATIVE 'E' /* Relative mode */ + +#define ACECAD_UPPER_ORIGIN "b" /* Origin upper left */ + +#define ACECAD_PROMPT_MODE "B" /* Prompt mode */ +#define ACECAD_STREAM_MODE "@" /* Stream mode */ +#define ACECAD_INCREMENT 'I' /* Set increment */ +#define ACECAD_BINARY_FMT "zb" /* Binary reporting */ + +#define ACECAD_PROMPT "P" /* Prompt for current position */ + +#define PHASING_BIT 0x80 +#define PROXIMITY_BIT 0x40 +#define TABID_BIT 0x20 +#define XSIGN_BIT 0x10 +#define YSIGN_BIT 0x08 +#define BUTTON_BITS 0x07 +#define COORD_BITS 0x7f + +#define ABSOLUTE_FLAG 1 + +#define milisleep(ms) xf86usleep (ms * 1000) + +#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) + +static const char * acecad_initstr = ACECAD_BINARY_FMT ACECAD_STREAM_MODE; + +typedef struct +{ + XISBuffer *buffer; + int acecadInc; /* increment between transmits */ + int acecadOldX; /* previous X position */ + int acecadOldY; /* previous Y position */ + int acecadOldZ; /* previous Z position */ + int acecadOldProximity; /* previous proximity */ + int acecadOldButtons; /* previous buttons state */ + int acecadMaxX; /* max X value */ + int acecadMaxY; /* max Y value */ + int acecadMaxZ; /* max Y value */ + char acecadReportSpeed; /* report speed */ + int acecadUSB; /*USB flag*/ + int flags; /* various flags */ + int packeti; /* number of bytes read */ + int PacketSize; /* number of bytes read */ + unsigned char packet[ACECAD_PACKET_SIZE]; /* data read on the device */ +} AceCadPrivateRec, *AceCadPrivatePtr; + + +/****************************************************************************** + * Declarations + *****************************************************************************/ +static MODULESETUPPROTO( SetupProc ); +static void TearDownProc (void *); +static Bool DeviceControl (DeviceIntPtr, int); +static Bool DeviceOn (DeviceIntPtr); +static Bool DeviceOff (DeviceIntPtr); +static Bool DeviceClose (DeviceIntPtr); +static Bool DeviceInit (DeviceIntPtr); +static void ReadInput (LocalDevicePtr); +static void USBReadInput (LocalDevicePtr); +static void CloseProc (LocalDevicePtr); +static Bool ConvertProc (LocalDevicePtr, int, int, int, int, int, int, int, int, int *, int *); +static Bool ReverseConvertProc(LocalDevicePtr , int , int , int*); +static Bool QueryHardware (AceCadPrivatePtr); +static Bool USBQueryHardware (LocalDevicePtr); +static void NewPacket (AceCadPrivatePtr priv); +static Bool AceCadGetPacket (AceCadPrivatePtr); +static InputInfoPtr AceCadPreInit(InputDriverPtr, IDevPtr , int); +static int IsUSBLine(int); + + +#endif Index: xc/programs/Xserver/hw/xfree86/input/acecad/acecad.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/acecad/acecad.man:1.1 --- /dev/null Fri Jan 18 15:25:52 2002 +++ xc/programs/Xserver/hw/xfree86/input/acecad/acecad.man Mon Aug 13 15:35:00 2001 @@ -0,0 +1,40 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/acecad/acecad.man,v 1.1 2001/08/13 19:35:00 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH ACECAD __drivermansuffix__ __vendorversion__ +.SH NAME +acecad \- Acecad Flair input driver +.SH SYNOPSIS +.B "Section \*qInputDevice\*q" +.br +.BI " Identifier \*q" idevname \*q +.br +.B " Driver \*qacecad\*q" +.br +.BI " Option \*qDevice\*q \*q" devpath \*q +.br +\ \ ... +.br +.B EndSection +.SH DESCRIPTION +.B acecad +is an XFree86 input driver for Acecad Flair devices... +.PP +The +.B acecad +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... +Edouard TISSERANT Index: xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c diff -u xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c:1.3 xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c:removed --- xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c:1.3 Sun Jun 13 01:18:54 1999 +++ xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c Fri Jan 18 15:25:52 2002 @@ -1,1037 +0,0 @@ -/* - * Copyright 1996 by Steven Lang <tiger@tyger.org> - * Modified for the AceCad Tablet, - * by Shane Watts <shane@bofh.asn.au> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Steven Lang not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. Steven Lang makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * STEVEN LANG DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL STEVEN LANG BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTIONS, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c,v 1.3 1999/06/13 05:18:54 dawes Exp $ */ - -#define NEED_EVENTS -#include "X.h" -#include "Xproto.h" -#include "misc.h" -#include "inputstr.h" -#include "scrnintstr.h" -#include "XI.h" -#include "XIproto.h" - -#if defined(sun) && !defined(i386) -#define POSIX_TTY -#include <errno.h> -#include <termio.h> -#include <fcntl.h> -#include <ctype.h> - -#include "extio.h" -#else -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSproc.h" -#ifdef XFree86LOADER -#include "xf86_ansic.h" -#endif -#include "xf86Config.h" -#include "xf86Xinput.h" -#include "atKeynames.h" -#include "xf86Version.h" -#endif - -#if !defined(sun) || defined(i386) -#include "osdep.h" -#include "exevents.h" - -#include "extnsionst.h" -#include "extinit.h" -#endif - -/* -** Debugging macros -*/ -#ifdef DBG -#undef DBG -#endif -#ifdef DEBUG -#undef DEBUG -#endif - -static int debug_level = 0; -#define DEBUG 1 -#if DEBUG -#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} -#else -#define DBG(lvl, f) -#endif - -/* -** Device records -*/ -#define ABSOLUTE_FLAG 1 -#define STYLUS_FLAG 2 - -typedef struct -{ - char *acecadDevice; /* device file name */ - int acecadInc; /* increment between transmits */ - int acecadButTrans; /* button translation flags */ - int acecadOldX; /* previous X position */ - int acecadOldY; /* previous Y position */ - int acecadOldProximity; /* previous proximity */ - int acecadOldButtons; /* previous buttons state */ - int acecadMaxX; /* max X value */ - int acecadMaxY; /* max Y value */ - int acecadXLeft; /* screen left */ - int acecadXRight; /* screen right */ - int acecadYtop; /* screen top */ - int acecadYbot; /* screen bottom */ - int acecadRes; /* resolution in lines per inch */ - int flags; /* various flags */ - int acecadIndex; /* number of bytes read */ - unsigned char acecadData[5]; /* data read on the device */ -} AceCadDeviceRec, *AceCadDevicePtr; - -/* -** Configuration data -*/ -#define ACECAD_SECTION_NAME "AceCad" -#define PORT 1 -#define DEVICENAME 2 -#define THE_MODE 3 -#define CURSOR 4 -#define INCREMENT 5 -#define BORDER 6 -#define DEBUG_LEVEL 7 -#define HISTORY_SIZE 8 -#define ALWAYS_CORE 9 - -#if !defined(sun) || defined(i386) -static SymTabRec AceCadTab[] = { - {ENDSUBSECTION, "endsubsection"}, - {PORT, "port"}, - {DEVICENAME, "devicename"}, - {THE_MODE, "mode"}, - {CURSOR, "cursor"}, - {INCREMENT, "increment"}, - {BORDER, "border"}, - {DEBUG_LEVEL, "debuglevel"}, - {HISTORY_SIZE, "historysize"}, - { ALWAYS_CORE, "alwayscore" }, - {-1, ""} -}; - -#define RELATIVE 1 -#define ABSOLUTE 2 - -static SymTabRec AceCadModeTabRec[] = { - {RELATIVE, "relative"}, - {ABSOLUTE, "absolute"}, - {-1, ""} -}; - -#define PUCK 1 -#define STYLUS 2 - -static SymTabRec AceCadPointTabRec[] = { - {PUCK, "puck"}, - {STYLUS, "stylus"}, - {-1, ""} -}; - -#endif - -/* -** Contants and macro -*/ -#define BUFFER_SIZE 256 /* size of reception buffer */ -#define XI_NAME "ACECAD" /* X device name for the stylus */ - -#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) - -#define ACECAD_CONFIG "a" /* Send configuration (max coords) */ - -#define ACECAD_ABSOLUTE 'F' /* Absolute mode */ -#define ACECAD_RELATIVE 'E' /* Relative mode */ - -#define ACECAD_UPPER_ORIGIN "b" /* Origin upper left */ - -#define ACECAD_PROMPT_MODE "B" /* Prompt mode */ -#define ACECAD_STREAM_MODE "@" /* Stream mode */ -#define ACECAD_INCREMENT 'I' /* Set increment */ -#define ACECAD_BINARY_FMT "zb" /* Binary reporting */ - -#define ACECAD_PROMPT "P" /* Prompt for current position */ - -static const char * acecad_initstr = ACECAD_BINARY_FMT ACECAD_STREAM_MODE; - -#define PHASING_BIT 0x80 -#define PROXIMITY_BIT 0x40 -#define TABID_BIT 0x20 -#define XSIGN_BIT 0x10 -#define YSIGN_BIT 0x08 -#define BUTTON_BITS 0x07 -#define COORD_BITS 0x7f - -/* -** External declarations -*/ -#if defined(sun) && !defined(i386) -#define ENQUEUE suneqEnqueue -#else -#define ENQUEUE xf86eqEnqueue - -extern void xf86eqEnqueue( -#if NeedFunctionPrototypes - xEventPtr /*e*/ -#endif -); -#endif - -extern void miPointerDeltaCursor( -#if NeedFunctionPrototypes - int /*dx*/, - int /*dy*/, - unsigned long /*time*/ -#endif -); - -#if !defined(sun) || defined(i386) -/* -** xf86AceCadConfig -** Reads the AceCad section from the XF86Config file -*/ -static Bool -xf86AceCadConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) -{ - LocalDevicePtr dev = array[inx]; - AceCadDevicePtr priv = (AceCadDevicePtr)(dev->private); - int token; - int mtoken; - - DBG(1, ErrorF("xf86AceCadConfig\n")); - - while ((token = xf86GetToken(AceCadTab)) != ENDSUBSECTION) { - switch(token) { - case DEVICENAME: - if (xf86GetToken(NULL) != STRING) - xf86ConfigError("Option string expected"); - else { - dev->name = strdup(val->str); - if (xf86Verbose) - ErrorF("%s AceCad X device name is %s\n", XCONFIG_GIVEN, - dev->name); - } - break; - - case PORT: - if (xf86GetToken(NULL) != STRING) - xf86ConfigError("Option string expected"); - else { - priv->acecadDevice = strdup(val->str); - if (xf86Verbose) - ErrorF("%s AceCad port is %s\n", XCONFIG_GIVEN, - priv->acecadDevice); - } - break; - - case THE_MODE: - mtoken = xf86GetToken(AceCadModeTabRec); - if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) - xf86ConfigError("Mode type token expected"); - else { - switch (mtoken) { - case ABSOLUTE: - priv->flags |= ABSOLUTE_FLAG; - break; - case RELATIVE: - priv->flags &= ~ABSOLUTE_FLAG; - break; - default: - xf86ConfigError("Illegal Mode type"); - break; - } - } - break; - - case CURSOR: - mtoken = xf86GetToken(AceCadPointTabRec); - if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) - xf86ConfigError("Cursor token expected"); - else { - switch (mtoken) { - case STYLUS: - priv->flags |= STYLUS_FLAG; - break; - case PUCK: - priv->flags &= ~STYLUS_FLAG; - break; - default: - xf86ConfigError("Illegal cursor type"); - break; - } - } - break; - - case INCREMENT: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - priv->acecadInc = val->num; - if (xf86Verbose) - ErrorF("%s AceCad increment value is %d\n", XCONFIG_GIVEN, - priv->acecadInc); - break; - - case DEBUG_LEVEL: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - debug_level = val->num; - if (xf86Verbose) { -#if DEBUG - ErrorF("%s AceCad debug level sets to %d\n", XCONFIG_GIVEN, - debug_level); -#else - ErrorF("%s AceCad debug level not sets to %d because" - " debugging is not compiled\n", XCONFIG_GIVEN, - debug_level); -#endif - } - break; - - case HISTORY_SIZE: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - dev->history_size = val->num; - if (xf86Verbose) - ErrorF("%s AceCad Motion history size is %d\n", XCONFIG_GIVEN, - dev->history_size); - break; - - case ALWAYS_CORE: - xf86AlwaysCore(dev, TRUE); - if (xf86Verbose) - ErrorF("%s AceCad device always stays core pointer\n", - XCONFIG_GIVEN); - break; - - case EOF: - FatalError("Unexpected EOF (missing EndSubSection)"); - break; - - default: - xf86ConfigError("AceCad subsection keyword expected"); - break; - } - } - - DBG(1, ErrorF("xf86AceCadConfig name=%s\n", priv->acecadDevice)); - - return Success; -} -#endif - -/* -** xf86AceCadReadInput -** Reads from the AceCad and posts any new events to the server. -*/ -static void -xf86AceCadReadInput(LocalDevicePtr local) -{ - AceCadDevicePtr priv = (AceCadDevicePtr) local->private; - int len, loop; - int is_core_pointer, is_absolute; - int x, y, buttons, prox; - DeviceIntPtr device; - unsigned char buffer[BUFFER_SIZE]; - - DBG(7, ErrorF("xf86AceCadReadInput BEGIN device=%s fd=%d\n", - priv->acecadDevice, local->fd)); - - SYSCALL(len = read(local->fd, buffer, sizeof(buffer))); - - if (len <= 0) { - Error("error reading AceCad device"); - return; - } - - for(loop=0; loop<len; loop++) { - -/* Format of 5 bytes data packet for AceCad Tablets - Byte 1 - bit 7 Phasing bit always 1 - bit 6 Proximity bit - bit 5 Tablet ID - bit 4 X sign (Always 1 for absolute) - bit 3 Y sign (Always 1 for absolute) - bit 2-0 Button status - - Byte 2 - bit 7 Always 0 - bits 6-0 = X6 - X0 - - Byte 3 (Absolute mode only) - bit 7 Always 0 - bits 6-0 = X13 - X7 - - Byte 4 - bit 7 Always 0 - bits 6-0 = Y6 - Y0 - - Byte 5 (Absolute mode only) - bit 7 Always 0 - bits 6-0 = Y13 - Y7 -*/ - - if ((priv->acecadIndex == 0) && !(buffer[loop] & PHASING_BIT)) { /* magic bit is not OK */ - DBG(6, ErrorF("xf86AceCadReadInput bad magic number 0x%x\n", buffer[loop]));; - continue; - } - - priv->acecadData[priv->acecadIndex++] = buffer[loop]; - - if (priv->acecadIndex == (priv->flags & ABSOLUTE_FLAG? 5: 3)) { -/* the packet is OK */ -/* reset char count for next read */ - priv->acecadIndex = 0; - - if (priv->flags & ABSOLUTE_FLAG) { - x = (int)priv->acecadData[1] + ((int)priv->acecadData[2] << 7); - y = (int)priv->acecadData[3] + ((int)priv->acecadData[4] << 7); - } else { - x = priv->acecadData[0] & XSIGN_BIT? priv->acecadData[1]: -priv->acecadData[1]; - y = priv->acecadData[0] & YSIGN_BIT? priv->acecadData[2]: -priv->acecadData[2]; - } - -/* x = priv->acecadMaxX - x; /**/ - y = priv->acecadMaxY - y; /**/ - - prox = (priv->acecadData[0] & PROXIMITY_BIT)? 0: 1; - - buttons = (priv->acecadData[0] & BUTTON_BITS); - - device = local->dev; - - DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tbuttons=%d\n", - prox ? "true" : "false", x, y, buttons)); - - is_absolute = (priv->flags & ABSOLUTE_FLAG); - is_core_pointer = xf86IsCorePointer(device); - - if (is_core_pointer) { - x = x * screenInfo.screens[0]->width / priv->acecadMaxX; - y = y * screenInfo.screens[0]->height / priv->acecadMaxY; - DBG(6, ErrorF("Adjusted coords x=%d y=%d\n", x, y)); - } - -/* coordonates are ready we can send events */ - if (prox) { - if (!(priv->acecadOldProximity)) - if (!is_core_pointer) - xf86PostProximityEvent(device, 1, 0, 2, x, y); - - if ((is_absolute && ((priv->acecadOldX != x) || (priv->acecadOldY != y))) - || (!is_absolute && (x || y))) { - if (is_absolute || priv->acecadOldProximity) { - xf86PostMotionEvent(device, is_absolute, 0, 2, x, y); - } - } - - if (priv->acecadOldButtons != buttons) { - int delta; - int button; - - delta = buttons - priv->acecadOldButtons; - button = (delta > 0)? delta: ((delta == 0)? - priv->acecadOldButtons : -delta); - - if (priv->acecadOldButtons != buttons) { - DBG(6, ErrorF("xf86AceCadReadInput button=%d\n", button)); - - xf86PostButtonEvent(device, is_absolute, button, - (delta >0), 0, 2, x, y); - } - - } - - priv->acecadOldButtons = buttons; - priv->acecadOldX = x; - priv->acecadOldY = y; - priv->acecadOldProximity = prox; - } else { /* !PROXIMITY */ -/* Any changes in buttons are ignored when !proximity */ - if (!is_core_pointer) - if (priv->acecadOldProximity) - xf86PostProximityEvent(device, 0, 0, 2, x, y); - priv->acecadOldProximity = 0; - } - } - } - DBG(7, ErrorF("xf86AceCadReadInput END device=0x%x priv=0x%x\n", - local->dev, priv)); -} - -/* -** xf86AceCadControlProc -** It really does do something. Honest! -*/ -static void -xf86AceCadControlProc(DeviceIntPtr device, PtrCtrl *ctrl) -{ - DBG(2, ErrorF("xf86AceCadControlProc\n")); -} - -/* -** write_and_read -** Write data, and get the response. -*/ -static char * -write_and_read(int fd, char *data, char *buffer, int len, int cr_term) -{ - int err, numread = 0; - fd_set readfds; - struct timeval timeout; - - SYSCALL(err = write(fd, data, strlen(data))); - if (err == -1) { - Error("AceCad write"); - return NULL; - } - - FD_ZERO(&readfds); - FD_SET(fd, &readfds); - while (numread < len) { - timeout.tv_sec = 0; - timeout.tv_usec = 200000; - - SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); - if (err == -1) { - Error("AceCad select"); - return NULL; - } - if (!err) { - ErrorF("Timeout while reading AceCad tablet. No tablet connected ???\n"); - return NULL; - } - - SYSCALL(err = read(fd, buffer + numread++, 1)); - if (err == -1) { - Error("AceCad read"); - return NULL; - } - if (!err) { - --numread; - break; - } - if (cr_term && buffer[numread - 1] == '\r') { - break; - buffer[numread - 1] = 0; - } - } - buffer[numread] = 0; - return buffer; -} - -/* -** xf86AceCadOpen -** Open and initialize the tablet, as well as probe for any needed data. -*/ -static Bool -xf86AceCadOpen(LocalDevicePtr local) -{ - struct termios termios_tty; - struct timeval timeout; - char buffer[256]; - int err; - AceCadDevicePtr priv = (AceCadDevicePtr)local->private; - - DBG(1, ErrorF("opening %s\n", priv->acecadDevice)); - - SYSCALL(local->fd = open(priv->acecadDevice, O_RDWR|O_NDELAY, 0)); - if (local->fd == -1) { - Error(priv->acecadDevice); - return !Success; - } - DBG(2, ErrorF("%s opened as fd %d\n", priv->acecadDevice, local->fd)); - -#ifdef POSIX_TTY - err = tcgetattr(local->fd, &termios_tty); - if (err == -1) { - Error("AceCad tcgetattr"); - return !Success; - } - termios_tty.c_iflag = IXOFF; - termios_tty.c_cflag = B9600|CS8|CREAD|CLOCAL|HUPCL|PARENB|PARODD; - termios_tty.c_lflag = 0; - -/* I wonder what these all do, anyway */ - termios_tty.c_cc[VINTR] = 0; - termios_tty.c_cc[VQUIT] = 0; - termios_tty.c_cc[VERASE] = 0; -#ifdef VWERASE - termios_tty.c_cc[VWERASE] = 0; -#endif -#ifdef VREPRINT - termios_tty.c_cc[VREPRINT] = 0; -#endif - termios_tty.c_cc[VKILL] = 0; - termios_tty.c_cc[VEOF] = 0; - termios_tty.c_cc[VEOL] = 0; -#ifdef VEOL2 - termios_tty.c_cc[VEOL2] = 0; -#endif - termios_tty.c_cc[VSUSP] = 0; -#ifdef VDISCARD - termios_tty.c_cc[VDISCARD] = 0; -#endif -#ifdef VLNEXT - termios_tty.c_cc[VLNEXT] = 0; -#endif - - termios_tty.c_cc[VMIN] = 1 ; - termios_tty.c_cc[VTIME] = 10 ; - - err = tcsetattr(local->fd, TCSANOW, &termios_tty); - if (err == -1) { - Error("AceCad tcsetattr TCSANOW"); - return !Success; - } -#else - Code for someone else to write to handle OSs without POSIX tty functions -#endif - - DBG(1, ErrorF("initializing AceCad tablet\n")); - -/* Send reset (NULL) to the tablet */ - SYSCALL(err = write(local->fd, "\0", 1)); - if (err == -1) { - Error("AceCad write"); - return !Success; - } - -/* wait 200 mSecs, just in case */ - timeout.tv_sec = 0; - timeout.tv_usec = 200000; - SYSCALL(err = select(0, NULL, NULL, NULL, &timeout)); - if (err == -1) { - Error("AceCad select"); - return !Success; - } - -/* Put it in prompt mode so it doens't say anything before we're ready */ - SYSCALL(err = write(local->fd, ACECAD_PROMPT_MODE, strlen(ACECAD_PROMPT_MODE))); - if (err == -1) { - Error("AceCad write"); - return !Success; - } -/* Clear any pending input */ - tcflush(local->fd, TCIFLUSH); - -/* DBG(2, ErrorF("Reading Firmware ID\n")); */ -/* if (!write_and_read(local->fd, ACECAD_PROMPT, buffer, 5, 1)) */ -/* return !Success; */ - -/* DBG(2, ErrorF("%s\n", buffer)); */ - -/* if (xf86Verbose) */ -/* ErrorF("%s AceCad firmware ID : %s\n", XCONFIG_PROBED, buffer); */ - - DBG(2, ErrorF("reading max coordinates\n")); - if (!write_and_read(local->fd, ACECAD_CONFIG, buffer, 5, 0)) - return !Success; - priv->acecadMaxX = (int)buffer[1] + ((int)buffer[2] << 7); - priv->acecadMaxY = (int)buffer[3] + ((int)buffer[4] << 7); - -/* priv->acecadMaxX = 6000; */ -/* priv->acecadMaxY = 6000; */ - - if (xf86Verbose) - ErrorF("%s AceCad tablet size is %d.%1dinx%d.%1din, %dx%d " - "lines of resolution\n", XCONFIG_PROBED, - priv->acecadMaxX / 500, (priv->acecadMaxX / 50) % 10, - priv->acecadMaxY / 500, (priv->acecadMaxY / 50) % 10, - priv->acecadMaxX, priv->acecadMaxY); - - if (priv->acecadInc > 95) - priv->acecadInc = 95; - if (priv->acecadInc < 1) { -/* Make a guess as to the best increment value given video mode */ - if (priv->acecadMaxX / screenInfo.screens[0]->width < - priv->acecadMaxY / screenInfo.screens[0]->height) - priv->acecadInc = priv->acecadMaxX / screenInfo.screens[0]->width; - else - priv->acecadInc = priv->acecadMaxY / screenInfo.screens[0]->height; - if (priv->acecadInc < 1) - priv->acecadInc = 1; - if (xf86Verbose) - ErrorF("%s Using increment value of %d\n", XCONFIG_PROBED, - priv->acecadInc); - } - -/* Sets up the tablet mode to increment, stream, and such */ - sprintf(buffer, "%s%c%c%c", acecad_initstr, ACECAD_INCREMENT, 32 + priv->acecadInc, - (priv->flags & ABSOLUTE_FLAG)? ACECAD_ABSOLUTE: ACECAD_RELATIVE); - - SYSCALL(err = write(local->fd, buffer, strlen(buffer))) - if (err == -1) { - Error("AceCad write"); - return !Success; - } - - if (err <= 0) { - SYSCALL(close(local->fd)); - return !Success; - } - - return Success; -} - -/* -** xf86AceCadOpenDevice -** Opens and initializes the device driver stuff or sumpthin. -*/ -static int -xf86AceCadOpenDevice(DeviceIntPtr pAceCad) -{ - LocalDevicePtr local = (LocalDevicePtr)pAceCad->public.devicePrivate; - AceCadDevicePtr priv = (AceCadDevicePtr)XI_PRIVATE(pAceCad); - - if (xf86AceCadOpen(local) != Success) { - if (local->fd >= 0) { - SYSCALL(close(local->fd)); - } - local->fd = -1; - } - -/* Set the real values */ - InitValuatorAxisStruct(pAceCad, - 0, - 0, /* min val */ - priv->acecadMaxX, /* max val */ - 500000, /* resolution */ - 0, /* min_res */ - 500000); /* max_res */ - InitValuatorAxisStruct(pAceCad, - 1, - 0, /* min val */ - priv->acecadMaxY, /* max val */ - 500000, /* resolution */ - 0, /* min_res */ - 500000); /* max_res */ - return (local->fd != -1); -} - -/* -** xf86AceCadProc -** Handle requests to do stuff to the driver. -*/ -static int -xf86AceCadProc(DeviceIntPtr pAceCad, int what) -{ - CARD8 map[25]; - int nbaxes; - int nbbuttons; - int loop; - LocalDevicePtr local = (LocalDevicePtr)pAceCad->public.devicePrivate; - AceCadDevicePtr priv = (AceCadDevicePtr)PRIVATE(pAceCad); - - DBG(2, ErrorF("BEGIN xf86AceCadProc dev=0x%x priv=0x%x what=%d\n", pAceCad, priv, what)); - - switch (what) { - case DEVICE_INIT: - DBG(1, ErrorF("xf86AceCadProc pAceCad=0x%x what=INIT\n", pAceCad)); - - nbaxes = 2; /* X, Y */ - nbbuttons = (priv->flags & STYLUS_FLAG)? 2: 4; - - for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop; - - if (InitButtonClassDeviceStruct(pAceCad, - nbbuttons, - map) == FALSE) { - ErrorF("unable to allocate Button class device\n"); - return !Success; - } - - if (InitFocusClassDeviceStruct(pAceCad) == FALSE) { - ErrorF("unable to init Focus class device\n"); - return !Success; - } - - if (InitPtrFeedbackClassDeviceStruct(pAceCad, - xf86AceCadControlProc) == FALSE) { - ErrorF("unable to init ptr feedback\n"); - return !Success; - } - - if (InitProximityClassDeviceStruct(pAceCad) == FALSE) { - ErrorF("unable to init proximity class device\n"); - return !Success; - } - - if (InitValuatorClassDeviceStruct(pAceCad, - nbaxes, - xf86GetMotionEvents, - local->history_size, - (priv->flags & ABSOLUTE_FLAG)? Absolute: Relative) - == FALSE) { - ErrorF("unable to allocate Valuator class device\n"); - return !Success; - } -/* allocate the motion history buffer if needed */ - xf86MotionHistoryAllocate(local); - - AssignTypeAndName(pAceCad, local->atom, local->name); -/* open the device to gather informations */ - xf86AceCadOpenDevice(pAceCad); - break; - - case DEVICE_ON: - DBG(1, ErrorF("xf86AceCadProc pAceCad=0x%x what=ON\n", pAceCad)); - - if ((local->fd < 0) && (!xf86AceCadOpenDevice(pAceCad))) { - return !Success; - } -/* SYSCALL(write(local->fd, ACECAD_PROMPT, strlen(ACECAD_PROMPT))); */ - AddEnabledDevice(local->fd); - pAceCad->public.on = TRUE; - break; - - case DEVICE_OFF: - DBG(1, ErrorF("xf86AceCadProc pAceCad=0x%x what=%s\n", pAceCad, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - if (local->fd >= 0) - RemoveEnabledDevice(local->fd); - pAceCad->public.on = FALSE; - break; - - case DEVICE_CLOSE: - DBG(1, ErrorF("xf86AceCadProc pAceCad=0x%x what=%s\n", pAceCad, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - SYSCALL(close(local->fd)); - local->fd = -1; - break; - - default: - ErrorF("unsupported mode=%d\n", what); - return !Success; - break; - } - DBG(2, ErrorF("END xf86AceCadProc Success what=%d dev=0x%x priv=0x%x\n", - what, pAceCad, priv)); - return Success; -} - -/* -** xf86AceCadClose -** It... Uh... Closes the physical device? -*/ -static void -xf86AceCadClose(LocalDevicePtr local) -{ - if (local->fd >= 0) { - SYSCALL(close(local->fd)); - } - local->fd = -1; -} - -/* -** xf86AceCadChangeControl -** When I figure out what it does, it will do it. -*/ -static int -xf86AceCadChangeControl(LocalDevicePtr local, pointer control) -{ - xDeviceResolutionCtl *res; - - res = (xDeviceResolutionCtl *)control; - - if ((res->control != DEVICE_RESOLUTION) || - (res->num_valuators < 1)) - return (BadMatch); - - return(Success); -} - -/* -** xf86AceCadSwitchMode -** Switches the mode. For now just absolute or relative, hopefully -** more on the way. -*/ -static int -xf86AceCadSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) -{ - LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; - AceCadDevicePtr priv = (AceCadDevicePtr)(local->private); - char newmode; - - DBG(3, ErrorF("xf86AceCadSwitchMode dev=0x%x mode=%d\n", dev, mode)); - - switch(mode) { - case Absolute: - priv->flags |= ABSOLUTE_FLAG; - newmode = ACECAD_ABSOLUTE; - break; - - case Relative: - priv->flags &= ~ABSOLUTE_FLAG; - newmode = ACECAD_RELATIVE; - break; - - default: - DBG(1, ErrorF("xf86AceCadSwitchMode dev=0x%x invalid mode=%d\n", - dev, mode)); - return BadMatch; - } - SYSCALL(write(local->fd, &newmode, 1)); - return Success; -} - -/* -** xf86AceCadAllocate -** Allocates the device structures for the AceCad. -*/ -static LocalDevicePtr -xf86AceCadAllocate() -{ - LocalDevicePtr local = xalloc(sizeof(LocalDeviceRec)); - AceCadDevicePtr priv = xalloc(sizeof(AceCadDeviceRec)); -#if defined (sun) && !defined(i386) - char *dev_name = getenv("ACECAD_DEV"); -#endif - - local->name = XI_NAME; - local->type_name = "AceCad Tablet"; - local->flags = 0; -#if !defined(sun) || defined(i386) - local->device_config = xf86AceCadConfig; -#endif - local->device_control = xf86AceCadProc; - local->read_input = xf86AceCadReadInput; - local->control_proc = xf86AceCadChangeControl; - local->close_proc = xf86AceCadClose; - local->switch_mode = xf86AceCadSwitchMode; - local->fd = -1; - local->atom = 0; - local->dev = NULL; - local->private = priv; - local->private_flags = 0; - local->history_size = 0; - -#if defined(sun) && !defined(i386) - if (def_name) { - priv->acecadDevice = xalloc(strlen(dev_name) + 1); - strcpy(priv->acecadDevice, device_name); - ErrorF("xf86AceCadOpen port changed to '%s'\n", priv->acecadDevice); - } else { - priv->acecadDevice = ""; - } -#else - priv->acecadDevice = ""; /* device file name */ -#endif - priv->acecadInc = -1; /* re-transmit position on increment */ - priv->acecadOldX = -1; /* previous X position */ - priv->acecadOldY = -1; /* previous Y position */ - priv->acecadOldProximity = 0; /* previous proximity */ - priv->acecadOldButtons = 0; /* previous buttons state */ - priv->acecadMaxX = -1; /* max X value */ - priv->acecadMaxY = -1; /* max Y value */ - priv->flags = 0; /* various flags */ - priv->acecadIndex = 0; /* number of bytes read */ - - return local; -} - - -/* -** AceCad device association -** Device section name and allocation function. -*/ -DeviceAssocRec acecad_assoc = -{ - ACECAD_SECTION_NAME, /* config_section_name */ - xf86AceCadAllocate /* device_allocate */ -}; - -#ifdef DYNAMIC_MODULE -/* -** init_module -** Entry point for dynamic module. -*/ -int -#ifndef DLSYM_BUG -init_module(unsigned long server_version) -#else -init_xf86AceCad(unsigned long server_version) -#endif -{ - xf86AddDeviceAssoc(&acecad_assoc); - - if (server_version != XF86_VERSION_CURRENT) { - ErrorF("Warning: AceCad module compiled for version%s\n", - XF86_VERSION); - return 0; - } else { - return 1; - } -} -#endif - -#ifdef XFree86LOADER -/* - * Entry point for the loader code - */ -XF86ModuleVersionInfo xf86AceCadVersion = { - "xf86AceCad", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - 0x00010000, - {0,0,0,0} -}; - -void -xf86AceCadModuleInit(data, magic) - pointer *data; - INT32 *magic; -{ - static int cnt = 0; - - switch (cnt) { - case 0: - *magic = MAGIC_VERSION; - *data = &xf86AceCadVersion; - cnt++; - break; - - case 1: - *magic = MAGIC_ADD_XINPUT_DEVICE; - *data = &acecad_assoc; - cnt++; - break; - - default: - *magic = MAGIC_DONE; - *data = NULL; - break; - } -} -#endif - Index: xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile:1.1 --- /dev/null Fri Jan 18 15:25:52 2002 +++ xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile Sun Aug 12 18:48:43 2001 @@ -0,0 +1,26 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/calcomp/Imakefile,v 1.1 2001/08/12 22:48:43 alanh Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = xf86Calcomp.c +OBJS = xf86Calcomp.o + +DRIVER = calcomp + +INCLUDES = -I. -I$(XF86COMSRC) -I../../loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/calcomp/calcomp.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/calcomp/calcomp.man:1.2 --- /dev/null Fri Jan 18 15:25:52 2002 +++ xc/programs/Xserver/hw/xfree86/input/calcomp/calcomp.man Sun Aug 12 18:51:29 2001 @@ -0,0 +1,82 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/calcomp/calcomp.man,v 1.2 2001/08/12 22:51:29 alanh Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH CALCOMP __drivermansuffix__ __vendorversion__ +.SH NAME +calcomp \- Calcomp input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qcalcomp\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B calcomp +is an XFree86 input driver for Calcomp devices. +.PP +The +.B calcomp +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 Calcomp binary format used by the Drawing Board II +and III series. +.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 +Both the 3 button stylus and the 4- or 16 button lens cursors can be used +without changing the configuration file. Support for pressure sensitivity +has not been tested, so the solid-tip stylus will probably not work. +.PP +This device supports the following entries: +.RS 8 +.TP 4 +.B Option \fI"Device"\fP \fI"path"\fP +sets the path to the special file which represents the serial line where +the tablet is plugged. This option is mandatory. +.TP 4 +.B Option \fI"Cursor"\fP \fI"Stylus"|"Puck"\fP +this option is supported for backward compatibility only, but it should +not be necessary. +.TP 4 +.B Option \fI"DeviceName"\fP \fI"name"\fP +sets the name of the X device. Some user-space programs may require a fixed +name, e.g. TABLET, to recognize the digitizer. +.TP 4 +.B Option \fI"Mode"\fP \fI"Relative"|"Absolute"\fP +sets the mode of the device. Currently only Absolute mode is supported. +.TP 4 +.B Option \fI"Pressure"\fP \fI"on"\fP +enables pressure reporting if your tablet supports it. This option is +untested and may not work. +.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. +.TP 4 +.B Option \fI"MinX"\fP \fI"number"\fP +X coordinate of the bottom left corner of the active zone. +.TP 4 +.B Option \fI"MinY"\fP \fI"number"\fP +Y coordinate of the bottom left corner of the active zone. +.TP 4 +.B Option \fI"MaxX"\fP \fI"Inumber"\fP +X coordinate of the top right corner of the active zone. +.TP 4 +.B Option \fI"MaxY"\fP \fI"number"\fP +Y coordinate of the top right corner of the active zone. +.TP 4 +.B Option \fI"DebugLevel"\fP \fInumber \fP +sets the level of debugging info reported. +.TP 4 +.RE +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Martin Kroeker <mk@daveg.com> Index: xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c:1.5 --- /dev/null Fri Jan 18 15:25:52 2002 +++ xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c Mon Nov 26 11:25:52 2001 @@ -0,0 +1,837 @@ +/* + * Copyright (c) 2000,2001 Martin Kroeker (mk@daveg.com) + * sample driver used : + * Copyright (c) 1998 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + * Except as contained in this notice, the names of Martin Kroeker and/or + * Daveg GmbH shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from Martin Kroeker or Daveg GmbH. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.c,v 1.5 2001/11/26 16:25:52 dawes Exp $ */ + +#define _CALCOMP_C_ +/***************************************************************************** + * Standard Headers + ****************************************************************************/ + +#include <misc.h> +#include <xf86.h> +#define NEED_XF86_TYPES +#include <xf86_ansic.h> +#include <xf86_OSproc.h> +#include <xf86Xinput.h> +#include <xisb.h> +#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ + +/***************************************************************************** + * Local Headers + ****************************************************************************/ +#include "xf86Calcomp.h" + +/***************************************************************************** + * Variables without includable headers + ****************************************************************************/ + #define DEBUG 1 +/***************************************************************************** + * Local Variables + ****************************************************************************/ + +InputDriverRec CALCOMP = { + 1, + "calcomp", + NULL, + CalcompPreInit, /*preinit ?*/ + NULL, + NULL, + 0 + }; + +/* + * Be sure to set vmin appropriately for your device's protocol. You want to + * read a full packet before returning + */ +static const char *default_options[] = +{ + "Device", "/dev/ttyS1", + "BaudRate", "9600", + "StopBits", "1", + "DataBits", "8", + "Parity", "None", + "Vmin", "1", + "Vtime", "1", + "FlowControl", "None" +}; + + +#ifdef XFree86LOADER + +static XF86ModuleVersionInfo VersionRec = +{ + "calcomp", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by + * a tool */ +}; + +static const char *reqSymbols[] = { + "AddEnabledDevice", + "ErrorF", + "InitButtonClassDeviceStruct", + "InitProximityClassDeviceStruct", + "InitValuatorAxisStruct", + "InitValuatorClassDeviceStruct", + "InitPtrFeedbackClassDeviceStruct", + "RemoveEnabledDevice", + "Xcalloc", + "Xfree", + "XisbBlockDuration", + "XisbFree", + "XisbNew", + "XisbRead", + "XisbTrace", + "screenInfo", + "xf86AddInputDriver", + "xf86AllocateInput", + "xf86CloseSerial", + "xf86CollectInputOptions", + "xf86ErrorFVerb", + "xf86FindOptionValue", + "xf86GetMotionEvents", + "xf86GetVerbosity", + "xf86MotionHistoryAllocate", + "xf86NameCmp", + "xf86OpenSerial", + "xf86OptionListCreate", + "xf86OptionListMerge", + "xf86OptionListReport", + "xf86PostButtonEvent", + "xf86PostMotionEvent", + "xf86PostProximityEvent", + "xf86ProcessCommonOptions", + "xf86ScaleAxis", + "xf86SetIntOption", + "xf86SetStrOption", + "xf86XInputSetScreen", + "xf86XInputSetSendCoreEvents", + NULL + }; + + +static pointer +CalcompSetupProc( pointer module, + pointer options, + int *errmaj, + int *errmin ) + { + xf86LoaderReqSymLists(reqSymbols, NULL); + xf86AddInputDriver(&CALCOMP, module, 0); + return (pointer) 1; + } + + + +XF86ModuleData calcompModuleData = { &VersionRec, CalcompSetupProc, NULL }; + + +#endif /* XFree86LOADER */ + + + + +/***************************************************************************** + * Function Definitions + ****************************************************************************/ + + +/* + * The TearDownProc may have to be tailored to your device + */ +/****************************************************** +static void +TearDownProc( pointer p ) +{ + LocalDevicePtr local = (LocalDevicePtr) p; + CALCOMPPrivatePtr priv = (CALCOMPPrivatePtr) local->private; + + ErrorF ("Calcomp TearDownProc Called\n"); + + DeviceOff (local->dev); + + + xf86CloseSerial (local->fd); + XisbFree (priv->buffer); + xfree (priv); + xfree (local->name); + xfree (local); +} +**********************************************************/ + + + +/* + * The DeviceControl function should not need to be changed + * except to remove ErrorFs + */ +static Bool +DeviceControl (DeviceIntPtr dev, int mode) +{ + Bool RetValue; + +/* ErrorF ("DeviceControl called mode = %d\n", mode);*/ + switch (mode) + { + case DEVICE_INIT: +/* ErrorF ("\tINIT\n");*/ + DeviceInit (dev); + RetValue = Success; + break; + case DEVICE_ON: +/* ErrorF ("\tON\n");*/ + RetValue = DeviceOn( dev ); + break; + case DEVICE_OFF: +/* ErrorF ("\tOFF\n");*/ + RetValue = DeviceOff( dev ); + break; + case DEVICE_CLOSE: +/* ErrorF ("\tCLOSE\n");*/ + RetValue = DeviceClose( dev ); + break; + default: + ErrorF ("\tBAD MODE\n"); + RetValue = BadValue; + } + + return( RetValue ); +} + +/* + * The DeviceOn function should not need to be changed + */ +static Bool +DeviceOn (DeviceIntPtr dev) +{ + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + + AddEnabledDevice (local->fd); + dev->public.on = TRUE; + return (Success); +} + +/* + * The DeviceOff function should not need to be changed + */ +static Bool +DeviceOff (DeviceIntPtr dev) +{ + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + + RemoveEnabledDevice (local->fd); + dev->public.on = FALSE; + return (Success); +} + +/* + * The DeviceClose function should not need to be changed + */ +static Bool +DeviceClose (DeviceIntPtr dev) +{ + return (Success); +} + +/* + * The DeviceInit function will need to be tailored to your device + */ +static Bool +DeviceInit (DeviceIntPtr dev) +{ + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + CALCOMPPrivatePtr priv = (CALCOMPPrivatePtr) (local->private); + unsigned char map[] = + {0, 1}; + + /* + * Set up buttons, valuators etc for your device + */ + if (InitButtonClassDeviceStruct (dev, 1, map) == FALSE) + { + ErrorF ("Unable to allocate CALCOMP ButtonClassDeviceStruct\n"); + return !Success; + } + if (InitFocusClassDeviceStruct (dev) == FALSE) { /* is this necessary? */ + ErrorF ("Unable to allocate CALCOMP focus class device\n"); + return !Success; + } + + /* + * this example device reports motions on 2 axes in absolute coordinates. + * Device may reports touch pressure on the 3rd axis. + */ + if (InitValuatorClassDeviceStruct (dev, 3, xf86GetMotionEvents, + local->history_size, Absolute) == FALSE) + { + ErrorF ("Unable to allocate CALCOMP ValuatorClassDeviceStruct\n"); + return !Success; + } + else + { + InitValuatorAxisStruct (dev, 0, priv->min_x, priv->max_x, + 39400, + 0 /* min_res */ , + 12000 /* max_res */ ); + InitValuatorAxisStruct (dev, 1, priv->min_y, priv->max_y, + 39400, + 0 /* min_res */ , + 39400 /* max_res */ ); + + InitValuatorAxisStruct (dev, 2, priv->min_z, priv->max_z, + 32, + 0 /* min_res */ , + 32 /* max_res */ ); + } + + if (InitProximityClassDeviceStruct (dev) == FALSE) + { + ErrorF ("unable to allocate CALCOMP ProximityClassDeviceStruct\n"); + return !Success; + } + + + if (InitPtrFeedbackClassDeviceStruct(dev, + ControlProc) == FALSE) { + ErrorF("unable to init ptr feedback\n"); + return !Success; + } + + /* + * Allocate the motion events buffer. + */ + xf86MotionHistoryAllocate (local); + return (Success); +} + +/* + * The ReadInput function will have to be tailored to your device + */ +static void +ReadInput (LocalDevicePtr local) +{ + int x=0, y=0 , z=0; + /*int state;*/ + int prox,buttons; + Bool is_absolute = TRUE; /* FIXME */ + CALCOMPPrivatePtr priv = (CALCOMPPrivatePtr) (local->private); + + /* + * set blocking to -1 on the first call because we know there is data to + * read. Xisb automatically clears it after one successful read so that + * succeeding reads are preceeded by a select with a 0 timeout to prevent + * read from blocking indefinitely. + */ + XisbBlockDuration (priv->buffer, -1); + while (CALCOMPGetPacket (priv) == Success) + { + /* + * Examine priv->packet and call these functions as appropriate: + * + xf86PostProximityEvent + xf86PostMotionEvent + xf86PostButtonEvent + */ + /* Format of 6 bytes data packet in Calcomp Binary Encoding + + Byte 1 + bit 7 Phasing bit, always 1 + bit 6 Buttons on a 16bit cursor + bit 5 Button 3 + bit 4 Button 2 + bit 3 Button 1 + bit 2 Button 0 (Stylus tip) + bit 1 X15 + bit 0 X14 + Byte 2 + bit 7 Always 0 + bits 6-0 = X13 - X7 + Byte 3 + bit 7 Always 0 + bits 6-0 = X6 - X0 + Byte 4 + bit 7 Always 0 + bit 6 Proximity + bits 3-0 = Y17 - Y14 + Byte 5 + bit 7 Always 0 + bits 6-0 = Y13 - Y7 + Byte 6 + bit 7 Always 0 + bits 6-0 = Y6 - Y0 + */ + x = priv->packet[2] + priv->packet[1] * 128 + +(priv->packet[0] & 0x03) *128*128; + y = priv->packet[5] + priv->packet[4]*128 +priv->packet[3]*128*128; + y = priv->max_y -y; + prox = ((int)priv->packet[3] & PROXIMITY_BIT)? 0: 1; + + buttons = (((int)priv->packet[0] & BUTTON_BITS) >>2); + if (buttons && ! priv->pressure ) { + if (buttons >15) { + buttons = buttons -15; + }else{ + buttons = buttons /2; + if (buttons <4 ) buttons = buttons +1; + } + }else{ + z = buttons; /* button bits convey pressure data*/ + if (z >= priv->button_threshold) buttons = 1; +#if 0 +xf86Msg(X_INFO,"Tablett pressurebutton = %d >= %d\n",z,priv->button_threshold); +#endif + } +#if 0 +xf86Msg(X_INFO,"Tablett x y prox buttons = %d %d %d %d\n",x,y,prox,buttons); +#endif + if (prox) { + if (!(priv->prox)) { + xf86PostProximityEvent(local->dev, 1, 0, 2, x, y); + } + + if ((is_absolute && ((priv->x != x) || (priv->y != y))) + || (!is_absolute && (x || y))) { + priv->x = x; + priv->y = y; + + if (is_absolute || priv->prox) { + xf86PostMotionEvent(local->dev, is_absolute, 0, 3, x, y, z); + + } + } + if (priv->buttons != buttons) { + int delta; + int button; + delta = buttons - priv->buttons; + button = (delta > 0)? delta: ((delta == 0)? priv->buttons : -delta); + if (priv->buttons != buttons) { + xf86PostButtonEvent(local->dev, is_absolute, button, + (delta > 0), 0, 2, x, y); + } + } + priv->buttons = buttons; + priv->x = x; + priv->y = y; + priv->prox = prox; + } else { /* !PROXIMITY */ + /* Any changes in buttons are ignored when !proximity */ + if (priv->prox) xf86PostProximityEvent(local->dev, 0, 0, 2, x, y); + priv->prox = 0; + } + + } /* while packets come in */ +} + +/* + * The ControlProc function may need to be tailored for your device + */ +static void +ControlProc (DeviceIntPtr device, PtrCtrl * control) +{ +} +static int +ChangeControlProc(LocalDevicePtr local, xDeviceCtl *control) +{ +return(Success); +} +/* + * the CloseProc should not need to be tailored to your device + */ +static void +CloseProc (LocalDevicePtr local) +{ +} + +/* + * The SwitchMode function may need to be tailored for your device + */ +static int +SwitchMode (ClientPtr client, DeviceIntPtr dev, int mode) +{ + return (Success); +} + +/* + * The ConvertProc function may need to be tailored for your device. + * This function converts the device's valuator outputs to x and y coordinates + * to simulate mouse events. + */ +static Bool +ConvertProc (LocalDevicePtr local, + int first, + int num, + int v0, + int v1, + int v2, + int v3, + int v4, + int v5, + int *x, + int *y) +{ +CALCOMPPrivatePtr priv=(CALCOMPPrivatePtr) local->private; +double factorX,factorY; + +xf86Msg(X_INFO,"Calcomp ConvertProc called\n"); +if (first !=0 || num == 1) return FALSE; + +factorX= ((double) priv->screen_width) + /(priv->max_x - priv->min_x); +factorY= ((double) priv->screen_height) + /(priv->max_y - priv->min_y); + + *x = v0*factorX; + *y = v1*factorY; + return (Success); +} + +/* + * the QueryHardware fuction should be tailored to your device to + * verify the device is attached and functional and perform any + * needed initialization. + */ +static Bool +QueryHardware (int fd, CALCOMPPrivatePtr priv) +{ +char buffer[255]; +int err; + + SYSCALL(err = write(fd, DB_COMM_SETUP, strlen(DB_COMM_SETUP))); + if (err<0) return !Success; + + xf86WaitForInput(-1,500); + + SYSCALL(err = write(fd, DB_UPPER_ORIGIN, strlen(DB_UPPER_ORIGIN))); + if (err<0) return !Success; + + xf86WaitForInput(-1,500); + + SYSCALL(err = write(fd, DB_BINARY_FMT, strlen(DB_BINARY_FMT))); + if (err<0) return !Success; + + xf86WaitForInput(-1,500); + + SYSCALL(err = write(fd, DB_XINCREMENT, strlen(DB_XINCREMENT))); + if (err<0) return !Success; + + xf86WaitForInput(-1,500); + + SYSCALL(err = write(fd, DB_YINCREMENT, strlen(DB_YINCREMENT))); + if (err<0) return !Success; + + xf86WaitForInput(-1,500); + + SYSCALL(err = write(fd, DB_1000LPI, strlen(DB_1000LPI))); + if (err<0) return !Success; + + xf86WaitForInput(-1,500); + + SYSCALL(err = write(fd, DB_STREAM_MODE, strlen(DB_STREAM_MODE))); + if (err<0) return !Success; + + xf86WaitForInput(-1,500); + if (priv->pressure) + SYSCALL(err = write(fd, DB_PRESSURE_ON, strlen(DB_PRESSURE_ON))); + else + SYSCALL(err = write(fd, DB_PRESSURE_OFF, strlen(DB_PRESSURE_OFF))); + if (err<0) return !Success; + + xf86WaitForInput(-1,500); + + if (!xf86CalWriteAndRead(fd, DB_FIRMID, buffer, 35, 1)) + return !Success; + + xf86Msg(X_INFO,"Calcomp firmware ID : %s\n", buffer); + memset(buffer,32,35); + + xf86WaitForInput(-1,500); + + if (!xf86CalWriteAndRead(fd, DB_PRODID, buffer, 20, 1)) + return !Success; + xf86Msg(X_INFO,"Product ID : %s\n", buffer); + + memset(buffer,32,20); + + xf86WaitForInput(-1,500); + + if (!xf86CalWriteAndRead(fd, DB_CONFIG, buffer, 6, 1)) + return !Success; + priv->max_x = (int)buffer[2] + ((int)buffer[1] << 7) + + (((int)buffer[0]&0x03)<<14); + priv->max_y = (int)buffer[5] + ((int)buffer[4] << 7); + + xf86Msg(X_INFO,"Tablet size : %d x %d \n", priv->max_x,priv->max_y); + + + xf86WaitForInput(-1,500); + + + SYSCALL(err = write(fd, DB_ABSOLUTE, strlen(DB_ABSOLUTE))); + if (err<0) return !Success; + + + +/* +*/ + return (Success); + +} + +static InputInfoPtr +CalcompPreInit( InputDriverPtr drv, + IDevPtr dev, int flags) + { + + InputInfoPtr local; + CALCOMPPrivatePtr priv = xcalloc (1, sizeof (CALCOMPPrivateRec)); + char *s; + + if (!(local = xf86AllocateInput(drv, 0))) + return NULL; + + xf86Msg (X_INFO,"Calcomp SetupProc called\n"); + if ((!local) || (!priv)) + goto SetupProc_fail; + + + xf86CollectInputOptions(local, default_options, NULL); + + xf86OptionListReport( local->options ); + local->fd = xf86OpenSerial (local->options); + + + + + + + + if (local->fd == -1) + { + xf86Msg (X_ERROR,"CALCOMP driver unable to open device\n"); + goto SetupProc_fail; + } else { + xf86Msg( X_INFO,"CALCOMP driver: Serial device opened\n"); + } + + priv->min_x = xf86SetIntOption( local->options, "MinX", 0 ); + priv->max_x = xf86SetIntOption( local->options, "MaxX", 1000 ); + priv->min_y = xf86SetIntOption( local->options, "MinY", 0 ); + priv->max_y = xf86SetIntOption( local->options, "MaxY", 1000 ); + priv->min_z = xf86SetIntOption( local->options, "MinZ", 0 ); + priv->max_z = xf86SetIntOption( local->options, "MaxZ", 32 ); + priv->button_threshold = xf86SetIntOption (local->options, "ButtonThreshold", 16 ); + priv->pressure = xf86SetIntOption (local->options, "Pressure", 0); + priv->untouch_delay = xf86SetIntOption( local->options, "UntouchDelay", 10 ); + priv->report_delay = xf86SetIntOption( local->options, "ReportDelay", 40 ); + priv->screen_num = xf86SetIntOption( local->options, "ScreenNumber", 0 ); + priv->button_number = xf86SetIntOption( local->options, "ButtonNumber", 1 ); + + xf86Msg(X_INFO,"options read MaxX=%d, MaxY=%d\n",priv->max_x,priv->max_y); + + s = xf86FindOptionValue (local->options, "ReportingMode"); + if ((s) && (xf86NameCmp (s, "raw") == 0)) + + priv->reporting_mode = TS_Raw; + else + priv->reporting_mode = TS_Scaled; + + priv->checksum = 0; + priv->buffer = XisbNew (local->fd, 200); + + DBG (9, XisbTrace (priv->buffer, 1)); + + /* + * Verify that your hardware is attached and fuctional if you can + */ + if (QueryHardware (local->fd, priv) != Success) + { + xf86Msg (X_ERROR,"Unable to query/initialize CALCOMP hardware.\n"); + goto SetupProc_fail; + }else + xf86Msg (X_INFO,"Calcomp tablet queried OK\n"); + + local->name = xf86SetStrOption( local->options, "DeviceName", "CALCOMP XInput Device"); + xf86Msg(X_CONFIG," Calcomp device name is %s\n",local->name); + /* Set the type that's appropriate for your device + * XI_KEYBOARD + * XI_MOUSE + * XI_TABLET + * XI_TOUCHSCREEN + * XI_TOUCHPAD + * XI_BARCODE + * XI_BUTTONBOX + * XI_KNOB_BOX + * XI_ONE_KNOB + * XI_NINE_KNOB + * XI_TRACKBALL + * XI_QUADRATURE + * XI_ID_MODULE + * XI_SPACEBALL + * XI_DATAGLOVE + * XI_EYETRACKER + * XI_CURSORKEYS + * XI_FOOTMOUSE + */ + local->type_name = XI_TABLET; + /* + * Standard setup for the local device record + */ + local->device_control = DeviceControl; + local->read_input = ReadInput; + local->control_proc = ChangeControlProc; + local->close_proc = CloseProc; + local->switch_mode = SwitchMode; + local->conversion_proc = ConvertProc; + local->dev = NULL; + local->private = priv; + local->private_flags = 0; + local->history_size = xf86SetIntOption( local->options, "HistorySize", 0 ); + local->flags |= XI86_CONFIGURED; + + xf86Msg(X_INFO,"Calcomp base setup finished\n"); + return (local); +SetupProc_fail: + xf86Msg (X_ERROR,"Calcomp setup failed, unloading tablet driver\n"); +/* taken from xf86Wacom*/ + xfree (priv); + xf86DeleteInput(local, 0); +/* * */ + return (NULL); + + + } + +/* + * This function should be renamed for your device and tailored to handle + * your device's protocol. + */ +static Bool +CALCOMPGetPacket (CALCOMPPrivatePtr priv) +{ + int count = 0; + int c; + + while ((c = XisbRead (priv->buffer)) >= 0) + { + /* + * fail after 500 bytes so the server doesn't hang forever if a + * device sends bad data. + */ + if (count++ > 500) + return (!Success); + + + if (c > 127) /* phasing bit set, start of packet */ + { + priv->packeti=0; + priv->packet[priv->packeti++] = (unsigned char) c; + } + else { + if (priv->packeti >0 && priv->packeti < CALCOMP_BODY_LEN) + priv->packet[priv->packeti++] = (unsigned char) c; + if (priv->packeti == CALCOMP_BODY_LEN) + { + priv->packeti=0; + return (Success); + } + } + } + return (!Success); +} + +/* +** xf86CalWriteAndRead +** Write data, and get the response. +*/ +static char * +xf86CalWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) +{ + int err, numread = 0; + int retries = 5; + + + + xf86FlushInput(fd); + + SYSCALL(err = write(fd, data, strlen(data))); + if (err == -1) { + xf86Msg(X_ERROR,"Calcomp write"); + return NULL; + } +do { + err=xf86WaitForInput(fd, 2000); + if (err < 0 ) { + xf86Msg(X_ERROR,"Calcomp select failed\n"); + return NULL; + } + retries--; + } + while (err<1 && retries >0); + +if (retries<=0) { + xf86Msg(X_WARNING,"Timeout while reading Calcomp tablet. No tablet connected ???\n"); + return NULL; + } + + while (numread < len) { + if (err == -1) { + xf86Msg(X_ERROR,"Calcomp select"); + return NULL; + } + + SYSCALL(err = read(fd, buffer + numread++, 1)); + if (err == -1) { + xf86Msg(X_ERROR,"Calcomp read"); + return NULL; + } + if (!err) { + --numread; + break; + } + if (cr_term && buffer[numread - 1] == '\r') { + buffer[numread - 1] = 0; + break; + } + } + buffer[numread] = 0; + return buffer; + } + Index: xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.h:1.2 --- /dev/null Fri Jan 18 15:25:52 2002 +++ xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.h Sat Oct 27 23:33:55 2001 @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2000-2001 Martin Kroeker (mk@daveg.com) + * code derived from sample driver + * Copyright (c) 1998 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/calcomp/xf86Calcomp.h,v 1.2 2001/10/28 03:33:55 tsi Exp $ */ + +#ifndef _CALCOMP_H_ +#define _CALCOMP_H_ + +/****************************************************************************** + * Definitions + * structs, typedefs, #defines, enums + *****************************************************************************/ +#define CALCOMP_PACKET_SIZE 5 +#define CALCOMP_INIT_CHECKSUM 0 +#define CALCOMP_BODY_LEN 6 + + + +/*************************************************************************/ +#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) + +#define DB_COMM_SETUP "\033%C1N81\r" /* Serial communication setup */ +#define DB_FIRMID "\033%__V\r" /* Request firmware ID string */ +#define DB_PRODID "\033%__p\r" /* Request product ID string */ +#define DB_CONFIG "\033%VS\r" /* Send configuration (max coords) */ + +#define DB_ABSOLUTE "\033%IR\r" /* Absolute mode */ +#define DB_RELATIVE "\033%IT\r" /* Relative mode */ + +#define DB_UPPER_ORIGIN "\033%L1\r" /* Origin upper left */ +#define DB_1000LPI "\033%JR1000,0\r" /* 1000 lines per inch */ + +#define DB_PROMPT_MODE "\033%Q?\r" /* Prompt mode (untested!) */ +#define DB_STREAM_MODE "\033%IR\r" /* Stream mode */ +#define DB_XINCREMENT "\033%X1\r" +#define DB_YINCREMENT "\033%Y1\r" /* Set increment to 1 */ +#define DB_BINARY_FMT "\033%^23\r" /* Calcomp binary mode */ +#define DB_PRESSURE_OFF "\033%VA0\r" /* Select button or pressure */ +#define DB_PRESSURE_ON "\033%VA1\r" /* reporting */ +#define DB_PROMPT "?" /* Prompt for current position */ + +#define PHASING_BIT 0x80 +#define PROXIMITY_BIT 0x20 +#define BUTTON_BITS 0x7c +#define COORD_BITS 0x7f +#define tcflush(fd, n) xf86FlushInput((fd)) +#undef read +#define read(a,b,c) xf86ReadSerial((a),(b),(c)) +#undef write +#define write(a,b,c) xf86WriteSerial((a),(char*)(b),(c)) +#undef close +#define close(a) xf86CloseSerial((a)) + +/*************************************************************************/ +typedef enum +{ + CALCOMP_normal, /*CALCOMP_type,*/ CALCOMP_body, CALCOMP_checksum +} +CALCOMPState; + +#define WORD_ASSEMBLY(byte1, byte2) (((byte2) << 8) | (byte1)) + +typedef struct _CALCOMPPrivateRec +{ + int min_x; /* Minimum x reported by calibration */ + int max_x; /* Maximum x */ + int min_y; /* Minimum y reported by calibration */ + int max_y; /* Maximum y */ + int min_z; + int max_z; + int button_threshold; /* Z > button threshold = button click */ + int pressure; /* 0 or 1, do we need pressure info */ + int axes; + int prox; /* Proximity */ + int x,y; /* x,y values */ + int buttons; /* button state */ + Bool button_down; /* is the "button" currently down */ + int button_number; /* which button to report */ + int reporting_mode; /* TS_Raw or TS_Scaled */ + + int untouch_delay; /* Delay before reporting an untouch (in ms) */ + int report_delay; /* Delay between touch report packets */ + + int screen_num; /* Screen associated with the device */ + int screen_width; /* Width of the associated X screen */ + int screen_height; /* Height of the screen */ + XISBuffer *buffer; + unsigned char packet[CALCOMP_PACKET_SIZE]; /* packet being/just read */ + int packeti; /* index into packet */ + unsigned char checksum; /* Current checksum of data in assembly * + * buffer */ + CALCOMPState lex_mode; +} +CALCOMPPrivateRec, *CALCOMPPrivatePtr; + +/****************************************************************************** + * Declarations + *****************************************************************************/ +#ifdef XFree86LOADER +static MODULESETUPPROTO( CalcompSetupProc ); +#endif +/*static void TearDownProc (pointer p);*/ +static Bool DeviceControl (DeviceIntPtr, int); +static Bool DeviceOn (DeviceIntPtr); +static Bool DeviceOff (DeviceIntPtr); +static Bool DeviceClose (DeviceIntPtr); +static Bool DeviceInit (DeviceIntPtr); +static void ReadInput (LocalDevicePtr); +static void ControlProc (DeviceIntPtr, PtrCtrl *); +static int ChangeControlProc (LocalDevicePtr, xDeviceCtl *); +static void CloseProc (LocalDevicePtr); +static int SwitchMode (ClientPtr, DeviceIntPtr, int); +static Bool ConvertProc (LocalDevicePtr, int, int, int, int, int, int, int, int, int *, int *); +static Bool QueryHardware (int , CALCOMPPrivatePtr); +static Bool CALCOMPGetPacket (CALCOMPPrivatePtr priv); +static char * xf86CalWriteAndRead(int, char *, char *, int , int ); +static InputInfoPtr CalcompPreInit(InputDriverPtr, IDevPtr, int) ; +/* + * DO NOT PUT ANYTHING AFTER THIS ENDIF + */ +#endif Index: xc/programs/Xserver/hw/xfree86/input/citron/citron.c diff -u xc/programs/Xserver/hw/xfree86/input/citron/citron.c:1.6 xc/programs/Xserver/hw/xfree86/input/citron/citron.c:1.7 --- xc/programs/Xserver/hw/xfree86/input/citron/citron.c:1.6 Thu Apr 5 13:42:34 2001 +++ xc/programs/Xserver/hw/xfree86/input/citron/citron.c Mon Jul 2 13:29:20 2001 @@ -25,7 +25,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.6 2001/04/05 17:42:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.7 2001/07/02 17:29:20 dawes Exp $ */ /* * Based, in part, on code with the following copyright notice: @@ -137,7 +137,6 @@ #define NEED_XF86_TYPES #include "xf86_ansic.h" #include "xf86_OSproc.h" -#include "xf86Optrec.h" #include "xf86Xinput.h" #include "xisb.h" #include "exevents.h" /* Needed for InitValuator/Proximity stuff*/ Index: xc/programs/Xserver/hw/xfree86/input/citron/citron.h diff -u xc/programs/Xserver/hw/xfree86/input/citron/citron.h:1.2 xc/programs/Xserver/hw/xfree86/input/citron/citron.h:1.3 --- xc/programs/Xserver/hw/xfree86/input/citron/citron.h:1.2 Thu Apr 5 13:42:34 2001 +++ xc/programs/Xserver/hw/xfree86/input/citron/citron.h Sat Oct 27 23:33:56 2001 @@ -25,7 +25,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.h,v 1.2 2001/04/05 17:42:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.h,v 1.3 2001/10/28 03:33:56 tsi Exp $ */ /* * Based, in part, on code with the following copyright notice: @@ -496,9 +496,11 @@ * Declarations *****************************************************************************/ /*extern void ModuleInit (pointer *, INT32 *);*/ +#ifdef XFree86LOADER static MODULESETUPPROTO (SetupProc); static void TearDownProc (pointer p); /*static void *SetupProc (XF86OptionPtr, int *, int *);*/ +#endif static Bool DeviceControl (DeviceIntPtr def, int mode); static Bool DeviceOn (DeviceIntPtr); static Bool DeviceOff (DeviceIntPtr); Index: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c diff -u xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c:1.4 xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c:1.6 --- xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c:1.4 Tue May 15 14:22:22 2001 +++ xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c Wed Dec 26 16:51:58 2001 @@ -30,7 +30,7 @@ * 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.4 2001/05/15 18:22:22 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c,v 1.6 2001/12/26 21:51:58 dawes Exp $ */ #include "xf86Version.h" @@ -63,8 +63,6 @@ #include "xf86Module.h" #endif -#undef sleep -#define sleep(t) xf86WaitForInput(-1, 1000 * (t)) #define wait_for_fd(fd) xf86WaitForInput((fd), 1000) #define tcflush(fd, n) xf86FlushInput((fd)) #undef read @@ -510,8 +508,6 @@ int v0, int v1, int v2, int v3, int v4, int v5, int *x, int *y) { - DigitalEdgeDevicePtr priv = (DigitalEdgeDevicePtr) local->private; - if (first != 0 || num == 1) return FALSE; @@ -709,6 +705,7 @@ DBG(2, ErrorF("xf86SumControlProc\n")); } +#if 0 /* ** xf86SumWriteAndRead ** Write data, and get the response. @@ -767,6 +764,7 @@ buffer[numread] = 0; return buffer; } +#endif /* ** xf86SumOpen @@ -1153,7 +1151,7 @@ ** xf86SumAllocate ** Allocates the device structures for the DigitalEdge. */ -static LocalDevicePtr xf86SumAllocate() +static LocalDevicePtr xf86SumAllocate(void) { #ifdef XFREE86_V4 LocalDevicePtr local = xf86AllocateInput(dedgeDrv, 0); Index: xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile:1.1 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile Fri Aug 17 09:27:55 2001 @@ -0,0 +1,30 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/dmc/Imakefile,v 1.1 2001/08/17 13:27:55 dawes Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = xf86DMC.c +OBJS = xf86DMC.o + +DRIVER = dmc + +INCLUDES = -I. -I$(XF86COMSRC) -I../../loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +#if !defined(XF86DriverSDK) +InstallModuleManPage($(DRIVER)) +#endif + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/dmc/dmc.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/dmc/dmc.man:1.1 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/dmc/dmc.man Fri Aug 17 09:27:55 2001 @@ -0,0 +1,39 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/dmc/dmc.man,v 1.1 2001/08/17 13:27:55 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH DMC __drivermansuffix__ __vendorversion__ +.SH NAME +dmc \- DMC input driver +.SH SYNOPSIS +.B "Section \*qInputDevice\*q" +.br +.BI " Identifier \*q" idevname \*q +.br +.B " Driver \*qdmc\*q" +.br +.BI " Option \*qDevice\*q \*q" devpath \*q +.br +\ \ ... +.br +.B EndSection +.SH DESCRIPTION +.B dmc +is an XFree86 input driver for DMC FIT10-controller... +.PP +The +.B dmc +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/dmc/xf86DMC.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/dmc/xf86DMC.c:1.2 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/dmc/xf86DMC.c Mon Nov 26 11:25:52 2001 @@ -0,0 +1,690 @@ +/* + * Copyright (c) 1999 Machine Vision Holdings Incorporated + * Author: Mayk Langer <langer@vsys.de> + * + * Template driver used: Copyright (c) 1998 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, cpy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/dmc/xf86DMC.c,v 1.2 2001/11/26 16:25:52 dawes Exp $ */ + +#define _DMC_C_ + +#include <misc.h> +#include <xf86.h> +#define NEED_XF86_TYPES +#include <xf86_ansic.h> +#include <xf86_OSproc.h> +#include <xf86Xinput.h> +#include <xisb.h> +#include <exevents.h> + +#include "xf86DMC.h" + +InputDriverRec DMC = { + 1, + "dmc", + NULL, + DMCPreInit, + /*DMCUnInit*/NULL, + NULL, + 0 +}; + + + +#ifdef XFree86LOADER + +static XF86ModuleVersionInfo VersionRec = +{ + "dmc", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by + * a tool */ +}; + + +static const char *reqSymbols[] = { + "AddEnabledDevice", + "ErrorF", + "InitButtonClassDeviceStruct", + "InitProximityClassDeviceStruct", + "InitValuatorAxisStruct", + "InitValuatorClassDeviceStruct", + "InitPtrFeedbackClassDeviceStruct", + "RemoveEnabledDevice", + "Xcalloc", + "Xfree", + "XisbBlockDuration", + "XisbFree", + "XisbNew", + "XisbRead", + "XisbTrace", + "screenInfo", + "xf86AddInputDriver", + "xf86AllocateInput", + "xf86CloseSerial", + "xf86CollectInputOptions", + "xf86ErrorFVerb", + "xf86FindOptionValue", + "xf86GetMotionEvents", + "xf86GetVerbosity", + "xf86MotionHistoryAllocate", + "xf86NameCmp", + "xf86OpenSerial", + "xf86OptionListCreate", + "xf86OptionListMerge", + "xf86OptionListReport", + "xf86PostButtonEvent", + "xf86PostMotionEvent", + "xf86PostProximityEvent", + "xf86ProcessCommonOptions", + "xf86ScaleAxis", + "xf86SetIntOption", + "xf86SetStrOption", + "xf86XInputSetScreen", + "xf86XInputSetSendCoreEvents", + NULL +}; + + +static pointer +DMCSetupProc( pointer module, + pointer options, + int *errmaj, + int *errmin ) +{ + xf86LoaderReqSymLists(reqSymbols, NULL); + xf86AddInputDriver(&DMC, module, 0); + return (pointer) 1; +} + +XF86ModuleData dmcModuleData = { &VersionRec, DMCSetupProc, NULL }; + + +#endif /* XFree86LOADER */ + + +/* + * Be sure to set vmin appropriately for your device's protocol. You want to + * read a full packet before returning + */ +static const char *default_options[] = +{ + /* "Device", "/dev/ttyS1",*/ + "BaudRate", "9600", + "StopBits", "1", + "DataBits", "8", + "Parity", "None", + "Vmin", "3", + "Vtime", "1", + "FlowControl", "None", + NULL, +}; + + +/***************************************************************************** + * Function Definitions + ****************************************************************************/ + + + +static InputInfoPtr +DMCPreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + InputInfoPtr pInfo; + DMCPrivatePtr priv = xcalloc (1, sizeof (DMCPrivateRec)); + char *s; + + if (!priv) + return NULL; + + if (!(pInfo = xf86AllocateInput(drv, 0))) { + xfree(priv); + return NULL; + } + + priv->min_x = 0; + priv->max_x = 1024; + priv->min_y = 768; + priv->max_y = 0; + priv->screen_num = 0; + priv->screen_width = -1; + priv->screen_height = -1; + priv->lex_mode = DMC_byte0; + priv->swap_xy = 0; + priv->button_down = FALSE; + priv->button_number = 1; + priv->proximity = FALSE; + priv->pen_down = 0; + + pInfo->type_name = XI_TOUCHSCREEN; + pInfo->device_control = DeviceControl; + pInfo->read_input = ReadInput; + pInfo->control_proc = ControlProc; + pInfo->close_proc = CloseProc; + pInfo->switch_mode = SwitchMode; + pInfo->conversion_proc = ConvertProc; + pInfo->dev = NULL; + pInfo->private = priv; + pInfo->private_flags = 0; + pInfo->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS; + pInfo->conf_idev = dev; + + xf86CollectInputOptions(pInfo, default_options, NULL); + + xf86OptionListReport( pInfo->options ); + + pInfo->fd = xf86OpenSerial (pInfo->options); + if (pInfo->fd == -1) + { + ErrorF ("DMC driver unable to open device\n"); + goto SetupProc_fail; + } + xf86CloseSerial(pInfo->fd); + /* + * Process the options for your device like this + */ + priv->min_x = xf86SetIntOption( pInfo->options, "MinX", 0 ); + priv->max_x = xf86SetIntOption( pInfo->options, "MaxX", 1024 ); + priv->min_y = xf86SetIntOption( pInfo->options, "MinY", 768 ); + priv->max_y = xf86SetIntOption( pInfo->options, "MaxY", 0 ); + priv->screen_num = xf86SetIntOption( pInfo->options, "ScreenNumber", 0 ); + priv->button_number = xf86SetIntOption( pInfo->options, "ButtonNumber", 1 ); + priv->swap_xy = xf86SetIntOption( pInfo->options, "SwapXY", 0 ); + priv->buffer = NULL; + s = xf86FindOptionValue (pInfo->options, "ReportingMode"); + if ((s) && (xf86NameCmp (s, "raw") == 0)) + priv->reporting_mode = TS_Raw; + else + priv->reporting_mode = TS_Scaled; + + priv->proximity = FALSE; + priv->button_down = FALSE; + priv->lex_mode = DMC_byte0; + + if (QueryHardware (priv) != Success) + { + ErrorF ("Unable to query/initialize DMC hardware.\n"); + goto SetupProc_fail; + } + + /* this results in an xstrdup that must be freed later */ + pInfo->name = xf86SetStrOption( pInfo->options, "DeviceName", "DMC"); + xf86ProcessCommonOptions(pInfo, pInfo->options); + + pInfo->flags |= XI86_CONFIGURED; + return (pInfo); + + SetupProc_fail: + if ((pInfo) && (pInfo->fd)) + xf86CloseSerial (pInfo->fd); + if ((pInfo) && (pInfo->name)) + xfree (pInfo->name); + + if ((priv) && (priv->buffer)) + XisbFree (priv->buffer); + if (priv) + xfree (priv); + return (pInfo); +} + +static Bool +DeviceControl (DeviceIntPtr dev, int mode) +{ + InputInfoPtr pInfo = dev->public.devicePrivate; + DMCPrivatePtr priv = (DMCPrivatePtr) (pInfo->private); + unsigned char map[] = + {0, 1}; + + switch (mode) + { + case DEVICE_INIT: + /* + * these have to be here instead of in the SetupProc, because when the + * SetupProc is run at server startup, screenInfo is not setup yet + */ + priv->screen_width = screenInfo.screens[priv->screen_num]->width; + priv->screen_height = screenInfo.screens[priv->screen_num]->height; + + /* + * Device reports button press for 1 button. + */ + if (InitButtonClassDeviceStruct (dev, 1, map) == FALSE) + { + ErrorF ("Unable to allocate DMC ButtonClassDeviceStruct\n"); + return !Success; + } + + /* + * Device reports motions on 2 axes in absolute coordinates. + * Axes min and max values are reported in raw coordinates. + */ + if (InitValuatorClassDeviceStruct (dev, 2, xf86GetMotionEvents, + pInfo->history_size, Absolute) == FALSE) + { + ErrorF ("Unable to allocate DMC ValuatorClassDeviceStruct\n"); + return !Success; + } + else + { + InitValuatorAxisStruct (dev, 0, priv->min_x, priv->max_x, + 9500, + 0 /* min_res */ , + 9500 /* max_res */ ); + InitValuatorAxisStruct (dev, 1, priv->min_y, priv->max_y, + 10500, + 0 /* min_res */ , + 10500 /* max_res */ ); + } + + if (InitProximityClassDeviceStruct (dev) == FALSE) + { + ErrorF ("unable to allocate DMC ProximityClassDeviceStruct\n"); + return !Success; + } + + if (InitPtrFeedbackClassDeviceStruct(dev, DMCPtrCtrl) == FALSE) + { + ErrorF ("unable to allocate DMC PtrFeedbackClassDeviceStruct\n"); + return !Success; + } + + /* + * Allocate the motion events buffer. + */ + xf86MotionHistoryAllocate (pInfo); + return (Success); + + case DEVICE_ON: + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) + { + xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); + return (!Success); + } + else + { + priv->buffer = XisbNew(pInfo->fd, 64); + if (!priv->buffer) + { + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + return (!Success); + } + else + { + unsigned char buf[2] = { 0x05, 0x40 }; + + sleep(1); /* touch need ca. 500ms delay !!! */ + XisbBlockDuration (priv->buffer, 500000); + if ( DMCSendPacket(priv, buf, 2) == Success ) + { + /* wait for right response */ + priv->lex_mode = DMC_Response0; + if (DMCGetPacket (priv) == Success ) + { + if ( priv->packet[0] == 0x06 ) + { + buf[0] = 0x31; + DMCSendPacket(priv,buf,1); + priv->lex_mode = DMC_Response0; + xf86Msg(X_ERROR, "DMC-Touch found\n"); + } + else + { + xf86Msg(X_ERROR, "DMC-Touch found\n"); + return (!Success); + } + } + else + { + xf86Msg(X_ERROR, "DMC-Touch found\n"); + return (!Success); + } + } + else + { + xf86Msg(X_ERROR, "DMC-Touch found\n"); + return (!Success); + } + } + } + + XisbBlockDuration (priv->buffer, -1); + priv->lex_mode = DMC_byte0; + + xf86FlushInput(pInfo->fd); + AddEnabledDevice (pInfo->fd); + dev->public.on = TRUE; + return (Success); + + case DEVICE_OFF: + case DEVICE_CLOSE: + if (pInfo->fd != -1) + { + RemoveEnabledDevice (pInfo->fd); + if (priv->buffer) + { + XisbFree(priv->buffer); + priv->buffer = NULL; + } + xf86CloseSerial(pInfo->fd); + } + dev->public.on = FALSE; + return (Success); + default: + return (BadValue); + } + +} + + +/* + * The ReadInput function will have to be tailored to your device + */ +static void +ReadInput (InputInfoPtr pInfo) +{ + DMCPrivatePtr priv = (DMCPrivatePtr) (pInfo->private); + int x,y; + unsigned char opck[ DMC_PACKET_SIZE ]; + + /* + * set blocking to -1 on the first call because we know there is data to + * read. Xisb automatically clears it after one successful read so that + * succeeding reads are preceeded buy a select with a 0 timeout to prevent + * read from blocking indefinately. + */ + XisbBlockDuration (priv->buffer, -1); + while (1) + { + memcpy(opck,priv->packet,5); + + if ( DMCGetPacket (priv) != Success) + break; + if ( priv->packet[0] == 0x11 ) + priv->pen_down=1; + else + priv->pen_down=0; + + if ( priv->swap_xy) + { + y = priv->packet[1]*256+priv->packet[2]; + x = priv->packet[3]*256+priv->packet[4]; + } + else + { + x = priv->packet[1]*256+priv->packet[2]; + y = priv->packet[3]*256+priv->packet[4]; + } + priv->packet[0] = priv->pen_down ? 0x01 : 0x00; + + if (priv->reporting_mode == TS_Scaled) + { + x = xf86ScaleAxis (x, 0, priv->screen_width, priv->min_x, + priv->max_x); + y = xf86ScaleAxis (y, 0, priv->screen_height, priv->min_y, + priv->max_y); + } + + xf86XInputSetScreen (pInfo, priv->screen_num, x, y); + + if ((priv->proximity == FALSE) && (priv->packet[0] & 0x01)) + { + priv->proximity = TRUE; + xf86PostProximityEvent (pInfo->dev, 1, 0, 2, x, y); + } + + /* + * Send events. + * + * We *must* generate a motion before a button change if pointer + * location has changed as DIX assumes this. This is why we always + * emit a motion, regardless of the kind of packet processed. + */ + + xf86PostMotionEvent (pInfo->dev, TRUE, 0, 2, x, y); + + /* + * Emit a button press or release. + */ + if ((priv->button_down == FALSE) && (priv->packet[0] & 0x01)) + + { + xf86PostButtonEvent (pInfo->dev, TRUE, + priv->button_number, 1, 0, 2, x, y); + priv->button_down = TRUE; + } + if ((priv->button_down == TRUE) && !(priv->packet[0] & 0x01)) + { + xf86PostButtonEvent (pInfo->dev, TRUE, + priv->button_number, 0, 0, 2, x, y); + priv->button_down = FALSE; + } + /* + * the untouch should always come after the button release + */ + if ((priv->proximity == TRUE) && !(priv->packet[0] & 0x01)) + { + priv->proximity = FALSE; + xf86PostProximityEvent (pInfo->dev, 0, 0, 2, x, y); + } + } +} + +/* + * The ControlProc function may need to be tailored for your device + */ +static int +ControlProc (InputInfoPtr pInfo, xDeviceCtl * control) +{ + xDeviceTSCalibrationCtl *c = (xDeviceTSCalibrationCtl *) control; + DMCPrivatePtr priv = (DMCPrivatePtr) (pInfo->private); + + priv->min_x = c->min_x; + priv->max_x = c->max_x; + priv->min_y = c->min_y; + priv->max_y = c->max_y; + + return (Success); +} + +/* + * the CloseProc should not need to be tailored to your device + */ +static void +CloseProc (InputInfoPtr pInfo) +{ + +} + +/* + * The SwitchMode function may need to be tailored for your device + */ +static int +SwitchMode (ClientPtr client, DeviceIntPtr dev, int mode) +{ + InputInfoPtr pInfo = dev->public.devicePrivate; + DMCPrivatePtr priv = (DMCPrivatePtr) (pInfo->private); + + + if ((mode == TS_Raw) || (mode == TS_Scaled)) + { + priv->reporting_mode = mode; + return (Success); + } + else if ((mode == SendCoreEvents) || (mode == DontSendCoreEvents)) + { + xf86XInputSetSendCoreEvents (pInfo, (mode == SendCoreEvents)); + return (Success); + } + else + return (!Success); +} + +/* + * The ConvertProc function may need to be tailored for your device. + * This function converts the device's valuator outputs to x and y coordinates + * to simulate mouse events. + */ +static Bool +ConvertProc (InputInfoPtr pInfo, + int first, + int num, + int v0, + int v1, + int v2, + int v3, + int v4, + int v5, + int *x, + int *y) +{ + DMCPrivatePtr priv = (DMCPrivatePtr) (pInfo->private); + + if (priv->reporting_mode == TS_Raw) + { + *x = xf86ScaleAxis (v0, 0, priv->screen_width, priv->min_x, + priv->max_x); + *y = xf86ScaleAxis (v1, 0, priv->screen_height, priv->min_y, + priv->max_y); + } + else + { + *x = v0; + *y = v1; + } + return (TRUE); +} + +/* + * the QueryHardware fuction should be tailored to your device to + * verify the device is attached and functional and perform any + * needed initialization. + */ +static Bool +QueryHardware (DMCPrivatePtr priv) +{ + /* Maybe once we get the hardware to actually respond correctly to its + configuration 'packets' */ + + return (Success); +} + +/* + * This function should be renamed for your device and tailored to handle + * your device's protocol. + */ +static Bool +DMCGetPacket (DMCPrivatePtr priv) +{ + int count = 0; + int c; + + while ((c = XisbRead (priv->buffer)) >= 0) + { + /* + * fail after 500 bytes so the server doesn't hang forever if a + * device sends bad data. + */ + if (count++ > 500) + return (!Success); + + switch (priv->lex_mode) + { + case DMC_byte0: + if ((( c & 0x3f ) != 0x11 ) && + (( c & 0x3f ) != 0x10 )) + return (!Success); + + priv->packet[0] = (unsigned char) c & 0x3f; + priv->lex_mode = DMC_byte1; + break; + + case DMC_byte1: + priv->packet[1] = (unsigned char) c; + priv->lex_mode = DMC_byte2; + break; + + case DMC_byte2: + priv->packet[2] = (unsigned char) c; + priv->lex_mode = DMC_byte3; + break; + + case DMC_byte3: + priv->packet[3] = (unsigned char) c; + priv->lex_mode = DMC_byte4; + break; + + case DMC_byte4: + priv->packet[4] = (unsigned char) c; + priv->lex_mode = DMC_byte0; + return (Success); + break; + + case DMC_Response0: + priv->packet[0] = (unsigned char) c; + return (Success); + break; + + } + } + return (!Success); +} + +static Bool +DMCSendPacket (DMCPrivatePtr priv, unsigned char *buf, int len) +{ + int count = 0; + + while ( len > 0 ) + { + if ( XisbWrite(priv->buffer, buf, 1) == 1 ) + { + buf++; + len--; + continue; + } + if ( count++ > 500 ) + break; + } + return (len ? !Success : Success); +} + +static void +DMCPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl) +{ + /* I have no clue what this does, except that registering it stops the + X server segfaulting in ProcGetPointerMapping() + Ho Hum. + */ +} Index: xc/programs/Xserver/hw/xfree86/input/dmc/xf86DMC.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/dmc/xf86DMC.h:1.1 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/dmc/xf86DMC.h Fri Aug 17 09:27:55 2001 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1999 Machine Vision Holdings Incorporated + * Author: Mayk Langer <langer@vsys.de> + * + * Template driver used: Copyright (c) 1998 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/dmc/xf86DMC.h,v 1.1 2001/08/17 13:27:55 dawes Exp $ */ + +#ifndef _DMC_H_ +#define _DMC_H_ + +/****************************************************************************** + * Definitions + * structs, typedefs, #defines, enums + *****************************************************************************/ + +#define DMC_PACKET_SIZE 5 + +typedef enum +{ + DMC_byte0, DMC_byte1, DMC_byte2, DMC_byte3, DMC_byte4, + DMC_Response0 +} +DMCState; + + +typedef struct _DMCPrivateRec +{ + int min_x; /* Minimum x reported by calibration */ + int max_x; /* Maximum x */ + int min_y; /* Minimum y reported by calibration */ + int max_y; /* Maximum y */ + Bool button_down; /* is the "button" currently down */ + int button_number; /* which button to report */ + int reporting_mode; /* TS_Raw or TS_Scaled */ + + int screen_num; /* Screen associated with the device */ + int screen_width; /* Width of the associated X screen */ + int screen_height; /* Height of the screen */ + int proximity; + int swap_xy; + XISBuffer *buffer; + unsigned char packet[DMC_PACKET_SIZE]; /* packet being/just read */ + DMCState lex_mode; + char pen_down; +} +DMCPrivateRec, *DMCPrivatePtr; + +/****************************************************************************** + * Declarations + *****************************************************************************/ + +static Bool DeviceControl (DeviceIntPtr, int); +static void ReadInput (InputInfoPtr); +static int ControlProc (InputInfoPtr, xDeviceCtl *); +static void CloseProc (InputInfoPtr); +static int SwitchMode (ClientPtr, DeviceIntPtr, int); +static Bool ConvertProc (InputInfoPtr, int, int, int, int, int, int, int, int, int *, int *); +static Bool QueryHardware (DMCPrivatePtr); +static Bool DMCGetPacket (DMCPrivatePtr priv); +static Bool DMCSendPacket (DMCPrivatePtr priv, unsigned char *buf, int len ); + +static InputInfoPtr +DMCPreInit(InputDriverPtr drv, IDevPtr dev, int flags); + +static void +DMCPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl); + + +#endif /* _DMC_H_ */ Index: xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c diff -u xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c:1.3 xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c:1.4 --- xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c:1.3 Fri Aug 11 15:10:43 2000 +++ xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c Mon Nov 26 11:25:53 2001 @@ -27,7 +27,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c,v 1.3 2000/08/11 19:10:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/xf86Dyna.c,v 1.4 2001/11/26 16:25:53 dawes Exp $ */ #define _DYNAPRO_C_ @@ -100,7 +100,6 @@ "xf86MotionHistoryAllocate", "xf86NameCmp", "xf86OpenSerial", - "xf86CloseSerial", "xf86OptionListCreate", "xf86OptionListMerge", "xf86OptionListReport", @@ -108,7 +107,6 @@ "xf86PostMotionEvent", "xf86PostProximityEvent", "xf86ProcessCommonOptions", - "xf86RemoveLocalDevice", "xf86ScaleAxis", "xf86SetIntOption", "xf86SetStrOption", Index: xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c diff -u xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c:1.10 xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c:1.11 --- xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c:1.10 Fri Aug 11 15:10:44 2000 +++ xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c Mon Nov 26 11:25:53 2001 @@ -48,7 +48,7 @@ * PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c,v 1.10 2000/08/11 19:10:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elo2300/elo.c,v 1.11 2001/11/26 16:25:53 dawes Exp $ */ #define _elo_C_ /***************************************************************************** @@ -115,8 +115,6 @@ EloPrivatePtr priv = (EloPrivatePtr) local->private; DeviceOff (local->dev); - - xf86RemoveLocalDevice (local); xf86CloseSerial (local->fd); XisbFree (priv->buffer); Index: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c diff -u xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c:1.13 xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c:1.14 --- xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c:1.13 Sun Apr 1 10:00:13 2001 +++ xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c Fri Aug 17 09:27:56 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.13 2001/04/01 14:00:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.14 2001/08/17 13:27:56 dawes Exp $ */ /* ******************************************************************************* @@ -1670,13 +1670,13 @@ xf86Msg(X_CONFIG, "Elographics untouch delay: %d ms\n", priv->untouch_delay*10); priv->report_delay = xf86SetIntOption(local->options, "ReportDelay", ELO_REPORT_DELAY); xf86Msg(X_CONFIG, "Elographics report delay: %d ms\n", priv->report_delay*10); - priv->max_x = xf86SetIntOption(local->options, "MaximumXPosition", 3000); + priv->max_x = xf86SetIntOption(local->options, "MaxX", 3000); xf86Msg(X_CONFIG, "Elographics maximum x position: %d\n", priv->max_x); - priv->min_x = xf86SetIntOption(local->options, "MinimumXPosition", 0); + priv->min_x = xf86SetIntOption(local->options, "MinX", 0); xf86Msg(X_CONFIG, "Elographics minimum x position: %d\n", priv->min_x); - priv->max_y = xf86SetIntOption(local->options, "MaximumYPosition", 3000); + priv->max_y = xf86SetIntOption(local->options, "MaxY", 3000); xf86Msg(X_CONFIG, "Elographics maximum y position: %d\n", priv->max_y); - priv->min_y = xf86SetIntOption(local->options, "MinimumYPosition", 0); + priv->min_y = xf86SetIntOption(local->options, "MinY", 0); xf86Msg(X_CONFIG, "Elographics minimum y position: %d\n", priv->min_y); priv->swap_axes = xf86SetBoolOption(local->options, "SwapXY", 0); if (priv->swap_axes) { Index: xc/programs/Xserver/hw/xfree86/input/hyperpen/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/hyperpen/Imakefile:1.2 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/hyperpen/Imakefile Wed Oct 10 16:59:25 2001 @@ -0,0 +1,30 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/hyperpen/Imakefile,v 1.2 2001/10/10 20:59:25 dawes Exp $ + +#define IHaveModules +#include <Server.tmpl> + +#if HasLinuxInput +DEFINES = -DLINUX_INPUT +#endif + +SRCS = xf86HyperPen.c +OBJS = xf86HyperPen.o + +DRIVER = hyperpen + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c:1.5 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c Wed Dec 26 16:51:58 2001 @@ -0,0 +1,1789 @@ +/* + * xf86HyperPen + * + * Based on the xf86Summa driver. + * + * Modified for the Aiptek HyperPen 6000 / Tevion MD 9310 + * (c) 2000 Roland Jansen <roland@lut.rwth-aachen.de> + * + * + * + * added button and 19200 bps stuff from the DigitalEdge driver on sourceforge + * (c) 2000 Christian Herzog <daduke@dataway.ch> + * + * + */ + +/* xf86Summa + * Copyright 1996 by Steven Lang <tiger@tyger.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Steven Lang not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. Steven Lang makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * STEVEN LANG DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL STEVEN LANG BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTIONS, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c,v 1.5 2001/12/26 21:51:58 dawes Exp $ */ + +#include <xf86Version.h> + +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) +#define XFREE86_V4 1 +#endif + +#ifdef XFREE86_V4 +/* post 3.9 headers */ + +#ifndef XFree86LOADER +#include <unistd.h> +#include <errno.h> +#endif + +#include <misc.h> +#include <xf86.h> +#define NEED_XF86_TYPES +#if !defined(DGUX) +#include <xf86_ansic.h> +#include <xisb.h> +#endif +#include <xf86_OSproc.h> +#include <xf86Xinput.h> +#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ +#include <keysym.h> +#include <mipointer.h> + +#ifdef XFree86LOADER +#include <xf86Module.h> +#endif + +#define wait_for_fd(fd) xf86WaitForInput((fd), 1000) +#define tcflush(fd, n) xf86FlushInput((fd)) +#undef read +#define read(a,b,c) xf86ReadSerial((a),(b),(c)) +#undef write +#define write(a,b,c) xf86WriteSerial((a),(char*)(b),(c)) +#undef close +#define close(a) xf86CloseSerial((a)) +#define XCONFIG_PROBED "(==)" +#define XCONFIG_GIVEN "(**)" +#define xf86Verbose 1 +#undef PRIVATE +#define PRIVATE(x) XI_PRIVATE(x) + +/* + * Be sure to set vmin appropriately for your device's protocol. You want to + * read a full packet before returning + */ + +static const char *default_options[] = +{ + "BaudRate", "9600", + "DataBits", "8", + "StopBits", "1", + "Parity", "Odd", + "FlowControl", "Xoff", + "VTime", "10", + "VMin", "7", + NULL +}; + +static InputDriverPtr hypDrv; + + +#else /* pre 3.9 headers */ + +#include "Xos.h" +#include <signal.h> +#include <stdio.h> + +#define NEED_EVENTS +#include "X.h" +#include "Xproto.h" +#include "misc.h" +#include "inputstr.h" +#include "scrnintstr.h" +#include "XI.h" +#include "XIproto.h" + +#if defined(sun) && !defined(i386) +#define POSIX_TTY +#include <errno.h> +#include <termio.h> +#include <fcntl.h> +#include <ctype.h> + +#include "extio.h" +#else +#include "compiler.h" + +#ifdef XFree86LOADER +#include "xf86_libc.h" +#endif +#include "xf86.h" +#include "xf86Procs.h" +#include "xf86_OSlib.h" +#include "xf86_Config.h" +#include "xf86Xinput.h" +#include "atKeynames.h" +#include "xf86Version.h" +#endif + +#if !defined(sun) || defined(i386) +#include "osdep.h" +#include "exevents.h" + +#include "extnsionst.h" +#include "extinit.h" +#endif + +#if defined(__QNX__) || defined(__QNXNTO__) +#define POSIX_TTY +#endif +#endif /* pre 3.9 headers */ + +/* +** Debugging macros +*/ +#ifdef DBG +#undef DBG +#endif +#ifdef DEBUG +#undef DEBUG +#endif + +#ifndef INI_DEBUG_LEVEL +#define INI_DEBUG_LEVEL 0 +#endif + +static int debug_level = INI_DEBUG_LEVEL; +#define DEBUG 1 +#if DEBUG +#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} +#else +#define DBG(lvl, f) +#endif + +/* +** Device records +*/ +#define ABSOLUTE_FLAG 1 +#define STYLUS_FLAG 2 +#define INVX_FLAG 4 +#define INVY_FLAG 8 +#define BAUD_19200_FLAG 16 + +int stylus; + +typedef struct +{ + char *hypDevice; /* device file name */ + int hypButTrans; /* button translation flags */ + int hypOldX; /* previous X position */ + int hypOldY; /* previous Y position */ + int hypOldZ; /* previous Z position */ + int hypOldProximity; /* previous proximity */ + int hypOldPush; /* previous buttons state */ + int hypOldButtons; /* previous buttons state */ + int hypOldBarrel; /* previous buttons state */ + int hypOldBarrel1; /* previous buttons state */ + int hypOldPressure; /* previous pen pressure */ + int hypMaxX; /* max X value */ + int hypMaxY; /* max Y value */ + int hypMaxZ; /* max Z value */ + int hypXSize; /* active area X size */ + int hypXOffset; /* active area X offset */ + int hypYSize; /* active area Y size */ + int hypYOffset; /* active area Y offset */ + int hypRes; /* resolution in lines per inch */ + int flags; /* various flags */ + int hypIndex; /* number of bytes read */ + int modelid; /* model id */ + int PT; /* pressure threshold */ + int AutoPT; /* automatically set PT*/ + int PMax; /* maximum pressure read from tablet */ + unsigned char hypData[7]; /* data read on the device */ +} HyperPenDeviceRec, *HyperPenDevicePtr; + +/* +** List of model IDs +*/ +static struct MODEL_ID { + unsigned id; + char* name; +} models[] = { + {0x32, "HyperPen 3000"}, + {0x43, "HyperPen 4000"}, + {0x54, "HyperPen 5000"}, + {0x64, "HyperPen 6000"}, + {0, NULL} +}; + +/* +** Configuration data +*/ +#define HYPERPEN_SECTION_NAME "HyperPen" + +#ifndef XFREE86_V4 + +#define PORT 1 +#define DEVICENAME 2 +#define THE_MODE 3 +#define CURSOR 4 +#define BORDER 5 +#define DEBUG_LEVEL 6 +#define HISTORY_SIZE 7 +#define ALWAYS_CORE 8 +#define ACTIVE_AREA 9 +#define ACTIVE_OFFSET 10 +#define INVX 11 +#define INVY 12 +#define BAUD_RATE 13 +#define PMIN 14 +#define PMAX 15 + +#if !defined(sun) || defined(i386) +static SymTabRec HypTab[] = { + {ENDSUBSECTION, "endsubsection"}, + {PORT, "port"}, + {DEVICENAME, "devicename"}, + {THE_MODE, "mode"}, + {CURSOR, "cursor"}, + {BORDER, "border"}, + {DEBUG_LEVEL, "debuglevel"}, + {HISTORY_SIZE, "historysize"}, + {ALWAYS_CORE, "alwayscore"}, + {ACTIVE_AREA, "activearea"}, + {ACTIVE_OFFSET, "activeoffset"}, + {INVX, "invx"}, + {INVY, "invy"}, + {BAUD_RATE, "baudrate"}, + {PMIN, "pmin"}, + {PMAX, "pmax"}, + {-1, ""} +}; + +#define RELATIVE 1 +#define ABSOLUTE 2 + +static SymTabRec HypModeTabRec[] = { + {RELATIVE, "relative"}, + {ABSOLUTE, "absolute"}, + {-1, ""} +}; + +#define PUCK 1 +#define STYLUS 2 + +static SymTabRec HypPointTabRec[] = { + {PUCK, "puck"}, + {STYLUS, "stylus"}, + {-1, ""} +}; + +#endif +#endif /* Pre 3.9 headers */ + +/* +** Contants and macro +*/ +#define BUFFER_SIZE 256 /* size of reception buffer */ +#define XI_NAME "HYPERPEN" /* X device name for the stylus */ + +#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) + + +#define SS_RESET "\0" /* Reset */ +#define SS_GETID "\5" /* Get Model ID */ +#define SS_CONFIG "a" /* Send configuration (max coords) */ +#define SS_PROMPT_MODE "D" /* Prompt mode */ +#define SS_STREAM_MODE "@" /* Stream mode */ +#define SS_RATE "µ" /* 19200 bps */ +#define SS_ABSOLUTE "F" /* absolute mode */ +#define SS_RELATIVE "E" /* relative mode */ +#define SS_MACROKEY "U" /* enable F-keys */ +#define SS_MACRO_4K "\2" /* start F-keys for Hyperpen 4000 */ +#define SS_MACRO_56K "\1" /* start F-keys for Hyperpen 5000/6000 */ +static const char * ss_initstr = SS_STREAM_MODE; + +#define PHASING_BIT 0x80 +#define PROXIMITY_BIT 0x40 +#define XSIGN_BIT 0x10 +#define YSIGN_BIT 0x08 +#define BUTTON_BITS 0x07 +#define COORD_BITS 0x7f +#define XAXIS_BITS 0x03 +#define YAXIS_BITS 0x0C +#define ZMASK_BIT 0x70 +#define TIP_BITS 0x01 +#define F_BIT 0x20 + + +/* macro from counts/inch to counts/meter */ +#define LPI2CPM(res) (res * 1000 / 25.4) + +/* +** External declarations +*/ + +#ifndef XFREE86_V4 + +#if defined(sun) && !defined(i386) +#define ENQUEUE suneqEnqueue +#else +#define ENQUEUE xf86eqEnqueue + +extern void xf86eqEnqueue( +#if NeedFunctionPrototypes + xEventPtr /*e */ +#endif + ); +#endif + +extern void miPointerDeltaCursor( +#if NeedFunctionPrototypes + int /*dx */ , + int /*dy */ , + unsigned long /*time */ +#endif + ); + + +#ifndef XFREE86_V4 +/* + *************************************************************************** + * + * set_serial_speed -- + * + * Set speed of the serial port. + * + *************************************************************************** + */ +static int +set_serial_speed(int fd, int speed_code) +{ + struct termios termios_tty; + int err; +#ifdef POSIX_TTY + SYSCALL(err = tcgetattr(fd, &termios_tty)); + if (err == -1) { + ErrorF("HyperPen tcgetattr error : %s\n", strerror(errno)); + return !Success; + } + termios_tty.c_iflag = IXOFF; + termios_tty.c_oflag = 0; + termios_tty.c_cflag = speed_code|CS8|CREAD|CLOCAL|HUPCL|PARENB|PARODD; + termios_tty.c_lflag = 0; + termios_tty.c_cc[VINTR] = 0; + termios_tty.c_cc[VQUIT] = 0; + termios_tty.c_cc[VERASE] = 0; + termios_tty.c_cc[VEOF] = 0; +#ifdef VWERASE + termios_tty.c_cc[VWERASE] = 0; +#endif +#ifdef VREPRINT + termios_tty.c_cc[VREPRINT] = 0; +#endif + termios_tty.c_cc[VKILL] = 0; + termios_tty.c_cc[VEOF] = 0; + termios_tty.c_cc[VEOL] = 0; +#ifdef VEOL2 + termios_tty.c_cc[VEOL2] = 0; +#endif + termios_tty.c_cc[VSUSP] = 0; +#ifdef VDSUSP + termios_tty.c_cc[VDSUSP] = 0; +#endif +#ifdef VDISCARD + termios_tty.c_cc[VDISCARD] = 0; +#endif +#ifdef VLNEXT + termios_tty.c_cc[VLNEXT] = 0; +#endif + /* minimum 1 character in one read call and timeout to 100 ms */ + termios_tty.c_cc[VMIN] = 1; + termios_tty.c_cc[VTIME] = 10; + SYSCALL(err = tcsetattr(fd, TCSANOW, &termios_tty)); + if (err == -1) { + ErrorF("HyperPen tcsetattr TCSANOW error : %s\n", strerror(errno)); + return !Success; + } +#else + Code for OSs without POSIX tty functions +#endif + return Success; +} +#endif /* Pre 3.9 stuff */ + +#if !defined(sun) || defined(i386) +/* +** xf86HypConfig +** Reads the HyperPen section from the XF86Config file +*/ +static Bool +xf86HypConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) +{ + LocalDevicePtr dev = array[inx]; + HyperPenDevicePtr priv = (HyperPenDevicePtr)(dev->private); + int token; + int mtoken; + + DBG(1, ErrorF("xf86HypConfig\n")); + + priv->AutoPT=1; + priv->PMax=1000; + + while ((token = xf86GetToken(HypTab)) != ENDSUBSECTION) { + switch(token) { + case DEVICENAME: + if (xf86GetToken(NULL) != STRING) + xf86ConfigError("Option string expected"); + else { + dev->name = strdup(val->str); + if (xf86Verbose) + ErrorF("%s HyperPen X device name is %s\n", XCONFIG_GIVEN, + dev->name); + } + break; + + case PORT: + if (xf86GetToken(NULL) != STRING) + xf86ConfigError("Option string expected"); + else { + priv->hypDevice = strdup(val->str); + if (xf86Verbose) + ErrorF("%s HyperPen port is %s\n", XCONFIG_GIVEN, + priv->hypDevice); + } + break; + + case THE_MODE: + mtoken = xf86GetToken(HypModeTabRec); + if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) + xf86ConfigError("Mode type token expected"); + else { + switch (mtoken) { + case ABSOLUTE: + priv->flags |= ABSOLUTE_FLAG; + break; + case RELATIVE: + priv->flags &= ~ABSOLUTE_FLAG; + break; + default: + xf86ConfigError("Illegal Mode type"); + break; + } + } + break; + + case CURSOR: + mtoken = xf86GetToken(HypPointTabRec); + if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) + xf86ConfigError("Cursor token expected"); + else { + switch (mtoken) { + case STYLUS: + priv->flags |= STYLUS_FLAG; + break; + case PUCK: + priv->flags &= ~STYLUS_FLAG; + break; + default: + xf86ConfigError("Illegal cursor type"); + break; + } + } + break; + + case DEBUG_LEVEL: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + debug_level = val->num; + if (xf86Verbose) { +#if DEBUG + ErrorF("%s HyperPen debug level set to %d\n", XCONFIG_GIVEN, + debug_level); +#else + ErrorF("%s HyperPen debug level not set to %d because" + " debugging is not compiled with the xf86HyperPen driver\n", XCONFIG_GIVEN, + debug_level); +#endif + } + break; + + case HISTORY_SIZE: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + dev->history_size = val->num; + if (xf86Verbose) + ErrorF("%s HyperPen Motion history size is %d\n", XCONFIG_GIVEN, + dev->history_size); + break; + + case ALWAYS_CORE: + xf86AlwaysCore(dev, TRUE); + if (xf86Verbose) + ErrorF("%s HyperPen device always stays core pointer\n", + XCONFIG_GIVEN); + break; + + case ACTIVE_AREA: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->hypXSize = val->realnum * 100; + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->hypYSize = val->realnum * 100; + if (xf86Verbose) + ErrorF("%s HyperPen active area: %d.%02dx%d.%02d" + " inches\n", XCONFIG_GIVEN, priv->hypXSize / 100, + priv->hypXSize % 100, priv->hypYSize / 100, + priv->hypYSize % 100); + break; + + case ACTIVE_OFFSET: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->hypXOffset = val->realnum * 100; + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->hypYOffset = val->realnum * 100; + if (xf86Verbose) + ErrorF("%s HyperPen active area offsets: %d.%02d %d.%02d" + " inches\n", XCONFIG_GIVEN, priv->hypXOffset / 100, + priv->hypXOffset % 100, priv->hypYOffset / 100, + priv->hypYOffset % 100); + break; + case INVX: + priv->flags |= INVX_FLAG; + break; + case INVY: + priv->flags |= INVY_FLAG; + break; + case BAUD_RATE: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + switch (val->num) { + case 19200: + priv->flags |= BAUD_19200_FLAG; + break; + case 9600: + priv->flags &= ~BAUD_19200_FLAG; + break; + default: + xf86ConfigError("Illegal speed value"); + break; + } + break; + case PMIN: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + if (val->num < 2) + xf86ConfigError("Illegal minimum pressure"); + else + { + priv->AutoPT = 0; /* desactivate auto threshold adjustment*/ + priv->PT = val->num; + }; + break; + case PMAX: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + if (val->num < 3) + xf86ConfigError("Illegal maximum pressure"); + else + priv->PMax = val->num; + break; + case EOF: + FatalError("Unexpected EOF (missing EndSubSection)"); + break; + + default: + xf86ConfigError("HyperPen subsection keyword expected"); + break; + } + } + + DBG(1, ErrorF("xf86HypConfig name=%s\n", priv->hypDevice)); + + return Success; +} +#endif +#endif /* pre 3.9 headers */ + +/* +** xf86HypConvert +** Convert valuators to X and Y. +*/ +static Bool +xf86HypConvert(LocalDevicePtr local, + int first, + int num, + int v0, + int v1, + int v2, + int v3, + int v4, + int v5, + int* x, + int* y) +{ + HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; + + if (first != 0 || num == 1) + return FALSE; + *x = (v0 * screenInfo.screens[0]->width) / priv->hypXSize; + *y = (v1 * screenInfo.screens[0]->height) / priv->hypYSize; + if (priv->flags & INVX_FLAG) + *x = screenInfo.screens[0]->width - *x; + if (*x < 0) + *x = 0; + if (priv->flags & INVY_FLAG) + *y = screenInfo.screens[0]->height - *y; + if (*y < 0) + *y = 0; + if (*x > screenInfo.screens[0]->width) + *x = screenInfo.screens[0]->width; + if (*y > screenInfo.screens[0]->height) + *y = screenInfo.screens[0]->height; + + + + return TRUE; +} + +/* +** xf86HypReverseConvert +** Convert X and Y to valuators. +*/ +static Bool +xf86HypReverseConvert(LocalDevicePtr local, + int x, + int y, + int *valuators) +{ + HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; + valuators[0] = ((x * priv->hypXSize) / screenInfo.screens[0]->width); + valuators[1] = ((y * priv->hypYSize) / screenInfo.screens[0]->height); + + + + return TRUE; +} + +/* +** xf86HypReadInput +** Reads from the HyperPen and posts any new events to the server. +*/ +static void +xf86HypReadInput(LocalDevicePtr local) +{ + HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; + int len, loop; + int is_core_pointer, is_absolute; + int f_keys, f_key, tip; + int x, y, bx, by, barrel, barrel1, prox, pressure, button, push; + int hw_pressure; + + DeviceIntPtr device; + unsigned char buffer[BUFFER_SIZE]; + + + + + SYSCALL(len = read(local->fd, buffer, sizeof(buffer))); + + if (len <= 0) { + Error("error reading HyperPen device"); + return; + } else { + + } + + for(loop=0; loop<len; loop++) { + + if ((priv->hypIndex == 0) && !(buffer[loop] & PHASING_BIT)) { /* magic bit is not OK */ + DBG(6, ErrorF("xf86HypReadInput bad magic number 0x%x\n", buffer[loop]));; + continue; + } + + priv->hypData[priv->hypIndex++] = buffer[loop]; + + if (priv->hypIndex == (priv->flags & ABSOLUTE_FLAG? 7 : 5)) { +/* the packet is OK */ +/* reset char count for next read */ + priv->hypIndex = 0; + + prox = (priv->hypData[0] & PROXIMITY_BIT)? 0: 1; + tip = (priv->hypData[0] & TIP_BITS)? 1:0; + button = (priv->hypData[0] & BUTTON_BITS); + + f_keys = (priv->hypData[0] & F_BIT); + pressure = (int) priv->hypData[6] + (((int) priv->hypData[5] & ZMASK_BIT) << 3); + + if ((tip==0) && (button==0) && (pressure>2) && (pressure != 1022)) {priv->flags |= STYLUS_FLAG; stylus=1;} else + if ((tip==0) && (button==0) && (pressure==0)) {priv->flags &= ~STYLUS_FLAG; stylus=0; pressure = 1019;} + +is_absolute = stylus; + + x = priv->hypData[1] + (priv->hypData[2] << 7) + ((priv->hypData[5] & XAXIS_BITS) << 14); + y = priv->hypData[3] + (priv->hypData[4] << 7) + ((priv->hypData[5] & YAXIS_BITS) << 12); + + if ((f_keys) && (tip)) (f_key = ((x >> 7) + 1) >> 1); else f_key =0; + + x -= priv->hypXOffset; + y = priv->hypYSize - y + priv->hypYOffset; + if (x < 0) x = 0; + if (y < 0) y = 0; + if (x > priv->hypXSize) x = priv->hypXSize; + if (y > priv->hypYSize) y = priv->hypYSize; + bx=x; + by=y; + + if (!is_absolute) { + x -= priv->hypOldX; + y -= priv->hypOldY; + } + + + + + + + hw_pressure=pressure; + + + if (!priv->PMax) priv->PMax=1000; + if (pressure>1020) pressure=priv->PT; + if (priv->AutoPT) + { + if ((pressure>1) && !(tip)) priv->PT = pressure; + pressure = 511 * (pressure - priv->PT - 10) / (priv->PMax - priv->PT); + } + else + { + pressure = 511 * (pressure - priv->PT) / (priv->PMax - priv->PT); + button &= ~1; + if (pressure>0) button |=1; + + }; + + + if (pressure > 511) pressure = 511; + if (pressure < 0) pressure = 0; + + + + push = button & 1; + barrel = button & 2; + barrel1 = button & 4; + + DBG(6, ErrorF("hw-press=%d\ttip=%d\tbarrel=%d\tbarrel1=%d\tpush=%d\tpressure=%d\tPT=%d\tbuttons=%d\tf-key=%d\n",hw_pressure, priv->hypData[0] & TIP_BITS, barrel, barrel1, push, pressure, priv->PT, priv->hypData[0] & BUTTON_BITS,f_key)); + + device = local->dev; + + + + + is_core_pointer = xf86IsCorePointer(device); + +/* coordonates are ready we can send events */ + + if ((prox) && !(f_keys)) { + if (!(priv->hypOldProximity)) + if (!is_core_pointer) + xf86PostProximityEvent(device, 1, 0, 3, x, y, pressure); + + if ((is_absolute && ((priv->hypOldX != x) || + (priv->hypOldY != y) || + (priv->hypOldZ != pressure))) + || (!is_absolute && (x || y))) { + if (is_absolute || priv->hypOldProximity) { + xf86PostMotionEvent(device, is_absolute, 0, 3, x, y, pressure); + } + } + + + + if (priv->hypOldBarrel1 != barrel1) { + int delta; + delta = barrel1 - priv->hypOldBarrel1; + if (priv->hypOldBarrel1 != barrel1) { + + + + xf86PostButtonEvent(device, is_absolute, 2, (delta > 0), 0, 3, x, y, pressure); + } + } + + if (priv->hypOldBarrel != barrel) { + int delta; + delta = barrel - priv->hypOldBarrel; + if (priv->hypOldBarrel != barrel) { + + xf86PostButtonEvent(device, is_absolute, 3, (delta > 0), 0, 3, x, y, pressure); + } + } + + if ((priv->hypOldPush != push) && !barrel && !barrel1) { + int delta; + delta = push - priv->hypOldPush; + if (priv->hypOldPush != push) { + + xf86PostButtonEvent(device, is_absolute, 1, (delta > 0), 0, 3, x, y, pressure); + } + } + + + priv->hypOldX = bx; + priv->hypOldY = by; + priv->hypOldPush = push; + priv->hypOldBarrel = barrel; + priv->hypOldBarrel1 = barrel1; + priv->hypOldProximity = prox; + + + } else { /* !PROXIMITY */ +/* Any changes in buttons are ignored when !proximity */ + if (!is_core_pointer) + if (priv->hypOldProximity) + xf86PostProximityEvent(device, 0, 0, 3, x, y, pressure); + priv->hypOldProximity = 0; + } + } + } + + +} + +/* +** xf86HypControlProc +** It really does do something. Honest! +*/ +static void +xf86HypControlProc(DeviceIntPtr device, PtrCtrl *ctrl) +{ + DBG(2, ErrorF("xf86HypControlProc\n")); +} + +/* +** xf86HypWriteAndRead +** Write data, and get the response. +*/ +static char * +xf86HypWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) +{ + int err, numread = 0; +#ifndef XFREE86_V4 + fd_set readfds; + struct timeval timeout; +#endif + + SYSCALL(err = write(fd, data, strlen(data))); + if (err == -1) { + Error("HyperPen write"); + return NULL; + } + +#ifndef XFREE86_V4 + FD_ZERO(&readfds); + FD_SET(fd, &readfds); +#endif + while (numread < len) { +#ifndef XFREE86_V4 + timeout.tv_sec = 0; + timeout.tv_usec = 100000; + + SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); +#else + err = xf86WaitForInput(fd, 100000); +#endif + if (err == -1) { + Error("HyperPen select"); + return NULL; + } + if (!err) { + ErrorF("Timeout while reading HyperPen tablet. No tablet connected ???\n"); + return NULL; + } + + SYSCALL(err = read(fd, buffer + numread++, 1)); + if (err == -1) { + Error("HyperPen read"); + return NULL; + } + if (!err) { + --numread; + break; + } + if (cr_term && buffer[numread - 1] == '\r') { + buffer[numread - 1] = 0; + break; + } + } + buffer[numread] = 0; + return buffer; +} + +/* +** xf86HypOpen +** Open and initialize the tablet, as well as probe for any needed data. +*/ + +#ifdef XFREE86_V4 +#define WAIT(t) \ + err = xf86WaitForInput(-1, ((t) * 1000)); \ + if (err == -1) { \ + ErrorF("HyperPen select error : %s\n", strerror(errno)); \ + return !Success; \ + } +#else +#define WAIT(t) \ + timeout.tv_sec = 0; \ + timeout.tv_usec = (t) * 1000; \ + SYSCALL(err = select(0, NULL, NULL, NULL, &timeout)); \ + if (err == -1) { \ + ErrorF("HyperPen select error : %s\n", strerror(errno)); \ + return !Success; \ + } +#endif + +static Bool +xf86HypOpen(LocalDevicePtr local) +{ +#ifndef XFREE86_V4 + struct termios termios_tty; + struct timeval timeout; +#endif + char buffer[256]; + int err, idx; + int i, n; + double res100; + double sratio, tratio; + HyperPenDevicePtr priv = (HyperPenDevicePtr)local->private; + + DBG(1, ErrorF("opening %s\n", priv->hypDevice)); + +#ifdef XFREE86_V4 + local->fd = xf86OpenSerial(local->options); +#else + SYSCALL(local->fd = open(priv->hypDevice, O_RDWR | O_NDELAY, 0)); +#endif + if (local->fd == -1) { + Error(priv->hypDevice); + return !Success; + } + DBG(2, ErrorF("%s opened as fd %d\n", priv->hypDevice, local->fd)); + +#ifdef XFREE86_V4 + if (xf86SetSerialSpeed(local->fd, 9600) < 0) + return !Success; +#else + if (set_serial_speed(local->fd, B9600) == !Success) + return !Success; +#endif + + DBG(1, ErrorF("initializing HyperPen tablet\n")); + +/* Send reset to the tablet */ + + write(local->fd, SS_RESET, strlen(SS_RESET)); + WAIT(1000); + +/* Put it in prompt mode so it doesn't say anything before we're ready */ + SYSCALL(err = write(local->fd, SS_PROMPT_MODE, strlen(SS_PROMPT_MODE))); + if (err == -1) { + Error("HyperPen write"); + return !Success; + } +/* Clear any pending input */ + tcflush(local->fd, TCIFLUSH); + + DBG(2, ErrorF("reading model\n")); + + if (!xf86HypWriteAndRead(local->fd, SS_GETID, buffer, 1, 0)) + return !Success; + + priv->modelid=buffer[0]; + + for (n = -1, i = 0; models[i].id != 0; i++) + if (models[i].id == priv->modelid) + n = i; + + if (xf86Verbose) + ErrorF("%s HyperPen Model: 0x%x (%s)\n", + XCONFIG_PROBED, priv->modelid, n==-1? "UNKNOWN":models[n].name); + + + /* enable F-Keys */ + SYSCALL(err = write(local->fd, SS_MACROKEY, strlen(SS_MACROKEY))); + if (err == -1) { + ErrorF("HyperPen write error : %s\n", strerror(errno)); + return !Success; + } + + DBG(6, ErrorF("prepared F-keys\n")); + + /* start sequence depends on model ID */ + if (priv->modelid == 0x43) SYSCALL(err = write(local->fd, SS_MACRO_4K, strlen(SS_MACRO_4K))); else SYSCALL(err = write(local->fd, SS_MACRO_56K, strlen(SS_MACRO_56K))); + + if (err == -1) { + ErrorF("HyperPen write error : %s\n", strerror(errno)); + return !Success; + } + + DBG(6, ErrorF("started F-keys\n")); + + + + priv->hypRes = 500; + res100 = priv->hypRes / 100; + + DBG(2, ErrorF("reading max coordinates\n")); + + if (!xf86HypWriteAndRead(local->fd, SS_CONFIG, buffer, 5, 0)) + return !Success; + + priv->hypMaxX = (buffer[1] & 0x7f) | (buffer[2] << 7); + priv->hypMaxY = (buffer[3] & 0x7f) | (buffer[4] << 7); + priv->hypMaxZ = 512; + +if (xf86Verbose) + ErrorF("%s HyperPen max tablet size %d.%02dinx%d.%02din, %dx%d " + "lines of resolution\n", XCONFIG_PROBED, + priv->hypMaxX / priv->hypRes, + (priv->hypMaxX * 100 / priv->hypRes) % 100, + priv->hypMaxY / priv->hypRes, + (priv->hypMaxY * 100 / priv->hypRes) % 100, + priv->hypMaxX, priv->hypMaxY); + + if (priv->hypXOffset >= 0 && priv->hypYOffset >= 0) { + priv->hypXOffset *= res100; + priv->hypYOffset *= res100; + priv->hypMaxX -= priv->hypXOffset; + priv->hypMaxY -= priv->hypYOffset; + } + + if (priv->hypXSize > 0 && priv->hypYSize > 0) { + if ((priv->hypXSize * res100) <= priv->hypMaxX && + (priv->hypYSize * res100) <= priv->hypMaxY) { + priv->hypXSize *= res100; + priv->hypYSize *= res100; + } else { + ErrorF("%s HyperPen active area bigger than tablet, " + "assuming maximum\n", XCONFIG_PROBED); + priv->hypXSize = priv->hypMaxX; + priv->hypYSize = priv->hypMaxY; + } + } else { + priv->hypXSize = priv->hypMaxX; + priv->hypYSize = priv->hypMaxY; + } + + /* map tablet area by screen aspect ratio */ + sratio = (double)screenInfo.screens[0]->height / + (double)screenInfo.screens[0]->width; + tratio = (double)priv->hypMaxY / (double)priv->hypMaxX; + + if (tratio <= 1.0) { /* tablet horizontal > vertical */ + priv->hypXSize = (double)priv->hypYSize / sratio; + if (priv->hypXSize > priv->hypMaxX) priv->hypXSize = priv->hypMaxX; + } + else { + priv->hypYSize = (double)priv->hypXSize / sratio; + if (priv->hypYSize > priv->hypMaxY) priv->hypYSize = priv->hypMaxY; + } + ErrorF("%s HyperPen using tablet area %d by %d, at res %d lpi\n", + XCONFIG_PROBED, priv->hypXSize, priv->hypYSize, priv->hypRes); + + if (priv->flags & BAUD_19200_FLAG) { +/* Send 19200 baud to the tablet */ + SYSCALL(err = write(local->fd, SS_RATE, strlen(SS_RATE))); + if (err == -1) { + ErrorF("HyperPen write error : %s\n", strerror(errno)); + return !Success; + } + + DBG(6, ErrorF("tablet set to 19200 bps\n")); + + + /* Wait 10 mSecs */ + WAIT(10); + + /* Set the speed of the serial link to 19200 */ +#ifdef XFREE86_V4 + if (xf86SetSerialSpeed(local->fd, 19200) < 0) { + return !Success; + } +#else + if (set_serial_speed(local->fd, B19200) == !Success) + return !Success; +#endif + + DBG(6, ErrorF("set serial speed to 19200\n")); + } + + + +/* Sets up the tablet mode to increment, stream, and such */ + for (idx = 0; ss_initstr[idx]; idx++) { + buffer[idx] = ss_initstr[idx]; + } + + buffer[idx] = 0; + + SYSCALL(err = write(local->fd, buffer, idx)); + + + + if (err == -1) { + Error("HyperPen write"); + return !Success; + } + + if (err <= 0) { + SYSCALL(close(local->fd)); + return !Success; + } + return Success; +} + +/* +** xf86HypOpenDevice +** Opens and initializes the device driver stuff or something. +*/ +static int +xf86HypOpenDevice(DeviceIntPtr pHyp) +{ + LocalDevicePtr local = (LocalDevicePtr)pHyp->public.devicePrivate; + HyperPenDevicePtr priv = (HyperPenDevicePtr)PRIVATE(pHyp); + + if (xf86HypOpen(local) != Success) { + if (local->fd >= 0) { + SYSCALL(close(local->fd)); + } + local->fd = -1; + } + +/* Set the real values */ + InitValuatorAxisStruct(pHyp, + 0, + 0, /* min val */ + priv->hypXSize, /* max val */ + LPI2CPM(priv->hypRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->hypRes)); /* max_res */ + InitValuatorAxisStruct(pHyp, + 1, + 0, /* min val */ + priv->hypYSize, /* max val */ + LPI2CPM(priv->hypRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->hypRes)); /* max_res */ + InitValuatorAxisStruct(pHyp, + 2, + 0, /* min val */ + 511, /* max val */ + 512, /* resolution */ + 0, /* min_res */ + 512); /* max_res */ + return (local->fd != -1); +} + +/* +** xf86HypProc +** Handle requests to do stuff to the driver. +*/ +static int +xf86HypProc(DeviceIntPtr pHyp, int what) +{ + CARD8 map[25]; + int nbaxes; + int nbbuttons; + int loop; + LocalDevicePtr local = (LocalDevicePtr)pHyp->public.devicePrivate; + HyperPenDevicePtr priv = (HyperPenDevicePtr)PRIVATE(pHyp); + + + + switch (what) { + case DEVICE_INIT: + DBG(1, ErrorF("xf86HypProc pHyp=0x%x what=INIT\n", pHyp)); + + nbaxes = 3; /* X, Y, Z */ + nbbuttons = (priv->flags & STYLUS_FLAG)? 3 : 4; + + for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop; + + if (InitButtonClassDeviceStruct(pHyp, + nbbuttons, + map) == FALSE) { + ErrorF("unable to allocate Button class device\n"); + return !Success; + } + + if (InitFocusClassDeviceStruct(pHyp) == FALSE) { + ErrorF("unable to init Focus class device\n"); + return !Success; + } + + if (InitPtrFeedbackClassDeviceStruct(pHyp, + xf86HypControlProc) == FALSE) { + ErrorF("unable to init ptr feedback\n"); + return !Success; + } + + if (InitProximityClassDeviceStruct(pHyp) == FALSE) { + ErrorF("unable to init proximity class device\n"); + return !Success; + } + + if (InitValuatorClassDeviceStruct(pHyp, + nbaxes, + xf86GetMotionEvents, + local->history_size, + (priv->flags & ABSOLUTE_FLAG)? Absolute: Relative) + == FALSE) { + ErrorF("unable to allocate Valuator class device\n"); + return !Success; + } +/* allocate the motion history buffer if needed */ + xf86MotionHistoryAllocate(local); +#ifndef XFREE86_V4 + AssignTypeAndName(pHyp, local->atom, local->name); +#endif +/* open the device to gather informations */ + xf86HypOpenDevice(pHyp); + break; + + case DEVICE_ON: + DBG(1, ErrorF("xf86HypProc pHyp=0x%x what=ON\n", pHyp)); + + if ((local->fd < 0) && (!xf86HypOpenDevice(pHyp))) { + return !Success; + } +#ifdef XFREE86_V4 + xf86AddEnabledDevice(local); +#else + AddEnabledDevice(local->fd); +#endif + pHyp->public.on = TRUE; + break; + + case DEVICE_OFF: + DBG(1, ErrorF("xf86HypProc pHyp=0x%x what=%s\n", pHyp, + (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); + if (local->fd >= 0) +#ifdef XFREE86_V4 + xf86RemoveEnabledDevice(local); +#else + RemoveEnabledDevice(local->fd); +#endif + pHyp->public.on = FALSE; + break; + + case DEVICE_CLOSE: + DBG(1, ErrorF("xf86HypProc pHyp=0x%x what=%s\n", pHyp, + (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); + SYSCALL(close(local->fd)); + local->fd = -1; + break; + + default: + ErrorF("unsupported mode=%d\n", what); + return !Success; + break; + } + DBG(2, ErrorF("END xf86HypProc Success what=%d dev=0x%x priv=0x%x\n", + what, pHyp, priv)); + return Success; +} + +/* +** xf86HypClose +** It... Uh... Closes the physical device? +*/ +static void +xf86HypClose(LocalDevicePtr local) +{ + if (local->fd >= 0) { + SYSCALL(close(local->fd)); + } + local->fd = -1; +} + +/* +** xf86HypChangeControl +** When I figure out what it does, it will do it. +*/ +static int +xf86HypChangeControl(LocalDevicePtr local, xDeviceCtl *control) +{ + xDeviceResolutionCtl *res; + + res = (xDeviceResolutionCtl *)control; + + if ((control->control != DEVICE_RESOLUTION) || + (res->num_valuators < 1)) + return (BadMatch); + + return(Success); +} + +/* +** xf86HypSwitchMode +** Switches the mode. For now just absolute or relative, hopefully +** more on the way. +*/ +static int +xf86HypSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) +{ + LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; + HyperPenDevicePtr priv = (HyperPenDevicePtr)(local->private); + char newmode; + + DBG(3, ErrorF("xf86HypSwitchMode dev=0x%x mode=%d\n", dev, mode)); + + switch(mode) { + case Absolute: + priv->flags |= ABSOLUTE_FLAG; + + break; + + case Relative: + priv->flags &= ~ABSOLUTE_FLAG; + + break; + + default: + DBG(1, ErrorF("xf86HypSwitchMode dev=0x%x invalid mode=%d\n", + dev, mode)); + return BadMatch; + } + SYSCALL(write(local->fd, &newmode, 1)); + return Success; +} + +/* +** xf86HypAllocate +** Allocates the device structures for the HyperPen. +*/ +static LocalDevicePtr +xf86HypAllocate(void) +{ +#ifdef XFREE86_V4 + LocalDevicePtr local = xf86AllocateInput(hypDrv, 0); +#else + LocalDevicePtr local = (LocalDevicePtr)xalloc(sizeof(LocalDeviceRec)); +#endif + HyperPenDevicePtr priv = (HyperPenDevicePtr)xalloc(sizeof(HyperPenDeviceRec)); +#if defined (sun) && !defined(i386) + char *dev_name = getenv("HYPERPEN_DEV"); +#endif + + local->name = XI_NAME; + local->type_name = "HyperPen Tablet"; + local->flags = 0; /*XI86_NO_OPEN_ON_INIT;*/ +#ifndef XFREE86_V4 +#if !defined(sun) || defined(i386) + local->device_config = xf86HypConfig; +#endif +#endif + local->device_control = xf86HypProc; + local->read_input = xf86HypReadInput; + local->control_proc = xf86HypChangeControl; + local->close_proc = xf86HypClose; + local->switch_mode = xf86HypSwitchMode; + local->conversion_proc = xf86HypConvert; + local->reverse_conversion_proc = xf86HypReverseConvert; + local->fd = -1; + local->atom = 0; + local->dev = NULL; + local->private = priv; + local->private_flags = 0; + local->history_size = 0; + +#if defined(sun) && !defined(i386) + if (dev_name) { + priv->hypDevice = (char *)xalloc(strlen(dev_name) + 1); + strcpy(priv->hypDevice, dev_name); + ErrorF("xf86HypOpen port changed to '%s'\n", priv->hypDevice); + } else { + priv->hypDevice = ""; + } +#else + priv->hypDevice = ""; /* device file name */ +#endif + priv->hypOldX = -1; /* previous X position */ + priv->hypOldY = -1; /* previous Y position */ + priv->hypOldProximity = 0; /* previous proximity */ + priv->hypOldButtons = 0; /* previous buttons state */ + priv->hypMaxX = -1; /* max X value */ + priv->hypMaxY = -1; /* max Y value */ + priv->hypXSize = -1; /* active area X */ + priv->hypXOffset = 0; /* active area X offset */ + priv->hypYSize = -1; /* active area Y */ + priv->hypYOffset = 0; /* active area Y offset */ + priv->flags = ABSOLUTE_FLAG; /* various flags -- default abs format */ + priv->hypIndex = 0; /* number of bytes read */ + priv->hypRes = 0; /* resolution */ + stylus=0; + + return local; +} + +#ifndef XFREE86_V4 + +/* +** HyperPen device association +** Device section name and allocation function. +*/ +DeviceAssocRec hypmasketch_assoc = +{ + HYPERPEN_SECTION_NAME, /* config_section_name */ + xf86HypAllocate /* device_allocate */ +}; + +#ifdef DYNAMIC_MODULE +/* +** init_module +** Entry point for dynamic module. +*/ +int +#ifndef DLSYM_BUG +init_module(unsigned long server_version) +#else +init_xf86HyperPen(unsigned long server_version) +#endif +{ + xf86AddDeviceAssoc(&hypmasketch_assoc); + + if (server_version != XF86_VERSION_CURRENT) { + ErrorF("Warning: HyperPen module compiled for version %s\n", + XF86_VERSION); + return 0; + } else { + return 1; + } +} +#endif + +#ifdef XFree86LOADER +/* + * Entry point for the loader code + */ +XF86ModuleVersionInfo xf86HyperPenVersion = { + "hyperpen", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 0x00010000, + {0,0,0,0} +}; + +void +xf86HyperPenModuleInit(data, magic) + pointer *data; + INT32 *magic; +{ + static int cnt = 0; + + switch (cnt) { + case 0: + *magic = MAGIC_VERSION; + *data = &xf86HyperPenVersion; + cnt++; + break; + + case 1: + *magic = MAGIC_ADD_XINPUT_DEVICE; + *data = &hypmasketch_assoc; + cnt++; + break; + + default: + *magic = MAGIC_DONE; + *data = NULL; + break; + } +} +#endif + +#else + +/* + * xf86HypUninit -- + * + * called when the driver is unloaded. + */ +static void +xf86HypUninit(InputDriverPtr drv, + LocalDevicePtr local, + int flags) +{ + HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; + + DBG(1, ErrorF("xf86HypUninit\n")); + + xf86HypProc(local->dev, DEVICE_OFF); + + xfree (priv); + xf86DeleteInput(local, 0); +} + + +/* + * xf86HypInit -- + * + * called when the module subsection is found in XF86Config + */ +static InputInfoPtr +xf86HypInit(InputDriverPtr drv, + IDevPtr dev, + int flags) +{ + LocalDevicePtr local = NULL; + HyperPenDevicePtr priv = NULL; + char *s; + + hypDrv = drv; + + local = xf86HypAllocate(); + local->conf_idev = dev; + + xf86CollectInputOptions(local, default_options, NULL); + xf86OptionListReport( local->options ); + + if (local) + priv = (HyperPenDevicePtr) local->private; + + if (!local || !priv) { + goto SetupProc_fail; + } + + local->name = dev->identifier; + + /* Serial Device is mandatory */ + priv->hypDevice = xf86FindOptionValue(local->options, "Device"); + + if (!priv->hypDevice) { + xf86Msg (X_ERROR, "%s: No Device specified.\n", dev->identifier); + goto SetupProc_fail; + } + + /* Process the common options. */ + xf86ProcessCommonOptions(local, local->options); + + /* Optional configuration */ + + xf86Msg(X_CONFIG, "%s serial device is %s\n", dev->identifier, + priv->hypDevice); + + debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); + if (debug_level > 0) { + xf86Msg(X_CONFIG, "%s: debug level set to %d\n", dev->identifier, debug_level); + } + + + + s = xf86FindOptionValue(local->options, "Mode"); + + if (s && (xf86NameCmp(s, "absolute") == 0)) { + priv->flags = priv->flags | ABSOLUTE_FLAG; + } + else if (s && (xf86NameCmp(s, "relative") == 0)) { + priv->flags = priv->flags & ~ABSOLUTE_FLAG; + } + else if (s) { + xf86Msg(X_ERROR, "%s: invalid Mode (should be absolute or relative). " + "Using default.\n", dev->identifier); + } + xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name, + (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); + + + s = xf86FindOptionValue(local->options, "Cursor"); + + if (s && (xf86NameCmp(s, "stylus") == 0)) { + priv->flags = priv->flags | STYLUS_FLAG; + } + else if (s && (xf86NameCmp(s, "puck") == 0)) { + priv->flags = priv->flags & ~STYLUS_FLAG; + } + else if (s) { + xf86Msg(X_ERROR, "%s: invalid Cursor (should be stylus or puck). " + "Using default.\n", dev->identifier); + } + xf86Msg(X_CONFIG, "%s is in cursor-mode %s\n", local->name, + (priv->flags & STYLUS_FLAG) ? "cursor" : "puck"); + + priv->hypXSize = xf86SetIntOption(local->options, "XSize", 0); + if (priv->hypXSize != 0) { + xf86Msg(X_CONFIG, "%s: XSize = %d\n", + dev->identifier, priv->hypXSize); + } + + priv->hypYSize = xf86SetIntOption(local->options, "YSize", 0); + if (priv->hypYSize != 0) { + xf86Msg(X_CONFIG, "%s: YSize = %d\n", + dev->identifier, priv->hypYSize); + } + + priv->PT = xf86SetIntOption(local->options, "PMin", 0); + if (priv->PT > 2) { + xf86Msg(X_CONFIG, "%s: PMin = %d\n", + dev->identifier, priv->PT); + } + else + xf86Msg(X_ERROR, "%s: invalid PMin value (should be > 2)." + "Using default.\n", dev->identifier); + + + priv->PMax = xf86SetIntOption(local->options, "PMax", 0); + if (priv->PMax > 3) { + xf86Msg(X_CONFIG, "%s: PMax = %d\n", + dev->identifier, priv->PMax); + } + else + xf86Msg(X_ERROR, "%s: invalid PMax value (should be > 3)." + "Using default.\n", dev->identifier); + + + priv->hypXOffset = xf86SetIntOption(local->options, "XOffset", 0); + if (priv->hypXOffset != 0) { + xf86Msg(X_CONFIG, "%s: XOffset = %d\n", + dev->identifier, priv->hypXOffset); + } + + priv->hypYOffset = xf86SetIntOption(local->options, "YOffset", 0); + if (priv->hypYOffset != 0) { + xf86Msg(X_CONFIG, "%s: YOffset = %d\n", + dev->identifier, priv->hypYOffset); + } + + if (xf86SetBoolOption(local->options, "InvX", FALSE)) { + priv->flags |= INVX_FLAG; + xf86Msg(X_CONFIG, "%s: InvX\n", dev->identifier); + } + + if (xf86SetBoolOption(local->options, "InvY", FALSE)) { + priv->flags |= INVY_FLAG; + xf86Msg(X_CONFIG, "%s: InvY\n", dev->identifier); + } + + { + int val; + val = xf86SetIntOption(local->options, "BaudRate", 0); + switch (val) { + case 19200: + priv->flags |= BAUD_19200_FLAG; + break; + case 9600: + priv->flags &= ~BAUD_19200_FLAG; + break; + default: + xf86Msg(X_CONFIG, "%s: Illegal speed value (must be 9600 or 19200)\n", dev->identifier); + break; + } + } + + /* mark the device configured */ + local->flags |= XI86_POINTER_CAPABLE | XI86_CONFIGURED; + + /* return the LocalDevice */ + return (local); + + SetupProc_fail: + if (priv) + xfree(priv); + if (local) + xfree(local); + return NULL; +} + +#ifdef XFree86LOADER +static +#endif +InputDriverRec HYPERPEN = { + 1, /* driver version */ + "hyperpen", /* driver name */ + NULL, /* identify */ + xf86HypInit, /* pre-init */ + xf86HypUninit, /* un-init */ + NULL, /* module */ + 0 /* ref count */ +}; + + +/* + *************************************************************************** + * + * Dynamic loading functions + * + *************************************************************************** + */ +#ifdef XFree86LOADER +/* + * xf86HypUnplug -- + * + * called when the module subsection is found in XF86Config + */ +static void +xf86HypUnplug(pointer p) +{ + DBG(1, ErrorF("xf86HypUnplug\n")); +} + +/* + * xf86HypPlug -- + * + * called when the module subsection is found in XF86Config + */ +static pointer +xf86HypPlug(pointer module, + pointer options, + int *errmaj, + int *errmin) +{ + DBG(1, ErrorF("xf86HypPlug\n")); + + xf86AddInputDriver(&HYPERPEN, module, 0); + + return module; +} + +static XF86ModuleVersionInfo xf86HypVersionRec = +{ + "hyperpen", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by */ + /* a tool */ +}; + +XF86ModuleData HyperPenModuleData = {&xf86HypVersionRec, + xf86HypPlug, + xf86HypUnplug}; + +#endif /* XFree86LOADER */ +#endif /* XFREE86_V4 */ + +/* end of xf86HyperPen.c */ Index: xc/programs/Xserver/hw/xfree86/input/joystick/xf86Jstk.c diff -u xc/programs/Xserver/hw/xfree86/input/joystick/xf86Jstk.c:1.4 xc/programs/Xserver/hw/xfree86/input/joystick/xf86Jstk.c:1.6 --- xc/programs/Xserver/hw/xfree86/input/joystick/xf86Jstk.c:1.4 Sun Jun 13 01:18:55 1999 +++ xc/programs/Xserver/hw/xfree86/input/joystick/xf86Jstk.c Wed Dec 26 16:51:59 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/joystick/xf86Jstk.c,v 1.4 1999/06/13 05:18:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/joystick/xf86Jstk.c,v 1.6 2001/12/26 21:51:59 dawes Exp $ */ #include <xf86Version.h> @@ -46,7 +46,6 @@ #include <xf86Module.h> #endif -#define sleep(t) xf86WaitForInput(-1, 1000 * (t)) #define wait_for_fd(fd) xf86WaitForInput((fd), 1000) #define tcflush(fd, n) xf86FlushInput((fd)) #undef read @@ -663,8 +662,6 @@ ErrorF("xf86JstckUnplug\n"); xf86JstkProc(local->dev, DEVICE_OFF); - - xf86RemoveLocalDevice(local); xfree (priv); xfree (local); Index: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c diff -u xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c:1.9 xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c:1.10 --- xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c:1.9 Sat Jun 5 11:55:25 1999 +++ xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c Mon Nov 26 11:25:53 2001 @@ -24,7 +24,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c,v 1.9 1999/06/05 15:55:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/magellan/magellan.c,v 1.10 2001/11/26 16:25:53 dawes Exp $ */ #define _MAGELLAN_C_ /***************************************************************************** @@ -99,8 +99,6 @@ MagellanPrivatePtr priv = (MagellanPrivatePtr) local->private; DeviceOff (local->dev); - - xf86RemoveLocalDevice (local); xf86CloseSerial (local->fd); XisbFree (priv->buffer); Index: xc/programs/Xserver/hw/xfree86/input/magictouch/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/magictouch/Imakefile:1.1 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/magictouch/Imakefile Tue Jul 3 11:13:57 2001 @@ -0,0 +1,30 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/magictouch/Imakefile,v 1.1 2001/07/03 15:13:57 paulo Exp $ + +#define IHaveModules +#include <Server.tmpl> + +SRCS = xf86MagicTouch.c +OBJS = xf86MagicTouch.o + +DRIVER = magictouch + +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget($(DRIVER),$(OBJS)) + +InstallObjectModule($(DRIVER),$(MODULEDIR),input) + +#if !defined(XF86DriverSDK) +InstallModuleManPage($(DRIVER)) +#endif + +DependTarget() + +InstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) Index: xc/programs/Xserver/hw/xfree86/input/magictouch/magictouch.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/magictouch/magictouch.man:1.1 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/magictouch/magictouch.man Tue Jul 3 11:13:57 2001 @@ -0,0 +1,25 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/magictouch/magictouch.man,v 1.1 2001/07/03 15:13:57 paulo 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 \*qmagictouch\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B magictouch +is an XFree86 input driver. +.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__), xf86cfg(1), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... Index: xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c:1.2 --- /dev/null Fri Jan 18 15:25:53 2002 +++ xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c Wed Jul 4 09:38:09 2001 @@ -0,0 +1,1107 @@ +/* + * $XFree86: xc/programs/Xserver/hw/xfree86/input/magictouch/xf86MagicTouch.c,v 1.2 2001/07/04 13:38:09 tsi Exp $ + */ + +#include <xf86Version.h> +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) +#define XFREE86_V4 +#endif + +#ifdef XFREE86_V4 + +#ifndef XFree86LOADER +#include <errno.h> +#include <string.h> +#include <unistd.h> +#endif + +#include <misc.h> +#include <xf86.h> +#if !defined(DGUX) +#include <xf86_ansic.h> +#endif +#include <xf86_OSproc.h> +#include <xf86Xinput.h> +#include <exevents.h> + +#ifdef XFree86LOADER +#include <xf86Module.h> +#endif + +#else /* XFREE86_V4 */ + +#include "Xos.h" +#include <signal.h> +#include <stdio.h> +#define NEED_EVENTS +#include "X.h" +#include "Xproto.h" +#include "inputstr.h" +#include "scrnintstr.h" + +#include "XI.h" +#include "XIproto.h" + +#if defined(sun) && !defined(i386) +#include <errno.h> +#include <termio.h> +#include <fcntl.h> +#include <ctype.h> + +#include "extio.h" +#else /* defined(sun) && !defined(i386) */ +#include "compiler.h" + +#include "xf86.h" +#include "xf86Procs.h" +#include "xf86_OSlib.h" +#include "xf86_Config.h" +#include "xf86Xinput.h" +#include "xf86Version.h" +#endif /* defined(sun) && !defined(i386) */ + +#if !defined(sun) || defined(i386) +#include "os.h" +#include "osdep.h" +#include "exevents.h" + +#include "extnsionst.h" +#include "extinit.h" +#endif /* !defined(sun) || defined(i386) */ + +#endif /* XFREE86_V4 */ + + +#ifndef XFREE86_V4 +#if !defined(sun) || defined(i386) +/* + *************************************************************************** + * + * Configuration descriptor. + * + *************************************************************************** + */ + +#define PORT 1 +#define MAGIC_DEVICE_NAME 2 +#define SCREEN_NO 3 +#define MAXX 4 +#define MAXY 5 +#define MINX 6 +#define MINY 7 +#define DEBUG_LEVEL 8 +#define HISTORY_SIZE 9 +#define LINK_SPEED 10 +#define ALWAYS_CORE 11 +#define SWAP_AXES 12 +#define N_SAMPLE_X 13 +#define N_SAMPLE_Y 14 + +static SymTabRec MagicTab[] = { + { ENDSUBSECTION, "endsubsection" }, + { PORT, "port" }, + { MAGIC_DEVICE_NAME, "devicename" }, + { SCREEN_NO, "screenno" }, + { MAXX, "maximumxposition" }, + { MAXY, "maximumyposition" }, + { MINX, "minimumxposition" }, + { MINY, "minimumyposition" }, + { DEBUG_LEVEL, "debuglevel" }, + { HISTORY_SIZE, "historysize" }, + { LINK_SPEED, "linkspeed" }, + { ALWAYS_CORE, "alwayscore" }, + { SWAP_AXES, "swapxy" }, + { N_SAMPLE_X, "numsamplex" }, + { N_SAMPLE_Y, "numsampley" }, + { -1, "" }, +}; + + +#define LS1200 1 +#define LS2400 2 +#define LS4800 3 +#define LS9600 4 + +static SymTabRec LinkSpeedTab[] = { + { LS1200, "b1200" }, + { LS2400, "b2400" }, + { LS4800, "b4800" }, + { LS9600, "b9600" } +}; +#endif /* !defined(sun) || defined(i386) */ + +/* + * This struct connects a line speed with + * a compatible motion packet delay. The + * driver will attempt to enforce a correct + * delay (according to this table) in order to + * avoid losing data in the touchscreen controller. + * LinkSpeedValues should be kept in sync with + * LinkSpeedTab. + */ +typedef struct { + int speed; + int delay; +} LinkParameterStruct; + +static LinkParameterStruct LinkSpeedValues[] = { + { B1200, 8 }, + { B2400, 4 }, + { B4800, 2 }, + { B9600, 1 } +}; +#endif /* XFREE86_V4 */ + + +/* + *************************************************************************** + * + * Default constants. + * + *************************************************************************** + */ +#define MAGIC_PACKET_SIZE 5 +#define MAGIC_PORT "/dev/magictouch" +#define MAGIC_LINK_SPEED B9600 + +/* First byte of the packet */ +#define MGCT_TOUCH 0x01 +#define MGCT_RKEY 0x02 +#define MGCT_LKEY 0x04 +#define MGCT_MKEY 0x08 +#define MGCT_CLICK_STATUS 0x10 + +#define MEDIE_X 20 +#define MEDIE_Y 20 + + +/* + *************************************************************************** + * + * Usefull macros. + * + *************************************************************************** + */ +#define WORD_ASSEMBLY(byte1, byte2) (((byte2) << 8) | (byte1)) +#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) + +/* This one is handy, thanx Fred ! */ +#ifdef DBG +#undef DBG +#endif +#ifdef DEBUG +#undef DEBUG +#endif + +static int debug_level = 0; +#define DEBUG 1 +#if DEBUG +#define DBG(lvl, f) {if ((lvl) == debug_level) { f; } } +#else +#define DBG(lvl, f) +#endif + + +#ifdef XFREE86_V4 +#undef SYSCALL +#undef read +#undef write +#undef close +#undef strdup +#define SYSCALL(call) call +#define read(fd, ptr, num) xf86ReadSerial(fd, ptr, num) +#define write(fd, ptr, num) xf86WriteSerial(fd, ptr, num) +#define close(fd) xf86CloseSerial(fd) +#define strdup(str) xf86strdup(str) +#endif + + + + + + +/* + *************************************************************************** + * + * Device private records. + * + *************************************************************************** + */ +typedef struct _MagicPrivateRec { + char *input_dev; /* The touchscreen input tty */ + int min_x; /* Minimum x reported by calibration */ + int max_x; /* Maximum x */ + int min_y; /* Minimum y reported by calibration */ + int max_y; /* Maximum y */ +#ifndef XFREE86_V4 + int link_speed; /* Speed of the RS232 link connecting the ts. */ +#endif + int screen_no; /* Screen associated with the device */ + int screen_width; /* Width of the associated X screen */ + int screen_height; /* Height of the screen */ + int swap_axes; /* Swap X an Y axes if != 0 */ + unsigned char packet_buf[MAGIC_PACKET_SIZE]; /* Assembly buffer */ + int packet_pos; + int buf_x[MEDIE_X], i_x, num_medie_x; + int buf_y[MEDIE_Y], i_y, num_medie_y; + Bool first_x, first_y; + Bool first_entry; + Bool e_presente; + Bool click_on; +} MagicPrivateRec, *MagicPrivatePtr; + + +#ifndef XFREE86_V4 +#if !defined(sun) || defined(i386) +/* + **************************************************************************** + * xf86MagicConfig -- + * Configure the device driver from configuration data + **************************************************************************** + */ +static Bool +xf86MagicConfig(LocalDevicePtr *array, + int inx, + int max, + LexPtr val) +{ + LocalDevicePtr local = array[inx]; + MagicPrivatePtr priv = (MagicPrivatePtr)(local->private); + int token; + + while ((token = xf86GetToken(MagicTab)) != ENDSUBSECTION) { + switch(token) { + + case PORT: + if (xf86GetToken(NULL) != STRING) { + xf86ConfigError("MagicTouch input port expected"); + } + priv->input_dev = strdup(val->str); + if (xf86Verbose) { + ErrorF("%s MagicTouch input port: %s\n", + XCONFIG_GIVEN, priv->input_dev); + } + break; + + case MAGIC_DEVICE_NAME: + if (xf86GetToken(NULL) != STRING) { + xf86ConfigError("Magictouch device name expected"); + } + local->name = strdup(val->str); + if (xf86Verbose) { + ErrorF("%s MagicTouch X device name: %s\n", + XCONFIG_GIVEN, local->name); + } + break; + + case SCREEN_NO: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch screen number expected"); + } + priv->screen_no = val->num; + if (xf86Verbose) { + ErrorF("%s MagicTouch associated screen: %d\n", + XCONFIG_GIVEN, priv->screen_no); + } + break; + + case LINK_SPEED: + { + int ltoken = xf86GetToken(LinkSpeedTab); + if (ltoken == EOF || + ltoken == STRING || + ltoken == NUMBER) { + xf86ConfigError("MagicTouch link speed expected"); + } + priv->link_speed = LinkSpeedValues[ltoken-1].speed; + if (xf86Verbose) { + ErrorF("%s MagicTouch link speed: %s bps\n", + XCONFIG_GIVEN, (LinkSpeedTab[ltoken-1].name)+1); + } + } + break; + + case MAXX: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch maximum x position expected"); + } + priv->max_x = val->num; + if (xf86Verbose) { + ErrorF("%s MagicTouch maximum x position: %d\n", + XCONFIG_GIVEN, priv->max_x); + } + break; + + case MAXY: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch maximum y position expected"); + } + priv->max_y = val->num; + if (xf86Verbose) { + ErrorF("%s MagicTouch maximum y position: %d\n", + XCONFIG_GIVEN, priv->max_y); + } + break; + + case MINX: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch minimum x position expected"); + } + priv->min_x = val->num; + if (xf86Verbose) { + ErrorF("%s MagicTouch minimum x position: %d\n", + XCONFIG_GIVEN, priv->min_x); + } + break; + + case MINY: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch minimum y position expected"); + } + priv->min_y = val->num; + if (xf86Verbose) { + ErrorF("%s MagicTouch minimum y position: %d\n", + XCONFIG_GIVEN, priv->min_y); + } + break; + + case DEBUG_LEVEL: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch driver debug level expected"); + } + debug_level = val->num; + if (xf86Verbose) { +#if DEBUG + ErrorF("%s MagicTouch debug level sets to %d\n", XCONFIG_GIVEN, + debug_level); +#else + ErrorF("%s MagicTouch debug not available\n", + XCONFIG_GIVEN, debug_level); +#endif + } + break; + + case HISTORY_SIZE: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch motion history size expected"); + } + local->history_size = val->num; + if (xf86Verbose) { + ErrorF("%s MagicTouch motion history size is %d\n", XCONFIG_GIVEN, + local->history_size); + } + break; + + case ALWAYS_CORE: + xf86AlwaysCore(local, TRUE); + if (xf86Verbose) { + ErrorF("%s MagicTouch device will always stays core pointer\n", + XCONFIG_GIVEN); + } + break; + + case SWAP_AXES: + priv->swap_axes = 1; + if (xf86Verbose) { + ErrorF("%s MagicTouch device will work with X and Y axes swapped\n", + XCONFIG_GIVEN); + } + break; + + case N_SAMPLE_X: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch driver NumSamplesX expected"); + } + priv->num_medie_x = val->num; + + + if (priv->num_medie_x>MEDIE_X) + priv->num_medie_x=MEDIE_X; + + DBG(4, + ErrorF("NumSampleX = %d\n", priv->num_medie_x) + ); + + break; + + case N_SAMPLE_Y: + if (xf86GetToken(NULL) != NUMBER) { + xf86ConfigError("MagicTouch driver NumSamplesY expected"); + } + priv->num_medie_y = val->num; + + if (priv->num_medie_y>MEDIE_Y) + priv->num_medie_y=MEDIE_Y; + + DBG(4, + ErrorF("NumSampleY = %d\n", priv->num_medie_y) + ); + break; + + case EOF: + FatalError("Unexpected EOF (missing EndSubSection)"); + break; + + default: + xf86ConfigError("MagicTouch subsection keyword expected"); + break; + } + } + + if (priv->max_x - priv->min_x <= 0) { + ErrorF("%s MagicTouch: reverse x mode (minimum x position >= maximum x position)\n", + XCONFIG_GIVEN); + } + if (priv->max_y - priv->min_y <= 0) { + ErrorF("%s MagicTouch: reverse y mode (minimum y position >= maximum y position)\n", + XCONFIG_GIVEN); + } + + DBG(2, ErrorF("xf86MagicConfig port name=%s\n", priv->input_dev)) + + return Success; +} + +#endif /* !defined(sun) || defined(i386) */ +#endif /* XFREE86_V4 */ + +/**************************************************************************** + * + * xf86MagicQueryOK -- + * Testa la presenza del touch controller. + * Si osserva che al primo accesso al touch dopo l'accensione e' + * presente nel buffer di ricezione il codice 0xF che identifica la + * vera presenza del touch controller. + * Dal secondo accesso in poi bisogna interrogare il touch controller + * per verificarne l'esistenza. + **************************************************************************** + */ +static Bool +xf86MagicQueryOK(int fd) +{ + Bool ok; + int result; + char buf; + + ok = Success; + + /* Provo a leggere un byte dal buffer di ricezione */ + SYSCALL( result = read(fd, &buf, 1) ); + + DBG(4, ErrorF("<<%s[%d]>> QueryOK: read --> %d\n", __FILE__, __LINE__, result) ); + + /* Se result e' -1 vuol dire che non c'e' nessun carattere nel + buffer. Allora X/Window e' stato avviato almeno una volta */ + if (result<0) { + DBG(4, + ErrorF("Avvio n-esimo di X/Windows\n"); + ErrorF("Controllo presenza Touch Controller\n") + ); + + /* Cerco il touch controller. Invio il carattere 0x00. */ + buf = 0; + SYSCALL( result = write(fd, &buf, 1) ); + + /* Attendo 20 ms per dare il tempo al touch controller di + capire il comando */ + usleep(20000); + + /* Leggo la risposta */ + SYSCALL( result = read(fd, &buf, 1) ); + + DBG(4, + ErrorF("QueryOK: buf==%X, result==%d\n", buf, result) + ); + } + + /* Se result<0 allora il touch controller non e' presente sul + disposito. Non posso proseguire */ + if (result<0) { + DBG(4, + ErrorF("<<%s[%d]>> result<0\n", __FILE__, __LINE__) + ); + ok = !Success; + } + /* Se il touch controller ha risposto allora controllo cosa ha + risposto */ + else { + ok = (buf==0xF ? Success : !Success); + DBG(4, + ErrorF("<<%s[%d]>> QueryOK buf==%x\n", __FILE__, __LINE__, buf) + ); + } + + return ok; +} + +/* + *********************************************************************** + * + * xf86MagicControl + * + *********************************************************************** + */ +static Bool +xf86MagicControl(DeviceIntPtr dev, + int mode) +{ + LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; + MagicPrivatePtr priv = (MagicPrivatePtr)(local->private); + unsigned char map[] = { 0, 1 }; + unsigned char req[MAGIC_PACKET_SIZE], replay[MAGIC_PACKET_SIZE]; + int status_line; + + switch (mode) { + case DEVICE_INIT: + DBG(2, ErrorF("MagicTouch init...\n") ); + + /* Controlla il numero di schermo selezionato */ + if (priv->screen_no >= screenInfo.numScreens || priv->screen_no<0) + priv->screen_no = 0; + /* Legge le dimensioni dello schermo */ + priv->screen_width = screenInfo.screens[priv->screen_no]->width; + priv->screen_height = screenInfo.screens[priv->screen_no]->height; + + if (InitButtonClassDeviceStruct(dev, 1, map)==FALSE) { + ErrorF("Impossibile allocare ButtonClassDeviceStruct per MagicTouch\n"); + return !Success; + } + + if (InitFocusClassDeviceStruct(dev)==FALSE) { + ErrorF("Impossibile allocare FocusClassDeviceStruct per MagicTouch\n"); + return !Success; + } + + /* + * Il movimento viene eseguito su due assi in coordinate assolute. + */ + if (InitValuatorClassDeviceStruct(dev, 2, xf86GetMotionEvents, local->history_size, Absolute) == FALSE ) + { + ErrorF("MagicTouch ValuatorClassDeviceStruct: ERRORE\n"); + return !Success; + } + else { + InitValuatorAxisStruct(dev, 0, priv->min_x, priv->max_x, + 9500, + 0, /* min res */ + 9500 /* max res */); + + InitValuatorAxisStruct(dev, 1, priv->min_y, priv->max_y, + 10500, + 0, + 10500); + } + + if (InitFocusClassDeviceStruct(dev)==FALSE) { + ErrorF("Impossibile allocare FocusClassDeviceStruct per MagicTouch\n"); + } + + /* + * Alloca il buffer degli eventi spostamento + */ + xf86MotionHistoryAllocate(local); + + #ifndef XFREE86_V4 + AssignTypeAndName(dev, local->atom, local->name); + #endif /* XFREE86_V4 */ + + DBG(2, ErrorF("MagicTouch INIT OK\n") ); + + break; /* DEVICE_INIT*/ + + case DEVICE_ON: + DBG(2, ErrorF("MagicTouch ON\n") ); + if (local->fd<0) { + #ifndef XFREE86_V4 + struct termios termios_tty; + int i,result; + #endif + + DBG(2, ErrorF("Opening device...\n") ); + + #ifdef XFREE86_V4 + local->fd = xf86OpenSerial(local->options); + if (local->fd<0) { + ErrorF("Impossibile aprire MagicTouch\n"); + return !Success; + } + #else + SYSCALL( local->fd = open(priv->input_dev, O_RDWR | O_NDELAY, 0) ); + if (local->fd<0) { + Error("Impossibile aprire MagicTouch\n"); + return !Success; + } + + DBG(3, ErrorF("Provo a configurare il MagicTouch\n") ); + + + memset(&termios_tty, 0, sizeof(termios_tty) ); + termios_tty.c_iflag = 0; + termios_tty.c_cflag = priv->link_speed | CS8 | CREAD | CLOCAL; + termios_tty.c_oflag = 0; + termios_tty.c_lflag = 0; + termios_tty.c_cc[VTIME]=0; + termios_tty.c_cc[VMIN]=1; + + /* + * Attivo l'RTS per abilitare il touch controller + */ + #if 0 + SYSCALL( result = ioctl(local->fd, TIOCMGET, &status_line) ); + if (result<0) + { + Error("Impossibile leggere stato linee seriale\n"); + close(local->fd); + return !Success; + } + status_line |= TIOCM_RTS; + SYSCALL( result = ioctl(local->fd, TIOCMSET, &status_line) ); + if (result<0) + { + Error("Impossibile settare stato linee seriale\n"); + close(local->fd); + return !Success; + } + #endif + + SYSCALL( result = tcsetattr(local->fd, TCSANOW, &termios_tty) ); + if (result<0) + { + Error("Impossibile configurare MagicTouch\n"); + close(local->fd); + return !Success; + } + #endif + + + /* Controlla se e' presente il touch controller.*/ + req[0] = 0x00; + if (xf86MagicQueryOK(local->fd)!=Success) { + ErrorF("MagicTouch not present\n"); + close(local->fd); + return !Success; + } + + priv->e_presente = TRUE; + + AddEnabledDevice(local->fd); + dev->public.on = TRUE; + } /* if (local->fd<0) */ + break; /* DEVICE_ON */ + + case DEVICE_CLOSE: + case DEVICE_OFF: + DBG(2, ErrorF("MagicTouch OFF\n") ); + dev->public.on = FALSE; + if (local->fd>=0) + emoveEnabledDevice(local->fd); + + SYSCALL( close(local->fd) ); + local->fd = -1; + DBG(2, ErrorF("OK\n") ); + break; /* DEVICE_OFF*/ + + default: + ErrorF("unsupported mode %d\n", mode); + return !Success; + } /* switch (mode) */ + + return Success; +} + + + +/* + *************************************************************************** + * + * GetPacket -- + * + *************************************************************************** + */ +static Bool +GetPacket(LocalDevicePtr local, unsigned char *buffer, int *n_rx, int fd) +{ + int num_bytes; + int i; + Bool ok; + MagicPrivatePtr priv=(MagicPrivatePtr) local->private; + + DBG(6, ErrorF("Entering GetPacket with packet_pos == %d\n", *n_rx) ); + + SYSCALL( + num_bytes=read(fd, buffer+*n_rx, MAGIC_PACKET_SIZE-*n_rx) + ); + + /* Se e' il primo ingresso nella procedura e ho letto un solo byte, + allora e' arrivato lo 0x0F di risposta all-inizializzazione del + touch controlloer */ + /* Sto gia' leggendo un pacchetto normale */ + *n_rx += num_bytes; + + DBG(8, + for (i=0; i<*n_rx; i++) + ErrorF("%3X", buffer[i]); + ErrorF("\n") + ); + + ok = (*n_rx==MAGIC_PACKET_SIZE ? Success : !Success ); + + if (ok==Success) + *n_rx = 0; + + DBG(6, + if(ok==Success) + ErrorF("GetPacket OK\n"); + else + ErrorF("GetPacket FAIL\n") + ); + + return ok; +} + +/* + ************************************************************************ + * + * xf86MagicReadInput + * + ************************************************************************ + */ +static +int medie_x(LocalDevicePtr local, int x) +{ + int i,res; + float medie; + MagicPrivatePtr priv = (MagicPrivatePtr)(local->private); + + DBG(6, + ErrorF("Medie in X = %d\n", priv->num_medie_x) + ); + + if (priv->first_x) { + priv->first_x = FALSE; + for (i=0; i<priv->num_medie_x; i++) + priv->buf_x[i] = x; + + res = x; + } + else { + priv->buf_x[priv->i_x] = x; + priv->i_x++; + if (priv->i_x>=priv->num_medie_x) + priv->i_x = 0; + + medie = 0.0; + for (i=0; i<priv->num_medie_x; i++) + medie += priv->buf_x[i]; + + res = (int)(medie/priv->num_medie_x); + } + + return res; +} + +static +int medie_y(LocalDevicePtr local, int y) +{ + int i,res; + float medie; + MagicPrivatePtr priv = (MagicPrivatePtr)(local->private); + + DBG(6, + ErrorF("Medie in Y = %d\n", priv->num_medie_y) + ); + + if (priv->first_y) { + priv->first_y = FALSE; + for (i=0; i<priv->num_medie_y; i++) + priv->buf_y[i] = y; + + res = y; + } + else { + priv->buf_y[priv->i_y] = y; + priv->i_y++; + if (priv->i_y>=priv->num_medie_y) + priv->i_y = 0; + + medie = 0.0; + for (i=0; i<priv->num_medie_y; i++) + medie += priv->buf_y[i]; + + res = (int)(medie/priv->num_medie_y); + } + + return res; +} + +/* +static +int MAX(int x, int y) +{ + return (x>=y ? x : y); +} +*/ + +#define MAX(x,y) (x>=y ? x : y) + +static void +xf86MagicReadInput(LocalDevicePtr local) +{ + MagicPrivatePtr priv = (MagicPrivatePtr)(local->private); + int cur_x, cur_y; + Bool touch_now; + static int n_coms = 0; + + if (!priv->e_presente) { + DBG(4, + ErrorF("<<%s[%d]>> ReadInput: Touch Controller non inizializzato\n") + ); + return; + } + + DBG(4, ErrorF("Entering ReadInput\n")); + /* + * Try to get a packet. + */ + if (GetPacket(local, priv->packet_buf, &priv->packet_pos, local->fd)==Success) + { + /* Calculate the (x,y) coord of pointer */ + cur_x = priv->packet_buf[1]; + cur_x <<= 6; + cur_x |= priv->packet_buf[2]; + + cur_y = priv->packet_buf[3]; + cur_y <<= 6; + cur_y |= priv->packet_buf[4]; + + touch_now = priv->packet_buf[0] & MGCT_TOUCH == MGCT_TOUCH; + + /* Se c'e' pressione sul touch inizio a calcolare la posizione + e a spostare il cursore grafico */ + if (touch_now) { + DBG(6, + ErrorF("Touch premuto: medio i valori di posizione\n") + ); + cur_x = medie_x(local, cur_x); + cur_y = medie_y(local, cur_y); + } + else { + DBG(6, + ErrorF("Touch rilasciato:\n" + "\tazzeramento buffer memoria\n" + "\tposizionamento immediato\n") + ); + + /* Se non ho pressione allora comando lo spostamento + del cursore senza mediare. Svuoto il buffer delle medie */ + priv->first_x = TRUE; + priv->first_y = TRUE; + } + /* Comando lo spostamento */ + xf86PostMotionEvent(local->dev, TRUE, 0, 2, cur_x, cur_y); + /* comanda la pressione del tasto */ + + DBG(9, + ErrorF("touch_now==%s\n", (touch_now==TRUE ? "TRUE" : "FALSE") ) + ); + if (touch_now!=priv->click_on) { + DBG(9, + ErrorF("Bottone == %s\n", (touch_now==TRUE ? "PREMUTO" : "RILASCAITO") ) + ); + priv->click_on = touch_now; + xf86PostButtonEvent(local->dev, TRUE, 1, touch_now, 0, 2, cur_x, cur_y); + } + } /* GetPacket */ +} + + +/* + ************************************************************************ + * + * xf86MagicConvert + * + ************************************************************************ + */ +static Bool +xf86MagicConvert(LocalDevicePtr local, + int first, + int num, + int v0, + int v1, + int v2, + int v3, + int v4, + int v5, + int *x, + int *y) +{ + MagicPrivatePtr priv = (MagicPrivatePtr) local->private; + int width = priv->max_x - priv->min_x; + int height = priv->max_y - priv->min_y; + int input_x, input_y; + + if (first != 0 || num != 2) { + return FALSE; + } + + DBG(3, ErrorF("MagicConvert: v0(%d), v1(%d)\n", v0, v1)); + + if (priv->swap_axes) { + input_x = v1; + input_y = v0; + } + else { + input_x = v0; + input_y = v1; + } + *x = (priv->screen_width * (input_x - priv->min_x)) / width; + *y = (priv->screen_height - (priv->screen_height * (input_y - priv->min_y)) / height); + +#ifdef XFREE86_V4 + /* + * Need to check if still on the correct screen. + * This call is here so that this work can be done after + * calib and before posting the event. + */ + xf86XInputSetScreen(local, priv->screen_no, *x, *y); +#endif + + DBG(3, ErrorF("MagicConvert: x(%d), y(%d)\n", *x, *y)); + + return TRUE; +} + + + +/* + ************************************************************************ + * + * xf86MagicAllocate + * + ************************************************************************ + */ +static LocalDevicePtr +#ifndef XFREE86_V4 +xf86MagicAllocate(void) +#else +xf86MagicAllocate(InputDriverPtr drv) +#endif +{ + #ifndef XFREE86_V4 + LocalDevicePtr local = (LocalDevicePtr) xalloc( sizeof(LocalDeviceRec) ); + #else + LocalDevicePtr local = xf86AllocateInput(drv, 0); + #endif + + MagicPrivatePtr priv = (MagicPrivatePtr) xalloc( sizeof(MagicPrivateRec) ); + + /* Controlla la corretta allocazione di buffers. Se uno dei buffers non + e' stato allocato correttamente termina l'inizializzazione + */ + if (!local) { + if (priv) + xfree(priv); + return NULL; + } + + if (!priv) { + if (local) + xfree(local); + return NULL; + } + + /* I buffers sono allocati correttamente */ + #ifdef XFREE86_V4 + priv->input_dev = strdup(MAGIC_PORT); + #else + priv->input_dev = MAGIC_PORT; + priv->link_speed = MAGIC_LINK_SPEED; + #endif + + priv->min_x = 60; + priv->max_x = 960; + priv->min_y = 60; + priv->max_y = 960; + priv->screen_no = 0; + priv->screen_width = -1; + priv->screen_height = -1; + priv->swap_axes = 0; + priv->first_x = + priv->first_y = TRUE; + priv->first_entry = TRUE; + priv->e_presente = FALSE; + priv->click_on = FALSE; + priv->i_x = + priv->i_y = 0; + priv->packet_pos = 0; + bzero(priv->buf_x, MEDIE_X); + bzero(priv->buf_y, MEDIE_Y); + priv->num_medie_x = MEDIE_X; + priv->num_medie_y = MEDIE_Y; + + local->name = XI_TOUCHSCREEN; + local->flags = 0; + + #ifndef XFREE86_V4 + #if !defined(sun) || defined(i386) + local->device_config = xf86MagicConfig; + #endif /* !defined(sun) || defined(i386) */ + #endif /* XFREE86_V4*/ + + local->device_control = xf86MagicControl; + local->read_input = xf86MagicReadInput; + local->control_proc = NULL; + local->close_proc = NULL; + local->switch_mode = NULL; + local->conversion_proc = xf86MagicConvert; + local->reverse_conversion_proc = NULL; + local->fd = -1; + local->atom = 0; + local->dev = NULL; + local->private = priv; + local->type_name = "MagicTouch"; + local->history_size = 0; + + return local; + +} /* xf86MagicAllocae */ + + + +#ifndef XFREE86_V4 + +/* + * Sezione relativa a X < 4.0.0 + */ + +DeviceAssocRec magictouch_assoc = { + "magictouch", + xf86MagicAllocate +}; + +#ifdef DYNAMIC_MODULE + +#ifndef DLSYM_BUG +int init_module(unsigned long server_version) +#else +int init_xf86Magic(unsigned long server_version) +#endif +{ + /* Aggiunge l'assiocazione per il touchscreen */ + xf86AddDeviceAssoc(&magictouch_assoc); + + /* Controlla la versione */ + if (server_version != XF86_VERSION_CURRENT) { + ErrorF("Warining: MagicTouch module compiled for version %s\n", XF86_VERSION); + return 0; + } + return 1; +} +#endif /* DYNAMIC_MODULE */ + +#else +/* + * Sezione relativa a X >= 4.0.0 + */ + +#endif /* XFREE86_V4 */ Index: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.43 xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.50 --- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.43 Fri May 18 16:22:30 2001 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c Wed Dec 19 11:05:22 2001 @@ -1,9 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.43 2001/05/18 20:22:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.50 2001/12/19 16:05:22 tsi Exp $ */ /* * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * Copyright 1993 by David Dawes <dawes@xfree86.org> - * Copyright 1994-1999 by The XFree86 Project, Inc. + * Copyright 1994-2001 by 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 @@ -78,6 +78,8 @@ static void MousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw); static void MouseReadInput(InputInfoPtr pInfo); +static void initPs2(InputInfoPtr pInfo, Bool reinsert); +static Bool ps2mouseReset(InputInfoPtr pInfo, unsigned char val); #undef MOUSE InputDriverRec MOUSE = { @@ -116,10 +118,15 @@ OPTION_PARITY, OPTION_FLOW_CONTROL, OPTION_VTIME, - OPTION_VMIN + OPTION_VMIN, + OPTION_EMULATE_WHEEL, + OPTION_EMU_WHEEL_BUTTON, + OPTION_EMU_WHEEL_INERTIA, + OPTION_X_AXIS_MAPPING, + OPTION_Y_AXIS_MAPPING } MouseOpts; -static const OptionInfoRec MouseOptions[] = { +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 }, @@ -146,6 +153,11 @@ { OPTION_FLOW_CONTROL, "FlowControl", OPTV_STRING, {0}, FALSE }, { OPTION_VTIME, "VTime", OPTV_INTEGER, {0}, FALSE }, { OPTION_VMIN, "VMin", OPTV_INTEGER, {0}, FALSE }, + { OPTION_EMULATE_WHEEL, "EmulateWheel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_EMU_WHEEL_BUTTON, "EmulateWheelButton", OPTV_INTEGER, {0}, FALSE }, + { OPTION_EMU_WHEEL_INERTIA, "EmulateWheelInertia", OPTV_INTEGER, {0}, FALSE }, + { OPTION_X_AXIS_MAPPING, "XAxisMapping", OPTV_STRING, {0}, FALSE }, + { OPTION_Y_AXIS_MAPPING, "YAxisMapping", OPTV_STRING, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -262,7 +274,7 @@ static const OptionInfoRec * MouseAvailableOptions(void *unused) { - return (MouseOptions); + return (mouseOptions); } static MouseProtocolID @@ -386,6 +398,14 @@ return TRUE; } +static void MouseBlockHandler(pointer data, + struct timeval **waitTime, + pointer LastSelectMask); + +static void MouseWakeupHandler(pointer data, + int i, + pointer LastSelectMask); + /* Process options common to all mouse types. */ static void MouseCommonOptions(InputInfoPtr pInfo) @@ -393,6 +413,7 @@ MouseDevPtr pMse; MessageType from = X_DEFAULT; char *s; + int origButtons; pMse = pInfo->private; @@ -402,8 +423,8 @@ pMse->buttons = MSE_DFLTBUTTONS; from = X_DEFAULT; } - xf86Msg(from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons); - + origButtons = pMse->buttons; + pMse->emulate3Buttons = xf86SetBoolOption(pInfo->options, "Emulate3Buttons", FALSE); pMse->emulate3Timeout = xf86SetIntOption(pInfo->options, "Emulate3Timeout", @@ -416,18 +437,18 @@ pMse->chordMiddle = xf86SetBoolOption(pInfo->options, "ChordMiddle", FALSE); if (pMse->chordMiddle) xf86Msg(X_CONFIG, "%s: ChordMiddle\n", pInfo->name); - pMse->flipXY = xf86SetBoolOption(pInfo->options,"FlipXY",FALSE); + pMse->flipXY = xf86SetBoolOption(pInfo->options, "FlipXY", FALSE); if (pMse->flipXY) - xf86Msg(X_CONFIG, "%s: FlipXY\n",pInfo->name); - if (xf86SetBoolOption(pInfo->options,"InvX",FALSE)) { + xf86Msg(X_CONFIG, "%s: FlipXY\n", pInfo->name); + if (xf86SetBoolOption(pInfo->options, "InvX", FALSE)) { pMse->invX = -1; - xf86Msg(X_CONFIG, "%s: InfX\n",pInfo->name); - } else + xf86Msg(X_CONFIG, "%s: InvX\n", pInfo->name); + } else pMse->invX = 1; - if (xf86SetBoolOption(pInfo->options,"InvY",FALSE)) { + if (xf86SetBoolOption(pInfo->options, "InvY", FALSE)) { pMse->invY = -1; - xf86Msg(X_CONFIG, "%s: InfY\n",pInfo->name); - } else + xf86Msg(X_CONFIG, "%s: InvY\n", pInfo->name); + } else pMse->invY = 1; s = xf86SetStrOption(pInfo->options, "ZAxisMapping", NULL); @@ -461,10 +482,10 @@ pMse->negativeW = 1 << (b3-1); pMse->positiveW = 1 << (b4-1); } - if ( b1 > pMse->buttons ) pMse->buttons = b1; - if ( b2 > pMse->buttons ) pMse->buttons = b2; - if ( b3 > pMse->buttons ) pMse->buttons = b3; - if ( b4 > pMse->buttons ) pMse->buttons = b4; + if (b1 > pMse->buttons) pMse->buttons = b1; + if (b2 > pMse->buttons) pMse->buttons = b2; + if (b3 > pMse->buttons) pMse->buttons = b3; + if (b4 > pMse->buttons) pMse->buttons = b4; } else { pMse->negativeZ = pMse->positiveZ = MSE_NOZMAP; pMse->negativeW = pMse->positiveW = MSE_NOZMAP; @@ -477,6 +498,97 @@ pInfo->name, s); } } + if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE)) { + Bool yFromConfig = FALSE; + int wheelButton; + + pMse->emulateWheel = TRUE; + wheelButton = xf86SetIntOption(pInfo->options, + "EmulateWheelButton", 4); + if (wheelButton < 0 || wheelButton > MSE_MAXBUTTONS) { + xf86Msg(X_WARNING, "%s: Invalid EmulateWheelButton value: %d\n", + pInfo->name, wheelButton); + wheelButton = 4; + } + pMse->wheelButtonMask = 1 << (wheelButton - 1); + + pMse->wheelInertia = xf86SetIntOption(pInfo->options, + "EmulateWheelInertia", 10); + if (pMse->wheelInertia <= 0) { + xf86Msg(X_WARNING, "%s: Invalid EmulateWheelInertia value: %d\n", + pInfo->name, pMse->wheelInertia); + pMse->wheelInertia = 50; + } + + pMse->negativeX = MSE_NOAXISMAP; + pMse->positiveX = MSE_NOAXISMAP; + s = xf86SetStrOption(pInfo->options, "XAxisMapping", NULL); + if (s) { + int b1 = 0, b2 = 0; + char *msg = NULL; + + if ((sscanf(s, "%d %d", &b1, &b2) == 2) && + b1 > 0 && b1 <= MSE_MAXBUTTONS && + b2 > 0 && b2 <= MSE_MAXBUTTONS) { + msg = xstrdup("buttons XX and YY"); + if (msg) + sprintf(msg, "buttons %d and %d", b1, b2); + pMse->negativeX = b1; + pMse->positiveX = b2; + if (b1 > pMse->buttons) pMse->buttons = b1; + if (b2 > pMse->buttons) pMse->buttons = b2; + } else { + xf86Msg(X_WARNING, "%s: Invalid XAxisMapping value: \"%s\"\n", + pInfo->name, s); + } + if (msg) { + xf86Msg(X_CONFIG, "%s: XAxisMapping: %s\n", pInfo->name, msg); + xfree(msg); + } + } + s = xf86SetStrOption(pInfo->options, "YAxisMapping", NULL); + if (s) { + int b1 = 0, b2 = 0; + char *msg = NULL; + + if ((sscanf(s, "%d %d", &b1, &b2) == 2) && + b1 > 0 && b1 <= MSE_MAXBUTTONS && + b2 > 0 && b2 <= MSE_MAXBUTTONS) { + msg = xstrdup("buttons XX and YY"); + if (msg) + sprintf(msg, "buttons %d and %d", b1, b2); + pMse->negativeY = b1; + pMse->positiveY = b2; + if (b1 > pMse->buttons) pMse->buttons = b1; + if (b2 > pMse->buttons) pMse->buttons = b2; + yFromConfig = TRUE; + } else { + xf86Msg(X_WARNING, "%s: Invalid YAxisMapping value: \"%s\"\n", + pInfo->name, s); + } + if (msg) { + xf86Msg(X_CONFIG, "%s: YAxisMapping: %s\n", pInfo->name, msg); + xfree(msg); + } + } + if (!yFromConfig) { + pMse->negativeY = 4; + pMse->positiveY = 5; + if (pMse->negativeY > pMse->buttons) + pMse->buttons = pMse->negativeY; + if (pMse->positiveY > pMse->buttons) + pMse->buttons = pMse->positiveY; + xf86Msg(X_DEFAULT, "%s: YAxisMapping: buttons %d and %d\n", + pInfo->name, pMse->negativeY, pMse->positiveY); + } + xf86Msg(X_CONFIG, "%s: EmulateWheel, EmulateWheelButton: %d, " + "EmulateWheelInertia: %d\n", + pInfo->name, wheelButton, pMse->wheelInertia); + } + if (origButtons != pMse->buttons) + from = X_CONFIG; + xf86Msg(from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons); + } static InputInfoPtr @@ -587,6 +699,8 @@ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); else { xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); + if (pMse->mousePriv) + xfree(pMse->mousePriv); xfree(pMse); pInfo->private = NULL; return pInfo; @@ -715,8 +829,6 @@ */ MouseDevPtr pMse; - unsigned char *param; - int paramlen; int i; int speed; int protoPara[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; @@ -809,8 +921,7 @@ /* Set the port parameters. */ if (!automatic) xf86SetSerial(pInfo->fd, pInfo->options); - param = NULL; - paramlen = 0; + switch (pMse->protocolID) { case PROT_LOGI: /* Logitech Mice */ /* @@ -963,52 +1074,19 @@ pMse->resolution); break; + case PROT_PS2: case PROT_IMPS2: /* IntelliMouse */ - { - static unsigned char s[] = { 243, 200, 243, 100, 243, 80, 242 }; - - param = s; - paramlen = sizeof(s); - } - break; - case PROT_EXPPS2: /* IntelliMouse Explorer */ - { - static unsigned char s[] = { 243, 200, 243, 200, 243, 80, 242 }; - - param = s; - paramlen = sizeof(s); - } - break; - + case PROT_THINKPS2: /* ThinkingMouse */ + case PROT_MMPS2: /* MouseMan+, FirstMouse+ */ + case PROT_GLIDEPS2: case PROT_NETPS2: /* NetMouse, NetMouse Pro, Mie Mouse */ case PROT_NETSCPS2: /* NetScroll */ - { - static unsigned char s[] = { 232, 3, 230, 230, 230, }; - - param = s; - paramlen = sizeof(s); - } - break; - - case PROT_MMPS2: /* MouseMan+, FirstMouse+ */ - { - static unsigned char s[] = { 230, 232, 0, 232, 3, 232, 2, 232, 1, - 230, 232, 3, 232, 1, 232, 2, 232, 3, }; - param = s; - paramlen = sizeof(s); - } + if ((pMse->mousePriv = + (pointer) xcalloc(sizeof(ps2PrivRec), 1)) == 0) + return FALSE; + initPs2(pInfo,TRUE); break; - - case PROT_THINKPS2: /* ThinkingMouse */ - { - static unsigned char s[] = { 243, 10, 232, 0, 243, 20, 243, 60, - 243, 40, 243, 20, 243, 20, 243, 60, - 243, 40, 243, 20, 243, 20, }; - param = s; - paramlen = sizeof(s); - } - case PROT_SYSMOUSE: if (osInfo->SetMiscRes) osInfo->SetMiscRes(pInfo, pMse->protocol, pMse->sampleRate, @@ -1020,71 +1098,7 @@ break; } - if (paramlen > 0) { -#ifdef EXTMOUSEDEBUG - for (i = 0; i < paramlen; ++i) { - if (xf86WriteSerial(pInfo->fd, ¶m[i], 1) != 1) - ErrorF("SetupMouse: Write to mouse failed (%s)\n", - strerror(errno)); - usleep(30000); - xf86ReadSerial(pInfo->fd, &c, 1); - ErrorF("SetupMouse: got %02x\n", c); - } -#else - if (xf86WriteSerial(pInfo->fd, param, paramlen) != paramlen) - xf86Msg(X_ERROR, "%s: Write to mouse failed\n", pInfo->name); -#endif - usleep(30000); - xf86FlushInput(pInfo->fd); - } - if (pMse->class & (MSE_PS2 | MSE_XPS2)) { - if (osInfo->SetPS2Res) { - osInfo->SetPS2Res(pInfo, pMse->protocol, pMse->sampleRate, - pMse->resolution); - } else { - unsigned char c2[2]; - c = 230; /* 1:1 scaling */ - xf86WriteSerial(pInfo->fd, &c, 1); - c = 244; /* enable mouse */ - xf86WriteSerial(pInfo->fd, &c, 1); - c2[0] = 243; /* set sampling rate */ - if (pMse->sampleRate > 0) { - if (pMse->sampleRate >= 200) - c2[1] = 200; - else if (pMse->sampleRate >= 100) - c2[1] = 100; - else if (pMse->sampleRate >= 80) - c2[1] = 80; - else if (pMse->sampleRate >= 60) - c2[1] = 60; - else if (pMse->sampleRate >= 40) - c2[1] = 40; - else - c2[1] = 20; - } else { - c2[1] = 100; - } - xf86WriteSerial(pInfo->fd, c2, 2); - c2[0] = 232; /* set device resolution */ - if (pMse->resolution > 0) { - if (pMse->resolution >= 200) - c2[1] = 3; - else if (pMse->resolution >= 100) - c2[1] = 2; - else if (pMse->resolution >= 50) - c2[1] = 1; - else - c2[1] = 0; - } else { - c2[1] = 2; - } - xf86WriteSerial(pInfo->fd, c2, 2); - usleep(30000); - xf86FlushInput(pInfo->fd); - } - } - pMse->protoBufTail = 0; pMse->inSync = 0; @@ -1114,6 +1128,14 @@ while ((c = XisbRead(pMse->buffer)) >= 0) { u = (unsigned char)c; + + if (pMse->class & (MSE_PS2 | MSE_XPS2)) { + if (ps2mouseReset(pInfo,u)) { + pBufP = 0; + continue; + } + } + if (pBufP >= pMse->protoPara[4]) { /* * Buffer contains a full packet, which has already been processed: @@ -1611,6 +1633,7 @@ } pMse->lastButtons = 0; pMse->emulateState = 0; + pMse->emulate3Pending = FALSE; device->public.on = TRUE; /* * send button up events for sanity. If no button down is pending @@ -1620,6 +1643,11 @@ for (i = 1; i <= 5; i++) xf86PostButtonEvent(device,0,i,0,0,0); xf86UnblockSIGIO (blocked); + if (pMse->emulate3Buttons) + { + RegisterBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler, + (pointer) pInfo); + } break; case DEVICE_OFF: @@ -1630,8 +1658,16 @@ XisbFree(pMse->buffer); pMse->buffer = NULL; } + if (pMse->mousePriv) + xfree(pMse->mousePriv); + pMse->mousePriv = NULL; xf86CloseSerial(pInfo->fd); pInfo->fd = -1; + if (pMse->emulate3Buttons) + { + RemoveBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler, + (pointer) pInfo); + } } device->public.on = FALSE; usleep(300000); @@ -1822,18 +1858,17 @@ #define reverseBits(map, b) (((b) & ~0x0f) | map[(b) & 0x0f]) static CARD32 -buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg) +buttonTimer(InputInfoPtr pInfo) { - InputInfoPtr pInfo; MouseDevPtr pMse; int sigstate; int id; - pInfo = arg; pMse = pInfo->private; sigstate = xf86BlockSIGIO (); + pMse->emulate3Pending = FALSE; 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]; @@ -1845,13 +1880,46 @@ return 0; } +static void MouseBlockHandler(pointer data, + struct timeval **waitTime, + pointer LastSelectMask) +{ + InputInfoPtr pInfo = (InputInfoPtr) data; + MouseDevPtr pMse = (MouseDevPtr) pInfo->private; + int ms; + + if (pMse->emulate3Pending) + { + ms = pMse->emulate3Expires - GetTimeInMillis (); + if (ms <= 0) + ms = 0; + AdjustWaitForDelay (waitTime, ms); + } +} + +static void MouseWakeupHandler(pointer data, + int i, + pointer LastSelectMask) +{ + InputInfoPtr pInfo = (InputInfoPtr) data; + MouseDevPtr pMse = (MouseDevPtr) pInfo->private; + int ms; + + if (pMse->emulate3Pending) + { + ms = pMse->emulate3Expires - GetTimeInMillis (); + if (ms <= 0) + buttonTimer (pInfo); + } +} + static void MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) { - static OsTimerPtr timer = NULL; MouseDevPtr pMse; int truebuttons, emulateButtons; int id, change; + int emuWheelDelta, emuWheelButton, emuWheelButtonMask; pMse = pInfo->private; @@ -1861,6 +1929,66 @@ else buttons = reverseBits(reverseMap, buttons); + /* Intercept wheel emulation. */ + if (pMse->emulateWheel && (buttons & pMse->wheelButtonMask)) { + /* Y axis movement */ + if (pMse->negativeY != MSE_NOAXISMAP) { + pMse->wheelYDistance += dy; + if (pMse->wheelYDistance < 0) { + emuWheelDelta = -pMse->wheelInertia; + emuWheelButton = pMse->negativeY; + } else { + emuWheelDelta = pMse->wheelInertia; + emuWheelButton = pMse->positiveY; + } + emuWheelButtonMask = 1 << (emuWheelButton - 1); + while (abs(pMse->wheelYDistance) > pMse->wheelInertia) { + pMse->wheelYDistance -= emuWheelDelta; + + /* + * Synthesize the press and release, but not when the button + * to be synthesized is already pressed "for real". + */ + if (!(emuWheelButtonMask & buttons) || + (emuWheelButtonMask & pMse->wheelButtonMask)) { + xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 1, 0, 0); + xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 0, 0, 0); + } + } + } + + /* X axis movement */ + if (pMse->negativeX != MSE_NOAXISMAP) { + pMse->wheelXDistance += dx; + if (pMse->wheelXDistance < 0) { + emuWheelDelta = -pMse->wheelInertia; + emuWheelButton = pMse->negativeX; + } else { + emuWheelDelta = pMse->wheelInertia; + emuWheelButton = pMse->positiveX; + } + emuWheelButtonMask = 1 << (emuWheelButton - 1); + while (abs(pMse->wheelXDistance) > pMse->wheelInertia) { + pMse->wheelXDistance -= emuWheelDelta; + + /* + * Synthesize the press and release, but not when the button + * to be synthesized is already pressed "for real". + */ + if (!(emuWheelButtonMask & buttons) || + (emuWheelButtonMask & pMse->wheelButtonMask)) { + xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 1, 0, 0); + xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 0, 0, 0); + } + } + } + + /* Absorb the mouse movement and the wheel button press. */ + dx = 0; + dy = 0; + buttons &= ~pMse->wheelButtonMask; + } + if (dx || dy) xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy); @@ -1890,13 +2018,10 @@ stateTab[pMse->emulateState][emulateButtons][2]; if (stateTab[pMse->emulateState][4][0] != 0) { - timer = TimerSet(timer, 0, pMse->emulate3Timeout, buttonTimer, - pInfo); + pMse->emulate3Expires = GetTimeInMillis () + pMse->emulate3Timeout; + pMse->emulate3Pending = TRUE; } else { - if (timer) { - TimerFree(timer); - timer = NULL; - } + pMse->emulate3Pending = FALSE; } } @@ -1968,6 +2093,166 @@ if (zbutton) { buttons &= ~zbutton; MouseDoPostEvent(pInfo, buttons, 0, 0); + } +} + +static void +initPs2(InputInfoPtr pInfo, Bool reinsert) +{ + MouseDevPtr pMse = pInfo->private; + unsigned char *param = NULL; + int paramlen = 0; + unsigned char c; + + if (reinsert) { + unsigned char init = 0xF4; + if (xf86WriteSerial(pInfo->fd, &init, 1) != 1) + xf86Msg(X_ERROR, "%s: Write to mouse failed\n", pInfo->name); + usleep(30000); + xf86FlushInput(pInfo->fd); + } + + switch (pMse->protocolID) { + case PROT_IMPS2: /* IntelliMouse */ + { + static unsigned char seq[] = { 243, 200, 243, 100, 243, 80, 242 }; + + param = seq; + paramlen = sizeof(seq); + } + break; + + case PROT_EXPPS2: /* IntelliMouse Explorer */ + { + static unsigned char seq[] = { 243, 200, 243, 100, 243, 80, + 243, 200, 243, 200, 243, 80, 242 }; + + param = seq; + paramlen = sizeof(seq); + } + break; + + case PROT_NETPS2: /* NetMouse, NetMouse Pro, Mie Mouse */ + case PROT_NETSCPS2: /* NetScroll */ + { + static unsigned char seq[] = { 232, 3, 230, 230, 230, }; + + param = seq; + paramlen = sizeof(seq); + } + break; + + case PROT_MMPS2: /* MouseMan+, FirstMouse+ */ + { + static unsigned char seq[] = { 230, 232, 0, 232, 3, 232, 2, 232, 1, + 230, 232, 3, 232, 1, 232, 2, 232, 3, }; + param = seq; + paramlen = sizeof(seq); + } + break; + + case PROT_THINKPS2: /* ThinkingMouse */ + { + static unsigned char seq[] = { 243, 10, 232, 0, 243, 20, 243, 60, + 243, 40, 243, 20, 243, 20, 243, 60, + 243, 40, 243, 20, 243, 20, }; + param = seq; + paramlen = sizeof(seq); + } + } + + if (paramlen > 0) { +#ifdef EXTMOUSEDEBUG + for (i = 0; i < paramlen; ++i) { + if (xf86WriteSerial(pInfo->fd, ¶m[i], 1) != 1) + ErrorF("SetupMouse: Write to mouse failed (%s)\n", + strerror(errno)); + usleep(30000); + xf86ReadSerial(pInfo->fd, &c, 1); + ErrorF("SetupMouse: got %02x\n", c); + } +#else + if (xf86WriteSerial(pInfo->fd, param, paramlen) != paramlen) + xf86Msg(X_ERROR, "%s: Write to mouse failed\n", pInfo->name); +#endif + usleep(30000); + xf86FlushInput(pInfo->fd); + } + + ((ps2PrivPtr)(pMse->mousePriv))->state = 0; + if (osInfo->SetPS2Res) { + osInfo->SetPS2Res(pInfo, pMse->protocol, pMse->sampleRate, + pMse->resolution); + } else { + unsigned char c2[2]; + + c = 230; /* 1:1 scaling */ + xf86WriteSerial(pInfo->fd, &c, 1); + c = 244; /* enable mouse */ + xf86WriteSerial(pInfo->fd, &c, 1); + c2[0] = 243; /* set sampling rate */ + if (pMse->sampleRate > 0) { + if (pMse->sampleRate >= 200) + c2[1] = 200; + else if (pMse->sampleRate >= 100) + c2[1] = 100; + else if (pMse->sampleRate >= 80) + c2[1] = 80; + else if (pMse->sampleRate >= 60) + c2[1] = 60; + else if (pMse->sampleRate >= 40) + c2[1] = 40; + else + c2[1] = 20; + } else { + c2[1] = 100; + } + xf86WriteSerial(pInfo->fd, c2, 2); + c2[0] = 232; /* set device resolution */ + if (pMse->resolution > 0) { + if (pMse->resolution >= 200) + c2[1] = 3; + else if (pMse->resolution >= 100) + c2[1] = 2; + else if (pMse->resolution >= 50) + c2[1] = 1; + else + c2[1] = 0; + } else { + c2[1] = 2; + } + xf86WriteSerial(pInfo->fd, c2, 2); + usleep(30000); + xf86FlushInput(pInfo->fd); + } +} + +static Bool +ps2mouseReset(InputInfoPtr pInfo, unsigned char val) +{ + MouseDevPtr pMse = pInfo->private; + ps2PrivPtr ps2priv = (ps2PrivPtr)pMse->mousePriv; +#ifdef EXTMOUSEDEBUG + ErrorF("Ps/2 Mouse State: %i, 0x%x\n",ps2priv->state,val); +#endif + switch (ps2priv->state) { + case 0: + if (val == 0xaa) + ps2priv->state = 1; + else + ps2priv->state = 0; + return FALSE; + case 1: + ps2priv->state = 0; + if (val == 0x00) { + xf86MsgVerb(X_INFO,3, + "Got reinsert event: reinitializing PS/2 mouse\n"); + initPs2(pInfo, TRUE); + return TRUE; + } else + return FALSE; + default: + return FALSE; } } Index: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man:1.2 xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man:1.3 --- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man:1.2 Sat Jan 27 13:20:58 2001 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man Mon Aug 6 17:13:19 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man,v 1.2 2001/01/27 18:20:58 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man,v 1.3 2001/08/06 21:13:19 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH MOUSE __drivermansuffix__ __vendorversion__ @@ -89,6 +89,49 @@ Enable/disable handling of mice that send left+right events when the middle button is used. Default: off. .TP 7 +.BI "Option \*qEmulateWheel\*q \*q" boolean \*q +Enable/disable "wheel" emulation. Wheel emulation means emulating button +press/release events when the mouse is moved while a specific real button +is pressed. Wheel button events (typically buttons 4 and 5) are +usually used for scrolling. Wheel emulation is useful for getting wheel-like +behaviour with trackballs. It can also be useful for mice with 4 or +more buttons but no wheel. See the description of the +.BR EmulateWheelButton , +.BR EmulateWheelInertia , +.BR XAxisMapping , +and +.B YAxisMapping +options below. Default: off. +.TP 7 +.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q +Specifies which button must be held down to enable wheel emulation mode. +While this button is down, X and/or Y pointer movement will generate button +press/release events as specified for the +.B XAxisMapping +and +.B YAxisMapping +settings. Default: 4. +.TP 7 +.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q +Specifies how far (in pixels) the pointer must move to generate button +press/release events in wheel emulation mode. Default: 50. +.TP 7 +.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q +Specifies which buttons are mapped to motion in the X direction in wheel +emulation mode. Button number +.I N1 +is mapped to the negative X axis motion and button number +.I N2 +is mapped to the positive X axis motion. Default: no mapping. +.TP 7 +.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q +Specifies which buttons are mapped to motion in the Y direction in wheel +emulation mode. Button number +.I N1 +is mapped to the negative Y axis motion and button number +.I N2 +is mapped to the positive Y axis motion. Default: "4 5". +.TP 7 .BI "Option \*qZAxisMapping\*q \*qX\*q" .TP 7 .BI "Option \*qZAxisMapping\*q \*qY\*q" @@ -110,6 +153,7 @@ .I N3 and .IR N4 . +Default: no mapping. .TP 7 .BI "Option \*qFlipXY\*q \*q" boolean \*q Enable/disable swapping the X and Y axes. Default: off. Index: xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h:1.5 xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h:1.6 --- xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h:1.5 Wed May 31 03:15:06 2000 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h Fri Nov 30 07:12:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h,v 1.5 2000/05/31 07:15:06 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h,v 1.6 2001/11/30 12:12:03 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -16,6 +16,10 @@ const char ** defaults; MouseProtocolID id; } MouseProtocolRec, *MouseProtocolPtr; + +typedef struct { + int state; +} ps2PrivRec, *ps2PrivPtr; /* mouse proto flags */ #define MPF_NONE 0x00 Index: xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c diff -u xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c:1.10 xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c:1.11 --- xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c:1.10 Tue Oct 24 14:07:51 2000 +++ xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c Mon Aug 6 16:51:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c,v 1.10 2000/10/24 18:07:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c,v 1.11 2001/08/06 20:51:10 dawes Exp $ */ /* * Copyright 1998 by Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> @@ -35,6 +35,7 @@ #include "xf86OSmouse.h" #include "xf86_ansic.h" #include "mouse.h" +#include "mousePriv.h" /* serial PnP ID string */ typedef struct { Index: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c diff -u xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c:1.13 xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c:1.14 --- xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c:1.13 Sun Apr 1 10:00:13 2001 +++ xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c Fri Aug 17 09:27:56 2001 @@ -21,7 +21,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c,v 1.13 2001/04/01 14:00:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c,v 1.14 2001/08/17 13:27:56 dawes Exp $ */ /* ******************************************************************************* @@ -1751,13 +1751,13 @@ xf86Msg(X_CONFIG, "Microtouch X device name: %s\n", local->name); priv->screen_no = xf86SetIntOption(local->options, "ScreenNo", 0); xf86Msg(X_CONFIG, "Microtouch associated screen: %d\n", priv->screen_no); - priv->max_x = xf86SetIntOption(local->options, "MaximumXPosition", 3000); + priv->max_x = xf86SetIntOption(local->options, "MaxX", 3000); xf86Msg(X_CONFIG, "Microtouch maximum x position: %d\n", priv->max_x); - priv->min_x = xf86SetIntOption(local->options, "MinimumXPosition", 0); + priv->min_x = xf86SetIntOption(local->options, "MinX", 0); xf86Msg(X_CONFIG, "Microtouch minimum x position: %d\n", priv->min_x); - priv->max_y = xf86SetIntOption(local->options, "MaximumYPosition", 3000); + priv->max_y = xf86SetIntOption(local->options, "MaxY", 3000); xf86Msg(X_CONFIG, "Microtouch maximum y position: %d\n", priv->max_y); - priv->min_y = xf86SetIntOption(local->options, "MinimumYPosition", 0); + priv->min_y = xf86SetIntOption(local->options, "MinY", 0); xf86Msg(X_CONFIG, "Microtouch minimum y position: %d\n", priv->min_y); priv->frequency = xf86SetIntOption(local->options, "Frequency", 0); xf86Msg(X_CONFIG, "Microtouch ThruGlass frequency is: %d\n", priv->frequency); Index: xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man diff -u xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man:1.2 xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man:1.3 --- xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man:1.2 Sat Jan 27 13:20:58 2001 +++ xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man Fri Aug 17 09:27:57 2001 @@ -1,15 +1,17 @@ -.\" $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__ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man,v 1.3 2001/08/17 13:27:57 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH PENMOUNT __drivermansuffix__ __vendorversion__ .SH NAME penmount \- PenMount input driver .SH SYNOPSIS -.B "Section ""InputDevice""" +.B "Section \*qInputDevice\*q" .br -.BI " Identifier """ idevname """" +.BI " Identifier \*q" idevname \*q .br -.B " Driver ""penmount""" +.B " Driver \*qpenmount\*q" .br -.BI " Option ""Device"" """ devpath """" +.BI " Option \*qDevice\*q \*q" devpath \*q .br \ \ ... .br Index: xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c diff -u xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c:1.2 xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c:1.3 --- xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c:1.2 Fri Aug 11 15:10:46 2000 +++ xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c Mon Nov 26 11:25:53 2001 @@ -28,7 +28,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c,v 1.2 2000/08/11 19:10:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/xf86PM.c,v 1.3 2001/11/26 16:25:53 dawes Exp $ */ #define _PENMOUNT_C_ @@ -92,7 +92,7 @@ "screenInfo", "xf86AddInputDriver", "xf86AllocateInput", - "xf86CloseSerial", /* first one */ + "xf86CloseSerial", "xf86CollectInputOptions", "xf86ErrorFVerb", "xf86FindOptionValue", @@ -101,7 +101,6 @@ "xf86MotionHistoryAllocate", "xf86NameCmp", "xf86OpenSerial", - "xf86CloseSerial", /* second one ? */ "xf86OptionListCreate", "xf86OptionListMerge", "xf86OptionListReport", @@ -109,7 +108,6 @@ "xf86PostMotionEvent", "xf86PostProximityEvent", "xf86ProcessCommonOptions", - "xf86RemoveLocalDevice", "xf86ScaleAxis", "xf86SetIntOption", "xf86SetStrOption", Index: xc/programs/Xserver/hw/xfree86/input/sample/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/sample/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/input/sample/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/input/sample/Imakefile:1.4 Sat Aug 14 06:50:02 1999 +++ xc/programs/Xserver/hw/xfree86/input/sample/Imakefile Tue Jan 15 10:32:45 2002 @@ -1,4 +1,9 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/sample/Imakefile,v 1.4 1999/08/14 10:50:02 dawes Exp $ +/* + * THIS SAMPLE INPUT DRIVER IS OUT OF DATE. DO NOT USE IT AS A TEMPLATE + * WHEN WRITING A NEW INPUT DRIVER. + */ + +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/sample/Imakefile,v 1.5 2002/01/15 15:32:45 dawes Exp $ #define IHaveModules #include <Server.tmpl> Index: xc/programs/Xserver/hw/xfree86/input/sample/README diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/sample/README:1.1 --- /dev/null Fri Jan 18 15:25:54 2002 +++ xc/programs/Xserver/hw/xfree86/input/sample/README Tue Jan 15 10:32:45 2002 @@ -0,0 +1,4 @@ + +This sample input driver is out of date. Do not use it as a template +when writing a new input driver. + Index: xc/programs/Xserver/hw/xfree86/input/sample/sample.c diff -u xc/programs/Xserver/hw/xfree86/input/sample/sample.c:1.8 xc/programs/Xserver/hw/xfree86/input/sample/sample.c:1.11 --- xc/programs/Xserver/hw/xfree86/input/sample/sample.c:1.8 Sat Jun 5 11:55:28 1999 +++ xc/programs/Xserver/hw/xfree86/input/sample/sample.c Tue Jan 15 10:32:45 2002 @@ -1,3 +1,8 @@ +/* + * THIS SAMPLE INPUT DRIVER IS OUT OF DATE. DO NOT USE IT AS A TEMPLATE + * WHEN WRITING A NEW INPUT DRIVER. + */ + /* * Copyright (c) 1998 Metro Link Incorporated * @@ -24,7 +29,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/sample/sample.c,v 1.8 1999/06/05 15:55:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/sample/sample.c,v 1.11 2002/01/15 15:32:45 dawes Exp $ */ #define _SAMPLE_C_ /***************************************************************************** @@ -71,7 +76,7 @@ * Be sure to set vmin appropriately for your device's protocol. You want to * read a full packet before returning */ -static char *default_options[] = +static const char *default_options[] = { "BaudRate", "9600", "StopBits", "1", @@ -102,8 +107,6 @@ DeviceOff (local->dev); - xf86RemoveLocalDevice (local); - xf86CloseSerial (local->fd); XisbFree (priv->buffer); xfree (priv); @@ -159,7 +162,7 @@ priv->button_threshold = xf86SetIntOption( merged, "ButtonThreshold", 128 ); s = xf86FindOptionValue (merged, "ReportingMode"); - if ((s) && (StrCaseCmp (s, "raw") == 0)) + if ((s) && (strcasecmp (s, "raw") == 0)) priv->reporting_mode = TS_Raw; else priv->reporting_mode = TS_Scaled; Index: xc/programs/Xserver/hw/xfree86/input/sample/sample.h diff -u xc/programs/Xserver/hw/xfree86/input/sample/sample.h:1.2 xc/programs/Xserver/hw/xfree86/input/sample/sample.h:1.4 --- xc/programs/Xserver/hw/xfree86/input/sample/sample.h:1.2 Mon Feb 1 07:13:00 1999 +++ xc/programs/Xserver/hw/xfree86/input/sample/sample.h Tue Jan 15 10:32:45 2002 @@ -1,3 +1,8 @@ +/* + * THIS SAMPLE INPUT DRIVER IS OUT OF DATE. DO NOT USE IT AS A TEMPLATE + * WHEN WRITING A NEW INPUT DRIVER. + */ + /* * Copyright (c) 1998 Metro Link Incorporated * @@ -24,7 +29,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/sample/sample.h,v 1.2 1999/02/01 12:13:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/sample/sample.h,v 1.4 2002/01/15 15:32:45 dawes Exp $ */ #ifndef _SAMPLE_H_ #define _SAMPLE_H_ @@ -76,7 +81,7 @@ /****************************************************************************** * Declarations *****************************************************************************/ -static MODULESETUPPROTO( sampleSetupProc ); +static MODULESETUPPROTO( SetupProc ); static void TearDownProc (pointer p); static Bool DeviceControl (DeviceIntPtr, int); static Bool DeviceOn (DeviceIntPtr); Index: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c diff -u xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c:1.11 xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c:1.13 --- xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c:1.11 Tue May 15 14:22:22 2001 +++ xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c Mon Nov 26 11:25:54 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.11 2001/05/15 18:22:22 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c,v 1.13 2001/11/26 16:25:54 dawes Exp $ */ #define _SPACEORB_C_ /***************************************************************************** @@ -109,7 +109,6 @@ "xf86MotionHistoryAllocate", "xf86NameCmp", "xf86OpenSerial", - "xf86CloseSerial", "xf86OptionListCreate", "xf86OptionListMerge", "xf86OptionListReport", @@ -117,7 +116,6 @@ "xf86PostMotionEvent", "xf86PostProximityEvent", "xf86ProcessCommonOptions", - "xf86RemoveLocalDevice", "xf86ScaleAxis", "xf86SetIntOption", "xf86SetStrOption", @@ -136,6 +134,24 @@ return (pointer) 1; } +static void +TearDownProc( pointer p ) +{ + 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); + } +} + /* was before: XF86ModuleData spaceorbModuleData = { &VersionRec, SetupProc, TearDownProc }; */ XF86ModuleData spaceorbModuleData = { &VersionRec, SPACEORBSetupProc, TearDownProc }; @@ -242,24 +258,6 @@ if (priv) xfree (priv); return (pInfo); -} - -static void -TearDownProc( pointer p ) -{ - 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); - } } static Bool Index: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h diff -u xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h:1.3 xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h:1.4 --- xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h:1.3 Fri Aug 11 15:10:47 2000 +++ xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h Sat Oct 27 23:33:58 2001 @@ -26,7 +26,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h,v 1.3 2000/08/11 19:10:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.h,v 1.4 2001/10/28 03:33:58 tsi Exp $ */ #ifndef _SPACEORB_H_ #define _SPACEORB_H_ @@ -70,8 +70,10 @@ /****************************************************************************** * Declarations *****************************************************************************/ +#ifdef XFree86LOADER static MODULESETUPPROTO(SPACEORBSetupProc); static void TearDownProc (pointer p); +#endif static Bool DeviceControl (DeviceIntPtr, int); static Bool DeviceOn (DeviceIntPtr); static Bool DeviceOff (DeviceIntPtr); Index: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c diff -u xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.10 xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.11 --- xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.10 Tue May 15 14:22:22 2001 +++ xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c Wed Dec 26 16:49:42 2001 @@ -24,7 +24,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.10 2001/05/15 18:22:22 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.11 2001/12/26 21:49:42 dawes Exp $ */ static const char identification[] = "$Identification: 18 $"; @@ -59,8 +59,6 @@ #include "xf86Module.h" #endif -#undef sleep -#define sleep(t) xf86WaitForInput(-1, 1000 * (t)) #define wait_for_fd(fd) xf86WaitForInput((fd), 1000) #define tcflush(fd, n) xf86FlushInput((fd)) #undef read @@ -898,13 +896,13 @@ buffer[0] = 0; SYSCALL(err = write(local->fd, buffer, 1)); -/* wait 200 mSecs, just in case */ +/* Wait 400 mSecs, just in case. 200 ms isn't enough for the Genius EasyPen. */ #ifndef XFREE86_V4 timeout.tv_sec = 0; - timeout.tv_usec = 200000; + timeout.tv_usec = 400000; SYSCALL(err = select(0, NULL, NULL, NULL, &timeout)); #else - err = xf86WaitForInput(-1, 200); + err = xf86WaitForInput(-1, 400000); #endif if (err == -1) { Error("SummaSketch select"); Index: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c diff -u xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.27 xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.30 --- xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.27 Fri May 18 19:35:33 2001 +++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c Wed Dec 26 16:51:59 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.27 2001/05/18 23:35:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.30 2001/12/26 21:51:59 dawes Exp $ */ /* * This driver is only able to handle the Wacom IV and Wacom V protocols. @@ -66,7 +66,6 @@ #endif #endif -#ifdef XFREE86_V4 /* post 3.9 headers */ #ifndef XFree86LOADER @@ -91,8 +90,6 @@ #include "xf86Module.h" #endif -#undef sleep -#define sleep(t) xf86WaitForInput(-1, 1000 * (t)) #define wait_for_fd(fd) xf86WaitForInput((fd), 1000) #define tcflush(fd, n) xf86FlushInput((fd)) #undef read @@ -125,53 +122,7 @@ static InputDriverPtr wcmDrv; -#else /* pre 3.9 headers */ -#include "Xos.h" -#include <signal.h> -#include <stdio.h> - -#define NEED_EVENTS -#include "X.h" -#include "Xproto.h" -#include "misc.h" -#include "inputstr.h" -#include "scrnintstr.h" -#include "XI.h" -#include "XIproto.h" -#include "keysym.h" - -#if defined(sun) && !defined(i386) -#define POSIX_TTY -#include <errno.h> -#include <termio.h> -#include <fcntl.h> -#include <ctype.h> -#include <stdio.h> - -#include "extio.h" -#else -#include "compiler.h" - -#include "xf86.h" -#include "xf86Procs.h" -#include "xf86_OSlib.h" -#include "xf86_Config.h" -#include "xf86Xinput.h" -#include "atKeynames.h" -#include "xf86Version.h" -#endif - -#if !defined(sun) || defined(i386) -#include "osdep.h" -#include "exevents.h" - -#include "extnsionst.h" -#include "extinit.h" -#endif - -#endif /* Pre 3.9 headers */ - #if defined(__QNX__) || defined(__QNXNTO__) #define POSIX_TTY #endif @@ -310,76 +261,7 @@ #define STYLUS_SECTION_NAME "wacomstylus" #define ERASER_SECTION_NAME "wacomeraser" -#ifndef XFREE86_V4 -#define PORT 1 -#define DEVICENAME 2 -#define THE_MODE 3 -#define SUPPRESS 4 -#define DEBUG_LEVEL 5 -#define TILT_MODE 6 -#define HISTORY_SIZE 7 -#define ALWAYS_CORE 8 -#define KEEP_SHAPE 9 -#define TOP_X 10 -#define TOP_Y 11 -#define BOTTOM_X 12 -#define BOTTOM_Y 13 -#define SERIAL 14 -#define BAUD_RATE 15 -#define THRESHOLD 16 -#define MAX_X 17 -#define MAX_Y 18 -#define MAX_Z 19 -#define RESOLUTION_X 20 -#define RESOLUTION_Y 21 -#define RESOLUTION_Z 22 -#define USB 23 -#define SCREEN_NO 24 - -#if !defined(sun) || defined(i386) -static SymTabRec WcmTab[] = { - { ENDSUBSECTION, "endsubsection" }, - { PORT, "port" }, - { DEVICENAME, "devicename" }, - { THE_MODE, "mode" }, - { SUPPRESS, "suppress" }, - { DEBUG_LEVEL, "debuglevel" }, - { TILT_MODE, "tiltmode" }, - { HISTORY_SIZE, "historysize" }, - { ALWAYS_CORE, "alwayscore" }, - { KEEP_SHAPE, "keepshape" }, - { TOP_X, "topx" }, - { TOP_Y, "topy" }, - { BOTTOM_X, "bottomx" }, - { BOTTOM_Y, "bottomy" }, - { SERIAL, "serial" }, - { BAUD_RATE, "baudrate" }, - { THRESHOLD, "threshold" }, - { MAX_X, "maxx" }, - { MAX_Y, "maxy" }, - { MAX_Z, "maxz" }, - { RESOLUTION_X, "resolutionx" }, - { RESOLUTION_Y, "resolutiony" }, - { RESOLUTION_Z, "resolutionz" }, - { USB, "usb" }, - { SCREEN_NO, "screenno" }, - { -1, "" } -}; - -#define RELATIVE 1 -#define ABSOLUTE 2 - -static SymTabRec ModeTabRec[] = { - { RELATIVE, "relative" }, - { ABSOLUTE, "absolute" }, - { -1, "" } -}; - -#endif - -#endif /* Pre 3.9 headers */ - /****************************************************************************** * constant and macros declarations *****************************************************************************/ @@ -522,506 +404,15 @@ static Bool xf86WcmUSBOpen(LocalDevicePtr); #endif - -#ifndef XFREE86_V4 - -#if defined(sun) && !defined(i386) -#define ENQUEUE suneqEnqueue -#else -#define ENQUEUE xf86eqEnqueue - -extern void xf86eqEnqueue( -#if NeedFunctionPrototypes - xEventPtr /*e*/ -#endif -); -#endif - -extern void miPointerDeltaCursor( -#if NeedFunctionPrototypes - int /*dx*/, - int /*dy*/, - unsigned long /*time*/ -#endif -); - -#endif /* pre 3.9 declarations */ - #if NeedFunctionPrototypes static LocalDevicePtr xf86WcmAllocateStylus(void); static LocalDevicePtr xf86WcmAllocateCursor(void); static LocalDevicePtr xf86WcmAllocateEraser(void); #endif -#ifndef XFREE86_V4 -/* - *************************************************************************** - * - * xf86WcmConfig -- - * Configure the device. - * - *************************************************************************** - */ -static Bool -xf86WcmConfig(LocalDevicePtr *array, - int inx, - int max, - LexPtr val) -{ - LocalDevicePtr dev = array[inx]; - WacomDevicePtr priv = (WacomDevicePtr)(dev->private); - WacomCommonPtr common = priv->common; - int token; - int mtoken; - - DBG(1, ErrorF("xf86WcmConfig\n")); - - if (xf86GetToken(WcmTab) != PORT) { - xf86ConfigError("PORT option must be the first option of a Wacom SubSection"); - } - - if (xf86GetToken(NULL) != STRING) - xf86ConfigError("Option string expected"); - else { - int loop; - - /* try to find another wacom device which share the same port */ - for(loop=0; loop<max; loop++) { - if (loop == inx) - continue; - if ((array[loop]->device_config == xf86WcmConfig) && - (strcmp(((WacomDevicePtr)array[loop]->private)->common->wcmDevice, val->str) == 0)) { - DBG(2, ErrorF("xf86WcmConfig wacom port share between" - " %s and %s\n", - dev->name, array[loop]->name)); - ((WacomDevicePtr) array[loop]->private)->common->wcmHasEraser |= common->wcmHasEraser; - xfree(common->wcmDevices); - xfree(common); - common = priv->common = ((WacomDevicePtr) array[loop]->private)->common; - common->wcmNumDevices++; - common->wcmDevices = (LocalDevicePtr *) xrealloc(common->wcmDevices, - sizeof(LocalDevicePtr) * common->wcmNumDevices); - common->wcmDevices[common->wcmNumDevices - 1] = dev; - break; - } - } - if (loop == max) { - common->wcmDevice = strdup(val->str); - if (xf86Verbose) - ErrorF("%s Wacom port is %s\n", XCONFIG_GIVEN, - common->wcmDevice); - } - } - - while ((token = xf86GetToken(WcmTab)) != ENDSUBSECTION) { - switch(token) { - case DEVICENAME: - if (xf86GetToken(NULL) != STRING) - xf86ConfigError("Option string expected"); - dev->name = strdup(val->str); - if (xf86Verbose) - ErrorF("%s Wacom X device name is %s\n", XCONFIG_GIVEN, - dev->name); - break; - - case THE_MODE: - mtoken = xf86GetToken(ModeTabRec); - if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) - xf86ConfigError("Mode type token expected"); - else { - switch (mtoken) { - case ABSOLUTE: - priv->flags = priv->flags | ABSOLUTE_FLAG; - break; - case RELATIVE: - priv->flags = priv->flags & ~ABSOLUTE_FLAG; - break; - default: - xf86ConfigError("Illegal Mode type"); - break; - } - } - break; - - case SUPPRESS: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - common->wcmSuppress = val->num; - if (xf86Verbose) - ErrorF("%s Wacom suppress value is %d\n", XCONFIG_GIVEN, - common->wcmSuppress); - break; - - case DEBUG_LEVEL: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - debug_level = val->num; - if (xf86Verbose) { -#if DEBUG - ErrorF("%s Wacom debug level sets to %d\n", XCONFIG_GIVEN, - debug_level); -#else - ErrorF("%s Wacom debug level not sets to %d because" - " debugging is not compiled\n", XCONFIG_GIVEN, - debug_level); -#endif - } - break; - - case TILT_MODE: - common->wcmFlags |= TILT_FLAG; - break; - - case HISTORY_SIZE: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - dev->history_size = val->num; - if (xf86Verbose) - ErrorF("%s Wacom Motion history size is %d\n", XCONFIG_GIVEN, - dev->history_size); - break; - - case ALWAYS_CORE: - xf86AlwaysCore(dev, TRUE); - if (xf86Verbose) - ErrorF("%s Wacom device always stays core pointer\n", - XCONFIG_GIVEN); - break; - - case KEEP_SHAPE: - priv->flags |= KEEP_SHAPE_FLAG; - if (xf86Verbose) - ErrorF("%s Wacom keeps shape\n", - XCONFIG_GIVEN); - break; - - case TOP_X: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - priv->topX = val->num; - if (xf86Verbose) - ErrorF("%s Wacom top x = %d\n", XCONFIG_GIVEN, priv->topX); - break; - - case TOP_Y: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - priv->topY = val->num; - if (xf86Verbose) - ErrorF("%s Wacom top y = %d\n", XCONFIG_GIVEN, priv->topY); - break; - - case BOTTOM_X: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - priv->bottomX = val->num; - if (xf86Verbose) - ErrorF("%s Wacom bottom x = %d\n", XCONFIG_GIVEN, priv->bottomX); - break; - - case BOTTOM_Y: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - priv->bottomY = val->num; - if (xf86Verbose) - ErrorF("%s Wacom bottom y = %d\n", XCONFIG_GIVEN, priv->bottomY); - break; - - case SERIAL: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - priv->serial = val->num; - if (xf86Verbose) - ErrorF("%s Wacom serial number = %u\n", XCONFIG_GIVEN, - priv->serial); - break; - - case BAUD_RATE: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - switch(val->num) { - case 38400: - common->wcmLinkSpeed = 38400; - break; - case 19200: - common->wcmLinkSpeed = 19200; - break; - case 9600: - common->wcmLinkSpeed = 9600; - break; - default: - xf86ConfigError("Illegal speed value"); - break; - } - if (xf86Verbose) - ErrorF("%s Wacom baud rate of %u\n", XCONFIG_GIVEN, - val->num); - break; - - case THRESHOLD: - if (xf86GetToken(NULL) != STRING) - xf86ConfigError("Option string expected"); - - common->wcmThreshold = atoi(val->str); - - if (xf86Verbose) - ErrorF("%s Wacom pressure threshold for button 1 = %d\n", - XCONFIG_GIVEN, common->wcmThreshold); - break; - - case MAX_X: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - common->wcmMaxX = val->num; - if (xf86Verbose) - ErrorF("%s Wacom max x = %d\n", XCONFIG_GIVEN, common->wcmMaxX); - break; - - case MAX_Y: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - common->wcmMaxY = val->num; - if (xf86Verbose) - ErrorF("%s Wacom max y = %d\n", XCONFIG_GIVEN, common->wcmMaxY); - break; - - case MAX_Z: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - common->wcmMaxZ = val->num; - if (xf86Verbose) - ErrorF("%s Wacom max y = %d\n", XCONFIG_GIVEN, common->wcmMaxZ); - break; - - case RESOLUTION_X: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - common->wcmResolX = val->num; - if (xf86Verbose) - ErrorF("%s Wacom resolution x = %d\n", XCONFIG_GIVEN, common->wcmResolX); - break; - - case RESOLUTION_Y: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - common->wcmResolY = val->num; - if (xf86Verbose) - ErrorF("%s Wacom resolution y = %d\n", XCONFIG_GIVEN, common->wcmResolY); - break; - - case RESOLUTION_Z: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - common->wcmResolZ = val->num; - if (xf86Verbose) - ErrorF("%s Wacom resolution y = %d\n", XCONFIG_GIVEN, common->wcmResolZ); - break; - - case USB: -#ifdef LINUX_INPUT - dev->read_input=xf86WcmReadUSBInput; - common->wcmOpen=xf86WcmUSBOpen; - ErrorF("%s Wacom reading USB link\n", XCONFIG_GIVEN); -#else - ErrorF("The USB version of the driver isn't available for your platform\n"); -#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; - - default: - xf86ConfigError("Wacom subsection keyword expected"); - break; - } - } - - DBG(1, ErrorF("xf86WcmConfig name=%s\n", common->wcmDevice)); - - return Success; -} -#endif /* Pre 3.9 stuff */ - -#if 0 -/* - *************************************************************************** - * - * ascii_to_hexa -- - * - *************************************************************************** - */ -/* - * transform two ascii hexa representation into an unsigned char - * most significant byte is the first one - */ -static unsigned char -ascii_to_hexa(char buf[2]) -{ - unsigned char uc; - - if (buf[0] >= 'A') { - uc = buf[0] - 'A' + 10; - } - else { - uc = buf[0] - '0'; - } - uc = uc << 4; - if (buf[1] >= 'A') { - uc += buf[1] - 'A' + 10; - } - else { - uc += buf[1] - '0'; - } - return uc; -} -#endif - -#ifndef XFREE86_V4 -/* - *************************************************************************** - * - * set_serial_speed -- - * - * Set speed of the serial port. - * - *************************************************************************** - */ -static int -set_serial_speed(int fd, - int speed_code) -{ - struct termios termios_tty; - int err; - -#ifdef POSIX_TTY - SYSCALL(err = tcgetattr(fd, &termios_tty)); - - if (err == -1) { - ErrorF("Wacom tcgetattr error : %s\n", strerror(errno)); - return !Success; - } - termios_tty.c_iflag = IXOFF; - termios_tty.c_oflag = 0; - termios_tty.c_cflag = speed_code|CS8|CREAD|CLOCAL; - termios_tty.c_lflag = 0; - - termios_tty.c_cc[VINTR] = 0; - termios_tty.c_cc[VQUIT] = 0; - termios_tty.c_cc[VERASE] = 0; - termios_tty.c_cc[VEOF] = 0; -#ifdef VWERASE - termios_tty.c_cc[VWERASE] = 0; -#endif -#ifdef VREPRINT - termios_tty.c_cc[VREPRINT] = 0; -#endif - termios_tty.c_cc[VKILL] = 0; - termios_tty.c_cc[VEOF] = 0; - termios_tty.c_cc[VEOL] = 0; -#ifdef VEOL2 - termios_tty.c_cc[VEOL2] = 0; -#endif - termios_tty.c_cc[VSUSP] = 0; -#ifdef VDSUSP - termios_tty.c_cc[VDSUSP] = 0; -#endif -#ifdef VDISCARD - termios_tty.c_cc[VDISCARD] = 0; -#endif -#ifdef VLNEXT - termios_tty.c_cc[VLNEXT] = 0; -#endif - - /* minimum 1 character in one read call and timeout to 100 ms */ - termios_tty.c_cc[VMIN] = 1; - termios_tty.c_cc[VTIME] = 10; - - SYSCALL(err = tcsetattr(fd, TCSANOW, &termios_tty)); - if (err == -1) { - ErrorF("Wacom tcsetattr TCSANOW error : %s\n", strerror(errno)); - return !Success; - } - -#else - Code for OSs without POSIX tty functions -#endif - - return Success; -} - -/* - *************************************************************************** - * - * wait_for_fd -- - * - * Wait one second that the file descriptor becomes readable. - * - *************************************************************************** - */ -static int -wait_for_fd(int fd) -{ - int err; - fd_set readfds; - struct timeval timeout; - - FD_ZERO(&readfds); - FD_SET(fd, &readfds); - - timeout.tv_sec = 1; - timeout.tv_usec = 0; - SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); - - return err; -} - /* *************************************************************************** * - * flush_input_fd -- - * - * Flush all input pending on the file descriptor. - * - *************************************************************************** - */ -static int -flush_input_fd(int fd) -{ - int err; - fd_set readfds; - struct timeval timeout; - char dummy[1]; - - FD_ZERO(&readfds); - FD_SET(fd, &readfds); - - do { - timeout.tv_sec = 0; - timeout.tv_usec = 0; - SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); - - if (err > 0) { - SYSCALL(err = read(fd, &dummy, 1)); - DBG(10, ErrorF("flush_input_fd: read %d bytes\n", err)); - } - } while (err > 0); - return err; -} -#endif /* Pre 3.9 stuff */ - -/* - *************************************************************************** - * * send_request -- * *************************************************************************** @@ -1179,7 +570,6 @@ if (first != 0 || num == 1) return FALSE; -#ifdef XFREE86_V4 if (priv->screen_no != -1) { width = screenInfo.screens[priv->screen_no]->width; height = screenInfo.screens[priv->screen_no]->height; @@ -1192,18 +582,15 @@ / (priv->bottomX - priv->topX); priv->factorY = ((double) height) / (priv->bottomY - priv->topY); -#endif *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; } @@ -1223,12 +610,10 @@ { WacomDevicePtr priv = (WacomDevicePtr) local->private; -#ifdef XFREE86_V4 priv->factorX = ((double) miPointerCurrentScreen()->width) / (priv->bottomX - priv->topX); priv->factorY = ((double) miPointerCurrentScreen()->height) / (priv->bottomY - priv->topY); -#endif valuators[0] = x / priv->factorX + 0.5; valuators[1] = y / priv->factorY + 0.5; @@ -2353,11 +1738,7 @@ unsigned long bit[EV_MAX][NBITS(KEY_MAX)]; int i, j; -#ifdef XFREE86_V4 local->fd = xf86OpenSerial(local->options); -#else - SYSCALL(local->fd = open(common->wcmDevice, O_RDONLY|O_NDELAY, 0)); -#endif if (local->fd == -1) { ErrorF("Error opening %s : %s\n", common->wcmDevice, strerror(errno)); return !Success; @@ -2470,30 +1851,16 @@ * *************************************************************************** */ -#ifdef XFREE86_V4 #define WAIT(t) \ err = xf86WaitForInput(-1, ((t) * 1000)); \ if (err == -1) { \ ErrorF("Wacom select error : %s\n", strerror(errno)); \ return !Success; \ } -#else -#define WAIT(t) \ - timeout.tv_sec = 0; \ - timeout.tv_usec = (t) * 1000; \ - SYSCALL(err = select(0, NULL, NULL, NULL, &timeout)); \ - if (err == -1) { \ - ErrorF("Wacom select error : %s\n", strerror(errno)); \ - return !Success; \ - } -#endif static Bool xf86WcmOpen(LocalDevicePtr local) { -#ifndef XFREE86_V4 - struct timeval timeout; -#endif char buffer[256]; char header[64]; /* This is a small buffer for discarding the unwanted header */ int err; @@ -2506,11 +1873,7 @@ DBG(1, ErrorF("opening %s\n", common->wcmDevice)); -#ifdef XFREE86_V4 local->fd = xf86OpenSerial(local->options); -#else - SYSCALL(local->fd = open(common->wcmDevice, O_RDWR|O_NDELAY, 0)); -#endif if (local->fd < 0) { ErrorF("Error opening %s : %s\n", common->wcmDevice, strerror(errno)); return !Success; @@ -2536,14 +1899,9 @@ DBG(1, ErrorF("initializing tablet\n")); /* Set the speed of the serial link to 38400 */ -#ifdef XFREE86_V4 if (xf86SetSerialSpeed(local->fd, 38400) < 0) { return !Success; } -#else - if (set_serial_speed(local->fd, B38400) == !Success) - return !Success; -#endif /* Send reset to the tablet */ SYSCALL(err = write(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD))); @@ -2566,14 +1924,9 @@ WAIT(75); /* Set the speed of the serial link to 19200 */ -#ifdef XFREE86_V4 if (xf86SetSerialSpeed(local->fd, 19200) < 0) { return !Success; } -#else - if (set_serial_speed(local->fd, B19200) == !Success) - return !Success; -#endif /* Send reset to the tablet */ SYSCALL(err = write(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD))); @@ -2596,14 +1949,9 @@ WAIT(75); /* Set the speed of the serial link to 9600 */ -#ifdef XFREE86_V4 if (xf86SetSerialSpeed(local->fd, 9600) < 0) { return !Success; } -#else - if (set_serial_speed(local->fd, B9600) == !Success) - return !Success; -#endif /* Send reset to the tablet */ SYSCALL(err = write(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD))); @@ -2624,11 +1972,7 @@ /* Wait 30 mSecs */ WAIT(30); -#ifdef XFREE86_V4 xf86FlushInput(local->fd); -#else - flush_input_fd(local->fd); -#endif DBG(2, ErrorF("reading model\n")); if (!send_request(local->fd, WC_MODEL, buffer)) { @@ -2850,9 +2194,6 @@ if (common->wcmLinkSpeed > 9600) { if (common->wcmProtocolLevel == 5) { char *speed_init_string = WC_V_19200; -#ifndef XFREE86_V4 - int speed = B19200; -#endif DBG(1, ErrorF("Switching serial link to %d\n", common->wcmLinkSpeed)); if (common->wcmLinkSpeed == 38400 && version < 2.0) { @@ -2864,16 +2205,10 @@ switch (common->wcmLinkSpeed) { case 38400: speed_init_string = WC_V_38400; -#ifndef XFREE86_V4 - speed = B38400; -#endif break; case 19200: speed_init_string = WC_V_19200; -#ifndef XFREE86_V4 - speed = B19200; -#endif break; } /* Switch the tablet to the requested speed */ @@ -2887,14 +2222,9 @@ WAIT(75); /* Set the speed of the serial link to requested speed */ -#ifdef XFREE86_V4 if (xf86SetSerialSpeed(local->fd, common->wcmLinkSpeed) < 0) { return !Success; } -#else - if (set_serial_speed(local->fd, speed) == !Success) - return !Success; -#endif } else { ErrorF("Changing the speed of a wacom IV device is not yet implemented\n"); @@ -3216,9 +2546,6 @@ else { /* allocate the motion history buffer if needed */ xf86MotionHistoryAllocate(local); -#ifndef XFREE86_V4 - AssignTypeAndName(pWcm, local->atom, local->name); -#endif } /* open the device to gather informations */ @@ -3232,11 +2559,7 @@ if ((local->fd < 0) && (!xf86WcmOpenDevice(pWcm))) { return !Success; } -#ifdef XFREE86_V4 xf86AddEnabledDevice(local); -#else - AddEnabledDevice(local->fd); -#endif pWcm->public.on = TRUE; break; @@ -3244,11 +2567,7 @@ DBG(1, ErrorF("xf86WcmProc pWcm=0x%x what=%s\n", pWcm, (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); if (local->fd >= 0) { -#ifdef XFREE86_V4 xf86RemoveEnabledDevice(local); -#else - RemoveEnabledDevice(local->fd); -#endif xf86WcmClose(local); } pWcm->public.on = FALSE; @@ -3360,11 +2679,7 @@ return NULL; } -#ifdef XFREE86_V4 local = xf86AllocateInput(wcmDrv, 0); -#else - local = (LocalDevicePtr) xalloc(sizeof(LocalDeviceRec)); -#endif if (!local) { xfree(priv); xfree(common); @@ -3373,9 +2688,6 @@ 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; @@ -3528,36 +2840,6 @@ xf86WcmAllocateEraser /* device_allocate */ }; -#ifndef XFREE86_V4 -#ifdef DYNAMIC_MODULE -/* - *************************************************************************** - * - * entry point of dynamic loading - * - *************************************************************************** - */ -int -#ifndef DLSYM_BUG -init_module(unsigned long server_version) -#else -init_xf86Wacom(unsigned long server_version) -#endif -{ - xf86AddDeviceAssoc(&wacom_stylus_assoc); - xf86AddDeviceAssoc(&wacom_cursor_assoc); - xf86AddDeviceAssoc(&wacom_eraser_assoc); - - if (server_version != XF86_VERSION_CURRENT) { - ErrorF("Warning: Wacom module compiled for version%s\n", XF86_VERSION); - return 0; - } else { - return 1; - } -} -#endif /* DYNAMIC_MODULE */ - -#else /* XFREE86_V4 */ /* * xf86WcmUninit -- @@ -3785,12 +3067,12 @@ } common->wcmResolY = xf86SetIntOption(local->options, "ResolutionY", common->wcmResolY); if (common->wcmResolY != 0) { - xf86Msg(X_CONFIG, "%s: resol x = %d\n", dev->identifier, + xf86Msg(X_CONFIG, "%s: resol y = %d\n", dev->identifier, common->wcmResolY); } common->wcmResolZ = xf86SetIntOption(local->options, "ResolutionZ", common->wcmResolZ); if (common->wcmResolZ != 0) { - xf86Msg(X_CONFIG, "%s: resol x = %d\n", dev->identifier, + xf86Msg(X_CONFIG, "%s: resol z = %d\n", dev->identifier, common->wcmResolZ); } @@ -3875,8 +3157,12 @@ int *errmaj, int *errmin) { - xf86Msg(X_INFO, "Wacom driver level: %s\n", identification+strlen("$Identification: ")); - + + /* The following message causes xf86cfg to puke. Commented out for now */ +#if 0 + xf86Msg(X_INFO, "Wacom driver level: %s\n", identification+strlen("$Identification: ")); +#endif + xf86AddInputDriver(&WACOM, module, 0); return module; @@ -3902,7 +3188,6 @@ xf86WcmUnplug}; #endif /* XFree86LOADER */ -#endif /* XFREE86_V4 */ /* * Local variables: Index: xc/programs/Xserver/hw/xfree86/int10/Imakefile diff -u xc/programs/Xserver/hw/xfree86/int10/Imakefile:1.13 xc/programs/Xserver/hw/xfree86/int10/Imakefile:1.14 --- xc/programs/Xserver/hw/xfree86/int10/Imakefile:1.13 Thu Dec 7 10:43:45 2000 +++ xc/programs/Xserver/hw/xfree86/int10/Imakefile Sat Oct 27 23:33:59 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.13 2000/12/07 15:43:45 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.14 2001/10/28 03:33:59 tsi Exp $ /* An OS-independent INT10 module/library */ @@ -39,6 +39,8 @@ ARCHDEFINES = -D_PC # elif defined(ia64Architecture) ARCHDEFINES = -D_PC_IO -D_PC_PCI +# elif defined(SparcArchitecture) || defined(PpcArchitecture) +ARCHDEFINES = -D__BIG_ENDIAN__ # endif INT10DEFINES = -D_X86EMU $(ARCHDEFINES) Index: xc/programs/Xserver/hw/xfree86/int10/generic.c diff -u xc/programs/Xserver/hw/xfree86/int10/generic.c:1.22.2.1 xc/programs/Xserver/hw/xfree86/int10/generic.c:1.23 --- xc/programs/Xserver/hw/xfree86/int10/generic.c:1.22.2.1 Mon May 28 10:23:39 2001 +++ xc/programs/Xserver/hw/xfree86/int10/generic.c Mon May 28 10:21:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.22.2.1 2001/05/28 14:23:39 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.23 2001/05/28 14:21:56 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -51,6 +51,7 @@ static void UnmapVRam(xf86Int10InfoPtr pInt); static void *sysMem = NULL; + xf86Int10InfoPtr xf86InitInt10(int entityIndex) Index: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c diff -u xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.20.2.1 xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.21 --- xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.20.2.1 Tue May 22 12:26:46 2001 +++ xc/programs/Xserver/hw/xfree86/int10/helper_mem.c Tue May 22 12:24:37 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.20.2.1 2001/05/22 16:26:46 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.21 2001/05/22 16:24:37 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment Index: xc/programs/Xserver/hw/xfree86/int10/pci.c diff -u xc/programs/Xserver/hw/xfree86/int10/pci.c:1.8.2.2 xc/programs/Xserver/hw/xfree86/int10/pci.c:1.11 --- xc/programs/Xserver/hw/xfree86/int10/pci.c:1.8.2.2 Fri May 25 14:15:46 2001 +++ xc/programs/Xserver/hw/xfree86/int10/pci.c Mon Oct 1 09:44:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.8.2.2 2001/05/25 18:15:46 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.11 2001/10/01 13:44:13 eich Exp $ */ /* * XFree86 int10 module @@ -32,49 +32,7 @@ /* 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"); -#endif - return 0; - } - - length = 0; - while ((ptr[0] == 0x55) && (ptr[1] == 0xAA)) { - unsigned short data_off = ptr[0x18] | (ptr[0x19] << 8); - unsigned char *data = ptr + data_off; - unsigned char type; - - if ((data[0] != 'P') || - (data[1] != 'C') || - (data[2] != 'I') || - (data[3] != 'R')) - break; - type = data[0x14]; -#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 */ - unsigned int image_length; - unsigned char indicator = data[0x15]; - if (indicator & 0x80) /* last image */ - break; - image_length = (data[0x10] | (data[0x11] << 8)) << 9; -#ifdef PRINT_PCI - ErrorF("data image length: 0x%x, ind: 0x%x\n", - image_length, indicator); -#endif - ptr += image_length; - continue; - } - /* OK, we have a PC Image */ - length = ptr[2] << 9; -#ifdef PRINT_PCI - ErrorF("BIOS length: 0x%x\n", length); -#endif - break; - } + length = xf86ReadPciBIOS(0, tag, -1, ptr, length); if (length > 0) memcpy(address, ptr, length); Index: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c diff -u xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.7 xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.8 --- xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.7 Sun Mar 25 00:32:13 2001 +++ xc/programs/Xserver/hw/xfree86/int10/xf86int10.c Mon Oct 1 09:44:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.7 2001/03/25 05:32:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.8 2001/10/01 13:44:13 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -742,7 +742,7 @@ dump_registers(pInt); if (xf86GetVerbosity() > 3) stack_trace(pInt); - return 1; + return 0; } } Index: xc/programs/Xserver/hw/xfree86/loader/Imakefile diff -u xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.27 xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.29 --- xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.27 Sat Apr 21 16:14:39 2001 +++ xc/programs/Xserver/hw/xfree86/loader/Imakefile Fri Nov 16 11:47:55 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/loader/Imakefile,v 1.27 2001/04/21 20:14:39 herrb Exp $ */ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/loader/Imakefile,v 1.29 2001/11/16 16:47:55 dawes Exp $ */ @@ -22,7 +22,16 @@ DLOBJ=dlloader.o #endif -DEFINES = $(DBMALLOCDEFINE) $(DLOPENDEFINES) $(OS_DEFINES) +#if FontencCompatibility + COMPAT_DEFINES = -DFONTENC_COMPATIBILITY +#endif + +#if HasShm + SHM_DEFINES = -DHAS_SHM +#endif + +DEFINES = $(DBMALLOCDEFINE) $(DLOPENDEFINES) $(OS_DEFINES) $(COMPAT_DEFINES) \ + $(SHM_DEFINES) MODULEDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" Index: xc/programs/Xserver/hw/xfree86/loader/aoutloader.c diff -u xc/programs/Xserver/hw/xfree86/loader/aoutloader.c:1.15 xc/programs/Xserver/hw/xfree86/loader/aoutloader.c:1.17 --- xc/programs/Xserver/hw/xfree86/loader/aoutloader.c:1.15 Sun Mar 14 06:18:05 1999 +++ xc/programs/Xserver/hw/xfree86/loader/aoutloader.c Fri Nov 16 11:47:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/aoutloader.c,v 1.15 1999/03/14 11:18:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/aoutloader.c,v 1.17 2001/11/16 16:47:55 dawes Exp $ */ /* * @@ -29,12 +29,13 @@ #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> -#ifdef QNX +#ifdef __QNX__ #include <fcntl.h> #else #include <sys/fcntl.h> #endif #include <sys/stat.h> +#include <netinet/in.h> #ifdef DBMALLOC #include <debug/malloc.h> Index: xc/programs/Xserver/hw/xfree86/loader/coffloader.c diff -u xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.15 xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.17 --- xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.15 Sat Jan 6 16:29:16 2001 +++ xc/programs/Xserver/hw/xfree86/loader/coffloader.c Mon Dec 17 15:00:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/coffloader.c,v 1.15 2001/01/06 21:29:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/coffloader.c,v 1.17 2001/12/17 20:00:44 dawes Exp $ */ /* * @@ -25,7 +25,7 @@ #include <sys/types.h> #include <unistd.h> #include <stdlib.h> -#ifdef QNX +#ifdef __QNX__ #include <fcntl.h> #else #include <sys/fcntl.h> @@ -494,8 +494,6 @@ { #if defined(i386) case R_DIR32: -#ifdef COFFDEBUG -#endif symval=COFFGetSymbolValue(cofffile, rel->r_symndx); if( symval ) { #ifdef COFFDEBUG @@ -788,16 +786,9 @@ break; #endif /* __powerpc__ */ default: -#if defined(i386) ErrorF( "COFF_RelocateEntry() Unsupported relocation type %o\n", rel->r_type ); -#endif -#if defined(__powerpc__) - ErrorF( - "COFF_RelocateEntry() Unsupported relocation type %o\n", - rel->r_type ); -#endif break; } return 0; Index: xc/programs/Xserver/hw/xfree86/loader/dixsym.c diff -u xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.38 xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.45 --- xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.38 Thu Apr 5 13:42:34 2001 +++ xc/programs/Xserver/hw/xfree86/loader/dixsym.c Sat Nov 17 11:05:59 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.38 2001/04/05 17:42:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.45 2001/11/17 16:05:59 dawes Exp $ */ /* @@ -29,17 +29,18 @@ #include "colormap.h" #include "cursor.h" #include "dix.h" +#include "dixevents.h" #include "dixfont.h" #include "dixstruct.h" #include "misc.h" #include "globals.h" #include "os.h" +#include "osdep.h" #include "resource.h" #include "servermd.h" #include "scrnintstr.h" #include "windowstr.h" #include "extension.h" -#define EVENT_SWAP_PTR #define EXTENSION_PROC_ARGS void * #include "extnsionst.h" #include "swaprep.h" @@ -56,13 +57,6 @@ #include "mipict.h" #endif -/* XXX This should be in a header somewhere */ -extern void ClientSleepUntil(ClientPtr, TimeStamp, void(*)(ClientPtr, pointer), - pointer); -extern int ShmCompletionCode; -extern int BadShmSegCode; -extern RESTYPE ShmSegType; - /* DIX things */ LOOKUP dixLookupTab[] = { @@ -96,6 +90,7 @@ SYMFUNC(SendErrorToClient) SYMFUNC(UpdateCurrentTime) SYMFUNC(UpdateCurrentTimeIf) + SYMFUNC(ProcBadRequest) SYMVAR(dispatchException) SYMVAR(isItTimeToYield) SYMVAR(ClientStateCallback) @@ -167,6 +162,7 @@ SYMVAR(DPMSDisabledSwitch) SYMVAR(defaultDPMSEnabled) #ifdef XV + /* XXX These are exported from the DDX, not DIX. */ SYMVAR(XvScreenInitProc) SYMVAR(XvGetScreenIndexProc) SYMVAR(XvGetRTPortProc) @@ -185,6 +181,8 @@ SYMVAR(screenInfo) SYMVAR(serverClient) SYMVAR(serverGeneration) + /* main.c */ + SYMFUNC(NotImplemented) /* pixmap.c */ SYMFUNC(AllocatePixmap) SYMFUNC(GetScratchPixmapHeader) @@ -225,6 +223,8 @@ SYMFUNC(SwapColorItem) /* tables.c */ SYMVAR(EventSwapVector) + SYMVAR(ReplySwapVector) + SYMVAR(ProcVector) /* window.c */ SYMFUNC(ChangeWindowAttributes) SYMFUNC(CheckWindowOptionalNeed) @@ -285,6 +285,8 @@ SYMFUNC(AttendClient) SYMFUNC(AddEnabledDevice) SYMFUNC(RemoveEnabledDevice) + SYMFUNC(MakeClientGrabPervious) + SYMFUNC(MakeClientGrabImpervious) SYMVAR(GrabInProgress) /* utils.c */ SYMFUNC(AdjustWaitForDelay) @@ -292,6 +294,8 @@ /* devices.c */ SYMFUNC(InitPointerDeviceStruct) + SYMFUNC(LookupKeyboardDevice) + SYMFUNC(LookupPointerDevice) #ifdef XINPUT /* Xi */ /* exevents.c */ @@ -302,17 +306,8 @@ #endif /* xf86DGA.c */ + /* XXX This is exported from the DDX, not DIX. */ SYMVAR(XDGAEventBase) - - /* libfont.a */ - SYMFUNC(GetGlyphs) - SYMFUNC(QueryGlyphExtents) - - /* libXext.a */ - SYMFUNC(ClientSleepUntil) - SYMVAR(ShmCompletionCode) - SYMVAR(BadShmSegCode) - SYMVAR(ShmSegType) /* librender.a */ #ifdef RENDER Index: xc/programs/Xserver/hw/xfree86/loader/elf.h diff -u xc/programs/Xserver/hw/xfree86/loader/elf.h:1.11 xc/programs/Xserver/hw/xfree86/loader/elf.h:1.12 --- xc/programs/Xserver/hw/xfree86/loader/elf.h:1.11 Fri Apr 27 15:34:00 2001 +++ xc/programs/Xserver/hw/xfree86/loader/elf.h Mon Jan 14 13:16:52 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.11 2001/04/27 19:34:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.12 2002/01/14 18:16:52 dawes Exp $ */ typedef unsigned int Elf32_Addr; @@ -435,6 +435,44 @@ #define R_PPC_SECTOFF_HI 35 #define R_PPC_SECTOFF_HA 36 #endif + +/* ARM relocs. */ +#define R_ARM_NONE 0 /* No reloc */ +#define R_ARM_PC24 1 /* PC relative 26 bit branch */ +#define R_ARM_ABS32 2 /* Direct 32 bit */ +#define R_ARM_REL32 3 /* PC relative 32 bit */ +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 /* Direct 16 bit */ +#define R_ARM_ABS12 6 /* Direct 12 bit */ +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 /* Direct 8 bit */ +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_SWI24 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_COPY 20 /* Copy symbol at runtime */ +#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ +#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ +#define R_ARM_RELATIVE 23 /* Adjust by program base */ +#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ +#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ +#define R_ARM_GOT32 26 /* 32 bit GOT entry */ +#define R_ARM_PLT32 27 /* 32 bit PLT address */ +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ +#define R_ARM_THM_PC9 103 /* thumb conditional branch */ +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS22 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 typedef struct elf32_rel { Elf32_Addr r_offset; Index: xc/programs/Xserver/hw/xfree86/loader/elfloader.c diff -u xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.37 xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.40 --- xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.37 Fri Apr 27 15:34:00 2001 +++ xc/programs/Xserver/hw/xfree86/loader/elfloader.c Mon Jan 14 13:16:52 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.37 2001/04/27 19:34:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.40 2002/01/14 18:16:52 dawes Exp $ */ /* * @@ -25,7 +25,7 @@ #include <sys/types.h> #include <unistd.h> #include <stdlib.h> -#ifdef QNX +#ifdef __QNX__ #include <fcntl.h> #else #include <sys/fcntl.h> @@ -1104,7 +1104,7 @@ { unsigned char *secp = elffile->saddr[secn]; unsigned int *dest32; /* address of the 32 bit place being modified */ -#if defined(__powerpc__) || defined(__mc68000__) || defined(__sparc__) +#if defined(__powerpc__) || defined(__sparc__) unsigned short *dest16; /* address of the 16 bit place being modified */ #endif #if defined(__sparc__) @@ -1380,35 +1380,53 @@ #endif /* alpha */ #if defined(__mc68000__) case R_68K_32: - dest32=(unsigned long *)(secp+rel->r_offset); + dest32=(unsigned int *)(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" ); + ELFDEBUG( "secp=%x\t", secp ); + ELFDEBUG( "symval=%x\t", symval ); + ELFDEBUG( "r_addend=%x\t", rel->r_addend ); + ELFDEBUG( "dest32=%8.8x\t", dest32 ); + ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); #endif - *dest32=symval+(*dest32); /* S + A */ + { + unsigned long val; + /* S + A */ + val=symval+(rel->r_addend); #ifdef ELFDEBUG - ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); + ELFDEBUG("S+A=%x\t",val); #endif - break; + *dest32=val; /* S + A */ + } +#ifdef ELFDEBUG + ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); +#endif + break; case R_68K_PC32: - dest32=(unsigned long *)(secp+rel->r_offset); + dest32=(unsigned int *)(secp+rel->r_offset); #ifdef ELFDEBUG - 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 ); + ELFDEBUG( "R_68K_PC32\t" ); + ELFDEBUG( "secp=%x\t", secp ); + ELFDEBUG( "symval=%x\t", symval ); + ELFDEBUG( "r_addend=%x\t", rel->r_addend ); + ELFDEBUG( "dest32=%8.8x\t", dest32 ); + ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); #endif - - *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ - + { + unsigned long val; + /* S + A - P */ + val=symval+(rel->r_addend); + val-=*dest32; #ifdef ELFDEBUG - ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); + ELFDEBUG("S+A=%x\t",val); + ELFDEBUG("S+A-P=%x\t",val+(*dest32)-(Elf_Addr)dest32); #endif - - break; + *dest32=val+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ + } +#ifdef ELFDEBUG + ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); +#endif + break; #endif /* __mc68000__ */ #if defined(__powerpc__) #if defined(PowerMAX_OS) @@ -2026,6 +2044,58 @@ break; #endif + +#if defined(__arm__) + case R_ARM_ABS32: + dest32=(unsigned int *)(secp+rel->r_offset); +#ifdef ELFDEBUG + ELFDEBUG( "R_ARM_ABS32\t"); + ELFDEBUG( "dest32=%x\t", dest32 ); + ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); +#endif + *dest32=symval+(*dest32); /* S + A */ +#ifdef ELFDEBUG + ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); +#endif + break; + + case R_ARM_REL32: + dest32=(unsigned int *)(secp+rel->r_offset); +#ifdef ELFDEBUG + { + char *namestr; + ELFDEBUG( "R_ARM_REL32 %s\t", + namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); + xf86loaderfree(namestr); + 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 */ + +#ifdef ELFDEBUG + ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); +#endif + + break; + + case R_ARM_PC24: + { + unsigned long val; + dest32=(unsigned int *)(secp+rel->r_offset); + val = (*dest32 & 0x00ffffff) << 2; + val = symval - (unsigned long)dest32 + val; + val >>= 2; + *dest32 = (*dest32 & 0xff000000) | (val & 0x00ffffff); + arm_flush_cache(dest32); + } + break; + +#endif /* (__arm__) */ + default: ErrorF("Elf_RelocateEntry() Unsupported relocation type %d\n", ELF_R_TYPE(rel->r_info)); @@ -2398,7 +2468,7 @@ #endif continue; } -#if defined(i386) || defined(__alpha__) || defined(__ia64__) +#if defined(i386) || defined(__alpha__) || defined(__ia64__) || defined(__arm__) /* .rel.text */ if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name), ".rel.text" ) == 0 ) { Index: xc/programs/Xserver/hw/xfree86/loader/extsym.c diff -u xc/programs/Xserver/hw/xfree86/loader/extsym.c:1.5 xc/programs/Xserver/hw/xfree86/loader/extsym.c:1.6 --- xc/programs/Xserver/hw/xfree86/loader/extsym.c:1.5 Wed Nov 1 17:50:04 2000 +++ xc/programs/Xserver/hw/xfree86/loader/extsym.c Sat Nov 17 11:05:59 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/extsym.c,v 1.5 2000/11/01 22:50:04 anderson Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/extsym.c,v 1.6 2001/11/17 16:05:59 dawes Exp $ */ /* * @@ -30,6 +30,7 @@ #ifdef PANORAMIX #include "panoramiX.h" #endif +#include "sleepuntil.h" #ifdef HAS_SHM extern int ShmCompletionCode; @@ -51,6 +52,8 @@ #endif LOOKUP extLookupTab[] = { + + SYMFUNC(ClientSleepUntil) #ifdef HAS_SHM SYMVAR(ShmCompletionCode) Index: xc/programs/Xserver/hw/xfree86/loader/fontsym.c diff -u xc/programs/Xserver/hw/xfree86/loader/fontsym.c:1.6 xc/programs/Xserver/hw/xfree86/loader/fontsym.c:1.9 --- xc/programs/Xserver/hw/xfree86/loader/fontsym.c:1.6 Sun Feb 13 01:15:41 2000 +++ xc/programs/Xserver/hw/xfree86/loader/fontsym.c Sat Nov 17 11:05:59 2001 @@ -1,9 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/fontsym.c,v 1.6 2000/02/13 06:15:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/fontsym.c,v 1.9 2001/11/17 16:05:59 dawes Exp $ */ #include "font.h" #include "sym.h" #include "fntfilst.h" #include "fontenc.h" +#ifdef FONTENC_COMPATIBILITY +#include "fontencc.h" +#endif #include "fntfilio.h" #include "fntfil.h" #include "fontutil.h" @@ -33,14 +36,30 @@ SYMFUNC(BitOrderInvert) SYMFUNC(FontFileMatchRenderer) SYMFUNC(RepadBitmap) - SYMFUNC(font_encoding_name) - SYMFUNC(font_encoding_recode) - SYMFUNC(font_encoding_find) - SYMFUNC(font_encoding_from_xlfd) + SYMFUNC(FontEncName) + SYMFUNC(FontEncRecode) + SYMFUNC(FontEncFind) + SYMFUNC(FontMapFind) + SYMFUNC(FontEncMapFind) + SYMFUNC(FontEncFromXLFD) + SYMFUNC(FontEncDirectory) + SYMFUNC(FontMapReverse) + SYMFUNC(FontMapReverseFree) SYMFUNC(CreateFontRec) SYMFUNC(DestroyFontRec) + SYMFUNC(GetGlyphs) + SYMFUNC(QueryGlyphExtents) SYMVAR(FontFileBitmapSources) + +#ifdef FONTENC_COMPATIBILITY + /* Obsolete backwards compatibility symbols -- fontencc.c */ + SYMFUNC(font_encoding_from_xlfd) + SYMFUNC(font_encoding_find) + SYMFUNC(font_encoding_recode) + SYMFUNC(font_encoding_name) + SYMFUNC(identifyEncodingFile) +#endif /* fontcache.c */ SYMFUNC(FontCacheGetSettings) Index: xc/programs/Xserver/hw/xfree86/loader/hash.c diff -u xc/programs/Xserver/hw/xfree86/loader/hash.c:1.18 xc/programs/Xserver/hw/xfree86/loader/hash.c:1.19 --- xc/programs/Xserver/hw/xfree86/loader/hash.c:1.18 Thu Feb 22 18:17:09 2001 +++ xc/programs/Xserver/hw/xfree86/loader/hash.c Wed Jul 25 11:05:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/hash.c,v 1.18 2001/02/22 23:17:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/hash.c,v 1.19 2001/07/25 15:05:07 dawes Exp $ */ /* * @@ -25,12 +25,8 @@ #include "os.h" #include "Xos.h" -#ifndef X_NOT_STDC_ENV #undef abs #include <stdlib.h> -#else -extern void free(); -#endif #include "sym.h" #include "loader.h" #include "hash.h" Index: xc/programs/Xserver/hw/xfree86/loader/loader.c diff -u xc/programs/Xserver/hw/xfree86/loader/loader.c:1.53 xc/programs/Xserver/hw/xfree86/loader/loader.c:1.55 --- xc/programs/Xserver/hw/xfree86/loader/loader.c:1.53 Thu Apr 5 11:55:28 2001 +++ xc/programs/Xserver/hw/xfree86/loader/loader.c Sat Oct 27 23:33:59 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.53 2001/04/05 15:55:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.55 2001/10/28 03:33:59 tsi Exp $ */ /* * @@ -99,6 +99,7 @@ DEFFUNCDOT(umul) DEFFUNCDOT(div) DEFFUNCDOT(udiv) +#ifdef linux static LOOKUP SparcV89LookupTab[] = { SYMFUNCDOT89(rem) SYMFUNCDOT89(urem) @@ -108,6 +109,7 @@ SYMFUNCDOT89(udiv) { 0, 0 } }; +#endif static LOOKUP SparcLookupTab[] = { SYMFUNCDOT(rem) SYMFUNCDOT(urem) @@ -704,38 +706,52 @@ } void -LoaderRefSymbols(const char *sym0, ...) +LoaderVRefSymbols(const char *sym0, va_list args) { - va_list ap; const char *s; if (sym0 == NULL) return; - va_start(ap, sym0); s = sym0; do { AppendSymbol(&refList, s); - s = va_arg(ap, const char *); + s = va_arg(args, const char *); } while (s != NULL); - va_end(ap); } void -LoaderRefSymLists(const char **list0, ...) +LoaderRefSymbols(const char *sym0, ...) { va_list ap; + + va_start(ap, sym0); + LoaderVRefSymbols(sym0, ap); + va_end(ap); +} + +void +LoaderVRefSymLists(const char **list0, va_list args) +{ const char **l; if (list0 == NULL) return; - va_start(ap, list0); l = list0; do { AppendSymList(&refList, l); - l = va_arg(ap, const char **); + l = va_arg(args, const char **); } while (l != NULL); +} + +void +LoaderRefSymLists(const char **list0, ...) +{ + va_list ap; + + va_start(ap, list0); + LoaderVRefSymLists(list0, ap); va_end(ap); } Index: xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h diff -u xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h:1.17 xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h:1.18 --- xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h:1.17 Mon Nov 13 18:09:57 2000 +++ xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h Wed Jun 13 19:10:43 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h,v 1.17 2000/11/13 23:09:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h,v 1.18 2001/06/13 23:10:43 dawes Exp $ */ /* * @@ -76,6 +76,8 @@ void LoaderVReqSymLists(const char **, va_list args); void LoaderVReqSymbols(const char *, va_list args); +void LoaderVRefSymLists(const char **, va_list args); +void LoaderVRefSymbols(const char *, va_list args); void LoaderShowStack(void); void *LoaderSymbolHandle(const char *, int); Index: xc/programs/Xserver/hw/xfree86/loader/loadmod.c diff -u xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.64 xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.66 --- xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.64 Tue Mar 27 18:42:17 2001 +++ xc/programs/Xserver/hw/xfree86/loader/loadmod.c Mon Dec 17 15:00:45 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.64 2001/03/27 23:42:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.66 2001/12/17 20:00:45 dawes Exp $ */ /* * @@ -29,9 +29,6 @@ /* For stat() and related stuff */ #define NO_OSLIB_PROTOTYPES #include "xf86_OSlib.h" -#if defined(SVR4) -#include <sys/stat.h> -#endif #define LOADERDECLARATIONS #include "loaderProcs.h" #include "misc.h" @@ -1198,7 +1195,7 @@ msg = "module does not exist"; break; case LDR_NOSUBENT: - msg = "submodule could not be loaded"; + msg = "a required submodule could not be loaded"; break; case LDR_NOSPACE: msg = "too many modules"; Index: xc/programs/Xserver/hw/xfree86/loader/misym.c diff -u xc/programs/Xserver/hw/xfree86/loader/misym.c:1.32 xc/programs/Xserver/hw/xfree86/loader/misym.c:1.33 --- xc/programs/Xserver/hw/xfree86/loader/misym.c:1.32 Tue Sep 19 22:05:11 2000 +++ xc/programs/Xserver/hw/xfree86/loader/misym.c Mon Aug 6 18:45:52 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/misym.c,v 1.32 2000/09/20 02:05:11 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/misym.c,v 1.33 2001/08/06 22:45:52 mvojkovi Exp $ */ /* * @@ -161,6 +161,7 @@ SYMFUNC(miOverlayCollectUnderlayRegions) SYMFUNC(miInitOverlay) SYMFUNC(miOverlayComputeCompositeClip) + SYMFUNC(miOverlayGetPrivateClips) SYMFUNC(miOverlaySetRootClip) SYMVAR(miZeroLineScreenIndex) SYMVAR(miSpritePointerFuncs) Index: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c diff -u xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.193 xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.202 --- xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.193 Fri May 18 20:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/loader/xf86sym.c Mon Jan 14 13:16:52 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.193 2001/05/19 00:26:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.202 2002/01/14 18:16:52 dawes Exp $ */ /* * @@ -47,6 +47,7 @@ #include "xf86cmap.h" #include "xf86fbman.h" #include "dgaproc.h" +#include "dpmsproc.h" #include "vidmodeproc.h" #include "xf86miscproc.h" #include "loader.h" @@ -103,6 +104,17 @@ extern long __umoddi3(long, long); #endif +#if defined(__arm__) +#if defined(__linux__) +#include <sys/io.h> +#endif + +extern long __divsi3(long, long); +extern long __modsi3(long, long); +extern long __udivsi3(long, long); +extern long __umodsi3(long, long); +#endif + #if defined(__powerpc__) && (defined(Lynx) || defined(linux)) void _restf14(); void _restf17(); @@ -157,8 +169,6 @@ extern int testinx(unsigned short, unsigned char); #endif -extern void DPMSSet(CARD16); - /* XFree86 things */ LOOKUP xfree86LookupTab[] = { @@ -392,6 +402,8 @@ SYMFUNC(xf86LoadOneModule) SYMFUNC(xf86UnloadSubModule) SYMFUNC(xf86LoaderCheckSymbol) + SYMFUNC(xf86LoaderRefSymLists) + SYMFUNC(xf86LoaderRefSymbols) SYMFUNC(xf86LoaderReqSymLists) SYMFUNC(xf86LoaderReqSymbols) SYMFUNC(xf86SetBackingStore) @@ -492,6 +504,7 @@ /* xf86fbman.c */ SYMFUNC(xf86InitFBManager) + SYMFUNC(xf86InitFBManagerArea) SYMFUNC(xf86InitFBManagerRegion) SYMFUNC(xf86RegisterFreeBoxCallback) SYMFUNC(xf86FreeOffscreenArea) @@ -519,6 +532,8 @@ SYMFUNC(xf86XVQueryOffscreenImages) SYMFUNC(xf86XVAllocateVideoAdaptorRec) SYMFUNC(xf86XVFreeVideoAdaptorRec) + SYMFUNC(xf86XVFillKeyHelper) + SYMFUNC(xf86XVClipVideoHelper) /* xf86xvmc.c */ SYMFUNC(xf86XvMCScreenInit) @@ -564,6 +579,7 @@ SYMFUNC(MiscExtGetKbdSettings) SYMFUNC(MiscExtGetKbdValue) SYMFUNC(MiscExtSetKbdValue) + SYMFUNC(MiscExtSetGrabKeysState) SYMFUNC(MiscExtCreateStruct) SYMFUNC(MiscExtDestroyStruct) SYMFUNC(MiscExtApply) @@ -589,7 +605,9 @@ SYMFUNC(xf86XInputSetSendCoreEvents) /* End merged segment */ #endif + SYMFUNC(DPMSGet) SYMFUNC(DPMSSet) + SYMFUNC(DPMSSupported) /* xf86Debug.c */ #ifdef BUILDDEBUG SYMFUNC(xf86Break1) @@ -706,6 +724,7 @@ SYMFUNC(xf86fgetc) SYMFUNC(xf86fgetpos) SYMFUNC(xf86fgets) + SYMFUNC(xf86finite) SYMFUNC(xf86floor) SYMFUNC(xf86fmod) SYMFUNC(xf86fopen) @@ -976,6 +995,18 @@ SYMFUNC(_inw) SYMFUNC(_inl) #endif +#if defined(__arm__) + SYMFUNC(__divsi3) + SYMFUNC(__udivsi3) + SYMFUNC(__modsi3) + SYMFUNC(__umodsi3) + SYMFUNC(outw) + SYMFUNC(outb) + SYMFUNC(outl) + SYMFUNC(inb) + SYMFUNC(inw) + SYMFUNC(inl) +#endif #ifdef __FreeBSD__ SYMFUNC(sysctlbyname) @@ -997,9 +1028,12 @@ SYMVAR(xf86Screens) SYMVAR(byte_reversed) /* debugging variables */ +#ifdef BUILDDEBUG + SYMVAR(xf86p8bit) SYMVAR(xf86DummyVar1) SYMVAR(xf86DummyVar2) SYMVAR(xf86DummyVar3) +#endif /* variables for PCI devices and cards from xf86Bus.c */ SYMVAR(xf86PCICardInfo) @@ -1021,7 +1055,7 @@ SYMVAR(res8514Shared) SYMVAR(PciAvoid) -#if defined(__powerpc__) && (!defined(NO_INLINE) || defined(Lynx)) && !defined(__OpenBSD__) +#if defined(__powerpc__) && (!defined(NO_INLINE) || defined(Lynx)) SYMVAR(ioBase) #endif Index: xc/programs/Xserver/hw/xfree86/os-support/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.44 xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.52 --- xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.44 Mon Apr 23 08:08:14 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/Imakefile Thu Dec 27 15:07:05 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.44 2001/04/23 12:08:14 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.52 2001/12/27 20:07:05 dawes Exp $ @@ -11,10 +11,11 @@ #define IHaveSubdirs #if defined(i386Architecture) || defined(ia64Architecture) || \ - (defined(LinuxArchitecture) && defined(AlphaArchitecture)) || \ + (defined(SunArchitecture) && defined(SparcArchitecture)) || \ (defined(FreeBSDArchitecture) && defined(AlphaArchitecture)) || \ - defined(PpcArchitecture) || defined(SparcArchitecture) || \ - (defined(LinuxArchitecture) && defined(MipsArchitecture)) + (defined(OpenBSDArchitecture) && defined(PpcArchitecture)) || \ + (defined(LynxOSArchitecture) && defined(PpcArchitecture)) || \ + defined(LinuxArchitecture) BUS_SUBDIR = bus #endif @@ -36,11 +37,7 @@ #if defined(SVR4Architecture) # if defined(SunArchitecture) -# if OSMinorVersion < 8 -OS_SUBDIR = solx86 -# else -OS_SUBDIR = sol8_x86 -# endif +OS_SUBDIR = sunos # elif defined(PmaxOSArchitecture) OS_SUBDIR = pmax # elif defined(DguxArchitecture) @@ -67,21 +64,9 @@ OS_SUBDIR = bsdi #endif -#if defined(i386MachArchitecture) || defined(OsfArchitecture) #if defined(GNUMachArchitecture) OS_SUBDIR = hurd -#else -OS_SUBDIR = mach #endif -#endif - -#if defined(AmoebaArchitecture) -OS_SUBDIR = amoeba -#endif - -#if defined(MinixArchitecture) -OS_SUBDIR = minix -#endif #if defined(OS2Architecture) OS_SUBDIR = os2 @@ -91,18 +76,26 @@ OS_SUBDIR = sco #endif -#if BuildXF86DRI && !DoLoadableServer +#if !DoLoadableServer + +#if BuildXF86DRI DRM_SRC = $(OS_SUBDIR)/drm/?*.c DRM_OBJ = $(OS_SUBDIR)/drm/?*.o DRM_DONES = $(OS_SUBDIR)/drm/DONE #endif +VBE_SRC = vbe/?*.c +VBE_OBJ = vbe/?*.o +VBE_DONES = vbe/DONE + +#endif + SUBDIRS = $(OS_SUBDIR) $(BUS_SUBDIR) misc vbe -SRCS = $(OS_SUBDIR)/?*.c $(BUS_SUBDIR)/?*.c misc/?*.c vbe/?*.c $(DRM_SRC) -OBJS = $(OS_SUBDIR)/?*.o $(BUS_SUBDIR)/?*.o misc/?*.o vbe/?*.o $(DRM_OBJ) +SRCS = $(OS_SUBDIR)/?*.c $(BUS_SUBDIR)/?*.c misc/?*.c $(VBE_SRC) $(DRM_SRC) +OBJS = $(OS_SUBDIR)/?*.o $(BUS_SUBDIR)/?*.o misc/?*.o $(VBE_OBJ) $(DRM_OBJ) -DONES = $(OS_SUBDIR)/DONE $(BUS_SUBDIR)/DONE misc/DONE vbe/DONE $(DRM_DONES) +DONES = $(OS_SUBDIR)/DONE $(BUS_SUBDIR)/DONE misc/DONE $(VBE_DONES) $(DRM_DONES) #if HasParallelMake MakeMutex($(SUBDIRS) $(OBJS) $(DONES)) Index: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib diff -u xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib:3.7 xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib:3.10 --- xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib:3.7 Fri Dec 8 22:31:38 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib Mon Dec 17 15:00:45 2001 @@ -34,13 +34,10 @@ at build time via Imakefile rules. This is alway preferable to reproducing functions in more than one OS library. - amoeba/ OS support for the Amoeba operating system. bsd/ OS support for the 386BSD/NetBSD/FreeBSD operating systems. bsdi/ OS support for the BSD/386 operating system. linux/ OS support for the Linux operating system. - mach/ OS support for the Mach and OSF/1 operating systems. - minix/ OS support for the Minix operating system. os2/ OS support for OS/2 2.11 and OS/2 Warp sco/ OS support for the SCO SVR3.x operating system. solx86/ OS support for the Solaris x86 operating system. @@ -75,7 +72,7 @@ { /* * Open console device, activate VTs, etc, etc. Fill in requisite - * pieces of x386Info. Most of this code comes from x386Init.c + * pieces of xf86Info. Most of this code comes from xf86Init.c */ } @@ -124,8 +121,7 @@ */ } -pointer xf86MapVidMem(int ScreenNum, int Region, pointer Base, - unsigned long Size) +pointer xf86MapVidMem(int ScreenNum, pointer Base, unsigned long Size) { /* * Handle mapping the video memory. Returns (pointer *)0 for @@ -293,7 +289,7 @@ { /* * Read characters from the keyboard device, and post the events - * by calling x386PostKbdEvent(). Read as much as is available + * by calling xf86PostKbdEvent(). Read as much as is available * without waiting. */ } @@ -350,7 +346,7 @@ { /* * Read characters from the mouse device, and post the events - * by calling x386PostMseEvent(). Read as much as is available + * by calling xf86PostMseEvent(). Read as much as is available * without waiting. If the OS doesn't handle the mouse protocol * translation, xf86MouseProtocol() may be called to do the * translation and event posting. If the OS does handle the protocol @@ -377,7 +373,7 @@ /* * When supporting an OS-based mouse driver (as opposed to the * server's internal mouse driver), read some events from the device - * and post them to the DIX layer through x386PostMseEvent(). + * and post them to the DIX layer through xf86PostMseEvent(). * * This function only needs to be implemented if USE_OSMOUSE is * defined for the OS. @@ -501,7 +497,7 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.7 2000/12/09 03:31:38 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.10 2001/12/17 20:00:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h diff -u xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h:1.2 Sat Jan 6 15:19:14 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h Sat Jun 30 17:54:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.2 2001/01/06 20:19:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.3 2001/06/30 21:54:03 tsi Exp $ */ #ifndef _INT10DEFINES_H_ #define _INT10DEFINES_H_ 1 @@ -8,7 +8,7 @@ #include <asm/vm86.h> #define CPU_R(type,name,num) \ - (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.##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) Index: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.14 xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.16 --- xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.14 Wed Mar 7 11:21:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h Mon Aug 6 16:51:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.14 2001/03/07 16:21:04 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.16 2001/08/06 20:51:10 dawes Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -127,10 +127,10 @@ * Arg to maintain before * emulate3buttons timer callback */ int resolution; - int negativeZ; - int positiveZ; - int negativeW; - int positiveW; + int negativeZ; /* button mask */ + int positiveZ; /* button mask */ + int negativeW; /* button mask */ + int positiveW; /* button mask */ pointer buffer; /* usually an XISBuffer* */ int protoBufTail; unsigned char protoBuf[8]; @@ -140,12 +140,28 @@ InputInfoPtr pInfo; int origProtocolID; const char * origProtocol; + Bool emulate3Pending;/* timer waiting */ + CARD32 emulate3Expires;/* time to fire emulation code */ + Bool emulateWheel; + int wheelInertia; + int wheelButtonMask; + int negativeX; /* Button values. Unlike the Z and */ + int positiveX; /* W equivalents, these are button */ + int negativeY; /* values rather than button masks. */ + int positiveY; + int wheelYDistance; + int wheelXDistance; } MouseDevRec, *MouseDevPtr; /* Z axis mapping */ #define MSE_NOZMAP 0 #define MSE_MAPTOX -1 #define MSE_MAPTOY -2 +#define MSE_MAPTOZ -3 +#define MSE_MAPTOW -4 + +/* Generalize for other axes. */ +#define MSE_NOAXISMAP MSE_NOZMAP #define MSE_MAXBUTTONS 12 #define MSE_DFLTBUTTONS 3 Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h diff -u 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.89 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h:3.81.2.1 Tue May 29 12:38:00 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h Mon Dec 24 18:21:25 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.81.2.1 2001/05/29 16:38:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.89 2001/12/24 23:21:25 dawes Exp $ */ /* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes <dawes@XFree86.org> @@ -98,12 +98,9 @@ #endif #endif -#if defined(MACH386) || defined(__OSF__) -# undef NULL -#endif /* MACH386 || __OSF__ */ - #include <stdio.h> #include <ctype.h> +#include <stddef.h> /**************************************************************************/ /* SYSV386 (SVR3, SVR4) - But not Solaris8 */ @@ -245,10 +242,6 @@ # endif # endif -# ifndef NULL -# define NULL 0 -# endif - #endif /* (SYSV || SVR4) && !DGUX */ /********** @@ -264,6 +257,7 @@ # include <sys/psw.h> # include <termio.h> +# include <sys/fbio.h> # include <sys/kbd.h> # include <sys/kbio.h> @@ -340,10 +334,6 @@ #undef VT_SYSREQ_DEFAULT #define VT_SYSREQ_DEFAULT FALSE /* Make sure that we dont define any VTs since DG/ux has none */ -#ifndef NULL -# define NULL 0 -#endif - #endif /* DGUX && SVR4 */ /**************************************************************************/ @@ -358,9 +348,6 @@ # endif # include <errno.h> -#ifndef __errno_location -extern int errno; -#endif # include <sys/stat.h> @@ -452,9 +439,6 @@ # undef CONSOLE_X_MODE_OFF # undef CONSOLE_X_BELL # endif -# if defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) -# include <dev/wscons/wsdisplay_usl_io.h> -# endif # endif # ifdef SYSCONS_SUPPORT # define COMPAT_SYSCONS @@ -481,10 +465,7 @@ # include <machine/pcvt_ioctl.h> # else # if defined(__NetBSD__) || defined(__OpenBSD__) -# if defined(WSCONS_SUPPORT) - /* NetBSD's wscons has a PCVT-compatibility module. */ -# include <dev/wscons/wsdisplay_usl_io.h> -# else +# if !defined(WSCONS_SUPPORT) # include <machine/pcvt_ioctl.h> # endif /* WSCONS_SUPPORT */ # else @@ -501,6 +482,7 @@ # endif /* PCVT_SUPPORT */ # ifdef WSCONS_SUPPORT # include <dev/wscons/wsconsio.h> +# include <dev/wscons/wsdisplay_usl_io.h> # endif /* WSCONS_SUPPORT */ # if defined(__FreeBSD__) # include <osreldate.h> @@ -564,101 +546,9 @@ # define USE_VT_SYSREQ # endif -# ifndef NULL -# define NULL 0 -# endif - #endif /* CSRG_BASED */ /**************************************************************************/ -/* Mach and OSF/1 */ -/**************************************************************************/ -#if defined(MACH386) || defined(__OSF__) -# include <sys/ioctl.h> - -# include <signal.h> - -# include <errno.h> -extern int errno; - -# if defined(__OSF__) -# include <sys/param.h> -# include <machine/kd.h> -# else /* __OSF__ */ -# if !defined(__STDC__) -# define __STDC__ 1 -# include <i386at/kd.h> -# include <i386at/kd_queue.h> -# undef __STDC__ -# else /* !__STDC__ */ -# include <i386at/kd.h> -# include <i386at/kd_queue.h> -# endif /* !__STDC__ */ -# include <sys/file.h> -# define SEEK_SET L_SET -# endif /* __OSF__ */ - -# ifdef MACH386 -# define NEED_STRERROR -# endif - -# include <sys/mman.h> -# include <sys/stat.h> -# define MOUSE_PROTOCOL_IN_KERNEL - -#endif /* MACH386 || __OSF__ */ - -/**************************************************************************/ -/* Minix */ -/**************************************************************************/ -#if defined(MINIX) -# include <sys/ioctl.h> -# include <signal.h> - -# include <termios.h> -# define termio termios -# define POSIX_TTY - -# include <errno.h> - -# include <assert.h> -# include <limits.h> -# include <sys/memio.h> -# include <sys/kbdio.h> - -# include <sys/stat.h> - -#endif /* MINIX */ - -/**************************************************************************/ -/* Amoeba */ -/**************************************************************************/ -#if defined(AMOEBA) -# define port am_port_t -# include <amoeba.h> -# include <cmdreg.h> -# include <stderr.h> -# include <ampolicy.h> -# include <proc.h> -# include <signal.h> -# include <server/iop/iop.h> -# include <errno.h> -# undef port - -# undef _POSIX_SOURCE /* to get the BSD-compatible symbols */ -# include <sys/stat.h> - - /* keyboard types */ -# define KB_84 1 -# define KB_101 2 -# define KB_OTHER 3 - -extern capability iopcap; -# define MOUSE_PROTOCOL_IN_KERNEL - -#endif /* AMOEBA */ - -/**************************************************************************/ /* OS/2 */ /**************************************************************************/ /* currently OS/2 with EMX/GCC compiler only */ @@ -783,49 +673,6 @@ #define USE_OSMOUSE #endif /* __GNU__ */ - -/**************************************************************************/ -/* Cygwin */ -/**************************************************************************/ -#if defined(__CYGWIN__) -#include <signal.h> -#include <errno.h> -#include <sys/stat.h> -#include <termios.h> -#include <sys/ioctl.h> -#include <sys/param.h> - -/* Warning: by default, the fd_set size is 32 in QNX! */ -#define FD_SETSIZE 256 -#include <sys/select.h> - - /* keyboard types */ -# define KB_84 1 -# define KB_101 2 -# define KB_OTHER 3 - - /* LEDs */ -# define LED_CAP 0x04 -# define LED_NUM 0x02 -# define LED_SCR 0x01 - -# define POSIX_TTY -# define OSMOUSE_ONLY -# define MOUSE_PROTOCOL_IN_KERNEL - -#define TIOCM_DTR 0x0001 /* data terminal ready */ -#define TIOCM_RTS 0x0002 /* request to send */ -#define TIOCM_CTS 0x1000 /* clear to send */ -#define TIOCM_DSR 0x2000 /* data set ready */ -#define TIOCM_RI 0x4000 /* ring */ -#define TIOCM_RNG TIOCM_RI -#define TIOCM_CD 0x8000 /* carrier detect */ -#define TIOCM_CAR TIOCM_CD -#define TIOCM_LE 0x0100 /* line enable */ -#define TIOCM_ST 0x0200 /* secondary transmit */ -#define TIOCM_SR 0x0400 /* secondary receive */ -#endif /* __CYGWIN__ */ - /**************************************************************************/ /* Generic */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.52 xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.54 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.52 Fri May 18 20:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h Thu Nov 8 16:49:43 2001 @@ -64,7 +64,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.52 2001/05/19 00:26:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.54 2001/11/08 21:49:43 herrb Exp $ */ #ifndef _XF86_OSPROC_H #define _XF86_OSPROC_H @@ -93,6 +93,9 @@ * assumed when VIDMEM_MMIO is * set. May be used with * VIDMEM_FRAMEBUFFER) */ +#define VIDMEM_READONLY 0x20 /* read-only mapping + * used when reading BIOS images + * through xf86MapVidMem() */ /* * OS-independent modem state flags for xf86SetSerialModemState() and @@ -229,6 +232,9 @@ extern int xf86XqueKbdProc(DeviceIntPtr, int); extern void xf86XqueEvents(void); #endif +#ifdef WSCONS_SUPPORT +extern void xf86WSKbdEvents(void); +#endif extern PMClose xf86OSPMOpen(void); #ifdef NEED_OS_RAC_PROTOS @@ -245,8 +251,11 @@ resPtr xf86IsaBusAccWindowsFromOS(void); resPtr xf86AccResFromOS(resPtr ret); #endif /* NEED_OS_RAC_PROTOS */ + +extern Bool xf86GetPciSizeFromOS(PCITAG tag, int indx, int* bits); -Bool xf86GetPciSizeFromOS(PCITAG tag, int indx, int* bits); +extern void xf86MakeNewMapping(int, int, unsigned long, unsigned long, pointer); +extern void xf86InitVidMem(void); #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.47 xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h:3.48 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h:3.47 Fri May 18 16:22:30 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h Mon Dec 31 13:13:37 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.47 2001/05/18 20:22:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.48 2001/12/31 18:13:37 herrb Exp $ */ #ifndef _XF86_ANSIC_H #define _XF86_ANSIC_H @@ -168,6 +168,7 @@ extern int xf86getc(XF86FILE*); extern int xf86fgetpos(XF86FILE*,XF86fpos_t*); extern char* xf86fgets(char*,INT32,XF86FILE*); +extern int xf86finite(double); extern double xf86floor(double); extern double xf86fmod(double,double); extern XF86FILE* xf86fopen(const char*,const char*); Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.50 xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.51 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.50 Tue Apr 10 12:08:03 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h Mon Dec 31 13:13:37 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.50 2001/04/10 16:08:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.51 2001/12/31 18:13:37 herrb Exp $ */ @@ -229,6 +229,8 @@ #define fgetpos(FP,fpp) xf86fgetpos(FP,fpp) #undef fgets #define fgets(cp,i,FP) xf86fgets(cp,i,FP) +#undef finite +#define finite(d) xf86finite(d) #undef floor #define floor(d) xf86floor(d) #undef fmod Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.14.2.1 xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.15 --- xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.14.2.1 Thu May 31 22:24:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h Thu May 31 22:10:06 2001 @@ -26,7 +26,7 @@ * * Author: Rickard E. (Rik) Faith <faith@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.14.2.1 2001/06/01 02:24:18 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.15 2001/06/01 02:10:06 dawes Exp $ * */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:3.3 xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:3.4 --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:3.3 Sun Apr 1 10:00:14 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h Thu Sep 27 04:25:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h,v 3.3 2001/04/01 14:00:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h,v 3.4 2001/09/27 08:25:04 alanh Exp $ */ /* WARNING: If you change any of these defines, make sure to change * the kernel include file as well (i810_drm.h) @@ -34,6 +34,8 @@ unsigned int front_offset; unsigned int back_offset; unsigned int depth_offset; + unsigned int overlay_offset; + unsigned int overlay_physical; unsigned int w; unsigned int h; unsigned int pitch; Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h:1.2 --- /dev/null Fri Jan 18 15:25:57 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h Thu Oct 4 14:32:29 2001 @@ -0,0 +1,186 @@ +/************************************************************************** + +Copyright 2001 VA Linux Systems Inc., Fremont, California. + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +on the rights to use, copy, modify, merge, publish, distribute, sub +license, and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + + +**************************************************************************/ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI830.h,v 1.2 2001/10/04 18:32:29 alanh Exp $ */ + +/* Author: Jeff Hartmann <jhartmann@valinux.com> + */ + +#ifndef _I830_XF86DRM_H_ +#define _I830_XF86DRM_H_ + +/* WARNING: These defines must be the same as what the Xserver uses. + * if you change them, you must change the defines in the Xserver. + */ + +#ifndef _I830_DEFINES_ +#define _I830_DEFINES_ + +#define I830_DMA_BUF_ORDER 12 +#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER) +#define I830_DMA_BUF_NR 256 +#define I830_NR_SAREA_CLIPRECTS 8 + +/* Each region is a minimum of 64k, and there are at most 64 of them. + */ +#define I830_NR_TEX_REGIONS 64 +#define I830_LOG_MIN_TEX_REGION_SIZE 16 + +/* if defining I830_ENABLE_4_TEXTURES, do it in i830_3d_reg.h, too */ +#if !defined(I830_ENABLE_4_TEXTURES) +#define I830_TEXTURE_COUNT 2 +#define I830_TEXBLEND_COUNT 2 /* always same as TEXTURE_COUNT? */ +#else /* defined(I830_ENABLE_4_TEXTURES) */ +#define I830_TEXTURE_COUNT 4 +#define I830_TEXBLEND_COUNT 4 /* always same as TEXTURE_COUNT? */ +#endif /* I830_ENABLE_4_TEXTURES */ + +#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ + +#define I830_UPLOAD_CTX 0x1 +#define I830_UPLOAD_BUFFERS 0x2 +#define I830_UPLOAD_CLIPRECTS 0x4 +#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */ +#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */ +#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */ +#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */ +#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */ +#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */ +#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */ +#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */ +#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2)) +#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2)) +#define I830_UPLOAD_TEXIMAGE_MASK 0xff00 +#define I830_UPLOAD_TEX0 0x10000 +#define I830_UPLOAD_TEX1 0x20000 +#define I830_UPLOAD_TEX2 0x40000 +#define I830_UPLOAD_TEX3 0x80000 +#define I830_UPLOAD_TEX_N(n) (0x10000 << (n)) +#define I830_UPLOAD_TEX_MASK 0xf0000 +#define I830_UPLOAD_TEXBLEND0 0x100000 +#define I830_UPLOAD_TEXBLEND1 0x200000 +#define I830_UPLOAD_TEXBLEND2 0x400000 +#define I830_UPLOAD_TEXBLEND3 0x800000 +#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n)) +#define I830_UPLOAD_TEXBLEND_MASK 0xf00000 +#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) +#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 + +/* Indices into buf.Setup where various bits of state are mirrored per + * context and per buffer. These can be fired at the card as a unit, + * or in a piecewise fashion as required. + */ + +/* Destbuffer state + * - backbuffer linear offset and pitch -- invarient in the current dri + * - zbuffer linear offset and pitch -- also invarient + * - drawing origin in back and depth buffers. + * + * Keep the depth/back buffer state here to acommodate private buffers + * in the future. + */ + +#define I830_DESTREG_CBUFADDR 0 +/* Invarient */ +#define I830_DESTREG_DBUFADDR 1 +#define I830_DESTREG_DV0 2 +#define I830_DESTREG_DV1 3 +#define I830_DESTREG_SENABLE 4 +#define I830_DESTREG_SR0 5 +#define I830_DESTREG_SR1 6 +#define I830_DESTREG_SR2 7 +#define I830_DESTREG_DR0 8 +#define I830_DESTREG_DR1 9 +#define I830_DESTREG_DR2 10 +#define I830_DESTREG_DR3 11 +#define I830_DESTREG_DR4 12 +#define I830_DEST_SETUP_SIZE 13 + +/* Context state + */ +#define I830_CTXREG_STATE1 0 +#define I830_CTXREG_STATE2 1 +#define I830_CTXREG_STATE3 2 +#define I830_CTXREG_STATE4 3 +#define I830_CTXREG_STATE5 4 +#define I830_CTXREG_IALPHAB 5 +#define I830_CTXREG_STENCILTST 6 +#define I830_CTXREG_ENABLES_1 7 +#define I830_CTXREG_ENABLES_2 8 +#define I830_CTXREG_AA 9 +#define I830_CTXREG_FOGCOLOR 10 +#define I830_CTXREG_BLENDCOLR0 11 +#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */ +#define I830_CTXREG_VF 13 +#define I830_CTXREG_VF2 14 +#define I830_CTXREG_MCSB0 15 +#define I830_CTXREG_MCSB1 16 +#define I830_CTX_SETUP_SIZE 17 + +/* Texture state (per tex unit) + */ + +#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */ +#define I830_TEXREG_MI1 1 +#define I830_TEXREG_MI2 2 +#define I830_TEXREG_MI3 3 +#define I830_TEXREG_MI4 4 +#define I830_TEXREG_MI5 5 +#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */ +#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */ +#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */ +#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ +#define I830_TEX_SETUP_SIZE 10 + + +#define I830_FRONT 0x1 +#define I830_BACK 0x2 +#define I830_DEPTH 0x4 +#endif /* _I830_DEFINES_ */ + +typedef struct _drmI830Init { + unsigned int start; + unsigned int end; + unsigned int size; + unsigned int mmio_offset; + unsigned int buffers_offset; + int sarea_off; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; + unsigned int cpp; +} drmI830Init; + +Bool drmI830CleanupDma(int driSubFD); +Bool drmI830InitDma(int driSubFD, drmI830Init *info ); + +#endif /* _I830_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h:1.1 --- /dev/null Fri Jan 18 15:25:57 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h Fri Dec 14 19:59:12 2001 @@ -0,0 +1,8 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmSiS.h,v 1.1 2001/12/15 00:59:12 dawes Exp $ */ + +#ifndef __XF86DRI_SIS_H__ +#define __XF86DRI_SIS_H__ + +extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.47 xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.50 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.47 Thu Feb 15 14:34:20 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile Mon Dec 31 13:18:49 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.47 2001/02/15 19:34:20 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.50 2001/12/31 18:18:49 herrb Exp $ #include <Server.tmpl> @@ -58,20 +58,32 @@ MTRRDEFINES = -DHAS_MTRR_SUPPORT #endif +#if defined(NetBSDArchitecture) && defined(HasMTRRBuiltin) +MTRRDEFINES = -DHAS_MTRR_BUILTIN +#endif + #if UsbMouseSupport -USBMOUSEDEFINES = -DUSBMOUSE_SUPPORT +USBMOUSEDEFINES1 = -DUSBMOUSE_SUPPORT #if !HasLibUsb LIBUSBINCLUDES = -Ilibusb #define IHaveSubdirs SUBDIRS = libusb +#else +#if HasLibUsbHid +USBMOUSEDEFINES2 = -DHAS_LIB_USB_HID #endif #endif - +#endif +USBMOUSEDEFINES = $(USBMOUSEDEFINES1) $(USBMOUSEDEFINES2) -#if (defined(NetBSDArchitecture) || defined(OpenBSDArchitecture)) \ - && defined(i386Architecture) +#if (defined(OpenBSDArchitecture) || defined(NetBSDArchitecture)) && defined(i386Architecture) +# if !defined(HasApmKqueue) || !HasApmKqueue APMSRC = bsd_apm.c APMOBJ = bsd_apm.o +# else +APMSRC = bsd_kqueue_apm.c +APMOBJ = bsd_kqueue_apm.o +# endif #else APMSRC = pm_noop.c APMOBJ = pm_noop.o @@ -98,7 +110,7 @@ AXP_OBJ=bsd_ev56.o xf86Axp.o bsd_axp.o #endif -#if defined(FreeBSDArchitecture) && HasAgpGart +#if (defined(FreeBSDArchitecture) || defined(NetBSDArchitecture)) && HasAgpGart AGP_SRC=lnx_agp.c AGP_OBJ=lnx_agp.o #else @@ -171,7 +183,7 @@ LinkSourceFile(vidmem.c,../shared) LinkSourceFile(sigio.c,../shared) LinkSourceFile(kmod_noop.c,../shared) -#if defined(FreeBSDArchitecture) && HasAgpGart +#if (defined(FreeBSDArchitecture) || defined(NetBSDArchitecture)) && HasAgpGart LinkSourceFile(lnx_agp.c,../linux) #else LinkSourceFile(agp_noop.c,../shared) 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.16 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c:3.18 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c:3.16 Sat Feb 3 14:33:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c Thu Nov 8 17:33:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.16 2001/02/03 19:33:05 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.18 2001/11/08 22:33:50 herrb Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -33,6 +33,9 @@ #include "xf86Priv.h" #include "xf86_OSlib.h" +#include <sys/utsname.h> +#include <stdlib.h> + static Bool KeepTty = FALSE; static int devConsoleFd = -1; static int VTnum = -1; @@ -144,6 +147,7 @@ { int i, fd = -1; int result; + struct utsname uts; xf86ConsOpen_t *driver; #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) vtmode_t vtmode; @@ -225,6 +229,16 @@ #endif #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) case SYSCONS: + /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt + * switching anymore. Here we check for FreeBSD 3.1 and up. + * Add cases for other *BSD that behave the same. + */ + uname (&uts); + if (strcmp(uts.sysname, "FreeBSD") == 0) { + i = atof(uts.release) * 100; + if (i >= 310) goto acquire_vt; + } + /* otherwise fall through */ case PCVT: /* * First activate the #1 VT. This is a hack to allow a server @@ -240,7 +254,8 @@ } sleep(1); } - + +acquire_vt: /* * now get the VT */ @@ -582,7 +597,11 @@ /* XXX Is this ok? */ for (i = 0; i < 8; i++) { +#if defined(__NetBSD__) sprintf(ttyname, "/dev/ttyE%d", i); +#elif defined(__OpenBSD__) + sprintf(ttyname, "/dev/ttyC%d", i); +#endif if ((fd = open(ttyname, 2)) != -1) break; } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c:3.18 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c:3.19 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c:3.18 Mon Nov 6 14:24:08 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c Thu Nov 8 16:49:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.18 2000/11/06 19:24:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.19 2001/11/08 21:49:44 herrb Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -129,6 +129,11 @@ tcgetattr(xf86Info.consoleFd, &kbdtty); break; #endif +#if defined WSCONS_SUPPORT + case WSCONS: + xf86FlushInput(xf86Info.kbdFd); + break; +#endif } } @@ -186,4 +191,25 @@ } return(xf86Info.consoleFd); } + +#ifdef WSCONS_SUPPORT + +#define NUMEVENTS 64 + +void +xf86WSKbdEvents(void) +{ + static struct wscons_event events[NUMEVENTS]; + int n, i; + + n = read(xf86Info.kbdFd, events, sizeof events); + if (n <= 0) + return; + n /= sizeof(struct wscons_event); + for (i = 0; i < n; i++) + xf86PostWSKbdEvent(&events[i]); +} + +#endif /* WSCONS_SUPPORT */ + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c:1.3 --- /dev/null Fri Jan 18 15:25:57 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c Sun Sep 30 12:31:49 2001 @@ -0,0 +1,196 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c,v 1.3 2001/09/30 16:31:49 herrb Exp $ */ +/* + * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal 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. + */ +/* $OpenBSD: bsd_kqueue_apm.c,v 1.2 2001/08/20 22:17:19 matthieu Exp $ */ + +#include "X.h" +#include "os.h" +#include "xf86.h" +#include "xf86Priv.h" +#define XF86_OS_PRIVS +#include "xf86_OSproc.h" +#include "xf86_OSlib.h" + +#include <sys/event.h> +#include <machine/apmvar.h> + +#define _PATH_APM_SOCKET "/var/run/apmdev" +#define _PATH_APM_DEV "/dev/apm" +#define _PATH_APM_CTLDEV "/dev/apmctl" + +static pointer APMihPtr = NULL; +static int devFd = -1; +static int ctlFd = -1; +static void bsdCloseAPM(void); + +static struct { + u_int apmBsd; + pmEvent xf86; +} bsdToXF86Array [] = { + { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY }, + { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND }, + { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME }, + { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME }, + { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY }, + { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE }, + { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME }, + { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND }, + { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY }, + { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND }, + { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME }, +#ifdef APM_CAPABILITY_CHANGE + { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED }, +#endif +}; + +#define numApmEvents (sizeof(bsdToXF86Array) / sizeof(bsdToXF86Array[0])) + +static pmEvent +bsdToXF86(int type) +{ + int i; + + for (i = 0; i < numApmEvents; i++) { + if (type == bsdToXF86Array[i].apmBsd) { + return bsdToXF86Array[i].xf86; + } + } + return XF86_APM_UNKNOWN; +} + +/* + * APM events can be requested direclty from /dev/apm + */ +static int +bsdPMGetEventFromOS(int kq, pmEvent *events, int num) +{ + struct kevent ev; + int i, result; + struct timespec ts = { 0, 0 }; + + for (i = 0; i < num; i++) { + result = kevent(kq, NULL, 0, &ev, 1, &ts); + if (result == 0) { + /* no event */ + break; + } else if (result < 0) { + xf86Msg(X_WARNING, "bsdPMGetEventFromOS: kevent returns" + " errno = %d\n", errno); + break; + } + events[i] = bsdToXF86(APM_EVENT_TYPE(ev.data)); + } + return i; +} + +/* + * If apmd(8) is running, he will get the events and handle them, + * so, we've nothing to do here. + * Otherwise, opening /dev/apmctl will succeed and we have to send the + * confirmations to /dev/apmctl. + */ +static pmWait +bsdPMConfirmEventToOs(int dummyfd, pmEvent event) +{ + if (ctlFd < 0) { + if ((ctlFd = open(_PATH_APM_CTLDEV, O_RDWR)) < 0) { + return PM_NONE; + } + } + /* apmctl open succeedeed */ + switch (event) { + case XF86_APM_SYS_STANDBY: + case XF86_APM_USER_STANDBY: + if (ioctl( ctlFd, APM_IOC_STANDBY, NULL ) == 0) + return PM_WAIT; /* should we stop the Xserver in standby, too? */ + else + return PM_NONE; + + case XF86_APM_SYS_SUSPEND: + case XF86_APM_CRITICAL_SUSPEND: + case XF86_APM_USER_SUSPEND: + if (ioctl( ctlFd, APM_IOC_SUSPEND, NULL ) == 0) + return PM_WAIT; + else + return PM_NONE; + break; + case XF86_APM_STANDBY_RESUME: + case XF86_APM_NORMAL_RESUME: + case XF86_APM_CRITICAL_RESUME: + case XF86_APM_STANDBY_FAILED: + case XF86_APM_SUSPEND_FAILED: + return PM_CONTINUE; + break; + default: + return PM_NONE; + } +} + +PMClose +xf86OSPMOpen(void) +{ + int kq; + struct kevent ev; + + if (APMihPtr || !xf86Info.pmFlag) { + return NULL; + } + if ((devFd = open(_PATH_APM_DEV, O_RDONLY)) == -1) { + return NULL; + } + if ((kq = kqueue()) <= 0) { + close(devFd); + return NULL; + } + EV_SET(&ev, devFd, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR, + 0, 0, NULL); + if (kevent(kq, &ev, 1, NULL, 0, NULL) < 0) { + close(devFd); + return NULL; + } + + xf86PMGetEventFromOs = bsdPMGetEventFromOS; + xf86PMConfirmEventToOs = bsdPMConfirmEventToOs; + APMihPtr = xf86AddInputHandler(kq, xf86HandlePMEvents, NULL); + return bsdCloseAPM; +} + +static void +bsdCloseAPM(void) +{ + int kq; + + if (APMihPtr) { + kq = xf86RemoveInputHandler(APMihPtr); + close(devFd); + if (ctlFd >= 0) { + close(ctlFd); + } + APMihPtr = NULL; + } +} 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.18 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c:1.20 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c:1.18 Sat Feb 3 14:33:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c Mon Jan 14 10:34:23 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.18 2001/02/03 19:33:05 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.20 2002/01/14 15:34:23 dawes Exp $ */ /* * Copyright 1999 by The XFree86 Project, Inc. @@ -16,7 +16,11 @@ #include <dev/wscons/wsconsio.h> #endif #ifdef USBMOUSE_SUPPORT +#ifdef HAS_LIB_USB_HID +#include <usbhid.h> +#else #include "usb.h" +#endif #define HUP_GENERIC_DESKTOP 0x0001 #define HUP_BUTTON 0x0009 @@ -141,6 +145,8 @@ hw.iftype = MOUSE_IF_UNKNOWN; hw.model = MOUSE_MODEL_GENERIC; ioctl(pInfo->fd, MOUSE_GETHWINFO, &hw); + xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: hw.iftype is %d, hw.model is %d\n", + pInfo->name, hw.iftype, hw.model); if (ioctl(pInfo->fd, MOUSE_GETMODE, &mode) == 0) { for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); ++i) { if (mode.protocol == devproto[i].dproto) { @@ -150,6 +156,8 @@ protoPara[0] = mode.syncmask[0]; protoPara[1] = mode.syncmask[1]; } + xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", + pInfo->name, devproto[i].name); return devproto[i].name; } } 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.43 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c:3.45 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c:3.43 Sun Apr 22 04:48:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c Sat Oct 27 23:34:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.43 2001/04/22 08:48:51 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.45 2001/10/28 03:34:00 tsi Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -74,6 +74,13 @@ #define X_MTRR_ID "XFree86" #endif +#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) +#include <machine/mtrr.h> +#include <machine/sysarch.h> +#include <sys/queue.h> +#endif + + #ifdef __alpha__ #include <sys/sysctl.h> #include "xf86Axp.h" @@ -199,7 +206,13 @@ static void undoWC(int, pointer); static Bool cleanMTRR(void); #endif +#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) +static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool, + MessageType); +static void NetBSDundoWC(int, pointer); +#endif + #if !defined(__powerpc__) /* * Check if /dev/mem can be mmap'd. If it can't print a warning when @@ -340,6 +353,10 @@ } } #endif +#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) + pVidMem->setWC = NetBSDsetWC; + pVidMem->undoWC = NetBSDundoWC; +#endif pVidMem->initialised = TRUE; } @@ -444,9 +461,11 @@ #endif (void)memcpy(Buf, (void *)(ptr + Offset), Len); (void)munmap((caddr_t)ptr, mlen); +#ifdef DEBUG xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" "-> %02x %02x %02x %02x...\n", Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); +#endif return(Len); } @@ -666,8 +685,9 @@ FatalError("xf86ReadBIOS: open /dev/kmem\n"); } - +#ifdef DEBUG fprintf(stderr, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len); +#endif if (Base < 0x80000000) { fprintf(stderr, "No VGA\n"); @@ -1669,3 +1689,54 @@ = readDense32; #endif /* __FreeBSD__ && __alpha__ */ + +#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) +static pointer +NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, + MessageType from) +{ + struct mtrr *mtrrp; + int n; + + xf86DrvMsg(screenNum, X_WARNING, + "%s MTRR %lx - %lx\n", enable ? "set" : "remove", + base, (base + size)); + + mtrrp = xnfalloc(sizeof (struct mtrr)); + mtrrp->base = base; + mtrrp->len = size; + mtrrp->type = MTRR_TYPE_WC; + + /* + * MTRR_PRIVATE will make this MTRR get reset automatically + * if this process exits, so we have no need for an explicit + * cleanup operation when starting a new server. + */ + + if (enable) + mtrrp->flags = MTRR_VALID | MTRR_PRIVATE; + else + mtrrp->flags = 0; + n = 1; + + if (i386_set_mtrr(mtrrp, &n) < 0) { + xfree(mtrrp); + return NULL; + } + return mtrrp; +} + +static void +NetBSDundoWC(int screenNum, pointer list) +{ + struct mtrr *mtrrp = (struct mtrr *)list; + int n; + + if (mtrrp == NULL) + return; + n = 1; + mtrrp->flags &= ~MTRR_VALID; + i386_set_mtrr(mtrrp, &n); + xfree(mtrrp); +} +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.9 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.5 Tue Apr 10 14:42:58 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile Sun Dec 16 14:45:01 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.5 2001/04/10 18:42:58 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.9 2001/12/16 19:45:01 alanh 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 @@ -19,6 +19,7 @@ xf86drmRandom.c \ xf86drmSL.c \ xf86drmI810.c \ + xf86drmI830.c \ xf86drmMga.c \ xf86drmR128.c \ xf86drmRadeon.c \ @@ -30,6 +31,7 @@ xf86drmRandom.o \ xf86drmSL.o \ xf86drmI810.o \ + xf86drmI830.o \ xf86drmMga.o \ xf86drmR128.o \ xf86drmRadeon.o \ @@ -61,6 +63,7 @@ LinkSourceFile(xf86drm.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmHash.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmI810.c,$(XF86OSSRC)/linux/drm) +LinkSourceFile(xf86drmI830.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmMga.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmR128.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmRandom.c,$(XF86OSSRC)/linux/drm) 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.6 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile:1.6 Wed Apr 18 10:52:43 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile Wed Dec 12 19:24:45 2001 @@ -1,29 +1,5 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.6 2001/04/18 14:52:43 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.8 2001/12/13 00:24:45 alanh Exp $ -#include <Server.tmpl> - -#if 0 -LinkSourceFile(xf86drm.c,..) -LinkSourceFile(xf86drmHash.c,..) -LinkSourceFile(xf86drmRandom.c,..) -LinkSourceFile(xf86drmSL.c,..) -LinkSourceFile(xf86drm.h,$(XF86OSSRC)) -LinkSourceFile(xf86_OSproc.h,$(XF86OSSRC)) -LinkSourceFile(sigio.c,$(XF86OSSRC)/shared) -#endif - -XCOMM Try to use the Linux version of the DRM headers. This avoids skew -XCOMM and missing headers. If there's a need to break them out, they -XCOMM can be re-added later. If not, they can be moved to somewhere more -XCOMM OS-independent and referenced from there. -LinkSourceFile(drm.h,$(XF86OSSRC)/linux/drm/kernel) -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) - - XCOMM This is a kludge until we determine how best to build the XCOMM kernel-specific device driver. This allows us to continue XCOMM to maintain the single Makefile.bsd with kernel-specific @@ -37,7 +13,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 the modules' #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.4 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd:1.4 Tue Mar 6 11:45:25 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd Sun Dec 16 14:45:01 2001 @@ -1,5 +1,6 @@ # $FreeBSD$ -SUBDIR = drm tdfx mga gamma +# i810, i830 & sis are not complete +SUBDIR = tdfx mga r128 radeon gamma # i810 sis i830 .include <bsd.subdir.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/ati_pcigart.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/ati_pcigart.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/ati_pcigart.h Wed Dec 12 19:24:45 2001 @@ -0,0 +1,197 @@ +/* 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__ ); + + 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 ); +} + +int DRM(ati_pcigart_init)( drm_device_t *dev, + unsigned long *addr, + dma_addr_t *bus_addr) +{ + drm_sg_mem_t *entry = dev->sg; + unsigned long address = 0; + unsigned long pages; + u32 *pci_gart, page_base, bus_address = 0; + int i, j, ret = 0; + + if ( !entry ) { + DRM_ERROR( "no scatter/gather memory!\n" ); + goto done; + } + + address = DRM(ati_alloc_pcigart_table)(); + if ( !address ) { + DRM_ERROR( "cannot allocate PCI GART page!\n" ); + goto done; + } + + if ( !dev->pdev ) { + DRM_ERROR( "PCI device unknown!\n" ); + goto done; + } + + bus_address = pci_map_single(dev->pdev, (void *)address, + ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, + PCI_DMA_TODEVICE); + if (bus_address == 0) { + DRM_ERROR( "unable to map PCIGART pages!\n" ); + DRM(ati_free_pcigart_table)( address ); + address = 0; + goto done; + } + + 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++ ) { + /* we need to support large memory configurations */ + entry->busaddr[i] = pci_map_single(dev->pdev, + page_address( entry->pagelist[i] ), + PAGE_SIZE, + PCI_DMA_TODEVICE); + if (entry->busaddr[i] == 0) { + DRM_ERROR( "unable to map PCIGART pages!\n" ); + DRM(ati_pcigart_cleanup)( dev, address, bus_address ); + address = 0; + bus_address = 0; + goto done; + } + page_base = (u32) entry->busaddr[i]; + + for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { + *pci_gart++ = cpu_to_le32( page_base ); + page_base += ATI_PCIGART_PAGE_SIZE; + } + } + + ret = 1; + +#if defined(__i386__) || defined(__x86_64__) + asm volatile ( "wbinvd" ::: "memory" ); +#else + mb(); +#endif + +done: + *addr = address; + *bus_addr = bus_address; + return ret; +} + +int DRM(ati_pcigart_cleanup)( drm_device_t *dev, + unsigned long addr, + dma_addr_t bus_addr) +{ + drm_sg_mem_t *entry = dev->sg; + unsigned long pages; + int i; + + /* we need to support large memory configurations */ + if ( !entry ) { + DRM_ERROR( "no scatter/gather memory!\n" ); + return 0; + } + + if ( bus_addr ) { + pci_unmap_single(dev->pdev, bus_addr, + ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, + PCI_DMA_TODEVICE); + + pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) + ? entry->pages : ATI_MAX_PCIGART_PAGES; + + for ( i = 0 ; i < pages ; i++ ) { + if ( !entry->busaddr[i] ) break; + pci_unmap_single(dev->pdev, entry->busaddr[i], + PAGE_SIZE, PCI_DMA_TODEVICE); + } + } + + if ( addr ) { + DRM(ati_free_pcigart_table)( addr ); + } + + return 1; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm.h:1.4 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm.h Sun Dec 16 14:45:01 2001 @@ -0,0 +1,501 @@ +/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*- + * Created: Mon Jan 4 10:05:05 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. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * + * Acknowledgements: + * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg. + * + */ + +#ifndef _DRM_H_ +#define _DRM_H_ + +#include <sys/ioccom.h> +#define DRM_IOCTL_NR(n) ((n) & 0xff) + +#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" +#define DRM_DEV_DRM "/dev/drm" +#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) +#define DRM_DEV_UID 0 +#define DRM_DEV_GID 0 +#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 */ +#define DRM_RAM_PERCENT 50 /* How much system ram can we lock? */ + +#define _DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */ +#define _DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */ +#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) +#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) +#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) + +typedef unsigned long drm_handle_t; +typedef unsigned int drm_context_t; +typedef unsigned int drm_drawable_t; +typedef unsigned int drm_magic_t; + +/* Warning: If you change this structure, make sure you change + * XF86DRIClipRectRec in the server as well */ + +typedef struct drm_clip_rect { + 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 driver specific structures */ +#include "mga_drm.h" +#include "i810_drm.h" +#include "i830_drm.h" +#include "r128_drm.h" +#include "radeon_drm.h" +#include "sis_drm.h" + +typedef struct drm_version { + int version_major; /* Major version */ + int version_minor; /* Minor version */ + int version_patchlevel;/* Patch level */ + size_t name_len; /* Length of name buffer */ + char *name; /* Name of driver */ + size_t date_len; /* Length of date buffer */ + char *date; /* User-space buffer to hold date */ + size_t desc_len; /* Length of desc buffer */ + char *desc; /* User-space buffer to hold desc */ +} drm_version_t; + +typedef struct drm_unique { + size_t unique_len; /* Length of unique */ + char *unique; /* Unique name for driver instantiation */ +} drm_unique_t; + +typedef struct drm_list { + int count; /* Length of user-space structures */ + drm_version_t *version; +} drm_list_t; + +typedef struct drm_block { + int unused; +} drm_block_t; + +typedef struct drm_control { + enum { + DRM_ADD_COMMAND, + DRM_RM_COMMAND, + DRM_INST_HANDLER, + DRM_UNINST_HANDLER + } func; + int irq; +} 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_SCATTER_GATHER = 4 /* Scatter/gather memory for PCI DMA */ +} drm_map_type_t; + +typedef enum drm_map_flags { + _DRM_RESTRICTED = 0x01, /* Cannot be mapped to user-virtual */ + _DRM_READ_ONLY = 0x02, + _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_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) */ + 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 */ +} 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 */ + _DRM_LOCK_FLUSH = 0x04, /* Flush this context's DMA queue first */ + _DRM_LOCK_FLUSH_ALL = 0x08, /* Flush all DMA queues first */ + /* These *HALT* flags aren't supported yet + -- they will be used to support the + full-screen DGA-like mode. */ + _DRM_HALT_ALL_QUEUES = 0x10, /* Halt all current and future queues */ + _DRM_HALT_CUR_QUEUES = 0x20 /* Halt all current queues */ +} drm_lock_flags_t; + +typedef struct drm_lock { + int context; + drm_lock_flags_t flags; +} drm_lock_t; + +typedef enum drm_dma_flags { /* These values *MUST* match xf86drm.h */ + /* Flags for DMA buffer dispatch */ + _DRM_DMA_BLOCK = 0x01, /* Block until buffer dispatched. + Note, the buffer may not yet have + been processed by the hardware -- + getting a hardware lock with the + hardware quiescent will ensure + that the buffer has been + processed. */ + _DRM_DMA_WHILE_LOCKED = 0x02, /* Dispatch while lock held */ + _DRM_DMA_PRIORITY = 0x04, /* High priority dispatch */ + + /* Flags for DMA buffer request */ + _DRM_DMA_WAIT = 0x10, /* Wait for free buffers */ + _DRM_DMA_SMALLER_OK = 0x20, /* Smaller-than-requested buffers ok */ + _DRM_DMA_LARGER_OK = 0x40 /* Larger-than-requested buffers ok */ +} drm_dma_flags_t; + +typedef struct drm_buf_desc { + int count; /* Number of buffers of this size */ + int size; /* Size in bytes */ + int low_mark; /* Low water mark */ + 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_SG_BUFFER = 0x04 /* Scatter/gather memory buffer */ + } flags; + unsigned long agp_start; /* Start address of where the agp buffers + * are in the agp aperture */ +} drm_buf_desc_t; + +typedef struct drm_buf_info { + int count; /* Entries in list */ + drm_buf_desc_t *list; +} drm_buf_info_t; + +typedef struct drm_buf_free { + int count; + int *list; +} drm_buf_free_t; + +typedef struct drm_buf_pub { + int idx; /* Index into master buflist */ + int total; /* Buffer size */ + int used; /* Amount of buffer in use (for DMA) */ + void *address; /* Address of buffer */ +} drm_buf_pub_t; + +typedef struct drm_buf_map { + int count; /* Length of buflist */ + void *virtual; /* Mmaped area in user-virtual */ + drm_buf_pub_t *list; /* Buffer information */ +} drm_buf_map_t; + +typedef struct drm_dma { + /* Indices here refer to the offset into + buflist in drm_buf_get_t. */ + int context; /* Context handle */ + int send_count; /* Number of buffers to send */ + int *send_indices; /* List of handles to buffers */ + int *send_sizes; /* Lengths of data to send */ + drm_dma_flags_t flags; /* Flags */ + int request_count; /* Number of buffers requested */ + int request_size; /* Desired size for buffers */ + int *request_indices; /* Buffer information */ + int *request_sizes; + int granted_count; /* Number of buffers granted */ +} drm_dma_t; + +typedef enum { + _DRM_CONTEXT_PRESERVED = 0x01, + _DRM_CONTEXT_2DONLY = 0x02 +} drm_ctx_flags_t; + +typedef struct drm_ctx { + drm_context_t handle; + drm_ctx_flags_t flags; +} drm_ctx_t; + +typedef struct drm_ctx_res { + int count; + drm_ctx_t *contexts; +} drm_ctx_res_t; + +typedef struct drm_draw { + drm_drawable_t handle; +} drm_draw_t; + +typedef struct drm_auth { + drm_magic_t magic; +} drm_auth_t; + +typedef struct drm_irq_busid { + int irq; + int busnum; + int devnum; + int funcnum; +} drm_irq_busid_t; + +typedef struct drm_agp_mode { + unsigned long mode; +} drm_agp_mode_t; + + /* For drm_agp_alloc -- allocated a buffer */ +typedef struct drm_agp_buffer { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for BIND/UNBIND ioctls */ + unsigned long type; /* Type of memory to allocate */ + unsigned long physical; /* Physical used by i810 */ +} drm_agp_buffer_t; + + /* For drm_agp_bind */ +typedef struct drm_agp_binding { + unsigned long handle; /* From drm_agp_buffer */ + unsigned long offset; /* In bytes -- will round to page boundary */ +} drm_agp_binding_t; + +typedef struct drm_agp_info { + int agp_version_major; + int agp_version_minor; + unsigned long mode; + unsigned long aperture_base; /* physical address */ + unsigned long aperture_size; /* bytes */ + unsigned long memory_allowed; /* bytes */ + unsigned long memory_used; + + /* PCI information */ + unsigned short id_vendor; + unsigned short id_device; +} drm_agp_info_t; + +typedef struct drm_scatter_gather { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for mapping / unmapping */ +} drm_scatter_gather_t; + +#define DRM_IOCTL_BASE 'd' +#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) +#define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size) +#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_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) + +/* 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) + +/* I830 specific ioctls */ +#define DRM_IOCTL_I830_INIT DRM_IOW( 0x40, drm_i830_init_t) +#define DRM_IOCTL_I830_VERTEX DRM_IOW( 0x41, drm_i830_vertex_t) +#define DRM_IOCTL_I830_CLEAR DRM_IOW( 0x42, drm_i830_clear_t) +#define DRM_IOCTL_I830_FLUSH DRM_IO ( 0x43) +#define DRM_IOCTL_I830_GETAGE DRM_IO ( 0x44) +#define DRM_IOCTL_I830_GETBUF DRM_IOWR(0x45, drm_i830_dma_t) +#define DRM_IOCTL_I830_SWAP DRM_IO ( 0x46) +#define DRM_IOCTL_I830_COPY DRM_IOW( 0x47, drm_i830_copy_t) +#define DRM_IOCTL_I830_DOCOPY DRM_IO ( 0x48) + +#endif 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.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h:1.3 Tue Mar 6 11:45:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h Wed Dec 12 19:24:45 2001 @@ -1,8 +1,8 @@ -/* drmP.h -- Private header for Direct Rendering Manager -*- c -*- +/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * Revised: Tue Oct 12 08:51:07 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 @@ -11,226 +11,120 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to 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. - * - * $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.3 2001/03/06 16:45:26 dawes Exp $ - * + * 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_ #define _DRM_P_H_ -#ifdef _KERNEL -#include <sys/param.h> -#include <sys/queue.h> -#include <sys/malloc.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/stat.h> -#include <sys/proc.h> -#include <sys/lock.h> -#include <sys/fcntl.h> -#include <sys/uio.h> -#include <sys/filio.h> -#include <sys/sysctl.h> -#include <sys/select.h> -#include <sys/bus.h> -#if __FreeBSD_version >= 400005 -#include <sys/taskqueue.h> -#endif +#if defined(_KERNEL) || defined(__KERNEL__) -#if __FreeBSD_version >= 400006 -#define DRM_AGP +/* DRM template customization defaults + */ +#ifndef __HAVE_AGP +#define __HAVE_AGP 0 #endif - -#ifdef DRM_AGP -#include <pci/agpvar.h> +#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 -#include "drm.h" +#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then + also include looping detection. */ -typedef u_int32_t atomic_t; -typedef u_int32_t cycles_t; -typedef u_int32_t spinlock_t; -#define atomic_set(p, v) (*(p) = (v)) -#define atomic_read(p) (*(p)) -#define atomic_inc(p) atomic_add_int(p, 1) -#define atomic_dec(p) atomic_subtract_int(p, 1) -#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) -{ - int s = splhigh(); - u_int32_t m = 1<<b; - u_int32_t r = *p & m; - *p |= m; - splx(s); - return r; -} - -static __inline void -clear_bit(int b, volatile u_int32_t *p) -{ - atomic_clear_int(p + (b >> 5), 1 << (b & 0x1f)); -} - -static __inline void -set_bit(int b, volatile u_int32_t *p) -{ - atomic_set_int(p + (b >> 5), 1 << (b & 0x1f)); -} - -static __inline int -test_bit(int b, volatile u_int32_t *p) -{ - return p[b >> 5] & (1 << (b & 0x1f)); -} - -static __inline int -find_first_zero_bit(volatile u_int32_t *p, int max) -{ - int b; - - for (b = 0; b < max; b += 32) { - if (p[b >> 5] != ~0) { - for (;;) { - if ((p[b >> 5] & (1 << (b & 0x1f))) == 0) - return b; - b++; - } - } - } - return max; -} - -#define spldrm() spltty() - -#define memset(p, v, s) bzero(p, s) - -/* - * Fake out the module macros for versions of FreeBSD where they don't - * exist. - */ -#if __FreeBSD_version < 400002 +typedef struct drm_device drm_device_t; +typedef struct drm_file drm_file_t; -#define MODULE_VERSION(a,b) struct __hack -#define MODULE_DEPEND(a,b,c,d,e) struct __hack +/* There's undoubtably more of this file to go into these OS dependent ones. */ -#endif +#include "drm_os_freebsd.h" -#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. */ +#include "drm.h" +/* Begin the DRM... */ + #define DRM_HASH_SIZE 16 /* Size of key hash table */ #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ #define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */ #define DRM_LOOPING_LIMIT 5000000 #define DRM_BSZ 1024 /* Buffer size for /dev/drm? output */ -#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */ #define DRM_LOCK_SLICE 1 /* Time slice for lock, in jiffies */ #define DRM_FLAG_DEBUG 0x01 #define DRM_FLAG_NOCTX 0x02 -#define DRM_MEM_DMA 0 -#define DRM_MEM_SAREA 1 -#define DRM_MEM_DRIVER 2 -#define DRM_MEM_MAGIC 3 -#define DRM_MEM_IOCTLS 4 -#define DRM_MEM_MAPS 5 -#define DRM_MEM_VMAS 6 -#define DRM_MEM_BUFS 7 -#define DRM_MEM_SEGS 8 -#define DRM_MEM_PAGES 9 -#define DRM_MEM_FILES 10 -#define DRM_MEM_QUEUES 11 -#define DRM_MEM_CMDS 12 -#define DRM_MEM_MAPPINGS 13 -#define DRM_MEM_BUFLISTS 14 +#define DRM_MEM_DMA 0 +#define DRM_MEM_SAREA 1 +#define DRM_MEM_DRIVER 2 +#define DRM_MEM_MAGIC 3 +#define DRM_MEM_IOCTLS 4 +#define DRM_MEM_MAPS 5 +#define DRM_MEM_VMAS 6 +#define DRM_MEM_BUFS 7 +#define DRM_MEM_SEGS 8 +#define DRM_MEM_PAGES 9 +#define DRM_MEM_FILES 10 +#define DRM_MEM_QUEUES 11 +#define DRM_MEM_CMDS 12 +#define DRM_MEM_MAPPINGS 13 +#define DRM_MEM_BUFLISTS 14 #define DRM_MEM_AGPLISTS 15 #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) /* Backward compatibility section */ + /* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */ #ifndef _PAGE_PWT - /* The name of _PAGE_WT was changed to - _PAGE_PWT in Linux 2.2.6 */ #define _PAGE_PWT _PAGE_WT #endif -#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) -#define _DRM_CAS(lock,old,new,__ret) \ - do { \ - int __dummy; /* Can't mark eax as clobbered */ \ - __asm__ __volatile__( \ - "lock ; cmpxchg %4,%1\n\t" \ - "setnz %0" \ - : "=d" (__ret), \ - "=m" (__drm_dummy_lock(lock)), \ - "=a" (__dummy) \ - : "2" (old), \ - "r" (new)); \ + /* 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) - - - /* Macros to make printk easier */ -#define DRM_ERROR(fmt, arg...) \ - printf("error: " "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg) -#define DRM_MEM_ERROR(area, fmt, arg...) \ - printf("error: " "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \ - drm_mem_stats[area].name , ##arg) -#define DRM_INFO(fmt, arg...) printf("info: " "[" DRM_NAME "] " fmt , ##arg) - -#if DRM_DEBUG_CODE -#define DRM_DEBUG(fmt, arg...) \ - do { \ - if (drm_flags&DRM_FLAG_DEBUG) \ - printf("[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ - ##arg); \ - } while (0) -#else -#define DRM_DEBUG(fmt, arg...) do { } while (0) -#endif - -#define DRM_PROC_LIMIT (PAGE_SIZE-80) - -#define DRM_SYSCTL_PRINT(fmt, arg...) \ - snprintf(buf, sizeof(buf), fmt, ##arg); \ - error = SYSCTL_OUT(req, buf, strlen(buf)); \ - if (error) return error; - -#define DRM_SYSCTL_PRINT_RET(ret, fmt, arg...) \ - snprintf(buf, sizeof(buf), fmt, ##arg); \ - error = SYSCTL_OUT(req, buf, strlen(buf)); \ - if (error) { ret; return error; } - /* Internal types and structures */ #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define DRM_MIN(a,b) ((a)<(b)?(a):(b)) @@ -240,15 +134,25 @@ #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 struct drm_pci_list { + u16 vendor; + u16 device; +} drm_pci_list_t; + typedef struct drm_ioctl_desc { - d_ioctl_t *func; + d_ioctl_t *func; int auth_needed; int root_only; } drm_ioctl_desc_t; typedef struct drm_devstate { pid_t owner; /* X server pid holding x_lock */ - + } drm_devstate_t; typedef struct drm_magic_entry { @@ -258,8 +162,8 @@ } drm_magic_entry_t; typedef struct drm_magic_head { - struct drm_magic_entry *head; - struct drm_magic_entry *tail; + struct drm_magic_entry *head; + struct drm_magic_entry *tail; } drm_magic_head_t; typedef struct drm_vma_entry { @@ -279,7 +183,7 @@ struct drm_buf *next; /* Kernel-only: used for free list */ __volatile__ int waiting; /* On kernel DMA queue */ __volatile__ int pending; /* On hardware DMA queue */ - int dma_wait; /* Processes waiting */ + wait_queue_head_t dma_wait; /* Processes waiting */ pid_t pid; /* PID of holding process */ int context; /* Kernel queue for this buffer */ int while_locked;/* Dispatch this buffer while locked */ @@ -292,15 +196,15 @@ DRM_LIST_RECLAIM = 5 } list; /* Which list we're on */ - void *dev_private; - int dev_priv_size; - #if DRM_DMA_HISTOGRAM - struct timespec time_queued; /* Queued to kernel DMA queue */ - struct timespec time_dispatched; /* Dispatched to hardware */ - struct timespec time_completed; /* Completed by hardware */ - struct timespec time_freed; /* Back on freelist */ + cycles_t time_queued; /* Queued to kernel DMA queue */ + cycles_t time_dispatched; /* Dispatched to hardware */ + cycles_t time_completed; /* Completed by hardware */ + cycles_t time_freed; /* Back on freelist */ #endif + + int dev_priv_size; /* Size of buffer private stoarge */ + void *dev_private; /* Per-buffer private storage */ } drm_buf_t; #if DRM_DMA_HISTOGRAM @@ -309,14 +213,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]; @@ -332,20 +236,20 @@ drm_buf_t **rp; /* Read pointer */ drm_buf_t **wp; /* Write pointer */ drm_buf_t **end; /* End pointer */ - spinlock_t read_lock; - spinlock_t write_lock; + DRM_OS_SPINTYPE read_lock; + DRM_OS_SPINTYPE write_lock; } drm_waitlist_t; typedef struct drm_freelist { int initialized; /* Freelist in use */ atomic_t count; /* Number of free buffers */ drm_buf_t *next; /* End pointer */ - - int waiting; /* Processes waiting on free bufs */ + + wait_queue_head_t waiting; /* Processes waiting on free bufs */ 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_OS_SPINTYPE lock; } drm_freelist_t; typedef struct drm_buf_entry { @@ -365,7 +269,7 @@ } drm_hw_lock_t; typedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t; -typedef struct drm_file { +struct drm_file { TAILQ_ENTRY(drm_file) link; int authenticated; int minor; @@ -375,38 +279,40 @@ drm_magic_t magic; unsigned long ioctl_count; struct drm_device *devXX; -} drm_file_t; +}; - typedef struct drm_queue { atomic_t use_count; /* Outstanding uses (+1) */ atomic_t finalization; /* Finalization in progress */ atomic_t block_count; /* Count of processes waiting */ atomic_t block_read; /* Queue blocked for reads */ - int read_queue; /* Processes waiting on block_read */ + wait_queue_head_t read_queue; /* Processes waiting on block_read */ atomic_t block_write; /* Queue blocked for writes */ - int write_queue; /* Processes waiting on block_write */ + 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 */ - int flush_queue; /* Processes waiting until flush */ + wait_queue_head_t flush_queue; /* Processes waiting until flush */ } drm_queue_t; typedef struct drm_lock_data { drm_hw_lock_t *hw_lock; /* Hardware lock */ pid_t pid; /* PID of lock holder (0=kernel) */ - int lock_queue; /* Queue of blocked processes */ + wait_queue_head_t lock_queue; /* Queue of blocked processes */ unsigned long lock_time; /* Time of last lock in jiffies */ } 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 */ @@ -415,27 +321,28 @@ 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; - vm_offset_t *pagelist; + 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 */ drm_buf_t *this_buffer; /* Buffer being sent */ drm_buf_t *next_buffer; /* Selected buffer to send */ drm_queue_t *next_queue; /* Queue from which buffer selected*/ - int waiting; /* Processes waiting on free bufs */ + wait_queue_head_t waiting; /* Processes waiting on free bufs */ } drm_device_dma_t; - -#ifdef DRM_AGP +#if __REALLY_HAVE_AGP typedef struct drm_agp_mem { void *handle; unsigned long bound; /* address */ @@ -454,27 +361,45 @@ int acquired; unsigned long base; int agp_mtrr; + int cant_use_aperture; + unsigned long page_mask; } 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 TAILQ_HEAD(drm_map_list, drm_map_list_entry) drm_map_list_t; +typedef struct drm_map_list_entry { + TAILQ_ENTRY(drm_map_list_entry) link; + drm_map_t *map; +} drm_map_list_entry_t; -typedef struct drm_device { +struct drm_device { const char *name; /* Simple driver name */ char *unique; /* Unique identifier: e.g., busid */ int unique_len; /* Length of unique field */ device_t device; /* Device instance from newbus */ dev_t devnode; /* Device number for mknod */ char *devname; /* For /proc/interrupts */ - + int blocked; /* Blocked due to VC switch? */ int flags; /* Flags to open(2) */ int writable; /* Opened with FWRITE */ struct proc_dir_entry *root; /* Root for this device's entries */ /* Locks */ - struct simplelock count_lock; /* For inuse, open_count, buf_use */ - struct lock dev_lock; /* For others */ - + DRM_OS_SPINTYPE count_lock; /* For inuse, open_count, buf_use */ + struct lock dev_lock; /* For others */ /* Usage Counters */ int open_count; /* Outstanding files open */ atomic_t ioctl_count; /* Outstanding IOCTLs pending */ @@ -482,26 +407,22 @@ 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_list_t files; 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 */ @@ -513,223 +434,199 @@ drm_device_dma_t *dma; /* Optional pointer for DMA support */ /* Context support */ - struct resource *irq; /* Interrupt used by board */ + int irq; /* Interrupt used by board */ + struct resource *irqr; /* Resource for interrupt used by board */ void *irqh; /* Handle from bus_setup_intr */ - __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 */ + __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 */ + wait_queue_head_t 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 */ + unsigned long last_switch; /* jiffies at last context switch */ #if __FreeBSD_version >= 400005 - struct task task; + struct task task; #endif - struct timespec ctx_start; - struct timespec lck_start; -#if DRM_DMA_HISTOGRAM + cycles_t ctx_start; + cycles_t lck_start; +#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 */ char *buf_rp; /* Read pointer */ char *buf_wp; /* Write pointer */ char *buf_end; /* End pointer */ - struct sigio *buf_sigio; /* Processes waiting for SIGIO */ + struct sigio *buf_sigio; /* Processes waiting for SIGIO */ struct selinfo buf_sel; /* Workspace for select/poll */ - int buf_readers; /* Processes waiting to read */ - int buf_writers; /* Processes waiting to ctx switch */ - int buf_selecting; /* True if poll sleeper */ + int buf_selecting;/* True if poll sleeper */ + wait_queue_head_t buf_readers; /* Processes waiting to read */ + wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ /* Sysctl support */ struct drm_sysctl_info *sysctl; -#ifdef DRM_AGP +#if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif - u_int32_t *ctx_bitmap; - void *dev_private; -} drm_device_t; - - - /* Internal function definitions */ - - /* Misc. support (init.c) */ -extern int drm_flags; -extern void drm_parse_options(char *s); - - - /* Device support (fops.c) */ -extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev, struct proc *p); -extern int drm_open_helper(dev_t kdev, int flags, int fmt, struct proc *p, - drm_device_t *dev); -extern d_close_t drm_close; -extern d_read_t drm_read; -extern d_write_t drm_write; -extern d_poll_t drm_poll; -extern int drm_fsetown(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p); -extern int drm_fgetown(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p); -extern int drm_write_string(drm_device_t *dev, const char *s); - -#if 0 - /* Mapping support (vm.c) */ -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 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); -#endif -extern d_mmap_t drm_mmap; - - /* Proc support (proc.c) */ -extern int drm_sysctl_init(drm_device_t *dev); -extern int drm_sysctl_cleanup(drm_device_t *dev); - - /* Memory management support (memory.c) */ -extern void drm_mem_init(void); - -#if __FreeBSD_version < 411000 -#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS + struct pci_dev *pdev; +#ifdef __alpha__ +#if LINUX_VERSION_CODE < 0x020403 + struct pci_controler *hose; #else -#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS) + 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 */ + sigset_t sigmask; +}; + +extern int DRM(flags); +extern void DRM(parse_options)( char *s ); +extern int DRM(cpu_valid)( void ); + + /* Authentication (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); + + /* Driver support (drm_drv.h) */ +extern int DRM(version)( DRM_OS_IOCTL ); +extern int DRM(write_string)(drm_device_t *dev, const char *s); + + /* Memory management support (drm_memory.h) */ +extern void DRM(mem_init)(void); +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)(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 + +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 ); +extern void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle ); +extern int DRM(ctxbitmap_next)( drm_device_t *dev ); +#endif + + /* Locking IOCTL support (drm_lock.h) */ +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(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 ); + +#if __HAVE_DMA + /* 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(irq_install)( drm_device_t *dev, int irq ); +extern int DRM(irq_uninstall)( drm_device_t *dev ); +extern void DRM(dma_service)( DRM_OS_IRQ_ARGS ); +#if __HAVE_DMA_IRQ_BH +extern void DRM(dma_immediate_bh)( DRM_OS_TASKQUEUE_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); -extern char *drm_strdup(const char *s, int area); -extern void drm_strfree(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); - -#ifdef DRM_AGP -extern void *drm_alloc_agp(int pages, u_int32_t type); -extern int drm_free_agp(void *handle, int pages); -extern int drm_bind_agp(void *handle, unsigned int start); -extern int drm_unbind_agp(void *handle); -#endif - - /* Buffer management support (bufs.c) */ -extern int drm_order(unsigned long size); -extern d_ioctl_t drm_addmap; -extern d_ioctl_t drm_addbufs; -extern d_ioctl_t drm_infobufs; -extern d_ioctl_t drm_markbufs; -extern d_ioctl_t drm_freebufs; -extern d_ioctl_t drm_mapbufs; - - - /* 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_wakeup(drm_device_t *dev, drm_buf_t *buf); -extern void drm_clear_next_buffer(drm_device_t *dev); -extern int drm_select_queue(drm_device_t *dev, - void (*wrapper)(void *)); -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 DRM_DMA_HISTOGRAM -extern int drm_histogram_slot(struct timespec *ts); -extern void drm_histogram_compute(drm_device_t *dev, drm_buf_t *buf); +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 d_ioctl_t drm_irq_busid; -extern d_ioctl_t drm_getunique; -extern d_ioctl_t drm_setunique; - - - /* Context IOCTL support (context.c) */ -extern d_ioctl_t drm_resctx; -extern d_ioctl_t drm_addctx; -extern d_ioctl_t drm_modctx; -extern d_ioctl_t drm_getctx; -extern d_ioctl_t drm_switchctx; -extern d_ioctl_t drm_newctx; -extern d_ioctl_t drm_rmctx; - - - /* Drawable IOCTL support (drawable.c) */ -extern d_ioctl_t drm_adddraw; -extern d_ioctl_t drm_rmdraw; - - - /* 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 d_ioctl_t drm_getmagic; -extern d_ioctl_t drm_authmagic; - - - /* Locking IOCTL support (lock.c) */ -extern d_ioctl_t drm_block; -extern d_ioctl_t drm_unblock; -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 d_ioctl_t drm_finish; -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); - - /* 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); - -#ifdef DRM_AGP - /* AGP/GART support (agpsupport.c) */ -extern drm_agp_head_t *drm_agp_init(void); -extern d_ioctl_t drm_agp_acquire; -extern d_ioctl_t drm_agp_release; -extern d_ioctl_t drm_agp_enable; -extern d_ioctl_t drm_agp_info; -extern d_ioctl_t drm_agp_alloc; -extern d_ioctl_t drm_agp_free; -extern d_ioctl_t drm_agp_unbind; -extern d_ioctl_t drm_agp_bind; + /* 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 void DRM(agp_do_release)(void); +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 + + /* 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); +#endif + +#if __REALLY_HAVE_SG + /* ATI PCIGART support (ati_pcigart.h) */ +extern int DRM(ati_pcigart_init)(drm_device_t *dev, + unsigned long *addr, + dma_addr_t *bus_addr); +extern int DRM(ati_pcigart_cleanup)(drm_device_t *dev, + unsigned long addr, + dma_addr_t bus_addr); #endif -#endif + +#endif /* __KERNEL__ */ #endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_agpsupport.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_agpsupport.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_agpsupport.h Wed Dec 12 19:24:45 2001 @@ -0,0 +1,326 @@ +/* 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> + */ + +#include "drmP.h" + +#include <vm/vm.h> +#include <vm/pmap.h> +#if __REALLY_HAVE_AGP +#include <sys/agpio.h> +#endif + +int DRM(agp_info)(DRM_OS_IOCTL) +{ + drm_device_t *dev = kdev->si_drv1; + struct agp_info *kern; + drm_agp_info_t info; + + if (!dev->agp || !dev->agp->acquired) return EINVAL; + + kern = &dev->agp->info; + agp_get_info(dev->agp->agpdev, kern); + info.agp_version_major = 1; + info.agp_version_minor = 0; + info.mode = kern->ai_mode; + info.aperture_base = kern->ai_aperture_base; + info.aperture_size = kern->ai_aperture_size; + info.memory_allowed = kern->ai_memory_allowed; + info.memory_used = kern->ai_memory_used; + info.id_vendor = kern->ai_devid & 0xffff; + info.id_device = kern->ai_devid >> 16; + + *(drm_agp_info_t *) data = info; + return 0; +} + +int DRM(agp_acquire)(DRM_OS_IOCTL) +{ + drm_device_t *dev = kdev->si_drv1; + int retcode; + + if (!dev->agp || dev->agp->acquired) return EINVAL; + retcode = agp_acquire(dev->agp->agpdev); + if (retcode) return retcode; + dev->agp->acquired = 1; + return 0; +} + +int DRM(agp_release)(DRM_OS_IOCTL) +{ + drm_device_t *dev = kdev->si_drv1; + + if (!dev->agp || !dev->agp->acquired) + return EINVAL; + agp_release(dev->agp->agpdev); + dev->agp->acquired = 0; + return 0; + +} + +void DRM(agp_do_release)(void) +{ + device_t agpdev; + + agpdev = agp_find_device(); + if (agpdev) + agp_release(agpdev); +} + +int DRM(agp_enable)(DRM_OS_IOCTL) +{ + drm_device_t *dev = kdev->si_drv1; + drm_agp_mode_t mode; + + if (!dev->agp || !dev->agp->acquired) return EINVAL; + + mode = *(drm_agp_mode_t *) data; + + dev->agp->mode = mode.mode; + agp_enable(dev->agp->agpdev, mode.mode); + dev->agp->base = dev->agp->info.ai_aperture_base; + dev->agp->enabled = 1; + return 0; +} + +int DRM(agp_alloc)(DRM_OS_IOCTL) +{ + drm_device_t *dev = kdev->si_drv1; + drm_agp_buffer_t request; + drm_agp_mem_t *entry; + void *handle; + unsigned long pages; + u_int32_t type; + struct agp_memory_info info; + + if (!dev->agp || !dev->agp->acquired) return EINVAL; + + request = *(drm_agp_buffer_t *) data; + + if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS))) + return ENOMEM; + + bzero(entry, sizeof(*entry)); + + pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + type = (u_int32_t) request.type; + + if (!(handle = DRM(alloc_agp)(pages, type))) { + DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return ENOMEM; + } + + entry->handle = handle; + 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; + + agp_memory_info(dev->agp->agpdev, entry->handle, &info); + + request.handle = (unsigned long) entry->handle; + request.physical = info.ami_physical; + + *(drm_agp_buffer_t *) data = request; + + return 0; +} + +static drm_agp_mem_t * DRM(agp_lookup_entry)(drm_device_t *dev, void *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)(DRM_OS_IOCTL) +{ + drm_device_t *dev = kdev->si_drv1; + drm_agp_binding_t request; + drm_agp_mem_t *entry; + int retcode; + + if (!dev->agp || !dev->agp->acquired) return EINVAL; + request = *(drm_agp_binding_t *) data; + if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle))) + return EINVAL; + if (!entry->bound) return EINVAL; + retcode=DRM(unbind_agp)(entry->handle); + if (!retcode) + { + entry->bound=0; + return 0; + } + else + return retcode; +} + +int DRM(agp_bind)(DRM_OS_IOCTL) +{ + drm_device_t *dev = kdev->si_drv1; + drm_agp_binding_t request; + drm_agp_mem_t *entry; + int retcode; + int page; + + DRM_DEBUG("agp_bind, page_size=%x\n", PAGE_SIZE); + if (!dev->agp || !dev->agp->acquired) + return EINVAL; + request = *(drm_agp_binding_t *) data; + if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle))) + return EINVAL; + if (entry->bound) return EINVAL; + page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; + if ((retcode = DRM(bind_agp)(entry->handle, page))) + return retcode; + entry->bound = dev->agp->base + (page << PAGE_SHIFT); + return 0; +} + +int DRM(agp_free)(DRM_OS_IOCTL) +{ + drm_device_t *dev = kdev->si_drv1; + drm_agp_buffer_t request; + drm_agp_mem_t *entry; + + if (!dev->agp || !dev->agp->acquired) return EINVAL; + request = *(drm_agp_buffer_t *) data; + if (!(entry = DRM(agp_lookup_entry)(dev, (void*) request.handle))) + return EINVAL; + if (entry->bound) DRM(unbind_agp)(entry->handle); + + 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->handle, entry->pages); + DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return 0; +} + +drm_agp_head_t *DRM(agp_init)(void) +{ + device_t agpdev; + drm_agp_head_t *head = NULL; + int agp_available = 1; + + agpdev = agp_find_device(); + if (!agpdev) + agp_available = 0; + + DRM_DEBUG("agp_available = %d\n", agp_available); + + if (agp_available) { + if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS))) + return NULL; + bzero((void *)head, sizeof(*head)); + head->agpdev = agpdev; + agp_get_info(agpdev, &head->info); + head->memory = NULL; +#if 0 /* bogus */ + 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; + case VIA_GENERIC: head->chipset = "VIA"; break; + case VIA_VP3: head->chipset = "VIA VP3"; break; + case VIA_MVP3: head->chipset = "VIA MVP3"; break; + 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: + } +#endif + DRM_INFO("AGP at 0x%08x %dMB\n", + head->info.ai_aperture_base, + head->info.ai_aperture_size >> 20); + } + return head; +} + +void DRM(agp_uninit)(void) +{ +/* FIXME: What goes here */ +} + + +agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type) +{ + device_t agpdev; + + agpdev = agp_find_device(); + if (!agpdev) + return NULL; + + return agp_alloc_memory(agpdev, type, pages << AGP_PAGE_SHIFT); +} + +int DRM(agp_free_memory)(agp_memory *handle) +{ + device_t agpdev; + + agpdev = agp_find_device(); + if (!agpdev || !handle) + return 0; + + agp_free_memory(agpdev, handle); + return 1; +} + +int DRM(agp_bind_memory)(agp_memory *handle, off_t start) +{ + device_t agpdev; + + agpdev = agp_find_device(); + if (!agpdev || !handle) + return EINVAL; + + return agp_bind_memory(agpdev, handle, start * PAGE_SIZE); +} + +int DRM(agp_unbind_memory)(agp_memory *handle) +{ + device_t agpdev; + + agpdev = agp_find_device(); + if (!agpdev || !handle) + return EINVAL; + + return agp_unbind_memory(agpdev, handle); +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_auth.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_auth.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_auth.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,166 @@ +/* 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); + + DRM_OS_LOCK; + for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { + if (pt->magic == magic) { + retval = pt->priv; + break; + } + } + DRM_OS_UNLOCK; + 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_magic_entry_t*) DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); + if (!entry) DRM_OS_RETURN(ENOMEM); + entry->magic = magic; + entry->priv = priv; + entry->next = NULL; + + DRM_OS_LOCK; + 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; + } + DRM_OS_UNLOCK; + + 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); + + DRM_OS_LOCK; + 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; + } + DRM_OS_UNLOCK; + DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); + return 0; + } + } + DRM_OS_UNLOCK; + + DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); + DRM_OS_RETURN(EINVAL); +} + +int DRM(getmagic)(DRM_OS_IOCTL) +{ + static drm_magic_t sequence = 0; + drm_auth_t auth; + static DRM_OS_SPINTYPE lock; + static int first = 1; + DRM_OS_DEVICE; + DRM_OS_PRIV; + + if (first) { + DRM_OS_SPININIT(lock, "drm getmagic"); + first = 0; + } + + /* Find unique magic */ + if (priv->magic) { + auth.magic = priv->magic; + } else { + do { + DRM_OS_SPINLOCK(&lock); + if (!sequence) ++sequence; /* reserve 0 */ + auth.magic = sequence++; + DRM_OS_SPINUNLOCK(&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); + + DRM_OS_KRNTOUSR((drm_auth_t *)data, auth, sizeof(auth)); + + return 0; +} + +int DRM(authmagic)(DRM_OS_IOCTL) +{ + drm_auth_t auth; + drm_file_t *file; + DRM_OS_DEVICE; + + DRM_OS_KRNFROMUSR(auth, (drm_auth_t *)data, sizeof(auth)); + + 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; + } + DRM_OS_RETURN(EINVAL); +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_bufs.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_bufs.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_bufs.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,1092 @@ +/* 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 <machine/param.h> +#include <sys/mman.h> +#include <vm/vm.h> +#include <vm/pmap.h> +#include <vm/vm_extern.h> +#include <vm/vm_map.h> +#include <vm/vm_param.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)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_map_t *map; + drm_map_list_entry_t *list; + + if (!(dev->flags & (FREAD|FWRITE))) + DRM_OS_RETURN(EACCES); /* Require read/write */ + + map = (drm_map_t *) DRM(alloc)( sizeof(*map), DRM_MEM_MAPS ); + if ( !map ) + DRM_OS_RETURN(ENOMEM); + + *map = *(drm_map_t *)data; + + /* 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 ); + DRM_OS_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 ); + DRM_OS_RETURN(EINVAL); + } + map->mtrr = -1; + map->handle = 0; + + TAILQ_FOREACH(list, dev->maplist, link) { + drm_map_t *entry = list->map; + if ( (entry->offset >= map->offset + && (entry->offset) < (map->offset + map->size) ) + || ((entry->offset + entry->size) >= map->offset + && (entry->offset + entry->size) < (map->offset + map->size) ) + || ((entry->offset < map->offset) + && (entry->offset + entry->size) >= (map->offset + map->size) ) ) + DRM_DEBUG("map collission: add(0x%lx-0x%lx), current(0x%lx-0x%lx)\n", + entry->offset, entry->offset + entry->size - 1, + map->offset, map->offset + map->size - 1); + } + + switch ( map->type ) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#if !defined(__sparc__) && !defined(__alpha__) + if ( map->offset + map->size < map->offset + ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + DRM_OS_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: + DRM_INFO( "%ld %d %d\n", + map->size, DRM(order)( map->size ), PAGE_SHIFT); + 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 ); + DRM_OS_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 += 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); + DRM_OS_RETURN(EINVAL); + } + map->offset = map->offset + dev->sg->handle; + break; + + default: + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + DRM_OS_RETURN(EINVAL); + } + + list = DRM(alloc)(sizeof(*list), DRM_MEM_MAPS); + if(!list) { + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + DRM_OS_RETURN(EINVAL); + } + memset(list, 0, sizeof(*list)); + list->map = map; + + DRM_OS_LOCK; + TAILQ_INSERT_TAIL(dev->maplist, list, link); + DRM_OS_UNLOCK; + + *(drm_map_t *)data = *map; + + if ( map->type != _DRM_SHM ) { + ((drm_map_t *)data)->handle = (void *)map->offset; + } + return 0; +} + + +/* Remove a map private from list and deallocate resources if the mapping + * isn't in use. + */ + +int DRM(rmmap)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_map_list_entry_t *list; + drm_map_t *map; + drm_map_t request; + int found_maps = 0; + + DRM_OS_KRNFROMUSR( request, (drm_map_t *)data, sizeof(request) ); + + DRM_OS_LOCK; + TAILQ_FOREACH(list, dev->maplist, link) { + map = list->map; + if(map->handle == request.handle && + map->flags & _DRM_REMOVABLE) break; + } + + /* List has wrapped around to the head pointer, or its empty we didn't + * find anything. + */ + if(list == NULL) { + DRM_OS_UNLOCK; + DRM_OS_RETURN(EINVAL); + } + TAILQ_REMOVE(dev->maplist, list, link); + DRM(free)(list, sizeof(*list), DRM_MEM_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: + DRM(free_pages)( (unsigned long)map->handle, DRM(order)(map->size), DRM_MEM_SAREA ); + break; + case _DRM_AGP: + case _DRM_SCATTER_GATHER: + break; + } + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + } + DRM_OS_UNLOCK; + return 0; +} + +#if __HAVE_DMA + + +static void DRM(cleanup_buf_error)(drm_buf_entry_t *entry) +{ + int i; + + if (entry->seg_count) { + for (i = 0; i < entry->seg_count; i++) { + DRM(free_pages)(entry->seglist[i], + entry->page_order, + DRM_MEM_DMA); + } + DRM(free)(entry->seglist, + entry->seg_count * + sizeof(*entry->seglist), + DRM_MEM_SEGS); + + entry->seg_count = 0; + } + + if(entry->buf_count) { + for(i = 0; i < entry->buf_count; i++) { + if(entry->buflist[i].dev_private) { + DRM(free)(entry->buflist[i].dev_private, + entry->buflist[i].dev_priv_size, + DRM_MEM_BUFS); + } + } + DRM(free)(entry->buflist, + entry->buf_count * + sizeof(*entry->buflist), + DRM_MEM_BUFS); + +#if __HAVE_DMA_FREELIST + DRM(freelist_destroy)(&entry->freelist); +#endif + + entry->buf_count = 0; + } +} + +#if __REALLY_HAVE_AGP +int DRM(addbufs_agp)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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; + drm_buf_t **temp_buflist; + + if ( !dma ) DRM_OS_RETURN(EINVAL); + + DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + + count = request.count; + order = DRM(order)( request.size ); + size = 1 << order; + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? round_page(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: 0x%lx\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 ) + DRM_OS_RETURN(EINVAL); + if ( dev->queue_count ) + DRM_OS_RETURN(EBUSY); /* Not while in use */ + + DRM_OS_SPINLOCK( &dev->count_lock ); + if ( dev->buf_use ) { + DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_OS_RETURN(EBUSY); + } + atomic_inc( &dev->buf_alloc ); + DRM_OS_SPINUNLOCK( &dev->count_lock ); + + DRM_OS_LOCK; + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); /* May only call once for each order */ + } + + if (count < 0 || count > 4096) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(EINVAL); + } + + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_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; + buf->dma_wait = 0; + 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 ); + if(!buf->dev_private) { + /* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + DRM(cleanup_buf_error)(entry); + } + 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 + + offset += alignment; + entry->buf_count++; + byte_count += PAGE_SIZE << page_order; + } + + DRM_DEBUG( "byte_count: %d\n", byte_count ); + + temp_buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + if(!temp_buflist) { + /* Free the entry because it isn't valid */ + DRM(cleanup_buf_error)(entry); + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); + } + dma->buflist = temp_buflist; + + 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 + DRM_OS_UNLOCK; + + request.count = entry->buf_count; + request.size = size; + + DRM_OS_KRNTOUSR( (drm_buf_desc_t *)data, request, sizeof(request) ); + + 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)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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; + unsigned long *temp_pagelist; + drm_buf_t **temp_buflist; + + if ( !dma ) DRM_OS_RETURN(EINVAL); + + DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + + 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 ) + DRM_OS_RETURN(EINVAL); + if ( dev->queue_count ) + DRM_OS_RETURN(EBUSY); /* Not while in use */ + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? round_page(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + DRM_OS_SPINLOCK( &dev->count_lock ); + if ( dev->buf_use ) { + DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_OS_RETURN(EBUSY); + } + atomic_inc( &dev->buf_alloc ); + DRM_OS_SPINUNLOCK( &dev->count_lock ); + + DRM_OS_LOCK; + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); /* May only call once for each order */ + } + + if (count < 0 || count > 4096) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(EINVAL); + } + + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_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 ); + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); + } + memset( entry->seglist, 0, count * sizeof(*entry->seglist) ); + + temp_pagelist = DRM(realloc)( dma->pagelist, + dma->page_count * sizeof(*dma->pagelist), + (dma->page_count + (count << page_order)) + * sizeof(*dma->pagelist), + DRM_MEM_PAGES ); + if(!temp_pagelist) { + DRM(free)( entry->buflist, + count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + DRM(free)( entry->seglist, + count * sizeof(*entry->seglist), + DRM_MEM_SEGS ); + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); + } + + dma->pagelist = temp_pagelist; + 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; + buf->dma_wait = 0; + 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; + } + + temp_buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + if(!temp_buflist) { + /* Free the entry because it isn't valid */ + DRM(cleanup_buf_error)(entry); + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); + } + dma->buflist = temp_buflist; + + 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 + DRM_OS_UNLOCK; + + request.count = entry->buf_count; + request.size = size; + + DRM_OS_KRNTOUSR( (drm_buf_desc_t *)data, request, sizeof(request) ); + + atomic_dec( &dev->buf_alloc ); + return 0; + +} +#endif /* __HAVE_PCI_DMA */ + +#if __REALLY_HAVE_SG +int DRM(addbufs_sg)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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; + drm_buf_t **temp_buflist; + + if ( !dma ) DRM_OS_RETURN(EINVAL); + + DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + + count = request.count; + order = DRM(order)( request.size ); + size = 1 << order; + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? round_page(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 ) + DRM_OS_RETURN(EINVAL); + if ( dev->queue_count ) DRM_OS_RETURN(EBUSY); /* Not while in use */ + + DRM_OS_SPINLOCK( &dev->count_lock ); + if ( dev->buf_use ) { + DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_OS_RETURN(EBUSY); + } + atomic_inc( &dev->buf_alloc ); + DRM_OS_SPINUNLOCK( &dev->count_lock ); + + DRM_OS_LOCK; + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); /* May only call once for each order */ + } + + if (count < 0 || count > 4096) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(EINVAL); + } + + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_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; + buf->dma_wait = 0; + 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 ); + if(!buf->dev_private) { + /* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + DRM(cleanup_buf_error)(entry); + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); + } + + 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 ); + + temp_buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + if(!temp_buflist) { + /* Free the entry because it isn't valid */ + DRM(cleanup_buf_error)(entry); + DRM_OS_UNLOCK; + atomic_dec( &dev->buf_alloc ); + DRM_OS_RETURN(ENOMEM); + } + dma->buflist = temp_buflist; + + 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 + DRM_OS_UNLOCK; + + request.count = entry->buf_count; + request.size = size; + + DRM_OS_KRNTOUSR( (drm_buf_desc_t *)data, request, sizeof(request) ); + + dma->flags = _DRM_DMA_USE_SG; + + atomic_dec( &dev->buf_alloc ); + return 0; +} +#endif /* __REALLY_HAVE_SG */ + +int DRM(addbufs)( DRM_OS_IOCTL ) +{ + drm_buf_desc_t request; + + DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + +#if __REALLY_HAVE_AGP + if ( request.flags & _DRM_AGP_BUFFER ) + return DRM(addbufs_agp)( kdev, cmd, data, flags, p ); + else +#endif +#if __REALLY_HAVE_SG + if ( request.flags & _DRM_SG_BUFFER ) + return DRM(addbufs_sg)( kdev, cmd, data, flags, p ); + else +#endif +#if __HAVE_PCI_DMA + return DRM(addbufs_pci)( kdev, cmd, data, flags, p ); +#else + DRM_OS_RETURN(EINVAL); +#endif +} + +int DRM(infobufs)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_buf_info_t request; + int i; + int count; + + if ( !dma ) DRM_OS_RETURN(EINVAL); + + DRM_OS_SPINLOCK( &dev->count_lock ); + if ( atomic_read( &dev->buf_alloc ) ) { + DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_OS_RETURN(EBUSY); + } + ++dev->buf_use; /* Can't allocate more after this call */ + DRM_OS_SPINUNLOCK( &dev->count_lock ); + + DRM_OS_KRNFROMUSR( request, (drm_buf_info_t *)data, sizeof(request) ); + + 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 ( DRM_OS_COPYTOUSR( &to->count, + &from->buf_count, + sizeof(from->buf_count) ) || + DRM_OS_COPYTOUSR( &to->size, + &from->buf_size, + sizeof(from->buf_size) ) || + DRM_OS_COPYTOUSR( &to->low_mark, + &list->low_mark, + sizeof(list->low_mark) ) || + DRM_OS_COPYTOUSR( &to->high_mark, + &list->high_mark, + sizeof(list->high_mark) ) ) + DRM_OS_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; + + DRM_OS_KRNTOUSR( (drm_buf_info_t *)data, request, sizeof(request) ); + + return 0; +} + +int DRM(markbufs)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + int order; + drm_buf_entry_t *entry; + + if ( !dma ) DRM_OS_RETURN(EINVAL); + + DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) ); + + 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 ) + DRM_OS_RETURN(EINVAL); + entry = &dma->bufs[order]; + + if ( request.low_mark < 0 || request.low_mark > entry->buf_count ) + DRM_OS_RETURN(EINVAL); + if ( request.high_mark < 0 || request.high_mark > entry->buf_count ) + DRM_OS_RETURN(EINVAL); + + entry->freelist.low_mark = request.low_mark; + entry->freelist.high_mark = request.high_mark; + + return 0; +} + +int DRM(freebufs)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_buf_free_t request; + int i; + int idx; + drm_buf_t *buf; + + if ( !dma ) DRM_OS_RETURN(EINVAL); + + DRM_OS_KRNFROMUSR( request, (drm_buf_free_t *)data, sizeof(request) ); + + DRM_DEBUG( "%d\n", request.count ); + for ( i = 0 ; i < request.count ; i++ ) { + if ( DRM_OS_COPYFROMUSR( &idx, + &request.list[i], + sizeof(idx) ) ) + DRM_OS_RETURN(EFAULT); + if ( idx < 0 || idx >= dma->buf_count ) { + DRM_ERROR( "Index %d (of %d max)\n", + idx, dma->buf_count - 1 ); + DRM_OS_RETURN(EINVAL); + } + buf = dma->buflist[idx]; + if ( buf->pid != DRM_OS_CURRENTPID ) { + DRM_ERROR( "Process %d freeing buffer owned by %d\n", + DRM_OS_CURRENTPID, buf->pid ); + DRM_OS_RETURN(EINVAL); + } + DRM(free_buffer)( dev, buf ); + } + + return 0; +} + +int DRM(mapbufs)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + int retcode = 0; + const int zero = 0; + vm_offset_t virtual, address; +#if __FreeBSD_version >= 500000 + struct vmspace *vms = p->td_proc->p_vmspace; +#else + struct vmspace *vms = p->p_vmspace; +#endif + drm_buf_map_t request; + int i; + + if ( !dma ) DRM_OS_RETURN(EINVAL); + + DRM_OS_SPINLOCK( &dev->count_lock ); + if ( atomic_read( &dev->buf_alloc ) ) { + DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_OS_RETURN(EBUSY); + } + dev->buf_use++; /* Can't allocate more after this call */ + DRM_OS_SPINUNLOCK( &dev->count_lock ); + + DRM_OS_KRNFROMUSR( request, (drm_buf_map_t *)data, sizeof(request) ); + + 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; + } + + virtual = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ); + retcode = vm_mmap(&vms->vm_map, + &virtual, + round_page(map->size), + PROT_READ|PROT_WRITE, VM_PROT_ALL, + MAP_SHARED, + SLIST_FIRST(&kdev->si_hlist), + (unsigned long)map->offset ); + } else { + virtual = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ); + retcode = vm_mmap(&vms->vm_map, + &virtual, + round_page(dma->byte_count), + PROT_READ|PROT_WRITE, VM_PROT_ALL, + MAP_SHARED, + SLIST_FIRST(&kdev->si_hlist), + 0); + } + if (retcode) + goto done; + request.virtual = (void *)virtual; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + if ( DRM_OS_COPYTOUSR( &request.list[i].idx, + &dma->buflist[i]->idx, + sizeof(request.list[0].idx) ) ) { + retcode = EFAULT; + goto done; + } + if ( DRM_OS_COPYTOUSR( &request.list[i].total, + &dma->buflist[i]->total, + sizeof(request.list[0].total) ) ) { + retcode = EFAULT; + goto done; + } + if ( DRM_OS_COPYTOUSR( &request.list[i].used, + &zero, + sizeof(zero) ) ) { + retcode = EFAULT; + goto done; + } + address = virtual + dma->buflist[i]->offset; /* *** */ + if ( DRM_OS_COPYTOUSR( &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 ); + + DRM_OS_KRNTOUSR( (drm_buf_map_t *)data, request, sizeof(request) ); + + DRM_OS_RETURN(retcode); +} + +#endif /* __HAVE_DMA */ + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_context.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_context.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_context.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,730 @@ +/* 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 ) { + DRM_OS_LOCK; + clear_bit( ctx_handle, dev->ctx_bitmap ); + dev->context_sareas[ctx_handle] = NULL; + DRM_OS_UNLOCK; + 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; + + DRM_OS_LOCK; + 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) { + drm_map_t **ctx_sareas; + + ctx_sareas = DRM(realloc)(dev->context_sareas, + (dev->max_context - 1) * + sizeof(*dev->context_sareas), + dev->max_context * + sizeof(*dev->context_sareas), + DRM_MEM_MAPS); + if(!ctx_sareas) { + clear_bit(bit, dev->ctx_bitmap); + DRM_OS_UNLOCK; + return -1; + } + dev->context_sareas = ctx_sareas; + 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); + if(!dev->context_sareas) { + clear_bit(bit, dev->ctx_bitmap); + DRM_OS_UNLOCK; + return -1; + } + dev->context_sareas[bit] = NULL; + } + } + DRM_OS_UNLOCK; + return bit; + } + DRM_OS_UNLOCK; + return -1; +} + +int DRM(ctxbitmap_init)( drm_device_t *dev ) +{ + int i; + int temp; + + DRM_OS_LOCK; + dev->ctx_bitmap = (unsigned long *) DRM(alloc)( PAGE_SIZE, + DRM_MEM_CTXBITMAP ); + if ( dev->ctx_bitmap == NULL ) { + DRM_OS_UNLOCK; + DRM_OS_RETURN(ENOMEM); + } + memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE ); + dev->context_sareas = NULL; + dev->max_context = -1; + DRM_OS_UNLOCK; + + 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_OS_LOCK; + 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 ); + DRM_OS_UNLOCK; +} + +/* ================================================================ + * Per Context SAREA Support + */ + +int DRM(getsareactx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_priv_map_t request; + drm_map_t *map; + + DRM_OS_KRNFROMUSR( request, (drm_ctx_priv_map_t *)data, + sizeof(request) ); + + DRM_OS_LOCK; + if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) { + DRM_OS_UNLOCK; + DRM_OS_RETURN(EINVAL); + } + + map = dev->context_sareas[request.ctx_id]; + DRM_OS_UNLOCK; + + request.handle = map->handle; + + DRM_OS_KRNTOUSR( (drm_ctx_priv_map_t *)data, request, sizeof(request) ); + + return 0; +} + +int DRM(setsareactx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_priv_map_t request; + drm_map_t *map = NULL; + drm_map_list_entry_t *list; + + DRM_OS_KRNFROMUSR( request, (drm_ctx_priv_map_t *)data, + sizeof(request) ); + + DRM_OS_LOCK; + TAILQ_FOREACH(list, dev->maplist, link) { + map=list->map; + if(map->handle == request.handle) + goto found; + } + +bad: + DRM_OS_UNLOCK; + return -EINVAL; + +found: + map = list->map; + if (!map) goto bad; + if (dev->max_context < 0) + goto bad; + if (request.ctx_id >= (unsigned) dev->max_context) + goto bad; + dev->context_sareas[request.ctx_id] = map; + DRM_OS_UNLOCK; + 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" ); + DRM_OS_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 ); + DRM_OS_WAKEUP( &dev->context_wait ); + + return 0; +} + +int DRM(resctx)( DRM_OS_IOCTL ) +{ + drm_ctx_res_t res; + drm_ctx_t ctx; + int i; + + DRM_OS_KRNFROMUSR( res, (drm_ctx_res_t *)data, sizeof(res) ); + + if ( res.count >= DRM_RESERVED_CONTEXTS ) { + memset( &ctx, 0, sizeof(ctx) ); + for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + ctx.handle = i; + if ( DRM_OS_COPYTOUSR( &res.contexts[i], + &i, sizeof(i) ) ) + DRM_OS_RETURN(EFAULT); + } + } + res.count = DRM_RESERVED_CONTEXTS; + + DRM_OS_KRNTOUSR( (drm_ctx_res_t *)data, res, sizeof(res) ); + + return 0; +} + +int DRM(addctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + 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? */ + DRM_OS_RETURN(ENOMEM); + } + + DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + + return 0; +} + +int DRM(modctx)( DRM_OS_IOCTL ) +{ + /* This does nothing */ + return 0; +} + +int DRM(getctx)( DRM_OS_IOCTL ) +{ + drm_ctx_t ctx; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + /* This is 0, because we don't handle any context flags */ + ctx.flags = 0; + + DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + + return 0; +} + +int DRM(switchctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + DRM_DEBUG( "%d\n", ctx.handle ); + return DRM(context_switch)( dev, dev->last_context, ctx.handle ); +} + +int DRM(newctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + DRM_DEBUG( "%d\n", ctx.handle ); + DRM(context_switch_complete)( dev, ctx.handle ); + + return 0; +} + +int DRM(rmctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + DRM_DEBUG( "%d\n", ctx.handle ); + 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"); + DRM_OS_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); + DRM_OS_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); + DRM_OS_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); + DRM_OS_WAKEUP_INT(&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%ld f%ld b%ld\n", + (unsigned long)atomic_read(&q->use_count), + (unsigned long)atomic_read(&q->finalization), + (unsigned long)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); + + q->write_queue = 0; + q->read_queue = 0; + q->flush_queue = 0; + + 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 */ + DRM_OS_LOCK; + + 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) { + DRM_OS_UNLOCK; + DRM_DEBUG("out of memory\n"); + DRM_OS_RETURN(ENOMEM); + } + } + dev->queuelist[dev->queue_count-1] = queue; + + DRM_OS_UNLOCK; + DRM_DEBUG("%d (new)\n", dev->queue_count - 1); + return dev->queue_count - 1; +} + +int DRM(resctx)( DRM_OS_IOCTL ) +{ + drm_ctx_res_t res; + drm_ctx_t ctx; + int i; + + DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); + + DRM_OS_KRNFROMUSR( res, (drm_ctx_res_t *)data, sizeof(res) ); + + if (res.count >= DRM_RESERVED_CONTEXTS) { + memset(&ctx, 0, sizeof(ctx)); + for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { + ctx.handle = i; + if (DRM_OS_COPYTOUSR(&res.contexts[i], + &i, + sizeof(i))) + DRM_OS_RETURN(EFAULT); + } + } + res.count = DRM_RESERVED_CONTEXTS; + + DRM_OS_KRNTOUSR( (drm_ctx_res_t *)data, res, sizeof(res) ); + + return 0; +} + +int DRM(addctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + 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); + + DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + + return 0; +} + +int DRM(modctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + drm_queue_t *q; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle < 0 || ctx.handle >= dev->queue_count) + DRM_OS_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); + DRM_OS_RETURN(EINVAL); + } + + if (DRM_BUFCOUNT(&q->waitlist)) { + atomic_dec(&q->use_count); + DRM_OS_RETURN(EBUSY); + } + + q->flags = ctx.flags; + + atomic_dec(&q->use_count); + return 0; +} + +int DRM(getctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + drm_queue_t *q; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle >= dev->queue_count) + DRM_OS_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); + DRM_OS_RETURN(EINVAL); + } + + ctx.flags = q->flags; + atomic_dec(&q->use_count); + + DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + + return 0; +} + +int DRM(switchctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + DRM_DEBUG("%d\n", ctx.handle); + return DRM(context_switch)(dev, dev->last_context, ctx.handle); +} + +int DRM(newctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + DRM_DEBUG("%d\n", ctx.handle); + DRM(context_switch_complete)(dev, ctx.handle); + + return 0; +} + +int DRM(rmctx)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_ctx_t ctx; + drm_queue_t *q; + drm_buf_t *buf; + + DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle >= dev->queue_count) DRM_OS_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); + DRM_OS_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)) { + static int never; + int retcode; + retcode = tsleep(&never, PZERO|PCATCH, "never", 1); + if (retcode) + return retcode; + } + /* Remove queued buffers */ + while ((buf = DRM(waitlist_get)(&q->waitlist))) { + DRM(free_buffer)(dev, buf); + } + clear_bit(0, &dev->interrupt_flag); + + /* Wakeup blocked processes */ + wakeup( &q->block_read ); + wakeup( &q->block_write ); + DRM_OS_WAKEUP_INT( &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/bsd/drm/kernel/drm_dma.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_dma.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_dma.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,605 @@ +/* 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> + */ + +#include <machine/bus.h> +#include <machine/resource.h> +#include <sys/rman.h> + +#include "drmP.h" + +#ifndef __HAVE_DMA_WAITQUEUE +#define __HAVE_DMA_WAITQUEUE 0 +#endif +#ifndef __HAVE_DMA_RECLAIM +#define __HAVE_DMA_RECLAIM 0 +#endif +#ifndef __HAVE_SHARED_IRQ +#define __HAVE_SHARED_IRQ 0 +#endif + +#if __HAVE_SHARED_IRQ +#define DRM_IRQ_TYPE SA_SHIRQ +#else +#define DRM_IRQ_TYPE 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 ) + DRM_OS_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 ( buf->dma_wait ) { + wakeup( &buf->dma_wait ); + buf->dma_wait = 0; + } +#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)) { + DRM_OS_WAKEUP_INT(&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) { + int s = splclock(); + if (dev->timer.c_time != dev->last_switch + DRM_TIME_SLICE) { + callout_reset(&dev->timer, + dev->last_switch + DRM_TIME_SLICE - j, + (void (*)(void *))wrapper, + dev); + } + splx(s); + 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; + int error; + + 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"); + DRM_OS_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); + DRM_OS_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)) { + atomic_inc(&q->block_count); + for (;;) { + if (!atomic_read(&q->block_write)) break; + error = tsleep(&q->block_write, PZERO|PCATCH, + "dmawr", 0); + if (error) { + atomic_dec(&q->use_count); + return error; + } + } + atomic_dec(&q->block_count); + } + + 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); + DRM_OS_RETURN(EINVAL); + } + buf = dma->buflist[ idx ]; + if (buf->pid != DRM_OS_CURRENTPID) { + atomic_dec(&q->use_count); + DRM_ERROR("Process %d using buffer owned by %d\n", + DRM_OS_CURRENTPID, buf->pid); + DRM_OS_RETURN(EINVAL); + } + if (buf->list != DRM_LIST_NONE) { + atomic_dec(&q->use_count); + DRM_ERROR("Process %d using buffer %d on list %d\n", + DRM_OS_CURRENTPID, 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); + DRM_OS_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); + DRM_OS_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 = DRM_OS_CURRENTPID; + if (DRM_OS_COPYTOUSR(&d->request_indices[i], + &buf->idx, + sizeof(buf->idx))) + DRM_OS_RETURN(EFAULT); + + if (DRM_OS_COPYTOUSR(&d->request_sizes[i], + &buf->total, + sizeof(buf->total))) + DRM_OS_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 rid; + int retcode; + + if ( !irq ) + DRM_OS_RETURN(EINVAL); + + DRM_OS_LOCK; + if ( dev->irq ) { + DRM_OS_UNLOCK; + DRM_OS_RETURN(EBUSY); + } + dev->irq = irq; + DRM_OS_UNLOCK; + + 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 + TASK_INIT(&dev->task, 0, DRM(dma_immediate_bh), dev); +#endif + + /* Before installing handler */ + DRIVER_PREINSTALL(); + + /* Install handler */ + rid = 0; + dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &rid, + 0, ~0, 1, RF_SHAREABLE); + if (!dev->irqr) + return ENOENT; + + retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY, + DRM(dma_service), dev, &dev->irqh); + if ( retcode ) { + DRM_OS_LOCK; + bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr); + dev->irq = 0; + DRM_OS_UNLOCK; + return retcode; + } + + /* After installing handler */ + DRIVER_POSTINSTALL(); + + return 0; +} + +int DRM(irq_uninstall)( drm_device_t *dev ) +{ + int irq; + + DRM_OS_LOCK; + irq = dev->irq; + dev->irq = 0; + DRM_OS_UNLOCK; + + if ( !irq ) + DRM_OS_RETURN(EINVAL); + + DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); + + DRIVER_UNINSTALL(); + + bus_teardown_intr(dev->device, dev->irqr, dev->irqh); + bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr); + + return 0; +} + +int DRM(control)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_control_t ctl; + + DRM_OS_KRNFROMUSR( ctl, (drm_control_t *) data, sizeof(ctl) ); + + switch ( ctl.func ) { + case DRM_INST_HANDLER: + return DRM(irq_install)( dev, ctl.irq ); + case DRM_UNINST_HANDLER: + return DRM(irq_uninstall)( dev ); + default: + DRM_OS_RETURN(EINVAL); + } +} + +#endif /* __HAVE_DMA_IRQ */ + +#endif /* __HAVE_DMA */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drawable.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drawable.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drawable.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,50 @@ +/* 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)( DRM_OS_IOCTL ) +{ + drm_draw_t draw; + + draw.handle = 0; /* NOOP */ + DRM_DEBUG("%d\n", draw.handle); + + DRM_OS_KRNTOUSR( (drm_draw_t *)data, draw, sizeof(draw) ); + + return 0; +} + +int DRM(rmdraw)( DRM_OS_IOCTL ) +{ + return 0; /* NOOP */ +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drv.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_drv.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,1160 @@ +/* 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 __HAVE_KERNEL_CTX_SWITCH +#define __HAVE_KERNEL_CTX_SWITCH 0 +#endif +#ifndef PCI_ANY_ID +#define PCI_ANY_ID ~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_POSTCLEANUP +#define DRIVER_POSTCLEANUP() +#endif +#ifndef DRIVER_PRESETUP +#define DRIVER_PRESETUP() +#endif +#ifndef DRIVER_POSTSETUP +#define DRIVER_POSTSETUP() +#endif +#ifndef DRIVER_IOCTLS +#define DRIVER_IOCTLS +#endif +#ifndef DRIVER_FOPS +#if DRM_LINUX +#include <sys/file.h> +#include <sys/proc.h> +#include <machine/../linux/linux.h> +#include <machine/../linux/linux_proto.h> +#include "drm_linux.h" +#endif +#endif + + +/* + * The default number of instances (minor numbers) to initialize. + */ +#ifndef DRIVER_NUM_CARDS +#define DRIVER_NUM_CARDS 1 +#endif + +static int DRM(init)(device_t nbdev); +static void DRM(cleanup)(device_t nbdev); + +#define CDEV_MAJOR 145 +#define DRIVER_SOFTC(unit) \ + ((drm_device_t *) devclass_get_softc(DRM(devclass), unit)) + +#if __REALLY_HAVE_AGP +MODULE_DEPEND(DRIVER_NAME, agp, 1, 1, 1); +#endif +#if DRM_LINUX +MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1); +#endif + +static drm_device_t *DRM(device); +static int *DRM(minor); +static int DRM(numdevs) = 0; + + +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 __REALLY_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) ) + + +static int DRM(probe)(device_t dev) +{ + const char *s = 0; + + int pciid=pci_get_devid(dev); + int vendor = (pciid & 0x0000ffff); + int device = (pciid & 0xffff0000) >> 16; + int i=0, done=0; + DRM_INFO("Checking PCI vendor=%d, device=%d\n", vendor, device); + while ( !done && (DRM(devicelist)[i].vendor != 0 ) ) { + if ( (DRM(devicelist)[i].vendor == vendor) && + (DRM(devicelist)[i].device == device) ) { + done=1; + if ( DRM(devicelist)[i].supported ) + s = DRM(devicelist)[i].name; + else + DRM_INFO("%s not supported\n", DRM(devicelist)[i].name); + } + i++; + } + + if (s) { + device_set_desc(dev, s); + return 0; + } + + return ENXIO; +} + +static int DRM(attach)(device_t dev) +{ + return DRM(init)(dev); +} + +static int DRM(detach)(device_t dev) +{ + DRM(cleanup)(dev); + return 0; +} + +static device_method_t DRM(methods)[] = { + /* Device interface */ + DEVMETHOD(device_probe, DRM( probe)), + DEVMETHOD(device_attach, DRM( attach)), + DEVMETHOD(device_detach, DRM( detach)), + + { 0, 0 } +}; + +static driver_t DRM(driver) = { + "drm", + DRM(methods), + sizeof(drm_device_t), +}; + +static devclass_t DRM( devclass); + +static struct cdevsw DRM( cdevsw) = { + /* open */ DRM( open ), + /* close */ DRM( close ), + /* read */ DRM( read ), + /* write */ DRM( write ), + /* ioctl */ DRM( ioctl ), + /* poll */ DRM( poll ), + /* mmap */ DRM( mmap ), + /* strategy */ nostrategy, + /* name */ DRIVER_NAME, + /* maj */ CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ D_TTY | D_TRACKCLOSE, +#if __FreeBSD_version >= 500000 + /* kqfilter */ 0 +#else + /* bmaj */ -1 +#endif +}; + +static int DRM(setup)( drm_device_t *dev ) +{ + int i; + + DRIVER_PRESETUP(); + 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) DRM_OS_RETURN(ENOMEM); + memset(dev->maplist, 0, sizeof(*dev->maplist)); + TAILQ_INIT(dev->maplist); + dev->map_count = 0; + + dev->vmalist = NULL; + dev->lock.hw_lock = NULL; + dev->lock.lock_queue = 0; + 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; +#if __FreeBSD_version >= 500000 + callout_init( &dev->timer, 1 ); +#else + callout_init( &dev->timer ); +#endif + dev->context_wait = 0; + + 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_sigio = NULL; + dev->buf_readers = 0; + dev->buf_writers = 0; + dev->buf_selecting = 0; + + 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. + */ + DRIVER_POSTSETUP(); + return 0; +} + + +static int DRM(takedown)( drm_device_t *dev ) +{ + drm_magic_entry_t *pt, *next; + drm_map_t *map; + drm_map_list_entry_t *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 + + DRM_OS_LOCK; + callout_stop( &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->handle ); + DRM(free_agp)( entry->handle, 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 ) { + while ((list=TAILQ_FIRST(dev->maplist))) { + map = list->map; + 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: + 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; + case _DRM_SCATTER_GATHER: + /* Handle it, but do nothing, if REALLY_HAVE_SG + * isn't defined. + */ +#if __REALLY_HAVE_SG + if(dev->sg) { + DRM(sg_cleanup)(dev->sg); + dev->sg = NULL; + } +#endif + break; + } + TAILQ_REMOVE(dev->maplist, list, link); + DRM(free)(list, sizeof(*list), DRM_MEM_MAPS); + 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; + DRM_OS_WAKEUP_INT(&dev->lock.lock_queue); + } + DRM_OS_UNLOCK; + + return 0; +} + +/* + * Figure out how many instances to initialize. + */ +static int drm_count_cards(void) +{ + int num = 0; +#if defined(DRIVER_CARD_LIST) + int i; + drm_pci_list_t *l; + u16 device, vendor; + struct pci_dev *pdev = NULL; +#endif + + DRM_DEBUG( "\n" ); + +#if defined(DRIVER_COUNT_CARDS) + num = DRIVER_COUNT_CARDS(); +#elif defined(DRIVER_CARD_LIST) + for (i = 0, l = DRIVER_CARD_LIST; l[i].vendor != 0; i++) { + pdev = NULL; + vendor = l[i].vendor; + device = l[i].device; + if(device == 0xffff) device = PCI_ANY_ID; + if(vendor == 0xffff) vendor = PCI_ANY_ID; + while ((pdev = pci_find_device(vendor, device, pdev))) { + num++; /* FIXME: What about two cards of the same device id? */ + } + } +#else + num = DRIVER_NUM_CARDS; +#endif + DRM_DEBUG("numdevs = %d\n", num); + return num; +} + +/* drm_init is called via init_module at module load time, or via + * linux/init/main.c (this is not currently supported). + */ +static int DRM(init)( device_t nbdev ) +{ + + drm_device_t *dev; + int i; +#if __HAVE_CTX_BITMAP + int retcode; +#endif + DRM_DEBUG( "\n" ); + +#ifdef MODULE + DRM(parse_options)( drm_opts ); +#endif + + DRM(numdevs) = drm_count_cards(); + /* Force at least one instance. */ + if (DRM(numdevs) <= 0) + DRM(numdevs) = 1; + + DRM(device) = DRM_OS_MALLOC(sizeof(*DRM(device)) * DRM(numdevs)); + if (!DRM(device)) { + DRM_OS_RETURN(ENOMEM); + } + DRM(minor) = DRM_OS_MALLOC(sizeof(*(DRM(minor))) * DRM(numdevs)); + if (!DRM(minor)) { + DRM_OS_FREE(DRM(device)); + DRM_OS_RETURN(ENOMEM); + } + + DRIVER_PREINIT(); + + + for (i = 0; i < DRM(numdevs); i++) { + int unit = device_get_unit(nbdev); + /* FIXME??? - multihead !!! */ + dev = device_get_softc(nbdev); + memset( (void *)dev, 0, sizeof(*dev) ); + DRM(minor)[i]=unit; + DRM_OS_SPININIT(dev->count_lock, "drm device"); + lockinit(&dev->dev_lock, PZERO, "drmlk", 0, 0); + dev->device = nbdev; + dev->devnode = make_dev( &DRM(cdevsw), + unit, + DRM_DEV_UID, + DRM_DEV_GID, + DRM_DEV_MODE, + "dri/card%d", unit ); + dev->name = DRIVER_NAME; + DRM(mem_init)(); + DRM(sysctl_init)(dev); + TAILQ_INIT(&dev->files); + +#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(sysctl_cleanup)( dev ); + destroy_dev(dev->devnode); + DRM(takedown)( dev ); + DRM_OS_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(sysctl_cleanup)( dev ); + destroy_dev(dev->devnode); + DRM(takedown)( dev ); + return retcode; + } +#endif + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + DRM(minor)[i] ); + } + + DRIVER_POSTINIT(); + + return 0; +} + +/* drm_cleanup is called via cleanup_module at module unload time. + */ +static void DRM(cleanup)(device_t nbdev) +{ + drm_device_t *dev; + int i; + + DRM_DEBUG( "\n" ); + + for (i = DRM(numdevs) - 1; i >= 0; i--) { + /* FIXME??? - multihead */ + dev = device_get_softc(nbdev); + DRM(sysctl_cleanup)( dev ); + destroy_dev(dev->devnode); +#if __HAVE_CTX_BITMAP + DRM(ctxbitmap_cleanup)( dev ); +#endif + +#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR + if ( dev->agp && dev->agp->agp_mtrr >= 0) { + 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 + } + DRIVER_POSTCLEANUP(); + DRM_OS_FREE(DRM(minor)); + DRM_OS_FREE(DRM(device)); + DRM(numdevs) = 0; +} + + +int DRM(version)( DRM_OS_IOCTL ) +{ + drm_version_t version; + int len; + + DRM_OS_KRNFROMUSR( version, (drm_version_t *)data, sizeof(version) ); + +#define DRM_COPY( name, value ) \ + len = strlen( value ); \ + if ( len > name##_len ) len = name##_len; \ + name##_len = strlen( value ); \ + if ( len && name ) { \ + if ( DRM_OS_COPYTOUSR( name, value, len ) ) \ + DRM_OS_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 ); + + DRM_OS_KRNTOUSR( (drm_version_t *)data, version, sizeof(version) ); + + return 0; +} + +int DRM( open)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p) +{ + drm_device_t *dev = NULL; + int retcode = 0; + int i; + + for (i = 0; i < DRM(numdevs); i++) { + /* FIXME ??? - multihead */ + dev = DRIVER_SOFTC(minor(kdev)); + } + if (!dev) { + DRM_OS_RETURN(ENODEV); + } + + DRM_DEBUG( "open_count = %d\n", dev->open_count ); + + device_busy(dev->device); + retcode = DRM(open_helper)(kdev, flags, fmt, p, dev); + + if ( !retcode ) { + atomic_inc( &dev->counts[_DRM_STAT_OPENS] ); + DRM_OS_SPINLOCK( &dev->count_lock ); + if ( !dev->open_count++ ) { + DRM_OS_SPINUNLOCK( &dev->count_lock ); + return DRM(setup)( dev ); + } + DRM_OS_SPINUNLOCK( &dev->count_lock ); + } + device_unbusy(dev->device); + + return retcode; +} + +int DRM( close)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p) +{ + drm_file_t *priv; + drm_device_t *dev = kdev->si_drv1; + int retcode = 0; + + DRM_DEBUG( "open_count = %d\n", dev->open_count ); + priv = DRM(find_file_by_proc)(dev, p); + if (!priv) { + DRM_DEBUG("can't find authenticator\n"); + return EINVAL; + } + + DRIVER_PRERELEASE(); + + /* ======================================================== + * Begin inline drm_release + */ + + DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", + DRM_OS_CURRENTPID, (long)dev->device, dev->open_count ); + + if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) + && dev->lock.pid == DRM_OS_CURRENTPID) { + DRM_DEBUG("Process %d dead, freeing lock for context %d\n", + DRM_OS_CURRENTPID, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); +#if HAVE_DRIVER_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 */ + for (;;) { + 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 = p->p_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 + retcode = tsleep(&dev->lock.lock_queue, + PZERO|PCATCH, + "drmlk2", + 0); + if (retcode) + break; + } + 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 + + funsetown(dev->buf_sigio); + + DRM_OS_LOCK; + priv = DRM(find_file_by_proc)(dev, p); + if (priv) { + priv->refs--; + if (!priv->refs) { + TAILQ_REMOVE(&dev->files, priv, link); + } + } + DRM_OS_UNLOCK; + + DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES ); + + /* ======================================================== + * End inline drm_release + */ + + atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); + DRM_OS_SPINLOCK( &dev->count_lock ); + if ( !--dev->open_count ) { + if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) { + DRM_ERROR( "Device busy: %ld %d\n", + (unsigned long)atomic_read( &dev->ioctl_count ), + dev->blocked ); + DRM_OS_SPINUNLOCK( &dev->count_lock ); + DRM_OS_RETURN(EBUSY); + } + DRM_OS_SPINUNLOCK( &dev->count_lock ); + device_unbusy(dev->device); + return DRM(takedown)( dev ); + } + DRM_OS_SPINUNLOCK( &dev->count_lock ); + + + DRM_OS_RETURN(retcode); +} + +/* DRM(ioctl) is called whenever a process performs an ioctl on /dev/drm. + */ +int DRM(ioctl)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + int retcode = 0; + drm_ioctl_desc_t *ioctl; + d_ioctl_t *func; + int nr = DRM_IOCTL_NR(cmd); + DRM_OS_PRIV; + + atomic_inc( &dev->ioctl_count ); + atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] ); + ++priv->ioctl_count; + + DRM_DEBUG( "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n", + DRM_OS_CURRENTPID, cmd, nr, (long)dev->device, priv->authenticated ); + + switch (cmd) { + case FIONBIO: + atomic_dec(&dev->ioctl_count); + return 0; + + case FIOASYNC: + atomic_dec(&dev->ioctl_count); + dev->flags |= FASYNC; + return 0; + + case FIOSETOWN: + atomic_dec(&dev->ioctl_count); + return fsetown(*(int *)data, &dev->buf_sigio); + + case FIOGETOWN: + atomic_dec(&dev->ioctl_count); + *(int *) data = fgetown(dev->buf_sigio); + return 0; + } + + 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 && DRM_OS_CHECKSUSER ) + || ( ioctl->auth_needed && !priv->authenticated ) ) { + retcode = EACCES; + } else { + retcode = func( kdev, cmd, data, flags, p ); + } + } + + atomic_dec( &dev->ioctl_count ); + DRM_OS_RETURN(retcode); +} + +int DRM(lock)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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 + + DRM_OS_KRNFROMUSR( lock, (drm_lock_t *)data, sizeof(lock) ); + + if ( lock.context == DRM_KERNEL_CONTEXT ) { + DRM_ERROR( "Process %d using kernel context %d\n", + DRM_OS_CURRENTPID, lock.context ); + DRM_OS_RETURN(EINVAL); + } + + DRM_DEBUG( "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", + lock.context, DRM_OS_CURRENTPID, + dev->lock.hw_lock->lock, lock.flags ); + +#if __HAVE_DMA_QUEUE + if ( lock.context < 0 ) + DRM_OS_RETURN(EINVAL); +#elif __HAVE_MULTIPLE_DMA_QUEUES + if ( lock.context < 0 || lock.context >= dev->queue_count ) + DRM_OS_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 ) { + for (;;) { + if ( !dev->lock.hw_lock ) { + /* Device has been unregistered */ + ret = EINTR; + break; + } + if ( DRM(lock_take)( &dev->lock.hw_lock->lock, + lock.context ) ) { + dev->lock.pid = DRM_OS_CURRENTPID; + dev->lock.lock_time = jiffies; + atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); + break; /* Got lock */ + } + + /* Contention */ + ret = tsleep(&dev->lock.lock_queue, + PZERO|PCATCH, + "drmlk2", + 0); + if (ret) + break; + } + } + +#if __HAVE_DMA_FLUSH + DRM(flush_unblock)( dev, lock.context, lock.flags ); /* cleanup phase */ +#endif + + if ( !ret ) { + +#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 +#if __HAVE_KERNEL_CTX_SWITCH + if ( dev->last_context != lock.context ) { + DRM(context_switch)(dev, dev->last_context, + lock.context); + } +#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 + + DRM_OS_RETURN(ret); +} + + +int DRM(unlock)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_lock_t lock; + + DRM_OS_KRNFROMUSR( lock, (drm_lock_t *)data, sizeof(lock) ) ; + + if ( lock.context == DRM_KERNEL_CONTEXT ) { + DRM_ERROR( "Process %d using kernel context %d\n", + DRM_OS_CURRENTPID, lock.context ); + DRM_OS_RETURN(EINVAL); + } + + atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); + +#if __HAVE_KERNEL_CTX_SWITCH + /* We no longer really hold it, but if we are the next + * agent to request it then we should just be able to + * take it immediately and not eat the ioctl. + */ + dev->lock.pid = 0; + { + __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock; + unsigned int old, new, prev, ctx; + + ctx = lock.context; + do { + old = *plock; + new = ctx; + prev = cmpxchg(plock, old, new); + } while (prev != old); + } + wake_up_interruptible(&dev->lock.lock_queue); +#else + 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" ); + } + } +#endif /* !__HAVE_KERNEL_CTX_SWITCH */ + + return 0; +} + +#if DRM_LINUX +static linux_ioctl_function_t DRM( linux_ioctl); +static struct linux_ioctl_handler DRM( handler) = {DRM( linux_ioctl), LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX}; +SYSINIT (DRM( register), SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_register_handler, &DRM( handler)); +SYSUNINIT(DRM( unregister), SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_unregister_handler, &DRM( handler)); + +/* + * Linux emulation IOCTL + */ +static int +DRM(linux_ioctl)(DRM_OS_STRUCTPROC *p, struct linux_ioctl_args* args) +{ +#if (__FreeBSD_version >= 500000) + struct file *fp = p->td_proc->p_fd->fd_ofiles[args->fd]; +#else + struct file *fp = p->p_fd->fd_ofiles[args->fd]; +#endif + u_long cmd = args->cmd; + caddr_t data = (caddr_t) args->arg; + /* + * Pass the ioctl off to our standard handler. + */ + return(fo_ioctl(fp, cmd, data, p)); +} +#endif /* DRM_LINUX */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_fops.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_fops.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_fops.h Wed Dec 12 19:24:46 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 <sys/signalvar.h> +#include <sys/poll.h> + +drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_OS_STRUCTPROC *p) +{ +#if __FreeBSD_version >= 500021 + uid_t uid = p->td_proc->p_ucred->cr_svuid; + pid_t pid = p->td_proc->p_pid; +#else + uid_t uid = p->p_cred->p_svuid; + pid_t pid = p->p_pid; +#endif + drm_file_t *priv; + + TAILQ_FOREACH(priv, &dev->files, link) + if (priv->pid == pid && priv->uid == uid) + return priv; + return NULL; +} + +/* DRM(open) is called whenever a process opens /dev/drm. */ + +int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p, + drm_device_t *dev) +{ + int m = minor(kdev); + drm_file_t *priv; + + if (flags & O_EXCL) + return EBUSY; /* No exclusive opens */ + dev->flags = flags; + if (!DRM(cpu_valid)()) + DRM_OS_RETURN(EINVAL); + + DRM_DEBUG("pid = %d, minor = %d\n", DRM_OS_CURRENTPID, m); + + /* FIXME: linux mallocs and bzeros here */ + priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); + if (priv) { + priv->refs++; + } else { + priv = (drm_file_t *) DRM(alloc)(sizeof(*priv), DRM_MEM_FILES); + bzero(priv, sizeof(*priv)); +#if __FreeBSD_version >= 500000 + priv->uid = p->td_proc->p_ucred->cr_svuid; + priv->pid = p->td_proc->p_pid; +#else + priv->uid = p->p_cred->p_svuid; + priv->pid = p->p_pid; +#endif + + priv->refs = 1; + priv->minor = m; + priv->devXX = dev; + priv->ioctl_count = 0; + priv->authenticated = !DRM_OS_CHECKSUSER; + lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, p); + TAILQ_INSERT_TAIL(&dev->files, priv, link); + lockmgr(&dev->dev_lock, LK_RELEASE, 0, p); + } + + kdev->si_drv1 = dev; + + + 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)(dev_t kdev, struct uio *uio, int ioflag) +{ + DRM_OS_DEVICE; + int left; + int avail; + int send; + int cur; + int error = 0; + + DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); + + while (dev->buf_rp == dev->buf_wp) { + DRM_DEBUG(" sleeping\n"); + if (dev->flags & FASYNC) + return EWOULDBLOCK; + error = tsleep(&dev->buf_rp, PZERO|PCATCH, "drmrd", 0); + if (error) { + DRM_DEBUG(" interrupted\n"); + return error; + } + DRM_DEBUG(" awake\n"); + } + + left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; + avail = DRM_BSZ - left; + send = DRM_MIN(avail, uio->uio_resid); + + 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); + } + error = uiomove(dev->buf_rp, cur, uio); + if (error) + break; + dev->buf_rp += cur; + if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf; + send -= cur; + } + + wakeup(&dev->buf_wp); + return error; +} + +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 (dev->buf_selecting) { + dev->buf_selecting = 0; + selwakeup(&dev->buf_sel); + } + + DRM_DEBUG("dev->buf_sigio=%p\n", dev->buf_sigio); + if (dev->buf_sigio) { + DRM_DEBUG("dev->buf_sigio->sio_pgid=%d\n", dev->buf_sigio->sio_pgid); + pgsigio(dev->buf_sigio, SIGIO, 0); + } + DRM_DEBUG("waking\n"); + wakeup(&dev->buf_rp); + + return 0; +} + +int DRM(poll)(dev_t kdev, int events, DRM_OS_STRUCTPROC *p) +{ + drm_device_t *dev = kdev->si_drv1; + int s; + int revents = 0; + + s = spldrm(); + if (events & (POLLIN | POLLRDNORM)) { + int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; + if (left > 0) + revents |= events & (POLLIN | POLLRDNORM); + else + selrecord(p, &dev->buf_sel); + } + splx(s); + + return revents; +} + +int DRM(write)(dev_t kdev, struct uio *uio, int ioflag) +{ + DRM_DEBUG("pid = %d, device = %p, open_count = %d\n", + curproc->p_pid, ((drm_device_t *)kdev->si_drv1)->device, ((drm_device_t *)kdev->si_drv1)->open_count); + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_init.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_init.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_init.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,110 @@ +/* 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 && DRM_DEBUG_CODE +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_opts=" options, or the command-line + * options passed to the kernel via LILO. The grammar of the format is as + * follows: + * + * drm ::= 'drm_opts=' option_list + * option_list ::= option [ ';' option_list ] + * option ::= 'device:' major + * | 'debug' + * | 'noctx' + * major ::= INTEGER + * + * Note that 's' contains option_list without the 'drm_opts=' 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) +{ + return 1; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_ioctl.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_ioctl.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_ioctl.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,237 @@ +/* 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" +#include <sys/bus.h> +#include <pci/pcivar.h> + +int DRM(irq_busid)( DRM_OS_IOCTL ) +{ + drm_irq_busid_t id; + devclass_t pci; + device_t bus, dev; + device_t *kids; + int error, i, num_kids; + + DRM_OS_KRNFROMUSR( id, (drm_irq_busid_t *)data, sizeof(id) ); + + pci = devclass_find("pci"); + if (!pci) + return ENOENT; + bus = devclass_get_device(pci, id.busnum); + if (!bus) + return ENOENT; + error = device_get_children(bus, &kids, &num_kids); + if (error) + return error; + + dev = 0; + for (i = 0; i < num_kids; i++) { + dev = kids[i]; + if (pci_get_slot(dev) == id.devnum + && pci_get_function(dev) == id.funcnum) + break; + } + + free(kids, M_TEMP); + + if (i != num_kids) + id.irq = pci_get_irq(dev); + else + id.irq = 0; + DRM_DEBUG("%d:%d:%d => IRQ %d\n", + id.busnum, id.devnum, id.funcnum, id.irq); + + DRM_OS_KRNTOUSR( (drm_irq_busid_t *)data, id, sizeof(id) ); + + return 0; +} + +int DRM(getunique)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_unique_t u; + + DRM_OS_KRNFROMUSR( u, (drm_unique_t *)data, sizeof(u) ); + + if (u.unique_len >= dev->unique_len) { + if (DRM_OS_COPYTOUSR(u.unique, dev->unique, dev->unique_len)) + DRM_OS_RETURN(EFAULT); + } + u.unique_len = dev->unique_len; + + DRM_OS_KRNTOUSR( (drm_unique_t *)data, u, sizeof(u) ); + + return 0; +} + +int DRM(setunique)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_unique_t u; + + if (dev->unique_len || dev->unique) + DRM_OS_RETURN(EBUSY); + + DRM_OS_KRNFROMUSR( u, (drm_unique_t *)data, sizeof(u) ); + + if (!u.unique_len || u.unique_len > 1024) + DRM_OS_RETURN(EINVAL); + + dev->unique_len = u.unique_len; + dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER); + + if(!dev->unique) DRM_OS_RETURN(ENOMEM); + + if (DRM_OS_COPYFROMUSR(dev->unique, u.unique, dev->unique_len)) + DRM_OS_RETURN(EFAULT); + + dev->unique[dev->unique_len] = '\0'; + + dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2, + DRM_MEM_DRIVER); + if(!dev->devname) { + DRM(free)(dev->devname, sizeof(*dev->devname), DRM_MEM_DRIVER); + DRM_OS_RETURN(ENOMEM); + } + sprintf(dev->devname, "%s@%s", dev->name, dev->unique); + + + return 0; +} + + +int DRM(getmap)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_map_t map; + drm_map_t *mapinlist; + drm_map_list_entry_t *list; + int idx; + int i = 0; + + DRM_OS_KRNFROMUSR( map, (drm_map_t *)data, sizeof(map) ); + + idx = map.offset; + + DRM_OS_LOCK; + if (idx < 0 || idx >= dev->map_count) { + DRM_OS_UNLOCK; + DRM_OS_RETURN(EINVAL); + } + + TAILQ_FOREACH(list, dev->maplist, link) { + mapinlist = list->map; + if (i==idx) { + map.offset = mapinlist->offset; + map.size = mapinlist->size; + map.type = mapinlist->type; + map.flags = mapinlist->flags; + map.handle = mapinlist->handle; + map.mtrr = mapinlist->mtrr; + break; + } + i++; + } + + DRM_OS_UNLOCK; + + if (!list) + return EINVAL; + + DRM_OS_KRNTOUSR( (drm_map_t *)data, map, sizeof(map) ); + + return 0; +} + +int DRM(getclient)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_client_t client; + drm_file_t *pt; + int idx; + int i = 0; + + DRM_OS_KRNFROMUSR( client, (drm_client_t *)data, sizeof(client) ); + + idx = client.idx; + DRM_OS_LOCK; + TAILQ_FOREACH(pt, &dev->files, link) { + if (i==idx) + { + client.auth = pt->authenticated; + client.pid = pt->pid; + client.uid = pt->uid; + client.magic = pt->magic; + client.iocs = pt->ioctl_count; + DRM_OS_UNLOCK; + + *(drm_client_t *)data = client; + return 0; + } + i++; + } + DRM_OS_UNLOCK; + + DRM_OS_KRNTOUSR( (drm_client_t *)data, client, sizeof(client) ); + + return 0; +} + +int DRM(getstats)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_stats_t stats; + int i; + + memset(&stats, 0, sizeof(stats)); + + DRM_OS_LOCK; + + 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; + + DRM_OS_UNLOCK; + + DRM_OS_KRNTOUSR( (drm_stats_t *)data, stats, sizeof(stats) ); + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_linux.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_linux.h:1.2 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_linux.h Sun Dec 16 14:45:01 2001 @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2000 by Coleman Kane <cokane@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Gardner Buchanan. + * 4. The name of Gardner Buchanan may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/sys/dev/tdfx/tdfx_linux.h,v 1.4 2000/08/22 05:57:55 marcel Exp $ + */ + +/* FIXME: There are IOCTLS to merge in here, see drm.h*/ + +/* Query IOCTLs */ +/* XFree86 4.1.x DRI support */ + +#define LINUX_DRM_IOCTL_VERSION 0x6400 +#define LINUX_DRM_IOCTL_GET_UNIQUE 0x6401 +#define LINUX_DRM_IOCTL_GET_MAGIC 0x6402 +#define LINUX_DRM_IOCTL_IRQ_BUSID 0x6403 +#define LINUX_DRM_IOCTL_GET_MAP 0x6404 +#define LINUX_DRM_IOCTL_GET_CLIENT 0x6405 +#define LINUX_DRM_IOCTL_GET_STATS 0x6406 + +#define LINUX_DRM_IOCTL_SET_UNIQUE 0x6410 +#define LINUX_DRM_IOCTL_AUTH_MAGIC 0x6411 +#define LINUX_DRM_IOCTL_BLOCK 0x6412 +#define LINUX_DRM_IOCTL_UNBLOCK 0x6413 +#define LINUX_DRM_IOCTL_CONTROL 0x6414 +#define LINUX_DRM_IOCTL_ADD_MAP 0x6415 +#define LINUX_DRM_IOCTL_ADD_BUFS 0x6416 +#define LINUX_DRM_IOCTL_MARK_BUFS 0x6417 +#define LINUX_DRM_IOCTL_INFO_BUFS 0x6418 +#define LINUX_DRM_IOCTL_MAP_BUFS 0x6419 +#define LINUX_DRM_IOCTL_FREE_BUFS 0x641a + +#define LINUX_DRM_IOCTL_RM_MAP 0x641b + +#define LINUX_DRM_IOCTL_SET_SAREA_CTX 0x641c +#define LINUX_DRM_IOCTL_GET_SAREA_CTX 0x641d + +#define LINUX_DRM_IOCTL_ADD_CTX 0x6420 +#define LINUX_DRM_IOCTL_RM_CTX 0x6421 +#define LINUX_DRM_IOCTL_MOD_CTX 0x6422 +#define LINUX_DRM_IOCTL_GET_CTX 0x6423 +#define LINUX_DRM_IOCTL_SWITCH_CTX 0x6424 +#define LINUX_DRM_IOCTL_NEW_CTX 0x6425 +#define LINUX_DRM_IOCTL_RES_CTX 0x6426 +#define LINUX_DRM_IOCTL_ADD_DRAW 0x6427 +#define LINUX_DRM_IOCTL_RM_DRAW 0x6428 +#define LINUX_DRM_IOCTL_DMA 0x6429 +#define LINUX_DRM_IOCTL_LOCK 0x642a +#define LINUX_DRM_IOCTL_UNLOCK 0x642b +#define LINUX_DRM_IOCTL_FINISH 0x642c + +#define LINUX_DRM_IOCTL_AGP_ACQUIRE 0x6430 +#define LINUX_DRM_IOCTL_AGP_RELEASE 0x6431 +#define LINUX_DRM_IOCTL_AGP_ENABLE 0x6432 +#define LINUX_DRM_IOCTL_AGP_INFO 0x6433 +#define LINUX_DRM_IOCTL_AGP_ALLOC 0x6434 +#define LINUX_DRM_IOCTL_AGP_FREE 0x6435 +#define LINUX_DRM_IOCTL_AGP_BIND 0x6436 +#define LINUX_DRM_IOCTL_AGP_UNBIND 0x6437 + +#define LINUX_DRM_IOCTL_SG_ALLOC 0x6438 +#define LINUX_DRM_IOCTL_SG_FREE 0x6439 + +/* MGA specific ioctls */ +#define LINUX_DRM_IOCTL_MGA_INIT 0x6440 +#define LINUX_DRM_IOCTL_MGA_FLUSH 0x6441 +#define LINUX_DRM_IOCTL_MGA_RESET 0x6442 +#define LINUX_DRM_IOCTL_MGA_SWAP 0x6443 +#define LINUX_DRM_IOCTL_MGA_CLEAR 0x6444 +#define LINUX_DRM_IOCTL_MGA_VERTEX 0x6445 +#define LINUX_DRM_IOCTL_MGA_INDICES 0x6446 +#define LINUX_DRM_IOCTL_MGA_ILOAD 0x6447 +#define LINUX_DRM_IOCTL_MGA_BLIT 0x6448 + +/* i810 specific ioctls */ +#define LINUX_DRM_IOCTL_I810_INIT 0x6440 +#define LINUX_DRM_IOCTL_I810_VERTEX 0x6441 +#define LINUX_DRM_IOCTL_I810_CLEAR 0x6442 +#define LINUX_DRM_IOCTL_I810_FLUSH 0x6443 +#define LINUX_DRM_IOCTL_I810_GETAGE 0x6444 +#define LINUX_DRM_IOCTL_I810_GETBUF 0x6445 +#define LINUX_DRM_IOCTL_I810_SWAP 0x6446 +#define LINUX_DRM_IOCTL_I810_COPY 0x6447 +#define LINUX_DRM_IOCTL_I810_DOCOPY 0x6448 + +/* I830 specific ioctls */ +#define LINUX_DRM_IOCTL_I830_INIT 0x6440 +#define LINUX_DRM_IOCTL_I830_VERTEX 0x6441 +#define LINUX_DRM_IOCTL_I830_CLEAR 0x6442 +#define LINUX_DRM_IOCTL_I830_FLUSH 0x6443 +#define LINUX_DRM_IOCTL_I830_GETAGE 0x6444 +#define LINUX_DRM_IOCTL_I830_GETBUF 0x6445 +#define LINUX_DRM_IOCTL_I830_SWAP 0x6446 +#define LINUX_DRM_IOCTL_I830_COPY 0x6447 +#define LINUX_DRM_IOCTL_I830_DOCOPY 0x6448 + +/* Rage 128 specific ioctls */ +#define LINUX_DRM_IOCTL_R128_INIT 0x6440 +#define LINUX_DRM_IOCTL_R128_CCE_START 0x6441 +#define LINUX_DRM_IOCTL_R128_CCE_STOP 0x6442 +#define LINUX_DRM_IOCTL_R128_CCE_RESET 0x6443 +#define LINUX_DRM_IOCTL_R128_CCE_IDLE 0x6444 +#define LINUX_DRM_IOCTL_R128_RESET 0x6446 +#define LINUX_DRM_IOCTL_R128_SWAP 0x6447 +#define LINUX_DRM_IOCTL_R128_CLEAR 0x6448 +#define LINUX_DRM_IOCTL_R128_VERTEX 0x6449 +#define LINUX_DRM_IOCTL_R128_INDICES 0x644a +#define LINUX_DRM_IOCTL_R128_BLIT 0x644b +#define LINUX_DRM_IOCTL_R128_DEPTH 0x644c +#define LINUX_DRM_IOCTL_R128_STIPPLE 0x644d +#define LINUX_DRM_IOCTL_R128_INDIRECT 0x644f +#define LINUX_DRM_IOCTL_R128_FULLSCREEN 0x6450 + +/* Radeon specific ioctls */ +#define LINUX_DRM_IOCTL_RADEON_CP_INIT 0x6440 +#define LINUX_DRM_IOCTL_RADEON_CP_START 0x6441 +#define LINUX_DRM_IOCTL_RADEON_CP_STOP 0x6442 +#define LINUX_DRM_IOCTL_RADEON_CP_RESET 0x6443 +#define LINUX_DRM_IOCTL_RADEON_CP_IDLE 0x6444 +#define LINUX_DRM_IOCTL_RADEON_RESET 0x6445 +#define LINUX_DRM_IOCTL_RADEON_FULLSCREEN 0x6446 +#define LINUX_DRM_IOCTL_RADEON_SWAP 0x6447 +#define LINUX_DRM_IOCTL_RADEON_CLEAR 0x6448 +#define LINUX_DRM_IOCTL_RADEON_VERTEX 0x6449 +#define LINUX_DRM_IOCTL_RADEON_INDICES 0x644a +#define LINUX_DRM_IOCTL_RADEON_STIPPLE 0x644c +#define LINUX_DRM_IOCTL_RADEON_INDIRECT 0x644d +#define LINUX_DRM_IOCTL_RADEON_TEXTURE 0x644e + +/* card specific ioctls may increase the DRM_MAX */ +#define LINUX_IOCTL_DRM_MIN LINUX_DRM_IOCTL_VERSION +#define LINUX_IOCTL_DRM_MAX LINUX_DRM_IOCTL_R128_FULLSCREEN Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lists.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lists.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lists.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,236 @@ +/* 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) + DRM_OS_RETURN( EINVAL ); + + bl->bufs = DRM(alloc)((bl->count + 2) * sizeof(*bl->bufs), + DRM_MEM_BUFLISTS); + + if(!bl->bufs) DRM_OS_RETURN(ENOMEM); + + bl->count = count; + bl->rp = bl->bufs; + bl->wp = bl->bufs; + bl->end = &bl->bufs[bl->count+1]; + DRM_OS_SPININIT( bl->write_lock, "writelock" ); + DRM_OS_SPININIT( bl->read_lock, "readlock" ); + return 0; +} + +int DRM(waitlist_destroy)(drm_waitlist_t *bl) +{ + if (bl->rp != bl->wp) + DRM_OS_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; + int s; + left = DRM_LEFTCOUNT(bl); + if (!left) { + DRM_ERROR("Overflow while adding buffer %d from pid %d\n", + buf->idx, buf->pid); + DRM_OS_RETURN( EINVAL ); + } +#if __HAVE_DMA_HISTOGRAM + getnanotime(&buf->time_queued); +#endif + buf->list = DRM_LIST_WAIT; + + DRM_OS_SPINLOCK(&bl->write_lock); + s = spldrm(); + *bl->wp = buf; + if (++bl->wp >= bl->end) bl->wp = bl->bufs; + splx(s); + DRM_OS_SPINUNLOCK(&bl->write_lock); + + return 0; +} + +drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl) +{ + drm_buf_t *buf; + int s; + + DRM_OS_SPINLOCK(&bl->read_lock); + s = spldrm(); + buf = *bl->rp; + if (bl->rp == bl->wp) { + splx(s); + DRM_OS_SPINUNLOCK(&bl->read_lock); + return NULL; + } + if (++bl->rp >= bl->end) bl->rp = bl->bufs; + splx(s); + DRM_OS_SPINUNLOCK(&bl->read_lock); + + 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; + bl->waiting = 0; + + bl->low_mark = 0; + bl->high_mark = 0; + atomic_set(&bl->wfh, 0); + DRM_OS_SPININIT( bl->lock, "freelistlock" ); + ++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 + getnanotime(&buf->time_queued); + DRM(histogram_compute)(dev, buf); +#endif + buf->list = DRM_LIST_FREE; + + DRM_OS_SPINLOCK( &bl->lock ); + buf->next = bl->next; + bl->next = buf; + DRM_OS_SPINUNLOCK( &bl->lock ); + + atomic_inc(&bl->count); + if (atomic_read(&bl->count) > dma->buf_count) { + DRM_ERROR("%ld of %d buffers free after addition of %d\n", + (unsigned long)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); + DRM_OS_WAKEUP_INT(&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 */ + DRM_OS_SPINLOCK(&bl->lock); + if (!bl->next) { + DRM_OS_SPINUNLOCK(&bl->lock); + return NULL; + } + buf = bl->next; + bl->next = bl->next->next; + DRM_OS_SPINUNLOCK(&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; + int error; + + 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) { + for (;;) { + if (!atomic_read(&bl->wfh) + && (buf = DRM(freelist_try(bl)))) break; + error = tsleep(&bl->waiting, PZERO|PCATCH, + "drmfg", 0); + if (error) + break; + } + } + return buf; + } + + return DRM(freelist_try)(bl); +} + +#endif /* __HAVE_DMA_FREELIST */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lock.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lock.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_lock.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,244 @@ +/* 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)( DRM_OS_IOCTL ) +{ + DRM_DEBUG("\n"); + return 0; +} + +int DRM(unblock)( DRM_OS_IOCTL ) +{ + DRM_DEBUG("\n"); + return 0; +} + +int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new; + + char failed; + + do { + old = *lock; + if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT; + else new = context | _DRM_LOCK_HELD; + _DRM_CAS(lock, old, new, failed); + } while (failed); + 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; + char failed; + + dev->lock.pid = 0; + do { + old = *lock; + new = context | _DRM_LOCK_HELD; + _DRM_CAS(lock, old, new, failed); + } while (failed); + return 1; +} + +int DRM(lock_free)(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new; + pid_t pid = dev->lock.pid; + char failed; + + dev->lock.pid = 0; + do { + old = *lock; + new = 0; + _DRM_CAS(lock, old, new, failed); + } while (failed); + 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; + } + DRM_OS_WAKEUP_INT(&dev->lock.lock_queue); + return 0; +} + +static int DRM(flush_queue)(drm_device_t *dev, int context) +{ + int error; + 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); + atomic_inc(&q->block_count); + error = tsleep(&q->flush_queue, PZERO|PCATCH, "drmfq", 0); + if (error) + return error; + atomic_dec(&q->block_count); + } + 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); + DRM_OS_WAKEUP_INT(&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)( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + int ret = 0; + drm_lock_t lock; + + DRM_DEBUG("\n"); + + DRM_OS_KRNFROMUSR( lock, (drm_lock_t *)data, sizeof(lock) ); + + 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; + char failed; + + + /* 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; + _DRM_CAS(&s->lock->lock, old, new, failed); + } while (failed); + return 0; +} + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_memory.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_memory.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_memory.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,433 @@ +/* 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 "drmP.h" +#include <vm/vm.h> +#include <vm/pmap.h> +#if __REALLY_HAVE_AGP +#include <sys/agpio.h> +#endif + +#define malloctype DRM(M_DRM) +/* The macros confliced in the MALLOC_DEFINE */ + +MALLOC_DEFINE(malloctype, "drm", "DRM Data Structures"); + +#undef malloctype + +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 DRM_OS_SPINTYPE DRM(mem_lock); +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; + + DRM_OS_SPININIT(DRM(mem_lock), "drm memory"); + + 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; + } + + DRM(ram_available) = 0; /* si.totalram */ + DRM(ram_used) = 0; +} + +/* drm_mem_info is called whenever a process reads /dev/drm/mem. */ + +static int DRM(_mem_info) DRM_SYSCTL_HANDLER_ARGS +{ + drm_mem_stats_t *pt; + char buf[128]; + int error; + + DRM_SYSCTL_PRINT(" total counts " + " | outstanding \n"); + DRM_SYSCTL_PRINT("type alloc freed fail bytes freed" + " | allocs bytes\n\n"); + DRM_SYSCTL_PRINT("%-9.9s %5d %5d %4d %10lu |\n", + "system", 0, 0, 0, DRM(ram_available)); + DRM_SYSCTL_PRINT("%-9.9s %5d %5d %4d %10lu |\n", + "locked", 0, 0, 0, DRM(ram_used)); + DRM_SYSCTL_PRINT("\n"); + for (pt = DRM(mem_stats); pt->name; pt++) { + DRM_SYSCTL_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); + } + SYSCTL_OUT(req, "", 1); + + return 0; +} + +int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS +{ + int ret; + + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ret = DRM(_mem_info)(oidp, arg1, arg2, req); + DRM_OS_SPINUNLOCK(&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 = malloc(size, DRM(M_DRM), M_NOWAIT))) { + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[area].fail_count; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return NULL; + } + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[area].succeed_count; + DRM(mem_stats)[area].bytes_allocated += size; + DRM_OS_SPINUNLOCK(&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)(char *s, int area) +{ + unsigned int size; + + if (!s) return; + + size = 1 + strlen(s); + 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 free(pt, DRM(M_DRM)); + DRM_OS_SPINLOCK(&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; + DRM_OS_SPINUNLOCK(&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) +{ + vm_offset_t address; + unsigned long bytes = PAGE_SIZE << order; + + + address = (vm_offset_t) contigmalloc(bytes, DRM(M_DRM), M_WAITOK, 0, ~0, 1, 0); + if (!address) { + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[area].fail_count; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return 0; + } + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[area].succeed_count; + DRM(mem_stats)[area].bytes_allocated += bytes; + DRM(ram_used) += bytes; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + + + /* Zero outside the lock */ + memset((void *)address, 0, bytes); + + + 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; + + if (!address) { + DRM_MEM_ERROR(area, "Attempt to free address 0\n"); + } else { + contigfree((void *) address, bytes, DRM(M_DRM)); + } + + DRM_OS_SPINLOCK(&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; + DRM_OS_SPINUNLOCK(&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 = pmap_mapdev(offset, size))) { + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return NULL; + } + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; + DRM_OS_SPINUNLOCK(&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 + pmap_unmapdev((vm_offset_t) pt, size); + + DRM_OS_SPINLOCK(&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; + DRM_OS_SPINUNLOCK(&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))) { + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_allocated + += pages << PAGE_SHIFT; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return handle; + } + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_TOTALAGP].fail_count; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return NULL; +} + +int DRM(free_agp)(agp_memory *handle, int pages) +{ + int alloc_count; + int free_count; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, + "Attempt to free NULL AGP handle\n"); + DRM_OS_RETURN(EINVAL); + } + + if (DRM(agp_free_memory)(handle)) { + DRM_OS_SPINLOCK(&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; + DRM_OS_SPINUNLOCK(&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; + } + DRM_OS_RETURN(EINVAL); +} + +int DRM(bind_agp)(agp_memory *handle, unsigned int start) +{ + int retcode; + device_t dev = agp_find_device(); + struct agp_memory_info info; + + if (!dev) + return EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Attempt to bind NULL AGP handle\n"); + DRM_OS_RETURN(EINVAL); + } + + if (!(retcode = DRM(agp_bind_memory)(handle, start))) { + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; + agp_memory_info(dev, handle, &info); + DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_allocated + += info.ami_size; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_OS_RETURN(0); + } + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].fail_count; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + DRM_OS_RETURN(retcode); +} + +int DRM(unbind_agp)(agp_memory *handle) +{ + int alloc_count; + int free_count; + int retcode = EINVAL; + device_t dev = agp_find_device(); + struct agp_memory_info info; + + if (!dev) + return EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Attempt to unbind NULL AGP handle\n"); + DRM_OS_RETURN(retcode); + } + + agp_memory_info(dev, handle, &info); + + if ((retcode = DRM(agp_unbind_memory)(handle))) + DRM_OS_RETURN(retcode); + + DRM_OS_SPINLOCK(&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 + += info.ami_size; + DRM_OS_SPINUNLOCK(&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); + } + DRM_OS_RETURN(retcode); +} +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_freebsd.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_freebsd.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_os_freebsd.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,375 @@ +#include <sys/param.h> +#include <sys/queue.h> +#include <sys/malloc.h> +#include <sys/kernel.h> +#include <sys/module.h> +#include <sys/systm.h> +#include <sys/conf.h> +#include <sys/stat.h> +#include <sys/proc.h> +#include <sys/lock.h> +#include <sys/fcntl.h> +#include <sys/uio.h> +#include <sys/filio.h> +#include <sys/sysctl.h> +#include <sys/select.h> +#include <vm/vm.h> +#include <vm/pmap.h> +#include <machine/pmap.h> +#if __FreeBSD_version >= 500000 +#include <sys/selinfo.h> +#endif +#include <sys/bus.h> +#if __FreeBSD_version >= 400005 +#include <sys/taskqueue.h> +#endif +#if __FreeBSD_version >= 500000 +#include <sys/mutex.h> +#endif + +#if __FreeBSD_version >= 400006 +#define __REALLY_HAVE_AGP __HAVE_AGP +#endif + +#define __REALLY_HAVE_MTRR 0 +#define __REALLY_HAVE_SG 0 + +#if __REALLY_HAVE_AGP +#include <pci/agpvar.h> +#endif + +#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */ + +#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) +#define DRM_DEV_UID 0 +#define DRM_DEV_GID 0 + + +#if __FreeBSD_version >= 500000 +#define DRM_OS_SPINTYPE struct mtx +#define DRM_OS_SPININIT(l,name) mtx_init(&l, name, MTX_DEF) +#define DRM_OS_SPINLOCK(l) mtx_lock(l) +#define DRM_OS_SPINUNLOCK(u) mtx_unlock(u); +#define DRM_OS_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curthread) +#define DRM_OS_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, 0, curthread) +#define DRM_OS_CURPROC curthread +#define DRM_OS_STRUCTPROC struct thread +#define DRM_OS_CURRENTPID curthread->td_proc->p_pid +#define DRM_OS_IOCTL dev_t kdev, u_long cmd, caddr_t data, int flags, struct thread *p +#define DRM_OS_CHECKSUSER suser(p->td_proc) +#else +#define DRM_OS_CURPROC curproc +#define DRM_OS_STRUCTPROC struct proc +#define DRM_OS_SPINTYPE struct simplelock +#define DRM_OS_SPININIT(l,name) simple_lock_init(&l) +#define DRM_OS_SPINLOCK(l) simple_lock(l) +#define DRM_OS_SPINUNLOCK(u) simple_unlock(u); +#define DRM_OS_IOCTL dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p +#define DRM_OS_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc) +#define DRM_OS_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc) +#define DRM_OS_CURRENTPID curproc->p_pid +#define DRM_OS_CHECKSUSER suser(p) +#endif + +#define DRM_OS_TASKQUEUE_ARGS void *dev, int pending +#define DRM_OS_IRQ_ARGS void *device +#define DRM_OS_DEVICE drm_device_t *dev = kdev->si_drv1 +#define DRM_OS_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT ) +#define DRM_OS_FREE(pt) free( pt, DRM(M_DRM) ) +#define DRM_OS_VTOPHYS(addr) vtophys(addr) + +#define DRM_OS_PRIV \ + drm_file_t *priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); \ + if (!priv) { \ + DRM_DEBUG("can't find authenticator\n"); \ + return EINVAL; \ + } + +#define DRM_OS_DELAY( udelay ) \ +do { \ + struct timeval tv1, tv2; \ + microtime(&tv1); \ + do { \ + microtime(&tv2); \ + } \ + while (((tv2.tv_sec-tv1.tv_sec)*1000000 + tv2.tv_usec - tv1.tv_usec) < udelay ); \ +} while (0) + +#define DRM_OS_RETURN(v) return v; + + +#define DRM_OS_KRNTOUSR(arg1, arg2, arg3) \ + *arg1 = arg2 +#define DRM_OS_KRNFROMUSR(arg1, arg2, arg3) \ + arg1 = *arg2 +#define DRM_OS_COPYTOUSR(arg1, arg2, arg3) \ + copyout(arg2, arg1, arg3) +#define DRM_OS_COPYFROMUSR(arg1, arg2, arg3) \ + copyin(arg2, arg1, arg3) + +#define DRM_OS_READMEMORYBARRIER \ +{ \ + int xchangeDummy; \ + DRM_DEBUG("%s\n", __FUNCTION__); \ + __asm__ volatile(" push %%eax ; xchg %%eax, %0 ; pop %%eax" : : "m" (xchangeDummy)); \ + __asm__ volatile(" push %%eax ; push %%ebx ; push %%ecx ; push %%edx ;" \ + " movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ;" \ + " pop %%eax" : /* no outputs */ : /* no inputs */ ); \ +} while (0); + +#define DRM_OS_WRITEMEMORYBARRIER DRM_OS_READMEMORYBARRIER + +#define DRM_OS_WAKEUP(w) wakeup(w) +#define DRM_OS_WAKEUP_INT(w) wakeup(w) + +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) + +#define malloctype DRM(M_DRM) +/* The macros confliced in the MALLOC_DEFINE */ +MALLOC_DECLARE(malloctype); +#undef malloctype + +typedef struct drm_chipinfo +{ + int vendor; + int device; + int supported; + char *name; +} drm_chipinfo_t; + +typedef unsigned long atomic_t; +typedef u_int32_t cycles_t; +typedef u_int32_t spinlock_t; +typedef u_int32_t u32; +typedef u_int16_t u16; +typedef u_int8_t u8; +#define atomic_set(p, v) (*(p) = (v)) +#define atomic_read(p) (*(p)) +#define atomic_inc(p) atomic_add_long(p, 1) +#define atomic_dec(p) atomic_subtract_long(p, 1) +#define atomic_add(n, p) atomic_add_long(p, n) +#define atomic_sub(n, p) atomic_subtract_long(p, n) + +/* Fake this */ +static __inline unsigned int +test_and_set_bit(int b, volatile unsigned long *p) +{ + int s = splhigh(); + unsigned int m = 1<<b; + unsigned int r = *p & m; + *p |= m; + splx(s); + return r; +} + +static __inline void +clear_bit(int b, volatile unsigned long *p) +{ + atomic_clear_long(p + (b >> 5), 1 << (b & 0x1f)); +} + +static __inline void +set_bit(int b, volatile unsigned long *p) +{ + atomic_set_long(p + (b >> 5), 1 << (b & 0x1f)); +} + +static __inline int +test_bit(int b, volatile unsigned long *p) +{ + return p[b >> 5] & (1 << (b & 0x1f)); +} + +static __inline int +find_first_zero_bit(volatile unsigned long *p, int max) +{ + int b; + + for (b = 0; b < max; b += 32) { + if (p[b >> 5] != ~0) { + for (;;) { + if ((p[b >> 5] & (1 << (b & 0x1f))) == 0) + return b; + b++; + } + } + } + return max; +} + +#define spldrm() spltty() + +#define memset(p, v, s) bzero(p, s) + +/* + * Fake out the module macros for versions of FreeBSD where they don't + * exist. + */ +#if (__FreeBSD_version < 500002 && __FreeBSD_version > 500000) || __FreeBSD_version < 420000 +/* FIXME: again, what's the exact date? */ +#define MODULE_VERSION(a,b) struct __hack +#define MODULE_DEPEND(a,b,c,d,e) struct __hack + +#endif + +#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) +#define _DRM_CAS(lock,old,new,__ret) \ + do { \ + int __dummy; /* Can't mark eax as clobbered */ \ + __asm__ __volatile__( \ + "lock ; cmpxchg %4,%1\n\t" \ + "setnz %0" \ + : "=d" (__ret), \ + "=m" (__drm_dummy_lock(lock)), \ + "=a" (__dummy) \ + : "2" (old), \ + "r" (new)); \ + } while (0) + +/* Redefinitions to make templating easy */ +#define wait_queue_head_t long +#define agp_memory void +#define jiffies ticks + + /* Macros to make printf easier */ +#define DRM_ERROR(fmt, arg...) \ + printf("error: " "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg) +#define DRM_MEM_ERROR(area, fmt, arg...) \ + printf("error: " "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \ + DRM(mem_stats)[area].name , ##arg) +#define DRM_INFO(fmt, arg...) printf("info: " "[" DRM_NAME "] " fmt , ##arg) + +#if DRM_DEBUG_CODE +#define DRM_DEBUG(fmt, arg...) \ + do { \ + if (DRM(flags) & DRM_FLAG_DEBUG) \ + printf("[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ + ##arg); \ + } while (0) +#else +#define DRM_DEBUG(fmt, arg...) do { } while (0) +#endif + +#define DRM_PROC_LIMIT (PAGE_SIZE-80) + +#if (__FreeBSD_version >= 500000) || ((__FreeBSD_version < 500000) && (__FreeBSD_version >= 410002)) +#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS) +#else +#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS +#endif + +#define DRM_SYSCTL_PRINT(fmt, arg...) \ + snprintf(buf, sizeof(buf), fmt, ##arg); \ + error = SYSCTL_OUT(req, buf, strlen(buf)); \ + if (error) return error; + +#define DRM_SYSCTL_PRINT_RET(ret, fmt, arg...) \ + snprintf(buf, sizeof(buf), fmt, ##arg); \ + error = SYSCTL_OUT(req, buf, strlen(buf)); \ + if (error) { ret; return error; } + + +#define DRM_FIND_MAP(dest, o) \ + do { \ + drm_map_list_entry_t *listentry; \ + TAILQ_FOREACH(listentry, dev->maplist, link) { \ + if ( listentry->map->offset == o ) { \ + dest = listentry->map; \ + break; \ + } \ + } \ + } while (0) + + +/* Internal functions */ + +/* drm_drv.h */ +extern d_ioctl_t DRM(ioctl); +extern d_ioctl_t DRM(lock); +extern d_ioctl_t DRM(unlock); +extern d_open_t DRM(open); +extern d_close_t DRM(close); +extern d_read_t DRM(read); +extern d_write_t DRM(write); +extern d_poll_t DRM(poll); +extern d_mmap_t DRM(mmap); +extern int DRM(open_helper)(dev_t kdev, int flags, int fmt, + DRM_OS_STRUCTPROC *p, drm_device_t *dev); +extern drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, + DRM_OS_STRUCTPROC *p); + +/* Misc. IOCTL support (drm_ioctl.h) */ +extern d_ioctl_t DRM(irq_busid); +extern d_ioctl_t DRM(getunique); +extern d_ioctl_t DRM(setunique); +extern d_ioctl_t DRM(getmap); +extern d_ioctl_t DRM(getclient); +extern d_ioctl_t DRM(getstats); + +/* Context IOCTL support (drm_context.h) */ +extern d_ioctl_t DRM(resctx); +extern d_ioctl_t DRM(addctx); +extern d_ioctl_t DRM(modctx); +extern d_ioctl_t DRM(getctx); +extern d_ioctl_t DRM(switchctx); +extern d_ioctl_t DRM(newctx); +extern d_ioctl_t DRM(rmctx); +extern d_ioctl_t DRM(setsareactx); +extern d_ioctl_t DRM(getsareactx); + +/* Drawable IOCTL support (drm_drawable.h) */ +extern d_ioctl_t DRM(adddraw); +extern d_ioctl_t DRM(rmdraw); + +/* Authentication IOCTL support (drm_auth.h) */ +extern d_ioctl_t DRM(getmagic); +extern d_ioctl_t DRM(authmagic); + +/* Locking IOCTL support (drm_lock.h) */ +extern d_ioctl_t DRM(block); +extern d_ioctl_t DRM(unblock); +extern d_ioctl_t DRM(finish); + +/* Buffer management support (drm_bufs.h) */ +extern d_ioctl_t DRM(addmap); +extern d_ioctl_t DRM(rmmap); +#if __HAVE_DMA +extern d_ioctl_t DRM(addbufs_agp); +extern d_ioctl_t DRM(addbufs_pci); +extern d_ioctl_t DRM(addbufs_sg); +extern d_ioctl_t DRM(addbufs); +extern d_ioctl_t DRM(infobufs); +extern d_ioctl_t DRM(markbufs); +extern d_ioctl_t DRM(freebufs); +extern d_ioctl_t DRM(mapbufs); +#endif + +/* Memory management support (drm_memory.h) */ +extern int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS; + +/* DMA support (drm_dma.h) */ +#if __HAVE_DMA_IRQ +extern d_ioctl_t DRM(control); +#endif + +/* AGP/GART support (drm_agpsupport.h) */ +#if __REALLY_HAVE_AGP +extern d_ioctl_t DRM(agp_acquire); +extern d_ioctl_t DRM(agp_release); +extern d_ioctl_t DRM(agp_enable); +extern d_ioctl_t DRM(agp_info); +extern d_ioctl_t DRM(agp_alloc); +extern d_ioctl_t DRM(agp_free); +extern d_ioctl_t DRM(agp_unbind); +extern d_ioctl_t DRM(agp_bind); +#endif + +/* Scatter Gather Support (drm_scatter.h) */ +#if __HAVE_SG +extern d_ioctl_t DRM(sg_alloc); +extern d_ioctl_t DRM(sg_free); +#endif + +/* SysCtl Support (drm_sysctl.h) */ +extern int DRM(sysctl_init)(drm_device_t *dev); +extern int DRM(sysctl_cleanup)(drm_device_t *dev); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_scatter.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_scatter.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_scatter.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,237 @@ +/* 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->busaddr, + entry->pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); + 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->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); + if ( !entry->busaddr ) { + DRM(free)( entry->pagelist, + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + DRM(free)( entry, + sizeof(*entry), + DRM_MEM_SGLISTS ); + return -ENOMEM; + } + memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) ); + + entry->virtual = vmalloc_32( pages << PAGE_SHIFT ); + if ( !entry->virtual ) { + DRM(free)( entry->busaddr, + entry->pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); + 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 = page_address( entry->pagelist[i] ); + 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 = page_address( entry->pagelist[i] ); + 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/bsd/drm/kernel/drm_sysctl.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_sysctl.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_sysctl.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,523 @@ +SYSCTL_NODE(_hw, OID_AUTO, dri, CTLFLAG_RW, 0, "DRI Graphics"); + +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)DRM_SYSCTL_HANDLER_ARGS; +#endif +#if DRM_DMA_HISTOGRAM +static int DRM(histo_info)DRM_SYSCTL_HANDLER_ARGS; +#endif + +struct DRM(sysctl_list) { + const char *name; + int (*f) DRM_SYSCTL_HANDLER_ARGS; +} DRM(sysctl_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_CODExx + { "vma", DRM(vma_info) }, +#endif +#if DRM_DMA_HISTOGRAM + { "histo", drm_histo_info) }, +#endif +}; +#define DRM_SYSCTL_ENTRIES (sizeof(DRM(sysctl_list))/sizeof(DRM(sysctl_list)[0])) + +struct drm_sysctl_info { + struct sysctl_oid oids[DRM_SYSCTL_ENTRIES + 1]; + struct sysctl_oid_list list; + char name[2]; +}; + +int DRM(sysctl_init)(drm_device_t *dev) +{ + struct drm_sysctl_info *info; + struct sysctl_oid *oid; + struct sysctl_oid *top; + int i; + + /* Find the next free slot under hw.graphics */ + i = 0; + SLIST_FOREACH(oid, &sysctl__hw_dri_children, oid_link) { + if (i <= oid->oid_arg2) + i = oid->oid_arg2 + 1; + } + + info = DRM(alloc)(sizeof *info, DRM_MEM_DRIVER); + dev->sysctl = info; + + /* Construct the node under hw.graphics */ + info->name[0] = '0' + i; + info->name[1] = 0; + oid = &info->oids[DRM_SYSCTL_ENTRIES]; + bzero(oid, sizeof(*oid)); + oid->oid_parent = &sysctl__hw_dri_children; + oid->oid_number = OID_AUTO; + oid->oid_kind = CTLTYPE_NODE | CTLFLAG_RW; + oid->oid_arg1 = &info->list; + oid->oid_arg2 = i; + oid->oid_name = info->name; + oid->oid_handler = 0; + oid->oid_fmt = "N"; + SLIST_INIT(&info->list); + sysctl_register_oid(oid); + top = oid; + + for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) { + oid = &info->oids[i]; + bzero(oid, sizeof(*oid)); + oid->oid_parent = top->oid_arg1; + oid->oid_number = OID_AUTO; + oid->oid_kind = CTLTYPE_INT | CTLFLAG_RD; + oid->oid_arg1 = dev; + oid->oid_arg2 = 0; + oid->oid_name = DRM(sysctl_list)[i].name; + oid->oid_handler = DRM(sysctl_list[)i].f; + oid->oid_fmt = "A"; + sysctl_register_oid(oid); + } + + return 0; +} + +int DRM(sysctl_cleanup)(drm_device_t *dev) +{ + int i; + + DRM_DEBUG("dev->sysctl=%p\n", dev->sysctl); + for (i = 0; i < DRM_SYSCTL_ENTRIES + 1; i++) + sysctl_unregister_oid(&dev->sysctl->oids[i]); + + DRM(free)(dev->sysctl, sizeof *dev->sysctl, DRM_MEM_DRIVER); + dev->sysctl = NULL; + + return 0; +} + +static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + char buf[128]; + int error; + + if (dev->unique) { + DRM_SYSCTL_PRINT("%s 0x%x %s\n", + dev->name, dev2udev(dev->devnode), dev->unique); + } else { + DRM_SYSCTL_PRINT("%s 0x%x\n", dev->name, dev2udev(dev->devnode)); + } + + SYSCTL_OUT(req, "", 1); + + return 0; +} + +static int DRM(_vm_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + drm_map_t *map; + drm_map_list_entry_t *listentry; + const char *types[] = { "FB", "REG", "SHM" }; + const char *type; + int i=0; + char buf[128]; + int error; + + DRM_SYSCTL_PRINT("slot offset size type flags " + "address mtrr\n\n"); + error = SYSCTL_OUT(req, buf, strlen(buf)); + if (error) return error; + + if (dev->maplist != NULL) { + TAILQ_FOREACH(listentry, dev->maplist, link) { + map = listentry->map; + if (map->type < 0 || map->type > 2) type = "??"; + else type = types[map->type]; + DRM_SYSCTL_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_SYSCTL_PRINT("none\n"); + } else { + DRM_SYSCTL_PRINT("%4d\n", map->mtrr); + } + i++; + } + } + SYSCTL_OUT(req, "", 1); + + return 0; +} + +static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + int ret; + + DRM_OS_LOCK; + ret = DRM(_vm_info)(oidp, arg1, arg2, req); + DRM_OS_UNLOCK; + + return ret; +} + + +static int DRM(_queues_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + int i; + drm_queue_t *q; + char buf[128]; + int error; + + DRM_SYSCTL_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_SYSCTL_PRINT_RET(atomic_dec(&q->use_count), + "%5d/0x%03x %5ld %5ld" + " %5ld/%c%c/%c%c%c %5d %10ld %10ld %10ld\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' : '-', + q->read_queue ? 'r':'-', + q->write_queue ? 'w':'-', + 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); + } + + SYSCTL_OUT(req, "", 1); + return 0; +} + +static int DRM(queues_info) DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + int ret; + + DRM_OS_LOCK; + ret = DRM(_queues_info)(oidp, arg1, arg2, req); + DRM_OS_UNLOCK; + return ret; +} + +/* drm_bufs_info is called whenever a process reads + hw.dri.0.bufs. */ + +static int DRM(_bufs_info) DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + drm_device_dma_t *dma = dev->dma; + int i; + char buf[128]; + int error; + + if (!dma) return 0; + DRM_SYSCTL_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_SYSCTL_PRINT("%2d %8d %5d %5ld %5d %5d %5d\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_SYSCTL_PRINT("\n"); + for (i = 0; i < dma->buf_count; i++) { + if (i && !(i%32)) DRM_SYSCTL_PRINT("\n"); + DRM_SYSCTL_PRINT(" %d", dma->buflist[i]->list); + } + DRM_SYSCTL_PRINT("\n"); + + SYSCTL_OUT(req, "", 1); + return 0; +} + +static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + int ret; + + DRM_OS_LOCK; + ret = DRM(_bufs_info)(oidp, arg1, arg2, req); + DRM_OS_UNLOCK; + return ret; +} + + +static int DRM(_clients_info) DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + drm_file_t *priv; + char buf[128]; + int error; + + DRM_SYSCTL_PRINT("a dev pid uid magic ioctls\n\n"); + TAILQ_FOREACH(priv, &dev->files, link) { + DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n", + priv->authenticated ? 'y' : 'n', + priv->minor, + priv->pid, + priv->uid, + priv->magic, + priv->ioctl_count); + } + + SYSCTL_OUT(req, "", 1); + return 0; +} + +static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + int ret; + + DRM_OS_LOCK; + ret = DRM(_clients_info)(oidp, arg1, arg2, req); + DRM_OS_UNLOCK; + return ret; +} + +#if DRM_DEBUG_CODExx + +static int DRM(_vma_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + drm_vma_entry_t *pt; + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; + unsigned long i; + struct vm_area_struct *vma; + unsigned long address; +#if defined(__i386__) + unsigned int pgprot; +#endif + char buf[128]; + int error; + + DRM_SYSCTL_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_SYSCTL_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' : '-', + vma->vm_offset ); +#if defined(__i386__) + pgprot = pgprot_val(vma->vm_page_prot); + DRM_SYSCTL_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_4M ? 'm' : 'k', + pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); +#endif + DRM_SYSCTL_PRINT("\n"); + 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_SYSCTL_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_SYSCTL_PRINT(" 0x%08lx\n", i); + } + } + } + + SYSCTL_OUT(req, "", 1); + return 0; +} + +static int DRM(vma_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + int ret; + + DRM_OS_LOCK; + ret = DRM(_vma_info)(oidp, arg1, arg2, req); + DRM_OS_UNLOCK; + return ret; +} +#endif + + +#if DRM_DMA_HISTOGRAM +static int DRM(_histo_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + 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; + char buf[128]; + int error; + + DRM_SYSCTL_PRINT("general statistics:\n"); + DRM_SYSCTL_PRINT("total %10u\n", atomic_read(&dev->histo.total)); + DRM_SYSCTL_PRINT("open %10u\n", atomic_read(&dev->total_open)); + DRM_SYSCTL_PRINT("close %10u\n", atomic_read(&dev->total_close)); + DRM_SYSCTL_PRINT("ioctl %10u\n", atomic_read(&dev->total_ioctl)); + DRM_SYSCTL_PRINT("irq %10u\n", atomic_read(&dev->total_irq)); + DRM_SYSCTL_PRINT("ctx %10u\n", atomic_read(&dev->total_ctx)); + + DRM_SYSCTL_PRINT("\nlock statistics:\n"); + DRM_SYSCTL_PRINT("locks %10u\n", atomic_read(&dev->total_locks)); + DRM_SYSCTL_PRINT("unlocks %10u\n", atomic_read(&dev->total_unlocks)); + DRM_SYSCTL_PRINT("contends %10u\n", atomic_read(&dev->total_contends)); + DRM_SYSCTL_PRINT("sleeps %10u\n", atomic_read(&dev->total_sleeps)); + + + if (dma) { + DRM_SYSCTL_PRINT("\ndma statistics:\n"); + DRM_SYSCTL_PRINT("prio %10u\n", + atomic_read(&dma->total_prio)); + DRM_SYSCTL_PRINT("bytes %10u\n", + atomic_read(&dma->total_bytes)); + DRM_SYSCTL_PRINT("dmas %10u\n", + atomic_read(&dma->total_dmas)); + DRM_SYSCTL_PRINT("missed:\n"); + DRM_SYSCTL_PRINT(" dma %10u\n", + atomic_read(&dma->total_missed_dma)); + DRM_SYSCTL_PRINT(" lock %10u\n", + atomic_read(&dma->total_missed_lock)); + DRM_SYSCTL_PRINT(" free %10u\n", + atomic_read(&dma->total_missed_free)); + DRM_SYSCTL_PRINT(" sched %10u\n", + atomic_read(&dma->total_missed_sched)); + DRM_SYSCTL_PRINT("tried %10u\n", + atomic_read(&dma->total_tried)); + DRM_SYSCTL_PRINT("hit %10u\n", + atomic_read(&dma->total_hit)); + DRM_SYSCTL_PRINT("lost %10u\n", + atomic_read(&dma->total_lost)); + + buffer = dma->next_buffer; + if (buffer) { + DRM_SYSCTL_PRINT("next_buffer %7d\n", buffer->idx); + } else { + DRM_SYSCTL_PRINT("next_buffer none\n"); + } + buffer = dma->this_buffer; + if (buffer) { + DRM_SYSCTL_PRINT("this_buffer %7d\n", buffer->idx); + } else { + DRM_SYSCTL_PRINT("this_buffer none\n"); + } + } + + + DRM_SYSCTL_PRINT("\nvalues:\n"); + if (dev->lock.hw_lock) { + DRM_SYSCTL_PRINT("lock 0x%08x\n", + dev->lock.hw_lock->lock); + } 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("queue_count %10d\n", dev->queue_count); + DRM_SYSCTL_PRINT("last_context %10d\n", dev->last_context); + DRM_SYSCTL_PRINT("last_switch %10u\n", dev->last_switch); + DRM_SYSCTL_PRINT("last_checked %10d\n", dev->last_checked); + + + DRM_SYSCTL_PRINT("\n q2d d2c c2f" + " q2c q2f dma sch" + " ctx lacq lhld\n\n"); + for (i = 0; i < DRM_DMA_HISTOGRAM_SLOTS; i++) { + DRM_SYSCTL_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); + } + SYSCTL_OUT(req, "", 1); + return 0; +} + +static int DRM(histo_info)DRM_SYSCTL_HANDLER_ARGS +{ + drm_device_t *dev = arg1; + int ret; + + DRM_OS_LOCK; + ret = _drm_histo_info(oidp, arg1, arg2, req); + DRM_OS_UNLOCK; + return ret; +} +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_vm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_vm.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm_vm.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,81 @@ +#include <vm/vm.h> +#include <vm/pmap.h> + +static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) +{ + drm_device_t *dev = kdev->si_drv1; + drm_device_dma_t *dma = dev->dma; + unsigned long physical; + unsigned long page; + + if (!dma) return -1; /* Error */ + if (!dma->pagelist) return -1; /* Nothing allocated */ + + page = offset >> PAGE_SHIFT; + physical = dma->pagelist[page]; + + DRM_DEBUG("0x%08x (page %lu) => 0x%08lx\n", offset, page, physical); + return atop(physical); +} + +int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) +{ + drm_device_t *dev = kdev->si_drv1; + drm_map_t *map = NULL; + drm_map_list_entry_t *listentry=NULL; + /*drm_file_t *priv;*/ + +/* DRM_DEBUG("offset = 0x%x\n", offset);*/ + + /*XXX Fixme */ + /*priv = DRM(find_file_by_proc)(dev, p); + if (!priv) { + DRM_DEBUG("can't find authenticator\n"); + return EINVAL; + } + + if (!priv->authenticated) DRM_OS_RETURN(EACCES);*/ + + if (dev->dma + && offset >= 0 + && offset < ptoa(dev->dma->page_count)) + return DRM(dma_mmap)(kdev, offset, prot); + + /* 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. */ + TAILQ_FOREACH(listentry, dev->maplist, link) { + map = listentry->map; +/* DRM_DEBUG("considering 0x%x..0x%x\n", map->offset, map->offset + map->size - 1);*/ + if (offset >= map->offset + && offset < map->offset + map->size) break; + } + + if (!listentry) { + DRM_DEBUG("can't find map\n"); + return -1; + } + if (((map->flags&_DRM_RESTRICTED) && suser(curproc))) { + DRM_DEBUG("restricted map\n"); + return -1; + } + + switch (map->type) { + case _DRM_FRAME_BUFFER: + case _DRM_REGISTERS: + case _DRM_AGP: + return atop(offset); + case _DRM_SHM: + return atop(vtophys(offset)); + default: + return -1; /* This should never happen. */ + } + DRM_DEBUG("bailing out\n"); + + return -1; +} + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810_drm.h:1.3 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810_drm.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,201 @@ +#ifndef _I810_DRM_H_ +#define _I810_DRM_H_ + +/* WARNING: These defines must be the same as what the Xserver uses. + * if you change them, you must change the defines in the Xserver. + */ + +#ifndef _I810_DEFINES_ +#define _I810_DEFINES_ + +#define I810_DMA_BUF_ORDER 12 +#define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER) +#define I810_DMA_BUF_NR 256 +#define I810_NR_SAREA_CLIPRECTS 8 + +/* Each region is a minimum of 64k, and there are at most 64 of them. + */ +#define I810_NR_TEX_REGIONS 64 +#define I810_LOG_MIN_TEX_REGION_SIZE 16 +#endif + +#define I810_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ +#define I810_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ +#define I810_UPLOAD_CTX 0x4 +#define I810_UPLOAD_BUFFERS 0x8 +#define I810_UPLOAD_TEX0 0x10 +#define I810_UPLOAD_TEX1 0x20 +#define I810_UPLOAD_CLIPRECTS 0x40 + + +/* Indices into buf.Setup where various bits of state are mirrored per + * context and per buffer. These can be fired at the card as a unit, + * or in a piecewise fashion as required. + */ + +/* Destbuffer state + * - backbuffer linear offset and pitch -- invarient in the current dri + * - zbuffer linear offset and pitch -- also invarient + * - drawing origin in back and depth buffers. + * + * Keep the depth/back buffer state here to acommodate private buffers + * in the future. + */ +#define I810_DESTREG_DI0 0 /* CMD_OP_DESTBUFFER_INFO (2 dwords) */ +#define I810_DESTREG_DI1 1 +#define I810_DESTREG_DV0 2 /* GFX_OP_DESTBUFFER_VARS (2 dwords) */ +#define I810_DESTREG_DV1 3 +#define I810_DESTREG_DR0 4 /* GFX_OP_DRAWRECT_INFO (4 dwords) */ +#define I810_DESTREG_DR1 5 +#define I810_DESTREG_DR2 6 +#define I810_DESTREG_DR3 7 +#define I810_DESTREG_DR4 8 +#define I810_DEST_SETUP_SIZE 10 + +/* Context state + */ +#define I810_CTXREG_CF0 0 /* GFX_OP_COLOR_FACTOR */ +#define I810_CTXREG_CF1 1 +#define I810_CTXREG_ST0 2 /* GFX_OP_STIPPLE */ +#define I810_CTXREG_ST1 3 +#define I810_CTXREG_VF 4 /* GFX_OP_VERTEX_FMT */ +#define I810_CTXREG_MT 5 /* GFX_OP_MAP_TEXELS */ +#define I810_CTXREG_MC0 6 /* GFX_OP_MAP_COLOR_STAGES - stage 0 */ +#define I810_CTXREG_MC1 7 /* GFX_OP_MAP_COLOR_STAGES - stage 1 */ +#define I810_CTXREG_MC2 8 /* GFX_OP_MAP_COLOR_STAGES - stage 2 */ +#define I810_CTXREG_MA0 9 /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */ +#define I810_CTXREG_MA1 10 /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */ +#define I810_CTXREG_MA2 11 /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */ +#define I810_CTXREG_SDM 12 /* GFX_OP_SRC_DEST_MONO */ +#define I810_CTXREG_FOG 13 /* GFX_OP_FOG_COLOR */ +#define I810_CTXREG_B1 14 /* GFX_OP_BOOL_1 */ +#define I810_CTXREG_B2 15 /* GFX_OP_BOOL_2 */ +#define I810_CTXREG_LCS 16 /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */ +#define I810_CTXREG_PV 17 /* GFX_OP_PV_RULE -- Invarient! */ +#define I810_CTXREG_ZA 18 /* GFX_OP_ZBIAS_ALPHAFUNC */ +#define I810_CTXREG_AA 19 /* GFX_OP_ANTIALIAS */ +#define I810_CTX_SETUP_SIZE 20 + +/* Texture state (per tex unit) + */ +#define I810_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (4 dwords) */ +#define I810_TEXREG_MI1 1 +#define I810_TEXREG_MI2 2 +#define I810_TEXREG_MI3 3 +#define I810_TEXREG_MF 4 /* GFX_OP_MAP_FILTER */ +#define I810_TEXREG_MLC 5 /* GFX_OP_MAP_LOD_CTL */ +#define I810_TEXREG_MLL 6 /* GFX_OP_MAP_LOD_LIMITS */ +#define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */ +#define I810_TEX_SETUP_SIZE 8 + +#define I810_FRONT 0x1 +#define I810_BACK 0x2 +#define I810_DEPTH 0x4 + + +typedef struct _drm_i810_init { + enum { + 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; + unsigned int ring_size; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int overlay_offset; + unsigned int overlay_physical; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; +} drm_i810_init_t; + +/* Warning: If you change the SAREA structure you must change the Xserver + * structure as well */ + +typedef struct _drm_i810_tex_region { + 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 */ +} drm_i810_tex_region_t; + +typedef struct _drm_i810_sarea { + unsigned int ContextState[I810_CTX_SETUP_SIZE]; + unsigned int BufferState[I810_DEST_SETUP_SIZE]; + unsigned int TexState[2][I810_TEX_SETUP_SIZE]; + unsigned int dirty; + + unsigned int nbox; + drm_clip_rect_t boxes[I810_NR_SAREA_CLIPRECTS]; + + /* 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. + */ + + drm_i810_tex_region_t texList[I810_NR_TEX_REGIONS+1]; + /* Last elt is sentinal */ + int texAge; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + int ctxOwner; /* last context to upload state */ + + int vertex_prim; + +} drm_i810_sarea_t; + +typedef struct _drm_i810_clear { + int clear_color; + int clear_depth; + int flags; +} drm_i810_clear_t; + + + +/* These may be placeholders if we have more cliprects than + * I810_NR_SAREA_CLIPRECTS. In that case, the client sets discard to + * false, indicating that the buffer will be dispatched again with a + * new set of cliprects. + */ +typedef struct _drm_i810_vertex { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + int discard; /* client is finished with the buffer? */ +} drm_i810_vertex_t; + +typedef struct _drm_i810_copy_t { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + void *address; /* Address to copy from */ +} drm_i810_copy_t; + +typedef struct drm_i810_dma { + void *virtual; + int request_idx; + int request_size; + int granted; +} drm_i810_dma_t; + +#endif /* _I810_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830_drm.h:1.1 --- /dev/null Fri Jan 18 15:25:58 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830_drm.h Sun Dec 16 14:45:01 2001 @@ -0,0 +1,238 @@ +#ifndef _I830_DRM_H_ +#define _I830_DRM_H_ + +/* WARNING: These defines must be the same as what the Xserver uses. + * if you change them, you must change the defines in the Xserver. + */ + +#ifndef _I830_DEFINES_ +#define _I830_DEFINES_ + +#define I830_DMA_BUF_ORDER 12 +#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER) +#define I830_DMA_BUF_NR 256 +#define I830_NR_SAREA_CLIPRECTS 8 + +/* Each region is a minimum of 64k, and there are at most 64 of them. + */ +#define I830_NR_TEX_REGIONS 64 +#define I830_LOG_MIN_TEX_REGION_SIZE 16 + +/* if defining I830_ENABLE_4_TEXTURES, do it in i830_3d_reg.h, too */ +#if !defined(I830_ENABLE_4_TEXTURES) +#define I830_TEXTURE_COUNT 2 +#define I830_TEXBLEND_COUNT 2 /* always same as TEXTURE_COUNT? */ +#else /* defined(I830_ENABLE_4_TEXTURES) */ +#define I830_TEXTURE_COUNT 4 +#define I830_TEXBLEND_COUNT 4 /* always same as TEXTURE_COUNT? */ +#endif /* I830_ENABLE_4_TEXTURES */ + +#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ + +#define I830_UPLOAD_CTX 0x1 +#define I830_UPLOAD_BUFFERS 0x2 +#define I830_UPLOAD_CLIPRECTS 0x4 +#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */ +#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */ +#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */ +#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */ +#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */ +#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */ +#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */ +#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */ +#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2)) +#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2)) +#define I830_UPLOAD_TEXIMAGE_MASK 0xff00 +#define I830_UPLOAD_TEX0 0x10000 +#define I830_UPLOAD_TEX1 0x20000 +#define I830_UPLOAD_TEX2 0x40000 +#define I830_UPLOAD_TEX3 0x80000 +#define I830_UPLOAD_TEX_N(n) (0x10000 << (n)) +#define I830_UPLOAD_TEX_MASK 0xf0000 +#define I830_UPLOAD_TEXBLEND0 0x100000 +#define I830_UPLOAD_TEXBLEND1 0x200000 +#define I830_UPLOAD_TEXBLEND2 0x400000 +#define I830_UPLOAD_TEXBLEND3 0x800000 +#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n)) +#define I830_UPLOAD_TEXBLEND_MASK 0xf00000 +#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) +#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 + +/* Indices into buf.Setup where various bits of state are mirrored per + * context and per buffer. These can be fired at the card as a unit, + * or in a piecewise fashion as required. + */ + +/* Destbuffer state + * - backbuffer linear offset and pitch -- invarient in the current dri + * - zbuffer linear offset and pitch -- also invarient + * - drawing origin in back and depth buffers. + * + * Keep the depth/back buffer state here to acommodate private buffers + * in the future. + */ + +#define I830_DESTREG_CBUFADDR 0 +/* Invarient */ +#define I830_DESTREG_DBUFADDR 1 +#define I830_DESTREG_DV0 2 +#define I830_DESTREG_DV1 3 +#define I830_DESTREG_SENABLE 4 +#define I830_DESTREG_SR0 5 +#define I830_DESTREG_SR1 6 +#define I830_DESTREG_SR2 7 +#define I830_DESTREG_DR0 8 +#define I830_DESTREG_DR1 9 +#define I830_DESTREG_DR2 10 +#define I830_DESTREG_DR3 11 +#define I830_DESTREG_DR4 12 +#define I830_DEST_SETUP_SIZE 13 + +/* Context state + */ +#define I830_CTXREG_STATE1 0 +#define I830_CTXREG_STATE2 1 +#define I830_CTXREG_STATE3 2 +#define I830_CTXREG_STATE4 3 +#define I830_CTXREG_STATE5 4 +#define I830_CTXREG_IALPHAB 5 +#define I830_CTXREG_STENCILTST 6 +#define I830_CTXREG_ENABLES_1 7 +#define I830_CTXREG_ENABLES_2 8 +#define I830_CTXREG_AA 9 +#define I830_CTXREG_FOGCOLOR 10 +#define I830_CTXREG_BLENDCOLR0 11 +#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */ +#define I830_CTXREG_VF 13 +#define I830_CTXREG_VF2 14 +#define I830_CTXREG_MCSB0 15 +#define I830_CTXREG_MCSB1 16 +#define I830_CTX_SETUP_SIZE 17 + +/* Texture state (per tex unit) + */ + +#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */ +#define I830_TEXREG_MI1 1 +#define I830_TEXREG_MI2 2 +#define I830_TEXREG_MI3 3 +#define I830_TEXREG_MI4 4 +#define I830_TEXREG_MI5 5 +#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */ +#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */ +#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */ +#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ +#define I830_TEX_SETUP_SIZE 10 + +#define I830_FRONT 0x1 +#define I830_BACK 0x2 +#define I830_DEPTH 0x4 + +#endif /* _I830_DEFINES_ */ + +typedef struct _drm_i830_init { + enum { + I830_INIT_DMA = 0x01, + I830_CLEANUP_DMA = 0x02 + } func; + unsigned int mmio_offset; + unsigned int buffers_offset; + int sarea_priv_offset; + unsigned int ring_start; + unsigned int ring_end; + unsigned int ring_size; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; + unsigned int back_pitch; + unsigned int depth_pitch; + unsigned int cpp; +} drm_i830_init_t; + +/* Warning: If you change the SAREA structure you must change the Xserver + * structure as well */ + +typedef struct _drm_i830_tex_region { + 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 */ +} drm_i830_tex_region_t; + +typedef struct _drm_i830_sarea { + unsigned int ContextState[I830_CTX_SETUP_SIZE]; + unsigned int BufferState[I830_DEST_SETUP_SIZE]; + unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE]; + unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE]; + unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT]; + unsigned int Palette[2][256]; + unsigned int dirty; + + unsigned int nbox; + drm_clip_rect_t boxes[I830_NR_SAREA_CLIPRECTS]; + + /* 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. + */ + + drm_i830_tex_region_t texList[I830_NR_TEX_REGIONS+1]; + /* Last elt is sentinal */ + int texAge; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + int ctxOwner; /* last context to upload state */ + + int vertex_prim; +} drm_i830_sarea_t; + +typedef struct _drm_i830_clear { + int clear_color; + int clear_depth; + int flags; + unsigned int clear_colormask; + unsigned int clear_depthmask; +} drm_i830_clear_t; + + + +/* These may be placeholders if we have more cliprects than + * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to + * false, indicating that the buffer will be dispatched again with a + * new set of cliprects. + */ +typedef struct _drm_i830_vertex { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + int discard; /* client is finished with the buffer? */ +} drm_i830_vertex_t; + +typedef struct _drm_i830_copy_t { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + void *address; /* Address to copy from */ +} drm_i830_copy_t; + +typedef struct drm_i830_dma { + void *virtual; + int request_idx; + int request_size; + int granted; +} drm_i830_dma_t; + +#endif /* _I830_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drm.h:1.3 --- /dev/null Fri Jan 18 15:25:59 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga_drm.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,310 @@ +/* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- + * Created: Tue Jan 25 01:50:01 1999 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 + * 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: + * 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__ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (mga_sarea.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 /* 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_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; +} drm_mga_context_regs_t; + +/* Setup registers for 2D, X server + */ +typedef struct { + unsigned int pitch; +} drm_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; +} drm_mga_texture_regs_t; + +/* General aging mechanism + */ +typedef struct { + unsigned int head; /* Position of head pointer */ + unsigned int wrap; /* Primary DMA wrap count */ +} drm_mga_age_t; + +typedef struct _drm_mga_sarea { + /* The channel for communication of state information to the kernel + * on firing a vertex dma buffer. + */ + 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; + + /* 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 + * 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; + unsigned int exported_nback; + 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. + */ + 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; +} drm_mga_sarea_t; + + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmMga.h) + */ +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 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_indices { + int idx; /* buffer to queue */ + unsigned int start; + unsigned int end; + int discard; /* client finished with buffer? */ +} drm_mga_indices_t; + +typedef struct drm_mga_iload { + int idx; + unsigned int dstorg; + unsigned int length; +} drm_mga_iload_t; + +typedef struct _drm_mga_blit { + unsigned int planemask; + unsigned int 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/bsd/drm/kernel/r128_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drm.h:1.3 --- /dev/null Fri Jan 18 15:25:59 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128_drm.h Wed Dec 12 19:24:46 2001 @@ -0,0 +1,287 @@ +/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- + * Created: Wed Apr 5 19:24:19 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: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + */ + +#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) + */ +#ifndef __R128_SAREA_DEFINES__ +#define __R128_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? + */ +#define R128_UPLOAD_CONTEXT 0x001 +#define R128_UPLOAD_SETUP 0x002 +#define R128_UPLOAD_TEX0 0x004 +#define R128_UPLOAD_TEX1 0x008 +#define R128_UPLOAD_TEX0IMAGES 0x010 +#define R128_UPLOAD_TEX1IMAGES 0x020 +#define R128_UPLOAD_CORE 0x040 +#define R128_UPLOAD_MASKS 0x080 +#define R128_UPLOAD_WINDOW 0x100 +#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ +#define R128_REQUIRE_QUIESCENCE 0x400 +#define R128_UPLOAD_ALL 0x7ff + +#define R128_FRONT 0x1 +#define R128_BACK 0x2 +#define R128_DEPTH 0x4 + +/* Primitive types + */ +#define R128_POINTS 0x1 +#define R128_LINES 0x2 +#define R128_LINE_STRIP 0x3 +#define R128_TRIANGLES 0x4 +#define R128_TRIANGLE_FAN 0x5 +#define R128_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#define R128_BUFFER_SIZE 16384 + +/* Byte offsets for indirect buffer data + */ +#define R128_INDEX_PRIM_OFFSET 20 +#define R128_HOSTDATA_BLIT_OFFSET 32 + +/* Keep these small for testing. + */ +#define R128_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 R128_LOCAL_TEX_HEAP 0 +#define R128_AGP_TEX_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_MAX_TEXTURE_LEVELS 11 +#define R128_MAX_TEXTURE_UNITS 2 + +#endif /* __R128_SAREA_DEFINES__ */ + +typedef struct { + /* Context state - can be written in one large chunk */ + unsigned int dst_pitch_offset_c; + unsigned int dp_gui_master_cntl_c; + unsigned int sc_top_left_c; + unsigned int sc_bottom_right_c; + unsigned int z_offset_c; + unsigned int z_pitch_c; + unsigned int z_sten_cntl_c; + unsigned int tex_cntl_c; + unsigned int misc_3d_state_cntl_reg; + unsigned int texture_clr_cmp_clr_c; + unsigned int texture_clr_cmp_msk_c; + unsigned int fog_color_c; + + /* Texture state */ + unsigned int tex_size_pitch_c; + unsigned int constant_color_c; + + /* Setup state */ + unsigned int pm4_vc_fpu_setup; + unsigned int setup_cntl; + + /* Mask state */ + unsigned int dp_write_mask; + unsigned int sten_ref_mask_c; + unsigned int plane_3d_mask_c; + + /* Window state */ + unsigned int window_xy_offset; + + /* Core state */ + unsigned int scale_3d_cntl; +} drm_r128_context_regs_t; + +/* 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_MAX_TEXTURE_LEVELS]; + unsigned int tex_border_color; +} drm_r128_texture_regs_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_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[R128_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for client-side throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + + drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; + int tex_age[R128_NR_TEX_HEAPS]; + int ctx_owner; +} drm_r128_sarea_t; + + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmR128.h) + */ +typedef struct drm_r128_init { + enum { + 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; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + unsigned int 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 { + int flush; + int idle; +} drm_r128_cce_stop_t; + +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 { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drm_r128_vertex_t; + +typedef struct drm_r128_indices { + int prim; + int idx; + int start; + int end; + int discard; /* Client finished with buffer? */ +} drm_r128_indices_t; + +typedef struct drm_r128_blit { + int idx; + int pitch; + int offset; + int format; + unsigned short x, y; + unsigned short width, height; +} drm_r128_blit_t; + +typedef struct drm_r128_depth { + enum { + R128_WRITE_SPAN = 0x01, + R128_WRITE_PIXELS = 0x02, + R128_READ_SPAN = 0x03, + R128_READ_PIXELS = 0x04 + } func; + int n; + int *x; + int *y; + unsigned int *buffer; + unsigned char *mask; +} drm_r128_depth_t; + +typedef struct drm_r128_stipple { + unsigned int *mask; +} drm_r128_stipple_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/bsd/drm/kernel/radeon_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drm.h:1.1 --- /dev/null Fri Jan 18 15:25:59 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon_drm.h Wed Dec 12 19:24:47 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/bsd/drm/kernel/sis_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis_drm.h:1.1 --- /dev/null Fri Jan 18 15:25:59 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis_drm.h Wed Dec 12 19:24:47 2001 @@ -0,0 +1,30 @@ + +#ifndef _sis_drm_public_h_ +#define _sis_drm_public_h_ + +typedef struct { + int context; + unsigned int offset; + unsigned int size; + unsigned int free; +} drm_sis_mem_t; + +typedef struct { + unsigned int offset, size; +} drm_sis_agp_t; + +typedef struct { + unsigned int left, right; +} drm_sis_flip_t; + +#if defined(__KERNEL__) || defined(_KERNEL) + +int sis_fb_alloc(DRM_OS_IOCTL); +int sis_fb_free(DRM_OS_IOCTL); +int sisp_agp_init(DRM_OS_IOCTL); +int sisp_agp_alloc(DRM_OS_IOCTL); +int sisp_agp_free(DRM_OS_IOCTL); + +#endif + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/Makefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/Makefile:1.1 Fri Jun 16 20:03:29 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/Makefile Fri Jan 18 15:25:59 2002 @@ -1,16 +0,0 @@ -# $FreeBSD$ - -KMOD = drm -SRCS = init.c memory.c auth.c context.c drawable.c bufs.c \ - lists.c lock.c ioctl.c fops.c vm.c dma.c sysctl.c \ - agpsupport.c ctxbitmap.c -SRCS += device_if.h bus_if.h pci_if.h -CFLAGS += ${DEBUG_FLAGS} -I.. - -@: - ln -sf /sys @ - -machine: - ln -sf /sys/i386/include machine - -.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/agpsupport.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/agpsupport.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/agpsupport.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/agpsupport.c:1.1 Fri Jun 16 20:03:29 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/agpsupport.c Fri Jan 18 15:25:59 2002 @@ -1,270 +0,0 @@ -/* agpsupport.c -- DRM support for AGP/GART backend - * 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" - -#ifdef DRM_AGP - -#include <pci/agpvar.h> - -MODULE_DEPEND(drm, agp, 1, 1, 1); - -int -drm_agp_info(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - struct agp_info *kern; - drm_agp_info_t info; - - if (!dev->agp->acquired) return EINVAL; - - kern = &dev->agp->info; - agp_get_info(dev->agp->agpdev, kern); - info.agp_version_major = 1; - info.agp_version_minor = 0; - info.mode = kern->ai_mode; - info.aperture_base = kern->ai_aperture_base; - info.aperture_size = kern->ai_aperture_size; - info.memory_allowed = kern->ai_memory_allowed; - info.memory_used = kern->ai_memory_used; - info.id_vendor = kern->ai_devid & 0xffff; - info.id_device = kern->ai_devid >> 16; - - *(drm_agp_info_t *) data = info; - return 0; -} - -int -drm_agp_acquire(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - int retcode; - - if (dev->agp->acquired) return EINVAL; - retcode = agp_acquire(dev->agp->agpdev); - if (retcode) return retcode; - dev->agp->acquired = 1; - return 0; -} - -int -drm_agp_release(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - - if (!dev->agp->acquired) return EINVAL; - agp_release(dev->agp->agpdev); - dev->agp->acquired = 0; - return 0; - -} - -int -drm_agp_enable(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_agp_mode_t mode; - - if (!dev->agp->acquired) return EINVAL; - - mode = *(drm_agp_mode_t *) data; - - dev->agp->mode = mode.mode; - agp_enable(dev->agp->agpdev, mode.mode); - dev->agp->base = dev->agp->info.ai_aperture_base; - dev->agp->enabled = 1; - return 0; -} - -int drm_agp_alloc(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_agp_buffer_t request; - drm_agp_mem_t *entry; - void *handle; - unsigned long pages; - u_int32_t type; - struct agp_memory_info info; - - if (!dev->agp->acquired) return EINVAL; - - request = *(drm_agp_buffer_t *) data; - - 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 = (u_int32_t) request.type; - - if (!(handle = drm_alloc_agp(pages, type))) { - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - return ENOMEM; - } - - entry->handle = handle; - 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; - - agp_memory_info(dev->agp->agpdev, entry->handle, &info); - - request.handle = (unsigned long) entry->handle; - request.physical = info.ami_physical; - - *(drm_agp_buffer_t *) data = request; - - return 0; -} - -static drm_agp_mem_t * -drm_agp_lookup_entry(drm_device_t *dev, void *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(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_agp_binding_t request; - drm_agp_mem_t *entry; - - if (!dev->agp->acquired) return EINVAL; - request = *(drm_agp_binding_t *) data; - if (!(entry = drm_agp_lookup_entry(dev, (void *) request.handle))) - return EINVAL; - if (!entry->bound) return EINVAL; - return drm_unbind_agp(entry->handle); -} - -int drm_agp_bind(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_agp_binding_t request; - drm_agp_mem_t *entry; - int retcode; - int page; - - if (!dev->agp->acquired) return EINVAL; - request = *(drm_agp_binding_t *) data; - if (!(entry = drm_agp_lookup_entry(dev, (void *) request.handle))) - return EINVAL; - if (entry->bound) return EINVAL; - page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; - if ((retcode = drm_bind_agp(entry->handle, page))) return retcode; - entry->bound = dev->agp->base + (page << PAGE_SHIFT); - return 0; -} - -int drm_agp_free(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_agp_buffer_t request; - drm_agp_mem_t *entry; - - if (!dev->agp->acquired) return EINVAL; - request = *(drm_agp_buffer_t *) data; - if (!(entry = drm_agp_lookup_entry(dev, (void*) request.handle))) - return EINVAL; - if (entry->bound) drm_unbind_agp(entry->handle); - - 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->handle, entry->pages); - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - return 0; -} - -drm_agp_head_t *drm_agp_init(void) -{ - device_t agpdev; - drm_agp_head_t *head = NULL; - int agp_available = 1; - - agpdev = agp_find_device(); - if (!agpdev) - agp_available = 0; - - DRM_DEBUG("agp_available = %d\n", agp_available); - - if (agp_available) { - if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS))) - return NULL; - memset((void *)head, 0, sizeof(*head)); - head->agpdev = agpdev; - agp_get_info(agpdev, &head->info); - head->memory = NULL; -#if 0 /* bogus */ - 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; - case VIA_GENERIC: head->chipset = "VIA"; break; - case VIA_VP3: head->chipset = "VIA VP3"; break; - case VIA_MVP3: head->chipset = "VIA MVP3"; break; - 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: - } -#endif - DRM_INFO("AGP at 0x%08x %dMB\n", - head->info.ai_aperture_base, - head->info.ai_aperture_size >> 20); - } - return head; -} - -#endif /* DRM_AGP */ 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.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c:1.2 Thu Mar 1 21:45:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c Fri Jan 18 15:25:59 2002 @@ -1,168 +0,0 @@ -/* auth.c -- IOCTLs for authentication -*- 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); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { - if (pt->priv->authenticated) continue; - if (pt->magic == magic) { - retval = pt->priv; - break; - } - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - 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; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - 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; - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - 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); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - 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; - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - return 0; - } - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - - return EINVAL; -} - -int drm_getmagic(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - static drm_magic_t sequence = 0; -#if 0 - static struct simplelock lock; /* XXX */ -#endif - drm_device_t *dev = kdev->si_drv1; - drm_file_t *priv; - drm_auth_t auth; - - /* Find unique magic */ - priv = drm_find_file_by_proc(dev, p); - if (!priv) { - DRM_DEBUG("can't find file structure\n"); - return EINVAL; - } - if (priv->magic) { - auth.magic = priv->magic; - } else { - do { - simple_lock(&lock); - if (!sequence) ++sequence; /* reserve 0 */ - auth.magic = sequence++; - simple_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); - *(drm_auth_t *) data = auth; - return 0; -} - -int drm_authmagic(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_auth_t auth; - drm_file_t *file; - - auth = *(drm_auth_t *) data; - 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/bsd/drm/kernel/drm/bufs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/bufs.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/bufs.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/bufs.c:1.1 Fri Jun 16 20:03:29 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/bufs.c Fri Jan 18 15:25:59 2002 @@ -1,500 +0,0 @@ -/* bufs.c -- IOCTLs to manage buffers -*- 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" -#include <sys/mman.h> -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_extern.h> -#include <vm/vm_map.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(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_map_t *map; - - if (!(dev->flags & (FREAD|FWRITE))) - return EACCES; /* Require read/write */ - - map = drm_alloc(sizeof(*map), DRM_MEM_MAPS); - if (!map) return ENOMEM; - *map = *(drm_map_t *) data; - - DRM_DEBUG("offset = 0x%08lx, size = 0x%08lx, type = %d\n", - map->offset, map->size, map->type); - if ((map->offset & (PAGE_SIZE-1)) || (map->size & (PAGE_SIZE-1))) { - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - DRM_DEBUG("offset or size not page aligned\n"); - return EINVAL; - } - map->mtrr = -1; - map->handle = 0; - - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: - if (map->offset + map->size < map->offset - /* || map->offset < virt_to_phys(high_memory) */) { - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - DRM_DEBUG("bad frame buffer size\n"); - return EINVAL; - } -#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: - DRM_DEBUG("%ld %d\n", map->size, drm_order(map->size)); - map->handle = (void *)drm_alloc_pages(drm_order(map->size) - - PAGE_SHIFT, - DRM_MEM_SAREA); - 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; -#ifdef DRM_AGP - case _DRM_AGP: - map->offset = map->offset + dev->agp->base; - break; -#endif - default: - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - DRM_DEBUG("bad type\n"); - return EINVAL; - } - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - 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; - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - *(drm_map_t *) data = *map; - if (map->type != _DRM_SHM) - ((drm_map_t *)data)->handle = (void *) map->offset; - - return 0; -} - -int drm_addbufs(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - 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; - - request = *(drm_buf_desc_t *) data; - - 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) ? round_page(size) :size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - simple_lock(&dev->count_lock); - if (dev->buf_use) { - simple_unlock(&dev->count_lock); - return EBUSY; - } - atomic_inc(&dev->buf_alloc); - simple_unlock(&dev->count_lock); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - entry = &dma->bufs[order]; - if (entry->buf_count) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - 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) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - 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); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - 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; - buf->dma_wait = 0; - buf->pid = 0; -#if DRM_DMA_HISTOGRAM - timespecclear(&buf->time_queued); - timespecclear(&buf->time_dispatched); - timespecclear(&buf->time_completed); - timespecclear(&buf->time_freed); -#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]); - } - - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - request.count = entry->buf_count; - request.size = size; - - *(drm_buf_desc_t *) data = request; - - atomic_dec(&dev->buf_alloc); - return 0; -} - -int drm_infobufs(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - drm_buf_info_t request; - int i; - int count; - - if (!dma) return EINVAL; - - simple_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - simple_unlock(&dev->count_lock); - return EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - simple_unlock(&dev->count_lock); - - request = *(drm_buf_info_t *) data; - - 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) { - int error; - error = copyout(&dma->bufs[i].buf_count, - &request.list[count].count, - sizeof(dma->bufs[0] - .buf_count)); - if (error) return error; - error = copyout(&dma->bufs[i].buf_size, - &request.list[count].size, - sizeof(dma->bufs[0].buf_size)); - if (error) return error; - error = copyout(&dma->bufs[i] - .freelist.low_mark, - &request.list[count].low_mark, - sizeof(dma->bufs[0] - .freelist.low_mark)); - if (error) return error; - error = copyout(&dma->bufs[i] - .freelist.high_mark, - &request.list[count].high_mark, - sizeof(dma->bufs[0] - .freelist.high_mark)); - if (error) return error; - 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; - - *(drm_buf_info_t *) data = request; - - return 0; -} - -int drm_markbufs(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int order; - drm_buf_entry_t *entry; - - if (!dma) return EINVAL; - - request = *(drm_buf_desc_t *) data; - - 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(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - drm_buf_free_t request; - int i; - int idx; - int error; - drm_buf_t *buf; - - if (!dma) return EINVAL; - - request = *(drm_buf_free_t *) data; - - DRM_DEBUG("%d\n", request.count); - for (i = 0; i < request.count; i++) { - error = copyin(&request.list[i], &idx, sizeof(idx)); - if (error) - return error; - 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 != p->p_pid) { - DRM_ERROR("Process %d freeing buffer owned by %d\n", - p->p_pid, buf->pid); - return EINVAL; - } - drm_free_buffer(dev, buf); - } - - return 0; -} - -int drm_mapbufs(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - const int zero = 0; - vm_offset_t virtual; - vm_offset_t address; - drm_buf_map_t request; - int i; - - if (!dma) return EINVAL; - - DRM_DEBUG("\n"); - - simple_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - simple_unlock(&dev->count_lock); - return EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - simple_unlock(&dev->count_lock); - - request = *(drm_buf_map_t *) data; - - if (request.count >= dma->buf_count) { - virtual = 0; - retcode = vm_mmap(&p->p_vmspace->vm_map, - &virtual, - round_page(dma->byte_count), - PROT_READ|PROT_WRITE, VM_PROT_ALL, - MAP_SHARED, - SLIST_FIRST(&kdev->si_hlist), - 0); - if (retcode) - goto done; - - request.virtual = (void *)virtual; - - for (i = 0; i < dma->buf_count; i++) { - retcode = copyout(&dma->buflist[i]->idx, - &request.list[i].idx, - sizeof(request.list[0].idx)); - if (retcode) goto done; - retcode = copyout(&dma->buflist[i]->total, - &request.list[i].total, - sizeof(request.list[0].total)); - if (retcode) goto done; - retcode = copyout(&zero, - &request.list[i].used, - sizeof(request.list[0].used)); - if (retcode) goto done; - address = virtual + dma->buflist[i]->offset; - retcode = copyout(&address, - &request.list[i].address, - sizeof(address)); - if (retcode) goto done; - } - } -done: - request.count = dma->buf_count; - DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode); - - *(drm_buf_map_t *) data = request; - - return retcode; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/context.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/context.c:1.1 Fri Jun 16 20:03:29 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/context.c Fri Jan 18 15:25:59 2002 @@ -1,297 +0,0 @@ -/* context.c -- IOCTLs for contexts and DMA queues -*- 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); - - q->write_queue = 0; - q->read_queue = 0; - q->flush_queue = 0; - - 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 */ - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - - 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) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - DRM_DEBUG("out of memory\n"); - return -ENOMEM; - } - } - dev->queuelist[dev->queue_count-1] = queue; - - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - DRM_DEBUG("%d (new)\n", dev->queue_count - 1); - return dev->queue_count - 1; -} - -int drm_resctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i; - int error; - - DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - res = *(drm_ctx_res_t *) data; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - error = copyout(&i, &res.contexts[i], - sizeof(i)); - if (error) return error; - } - } - res.count = DRM_RESERVED_CONTEXTS; - *(drm_ctx_res_t *) data = res; - return 0; -} - - -int drm_addctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - 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); - *(drm_ctx_t *) data = ctx; - return 0; -} - -int drm_modctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - drm_queue_t *q; - - ctx = *(drm_ctx_t *) data; - - 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(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - drm_queue_t *q; - - ctx = *(drm_ctx_t *) data; - - 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); - - *(drm_ctx_t *) data = ctx; - - return 0; -} - -int drm_switchctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - DRM_DEBUG("%d\n", ctx.handle); - return drm_context_switch(dev, dev->last_context, ctx.handle); -} - -int drm_newctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - DRM_DEBUG("%d\n", ctx.handle); - drm_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int drm_rmctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - drm_queue_t *q; - drm_buf_t *buf; - - ctx = *(drm_ctx_t *) data; - 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) */ - - /* Wait while interrupt servicing is in progress */ - while (test_and_set_bit(0, &dev->interrupt_flag)) { - int never; - int error = tsleep(&never, PZERO|PCATCH, "drmrc", 1); - if (error) { - clear_bit(0, &dev->interrupt_flag); - return error; - } - } - /* Remove queued buffers */ - while ((buf = drm_waitlist_get(&q->waitlist))) { - drm_free_buffer(dev, buf); - } - clear_bit(0, &dev->interrupt_flag); - - /* Wakeup blocked processes */ - wakeup(&q->read_queue); - wakeup(&q->write_queue); - wakeup(&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/bsd/drm/kernel/drm/ctxbitmap.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ctxbitmap.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ctxbitmap.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ctxbitmap.c:1.1 Fri Jun 16 20:03:29 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ctxbitmap.c Fri Jan 18 15:25:59 2002 @@ -1,85 +0,0 @@ -/* ctxbitmap.c -- Context bitmap management - * Created: Thu Jan 6 03:56:42 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. - * - * 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 = (u_int32_t *) 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/bsd/drm/kernel/drm/dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/dma.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/dma.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/dma.c:1.1 Fri Jun 16 20:03:29 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/dma.c Fri Jan 18 15:25:59 2002 @@ -1,543 +0,0 @@ -/* dma.c -- DMA IOCTL and function support -*- c -*- - * Created: Fri Mar 19 14:30:16 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@valinuxa.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -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(struct timespec *ts) -{ - long count = ts->tv_sec * 1000 + ts->tv_nsec / 1000000; - 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) -{ - struct timespec queued_to_dispatched; - struct timespec dispatched_to_completed; - struct timespec completed_to_freed; - int q2d, d2c, c2f, q2c, q2f; - - if (timespecisset(&buf->time_queued)) { - queued_to_dispatched = buf->time_dispatched; - timespecsub(&queued_to_dispatched, &buf->time_queued); - dispatched_to_completed = buf->time_completed; - timespecsub(&dispatched_to_completed, &buf->time_dispatched); - completed_to_freed = buf->time_freed; - timespecsub(&completed_to_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); - - timespecadd(&queued_to_dispatched, &dispatched_to_completed); - q2c = drm_histogram_slot(&queued_to_dispatched); - timespecadd(&queued_to_dispatched, &completed_to_freed); - q2f = drm_histogram_slot(&queued_to_dispatched); - - 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]); - - } - timespecclear(&buf->time_queued); - timespecclear(&buf->time_dispatched); - timespecclear(&buf->time_completed); - timespecclear(&buf->time_freed); -} -#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_HISTOGRAMxx - buf->time_completed = get_cycles(); -#endif - if (buf->dma_wait) { - buf->dma_wait = 0; - wakeup(&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 - getnanotime(&dev->ctx_start); -#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 = ticks; - - 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 - { - struct timespec ts; - getnanotime(&ts); - timespecsub(&ts, &dev->ctx_start); - atomic_inc(&dev->histo.ctx[drm_histogram_slot(&ts)]); - } -#endif - clear_bit(0, &dev->context_flag); - wakeup(&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)) { - wakeup(&dma->next_queue->flush_queue); - } - dma->next_queue = NULL; -} - - -int drm_select_queue(drm_device_t *dev, void (*wrapper)(void *)) -{ - int i; - int candidate = -1; - int j = ticks; - - 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) { - int s = splclock(); - if (dev->timer.c_time != dev->last_switch + DRM_TIME_SLICE) { - callout_reset(&dev->timer, - dev->last_switch + DRM_TIME_SLICE - j, - wrapper, - dev); - } - splx(s); - 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; - int error; - - 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)) { - atomic_inc(&q->block_count); - for (;;) { - if (!atomic_read(&q->block_write)) break; - error = tsleep(&q->block_write, PZERO|PCATCH, - "dmawr", 0); - if (error) { - atomic_dec(&q->use_count); - return error; - } - } - atomic_dec(&q->block_count); - } - - 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 != curproc->p_pid) { - atomic_dec(&q->use_count); - DRM_ERROR("Process %d using buffer owned by %d\n", - curproc->p_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", - curproc->p_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; - int error; - 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 = curproc->p_pid; - error = copyout(&buf->idx, - &d->request_indices[i], - sizeof(buf->idx)); - if (error) - return error; - error = copyout(&buf->total, - &d->request_sizes[i], - sizeof(buf->total)); - if (error) - return error; - ++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/bsd/drm/kernel/drm/drawable.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drawable.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drawable.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drawable.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drawable.c Fri Jan 18 15:25:59 2002 @@ -1,50 +0,0 @@ -/* drawable.c -- IOCTLs for drawables -*- 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(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_draw_t draw; - - draw.handle = 0; /* NOOP */ - DRM_DEBUG("%d\n", draw.handle); - *(drm_draw_t *) data = draw; - return 0; -} - -int drm_rmdraw(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - return 0; /* NOOP */ -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drmstat.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drmstat.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drmstat.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drmstat.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drmstat.c Fri Jan 18 15:25:59 2002 @@ -1,418 +0,0 @@ -/* drmstat.c -- DRM device status and testing program - * Created: Tue Jan 5 08:19:24 1999 by faith@precisioninsight.com - * Revised: Sun Aug 1 11:02:00 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/kernel/drmstat.c,v 1.28 1999/08/04 18:12:11 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/drmstat.c,v 1.1 2000/06/17 00:03:30 martin Exp $ - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/mman.h> -#include <strings.h> -#include <errno.h> -#include <signal.h> -#include <fcntl.h> -#include "xf86drm.h" - -int sigio_fd; - -static double usec(struct timeval *end, struct timeval *start) -{ - double e = end->tv_sec * 1000000 + end->tv_usec; - double s = start->tv_sec * 1000000 + start->tv_usec; - - return e - s; -} - -static void getversion(int fd) -{ - drmVersionPtr version; - - version = drmGetVersion(fd); - if (version) { - 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 driver available\n" ); - } -} - -void handler(int fd, void *oldctx, void *newctx) -{ - printf("Got fd %d\n", fd); -} - -void process_sigio(char *device) -{ - int fd; - -printf("%s\n", device); - if ((fd = open(device, 0)) < 0) { -printf("%d\n", errno); - drmError(-errno, __FUNCTION__); - exit(1); - } - - sigio_fd = fd; - drmInstallSIGIOHandler(fd, handler); - for (;;) sleep(60); -} - -int main(int argc, char **argv) -{ - int c; - int r = 0; - int fd = -1; - drmHandle handle; - void *address; - char *pt; - unsigned long count; - unsigned long offset; - unsigned long size; - drmContext context; - int loops; - char buf[1024]; - int i; - drmBufInfoPtr info; - drmBufMapPtr bufs; - drmLockPtr lock; - int secs; - - while ((c = getopt(argc, argv, - "lc:vo:O:f:s:w:W:b:r:R:P:L:C:XS:B:F:")) != EOF) - switch (c) { - case 'F': - count = strtoul(optarg, NULL, 0); - if (!fork()) { - dup(fd); - sleep(count); - } - close(fd); - break; - case 'v': getversion(fd); break; - case 'X': - if ((r = drmCreateContext(fd, &context))) { - drmError(r, argv[0]); - return 1; - } - printf( "Got %d\n", context); - break; - case 'S': - process_sigio(optarg); - break; - case 'C': - if ((r = drmSwitchToContext(fd, strtoul(optarg, NULL, 0)))) { - drmError(r, argv[0]); - return 1; - } - break; - case 'c': - if ((r = drmSetBusid(fd,optarg))) { - drmError(r, argv[0]); - return 1; - } - break; - case 'o': - if ((fd = drmOpen(optarg, NULL)) < 0) { - drmError(fd, argv[0]); - return 1; - } - break; - case 'O': - if ((fd = drmOpen(NULL, optarg)) < 0) { - drmError(fd, argv[0]); - return 1; - } - break; - case 'B': /* Test buffer allocation */ - count = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, &pt, 0); - secs = strtoul(pt+1, NULL, 0); - { - drmDMAReq dma; - int *indices, *sizes; - - indices = alloca(sizeof(*indices) * count); - sizes = alloca(sizeof(*sizes) * count); - dma.context = context; - dma.send_count = 0; - dma.request_count = count; - dma.request_size = size; - dma.request_list = indices; - dma.request_sizes = sizes; - dma.flags = DRM_DMA_WAIT; - if ((r = drmDMA(fd, &dma))) { - drmError(r, argv[0]); - return 1; - } - for (i = 0; i < dma.granted_count; i++) { - printf("%5d: index = %d, size = %d\n", - i, dma.request_list[i], dma.request_sizes[i]); - } - sleep(secs); - drmFreeBufs(fd, dma.granted_count, indices); - } - break; - case 'b': - count = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - if ((r = drmAddBufs(fd, count, size, 0, 0)) < 0) { - drmError(r, argv[0]); - return 1; - } - if (!(info = drmGetBufInfo(fd))) { - drmError(0, argv[0]); - return 1; - } - for (i = 0; i < info->count; i++) { - printf("%5d buffers of size %6d (low = %d, high = %d)\n", - info->list[i].count, - info->list[i].size, - info->list[i].low_mark, - info->list[i].high_mark); - } - if ((r = drmMarkBufs(fd, 0.50, 0.80))) { - drmError(r, argv[0]); - return 1; - } - if (!(info = drmGetBufInfo(fd))) { - drmError(0, argv[0]); - return 1; - } - for (i = 0; i < info->count; i++) { - printf("%5d buffers of size %6d (low = %d, high = %d)\n", - info->list[i].count, - info->list[i].size, - info->list[i].low_mark, - info->list[i].high_mark); - } - printf("===== /proc/drm/1/meminfo =====\n"); - sprintf(buf, "cat /proc/drm/1/meminfo"); - system(buf); -#if 1 - if (!(bufs = drmMapBufs(fd))) { - drmError(0, argv[0]); - return 1; - } - printf("===============================\n"); - printf( "%d bufs\n", bufs->count); - for (i = 0; i < bufs->count; i++) { - printf( " %4d: %8d bytes at %p\n", - i, - bufs->list[i].total, - bufs->list[i].address); - } - printf("===== /proc/drm/1/vmainfo =====\n"); - sprintf(buf, "cat /proc/drm/1/vmainfo"); - system(buf); -#endif - break; - case 'f': - offset = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - handle = 0; - if ((r = drmAddMap(fd, offset, size, - DRM_FRAME_BUFFER, 0, &handle))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%08lx:0x%04lx added\n", offset, size); - printf("===== /proc/drm/1/meminfo =====\n"); - sprintf(buf, "cat /proc/drm/1/meminfo"); - system(buf); - break; - case 'r': - case 'R': - offset = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - handle = 0; - if ((r = drmAddMap(fd, offset, size, - DRM_REGISTERS, - c == 'R' ? DRM_READ_ONLY : 0, - &handle))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%08lx:0x%04lx added\n", offset, size); - printf("===== /proc/drm/1/meminfo =====\n"); - sprintf(buf, "cat /proc/drm/1/meminfo"); - system(buf); - break; - case 's': - size = strtoul(optarg, &pt, 0); - handle = 0; - if ((r = drmAddMap(fd, 0, size, - DRM_SHM, DRM_CONTAINS_LOCK, - &handle))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%04lx byte shm added at 0x%08lx\n", size, handle); - sprintf(buf, "sysctl hw.graphics.0.vm"); - system(buf); - break; - case 'P': - offset = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - address = NULL; - if ((r = drmMap(fd, offset, size, &address))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%08lx:0x%04lx mapped at %p for pid %d\n", - offset, size, address, getpid()); - printf("===== hw.graphics.0.vma =====\n"); - sprintf(buf, "sysctl hw.graphics.0.vma"); - system(buf); - mprotect((void *)offset, size, PROT_READ); - printf("===== hw.graphics.0.vma =====\n"); - sprintf(buf, "sysctl hw.graphics.0.vma"); - system(buf); - break; - case 'w': - case 'W': - offset = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - address = NULL; - if ((r = drmMap(fd, offset, size, &address))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%08lx:0x%04lx mapped at %p for pid %d\n", - offset, size, address, getpid()); - printf("===== /proc/%d/maps =====\n", getpid()); - sprintf(buf, "cat /proc/%d/maps", getpid()); - system(buf); - printf("===== /proc/drm/1/meminfo =====\n"); - sprintf(buf, "cat /proc/drm/1/meminfo"); - system(buf); - printf("===== /proc/drm/1/vmainfo =====\n"); - sprintf(buf, "cat /proc/drm/1/vmainfo"); - system(buf); - printf("===== READING =====\n"); - for (i = 0; i < 0x10; i++) - printf("%02x ", (unsigned int)((unsigned char *)address)[i]); - printf("\n"); - if (c == 'w') { - printf("===== WRITING =====\n"); - for (i = 0; i < size; i+=2) { - ((char *)address)[i] = i & 0xff; - ((char *)address)[i+1] = i & 0xff; - } - } - printf("===== READING =====\n"); - for (i = 0; i < 0x10; i++) - printf("%02x ", (unsigned int)((unsigned char *)address)[i]); - printf("\n"); - printf("===== /proc/drm/1/vmainfo =====\n"); - sprintf(buf, "cat /proc/drm/1/vmainfo"); - system(buf); - break; - case 'L': - context = strtoul(optarg, &pt, 0); - offset = strtoul(pt+1, &pt, 0); - size = strtoul(pt+1, &pt, 0); - loops = strtoul(pt+1, NULL, 0); - address = NULL; - if ((r = drmMap(fd, offset, size, &address))) { - drmError(r, argv[0]); - return 1; - } - lock = address; -#if 1 - { - int counter = 0; - struct timeval loop_start, loop_end; - struct timeval lock_start, lock_end; - double wt; -#define HISTOSIZE 9 - int histo[HISTOSIZE]; - int output = 0; - int fast = 0; - - if (loops < 0) { - loops = -loops; - ++output; - } - - for (i = 0; i < HISTOSIZE; i++) histo[i] = 0; - - gettimeofday(&loop_start, NULL); - for (i = 0; i < loops; i++) { - gettimeofday(&lock_start, NULL); - DRM_LIGHT_LOCK_COUNT(fd,lock,context,fast); - gettimeofday(&lock_end, NULL); - DRM_UNLOCK(fd,lock,context); - ++counter; - wt = usec(&lock_end, &lock_start); - if (wt <= 2.5) ++histo[8]; - if (wt < 5.0) ++histo[0]; - else if (wt < 50.0) ++histo[1]; - else if (wt < 500.0) ++histo[2]; - else if (wt < 5000.0) ++histo[3]; - else if (wt < 50000.0) ++histo[4]; - else if (wt < 500000.0) ++histo[5]; - else if (wt < 5000000.0) ++histo[6]; - else ++histo[7]; - if (output) printf( "%.2f uSec, %d fast\n", wt, fast); - } - gettimeofday(&loop_end, NULL); - printf( "Average wait time = %.2f usec, %d fast\n", - usec(&loop_end, &loop_start) / counter, fast); - printf( "%9d <= 2.5 uS\n", histo[8]); - printf( "%9d < 5 uS\n", histo[0]); - printf( "%9d < 50 uS\n", histo[1]); - printf( "%9d < 500 uS\n", histo[2]); - printf( "%9d < 5000 uS\n", histo[3]); - printf( "%9d < 50000 uS\n", histo[4]); - printf( "%9d < 500000 uS\n", histo[5]); - printf( "%9d < 5000000 uS\n", histo[6]); - printf( "%9d >= 5000000 uS\n", histo[7]); - } -#else - printf( "before lock: 0x%08x\n", lock->lock); - printf( "lock: 0x%08x\n", lock->lock); - sleep(5); - printf( "unlock: 0x%08x\n", lock->lock); -#endif - break; - default: - fprintf( stderr, "Usage: drmstat [options]\n" ); - return 1; - } - - return r; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/fops.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/fops.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/fops.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/fops.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/fops.c Fri Jan 18 15:25:59 2002 @@ -1,261 +0,0 @@ -/* fops.c -- File operations for DRM -*- 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 <sys/signalvar.h> -#include <sys/poll.h> - -drm_file_t *drm_find_file_by_proc(drm_device_t *dev, struct proc *p) -{ - uid_t uid = p->p_cred->p_svuid; - pid_t pid = p->p_pid; - drm_file_t *priv; - - TAILQ_FOREACH(priv, &dev->files, link) - if (priv->pid == pid && priv->uid == uid) - return priv; - return NULL; -} - - -/* drm_open is called whenever a process opens /dev/drm. */ - -int drm_open_helper(dev_t kdev, int flags, int fmt, struct proc *p, - drm_device_t *dev) -{ - int m = minor(kdev); - drm_file_t *priv; - - if (flags & O_EXCL) - return EBUSY; /* No exclusive opens */ - - dev->flags = flags; - - DRM_DEBUG("pid = %d, device = %p, minor = %d\n", - p->p_pid, dev->device, m); - - priv = drm_find_file_by_proc(dev, p); - if (priv) { - priv->refs++; - } else { - priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); - memset(priv, 0, sizeof(*priv)); - priv->uid = p->p_cred->p_svuid; - priv->pid = p->p_pid; - priv->refs = 1; - priv->minor = m; - priv->devXX = dev; - priv->ioctl_count = 0; - priv->authenticated = !suser(p); - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, p); - TAILQ_INSERT_TAIL(&dev->files, priv, link); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, p); - } - - kdev->si_drv1 = dev; - - return 0; -} - -int drm_write(dev_t kdev, struct uio *uio, int ioflag) -{ - struct proc *p = curproc; - drm_device_t *dev = kdev->si_drv1; - - DRM_DEBUG("pid = %d, device = %p, open_count = %d\n", - p->p_pid, dev->device, dev->open_count); - return 0; -} - -/* drm_release is called whenever a process closes /dev/drm*. */ - -int drm_close(dev_t kdev, int fflag, int devtype, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_file_t *priv; - - DRM_DEBUG("pid = %d, device = %p, open_count = %d\n", - p->p_pid, dev->device, dev->open_count); - - priv = drm_find_file_by_proc(dev, p); - if (!priv) { - DRM_DEBUG("can't find authenticator\n"); - return EINVAL; - } - - if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) - && dev->lock.pid == p->p_pid) { - DRM_ERROR("Process %d dead, freeing lock for context %d\n", - p->p_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); - - funsetown(dev->buf_sigio); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, p); - priv = drm_find_file_by_proc(dev, p); - if (priv) { - priv->refs--; - if (!priv->refs) { - TAILQ_REMOVE(&dev->files, priv, link); - drm_free(priv, sizeof(*priv), DRM_MEM_FILES); - } - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, p); - - 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(dev_t kdev, struct uio *uio, int ioflag) -{ - drm_device_t *dev = kdev->si_drv1; - int left; - int avail; - int send; - int cur; - int error = 0; - - DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); - - while (dev->buf_rp == dev->buf_wp) { - DRM_DEBUG(" sleeping\n"); - if (dev->flags & FASYNC) { - return EWOULDBLOCK; - } - error = tsleep(&dev->buf_rp, PZERO|PCATCH, "drmrd", 0); - if (error) { - DRM_DEBUG(" interrupted\n"); - return error; - } - DRM_DEBUG(" awake\n"); - } - - left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - avail = DRM_BSZ - left; - send = DRM_MIN(avail, uio->uio_resid); - - 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); - } - error = uiomove(dev->buf_rp, cur, uio); - if (error) - break; - dev->buf_rp += cur; - if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf; - send -= cur; - } - - wakeup(&dev->buf_wp); - - return error; -} - -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 (dev->buf_selecting) { - dev->buf_selecting = 0; - selwakeup(&dev->buf_sel); - } - - DRM_DEBUG("dev->buf_sigio=%p\n", dev->buf_sigio); - if (dev->buf_sigio) { - DRM_DEBUG("dev->buf_sigio->sio_pgid=%d\n", dev->buf_sigio->sio_pgid); - pgsigio(dev->buf_sigio, SIGIO, 0); - } - - DRM_DEBUG("waking\n"); - wakeup(&dev->buf_rp); - return 0; -} - -int drm_poll(dev_t kdev, int events, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - int s; - int revents = 0; - - s = spldrm(); - if (events & (POLLIN | POLLRDNORM)) { - int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - if (left > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &dev->buf_sel); - } - splx(s); - - return revents; -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/init.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/init.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/init.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/init.c Fri Jan 18 15:25:59 2002 @@ -1,100 +0,0 @@ -/* init.c -- Setup/Cleanup for DRM -*- 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" - -MODULE_VERSION(drm, 1); - -int drm_flags = 0; - -/* drm_parse_option parses a single option. See description for - drm_parse_drm 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 */ - } -} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ioctl.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ioctl.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ioctl.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ioctl.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/ioctl.c Fri Jan 18 15:25:59 2002 @@ -1,120 +0,0 @@ -/* ioctl.c -- IOCTL processing for DRM -*- 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" -#include <sys/bus.h> -#include <pci/pcivar.h> - -int -drm_irq_busid(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_irq_busid_t id; - devclass_t pci; - device_t bus, dev; - device_t *kids; - int error, i, num_kids; - - id = *(drm_irq_busid_t *) data; - pci = devclass_find("pci"); - if (!pci) - return ENOENT; - bus = devclass_get_device(pci, id.busnum); - if (!bus) - return ENOENT; - error = device_get_children(bus, &kids, &num_kids); - if (error) - return error; - - dev = 0; - for (i = 0; i < num_kids; i++) { - dev = kids[i]; - if (pci_get_slot(dev) == id.devnum - && pci_get_function(dev) == id.funcnum) - break; - } - - free(kids, M_TEMP); - - if (i != num_kids) - id.irq = pci_get_irq(dev); - else - id.irq = 0; - - DRM_DEBUG("%d:%d:%d => IRQ %d\n", - id.busnum, id.devnum, id.funcnum, id.irq); - *(drm_irq_busid_t *) data = id; - - return 0; -} - -int -drm_getunique(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_unique_t u; - int error; - - u = *(drm_unique_t *) data; - if (u.unique_len >= dev->unique_len) { - error = copyout(dev->unique, u.unique, dev->unique_len); - if (error) - return error; - } - u.unique_len = dev->unique_len; - *(drm_unique_t *) data = u; - return 0; -} - -int -drm_setunique(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_unique_t u; - int error; - - if (dev->unique_len || dev->unique) return EBUSY; - - u = *(drm_unique_t *) data; - - dev->unique_len = u.unique_len; - dev->unique = drm_alloc(u.unique_len + 1, DRM_MEM_DRIVER); - error = copyin(u.unique, dev->unique, dev->unique_len); - if (error) - return error; - 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/bsd/drm/kernel/drm/lists.c diff -u 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:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c:1.2 Thu Mar 1 21:45:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c Fri Jan 18 15:25:59 2002 @@ -1,278 +0,0 @@ -/* lists.c -- Buffer list handling routines -*- 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) -{ - DRM_DEBUG("%d\n", 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]; - simple_lock_init(&bl->write_lock); - simple_lock_init(&bl->read_lock); - return 0; -} - -int drm_waitlist_destroy(drm_waitlist_t *bl) -{ - DRM_DEBUG("\n"); - 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; - int s; - - left = DRM_LEFTCOUNT(bl); - DRM_DEBUG("put %d (%d left, rp = %p, wp = %p)\n", - buf->idx, left, bl->rp, bl->wp); - if (!left) { - DRM_ERROR("Overflow while adding buffer %d from pid %d\n", - buf->idx, buf->pid); - return EINVAL; - } -#if DRM_DMA_HISTOGRAM - getnanotime(&buf->time_queued); -#endif - buf->list = DRM_LIST_WAIT; - - simple_lock(&bl->write_lock); - s = spldrm(); - *bl->wp = buf; - if (++bl->wp >= bl->end) bl->wp = bl->bufs; - splx(s); - simple_unlock(&bl->write_lock); - - return 0; -} - -drm_buf_t *drm_waitlist_get(drm_waitlist_t *bl) -{ - drm_buf_t *buf; - int s; - - simple_lock(&bl->read_lock); - s = spldrm(); - buf = *bl->rp; - if (bl->rp == bl->wp) { - splx(s); - simple_unlock(&bl->read_lock); - return NULL; - } - if (++bl->rp >= bl->end) bl->rp = bl->bufs; - splx(s); - simple_unlock(&bl->read_lock); - - DRM_DEBUG("get %d\n", buf->idx); - return buf; -} - -int drm_freelist_create(drm_freelist_t *bl, int count) -{ - DRM_DEBUG("\n"); - atomic_set(&bl->count, 0); - bl->next = NULL; - bl->waiting = 0; - 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) -{ - DRM_DEBUG("\n"); - 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) -{ - unsigned int old; - unsigned int new; - char failed; - int count = 0; - 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); - } - DRM_DEBUG("%d, count = %d, wfh = %d, w%d, p%d\n", - buf->idx, atomic_read(&bl->count), atomic_read(&bl->wfh), - buf->waiting, buf->pending); - if (!bl) return 1; -#if DRM_DMA_HISTOGRAM - getnanotime(&buf->time_freed); - drm_histogram_compute(dev, buf); -#endif - buf->list = DRM_LIST_FREE; -/* - do { - old = (unsigned long)bl->next; - buf->next = (void *)old; - new = (unsigned long)buf; - _DRM_CAS(&bl->next, old, new, failed); - if (++count > DRM_LOOPING_LIMIT) { - DRM_ERROR("Looping\n"); - 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", - 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); - if (bl->waiting) - wakeup(&bl->waiting); - } - return 0; -} - -static drm_buf_t *drm_freelist_try(drm_freelist_t *bl) -{ - unsigned int old; - unsigned int new; - char failed; - drm_buf_t *buf; - int count = 0; - - if (!bl) return NULL; - - /* Get buffer */ -/* - do { - old = (unsigned int)bl->next; - if (!old) { - return NULL; - } - new = (unsigned long)bl->next->next; - _DRM_CAS(&bl->next, old, new, failed); - if (++count > DRM_LOOPING_LIMIT) { - DRM_ERROR("Looping\n"); - return NULL; - } - } while (failed); - 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", - buf->idx, atomic_read(&bl->count), atomic_read(&bl->wfh), - buf->waiting, buf->pending); - 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; - int error; - - 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)) { - DRM_DEBUG("Block = %d, count = %d, wfh = %d\n", - block, atomic_read(&bl->count), - atomic_read(&bl->wfh)); - if (block) { - atomic_inc(&bl->waiting); - for (;;) { - if (!atomic_read(&bl->wfh) - && (buf = drm_freelist_try(bl))) break; - error = tsleep(&bl->waiting, PZERO|PCATCH, - "drmfg", 0); - if (error) - break; - } - atomic_dec(&bl->waiting); - } - return buf; - } - - DRM_DEBUG("Count = %d, wfh = %d\n", - atomic_read(&bl->count), atomic_read(&bl->wfh)); - return drm_freelist_try(bl); -} 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.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c:1.2 Thu Mar 1 21:45:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c Fri Jan 18 15:25:59 2002 @@ -1,223 +0,0 @@ -/* lock.c -- IOCTLs for locking -*- 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(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - DRM_DEBUG("\n"); - return 0; -} - -int -drm_unblock(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - DRM_DEBUG("\n"); - return 0; -} - -int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context) -{ - unsigned int old; - unsigned int new; - char failed; - - DRM_DEBUG("%d attempts\n", context); - do { - old = *lock; - if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT; - else new = context | _DRM_LOCK_HELD; - _DRM_CAS(lock, old, new, failed); - } while (failed); - 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 */ - DRM_DEBUG("%d\n", context); - return 1; - } - DRM_DEBUG("%d unable to get lock held by %d\n", - context, _DRM_LOCKING_CONTEXT(old)); - 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; - unsigned int new; - char failed; - - dev->lock.pid = 0; - do { - old = *lock; - new = context | _DRM_LOCK_HELD; - _DRM_CAS(lock, old, new, failed); - } while (failed); - DRM_DEBUG("%d => %d\n", _DRM_LOCKING_CONTEXT(old), context); - return 1; -} - -int drm_lock_free(drm_device_t *dev, - __volatile__ unsigned int *lock, unsigned int context) -{ - unsigned int old; - unsigned int new; - char failed; - pid_t pid = dev->lock.pid; - - DRM_DEBUG("%d\n", context); - dev->lock.pid = 0; - do { - old = *lock; - new = 0; - _DRM_CAS(lock, old, new, failed); - } while (failed); - 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; - } - wakeup(&dev->lock.lock_queue); - return 0; -} - -static int drm_flush_queue(drm_device_t *dev, int context) -{ - int ret = 0; - int error; - 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); - atomic_inc(&q->block_count); - 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); - 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); - wakeup(&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(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - int ret = 0; - drm_lock_t lock; - - DRM_DEBUG("\n"); - - lock = *(drm_lock_t *) data; - ret = drm_flush_block_and_flush(dev, lock.context, lock.flags); - drm_flush_unblock(dev, lock.context, lock.flags); - return ret; -} 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.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c:1.2 Thu Mar 1 21:45:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c Fri Jan 18 15:25:59 2002 @@ -1,458 +0,0 @@ -/* memory.c -- Memory management wrappers for DRM -*- 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 "drmP.h" - -#include <vm/vm.h> -#include <vm/pmap.h> -#ifdef DRM_AGP -#include <sys/agpio.h> -#endif - -MALLOC_DEFINE(M_DRM, "drm", "DRM Data Structures"); - -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; - -#ifdef SMP -static struct simplelock drm_mem_lock; -#endif -static unsigned long drm_ram_available = 0; -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; - - 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; - } - - drm_ram_available = 0; /* si.totalram; */ - drm_ram_used = 0; -} - -/* drm_mem_info is called whenever a process reads /dev/drm/mem. */ - -static int _drm_mem_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_mem_stats_t *pt; - char buf[128]; - int error; - - DRM_SYSCTL_PRINT(" total counts " - " | outstanding \n"); - DRM_SYSCTL_PRINT("type alloc freed fail bytes freed" - " | allocs bytes\n\n"); - DRM_SYSCTL_PRINT("%-9.9s %5d %5d %4d %10lu |\n", - "system", 0, 0, 0, drm_ram_available); - DRM_SYSCTL_PRINT("%-9.9s %5d %5d %4d %10lu |\n", - "locked", 0, 0, 0, drm_ram_used); - DRM_SYSCTL_PRINT("\n"); - for (pt = drm_mem_stats; pt->name; pt++) { - DRM_SYSCTL_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); - } - SYSCTL_OUT(req, "", 1); - - return 0; -} - -int drm_mem_info DRM_SYSCTL_HANDLER_ARGS -{ - int ret; - - simple_lock(&drm_mem_lock); - ret = _drm_mem_info(oidp, arg1, arg2, req); - simple_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 = malloc(size, M_DRM, M_NOWAIT))) { - simple_lock(&drm_mem_lock); - ++drm_mem_stats[area].fail_count; - simple_unlock(&drm_mem_lock); - return NULL; - } - simple_lock(&drm_mem_lock); - ++drm_mem_stats[area].succeed_count; - drm_mem_stats[area].bytes_allocated += size; - simple_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(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 free(pt, M_DRM); - simple_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; - simple_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) -{ - vm_offset_t address; - unsigned long bytes = PAGE_SIZE << order; - unsigned long addr; - unsigned int sz; - - simple_lock(&drm_mem_lock); - if (drm_ram_used > +(DRM_RAM_PERCENT * drm_ram_available) / 100) { - simple_unlock(&drm_mem_lock); - return 0; - } - simple_unlock(&drm_mem_lock); - - address = (vm_offset_t) contigmalloc(1<<order, M_DRM, M_WAITOK, 0, ~0, 1, 0); - if (!address) { - simple_lock(&drm_mem_lock); - ++drm_mem_stats[area].fail_count; - simple_unlock(&drm_mem_lock); - return 0; - } - simple_lock(&drm_mem_lock); - ++drm_mem_stats[area].succeed_count; - drm_mem_stats[area].bytes_allocated += bytes; - drm_ram_used += bytes; - simple_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) { - /* mem_map_reserve(MAP_NR(addr));*/ - } - - 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) { - /* mem_map_unreserve(MAP_NR(addr));*/ - } - contigfree((void *) address, bytes, M_DRM); - } - - simple_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; - simple_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 = pmap_mapdev(offset, size))) { - simple_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_MAPPINGS].fail_count; - simple_unlock(&drm_mem_lock); - return NULL; - } - simple_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_MAPPINGS].succeed_count; - drm_mem_stats[DRM_MEM_MAPPINGS].bytes_allocated += size; - simple_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 - pmap_unmapdev((vm_offset_t) pt, size); - - simple_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; - simple_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); - } -} - -#ifdef DRM_AGP -void *drm_alloc_agp(int pages, u_int32_t type) -{ - device_t dev = agp_find_device(); - void *handle; - - if (!dev) - return NULL; - - if (!pages) { - DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n"); - return NULL; - } - - if ((handle = agp_alloc_memory(dev, type, pages << AGP_PAGE_SHIFT))) { - simple_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; - drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated - += pages << PAGE_SHIFT; - simple_unlock(&drm_mem_lock); - return handle; - } - simple_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count; - simple_unlock(&drm_mem_lock); - return NULL; -} - -int drm_free_agp(void *handle, int pages) -{ - device_t dev = agp_find_device(); - int alloc_count; - int free_count; - int retval = EINVAL; - - if (!dev) - return EINVAL; - - if (!handle) { - DRM_MEM_ERROR(DRM_MEM_TOTALAGP, - "Attempt to free NULL AGP handle\n"); - return retval; - } - - agp_free_memory(dev, handle); - simple_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; - simple_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; -} - -int drm_bind_agp(void *handle, unsigned int start) -{ - device_t dev = agp_find_device(); - int retcode = EINVAL; - struct agp_memory_info info; - - DRM_DEBUG("drm_bind_agp called\n"); - - if (!dev) - return EINVAL; - - if (!handle) { - DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, - "Attempt to bind NULL AGP handle\n"); - return retcode; - } - - if (!(retcode = agp_bind_memory(dev, handle, - start << AGP_PAGE_SHIFT))) { - simple_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; - agp_memory_info(dev, handle, &info); - drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated - += info.ami_size; - simple_unlock(&drm_mem_lock); - DRM_DEBUG("drm_agp.bind_memory: retcode %d\n", retcode); - return retcode; - } - simple_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count; - simple_unlock(&drm_mem_lock); - return retcode; -} - -int drm_unbind_agp(void *handle) -{ - device_t dev = agp_find_device(); - int alloc_count; - int free_count; - int retcode = EINVAL; - struct agp_memory_info info; - - if (!dev) - return EINVAL; - - if (!handle) { - DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, - "Attempt to unbind NULL AGP handle\n"); - return retcode; - } - - - agp_memory_info(dev, handle, &info); - if ((retcode = agp_unbind_memory(dev, handle))) - return retcode; - simple_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 += info.ami_size; - simple_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/bsd/drm/kernel/drm/proc.c diff -u 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:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c:1.2 Thu Mar 1 21:45:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c Fri Jan 18 15:25:59 2002 @@ -1,568 +0,0 @@ -/* proc.c -- /proc support for DRM -*- c -*- - * Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 11:31:48 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/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.2 2001/03/02 02:45:38 dawes Exp $ - * - */ - -#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("graphics", S_IFDIR, NULL); - if (!drm_root) { - DRM_ERROR("Cannot create /proc/graphics\n"); - return -1; - } - - /* Instead of doing this search, we should - add some global support for /proc/graphics. */ - for (i = 0; i < 8; i++) { - sprintf(drm_slot_name, "graphics/%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("graphics", NULL); - } - if (drm_dev_root->nlink == 2) break; - drm_dev_root = NULL; - } - if (!drm_dev_root) { - DRM_ERROR("Cannot find slot in /proc/graphics\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("graphics", 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("graphics", 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; - 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 - -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; - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; - unsigned long i; - struct vm_area_struct *vma; - unsigned long address; -#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' : '-', - vma->vm_offset ); -#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_4M ? 'm' : 'k', - pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); -#endif - DRM_PROC_PRINT("\n"); - 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); - } - } - } - - 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%08x\n", dev->context_flag); - DRM_PROC_PRINT("interrupt_flag 0x%08x\n", dev->interrupt_flag); - DRM_PROC_PRINT("dma_flag 0x%08x\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/bsd/drm/kernel/drm/sysctl.c diff -u 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:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c:1.2 Thu Mar 1 21:45:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c Fri Jan 18 15:25:59 2002 @@ -1,554 +0,0 @@ -/* proc.c -- /proc support for DRM -*- c -*- - * Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 11:31:48 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$ - * $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 $ - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include <sys/sysctl.h> - -SYSCTL_NODE(_hw, OID_AUTO, dri, CTLFLAG_RW, 0, "DRI Graphics"); - -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 DRM_SYSCTL_HANDLER_ARGS; -#endif -#if DRM_DMA_HISTOGRAM -static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS; -#endif - -struct drm_sysctl_list { - const char *name; - int (*f) DRM_SYSCTL_HANDLER_ARGS; -} drm_sysctl_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_CODExx - { "vma", drm_vma_info }, -#endif -#if DRM_DMA_HISTOGRAM - { "histo", drm_histo_info }, -#endif -}; -#define DRM_SYSCTL_ENTRIES (sizeof(drm_sysctl_list)/sizeof(drm_sysctl_list[0])) - -struct drm_sysctl_info { - struct sysctl_oid oids[DRM_SYSCTL_ENTRIES + 1]; - struct sysctl_oid_list list; - char name[2]; -}; - -int drm_sysctl_init(drm_device_t *dev) -{ - struct drm_sysctl_info *info; - struct sysctl_oid *oid; - struct sysctl_oid *top; - int i; - - /* Find the next free slot under hw.graphics */ - i = 0; - SLIST_FOREACH(oid, &sysctl__hw_dri_children, oid_link) { - if (i <= oid->oid_arg2) - i = oid->oid_arg2 + 1; - } - - info = drm_alloc(sizeof *info, DRM_MEM_DRIVER); - dev->sysctl = info; - - /* Construct the node under hw.graphics */ - info->name[0] = '0' + i; - info->name[1] = 0; - oid = &info->oids[DRM_SYSCTL_ENTRIES]; - bzero(oid, sizeof(*oid)); - oid->oid_parent = &sysctl__hw_dri_children; - oid->oid_number = OID_AUTO; - oid->oid_kind = CTLTYPE_NODE | CTLFLAG_RW; - oid->oid_arg1 = &info->list; - oid->oid_arg2 = i; - oid->oid_name = info->name; - oid->oid_handler = 0; - oid->oid_fmt = "N"; - SLIST_INIT(&info->list); - sysctl_register_oid(oid); - top = oid; - - for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) { - oid = &info->oids[i]; - bzero(oid, sizeof(*oid)); - oid->oid_parent = top->oid_arg1; - oid->oid_number = OID_AUTO; - oid->oid_kind = CTLTYPE_INT | CTLFLAG_RD; - oid->oid_arg1 = dev; - oid->oid_arg2 = 0; - oid->oid_name = drm_sysctl_list[i].name; - oid->oid_handler = drm_sysctl_list[i].f; - oid->oid_fmt = "A"; - sysctl_register_oid(oid); - } - - return 0; -} - -int drm_sysctl_cleanup(drm_device_t *dev) -{ - int i; - - DRM_DEBUG("dev->sysctl=%p\n", dev->sysctl); - for (i = 0; i < DRM_SYSCTL_ENTRIES + 1; i++) - sysctl_unregister_oid(&dev->sysctl->oids[i]); - - drm_free(dev->sysctl, sizeof *dev->sysctl, DRM_MEM_DRIVER); - dev->sysctl = NULL; - - return 0; -} - -static int drm_name_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - char buf[128]; - int error; - - if (dev->unique) { - DRM_SYSCTL_PRINT("%s 0x%x %s\n", - dev->name, dev2udev(dev->devnode), dev->unique); - } else { - DRM_SYSCTL_PRINT("%s 0x%x\n", dev->name, dev2udev(dev->devnode)); - } - - SYSCTL_OUT(req, "", 1); - - return 0; -} - -static int _drm_vm_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - drm_map_t *map; - const char *types[] = { "FB", "REG", "SHM", "AGP" }; - const char *type; - int i; - char buf[128]; - int error; - - DRM_SYSCTL_PRINT("slot offset size type flags " - "address mtrr\n\n"); - error = SYSCTL_OUT(req, buf, strlen(buf)); - if (error) return error; - - 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_SYSCTL_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_SYSCTL_PRINT("none\n"); - } else { - DRM_SYSCTL_PRINT("%4d\n", map->mtrr); - } - } - SYSCTL_OUT(req, "", 1); - - return 0; -} - -static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - int ret; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - ret = _drm_vm_info(oidp, arg1, arg2, req); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - return ret; -} - - -static int _drm_queues_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - int i; - drm_queue_t *q; - char buf[128]; - int error; - - DRM_SYSCTL_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_SYSCTL_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' : '-', - q->read_queue ? 'r':'-', - q->write_queue ? 'w':'-', - 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); - } - - SYSCTL_OUT(req, "", 1); - return 0; -} - -static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - int ret; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - ret = _drm_queues_info(oidp, arg1, arg2, req); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - return ret; -} - -/* drm_bufs_info is called whenever a process reads - hw.dri.0.bufs. */ - -static int _drm_bufs_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - drm_device_dma_t *dma = dev->dma; - int i; - char buf[128]; - int error; - - if (!dma) return 0; - DRM_SYSCTL_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_SYSCTL_PRINT("%2d %8d %5d %5d %5d %5d %5d\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_SYSCTL_PRINT("\n"); - for (i = 0; i < dma->buf_count; i++) { - if (i && !(i%32)) DRM_SYSCTL_PRINT("\n"); - DRM_SYSCTL_PRINT(" %d", dma->buflist[i]->list); - } - DRM_SYSCTL_PRINT("\n"); - - SYSCTL_OUT(req, "", 1); - return 0; -} - -static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - int ret; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - ret = _drm_bufs_info(oidp, arg1, arg2, req); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - return ret; -} - - -static int _drm_clients_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - drm_file_t *priv; - char buf[128]; - int error; - - DRM_SYSCTL_PRINT("a dev pid uid magic ioctls\n\n"); - TAILQ_FOREACH(priv, &dev->files, link) { - DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n", - priv->authenticated ? 'y' : 'n', - priv->minor, - priv->pid, - priv->uid, - priv->magic, - priv->ioctl_count); - } - - SYSCTL_OUT(req, "", 1); - return 0; -} - -static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - int ret; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - ret = _drm_clients_info(oidp, arg1, arg2, req); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - return ret; -} - -#if DRM_DEBUG_CODExx - -static int _drm_vma_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - drm_vma_entry_t *pt; - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; - unsigned long i; - struct vm_area_struct *vma; - unsigned long address; -#if defined(__i386__) - unsigned int pgprot; -#endif - char buf[128]; - int error; - - DRM_SYSCTL_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_SYSCTL_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' : '-', - vma->vm_offset ); -#if defined(__i386__) - pgprot = pgprot_val(vma->vm_page_prot); - DRM_SYSCTL_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_4M ? 'm' : 'k', - pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); -#endif - DRM_SYSCTL_PRINT("\n"); - 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_SYSCTL_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_SYSCTL_PRINT(" 0x%08lx\n", i); - } - } - } - - SYSCTL_OUT(req, "", 1); - return 0; -} - -static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - int ret; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - ret = _drm_vma_info(oidp, arg1, arg2, req); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - return ret; -} -#endif - - -#if DRM_DMA_HISTOGRAM -static int _drm_histo_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - 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; - char buf[128]; - int error; - - DRM_SYSCTL_PRINT("general statistics:\n"); - DRM_SYSCTL_PRINT("total %10u\n", atomic_read(&dev->histo.total)); - DRM_SYSCTL_PRINT("open %10u\n", atomic_read(&dev->total_open)); - DRM_SYSCTL_PRINT("close %10u\n", atomic_read(&dev->total_close)); - DRM_SYSCTL_PRINT("ioctl %10u\n", atomic_read(&dev->total_ioctl)); - DRM_SYSCTL_PRINT("irq %10u\n", atomic_read(&dev->total_irq)); - DRM_SYSCTL_PRINT("ctx %10u\n", atomic_read(&dev->total_ctx)); - - DRM_SYSCTL_PRINT("\nlock statistics:\n"); - DRM_SYSCTL_PRINT("locks %10u\n", atomic_read(&dev->total_locks)); - DRM_SYSCTL_PRINT("unlocks %10u\n", atomic_read(&dev->total_unlocks)); - DRM_SYSCTL_PRINT("contends %10u\n", atomic_read(&dev->total_contends)); - DRM_SYSCTL_PRINT("sleeps %10u\n", atomic_read(&dev->total_sleeps)); - - - if (dma) { - DRM_SYSCTL_PRINT("\ndma statistics:\n"); - DRM_SYSCTL_PRINT("prio %10u\n", - atomic_read(&dma->total_prio)); - DRM_SYSCTL_PRINT("bytes %10u\n", - atomic_read(&dma->total_bytes)); - DRM_SYSCTL_PRINT("dmas %10u\n", - atomic_read(&dma->total_dmas)); - DRM_SYSCTL_PRINT("missed:\n"); - DRM_SYSCTL_PRINT(" dma %10u\n", - atomic_read(&dma->total_missed_dma)); - DRM_SYSCTL_PRINT(" lock %10u\n", - atomic_read(&dma->total_missed_lock)); - DRM_SYSCTL_PRINT(" free %10u\n", - atomic_read(&dma->total_missed_free)); - DRM_SYSCTL_PRINT(" sched %10u\n", - atomic_read(&dma->total_missed_sched)); - DRM_SYSCTL_PRINT("tried %10u\n", - atomic_read(&dma->total_tried)); - DRM_SYSCTL_PRINT("hit %10u\n", - atomic_read(&dma->total_hit)); - DRM_SYSCTL_PRINT("lost %10u\n", - atomic_read(&dma->total_lost)); - - buffer = dma->next_buffer; - if (buffer) { - DRM_SYSCTL_PRINT("next_buffer %7d\n", buffer->idx); - } else { - DRM_SYSCTL_PRINT("next_buffer none\n"); - } - buffer = dma->this_buffer; - if (buffer) { - DRM_SYSCTL_PRINT("this_buffer %7d\n", buffer->idx); - } else { - DRM_SYSCTL_PRINT("this_buffer none\n"); - } - } - - - DRM_SYSCTL_PRINT("\nvalues:\n"); - if (dev->lock.hw_lock) { - DRM_SYSCTL_PRINT("lock 0x%08x\n", - dev->lock.hw_lock->lock); - } else { - DRM_SYSCTL_PRINT("lock none\n"); - } - 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); - DRM_SYSCTL_PRINT("last_switch %10u\n", dev->last_switch); - DRM_SYSCTL_PRINT("last_checked %10d\n", dev->last_checked); - - - DRM_SYSCTL_PRINT("\n q2d d2c c2f" - " q2c q2f dma sch" - " ctx lacq lhld\n\n"); - for (i = 0; i < DRM_DMA_HISTOGRAM_SLOTS; i++) { - DRM_SYSCTL_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); - } - SYSCTL_OUT(req, "", 1); - return 0; -} - -static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS -{ - drm_device_t *dev = arg1; - int ret; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - ret = _drm_histo_info(oidp, arg1, arg2, req); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - return ret; -} -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/vm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/vm.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/vm.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/vm.c:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/vm.c Fri Jan 18 15:25:59 2002 @@ -1,104 +0,0 @@ -/* vm.c -- Memory mapping for DRM -*- 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" - -#include <vm/vm.h> -#include <vm/pmap.h> - -static int drm_dma_mmap(dev_t kdev, vm_offset_t offset, int prot) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - unsigned long physical; - unsigned long page; - - if (!dma) return -1; /* Error */ - if (!dma->pagelist) return -1; /* Nothing allocated */ - - page = offset >> PAGE_SHIFT; - physical = dma->pagelist[page]; - - DRM_DEBUG("0x%08x (page %lu) => 0x%08lx\n", offset, page, physical); - return atop(physical); -} - -int drm_mmap(dev_t kdev, vm_offset_t offset, int prot) -{ - drm_device_t *dev = kdev->si_drv1; - drm_map_t *map = NULL; - int i; - - /* DRM_DEBUG("offset = 0x%x\n", offset); */ - - if (dev->dma - && offset >= 0 - && offset < ptoa(dev->dma->page_count)) - return drm_dma_mmap(kdev, offset, prot); - - /* 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]; - /* DRM_DEBUG("considering 0x%x..0x%x\n", map->offset, map->offset + map->size - 1); */ - if (offset >= map->offset - && offset < map->offset + map->size) break; - } - - if (i >= dev->map_count) { - DRM_DEBUG("can't find map\n"); - return -1; - } - if (!map || ((map->flags&_DRM_RESTRICTED) && suser(curproc))) { - DRM_DEBUG("restricted map\n"); - return -1; - } - - switch (map->type) { - case _DRM_FRAME_BUFFER: - case _DRM_REGISTERS: - case _DRM_AGP: - return atop(offset); - case _DRM_SHM: - return atop(vtophys(offset)); - default: - return -1; /* This should never happen. */ - } - DRM_DEBUG("bailing out\n"); - - return -1; -} 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.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile:1.2 Tue Mar 6 11:45:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile Wed Dec 12 19:24:49 2001 @@ -1,15 +1,25 @@ # $FreeBSD$ KMOD = gamma +NOMAN= YES SRCS = gamma_drv.c gamma_dma.c -SRCS += device_if.h bus_if.h pci_if.h +SRCS += device_if.h bus_if.h pci_if.h opt_drm_linux.h CFLAGS += ${DEBUG_FLAGS} -I. -I.. -KMODDEPS = drm @: ln -sf /sys @ machine: ln -sf /sys/i386/include machine + +.if ${MACHINE_ARCH} == "i386" +# This line enables linux ioctl handling +# If you want support for this uncomment this line +#TDFX_OPTS= "\#define DRM_LINUX" 1 +.endif + +opt_drm_linux.h: + touch opt_drm_linux.h + echo $(TDFX_OPTS) >> opt_drm_linux.h .include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma.h:1.1 --- /dev/null Fri Jan 18 15:25:59 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma.h Wed Dec 12 19:24:49 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/bsd/drm/kernel/gamma/gamma_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_dma.c Wed Dec 12 19:24:49 2001 @@ -1,4 +1,4 @@ -/* gamma_dma.c -- DMA support for GMX 2000 -*- c -*- +/* gamma_dma.c -- DMA support for GMX 2000 -*- linux-c -*- * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -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,77 +23,36 @@ * OTHER LIABILITY, WHETHER IN AN ACTION 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 <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> -#include <vm/vm.h> -#include <vm/pmap.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, - vm_offset_t address, - vm_size_t length) +static __inline__ void gamma_dma_dispatch(drm_device_t *dev, unsigned long address, + unsigned long length) { - GAMMA_WRITE(GAMMA_DMAADDRESS, vtophys(address)); + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + + GAMMA_WRITE(GAMMA_DMAADDRESS, DRM_OS_VTOPHYS((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) @@ -101,15 +60,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) @@ -119,7 +81,7 @@ GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); GAMMA_WRITE(GAMMA_SYNC, 0); - + /* Read from first MX */ do { while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)) @@ -133,43 +95,43 @@ } 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) +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(void *arg) +void gamma_dma_service( DRM_OS_IRQ_ARGS) { - drm_device_t *dev = (drm_device_t *)arg; - 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); -#if 0 - /* Dispatch new buffer */ - queue_task(&dev->tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); -#endif } } @@ -182,22 +144,19 @@ int retcode = 0; drm_device_dma_t *dma = dev->dma; #if DRM_DMA_HISTOGRAM - struct timespec dma_start, dma_stop; + 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)) DRM_OS_RETURN( EBUSY ); + #if DRM_DMA_HISTOGRAM - getnanotime(&dma_start); + dma_start = get_cycles(); #endif if (!dma->next_buffer) { DRM_ERROR("No next_buffer\n"); clear_bit(0, &dev->dma_flag); - return EINVAL; + DRM_OS_RETURN( EINVAL ); } buf = dma->next_buffer; @@ -208,23 +167,23 @@ 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; + DRM_OS_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; + DRM_OS_RETURN( EBUSY ); } if (buf->while_locked) { @@ -234,11 +193,10 @@ 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; + DRM_OS_RETURN( EBUSY ); } } @@ -246,13 +204,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. @@ -260,23 +219,23 @@ TIME! */ } - drm_clear_next_buffer(dev); + gamma_clear_next_buffer(dev); buf->pending = 1; buf->waiting = 0; buf->list = DRM_LIST_PEND; #if DRM_DMA_HISTOGRAM - getnanotime(&buf->time_dispatched); + buf->time_dispatched = get_cycles(); #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"); } @@ -286,15 +245,19 @@ clear_bit(0, &dev->dma_flag); #if DRM_DMA_HISTOGRAM - getnanotime(&dma_stop); - timespecsub(&dma_stop, &dma_start); - atomic_inc(&dev->histo.ctx[drm_histogram_slot(&dma_stop)]); + dma_stop = get_cycles(); + atomic_inc(&dev->histo.dma[gamma_histogram_slot(dma_stop - dma_start)]); #endif - return retcode; + DRM_OS_RETURN( retcode ); +} + +static void gamma_dma_timer_bh(unsigned long dev) +{ + gamma_dma_schedule((drm_device_t *)dev, 0); } -static void gamma_dma_schedule_wrapper(void *dev) +void gamma_dma_immediate_bh(DRM_OS_TASKQUEUE_ARGS) { gamma_dma_schedule(dev, 0); } @@ -310,24 +273,24 @@ int expire = 20; drm_device_dma_t *dma = dev->dma; #if DRM_DMA_HISTOGRAM - struct timespec schedule_start; + cycles_t schedule_start; #endif if (test_and_set_bit(0, &dev->interrupt_flag)) { /* Not reentrant */ - atomic_inc(&dma->total_missed_sched); - return EBUSY; + atomic_inc(&dev->counts[10]); /* _DRM_STAT_MISSED */ + DRM_OS_RETURN( EBUSY ); } - missed = atomic_read(&dma->total_missed_sched); + missed = atomic_read(&dev->counts[10]); #if DRM_DMA_HISTOGRAM - getnanotime(&schedule_start); + schedule_start = get_cycles(); #endif again: if (dev->context_flag) { clear_bit(0, &dev->interrupt_flag); - return EBUSY; + DRM_OS_RETURN( EBUSY ); } if (dma->next_buffer) { /* Unsent buffer that was previously @@ -335,23 +298,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_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); @@ -363,33 +321,26 @@ } 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 - { - struct timespec ts; - getnanotime(&ts); - timespecsub(&ts, &schedule_start); - atomic_inc(&dev->histo.schedule[drm_histogram_slot(&ts)]); - } + atomic_inc(&dev->histo.schedule[gamma_histogram_slot(get_cycles() + - schedule_start)]); #endif return retcode; } static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d) { - struct proc *p = curproc; unsigned long address; unsigned long length; int must_free = 0; @@ -399,7 +350,7 @@ drm_buf_t *buf; drm_buf_t *last_buf = NULL; drm_device_dma_t *dma = dev->dma; - static int never; + static int never; /* Turn off interrupt handling */ while (test_and_set_bit(0, &dev->interrupt_flag)) { @@ -408,7 +359,7 @@ return retcode; } 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)) { retcode = tsleep(&never, PZERO|PCATCH, "gamp2", 1); if (retcode) @@ -416,7 +367,6 @@ } ++must_free; } - atomic_inc(&dma->total_prio); for (i = 0; i < d->send_count; i++) { idx = d->send_indices[i]; @@ -426,15 +376,15 @@ continue; } buf = dma->buflist[ idx ]; - if (buf->pid != p->p_pid) { + if (buf->pid != DRM_OS_CURRENTPID) { DRM_ERROR("Process %d using buffer owned by %d\n", - p->p_pid, buf->pid); + DRM_OS_CURRENTPID, buf->pid); retcode = EINVAL; goto cleanup; } if (buf->list != DRM_LIST_NONE) { DRM_ERROR("Process %d using %d's buffer on list %d\n", - p->p_pid, buf->pid, buf->list); + DRM_OS_CURRENTPID, buf->pid, buf->list); retcode = EINVAL; goto cleanup; } @@ -467,14 +417,13 @@ goto cleanup; } buf->pending = 1; - + if (dev->last_context != buf->context && !(dev->queuelist[buf->context]->flags & _DRM_CONTEXT_PRESERVED)) { - atomic_inc(&dev->context_wait); - /* PRE: dev->last_context != buf->context */ - drm_context_switch(dev, dev->last_context, - buf->context); + /* PRE: 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. @@ -482,7 +431,6 @@ TIME! */ retcode = tsleep(&dev->context_wait, PZERO|PCATCH, "gamctx", 0); - atomic_dec(&dev->context_wait); if (retcode) goto cleanup; if (dev->last_context != buf->context) { @@ -493,15 +441,15 @@ } #if DRM_DMA_HISTOGRAM - getnanotime(&buf->time_queued); + buf->time_queued = get_cycles(); 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; } @@ -510,40 +458,40 @@ 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"); } } clear_bit(0, &dev->interrupt_flag); - return retcode; + DRM_OS_RETURN( retcode ); } static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d) { - struct proc *p = curproc; drm_buf_t *last_buf = NULL; int retcode = 0; drm_device_dma_t *dma = dev->dma; - - if ((retcode = drm_dma_enqueue(dev, d))) { - return retcode; - } - - gamma_dma_schedule(dev, 0); - if (d->flags & _DRM_DMA_BLOCK) { last_buf = dma->buflist[d->send_indices[d->send_count-1]]; atomic_inc(&last_buf->dma_wait); } + if ((retcode = gamma_dma_enqueue(dev, d))) { + if (d->flags & _DRM_DMA_BLOCK) + atomic_dec(&last_buf->dma_wait); + return retcode; + } + + gamma_dma_schedule(dev, 0); + if (d->flags & _DRM_DMA_BLOCK) { - DRM_DEBUG("%d waiting\n", p->p_pid); + DRM_DEBUG("%d waiting\n", DRM_OS_CURRENTPID); for (;;) { retcode = tsleep(&last_buf->dma_wait, PZERO|PCATCH, "gamdw", 0); @@ -553,13 +501,12 @@ if (retcode) break; } - - DRM_DEBUG("%d running\n", p->p_pid); atomic_dec(&last_buf->dma_wait); + DRM_DEBUG("%d running\n", DRM_OS_CURRENTPID); if (!retcode || (last_buf->list==DRM_LIST_PEND && !last_buf->pending)) { if (!last_buf->dma_wait) { - drm_free_buffer(dev, last_buf); + gamma_free_buffer(dev, last_buf); } } if (retcode) { @@ -571,254 +518,49 @@ last_buf->idx, last_buf->list, last_buf->pid, - p->p_pid); + DRM_OS_CURRENTPID); } } - return retcode; + DRM_OS_RETURN( retcode ); } -int gamma_dma(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) +int gamma_dma( DRM_OS_IOCTL ) { - drm_device_t *dev = kdev->si_drv1; + DRM_OS_DEVICE; drm_device_dma_t *dma = dev->dma; int retcode = 0; drm_dma_t d; - d = *(drm_dma_t *) data; - DRM_DEBUG("%d %d: %d send, %d req\n", - p->p_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", - p->p_pid, d.context); - return EINVAL; - } + DRM_OS_KRNFROMUSR(d, (drm_dma_t *) data, sizeof(d)); + if (d.send_count < 0 || d.send_count > dma->buf_count) { DRM_ERROR("Process %d trying to send %d buffers (of %d max)\n", - p->p_pid, d.send_count, dma->buf_count); - return EINVAL; + DRM_OS_CURRENTPID, d.send_count, dma->buf_count); + DRM_OS_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", - p->p_pid, d.request_count, dma->buf_count); - return EINVAL; + DRM_OS_CURRENTPID, d.request_count, dma->buf_count); + DRM_OS_RETURN( EINVAL ); } 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", - p->p_pid, d.granted_count); - *(drm_dma_t *) data = d; + DRM_OS_CURRENTPID, d.granted_count); + DRM_OS_KRNTOUSR((drm_dma_t *) data, d, sizeof(d)); return retcode; -} - -int gamma_irq_install(drm_device_t *dev, int irq) -{ - int rid; - int retcode; - - if (!irq) return EINVAL; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - if (dev->irq) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - return EBUSY; - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - 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; - -#if 0 - dev->tq.next = NULL; - dev->tq.sync = 0; - dev->tq.routine = gamma_dma_schedule_tq_wrapper; - dev->tq.data = dev; -#endif - /* Before installing handler */ - GAMMA_WRITE(GAMMA_GCOMMANDMODE, 0); - GAMMA_WRITE(GAMMA_GDMACONTROL, 0); - - /* Install handler */ - rid = 0; - dev->irq = bus_alloc_resource(dev->device, SYS_RES_IRQ, &rid, - 0, ~0, 1, RF_SHAREABLE); - if (!dev->irq) - return ENOENT; - - retcode = bus_setup_intr(dev->device, dev->irq, INTR_TYPE_TTY, - gamma_dma_service, dev, &dev->irqh); - if (retcode) { - bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irq); - dev->irq = 0; - 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) -{ - if (!dev->irq) - return EINVAL; - - DRM_DEBUG("%ld\n", rman_get_start(dev->irq)); - - GAMMA_WRITE(GAMMA_GDELAYTIMER, 0); - GAMMA_WRITE(GAMMA_COMMANDINTENABLE, 0); - GAMMA_WRITE(GAMMA_GINTENABLE, 0); - - bus_teardown_intr(dev->device, dev->irq, dev->irqh); - bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irq); - dev->irq = 0; - - return 0; -} - - -int gamma_control(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_control_t ctl; - int retcode; - - ctl = *(drm_control_t *) data; - - 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(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - int ret = 0; - drm_lock_t lock; - drm_queue_t *q; -#if DRM_DMA_HISTOGRAM - struct timespec start; - - getnanotime(&start); - dev->lck_start = start; -#endif - - lock = *(drm_lock_t *) data; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - p->p_pid, lock.context); - return EINVAL; - } - - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, p->p_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 = ticks - dev->lock.lock_time; - - if (j > 0 && j <= DRM_LOCK_SLICE) { - /* Can't take lock if we just had it and - there is contention. */ - static int never; - ret = tsleep(&never, PZERO|PCATCH, - "gaml1", j); - if (ret) - return ret; - } - } - atomic_inc(&dev->lock.lock_queue); - for (;;) { - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = p->p_pid; - dev->lock.lock_time = ticks; - atomic_inc(&dev->total_locks); - atomic_inc(&q->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); - ret = tsleep(&dev->lock.lock_queue, PZERO|PCATCH, - "gaml2", 0); - if (ret) - break; - } - atomic_dec(&dev->lock.lock_queue); - } - - drm_flush_unblock(dev, lock.context, lock.flags); /* cleanup phase */ - - if (!ret) { - 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 - { - struct timespec ts; - getnanotime(&ts); - timespecsub(&ts, &start); - atomic_inc(&dev->histo.lacq[drm_histogram_slot(&ts)]); - } -#endif - - return ret; } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.c Wed Dec 12 19:24:49 2001 @@ -1,4 +1,4 @@ -/* gamma.c -- 3dlabs GMX 2000 driver -*- c -*- +/* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*- * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -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,607 +23,65 @@ * OTHER LIABILITY, WHETHER IN AN ACTION 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> */ +#include <sys/types.h> +#include <sys/bus.h> +#include <pci/pcivar.h> +#include <opt_drm_linux.h> +#include "gamma.h" #include "drmP.h" #include "gamma_drv.h" -#include <pci/pcivar.h> +#define DRIVER_AUTHOR "VA Linux Systems Inc." -MODULE_DEPEND(gamma, drm, 1, 1, 1); +#define DRIVER_NAME "gamma" +#define DRIVER_DESC "3DLabs gamma" +#define DRIVER_DATE "20010216" -#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 -#ifndef PCI_VENDOR_ID_3DLABS -#define PCI_VENDOR_ID_3DLABS 0x3d3d -#endif - -static int gamma_init(device_t nbdev); -static void gamma_cleanup(device_t nbdev); - -static int gamma_probe(device_t dev) -{ - const char *s = 0; - - switch (pci_get_devid(dev)) { - case 0x00083d3d: - s = "3D Labs Gamma graphics accelerator"; - break; - - case 0x00063d3d: - s = "3D Labs MX graphics accelerator"; - break; - } - - if (s) { - device_set_desc(dev, s); - return 0; - } - - return ENXIO; -} - -static int gamma_attach(device_t dev) -{ - gamma_init(dev); - return 0; -} - -static int gamma_detach(device_t dev) -{ - gamma_cleanup(dev); - return 0; -} - -static device_method_t gamma_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, gamma_probe), - DEVMETHOD(device_attach, gamma_attach), - DEVMETHOD(device_detach, gamma_detach), +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 - { 0, 0 } -}; - -static driver_t gamma_driver = { - "drm", - gamma_methods, - sizeof(drm_device_t), -}; +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 } -static devclass_t gamma_devclass; -#define GAMMA_SOFTC(unit) \ - ((drm_device_t *) devclass_get_softc(gamma_devclass, unit)) - -DRIVER_MODULE(if_gamma, pci, gamma_driver, gamma_devclass, 0, 0); - -#define GAMMA_NAME "gamma" -#define GAMMA_DESC "3dlabs GMX 2000" -#define GAMMA_DATE "20000606" -#define GAMMA_MAJOR 1 -#define GAMMA_MINOR 0 -#define GAMMA_PATCHLEVEL 0 - -#define CDEV_MAJOR 200 - -static struct cdevsw gamma_cdevsw = { - /* open */ gamma_open, - /* close */ gamma_close, - /* read */ drm_read, - /* write */ drm_write, - /* ioctl */ gamma_ioctl, - /* poll */ nopoll, - /* mmap */ drm_mmap, - /* strategy */ nostrategy, - /* name */ "gamma", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_TRACKCLOSE, - /* bmaj */ -1 +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x3d3d, 0x0008, 1, "3DLabs Gamma"}, + {0, 0, 0, NULL} }; -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) -static int devices = 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_vm.h" +#include "drm_sysctl.h" -static int gamma_setup(drm_device_t *dev) -{ - int i; - - device_busy(dev->device); - - 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; - dev->lock.lock_queue = 0; - 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; - callout_init(&dev->timer); - dev->context_wait = 0; -#if DRM_DMA_HISTO - memset(&dev->histo, 0, sizeof(dev->histo)); -#endif - timespecclear(&dev->ctx_start); - timespecclear(&dev->lck_start); - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - dev->buf_sigio = NULL; - - 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); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - callout_stop(&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; - wakeup(&dev->lock.lock_queue); - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - device_unbusy(dev->device); - - return 0; -} - -int gamma_found(void) -{ - return devices; -} - -static int -gamma_find_devices(device_t dev) -{ - device_t *children, child; - int nchildren, i; - int count = 0; - - if (device_get_children(device_get_parent(dev), &children, &nchildren)) - return 0; - - for (i = 0; i < nchildren; i++) { - child = children[i]; - - if (pci_get_slot(dev) == pci_get_slot(child) && - pci_get_vendor(child) == PCI_VENDOR_ID_3DLABS && - pci_get_device(child) == PCI_DEVICE_ID_3DLABS_MX) { - count++; - } - } - free(children, M_TEMP); - - /* we don't currently support more than two */ - if (count > 2) count = 2; - - return count; -} - -/* gamma_init is called via gamma_attach at module load time */ - -static int -gamma_init(device_t nbdev) -{ - drm_device_t *dev = device_get_softc(nbdev); - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - simple_lock_init(&dev->count_lock); - lockinit(&dev->dev_lock, PZERO, "drmlk", 0, 0); - -#if 0 /* XXX use getenv I guess */ - drm_parse_options(gamma); -#endif - devices = gamma_find_devices(nbdev); - if (devices == 0) return -1; - -#if 0 - if ((retcode = misc_register(&gamma_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", GAMMA_NAME); - return retcode; - } -#endif - dev->device = nbdev; - dev->devnode = make_dev(&gamma_cdevsw, - device_get_unit(nbdev), - DRM_DEV_UID, - DRM_DEV_GID, - DRM_DEV_MODE, - GAMMA_NAME); - dev->name = GAMMA_NAME; - - drm_mem_init(); - drm_sysctl_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, - device_get_unit(nbdev), - devices); - - return 0; -} - -/* gamma_cleanup is called via gamma_detach at module unload time. */ - -static void -gamma_cleanup(device_t nbdev) -{ - drm_device_t *dev = device_get_softc(nbdev); - - DRM_DEBUG("\n"); - - drm_sysctl_cleanup(dev); -#if 0 - if (misc_deregister(&gamma_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } -#endif - device_busy(dev->device); - gamma_takedown(dev); -} - -SYSUNINIT(gamma_cleanup, SI_SUB_DRIVERS, SI_ORDER_ANY, gamma_cleanup, 0); - -#if 0 -int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - copy_from_user_ret(&version, - (drm_version_t *)arg, - sizeof(version), - -EFAULT); - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - copy_to_user_ret(name, value, len, -EFAULT); \ - } - - version.version_major = 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); - - copy_to_user_ret((drm_version_t *)arg, - &version, - sizeof(version), - -EFAULT); - return 0; -} -#endif - -int -gamma_open(dev_t kdev, int flags, int fmt, struct proc *p) -{ - drm_device_t *dev = GAMMA_SOFTC(minor(kdev)); - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - - device_busy(dev->device); - if (!(retcode = drm_open_helper(kdev, flags, fmt, p, dev))) { - atomic_inc(&dev->total_open); - simple_lock(&dev->count_lock); - if (!dev->open_count++) { - simple_unlock(&dev->count_lock); - retcode = gamma_setup(dev); - } - simple_unlock(&dev->count_lock); - } - device_unbusy(dev->device); - - return retcode; -} - -int -gamma_close(dev_t kdev, int flags, int fmt, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_close(kdev, flags, fmt, p))) { - atomic_inc(&dev->total_close); - simple_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); - simple_unlock(&dev->count_lock); - return EBUSY; - } - simple_unlock(&dev->count_lock); - return gamma_takedown(dev); - } - simple_unlock(&dev->count_lock); - } - return retcode; -} - -/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int -gamma_ioctl(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_device_t *dev = kdev->si_drv1; - drm_file_t *priv; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - d_ioctl_t *func; - - priv = drm_find_file_by_proc(dev, p); - if (!priv) { - DRM_DEBUG("can't find authenticator\n"); - return EINVAL; - } - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - - DRM_DEBUG("pid = %d, cmd = 0x%02lx, nr = 0x%02x, auth = %d\n", - p->p_pid, cmd, nr, priv->authenticated); - - switch (cmd) { - case FIOSETOWN: - return fsetown(*(int *)data, &dev->buf_sigio); - - case FIOGETOWN: - *(int *) data = fgetown(dev->buf_sigio); - return 0; - } - - 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 && suser(p)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = EACCES; - } else { - retcode = (func)(kdev, cmd, data, flags, p); - } - } - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -int gamma_unlock(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_lock_t *lockp = (drm_lock_t *) data; - - if (lockp->context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - p->p_pid, lockp->context); - return -EINVAL; - } - - DRM_DEBUG("%d frees lock (%d holds)\n", - lockp->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 - { - struct timespec ts; - getnanotime(&ts); - timespecsub(&ts, &dev->lck_start); - atomic_inc(&dev->histo.lhld[drm_histogram_slot(&ts)]); - } -#endif - - return 0; -} +DRIVER_MODULE(gamma, pci, gamma_driver, gamma_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/gamma_drv.h Wed Dec 12 19:24:49 2001 @@ -1,4 +1,4 @@ -/* gamma_drv.h -- Private header for 3dlabs GMX 2000 driver -*- c -*- +/* gamma_drv.h -- Private header for 3dlabs GMX 2000 driver -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -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,26 +23,82 @@ * OTHER LIABILITY, WHETHER IN AN ACTION 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_ + + +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; - /* gamma_drv.c */ -extern d_open_t gamma_open; -extern d_close_t gamma_close; -extern d_ioctl_t gamma_ioctl; -extern d_ioctl_t gamma_version; -extern d_ioctl_t gamma_dma; -extern d_ioctl_t gamma_lock; -extern d_ioctl_t gamma_unlock; -extern d_ioctl_t gamma_control; +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != DRM_OS_CURRENTPID ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + DRM_OS_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_irq_install(drm_device_t *dev, int irq); -extern int gamma_irq_uninstall(drm_device_t *dev); +extern int gamma_dma( DRM_OS_IOCTL ); +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/bsd/drm/kernel/i810/Makefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/Makefile:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/Makefile Wed Dec 12 19:24:49 2001 @@ -0,0 +1,25 @@ +# $FreeBSD$ + +KMOD= i810 +NOMAN= YES +SRCS= i810_drv.c i810_dma.c +SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h +CFLAGS+= ${DEBUG_FLAGS} -I. -I.. + +@: + ln -sf /sys @ + +machine: + ln -sf /sys/i386/include machine + +.if ${MACHINE_ARCH} == "i386" +# This line enables linux ioctl handling +# If you want support for this uncomment this line +#I810_OPTS= "\#define DRM_LINUX" 1 +.endif + +opt_drm_linux.h: + touch opt_drm_linux.h + echo $(I810_OPTS) >> opt_drm_linux.h + +.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810.h:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810.h Wed Dec 12 19:24:49 2001 @@ -0,0 +1,116 @@ +/* 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 __HAVE_SHARED_IRQ 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; \ + if ( dev_priv ) { \ + 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/bsd/drm/kernel/i810/i810_dma.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_dma.c:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_dma.c Wed Dec 12 19:24:49 2001 @@ -0,0 +1,1220 @@ +/* i810_dma.c -- DMA support for the i810 -*- linux-c -*- + * Created: Mon Dec 13 01:50:01 1999 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> + * Keith Whitwell <keithw@valinux.com> + * + */ + + +#include "i810.h" +#include "drmP.h" +#include "i810_drv.h" + +#define I810_BUF_FREE 2 +#define I810_BUF_CLIENT 1 +#define I810_BUF_HARDWARE 0 + +#define I810_BUF_UNMAPPED 0 +#define I810_BUF_MAPPED 1 + +#define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; + +#define BEGIN_LP_RING(n) do { \ + if (I810_VERBOSE) \ + DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", \ + n, __FUNCTION__); \ + if (dev_priv->ring.space < n*4) \ + i810_wait_ring(dev, n*4); \ + dev_priv->ring.space -= n*4; \ + outring = dev_priv->ring.tail; \ + ringmask = dev_priv->ring.tail_mask; \ + virt = dev_priv->ring.virtual_start; \ +} while (0) + +#define ADVANCE_LP_RING() do { \ + if (I810_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ + dev_priv->ring.tail = outring; \ + I810_WRITE(LP_RING + RING_TAIL, outring); \ +} while(0) + +#define OUT_RING(n) do { \ + if (I810_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ + *(volatile unsigned int *)(virt + outring) = n; \ + outring += 4; \ + outring &= ringmask; \ +} while (0); + +static __inline__ void i810_print_status_page(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + drm_i810_private_t *dev_priv = dev->dev_private; + u32 *temp = (u32 *)dev_priv->hw_status_page; + int i; + + DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]); + DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]); + DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]); + DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]); + DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]); + for(i = 6; i < dma->buf_count + 6; i++) { + DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 6, temp[i]); + } +} + +static drm_buf_t *i810_freelist_get(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + int i; + char failed; + + /* 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 */ + _DRM_CAS(buf_priv->in_use, I810_BUF_FREE, I810_BUF_CLIENT, + failed); + if (!failed) + return buf; + } + return NULL; +} + +/* This should only be called if the buffer is not sent to the hardware + * yet, the hardware updates in use for us once its on the ring buffer. + */ + +static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf) +{ + drm_i810_buf_priv_t *buf_priv = buf->dev_private; + char failed; + + /* In use is already a pointer */ + _DRM_CAS(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE, failed); + if(failed) { + DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); + DRM_OS_RETURN( EINVAL ); + } + + return 0; +} + + +int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) +{ + DRM_OS_DEVICE; + drm_i810_private_t *dev_priv; + drm_buf_t *buf; + drm_i810_buf_priv_t *buf_priv; + + lock_kernel(); + 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(); + + if (remap_page_range(vma->vm_start, + VM_OFFSET(vma), + vma->vm_end - vma->vm_start, + vma->vm_page_prot)) DRM_OS_RETURN(EAGAIN); + return 0; +} + +static int i810_map_buffer(drm_buf_t *buf, struct file *filp) +{ + DRM_OS_DEVICE; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; + drm_i810_private_t *dev_priv = dev->dev_private; + struct file_operations *old_fops; + int retcode = 0; + + if(buf_priv->currently_mapped == I810_BUF_MAPPED) DRM_OS_RETURN(EINVAL); + + if(VM_DONTCOPY != 0) { +#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, + PROT_READ|PROT_WRITE, + MAP_SHARED, + buf->bus_address); + dev_priv->mmap_buffer = NULL; + filp->f_op = old_fops; + if ((unsigned long)buf_priv->virtual > -1024UL) { + /* Real error */ + DRM_DEBUG("mmap error\n"); + retcode = (signed int)buf_priv->virtual; + buf_priv->virtual = 0; + } +#if 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; + } + return retcode; +} + +static int i810_unmap_buffer(drm_buf_t *buf) +{ + drm_i810_buf_priv_t *buf_priv = buf->dev_private; + int retcode = 0; + + if(VM_DONTCOPY != 0) { + if(buf_priv->currently_mapped != I810_BUF_MAPPED) + DRM_OS_RETURN(EINVAL); +#if LINUX_VERSION_CODE <= 0x020402 + down( ¤t->mm->mmap_sem ); +#else + down_write( ¤t->mm->mmap_sem ); +#endif + retcode = do_munmap(current->mm, + (unsigned long)buf_priv->virtual, + (size_t) buf->total); +#if LINUX_VERSION_CODE <= 0x020402 + up( ¤t->mm->mmap_sem ); +#else + up_write( ¤t->mm->mmap_sem ); +#endif + } + buf_priv->currently_mapped = I810_BUF_UNMAPPED; + buf_priv->virtual = 0; + + return retcode; +} + +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; + drm_buf_t *buf; + drm_i810_buf_priv_t *buf_priv; + int retcode = 0; + + buf = i810_freelist_get(dev); + if (!buf) { + retcode = -ENOMEM; + DRM_DEBUG("retcode=%d\n", retcode); + DRM_OS_RETURN(retcode); + } + + retcode = i810_map_buffer(buf, filp); + if(retcode) { + i810_freelist_put(dev, buf); + DRM_DEBUG("mapbuf failed, retcode %d\n", retcode); + return retcode; + } + buf->pid = priv->pid; + buf_priv = buf->dev_private; + d->granted = 1; + d->request_idx = buf->idx; + d->request_size = buf->total; + d->virtual = buf_priv->virtual; + + return retcode; +} + +static unsigned long i810_alloc_page(drm_device_t *dev) +{ + unsigned long address; + + address = __get_free_page(GFP_KERNEL); + 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) + return; + + atomic_dec(&virt_to_page(page)->count); + clear_bit(PG_locked, &virt_to_page(page)->flags); + DRM_OS_WAKEUP(&virt_to_page(page)->wait); + free_page(page); + return; +} + +static int i810_dma_cleanup(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + + if(dev->dev_private) { + int i; + 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); + } + 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_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); + } + } + return 0; +} + +static int i810_wait_ring(drm_device_t *dev, int n) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_ring_buffer_t *ring = &(dev_priv->ring); + int iters = 0; + unsigned long end; + unsigned int last_head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; + + 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); + DRM_ERROR("lockup\n"); + goto out_wait_ring; + } + + for (i = 0 ; i < 2000 ; i++) ; + } + +out_wait_ring: + return iters; +} + +static void i810_kernel_lost_context(drm_device_t *dev) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_ring_buffer_t *ring = &(dev_priv->ring); + + ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; + ring->tail = I810_READ(LP_RING + RING_TAIL); + ring->space = ring->head - (ring->tail+8); + if (ring->space < 0) ring->space += ring->Size; +} + +static int i810_freelist_init(drm_device_t *dev, drm_i810_private_t *dev_priv) +{ + drm_device_dma_t *dma = dev->dma; + 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 */ + DRM_OS_RETURN(EINVAL); + } + + 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); + } + return 0; +} + +static int i810_dma_initialize(drm_device_t *dev, + drm_i810_private_t *dev_priv, + drm_i810_init_t *init) +{ + drm_map_list_entry_t *listentry; + + memset(dev_priv, 0, sizeof(drm_i810_private_t)); + + TAILQ_FOREACH(listentry, dev->maplist, link) { + drm_map_t *map = listentry->map; + if (map->type == _DRM_SHM && + map->flags & _DRM_CONTAINS_LOCK) { + dev_priv->sarea = map; + break; + } + } + + if(!dev_priv->sarea_map) { + dev->dev_private = (void *)dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("can not find sarea!\n"); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); + if(!dev_priv->mmio_map) { + dev->dev_private = (void *)dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("can not find mmio map!\n"); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); + if(!dev_priv->buffer_map) { + dev->dev_private = (void *)dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("can not find dma buffer map!\n"); + DRM_OS_RETURN(EINVAL); + } + + 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); + + if (dev_priv->ring.virtual_start == NULL) { + dev->dev_private = (void *) dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("can not ioremap virtual address for" + " ring buffer\n"); + DRM_OS_RETURN(ENOMEM); + } + + dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; + + dev_priv->w = init->w; + dev_priv->h = init->h; + dev_priv->pitch = init->pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->depth_offset = init->depth_offset; + + 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); + if(dev_priv->hw_status_page == 0UL) { + dev->dev_private = (void *)dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("Can not allocate hardware status page\n"); + DRM_OS_RETURN(ENOMEM); + } + memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); + 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, dev_priv) != 0) { + dev->dev_private = (void *)dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("Not enough space in the status page for" + " the freelist\n"); + DRM_OS_RETURN(ENOMEM); + } + dev->dev_private = (void *)dev_priv; + + return 0; +} + +int i810_dma_init( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_i810_private_t *dev_priv; + drm_i810_init_t init; + int retcode = 0; + + DRM_OS_KRNFROMUSR( init, (drm_i810_init_t *) data, sizeof(init) ); + + switch(init.func) { + case I810_INIT_DMA: + dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), + DRM_MEM_DRIVER); + if(dev_priv == NULL) DRM_OS_RETURN(ENOMEM); + retcode = i810_dma_initialize(dev, dev_priv, &init); + break; + case I810_CLEANUP_DMA: + retcode = i810_dma_cleanup(dev); + break; + default: + retcode = -EINVAL; + break; + } + + DRM_OS_RETURN(retcode); +} + + + +/* Most efficient way to verify state for the i810 is as it is + * emitted. Non-conformant state is silently dropped. + * + * 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 ) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + int i, j = 0; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( I810_CTX_SETUP_SIZE ); + + OUT_RING( GFX_OP_COLOR_FACTOR ); + OUT_RING( code[I810_CTXREG_CF1] ); + + OUT_RING( GFX_OP_STIPPLE ); + OUT_RING( code[I810_CTXREG_ST1] ); + + for ( i = 4 ; i < I810_CTX_SETUP_SIZE ; i++ ) { + tmp = code[i]; + + if ((tmp & (7<<29)) == (3<<29) && + (tmp & (0x1f<<24)) < (0x1d<<24)) + { + OUT_RING( tmp ); + j++; + } + } + + if (j & 1) + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + +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; + RING_LOCALS; + + BEGIN_LP_RING( I810_TEX_SETUP_SIZE ); + + OUT_RING( GFX_OP_MAP_INFO ); + OUT_RING( code[I810_TEXREG_MI1] ); + OUT_RING( code[I810_TEXREG_MI2] ); + OUT_RING( code[I810_TEXREG_MI3] ); + + for ( i = 4 ; i < I810_TEX_SETUP_SIZE ; i++ ) { + tmp = code[i]; + + if ((tmp & (7<<29)) == (3<<29) && + (tmp & (0x1f<<24)) < (0x1d<<24)) + { + OUT_RING( tmp ); + j++; + } + } + + if (j & 1) + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + + +/* Need to do some additional checking when setting the dest buffer. + */ +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; + + BEGIN_LP_RING( I810_DEST_SETUP_SIZE + 2 ); + + tmp = code[I810_DESTREG_DI1]; + if (tmp == dev_priv->front_di1 || tmp == dev_priv->back_di1) { + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( tmp ); + } else + DRM_DEBUG("bad di1 %x (allow %x or %x)\n", + tmp, dev_priv->front_di1, dev_priv->back_di1); + + /* invarient: + */ + OUT_RING( CMD_OP_Z_BUFFER_INFO ); + OUT_RING( dev_priv->zi1 ); + + OUT_RING( GFX_OP_DESTBUFFER_VARS ); + OUT_RING( code[I810_DESTREG_DV1] ); + + OUT_RING( GFX_OP_DRAWRECT_INFO ); + OUT_RING( code[I810_DESTREG_DR1] ); + OUT_RING( code[I810_DESTREG_DR2] ); + OUT_RING( code[I810_DESTREG_DR3] ); + OUT_RING( code[I810_DESTREG_DR4] ); + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + + + +static void i810EmitState( drm_device_t *dev ) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + + if (dirty & I810_UPLOAD_BUFFERS) { + i810EmitDestVerified( dev, sarea_priv->BufferState ); + sarea_priv->dirty &= ~I810_UPLOAD_BUFFERS; + } + + if (dirty & I810_UPLOAD_CTX) { + i810EmitContextVerified( dev, sarea_priv->ContextState ); + sarea_priv->dirty &= ~I810_UPLOAD_CTX; + } + + if (dirty & I810_UPLOAD_TEX0) { + i810EmitTexVerified( dev, sarea_priv->TexState[0] ); + sarea_priv->dirty &= ~I810_UPLOAD_TEX0; + } + + if (dirty & I810_UPLOAD_TEX1) { + i810EmitTexVerified( dev, sarea_priv->TexState[1] ); + sarea_priv->dirty &= ~I810_UPLOAD_TEX1; + } +} + + + +/* need to verify + */ +static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, + unsigned int clear_color, + unsigned int clear_zval ) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int pitch = dev_priv->pitch; + int cpp = 2; + int i; + RING_LOCALS; + + i810_kernel_lost_context(dev); + + if (nbox > I810_NR_SAREA_CLIPRECTS) + nbox = I810_NR_SAREA_CLIPRECTS; + + for (i = 0 ; i < nbox ; i++, pbox++) { + unsigned int x = pbox->x1; + unsigned int y = pbox->y1; + unsigned int width = (pbox->x2 - x) * cpp; + unsigned int height = pbox->y2 - y; + unsigned int start = y * pitch + x * cpp; + + if (pbox->x1 > pbox->x2 || + pbox->y1 > pbox->y2 || + pbox->x2 > dev_priv->w || + pbox->y2 > dev_priv->h) + continue; + + if ( flags & I810_FRONT ) { + DRM_DEBUG("clear front\n"); + 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 ); + OUT_RING( start ); + OUT_RING( clear_color ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + } + + if ( flags & I810_BACK ) { + DRM_DEBUG("clear back\n"); + 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 ); + OUT_RING( dev_priv->back_offset + start ); + OUT_RING( clear_color ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + } + + if ( flags & I810_DEPTH ) { + DRM_DEBUG("clear depth\n"); + 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 ); + OUT_RING( dev_priv->depth_offset + start ); + OUT_RING( clear_zval ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + } + } +} + +static void i810_dma_dispatch_swap( drm_device_t *dev ) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int pitch = dev_priv->pitch; + int cpp = 2; + int ofs = dev_priv->back_offset; + int i; + RING_LOCALS; + + DRM_DEBUG("swapbuffers\n"); + + i810_kernel_lost_context(dev); + + if (nbox > I810_NR_SAREA_CLIPRECTS) + nbox = I810_NR_SAREA_CLIPRECTS; + + for (i = 0 ; i < nbox; i++, pbox++) + { + unsigned int w = pbox->x2 - pbox->x1; + unsigned int h = pbox->y2 - pbox->y1; + unsigned int dst = pbox->x1*cpp + pbox->y1*pitch; + unsigned int start = ofs + dst; + + if (pbox->x1 > pbox->x2 || + pbox->y1 > pbox->y2 || + 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); + + BEGIN_LP_RING( 6 ); + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4 ); + OUT_RING( pitch | (0xCC << 16)); + OUT_RING( (h << 16) | (w * cpp)); + OUT_RING( dst ); + OUT_RING( pitch ); + OUT_RING( start ); + ADVANCE_LP_RING(); + } +} + + +static void i810_dma_dispatch_vertex(drm_device_t *dev, + drm_buf_t *buf, + int discard, + int used) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + 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; + int i = 0; + char failed; + RING_LOCALS; + + i810_kernel_lost_context(dev); + + if (nbox > I810_NR_SAREA_CLIPRECTS) + nbox = I810_NR_SAREA_CLIPRECTS; + + if (discard) { + _DRM_CAS(buf_priv->in_use, I810_BUF_CLIENT, + I810_BUF_HARDWARE, failed); + if (failed) + DRM_DEBUG("xxxx 2\n"); + } + + 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", + address, used, nbox); + + dev_priv->counter++; + DRM_DEBUG( "dispatch counter : %ld\n", dev_priv->counter); + DRM_DEBUG( "i810_dma_dispatch\n"); + DRM_DEBUG( "start : %lx\n", start); + DRM_DEBUG( "used : %d\n", used); + DRM_DEBUG( "start + used - 4 : %ld\n", start + used - 4); + + if (buf_priv->currently_mapped == I810_BUF_MAPPED) { + *(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; + } + + i810_unmap_buffer(buf); + } + + if (used) { + do { + if (i < nbox) { + BEGIN_LP_RING(4); + 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); + } + + BEGIN_LP_RING(10); + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( 20 ); + OUT_RING( dev_priv->counter ); + OUT_RING( 0 ); + + if (discard) { + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( buf_priv->my_use_idx ); + OUT_RING( I810_BUF_FREE ); + OUT_RING( 0 ); + } + + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); +} + + +/* Interrupts are only for flushing */ +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->counts[_DRM_STAT_IRQ]); + temp = I810_READ16(I810REG_INT_IDENTITY_R); + temp = temp & ~(0x6000); + 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); +} + +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; + + atomic_set(&dev_priv->flush_done, 1); + DRM_OS_WAKEUP_INT(&dev_priv->flush_queue); +} + +static inline void i810_dma_emit_flush(drm_device_t *dev) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + i810_kernel_lost_context(dev); + + BEGIN_LP_RING(2); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( GFX_OP_USER_INTERRUPT ); + ADVANCE_LP_RING(); + +/* i810_wait_ring( dev, dev_priv->ring.Size - 8 ); */ +/* atomic_set(&dev_priv->flush_done, 1); */ +/* DRM_OS_WAKEUP_INT(&dev_priv->flush_queue); */ +} + +static inline void i810_dma_quiescent_emit(drm_device_t *dev) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + i810_kernel_lost_context(dev); + + BEGIN_LP_RING(4); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + OUT_RING( GFX_OP_USER_INTERRUPT ); + ADVANCE_LP_RING(); + +/* i810_wait_ring( dev, dev_priv->ring.Size - 8 ); */ +/* atomic_set(&dev_priv->flush_done, 1); */ +/* DRM_OS_WAKEUP_INT(&dev_priv->flush_queue); */ +} + +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; + + if(dev_priv == NULL) { + return; + } + 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); + if (atomic_read(&dev_priv->flush_done) == 1) break; + 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; +} + +static int i810_flush_queue(drm_device_t *dev) +{ + DECLARE_WAITQUEUE(entry, current); + 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; + + if(dev_priv == NULL) { + return 0; + } + 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_emit_flush(dev); + if (atomic_read(&dev_priv->flush_done) == 1) break; + 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); + + + 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; + + char failed; + _DRM_CAS(buf_priv->in_use, I810_BUF_HARDWARE, + I810_BUF_FREE, failed); + + if (!failed) + DRM_DEBUG("reclaimed from HARDWARE\n"); + if (used == I810_BUF_CLIENT) + DRM_DEBUG("still on client HARDWARE\n"); + } + + return ret; +} + +/* Must be called with the lock held */ +void i810_reclaim_buffers(drm_device_t *dev, pid_t pid) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma) return; + if (!dev->dev_private) return; + if (!dma->buflist) return; + + i810_flush_queue(dev); + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; + + if (buf->pid == pid && buf_priv) { + char failed; + _DRM_CAS(buf_priv->in_use, I810_BUF_CLIENT, + I810_BUF_FREE, failed); + + if (!failed) + + DRM_DEBUG("reclaimed from client\n"); + if(buf_priv->currently_mapped == I810_BUF_MAPPED) + buf_priv->currently_mapped = I810_BUF_UNMAPPED; + } + } +} + +int i810_flush_ioctl( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + + 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"); + DRM_OS_RETURN( EINVAL ); + } + + i810_flush_queue(dev); + return 0; +} + + +int i810_dma_vertex( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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_vertex_t vertex; + + DRM_OS_KRNFROMUSR( vertex, (drm_i810_vertex_t *) data, sizeof(vertex) ); + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_dma_vertex called without lock held\n"); + DRM_OS_RETURN( EINVAL ); + } + + DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", + vertex.idx, vertex.used, vertex.discard); + + if(vertex.idx < 0 || vertex.idx > dma->buf_count) DRM_OS_RETURN(EINVAL); + + i810_dma_dispatch_vertex( dev, + dma->buflist[ vertex.idx ], + vertex.discard, vertex.used ); + + 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; +} + + + +int i810_clear_bufs( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_i810_clear_t clear; + + DRM_OS_KRNFROMUSR( clear, (drm_i810_clear_t *) data, sizeof(clear) ); + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_clear_bufs called without lock held\n"); + DRM_OS_RETURN( EINVAL ); + } + + /* GH: Someone's doing nasty things... */ + if (!dev->dev_private) { + DRM_OS_RETURN(EINVAL); + } + + i810_dma_dispatch_clear( dev, clear.flags, + clear.clear_color, + clear.clear_depth ); + return 0; +} + +int i810_swap_bufs( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + + DRM_DEBUG("i810_swap_bufs\n"); + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_swap_buf called without lock held\n"); + DRM_OS_RETURN( EINVAL ); + } + + i810_dma_dispatch_swap( dev ); + return 0; +} + +int i810_getage( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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; + + sarea_priv->last_dispatch = (int) hw_status[5]; + return 0; +} + +int i810_getbuf( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + int retcode = 0; + 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_DEBUG("getbuf\n"); + DRM_OS_KRNFROMUSR( d, (drm_i810_dma_t *) data, sizeof(d) ); + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_dma called without lock held\n"); + DRM_OS_RETURN( EINVAL ); + } + + d.granted = 0; + + retcode = i810_dma_get_buffer(dev, &d, filp); + + DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", + DRM_OS_CURRENTPID, retcode, d.granted); + + DRM_OS_KRNTOUSR( (drm_dma_t *) data, d, sizeof(d) ); + sarea_priv->last_dispatch = (int) hw_status[5]; + + DRM_OS_RETURN(retcode); +} + +int i810_copybuf( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_i810_copy_t d; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; + drm_buf_t *buf; + drm_i810_buf_priv_t *buf_priv; + drm_device_dma_t *dma = dev->dma; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_dma called without lock held\n"); + DRM_OS_RETURN( EINVAL ); + } + + DRM_OS_KRNFROMUSR( d, (drm_i810_copy_t *) data, sizeof(d) ); + + if(d.idx < 0 || d.idx > dma->buf_count) DRM_OS_RETURN(EINVAL); + buf = dma->buflist[ d.idx ]; + buf_priv = buf->dev_private; + if (buf_priv->currently_mapped != I810_BUF_MAPPED) DRM_OS_RETURN(EPERM); + if(d.used < 0 || d.used > buf->total) DRM_OS_RETURN(EINVAL); + + if (DRM_OS_COPYFROMUSR(buf_priv->virtual, d.address, d.used)) + DRM_OS_RETURN( EFAULT ); + + sarea_priv->last_dispatch = (int) hw_status[5]; + + return 0; +} + +int i810_docopy( DRM_OS_IOCTL ) +{ + if(VM_DONTCOPY == 0) return 1; + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.c:1.2 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.c Thu Dec 27 21:27:37 2001 @@ -0,0 +1,95 @@ +/* i810_drv.c -- I810 driver -*- linux-c -*- + * Created: Mon Dec 13 01:56:22 1999 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 + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + + +#include <sys/types.h> +#include <sys/bus.h> +#include <pci/pcivar.h> +#include <opt_drm_linux.h> + +#include "i810.h" +#include "drmP.h" +#include "i810_drv.h" + +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "i810" +#define DRIVER_DESC "Intel i810" +#define DRIVER_DATE "20010616" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 2 +#define DRIVER_PATCHLEVEL 0 + +/* Device IDs unknown. Can someone help? anholt@teleport.com */ +drm_chipinfo_t DRM(devicelist)[] = { + {0, 0, 0, NULL} +}; + +#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_vm.h" +#include "drm_sysctl.h" + +DRIVER_MODULE(i810, pci, i810_driver, i810_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.h:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i810/i810_drv.h Wed Dec 12 19:24:49 2001 @@ -0,0 +1,179 @@ +/* i810_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. + * 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> + * + */ + +#ifndef _I810_DRV_H_ +#define _I810_DRV_H_ + +typedef struct drm_i810_buf_priv { + u32 *in_use; + int my_use_idx; + int currently_mapped; + void *virtual; + void *kernel_virtual; + int map_count; + struct vm_area_struct *vma; +} drm_i810_buf_priv_t; + +typedef struct _drm_i810_ring_buffer{ + int tail_mask; + unsigned long Start; + unsigned long End; + unsigned long Size; + u8 *virtual_start; + int head; + int tail; + int space; +} drm_i810_ring_buffer_t; + +typedef struct drm_i810_private { + drm_map_t *sarea_map; + drm_map_t *buffer_map; + drm_map_t *mmio_map; + + drm_i810_sarea_t *sarea_priv; + drm_i810_ring_buffer_t ring; + + unsigned long hw_status_page; + unsigned long counter; + + atomic_t flush_done; + 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_dma.c */ +extern int i810_dma_schedule(drm_device_t *dev, int locked); +extern int i810_getbuf( DRM_OS_IOCTL ); +extern int i810_dma_init( DRM_OS_IOCTL ); +extern int i810_flush_ioctl( DRM_OS_IOCTL ); +extern int i810_getage( DRM_OS_IOCTL ); +extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma); +extern int i810_copybuf( DRM_OS_IOCTL ); +extern int i810_docopy( DRM_OS_IOCTL ); + +extern void i810_dma_quiescent(drm_device_t *dev); + +#define I810_VERBOSE 0 + + +int i810_dma_vertex( DRM_OS_IOCTL ); +int i810_swap_bufs( DRM_OS_IOCTL ); +int i810_clear_bufs( DRM_OS_IOCTL ); + +#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) +#define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1) +#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1) + +#define INST_PARSER_CLIENT 0x00000000 +#define INST_OP_FLUSH 0x02000000 +#define INST_FLUSH_MAP_CACHE 0x00000001 + + +#define BB1_START_ADDR_MASK (~0x7) +#define BB1_PROTECTED (1<<0) +#define BB1_UNPROTECTED (0<<0) +#define BB2_END_ADDR_MASK (~0x7) + +#define I810REG_HWSTAM 0x02098 +#define I810REG_INT_IDENTITY_R 0x020a4 +#define I810REG_INT_MASK_R 0x020a8 +#define I810REG_INT_ENABLE_R 0x020a0 + +#define LP_RING 0x2030 +#define HP_RING 0x2040 +#define RING_TAIL 0x00 +#define TAIL_ADDR 0x000FFFF8 +#define RING_HEAD 0x04 +#define HEAD_WRAP_COUNT 0xFFE00000 +#define HEAD_WRAP_ONE 0x00200000 +#define HEAD_ADDR 0x001FFFFC +#define RING_START 0x08 +#define START_ADDR 0x00FFFFF8 +#define RING_LEN 0x0C +#define RING_NR_PAGES 0x000FF000 +#define RING_REPORT_MASK 0x00000006 +#define RING_REPORT_64K 0x00000002 +#define RING_REPORT_128K 0x00000004 +#define RING_NO_REPORT 0x00000000 +#define RING_VALID_MASK 0x00000001 +#define RING_VALID 0x00000001 +#define RING_INVALID 0x00000000 + +#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19)) +#define SC_UPDATE_SCISSOR (0x1<<1) +#define SC_ENABLE_MASK (0x1<<0) +#define SC_ENABLE (0x1<<0) + +#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1)) +#define SCI_YMIN_MASK (0xffff<<16) +#define SCI_XMIN_MASK (0xffff<<0) +#define SCI_YMAX_MASK (0xffff<<16) +#define SCI_XMAX_MASK (0xffff<<0) + +#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0) +#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) +#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x2) +#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0) +#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) +#define GFX_OP_PRIMITIVE ((0x3<<29)|(0x1f<<24)) + +#define CMD_OP_Z_BUFFER_INFO ((0x0<<29)|(0x16<<23)) +#define CMD_OP_DESTBUFFER_INFO ((0x0<<29)|(0x15<<23)) + +#define BR00_BITBLT_CLIENT 0x40000000 +#define BR00_OP_COLOR_BLT 0x10000000 +#define BR00_OP_SRC_COPY_BLT 0x10C00000 +#define BR13_SOLID_PATTERN 0x80000000 + + + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/Makefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/Makefile:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/Makefile Sun Dec 16 14:45:01 2001 @@ -0,0 +1,25 @@ +# $FreeBSD$ + +KMOD= i830 +NOMAN= YES +SRCS= i830_drv.c i830_dma.c +SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h +CFLAGS+= ${DEBUG_FLAGS} -I. -I.. + +@: + ln -sf /sys @ + +machine: + ln -sf /sys/i386/include machine + +.if ${MACHINE_ARCH} == "i386" +# This line enables linux ioctl handling +# If you want support for this uncomment this line +#I830_OPTS= "\#define DRM_LINUX" 1 +.endif + +opt_drm_linux.h: + touch opt_drm_linux.h + echo $(I830_OPTS) >> opt_drm_linux.h + +.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830.h:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830.h Sun Dec 16 14:45:01 2001 @@ -0,0 +1,116 @@ +/* i830.h -- Intel I830 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 __I830_H__ +#define __I830_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) i830_##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 { \ + i830_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 { \ + i830_dma_quiescent( dev ); \ +} while (0) + +#define __HAVE_DMA_IRQ 1 +#define __HAVE_DMA_IRQ_BH 1 +#define __HAVE_SHARED_IRQ 1 +#define DRIVER_PREINSTALL() do { \ + drm_i830_private_t *dev_priv = \ + (drm_i830_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I830_READ16( I830REG_HWSTAM ); \ + tmp = tmp & 0x6000; \ + I830_WRITE16( I830REG_HWSTAM, tmp ); \ + \ + tmp = I830_READ16( I830REG_INT_MASK_R ); \ + tmp = tmp & 0x6000; /* Unmask interrupts */ \ + I830_WRITE16( I830REG_INT_MASK_R, tmp ); \ + tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ +} while (0) + +#define DRIVER_POSTINSTALL() do { \ + drm_i830_private_t *dev_priv = \ + (drm_i830_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; \ + tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \ + I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ +} while (0) + +#define DRIVER_UNINSTALL() do { \ + drm_i830_private_t *dev_priv = \ + (drm_i830_private_t *)dev->dev_private; \ + u16 tmp; \ + if ( dev_priv ) { \ + tmp = I830_READ16( I830REG_INT_IDENTITY_R ); \ + tmp = tmp & ~(0x6000); /* Clear all interrupts */ \ + if ( tmp != 0 ) \ + I830_WRITE16( I830REG_INT_IDENTITY_R, tmp ); \ + \ + tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ + } \ +} while (0) + +/* Buffer customization: + */ + +#define DRIVER_BUF_PRIV_T drm_i830_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_i830_private_t *)((dev)->dev_private))->buffer_map + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_dma.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_dma.c:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_dma.c Sun Dec 16 14:45:01 2001 @@ -0,0 +1,1418 @@ +/* i830_dma.c -- DMA support for the I830 -*- linux-c -*- + * Created: Mon Dec 13 01:50:01 1999 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> + * Keith Whitwell <keithw@valinux.com> + * Abraham vd Merwe <abraham@2d3d.co.za> + * + */ + +#define __NO_VERSION__ +#include "i830.h" +#include "drmP.h" +#include "i830_drv.h" +#include <linux/interrupt.h> /* For task queue support */ + +/* in case we don't have a 2.3.99-pre6 kernel or later: */ +#ifndef VM_DONTCOPY +#define VM_DONTCOPY 0 +#endif + +#define I830_BUF_FREE 2 +#define I830_BUF_CLIENT 1 +#define I830_BUF_HARDWARE 0 + +#define I830_BUF_UNMAPPED 0 +#define I830_BUF_MAPPED 1 + +#define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; + + +#define DO_IDLE_WORKAROUND() \ +do { \ + int _head; \ + int _tail; \ + int _i; \ + do { \ + _head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; \ + _tail = I830_READ(LP_RING + RING_TAIL) & TAIL_ADDR; \ + for(_i = 0; _i < 65535; _i++); \ + } while(_head != _tail); \ +} while(0) + +#define I830_SYNC_WORKAROUND 0 + +#define BEGIN_LP_RING(n) do { \ + if (I830_VERBOSE) \ + DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", \ + n, __FUNCTION__); \ + if (I830_SYNC_WORKAROUND) \ + DO_IDLE_WORKAROUND(); \ + if (dev_priv->ring.space < n*4) \ + i830_wait_ring(dev, n*4); \ + dev_priv->ring.space -= n*4; \ + outring = dev_priv->ring.tail; \ + ringmask = dev_priv->ring.tail_mask; \ + virt = dev_priv->ring.virtual_start; \ +} while (0) + +#define ADVANCE_LP_RING() do { \ + if (I830_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ + dev_priv->ring.tail = outring; \ + I830_WRITE(LP_RING + RING_TAIL, outring); \ +} while(0) + +#define OUT_RING(n) do { \ + if (I830_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ + *(volatile unsigned int *)(virt + outring) = n; \ + outring += 4; \ + outring &= ringmask; \ +} while (0); + +static inline void i830_print_status_page(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + drm_i830_private_t *dev_priv = dev->dev_private; + u32 *temp = (u32 *)dev_priv->hw_status_page; + int i; + + DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]); + DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]); + DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]); + DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]); + DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]); + for(i = 9; i < dma->buf_count + 9; i++) { + DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 9, temp[i]); + } +} + +static drm_buf_t *i830_freelist_get(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + int i; + int used; + + /* Linear search might not be the best solution */ + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + /* In use is already a pointer */ + used = cmpxchg(buf_priv->in_use, I830_BUF_FREE, + I830_BUF_CLIENT); + if(used == I830_BUF_FREE) { + return buf; + } + } + return NULL; +} + +/* This should only be called if the buffer is not sent to the hardware + * yet, the hardware updates in use for us once its on the ring buffer. + */ + +static int i830_freelist_put(drm_device_t *dev, drm_buf_t *buf) +{ + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + int used; + + /* In use is already a pointer */ + used = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, I830_BUF_FREE); + if(used != I830_BUF_CLIENT) { + DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); + return -EINVAL; + } + + return 0; +} + +static struct file_operations i830_buffer_fops = { + open: DRM(open), + flush: DRM(flush), + release: DRM(release), + ioctl: DRM(ioctl), + mmap: i830_mmap_buffers, + read: DRM(read), + fasync: DRM(fasync), + poll: DRM(poll), +}; + +int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev; + drm_i830_private_t *dev_priv; + drm_buf_t *buf; + drm_i830_buf_priv_t *buf_priv; + + lock_kernel(); + dev = priv->dev; + 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 = I830_BUF_MAPPED; + unlock_kernel(); + + if (remap_page_range(vma->vm_start, + VM_OFFSET(vma), + vma->vm_end - vma->vm_start, + vma->vm_page_prot)) return -EAGAIN; + return 0; +} + +static int i830_map_buffer(drm_buf_t *buf, struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + drm_i830_private_t *dev_priv = dev->dev_private; + struct file_operations *old_fops; + int retcode = 0; + + if(buf_priv->currently_mapped == I830_BUF_MAPPED) return -EINVAL; + + if(VM_DONTCOPY != 0) { +#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 = &i830_buffer_fops; + dev_priv->mmap_buffer = buf; + buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, + PROT_READ|PROT_WRITE, + MAP_SHARED, + buf->bus_address); + dev_priv->mmap_buffer = NULL; + filp->f_op = old_fops; + if ((unsigned long)buf_priv->virtual > -1024UL) { + /* Real error */ + DRM_DEBUG("mmap error\n"); + retcode = (signed int)buf_priv->virtual; + buf_priv->virtual = 0; + } +#if 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 = I830_BUF_MAPPED; + } + return retcode; +} + +static int i830_unmap_buffer(drm_buf_t *buf) +{ + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + int retcode = 0; + + if(VM_DONTCOPY != 0) { + if(buf_priv->currently_mapped != I830_BUF_MAPPED) + return -EINVAL; +#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, + (size_t) buf->total); +#else + 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 + } + buf_priv->currently_mapped = I830_BUF_UNMAPPED; + buf_priv->virtual = 0; + + return retcode; +} + +static int i830_dma_get_buffer(drm_device_t *dev, drm_i830_dma_t *d, + struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_buf_t *buf; + drm_i830_buf_priv_t *buf_priv; + int retcode = 0; + + buf = i830_freelist_get(dev); + if (!buf) { + retcode = -ENOMEM; + DRM_DEBUG("retcode=%d\n", retcode); + return retcode; + } + + retcode = i830_map_buffer(buf, filp); + if(retcode) { + i830_freelist_put(dev, buf); + DRM_DEBUG("mapbuf failed, retcode %d\n", retcode); + return retcode; + } + buf->pid = priv->pid; + buf_priv = buf->dev_private; + d->granted = 1; + d->request_idx = buf->idx; + d->request_size = buf->total; + d->virtual = buf_priv->virtual; + + return retcode; +} + +static unsigned long i830_alloc_page(drm_device_t *dev) +{ + unsigned long address; + + address = __get_free_page(GFP_KERNEL); + 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 i830_free_page(drm_device_t *dev, unsigned long page) +{ + 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); + free_page(page); + return; +} + +static int i830_dma_cleanup(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + + if(dev->dev_private) { + int i; + drm_i830_private_t *dev_priv = + (drm_i830_private_t *) dev->dev_private; + + if(dev_priv->ring.virtual_start) { + DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, + dev_priv->ring.Size); + } + if(dev_priv->hw_status_page != 0UL) { + i830_free_page(dev, dev_priv->hw_status_page); + /* Need to rewrite hardware status page */ + I830_WRITE(0x02080, 0x1ffff000); + } + DRM(free)(dev->dev_private, sizeof(drm_i830_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_i830_buf_priv_t *buf_priv = buf->dev_private; + DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total); + } + } + return 0; +} + +static int i830_wait_ring(drm_device_t *dev, int n) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_ring_buffer_t *ring = &(dev_priv->ring); + int iters = 0; + unsigned long end; + unsigned int last_head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; + + end = jiffies + (HZ*3); + while (ring->space < n) { + int i; + + ring->head = I830_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); + last_head = ring->head; + } + + iters++; + if((signed)(end - jiffies) <= 0) { + DRM_ERROR("space: %d wanted %d\n", ring->space, n); + DRM_ERROR("lockup\n"); + goto out_wait_ring; + } + + for (i = 0 ; i < 2000 ; i++) ; + } + +out_wait_ring: + return iters; +} + +static void i830_kernel_lost_context(drm_device_t *dev) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_ring_buffer_t *ring = &(dev_priv->ring); + + ring->head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; + ring->tail = I830_READ(LP_RING + RING_TAIL); + ring->space = ring->head - (ring->tail+8); + if (ring->space < 0) ring->space += ring->Size; +} + +static int i830_freelist_init(drm_device_t *dev, drm_i830_private_t *dev_priv) +{ + drm_device_dma_t *dma = dev->dma; + int my_idx = 36; + 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; + } + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i830_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 = I830_BUF_FREE; + + buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, + buf->total); + } + return 0; +} + +static int i830_dma_initialize(drm_device_t *dev, + drm_i830_private_t *dev_priv, + drm_i830_init_t *init) +{ + struct list_head *list; + + memset(dev_priv, 0, sizeof(drm_i830_private_t)); + + 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; + } + } + + if(!dev_priv->sarea_map) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("can not find sarea!\n"); + return -EINVAL; + } + DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); + if(!dev_priv->mmio_map) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("can not find mmio map!\n"); + return -EINVAL; + } + DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); + if(!dev_priv->buffer_map) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("can not find dma buffer map!\n"); + return -EINVAL; + } + + dev_priv->sarea_priv = (drm_i830_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); + + if (dev_priv->ring.virtual_start == NULL) { + dev->dev_private = (void *) dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("can not ioremap virtual address for" + " ring buffer\n"); + return -ENOMEM; + } + + dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; + + dev_priv->w = init->w; + dev_priv->h = init->h; + dev_priv->pitch = init->pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->depth_offset = init->depth_offset; + + 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; + + dev_priv->cpp = init->cpp; + /* We are using seperate values as placeholders for mechanisms for + * private backbuffer/depthbuffer usage. + */ + + dev_priv->back_pitch = init->back_pitch; + dev_priv->depth_pitch = init->depth_pitch; + + /* Program Hardware Status Page */ + dev_priv->hw_status_page = i830_alloc_page(dev); + if(dev_priv->hw_status_page == 0UL) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("Can not allocate hardware status page\n"); + return -ENOMEM; + } + memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); + DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page); + + I830_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(i830_freelist_init(dev, dev_priv) != 0) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("Not enough space in the status page for" + " the freelist\n"); + return -ENOMEM; + } + dev->dev_private = (void *)dev_priv; + + return 0; +} + +int i830_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_i830_private_t *dev_priv; + drm_i830_init_t init; + int retcode = 0; + + if (copy_from_user(&init, (drm_i830_init_t *)arg, sizeof(init))) + return -EFAULT; + + switch(init.func) { + case I830_INIT_DMA: + dev_priv = DRM(alloc)(sizeof(drm_i830_private_t), + DRM_MEM_DRIVER); + if(dev_priv == NULL) return -ENOMEM; + retcode = i830_dma_initialize(dev, dev_priv, &init); + break; + case I830_CLEANUP_DMA: + retcode = i830_dma_cleanup(dev); + break; + default: + retcode = -EINVAL; + break; + } + + return retcode; +} + +/* Most efficient way to verify state for the i830 is as it is + * emitted. Non-conformant state is silently dropped. + * + * Use 'volatile' & local var tmp to force the emitted values to be + * identical to the verified ones. + */ +static void i830EmitContextVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + int i, j = 0; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( I830_CTX_SETUP_SIZE ); + for ( i = 0 ; i < I830_CTX_SETUP_SIZE ; i++ ) { + tmp = code[i]; + +#if 0 + if ((tmp & (7<<29)) == (3<<29) && + (tmp & (0x1f<<24)) < (0x1d<<24)) { + OUT_RING( tmp ); + j++; + } else { + printk("Skipping %d\n", i); + } +#else + OUT_RING( tmp ); + j++; +#endif + } + + if (j & 1) + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + +static void i830EmitTexVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + int i, j = 0; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( I830_TEX_SETUP_SIZE ); + + OUT_RING( GFX_OP_MAP_INFO ); + OUT_RING( code[I830_TEXREG_MI1] ); + OUT_RING( code[I830_TEXREG_MI2] ); + OUT_RING( code[I830_TEXREG_MI3] ); + OUT_RING( code[I830_TEXREG_MI4] ); + OUT_RING( code[I830_TEXREG_MI5] ); + + for ( i = 6 ; i < I830_TEX_SETUP_SIZE ; i++ ) { + tmp = code[i]; + OUT_RING( tmp ); + j++; + } + + if (j & 1) + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + +static void i830EmitTexBlendVerified( drm_device_t *dev, + volatile unsigned int *code, + volatile unsigned int num) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + int i, j = 0; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( num ); + + for ( i = 0 ; i < num ; i++ ) { + tmp = code[i]; + OUT_RING( tmp ); + j++; + } + + if (j & 1) + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + +static void i830EmitTexPalette( drm_device_t *dev, + unsigned int *palette, + int number, + int is_shared ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + int i; + RING_LOCALS; + + BEGIN_LP_RING( 258 ); + + if(is_shared == 1) { + OUT_RING(CMD_OP_MAP_PALETTE_LOAD | + MAP_PALETTE_NUM(0) | + MAP_PALETTE_BOTH); + } else { + OUT_RING(CMD_OP_MAP_PALETTE_LOAD | MAP_PALETTE_NUM(number)); + } + for(i = 0; i < 256; i++) { + OUT_RING(palette[i]); + } + OUT_RING(0); +} + +/* Need to do some additional checking when setting the dest buffer. + */ +static void i830EmitDestVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( I830_DEST_SETUP_SIZE + 6 ); + + tmp = code[I830_DESTREG_CBUFADDR]; + if (tmp == dev_priv->front_di1) { + /* Don't use fence when front buffer rendering */ + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( BUF_3D_ID_COLOR_BACK | + BUF_3D_PITCH(dev_priv->back_pitch * dev_priv->cpp) ); + OUT_RING( tmp ); + + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( BUF_3D_ID_DEPTH | + BUF_3D_PITCH(dev_priv->depth_pitch * dev_priv->cpp)); + OUT_RING( dev_priv->zi1 ); + } else if(tmp == dev_priv->back_di1) { + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( BUF_3D_ID_COLOR_BACK | + BUF_3D_PITCH(dev_priv->back_pitch * dev_priv->cpp) | + BUF_3D_USE_FENCE); + OUT_RING( tmp ); + + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( BUF_3D_ID_DEPTH | BUF_3D_USE_FENCE | + BUF_3D_PITCH(dev_priv->depth_pitch * dev_priv->cpp)); + OUT_RING( dev_priv->zi1 ); + } else { + DRM_DEBUG("bad di1 %x (allow %x or %x)\n", + tmp, dev_priv->front_di1, dev_priv->back_di1); + } + + /* invarient: + */ + + + OUT_RING( GFX_OP_DESTBUFFER_VARS ); + OUT_RING( code[I830_DESTREG_DV1] ); + + OUT_RING( GFX_OP_DRAWRECT_INFO ); + OUT_RING( code[I830_DESTREG_DR1] ); + OUT_RING( code[I830_DESTREG_DR2] ); + OUT_RING( code[I830_DESTREG_DR3] ); + OUT_RING( code[I830_DESTREG_DR4] ); + + /* Need to verify this */ + tmp = code[I830_DESTREG_SENABLE]; + if((tmp & ~0x3) == GFX_OP_SCISSOR_ENABLE) { + OUT_RING( tmp ); + } else { + DRM_DEBUG("bad scissor enable\n"); + OUT_RING( 0 ); + } + + OUT_RING( code[I830_DESTREG_SENABLE] ); + + OUT_RING( GFX_OP_SCISSOR_RECT ); + OUT_RING( code[I830_DESTREG_SR1] ); + OUT_RING( code[I830_DESTREG_SR2] ); + + ADVANCE_LP_RING(); +} + +static void i830EmitState( drm_device_t *dev ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + + if (dirty & I830_UPLOAD_BUFFERS) { + i830EmitDestVerified( dev, sarea_priv->BufferState ); + sarea_priv->dirty &= ~I830_UPLOAD_BUFFERS; + } + + if (dirty & I830_UPLOAD_CTX) { + i830EmitContextVerified( dev, sarea_priv->ContextState ); + sarea_priv->dirty &= ~I830_UPLOAD_CTX; + } + + if (dirty & I830_UPLOAD_TEX0) { + i830EmitTexVerified( dev, sarea_priv->TexState[0] ); + sarea_priv->dirty &= ~I830_UPLOAD_TEX0; + } + + if (dirty & I830_UPLOAD_TEX1) { + i830EmitTexVerified( dev, sarea_priv->TexState[1] ); + sarea_priv->dirty &= ~I830_UPLOAD_TEX1; + } + + if (dirty & I830_UPLOAD_TEXBLEND0) { + i830EmitTexBlendVerified( dev, sarea_priv->TexBlendState[0], + sarea_priv->TexBlendStateWordsUsed[0]); + sarea_priv->dirty &= ~I830_UPLOAD_TEXBLEND0; + } + + if (dirty & I830_UPLOAD_TEXBLEND1) { + i830EmitTexBlendVerified( dev, sarea_priv->TexBlendState[1], + sarea_priv->TexBlendStateWordsUsed[1]); + sarea_priv->dirty &= ~I830_UPLOAD_TEXBLEND1; + } + + if (dirty & I830_UPLOAD_TEX_PALETTE_SHARED) { + i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 1); + } else { + if (dirty & I830_UPLOAD_TEX_PALETTE_N(0)) { + i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 0); + sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(0); + } + if (dirty & I830_UPLOAD_TEX_PALETTE_N(1)) { + i830EmitTexPalette(dev, sarea_priv->Palette[1], 1, 0); + sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(1); + } + } +} + +static void i830_dma_dispatch_clear( drm_device_t *dev, int flags, + unsigned int clear_color, + unsigned int clear_zval, + unsigned int clear_depthmask) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int pitch = dev_priv->pitch; + int cpp = dev_priv->cpp; + int i; + unsigned int BR13, CMD, D_CMD; + RING_LOCALS; + + i830_kernel_lost_context(dev); + + switch(cpp) { + case 2: + BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24); + D_CMD = CMD = XY_COLOR_BLT_CMD; + break; + case 4: + BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24) | (1<<25); + CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA | + XY_COLOR_BLT_WRITE_RGB); + D_CMD = XY_COLOR_BLT_CMD; + if(clear_depthmask & 0x00ffffff) + D_CMD |= XY_COLOR_BLT_WRITE_RGB; + if(clear_depthmask & 0xff000000) + D_CMD |= XY_COLOR_BLT_WRITE_ALPHA; + break; + default: + BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24); + D_CMD = CMD = XY_COLOR_BLT_CMD; + break; + } + + if (nbox > I830_NR_SAREA_CLIPRECTS) + nbox = I830_NR_SAREA_CLIPRECTS; + + for (i = 0 ; i < nbox ; i++, pbox++) { + if (pbox->x1 > pbox->x2 || + pbox->y1 > pbox->y2 || + pbox->x2 > dev_priv->w || + pbox->y2 > dev_priv->h) + continue; + + if ( flags & I830_FRONT ) { + DRM_DEBUG("clear front\n"); + BEGIN_LP_RING( 6 ); + OUT_RING( CMD ); + OUT_RING( BR13 ); + OUT_RING( (pbox->y1 << 16) | pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | pbox->x2 ); + OUT_RING( 0 ); + OUT_RING( clear_color ); + ADVANCE_LP_RING(); + } + + if ( flags & I830_BACK ) { + DRM_DEBUG("clear back\n"); + BEGIN_LP_RING( 6 ); + OUT_RING( CMD ); + OUT_RING( BR13 ); + OUT_RING( (pbox->y1 << 16) | pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | pbox->x2 ); + OUT_RING( dev_priv->back_offset ); + OUT_RING( clear_color ); + ADVANCE_LP_RING(); + } + + if ( flags & I830_DEPTH ) { + DRM_DEBUG("clear depth\n"); + BEGIN_LP_RING( 6 ); + OUT_RING( D_CMD ); + OUT_RING( BR13 ); + OUT_RING( (pbox->y1 << 16) | pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | pbox->x2 ); + OUT_RING( dev_priv->depth_offset ); + OUT_RING( clear_zval ); + ADVANCE_LP_RING(); + } + } +} + +static void i830_dma_dispatch_swap( drm_device_t *dev ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int pitch = dev_priv->pitch; + int cpp = dev_priv->cpp; + int ofs = dev_priv->back_offset; + int i; + unsigned int CMD, BR13; + RING_LOCALS; + + DRM_DEBUG("swapbuffers\n"); + + switch(cpp) { + case 2: + BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24); + CMD = XY_SRC_COPY_BLT_CMD; + break; + case 4: + BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24) | (1<<25); + CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + break; + default: + BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24); + CMD = XY_SRC_COPY_BLT_CMD; + break; + } + + i830_kernel_lost_context(dev); + + if (nbox > I830_NR_SAREA_CLIPRECTS) + nbox = I830_NR_SAREA_CLIPRECTS; + + for (i = 0 ; i < nbox; i++, pbox++) + { + if (pbox->x1 > pbox->x2 || + pbox->y1 > pbox->y2 || + pbox->x2 > dev_priv->w || + pbox->y2 > dev_priv->h) + continue; + + DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", + pbox->x1, pbox->y1, + pbox->x2, pbox->y2); + + BEGIN_LP_RING( 8 ); + OUT_RING( CMD ); + OUT_RING( BR13 ); + + OUT_RING( (pbox->y1 << 16) | + pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | + pbox->x2 ); + + OUT_RING( 0 /* front ofs always zero */ ); + OUT_RING( (pbox->y1 << 16) | + pbox->x1 ); + + OUT_RING( BR13 & 0xffff ); + OUT_RING( ofs ); + + ADVANCE_LP_RING(); + } +} + + +static void i830_dma_dispatch_vertex(drm_device_t *dev, + drm_buf_t *buf, + int discard, + int used) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; + 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; + int i = 0, u; + RING_LOCALS; + + i830_kernel_lost_context(dev); + + if (nbox > I830_NR_SAREA_CLIPRECTS) + nbox = I830_NR_SAREA_CLIPRECTS; + + if (discard) { + u = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, + I830_BUF_HARDWARE); + if(u != I830_BUF_CLIENT) { + DRM_DEBUG("xxxx 2\n"); + } + } + + if (used > 4*1024) + used = 0; + + if (sarea_priv->dirty) + i830EmitState( dev ); + + DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", + address, used, nbox); + + dev_priv->counter++; + DRM_DEBUG( "dispatch counter : %ld\n", dev_priv->counter); + DRM_DEBUG( "i830_dma_dispatch\n"); + DRM_DEBUG( "start : %lx\n", start); + DRM_DEBUG( "used : %d\n", used); + DRM_DEBUG( "start + used - 4 : %ld\n", start + used - 4); + + if (buf_priv->currently_mapped == I830_BUF_MAPPED) { + *(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; + } + + i830_unmap_buffer(buf); + } + + if (used) { + do { + if (i < nbox) { + BEGIN_LP_RING(6); + OUT_RING( GFX_OP_DRAWRECT_INFO ); + OUT_RING( sarea_priv->BufferState[I830_DESTREG_DR1] ); + OUT_RING( box[i].x1 | (box[i].y1<<16) ); + OUT_RING( box[i].x2 | (box[i].y2<<16) ); + OUT_RING( sarea_priv->BufferState[I830_DESTREG_DR4] ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + } + + BEGIN_LP_RING(4); + + OUT_RING( MI_BATCH_BUFFER ); + OUT_RING( start | MI_BATCH_NON_SECURE ); + OUT_RING( start + used - 4 ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + + } while (++i < nbox); + } + + BEGIN_LP_RING(10); + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( 20 ); + OUT_RING( dev_priv->counter ); + OUT_RING( 0 ); + + if (discard) { + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( buf_priv->my_use_idx ); + OUT_RING( I830_BUF_FREE ); + OUT_RING( 0 ); + } + + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); +} + +/* Interrupts are only for flushing */ +void i830_dma_service(int irq, void *device, struct pt_regs *regs) +{ + drm_device_t *dev = (drm_device_t *)device; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u16 temp; + + temp = I830_READ16(I830REG_INT_IDENTITY_R); + temp = temp & ~(0x6000); + if(temp != 0) I830_WRITE16(I830REG_INT_IDENTITY_R, + temp); /* Clear all interrupts */ + else + return; + + queue_task(&dev->tq, &tq_immediate); + mark_bh(IMMEDIATE_BH); +} + +void DRM(dma_immediate_bh)(void *device) +{ + drm_device_t *dev = (drm_device_t *) device; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + + atomic_set(&dev_priv->flush_done, 1); + wake_up_interruptible(&dev_priv->flush_queue); +} + +static inline void i830_dma_emit_flush(drm_device_t *dev) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + i830_kernel_lost_context(dev); + + BEGIN_LP_RING(2); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( GFX_OP_USER_INTERRUPT ); + ADVANCE_LP_RING(); + + i830_wait_ring( dev, dev_priv->ring.Size - 8 ); + atomic_set(&dev_priv->flush_done, 1); + wake_up_interruptible(&dev_priv->flush_queue); +} + +static inline void i830_dma_quiescent_emit(drm_device_t *dev) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + i830_kernel_lost_context(dev); + + BEGIN_LP_RING(4); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + OUT_RING( GFX_OP_USER_INTERRUPT ); + ADVANCE_LP_RING(); + + i830_wait_ring( dev, dev_priv->ring.Size - 8 ); + atomic_set(&dev_priv->flush_done, 1); + wake_up_interruptible(&dev_priv->flush_queue); +} + +void i830_dma_quiescent(drm_device_t *dev) +{ + DECLARE_WAITQUEUE(entry, current); + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + unsigned long end; + + if(dev_priv == NULL) { + return; + } + atomic_set(&dev_priv->flush_done, 0); + add_wait_queue(&dev_priv->flush_queue, &entry); + end = jiffies + (HZ*3); + + for (;;) { + current->state = TASK_INTERRUPTIBLE; + i830_dma_quiescent_emit(dev); + if (atomic_read(&dev_priv->flush_done) == 1) break; + 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; +} + +static int i830_flush_queue(drm_device_t *dev) +{ + DECLARE_WAITQUEUE(entry, current); + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + drm_device_dma_t *dma = dev->dma; + unsigned long end; + int i, ret = 0; + + if(dev_priv == NULL) { + return 0; + } + atomic_set(&dev_priv->flush_done, 0); + add_wait_queue(&dev_priv->flush_queue, &entry); + end = jiffies + (HZ*3); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + i830_dma_emit_flush(dev); + if (atomic_read(&dev_priv->flush_done) == 1) break; + 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); + + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + + int used = cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE, + I830_BUF_FREE); + + if (used == I830_BUF_HARDWARE) + DRM_DEBUG("reclaimed from HARDWARE\n"); + if (used == I830_BUF_CLIENT) + DRM_DEBUG("still on client HARDWARE\n"); + } + + return ret; +} + +/* Must be called with the lock held */ +void i830_reclaim_buffers(drm_device_t *dev, pid_t pid) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma) return; + if (!dev->dev_private) return; + if (!dma->buflist) return; + + i830_flush_queue(dev); + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + + if (buf->pid == pid && buf_priv) { + int used = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, + I830_BUF_FREE); + + if (used == I830_BUF_CLIENT) + DRM_DEBUG("reclaimed from client\n"); + if(buf_priv->currently_mapped == I830_BUF_MAPPED) + buf_priv->currently_mapped = I830_BUF_UNMAPPED; + } + } +} + +int i830_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("i830_flush_ioctl\n"); + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_flush_ioctl called without lock held\n"); + return -EINVAL; + } + + i830_flush_queue(dev); + return 0; +} + +int i830_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_device_dma_t *dma = dev->dma; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) + dev_priv->sarea_priv; + drm_i830_vertex_t vertex; + + if (copy_from_user(&vertex, (drm_i830_vertex_t *)arg, sizeof(vertex))) + return -EFAULT; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_dma_vertex called without lock held\n"); + return -EINVAL; + } + + DRM_DEBUG("i830 dma vertex, idx %d used %d discard %d\n", + vertex.idx, vertex.used, vertex.discard); + + if(vertex.idx < 0 || vertex.idx > dma->buf_count) return -EINVAL; + + i830_dma_dispatch_vertex( dev, + dma->buflist[ vertex.idx ], + vertex.discard, vertex.used ); + + sarea_priv->last_enqueue = dev_priv->counter-1; + sarea_priv->last_dispatch = (int) hw_status[5]; + + return 0; +} + +int i830_clear_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_clear_t clear; + + if (copy_from_user(&clear, (drm_i830_clear_t *)arg, sizeof(clear))) + return -EFAULT; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_clear_bufs called without lock held\n"); + return -EINVAL; + } + + /* GH: Someone's doing nasty things... */ + if (!dev->dev_private) { + return -EINVAL; + } + + i830_dma_dispatch_clear( dev, clear.flags, + clear.clear_color, + clear.clear_depth, + clear.clear_depthmask); + return 0; +} + +int i830_swap_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + DRM_DEBUG("i830_swap_bufs\n"); + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_swap_buf called without lock held\n"); + return -EINVAL; + } + + i830_dma_dispatch_swap( dev ); + return 0; +} + +int i830_getage(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_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) + dev_priv->sarea_priv; + + sarea_priv->last_dispatch = (int) hw_status[5]; + return 0; +} + +int i830_getbuf(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 = 0; + drm_i830_dma_t d; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) + dev_priv->sarea_priv; + + DRM_DEBUG("getbuf\n"); + if (copy_from_user(&d, (drm_i830_dma_t *)arg, sizeof(d))) + return -EFAULT; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_dma called without lock held\n"); + return -EINVAL; + } + + d.granted = 0; + + retcode = i830_dma_get_buffer(dev, &d, filp); + + DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", + current->pid, retcode, d.granted); + + if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d))) + return -EFAULT; + sarea_priv->last_dispatch = (int) hw_status[5]; + + return retcode; +} + +int i830_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_copy_t d; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) + dev_priv->sarea_priv; + drm_buf_t *buf; + drm_i830_buf_priv_t *buf_priv; + drm_device_dma_t *dma = dev->dma; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_dma called without lock held\n"); + return -EINVAL; + } + + if (copy_from_user(&d, (drm_i830_copy_t *)arg, sizeof(d))) + return -EFAULT; + + if(d.idx < 0 || d.idx > dma->buf_count) return -EINVAL; + buf = dma->buflist[ d.idx ]; + buf_priv = buf->dev_private; + if (buf_priv->currently_mapped != I830_BUF_MAPPED) return -EPERM; + + if(d.used < 0 || d.used > buf->total) return -EINVAL; + + if (copy_from_user(buf_priv->virtual, d.address, d.used)) + return -EFAULT; + + sarea_priv->last_dispatch = (int) hw_status[5]; + + return 0; +} + +int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + if(VM_DONTCOPY == 0) return 1; + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.c:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.c Sun Dec 16 14:45:01 2001 @@ -0,0 +1,102 @@ +/* i830_drv.c -- I810 driver -*- linux-c -*- + * Created: Mon Dec 13 01:56:22 1999 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 + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * Abraham vd Merwe <abraham@2d3d.co.za> + */ + +#include <linux/config.h> +#include "i830.h" +#include "drmP.h" +#include "i830_drv.h" + +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "i830" +#define DRIVER_DESC "Intel 830M" +#define DRIVER_DATE "20011004" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 2 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_INIT)] = { i830_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_VERTEX)] = { i830_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_CLEAR)] = { i830_clear_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_FLUSH)] = { i830_flush_ioctl, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_GETAGE)] = { i830_getage, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_GETBUF)] = { i830_getbuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_SWAP)] = { i830_swap_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_COPY)] = { i830_copybuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_DOCOPY)] = { i830_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" + +#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. + */ + +/* JH- We have to hand expand the string ourselves because of the cpp. If + * anyone can think of a way that we can fit into the __setup macro without + * changing it, then please send the solution my way. + */ +static int __init i830_options( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", i830_options ); +#endif + +#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/bsd/drm/kernel/i830/i830_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.h:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/i830/i830_drv.h Sun Dec 16 14:45:01 2001 @@ -0,0 +1,213 @@ +/* i830_drv.h -- Private header for the I830 driver -*- linux-c -*- + * Created: Mon Dec 13 01:50:01 1999 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> + * + */ + +#ifndef _I830_DRV_H_ +#define _I830_DRV_H_ + +typedef struct drm_i830_buf_priv { + u32 *in_use; + int my_use_idx; + int currently_mapped; + void *virtual; + void *kernel_virtual; + int map_count; + struct vm_area_struct *vma; +} drm_i830_buf_priv_t; + +typedef struct _drm_i830_ring_buffer{ + int tail_mask; + unsigned long Start; + unsigned long End; + unsigned long Size; + u8 *virtual_start; + int head; + int tail; + int space; +} drm_i830_ring_buffer_t; + +typedef struct drm_i830_private { + drm_map_t *sarea_map; + drm_map_t *buffer_map; + drm_map_t *mmio_map; + + drm_i830_sarea_t *sarea_priv; + drm_i830_ring_buffer_t ring; + + unsigned long hw_status_page; + unsigned long counter; + + atomic_t flush_done; + 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; + int back_pitch; + int depth_pitch; + unsigned int cpp; +} drm_i830_private_t; + + /* i830_dma.c */ +extern int i830_dma_schedule(drm_device_t *dev, int locked); +extern int i830_getbuf(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i830_dma_init(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i830_flush_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern void i830_reclaim_buffers(drm_device_t *dev, pid_t pid); +extern int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma); +extern int i830_copybuf(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i830_docopy(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern void i830_dma_quiescent(drm_device_t *dev); + +extern int i830_dma_vertex(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern int i830_swap_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern int i830_clear_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +#define I830_VERBOSE 0 + +#define I830_BASE(reg) ((unsigned long) \ + dev_priv->mmio_map->handle) +#define I830_ADDR(reg) (I830_BASE(reg) + reg) +#define I830_DEREF(reg) *(__volatile__ int *)I830_ADDR(reg) +#define I830_READ(reg) I830_DEREF(reg) +#define I830_WRITE(reg,val) do { I830_DEREF(reg) = val; } while (0) +#define I830_DEREF16(reg) *(__volatile__ u16 *)I830_ADDR(reg) +#define I830_READ16(reg) I830_DEREF16(reg) +#define I830_WRITE16(reg,val) do { I830_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) +#define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1) +#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1) + +#define INST_PARSER_CLIENT 0x00000000 +#define INST_OP_FLUSH 0x02000000 +#define INST_FLUSH_MAP_CACHE 0x00000001 + + +#define BB1_START_ADDR_MASK (~0x7) +#define BB1_PROTECTED (1<<0) +#define BB1_UNPROTECTED (0<<0) +#define BB2_END_ADDR_MASK (~0x7) + +#define I830REG_HWSTAM 0x02098 +#define I830REG_INT_IDENTITY_R 0x020a4 +#define I830REG_INT_MASK_R 0x020a8 +#define I830REG_INT_ENABLE_R 0x020a0 + +#define LP_RING 0x2030 +#define HP_RING 0x2040 +#define RING_TAIL 0x00 +#define TAIL_ADDR 0x000FFFF8 +#define RING_HEAD 0x04 +#define HEAD_WRAP_COUNT 0xFFE00000 +#define HEAD_WRAP_ONE 0x00200000 +#define HEAD_ADDR 0x001FFFFC +#define RING_START 0x08 +#define START_ADDR 0x00FFFFF8 +#define RING_LEN 0x0C +#define RING_NR_PAGES 0x000FF000 +#define RING_REPORT_MASK 0x00000006 +#define RING_REPORT_64K 0x00000002 +#define RING_REPORT_128K 0x00000004 +#define RING_NO_REPORT 0x00000000 +#define RING_VALID_MASK 0x00000001 +#define RING_VALID 0x00000001 +#define RING_INVALID 0x00000000 + +#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19)) +#define SC_UPDATE_SCISSOR (0x1<<1) +#define SC_ENABLE_MASK (0x1<<0) +#define SC_ENABLE (0x1<<0) + +#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1)) +#define SCI_YMIN_MASK (0xffff<<16) +#define SCI_XMIN_MASK (0xffff<<0) +#define SCI_YMAX_MASK (0xffff<<16) +#define SCI_XMAX_MASK (0xffff<<0) + +#define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19)) +#define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1) +#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0) +#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) +#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4) +#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0) +#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) +#define GFX_OP_PRIMITIVE ((0x3<<29)|(0x1f<<24)) + +#define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) + + +#define BR00_BITBLT_CLIENT 0x40000000 +#define BR00_OP_COLOR_BLT 0x10000000 +#define BR00_OP_SRC_COPY_BLT 0x10C00000 +#define BR13_SOLID_PATTERN 0x80000000 + +#define BUF_3D_ID_COLOR_BACK (0x3<<24) +#define BUF_3D_ID_DEPTH (0x7<<24) +#define BUF_3D_USE_FENCE (1<<23) +#define BUF_3D_PITCH(x) (((x)/4)<<2) + +#define CMD_OP_MAP_PALETTE_LOAD ((3<<29)|(0x1d<<24)|(0x82<<16)|255) +#define MAP_PALETTE_NUM(x) ((x<<8) & (1<<8)) +#define MAP_PALETTE_BOTH (1<<11) + +#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4) +#define XY_COLOR_BLT_WRITE_ALPHA (1<<21) +#define XY_COLOR_BLT_WRITE_RGB (1<<20) + +#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) +#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) +#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) + +#define MI_BATCH_BUFFER ((0x30<<23)|1) +#define MI_BATCH_NON_SECURE (1) + + +#endif + Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/Makefile Wed Dec 12 19:24:49 2001 @@ -1,16 +1,25 @@ # $FreeBSD$ -KMOD = mga -SRCS = mga_drv.c mga_context.c mga_state.c mga_bufs.c mga_dma.c -SRCS += device_if.h bus_if.h pci_if.h -CFLAGS += ${DEBUG_FLAGS} -I.. -KERN = /usr/src/sys -KMODDEPS = drm +KMOD= mga +NOMAN= YES +SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c +SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h +CFLAGS+= ${DEBUG_FLAGS} -I. -I.. @: ln -sf /sys @ machine: ln -sf /sys/i386/include machine + +.if ${MACHINE_ARCH} == "i386" +# This line enables linux ioctl handling +# If you want support for this uncomment this line +#MGA_OPTS= "\#define DRM_LINUX" 1 +.endif + +opt_drm_linux.h: + touch opt_drm_linux.h + echo $(MGA_OPTS) >> opt_drm_linux.h .include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga.h:1.1 --- /dev/null Fri Jan 18 15:26:00 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga.h Wed Dec 12 19:24:49 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/bsd/drm/kernel/mga/mga_bufs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_bufs.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_bufs.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_bufs.c:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_bufs.c Fri Jan 18 15:26:00 2002 @@ -1,604 +0,0 @@ -/* mga_bufs.c -- IOCTLs to manage buffers - * 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 <sys/mman.h> -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_extern.h> -#include <vm/vm_map.h> - - -static int -mga_addbufs_agp(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - 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; - - request = *(drm_buf_desc_t *) data; - - count = request.count; - order = drm_order(request.size); - size = 1 << order; - agp_offset = request.agp_start; - alignment = (request.flags & _DRM_PAGE_ALIGN) ? round_page(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 */ - simple_lock(&dev->count_lock); - if (dev->buf_use) { - simple_unlock(&dev->count_lock); - return EBUSY; - } - atomic_inc(&dev->buf_alloc); - simple_unlock(&dev->count_lock); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - entry = &dma->bufs[order]; - if (entry->buf_count) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - 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) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - 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; - - DRM_DEBUG("offset : %ld\n", offset); - - 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; - buf->dma_wait = 0; - 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 - timespecclear(&buf->time_queued); - timespecclear(&buf->time_dispatched); - timespecclear(&buf->time_completed); - timespecclear(&buf->time_freed); -#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; - - 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]); - } - - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - request.count = entry->buf_count; - request.size = size; - - *(drm_buf_desc_t *) data = request; - - 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; -} - -static int -mga_addbufs_pci(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - 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; - - request = *(drm_buf_desc_t *) data; - - 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) ? round_page(size) :size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - simple_lock(&dev->count_lock); - if (dev->buf_use) { - simple_unlock(&dev->count_lock); - return EBUSY; - } - atomic_inc(&dev->buf_alloc); - simple_unlock(&dev->count_lock); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - entry = &dma->bufs[order]; - if (entry->buf_count) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - 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) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - 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); - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - 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; - buf->dma_wait = 0; - buf->pid = 0; -#if DRM_DMA_HISTOGRAM - timespecclear(&buf->time_queued); - timespecclear(&buf->time_dispatched); - timespecclear(&buf->time_completed); - timespecclear(&buf->time_freed); -#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]); - } - - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - request.count = entry->buf_count; - request.size = size; - - *(drm_buf_desc_t *) data = request; - - atomic_dec(&dev->buf_alloc); - return 0; -} - -int -mga_addbufs(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_buf_desc_t request; - - request = *(drm_buf_desc_t *) data; - - if(request.flags & _DRM_AGP_BUFFER) - return mga_addbufs_agp(kdev, cmd, data, flags, p); - else - return mga_addbufs_pci(kdev, cmd, data, flags, p); -} - -int -mga_infobufs(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - drm_buf_info_t request; - int i; - int count; - int error; - - if (!dma) return EINVAL; - - simple_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - simple_unlock(&dev->count_lock); - return EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - simple_unlock(&dev->count_lock); - - request = *(drm_buf_info_t *) data; - - 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) { - error = copyout(&dma->bufs[i].buf_count, - &request.list[count].count, - sizeof(dma->bufs[0] - .buf_count)); - if (error) return error; - error = copyout(&dma->bufs[i].buf_size, - &request.list[count].size, - sizeof(dma->bufs[0] - .buf_size)); - if (error) return error; - error = copyout(&dma->bufs[i] - .freelist.low_mark, - &request.list[count].low_mark, - sizeof(dma->bufs[0] - .freelist.low_mark)); - if (error) return error; - error = copyout(&dma->bufs[i] - .freelist.high_mark, - &request.list[count].high_mark, - sizeof(dma->bufs[0] - .freelist.high_mark)); - if (error) return error; - 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; - - *(drm_buf_info_t *) data = request; - - return 0; -} - -int -mga_markbufs(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int order; - drm_buf_entry_t *entry; - - if (!dma) return EINVAL; - - request = *(drm_buf_desc_t *) data; - - 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 -mga_freebufs(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - drm_buf_free_t request; - int i; - int error; - int idx; - drm_buf_t *buf; - - if (!dma) return EINVAL; - - request = *(drm_buf_free_t *) data; - - DRM_DEBUG("%d\n", request.count); - for (i = 0; i < request.count; i++) { - error = copyin(&request.list[i], - &idx, - sizeof(idx)); - if (error) return error; - 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 != p->p_pid) { - DRM_ERROR("Process %d freeing buffer owned by %d\n", - p->p_pid, buf->pid); - return EINVAL; - } - drm_free_buffer(dev, buf); - } - - return 0; -} - -int -mga_mapbufs(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - const int zero = 0; - vm_offset_t virtual; - vm_offset_t address; - drm_buf_map_t request; - int i; - - if (!dma) return EINVAL; - - DRM_DEBUG("\n"); - - simple_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - simple_unlock(&dev->count_lock); - DRM_DEBUG("Busy\n"); - return EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - simple_unlock(&dev->count_lock); - - request = *(drm_buf_map_t *) data; - - DRM_DEBUG("mga_mapbufs\n"); - DRM_DEBUG("dma->flags : %x\n", dma->flags); - - 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) { - DRM_DEBUG("map is null\n"); - 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); - virtual = 0; - retcode = vm_mmap(&p->p_vmspace->vm_map, - &virtual, - map->size, - PROT_READ|PROT_WRITE, VM_PROT_ALL, - MAP_SHARED, - SLIST_FIRST(&kdev->si_hlist), - map->offset); - } else { - virtual = 0; - retcode = vm_mmap(&p->p_vmspace->vm_map, - &virtual, - round_page(dma->byte_count), - PROT_READ|PROT_WRITE, VM_PROT_ALL, - MAP_SHARED, - SLIST_FIRST(&kdev->si_hlist), - 0); - } - if (retcode) { - /* Real error */ - DRM_DEBUG("mmap error\n"); - goto done; - } - request.virtual = (void *)virtual; - - for (i = 0; i < dma->buf_count; i++) { - retcode = copyout(&dma->buflist[i]->idx, - &request.list[i].idx, - sizeof(request.list[0].idx)); - if (retcode) goto done; - retcode = copyout(&dma->buflist[i]->total, - &request.list[i].total, - sizeof(request.list[0].total)); - if (retcode) goto done; - retcode = copyout(&zero, - &request.list[i].used, - sizeof(request.list[0].used)); - if (retcode) goto done; - address = virtual + dma->buflist[i]->offset; - retcode = copyout(&address, - &request.list[i].address, - sizeof(address)); - if (retcode) goto done; - } - } - done: - request.count = dma->buf_count; - DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode); - - *(drm_buf_map_t *) data = request; - - DRM_DEBUG("retcode : %d\n", retcode); - - return retcode; -} 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.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c:1.2 Thu Mar 1 21:45:39 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c Fri Jan 18 15:26:00 2002 @@ -1,200 +0,0 @@ -/* mga_context.c -- IOCTLs for mga contexts - * 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) -{ - int temp = drm_ctxbitmap_next(dev); - DRM_DEBUG("mga_alloc_queue: %d\n", temp); - return temp; -} - -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 - getnanotime(&dev->ctx_start); -#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 = ticks; - - 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 - { - struct timespec ts; - getnanotime(&ts); - timespecsub(&ts, &dev->lck_start); - atomic_inc(&dev->histo.ctx[drm_histogram_slot(&ts)]); - } -#endif - clear_bit(0, &dev->context_flag); - wakeup(&dev->context_wait); - - return 0; -} - -int -mga_resctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i, error; - - DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - res = *(drm_ctx_res_t *) data; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - error = copyout(&i, &res.contexts[i], sizeof(i)); - if (error) return error; - } - } - res.count = DRM_RESERVED_CONTEXTS; - *(drm_ctx_res_t *) data = res; - return 0; -} - -int -mga_addctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - 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) { - DRM_DEBUG("Not enough free contexts.\n"); - /* Should this return EBUSY instead? */ - return ENOMEM; - } - DRM_DEBUG("%d\n", ctx.handle); - *(drm_ctx_t *) data = ctx; - return 0; -} - -int -mga_modctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - /* This does nothing for the mga */ - return 0; -} - -int mga_getctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - /* This is 0, because we don't hanlde any context flags */ - ctx.flags = 0; - *(drm_ctx_t *) data = ctx; - return 0; -} - -int mga_switchctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - DRM_DEBUG("%d\n", ctx.handle); - return mga_context_switch(dev, dev->last_context, ctx.handle); -} - -int mga_newctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - DRM_DEBUG("%d\n", ctx.handle); - mga_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int mga_rmctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - 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/bsd/drm/kernel/mga/mga_dma.c diff -u 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.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c:1.2 Thu Mar 1 21:45:39 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c Wed Dec 12 19:24:49 2001 @@ -1,4 +1,4 @@ -/* mga_dma.c -- DMA support for mga g200/g400 +/* mga_dma.c -- DMA support for mga g200/g400 -*- linux-c -*- * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -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 @@ -24,1054 +24,796 @@ * 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 <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> -#include <vm/vm.h> -#include <vm/pmap.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 PDEA_pagpxfer_enable 0x2 +#define MGA_DEFAULT_USEC_TIMEOUT 10000 +#define MGA_FREELIST_DEBUG 0 -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; - - DRM_DEBUG("%s\n", __FUNCTION__); + u32 status = 0; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - address = (unsigned long) drm_alloc(PAGE_SIZE, DRM_MEM_DMA); - 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; + } + DRM_OS_DELAY( 1 ); } - - return address; + +#if MGA_DMA_DEBUG + DRM_ERROR( "failed!\n" ); + DRM_INFO( " status=0x%08x\n", status ); +#endif + DRM_OS_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 ) { - DRM_DEBUG("%s\n", __FUNCTION__); + u32 status = 0; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - if(page == 0UL) { - return; + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + status = MGA_READ( MGA_STATUS ) & MGA_DMA_IDLE_MASK; + if ( status == MGA_ENDPRDMASTS ) return 0; + DRM_OS_DELAY( 1 ); } - drm_free((void *) page, PAGE_SIZE, DRM_MEM_DMA); - return; + +#if MGA_DMA_DEBUG + DRM_ERROR( "failed! status=0x%08x\n", status ); +#endif + DRM_OS_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; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + /* The primary DMA stream should look like new right about now. + */ + primary->tail = 0; + primary->space = primary->size; + primary->last_flush = 0; + + sarea_priv->last_wrap = 0; + + /* FIXME: Reset counters, buffer ages etc... + */ + + /* FIXME: What else do we need to reinitialize? WARP stuff? + */ + + return 0; } -void mga_flush_write_combine(void) +int mga_do_engine_reset( drm_mga_private_t *dev_priv ) { - int xchangeDummy; - DRM_DEBUG("%s\n", __FUNCTION__); + DRM_DEBUG( "%s\n", __FUNCTION__ ); - __asm__ volatile(" push %%eax ; xchg %%eax, %0 ; pop %%eax" : : "m" (xchangeDummy)); - __asm__ volatile(" push %%eax ; push %%ebx ; push %%ecx ; push %%edx ;" - " movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ;" - " pop %%eax" : /* no outputs */ : /* no inputs */ ); + /* Okay, so we've completely screwed up and locked the engine. + * How about we clean up after ourselves? + */ + MGA_WRITE( MGA_RST, MGA_SOFTRESET ); + DRM_OS_DELAY( 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 + + MGA_WRITE( MGA_ICLEAR, MGA_SOFTRAPICLR ); + MGA_WRITE( MGA_IEN, MGA_SOFTRAPIEN ); + + /* The primary DMA stream should look like new right about now. + */ + mga_do_dma_reset( dev_priv ); + + /* This bad boy will never fail. + */ + return 0; } + -/* These are two age tags that will never be sent to - * the hardware */ -#define MGA_BUF_USED 0xffffffff -#define MGA_BUF_FREE 0 +/* ================================================================ + * Primary DMA stream + */ -static int mga_freelist_init(drm_device_t *dev) +void mga_do_dma_flush( drm_mga_private_t *dev_priv ) { - 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; - - DRM_DEBUG("%s\n", __FUNCTION__); - - dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); - if(dev_priv->head == NULL) return ENOMEM; - memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); - dev_priv->head->age = MGA_BUF_USED; - - for (i = 0; i < dma->buf_count; i++) { - buf = dma->buflist[ i ]; - buf_priv = buf->dev_private; - item = drm_alloc(sizeof(drm_mga_freelist_t), - DRM_MEM_DRIVER); - if(item == NULL) return ENOMEM; - memset(item, 0, sizeof(drm_mga_freelist_t)); - item->age = MGA_BUF_FREE; - item->prev = dev_priv->head; - item->next = dev_priv->head->next; - if(dev_priv->head->next != NULL) - dev_priv->head->next->prev = item; - if(item->next == NULL) dev_priv->tail = item; - item->buf = buf; - buf_priv->my_freelist = item; - buf_priv->discard = 0; - dev_priv->head->next = item; + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + u32 head, tail; + DMA_LOCALS; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); + + if ( primary->tail == primary->last_flush ) { + DRM_DEBUG( " bailing out...\n" ); + return; } - - return 0; + + tail = primary->tail + dev_priv->primary->offset; + + /* 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 ); + + 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 { + 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 ); + + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); + + DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } -static void mga_freelist_cleanup(drm_device_t *dev) +void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) { - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_freelist_t *item; - drm_mga_freelist_t *prev; - - DRM_DEBUG("%s\n", __FUNCTION__); - - item = dev_priv->head; - while(item) { - prev = item; - item = item->next; - drm_free(prev, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + u32 head, tail; + DMA_LOCALS; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); + + BEGIN_DMA_WRAP(); + + 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; } - - dev_priv->head = dev_priv->tail = NULL; + + 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__ ); } -/* Frees dispatch lock */ -static __inline void mga_dma_quiescent(drm_device_t *dev) +void mga_do_dma_wrap_end( 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_primary_buffer_t *primary = &dev_priv->prim; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned long end; + u32 head = dev_priv->primary->offset; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); + + sarea_priv->last_wrap++; + DRM_DEBUG( " wrap = %d\n", sarea_priv->last_wrap ); + + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); + + clear_bit( 0, &primary->wrapped ); + DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); +} + + +/* ================================================================ + * 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 ) +{ + 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 + +static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv ) +{ + drm_device_dma_t *dma = dev->dma; + 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 ); - DRM_DEBUG("%s\n", __FUNCTION__); - end = ticks + (hz*3); - while(1) { - if(!test_and_set_bit(MGA_IN_DISPATCH, - &dev_priv->dispatch_status)) { - break; - } - if((signed)(end - ticks) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup\n"); - return; - } - for (i = 0 ; i < 2000 ; i++) mga_delay(); + dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t), + DRM_MEM_DRIVER ); + if ( dev_priv->head == NULL ) + DRM_OS_RETURN(ENOMEM); + + memset( dev_priv->head, 0, sizeof(drm_mga_freelist_t) ); + SET_AGE( &dev_priv->head->age, MGA_BUFFER_USED, 0 ); + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + + entry = DRM(alloc)( sizeof(drm_mga_freelist_t), + DRM_MEM_DRIVER ); + if ( entry == NULL ) + DRM_OS_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; + + buf_priv->list_entry = entry; + buf_priv->discard = 0; + buf_priv->dispatched = 0; + + dev_priv->head->next = entry; } - end = ticks + (hz*3); - DRM_DEBUG("quiescent status : %x\n", MGA_READ(MGAREG_STATUS)); - while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { - if((signed)(end - ticks) <= 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(); + + return 0; +} + +static void mga_freelist_cleanup( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *entry; + drm_mga_freelist_t *next; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + entry = dev_priv->head; + while ( entry ) { + next = entry->next; + DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); + entry = next; } - sarea_priv->dirty |= MGA_DMA_FLUSH; - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - DRM_DEBUG("exit, dispatch_status = 0x%02x\n",dev_priv->dispatch_status); + dev_priv->head = dev_priv->tail = NULL; } -static void mga_reset_freelist(drm_device_t *dev) +#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; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; int i; - for (i = 0; i < dma->buf_count; i++) { - buf = dma->buflist[ i ]; + 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; + SET_AGE( &buf_priv->list_entry->age, + MGA_BUFFER_FREE, 0 ); } } - -/* Least recently used : - * These operations are not atomic b/c they are protected by the - * hardware lock */ +#endif -drm_buf_t *mga_freelist_get(drm_device_t *dev) +static drm_buf_t *mga_freelist_get( drm_device_t *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_freelist_t *next; drm_mga_freelist_t *prev; - drm_mga_freelist_t *next; - static int failed = 0; - int ret, s; - - DRM_DEBUG("%s : tail->age : %d last_prim_age : %d\n", __FUNCTION__, - dev_priv->tail->age, dev_priv->last_prim_age); - - if(failed >= 1000 && dev_priv->tail->age >= dev_priv->last_prim_age) { - DRM_DEBUG("I'm waiting on the freelist!!! %d\n", - dev_priv->last_prim_age); - s = splsofttq(); - 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(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 == EINTR) { - clear_bit(MGA_IN_GETBUF, - &dev_priv->dispatch_status); - 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) { + 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 ); + + 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; - next->age = MGA_BUF_USED; - failed = 0; - return next->buf; + 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; } - failed++; - return NULL; + DRM_DEBUG( "returning NULL!\n" ); + return NULL; } -int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf) +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; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_freelist_t *head, *entry, *prev; + + DRM_DEBUG( "%s: age=0x%06lx wrap=%d\n", + __FUNCTION__, + buf_priv->list_entry->age.head - + dev_priv->primary->offset, + buf_priv->list_entry->age.wrap ); - DRM_DEBUG("%s\n", __FUNCTION__); + entry = buf_priv->list_entry; + head = dev_priv->head; - 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; + if ( buf_priv->list_entry->age.head == MGA_BUFFER_USED ) { + SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); prev = dev_priv->tail; - prev->next = next; - next->prev = prev; - next->next = NULL; - dev_priv->tail = next; - DRM_DEBUG("Discarded\n"); + prev->next = entry; + entry->prev = prev; + entry->next = NULL; } 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; + head->next = entry; + prev->prev = entry; + entry->prev = head; + entry->next = prev; } - - return 0; -} -static int mga_init_primary_bufs(drm_device_t *dev, drm_mga_init_t *init) -{ - 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; - - DRM_DEBUG("%s\n", __FUNCTION__); - 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)); - - temp = init->warp_ucode_size + dev_priv->primary_size; - temp = ((temp + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; - - dev_priv->ioremap = drm_ioremap(dev->agp->base + offset, - temp); - if(dev_priv->ioremap == NULL) { - DRM_DEBUG("Ioremap failed\n"); - return ENOMEM; - } - dev_priv->wait_queue = 0; - - 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 = - (u_int32_t *) (dev_priv->ioremap + - offset - - init->reserved_map_agpstart); - prim_buffer->num_dwords = 0; - prim_buffer->max_dwords = size_of_buf / sizeof(u_int32_t); - 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; + return 0; } -static void mga_fire_primary(drm_device_t *dev, drm_mga_prim_buf_t *prim) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - int use_agp = PDEA_pagpxfer_enable; - unsigned long end; - int i; - int next_idx; - PRIMLOCALS; - - DRM_DEBUG("%s\n", __FUNCTION__); - dev_priv->last_prim = prim; - - /* We never check for overflow, b/c there is always room */ - PRIMPTR(prim); - if(num_dwords <= 0) { - DRM_DEBUG("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 = ticks + (hz*3); - if(sarea_priv->dirty & MGA_DMA_FLUSH) { - DRM_DEBUG("Dma top flush\n"); - while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { - if((signed)(end - ticks) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup in fire primary " - "(Dma Top Flush)\n"); - goto out_prim_wait; - } - - for (i = 0 ; i < 4096 ; i++) mga_delay(); - } - sarea_priv->dirty &= ~(MGA_DMA_FLUSH); - } else { - DRM_DEBUG("Status wait\n"); - while((MGA_READ(MGAREG_STATUS) & 0x00020001) != 0x00020000) { - if((signed)(end - ticks) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup in fire primary " - "(Status Wait)\n"); - goto out_prim_wait; - } - - for (i = 0 ; i < 4096 ; i++) mga_delay(); - } - } - 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); - wakeup(&dev_priv->wait_queue); - clear_bit(MGA_BUF_SWAP_PENDING, &prim->buffer_status); - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); -} +/* ================================================================ + * DMA initialization, cleanup + */ -int mga_advance_primary(drm_device_t *dev) +static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) { - 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; - int s; - - /* This needs to reset the primary buffer if available, - * we should collect stats on how many times it bites - * it's tail */ - DRM_DEBUG("%s\n", __FUNCTION__); - - 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 */ - - s = splsofttq(); - if(test_and_set_bit(MGA_BUF_IN_USE, &prim_buffer->buffer_status)) { - for (;;) { - 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); - ret = tsleep(&dev_priv->wait_queue, PZERO|PCATCH, - "mgaap", 0); - if (ret) - break; - } - if(ret) { - splx(s); - return ret; - } - } - clear_bit(MGA_IN_WAIT, &dev_priv->dispatch_status); - splx(s); + drm_mga_private_t *dev_priv; + drm_map_list_entry_t *listentry; + int ret; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); + if ( !dev_priv ) + DRM_OS_RETURN(ENOMEM); - /* 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; -} + memset( dev_priv, 0, sizeof(drm_mga_private_t) ); -/* More dynamic performance decisions */ -static __inline int mga_decide_to_fire(drm_device_t *dev) -{ - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + dev_priv->chipset = init->chipset; - DRM_DEBUG("%s\n", __FUNCTION__); + dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; - if(test_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status)) { - return 1; + 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; - if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords) { - return 1; - } + 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; - if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords) { - 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)) { - return 1; - } - } + dev_priv->depth_cpp = init->depth_cpp; + dev_priv->depth_offset = init->depth_offset; + dev_priv->depth_pitch = init->depth_pitch; - 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; - } - } + /* FIXME: Need to support AGP textures... + */ + dev_priv->texture_offset = init->texture_offset[0]; + dev_priv->texture_size = init->texture_size[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; + TAILQ_FOREACH(listentry, dev->maplist, link) { + drm_map_t *map = listentry->map; + if (map->type == _DRM_SHM && + map->flags & _DRM_CONTAINS_LOCK) { + dev_priv->sarea = map; + break; } } - 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; - int retval =0 ; + if(!dev_priv->sarea) { + DRM_ERROR( "failed to find sarea!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(EINVAL); + } + + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR( "failed to find framebuffer!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR( "failed to find mmio region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->status, init->status_offset ); + if(!dev_priv->status) { + DRM_ERROR( "failed to find status page!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->warp, init->warp_offset ); + if(!dev_priv->warp) { + DRM_ERROR( "failed to find warp microcode region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->primary, init->primary_offset ); + if(!dev_priv->primary) { + DRM_ERROR( "failed to find primary dma region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR( "failed to find dma buffer region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(EINVAL); + } + + 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 ); + + if(!dev_priv->warp->handle || + !dev_priv->primary->handle || + !dev_priv->buffers->handle ) { + DRM_ERROR( "failed to ioremap agp regions!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(ENOMEM); + } + + ret = mga_warp_install_microcode( dev_priv ); + if ( ret < 0 ) { + DRM_ERROR( "failed to install WARP ucode!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(ret); + } + + ret = mga_warp_init( dev_priv ); + if ( ret < 0 ) { + DRM_ERROR( "failed to init WARP engine!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(ret); + } - if (!dev_priv) return EBUSY; + dev_priv->prim.status = (u32 *)dev_priv->status->handle; - if (test_and_set_bit(0, &dev->dma_flag)) { - retval = EBUSY; - goto sch_out_wakeup; - } - - DRM_DEBUG("%s\n", __FUNCTION__); - if (!dev_priv) { - DRM_DEBUG("dev_priv is not set\n"); - return (0); - } - - 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); - DRM_DEBUG("Not locked\n"); - 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); - } - } - - if (!locked) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } - clear_bit(0, &dev->dma_flag); -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); - wakeup(&dev_priv->flush_queue); - } + mga_do_wait_for_idle( dev_priv ); - if(test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && - dev_priv->tail->age < dev_priv->last_prim_age) - wakeup(&dev_priv->buf_queue); + /* 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 - return retval; -} + 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; -static void mga_dma_service(void *arg) -{ - drm_device_t *dev = (drm_device_t *)arg; - 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); - taskqueue_enqueue(taskqueue_swi, &dev->task); - wakeup(&dev_priv->wait_queue); -} + dev_priv->prim.tail = 0; + dev_priv->prim.space = dev_priv->prim.size; + dev_priv->prim.wrapped = 0; -static void mga_dma_task_queue(void *device, int pending) -{ - DRM_DEBUG("%s\n", __FUNCTION__); - mga_dma_schedule((drm_device_t *)device, 0); -} + dev_priv->prim.last_flush = 0; + dev_priv->prim.last_wrap = 0; -int mga_dma_cleanup(drm_device_t *dev) -{ - DRM_DEBUG("%s\n", __FUNCTION__); + dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE; - 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_ioremapfree((void *) dev_priv->ioremap, temp); - } - 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); - } + 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; - drm_free(dev->dev_private, sizeof(drm_mga_private_t), - DRM_MEM_DRIVER); - dev->dev_private = NULL; + if ( mga_freelist_init( dev, dev_priv ) < 0 ) { + DRM_ERROR( "could not initialize freelist\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + DRM_OS_RETURN(ENOMEM); } + /* Make dev_private visable to others. */ + dev->dev_private = (void *)dev_priv; return 0; } -static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) { - drm_mga_private_t *dev_priv; - drm_map_t *sarea_map = NULL; +int mga_do_cleanup_dma( drm_device_t *dev ) +{ + 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; - - 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); - DRM_DEBUG("reserved_map or buffer_map are invalid\n"); - return EINVAL; - } - - 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 *) - ((u_int8_t *)sarea_map->handle + - init->sarea_priv_offset); + if ( dev->dev_private ) { + drm_mga_private_t *dev_priv = dev->dev_private; - /* 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; - dev_priv->flush_queue = 0; - 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->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; - } + DRM_IOREMAPFREE( dev_priv->warp ); + DRM_IOREMAPFREE( dev_priv->primary ); + DRM_IOREMAPFREE( dev_priv->buffers ); - dev_priv->status_page = (void*)dev_priv->real_status_page; /* XXX wants nocache */ -#if 0 - 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"); - return ENOMEM; - } -#endif + if ( dev_priv->head != NULL ) { + mga_freelist_cleanup( dev ); + } - /* Write status page when secend or softrap occurs */ - MGA_WRITE(MGAREG_PRIMPTR, - vtophys((void *)dev_priv->real_status_page) | 0x00000003); - - - /* Private is now filled in, initialize the hardware */ - { - PRIMLOCALS; - PRIMGETPTR( dev_priv ); - - 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 - */ - - mga_flush_write_combine(); - MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL); - - MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) | - PDEA_pagpxfer_enable)); - - while(MGA_READ(MGAREG_DWGSYNC) != 0x0100) ; - } - - if(mga_freelist_init(dev) != 0) { - DRM_ERROR("Could not initialize freelist\n"); - mga_dma_cleanup(dev); - return ENOMEM; + DRM(free)( dev->dev_private, sizeof(drm_mga_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; } + return 0; } -int -mga_dma_init(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) +int mga_dma_init( DRM_OS_IOCTL ) { - drm_device_t *dev = kdev->si_drv1; + DRM_OS_DEVICE; drm_mga_init_t init; - - DRM_DEBUG("%s\n", __FUNCTION__); + + DRM_OS_KRNFROMUSR( init, (drm_mga_init_t *) data, sizeof(init) ); - init = *(drm_mga_init_t *) data; - - 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; + DRM_OS_RETURN( EINVAL ); } + + +/* ================================================================ + * Primary DMA stream management + */ -int mga_irq_install(drm_device_t *dev, int irq) +int mga_dma_flush( DRM_OS_IOCTL ) { - int rid; - int retcode; + DRM_OS_DEVICE; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_lock_t lock; - if (!irq) return EINVAL; - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - if (dev->irq) { - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - return EBUSY; - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - DRM_DEBUG("install irq handler %d\n", irq); + LOCK_TEST_WITH_RETURN( dev ); - 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; - TASK_INIT(&dev->task, 0, mga_dma_task_queue, dev); - - /* Before installing handler */ - MGA_WRITE(MGAREG_IEN, 0); - /* Install handler */ - rid = 0; - dev->irq = bus_alloc_resource(dev->device, SYS_RES_IRQ, &rid, - 0, ~0, 1, RF_SHAREABLE); - if (!dev->irq) - return ENOENT; - - retcode = bus_setup_intr(dev->device, dev->irq, INTR_TYPE_TTY, - mga_dma_service, dev, &dev->irqh); - if (retcode) { - bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irq); - dev->irq = 0; - return retcode; - } - - /* After installing handler */ - MGA_WRITE(MGAREG_ICLEAR, 0x00000001); - MGA_WRITE(MGAREG_IEN, 0x00000001); - return 0; -} + DRM_OS_KRNFROMUSR( lock, (drm_lock_t *) data, sizeof(lock) ); -int mga_irq_uninstall(drm_device_t *dev) -{ - if (!dev->irq) - return EINVAL; - - DRM_DEBUG("remove irq handler %ld\n", rman_get_start(dev->irq)); - MGA_WRITE(MGAREG_ICLEAR, 0x00000001); - MGA_WRITE(MGAREG_IEN, 0); - - bus_teardown_intr(dev->device, dev->irq, dev->irqh); - bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irq); - dev->irq = 0; + 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, " : "" ); - return 0; -} + WRAP_WAIT_WITH_RETURN( dev_priv ); -int mga_control(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_control_t ctl; - - ctl = *(drm_control_t *) data; - - DRM_DEBUG("%s\n", __FUNCTION__); - - 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; + if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { + mga_do_dma_flush( dev_priv ); } -} -static int mga_flush_queue(drm_device_t *dev) -{ - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - int ret = 0; - int s; - - DRM_DEBUG("%s\n", __FUNCTION__); - - if(!dev_priv) return 0; - - if(dev_priv->next_prim->num_dwords != 0) { - s = splsofttq(); - set_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); - for (;;) { - mga_dma_schedule(dev, 0); - if (!test_bit(MGA_IN_FLUSH, - &dev_priv->dispatch_status)) - break; - atomic_inc(&dev->total_sleeps); - ret = tsleep(&dev_priv->flush_queue, PZERO|PCATCH, - "mgafq", 0); - if (ret) { - clear_bit(MGA_IN_FLUSH, - &dev_priv->dispatch_status); - break; - } - } - splx(s); + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { +#if MGA_DMA_DEBUG + int ret = mga_do_wait_for_idle( dev_priv ); + if ( ret ) + DRM_INFO( __FUNCTION__": -EBUSY\n" ); + return ret; +#else + return mga_do_wait_for_idle( dev_priv ); +#endif + } else { + return 0; } - return ret; } -/* Must be called with the lock held */ -void mga_reclaim_buffers(drm_device_t *dev, pid_t pid) +int mga_dma_reset( DRM_OS_IOCTL ) { - drm_device_dma_t *dma = dev->dma; - int i; + DRM_OS_DEVICE; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - if (!dma) return; - if(dev->dev_private == NULL) return; - if(dma->buflist == NULL) return; - - DRM_DEBUG("%s\n", __FUNCTION__); - 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; - } - } + LOCK_TEST_WITH_RETURN( dev ); + + return mga_do_dma_reset( dev_priv ); } + + +/* ================================================================ + * DMA buffer management + */ -int mga_lock(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) +#if 0 +static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d ) { - drm_device_t *dev = kdev->si_drv1; - int ret = 0; - drm_lock_t lock; - - DRM_DEBUG("%s\n", __FUNCTION__); - lock = *(drm_lock_t *) data; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - p->p_pid, lock.context); - return EINVAL; - } - - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, p->p_pid, dev->lock.hw_lock->lock, - lock.flags); + drm_buf_t *buf; + int i; - if (lock.context < 0) { - return EINVAL; - } - - /* Only one queue: - */ + for ( i = d->granted_count ; i < d->request_count ; i++ ) { + buf = mga_freelist_get( dev ); + if ( !buf ) + DRM_OS_RETURN( EAGAIN ); + + buf->pid = current->pid; + + if ( DRM_OS_COPYTOUSR( &d->request_indices[i], + &buf->idx, sizeof(buf->idx) ) ) + DRM_OS_RETURN( EFAULT ); + if ( DRM_OS_COPYTOUSR( &d->request_sizes[i], + &buf->total, sizeof(buf->total) ) ) + DRM_OS_RETURN( EFAULT ); - if (!ret) { - atomic_inc(&dev->lock.lock_queue); - for (;;) { - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = p->p_pid; - dev->lock.lock_time = ticks; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); - ret = tsleep(&dev->lock.lock_queue, PZERO|PCATCH, - "mgal2", 0); - if (ret) - break; - } - atomic_dec(&dev->lock.lock_queue); + d->granted_count++; } - - if (!ret) { - 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(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_lock_t lock; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - int s; +#endif /* 0 */ - DRM_DEBUG("%s\n", __FUNCTION__); - lock = *(drm_lock_t *) data; +int mga_dma_buffers( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_dma_t d; + drm_buf_t *buf; + int i; + int ret = 0; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_flush_ioctl called without lock held\n"); - return EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); - if(lock.flags & _DRM_LOCK_FLUSH || lock.flags & _DRM_LOCK_FLUSH_ALL) { - drm_mga_prim_buf_t *temp_buf; - temp_buf = dev_priv->current_prim; + DRM_OS_KRNFROMUSR( d, (drm_dma_t *) data, sizeof(d) ); - 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); + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + DRM_OS_CURRENTPID, d.send_count ); + DRM_OS_RETURN( EINVAL ); } - if(lock.flags & _DRM_LOCK_QUIESCENT) { - mga_flush_queue(dev); - mga_dma_quiescent(dev); + + /* 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", + DRM_OS_CURRENTPID, d.request_count, dma->buf_count ); + DRM_OS_RETURN( EINVAL ); + } + + WRAP_TEST_WITH_RETURN( dev_priv ); + + d.granted_count = 0; + + if ( d.request_count ) { + for ( i = d.granted_count ; i < d.request_count ; i++ ) { + buf = mga_freelist_get( dev ); + if ( !buf ) + DRM_OS_RETURN( EAGAIN ); + + buf->pid = DRM_OS_CURRENTPID; + + if ( DRM_OS_COPYTOUSR( &d.request_indices[i], + &buf->idx, sizeof(buf->idx) ) ) + DRM_OS_RETURN( EFAULT ); + if ( DRM_OS_COPYTOUSR( &d.request_sizes[i], + &buf->total, sizeof(buf->total) ) ) + DRM_OS_RETURN( EFAULT ); + + d.granted_count++; + } + ret = 0; } + + DRM_OS_KRNTOUSR( (drm_dma_t *) data, d, sizeof(d) ); - return 0; + return ret; } 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.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c:1.2 Thu Mar 1 21:45:39 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c Wed Dec 12 19:24:49 2001 @@ -1,6 +1,6 @@ -/* mga_drv.c -- Matrox g200/g400 driver +/* 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. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. @@ -11,704 +11,88 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to 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. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ -#include "drmP.h" -#include "mga_drv.h" +#include <sys/types.h> +#include <sys/bus.h> #include <pci/pcivar.h> - -MODULE_DEPEND(mga, drm, 1, 1, 1); -MODULE_DEPEND(mga, agp, 1, 1, 1); +#include <opt_drm_linux.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 0 - -drm_ctx_t mga_res_ctx; - -static int mga_probe(device_t dev) -{ - const char *s = 0; - - switch (pci_get_devid(dev)) { - case 0x0525102b: - s = "Matrox MGA G400 AGP graphics accelerator"; - break; - - case 0x0521102b: - s = "Matrox MGA G200 AGP graphics accelerator"; - break; - } - - if (s) { - device_set_desc(dev, s); - return 0; - } - - return ENXIO; -} - -static int mga_attach(device_t dev) -{ - return mga_init(dev); -} - -static int mga_detach(device_t dev) -{ - mga_cleanup(dev); - return 0; -} - -static device_method_t mga_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, mga_probe), - DEVMETHOD(device_attach, mga_attach), - DEVMETHOD(device_detach, mga_detach), - - { 0, 0 } -}; +#include "mga.h" +#include "drmP.h" +#include "mga_drv.h" -static driver_t mga_driver = { - "drm", - mga_methods, - sizeof(drm_device_t), -}; +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." -static devclass_t mga_devclass; -#define MGA_SOFTC(unit) \ - ((drm_device_t *) devclass_get_softc(mga_devclass, unit)) - -DRIVER_MODULE(if_mga, pci, mga_driver, mga_devclass, 0, 0); - -#define CDEV_MAJOR 145 - /* mga_drv.c */ -static struct cdevsw mga_cdevsw = { - /* open */ mga_open, - /* close */ mga_close, - /* read */ drm_read, - /* write */ drm_write, - /* ioctl */ mga_ioctl, - /* poll */ drm_poll, - /* mmap */ drm_mmap, - /* strategy */ nostrategy, - /* name */ "mga", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_TRACKCLOSE, - /* bmaj */ -1 -}; +#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 -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 }, +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x102b, 0x0520, 0, "Matrox G200 (PCI)"}, + {0x102b, 0x0521, 1, "Matrox G200 (AGP)"}, + {0x102b, 0x0525, 1, "Matrox G400 (AGP)"}, + {0, 0, 0, NULL} }; - -#define MGA_IOCTL_COUNT DRM_ARRAY_SIZE(mga_ioctls) -static int mga_setup(drm_device_t *dev) -{ - int i; - - device_busy(dev->device); - - 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; - dev->lock.lock_queue = 0; - 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; - callout_init(&dev->timer); - dev->context_wait = 0; - - timespecclear(&dev->ctx_start); - timespecclear(&dev->lck_start); - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - bzero(&dev->buf_sel, sizeof dev->buf_sel); - dev->buf_sigio = NULL; - dev->buf_readers = 0; - dev->buf_writers = 0; - dev->buf_selecting = 0; - - 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->irq) mga_irq_uninstall(dev); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - callout_stop(&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->handle); - drm_free_agp(entry->handle, entry->pages); - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - } - dev->agp->memory = NULL; - - if (dev->agp->acquired) - agp_release(dev->agp->agpdev); - - 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; - wakeup(&dev->lock.lock_queue); - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - return 0; -} - -/* mga_init is called via mga_attach at module load time, */ - -int -mga_init(device_t nbdev) -{ - int retcode; - drm_device_t *dev = device_get_softc(nbdev); - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - simple_lock_init(&dev->count_lock); - lockinit(&dev->dev_lock, PZERO, "drmlk", 0, 0); - -#if 0 - drm_parse_options(mga); -#endif - dev->device = nbdev; - dev->devnode = make_dev(&mga_cdevsw, - device_get_unit(nbdev), - DRM_DEV_UID, - DRM_DEV_GID, - DRM_DEV_MODE, - MGA_NAME); - dev->name = MGA_NAME; - - DRM_DEBUG("doing mem init\n"); - drm_mem_init(); - DRM_DEBUG("doing proc init\n"); - drm_sysctl_init(dev); - TAILQ_INIT(&dev->files); - DRM_DEBUG("doing agp init\n"); - dev->agp = drm_agp_init(); - if(dev->agp == NULL) { - DRM_INFO("The mga drm module requires the agp module" - " to function correctly\nPlease load the agp" - " module before you load the mga module\n"); - drm_sysctl_cleanup(dev); - mga_takedown(dev); - return ENOMEM; - } -#if 0 - 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 - DRM_DEBUG("doing ctxbitmap init\n"); - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_sysctl_cleanup(dev); - 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, - device_get_unit(nbdev)); - - return 0; -} - -/* mga_cleanup is called via cleanup_module at module unload time. */ - -void mga_cleanup(device_t nbdev) -{ - drm_device_t *dev = device_get_softc(nbdev); - - DRM_DEBUG("\n"); - - drm_sysctl_cleanup(dev); - destroy_dev(dev->devnode); - - DRM_INFO("Module unloaded\n"); - drm_ctxbitmap_cleanup(dev); - mga_dma_cleanup(dev); -#if 0 - 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_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -} - -int -mga_version(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_version_t version; - int len; - - version = *(drm_version_t *) data; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - int error = copyout(value, name, len); \ - if (error) return error; \ - } - - 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); - - *(drm_version_t *) data = version; - return 0; -} - -int -mga_open(dev_t kdev, int flags, int fmt, struct proc *p) -{ - drm_device_t *dev = MGA_SOFTC(minor(kdev)); - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - - device_busy(dev->device); - if (!(retcode = drm_open_helper(kdev, flags, fmt, p, dev))) { - atomic_inc(&dev->total_open); - simple_lock(&dev->count_lock); - if (!dev->open_count++) { - simple_unlock(&dev->count_lock); - retcode = mga_setup(dev); - } - simple_unlock(&dev->count_lock); - } - device_unbusy(dev->device); - - return retcode; -} - -int -mga_close(dev_t kdev, int flags, int fmt, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_file_t *priv; - int retcode = 0; - - DRM_DEBUG("pid = %d, open_count = %d\n", - p->p_pid, dev->open_count); - - priv = drm_find_file_by_proc(dev, p); - if (!priv) { - DRM_DEBUG("can't find authenticator\n"); - return EINVAL; - } - - if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) - && dev->lock.pid == p->p_pid) { - mga_reclaim_buffers(dev, priv->pid); - DRM_ERROR("Process %d dead, freeing lock for context %d\n", - p->p_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 */ - for (;;) { - 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 = p->p_pid; - dev->lock.lock_time = ticks; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - /* Contention */ - atomic_inc(&dev->total_sleeps); - retcode = tsleep(&dev->lock.lock_queue, - PZERO|PCATCH, - "drmlk2", - 0); - if (retcode) - break; - } - if(!retcode) { - mga_reclaim_buffers(dev, priv->pid); - drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT); - } - } - funsetown(dev->buf_sigio); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, p); - priv = drm_find_file_by_proc(dev, p); - if (priv) { - priv->refs--; - if (!priv->refs) { - TAILQ_REMOVE(&dev->files, priv, link); - drm_free(priv, sizeof(*priv), DRM_MEM_FILES); - } - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, p); - - atomic_inc(&dev->total_close); - simple_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); - simple_unlock(&dev->count_lock); - return EBUSY; - } - simple_unlock(&dev->count_lock); - device_unbusy(dev->device); - return mga_takedown(dev); - } - simple_unlock(&dev->count_lock); - return retcode; -} - - -/* mga_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int -mga_ioctl(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_device_t *dev = kdev->si_drv1; - drm_file_t *priv; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - d_ioctl_t *func; - - DRM_DEBUG("dev=%p\n", dev); - priv = drm_find_file_by_proc(dev, p); - if (!priv) { - DRM_DEBUG("can't find authenticator\n"); - return EINVAL; - } - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - - DRM_DEBUG("pid = %d, cmd = 0x%02lx, nr = 0x%02x, auth = %d\n", - p->p_pid, cmd, nr, priv->authenticated); - - switch (cmd) { - case FIONBIO: - atomic_dec(&dev->ioctl_count); - return 0; - - case FIOASYNC: - atomic_dec(&dev->ioctl_count); - dev->flags |= FASYNC; - return 0; - - case FIOSETOWN: - atomic_dec(&dev->ioctl_count); - return fsetown(*(int *)data, &dev->buf_sigio); - - case FIOGETOWN: - atomic_dec(&dev->ioctl_count); - *(int *) data = fgetown(dev->buf_sigio); - return 0; - } - - if (nr >= MGA_IOCTL_COUNT) { - retcode = EINVAL; - } else { - ioctl = &mga_ioctls[nr]; - func = ioctl->func; - - if (!func) { - DRM_DEBUG("no function\n"); - retcode = EINVAL; - } else if ((ioctl->root_only && suser(p)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = EACCES; - } else { - retcode = (func)(kdev, cmd, data, flags, p); - } - } - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -int -mga_unlock(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_lock_t lock; - int s; - - lock = *(drm_lock_t *) data; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - p->p_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); - - s = splsofttq(); - mga_dma_schedule(dev, 1); - splx(s); - - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } +#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_vm.h" +#include "drm_sysctl.h" - return 0; -} +DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 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.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h:1.2 Thu Mar 1 21:45:39 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h Wed Dec 12 19:24:49 2001 @@ -1,4 +1,4 @@ -/* mga_drv.h -- Private header for the Matrox g200/g400 driver +/* 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. @@ -11,486 +11,628 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to 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. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Gareth Hughes <gareth@valinux.com> */ -#ifndef _MGA_DRV_H_ -#define _MGA_DRV_H_ +#ifndef __MGA_DRV_H__ +#define __MGA_DRV_H__ -#define MGA_BUF_IN_USE 0 -#define MGA_BUF_SWAP_PENDING 1 -#define MGA_BUF_FORCE_FIRE 2 -#define MGA_BUF_NEEDS_OVERFLOW 3 +#ifndef u8 +#define u8 u_int8_t +#define u16 u_int16_t +#define u32 u_int32_t +#endif + +typedef struct drm_mga_primary_buffer { + u8 *start; + u8 *end; + int size; + + u32 tail; + int space; + volatile long 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 { + struct drm_mga_freelist *next; + struct drm_mga_freelist *prev; + drm_mga_age_t age; + drm_buf_t *buf; +} drm_mga_freelist_t; typedef struct { - u_int32_t buffer_status; - int num_dwords; - int max_dwords; - u_int32_t *current_dma_ptr; - u_int32_t *head; - u_int32_t phys_head; - unsigned int prim_age; - int sec_used; - int idx; -} drm_mga_prim_buf_t; + drm_mga_freelist_t *list_entry; + int discard; + int dispatched; +} drm_mga_buf_priv_t; -typedef struct _drm_mga_freelist { - __volatile__ unsigned int age; - drm_buf_t *buf; - struct _drm_mga_freelist *next; - struct _drm_mga_freelist *prev; -} drm_mga_freelist_t; +typedef struct drm_mga_private { + drm_mga_primary_buffer_t prim; + drm_mga_sarea_t *sarea_priv; -#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 { - u_int32_t 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; - u_int8_t *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; drm_mga_freelist_t *head; drm_mga_freelist_t *tail; - int flush_queue; /* Processes waiting until flush */ - int wait_queue; /* Processes waiting until interrupt */ - int buf_queue; /* Processes waiting for a free buf */ - /* Some validated register values: - */ - u_int32_t mAccess; -} drm_mga_private_t; - /* mga_drv.c */ -extern int mga_init(device_t); -extern void mga_cleanup(device_t); -extern d_ioctl_t mga_version; -extern d_open_t mga_open; -extern d_close_t mga_close; -extern d_ioctl_t mga_ioctl; -extern d_ioctl_t mga_unlock; + unsigned int warp_pipe; + unsigned long warp_pipe_phys[MGA_MAX_WARP_PIPES]; + int chipset; + int usec_timeout; + + u32 clear_cmd; + u32 maccess; + + unsigned int fb_cpp; + unsigned int front_offset; + unsigned int front_pitch; + unsigned int back_offset; + unsigned int back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset; + unsigned int depth_pitch; + + unsigned int texture_offset; + unsigned int texture_size; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *status; + drm_map_t *warp; + drm_map_t *primary; + drm_map_t *buffers; + drm_map_t *agp_textures; +} drm_mga_private_t; + /* mga_dma.c */ -extern int mga_dma_schedule(drm_device_t *dev, int locked); -extern int mga_irq_install(drm_device_t *dev, int irq); -extern int mga_irq_uninstall(drm_device_t *dev); -extern d_ioctl_t mga_dma; -extern d_ioctl_t mga_control; -extern d_ioctl_t mga_lock; - -/* mga_dma_init does init and release */ -extern int mga_dma_cleanup(drm_device_t *dev); -extern d_ioctl_t mga_dma_init; -extern d_ioctl_t mga_flush_ioctl; -extern void mga_flush_write_combine(void); -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 d_ioctl_t mga_addbufs; -extern d_ioctl_t mga_infobufs; -extern d_ioctl_t mga_markbufs; -extern d_ioctl_t mga_freebufs; -extern d_ioctl_t mga_mapbufs; -extern d_ioctl_t mga_addmap; - /* mga_state.c */ -extern d_ioctl_t mga_clear_bufs; -extern d_ioctl_t mga_swap_bufs; -extern d_ioctl_t mga_iload; -extern d_ioctl_t mga_vertex; -extern d_ioctl_t mga_indices; - /* mga_context.c */ -extern d_ioctl_t mga_resctx; -extern d_ioctl_t mga_addctx; -extern d_ioctl_t mga_modctx; -extern d_ioctl_t mga_getctx; -extern d_ioctl_t mga_switchctx; -extern d_ioctl_t mga_newctx; -extern d_ioctl_t mga_rmctx; - -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); - - -typedef enum { - TT_GENERAL, - TT_BLIT, - TT_VECTOR, - TT_VERTEX -} transferType_t; +extern int mga_dma_init( DRM_OS_IOCTL ); +extern int mga_dma_flush( DRM_OS_IOCTL ); +extern int mga_dma_reset( DRM_OS_IOCTL ); +extern int mga_dma_buffers( DRM_OS_IOCTL ); + +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 ); -typedef struct { - drm_mga_freelist_t *my_freelist; - int discard; - int dispatched; -} drm_mga_buf_priv_t; +extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ); + /* mga_state.c */ +extern int mga_dma_clear( DRM_OS_IOCTL ); +extern int mga_dma_swap( DRM_OS_IOCTL ); +extern int mga_dma_vertex( DRM_OS_IOCTL ); +extern int mga_dma_indices( DRM_OS_IOCTL ); +extern int mga_dma_iload( DRM_OS_IOCTL ); +extern int mga_dma_blit( DRM_OS_IOCTL ); + + /* mga_warp.c */ +extern int mga_warp_install_microcode( drm_mga_private_t *dev_priv ); +extern int mga_warp_init( drm_mga_private_t *dev_priv ); + +#define mga_flush_write_combine() DRM_OS_READMEMORYBARRIER + +#define MGA_BASE( reg ) ((unsigned long)(dev_priv->mmio->handle)) +#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) + +#define MGA_DEREF( reg ) *(volatile u32 *)MGA_ADDR( reg ) +#define MGA_DEREF8( reg ) *(volatile u8 *)MGA_ADDR( reg ) + +#ifdef __alpha__ +#define MGA_READ( reg ) (_MGA_READ((u32 *)MGA_ADDR(reg))) +#define MGA_WRITE( reg, val ) do { wmb(); MGA_DEREF( reg ) = val; } while (0) +#define MGA_WRITE8( reg, val ) do { wmb(); MGA_DEREF8( reg ) = val; } while (0) + +static inline u32 _MGA_READ(u32 *addr) +{ + mb(); + return *(volatile u32 *)addr; +} + +#else +#define MGA_READ( reg ) MGA_DEREF( reg ) +#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0) +#define MGA_WRITE8( reg, val ) do { MGA_DEREF8( reg ) = val; } while (0) +#endif + #define DWGREG0 0x1c00 #define DWGREG0_END 0x1dff #define DWGREG1 0x2c00 #define DWGREG1_END 0x2dff #define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END) -#define ADRINDEX0(r) (u_int8_t)((r - DWGREG0) >> 2) -#define ADRINDEX1(r) (u_int8_t)(((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 u_int8_t tempIndex[4]; u_int32_t *dma_ptr; u_int32_t 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] = *(u_int32_t *)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 != DRM_OS_CURRENTPID ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + DRM_OS_RETURN( EINVAL ); \ + } \ +} 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" ); \ + DRM_OS_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 ) ) { \ + if ( MGA_DMA_DEBUG ) \ + DRM_INFO( __FUNCTION__": wrap...\n" ); \ + DRM_OS_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 ); \ } \ -}while (0) + 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/bsd/drm/kernel/mga/mga_state.c diff -u 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.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c:1.2 Thu Mar 1 21:45:39 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c Wed Dec 12 19:24:49 2001 @@ -1,4 +1,4 @@ -/* mga_state.c -- State support for mga g200/g400 +/* 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. @@ -11,431 +11,408 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to 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@precisioninsight.com> - * Keith Whitwell <keithw@precisioninsight.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" -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) - +/* ================================================================ + * DMA hardware state programming functions + */ -static void mgaEmitClipRect(drm_mga_private_t * dev_priv, - drm_clip_rect_t * box) +static void mga_emit_clip_rect( drm_mga_private_t *dev_priv, + drm_clip_rect_t *box ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - PRIMLOCALS; - DRM_DEBUG("%s\n", __FUNCTION__); + 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 (eliminates clip disable) */ - 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_DEBUG("%s\n", __FUNCTION__); - - /* This takes a max of 20 dwords */ - PRIMGETPTR(dev_priv); + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + DMA_LOCALS; - 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]); + BEGIN_DMA( 3 ); - 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_DSTORG, ctx->dstorg, + MGA_MACCESS, ctx->maccess, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); - 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_ALPHACTRL, ctx->alphactrl, + MGA_FOGCOL, ctx->fogcolor, + MGA_WFLAG, ctx->wflag, + MGA_ZORG, dev_priv->depth_offset ); - PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]); - PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + DMA_BLOCK( MGA_FCOL, ctx->fcol, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); - } 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; - DRM_DEBUG("%s\n", __FUNCTION__); - - 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; - DRM_DEBUG("%s\n", __FUNCTION__); + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; + DMA_LOCALS; - PRIMGETPTR(dev_priv); + BEGIN_DMA( 4 ); - /* This takes a max of 30 dwords */ + DMA_BLOCK( MGA_TEXCTL2, tex->texctl2, + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); - PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); - PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); - PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); - PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); - PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); - PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); - PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); - PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR24, tex->texwidth ); - PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); - PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_WR49, 0); + DMA_BLOCK( MGA_WR34, tex->texheight, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff, + MGA_DMAPAD, 0x00000000 ); - PRIMOUTREG(MGAREG_WR57, 0); - PRIMOUTREG(MGAREG_WR53, 0); - PRIMOUTREG(MGAREG_WR61, 0); - PRIMOUTREG(MGAREG_WR52, 0x40); - - PRIMOUTREG(MGAREG_WR60, 0x40); - PRIMOUTREG(MGAREG_WR54, regs[MGA_TEXREG_WIDTH] | 0x40); - PRIMOUTREG(MGAREG_WR62, regs[MGA_TEXREG_HEIGHT] | 0x40); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); - PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); - - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -#define TMC_map1_enable 0x80000000 - -static void mgaG400EmitTex1(drm_mga_private_t * dev_priv) +static __inline__ void mga_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_DEBUG("%s\n", __FUNCTION__); - - PRIMGETPTR(dev_priv); + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; + DMA_LOCALS; - /* This takes 25 dwords */ + BEGIN_DMA( 6 ); - 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_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC, + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); - 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_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); - 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_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR49, 0x00000000 ); - PRIMOUTREG(MGAREG_WR57, 0); - PRIMOUTREG(MGAREG_WR53, 0); - PRIMOUTREG(MGAREG_WR61, 0); - PRIMOUTREG(MGAREG_WR52, regs[MGA_TEXREG_WIDTH] | 0x40); + DMA_BLOCK( MGA_WR57, 0x00000000, + MGA_WR53, 0x00000000, + MGA_WR61, 0x00000000, + MGA_WR52, MGA_G400_WR_MAGIC ); - PRIMOUTREG(MGAREG_WR60, regs[MGA_TEXREG_HEIGHT] | 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_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. - */ - -#define EMIT_PIPE 50 -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_DEBUG("%s\n", __FUNCTION__); - - PRIMGETPTR(dev_priv); - - /* This takes 50 dwords */ - - /* 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); - } + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[1]; + DMA_LOCALS; - PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + BEGIN_DMA( 5 ); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x18000000); - } + 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 ); - PRIMOUTREG(MGAREG_WFLAG, 0); - PRIMOUTREG(MGAREG_WFLAG1, 0); - PRIMOUTREG(MGAREG_WR56, MAGIC_FPARAM_HEX_VALUE); - PRIMOUTREG(MGAREG_DMAPAD, 0); + ADVANCE_DMA(); +} - 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 */ +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; + BEGIN_DMA( 3 ); - PRIMOUTREG(MGAREG_WR54, 0x40); /* Tex stage 0 : w */ - PRIMOUTREG(MGAREG_WR62, 0x40); /* Tex stage 0 : h */ - PRIMOUTREG(MGAREG_WR52, 0x40); /* Tex stage 1 : w */ - PRIMOUTREG(MGAREG_WR60, 0x40); /* Tex stage 1 : h */ + DMA_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 ); + /* 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; - DRM_DEBUG("%s\n", __FUNCTION__); - - PRIMGETPTR(dev_priv); + unsigned int pipe = sarea_priv->warp_pipe; + DMA_LOCALS; - /* This takes 15 dwords */ + BEGIN_DMA( 10 ); - PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend); - PRIMOUTREG(MGAREG_WVRTXSZ, 7); - PRIMOUTREG(MGAREG_WFLAG, 0); - PRIMOUTREG(MGAREG_WR24, 0); /* tex w/h */ - - 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; - DRM_DEBUG("%s\n", __FUNCTION__); - 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; - DRM_DEBUG("%s\n", __FUNCTION__); - - 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; + DRM_OS_RETURN( EINVAL ); } return 0; @@ -443,667 +420,647 @@ /* 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; - DRM_DEBUG("%s\n", __FUNCTION__); + org = tex->texorg & (MGA_TEXORGMAP_MASK | MGA_TEXORGACC_MASK); - 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; + if ( org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI) ) { + DRM_ERROR( "*** bad TEXORG: 0x%x, unit %d\n", + tex->texorg, unit ); + tex->texorg = 0; + DRM_OS_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; - - DRM_DEBUG("%s\n", __FUNCTION__); + 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 ) { - DRM_DEBUG("%s\n", __FUNCTION__); + 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 ); + DRM_OS_RETURN( EINVAL ); + } - if (dstOrg < dev_priv->textureOffset || - dstOrg + length > - (dev_priv->textureOffset + dev_priv->textureSize)) { - return EINVAL; + if ( length & MGA_ILOAD_MASK ) { + DRM_ERROR( "*** bad iload length: 0x%x\n", + length & MGA_ILOAD_MASK ); + DRM_OS_RETURN( EINVAL ); } - if (length % 64) { - 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 ); + DRM_OS_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_DEBUG("%s\n", __FUNCTION__); + 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(); - PRIM_OVERFLOW(dev, dev_priv, 30); + for ( i = 0 ; i < nbox ; i++ ) { + drm_clip_rect_t *box = &pbox[i]; + u32 height = box->y2 - box->y1; - PRIMOUTREG(MGAREG_DSTORG, destOrg); - PRIMOUTREG(MGAREG_MACCESS, 0x00000000); - DRM_DEBUG("srcorg : %lx\n", bus_address | use_agp); - PRIMOUTREG(MGAREG_SRCORG, (u32) bus_address | use_agp); - PRIMOUTREG(MGAREG_AR5, 64); + DRM_DEBUG( " from=%d,%d to=%d,%d\n", + box->x1, box->y1, box->x2, box->y2 ); - PRIMOUTREG(MGAREG_PITCH, 64); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); + if ( clear->flags & MGA_FRONT ) { + BEGIN_DMA( 2 ); - PRIMOUTREG(MGAREG_AR0, 63); - PRIMOUTREG(MGAREG_AR3, 0); - PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16)); - PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->color_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_SRCORG, 0); - PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + 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(); + } - PRIMADVANCE(dev_priv); + 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_vertex(drm_device_t * dev, drm_buf_t * buf) +static void mga_dma_dispatch_swap( drm_device_t *dev ) { drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_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; - int i = 0; - PRIMLOCALS; - DRM_DEBUG("%s\n", __FUNCTION__); + 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" ); - DRM_DEBUG("dispatch vertex %d addr 0x%lx, " - "length 0x%x nbox %d dirty %x\n", - buf->idx, address, length, - sarea_priv->nbox, sarea_priv->dirty); - - DRM_DEBUG("used : %d, total : %d\n", buf->used, buf->total); - - if (buf->used) { - /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). - */ - buf_priv->dispatched = 1; - PRIM_OVERFLOW(dev, dev_priv, - (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); - mgaEmitState(dev_priv); + sarea_priv->last_frame.head = dev_priv->prim.tail; + sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap; -#if 0 - length = dev_priv->vertexsize * 3 * 4; -#endif + BEGIN_DMA( 4 + nbox ); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + DMA_BLOCK( MGA_DSTORG, dev_priv->front_offset, + MGA_MACCESS, dev_priv->maccess, + MGA_SRCORG, dev_priv->back_offset, + MGA_AR5, dev_priv->front_pitch ); - do { - if (i < sarea_priv->nbox) { - DRM_DEBUG("idx %d Emit box %d/%d:" - "%d,%d - %d,%d\n", - buf->idx, - i, sarea_priv->nbox, - sarea_priv->boxes[i].x1, - sarea_priv->boxes[i].y1, - sarea_priv->boxes[i].x2, - sarea_priv->boxes[i].y2); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_PLNWT, 0xffffffff, + MGA_DWGCTL, MGA_DWGCTL_COPY ); - mgaEmitClipRect(dev_priv, - &sarea_priv->boxes[i]); - } + 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; - 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); - } + DRM_DEBUG( " from=%d,%d to=%d,%d\n", + box->x1, box->y1, box->x2, box->y2 ); - if (buf_priv->discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); - buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); + 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_indices(drm_device_t * dev, - drm_buf_t * buf, - unsigned int start, unsigned int end) +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 int address = (unsigned int) buf->bus_address; - int use_agp = PDEA_pagpxfer_enable; + u32 address = (u32) buf->bus_address; + u32 length = (u32) buf->used; int i = 0; - PRIMLOCALS; - DRM_DEBUG("%s\n", __FUNCTION__); + DMA_LOCALS; + DRM_DEBUG( "vertex: buf=%d used=%d\n", buf->idx, buf->used ); - DRM_DEBUG("dispatch indices %d addr 0x%x, " - "start 0x%x end 0x%x nbox %d dirty %x\n", - buf->idx, address, start, end, - sarea_priv->nbox, sarea_priv->dirty); - - if (start != end) { - /* 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); + MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); do { - if (i < sarea_priv->nbox) { - DRM_DEBUG("idx %d Emit box %d/%d:" - "%d,%d - %d,%d\n", - buf->idx, - i, sarea_priv->nbox, - sarea_priv->boxes[i].x1, - sarea_priv->boxes[i].y1, - sarea_priv->boxes[i].x2, - sarea_priv->boxes[i].y2); - - mgaEmitClipRect(dev_priv, - &sarea_priv->boxes[i]); + if ( i < sarea_priv->nbox ) { + mga_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); } + + BEGIN_DMA( 1 ); - 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)); - - PRIMADVANCE(dev_priv); - } while (++i < sarea_priv->nbox); - } - if (buf_priv->discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); + 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 ); + } -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) + FLUSH_DMA(); +} +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 *regs = sarea_priv->ContextState; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - unsigned int cmd; - int i; - PRIMLOCALS; - DRM_DEBUG("%s\n", __FUNCTION__); + u32 address = (u32) buf->bus_address; + int i = 0; + DMA_LOCALS; + DRM_DEBUG( "indices: buf=%d start=%d end=%d\n", buf->idx, start, end ); - 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; - - DRM_DEBUG("dispatch clear %d,%d-%d,%d flags %x!\n", - pbox[i].x1, pbox[i].y1, pbox[i].x2, - pbox[i].y2, flags); - - if (flags & MGA_FRONT) { - DRM_DEBUG("clear front\n"); - 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); - } + if ( start != end ) { + buf_priv->dispatched = 1; - if (flags & MGA_BACK) { - DRM_DEBUG("clear back\n"); - 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); - } + MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); - if (flags & MGA_DEPTH) { - DRM_DEBUG("clear depth\n"); - 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); - } + do { + if ( i < sarea_priv->nbox ) { + mga_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); + } + + 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 ); } - /* 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); + FLUSH_DMA(); } -static void mga_dma_dispatch_swap(drm_device_t * dev) +/* This copies a 64 byte aligned agp region to the frambuffer with a + * standard blit, the ioctl needs to do checking. + */ +static void mga_dma_dispatch_iload( drm_device_t *dev, drm_buf_t *buf, + unsigned int dstorg, unsigned int length ) { drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int i; - int pixel_stride = dev_priv->stride / dev_priv->cpp; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_context_regs_t *ctx = &dev_priv->sarea_priv->context_state; + u32 srcorg = buf->bus_address | MGA_SRCACC_AGP | MGA_SRCMAP_SYSMEM; + u32 y2; + DMA_LOCALS; + DRM_DEBUG( "%s: buf=%d used=%d\n", + __FUNCTION__, buf->idx, buf->used ); - PRIMLOCALS; - DRM_DEBUG("%s\n", __FUNCTION__); + y2 = length / 64; - PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20); + BEGIN_DMA( 5 ); - 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_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_SRCORG, 0); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + 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 ); - PRIMADVANCE(dev_priv); + 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(); } -int mga_clear_bufs(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) +static void mga_dma_dispatch_blit( drm_device_t *dev, + drm_mga_blit_t *blit ) { - drm_device_t *dev = kdev->si_drv1; - 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; - int s; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + drm_clip_rect_t *pbox = sarea_priv->boxes; + 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; - clear = *(drm_mga_clear_t *) data; - DRM_DEBUG("%s\n", __FUNCTION__); + if ( blit->ydir == -1 ) { + srcy = blit->height - srcy - 1; + } - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_clear_bufs called without lock held\n"); - return EINVAL; - } + start = srcy * blit->src_pitch + srcx; - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + DMA_BLOCK( MGA_AR0, start + w, + MGA_AR3, start, + MGA_FXBNDRY, ((dstx + w) << 16) | (dstx & 0xffff), + MGA_YDSTLEN + MGA_EXEC, (dsty << 16) | h ); + } - /* Make sure we restore the 3D state next time. + /* Do something to flush AGP? */ - 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(); - s = splsofttq(); - mga_dma_schedule(dev, 1); - splx(s); - return 0; + + /* Force reset of DWGCTL */ + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_PITCH, dev_priv->front_pitch, + MGA_DWGCTL, ctx->dwgctl ); + + ADVANCE_DMA(); } + + +/* ================================================================ + * + */ -int mga_swap_bufs(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) +int mga_dma_clear( DRM_OS_IOCTL ) { - drm_device_t *dev = kdev->si_drv1; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + DRM_OS_DEVICE; + drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - int s; + drm_mga_clear_t clear; - DRM_DEBUG("%s\n", __FUNCTION__); + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_swap_bufs called without lock held\n"); - return EINVAL; - } + DRM_OS_KRNFROMUSR( clear, (drm_mga_clear_t *) data, sizeof(clear) ); - 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_swap(dev); - PRIMUPDATE(dev_priv); - set_bit(MGA_BUF_SWAP_PENDING, - &dev_priv->current_prim->buffer_status); - mga_flush_write_combine(); - s = splsofttq(); - mga_dma_schedule(dev, 1); - splx(s); + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + return 0; } -int mga_iload(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) +int mga_dma_swap( DRM_OS_IOCTL ) { - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + DRM_OS_DEVICE; + drm_mga_private_t *dev_priv = 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; - int s; - DRM_DEBUG("%s\n", __FUNCTION__); + LOCK_TEST_WITH_RETURN( dev ); - DRM_DEBUG("Starting Iload\n"); - iload = *(drm_mga_iload_t *) data; + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_iload called without lock held\n"); - return EINVAL; - } + WRAP_TEST_WITH_RETURN( dev_priv ); - buf = dma->buflist[iload.idx]; - buf_priv = buf->dev_private; - bus_address = buf->bus_address; - DRM_DEBUG("bus_address %lx, length %d, destorg : %x\n", - bus_address, iload.length, iload.destOrg); - - if (mgaVerifyIload(dev_priv, - bus_address, iload.destOrg, iload.length)) { - mga_freelist_put(dev, buf); - return EINVAL; - } - - sarea_priv->dirty |= MGA_UPLOAD_CTX; - - 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(); - s = splsofttq(); - mga_dma_schedule(dev, 1); - splx(s); + mga_dma_dispatch_swap( dev ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + return 0; } -int mga_vertex(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) +int mga_dma_vertex( DRM_OS_IOCTL ) { - drm_device_t *dev = kdev->si_drv1; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + DRM_OS_DEVICE; + 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_DEBUG("%s\n", __FUNCTION__); + LOCK_TEST_WITH_RETURN( dev ); - vertex = *(drm_mga_vertex_t *) data; + DRM_OS_KRNFROMUSR( vertex, (drm_mga_vertex_t *) data, sizeof(vertex) ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_vertex called without lock held\n"); - return EINVAL; - } - - DRM_DEBUG("mga_vertex\n"); - + if(vertex.idx < 0 || vertex.idx > dma->buf_count) DRM_OS_RETURN( EINVAL ); buf = dma->buflist[vertex.idx]; buf_priv = buf->dev_private; buf->used = vertex.used; buf_priv->discard = vertex.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 ( vertex.discard ) { + if ( buf_priv->dispatched == 1 ) + AGE_BUFFER( buf_priv ); buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); + mga_freelist_put( dev, buf ); } - DRM_DEBUG("bad state\n"); - return EINVAL; + DRM_OS_RETURN( EINVAL ); } - mga_dma_dispatch_vertex(dev, buf); + WRAP_TEST_WITH_RETURN( dev_priv ); - PRIMUPDATE(dev_priv); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); + mga_dma_dispatch_vertex( dev, buf ); + return 0; } - -int mga_indices(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) +int mga_dma_indices( DRM_OS_IOCTL ) { - drm_device_t *dev = kdev->si_drv1; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + DRM_OS_DEVICE; + 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_indices_t indices; - DRM_DEBUG("%s\n", __FUNCTION__); - indices = *(drm_mga_indices_t *) data; + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_indices called without lock held\n"); - return EINVAL; - } + DRM_OS_KRNFROMUSR( indices, (drm_mga_indices_t *) data, sizeof(indices) ); - DRM_DEBUG("mga_indices\n"); + if(indices.idx < 0 || indices.idx > dma->buf_count) DRM_OS_RETURN( EINVAL ); buf = dma->buflist[indices.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); + 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; + DRM_OS_RETURN( EINVAL ); } + + WRAP_TEST_WITH_RETURN( dev_priv ); - mga_dma_dispatch_indices(dev, buf, indices.start, indices.end); + mga_dma_dispatch_indices( dev, buf, indices.start, indices.end ); - PRIMUPDATE(dev_priv); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); return 0; } - - -static int -mga_dma_get_buffers(drm_device_t * dev, drm_dma_t * d, struct proc *p) +int mga_dma_iload( DRM_OS_IOCTL ) { - int i, error; + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = dev->dev_private; drm_buf_t *buf; - DRM_DEBUG("%s\n", __FUNCTION__); + drm_mga_buf_priv_t *buf_priv; + drm_mga_iload_t iload; + DRM_DEBUG( __FUNCTION__ ":\n" ); + + LOCK_TEST_WITH_RETURN( dev ); - for (i = d->granted_count; i < d->request_count; i++) { - buf = mga_freelist_get(dev); - if (!buf) - break; - buf->pid = p->p_pid; - error = copyout(&buf->idx, - &d->request_indices[i], - sizeof(buf->idx)); - if (error) return error; - error = copyout(&buf->total, - &d->request_sizes[i], - sizeof(buf->total)); - if (error) return error; - ++d->granted_count; + DRM_OS_KRNFROMUSR( iload, (drm_mga_iload_t *) data, sizeof(iload) ); + +#if 0 + if ( mga_do_wait_for_idle( dev_priv ) ) { + if ( MGA_DMA_DEBUG ) + DRM_INFO( __FUNCTION__": -EBUSY\n" ); + DRM_OS_RETURN( EBUSY ); + } +#endif + if(iload.idx < 0 || iload.idx > dma->buf_count) DRM_OS_RETURN( EINVAL ); + + buf = dma->buflist[iload.idx]; + buf_priv = buf->dev_private; + + if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) { + mga_freelist_put( dev, buf ); + DRM_OS_RETURN( EINVAL ); } + + 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; + return 0; } -int mga_dma(dev_t kdev, u_long cmd, caddr_t data, - int flags, struct proc *p) +int mga_dma_blit( DRM_OS_IOCTL ) { - drm_device_t *dev = kdev->si_drv1; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - drm_dma_t d; - DRM_DEBUG("%s\n", __FUNCTION__); + DRM_OS_DEVICE; + 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__ ); - d = *(drm_dma_t *) data; - DRM_DEBUG("%d %d: %d send, %d req\n", - p->p_pid, d.context, d.send_count, d.request_count); + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_dma called without lock held\n"); - return EINVAL; - } + DRM_OS_KRNFROMUSR( blit, (drm_mga_blit_t *) data, sizeof(blit) ); - /* Please don't send us buffers. - */ - if (d.send_count != 0) { - DRM_ERROR - ("Process %d trying to send %d buffers via drmDMA\n", - p->p_pid, d.send_count); - return EINVAL; - } + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - /* 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", - p->p_pid, d.request_count, dma->buf_count); - return EINVAL; - } + if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) ) + DRM_OS_RETURN( EINVAL ); - d.granted_count = 0; + WRAP_TEST_WITH_RETURN( dev_priv ); - if (d.request_count) { - retcode = mga_dma_get_buffers(dev, &d, p); - } + mga_dma_dispatch_blit( dev, &blit ); - DRM_DEBUG("%d returning, granted = %d\n", - p->p_pid, d.granted_count); - *(drm_dma_t *) data = d; - return retcode; + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + + return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_ucode.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_ucode.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_ucode.h Wed Dec 12 19:24:49 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/bsd/drm/kernel/mga/mga_warp.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_warp.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_warp.c Wed Dec 12 19:24:50 2001 @@ -0,0 +1,210 @@ +/* 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 ); + DRM_OS_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 ); + DRM_OS_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_mga_private_t *dev_priv ) +{ + 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: + DRM_OS_RETURN(EINVAL); + } +} + +#define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) + +int mga_warp_init( drm_mga_private_t *dev_priv ) +{ + u32 wmisc; + + /* 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: + DRM_OS_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 ); + DRM_OS_RETURN(EINVAL); + } + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/Makefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/Makefile:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/Makefile Wed Dec 12 19:24:50 2001 @@ -0,0 +1,25 @@ +# $FreeBSD$ + +KMOD = r128 +NOMAN= YES +SRCS = r128_cce.c r128_drv.c r128_state.c +SRCS += device_if.h bus_if.h pci_if.h opt_drm_linux.h +CFLAGS += ${DEBUG_FLAGS} -I. -I.. + +@: + ln -sf /sys @ + +machine: + ln -sf /sys/i386/include machine + +.if ${MACHINE_ARCH} == "i386" +# This line enables linux ioctl handling +# If you want support for this uncomment this line +#R128_OPTS= "\#define DRM_LINUX" 1 +.endif + +opt_drm_linux.h: + touch opt_drm_linux.h + echo $(R128_OPTS) >> opt_drm_linux.h + +.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128.h Wed Dec 12 19:24:50 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/bsd/drm/kernel/r128/r128_cce.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_cce.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_cce.c Wed Dec 12 19:24:50 2001 @@ -0,0 +1,1022 @@ +/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- + * Created: Wed Apr 5 19:24:19 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "r128.h" +#include "drmP.h" +#include "r128_drv.h" + + +#define R128_FIFO_DEBUG 0 + +int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ); + +/* CCE microcode (from ATI) */ +static u32 r128_cce_microcode[] = { + 0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0, + 1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0, + 599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1, + 11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11, + 262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28, + 1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9, + 30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656, + 1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1, + 15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071, + 12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2, + 46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1, + 459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1, + 18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1, + 15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2, + 268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1, + 15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82, + 1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729, + 3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008, + 1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0, + 15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1, + 180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1, + 114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0, + 33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370, + 1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1, + 14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793, + 1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1, + 198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1, + 114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1, + 1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1, + 1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894, + 16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14, + 174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1, + 33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1, + 33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1, + 409611, 9, 188, 0, 10240, 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, 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, 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, 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, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +int R128_READ_PLL(drm_device_t *dev, int addr) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + + R128_WRITE8(R128_CLOCK_CNTL_INDEX, addr & 0x1f); + return R128_READ(R128_CLOCK_CNTL_DATA); +} + +#if R128_FIFO_DEBUG +static void r128_status( drm_r128_private_t *dev_priv ) +{ + printk( "GUI_STAT = 0x%08x\n", + (unsigned int)R128_READ( R128_GUI_STAT ) ); + printk( "PM4_STAT = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_STAT ) ); + printk( "PM4_BUFFER_DL_WPTR = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_DL_WPTR ) ); + printk( "PM4_BUFFER_DL_RPTR = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_DL_RPTR ) ); + printk( "PM4_MICRO_CNTL = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_MICRO_CNTL ) ); + printk( "PM4_BUFFER_CNTL = 0x%08x\n", + (unsigned int)R128_READ( R128_PM4_BUFFER_CNTL ) ); +} +#endif + + +/* ================================================================ + * Engine, FIFO control + */ + +static int r128_do_pixcache_flush( drm_r128_private_t *dev_priv ) +{ + u32 tmp; + int i; + + tmp = R128_READ( R128_PC_NGUI_CTLSTAT ) | R128_PC_FLUSH_ALL; + R128_WRITE( R128_PC_NGUI_CTLSTAT, tmp ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(R128_READ( R128_PC_NGUI_CTLSTAT ) & R128_PC_BUSY) ) { + return 0; + } + DRM_OS_DELAY( 1 ); + } + +#if R128_FIFO_DEBUG + DRM_ERROR( "%s failed!\n", __FUNCTION__ ); +#endif + DRM_OS_RETURN( EBUSY ); +} + +static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries ) +{ + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + int slots = R128_READ( R128_GUI_STAT ) & R128_GUI_FIFOCNT_MASK; + if ( slots >= entries ) return 0; + DRM_OS_DELAY( 1 ); + } + +#if R128_FIFO_DEBUG + DRM_ERROR( "%s failed!\n", __FUNCTION__ ); +#endif + DRM_OS_RETURN( EBUSY ); +} + +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; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(R128_READ( R128_GUI_STAT ) & R128_GUI_ACTIVE) ) { + r128_do_pixcache_flush( dev_priv ); + return 0; + } + DRM_OS_DELAY( 1 ); + } + +#if R128_FIFO_DEBUG + DRM_ERROR( "%s failed!\n", __FUNCTION__ ); +#endif + DRM_OS_RETURN( EBUSY ); +} + + +/* ================================================================ + * CCE control, initialization + */ + +/* Load the microcode for the CCE */ +static void r128_cce_load_microcode( drm_r128_private_t *dev_priv ) +{ + int i; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + r128_do_wait_for_idle( dev_priv ); + + R128_WRITE( R128_PM4_MICROCODE_ADDR, 0 ); + for ( i = 0 ; i < 256 ; i++ ) { + R128_WRITE( R128_PM4_MICROCODE_DATAH, + r128_cce_microcode[i * 2] ); + R128_WRITE( R128_PM4_MICROCODE_DATAL, + r128_cce_microcode[i * 2 + 1] ); + } +} + +/* Flush any pending commands to the CCE. 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 r128_do_cce_flush( drm_r128_private_t *dev_priv ) +{ + u32 tmp; + + tmp = R128_READ( R128_PM4_BUFFER_DL_WPTR ) | R128_PM4_BUFFER_DL_DONE; + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, tmp ); +} + +/* Wait for the CCE to go idle. + */ +int r128_do_cce_idle( drm_r128_private_t *dev_priv ) +{ + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + 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 ) && + !(pm4stat & (R128_PM4_BUSY | + R128_PM4_GUI_ACTIVE)) ) { + return r128_do_pixcache_flush( dev_priv ); + } + } + DRM_OS_DELAY( 1 ); + } + +#if R128_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + r128_status( dev_priv ); +#endif + DRM_OS_RETURN( EBUSY ); +} + +/* Start the Concurrent Command Engine. + */ +static void r128_do_cce_start( drm_r128_private_t *dev_priv ) +{ + r128_do_wait_for_idle( dev_priv ); + + R128_WRITE( R128_PM4_BUFFER_CNTL, + dev_priv->cce_mode | dev_priv->ring.size_l2qw ); + R128_READ( R128_PM4_BUFFER_ADDR ); /* as per the sample code */ + R128_WRITE( R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN ); + + dev_priv->cce_running = 1; +} + +/* Reset the Concurrent Command Engine. This will not flush any pending + * 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 ); + SET_RING_HEAD( &dev_priv->ring, 0 ); + dev_priv->ring.tail = 0; +} + +/* Stop the Concurrent Command Engine. This will not flush any pending + * 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 ) +{ + R128_WRITE( R128_PM4_MICRO_CNTL, 0 ); + R128_WRITE( R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4 ); + + dev_priv->cce_running = 0; +} + +/* Reset the engine. This will stop the CCE if it is running. + */ +static int r128_do_engine_reset( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + u32 clock_cntl_index, mclk_cntl, gen_reset_cntl; + + r128_do_pixcache_flush( dev_priv ); + + clock_cntl_index = R128_READ( R128_CLOCK_CNTL_INDEX ); + mclk_cntl = R128_READ_PLL( dev, R128_MCLK_CNTL ); + + R128_WRITE_PLL( R128_MCLK_CNTL, + mclk_cntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP ); + + gen_reset_cntl = R128_READ( R128_GEN_RESET_CNTL ); + + /* Taken from the sample code - do not change */ + R128_WRITE( R128_GEN_RESET_CNTL, + gen_reset_cntl | R128_SOFT_RESET_GUI ); + R128_READ( R128_GEN_RESET_CNTL ); + R128_WRITE( R128_GEN_RESET_CNTL, + gen_reset_cntl & ~R128_SOFT_RESET_GUI ); + R128_READ( R128_GEN_RESET_CNTL ); + + R128_WRITE_PLL( R128_MCLK_CNTL, mclk_cntl ); + R128_WRITE( R128_CLOCK_CNTL_INDEX, clock_cntl_index ); + R128_WRITE( R128_GEN_RESET_CNTL, gen_reset_cntl ); + + /* Reset the CCE ring */ + r128_do_cce_reset( dev_priv ); + + /* The CCE is no longer running after an engine reset */ + dev_priv->cce_running = 0; + + /* Reset any pending vertex, indirect buffers */ + r128_freelist_reset( dev ); + + return 0; +} + +static void r128_cce_init_ring_buffer( drm_device_t *dev, + drm_r128_private_t *dev_priv ) +{ + 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. + */ +#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. */ + SET_RING_HEAD( &dev_priv->ring, 0 ); + +#if __REALLY_HAVE_SG + if ( !dev_priv->is_pci ) { +#endif + R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, + dev_priv->ring_rptr->offset ); +#if __REALLY_HAVE_SG + } 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, + entry->busaddr[page_ofs]); + DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", + entry->busaddr[page_ofs], + entry->handle + tmp_ofs ); + } +#endif + + /* Set watermark control */ + R128_WRITE( R128_PM4_BUFFER_WM_CNTL, + ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) + | ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) + | ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) + | ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT) ); + + /* Force read. Why? Because it's in the examples... */ + R128_READ( R128_PM4_BUFFER_ADDR ); + + /* Turn on bus mastering */ + tmp = R128_READ( R128_BUS_CNTL ) & ~R128_BUS_MASTER_DIS; + R128_WRITE( R128_BUS_CNTL, tmp ); +} + +static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) +{ + drm_r128_private_t *dev_priv; + drm_map_list_entry_t *listentry; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); + if ( dev_priv == NULL ) + DRM_OS_RETURN( ENOMEM ); + + memset( dev_priv, 0, sizeof(drm_r128_private_t) ); + + dev_priv->is_pci = init->is_pci; + + if ( dev_priv->is_pci && !dev->sg ) { + DRM_ERROR( "PCI GART memory not allocated!\n" ); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN( EINVAL ); + } + + dev_priv->usec_timeout = init->usec_timeout; + if ( dev_priv->usec_timeout < 1 || + dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { + DRM_DEBUG( "TIMEOUT problem!\n" ); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN( EINVAL ); + } + + dev_priv->cce_mode = init->cce_mode; + + /* GH: 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->cce_mode != R128_PM4_192BM ) && + ( init->cce_mode != R128_PM4_128BM_64INDBM ) && + ( init->cce_mode != R128_PM4_64BM_128INDBM ) && + ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { + DRM_DEBUG( "Bad cce_mode!\n" ); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN( EINVAL ); + } + + switch ( init->cce_mode ) { + case R128_PM4_NONPM4: + dev_priv->cce_fifo_size = 0; + break; + case R128_PM4_192PIO: + case R128_PM4_192BM: + dev_priv->cce_fifo_size = 192; + break; + case R128_PM4_128PIO_64INDBM: + case R128_PM4_128BM_64INDBM: + dev_priv->cce_fifo_size = 128; + break; + case R128_PM4_64PIO_128INDBM: + case R128_PM4_64BM_128INDBM: + case R128_PM4_64PIO_64VCBM_64INDBM: + case R128_PM4_64BM_64VCBM_64INDBM: + case R128_PM4_64PIO_64VCPIO_64INDPIO: + dev_priv->cce_fifo_size = 64; + break; + } + + 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; + + 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; + + dev_priv->front_pitch_offset_c = (((dev_priv->front_pitch/8) << 21) | + (dev_priv->front_offset >> 5)); + dev_priv->back_pitch_offset_c = (((dev_priv->back_pitch/8) << 21) | + (dev_priv->back_offset >> 5)); + dev_priv->depth_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | + (dev_priv->depth_offset >> 5) | + R128_DST_TILE); + dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | + (dev_priv->span_offset >> 5)); + + TAILQ_FOREACH(listentry, dev->maplist, link) { + drm_map_t *map = listentry->map; + if (map->type == _DRM_SHM && + map->flags & _DRM_CONTAINS_LOCK) { + dev_priv->sarea = map; + break; + } + } + + if(!dev_priv->sarea) { + DRM_ERROR("could not find sarea!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(EINVAL); + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR("could not find framebuffer!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR("could not find mmio region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); + if(!dev_priv->cce_ring) { + DRM_ERROR("could not find cce ring region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + if(!dev_priv->ring_rptr) { + DRM_ERROR("could not find ring read pointer!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR("could not find dma buffer region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(EINVAL); + } + + if ( !dev_priv->is_pci ) { + DRM_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); + if(!dev_priv->agp_textures) { + DRM_ERROR("could not find agp texture region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(EINVAL); + } + } + + dev_priv->sarea_priv = + (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + if ( !dev_priv->is_pci ) { + DRM_IOREMAP( dev_priv->cce_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); + if(!dev_priv->cce_ring->handle || + !dev_priv->ring_rptr->handle || + !dev_priv->buffers->handle) { + DRM_ERROR("Could not ioremap agp regions!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(ENOMEM); + } + } 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); + + dev_priv->ring.start = (u32 *)dev_priv->cce_ring->handle; + 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.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 ); + + dev_priv->sarea_priv->last_dispatch = 0; + R128_WRITE( R128_LAST_DISPATCH_REG, + dev_priv->sarea_priv->last_dispatch ); + +#if __REALLY_HAVE_SG + if ( dev_priv->is_pci ) { + if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, + &dev_priv->bus_pci_gart) ) { + DRM_ERROR( "failed to init PCI GART!\n" ); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + DRM_OS_RETURN(ENOMEM); + } + R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart ); + } +#endif + + r128_cce_init_ring_buffer( dev, dev_priv ); + r128_cce_load_microcode( dev_priv ); + + dev->dev_private = (void *)dev_priv; + + r128_do_engine_reset( dev ); + + return 0; +} + +int r128_do_cleanup_cce( drm_device_t *dev ) +{ + if ( dev->dev_private ) { + drm_r128_private_t *dev_priv = dev->dev_private; + +#if __REALLY_HAVE_SG + if ( !dev_priv->is_pci ) { +#endif + DRM_IOREMAPFREE( dev_priv->cce_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); +#if __REALLY_HAVE_SG + } else { + if (!DRM(ati_pcigart_cleanup)( dev, + dev_priv->phys_pci_gart, + dev_priv->bus_pci_gart )) + DRM_ERROR( "failed to cleanup PCI GART!\n" ); + } +#endif + + DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + } + + return 0; +} + +int r128_cce_init( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_init_t init; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + DRM_OS_KRNFROMUSR( init, (drm_r128_init_t *)data, sizeof(init) ); + + switch ( init.func ) { + case R128_INIT_CCE: + return r128_do_init_cce( dev, &init ); + case R128_CLEANUP_CCE: + return r128_do_cleanup_cce( dev ); + } + + DRM_OS_RETURN( EINVAL ); +} + +int r128_cce_start( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + 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; + } + + r128_do_cce_start( dev_priv ); + + return 0; +} + +/* Stop the CCE. The engine must have been idled before calling this + * routine. + */ +int r128_cce_stop( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_cce_stop_t stop; + int ret; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR(stop, (drm_r128_cce_stop_t *)data, sizeof(stop) ); + + /* Flush any pending CCE commands. This ensures any outstanding + * commands are exectuted by the engine before we turn it off. + */ + if ( stop.flush ) { + r128_do_cce_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 = r128_do_cce_idle( dev_priv ); + if ( ret ) return ret; + } + + /* Finally, we can turn off the CCE. If the engine isn't idle, + * we will get some dropped triangles as they won't be fully + * rendered before the CCE is shut down. + */ + r128_do_cce_stop( dev_priv ); + + /* Reset the engine */ + r128_do_engine_reset( dev ); + + return 0; +} + +/* Just reset the CCE ring. Called as part of an X Server engine reset. + */ +int r128_cce_reset( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_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__ ); + DRM_OS_RETURN( EINVAL ); + } + + r128_do_cce_reset( dev_priv ); + + /* The CCE is no longer running after an engine reset */ + dev_priv->cce_running = 0; + + return 0; +} + +int r128_cce_idle( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( dev_priv->cce_running ) { + r128_do_cce_flush( dev_priv ); + } + + return r128_do_cce_idle( dev_priv ); +} + +int r128_engine_reset( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + 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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_fullscreen_t fs; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( fs, (drm_r128_fullscreen_t *)data, sizeof(fs) ); + + switch ( fs.func ) { + case R128_INIT_FULLSCREEN: + return r128_do_init_pageflip( dev ); + case R128_CLEANUP_FULLSCREEN: + return r128_do_cleanup_pageflip( dev ); + } + + DRM_OS_RETURN( EINVAL ); +} + + +/* ================================================================ + * Freelist management + */ +#define R128_BUFFER_USED 0xffffffff +#define R128_BUFFER_FREE 0 + +#if 0 +static int r128_freelist_init( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_freelist_t *entry; + int i; + + dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); + if ( dev_priv->head == NULL ) + DRM_OS_RETURN( ENOMEM ); + + memset( dev_priv->head, 0, sizeof(drm_r128_freelist_t) ); + dev_priv->head->age = R128_BUFFER_USED; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + + entry = DRM(alloc)( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); + if ( !entry ) DRM_OS_RETURN( ENOMEM ); + + entry->age = R128_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 *r128_freelist_get( drm_device_t *dev ) +{ + 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, t; + + /* 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 ) + return buf; + } + + for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { + u32 done_age = R128_READ( R128_LAST_DISPATCH_REG ); + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + 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; + return buf; + } + } + DRM_OS_DELAY( 1 ); + } + + DRM_ERROR( "returning NULL!\n" ); + return NULL; +} + +void r128_freelist_reset( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + drm_buf_t *buf = dma->buflist[i]; + drm_r128_buf_priv_t *buf_priv = buf->dev_private; + buf_priv->age = 0; + } +} + + +/* ================================================================ + * CCE command submission + */ + +int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) +{ + drm_r128_ring_buffer_t *ring = &dev_priv->ring; + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + r128_update_ring_snapshot( ring ); + if ( ring->space >= n ) + return 0; + DRM_OS_DELAY( 1 ); + } + + /* FIXME: This is being ignored... */ + DRM_ERROR( "failed!\n" ); + DRM_OS_RETURN( EBUSY ); +} + +static int r128_cce_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 = r128_freelist_get( dev ); + if ( !buf ) DRM_OS_RETURN( EAGAIN ); + + buf->pid = DRM_OS_CURRENTPID; + + if ( DRM_OS_COPYTOUSR( &d->request_indices[i], &buf->idx, + sizeof(buf->idx) ) ) + DRM_OS_RETURN( EFAULT ); + if ( DRM_OS_COPYTOUSR( &d->request_sizes[i], &buf->total, + sizeof(buf->total) ) ) + DRM_OS_RETURN( EFAULT ); + d->granted_count++; + } + return 0; +} + +int r128_cce_buffers( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + int ret = 0; + drm_dma_t d; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( d, (drm_dma_t *) data, sizeof(d) ); + + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + DRM_OS_CURRENTPID, d.send_count ); + DRM_OS_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", + DRM_OS_CURRENTPID, d.request_count, dma->buf_count ); + DRM_OS_RETURN( EINVAL ); + } + + d.granted_count = 0; + + if ( d.request_count ) { + ret = r128_cce_get_buffers( dev, &d ); + } + + DRM_OS_KRNTOUSR((drm_dma_t *) data, d, sizeof(d) ); + + return ret; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.c:1.2 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.c Thu Dec 27 21:27:38 2001 @@ -0,0 +1,151 @@ +/* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*- + * Created: Mon Dec 13 09:47:27 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. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + + +#include <sys/types.h> +#include <sys/bus.h> +#include <pci/pcivar.h> +#include <opt_drm_linux.h> + +#include "r128.h" +#include "drmP.h" +#include "r128_drv.h" +#if __REALLY_HAVE_SG +#include "ati_pcigart.h" +#endif + +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." + +#define DRIVER_NAME "r128" +#define DRIVER_DESC "ATI Rage 128" +#define DRIVER_DATE "20010405" + +#define DRIVER_MAJOR 2 +#define DRIVER_MINOR 2 +#define DRIVER_PATCHLEVEL 0 + +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x1002, 0x4c45, 1, "ATI Rage 128 Mobility LE"}, + {0x1002, 0x4c46, 1, "ATI Rage 128 Mobility LF"}, + {0x1002, 0x4d46, 1, "ATI Rage 128 Mobility MF (AGP 4x)"}, + {0x1002, 0x4d4c, 1, "ATI Rage 128 Mobility ML"}, + {0x1002, 0x5041, 0, "ATI Rage 128 Pro PA (PCI)"}, + {0x1002, 0x5042, 1, "ATI Rage 128 Pro PB (AGP 2x)"}, + {0x1002, 0x5043, 1, "ATI Rage 128 Pro PC (AGP 4x)"}, + {0x1002, 0x5044, 0, "ATI Rage 128 Pro PD (PCI)"}, + {0x1002, 0x5045, 1, "ATI Rage 128 Pro PE (AGP 2x)"}, + {0x1002, 0x5046, 1, "ATI Rage 128 Pro PF (AGP 4x)"}, + {0x1002, 0x5047, 0, "ATI Rage 128 Pro PG (PCI)"}, + {0x1002, 0x5048, 1, "ATI Rage 128 Pro PH (AGP)"}, + {0x1002, 0x5049, 1, "ATI Rage 128 Pro PI (AGP)"}, + {0x1002, 0x504a, 0, "ATI Rage 128 Pro PJ (PCI)"}, + {0x1002, 0x504b, 1, "ATI Rage 128 Pro PK (AGP)"}, + {0x1002, 0x504c, 1, "ATI Rage 128 Pro PL (AGP)"}, + {0x1002, 0x504d, 0, "ATI Rage 128 Pro PM (PCI)"}, + {0x1002, 0x504e, 1, "ATI Rage 128 Pro PN (AGP)"}, + {0x1002, 0x505f, 1, "ATI Rage 128 Pro PO (AGP)"}, + {0x1002, 0x5050, 0, "ATI Rage 128 Pro PP (PCI)"}, + {0x1002, 0x5051, 1, "ATI Rage 128 Pro PQ (AGP)"}, + {0x1002, 0x5052, 1, "ATI Rage 128 Pro PR (AGP)"}, + {0x1002, 0x5053, 0, "ATI Rage 128 Pro PS (PCI)"}, + {0x1002, 0x5054, 1, "ATI Rage 128 Pro PT (AGP)"}, + {0x1002, 0x5055, 1, "ATI Rage 128 Pro PU (AGP)"}, + {0x1002, 0x5056, 0, "ATI Rage 128 Pro PV (PCI)"}, + {0x1002, 0x5057, 1, "ATI Rage 128 Pro PW (AGP)"}, + {0x1002, 0x5058, 1, "ATI Rage 128 Pro PX (AGP)"}, + {0x1002, 0x5245, 0, "ATI Rage 128 GL (PCI)"}, + {0x1002, 0x5246, 1, "ATI Rage 128 GL (AGP 2x)"}, + {0x1002, 0x524b, 0, "ATI Rage 128 VR (PCI)"}, + {0x1002, 0x524c, 1, "ATI Rage 128 VR (AGP 2x)"}, + {0x1002, 0x5345, 0, "ATI Rage 128 SE (PCI)"}, + {0x1002, 0x5346, 1, "ATI Rage 128 SF (AGP 2x)"}, + {0x1002, 0x5347, 1, "ATI Rage 128 SG (AGP 4x)"}, + {0x1002, 0x5348, 0, "ATI Rage 128 SH (unknown)"}, + {0x1002, 0x534b, 0, "ATI Rage 128 SK (PCI)"}, + {0x1002, 0x534c, 1, "ATI Rage 128 SL (AGP 2x)"}, + {0x1002, 0x534d, 1, "ATI Rage 128 SM (AGP 4x)"}, + {0x1002, 0x534e, 1, "ATI Rage 128 (AGP 4x?)"}, + {0, 0, 0, NULL} +}; + +#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 }, + + +#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_sysctl.h" +#include "drm_vm.h" +#if __REALLY_HAVE_SG +#include "drm_scatter.h" +#endif + +DRIVER_MODULE(r128, pci, r128_driver, r128_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_drv.h Wed Dec 12 19:24:50 2001 @@ -0,0 +1,544 @@ +/* r128_drv.h -- Private header for r128 driver -*- linux-c -*- + * Created: Mon Dec 13 09:51:11 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> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * Michel Dänzer <daenzerm@student.ethz.ch> + */ + +#include <machine/endian.h> +#if BYTE_ORDER==LITTLE_ENDIAN +#define le32_to_cpu(x) x +#define cpu_to_le32(x) x +#else +#define le32_to_cpu(x) ntohl(x) +#define cpu_to_le32(x) htonl(x) +#endif + +#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; + struct drm_r128_freelist *next; + struct drm_r128_freelist *prev; +} drm_r128_freelist_t; + +typedef struct drm_r128_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_r128_ring_buffer_t; + +typedef struct drm_r128_private { + drm_r128_ring_buffer_t ring; + drm_r128_sarea_t *sarea_priv; + + int cce_mode; + int cce_fifo_size; + int cce_running; + + drm_r128_freelist_t *head; + drm_r128_freelist_t *tail; + + int usec_timeout; + int is_pci; + unsigned long phys_pci_gart; +#if __REALLY_HAVE_SG + dma_addr_t bus_pci_gart; +#endif + unsigned long cce_buffers_offset; + + 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; + unsigned int span_offset; + + u32 front_pitch_offset_c; + u32 back_pitch_offset_c; + u32 depth_pitch_offset_c; + u32 span_pitch_offset_c; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *cce_ring; + drm_map_t *ring_rptr; + drm_map_t *buffers; + drm_map_t *agp_textures; +} drm_r128_private_t; + +typedef struct drm_r128_buf_priv { + u32 age; + int prim; + int discard; + int dispatched; + drm_r128_freelist_t *list_entry; +} drm_r128_buf_priv_t; + + /* r128_cce.c */ +extern int r128_cce_init( DRM_OS_IOCTL ); +extern int r128_cce_start( DRM_OS_IOCTL ); +extern int r128_cce_stop( DRM_OS_IOCTL ); +extern int r128_cce_reset( DRM_OS_IOCTL ); +extern int r128_cce_idle( DRM_OS_IOCTL ); +extern int r128_engine_reset( DRM_OS_IOCTL ); +extern int r128_fullscreen( DRM_OS_IOCTL ); +extern int r128_cce_buffers( DRM_OS_IOCTL ); + +extern void r128_freelist_reset( drm_device_t *dev ); +extern drm_buf_t *r128_freelist_get( drm_device_t *dev ); + +extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); + +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( DRM_OS_IOCTL ); +extern int r128_cce_swap( DRM_OS_IOCTL ); +extern int r128_cce_vertex( DRM_OS_IOCTL ); +extern int r128_cce_indices( DRM_OS_IOCTL ); +extern int r128_cce_blit( DRM_OS_IOCTL ); +extern int r128_cce_depth( DRM_OS_IOCTL ); +extern int r128_cce_stipple( DRM_OS_IOCTL ); +extern int r128_cce_indirect( DRM_OS_IOCTL ); + + +/* Register definitions, register access macros and drmAddMap constants + * for Rage 128 kernel driver. + */ + +#define R128_AUX_SC_CNTL 0x1660 +# define R128_AUX1_SC_EN (1 << 0) +# define R128_AUX1_SC_MODE_OR (0 << 1) +# define R128_AUX1_SC_MODE_NAND (1 << 1) +# define R128_AUX2_SC_EN (1 << 2) +# define R128_AUX2_SC_MODE_OR (0 << 3) +# define R128_AUX2_SC_MODE_NAND (1 << 3) +# define R128_AUX3_SC_EN (1 << 4) +# define R128_AUX3_SC_MODE_OR (0 << 5) +# define R128_AUX3_SC_MODE_NAND (1 << 5) +#define R128_AUX1_SC_LEFT 0x1664 +#define R128_AUX1_SC_RIGHT 0x1668 +#define R128_AUX1_SC_TOP 0x166c +#define R128_AUX1_SC_BOTTOM 0x1670 +#define R128_AUX2_SC_LEFT 0x1674 +#define R128_AUX2_SC_RIGHT 0x1678 +#define R128_AUX2_SC_TOP 0x167c +#define R128_AUX2_SC_BOTTOM 0x1680 +#define R128_AUX3_SC_LEFT 0x1684 +#define R128_AUX3_SC_RIGHT 0x1688 +#define R128_AUX3_SC_TOP 0x168c +#define R128_AUX3_SC_BOTTOM 0x1690 + +#define R128_BRUSH_DATA0 0x1480 +#define R128_BUS_CNTL 0x0030 +# define R128_BUS_MASTER_DIS (1 << 6) + +#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) +# define R128_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) +# define R128_GMC_BRUSH_SOLID_COLOR (13 << 4) +# define R128_GMC_BRUSH_NONE (15 << 4) +# define R128_GMC_DST_16BPP (4 << 8) +# define R128_GMC_DST_24BPP (5 << 8) +# define R128_GMC_DST_32BPP (6 << 8) +# define R128_GMC_DST_DATATYPE_SHIFT 8 +# define R128_GMC_SRC_DATATYPE_COLOR (3 << 12) +# define R128_DP_SRC_SOURCE_MEMORY (2 << 24) +# define R128_DP_SRC_SOURCE_HOST_DATA (3 << 24) +# define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28) +# define R128_GMC_AUX_CLIP_DIS (1 << 29) +# define R128_GMC_WR_MSK_DIS (1 << 30) +# define R128_ROP3_S 0x00cc0000 +# define R128_ROP3_P 0x00f00000 +#define R128_DP_WRITE_MASK 0x16cc +#define R128_DST_PITCH_OFFSET_C 0x1c80 +# define R128_DST_TILE (1 << 31) + +#define R128_GEN_RESET_CNTL 0x00f0 +# define R128_SOFT_RESET_GUI (1 << 0) + +#define R128_GUI_SCRATCH_REG0 0x15e0 +#define R128_GUI_SCRATCH_REG1 0x15e4 +#define R128_GUI_SCRATCH_REG2 0x15e8 +#define R128_GUI_SCRATCH_REG3 0x15ec +#define R128_GUI_SCRATCH_REG4 0x15f0 +#define R128_GUI_SCRATCH_REG5 0x15f4 + +#define R128_GUI_STAT 0x1740 +# define R128_GUI_FIFOCNT_MASK 0x0fff +# define R128_GUI_ACTIVE (1 << 31) + +#define R128_MCLK_CNTL 0x000f +# define R128_FORCE_GCP (1 << 16) +# define R128_FORCE_PIPE3D_CP (1 << 17) +# define R128_FORCE_RCP (1 << 18) + +#define R128_PC_GUI_CTLSTAT 0x1748 +#define R128_PC_NGUI_CTLSTAT 0x0184 +# define R128_PC_FLUSH_GUI (3 << 0) +# define R128_PC_RI_GUI (1 << 2) +# 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 +#define R128_SEC_TEX_CNTL_C 0x1d00 +#define R128_SEC_TEXTURE_BORDER_COLOR_C 0x1d3c +#define R128_SETUP_CNTL 0x1bc4 +#define R128_STEN_REF_MASK_C 0x1d40 + +#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 + + +/* CCE registers + */ +#define R128_PM4_BUFFER_OFFSET 0x0700 +#define R128_PM4_BUFFER_CNTL 0x0704 +# define R128_PM4_MASK (15 << 28) +# define R128_PM4_NONPM4 (0 << 28) +# define R128_PM4_192PIO (1 << 28) +# define R128_PM4_192BM (2 << 28) +# define R128_PM4_128PIO_64INDBM (3 << 28) +# define R128_PM4_128BM_64INDBM (4 << 28) +# define R128_PM4_64PIO_128INDBM (5 << 28) +# define R128_PM4_64BM_128INDBM (6 << 28) +# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) +# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) +# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) + +#define R128_PM4_BUFFER_WM_CNTL 0x0708 +# define R128_WMA_SHIFT 0 +# define R128_WMB_SHIFT 8 +# define R128_WMC_SHIFT 16 +# define R128_WB_WM_SHIFT 24 + +#define R128_PM4_BUFFER_DL_RPTR_ADDR 0x070c +#define R128_PM4_BUFFER_DL_RPTR 0x0710 +#define R128_PM4_BUFFER_DL_WPTR 0x0714 +# define R128_PM4_BUFFER_DL_DONE (1 << 31) + +#define R128_PM4_VC_FPU_SETUP 0x071c + +#define R128_PM4_IW_INDOFF 0x0738 +#define R128_PM4_IW_INDSIZE 0x073c + +#define R128_PM4_STAT 0x07b8 +# define R128_PM4_FIFOCNT_MASK 0x0fff +# define R128_PM4_BUSY (1 << 16) +# define R128_PM4_GUI_ACTIVE (1 << 31) + +#define R128_PM4_MICROCODE_ADDR 0x07d4 +#define R128_PM4_MICROCODE_RADDR 0x07d8 +#define R128_PM4_MICROCODE_DATAH 0x07dc +#define R128_PM4_MICROCODE_DATAL 0x07e0 + +#define R128_PM4_BUFFER_ADDR 0x07f0 +#define R128_PM4_MICRO_CNTL 0x07fc +# define R128_PM4_MICRO_FREERUN (1 << 30) + +#define R128_PM4_FIFO_DATA_EVEN 0x1000 +#define R128_PM4_FIFO_DATA_ODD 0x1004 + + +/* CCE command packets + */ +#define R128_CCE_PACKET0 0x00000000 +#define R128_CCE_PACKET1 0x40000000 +#define R128_CCE_PACKET2 0x80000000 +#define R128_CCE_PACKET3 0xC0000000 +# define R128_CNTL_HOSTDATA_BLT 0x00009400 +# define R128_CNTL_PAINT_MULTI 0x00009A00 +# define R128_CNTL_BITBLT_MULTI 0x00009B00 +# define R128_3D_RNDR_GEN_INDX_PRIM 0x00002300 + +#define R128_CCE_PACKET_MASK 0xC0000000 +#define R128_CCE_PACKET_COUNT_MASK 0x3fff0000 +#define R128_CCE_PACKET0_REG_MASK 0x000007ff +#define R128_CCE_PACKET1_REG0_MASK 0x000007ff +#define R128_CCE_PACKET1_REG1_MASK 0x003ff800 + +#define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000 +#define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001 +#define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002 +#define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 +#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 +#define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010 +#define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020 +#define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030 +#define R128_CCE_VC_CNTL_NUM_SHIFT 16 + +#define R128_DATATYPE_CI8 2 +#define R128_DATATYPE_ARGB1555 3 +#define R128_DATATYPE_RGB565 4 +#define R128_DATATYPE_RGB888 5 +#define R128_DATATYPE_ARGB8888 6 +#define R128_DATATYPE_RGB332 7 +#define R128_DATATYPE_RGB8 9 +#define R128_DATATYPE_ARGB4444 15 + +/* Constants */ +#define R128_AGP_OFFSET 0x02000000 + +#define R128_WATERMARK_L 16 +#define R128_WATERMARK_M 8 +#define R128_WATERMARK_N 8 +#define R128_WATERMARK_K 128 + +#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 0x7fffffff +#define R128_MAX_VB_VERTS (0xffff) + +#define R128_RING_HIGH_MARK 128 + +#define R128_PERFORMANCE_BOXES 0 + + +#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) +#define R128_ADDR(reg) (R128_BASE( reg ) + reg) + +#define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg ) +#ifdef __alpha__ +#define R128_READ(reg) (_R128_READ((u32 *)R128_ADDR(reg))) +static inline u32 _R128_READ(u32 *addr) +{ + DRM_OS_READMEMORYBARRIER; + return *(volatile u32 *)addr; +} +#define R128_WRITE(reg,val) \ +do { \ + DRM_OS_WRITEMEMORYBARRIER; \ + 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) +{ + DRM_OS_READMEMORYBARRIER; + return *(volatile u8 *)addr; +} +#define R128_WRITE8(reg,val) \ +do { \ + DRM_OS_WRITEMEMORYBARRIER; \ + 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 | \ + ((n) << 16) | ((reg) >> 2)) +#define CCE_PACKET1( reg0, reg1 ) (R128_CCE_PACKET1 | \ + (((reg1) >> 2) << 11) | ((reg0) >> 2)) +#define CCE_PACKET2() (R128_CCE_PACKET2) +#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 != DRM_OS_CURRENTPID ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + DRM_OS_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; \ + DRM_OS_DELAY( 1 ); \ + } \ + DRM_ERROR( "ring space check failed!\n" ); \ + DRM_OS_RETURN( EBUSY ); \ + } \ + __ring_space_done: \ +} while (0) + +#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; \ + if ( sarea_priv->last_dispatch >= R128_MAX_VB_AGE ) { \ + int __ret = r128_do_cce_idle( dev_priv ); \ + if ( __ret < 0 ) return __ret; \ + sarea_priv->last_dispatch = 0; \ + r128_freelist_reset( dev ); \ + } \ +} while (0) + +#define R128_WAIT_UNTIL_PAGE_FLIPPED() do { \ + OUT_RING( CCE_PACKET0( R128_WAIT_UNTIL, 0 ) ); \ + OUT_RING( R128_EVENT_CRTC_OFFSET ); \ +} while (0) + + +/* ================================================================ + * Ring control + */ + +#define r128_flush_write_combine() DRM_OS_READMEMORYBARRIER + + +#define R128_VERBOSE 0 + +#define RING_LOCALS \ + int write; unsigned int tail_mask; volatile u32 *ring; + +#define BEGIN_RING( n ) do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ + (n), __FUNCTION__ ); \ + } \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ + r128_wait_ring( dev_priv, (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() 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 ); \ +} while (0) + +#define OUT_RING( x ) do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ + (unsigned int)(x), write ); \ + } \ + ring[write++] = cpu_to_le32( x ); \ + write &= tail_mask; \ +} while (0) + +#endif /* __R128_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_state.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_state.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/r128/r128_state.c Wed Dec 12 19:24:50 2001 @@ -0,0 +1,1570 @@ +/* r128_state.c -- State support for r128 -*- linux-c -*- + * Created: Thu Jan 27 02:53:43 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> + */ + + +#include "r128.h" +#include "drmP.h" +#include "r128_drv.h" +#include "drm.h" + + + +/* ================================================================ + * CCE hardware state programming functions + */ + +static void r128_emit_clip_rects( drm_r128_private_t *dev_priv, + drm_clip_rect_t *boxes, int count ) +{ + u32 aux_sc_cntl = 0x00000000; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 17 ); + + if ( count >= 1 ) { + OUT_RING( CCE_PACKET0( R128_AUX1_SC_LEFT, 3 ) ); + OUT_RING( boxes[0].x1 ); + OUT_RING( boxes[0].x2 - 1 ); + OUT_RING( boxes[0].y1 ); + OUT_RING( boxes[0].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX1_SC_EN | R128_AUX1_SC_MODE_OR); + } + if ( count >= 2 ) { + OUT_RING( CCE_PACKET0( R128_AUX2_SC_LEFT, 3 ) ); + OUT_RING( boxes[1].x1 ); + OUT_RING( boxes[1].x2 - 1 ); + OUT_RING( boxes[1].y1 ); + OUT_RING( boxes[1].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX2_SC_EN | R128_AUX2_SC_MODE_OR); + } + if ( count >= 3 ) { + OUT_RING( CCE_PACKET0( R128_AUX3_SC_LEFT, 3 ) ); + OUT_RING( boxes[2].x1 ); + OUT_RING( boxes[2].x2 - 1 ); + OUT_RING( boxes[2].y1 ); + OUT_RING( boxes[2].y2 - 1 ); + + aux_sc_cntl |= (R128_AUX3_SC_EN | R128_AUX3_SC_MODE_OR); + } + + OUT_RING( CCE_PACKET0( R128_AUX_SC_CNTL, 0 ) ); + OUT_RING( aux_sc_cntl ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_core( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_SCALE_3D_CNTL, 0 ) ); + OUT_RING( ctx->scale_3d_cntl ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_context( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 13 ); + + OUT_RING( CCE_PACKET0( R128_DST_PITCH_OFFSET_C, 11 ) ); + OUT_RING( ctx->dst_pitch_offset_c ); + OUT_RING( ctx->dp_gui_master_cntl_c ); + OUT_RING( ctx->sc_top_left_c ); + OUT_RING( ctx->sc_bottom_right_c ); + OUT_RING( ctx->z_offset_c ); + OUT_RING( ctx->z_pitch_c ); + OUT_RING( ctx->z_sten_cntl_c ); + OUT_RING( ctx->tex_cntl_c ); + OUT_RING( ctx->misc_3d_state_cntl_reg ); + OUT_RING( ctx->texture_clr_cmp_clr_c ); + OUT_RING( ctx->texture_clr_cmp_msk_c ); + OUT_RING( ctx->fog_color_c ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_setup( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 3 ); + + OUT_RING( CCE_PACKET1( R128_SETUP_CNTL, R128_PM4_VC_FPU_SETUP ) ); + OUT_RING( ctx->setup_cntl ); + OUT_RING( ctx->pm4_vc_fpu_setup ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_masks( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 5 ); + + OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); + OUT_RING( ctx->dp_write_mask ); + + OUT_RING( CCE_PACKET0( R128_STEN_REF_MASK_C, 1 ) ); + OUT_RING( ctx->sten_ref_mask_c ); + OUT_RING( ctx->plane_3d_mask_c ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_window( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_WINDOW_XY_OFFSET, 0 ) ); + OUT_RING( ctx->window_xy_offset ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_tex0( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_context_regs_t *ctx = &sarea_priv->context_state; + drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[0]; + int i; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 7 + R128_MAX_TEXTURE_LEVELS ); + + OUT_RING( CCE_PACKET0( R128_PRIM_TEX_CNTL_C, + 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_MAX_TEXTURE_LEVELS ; i++ ) { + OUT_RING( tex->tex_offset[i] ); + } + + OUT_RING( CCE_PACKET0( R128_CONSTANT_COLOR_C, 1 ) ); + OUT_RING( ctx->constant_color_c ); + OUT_RING( tex->tex_border_color ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_tex1( drm_r128_private_t *dev_priv ) +{ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; + int i; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 5 + R128_MAX_TEXTURE_LEVELS ); + + OUT_RING( CCE_PACKET0( R128_SEC_TEX_CNTL_C, + 1 + R128_MAX_TEXTURE_LEVELS ) ); + OUT_RING( tex->tex_cntl ); + OUT_RING( tex->tex_combine_cntl ); + for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { + OUT_RING( tex->tex_offset[i] ); + } + + OUT_RING( CCE_PACKET0( R128_SEC_TEXTURE_BORDER_COLOR_C, 0 ) ); + OUT_RING( tex->tex_border_color ); + + ADVANCE_RING(); +} + +static __inline__ void r128_emit_state( drm_r128_private_t *dev_priv ) +{ + drm_r128_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 & R128_UPLOAD_CORE ) { + r128_emit_core( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_CORE; + } + + if ( dirty & R128_UPLOAD_CONTEXT ) { + r128_emit_context( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_CONTEXT; + } + + if ( dirty & R128_UPLOAD_SETUP ) { + r128_emit_setup( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_SETUP; + } + + if ( dirty & R128_UPLOAD_MASKS ) { + r128_emit_masks( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_MASKS; + } + + if ( dirty & R128_UPLOAD_WINDOW ) { + r128_emit_window( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_WINDOW; + } + + if ( dirty & R128_UPLOAD_TEX0 ) { + r128_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_TEX0; + } + + if ( dirty & R128_UPLOAD_TEX1 ) { + r128_emit_tex1( dev_priv ); + sarea_priv->dirty &= ~R128_UPLOAD_TEX1; + } + + /* Turn off the texture cache flushing */ + sarea_priv->context_state.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH; + + sarea_priv->dirty &= ~R128_REQUIRE_QUIESCENCE; +} + + +#if R128_PERFORMANCE_BOXES +/* ================================================================ + * Performance monitoring functions + */ + +static void r128_clear_box( drm_r128_private_t *dev_priv, + int x, int y, int w, int h, + int r, int g, int b ) +{ + u32 pitch, offset; + u32 fb_bpp, color; + RING_LOCALS; + + switch ( dev_priv->fb_bpp ) { + case 16: + fb_bpp = R128_GMC_DST_16BPP; + color = (((r & 0xf8) << 8) | + ((g & 0xfc) << 3) | + ((b & 0xf8) >> 3)); + break; + case 24: + fb_bpp = R128_GMC_DST_24BPP; + color = ((r << 16) | (g << 8) | b); + break; + case 32: + fb_bpp = R128_GMC_DST_32BPP; + color = (((0xff) << 24) | (r << 16) | (g << 8) | b); + break; + default: + return; + } + + offset = dev_priv->back_offset; + pitch = dev_priv->back_pitch >> 3; + + 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( (pitch << 21) | (offset >> 5) ); + OUT_RING( color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); +} + +static void r128_cce_performance_boxes( drm_r128_private_t *dev_priv ) +{ + if ( atomic_read( &dev_priv->idle_count ) == 0 ) { + r128_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); + } else { + atomic_set( &dev_priv->idle_count, 0 ); + } +} + +#endif + + +/* ================================================================ + * CCE command dispatch functions + */ + +static void r128_print_dirty( const char *msg, unsigned int flags ) +{ + DRM_INFO( "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n", + msg, + flags, + (flags & R128_UPLOAD_CORE) ? "core, " : "", + (flags & R128_UPLOAD_CONTEXT) ? "context, " : "", + (flags & R128_UPLOAD_SETUP) ? "setup, " : "", + (flags & R128_UPLOAD_TEX0) ? "tex0, " : "", + (flags & R128_UPLOAD_TEX1) ? "tex1, " : "", + (flags & R128_UPLOAD_MASKS) ? "masks, " : "", + (flags & R128_UPLOAD_WINDOW) ? "window, " : "", + (flags & R128_UPLOAD_CLIPRECTS) ? "cliprects, " : "", + (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); +} + +static void r128_cce_dispatch_clear( drm_device_t *dev, + 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; + 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 &= ~(R128_FRONT | R128_BACK); + if ( tmp & R128_FRONT ) flags |= R128_BACK; + if ( tmp & R128_BACK ) flags |= R128_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", + pbox[i].x1, pbox[i].y1, pbox[i].x2, + pbox[i].y2, flags ); + + if ( flags & (R128_FRONT | R128_BACK) ) { + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); + OUT_RING( clear->color_mask ); + + ADVANCE_RING(); + } + + if ( flags & R128_FRONT ) { + 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 | + (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->clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + if ( flags & R128_BACK ) { + 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 | + (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->clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + if ( flags & R128_DEPTH ) { + 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 | + (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->clear_depth ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + } +} + +static void r128_cce_dispatch_swap( drm_device_t *dev ) +{ + 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; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + +#if R128_PERFORMANCE_BOXES + /* Do some trivial performance monitoring... + */ + r128_cce_performance_boxes( dev_priv ); +#endif + + 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; + + 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 | + (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 ); + + 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( 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_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 ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + 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 = buf->bus_address; + int size = buf->used; + int prim = buf_priv->prim; + int i = 0; + RING_LOCALS; + DRM_DEBUG( "%s: buf=%d nbox=%d\n", + __FUNCTION__, buf->idx, sarea_priv->nbox ); + + if ( 0 ) + r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); + + if ( buf->used ) { + buf_priv->dispatched = 1; + + if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128_emit_state( dev_priv ); + } + + do { + /* Emit the next set of up to three cliprects */ + if ( i < sarea_priv->nbox ) { + r128_emit_clip_rects( dev_priv, + &sarea_priv->boxes[i], + sarea_priv->nbox - i ); + } + + /* Emit the vertex buffer rendering commands */ + BEGIN_RING( 5 ); + + OUT_RING( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, 3 ) ); + OUT_RING( offset ); + OUT_RING( size ); + OUT_RING( format ); + OUT_RING( prim | R128_CCE_VC_CNTL_PRIM_WALK_LIST | + (size << R128_CCE_VC_CNTL_NUM_SHIFT) ); + + ADVANCE_RING(); + + i += 3; + } 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 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( 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 &= ~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 ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_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 = buf->bus_address + 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 CCE packet. + */ + if ( dwords & 1 ) { + u32 *data = (u32 *) + ((char *)dev_priv->buffers->handle + + buf->offset + start); + data[dwords++] = cpu_to_le32( R128_CCE_PACKET2 ); + } + + buf_priv->dispatched = 1; + + /* Fire off the indirect buffer */ + BEGIN_RING( 3 ); + + OUT_RING( CCE_PACKET0( R128_PM4_IW_INDOFF, 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 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( 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 r128_cce_dispatch_indices( drm_device_t *dev, + drm_buf_t *buf, + int start, int end, + int count ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + 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_priv->cce_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 ) + r128_print_dirty( "dispatch_indices", sarea_priv->dirty ); + + if ( start != end ) { + buf_priv->dispatched = 1; + + if ( sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS ) { + r128_emit_state( dev_priv ); + } + + dwords = (end - start + 3) / sizeof(u32); + + data = (u32 *)((char *)dev_priv->buffers->handle + + buf->offset + start); + + data[0] = cpu_to_le32( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, + dwords-2 ) ); + + 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 ) { +#if BYTE_ORDER==LITTLE_ENDIAN + data[dwords-1] &= 0x0000ffff; +#else + data[dwords-1] &= 0xffff0000; +#endif + } + + do { + /* Emit the next set of up to three cliprects */ + if ( i < sarea_priv->nbox ) { + r128_emit_clip_rects( dev_priv, + &sarea_priv->boxes[i], + sarea_priv->nbox - i ); + } + + r128_cce_dispatch_indirect( dev, buf, start, end ); + + i += 3; + } 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 ); + + OUT_RING( CCE_PACKET0( R128_LAST_DISPATCH_REG, 0 ) ); + OUT_RING( 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 &= ~R128_UPLOAD_CLIPRECTS; + sarea_priv->nbox = 0; +} + +static int r128_cce_dispatch_blit( drm_device_t *dev, + drm_r128_blit_t *blit, int pid ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + u32 *data; + int dword_shift, dwords; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + /* 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_CI8: + case R128_DATATYPE_RGB8: + dword_shift = 2; + break; + default: + DRM_ERROR( "invalid blit format %d\n", blit->format ); + DRM_OS_RETURN( EINVAL ); + } + + /* Flush the pixel cache, and mark the contents as Read Invalid. + * 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( 2 ); + + OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); + OUT_RING( R128_PC_RI_GUI | R128_PC_FLUSH_GUI ); + + ADVANCE_RING(); + + /* Dispatch the indirect buffer. + */ + buf = dma->buflist[blit->idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != pid ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + pid, buf->pid ); + DRM_OS_RETURN( EINVAL ); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", blit->idx ); + DRM_OS_RETURN( EINVAL ); + } + + buf_priv->discard = 1; + + dwords = (blit->width * blit->height) >> dword_shift; + + data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); + + 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); + + r128_cce_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( 2 ); + + OUT_RING( CCE_PACKET0( R128_PC_GUI_CTLSTAT, 0 ) ); + OUT_RING( R128_PC_FLUSH_GUI ); + + ADVANCE_RING(); + + return 0; +} + + +/* ================================================================ + * Tiled depth buffer management + * + * FIXME: These should all set the destination write mask for when we + * have hardware stencil support. + */ + +static int r128_cce_dispatch_write_span( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, x, y; + u32 *buffer; + u8 *mask; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + count = depth->n; + if ( DRM_OS_COPYFROMUSR( &x, depth->x, sizeof(x) ) ) { + DRM_OS_RETURN( EFAULT ); + } + if ( DRM_OS_COPYFROMUSR( &y, depth->y, sizeof(y) ) ) { + DRM_OS_RETURN( EFAULT ); + } + + buffer = DRM_OS_MALLOC( depth->n * sizeof(u32) ); + if ( buffer == NULL ) + DRM_OS_RETURN( ENOMEM ); + if ( DRM_OS_COPYFROMUSR( buffer, depth->buffer, + depth->n * sizeof(u32) ) ) { + DRM_OS_FREE( buffer ); + DRM_OS_RETURN( EFAULT ); + } + + if ( depth->mask ) { + mask = DRM_OS_MALLOC( depth->n * sizeof(u8) ); + if ( mask == NULL ) { + DRM_OS_FREE( buffer ); + DRM_OS_RETURN( ENOMEM ); + } + if ( DRM_OS_COPYFROMUSR( mask, depth->mask, + depth->n * sizeof(u8) ) ) { + DRM_OS_FREE( buffer ); + DRM_OS_FREE( mask ); + DRM_OS_RETURN( EFAULT ); + } + + for ( i = 0 ; i < count ; i++, x++ ) { + 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 | + (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] ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + DRM_OS_FREE( mask ); + } else { + for ( i = 0 ; i < count ; i++, x++ ) { + 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 | + (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] ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + DRM_OS_FREE( buffer ); + + return 0; +} + +static int r128_cce_dispatch_write_pixels( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, *x, *y; + u32 *buffer; + u8 *mask; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + count = depth->n; + + x = DRM_OS_MALLOC( count * sizeof(*x) ); + if ( x == NULL ) { + DRM_OS_RETURN( ENOMEM ); + } + y = DRM_OS_MALLOC( count * sizeof(*y) ); + if ( y == NULL ) { + DRM_OS_FREE( x ); + DRM_OS_RETURN( ENOMEM ); + } + if ( DRM_OS_COPYFROMUSR( x, depth->x, count * sizeof(int) ) ) { + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_RETURN( EFAULT ); + } + if ( DRM_OS_COPYFROMUSR( y, depth->y, count * sizeof(int) ) ) { + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_RETURN( EFAULT ); + } + + buffer = DRM_OS_MALLOC( depth->n * sizeof(u32) ); + if ( buffer == NULL ) { + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_RETURN( ENOMEM ); + } + if ( DRM_OS_COPYFROMUSR( buffer, depth->buffer, + depth->n * sizeof(u32) ) ) { + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_FREE( buffer ); + DRM_OS_RETURN( EFAULT ); + } + + if ( depth->mask ) { + mask = DRM_OS_MALLOC( depth->n * sizeof(u8) ); + if ( mask == NULL ) { + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_FREE( buffer ); + DRM_OS_RETURN( ENOMEM ); + } + if ( DRM_OS_COPYFROMUSR( mask, depth->mask, + depth->n * sizeof(u8) ) ) { + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_FREE( buffer ); + DRM_OS_FREE( mask ); + DRM_OS_RETURN( EFAULT ); + } + + for ( i = 0 ; i < count ; i++ ) { + 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 | + (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] ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + DRM_OS_FREE( mask ); + } else { + for ( i = 0 ; i < count ; 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 | + (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] ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + } + + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_FREE( buffer ); + + return 0; +} + +static int r128_cce_dispatch_read_span( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, x, y; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + count = depth->n; + if ( DRM_OS_COPYFROMUSR( &x, depth->x, sizeof(x) ) ) { + DRM_OS_RETURN( EFAULT ); + } + if ( DRM_OS_COPYFROMUSR( &y, depth->y, sizeof(y) ) ) { + DRM_OS_RETURN( EFAULT ); + } + + 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 | + (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 ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (0 << 16) | 0 ); + OUT_RING( (count << 16) | 1 ); + + ADVANCE_RING(); + + return 0; +} + +static int r128_cce_dispatch_read_pixels( drm_device_t *dev, + drm_r128_depth_t *depth ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int count, *x, *y; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + count = depth->n; + if ( count > dev_priv->depth_pitch ) { + count = dev_priv->depth_pitch; + } + + x = DRM_OS_MALLOC( count * sizeof(*x) ); + if ( x == NULL ) { + DRM_OS_RETURN( ENOMEM ); + } + y = DRM_OS_MALLOC( count * sizeof(*y) ); + if ( y == NULL ) { + DRM_OS_FREE( x ); + DRM_OS_RETURN( ENOMEM ); + } + if ( DRM_OS_COPYFROMUSR( x, depth->x, count * sizeof(int) ) ) { + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_RETURN( EFAULT ); + } + if ( DRM_OS_COPYFROMUSR( y, depth->y, count * sizeof(int) ) ) { + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + DRM_OS_RETURN( EFAULT ); + } + + for ( i = 0 ; i < count ; i++ ) { + 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 | + (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 ); + + OUT_RING( (x[i] << 16) | y[i] ); + OUT_RING( (i << 16) | 0 ); + OUT_RING( (1 << 16) | 1 ); + + ADVANCE_RING(); + } + + DRM_OS_FREE( x ); + DRM_OS_FREE( y ); + + return 0; +} + + +/* ================================================================ + * Polygon stipple + */ + +static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + BEGIN_RING( 33 ); + + OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); + for ( i = 0 ; i < 32 ; i++ ) { + OUT_RING( stipple[i] ); + } + + ADVANCE_RING(); +} + + +/* ================================================================ + * IOCTL functions + */ + +int r128_cce_clear( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_r128_clear_t clear; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( clear, (drm_r128_clear_t *) data, + sizeof(clear) ); + + 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 ); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; + + return 0; +} + +int r128_cce_swap( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_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 > R128_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; + + 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; +} + +int r128_cce_vertex( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_vertex_t vertex; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + DRM_OS_RETURN( EINVAL ); + } + + DRM_OS_KRNFROMUSR( vertex, (drm_r128_vertex_t *) data, + sizeof(vertex) ); + + DRM_DEBUG( "%s: pid=%d index=%d count=%d discard=%d\n", + __FUNCTION__, DRM_OS_CURRENTPID, + 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 ); + DRM_OS_RETURN( EINVAL ); + } + if ( vertex.prim < 0 || + vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { + DRM_ERROR( "buffer prim %d\n", vertex.prim ); + DRM_OS_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 != DRM_OS_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_OS_CURRENTPID, buf->pid ); + DRM_OS_RETURN( EINVAL ); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); + DRM_OS_RETURN( EINVAL ); + } + + buf->used = vertex.count; + buf_priv->prim = vertex.prim; + buf_priv->discard = vertex.discard; + + r128_cce_dispatch_vertex( dev, buf ); + + return 0; +} + +int r128_cce_indices( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_indices_t elts; + int count; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + DRM_OS_RETURN( EINVAL ); + } + + DRM_OS_KRNFROMUSR( elts, (drm_r128_indices_t *) data, + sizeof(elts) ); + + DRM_DEBUG( "%s: pid=%d buf=%d s=%d e=%d d=%d\n", + __FUNCTION__, DRM_OS_CURRENTPID, + 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 ); + DRM_OS_RETURN( EINVAL ); + } + if ( elts.prim < 0 || + elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) { + DRM_ERROR( "buffer prim %d\n", elts.prim ); + DRM_OS_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 != DRM_OS_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_OS_CURRENTPID, buf->pid ); + DRM_OS_RETURN( EINVAL ); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", elts.idx ); + DRM_OS_RETURN( EINVAL ); + } + + count = (elts.end - elts.start) / sizeof(u16); + elts.start -= R128_INDEX_PRIM_OFFSET; + + if ( elts.start & 0x7 ) { + DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); + DRM_OS_RETURN( EINVAL ); + } + if ( elts.start < buf->used ) { + DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); + DRM_OS_RETURN( EINVAL ); + } + + buf->used = elts.end; + buf_priv->prim = elts.prim; + buf_priv->discard = elts.discard; + + r128_cce_dispatch_indices( dev, buf, elts.start, elts.end, count ); + + return 0; +} + +int r128_cce_blit( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_blit_t blit; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( blit, (drm_r128_blit_t *) data, + sizeof(blit) ); + + DRM_DEBUG( "%s: pid=%d index=%d\n", + __FUNCTION__, DRM_OS_CURRENTPID, blit.idx ); + + if ( blit.idx < 0 || blit.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + blit.idx, dma->buf_count - 1 ); + DRM_OS_RETURN( EINVAL ); + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + return r128_cce_dispatch_blit( dev, &blit, DRM_OS_CURRENTPID ); +} + +int r128_cce_depth( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_depth_t depth; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( depth, (drm_r128_depth_t *) data, + sizeof(depth) ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + switch ( depth.func ) { + case R128_WRITE_SPAN: + return r128_cce_dispatch_write_span( dev, &depth ); + case R128_WRITE_PIXELS: + return r128_cce_dispatch_write_pixels( dev, &depth ); + case R128_READ_SPAN: + return r128_cce_dispatch_read_span( dev, &depth ); + case R128_READ_PIXELS: + return r128_cce_dispatch_read_pixels( dev, &depth ); + } + + DRM_OS_RETURN( EINVAL ); +} + +int r128_cce_stipple( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_r128_stipple_t stipple; + u32 mask[32]; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( stipple, (drm_r128_stipple_t *) data, + sizeof(stipple) ); + + if ( DRM_OS_COPYFROMUSR( &mask, stipple.mask, + 32 * sizeof(u32) ) ) + DRM_OS_RETURN( EFAULT ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + r128_cce_dispatch_stipple( dev, mask ); + + return 0; +} + +int r128_cce_indirect( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_r128_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_indirect_t indirect; +#if 0 + RING_LOCALS; +#endif + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + DRM_OS_RETURN(EINVAL); + } + + DRM_OS_KRNFROMUSR( indirect, (drm_r128_indirect_t *) data, + sizeof(indirect) ); + + 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 ); + DRM_OS_RETURN(EINVAL); + } + + buf = dma->buflist[indirect.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != DRM_OS_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_OS_CURRENTPID, buf->pid ); + DRM_OS_RETURN(EINVAL); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); + DRM_OS_RETURN(EINVAL); + } + + if ( indirect.start < buf->used ) { + DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", + indirect.start, buf->used ); + DRM_OS_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; + +#if 0 + /* 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(); +#endif + + /* Dispatch the indirect buffer full of commands from the + * X server. This is insecure and is thus only available to + * privileged clients. + */ + r128_cce_dispatch_indirect( dev, buf, indirect.start, indirect.end ); + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/Makefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/Makefile:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/Makefile Wed Dec 12 19:24:51 2001 @@ -0,0 +1,25 @@ +# $FreeBSD$ + +KMOD = radeon +NOMAN= YES +SRCS = radeon_cp.c radeon_drv.c radeon_state.c +SRCS += device_if.h bus_if.h pci_if.h opt_drm_linux.h +CFLAGS += ${DEBUG_FLAGS} -I. -I.. + +@: + ln -sf /sys @ + +machine: + ln -sf /sys/i386/include machine + +.if ${MACHINE_ARCH} == "i386" +# This line enables linux ioctl handling +# If you want support for this uncomment this line +#RADEON_OPTS= "\#define DRM_LINUX" 1 +.endif + +opt_drm_linux.h: + touch opt_drm_linux.h + echo $(RADEON_OPTS) >> opt_drm_linux.h + +.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon.h Wed Dec 12 19:24:51 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/bsd/drm/kernel/radeon/radeon_cp.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_cp.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_cp.c Wed Dec 12 19:24:51 2001 @@ -0,0 +1,1421 @@ +/* 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> + */ + +#include "radeon.h" +#include "drmP.h" +#include "radeon_drv.h" + +#include <vm/vm.h> +#include <vm/pmap.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; + } + DRM_OS_DELAY( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + DRM_OS_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; + DRM_OS_DELAY( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + DRM_OS_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 ) 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; + } + DRM_OS_DELAY( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + DRM_OS_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_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_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 ) +{ + u32 ring_start, cur_read_ptr; + u32 tmp; + + /* 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 __REALLY_HAVE_SG + if ( !dev_priv->is_pci ) { +#endif + RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, + dev_priv->ring_rptr->offset ); +#if __REALLY_HAVE_SG + } 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, + entry->busaddr[page_ofs]); + DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", + entry->busaddr[page_ofs], + entry->handle + tmp_ofs ); + } +#endif + + /* 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; + drm_map_list_entry_t *listentry; + u32 tmp; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); + if ( dev_priv == NULL ) + DRM_OS_RETURN( ENOMEM ); + + 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" ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN( EINVAL ); + } +#endif + + if ( dev_priv->is_pci && !dev->sg ) { + DRM_ERROR( "PCI GART memory not allocated!\n" ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_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" ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_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 ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_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); + + TAILQ_FOREACH(listentry, dev->maplist, link) { + drm_map_t *map = listentry->map; + if (map->type == _DRM_SHM && + map->flags & _DRM_CONTAINS_LOCK) { + dev_priv->sarea = map; + break; + } + } + + if(!dev_priv->sarea) { + DRM_ERROR("could not find sarea!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(EINVAL); + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR("could not find framebuffer!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR("could not find mmio region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset ); + if(!dev_priv->cp_ring) { + DRM_ERROR("could not find cp ring region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + if(!dev_priv->ring_rptr) { + DRM_ERROR("could not find ring read pointer!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(EINVAL); + } + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR("could not find dma buffer region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(EINVAL); + } + + if ( !dev_priv->is_pci ) { + DRM_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); + if(!dev_priv->agp_textures) { + DRM_ERROR("could not find agp texture region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(EINVAL); + } + } + + 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 ); + if(!dev_priv->cp_ring->handle || + !dev_priv->ring_rptr->handle || + !dev_priv->buffers->handle) { + DRM_ERROR("could not find ioremap agp regions!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(EINVAL); + } + } 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 __REALLY_HAVE_SG + if ( dev_priv->is_pci ) { + if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, + &dev_priv->bus_pci_gart)) { + DRM_ERROR( "failed to init PCI GART!\n" ); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + DRM_OS_RETURN(ENOMEM); + } + /* 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, dev_priv->bus_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 { +#endif + /* Turn off PCI GART + */ + tmp = RADEON_READ( RADEON_AIC_CNTL ) + & ~RADEON_PCIGART_TRANSLATE_EN; + RADEON_WRITE( RADEON_AIC_CNTL, tmp ); +#if __REALLY_HAVE_SG + } +#endif + + radeon_cp_load_microcode( dev_priv ); + radeon_cp_init_ring_buffer( dev, dev_priv ); + +#if ROTATE_BUFS + dev_priv->last_buf = 0; +#endif + + dev->dev_private = (void *)dev_priv; + + radeon_do_engine_reset( dev ); + + 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 __REALLY_HAVE_SG + if ( !dev_priv->is_pci ) { +#endif + DRM_IOREMAPFREE( dev_priv->cp_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); +#if __REALLY_HAVE_SG + } else { + if (!DRM(ati_pcigart_cleanup)( dev, + dev_priv->phys_pci_gart, + dev_priv->bus_pci_gart )) + DRM_ERROR( "failed to cleanup PCI GART!\n" ); + } +#endif + + DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + } + + return 0; +} + +int radeon_cp_init( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_radeon_init_t init; + + DRM_OS_KRNFROMUSR( init, (drm_radeon_init_t *) data, sizeof(init) ); + + switch ( init.func ) { + case RADEON_INIT_CP: + return radeon_do_init_cp( dev, &init ); + case RADEON_CLEANUP_CP: + return radeon_do_cleanup_cp( dev ); + } + + DRM_OS_RETURN( EINVAL ); +} + +int radeon_cp_start( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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 ); + + DRM_OS_KRNFROMUSR( stop, (drm_radeon_cp_stop_t *) data, sizeof(stop) ); + + /* 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 ) 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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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__ ); + DRM_OS_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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_radeon_fullscreen_t fs; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( fs, (drm_radeon_fullscreen_t *) data, + sizeof(fs) ); + + switch ( fs.func ) { + case RADEON_INIT_FULLSCREEN: + return radeon_do_init_pageflip( dev ); + case RADEON_CLEANUP_FULLSCREEN: + return radeon_do_cleanup_pageflip( dev ); + } + + DRM_OS_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 ) + DRM_OS_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 ) DRM_OS_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 + } + DRM_OS_DELAY( 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; + DRM_OS_DELAY( 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 + DRM_OS_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 ) DRM_OS_RETURN( EAGAIN ); + + buf->pid = DRM_OS_CURRENTPID; + + if (DRM_OS_COPYTOUSR( &d->request_indices[i], &buf->idx, + sizeof(buf->idx) ) ) + DRM_OS_RETURN( EFAULT ); + if (DRM_OS_COPYTOUSR( &d->request_sizes[i], &buf->total, + sizeof(buf->total) ) ) + DRM_OS_RETURN( EFAULT ); + + d->granted_count++; + } + return 0; +} + +int radeon_cp_buffers( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_device_dma_t *dma = dev->dma; + int ret = 0; + drm_dma_t d; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( d, (drm_dma_t *) data, sizeof(d) ); + + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + DRM_OS_CURRENTPID, d.send_count ); + DRM_OS_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", + DRM_OS_CURRENTPID, d.request_count, dma->buf_count ); + DRM_OS_RETURN( EINVAL ); + } + + d.granted_count = 0; + + if ( d.request_count ) { + ret = radeon_cp_get_buffers( dev, &d ); + } + + DRM_OS_KRNTOUSR( (drm_dma_t *) data, d, sizeof(d) ); + + return ret; +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.c Wed Dec 12 19:24:51 2001 @@ -0,0 +1,114 @@ +/* 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 <sys/types.h> +#include <sys/bus.h> +#include <pci/pcivar.h> +#include <opt_drm_linux.h> + +#include "radeon.h" +#include "drmP.h" +#include "radeon_drv.h" +#if __REALLY_HAVE_SG +#include "ati_pcigart.h" +#endif + +#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 + +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x1002, 0x5144, 1, "ATI Radeon QD"}, + {0x1002, 0x5145, 1, "ATI Radeon QE"}, + {0x1002, 0x5146, 1, "ATI Radeon QF"}, + {0x1002, 0x5147, 1, "ATI Radeon QG"}, + {0x1002, 0x5159, 1, "ATI Radeon VE"}, + {0, 0, 0, NULL} +}; + +#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_vm.h" +#include "drm_sysctl.h" +#if __REALLY_HAVE_SG +#include "drm_scatter.h" +#endif + +DRIVER_MODULE(radeon, pci, radeon_driver, radeon_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_drv.h Wed Dec 12 19:24:51 2001 @@ -0,0 +1,725 @@ +/* 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; +#if __REALLY_HAVE_SG + dma_addr_t bus_pci_gart; +#endif + + 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( DRM_OS_IOCTL ); +extern int radeon_cp_start( DRM_OS_IOCTL ); +extern int radeon_cp_stop( DRM_OS_IOCTL ); +extern int radeon_cp_reset( DRM_OS_IOCTL ); +extern int radeon_cp_idle( DRM_OS_IOCTL ); +extern int radeon_engine_reset( DRM_OS_IOCTL ); +extern int radeon_fullscreen( DRM_OS_IOCTL ); +extern int radeon_cp_buffers( DRM_OS_IOCTL ); + +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( DRM_OS_IOCTL ); +extern int radeon_cp_swap( DRM_OS_IOCTL ); +extern int radeon_cp_vertex( DRM_OS_IOCTL ); +extern int radeon_cp_indices( DRM_OS_IOCTL ); +extern int radeon_cp_texture( DRM_OS_IOCTL ); +extern int radeon_cp_stipple( DRM_OS_IOCTL ); +extern int radeon_cp_indirect( DRM_OS_IOCTL ); + +/* 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) +{ + DRM_OS_READMEMORYBARRIER; + return *(volatile u32 *)addr; +} +#define RADEON_WRITE(reg,val) \ +do { \ + DRM_OS_WRITEMEMORYBARRIER; \ + 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) +{ + DRM_OS_READMEMORYBARRIER; + return *(volatile u8 *)addr; +} +#define RADEON_WRITE8(reg,val) \ +do { \ + DRM_OS_WRITEMEMORYBARRIER; \ + 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 != DRM_OS_CURRENTPID ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + DRM_OS_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; \ + DRM_OS_DELAY( 1 ); \ + } \ + DRM_ERROR( "ring space check failed!\n" ); \ + DRM_OS_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 ) 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() DRM_OS_READMEMORYBARRIER + + +#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/bsd/drm/kernel/radeon/radeon_state.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_state.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/radeon/radeon_state.c Wed Dec 12 19:24:51 2001 @@ -0,0 +1,1461 @@ +/* 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> + */ + +#include "radeon.h" +#include "drmP.h" +#include "radeon_drv.h" +#include "drm.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, int pid ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_radeon_buf_priv_t *buf_priv; + u32 format; + u32 *buffer; + const 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 ) DRM_OS_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 ); + DRM_OS_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 = 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 = (const char *)image->data + size; + + if ( DRM_OS_COPYTOUSR( tex->image, image, sizeof(*image) ) ) { + DRM_ERROR( "EFAULT on tex->image\n" ); + DRM_OS_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 ( DRM_OS_COPYFROMUSR( buffer, data, dwords * sizeof(u32) ) ) { + DRM_ERROR( "EFAULT on data, %d dwords\n", dwords ); + DRM_OS_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 ( DRM_OS_COPYFROMUSR( buffer, data, tex_width ) ) { + DRM_ERROR( "EFAULT on pad, %d bytes\n", + tex_width ); + DRM_OS_RETURN( EFAULT ); + } + buffer += 8; + data += tex_width; + } + } + + buf->pid = 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(); + + DRM_OS_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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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 ); + + DRM_OS_KRNFROMUSR( clear, (drm_radeon_clear_t *) data, + sizeof(clear) ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; + + if ( DRM_OS_COPYFROMUSR( &depth_boxes, clear.depth_boxes, + sarea_priv->nbox * sizeof(depth_boxes[0]) ) ) + DRM_OS_RETURN( EFAULT ); + + radeon_cp_dispatch_clear( dev, &clear, depth_boxes ); + + return 0; +} + +int radeon_cp_swap( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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__ ); + DRM_OS_RETURN( EINVAL ); + } + + DRM_OS_KRNFROMUSR( vertex, (drm_radeon_vertex_t *) data, + sizeof(vertex) ); + + DRM_DEBUG( "%s: pid=%d index=%d count=%d discard=%d\n", + __FUNCTION__, DRM_OS_CURRENTPID, + 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 ); + DRM_OS_RETURN( EINVAL ); + } + if ( vertex.prim < 0 || + vertex.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { + DRM_ERROR( "buffer prim %d\n", vertex.prim ); + DRM_OS_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 != DRM_OS_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_OS_CURRENTPID, buf->pid ); + DRM_OS_RETURN( EINVAL ); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); + DRM_OS_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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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__ ); + DRM_OS_RETURN( EINVAL ); + } + + DRM_OS_KRNFROMUSR( elts, (drm_radeon_indices_t *) data, + sizeof(elts) ); + + DRM_DEBUG( "%s: pid=%d index=%d start=%d end=%d discard=%d\n", + __FUNCTION__, DRM_OS_CURRENTPID, + 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 ); + DRM_OS_RETURN( EINVAL ); + } + if ( elts.prim < 0 || + elts.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { + DRM_ERROR( "buffer prim %d\n", elts.prim ); + DRM_OS_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 != DRM_OS_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_OS_CURRENTPID, buf->pid ); + DRM_OS_RETURN( EINVAL ); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", elts.idx ); + DRM_OS_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 ); + DRM_OS_RETURN( EINVAL ); + } + if ( elts.start < buf->used ) { + DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); + DRM_OS_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( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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 ); + + DRM_OS_KRNFROMUSR( tex, (drm_radeon_texture_t *) data, sizeof(tex) ); + + if ( tex.image == NULL ) { + DRM_ERROR( "null texture image!\n" ); + DRM_OS_RETURN( EINVAL ); + } + + if ( DRM_OS_COPYFROMUSR( &image, + (drm_radeon_tex_image_t *)tex.image, + sizeof(image) ) ) + DRM_OS_RETURN( EFAULT ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + return radeon_cp_dispatch_texture( dev, &tex, &image, DRM_OS_CURRENTPID ); +} + +int radeon_cp_stipple( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_stipple_t stipple; + u32 mask[32]; + + LOCK_TEST_WITH_RETURN( dev ); + + DRM_OS_KRNFROMUSR( stipple, (drm_radeon_stipple_t *) data, + sizeof(stipple) ); + + if ( DRM_OS_COPYFROMUSR( &mask, stipple.mask, 32 * sizeof(u32) ) ) + DRM_OS_RETURN( EFAULT ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + radeon_cp_dispatch_stipple( dev, mask ); + + return 0; +} + +int radeon_cp_indirect( DRM_OS_IOCTL ) +{ + DRM_OS_DEVICE; + 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__ ); + DRM_OS_RETURN( EINVAL ); + } + + DRM_OS_KRNFROMUSR( indirect, (drm_radeon_indirect_t *) data, + sizeof(indirect) ); + + 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 ); + DRM_OS_RETURN( EINVAL ); + } + + buf = dma->buflist[indirect.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != DRM_OS_CURRENTPID ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + DRM_OS_CURRENTPID, buf->pid ); + DRM_OS_RETURN( EINVAL ); + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); + DRM_OS_RETURN( EINVAL ); + } + + if ( indirect.start < buf->used ) { + DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", + indirect.start, buf->used ); + DRM_OS_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/bsd/drm/kernel/sis/Makefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/Makefile:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/Makefile Wed Dec 12 19:24:51 2001 @@ -0,0 +1,25 @@ +# $FreeBSD$ + +KMOD= sis +NOMAN= YES +SRCS= sis_drv.c sis_ds.c sis_mm.c +SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h +CFLAGS+= ${DEBUG_FLAGS} -I. -I.. + +@: + ln -sf /sys @ + +machine: + ln -sf /sys/i386/include machine + +.if ${MACHINE_ARCH} == "i386" +# This line enables linux ioctl handling +# If you want support for this uncomment this line +#SIS_OPTS= "\#define DRM_LINUX" 1 +.endif + +opt_drm_linux.h: + touch opt_drm_linux.h + echo $(SIS_OPTS) >> opt_drm_linux.h + +.include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis.h Wed Dec 12 19:24:51 2001 @@ -0,0 +1,45 @@ +/* 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/bsd/drm/kernel/sis/sis.h,v 1.1 2001/12/13 00:24:51 alanh Exp $ */ + +#ifndef __SIS_H__ +#define __SIS_H__ + + +/* 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/bsd/drm/kernel/sis/sis_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drm.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drm.h Wed Dec 12 19:24:51 2001 @@ -0,0 +1,30 @@ + +#ifndef _sis_drm_public_h_ +#define _sis_drm_public_h_ + +typedef struct { + int context; + unsigned int offset; + unsigned int size; + unsigned int free; +} drm_sis_mem_t; + +typedef struct { + unsigned int offset, size; +} drm_sis_agp_t; + +typedef struct { + unsigned int left, right; +} drm_sis_flip_t; + +#if defined(__KERNEL__) || defined(_KERNEL) + +int sis_fb_alloc(DRM_OS_IOCTL); +int sis_fb_free(DRM_OS_IOCTL); +int sisp_agp_init(DRM_OS_IOCTL); +int sisp_agp_alloc(DRM_OS_IOCTL); +int sisp_agp_free(DRM_OS_IOCTL); + +#endif + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.c Wed Dec 12 19:24:52 2001 @@ -0,0 +1,90 @@ +/* sis.c -- 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. + * + */ + + +#include <sys/types.h> +#include <sys/bus.h> +#include <pci/pcivar.h> +#include <opt_drm_linux.h> + +#include "sis.h" +#include "drmP.h" +#include "sis_drm.h" +#include "sis_drv.h" + +#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 + +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x1039, 0x0300, 1, "SIS 300"}, + {0x1039, 0x0540, 1, "SIS 540"}, + {0x1039, 0x0630, 1, "SIS 630"}, + {0, 0, 0, NULL} +}; + +#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_vm.h" +#include "drm_sysctl.h" + +DRIVER_MODULE(sis, pci, sis_driver, sis_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_drv.h Wed Dec 12 19:24:52 2001 @@ -0,0 +1,42 @@ +/* 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. + * + */ + +#ifndef _SIS_DRV_H_ +#define _SIS_DRV_H_ + +typedef struct drm_sis_private { + drm_map_t *buffers; +} drm_sis_private_t; + +/* Stereo ? - this was never committed */ + +int sis_flip( DRM_OS_IOCTL ); +int sis_flip_init( DRM_OS_IOCTL ); +int sis_flip_final( DRM_OS_IOCTL ); +void flip_final(void); + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.c Wed Dec 12 19:24:52 2001 @@ -0,0 +1,398 @@ +/* sis_ds.c -- Private header for Direct Rendering Manager -*- linux-c -*- + * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw + * + * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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: + * Sung-Ching Lin <sclin@sis.com.tw> + * + */ + + +#include "sis.h" +#include "drmP.h" +#include "sis_ds.h" + +/* Set Data Structure, not check repeated value + * temporarily used + */ + +set_t *setInit(void) +{ + int i; + set_t *set; + + set = (set_t *)SD_MALLOC(sizeof(set_t)); + for(i = 0; i < SET_SIZE; i++){ + set->list[i].free_next = i+1; + set->list[i].alloc_next = -1; + } + set->list[SET_SIZE-1].free_next = -1; + set->free = 0; + set->alloc = -1; + set->trace = -1; + + return set; +} + +int setAdd(set_t *set, ITEM_TYPE item) +{ + int free = set->free; + + if(free != -1){ + set->list[free].val = item; + set->free = set->list[free].free_next; + } + else{ + return 0; + } + + set->list[free].alloc_next = set->alloc; + set->alloc = free; + set->list[free].free_next = -1; + + return 1; +} + +int setDel(set_t *set, ITEM_TYPE item) +{ + int alloc = set->alloc; + int prev = -1; + + while(alloc != -1){ + if(set->list[alloc].val == item){ + if(prev != -1) + set->list[prev].alloc_next = set->list[alloc].alloc_next; + else + set->alloc = set->list[alloc].alloc_next; + break; + } + prev = alloc; + alloc = set->list[alloc].alloc_next; + } + + if(alloc == -1) + return 0; + + set->list[alloc].free_next = set->free; + set->free = alloc; + set->list[alloc].alloc_next = -1; + + return 1; +} + +/* setFirst -> setAdd -> setNext is wrong */ + +int setFirst(set_t *set, ITEM_TYPE *item) +{ + if(set->alloc == -1) + return 0; + + *item = set->list[set->alloc].val; + set->trace = set->list[set->alloc].alloc_next; + + return 1; +} + +int setNext(set_t *set, ITEM_TYPE *item) +{ + if(set->trace == -1) + return 0; + + *item = set->list[set->trace].val; + set->trace = set->list[set->trace].alloc_next; + + return 1; +} + +int setDestroy(set_t *set) +{ + SD_FREE(set); + + return 1; +} + +/* + * GLX Hardware Device Driver common code + * Copyright (C) 1999 Keith Whitwell + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#define ISFREE(bptr) ((bptr)->free) + +#define PRINTF(fmt, arg...) do{}while(0) +#define fprintf(fmt, arg...) do{}while(0) + +static void *calloc(size_t nmemb, size_t size) +{ + void *addr; + addr = SD_MALLOC(nmemb*size); + memset(addr, 0, nmemb*size); + return addr; +} + +void mmDumpMemInfo( memHeap_t *heap ) +{ + TMemBlock *p; + + PRINTF ("Memory heap %p:\n", heap); + if (heap == 0) { + PRINTF (" heap == 0\n"); + } else { + p = (TMemBlock *)heap; + while (p) { + PRINTF (" Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size, + p->free ? '.':'U', + p->reserved ? 'R':'.'); + p = p->next; + } + } + PRINTF ("End of memory blocks\n"); +} + +memHeap_t *mmInit(int ofs, + int size) +{ + PMemBlock blocks; + + if (size <= 0) { + return 0; + } + blocks = (TMemBlock *) calloc(1,sizeof(TMemBlock)); + if (blocks) { + blocks->ofs = ofs; + blocks->size = size; + blocks->free = 1; + return (memHeap_t *)blocks; + } else + return 0; +} + +/* Kludgey workaround for existing i810 server. Remove soon. + */ +memHeap_t *mmAddRange( memHeap_t *heap, + int ofs, + int size ) +{ + PMemBlock blocks; + blocks = (TMemBlock *) calloc(2,sizeof(TMemBlock)); + if (blocks) { + blocks[0].size = size; + blocks[0].free = 1; + blocks[0].ofs = ofs; + blocks[0].next = &blocks[1]; + + /* Discontinuity - stops JoinBlock from trying to join non-adjacent + * ranges. + */ + blocks[1].size = 0; + blocks[1].free = 0; + blocks[1].ofs = ofs+size; + blocks[1].next = (PMemBlock) heap; + return (memHeap_t *)blocks; + } + else + return heap; +} + +static TMemBlock* SliceBlock(TMemBlock *p, + int startofs, int size, + int reserved, int alignment) +{ + TMemBlock *newblock; + + /* break left */ + if (startofs > p->ofs) { + newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock)); + newblock->ofs = startofs; + newblock->size = p->size - (startofs - p->ofs); + newblock->free = 1; + newblock->next = p->next; + p->size -= newblock->size; + p->next = newblock; + p = newblock; + } + + /* break right */ + if (size < p->size) { + newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock)); + newblock->ofs = startofs + size; + newblock->size = p->size - size; + newblock->free = 1; + newblock->next = p->next; + p->size = size; + p->next = newblock; + } + + /* p = middle block */ + p->align = alignment; + p->free = 0; + p->reserved = reserved; + return p; +} + +PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch) +{ + int mask,startofs,endofs; + TMemBlock *p; + + if (!heap || align2 < 0 || size <= 0) + return NULL; + mask = (1 << align2)-1; + startofs = 0; + p = (TMemBlock *)heap; + while (p) { + if (ISFREE(p)) { + startofs = (p->ofs + mask) & ~mask; + if ( startofs < startSearch ) { + startofs = startSearch; + } + endofs = startofs+size; + if (endofs <= (p->ofs+p->size)) + break; + } + p = p->next; + } + if (!p) + return NULL; + p = SliceBlock(p,startofs,size,0,mask+1); + p->heap = heap; + return p; +} + +static __inline__ int Join2Blocks(TMemBlock *p) +{ + if (p->free && p->next && p->next->free) { + TMemBlock *q = p->next; + p->size += q->size; + p->next = q->next; + SD_FREE(q); + return 1; + } + return 0; +} + +int mmFreeMem(PMemBlock b) +{ + TMemBlock *p,*prev; + + if (!b) + return 0; + if (!b->heap) { + fprintf(stderr, "no heap\n"); + return -1; + } + p = b->heap; + prev = NULL; + while (p && p != b) { + prev = p; + p = p->next; + } + if (!p || p->free || p->reserved) { + if (!p) + fprintf(stderr, "block not found in heap\n"); + else if (p->free) + fprintf(stderr, "block already free\n"); + else + fprintf(stderr, "block is reserved\n"); + return -1; + } + p->free = 1; + Join2Blocks(p); + if (prev) + Join2Blocks(prev); + return 0; +} + +int mmReserveMem(memHeap_t *heap, int offset,int size) +{ + int endofs; + TMemBlock *p; + + if (!heap || size <= 0) + return -1; + endofs = offset+size; + p = (TMemBlock *)heap; + while (p && p->ofs <= offset) { + if (ISFREE(p) && endofs <= (p->ofs+p->size)) { + SliceBlock(p,offset,size,1,1); + return 0; + } + p = p->next; + } + return -1; +} + +int mmFreeReserved(memHeap_t *heap, int offset) +{ + TMemBlock *p,*prev; + + if (!heap) + return -1; + p = (TMemBlock *)heap; + prev = NULL; + while (p && p->ofs != offset) { + prev = p; + p = p->next; + } + if (!p || !p->reserved) + return -1; + p->free = 1; + p->reserved = 0; + Join2Blocks(p); + if (prev) + Join2Blocks(prev); + return 0; +} + +void mmDestroy(memHeap_t *heap) +{ + TMemBlock *p,*q; + + if (!heap) + return; + p = (TMemBlock *)heap; + while (p) { + q = p->next; + SD_FREE(p); + p = q; + } +} Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_ds.h Wed Dec 12 19:24:52 2001 @@ -0,0 +1,163 @@ +/* sis_ds.h -- Private header for Direct Rendering Manager -*- linux-c -*- + * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw + * + * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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: + * Sung-Ching Lin <sclin@sis.com.tw> + * + */ + +#ifndef _sis_ds_h_ +#define _sis_ds_h_ + +/* Set Data Structure */ + +#define SET_SIZE 5000 +#define SD_MALLOC(s) malloc( s, DRM(M_DRM), M_NOWAIT ) +#define SD_FREE(s) free( s, DRM(M_DRM) ) + +typedef unsigned int ITEM_TYPE; + +typedef struct { + ITEM_TYPE val; + int alloc_next, free_next; +} list_item_t; + +typedef struct { + int alloc; + int free; + int trace; + list_item_t list[SET_SIZE]; +} set_t; + +set_t *setInit(void); +int setAdd(set_t *set, ITEM_TYPE item); +int setDel(set_t *set, ITEM_TYPE item); +int setFirst(set_t *set, ITEM_TYPE *item); +int setNext(set_t *set, ITEM_TYPE *item); +int setDestroy(set_t *set); + +#endif + +/* + * GLX Hardware Device Driver common code + * Copyright (C) 1999 Keith Whitwell + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef MM_INC +#define MM_INC + +struct mem_block_t { + struct mem_block_t *next; + struct mem_block_t *heap; + int ofs,size; + int align; + int free:1; + int reserved:1; +}; +typedef struct mem_block_t TMemBlock; +typedef struct mem_block_t *PMemBlock; + +/* a heap is just the first block in a chain */ +typedef struct mem_block_t memHeap_t; + +static __inline__ int mmBlockSize(PMemBlock b) +{ return b->size; } + +static __inline__ int mmOffset(PMemBlock b) +{ return b->ofs; } + +static __inline__ void mmMarkReserved(PMemBlock b) +{ b->reserved = 1; } + +/* + * input: total size in bytes + * return: a heap pointer if OK, NULL if error + */ +memHeap_t *mmInit( int ofs, int size ); + + + +memHeap_t *mmAddRange( memHeap_t *heap, + int ofs, + int size ); + + +/* + * Allocate 'size' bytes with 2^align2 bytes alignment, + * restrict the search to free memory after 'startSearch' + * depth and back buffers should be in different 4mb banks + * to get better page hits if possible + * input: size = size of block + * align2 = 2^align2 bytes alignment + * startSearch = linear offset from start of heap to begin search + * return: pointer to the allocated block, 0 if error + */ +PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch ); + +/* + * Free block starts at offset + * input: pointer to a block + * return: 0 if OK, -1 if error + */ +int mmFreeMem( PMemBlock b ); + +/* + * Reserve 'size' bytes block start at offset + * This is used to prevent allocation of memory already used + * by the X server for the front buffer, pixmaps, and cursor + * input: size, offset + * output: 0 if OK, -1 if error + */ +int mmReserveMem( memHeap_t *heap, int offset,int size ); +int mmFreeReserved( memHeap_t *heap, int offset ); + +/* + * destroy MM + */ +void mmDestroy( memHeap_t *mmInit ); + +/* For debuging purpose. */ +void mmDumpMemInfo( memHeap_t *mmInit ); + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_mm.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_mm.c:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/sis/sis_mm.c Wed Dec 12 19:24:52 2001 @@ -0,0 +1,300 @@ +/* sis_mm.c -- Private header for Direct Rendering Manager -*- linux-c -*- + * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw + * + * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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: + * Sung-Ching Lin <sclin@sis.com.tw> + * + */ + +#ifdef __linux +#define __NO_VERSION__ +#include <linux/sisfb.h> +#endif + +#include "sis.h" +#include "drmP.h" +#include "sis_drm.h" +#include "sis_drv.h" +#include "sis_ds.h" + +#define MAX_CONTEXT 100 +#define VIDEO_TYPE 0 +#define AGP_TYPE 1 + +typedef struct { + int used; + int context; + set_t *sets[2]; /* 0 for video, 1 for AGP */ +} sis_context_t; + +static sis_context_t global_ppriv[MAX_CONTEXT]; + +static int add_alloc_set(int context, int type, unsigned int val) +{ + int i, retval = 0; + + for(i = 0; i < MAX_CONTEXT; i++) + if(global_ppriv[i].used && global_ppriv[i].context == context){ + retval = setAdd(global_ppriv[i].sets[type], val); + break; + } + return retval; +} + +static int del_alloc_set(int context, int type, unsigned int val) +{ + int i, retval = 0; + for(i = 0; i < MAX_CONTEXT; i++) + if(global_ppriv[i].used && global_ppriv[i].context == context){ + retval = setDel(global_ppriv[i].sets[type], val); + break; + } + return retval; +} + +/* fb management via fb device */ +#if 1 +int sis_fb_alloc( DRM_OS_IOCTL ) +{ + drm_sis_mem_t fb; + struct sis_memreq req; + int retval = 0; + + DRM_OS_KRNFROMUSR( fb, (drm_sis_mem_t *) data, sizeof(fb) ); + + req.size = fb.size; + sis_malloc(&req); + if(req.offset){ + /* TODO */ + fb.offset = req.offset; + fb.free = req.offset; + if(!add_alloc_set(fb.context, VIDEO_TYPE, fb.free)){ + DRM_DEBUG("adding to allocation set fails"); + sis_free(req.offset); + retval = -1; + } + } + else{ + fb.offset = 0; + fb.size = 0; + fb.free = 0; + } + + DRM_OS_KRNTOUSR( (drm_sis_mem_t *) data, fb, sizeof(fb) ); + + DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb.size, req.offset); + + return retval; +} + +int sis_fb_free( DRM_OS_IOCTL ) +{ + drm_sis_mem_t fb; + int retval = 0; + + DRM_OS_KRNFROMUSR( fb, (drm_sis_mem_t *) data, sizeof(fb) ); + + if(!fb.free){ + return -1; + } + + sis_free(fb.free); + if(!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) + retval = -1; + + DRM_DEBUG("free fb, offset = %d\n", fb.free); + + return retval; +} + +#else + +int sis_fb_alloc( DRM_OS_IOCTL ) +{ + return -1; +} + +int sis_fb_free( DRM_OS_IOCTL ) +{ + return 0; +} + +#endif + +/* agp memory management */ +#if 1 + +static memHeap_t *AgpHeap = NULL; + +int sisp_agp_init( DRM_OS_IOCTL ) +{ + drm_sis_agp_t agp; + + DRM_OS_KRNFROMUSR( agp, (drm_sis_agp_t *) data, sizeof(agp) ); + + AgpHeap = mmInit(agp.offset, agp.size); + + DRM_DEBUG("offset = %u, size = %u", agp.offset, agp.size); + + return 0; +} + +int sisp_agp_alloc( DRM_OS_IOCTL ) +{ + drm_sis_mem_t agp; + PMemBlock block; + int retval = 0; + + if(!AgpHeap) + return -1; + + DRM_OS_KRNFROMUSR( agp, (drm_sis_mem_t *) data, sizeof(agp)); + + block = mmAllocMem(AgpHeap, agp.size, 0, 0); + if(block){ + /* TODO */ + agp.offset = block->ofs; + agp.free = (unsigned int)block; + if(!add_alloc_set(agp.context, AGP_TYPE, agp.free)){ + DRM_DEBUG("adding to allocation set fails"); + mmFreeMem((PMemBlock)agp.free); + retval = -1; + } + } + else{ + agp.offset = 0; + agp.size = 0; + agp.free = 0; + } + + DRM_OS_KRNTOUSR( (drm_sis_mem_t *) data, agp, sizeof(agp) ); + + DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp.size, agp.offset); + + return retval; +} + +int sisp_agp_free( DRM_OS_IOCTL ) +{ + drm_sis_mem_t agp; + int retval = 0; + + if(!AgpHeap) + return -1; + + DRM_OS_KRNFROMUSR( agp, (drm_sis_mem_t *) data, sizeof(agp)); + + if(!agp.free){ + return -1; + } + + mmFreeMem((PMemBlock)agp.free); + if(!del_alloc_set(agp.context, AGP_TYPE, agp.free)) + retval = -1; + + DRM_DEBUG("free agp, free = %d\n", agp.free); + + return retval; +} + +#endif + +int sis_init_context(int context) +{ + int i; + + for(i = 0; i < MAX_CONTEXT ; i++) + if(global_ppriv[i].used && (global_ppriv[i].context == context)) + break; + + if(i >= MAX_CONTEXT){ + for(i = 0; i < MAX_CONTEXT ; i++){ + if(!global_ppriv[i].used){ + global_ppriv[i].context = context; + global_ppriv[i].used = 1; + global_ppriv[i].sets[0] = setInit(); + global_ppriv[i].sets[1] = setInit(); + DRM_DEBUG("init allocation set, socket=%d, context = %d\n", + i, context); + break; + } + } + if((i >= MAX_CONTEXT) || (global_ppriv[i].sets[0] == NULL) || + (global_ppriv[i].sets[1] == NULL)){ + return 0; + } + } + + return 1; +} + +int sis_final_context(int context) +{ + int i; + + for(i=0; i<MAX_CONTEXT; i++) + if(global_ppriv[i].used && (global_ppriv[i].context == context)) + break; + + if(i < MAX_CONTEXT){ + set_t *set; + unsigned int item; + int retval; + + DRM_DEBUG("find socket %d, context = %d\n", i, context); + + /* Video Memory */ + set = global_ppriv[i].sets[0]; + retval = setFirst(set, &item); + while(retval){ + DRM_DEBUG("free video memory 0x%x\n", item); +#if 0 + sis_free(item); +#endif + retval = setNext(set, &item); + } + setDestroy(set); + + /* AGP Memory */ + set = global_ppriv[i].sets[1]; + retval = setFirst(set, &item); + while(retval){ + DRM_DEBUG("free agp memory 0x%x\n", item); + mmFreeMem((PMemBlock)item); + retval = setNext(set, &item); + } + setDestroy(set); + + global_ppriv[i].used = 0; + } + + /* turn-off auto-flip */ + /* TODO */ +#if defined(SIS_STEREO) + flip_final(); +#endif + + return 1; +} 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.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile:1.2 Tue Mar 6 11:45:29 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile Wed Dec 12 19:24:52 2001 @@ -1,15 +1,25 @@ # $FreeBSD$ -KMOD = tdfx -SRCS = tdfx_drv.c tdfx_context.c -SRCS += device_if.h bus_if.h pci_if.h -CFLAGS += ${DEBUG_FLAGS} -I. -I.. -KMODDEPS = drm +KMOD= tdfx +NOMAN= YES +SRCS= tdfx_drv.c +SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h +CFLAGS+= ${DEBUG_FLAGS} -I. -I.. @: ln -sf /sys @ machine: ln -sf /sys/i386/include machine + +.if ${MACHINE_ARCH} == "i386" +# This line enables linux ioctl handling +# If you want support for this uncomment this line +#TDFX_OPTS= "\#define DRM_LINUX" 1 +.endif + +opt_drm_linux.h: + touch opt_drm_linux.h + echo $(TDFX_OPTS) >> opt_drm_linux.h .include <bsd.kmod.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx.h:1.1 --- /dev/null Fri Jan 18 15:26:01 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx.h Wed Dec 12 19:24:52 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/bsd/drm/kernel/tdfx/tdfx_context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_context.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_context.c:1.1 Fri Jun 16 20:03:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_context.c Fri Jan 18 15:26:01 2002 @@ -1,204 +0,0 @@ -/* tdfx_context.c -- IOCTLs for tdfx contexts -*- 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> - * - */ - -#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 - getnanotime(&dev->ctx_start); -#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 = ticks; - - 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 - { - struct timespec ts; - getnanotime(&ts); - timespecsub(&ts, &dev->lck_start); - atomic_inc(&dev->histo.ctx[drm_histogram_slot(&ts)]); - } -#endif - clear_bit(0, &dev->context_flag); - wakeup(&dev->context_wait); - - return 0; -} - - -int -tdfx_resctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i, error; - - DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - res = *(drm_ctx_res_t *) data; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - error = copyout(&i, &res.contexts[i], sizeof(i)); - if (error) return error; - } - } - res.count = DRM_RESERVED_CONTEXTS; - *(drm_ctx_res_t *) data = res; - return 0; -} - - -int -tdfx_addctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - 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; - } - - *(drm_ctx_t *) data = ctx; - return 0; -} - -int -tdfx_modctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - if (ctx.flags==_DRM_CONTEXT_PRESERVED) - tdfx_res_ctx.handle=ctx.handle; - return 0; -} - -int -tdfx_getctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - /* This is 0, because we don't hanlde any context flags */ - ctx.flags = 0; - *(drm_ctx_t *) data = ctx; - return 0; -} - -int -tdfx_switchctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - DRM_DEBUG("%d\n", ctx.handle); - return tdfx_context_switch(dev, dev->last_context, ctx.handle); -} - -int -tdfx_newctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - DRM_DEBUG("%d\n", ctx.handle); - tdfx_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int -tdfx_rmctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_ctx_t ctx; - - ctx = *(drm_ctx_t *) data; - drm_ctxbitmap_free(dev, ctx.handle); - - return 0; -} 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.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c:1.3 Tue Mar 6 11:45:29 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c Wed Dec 12 19:24:52 2001 @@ -1,4 +1,4 @@ -/* tdfx.c -- tdfx driver -*- c -*- +/* tdfx_drv.c -- tdfx driver -*- linux-c -*- * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -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,719 +23,78 @@ * OTHER LIABILITY, WHETHER IN AN ACTION 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> */ -#include "drmP.h" -#include "tdfx_drv.h" +#include <sys/types.h> +#include <sys/bus.h> #include <pci/pcivar.h> - -MODULE_DEPEND(tdfx, drm, 1, 1, 1); -#ifdef DRM_AGP -MODULE_DEPEND(tdfx, agp, 1, 1, 1); -#endif +#include <opt_drm_linux.h> -#define TDFX_NAME "tdfx" -#define TDFX_DESC "tdfx" -#define TDFX_DATE "20000928" -#define TDFX_MAJOR 1 -#define TDFX_MINOR 0 -#define TDFX_PATCHLEVEL 0 - -static int tdfx_init(device_t nbdev); -static void tdfx_cleanup(device_t nbdev); - -drm_ctx_t tdfx_res_ctx; - -static int tdfx_probe(device_t dev) -{ - const char *s = 0; - - switch (pci_get_devid(dev)) { - case 0x0003121a: - s = "3Dfx Voodoo Banshee graphics accelerator"; - break; - - case 0x0005121a: - s = "3Dfx Voodoo 3 graphics accelerator"; - break; - case 0x0009121a: - s = "3Dfx Voodoo 5 graphics accelerator"; - break; - } - - if (s) { - device_set_desc(dev, s); - return 0; - } - - return ENXIO; -} - -static int tdfx_attach(device_t dev) -{ - tdfx_init(dev); - return 0; -} - -static int tdfx_detach(device_t dev) -{ - tdfx_cleanup(dev); - return 0; -} - -static device_method_t tdfx_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, tdfx_probe), - DEVMETHOD(device_attach, tdfx_attach), - DEVMETHOD(device_detach, tdfx_detach), +#include "tdfx.h" +#include "drmP.h" - { 0, 0 } -}; +#define DRIVER_AUTHOR "VA Linux Systems Inc." -static driver_t tdfx_driver = { - "drm", - tdfx_methods, - sizeof(drm_device_t), -}; +#define DRIVER_NAME "tdfx" +#define DRIVER_DESC "3dfx Banshee/Voodoo3+" +#define DRIVER_DATE "20010216" -static devclass_t tdfx_devclass; -#define TDFX_SOFTC(unit) \ - ((drm_device_t *) devclass_get_softc(tdfx_devclass, unit)) - -DRIVER_MODULE(if_tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0); - -#define CDEV_MAJOR 145 - /* tdfx_drv.c */ -static d_open_t tdfx_open; -static d_close_t tdfx_close; -static d_ioctl_t tdfx_version; -static d_ioctl_t tdfx_ioctl; -static d_ioctl_t tdfx_lock; -static d_ioctl_t tdfx_unlock; - -static struct cdevsw tdfx_cdevsw = { - /* open */ tdfx_open, - /* close */ tdfx_close, - /* read */ drm_read, - /* write */ drm_write, - /* ioctl */ tdfx_ioctl, - /* poll */ drm_poll, - /* mmap */ drm_mmap, - /* strategy */ nostrategy, - /* name */ "tdfx", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_TRACKCLOSE, - /* bmaj */ -1 -}; +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 -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 }, -#ifdef DRM_AGP - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 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}, +#ifndef PCI_VENDOR_ID_3DFX +#define PCI_VENDOR_ID_3DFX 0x121A #endif -}; -#define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls) - -static int -tdfx_setup(drm_device_t *dev) -{ - int i; - - device_busy(dev->device); - - 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; - dev->lock.lock_queue = 0; - 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; - callout_init(&dev->timer); - dev->context_wait = 0; - - timespecclear(&dev->ctx_start); - timespecclear(&dev->lck_start); - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - bzero(&dev->buf_sel, sizeof dev->buf_sel); - dev->buf_sigio = NULL; - dev->buf_readers = 0; - dev->buf_writers = 0; - dev->buf_selecting = 0; - - 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"); - - lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, curproc); - callout_stop(&dev->timer); - - if (dev->devname) { - drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); - dev->devname = NULL; - } - - if (dev->unique) { - drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); - dev->unique = NULL; - dev->unique_len = 0; - } - /* Clear pid list */ - for (i = 0; i < DRM_HASH_SIZE; i++) { - for (pt = dev->magiclist[i].head; pt; pt = next) { - next = pt->next; - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - } - dev->magiclist[i].head = dev->magiclist[i].tail = NULL; - } -#ifdef DRM_AGP - /* Clear AGP information */ - if (dev->agp) { - drm_agp_mem_t *temp; - drm_agp_mem_t *temp_next; - - temp = dev->agp->memory; - while(temp != NULL) { - temp_next = temp->next; - drm_free_agp(temp->handle, temp->pages); - drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); - temp = temp_next; - } - - if (dev->agp->acquired) - agp_release(dev->agp->agpdev); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } +#ifndef PCI_DEVICE_ID_3DFX_VOODOO5 +#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 #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); - } +#ifndef PCI_DEVICE_ID_3DFX_VOODOO4 +#define PCI_DEVICE_ID_3DFX_VOODOO4 0x0007 #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; /* XXX */ - } - 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; - wakeup(&dev->lock.lock_queue); - } - lockmgr(&dev->dev_lock, LK_RELEASE, 0, curproc); - - return 0; -} - -/* tdfx_init is called via tdfx_attach at module load time, */ - -static int -tdfx_init(device_t nbdev) -{ - drm_device_t *dev = device_get_softc(nbdev); - int retcode; - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - simple_lock_init(&dev->count_lock); - lockinit(&dev->dev_lock, PZERO, "drmlk", 0, 0); - -#if 0 - drm_parse_options(tdfx); +#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_3000 /* Voodoo3 3000 */ +#define PCI_DEVICE_ID_3DFX_VOODOO3_3000 0x0005 #endif - - dev->device = nbdev; - dev->devnode = make_dev(&tdfx_cdevsw, - device_get_unit(nbdev), - DRM_DEV_UID, - DRM_DEV_GID, - DRM_DEV_MODE, - TDFX_NAME); - dev->name = TDFX_NAME; - - drm_mem_init(); - drm_sysctl_init(dev); - TAILQ_INIT(&dev->files); - -#ifdef DRM_AGP - dev->agp = drm_agp_init(); -#endif - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_sysctl_cleanup(dev); - 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, - device_get_unit(nbdev)); - - return 0; -} - -/* tdfx_cleanup is called via tdfx_detach at module unload time. */ - -static void -tdfx_cleanup(device_t nbdev) -{ - drm_device_t *dev = device_get_softc(nbdev); - - DRM_DEBUG("\n"); - - drm_sysctl_cleanup(dev); - destroy_dev(dev->devnode); - - DRM_INFO("Module unloaded\n"); - - drm_ctxbitmap_cleanup(dev); - tdfx_takedown(dev); -} - -static int -tdfx_version(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_version_t version; - int len; - - version = *(drm_version_t *) data; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - int error = copyout(value, name, len); \ - if (error) return error; \ - } - - 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); - - *(drm_version_t *) data = version; - return 0; -} - -static int -tdfx_open(dev_t kdev, int flags, int fmt, struct proc *p) -{ - drm_device_t *dev = TDFX_SOFTC(minor(kdev)); - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - - device_busy(dev->device); - if (!(retcode = drm_open_helper(kdev, flags, fmt, p, dev))) { - atomic_inc(&dev->total_open); - simple_lock(&dev->count_lock); - if (!dev->open_count++) { - simple_unlock(&dev->count_lock); - retcode = tdfx_setup(dev); - } - simple_unlock(&dev->count_lock); - } - device_unbusy(dev->device); - - return retcode; -} - -static int -tdfx_close(dev_t kdev, int flags, int fmt, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_close(kdev, flags, fmt, p))) { - atomic_inc(&dev->total_close); - simple_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); - simple_unlock(&dev->count_lock); - return EBUSY; - } - simple_unlock(&dev->count_lock); - device_unbusy(dev->device); - return tdfx_takedown(dev); - } - simple_unlock(&dev->count_lock); - } - - return retcode; -} - -/* tdfx_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -static int -tdfx_ioctl(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_device_t *dev = kdev->si_drv1; - drm_file_t *priv; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - d_ioctl_t *func; - - DRM_DEBUG("dev=%p\n", dev); - priv = drm_find_file_by_proc(dev, p); - if (!priv) { - DRM_DEBUG("can't find authenticator\n"); - return EINVAL; - } - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - - DRM_DEBUG("pid = %d, cmd = 0x%02lx, nr = 0x%02x, auth = %d\n", - p->p_pid, cmd, nr, priv->authenticated); - - switch (cmd) { - case FIONBIO: - atomic_dec(&dev->ioctl_count); - return 0; - - case FIOASYNC: - atomic_dec(&dev->ioctl_count); - dev->flags |= FASYNC; - return 0; - - case FIOSETOWN: - atomic_dec(&dev->ioctl_count); - return fsetown(*(int *)data, &dev->buf_sigio); - - case FIOGETOWN: - atomic_dec(&dev->ioctl_count); - *(int *) data = fgetown(dev->buf_sigio); - return 0; - } - - 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 && suser(p)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = EACCES; - } else { - retcode = (func)(kdev, cmd, data, flags, p); - } - } - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -static int -tdfx_lock(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - int ret = 0; - drm_lock_t lock; -#if DRM_DMA_HISTOGRAM - - getnanotime(&dev->lck_start); -#endif - - lock = *(drm_lock_t *) data; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - p->p_pid, lock.context); - return EINVAL; - } - - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, p->p_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 = ticks - 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 ticks=%d\n", - lock.context, p->p_pid, j, - dev->lock.lock_time, ticks); - ret = tsleep(&never, PZERO|PCATCH, "drmlk1", - DRM_LOCK_SLICE - j); - if (ret) - return ret; - DRM_DEBUG("ticks=%d\n", ticks); - } - } +#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_2000 /* Voodoo3 3000 */ +#define PCI_DEVICE_ID_3DFX_VOODOO3_2000 0x0004 #endif - for (;;) { - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = p->p_pid; - dev->lock.lock_time = ticks; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); - ret = tsleep(&dev->lock.lock_queue, - PZERO|PCATCH, - "drmlk2", - 0); - if (ret) - break; - } - } - -#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); - } - } +#ifndef PCI_DEVICE_ID_3DFX_BANSHEE +#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 #endif - if (!ret) { - if (lock.flags & _DRM_LOCK_READY) { - /* Wait for space in DMA/FIFO */ - } - if (lock.flags & _DRM_LOCK_QUIESCENT) { - /* Make hardware quiescent */ -#if 0 - tdfx_quiescent(dev); -#endif - } - } +/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h + * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. + */ +drm_chipinfo_t DRM(devicelist)[] = { + {0x121a, 0x0003, 1, "3dfx Voodoo Banshee"}, + {0x121a, 0x0004, 1, "3dfx Voodoo3 2000"}, + {0x121a, 0x0005, 1, "3dfx Voodoo3 3000"}, + {0x121a, 0x0007, 1, "3dfx Voodoo4"}, + {0x121a, 0x0009, 1, "3dfx Voodoo5"}, + {0, 0, 0, NULL} +}; -#if 0 - DRM_ERROR("pid = %5d, old counter = %5ld\n", - p->p_pid, current->counter); -#endif -#if 0 - while (current->counter > 25) - current->counter >>= 1; /* decrease time slice */ - DRM_ERROR("pid = %5d, new counter = %5ld\n", - p->p_pid, current->counter); -#endif - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); -#if DRM_DMA_HISTOGRAM - { - struct timespec ts; - getnanotime(&ts); - timespecsub(&ts, &dev->lck_start); - atomic_inc(&dev->histo.lhld[drm_histogram_slot(&ts)]); - } -#endif - - return ret; -} - - -static int -tdfx_unlock(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - drm_device_t *dev = kdev->si_drv1; - drm_lock_t lock; - - lock = *(drm_lock_t *) data; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - p->p_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"); - } - } +#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_vm.h" +#include "drm_sysctl.h" - return 0; -} +DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.h:1.1 Fri Jun 16 20:03:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.h Fri Jan 18 15:26:02 2002 @@ -1,45 +0,0 @@ -/* tdfx_drv.h -- Private header for tdfx driver -*- 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. - * - * - */ - -#ifndef _TDFX_DRV_H_ -#define _TDFX_DRV_H_ - - /* tdfx_context.c */ - -extern d_ioctl_t tdfx_resctx; -extern d_ioctl_t tdfx_addctx; -extern d_ioctl_t tdfx_modctx; -extern d_ioctl_t tdfx_getctx; -extern d_ioctl_t tdfx_switchctx; -extern d_ioctl_t tdfx_newctx; -extern d_ioctl_t tdfx_rmctx; - -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/bus/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.16 xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.18 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.16 Fri Apr 20 13:02:43 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile Thu Nov 1 18:35:33 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.16 2001/04/20 17:02:43 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.18 2001/11/01 23:35:33 dawes Exp $ #include <Server.tmpl> @@ -27,7 +27,13 @@ #elif defined(LinuxArchitecture) && \ (defined(PpcArchitecture) || \ defined(MipsArchitecture) || \ - defined(ia64Architecture)) + defined(ia64Architecture) || \ + defined(Mc68020Architecture) || \ + defined(Arm32Architecture) || \ + defined(HPArchitecture) || \ + defined(s390Architecture) || \ + defined(SuperHArchitecture) || \ + defined(SuperHebArchitecture)) 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.48.2.1 xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c:1.51 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c:1.48.2.1 Mon May 21 01:00:36 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c Sat Oct 27 23:34:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.48.2.1 2001/05/21 05:00:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.51 2001/10/28 03:34:00 tsi Exp $ */ /* * Pci.c - New server PCI access functions * @@ -24,7 +24,7 @@ * pciBusAddrToHostAddr() - Convert a PCI address to a host address * pciHostAddrToBusAddr() - Convert a host address to a PCI address * pciGetBaseSize - Returns the number of bits in a PCI base addr mapping - * xf86MapPciMem() - Like xf86MapVidMem() expect function expects + * xf86MapPciMem() - Like xf86MapVidMem() except function expects * a PCI address and PCITAG (identifies PCI domain) * xf86ReadPciBIOS() - Like xf86ReadBIOS, except that it handles PCI/host * address translation and BIOS decode enabling. @@ -60,9 +60,6 @@ * Of course, if you choose not to use one of the generic * functions, you will need to provide a platform specifc replacement. * - * See xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c for an example - * of how to extend this framework to other platforms/OSes. - * * Gary Barton * Concurrent Computer Corporation * garyb@gate.net @@ -211,9 +208,6 @@ static Bool inProbe = FALSE; static pciConfigPtr pci_devp[MAX_PCI_DEVICES + 1] = {NULL, }; -#ifdef INCLUDE_LOCKPCI -static pciConfigPtr pci_locked_devp[MAX_PCI_DEVICES + 1] = {NULL, }; -#endif /* * Platform specific PCI function pointers. @@ -255,10 +249,9 @@ pciFindFirst(CARD32 id, CARD32 mask) { #ifdef DEBUGPCI -ErrorF("pciFindFirst(0x%lx, 0x%lx), pciInit = %d\n", id, mask, pciInitialized); + ErrorF("pciFindFirst(0x%lx, 0x%lx), pciInit = %d\n", id, mask, pciInitialized); #endif - if (!pciInitialized) - pciInit(); + pciInit(); pciDevid = id & mask; pciDevidMask = mask; @@ -270,10 +263,9 @@ pciFindNext(void) { #ifdef DEBUGPCI -ErrorF("pciFindNext(), pciInit = %d\n", pciInitialized); + ErrorF("pciFindNext(), pciInit = %d\n", pciInitialized); #endif - if (!pciInitialized) - pciInit(); + pciInit(); return((*pciFindNextFP)()); } @@ -284,10 +276,9 @@ int bus = PCI_BUS_FROM_TAG(tag); #ifdef DEBUGPCI -ErrorF("pciReadLong(0x%lx, %d)\n", tag, offset); + ErrorF("pciReadLong(0x%lx, %d)\n", tag, offset); #endif - if (!pciInitialized) - pciInit(); + pciInit(); if ((bus < pciNumBuses || inProbe) && pciBusInfo[bus] && pciBusInfo[bus]->funcs.pciReadLong) { @@ -334,8 +325,7 @@ { int bus = PCI_BUS_FROM_TAG(tag); - if (!pciInitialized) - pciInit(); + pciInit(); if (bus < pciNumBuses && pciBusInfo[bus] && pciBusInfo[bus]->funcs.pciWriteLong) @@ -384,8 +374,7 @@ #ifdef DEBUGPCI ErrorF("pciReadLong(0x%lx, %d)\n", tag, offset); #endif - if (!pciInitialized) - pciInit(); + pciInit(); if (bus < pciNumBuses && pciBusInfo[bus] && pciBusInfo[bus]->funcs.pciReadLong) { @@ -411,8 +400,7 @@ { int bus = PCI_BUS_FROM_TAG(tag); - if (!pciInitialized) - pciInit(); + pciInit(); if (bus > pciNumBuses || !pciBusInfo[bus] || !pciBusInfo[bus]->funcs.pciReadLong) return NULL; @@ -433,8 +421,7 @@ { int bus = PCI_BUS_FROM_TAG(tag); - if (!pciInitialized) - pciInit(); + pciInit(); if (bus < pciNumBuses && pciBusInfo[bus] && pciBusInfo[bus]->funcs.pciAddrBusToHost) @@ -448,8 +435,7 @@ { int bus = PCI_BUS_FROM_TAG(tag); - if (!pciInitialized) - pciInit(); + pciInit(); if (bus < pciNumBuses && pciBusInfo[bus] && pciBusInfo[bus]->funcs.pciAddrHostToBus) @@ -494,8 +480,7 @@ if (index < 0 || index > 6) return 0; - if (!pciInitialized) - pciInit(); + pciInit(); if (xf86GetPciSizeFromOS(tag, index, &bits)) { if (min) @@ -629,8 +614,10 @@ pciGenFindNext(void) { unsigned long devid, tmp; - unsigned char base_class, sub_class, sec_bus, pri_bus; + unsigned int sec_bus, pri_bus; + static int previousBus = 0; Bool speculativeProbe = FALSE; + unsigned char base_class, sub_class; #ifdef DEBUGPCI ErrorF("pciGenFindNext\n"); @@ -648,7 +635,8 @@ if (pciNumBuses == 0) return(PCI_NOT_FOUND); - pciBusNum = 0; + /* Skip ahead to the first bus defined by pciInit() */ + for (pciBusNum = 0; !pciBusInfo[pciBusNum]; ++pciBusNum); pciFuncNum = 0; pciDevNum = 0; } else { @@ -664,7 +652,7 @@ /* * Is current dev a multifunction device? */ - if (pciMfDev(pciBusNum, pciDevNum)) + if (!speculativeProbe && pciMfDev(pciBusNum, pciDevNum)) /* Probe for other functions */ pciFuncNum = 1; else @@ -713,7 +701,7 @@ #endif if (!pciBusInfo[pciBusNum]) { pciBusInfo[pciBusNum] = xnfalloc(sizeof(pciBusInfo_t)); - *pciBusInfo[pciBusNum] = *pciBusInfo[0]; + *pciBusInfo[pciBusNum] = *pciBusInfo[previousBus]; speculativeProbe = TRUE; } @@ -733,13 +721,15 @@ #ifdef DEBUGPCI ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid); #endif - if (devid == 0xffffffff) + if ((devid == 0xffffffff) || (devid == 0x00000000) || + (devid == 0xffff0000) || (devid == 0x0000ffff)) continue; /* Nobody home. Next device please */ - if (speculativeProbe && (pciNumBuses <= pciBusNum)) + if (pciNumBuses <= pciBusNum) pciNumBuses = pciBusNum + 1; speculativeProbe = FALSE; + previousBus = pciBusNum; /* * Before checking for a specific devid, look for enabled @@ -827,7 +817,7 @@ rv = inl(0xCFC); #if defined(__powerpc__) - signal(SIGBUS,SIG_DFL); + signal(SIGBUS, SIG_DFL); if (buserr_detected) return(0xffffffff); else @@ -870,7 +860,7 @@ outl(0xCFC, rv); #if defined(__powerpc__) - signal(SIGBUS,SIG_DFL); + signal(SIGBUS, SIG_DFL); #endif } @@ -926,8 +916,9 @@ pciConfigPtr * xf86scanpci(int flags) { - int idx = 0; - PCITAG tag; + pciConfigPtr devp; + int idx = 0; + PCITAG tag; if (pci_devp[0]) return pci_devp; @@ -940,65 +931,99 @@ return NULL; #ifdef DEBUGPCI -ErrorF("xf86scanpci: tag = 0x%lx\n", tag); + ErrorF("xf86scanpci: tag = 0x%lx\n", tag); #endif #ifndef OLD_FORMAT xf86MsgVerb(X_INFO, 2, "PCI: PCI scan (all values are in hex)\n"); #endif + while (idx < MAX_PCI_DEVICES && tag != PCI_NOT_FOUND) { - pciConfigPtr devp; - int i; - - devp = xalloc(sizeof(pciDevice)); - if (!devp) { - xf86Msg(X_ERROR, - "xf86scanpci: Out of memory after %d devices!!\n", - idx); - return (pciConfigPtr *)NULL; - } + int i; - /* Identify pci device by bus, dev, func, and tag */ - devp->tag = tag; - devp->busnum = PCI_BUS_FROM_TAG(tag); - devp->devnum = PCI_DEV_FROM_TAG(tag); - devp->funcnum = PCI_FUNC_FROM_TAG(tag); - - /* Read config space for this device */ - for (i = 0; i < 17; i++) /* PCI hdr plus 1st dev spec dword */ - devp->cfgspc.dwords[i] = - pciReadLong(tag, i * sizeof(CARD32)); + devp = xalloc(sizeof(pciDevice)); + if (!devp) { + xf86Msg(X_ERROR, + "xf86scanpci: Out of memory after %d devices!!\n", idx); + return (pciConfigPtr *)NULL; + } + /* Identify pci device by bus, dev, func, and tag */ + devp->tag = tag; + devp->busnum = PCI_BUS_FROM_TAG(tag); + devp->devnum = PCI_DEV_FROM_TAG(tag); + devp->funcnum = PCI_FUNC_FROM_TAG(tag); + + /* Read config space for this device */ + for (i = 0; i < 17; i++) /* PCI hdr plus 1st dev spec dword */ + devp->cfgspc.dwords[i] = pciReadLong(tag, i * sizeof(CARD32)); + + switch (devp->pci_header_type & 0x7f) { + case 0: /* Get base address sizes for type 0 headers */ - if ((devp->pci_header_type & 0x7f) == 0) - for (i = 0; i < 7; i++) - devp->basesize[i] = pciGetBaseSize(tag, i, FALSE, - &devp->minBasesize); - devp->listed_class = 0; + for (i = 0; i < 7; i++) + devp->basesize[i] = + pciGetBaseSize(tag, i, FALSE, &devp->minBasesize); + break; + + case 1: + /* Allow master aborts to complete normally on secondary buses */ + if (!(devp->pci_bridge_control & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) + break; + pciWriteByte(tag, PCI_PCI_BRIDGE_CONTROL_REG, + devp->pci_bridge_control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); + break; + + default: + break; + } + + devp->listed_class = 0; #ifdef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%02x,0x%02x,0x%1x " - "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", - devp->busnum, devp->devnum, devp->funcnum, - devp->pci_vendor, devp->pci_device, devp->pci_rev_id, - devp->pci_base_class, devp->pci_sub_class); + xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " + "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", + devp->busnum, devp->devnum, devp->funcnum, + devp->pci_vendor, devp->pci_device, devp->pci_rev_id, + devp->pci_base_class, devp->pci_sub_class); #else - xf86MsgVerb(X_INFO, 2, "PCI: %02x:%02x:%1x: chip %04x,%04x" - " card %04x,%04x rev %02x class %02x,%02x,%02x" - " hdr %02x\n", - devp->busnum, devp->devnum, devp->funcnum, - devp->pci_vendor, devp->pci_device, - devp->pci_subsys_vendor, devp->pci_subsys_card, - devp->pci_rev_id, devp->pci_base_class, - devp->pci_sub_class, devp->pci_prog_if, - devp->pci_header_type); + xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" + " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", + devp->busnum, devp->devnum, devp->funcnum, + devp->pci_vendor, devp->pci_device, + devp->pci_subsys_vendor, devp->pci_subsys_card, + devp->pci_rev_id, devp->pci_base_class, + devp->pci_sub_class, devp->pci_prog_if, + devp->pci_header_type); #endif - pci_devp[idx++] = devp; - tag = pciFindNext(); + pci_devp[idx++] = devp; + tag = pciFindNext(); + #ifdef DEBUGPCI -ErrorF("xf86scanpci: tag = pciFindNext = 0x%lx\n", tag); + ErrorF("xf86scanpci: tag = pciFindNext = 0x%lx\n", tag); #endif + + } + + /* Restore modified data (in reverse order) */ + while (--idx >= 0) { + devp = pci_devp[idx]; + switch (devp->pci_header_type & 0x7f) { + case 0: + break; + + case 1: + if (!(devp->pci_bridge_control & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) + break; + pciWriteByte(devp->tag, PCI_PCI_BRIDGE_CONTROL_REG, + devp->pci_bridge_control); + break; + + default: + break; + } } + #ifndef OLD_FORMAT xf86MsgVerb(X_INFO, 2, "PCI: End of PCI scan\n"); #endif @@ -1050,18 +1075,14 @@ } static int -readPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, - unsigned char *Buf, int Len) +handlePciBIOS(PCITAG Tag, int basereg, int (*func)(CARD8*,ADDRESS,pointer), pointer args) { CARD32 romsave = 0; int i; romBaseSource b_reg; ADDRESS hostbase; CARD8 tmp[64]; - CARD8 *image; - - unsigned long offset; - int ret, length, len, rlength; + int ret = 0; romsave = pciReadLong(Tag, PCI_MAP_ROM_REG); @@ -1084,7 +1105,7 @@ /* 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)); + savebase = pciReadLong(Tag, PCI_MAP_REG_START+(b_reg<<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), @@ -1105,52 +1126,19 @@ /* 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 + ret = func(tmp,hostbase,args); - /* 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; } @@ -1158,135 +1146,177 @@ pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); return 0; } + +typedef struct { + unsigned long Offset; + int Len; + unsigned char *Buf; + PciBiosType BiosType; +} readBios, *readBiosPtr; -#if 0 static int -readPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, - unsigned char *Buf, int Len) -{ - ADDRESS hostbase; - CARD8 *image = Buf; +readPciBios(CARD8* tmp, ADDRESS hostbase, pointer args) +{ + CARD8 *image; + unsigned int image_length = 0; + readBiosPtr rd = args; 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 */ + int ret, length, len, rlength; - /* - * Check if the rom base address is assigned. If it isn't, and if - * a basereg was supplied, temporarily map the rom at that base - * address. - */ - romsave = pciReadLong(Tag, PCI_MAP_ROM_REG); - romaddr = PCIGETROM(romsave); - if ((newbase = getValidBIOSBase(Tag, &basereg)) != romaddr) { -RetryWithBase: - romaddr = PCIGETROM(newbase); - if (romaddr) { - /* move mem base out of the way if in conflicts with ROM */ - if ((basereg >= 0) && (basereg <= 5)) { - if (!savebase) - savebase = pciReadLong(Tag, PCI_MAP_REG_START+(basereg<<2)); - if (PCIGETROM(savebase) == romaddr) { - 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), - (CARD32)~0); - } - } - } + /* We found a PCI BIOS Image. Now we look for the correct type */ + while ((tmp[0] == 0x55) && (tmp[1] == 0xAA)) { + unsigned short data_off = tmp[0x18] | (tmp[0x19] << 8); + unsigned char data[0x18]; + unsigned char type; + + if ((xf86ReadBIOS(hostbase + data_off, 0, data, sizeof(data)) + != sizeof(data)) || + (data[0] != 'P') || + (data[1] != 'C') || + (data[2] != 'I') || + (data[3] != 'R')) + break; + type = data[0x14]; +#ifdef PRINT_PCI + ErrorF("data segment in BIOS: 0x%x, type: 0x%x\n", data_off, type); +#endif + if (type != rd->BiosType) { /* not correct image: find next one */ + unsigned char indicator = data[0x15]; + unsigned int i_length; + if (indicator & 0x80) /* last image */ + break; + i_length = (data[0x10] | (data[0x11] << 8)) << 9; +#ifdef PRINT_PCI + ErrorF("data image length: 0x%x, ind: 0x%x\n", + image_length, indicator); +#endif + hostbase += i_length; + if (xf86ReadBIOS(hostbase, 0, tmp, sizeof(tmp)) + != sizeof(tmp)) + break; + continue; } - - - if (romaddr == 0) { - xf86Msg(X_WARNING, "xf86ReadPciBIOS: cannot locate a BIOS address\n"); - return -1; - } - 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)); - 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); - - /* 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] ) { + /* OK, we have a PCI BIOS Image of the correct type */ - /* 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; - } + if (rd->BiosType == PCI_BIOS_PC) + image_length = tmp[2] << 9; + else + image_length = (data[0x10] | (data[0x11] << 8)) << 9; +#ifdef PRINT_PCI + ErrorF("BIOS length: 0x%x\n", image_length); +#endif + break; + } + + ret = 0; + if (image_length) { + + /* + * if no length is given return the full lenght, + * Offset 0. Beware: Area pointed to by Buf must + * be large enough! + */ + if (rd->Len == 0) { + rd->Len = image_length; + rd->Offset = 0; + } + if ((rd->Offset) > (image_length)) { + xf86Msg(X_WARNING,"xf86ReadPciBios: requesting data past " + "end of BIOS %i > %i\n",(rd->Offset) , (image_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); + if ((rd->Offset + rd->Len) > (image_length)) { + rd->Len = (image_length) - rd->Offset; + xf86MsgVerb(X_INFO,3,"Truncating PCI BIOS Length to %i\n",rd->Len); + } } - - /* Restore ROM address decoding */ - pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); - /* Restore the base register if it was changed. */ - if (savebase) - pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), savebase); + + /* Read BIOS in 64kB chunks */ + offset = rd->Offset; + image = rd->Buf; + len = rd->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; + } + } - return ret; + return ret; } + +static int +getPciBIOSTypes(CARD8* tmp, ADDRESS hostbase, pointer arg) +{ + int n = 0; + PciBiosType *Buf = arg; + + /* We found a PCI BIOS Image. Now we collect the types type */ + do { + unsigned short data_off = tmp[0x18] | (tmp[0x19] << 8); + unsigned char data[16]; + unsigned int i_length; + + if ((xf86ReadBIOS(hostbase + data_off, 0, data, sizeof(data)) + != sizeof(data)) || + (data[0] != 'P') || + (data[1] != 'C') || + (data[2] != 'I') || + (data[3] != 'R')) + break; + + if (data[0x14] >= PCI_BIOS_OTHER) + *Buf++ = PCI_BIOS_OTHER; + else + *Buf++ = data[0x14]; + + n++; + if (data[0x15] & 0x80) /* last image */ + break; +#ifdef PRINT_PCI + ErrorF("data segment in BIOS: 0x%x, type: 0x%x\n", data_off, type); #endif + i_length = (data[0x10] | (data[0x11] << 8)) << 9; +#ifdef PRINT_PCI + ErrorF("data image length: 0x%x, ind: 0x%x\n", + image_length, indicator); +#endif + hostbase += i_length; + if (xf86ReadBIOS(hostbase, 0, tmp, sizeof(tmp)) + != sizeof(tmp)) + break; + continue; + } while ((tmp[0] == 0x55) && (tmp[1] == 0xAA)); + return n; +} typedef CARD32 (*ReadProcPtr)(PCITAG, int); typedef void (*WriteProcPtr)(PCITAG, int, CARD32); -int -xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, - unsigned char *Buf, int Len) +static int +HandlePciBios(PCITAG Tag, int basereg, int (*func)(CARD8*,ADDRESS,pointer), pointer ptr) { - int size, num; + int n, num; CARD32 Acc1, Acc2; PCITAG *pTag; int i; - size = readPciBIOS(Offset,Tag,basereg,Buf,Len); + n = handlePciBIOS(Tag,basereg,func,ptr); + if (n) + return n; - if ((size == Len) && (Buf[0] == 0x55) && (Buf[1] == 0xaa) && Buf[2] && - (Len >= (Buf[2] << 9))) - return size; - num = pciTestMultiDeviceCard(PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), PCI_FUNC_FROM_TAG(Tag),&pTag); - if (!num) return size; + if (!num) return 0; #define PCI_ENA (PCI_CMD_MEM_ENABLE | PCI_CMD_IO_ENABLE) Acc1 = ((ReadProcPtr)(pciLongFunc(Tag,READ)))(Tag,PCI_CMD_STAT_REG); @@ -1297,15 +1327,43 @@ Acc2 = ((ReadProcPtr)(pciLongFunc(pTag[i],READ)))(pTag[i],PCI_CMD_STAT_REG); ((WriteProcPtr)(pciLongFunc(pTag[i],WRITE)))(pTag[i], PCI_CMD_STAT_REG,(Acc2 | PCI_ENA)); - size = readPciBIOS(Offset,pTag[i],0,Buf,Len); + + n = handlePciBIOS(pTag[i],0,func,ptr); + ((WriteProcPtr)(pciLongFunc(pTag[i],WRITE)))(pTag[i],PCI_CMD_STAT_REG,Acc2); - if ((size == Len) && (Buf[0] == 0x55) && (Buf[1] == 0xaa) && Buf[2] && - (Len >= (Buf[2] << 9))) + if (n) break; } ((WriteProcPtr)(pciLongFunc(Tag,WRITE)))(Tag,PCI_CMD_STAT_REG,Acc1); - return size; + return n; } + +int +xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, + unsigned char *Buf, int Len) +{ + return xf86ReadPciBIOSByType(Offset, Tag, basereg, Buf, Len, PCI_BIOS_PC); +} + +int +xf86ReadPciBIOSByType(unsigned long Offset, PCITAG Tag, int basereg, + unsigned char *Buf, int Len, PciBiosType Type) +{ + + readBios rb; + rb.Offset = Offset; + rb.Len = Len; + rb.Buf = Buf; + rb.BiosType = Type; + + return HandlePciBios(Tag, basereg, readPciBios, &rb); +} + +int +xf86GetAvailablePciBIOSTypes(PCITAG Tag, int basereg, PciBiosType *Buf) +{ + return HandlePciBios(Tag, basereg, getPciBIOSTypes, (pointer) Buf); +} #endif /* INCLUDE_XF86_MAP_PCI_MEM */ Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h diff -u 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.21 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h:1.18.2.1 Mon May 21 01:00:36 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h Thu Nov 1 18:35:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.18.2.1 2001/05/21 05:00:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.21 2001/11/01 23:35:33 dawes Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -85,7 +85,7 @@ */ #define MAX_PCI_DEVICES 64 /* Max number of devices accomodated */ /* by xf86scanpci */ -#if defined(i386) || defined(__i386) || defined(__i386__) +#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 @@ -141,7 +141,7 @@ /* * Select architecture specific PCI init function */ -#if (defined(__powerpc__) || defined(__mips__)) && defined(linux) +#if (defined(__powerpc__) || defined(__mips__) || defined(__sh__) || defined(__mc68000__) || defined(__arm__) || defined(__s390__) || defined(__hppa__)) && defined(linux) # define ARCH_PCI_INIT linuxPciInit # define INCLUDE_XF86_MAP_PCI_MEM #elif defined(__powerpc__) && defined(__OpenBSD__) Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c:1.1 Fri Apr 20 13:02:43 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c Sat Oct 27 23:34:01 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/os-support/bus/Sbus.c,v 1.1 2001/04/20 17:02:43 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c,v 1.2 2001/10/28 03:34:01 tsi Exp $ */ #include <fcntl.h> #include <stdio.h> @@ -28,6 +28,9 @@ #include <stdlib.h> #include <sys/ioctl.h> #include <sys/mman.h> +#ifdef sun +#include <sys/utsname.h> +#endif #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" @@ -35,15 +38,37 @@ #include "xf86sbusBus.h" #include "xf86Sbus.h" +int promRootNode; + static int promFd = -1; -static int promRootNode, promCurrentNode; +static int 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 +sbusDevicePtr *xf86SbusInfo = NULL; + +struct sbus_devtable sbusDeviceTable[] = { + { SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "Sun Monochrome (bwtwo)" }, + { SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", "Sun Color2 (cgtwo)" }, + { SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "Sun Color3 (cgthree)" }, + { SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", "Sun Color4 (cgfour)" }, + { SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "Sun GX" }, + { SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", "Sun CG8/RasterOps" }, + { SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", "Sun GS (cgtwelve)" }, + { SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "Sun SX" }, + { SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", "Sun Graphics Tower" }, + { SBUS_DEVICE_MGX, -1, "mgx", "Quantum 3D MGXplus" }, + { SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "Sun ZX or Turbo ZX" }, + { SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "Sun TCX" }, + { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "Sun FFB" }, + { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "Sun Elite3D" }, + { 0, 0, NULL } +}; + +int promGetSibling(int node) { promOpio->oprom_size = sizeof(int); @@ -56,7 +81,7 @@ return *(int *)promOpio->oprom_array; } -static int +int promGetChild(int node) { promOpio->oprom_size = sizeof(int); @@ -69,7 +94,7 @@ return *(int *)promOpio->oprom_array; } -static char * +char * promGetProperty(const char *prop, int *lenp) { promOpio->oprom_size = MAX_VAL; @@ -81,7 +106,7 @@ return promOpio->oprom_array; } -static int +int promGetBool(const char *prop) { promOpio->oprom_size = 0; @@ -98,13 +123,11 @@ } } -enum { - PROM_NODE_PCI = 16, - PROM_NODE_EBUS = 8, - PROM_NODE_SBUS = 4, - PROM_NODE_PREF = 2, - PROM_NODE_SIBLING = 1 -}; +#define PROM_NODE_SIBLING 0x01 +#define PROM_NODE_PREF 0x02 +#define PROM_NODE_SBUS 0x04 +#define PROM_NODE_EBUS 0x08 +#define PROM_NODE_PCI 0x10 static int promSetNode(sbusPromNodePtr pnode) @@ -125,6 +148,7 @@ static void promIsP1275(void) { +#ifdef linux FILE *f; char buffer[1024]; @@ -139,6 +163,16 @@ break; } fclose(f); +#elif defined(sun) + struct utsname buffer; + + if ((uname(&buffer) == 0) && !strcmp(buffer.machine, "sun4u")) + promP1275 = TRUE; + else + promP1275 = FALSE; +#else +#error Missing promIsP1275() function for this OS +#endif } void @@ -200,72 +234,78 @@ return 0; return promGetBool(prop); } - -static sbusDevicePtr *devicePtrs; -static void promWalk(int node, int oldnode, int flags) +static void +promWalkAssignNodes(int node, int oldnode, int flags, sbusDevicePtr *devicePtrs) { int nextnode; - int len, sbus = (flags & PROM_NODE_SBUS); - char *prop = promGetProperty("device_type", &len); + int len, sbus = flags & PROM_NODE_SBUS; + char *prop; 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)) + prop = promGetProperty("device_type", &len); + if (prop && (len > 0)) do { + if (!strcmp(prop, "display")) { + prop = promGetProperty("name", &len); + if (!prop || len <= 0) 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)) + while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',') + prop++; + for (i = 0; sbusDeviceTable[i].devId; i++) + if (!strcmp(prop, sbusDeviceTable[i].promName)) + break; + devId = sbusDeviceTable[i].devId; + if (!devId) + break; + if (!sbus) { + if (devId == SBUS_DEVICE_FFB) { + /* + * All /SUNW,ffb outside of SBUS tree come before all + * /SUNW,afb outside of SBUS tree in Linux. + */ + if (!strcmp(prop, "afb")) + flags |= PROM_NODE_PREF; + } else if (devId != SBUS_DEVICE_CG14) + break; + } + for (i = 0; i < 32; i++) { + if (!devicePtrs[i] || devicePtrs[i]->devId != devId) continue; - for (j = i + 1, pNode = devicePtrs[i]->node; j < 32; j++) { - if (! devicePtrs[j] || devicePtrs[j]->devId != devId) + if (devicePtrs[i]->node.node) { + if ((devicePtrs[i]->node.cookie[0] & ~PROM_NODE_SIBLING) <= + (flags & ~PROM_NODE_SIBLING)) continue; - pNode2 = devicePtrs[j]->node; - devicePtrs[j]->node = pNode; - pNode = pNode2; + 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; } - devicePtrs[i]->node.node = node; - devicePtrs[i]->node.cookie[0] = flags; - devicePtrs[i]->node.cookie[1] = oldnode; break; } - break; - } + } while (0); + 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); + promWalkAssignNodes(nextnode, node, sbus, devicePtrs); + nextnode = promGetSibling(node); if (nextnode) - promWalk(nextnode, node, PROM_NODE_SIBLING|sbus); + promWalkAssignNodes(nextnode, node, PROM_NODE_SIBLING | sbus, devicePtrs); } void @@ -274,9 +314,10 @@ sbusDevicePtr psdp, *psdpp; int n, holes = 0, i, j; FILE *f; + sbusDevicePtr devicePtrs[32]; - devicePtrs = xnfcalloc(sizeof(sbusDevicePtr), 32); - for (psdpp = xf86SbusInfo, psdp = *psdpp, n = 0; psdp; psdp = *++psdpp, n++) { + (void)memset(devicePtrs, 0, sizeof(devicePtrs)); + for (psdpp = xf86SbusInfo, n = 0; (psdp = *psdpp); psdpp++, n++) { if (psdp->fbNum != n) holes = 1; devicePtrs[psdp->fbNum] = psdp; @@ -321,7 +362,7 @@ fclose(f); } promGetSibling(0); - promWalk(promRootNode, 0, 2); + promWalkAssignNodes(promRootNode, 0, PROM_NODE_PREF, devicePtrs); for (i = 0, j = 0; i < 32; i++) if (devicePtrs[i] && devicePtrs[i]->fbNum == -1) j++; @@ -334,7 +375,6 @@ } else n--; } - xfree(devicePtrs); } static char * @@ -377,7 +417,7 @@ } static int -promWalk2(char *path, int parent, int node, int searchNode, int type) +promWalkNode2Pathname(char *path, int parent, int node, int searchNode, int type) { int nextnode; int len, ntype = type; @@ -400,10 +440,12 @@ if (node == searchNode) return 1; nextnode = promGetChild(node); - if (nextnode && promWalk2(strchr (path, 0), node, nextnode, searchNode, ntype)) + if (nextnode && + promWalkNode2Pathname(strchr(path, 0), node, nextnode, searchNode, ntype)) return 1; nextnode = promGetSibling(node); - if (nextnode && promWalk2(path, parent, nextnode, searchNode, type)) + if (nextnode && + promWalkNode2Pathname(path, parent, nextnode, searchNode, type)) return 1; return 0; } @@ -416,14 +458,14 @@ if (!pnode->node) return NULL; ret = xalloc(4096); if (!ret) return NULL; - if (promWalk2(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0)) + if (promWalkNode2Pathname(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0)) return ret; xfree(ret); return NULL; } static int -promWalk3(char *name, char *regstr, int parent, int type) +promWalkPathname2Node(char *name, char *regstr, int parent, int type) { int len, node, ret; char *prop, *p; @@ -453,7 +495,7 @@ } if (!node) { for (node = promGetChild(parent); node; node = promGetSibling(node)) { - ret = promWalk3(name, regstr, node, type); + ret = promWalkPathname2Node(name, regstr, node, type); if (ret) return ret; } return 0; @@ -503,7 +545,7 @@ if (name + 1 == regstr) return 0; promGetSibling(0); - i = promWalk3(name + 1, regstr, promRootNode, 0); + i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0); xfree(name); return i; } 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.6.1 xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c:1.3.6.1 Tue May 29 12:38:00 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c Mon May 28 14:20:49 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c,v 1.3.6.1 2001/05/29 16:38:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c,v 1.4 2001/05/28 18:20:49 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * Index: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.4 Fri Apr 20 13:02:43 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c Sun May 27 22:42:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.4 2001/04/20 17:02:43 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.5 2001/05/28 02:42:30 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -136,4 +136,30 @@ val = (val & ~mask) | (bits & mask); syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); } -#endif /* Linux */ + +#elif defined(sun) + +/* + * Obviously, these need to be fleshed out, probably using openpromio. + */ +static CARD32 +sparcPciCfgRead(PCITAG tag, int off) +{ + FatalError("sparcPciCfgRead() called\n"); + + return 0; /* Gd'ole gcc... */ +} + +static void +sparcPciCfgWrite(PCITAG tag, int off, CARD32 val) +{ + FatalError("sparcPciCfbWrite() called\n"); +} + +static void +sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) +{ + FatalError("sparcPciCfgSetBits() called\n"); +} + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.27 xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.30 --- xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.27 Tue May 15 06:19:42 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h Sat Oct 27 23:34:01 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.27 2001/05/15 10:19:42 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.30 2001/10/28 03:34:01 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -334,8 +334,13 @@ #define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFFF0000) #define PCI_PCI_BRIDGE_CONTROL_REG 0x3E +#define PCI_PCI_BRIDGE_PARITY_EN 0x01 +#define PCI_PCI_BRIDGE_SERR_EN 0x02 #define PCI_PCI_BRIDGE_ISA_EN 0x04 #define PCI_PCI_BRIDGE_VGA_EN 0x08 +#define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20 +#define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40 +#define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80 /* Subsystem identification register */ #define PCI_SUBSYSTEM_ID_REG 0x2c @@ -349,7 +354,8 @@ */ /* Primitive Types */ -typedef unsigned long ADDRESS; /* Memory/PCI address */ +typedef unsigned long ADDRESS; /* Memory/PCI address */ +typedef unsigned long IOADDRESS; /* Must be large enough for a pointer */ typedef unsigned long PCITAG; /* @@ -625,6 +631,13 @@ #define pci_user_config_2 cfgspc.regs.devspf.bytes[2] #define pci_user_config_3 cfgspc.regs.devspf.bytes[3] +typedef enum { + PCI_BIOS_PC = 0, + PCI_BIOS_OPEN_FIRMARE, + PCI_BIOS_HP_PA_RISC, + PCI_BIOS_OTHER +} PciBiosType; + /* Public PCI access functions */ void pciInit(void); PCITAG pciFindFirst(CARD32 id, CARD32 mask); @@ -647,13 +660,13 @@ ADDRESS Base, unsigned long Size); int xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, unsigned char *Buf, int Len); +int xf86ReadPciBIOSByType(unsigned long Offset, PCITAG Tag, + int basereg, unsigned char *Buf, + int Len, PciBiosType Type); +int xf86GetAvailablePciBIOSTypes(PCITAG Tag, int basereg, + PciBiosType *Buf); pciConfigPtr *xf86scanpci(int flags); -/* Old sytle PCI access functions (for compatibility) */ -#if 0 -void xf86writepci(int, int, int, int, int, CARD32, CARD32); -#endif - extern int pciNumBuses; typedef enum { @@ -669,5 +682,3 @@ } 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.3 xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h:1.3 Fri Apr 20 13:02:43 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h Sat Oct 27 23:34:01 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/os-support/bus/xf86Sbus.h,v 1.3 2001/04/20 17:02:43 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h,v 1.4 2001/10/28 03:34:01 tsi Exp $ */ #ifndef _XF86_SBUS_H #define _XF86_SBUS_H @@ -36,6 +36,22 @@ #include <machine/fbio.h> #else #include <sun/fbio.h> +#endif + +#ifndef FBTYPE_SUNGP3 +#define FBTYPE_SUNGP3 -1 +#endif +#ifndef FBTYPE_MDICOLOR +#define FBTYPE_MDICOLOR -1 +#endif +#ifndef FBTYPE_SUNLEO +#define FBTYPE_SUNLEO -1 +#endif +#ifndef FBTYPE_TCXCOLOR +#define FBTYPE_TCXCOLOR -1 +#endif +#ifndef FBTYPE_CREATOR +#define FBTYPE_CREATOR -1 #endif #endif /* _XF86_SBUS_H */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.15 xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.17 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.15 Fri Feb 16 09:45:10 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c Thu Nov 1 18:35:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.15 2001/02/16 14:45:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.17 2001/11/01 23:35:33 dawes Exp $ */ /* Resource information code */ @@ -165,7 +165,7 @@ return ret; } -#elif defined(__powerpc__) || defined(__sparc__) || defined(__mips__) +#elif defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__sh__) || defined(__mc68000__) || defined(__arm__) || defined(__s390__) || defined(__hppa__) /* XXX this isn't exactly correct but it will get the server working * for now until we get something better. 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.5 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c:3.8 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c:3.5 Fri May 18 20:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c Mon Nov 26 14:02:02 2001 @@ -4,9 +4,10 @@ * This version is for both Linux and FreeBSD. * * Copyright © 2000 VA Linux Systems, Inc. + * Copyright © 2001 The XFree86 Project, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.5 2001/05/19 00:26:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.8 2001/11/26 19:02:02 dawes Exp $ */ #include "X.h" #include "xf86.h" @@ -17,7 +18,7 @@ #if defined(linux) #include <asm/ioctl.h> #include <linux/agpgart.h> -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__NetBSD__) #include <sys/ioctl.h> #include <sys/agpio.h> #endif @@ -55,7 +56,7 @@ * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called. */ static Bool -GARTInit() +GARTInit(int screenNum) { struct _agp_info agpinf; @@ -70,16 +71,17 @@ return FALSE; if (gartFd == -1) { - xf86Msg(X_ERROR, "Unable to open " AGP_DEVICE " (%s)\n", - strerror(errno)); - return FALSE; + xf86DrvMsg(screenNum, X_ERROR, + "GARTInit: Unable to open " AGP_DEVICE " (%s)\n", + strerror(errno)); + return FALSE; } xf86AcquireGART(-1); /* Check the kernel driver version. */ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { - xf86Msg(X_ERROR, "GARTInit: AGPIOC_INFO failed (%s)\n", - strerror(errno)); + xf86DrvMsg(screenNum, X_ERROR, + "GARTInit: AGPIOC_INFO failed (%s)\n", strerror(errno)); close(gartFd); gartFd = -1; return FALSE; @@ -90,8 +92,8 @@ /* Should this look for version >= rather than version == ? */ if (agpinf.version.major != AGPGART_MAJOR_VERSION && agpinf.version.minor != AGPGART_MINOR_VERSION) { - xf86Msg(X_ERROR, - "Kernel agpgart driver version is not current" + xf86DrvMsg(screenNum, X_ERROR, + "GARTInit: Kernel agpgart driver version is not current" " (%d.%d vs %d.%d)\n", agpinf.version.major, agpinf.version.minor, AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION); @@ -107,7 +109,7 @@ Bool xf86AgpGARTSupported() { - return GARTInit(); + return GARTInit(-1); } AgpInfoPtr @@ -116,12 +118,13 @@ struct _agp_info agpinf; AgpInfoPtr info; - if (!GARTInit()) + if (!GARTInit(screenNum)) return NULL; if ((info = xcalloc(sizeof(AgpInfo), 1)) == NULL) { - xf86DrvMsg(screenNum, X_ERROR, "Failed to allocate AgpInfo\n"); + xf86DrvMsg(screenNum, X_ERROR, + "xf86GetAGPInfo: Failed to allocate AgpInfo\n"); return NULL; } @@ -151,14 +154,14 @@ Bool xf86AcquireGART(int screenNum) { - if (screenNum != -1 && !GARTInit()) + if (screenNum != -1 && !GARTInit(screenNum)) return FALSE; if (screenNum == -1 || acquiredScreen != screenNum) { if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) { xf86DrvMsg(screenNum, X_WARNING, - "AGPIOC_ACQUIRE failed (%s)\n", - strerror(errno)); + "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n", + strerror(errno)); return FALSE; } acquiredScreen = screenNum; @@ -169,18 +172,29 @@ Bool xf86ReleaseGART(int screenNum) { - if (screenNum != -1 && !GARTInit()) + if (screenNum != -1 && !GARTInit(screenNum)) return FALSE; if (acquiredScreen == screenNum) { + /* + * The FreeBSD agp driver removes allocations on release. + * The Linux driver doesn't. xf86ReleaseGART() is expected + * to give up access to the GART, but not to remove any + * allocations. + */ +#if !defined(linux) + if (screenNum == -1) +#endif + { if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) { xf86DrvMsg(screenNum, X_WARNING, - "AGPIOC_RELEASE failed (%s)\n", - strerror(errno)); + "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n", + strerror(errno)); return FALSE; } acquiredScreen = -1; - return TRUE; + } + return TRUE; } return FALSE; } @@ -198,7 +212,7 @@ * memory is returned. On error, the return value is -1. */ - if (!GARTInit() || acquiredScreen != screenNum) + if (!GARTInit(screenNum) || acquiredScreen != screenNum) return -1; pages = (size / AGP_PAGE_SIZE); @@ -231,12 +245,12 @@ struct _agp_bind bind; int pageOffset; - if (!GARTInit() || acquiredScreen != screenNum) + if (!GARTInit(screenNum) || acquiredScreen != screenNum) return FALSE; if (acquiredScreen != screenNum) { xf86DrvMsg(screenNum, X_ERROR, - "AGP not acquired by this screen\n"); + "xf86BindGARTMemory: AGP not acquired by this screen\n"); return FALSE; } @@ -269,12 +283,12 @@ { struct _agp_unbind unbind; - if (!GARTInit() || acquiredScreen != screenNum) + if (!GARTInit(screenNum) || acquiredScreen != screenNum) return FALSE; if (acquiredScreen != screenNum) { xf86DrvMsg(screenNum, X_ERROR, - "AGP not acquired by this screen\n"); + "xf86UnbindGARTMemory: AGP not acquired by this screen\n"); return FALSE; } @@ -298,7 +312,7 @@ { agp_setup setup; - if (!GARTInit() || acquiredScreen != screenNum) + if (!GARTInit(screenNum) || acquiredScreen != screenNum) return FALSE; setup.agp_mode = mode; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c:3.9 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c:3.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c:3.9 Fri Dec 8 15:13:37 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c Mon Dec 24 17:54:31 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.9 2000/12/08 20:13:37 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.12 2001/12/24 22:54:31 dawes Exp $ */ #include "X.h" #include "os.h" @@ -13,6 +13,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <errno.h> #define APM_PROC "/proc/apm" #define APM_DEVICE "/dev/apm_bios" @@ -90,15 +91,15 @@ switch (event) { case XF86_APM_SYS_STANDBY: case XF86_APM_USER_STANDBY: - (void) ioctl( fd, APM_IOC_STANDBY, NULL ); - return PM_NONE; + if (ioctl( fd, APM_IOC_STANDBY, NULL )) + return PM_FAILED; + return PM_CONTINUE; case XF86_APM_SYS_SUSPEND: case XF86_APM_CRITICAL_SUSPEND: case XF86_APM_USER_SUSPEND: - if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0) - return PM_WAIT; - else - return PM_NONE; + if (ioctl( fd, APM_IOC_SUSPEND, NULL )) + return PM_FAILED; + return PM_CONTINUE; case XF86_APM_STANDBY_RESUME: case XF86_APM_NORMAL_RESUME: case XF86_APM_CRITICAL_RESUME: @@ -113,31 +114,35 @@ PMClose xf86OSPMOpen(void) { - int fd; + int fd, pfd; #ifdef DEBUG - ErrorF("APM: OSPMOpen called\n"); + ErrorF("APM: OSPMOpen called\n"); #endif - if (APMihPtr || !xf86Info.pmFlag) - return NULL; + if (APMihPtr || !xf86Info.pmFlag) + return NULL; - if (access( APM_PROC, R_OK ) || ((fd = open( APM_PROC, O_RDONLY)) == -1)) { - xf86MsgVerb(X_WARNING,3,"Cannot open APM\n"); - return NULL; - } - close( fd ); #ifdef DEBUG - ErrorF("APM: Opening device\n"); + ErrorF("APM: Opening device\n"); #endif - if ((fd = open( APM_DEVICE, O_RDWR )) > -1) { - xf86PMGetEventFromOs = lnxPMGetEventFromOs; - xf86PMConfirmEventToOs = lnxPMConfirmEventToOs; - APMihPtr = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL); - xf86MsgVerb(X_INFO,3,"Open APM successful\n"); - return lnxCloseAPM; - } - xf86MsgVerb(X_WARNING,3,"Open APM failed\n"); - return NULL; + if ((fd = open( APM_DEVICE, O_RDWR )) > -1) { + if (access( APM_PROC, R_OK ) || + ((pfd = open( APM_PROC, O_RDONLY)) == -1)) { + xf86MsgVerb(X_WARNING,3,"Cannot open APM (%s) (%s)\n", + APM_PROC, strerror(errno)); + close(fd); + return NULL; + } else + close(pfd); + xf86PMGetEventFromOs = lnxPMGetEventFromOs; + xf86PMConfirmEventToOs = lnxPMConfirmEventToOs; + APMihPtr = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL); + xf86MsgVerb(X_INFO,3,"Open APM successful\n"); + return lnxCloseAPM; + } + xf86MsgVerb(X_WARNING,3,"Open APM failed (%s) (%s)\n", APM_DEVICE, + strerror(errno)); + return NULL; } static void Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c:3.13 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c:3.14 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c:3.13 Tue Nov 14 16:59:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c Wed Oct 31 17:50:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.13 2000/11/14 21:59:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.14 2001/10/31 22:50:30 tsi Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -48,7 +48,7 @@ void xf86OpenConsole(void) { - int i, fd; + int i, fd = -1; int result; struct vt_mode VT; char vtname[11]; 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.19 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c:3.22 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c:3.19 Mon Mar 5 15:18:24 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c Wed Nov 7 23:00:14 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.19 2001/03/05 20:18:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.22 2001/11/08 04:00:14 tsi Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -34,6 +34,8 @@ #include "xf86Priv.h" #include "xf86_OSlib.h" +#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */ + void xf86SoundKbdBell(int loudness, int pitch, int duration) { @@ -139,9 +141,6 @@ char rad; #endif { - int i; - int value = 0x7f; /* Maximum delay with slowest rate */ - #ifdef __sparc__ int rate = 500; /* Default rate */ int delay = 200; /* Default delay */ @@ -150,6 +149,10 @@ int delay = 250; /* Default delay */ #endif +#if defined(__alpha__) || defined (__i386__) || defined(__ia64__) + int i; + int timeout; + int value = 0x7f; /* Maximum delay with slowest rate */ static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150, 133, 120, 109, 100, 92, 86, 80, 75, 67, @@ -159,7 +162,7 @@ static int valid_delays[] = { 250, 500, 750, 1000 }; #define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int )) - +#endif if (xf86Info.kbdRate >= 0) rate = xf86Info.kbdRate * 10; @@ -194,13 +197,21 @@ break; } - while ((inb(0x64) & 2) == 2); /* wait */ + timeout = KBC_TIMEOUT; + while (((inb(0x64) & 2) == 2) && --timeout) + usleep(1000); /* wait */ + + if (timeout == 0) + return; + outb(0x60, 0xf3); /* set typematic rate */ - while ((inb(0x64) & 2) == 2); /* wait */ + while (((inb(0x64) & 2) == 2) && --timeout) + usleep(1000); /* wait */ + usleep(10000); outb(0x60, value); -#endif /* __alpha__ || __i386__ */ +#endif /* __alpha__ || __i386__ || __ia64__ */ } static int kbdtrans; 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.4 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c:3.6 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c:3.4 Sun Apr 1 10:00:15 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c Wed Oct 31 17:50:30 2001 @@ -1,11 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c,v 3.4 2001/04/01 14:00:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c,v 3.6 2001/10/31 22:50:30 tsi Exp $ */ #include <errno.h> #include <fcntl.h> #include <unistd.h> #include <sys/wait.h> #include <signal.h> -#include "xf86_OSproc.h" +#include "xf86_OSlib.h" +#include "xf86.h" #define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe" @@ -66,7 +67,16 @@ */ switch (pid = fork()) { case 0: /* child */ + /* change real/effective user ID to 0/0 as we need to + * preinstall agpgart module for some DRM modules + */ + if (setreuid(0,0)) { + xf86Msg(X_WARNING,"LoadKernelModule: " + "Setting of real/effective user Id to 0/0 failed"); + } + setenv("PATH","/sbin",1); n = execl(mpPath, "modprobe", modName, NULL); + xf86Msg(X_WARNING,"LoadKernelModule %s\n",strerror(errno)); exit(EXIT_FAILURE); /* if we get here the child's exec failed */ break; case -1: /* fork failed */ 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.6.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c:3.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c:3.6.2.1 Fri Jun 1 16:03:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c Fri Jun 1 16:03:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.6.2.1 2001/06/01 20:03:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.7 2001/06/01 20:03:05 dawes Exp $ */ #include <stdio.h> #include "X.h" 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.51.2.3 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c:3.60 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c:3.51.2.3 Tue May 29 12:38:00 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c Thu Nov 1 18:35:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.51.2.3 2001/05/29 16:38:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.60 2001/11/01 23:35:33 dawes Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -42,6 +42,8 @@ #include <asm/mtrr.h> #endif +extern int ioperm(unsigned long from, unsigned long num, int turn_on); + #ifndef MAP_FAILED #define MAP_FAILED ((void *)-1) #endif @@ -49,8 +51,22 @@ static Bool ExtendedEnabled = FALSE; #ifdef __ia64__ + #include "compiler.h" #include <sys/io.h> + +#elif !defined(__powerpc__) && \ + !defined(__mc68000__) && \ + !defined(__sparc__) && \ + !defined(__mips__) + +/* + * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare + * these. + */ +extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on); +extern int iopl(int __level); + #endif #ifdef __alpha__ @@ -243,52 +259,41 @@ 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; - } + { + unsigned long last, lbase, d_size; + unsigned long n_size = size; + unsigned long n_base = base; + + int i = 0; + last = n_base + n_size - 1; + for (lbase = n_base; !(lbase & 1) && (last & 1); + lbase = lbase >> 1, last = last >> 1, i++) + if (lbase != last) { + while((lbase & 1) == (last & 1)) { + i++; + lbase >>= 1; + last >>= 1; + } + } + d_size = 1 << i; +#ifdef DEBUG + ErrorF("WC_BASE: 0x%lx WC_END: 0x%lx\n",base,base+d_size-1); +#endif + n_base += d_size; + n_size -= d_size; + if (n_size) { + xf86DrvMsgVerb(screenNum,X_INFO,3,"Splitting WC range: " + "base: 0x%lx, size: 0x%lx\n",base,size); + wcr->next = mtrr_add_wc_region(screenNum, n_base, n_size,from); + } + wcr->sentry.size = d_size; + } + /*****************************************************************/ #endif /* SPLIT_WC_REGIONS */ @@ -358,7 +363,7 @@ #ifdef __alpha__ if (axpSystem == -1) { axpSystem = lnxGetAXP(); - if (needSparse = (_bus_base_sparse() > 0)) { + if ((needSparse = (_bus_base_sparse() > 0))) { hae_thresh = xf86AXPParams[axpSystem].hae_thresh; hae_mask = xf86AXPParams[axpSystem].hae_mask; sparse_size = xf86AXPParams[axpSystem].size; @@ -517,7 +522,7 @@ #endif } close(fd); -#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) if (ioperm(0, 1024, 1) || iopl(3)) FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n"); # if !defined(__alpha__) @@ -538,7 +543,7 @@ #if defined(__powerpc__) munmap(ioBase, 0x20000); ioBase = NULL; -#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) iopl(0); ioperm(0, 1024, 0); #endif @@ -552,29 +557,31 @@ /* Interrupt Handling section */ /***************************************************************************/ +/* XXX The #ifdefs should be made simpler. */ + Bool xf86DisableInterrupts() { +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) if (!ExtendedEnabled) -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) if (iopl(3) || ioperm(0, 1024, 1)) return (FALSE); #endif -#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) +#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) #else -#ifdef __GNUC__ -#if defined(__ia64__) -#if 0 +# ifdef __GNUC__ +# if defined(__ia64__) +# if 0 __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory"); -#endif -#else +# endif +# else __asm__ __volatile__("cli"); -#endif -#else +# endif +# else asm("cli"); -#endif +# endif #endif -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) if (!ExtendedEnabled) { iopl(0); ioperm(0, 1024, 0); @@ -587,26 +594,26 @@ void xf86EnableInterrupts() { +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) if (!ExtendedEnabled) -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) if (iopl(3) || ioperm(0, 1024, 1)) return; #endif -#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) +#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) #else -#ifdef __GNUC__ -#if defined(__ia64__) -#if 0 +# ifdef __GNUC__ +# if defined(__ia64__) +# if 0 __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory"); -#endif -#else +# endif +# else __asm__ __volatile__("sti"); -#endif -#else +# endif +# else asm("sti"); -#endif +# endif #endif -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) if (!ExtendedEnabled) { iopl(0); ioperm(0, 1024, 0); @@ -619,10 +626,6 @@ #define vuip volatile unsigned int * -static unsigned long msb_set = 0; -static pointer lnxSBase = 0; -static pointer lnxBase = 0; - extern int readDense8(pointer Base, register unsigned long Offset); extern int readDense16(pointer Base, register unsigned long Offset); extern int readDense32(pointer Base, register unsigned long Offset); @@ -655,10 +658,17 @@ static void writeSparse32(int Value, pointer Base, register unsigned long Offset); +#define DENSE_BASE 0x2ff00000000UL +#define SPARSE_BASE 0x30000000000UL + +static unsigned long msb_set = 0; + static pointer mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd; + unsigned long ret, rets = 0; + static Bool was_here = FALSE; if (!was_here) { @@ -673,34 +683,89 @@ xf86ReadMmio8 = readSparse8; xf86ReadMmio16 = readSparse16; xf86ReadMmio32 = readSparse32; + } - if ((fd = open(DEV_MEM, O_RDWR)) < 0) { - FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n", + if ((fd = open(DEV_MEM, O_RDWR)) < 0) { + FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n", strerror(errno)); - } - /* This requirers linux-0.99.pl10 or above */ - lnxBase = mmap((caddr_t)0, 0x100000000, - PROT_READ | PROT_WRITE, - MAP_SHARED, fd, - (off_t) bus_base); - lnxSBase = mmap((caddr_t)0, 0x400000000, - PROT_READ | PROT_WRITE, - MAP_SHARED, fd, - (off_t) _bus_base_sparse()); - - close(fd); + } + +#if 0 + xf86Msg(X_INFO,"mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n", + Base, Size, flags); +#endif + + /* This requirers linux-0.99.pl10 or above */ + + /* + * Always do DENSE mmap, since read32/write32 currently require it. + */ + ret = (unsigned long)mmap((caddr_t)(DENSE_BASE + Base), Size, + PROT_READ | PROT_WRITE, + MAP_SHARED, fd, + (off_t) (bus_base + Base)); + + /* + * Do SPARSE mmap only when MMIO and not MMIO_32BIT, or FRAMEBUFFER + * and SPARSE (which should require the use of read/write macros). + * + * By not SPARSE mmapping an 8MB framebuffer, we can save approx. 256K + * bytes worth of pagetable (32 pages). + */ + if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) || + ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) + { + rets = (unsigned long)mmap((caddr_t)(SPARSE_BASE + (Base << 5)), + Size << 5, PROT_READ | PROT_WRITE, + MAP_SHARED, fd, + (off_t) _bus_base_sparse() + (Base << 5)); + } + + close(fd); - if (lnxSBase == MAP_FAILED || lnxBase == MAP_FAILED) { - FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n", + if (ret == (unsigned long)MAP_FAILED || ret != (DENSE_BASE + Base)) { + FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n", strerror(errno)); - } + } + + if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) || + ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) + { + if (rets == (unsigned long)MAP_FAILED || + rets != (SPARSE_BASE + (Base << 5))) + { + FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n", + strerror(errno)); + } } - return (pointer)((unsigned long)lnxBase + Base); + +#if 1 + if (rets) + xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx" + " to DENSE at 0x%lx and SPARSE at 0x%lx\n", + Base, Size, ret, rets); + else + xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx" + " to DENSE only at 0x%lx\n", + Base, Size, ret); + +#endif + return (pointer)(DENSE_BASE + Base); } static void unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size) { + unsigned long Offset = (unsigned long)Base - DENSE_BASE; +#if 1 + xf86Msg(X_INFO,"unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n", + Base, Size); +#endif + /* Unmap DENSE always. */ + munmap((caddr_t)Base, Size); + + /* Unmap SPARSE always, and ignore error in case we did not map it. */ + munmap((caddr_t)(SPARSE_BASE + (Offset << 5)), Size << 5); } static int @@ -710,7 +775,7 @@ register unsigned long msb; mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)lnxBase; + Offset += (unsigned long)Base - DENSE_BASE; shift = (Offset & 0x3) << 3; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -722,7 +787,7 @@ } mem_barrier(); - result = *(vuip) ((unsigned long)lnxSBase + (Offset << 5)); + result = *(vuip) (SPARSE_BASE + (Offset << 5)); result >>= shift; return 0xffUL & result; } @@ -734,7 +799,7 @@ register unsigned long msb; mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)lnxBase; + Offset += (unsigned long)Base - DENSE_BASE; shift = (Offset & 0x2) << 3; if (Offset >= hae_thresh) { msb = Offset & hae_mask; @@ -746,7 +811,7 @@ } mem_barrier(); - result = *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2))); + result = *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2))); result >>= shift; return 0xffffUL & result; } @@ -754,6 +819,7 @@ static int readSparse32(pointer Base, register unsigned long Offset) { + /* NOTE: this is really using DENSE. */ mem_barrier(); return *(vuip)((unsigned long)Base+(Offset)); } @@ -765,7 +831,7 @@ register unsigned int b = Value & 0xffU; write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)lnxBase; + Offset += (unsigned long)Base - DENSE_BASE; if (Offset >= hae_thresh) { msb = Offset & hae_mask; Offset -= msb; @@ -776,7 +842,7 @@ } write_mem_barrier(); - *(vuip) ((unsigned long)lnxSBase + (Offset << 5)) = b * 0x01010101; + *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101; } static void @@ -786,7 +852,7 @@ register unsigned int w = Value & 0xffffU; write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)lnxBase; + Offset += (unsigned long)Base - DENSE_BASE; if (Offset >= hae_thresh) { msb = Offset & hae_mask; Offset -= msb; @@ -797,13 +863,13 @@ } write_mem_barrier(); - *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2))) = - w * 0x00010001; + *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2))) = w * 0x00010001; } static void writeSparse32(int Value, pointer Base, register unsigned long Offset) { + /* NOTE: this is really using DENSE. */ write_mem_barrier(); *(vuip)((unsigned long)Base + (Offset)) = Value; return; @@ -815,7 +881,7 @@ register unsigned long msb; register unsigned int b = Value & 0xffU; - Offset += (unsigned long)Base - (unsigned long)lnxBase; + Offset += (unsigned long)Base - DENSE_BASE; if (Offset >= hae_thresh) { msb = Offset & hae_mask; Offset -= msb; @@ -824,7 +890,7 @@ msb_set = msb; } } - *(vuip) ((unsigned long)lnxSBase + (Offset << 5)) = b * 0x01010101; + *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101; } static void @@ -833,7 +899,7 @@ register unsigned long msb; register unsigned int w = Value & 0xffffU; - Offset += (unsigned long)Base - (unsigned long)lnxBase; + Offset += (unsigned long)Base - DENSE_BASE; if (Offset >= hae_thresh) { msb = Offset & hae_mask; Offset -= msb; @@ -842,13 +908,13 @@ msb_set = msb; } } - *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2))) = - w * 0x00010001; + *(vuip)(SPARSE_BASE+(Offset<<5)+(1<<(5-2))) = w * 0x00010001; } static void writeSparseNB32(int Value, pointer Base, register unsigned long Offset) { + /* NOTE: this is really using DENSE. */ *(vuip)((unsigned long)Base + (Offset)) = Value; return; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.9 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.9 Fri Jan 19 03:08:41 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile Thu Oct 4 14:28:22 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.9 2001/01/19 08:08:41 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.10 2001/10/04 18:28:22 alanh Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,6 +22,7 @@ xf86drmR128.c \ xf86drmRadeon.c \ xf86drmSiS.c \ + xf86drmI830.c \ $(MSRC) OBJS = xf86drm.o \ @@ -33,6 +34,7 @@ xf86drmR128.o \ xf86drmRadeon.o \ xf86drmSiS.o \ + xf86drmI830.o \ $(MOBJ) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ 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.22 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:1.25 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:1.22 Fri May 18 20:26:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c Mon Aug 27 13:40:59 2001 @@ -27,7 +27,7 @@ * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.22 2001/05/19 00:26:45 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.25 2001/08/27 17:40:59 dawes Exp $ * */ @@ -55,13 +55,14 @@ # include <sys/ioctl.h> # include <sys/mman.h> # include <sys/time.h> +# include <stdarg.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> +# include <X11/Xlibint.h> # define _DRM_MALLOC Xmalloc # define _DRM_FREE Xfree # endif @@ -107,6 +108,28 @@ #define makedev(x,y) ((dev_t)(((x) << 8) | (y))) #endif +#define DRM_MSG_VERBOSITY 3 + +static void +drmMsg(const char *format, ...) +{ + va_list ap; + +#ifndef XFree86Server + const char *env; + if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) +#endif + { + va_start(ap, format); +#ifdef XFree86Server + xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap); +#else + vfprintf(stderr, format, ap); +#endif + va_end(ap); + } +} + static void *drmHashTable = NULL; /* Context switch callbacks */ typedef struct drmHashEntry { @@ -182,6 +205,8 @@ gid_t group = DRM_DEV_GID; #endif + drmMsg("drmOpenDevice: minor is %d\n", minor); + #if defined(XFree86Server) devmode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE; dirmode = (devmode & S_IRUSR) ? S_IXUSR : 0; @@ -203,6 +228,7 @@ #endif sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor); + drmMsg("drmOpenDevice: node name is %s\n", buf); if (stat(buf, &st) || st.st_rdev != dev) { if (!isroot) return DRM_ERR_NOT_ROOT; remove(buf); @@ -213,7 +239,11 @@ chmod(buf, devmode); #endif - if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd; + fd = open(buf, O_RDWR, 0); + drmMsg("drmOpenDevice: open result is %d, (%s)\n", + fd, fd < 0 ? strerror(errno) : "OK"); + if (fd >= 0) return fd; + drmMsg("drmOpenDevice: Open failed\n"); remove(buf); return -errno; } @@ -261,9 +291,13 @@ int fd; const char *buf; + drmMsg("drmOpenByBusid: busid is %s\n", busid); for (i = 0; i < DRM_MAX_MINOR; i++) { - if ((fd = drmOpenMinor(i, 0)) >= 0) { + fd = drmOpenMinor(i, 1); + drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd); + if (fd >= 0) { buf = drmGetBusid(fd); + drmMsg("drmOpenByBusid: drmGetBusid reports %s\n", buf); if (buf && !strcmp(buf, busid)) { drmFreeBusid(buf); return fd; @@ -280,6 +314,7 @@ int i; int fd; drmVersionPtr version; + char * id; if (!drmAvailable()) { #if !defined(XFree86Server) @@ -294,15 +329,30 @@ #endif } + /* + * Open the first minor number that matches the driver name and isn't + * already in use. If it's in use it will have a busid assigned already. + */ 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); + id = drmGetBusid(fd); + drmMsg("drmGetBusid returned '%s'\n", id ? id : "NULL"); + if (!id || !*id) { + if (id) { + drmFreeBusid(id); + } + return fd; + } else { + drmFreeBusid(id); + } + } else { drmFreeVersion(version); - return fd; } - drmFreeVersion(version); } + close(fd); } } @@ -459,7 +509,9 @@ u.unique = (char *)busid; u.unique_len = strlen(busid); - if (ioctl(fd, DRM_IOCTL_SET_UNIQUE, &u)) return -errno; + if (ioctl(fd, DRM_IOCTL_SET_UNIQUE, &u)) { + return -errno; + } return 0; } 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.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c:1.5 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c Thu Sep 27 04:25:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.5 2001/04/10 16:08:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.7 2001/09/27 08:25:04 alanh Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -28,7 +28,7 @@ extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); extern int xf86RemoveSIGIOHandler(int fd); # else -# include <Xlibint.h> +# include <X11/Xlibint.h> # define _DRM_MALLOC Xmalloc # define _DRM_FREE Xfree # endif @@ -76,6 +76,8 @@ init.front_offset = info->front_offset; init.back_offset = info->back_offset; init.depth_offset = info->depth_offset; + init.overlay_offset = info->overlay_offset; + init.overlay_physical = info->overlay_physical; init.w = info->w; init.h = info->h; init.pitch = info->pitch; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c:1.1 --- /dev/null Fri Jan 18 15:26:04 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c Thu Oct 4 14:28:22 2001 @@ -0,0 +1,95 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI830.c,v 1.1 2001/10/04 18:28:22 alanh 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> +# 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 "drm.h" +#include "xf86drmI830.h" + +Bool drmI830CleanupDma(int driSubFD) +{ + drm_i830_init_t init; + + memset(&init, 0, sizeof(drm_i830_init_t)); + init.func = I810_CLEANUP_DMA; + + if(ioctl(driSubFD, DRM_IOCTL_I830_INIT, &init)) { + return FALSE; + } + + return TRUE; +} + +Bool drmI830InitDma(int driSubFD, drmI830Init *info) +{ + drm_i830_init_t init; + + memset(&init, 0, sizeof(drm_i830_init_t)); + + init.func = I810_INIT_DMA; + 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; + init.sarea_priv_offset = info->sarea_off; + init.front_offset = info->front_offset; + init.back_offset = info->back_offset; + init.depth_offset = info->depth_offset; + init.w = info->w; + init.h = info->h; + init.pitch = info->pitch; + init.pitch_bits = info->pitch_bits; + init.back_pitch = info->pitch; + init.depth_pitch = info->pitch; + init.cpp = info->cpp; + + if(ioctl(driSubFD, DRM_IOCTL_I830_INIT, &init)) { + return FALSE; + } + return TRUE; +} 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.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c:1.5 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c Mon Aug 27 13:40:59 2001 @@ -27,7 +27,7 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.6 2001/08/27 17:40:59 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -57,7 +57,7 @@ extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); extern int xf86RemoveSIGIOHandler(int fd); # else -# include <Xlibint.h> +# include <X11/Xlibint.h> # define _DRM_MALLOC Xmalloc # define _DRM_FREE Xfree # endif 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.9.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c:1.9.2.1 Wed May 23 14:58:00 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c Mon Aug 27 13:40:59 2001 @@ -26,7 +26,7 @@ * Author: Kevin E. Martin <martin@valinux.com> * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.9.2.1 2001/05/23 18:58:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.11 2001/08/27 17:40:59 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -56,7 +56,7 @@ extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); extern int xf86RemoveSIGIOHandler(int fd); # else -# include <Xlibint.h> +# include <X11/Xlibint.h> # define _DRM_MALLOC Xmalloc # define _DRM_FREE Xfree # endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c:1.3 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c Mon Aug 27 13:40:59 2001 @@ -27,7 +27,7 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c,v 1.4 2001/08/27 17:40:59 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -57,7 +57,7 @@ extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); extern int xf86RemoveSIGIOHandler(int fd); # else -# include <Xlibint.h> +# include <X11/Xlibint.h> # define _DRM_MALLOC Xmalloc # define _DRM_FREE Xfree # endif 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.6.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c:1.6.2.1 Tue May 22 17:25:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c Fri Dec 14 19:59:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.6.2.1 2001/05/22 21:25:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.10 2001/12/15 00:59:12 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -28,7 +28,7 @@ extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); extern int xf86RemoveSIGIOHandler(int fd); # else -# include <Xlibint.h> +# include <X11/Xlibint.h> # define _DRM_MALLOC Xmalloc # define _DRM_FREE Xfree # endif @@ -43,6 +43,7 @@ #include <sys/sysmacros.h> /* for makedev() */ #endif #include "xf86drm.h" +#include "xf86drmSiS.h" #define CONFIG_DRM_SIS #include "drm.h" #undef CONFIG_DRM_SIS @@ -53,7 +54,7 @@ agp.offset = offset; agp.size = size; - xf86ioctl(driSubFD, SIS_IOCTL_AGP_INIT, &agp); + ioctl(driSubFD, SIS_IOCTL_AGP_INIT, &agp); return TRUE; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Config.in diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Config.in:1.2 --- /dev/null Fri Jan 18 15:26:04 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Config.in Thu Oct 4 14:28:22 2001 @@ -0,0 +1,17 @@ +# +# Drm device configuration +# +# This driver provides support for the +# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. +# + +bool 'Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)' CONFIG_DRM +if [ "$CONFIG_DRM" != "n" ]; then + tristate ' 3dfx Banshee/Voodoo3+' CONFIG_DRM_TDFX + tristate ' 3dlabs GMX 2000' CONFIG_DRM_GAMMA + tristate ' ATI Rage 128' CONFIG_DRM_R128 + dep_tristate ' ATI Radeon' CONFIG_DRM_RADEON $CONFIG_AGP + dep_tristate ' Intel I810' CONFIG_DRM_I810 $CONFIG_AGP + dep_tristate ' Intel 830M' CONFIG_DRM_I830 $CONFIG_AGP + dep_tristate ' Matrox g200/g400' CONFIG_DRM_MGA $CONFIG_AGP +fi 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.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel:1.14 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel:1.12 Wed Mar 21 13:08:54 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel Thu Oct 4 14:28:22 2001 @@ -1,91 +1,30 @@ # -# Makefile for the drm device driver. This driver provides support for -# the Direct Rendering Infrastructure (DRI) in XFree86 4.x. -# +# Makefile for the drm device driver. This driver provides support for the +# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -# drm.o is a fake target -- it is never built -# The real targets are in the module-list O_TARGET := drm.o +list-multi := gamma.o tdfx.o r128.o mga.o i810.o i830.o ffb.o radeon.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)) +gamma-objs := gamma_drv.o gamma_dma.o +tdfx-objs := tdfx_drv.o +r128-objs := r128_drv.o r128_cce.o r128_state.o +mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o +i810-objs := i810_drv.o i810_dma.o +i830-objs := i830_drv.o i830_dma.o +radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o +ffb-objs := ffb_drv.o ffb_context.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_MGA) += mga.o +obj-$(CONFIG_DRM_I810) += i810.o +obj-$(CONFIG_DRM_I830) += i830.o +obj-$(CONFIG_DRM_FFB) += ffb.o -# libs-objs are included in every module so that radical changes to the -# architecture of the DRM support library can be made at a later time. -# -# The downside is that each module is larger, and a system that uses -# more than one module (i.e., a dual-head system) will use more memory -# (but a system that uses exactly one module will use the same amount of -# memory). -# -# The upside is that if the DRM support library ever becomes insufficient -# for new families of cards, a new library can be implemented for those new -# cards without impacting the drivers for the old cards. This is significant, -# because testing architectural changes to old cards may be impossible, and -# may delay the implementation of a better architecture. We've traded slight -# 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 - -ifeq ($(CONFIG_AGP),y) - lib-objs += agpsupport.o -else - ifeq ($(CONFIG_AGP),m) - lib-objs += agpsupport.o - endif -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 - - -# When linking into the kernel, link the library just once. -# If making modules, we include the library into each module - -lib-objs-mod := $(patsubst %.o,%-mod.o,$(lib-objs)) - -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) @@ -97,6 +36,9 @@ i810.o: $(i810-objs) $(lib) $(LD) -r -o $@ $(i810-objs) $(lib) + +i830.o: $(i830-objs) $(lib) + $(LD) -r -o $@ $(i830-objs) $(lib) r128.o: $(r128-objs) $(lib) $(LD) -r -o $@ $(r128-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.21.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux:1.25 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux:1.21.2.1 Tue May 22 17:25:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux Wed Jan 16 10:36:43 2002 @@ -31,15 +31,6 @@ # like this: # make TREE=/usr/my-kernel-tree/include # -# -# ***** NOTE NOTE NOTE NOTE NOTE ***** -# Because some distributions patch 2.2.x kernels to make kill_fasync have -# three parameters, this script tries to determine, via the examination of -# header files, if your kernel has been patched. If this detection is -# incorrect, you can override the value on the command line, like this: -# make PARAMS=2 -# or -# make PARAMS=3 .SUFFIXES: @@ -53,7 +44,7 @@ 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 +DRMHEADERS = drm.h drmP.h GAMMAOBJS = gamma_drv.o gamma_dma.o GAMMAHEADERS = gamma_drv.h $(DRMHEADERS) $(DRMTEMPLATES) @@ -132,10 +123,6 @@ | grep -s 'MODVERSIONS = ' | cut -d' ' -f3) AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ | grep -s 'AGP = ' | cut -d' ' -f3) -SIS := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ - | grep -s 'SIS = ' | cut -d' ' -f3) -PARAMS := $(shell if fgrep kill_fasync $(TREE)/linux/fs.h 2>/dev/null \ - | egrep -q '(band|int, int)'; then echo 3; else echo 2; fi) MACHINE := $(shell echo `uname -m`) ifeq ($(AGP),0) AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ @@ -145,13 +132,14 @@ ifeq ($(AGP),1) MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE DRMTEMPLATES += drm_agpsupport.h -DRMHEADERS += agpsupport-pre24.h MODS += mga.o ifeq ($(MACHINE),i386) MODS += i810.o +MODS += i830.o endif ifeq ($(MACHINE),i686) MODS += i810.o +MODS += i830.o endif MGAOBJS = mga_drv.o mga_dma.o mga_state.o mga_warp.o @@ -160,32 +148,26 @@ I810OBJS = i810_drv.o i810_dma.o I810HEADERS = i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES) +I830OBJS = i830_drv.o i830_dma.o +I830HEADERS = i830.h i830_drv.h i830_drm.h $(DRMHEADERS) $(DRMTEMPLATES) + endif ifeq ($(MACHINE),alpha) MODCFLAGS+= -ffixed-8 -mno-fp-regs -mcpu=ev56 -Wa,-mev6 endif -ifeq ($(SIS),1) -# It appears that the SiS driver makes calls to sis_malloc and sis_free, and -# that these calls are only defined if CONFIG_FB_SIS is selected. So, key -# off that to determine if we should attempt to build the SiS driver. -# -# A better way would be to detect the appropriate definitions in the header -# file to see if we can, at least, compile the driver. MODS += sis.o 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 Use 2.4.x kernels ONLY ! all::;@echo === WARNING ifeq ($(MODULES),0) @@ -207,9 +189,6 @@ ifeq ($(MODVERSIONS),1) MODCFLAGS += -DMODVERSIONS -include $(TREE)/linux/modversions.h endif -ifeq ($(PARAMS),3) -MODCFLAGS += -DKILLFASYNCHASTHREEPARAMETERS -endif # **** End of configuration @@ -253,6 +232,11 @@ i810.o: $(I810OBJS) $(LIBS) $(LD) -r $^ -o $@ +i830_drv.o: i830_drv.c + $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ +i830.o: $(I830OBJS) $(LIBS) + $(LD) -r $^ -o $@ + endif .PHONY: ChangeLog @@ -273,6 +257,7 @@ ifeq ($(AGP),1) $(MGAOBJS): $(MGAHEADERS) $(I810OBJS): $(I810HEADERS) +$(I830OBJS): $(I830HEADERS) $(R128OBJS): $(R128HEADERS) $(RADEONOBJS): $(RADEONHEADERS) endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport-pre24.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport-pre24.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport-pre24.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport-pre24.h:1.1 Fri Dec 1 09:29:00 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport-pre24.h Fri Jan 18 15:26:04 2002 @@ -1,115 +0,0 @@ -/* agpsupport-pre24.h -- Support for pre-2.4.0 kernels -*- linux-c -*- - * Created: Mon Nov 13 10:54:15 2000 by faith@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. - * - * Author: Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#ifndef _AGPSUPPORT_PRE24_H_ -#define _AGPSUPPORT_PRE24_H_ -typedef struct { - void (*free_memory)(agp_memory *); - agp_memory *(*allocate_memory)(size_t, u32); - int (*bind_memory)(agp_memory *, off_t); - int (*unbind_memory)(agp_memory *); - void (*enable)(u32); - int (*acquire)(void); - void (*release)(void); - void (*copy_info)(agp_kern_info *); -} drm_agp_t; - -static drm_agp_t drm_agp_struct = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -/* The C standard says that 'void *' is not guaranteed to hold a function - pointer, so we use this union to define a generic pointer that is - guaranteed to hold any of the function pointers we care about. */ -typedef union { - void (*free_memory)(agp_memory *); - agp_memory *(*allocate_memory)(size_t, u32); - int (*bind_memory)(agp_memory *, off_t); - int (*unbind_memory)(agp_memory *); - void (*enable)(u32); - int (*acquire)(void); - void (*release)(void); - void (*copy_info)(agp_kern_info *); - unsigned long address; -} drm_agp_func_u; - -typedef struct drm_agp_fill { - const char *name; - drm_agp_func_u *f; -} drm_agp_fill_t; - -static drm_agp_fill_t drm_agp_fill[] = { - { __MODULE_STRING(agp_free_memory), - (drm_agp_func_u *)&drm_agp_struct.free_memory }, - { __MODULE_STRING(agp_allocate_memory), - (drm_agp_func_u *)&drm_agp_struct.allocate_memory }, - { __MODULE_STRING(agp_bind_memory), - (drm_agp_func_u *)&drm_agp_struct.bind_memory }, - { __MODULE_STRING(agp_unbind_memory), - (drm_agp_func_u *)&drm_agp_struct.unbind_memory }, - { __MODULE_STRING(agp_enable), - (drm_agp_func_u *)&drm_agp_struct.enable }, - { __MODULE_STRING(agp_backend_acquire), - (drm_agp_func_u *)&drm_agp_struct.acquire }, - { __MODULE_STRING(agp_backend_release), - (drm_agp_func_u *)&drm_agp_struct.release }, - { __MODULE_STRING(agp_copy_info), - (drm_agp_func_u *)&drm_agp_struct.copy_info }, - { NULL, NULL } -}; - -#define DRM_AGP_GET _drm_agp_get() -#define DRM_AGP_PUT _drm_agp_put() - -static drm_agp_t *_drm_agp_get(void) -{ - drm_agp_fill_t *fill; - int agp_available = 1; - - for (fill = &drm_agp_fill[0]; fill->name; fill++) { - char *n = (char *)fill->name; - *fill->f = (drm_agp_func_u)get_module_symbol(NULL, n); - DRM_DEBUG("%s resolves to 0x%08lx\n", n, (*fill->f).address); - if (!(*fill->f).address) agp_available = 0; - } - return &drm_agp_struct; -} - -static void _drm_agp_put(void) -{ - drm_agp_fill_t *fill; - - for (fill = &drm_agp_fill[0]; fill->name; fill++) { -#if LINUX_VERSION_CODE >= 0x020400 - if ((*fill->f).address) put_module_symbol((*fill->f).address); -#endif - (*fill->f).address = 0; - } -} -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h:1.1 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h Mon Dec 10 18:28:50 2001 @@ -36,7 +36,7 @@ #elif PAGE_SIZE == 4096 # define ATI_PCIGART_TABLE_ORDER 3 # define ATI_PCIGART_TABLE_PAGES (1 << 3) -#elif +#else # error - PAGE_SIZE not 8K or 4K #endif @@ -57,7 +57,7 @@ page = virt_to_page( address ); - for ( i = 0 ; i <= ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { + for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { atomic_inc( &page->count ); SetPageReserved( page ); } @@ -72,11 +72,9 @@ 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++ ) { + for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { atomic_dec( &page->count ); ClearPageReserved( page ); } @@ -84,25 +82,42 @@ free_pages( address, ATI_PCIGART_TABLE_ORDER ); } -unsigned long DRM(ati_pcigart_init)( drm_device_t *dev ) +int DRM(ati_pcigart_init)( drm_device_t *dev, + unsigned long *addr, + dma_addr_t *bus_addr) { drm_sg_mem_t *entry = dev->sg; - unsigned long address; + unsigned long address = 0; unsigned long pages; - u32 *pci_gart, page_base; - int i, j; + u32 *pci_gart, page_base, bus_address = 0; + int i, j, ret = 0; if ( !entry ) { DRM_ERROR( "no scatter/gather memory!\n" ); - return 0; + goto done; } address = DRM(ati_alloc_pcigart_table)(); if ( !address ) { DRM_ERROR( "cannot allocate PCI GART page!\n" ); - return 0; + goto done; + } + + if ( !dev->pdev ) { + DRM_ERROR( "PCI device unknown!\n" ); + goto done; } + bus_address = pci_map_single(dev->pdev, (void *)address, + ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, + PCI_DMA_TODEVICE); + if (bus_address == 0) { + DRM_ERROR( "unable to map PCIGART pages!\n" ); + DRM(ati_free_pcigart_table)( address ); + address = 0; + goto done; + } + pci_gart = (u32 *)address; pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) @@ -111,28 +126,72 @@ 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 ); + /* we need to support large memory configurations */ + entry->busaddr[i] = pci_map_single(dev->pdev, + page_address( entry->pagelist[i] ), + PAGE_SIZE, + PCI_DMA_TODEVICE); + if (entry->busaddr[i] == 0) { + DRM_ERROR( "unable to map PCIGART pages!\n" ); + DRM(ati_pcigart_cleanup)( dev, address, bus_address ); + address = 0; + bus_address = 0; + goto done; + } + page_base = (u32) entry->busaddr[i]; + for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { *pci_gart++ = cpu_to_le32( page_base ); page_base += ATI_PCIGART_PAGE_SIZE; } } + + ret = 1; -#if __i386__ +#if defined(__i386__) || defined(__x86_64__) asm volatile ( "wbinvd" ::: "memory" ); #else mb(); #endif - return address; +done: + *addr = address; + *bus_addr = bus_address; + return ret; } -int DRM(ati_pcigart_cleanup)( unsigned long address ) +int DRM(ati_pcigart_cleanup)( drm_device_t *dev, + unsigned long addr, + dma_addr_t bus_addr) { + drm_sg_mem_t *entry = dev->sg; + unsigned long pages; + int i; - if ( address ) { - DRM(ati_free_pcigart_table)( address ); + /* we need to support large memory configurations */ + if ( !entry ) { + DRM_ERROR( "no scatter/gather memory!\n" ); + return 0; + } + + if ( bus_addr ) { + pci_unmap_single(dev->pdev, bus_addr, + ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, + PCI_DMA_TODEVICE); + + pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) + ? entry->pages : ATI_MAX_PCIGART_PAGES; + + for ( i = 0 ; i < pages ; i++ ) { + if ( !entry->busaddr[i] ) break; + pci_unmap_single(dev->pdev, entry->busaddr[i], + PAGE_SIZE, PCI_DMA_TODEVICE); + } + } + + if ( addr ) { + DRM(ati_free_pcigart_table)( addr ); } - return 0; + return 1; } 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.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h:1.6 Wed Mar 21 13:08:54 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h Fri Jan 18 15:26:04 2002 @@ -1,51 +0,0 @@ -/* compat-pre24.h -- Linux pre-2.4.0 compatibility - * Created: Mon Aug 28 15:31:43 2000 by faith@acm.org - * 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> - * - */ - -#ifndef _COMPAT_PRE24_H_ -#define _COMPAT_PRE24_H_ - - /* virt_to_page added in 2.4.0-test6 */ -#if LINUX_VERSION_CODE < 0x020400 -#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr)) -#endif - -#define block_all_signals(a,b,c) -#define unblock_all_signals() - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -#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/drm.h diff -u 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.24 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h:1.18.2.2 Thu May 31 22:24:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h Wed Jan 16 10:36:43 2002 @@ -45,7 +45,7 @@ #endif #define XFREE86_VERSION(major,minor,patch,snap) \ - ((major << 16) | (minor < 8) | patch) + ((major << 16) | (minor << 8) | patch) #ifndef CONFIG_XFREE86_VERSION #define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0) @@ -104,9 +104,8 @@ #include "i810_drm.h" #include "r128_drm.h" #include "radeon_drm.h" -#ifdef CONFIG_DRM_SIS #include "sis_drm.h" -#endif +#include "i830_drm.h" typedef struct drm_version { int version_major; /* Major version */ @@ -449,6 +448,12 @@ #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) +#define DRM_IOCTL_I810_OV0INFO DRM_IOR( 0x49, drm_i810_overlay_t) +#define DRM_IOCTL_I810_FSTATUS DRM_IO ( 0x4a) +#define DRM_IOCTL_I810_OV0FLIP DRM_IO ( 0x4b) +#define DRM_IOCTL_I810_MC DRM_IOW( 0x4c, drm_i810_mc_t) +#define DRM_IOCTL_I810_RSTATUS DRM_IO ( 0x4d ) + /* Rage 128 specific ioctls */ #define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) @@ -483,7 +488,6 @@ #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) @@ -493,6 +497,16 @@ #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 + +/* I830 specific ioctls */ +#define DRM_IOCTL_I830_INIT DRM_IOW( 0x40, drm_i830_init_t) +#define DRM_IOCTL_I830_VERTEX DRM_IOW( 0x41, drm_i830_vertex_t) +#define DRM_IOCTL_I830_CLEAR DRM_IOW( 0x42, drm_i830_clear_t) +#define DRM_IOCTL_I830_FLUSH DRM_IO ( 0x43) +#define DRM_IOCTL_I830_GETAGE DRM_IO ( 0x44) +#define DRM_IOCTL_I830_GETBUF DRM_IOWR(0x45, drm_i830_dma_t) +#define DRM_IOCTL_I830_SWAP DRM_IO ( 0x46) +#define DRM_IOCTL_I830_COPY DRM_IOW( 0x47, drm_i830_copy_t) +#define DRM_IOCTL_I830_DOCOPY DRM_IO ( 0x48) #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.17 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h:1.19 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h:1.17 Wed May 2 11:06:10 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h Tue Oct 2 07:44:17 2001 @@ -66,16 +66,16 @@ #include <linux/types.h> #include <linux/agp_backend.h> #endif -#if LINUX_VERSION_CODE >= 0x020100 /* KERNEL_VERSION(2,1,0) */ #include <linux/tqueue.h> #include <linux/poll.h> -#endif -#if LINUX_VERSION_CODE < 0x020400 -#include "compat-pre24.h" -#endif #include <asm/pgalloc.h> #include "drm.h" +/* page_to_bus for earlier kernels, not optimal in all cases */ +#ifndef page_to_bus +#define page_to_bus(page) ((unsigned int)(virt_to_bus(page_address(page)))) +#endif + /* DRM template customization defaults */ #ifndef __HAVE_AGP @@ -149,180 +149,7 @@ #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) - /* Backward compatibility section */ - /* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */ -#ifndef _PAGE_PWT -#define _PAGE_PWT _PAGE_WT -#endif - /* Wait queue declarations changed in 2.3.1 */ -#ifndef DECLARE_WAITQUEUE -#define DECLARE_WAITQUEUE(w,c) struct wait_queue w = { c, NULL } -typedef struct wait_queue *wait_queue_head_t; -#define init_waitqueue_head(q) *q = NULL; -#endif - - /* _PAGE_4M changed to _PAGE_PSE in 2.3.23 */ -#ifndef _PAGE_PSE -#define _PAGE_PSE _PAGE_4M -#endif - - /* vm_offset changed to vm_pgoff in 2.3.25 */ -#if LINUX_VERSION_CODE < 0x020319 -#define VM_OFFSET(vma) ((vma)->vm_offset) -#else #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) -#endif - - /* *_nopage return values defined in 2.3.26 */ -#ifndef NOPAGE_SIGBUS -#define NOPAGE_SIGBUS 0 -#endif -#ifndef NOPAGE_OOM -#define NOPAGE_OOM 0 -#endif - - /* module_init/module_exit added in 2.3.13 */ -#ifndef module_init -#define module_init(x) int init_module(void) { return x(); } -#endif -#ifndef module_exit -#define module_exit(x) void cleanup_module(void) { x(); } -#endif - - /* Generic cmpxchg added in 2.3.x */ -#ifndef __HAVE_ARCH_CMPXCHG - /* Include this here so that driver can be - used with older kernels. */ -#if defined(__alpha__) -static __inline__ unsigned long -__cmpxchg_u32(volatile int *m, int old, int new) -{ - unsigned long prev, cmp; - - __asm__ __volatile__( - "1: ldl_l %0,%5\n" - " cmpeq %0,%3,%1\n" - " beq %1,2f\n" - " mov %4,%1\n" - " stl_c %1,%2\n" - " beq %1,3f\n" - "2: mb\n" - ".subsection 2\n" - "3: br 1b\n" - ".previous" - : "=&r"(prev), "=&r"(cmp), "=m"(*m) - : "r"((long) old), "r"(new), "m"(*m) - : "memory" ); - - return prev; -} - -static __inline__ unsigned long -__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) -{ - unsigned long prev, cmp; - - __asm__ __volatile__( - "1: ldq_l %0,%5\n" - " cmpeq %0,%3,%1\n" - " beq %1,2f\n" - " mov %4,%1\n" - " stq_c %1,%2\n" - " beq %1,3f\n" - "2: mb\n" - ".subsection 2\n" - "3: br 1b\n" - ".previous" - : "=&r"(prev), "=&r"(cmp), "=m"(*m) - : "r"((long) old), "r"(new), "m"(*m) - : "memory" ); - - return prev; -} - -static __inline__ unsigned long -__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) -{ - switch (size) { - case 4: - return __cmpxchg_u32(ptr, old, new); - case 8: - return __cmpxchg_u64(ptr, old, new); - } - return old; -} -#define cmpxchg(ptr,o,n) \ - ({ \ - __typeof__(*(ptr)) _o_ = (o); \ - __typeof__(*(ptr)) _n_ = (n); \ - (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ - (unsigned long)_n_, sizeof(*(ptr))); \ - }) - -#elif __i386__ -static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, - unsigned long new, int size) -{ - unsigned long prev; - switch (size) { - case 1: - __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" - : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 2: - __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" - : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 4: - __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2" - : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - } - 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 - -#endif /* !__HAVE_ARCH_CMPXCHG */ /* Macros to make printk easier */ #define DRM_ERROR(fmt, arg...) \ @@ -393,6 +220,11 @@ typedef int drm_ioctl_t( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); +typedef struct drm_pci_list { + u16 vendor; + u16 device; +} drm_pci_list_t; + typedef struct drm_ioctl_desc { drm_ioctl_t *func; int auth_needed; @@ -611,6 +443,8 @@ int acquired; unsigned long base; int agp_mtrr; + int cant_use_aperture; + unsigned long page_mask; } drm_agp_head_t; #endif @@ -619,6 +453,7 @@ void *virtual; int pages; struct page **pagelist; + dma_addr_t *busaddr; } drm_sg_mem_t; typedef struct drm_sigdata { @@ -709,6 +544,7 @@ #if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif + struct pci_dev *pdev; #ifdef __alpha__ #if LINUX_VERSION_CODE < 0x020403 struct pci_controler *hose; @@ -758,21 +594,6 @@ 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, - 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); @@ -785,7 +606,6 @@ 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 void DRM(vm_shm_close)(struct vm_area_struct *vma); @@ -1013,8 +833,12 @@ #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); +extern int DRM(ati_pcigart_init)(drm_device_t *dev, + unsigned long *addr, + dma_addr_t *bus_addr); +extern int DRM(ati_pcigart_cleanup)(drm_device_t *dev, + unsigned long addr, + dma_addr_t bus_addr); #endif /* __KERNEL__ */ #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h:1.2 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h Mon Dec 10 18:28:50 2001 @@ -35,12 +35,8 @@ #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; @@ -271,21 +267,24 @@ case INTEL_GX: head->chipset = "Intel 440GX"; break; case INTEL_I810: head->chipset = "Intel i810"; break; -#if LINUX_VERSION_CODE >= 0x020400 + case INTEL_I815: head->chipset = "Intel i815"; break; +#if LINUX_VERSION_CODE >= 0x020415 + case INTEL_I820: head->chipset = "Intel i820"; break; +#endif case INTEL_I840: head->chipset = "Intel i840"; break; +#if LINUX_VERSION_CODE >= 0x020415 + case INTEL_I845: head->chipset = "Intel i845"; break; #endif + case INTEL_I850: head->chipset = "Intel i850"; break; 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; @@ -294,8 +293,35 @@ case AMD_IRONGATE: head->chipset = "AMD Irongate"; break; case ALI_GENERIC: head->chipset = "ALi"; break; case ALI_M1541: head->chipset = "ALi M1541"; break; + +#if LINUX_VERSION_CODE >= 0x020402 + case ALI_M1621: head->chipset = "ALi M1621"; break; + case ALI_M1631: head->chipset = "ALi M1631"; break; + case ALI_M1632: head->chipset = "ALi M1632"; break; + case ALI_M1641: head->chipset = "ALi M1641"; break; + case ALI_M1647: head->chipset = "ALi M1647"; break; + case ALI_M1651: head->chipset = "ALi M1651"; break; +#endif + +#if LINUX_VERSION_CODE >= 0x020406 + case SVWRKS_HE: head->chipset = "Serverworks HE"; + break; + case SVWRKS_LE: head->chipset = "Serverworks LE"; + break; + case SVWRKS_GENERIC: head->chipset = "Serverworks Generic"; + break; +#endif + default: head->chipset = "Unknown"; break; } +#if LINUX_VERSION_CODE <= 0x020408 + head->cant_use_aperture = 0; + head->page_mask = ~(0xfff); +#else + head->cant_use_aperture = head->agp_info.cant_use_aperture; + head->page_mask = head->agp_info.page_mask; +#endif + DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", head->agp_info.version.major, head->agp_info.version.minor, Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h:1.2 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h Tue Oct 2 07:44:17 2001 @@ -196,7 +196,7 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; struct list_head *list; - drm_map_list_t *r_list; + drm_map_list_t *r_list = NULL; drm_vma_entry_t *pt, *prev; drm_map_t *map; drm_map_t request; @@ -229,11 +229,7 @@ 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) { @@ -266,6 +262,46 @@ #if __HAVE_DMA + +static void DRM(cleanup_buf_error)(drm_buf_entry_t *entry) +{ + int i; + + if (entry->seg_count) { + for (i = 0; i < entry->seg_count; i++) { + DRM(free_pages)(entry->seglist[i], + entry->page_order, + DRM_MEM_DMA); + } + DRM(free)(entry->seglist, + entry->seg_count * + sizeof(*entry->seglist), + DRM_MEM_SEGS); + + entry->seg_count = 0; + } + + if(entry->buf_count) { + for(i = 0; i < entry->buf_count; i++) { + if(entry->buflist[i].dev_private) { + DRM(free)(entry->buflist[i].dev_private, + entry->buflist[i].dev_priv_size, + DRM_MEM_BUFS); + } + } + DRM(free)(entry->buflist, + entry->buf_count * + sizeof(*entry->buflist), + DRM_MEM_BUFS); + +#if __HAVE_DMA_FREELIST + DRM(freelist_destroy)(&entry->freelist); +#endif + + entry->buf_count = 0; + } +} + #if __REALLY_HAVE_AGP int DRM(addbufs_agp)( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ) @@ -286,6 +322,7 @@ int total; int byte_count; int i; + drm_buf_t **temp_buflist; if ( !dma ) return -EINVAL; @@ -332,6 +369,12 @@ return -ENOMEM; /* May only call once for each order */ } + if (count < 0 || count > 4096) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -EINVAL; + } + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), DRM_MEM_BUFS ); if ( !entry->buflist ) { @@ -365,6 +408,11 @@ buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T); buf->dev_private = DRM(alloc)( sizeof(DRIVER_BUF_PRIV_T), DRM_MEM_BUFS ); + if(!buf->dev_private) { + /* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + DRM(cleanup_buf_error)(entry); + } memset( buf->dev_private, 0, buf->dev_priv_size ); #if __HAVE_DMA_HISTOGRAM @@ -383,11 +431,20 @@ DRM_DEBUG( "byte_count: %d\n", byte_count ); - dma->buflist = DRM(realloc)( dma->buflist, + temp_buflist = DRM(realloc)( dma->buflist, dma->buf_count * sizeof(*dma->buflist), (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), DRM_MEM_BUFS ); + if(!temp_buflist) { + /* Free the entry because it isn't valid */ + DRM(cleanup_buf_error)(entry); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + dma->buflist = temp_buflist; + for ( i = 0 ; i < entry->buf_count ; i++ ) { dma->buflist[i + dma->buf_count] = &entry->buflist[i]; } @@ -440,6 +497,8 @@ int i; int byte_count; int page_count; + unsigned long *temp_pagelist; + drm_buf_t **temp_buflist; if ( !dma ) return -EINVAL; @@ -479,6 +538,12 @@ return -ENOMEM; /* May only call once for each order */ } + if (count < 0 || count > 4096) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -EINVAL; + } + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), DRM_MEM_BUFS ); if ( !entry->buflist ) { @@ -500,11 +565,24 @@ } memset( entry->seglist, 0, count * sizeof(*entry->seglist) ); - dma->pagelist = DRM(realloc)( dma->pagelist, + temp_pagelist = DRM(realloc)( dma->pagelist, dma->page_count * sizeof(*dma->pagelist), (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), DRM_MEM_PAGES ); + if(!temp_pagelist) { + DRM(free)( entry->buflist, + count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + DRM(free)( entry->seglist, + count * sizeof(*entry->seglist), + DRM_MEM_SEGS ); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + + dma->pagelist = temp_pagelist; DRM_DEBUG( "pagelist: %d entries\n", dma->page_count + (count << page_order) ); @@ -551,11 +629,20 @@ byte_count += PAGE_SIZE << page_order; } - dma->buflist = DRM(realloc)( dma->buflist, + temp_buflist = DRM(realloc)( dma->buflist, dma->buf_count * sizeof(*dma->buflist), (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), DRM_MEM_BUFS ); + if(!temp_buflist) { + /* Free the entry because it isn't valid */ + DRM(cleanup_buf_error)(entry); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + dma->buflist = temp_buflist; + for ( i = 0 ; i < entry->buf_count ; i++ ) { dma->buflist[i + dma->buf_count] = &entry->buflist[i]; } @@ -581,6 +668,7 @@ atomic_dec( &dev->buf_alloc ); return 0; + } #endif /* __HAVE_PCI_DMA */ @@ -588,152 +676,177 @@ 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 ); + 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; + drm_buf_t **temp_buflist; -#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 ); + 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 */ + } - 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]; - } + if (count < 0 || count > 4096) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -EINVAL; + } - dma->buf_count += entry->buf_count; - dma->byte_count += byte_count; + 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) ); - DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); - DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); + 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 ); + if(!buf->dev_private) { + /* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + DRM(cleanup_buf_error)(entry); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + 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 ); + + temp_buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + if(!temp_buflist) { + /* Free the entry because it isn't valid */ + DRM(cleanup_buf_error)(entry); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + dma->buflist = temp_buflist; + + 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] ); - } + 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 ); + up( &dev->struct_sem ); - request.count = entry->buf_count; - request.size = size; + request.count = entry->buf_count; + request.size = size; - if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) ) - return -EFAULT; + if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) ) + return -EFAULT; - dma->flags = _DRM_DMA_USE_SG; + dma->flags = _DRM_DMA_USE_SG; - atomic_dec( &dev->buf_alloc ); - return 0; + atomic_dec( &dev->buf_alloc ); + return 0; } #endif /* __HAVE_SG */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h Wed Dec 19 16:25:59 2001 @@ -27,6 +27,10 @@ * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * Gareth Hughes <gareth@valinux.com> + * ChangeLog: + * 2001-11-16 Torsten Duwe <duwe@caldera.de> + * added context constructor/destructor hooks, + * needed by SiS driver's memory management. */ #define __NO_VERSION__ @@ -70,13 +74,20 @@ 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); + drm_map_t **ctx_sareas; + + ctx_sareas = DRM(realloc)(dev->context_sareas, + (dev->max_context - 1) * + sizeof(*dev->context_sareas), + dev->max_context * + sizeof(*dev->context_sareas), + DRM_MEM_MAPS); + if(!ctx_sareas) { + clear_bit(bit, dev->ctx_bitmap); + up(&dev->struct_sem); + return -1; + } + dev->context_sareas = ctx_sareas; dev->context_sareas[bit] = NULL; } else { /* max_context == 1 at this point */ @@ -84,6 +95,11 @@ dev->max_context * sizeof(*dev->context_sareas), DRM_MEM_MAPS); + if(!dev->context_sareas) { + clear_bit(bit, dev->ctx_bitmap); + up(&dev->struct_sem); + return -1; + } dev->context_sareas[bit] = NULL; } } @@ -148,7 +164,7 @@ return -EFAULT; down(&dev->struct_sem); - if ((int)request.ctx_id >= dev->max_context) { + if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) { up(&dev->struct_sem); return -EINVAL; } @@ -169,7 +185,7 @@ drm_device_t *dev = priv->dev; drm_ctx_priv_map_t request; drm_map_t *map = NULL; - drm_map_list_t *r_list; + drm_map_list_t *r_list = NULL; struct list_head *list; if (copy_from_user(&request, @@ -181,22 +197,20 @@ 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; + r_list->map->handle == request.handle) + goto found; } - if (list == &(dev->maplist->head)) { - up(&dev->struct_sem); - return -EINVAL; - } - map = r_list->map; +bad: up(&dev->struct_sem); + return -EINVAL; - if (!map) return -EINVAL; - - down(&dev->struct_sem); - if ((int)request.ctx_id >= dev->max_context) { - up(&dev->struct_sem); - return -EINVAL; - } +found: + map = r_list->map; + if (!map) goto bad; + if (dev->max_context < 0) + goto bad; + if (request.ctx_id >= (unsigned) dev->max_context) + goto bad; dev->context_sareas[request.ctx_id] = map; up(&dev->struct_sem); return 0; @@ -306,6 +320,10 @@ /* Should this return -EBUSY instead? */ return -ENOMEM; } +#ifdef DRIVER_CTX_CTOR + if ( ctx.handle != DRM_KERNEL_CONTEXT ) + DRIVER_CTX_CTOR(ctx.handle); /* XXX: also pass dev ? */ +#endif if ( copy_to_user( (drm_ctx_t *)arg, &ctx, sizeof(ctx) ) ) return -EFAULT; @@ -380,6 +398,9 @@ priv->remove_auth_on_close = 1; } if ( ctx.handle != DRM_KERNEL_CONTEXT ) { +#ifdef DRIVER_CTX_DTOR + DRIVER_CTX_DTOR(ctx.handle); /* XXX: also pass dev ? */ +#endif DRM(ctxbitmap_free)( dev, ctx.handle ); } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h Fri Aug 17 22:51:16 2001 @@ -40,6 +40,15 @@ #ifndef __HAVE_DMA_RECLAIM #define __HAVE_DMA_RECLAIM 0 #endif +#ifndef __HAVE_SHARED_IRQ +#define __HAVE_SHARED_IRQ 0 +#endif + +#if __HAVE_SHARED_IRQ +#define DRM_IRQ_TYPE SA_SHIRQ +#else +#define DRM_IRQ_TYPE 0 +#endif #if __HAVE_DMA @@ -534,7 +543,7 @@ /* Install handler */ ret = request_irq( dev->irq, DRM(dma_service), - 0, dev->devname, dev ); + DRM_IRQ_TYPE, dev->devname, dev ); if ( ret < 0 ) { down( &dev->struct_sem ); dev->irq = 0; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h:1.3 Wed May 2 11:06:10 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h Fri Nov 2 12:41:54 2001 @@ -84,6 +84,9 @@ #ifndef __HAVE_SG #define __HAVE_SG 0 #endif +#ifndef __HAVE_KERNEL_CTX_SWITCH +#define __HAVE_KERNEL_CTX_SWITCH 0 +#endif #ifndef DRIVER_PREINIT #define DRIVER_PREINIT() @@ -97,29 +100,46 @@ #ifndef DRIVER_PRETAKEDOWN #define DRIVER_PRETAKEDOWN() #endif +#ifndef DRIVER_POSTCLEANUP +#define DRIVER_POSTCLEANUP() +#endif +#ifndef DRIVER_PRESETUP +#define DRIVER_PRESETUP() +#endif +#ifndef DRIVER_POSTSETUP +#define DRIVER_POSTSETUP() +#endif #ifndef DRIVER_IOCTLS #define DRIVER_IOCTLS #endif +#ifndef DRIVER_FOPS +#define DRIVER_FOPS \ +static struct file_operations DRM(fops) = { \ + owner: THIS_MODULE, \ + open: DRM(open), \ + flush: DRM(flush), \ + release: DRM(release), \ + ioctl: DRM(ioctl), \ + mmap: DRM(mmap), \ + read: DRM(read), \ + fasync: DRM(fasync), \ + poll: DRM(poll), \ +} +#endif -static drm_device_t DRM(device); -static int DRM(minor); +/* + * The default number of instances (minor numbers) to initialize. + */ +#ifndef DRIVER_NUM_CARDS +#define DRIVER_NUM_CARDS 1 +#endif -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_device_t *DRM(device); +static int *DRM(minor); +static int DRM(numdevs) = 0; +DRIVER_FOPS; static drm_ioctl_desc_t DRM(ioctls)[] = { [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 }, @@ -200,26 +220,15 @@ 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) ); +#ifdef MODULE_LICENSE +MODULE_LICENSE("GPL and additional rights"); #endif static int DRM(setup)( drm_device_t *dev ) { int i; + DRIVER_PRESETUP(); atomic_set( &dev->ioctl_count, 0 ); atomic_set( &dev->vma_count, 0 ); dev->buf_use = 0; @@ -319,6 +328,7 @@ * drm_select_queue fails between the time the interrupt is * initialized and the time the queues are initialized. */ + DRIVER_POSTSETUP(); return 0; } @@ -328,7 +338,7 @@ drm_magic_entry_t *pt, *next; drm_map_t *map; drm_map_list_t *r_list; - struct list_head *list; + struct list_head *list, *list_next; drm_vma_entry_t *vma, *vma_next; int i; @@ -396,7 +406,10 @@ } if( dev->maplist ) { - list_for_each(list, &dev->maplist->head) { + for(list = dev->maplist->head.next; + list != &dev->maplist->head; + list = list_next) { + list_next = list->next; r_list = (drm_map_list_t *)list; map = r_list->map; DRM(free)(r_list, sizeof(*r_list), DRM_MEM_MAPS); @@ -475,46 +488,101 @@ return 0; } +/* + * Figure out how many instances to initialize. + */ +static int drm_count_cards(void) +{ + int num = 0; +#if defined(DRIVER_CARD_LIST) + int i; + drm_pci_list_t *l; + u16 device, vendor; + struct pci_dev *pdev = NULL; +#endif + + DRM_DEBUG( "\n" ); + +#if defined(DRIVER_COUNT_CARDS) + num = DRIVER_COUNT_CARDS(); +#elif defined(DRIVER_CARD_LIST) + for (i = 0, l = DRIVER_CARD_LIST; l[i].vendor != 0; i++) { + pdev = NULL; + vendor = l[i].vendor; + device = l[i].device; + if(device == 0xffff) device = PCI_ANY_ID; + if(vendor == 0xffff) vendor = PCI_ANY_ID; + while ((pdev = pci_find_device(vendor, device, pdev))) { + num++; + } + } +#else + num = DRIVER_NUM_CARDS; +#endif + DRM_DEBUG("numdevs = %d\n", num); + return num; +} + /* 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); + + drm_device_t *dev; + int i; #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 + + DRM(numdevs) = drm_count_cards(); + /* Force at least one instance. */ + if (DRM(numdevs) <= 0) + DRM(numdevs) = 1; + + DRM(device) = kmalloc(sizeof(*DRM(device)) * DRM(numdevs), GFP_KERNEL); + if (!DRM(device)) { + return -ENOMEM; + } + DRM(minor) = kmalloc(sizeof(*DRM(minor)) * DRM(numdevs), GFP_KERNEL); + if (!DRM(minor)) { + kfree(DRM(device)); + return -ENOMEM; + } + 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; + for (i = 0; i < DRM(numdevs); i++) { + dev = &(DRM(device)[i]); + memset( (void *)dev, 0, sizeof(*dev) ); + dev->count_lock = SPIN_LOCK_UNLOCKED; + sema_init( &dev->struct_sem, 1 ); + + if ((DRM(minor)[i] = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) + return -EPERM; + dev->device = MKDEV(DRM_MAJOR, DRM(minor)[i] ); + dev->name = DRIVER_NAME; #if __REALLY_HAVE_AGP - dev->agp = DRM(agp_init)(); + 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; - } + if ( dev->agp == NULL ) { + DRM_ERROR( "Cannot initialize the agpgart module.\n" ); + DRM(stub_unregister)(DRM(minor)[i]); + 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, + 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 ); @@ -522,25 +590,25 @@ #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; - } + retcode = DRM(ctxbitmap_init)( dev ); + if( retcode ) { + DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); + DRM(stub_unregister)(DRM(minor)[i]); + DRM(takedown)( dev ); + return retcode; + } #endif + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + DRM(minor)[i] ); + } 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; } @@ -548,38 +616,49 @@ */ static void __exit drm_cleanup( void ) { - drm_device_t *dev = &DRM(device); + drm_device_t *dev; + int i; DRM_DEBUG( "\n" ); - if ( DRM(stub_unregister)(DRM(minor)) ) { - DRM_ERROR( "Cannot unload module\n" ); - } else { - DRM_INFO( "Module unloaded\n" ); - } + for (i = DRM(numdevs) - 1; i >= 0; i--) { + dev = &(DRM(device)[i]); + if ( DRM(stub_unregister)(DRM(minor)[i]) ) { + DRM_ERROR( "Cannot unload module\n" ); + } else { + DRM_DEBUG("minor %d unregistered\n", DRM(minor)[i]); + if (i == 0) { + DRM_INFO( "Module unloaded\n" ); + } + } #if __HAVE_CTX_BITMAP - DRM(ctxbitmap_cleanup)( dev ); + 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, + if ( dev->agp && dev->agp->agp_mtrr >= 0) { + 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 ); - } + DRM_DEBUG( "mtrr_del=%d\n", retval ); + } #endif - DRM(takedown)( dev ); + 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; - } + if ( dev->agp ) { + DRM(agp_uninit)(); + DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS ); + dev->agp = NULL; + } #endif + } + DRIVER_POSTCLEANUP(); + kfree(DRM(minor)); + kfree(DRM(device)); + DRM(numdevs) = 0; } module_init( drm_init ); @@ -623,16 +702,24 @@ int DRM(open)( struct inode *inode, struct file *filp ) { - drm_device_t *dev = &DRM(device); + drm_device_t *dev = NULL; int retcode = 0; + int i; + for (i = 0; i < DRM(numdevs); i++) { + if (MINOR(inode->i_rdev) == DRM(minor)[i]) { + dev = &(DRM(device)[i]); + break; + } + } + if (!dev) { + return -ENODEV; + } + 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++ ) { @@ -751,9 +838,6 @@ * 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 ) { @@ -908,6 +992,12 @@ #if __HAVE_DMA_QUIESCENT if ( lock.flags & _DRM_LOCK_QUIESCENT ) { DRIVER_DMA_QUIESCENT(); + } +#endif +#if __HAVE_KERNEL_CTX_SWITCH + if ( dev->last_context != lock.context ) { + DRM(context_switch)(dev, dev->last_context, + lock.context); } #endif } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h:1.2 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h Mon Jan 14 13:11:44 2002 @@ -47,6 +47,8 @@ DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); priv = DRM(alloc)(sizeof(*priv), DRM_MEM_FILES); + if(!priv) return -ENOMEM; + memset(priv, 0, sizeof(*priv)); filp->private_data = priv; priv->uid = current->euid; @@ -123,21 +125,31 @@ int avail; int send; int cur; + DECLARE_WAITQUEUE(wait, current); DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); + add_wait_queue(&dev->buf_readers, &wait); + set_current_state(TASK_INTERRUPTIBLE); while (dev->buf_rp == dev->buf_wp) { DRM_DEBUG(" sleeping\n"); if (filp->f_flags & O_NONBLOCK) { + remove_wait_queue(&dev->buf_readers, &wait); + set_current_state(TASK_RUNNING); return -EAGAIN; } - interruptible_sleep_on(&dev->buf_readers); + schedule(); /* wait for dev->buf_readers */ if (signal_pending(current)) { DRM_DEBUG(" interrupted\n"); + remove_wait_queue(&dev->buf_readers, &wait); + set_current_state(TASK_RUNNING); return -ERESTARTSYS; } DRM_DEBUG(" awake\n"); + set_current_state(TASK_INTERRUPTIBLE); } + remove_wait_queue(&dev->buf_readers, &wait); + set_current_state(TASK_RUNNING); left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; avail = DRM_BSZ - left; @@ -189,24 +201,8 @@ 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; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h:1.2 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h Fri Aug 17 22:51:16 2001 @@ -64,18 +64,18 @@ return; } -/* drm_parse_options parse the insmod "drm=" options, or the command-line +/* drm_parse_options parse the insmod "drm_opts=" options, or the command-line * options passed to the kernel via LILO. The grammar of the format is as * follows: * - * drm ::= 'drm=' option_list + * drm ::= 'drm_opts=' option_list * option_list ::= option [ ';' option_list ] * option ::= 'device:' major * | 'debug' * | 'noctx' * major ::= INTEGER * - * Note that 's' contains option_list without the 'drm=' part. + * Note that 's' contains option_list without the 'drm_opts=' part. * * device=major,minor specifies the device number used for /dev/drm * if major == 0 then the misc device is used Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h:1.2 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h Tue Oct 2 07:44:17 2001 @@ -76,26 +76,28 @@ drm_device_t *dev = priv->dev; drm_unique_t u; - if (dev->unique_len || dev->unique) - return -EBUSY; + if (dev->unique_len || dev->unique) return -EBUSY; - if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) - return -EFAULT; + if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) return -EFAULT; - if (!u.unique_len) - return -EINVAL; + if (!u.unique_len || u.unique_len > 1024) return -EINVAL; dev->unique_len = u.unique_len; dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER); + if(!dev->unique) return -ENOMEM; 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); + if(!dev->devname) { + DRM(free)(dev->devname, sizeof(*dev->devname), DRM_MEM_DRIVER); + return -ENOMEM; + } sprintf(dev->devname, "%s@%s", dev->name, dev->unique); -#ifdef __alpha__ do { struct pci_dev *pci_dev; int b, d, f; @@ -111,10 +113,13 @@ if (*p) break; pci_dev = pci_find_slot(b, PCI_DEVFN(d,f)); - if (pci_dev) - dev->hose = pci_dev->sysdata; - } while(0); + if (pci_dev) { + dev->pdev = pci_dev; +#ifdef __alpha__ + dev->hose = pci_dev->sysdata; #endif + } + } while(0); return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h Fri Aug 17 22:51:16 2001 @@ -38,9 +38,12 @@ { if (bl->count) return -EINVAL; - bl->count = count; bl->bufs = DRM(alloc)((bl->count + 2) * sizeof(*bl->bufs), DRM_MEM_BUFLISTS); + + if(!bl->bufs) return -ENOMEM; + + bl->count = count; bl->rp = bl->bufs; bl->wp = bl->bufs; bl->end = &bl->bufs[bl->count+1]; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h:1.2 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h Tue Oct 2 07:44:17 2001 @@ -85,12 +85,7 @@ } 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; } @@ -257,12 +252,7 @@ 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; @@ -283,12 +273,7 @@ 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); } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h Mon Oct 8 08:58:04 2001 @@ -186,7 +186,7 @@ DRM_PROC_PRINT("slot offset size type flags " "address mtrr\n\n"); i = 0; - list_for_each(list, &dev->maplist->head) { + if (dev->maplist != NULL) list_for_each(list, &dev->maplist->head) { r_list = (drm_map_list_t *)list; map = r_list->map; if(!map) continue; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h:1.1 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h Tue Oct 2 07:44:17 2001 @@ -47,12 +47,15 @@ vfree( entry->virtual ); + DRM(free)( entry->busaddr, + entry->pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); DRM(free)( entry->pagelist, - entry->pages * sizeof(*entry->pagelist), - DRM_MEM_PAGES ); + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); DRM(free)( entry, - sizeof(*entry), - DRM_MEM_SGLISTS ); + sizeof(*entry), + DRM_MEM_SGLISTS ); } int DRM(sg_alloc)( struct inode *inode, struct file *filp, @@ -94,14 +97,30 @@ return -ENOMEM; } + entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); + if ( !entry->busaddr ) { + DRM(free)( entry->pagelist, + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + DRM(free)( entry, + sizeof(*entry), + DRM_MEM_SGLISTS ); + return -ENOMEM; + } + memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) ); + entry->virtual = vmalloc_32( pages << PAGE_SHIFT ); if ( !entry->virtual ) { + DRM(free)( entry->busaddr, + entry->pages * sizeof(*entry->busaddr), + DRM_MEM_PAGES ); DRM(free)( entry->pagelist, - entry->pages * sizeof(*entry->pagelist), - DRM_MEM_PAGES ); + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); DRM(free)( entry, - sizeof(*entry), - DRM_MEM_SGLISTS ); + sizeof(*entry), + DRM_MEM_SGLISTS ); return -ENOMEM; } @@ -154,7 +173,7 @@ for ( i = 0 ; i < pages ; i++ ) { unsigned long *tmp; - tmp = (unsigned long *)entry->pagelist[i]->virtual; + tmp = page_address( entry->pagelist[i] ); for ( j = 0 ; j < PAGE_SIZE / sizeof(unsigned long) ; j++, tmp++ ) { @@ -172,7 +191,7 @@ "virtual mapping\n" ); } } - tmp = (unsigned long *)entry->pagelist[i]->virtual; + tmp = page_address( entry->pagelist[i] ); for(j = 0 ; j < PAGE_SIZE / sizeof(unsigned long) ; j++, tmp++) { Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h Tue Oct 2 07:44:17 2001 @@ -31,10 +31,6 @@ #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 { @@ -70,9 +66,7 @@ } static struct file_operations DRM(stub_fops) = { -#if LINUX_VERSION_CODE >= 0x020400 owner: THIS_MODULE, -#endif open: DRM(stub_open) }; @@ -84,6 +78,7 @@ if (!DRM(stub_list)) { DRM(stub_list) = DRM(alloc)(sizeof(*DRM(stub_list)) * DRM_STUB_MAXCARDS, DRM_MEM_STUB); + if(!DRM(stub_list)) return -1; for (i = 0; i < DRM_STUB_MAXCARDS; i++) { DRM(stub_list)[i].name = NULL; DRM(stub_list)[i].fops = NULL; @@ -121,11 +116,13 @@ return 0; } + int DRM(stub_register)(const char *name, struct file_operations *fops, drm_device_t *dev) { struct drm_stub_info *i = NULL; - + + DRM_DEBUG("\n"); if (register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops))) i = (struct drm_stub_info *)inter_module_get("drm"); @@ -133,9 +130,11 @@ /* Already registered */ DRM(stub_info).info_register = i->info_register; DRM(stub_info).info_unregister = i->info_unregister; - } else { + DRM_DEBUG("already registered\n"); + } else if (DRM(stub_info).info_register != DRM(stub_getminor)) { DRM(stub_info).info_register = DRM(stub_getminor); DRM(stub_info).info_unregister = DRM(stub_putminor); + DRM_DEBUG("calling inter_module_register\n"); inter_module_register("drm", THIS_MODULE, &DRM(stub_info)); } if (DRM(stub_info).info_register) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h:1.2.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h:1.2.2.1 Wed May 23 14:58:00 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h Mon Dec 10 18:28:50 2001 @@ -32,66 +32,108 @@ #define __NO_VERSION__ #include "drmP.h" -struct vm_operations_struct drm_vm_ops = { +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 = { +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 = { +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 = { +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 { +#if __REALLY_HAVE_AGP + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_map_t *map = NULL; + drm_map_list_t *r_list; + struct list_head *list; + + /* + * Find the right map + */ + + if(!dev->agp->cant_use_aperture) goto vm_nopage_error; + + 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->type == _DRM_AGP) { + unsigned long offset = address - vma->vm_start; + unsigned long baddr = VM_OFFSET(vma) + offset; + struct drm_agp_mem *agpmem; + struct page *page; + +#if __alpha__ + /* + * Adjust to a bus-relative address + */ + baddr -= dev->hose->mem_space->start; +#endif + + /* + * It's AGP memory - find the real physical page to map + */ + for(agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) { + if (agpmem->bound <= baddr && + agpmem->bound + agpmem->pages * PAGE_SIZE > baddr) + break; + } + + if (!agpmem) goto vm_nopage_error; + + /* + * Get the page, inc the use count, and return it + */ + offset = (baddr - agpmem->bound) >> PAGE_SHIFT; + agpmem->memory->memory[offset] &= dev->agp->page_mask; + page = virt_to_page(__va(agpmem->memory->memory[offset])); + get_page(page); + + DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx\n", + baddr, __va(agpmem->memory->memory[offset]), offset); + + return page; + } +vm_nopage_error: +#endif /* __REALLY_HAVE_AGP */ + 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; + struct page *page; if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ if (!map) return NOPAGE_OOM; /* Nothing allocated */ @@ -107,15 +149,12 @@ 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 + page = pte_page(*pte); + get_page(page); + + DRM_DEBUG("0x%08lx => 0x%08x\n", address, page_to_bus(page)); + return page; } /* Special close routine which deletes map information if we are the last @@ -126,7 +165,7 @@ { drm_file_t *priv = vma->vm_file->private_data; drm_device_t *dev = priv->dev; - drm_vma_entry_t *pt, *prev; + drm_vma_entry_t *pt, *prev, *next; drm_map_t *map; drm_map_list_t *r_list; struct list_head *list; @@ -134,24 +173,14 @@ 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 + for (pt = dev->vmalist, prev = NULL; pt; pt = next) { + next = pt->next; 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; @@ -159,6 +188,8 @@ dev->vmalist = pt->next; } DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS); + } else { + prev = pt; } } /* We were the only map that was found */ @@ -202,57 +233,38 @@ 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; + unsigned long page_nr; + struct page *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 + page_nr = offset >> PAGE_SHIFT; + page = virt_to_page((dma->pagelist[page_nr] + + (offset & (~PAGE_MASK)))); + + get_page(page); + + DRM_DEBUG("0x%08lx (page %lu) => 0x%08x\n", address, page_nr, + page_to_bus(page)); + return page; } -#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; @@ -270,13 +282,9 @@ 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 */ + get_page(page); -#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) @@ -288,10 +296,6 @@ 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) { @@ -312,9 +316,6 @@ 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); @@ -352,19 +353,32 @@ } unlock_kernel(); - vma->vm_ops = &drm_vm_dma_ops; - vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ + vma->vm_ops = &DRM(vm_dma_ops); -#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; +#if LINUX_VERSION_CODE <= 0x020414 + vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ +#else + vma->vm_flags |= VM_RESERVED; /* Don't swap */ #endif + vma->vm_file = filp; /* Needed for drm_vm_open() */ DRM(vm_open)(vma); return 0; } +#ifndef DRIVER_GET_MAP_OFS +#define DRIVER_GET_MAP_OFS() (map->offset) +#endif + +#ifndef DRIVER_GET_REG_OFS +#ifdef __alpha__ +#define DRIVER_GET_REG_OFS() (dev->hose->dense_mem_base - \ + dev->hose->mem_space->start) +#else +#define DRIVER_GET_REG_OFS() 0 +#endif +#endif + int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) { drm_file_t *priv = filp->private_data; @@ -389,10 +403,13 @@ for performance, even if the list was a bit longer. */ list_for_each(list, &dev->maplist->head) { + unsigned long off; + r_list = (drm_map_list_t *)list; map = r_list->map; if (!map) continue; - if (map->offset == VM_OFFSET(vma)) break; + off = DRIVER_GET_MAP_OFS(); + if (off == VM_OFFSET(vma)) break; } if (!map || ((map->flags&_DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) @@ -415,9 +432,20 @@ } switch (map->type) { + case _DRM_AGP: +#if defined(__alpha__) + /* + * On Alpha we can't talk to bus dma address from the + * CPU, so for memory of type DRM_AGP, we'll deal with + * sorting out the real physical pages and mappings + * in nopage() + */ + vma->vm_ops = &DRM(vm_ops); + break; +#endif + /* fall through to _DRM_FRAME_BUFFER... */ 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) { @@ -433,10 +461,7 @@ #endif vma->vm_flags |= VM_IO; /* not in core dump */ } -#ifdef __alpha__ - offset = dev->hose->dense_mem_base - - dev->hose->mem_space->start; -#endif + offset = DRIVER_GET_REG_OFS(); if (remap_page_range(vma->vm_start, VM_OFFSET(vma) + offset, vma->vm_end - vma->vm_start, @@ -446,38 +471,37 @@ " offset = 0x%lx\n", map->type, vma->vm_start, vma->vm_end, VM_OFFSET(vma) + offset); - vma->vm_ops = &drm_vm_ops; + vma->vm_ops = &DRM(vm_ops); break; case _DRM_SHM: - vma->vm_ops = &drm_vm_shm_ops; -#if LINUX_VERSION_CODE >= 0x020300 + vma->vm_ops = &DRM(vm_shm_ops); 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. */ +#if LINUX_VERSION_CODE <= 0x020414 vma->vm_flags |= VM_LOCKED; +#else + vma->vm_flags |= VM_RESERVED; +#endif break; case _DRM_SCATTER_GATHER: - vma->vm_ops = &drm_vm_sg_ops; -#if LINUX_VERSION_CODE >= 0x020300 + vma->vm_ops = &DRM(vm_sg_ops); vma->vm_private_data = (void *)map; +#if LINUX_VERSION_CODE <= 0x020414 + vma->vm_flags |= VM_LOCKED; #else - vma->vm_pte = (unsigned long)map; + vma->vm_flags |= VM_RESERVED; #endif - vma->vm_flags |= VM_LOCKED; break; default: return -EINVAL; /* This should never happen. */ } +#if LINUX_VERSION_CODE <= 0x020414 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; +#else + vma->vm_flags |= VM_RESERVED; /* Don't swap */ #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/gamma_drv.c diff -u 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.13 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c:1.12 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c Fri Aug 17 22:51:16 2001 @@ -62,6 +62,27 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" + +#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. + */ + +/* JH- We have to hand expand the string ourselves because of the cpp. If + * anyone can think of a way that we can fit into the __setup macro without + * changing it, then please send the solution my way. + */ +static int __init gamma_options( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", gamma_options ); +#endif + + #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h:1.1 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h Fri Aug 17 22:51:17 2001 @@ -62,9 +62,10 @@ #define __HAVE_DMA_IRQ 1 #define __HAVE_DMA_IRQ_BH 1 +#define __HAVE_SHARED_IRQ 1 #define DRIVER_PREINSTALL() do { \ drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ + (drm_i810_private_t *)dev->dev_private; \ u16 tmp; \ tmp = I810_READ16( I810REG_HWSTAM ); \ tmp = tmp & 0x6000; \ @@ -80,7 +81,7 @@ #define DRIVER_POSTINSTALL() do { \ drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ + (drm_i810_private_t *)dev->dev_private; \ u16 tmp; \ tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ tmp = tmp & 0x6000; \ @@ -90,15 +91,18 @@ #define DRIVER_UNINSTALL() do { \ drm_i810_private_t *dev_priv = \ - (drm_i810_private_t *)dev->dev_private; \ + (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 ); \ + if ( dev_priv ) { \ + 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 ); \ + tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ + } \ } while (0) /* Buffer customization: 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.12 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c:1.15 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c:1.12 Wed May 2 11:06:10 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c Tue Oct 2 07:44:17 2001 @@ -86,6 +86,7 @@ DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]); DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]); DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]); + DRM_DEBUG( "hw_status: Last Render: %x\n", temp[4]); DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]); for(i = 6; i < dma->buf_count + 6; i++) { DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 6, temp[i]); @@ -227,14 +228,9 @@ #else down_write( ¤t->mm->mmap_sem ); #endif -#if LINUX_VERSION_CODE < 0x020399 - retcode = do_munmap((unsigned long)buf_priv->virtual, - (size_t) buf->total); -#else retcode = do_munmap(current->mm, (unsigned long)buf_priv->virtual, (size_t) buf->total); -#endif #if LINUX_VERSION_CODE <= 0x020402 up( ¤t->mm->mmap_sem ); #else @@ -379,10 +375,9 @@ if (ring->space < 0) ring->space += ring->Size; } -static int i810_freelist_init(drm_device_t *dev) +static int i810_freelist_init(drm_device_t *dev, drm_i810_private_t *dev_priv) { drm_device_dma_t *dma = dev->dma; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; int my_idx = 24; u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx); int i; @@ -414,7 +409,6 @@ { struct list_head *list; - dev->dev_private = (void *) dev_priv; memset(dev_priv, 0, sizeof(drm_i810_private_t)); list_for_each(list, &dev->maplist->head) { @@ -426,9 +420,26 @@ break; } } - + if(!dev_priv->sarea_map) { + dev->dev_private = (void *)dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("can not find sarea!\n"); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); + if(!dev_priv->mmio_map) { + dev->dev_private = (void *)dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("can not find mmio map!\n"); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); + if(!dev_priv->buffer_map) { + dev->dev_private = (void *)dev_priv; + i810_dma_cleanup(dev); + DRM_ERROR("can not find dma buffer map!\n"); + return -EINVAL; + } dev_priv->sarea_priv = (drm_i810_sarea_t *) ((u8 *)dev_priv->sarea_map->handle + @@ -445,46 +456,53 @@ init->ring_start, init->ring_size); - dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; - if (dev_priv->ring.virtual_start == NULL) { + dev->dev_private = (void *) dev_priv; i810_dma_cleanup(dev); DRM_ERROR("can not ioremap virtual address for" " ring buffer\n"); return -ENOMEM; } + dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; + dev_priv->w = init->w; dev_priv->h = init->h; dev_priv->pitch = init->pitch; dev_priv->back_offset = init->back_offset; dev_priv->depth_offset = init->depth_offset; + dev_priv->overlay_offset = init->overlay_offset; + dev_priv->overlay_physical = init->overlay_physical; + 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); if(dev_priv->hw_status_page == 0UL) { + dev->dev_private = (void *)dev_priv; i810_dma_cleanup(dev); DRM_ERROR("Can not allocate hardware status page\n"); return -ENOMEM; } + memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); 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) { + if(i810_freelist_init(dev, dev_priv) != 0) { + dev->dev_private = (void *)dev_priv; i810_dma_cleanup(dev); DRM_ERROR("Not enough space in the status page for" " the freelist\n"); return -ENOMEM; } + dev->dev_private = (void *)dev_priv; + return 0; } @@ -1094,6 +1112,8 @@ DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", vertex.idx, vertex.used, vertex.discard); + if(vertex.idx < 0 || vertex.idx > dma->buf_count) return -EINVAL; + i810_dma_dispatch_vertex( dev, dma->buflist[ vertex.idx ], vertex.discard, vertex.used ); @@ -1123,6 +1143,11 @@ return -EINVAL; } + /* GH: Someone's doing nasty things... */ + if (!dev->dev_private) { + return -EINVAL; + } + i810_dma_dispatch_clear( dev, clear.flags, clear.clear_color, clear.clear_depth ); @@ -1217,11 +1242,13 @@ if (copy_from_user(&d, (drm_i810_copy_t *)arg, sizeof(d))) return -EFAULT; - if(d.idx > dma->buf_count) return -EINVAL; + if(d.idx < 0 || d.idx > dma->buf_count) return -EINVAL; buf = dma->buflist[ d.idx ]; buf_priv = buf->dev_private; if (buf_priv->currently_mapped != I810_BUF_MAPPED) return -EPERM; + if(d.used < 0 || d.used > buf->total) return -EINVAL; + if (copy_from_user(buf_priv->virtual, d.address, d.used)) return -EFAULT; @@ -1236,3 +1263,156 @@ if(VM_DONTCOPY == 0) return 1; return 0; } + +static void i810_dma_dispatch_mc(drm_device_t *dev, drm_buf_t *buf, int used, + unsigned int last_render) +{ + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned long address = (unsigned long)buf->bus_address; + unsigned long start = address - dev->agp->base; + int u; + RING_LOCALS; + + i810_kernel_lost_context(dev); + + u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, + I810_BUF_HARDWARE); + if(u != I810_BUF_CLIENT) { + DRM_DEBUG("MC found buffer that isn't mine!\n"); + } + + if (used > 4*1024) + used = 0; + + sarea_priv->dirty = 0x7f; + + DRM_DEBUG("dispatch mc addr 0x%lx, used 0x%x\n", + address, used); + + dev_priv->counter++; + DRM_DEBUG("dispatch counter : %ld\n", dev_priv->counter); + DRM_DEBUG("i810_dma_dispatch_mc\n"); + DRM_DEBUG("start : %lx\n", start); + DRM_DEBUG("used : %d\n", used); + DRM_DEBUG("start + used - 4 : %ld\n", start + used - 4); + + if (buf_priv->currently_mapped == I810_BUF_MAPPED) { + if (used & 4) { + *(u32 *)((u32)buf_priv->virtual + used) = 0; + used += 4; + } + + i810_unmap_buffer(buf); + } + 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(); + + + BEGIN_LP_RING(8); + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( buf_priv->my_use_idx ); + OUT_RING( I810_BUF_FREE ); + OUT_RING( 0 ); + + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( 16 ); + OUT_RING( last_render ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); +} + +int i810_dma_mc(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_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_mc_t mc; + + if (copy_from_user(&mc, (drm_i810_mc_t *)arg, sizeof(mc))) + return -EFAULT; + + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_dma_mc called without lock held\n"); + return -EINVAL; + } + + i810_dma_dispatch_mc(dev, dma->buflist[mc.idx], mc.used, + mc.last_render ); + + atomic_add(mc.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; +} + +int i810_rstatus(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + + return (int)(((u32 *)(dev_priv->hw_status_page))[4]); +} + +int i810_ov0_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; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + drm_i810_overlay_t data; + + data.offset = dev_priv->overlay_offset; + data.physical = dev_priv->overlay_physical; + copy_to_user((drm_i810_overlay_t *)arg,&data,sizeof(data)); + return 0; +} + +int i810_fstatus(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_fstatus called without lock held\n"); + return -EINVAL; + } + return I810_READ(0x30008); +} + +int i810_ov0_flip(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i810_ov0_flip called without lock held\n"); + return -EINVAL; + } + + //Tell the overlay to update + I810_WRITE(0x30000,dev_priv->overlay_physical | 0x80000000); + + return 0; +} + + 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.3.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h:1.3.2.1 Thu May 31 22:24:18 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h Thu Sep 27 04:25:05 2001 @@ -112,6 +112,8 @@ unsigned int front_offset; unsigned int back_offset; unsigned int depth_offset; + unsigned int overlay_offset; + unsigned int overlay_physical; unsigned int w; unsigned int h; unsigned int pitch; @@ -195,5 +197,19 @@ int request_size; int granted; } drm_i810_dma_t; + +typedef struct _drm_i810_overlay_t { + unsigned int offset; /* Address of the Overlay Regs */ + unsigned int physical; +} drm_i810_overlay_t; + +typedef struct _drm_i810_mc { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + int num_blocks; /* number of GFXBlocks */ + int *length; /* List of lengths for GFXBlocks (FUTURE)*/ + unsigned int last_render; /* Last Render Request */ +} drm_i810_mc_t; + #endif /* _I810_DRM_H_ */ 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.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c:1.10 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c Thu Sep 27 04:25:05 2001 @@ -39,10 +39,10 @@ #define DRIVER_NAME "i810" #define DRIVER_DESC "Intel i810" -#define DRIVER_DATE "20010215" +#define DRIVER_DATE "20010920" #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 1 +#define DRIVER_MINOR 2 #define DRIVER_PATCHLEVEL 0 #define DRIVER_IOCTLS \ @@ -54,7 +54,12 @@ [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 }, + [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_OV0INFO)] = { i810_ov0_info, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_FSTATUS)] = { i810_fstatus, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_OV0FLIP)] = { i810_ov0_flip, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_MC)] = { i810_dma_mc, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_RSTATUS)] = { i810_rstatus, 1, 0 } #define __HAVE_COUNTERS 4 @@ -71,6 +76,26 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" + +#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. + */ + +/* JH- We have to hand expand the string ourselves because of the cpp. If + * anyone can think of a way that we can fit into the __setup macro without + * changing it, then please send the solution my way. + */ +static int __init i810_options( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", i810_options ); +#endif + #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.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.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h:1.7 Wed Mar 21 13:08:55 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h Thu Sep 27 04:25:05 2001 @@ -73,6 +73,8 @@ int back_offset; int depth_offset; + int overlay_offset; + int overlay_physical; int w, h; int pitch; } drm_i810_private_t; @@ -93,6 +95,18 @@ unsigned int cmd, unsigned long arg); extern int i810_docopy(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); + +extern int i810_rstatus(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i810_ov0_info(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i810_fstatus(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i810_ov0_flip(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i810_dma_mc(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + extern void i810_dma_quiescent(drm_device_t *dev); Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830.h:1.1 --- /dev/null Fri Jan 18 15:26:06 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830.h Thu Oct 4 14:28:22 2001 @@ -0,0 +1,116 @@ +/* i830.h -- Intel I830 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 __I830_H__ +#define __I830_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) i830_##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 { \ + i830_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 { \ + i830_dma_quiescent( dev ); \ +} while (0) + +#define __HAVE_DMA_IRQ 1 +#define __HAVE_DMA_IRQ_BH 1 +#define __HAVE_SHARED_IRQ 1 +#define DRIVER_PREINSTALL() do { \ + drm_i830_private_t *dev_priv = \ + (drm_i830_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I830_READ16( I830REG_HWSTAM ); \ + tmp = tmp & 0x6000; \ + I830_WRITE16( I830REG_HWSTAM, tmp ); \ + \ + tmp = I830_READ16( I830REG_INT_MASK_R ); \ + tmp = tmp & 0x6000; /* Unmask interrupts */ \ + I830_WRITE16( I830REG_INT_MASK_R, tmp ); \ + tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ +} while (0) + +#define DRIVER_POSTINSTALL() do { \ + drm_i830_private_t *dev_priv = \ + (drm_i830_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; \ + tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \ + I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ +} while (0) + +#define DRIVER_UNINSTALL() do { \ + drm_i830_private_t *dev_priv = \ + (drm_i830_private_t *)dev->dev_private; \ + u16 tmp; \ + if ( dev_priv ) { \ + tmp = I830_READ16( I830REG_INT_IDENTITY_R ); \ + tmp = tmp & ~(0x6000); /* Clear all interrupts */ \ + if ( tmp != 0 ) \ + I830_WRITE16( I830REG_INT_IDENTITY_R, tmp ); \ + \ + tmp = I830_READ16( I830REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I830_WRITE16( I830REG_INT_ENABLE_R, tmp ); \ + } \ +} while (0) + +/* Buffer customization: + */ + +#define DRIVER_BUF_PRIV_T drm_i830_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_i830_private_t *)((dev)->dev_private))->buffer_map + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c:1.1 --- /dev/null Fri Jan 18 15:26:06 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c Thu Oct 4 14:28:22 2001 @@ -0,0 +1,1418 @@ +/* i830_dma.c -- DMA support for the I830 -*- linux-c -*- + * Created: Mon Dec 13 01:50:01 1999 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> + * Keith Whitwell <keithw@valinux.com> + * Abraham vd Merwe <abraham@2d3d.co.za> + * + */ + +#define __NO_VERSION__ +#include "i830.h" +#include "drmP.h" +#include "i830_drv.h" +#include <linux/interrupt.h> /* For task queue support */ + +/* in case we don't have a 2.3.99-pre6 kernel or later: */ +#ifndef VM_DONTCOPY +#define VM_DONTCOPY 0 +#endif + +#define I830_BUF_FREE 2 +#define I830_BUF_CLIENT 1 +#define I830_BUF_HARDWARE 0 + +#define I830_BUF_UNMAPPED 0 +#define I830_BUF_MAPPED 1 + +#define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; + + +#define DO_IDLE_WORKAROUND() \ +do { \ + int _head; \ + int _tail; \ + int _i; \ + do { \ + _head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; \ + _tail = I830_READ(LP_RING + RING_TAIL) & TAIL_ADDR; \ + for(_i = 0; _i < 65535; _i++); \ + } while(_head != _tail); \ +} while(0) + +#define I830_SYNC_WORKAROUND 0 + +#define BEGIN_LP_RING(n) do { \ + if (I830_VERBOSE) \ + DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", \ + n, __FUNCTION__); \ + if (I830_SYNC_WORKAROUND) \ + DO_IDLE_WORKAROUND(); \ + if (dev_priv->ring.space < n*4) \ + i830_wait_ring(dev, n*4); \ + dev_priv->ring.space -= n*4; \ + outring = dev_priv->ring.tail; \ + ringmask = dev_priv->ring.tail_mask; \ + virt = dev_priv->ring.virtual_start; \ +} while (0) + +#define ADVANCE_LP_RING() do { \ + if (I830_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ + dev_priv->ring.tail = outring; \ + I830_WRITE(LP_RING + RING_TAIL, outring); \ +} while(0) + +#define OUT_RING(n) do { \ + if (I830_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ + *(volatile unsigned int *)(virt + outring) = n; \ + outring += 4; \ + outring &= ringmask; \ +} while (0); + +static inline void i830_print_status_page(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + drm_i830_private_t *dev_priv = dev->dev_private; + u32 *temp = (u32 *)dev_priv->hw_status_page; + int i; + + DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]); + DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]); + DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]); + DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]); + DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]); + for(i = 9; i < dma->buf_count + 9; i++) { + DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 9, temp[i]); + } +} + +static drm_buf_t *i830_freelist_get(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + int i; + int used; + + /* Linear search might not be the best solution */ + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + /* In use is already a pointer */ + used = cmpxchg(buf_priv->in_use, I830_BUF_FREE, + I830_BUF_CLIENT); + if(used == I830_BUF_FREE) { + return buf; + } + } + return NULL; +} + +/* This should only be called if the buffer is not sent to the hardware + * yet, the hardware updates in use for us once its on the ring buffer. + */ + +static int i830_freelist_put(drm_device_t *dev, drm_buf_t *buf) +{ + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + int used; + + /* In use is already a pointer */ + used = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, I830_BUF_FREE); + if(used != I830_BUF_CLIENT) { + DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); + return -EINVAL; + } + + return 0; +} + +static struct file_operations i830_buffer_fops = { + open: DRM(open), + flush: DRM(flush), + release: DRM(release), + ioctl: DRM(ioctl), + mmap: i830_mmap_buffers, + read: DRM(read), + fasync: DRM(fasync), + poll: DRM(poll), +}; + +int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev; + drm_i830_private_t *dev_priv; + drm_buf_t *buf; + drm_i830_buf_priv_t *buf_priv; + + lock_kernel(); + dev = priv->dev; + 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 = I830_BUF_MAPPED; + unlock_kernel(); + + if (remap_page_range(vma->vm_start, + VM_OFFSET(vma), + vma->vm_end - vma->vm_start, + vma->vm_page_prot)) return -EAGAIN; + return 0; +} + +static int i830_map_buffer(drm_buf_t *buf, struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + drm_i830_private_t *dev_priv = dev->dev_private; + struct file_operations *old_fops; + int retcode = 0; + + if(buf_priv->currently_mapped == I830_BUF_MAPPED) return -EINVAL; + + if(VM_DONTCOPY != 0) { +#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 = &i830_buffer_fops; + dev_priv->mmap_buffer = buf; + buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, + PROT_READ|PROT_WRITE, + MAP_SHARED, + buf->bus_address); + dev_priv->mmap_buffer = NULL; + filp->f_op = old_fops; + if ((unsigned long)buf_priv->virtual > -1024UL) { + /* Real error */ + DRM_DEBUG("mmap error\n"); + retcode = (signed int)buf_priv->virtual; + buf_priv->virtual = 0; + } +#if 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 = I830_BUF_MAPPED; + } + return retcode; +} + +static int i830_unmap_buffer(drm_buf_t *buf) +{ + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + int retcode = 0; + + if(VM_DONTCOPY != 0) { + if(buf_priv->currently_mapped != I830_BUF_MAPPED) + return -EINVAL; +#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, + (size_t) buf->total); +#else + 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 + } + buf_priv->currently_mapped = I830_BUF_UNMAPPED; + buf_priv->virtual = 0; + + return retcode; +} + +static int i830_dma_get_buffer(drm_device_t *dev, drm_i830_dma_t *d, + struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_buf_t *buf; + drm_i830_buf_priv_t *buf_priv; + int retcode = 0; + + buf = i830_freelist_get(dev); + if (!buf) { + retcode = -ENOMEM; + DRM_DEBUG("retcode=%d\n", retcode); + return retcode; + } + + retcode = i830_map_buffer(buf, filp); + if(retcode) { + i830_freelist_put(dev, buf); + DRM_DEBUG("mapbuf failed, retcode %d\n", retcode); + return retcode; + } + buf->pid = priv->pid; + buf_priv = buf->dev_private; + d->granted = 1; + d->request_idx = buf->idx; + d->request_size = buf->total; + d->virtual = buf_priv->virtual; + + return retcode; +} + +static unsigned long i830_alloc_page(drm_device_t *dev) +{ + unsigned long address; + + address = __get_free_page(GFP_KERNEL); + 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 i830_free_page(drm_device_t *dev, unsigned long page) +{ + 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); + free_page(page); + return; +} + +static int i830_dma_cleanup(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + + if(dev->dev_private) { + int i; + drm_i830_private_t *dev_priv = + (drm_i830_private_t *) dev->dev_private; + + if(dev_priv->ring.virtual_start) { + DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, + dev_priv->ring.Size); + } + if(dev_priv->hw_status_page != 0UL) { + i830_free_page(dev, dev_priv->hw_status_page); + /* Need to rewrite hardware status page */ + I830_WRITE(0x02080, 0x1ffff000); + } + DRM(free)(dev->dev_private, sizeof(drm_i830_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_i830_buf_priv_t *buf_priv = buf->dev_private; + DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total); + } + } + return 0; +} + +static int i830_wait_ring(drm_device_t *dev, int n) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_ring_buffer_t *ring = &(dev_priv->ring); + int iters = 0; + unsigned long end; + unsigned int last_head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; + + end = jiffies + (HZ*3); + while (ring->space < n) { + int i; + + ring->head = I830_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); + last_head = ring->head; + } + + iters++; + if((signed)(end - jiffies) <= 0) { + DRM_ERROR("space: %d wanted %d\n", ring->space, n); + DRM_ERROR("lockup\n"); + goto out_wait_ring; + } + + for (i = 0 ; i < 2000 ; i++) ; + } + +out_wait_ring: + return iters; +} + +static void i830_kernel_lost_context(drm_device_t *dev) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_ring_buffer_t *ring = &(dev_priv->ring); + + ring->head = I830_READ(LP_RING + RING_HEAD) & HEAD_ADDR; + ring->tail = I830_READ(LP_RING + RING_TAIL); + ring->space = ring->head - (ring->tail+8); + if (ring->space < 0) ring->space += ring->Size; +} + +static int i830_freelist_init(drm_device_t *dev, drm_i830_private_t *dev_priv) +{ + drm_device_dma_t *dma = dev->dma; + int my_idx = 36; + 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; + } + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i830_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 = I830_BUF_FREE; + + buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, + buf->total); + } + return 0; +} + +static int i830_dma_initialize(drm_device_t *dev, + drm_i830_private_t *dev_priv, + drm_i830_init_t *init) +{ + struct list_head *list; + + memset(dev_priv, 0, sizeof(drm_i830_private_t)); + + 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; + } + } + + if(!dev_priv->sarea_map) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("can not find sarea!\n"); + return -EINVAL; + } + DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); + if(!dev_priv->mmio_map) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("can not find mmio map!\n"); + return -EINVAL; + } + DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); + if(!dev_priv->buffer_map) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("can not find dma buffer map!\n"); + return -EINVAL; + } + + dev_priv->sarea_priv = (drm_i830_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); + + if (dev_priv->ring.virtual_start == NULL) { + dev->dev_private = (void *) dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("can not ioremap virtual address for" + " ring buffer\n"); + return -ENOMEM; + } + + dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; + + dev_priv->w = init->w; + dev_priv->h = init->h; + dev_priv->pitch = init->pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->depth_offset = init->depth_offset; + + 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; + + dev_priv->cpp = init->cpp; + /* We are using seperate values as placeholders for mechanisms for + * private backbuffer/depthbuffer usage. + */ + + dev_priv->back_pitch = init->back_pitch; + dev_priv->depth_pitch = init->depth_pitch; + + /* Program Hardware Status Page */ + dev_priv->hw_status_page = i830_alloc_page(dev); + if(dev_priv->hw_status_page == 0UL) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("Can not allocate hardware status page\n"); + return -ENOMEM; + } + memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); + DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page); + + I830_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(i830_freelist_init(dev, dev_priv) != 0) { + dev->dev_private = (void *)dev_priv; + i830_dma_cleanup(dev); + DRM_ERROR("Not enough space in the status page for" + " the freelist\n"); + return -ENOMEM; + } + dev->dev_private = (void *)dev_priv; + + return 0; +} + +int i830_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_i830_private_t *dev_priv; + drm_i830_init_t init; + int retcode = 0; + + if (copy_from_user(&init, (drm_i830_init_t *)arg, sizeof(init))) + return -EFAULT; + + switch(init.func) { + case I830_INIT_DMA: + dev_priv = DRM(alloc)(sizeof(drm_i830_private_t), + DRM_MEM_DRIVER); + if(dev_priv == NULL) return -ENOMEM; + retcode = i830_dma_initialize(dev, dev_priv, &init); + break; + case I830_CLEANUP_DMA: + retcode = i830_dma_cleanup(dev); + break; + default: + retcode = -EINVAL; + break; + } + + return retcode; +} + +/* Most efficient way to verify state for the i830 is as it is + * emitted. Non-conformant state is silently dropped. + * + * Use 'volatile' & local var tmp to force the emitted values to be + * identical to the verified ones. + */ +static void i830EmitContextVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + int i, j = 0; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( I830_CTX_SETUP_SIZE ); + for ( i = 0 ; i < I830_CTX_SETUP_SIZE ; i++ ) { + tmp = code[i]; + +#if 0 + if ((tmp & (7<<29)) == (3<<29) && + (tmp & (0x1f<<24)) < (0x1d<<24)) { + OUT_RING( tmp ); + j++; + } else { + printk("Skipping %d\n", i); + } +#else + OUT_RING( tmp ); + j++; +#endif + } + + if (j & 1) + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + +static void i830EmitTexVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + int i, j = 0; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( I830_TEX_SETUP_SIZE ); + + OUT_RING( GFX_OP_MAP_INFO ); + OUT_RING( code[I830_TEXREG_MI1] ); + OUT_RING( code[I830_TEXREG_MI2] ); + OUT_RING( code[I830_TEXREG_MI3] ); + OUT_RING( code[I830_TEXREG_MI4] ); + OUT_RING( code[I830_TEXREG_MI5] ); + + for ( i = 6 ; i < I830_TEX_SETUP_SIZE ; i++ ) { + tmp = code[i]; + OUT_RING( tmp ); + j++; + } + + if (j & 1) + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + +static void i830EmitTexBlendVerified( drm_device_t *dev, + volatile unsigned int *code, + volatile unsigned int num) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + int i, j = 0; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( num ); + + for ( i = 0 ; i < num ; i++ ) { + tmp = code[i]; + OUT_RING( tmp ); + j++; + } + + if (j & 1) + OUT_RING( 0 ); + + ADVANCE_LP_RING(); +} + +static void i830EmitTexPalette( drm_device_t *dev, + unsigned int *palette, + int number, + int is_shared ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + int i; + RING_LOCALS; + + BEGIN_LP_RING( 258 ); + + if(is_shared == 1) { + OUT_RING(CMD_OP_MAP_PALETTE_LOAD | + MAP_PALETTE_NUM(0) | + MAP_PALETTE_BOTH); + } else { + OUT_RING(CMD_OP_MAP_PALETTE_LOAD | MAP_PALETTE_NUM(number)); + } + for(i = 0; i < 256; i++) { + OUT_RING(palette[i]); + } + OUT_RING(0); +} + +/* Need to do some additional checking when setting the dest buffer. + */ +static void i830EmitDestVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + unsigned int tmp; + RING_LOCALS; + + BEGIN_LP_RING( I830_DEST_SETUP_SIZE + 6 ); + + tmp = code[I830_DESTREG_CBUFADDR]; + if (tmp == dev_priv->front_di1) { + /* Don't use fence when front buffer rendering */ + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( BUF_3D_ID_COLOR_BACK | + BUF_3D_PITCH(dev_priv->back_pitch * dev_priv->cpp) ); + OUT_RING( tmp ); + + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( BUF_3D_ID_DEPTH | + BUF_3D_PITCH(dev_priv->depth_pitch * dev_priv->cpp)); + OUT_RING( dev_priv->zi1 ); + } else if(tmp == dev_priv->back_di1) { + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( BUF_3D_ID_COLOR_BACK | + BUF_3D_PITCH(dev_priv->back_pitch * dev_priv->cpp) | + BUF_3D_USE_FENCE); + OUT_RING( tmp ); + + OUT_RING( CMD_OP_DESTBUFFER_INFO ); + OUT_RING( BUF_3D_ID_DEPTH | BUF_3D_USE_FENCE | + BUF_3D_PITCH(dev_priv->depth_pitch * dev_priv->cpp)); + OUT_RING( dev_priv->zi1 ); + } else { + DRM_DEBUG("bad di1 %x (allow %x or %x)\n", + tmp, dev_priv->front_di1, dev_priv->back_di1); + } + + /* invarient: + */ + + + OUT_RING( GFX_OP_DESTBUFFER_VARS ); + OUT_RING( code[I830_DESTREG_DV1] ); + + OUT_RING( GFX_OP_DRAWRECT_INFO ); + OUT_RING( code[I830_DESTREG_DR1] ); + OUT_RING( code[I830_DESTREG_DR2] ); + OUT_RING( code[I830_DESTREG_DR3] ); + OUT_RING( code[I830_DESTREG_DR4] ); + + /* Need to verify this */ + tmp = code[I830_DESTREG_SENABLE]; + if((tmp & ~0x3) == GFX_OP_SCISSOR_ENABLE) { + OUT_RING( tmp ); + } else { + DRM_DEBUG("bad scissor enable\n"); + OUT_RING( 0 ); + } + + OUT_RING( code[I830_DESTREG_SENABLE] ); + + OUT_RING( GFX_OP_SCISSOR_RECT ); + OUT_RING( code[I830_DESTREG_SR1] ); + OUT_RING( code[I830_DESTREG_SR2] ); + + ADVANCE_LP_RING(); +} + +static void i830EmitState( drm_device_t *dev ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + + if (dirty & I830_UPLOAD_BUFFERS) { + i830EmitDestVerified( dev, sarea_priv->BufferState ); + sarea_priv->dirty &= ~I830_UPLOAD_BUFFERS; + } + + if (dirty & I830_UPLOAD_CTX) { + i830EmitContextVerified( dev, sarea_priv->ContextState ); + sarea_priv->dirty &= ~I830_UPLOAD_CTX; + } + + if (dirty & I830_UPLOAD_TEX0) { + i830EmitTexVerified( dev, sarea_priv->TexState[0] ); + sarea_priv->dirty &= ~I830_UPLOAD_TEX0; + } + + if (dirty & I830_UPLOAD_TEX1) { + i830EmitTexVerified( dev, sarea_priv->TexState[1] ); + sarea_priv->dirty &= ~I830_UPLOAD_TEX1; + } + + if (dirty & I830_UPLOAD_TEXBLEND0) { + i830EmitTexBlendVerified( dev, sarea_priv->TexBlendState[0], + sarea_priv->TexBlendStateWordsUsed[0]); + sarea_priv->dirty &= ~I830_UPLOAD_TEXBLEND0; + } + + if (dirty & I830_UPLOAD_TEXBLEND1) { + i830EmitTexBlendVerified( dev, sarea_priv->TexBlendState[1], + sarea_priv->TexBlendStateWordsUsed[1]); + sarea_priv->dirty &= ~I830_UPLOAD_TEXBLEND1; + } + + if (dirty & I830_UPLOAD_TEX_PALETTE_SHARED) { + i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 1); + } else { + if (dirty & I830_UPLOAD_TEX_PALETTE_N(0)) { + i830EmitTexPalette(dev, sarea_priv->Palette[0], 0, 0); + sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(0); + } + if (dirty & I830_UPLOAD_TEX_PALETTE_N(1)) { + i830EmitTexPalette(dev, sarea_priv->Palette[1], 1, 0); + sarea_priv->dirty &= ~I830_UPLOAD_TEX_PALETTE_N(1); + } + } +} + +static void i830_dma_dispatch_clear( drm_device_t *dev, int flags, + unsigned int clear_color, + unsigned int clear_zval, + unsigned int clear_depthmask) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int pitch = dev_priv->pitch; + int cpp = dev_priv->cpp; + int i; + unsigned int BR13, CMD, D_CMD; + RING_LOCALS; + + i830_kernel_lost_context(dev); + + switch(cpp) { + case 2: + BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24); + D_CMD = CMD = XY_COLOR_BLT_CMD; + break; + case 4: + BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24) | (1<<25); + CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA | + XY_COLOR_BLT_WRITE_RGB); + D_CMD = XY_COLOR_BLT_CMD; + if(clear_depthmask & 0x00ffffff) + D_CMD |= XY_COLOR_BLT_WRITE_RGB; + if(clear_depthmask & 0xff000000) + D_CMD |= XY_COLOR_BLT_WRITE_ALPHA; + break; + default: + BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24); + D_CMD = CMD = XY_COLOR_BLT_CMD; + break; + } + + if (nbox > I830_NR_SAREA_CLIPRECTS) + nbox = I830_NR_SAREA_CLIPRECTS; + + for (i = 0 ; i < nbox ; i++, pbox++) { + if (pbox->x1 > pbox->x2 || + pbox->y1 > pbox->y2 || + pbox->x2 > dev_priv->w || + pbox->y2 > dev_priv->h) + continue; + + if ( flags & I830_FRONT ) { + DRM_DEBUG("clear front\n"); + BEGIN_LP_RING( 6 ); + OUT_RING( CMD ); + OUT_RING( BR13 ); + OUT_RING( (pbox->y1 << 16) | pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | pbox->x2 ); + OUT_RING( 0 ); + OUT_RING( clear_color ); + ADVANCE_LP_RING(); + } + + if ( flags & I830_BACK ) { + DRM_DEBUG("clear back\n"); + BEGIN_LP_RING( 6 ); + OUT_RING( CMD ); + OUT_RING( BR13 ); + OUT_RING( (pbox->y1 << 16) | pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | pbox->x2 ); + OUT_RING( dev_priv->back_offset ); + OUT_RING( clear_color ); + ADVANCE_LP_RING(); + } + + if ( flags & I830_DEPTH ) { + DRM_DEBUG("clear depth\n"); + BEGIN_LP_RING( 6 ); + OUT_RING( D_CMD ); + OUT_RING( BR13 ); + OUT_RING( (pbox->y1 << 16) | pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | pbox->x2 ); + OUT_RING( dev_priv->depth_offset ); + OUT_RING( clear_zval ); + ADVANCE_LP_RING(); + } + } +} + +static void i830_dma_dispatch_swap( drm_device_t *dev ) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int pitch = dev_priv->pitch; + int cpp = dev_priv->cpp; + int ofs = dev_priv->back_offset; + int i; + unsigned int CMD, BR13; + RING_LOCALS; + + DRM_DEBUG("swapbuffers\n"); + + switch(cpp) { + case 2: + BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24); + CMD = XY_SRC_COPY_BLT_CMD; + break; + case 4: + BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24) | (1<<25); + CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + break; + default: + BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24); + CMD = XY_SRC_COPY_BLT_CMD; + break; + } + + i830_kernel_lost_context(dev); + + if (nbox > I830_NR_SAREA_CLIPRECTS) + nbox = I830_NR_SAREA_CLIPRECTS; + + for (i = 0 ; i < nbox; i++, pbox++) + { + if (pbox->x1 > pbox->x2 || + pbox->y1 > pbox->y2 || + pbox->x2 > dev_priv->w || + pbox->y2 > dev_priv->h) + continue; + + DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", + pbox->x1, pbox->y1, + pbox->x2, pbox->y2); + + BEGIN_LP_RING( 8 ); + OUT_RING( CMD ); + OUT_RING( BR13 ); + + OUT_RING( (pbox->y1 << 16) | + pbox->x1 ); + OUT_RING( (pbox->y2 << 16) | + pbox->x2 ); + + OUT_RING( 0 /* front ofs always zero */ ); + OUT_RING( (pbox->y1 << 16) | + pbox->x1 ); + + OUT_RING( BR13 & 0xffff ); + OUT_RING( ofs ); + + ADVANCE_LP_RING(); + } +} + + +static void i830_dma_dispatch_vertex(drm_device_t *dev, + drm_buf_t *buf, + int discard, + int used) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; + 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; + int i = 0, u; + RING_LOCALS; + + i830_kernel_lost_context(dev); + + if (nbox > I830_NR_SAREA_CLIPRECTS) + nbox = I830_NR_SAREA_CLIPRECTS; + + if (discard) { + u = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, + I830_BUF_HARDWARE); + if(u != I830_BUF_CLIENT) { + DRM_DEBUG("xxxx 2\n"); + } + } + + if (used > 4*1024) + used = 0; + + if (sarea_priv->dirty) + i830EmitState( dev ); + + DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", + address, used, nbox); + + dev_priv->counter++; + DRM_DEBUG( "dispatch counter : %ld\n", dev_priv->counter); + DRM_DEBUG( "i830_dma_dispatch\n"); + DRM_DEBUG( "start : %lx\n", start); + DRM_DEBUG( "used : %d\n", used); + DRM_DEBUG( "start + used - 4 : %ld\n", start + used - 4); + + if (buf_priv->currently_mapped == I830_BUF_MAPPED) { + *(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; + } + + i830_unmap_buffer(buf); + } + + if (used) { + do { + if (i < nbox) { + BEGIN_LP_RING(6); + OUT_RING( GFX_OP_DRAWRECT_INFO ); + OUT_RING( sarea_priv->BufferState[I830_DESTREG_DR1] ); + OUT_RING( box[i].x1 | (box[i].y1<<16) ); + OUT_RING( box[i].x2 | (box[i].y2<<16) ); + OUT_RING( sarea_priv->BufferState[I830_DESTREG_DR4] ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + } + + BEGIN_LP_RING(4); + + OUT_RING( MI_BATCH_BUFFER ); + OUT_RING( start | MI_BATCH_NON_SECURE ); + OUT_RING( start + used - 4 ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); + + } while (++i < nbox); + } + + BEGIN_LP_RING(10); + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( 20 ); + OUT_RING( dev_priv->counter ); + OUT_RING( 0 ); + + if (discard) { + OUT_RING( CMD_STORE_DWORD_IDX ); + OUT_RING( buf_priv->my_use_idx ); + OUT_RING( I830_BUF_FREE ); + OUT_RING( 0 ); + } + + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); +} + +/* Interrupts are only for flushing */ +void i830_dma_service(int irq, void *device, struct pt_regs *regs) +{ + drm_device_t *dev = (drm_device_t *)device; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u16 temp; + + temp = I830_READ16(I830REG_INT_IDENTITY_R); + temp = temp & ~(0x6000); + if(temp != 0) I830_WRITE16(I830REG_INT_IDENTITY_R, + temp); /* Clear all interrupts */ + else + return; + + queue_task(&dev->tq, &tq_immediate); + mark_bh(IMMEDIATE_BH); +} + +void DRM(dma_immediate_bh)(void *device) +{ + drm_device_t *dev = (drm_device_t *) device; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + + atomic_set(&dev_priv->flush_done, 1); + wake_up_interruptible(&dev_priv->flush_queue); +} + +static inline void i830_dma_emit_flush(drm_device_t *dev) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + i830_kernel_lost_context(dev); + + BEGIN_LP_RING(2); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( GFX_OP_USER_INTERRUPT ); + ADVANCE_LP_RING(); + + i830_wait_ring( dev, dev_priv->ring.Size - 8 ); + atomic_set(&dev_priv->flush_done, 1); + wake_up_interruptible(&dev_priv->flush_queue); +} + +static inline void i830_dma_quiescent_emit(drm_device_t *dev) +{ + drm_i830_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + + i830_kernel_lost_context(dev); + + BEGIN_LP_RING(4); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + OUT_RING( GFX_OP_USER_INTERRUPT ); + ADVANCE_LP_RING(); + + i830_wait_ring( dev, dev_priv->ring.Size - 8 ); + atomic_set(&dev_priv->flush_done, 1); + wake_up_interruptible(&dev_priv->flush_queue); +} + +void i830_dma_quiescent(drm_device_t *dev) +{ + DECLARE_WAITQUEUE(entry, current); + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + unsigned long end; + + if(dev_priv == NULL) { + return; + } + atomic_set(&dev_priv->flush_done, 0); + add_wait_queue(&dev_priv->flush_queue, &entry); + end = jiffies + (HZ*3); + + for (;;) { + current->state = TASK_INTERRUPTIBLE; + i830_dma_quiescent_emit(dev); + if (atomic_read(&dev_priv->flush_done) == 1) break; + 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; +} + +static int i830_flush_queue(drm_device_t *dev) +{ + DECLARE_WAITQUEUE(entry, current); + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + drm_device_dma_t *dma = dev->dma; + unsigned long end; + int i, ret = 0; + + if(dev_priv == NULL) { + return 0; + } + atomic_set(&dev_priv->flush_done, 0); + add_wait_queue(&dev_priv->flush_queue, &entry); + end = jiffies + (HZ*3); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + i830_dma_emit_flush(dev); + if (atomic_read(&dev_priv->flush_done) == 1) break; + 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); + + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + + int used = cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE, + I830_BUF_FREE); + + if (used == I830_BUF_HARDWARE) + DRM_DEBUG("reclaimed from HARDWARE\n"); + if (used == I830_BUF_CLIENT) + DRM_DEBUG("still on client HARDWARE\n"); + } + + return ret; +} + +/* Must be called with the lock held */ +void i830_reclaim_buffers(drm_device_t *dev, pid_t pid) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma) return; + if (!dev->dev_private) return; + if (!dma->buflist) return; + + i830_flush_queue(dev); + + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i830_buf_priv_t *buf_priv = buf->dev_private; + + if (buf->pid == pid && buf_priv) { + int used = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT, + I830_BUF_FREE); + + if (used == I830_BUF_CLIENT) + DRM_DEBUG("reclaimed from client\n"); + if(buf_priv->currently_mapped == I830_BUF_MAPPED) + buf_priv->currently_mapped = I830_BUF_UNMAPPED; + } + } +} + +int i830_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("i830_flush_ioctl\n"); + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_flush_ioctl called without lock held\n"); + return -EINVAL; + } + + i830_flush_queue(dev); + return 0; +} + +int i830_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_device_dma_t *dma = dev->dma; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) + dev_priv->sarea_priv; + drm_i830_vertex_t vertex; + + if (copy_from_user(&vertex, (drm_i830_vertex_t *)arg, sizeof(vertex))) + return -EFAULT; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_dma_vertex called without lock held\n"); + return -EINVAL; + } + + DRM_DEBUG("i830 dma vertex, idx %d used %d discard %d\n", + vertex.idx, vertex.used, vertex.discard); + + if(vertex.idx < 0 || vertex.idx > dma->buf_count) return -EINVAL; + + i830_dma_dispatch_vertex( dev, + dma->buflist[ vertex.idx ], + vertex.discard, vertex.used ); + + sarea_priv->last_enqueue = dev_priv->counter-1; + sarea_priv->last_dispatch = (int) hw_status[5]; + + return 0; +} + +int i830_clear_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_clear_t clear; + + if (copy_from_user(&clear, (drm_i830_clear_t *)arg, sizeof(clear))) + return -EFAULT; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_clear_bufs called without lock held\n"); + return -EINVAL; + } + + /* GH: Someone's doing nasty things... */ + if (!dev->dev_private) { + return -EINVAL; + } + + i830_dma_dispatch_clear( dev, clear.flags, + clear.clear_color, + clear.clear_depth, + clear.clear_depthmask); + return 0; +} + +int i830_swap_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + DRM_DEBUG("i830_swap_bufs\n"); + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_swap_buf called without lock held\n"); + return -EINVAL; + } + + i830_dma_dispatch_swap( dev ); + return 0; +} + +int i830_getage(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_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) + dev_priv->sarea_priv; + + sarea_priv->last_dispatch = (int) hw_status[5]; + return 0; +} + +int i830_getbuf(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 = 0; + drm_i830_dma_t d; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) + dev_priv->sarea_priv; + + DRM_DEBUG("getbuf\n"); + if (copy_from_user(&d, (drm_i830_dma_t *)arg, sizeof(d))) + return -EFAULT; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_dma called without lock held\n"); + return -EINVAL; + } + + d.granted = 0; + + retcode = i830_dma_get_buffer(dev, &d, filp); + + DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", + current->pid, retcode, d.granted); + + if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d))) + return -EFAULT; + sarea_priv->last_dispatch = (int) hw_status[5]; + + return retcode; +} + +int i830_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i830_copy_t d; + drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; + u32 *hw_status = (u32 *)dev_priv->hw_status_page; + drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) + dev_priv->sarea_priv; + drm_buf_t *buf; + drm_i830_buf_priv_t *buf_priv; + drm_device_dma_t *dma = dev->dma; + + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("i830_dma called without lock held\n"); + return -EINVAL; + } + + if (copy_from_user(&d, (drm_i830_copy_t *)arg, sizeof(d))) + return -EFAULT; + + if(d.idx < 0 || d.idx > dma->buf_count) return -EINVAL; + buf = dma->buflist[ d.idx ]; + buf_priv = buf->dev_private; + if (buf_priv->currently_mapped != I830_BUF_MAPPED) return -EPERM; + + if(d.used < 0 || d.used > buf->total) return -EINVAL; + + if (copy_from_user(buf_priv->virtual, d.address, d.used)) + return -EFAULT; + + sarea_priv->last_dispatch = (int) hw_status[5]; + + return 0; +} + +int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + if(VM_DONTCOPY == 0) return 1; + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drm.h:1.1 --- /dev/null Fri Jan 18 15:26:06 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drm.h Thu Oct 4 14:28:22 2001 @@ -0,0 +1,238 @@ +#ifndef _I830_DRM_H_ +#define _I830_DRM_H_ + +/* WARNING: These defines must be the same as what the Xserver uses. + * if you change them, you must change the defines in the Xserver. + */ + +#ifndef _I830_DEFINES_ +#define _I830_DEFINES_ + +#define I830_DMA_BUF_ORDER 12 +#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER) +#define I830_DMA_BUF_NR 256 +#define I830_NR_SAREA_CLIPRECTS 8 + +/* Each region is a minimum of 64k, and there are at most 64 of them. + */ +#define I830_NR_TEX_REGIONS 64 +#define I830_LOG_MIN_TEX_REGION_SIZE 16 + +/* if defining I830_ENABLE_4_TEXTURES, do it in i830_3d_reg.h, too */ +#if !defined(I830_ENABLE_4_TEXTURES) +#define I830_TEXTURE_COUNT 2 +#define I830_TEXBLEND_COUNT 2 /* always same as TEXTURE_COUNT? */ +#else /* defined(I830_ENABLE_4_TEXTURES) */ +#define I830_TEXTURE_COUNT 4 +#define I830_TEXBLEND_COUNT 4 /* always same as TEXTURE_COUNT? */ +#endif /* I830_ENABLE_4_TEXTURES */ + +#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ + +#define I830_UPLOAD_CTX 0x1 +#define I830_UPLOAD_BUFFERS 0x2 +#define I830_UPLOAD_CLIPRECTS 0x4 +#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */ +#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */ +#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */ +#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */ +#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */ +#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */ +#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */ +#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */ +#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2)) +#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2)) +#define I830_UPLOAD_TEXIMAGE_MASK 0xff00 +#define I830_UPLOAD_TEX0 0x10000 +#define I830_UPLOAD_TEX1 0x20000 +#define I830_UPLOAD_TEX2 0x40000 +#define I830_UPLOAD_TEX3 0x80000 +#define I830_UPLOAD_TEX_N(n) (0x10000 << (n)) +#define I830_UPLOAD_TEX_MASK 0xf0000 +#define I830_UPLOAD_TEXBLEND0 0x100000 +#define I830_UPLOAD_TEXBLEND1 0x200000 +#define I830_UPLOAD_TEXBLEND2 0x400000 +#define I830_UPLOAD_TEXBLEND3 0x800000 +#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n)) +#define I830_UPLOAD_TEXBLEND_MASK 0xf00000 +#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) +#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 + +/* Indices into buf.Setup where various bits of state are mirrored per + * context and per buffer. These can be fired at the card as a unit, + * or in a piecewise fashion as required. + */ + +/* Destbuffer state + * - backbuffer linear offset and pitch -- invarient in the current dri + * - zbuffer linear offset and pitch -- also invarient + * - drawing origin in back and depth buffers. + * + * Keep the depth/back buffer state here to acommodate private buffers + * in the future. + */ + +#define I830_DESTREG_CBUFADDR 0 +/* Invarient */ +#define I830_DESTREG_DBUFADDR 1 +#define I830_DESTREG_DV0 2 +#define I830_DESTREG_DV1 3 +#define I830_DESTREG_SENABLE 4 +#define I830_DESTREG_SR0 5 +#define I830_DESTREG_SR1 6 +#define I830_DESTREG_SR2 7 +#define I830_DESTREG_DR0 8 +#define I830_DESTREG_DR1 9 +#define I830_DESTREG_DR2 10 +#define I830_DESTREG_DR3 11 +#define I830_DESTREG_DR4 12 +#define I830_DEST_SETUP_SIZE 13 + +/* Context state + */ +#define I830_CTXREG_STATE1 0 +#define I830_CTXREG_STATE2 1 +#define I830_CTXREG_STATE3 2 +#define I830_CTXREG_STATE4 3 +#define I830_CTXREG_STATE5 4 +#define I830_CTXREG_IALPHAB 5 +#define I830_CTXREG_STENCILTST 6 +#define I830_CTXREG_ENABLES_1 7 +#define I830_CTXREG_ENABLES_2 8 +#define I830_CTXREG_AA 9 +#define I830_CTXREG_FOGCOLOR 10 +#define I830_CTXREG_BLENDCOLR0 11 +#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */ +#define I830_CTXREG_VF 13 +#define I830_CTXREG_VF2 14 +#define I830_CTXREG_MCSB0 15 +#define I830_CTXREG_MCSB1 16 +#define I830_CTX_SETUP_SIZE 17 + +/* Texture state (per tex unit) + */ + +#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */ +#define I830_TEXREG_MI1 1 +#define I830_TEXREG_MI2 2 +#define I830_TEXREG_MI3 3 +#define I830_TEXREG_MI4 4 +#define I830_TEXREG_MI5 5 +#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */ +#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */ +#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */ +#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ +#define I830_TEX_SETUP_SIZE 10 + +#define I830_FRONT 0x1 +#define I830_BACK 0x2 +#define I830_DEPTH 0x4 + +#endif /* _I830_DEFINES_ */ + +typedef struct _drm_i830_init { + enum { + I830_INIT_DMA = 0x01, + I830_CLEANUP_DMA = 0x02 + } func; + unsigned int mmio_offset; + unsigned int buffers_offset; + int sarea_priv_offset; + unsigned int ring_start; + unsigned int ring_end; + unsigned int ring_size; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; + unsigned int back_pitch; + unsigned int depth_pitch; + unsigned int cpp; +} drm_i830_init_t; + +/* Warning: If you change the SAREA structure you must change the Xserver + * structure as well */ + +typedef struct _drm_i830_tex_region { + 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 */ +} drm_i830_tex_region_t; + +typedef struct _drm_i830_sarea { + unsigned int ContextState[I830_CTX_SETUP_SIZE]; + unsigned int BufferState[I830_DEST_SETUP_SIZE]; + unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE]; + unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE]; + unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT]; + unsigned int Palette[2][256]; + unsigned int dirty; + + unsigned int nbox; + drm_clip_rect_t boxes[I830_NR_SAREA_CLIPRECTS]; + + /* 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. + */ + + drm_i830_tex_region_t texList[I830_NR_TEX_REGIONS+1]; + /* Last elt is sentinal */ + int texAge; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + int ctxOwner; /* last context to upload state */ + + int vertex_prim; +} drm_i830_sarea_t; + +typedef struct _drm_i830_clear { + int clear_color; + int clear_depth; + int flags; + unsigned int clear_colormask; + unsigned int clear_depthmask; +} drm_i830_clear_t; + + + +/* These may be placeholders if we have more cliprects than + * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to + * false, indicating that the buffer will be dispatched again with a + * new set of cliprects. + */ +typedef struct _drm_i830_vertex { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + int discard; /* client is finished with the buffer? */ +} drm_i830_vertex_t; + +typedef struct _drm_i830_copy_t { + int idx; /* buffer index */ + int used; /* nr bytes in use */ + void *address; /* Address to copy from */ +} drm_i830_copy_t; + +typedef struct drm_i830_dma { + void *virtual; + int request_idx; + int request_size; + int granted; +} drm_i830_dma_t; + +#endif /* _I830_DRM_H_ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.c:1.1 --- /dev/null Fri Jan 18 15:26:06 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.c Thu Oct 4 14:28:22 2001 @@ -0,0 +1,102 @@ +/* i830_drv.c -- I810 driver -*- linux-c -*- + * Created: Mon Dec 13 01:56:22 1999 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 + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * Abraham vd Merwe <abraham@2d3d.co.za> + */ + +#include <linux/config.h> +#include "i830.h" +#include "drmP.h" +#include "i830_drv.h" + +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "i830" +#define DRIVER_DESC "Intel 830M" +#define DRIVER_DATE "20011004" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 2 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_INIT)] = { i830_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_VERTEX)] = { i830_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_CLEAR)] = { i830_clear_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_FLUSH)] = { i830_flush_ioctl, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_GETAGE)] = { i830_getage, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_GETBUF)] = { i830_getbuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_SWAP)] = { i830_swap_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_COPY)] = { i830_copybuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I830_DOCOPY)] = { i830_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" + +#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. + */ + +/* JH- We have to hand expand the string ourselves because of the cpp. If + * anyone can think of a way that we can fit into the __setup macro without + * changing it, then please send the solution my way. + */ +static int __init i830_options( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", i830_options ); +#endif + +#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/i830_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.h:1.1 --- /dev/null Fri Jan 18 15:26:06 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_drv.h Thu Oct 4 14:28:22 2001 @@ -0,0 +1,213 @@ +/* i830_drv.h -- Private header for the I830 driver -*- linux-c -*- + * Created: Mon Dec 13 01:50:01 1999 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> + * + */ + +#ifndef _I830_DRV_H_ +#define _I830_DRV_H_ + +typedef struct drm_i830_buf_priv { + u32 *in_use; + int my_use_idx; + int currently_mapped; + void *virtual; + void *kernel_virtual; + int map_count; + struct vm_area_struct *vma; +} drm_i830_buf_priv_t; + +typedef struct _drm_i830_ring_buffer{ + int tail_mask; + unsigned long Start; + unsigned long End; + unsigned long Size; + u8 *virtual_start; + int head; + int tail; + int space; +} drm_i830_ring_buffer_t; + +typedef struct drm_i830_private { + drm_map_t *sarea_map; + drm_map_t *buffer_map; + drm_map_t *mmio_map; + + drm_i830_sarea_t *sarea_priv; + drm_i830_ring_buffer_t ring; + + unsigned long hw_status_page; + unsigned long counter; + + atomic_t flush_done; + 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; + int back_pitch; + int depth_pitch; + unsigned int cpp; +} drm_i830_private_t; + + /* i830_dma.c */ +extern int i830_dma_schedule(drm_device_t *dev, int locked); +extern int i830_getbuf(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i830_dma_init(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i830_flush_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern void i830_reclaim_buffers(drm_device_t *dev, pid_t pid); +extern int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma); +extern int i830_copybuf(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int i830_docopy(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern void i830_dma_quiescent(drm_device_t *dev); + +extern int i830_dma_vertex(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern int i830_swap_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern int i830_clear_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +#define I830_VERBOSE 0 + +#define I830_BASE(reg) ((unsigned long) \ + dev_priv->mmio_map->handle) +#define I830_ADDR(reg) (I830_BASE(reg) + reg) +#define I830_DEREF(reg) *(__volatile__ int *)I830_ADDR(reg) +#define I830_READ(reg) I830_DEREF(reg) +#define I830_WRITE(reg,val) do { I830_DEREF(reg) = val; } while (0) +#define I830_DEREF16(reg) *(__volatile__ u16 *)I830_ADDR(reg) +#define I830_READ16(reg) I830_DEREF16(reg) +#define I830_WRITE16(reg,val) do { I830_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) +#define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1) +#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1) + +#define INST_PARSER_CLIENT 0x00000000 +#define INST_OP_FLUSH 0x02000000 +#define INST_FLUSH_MAP_CACHE 0x00000001 + + +#define BB1_START_ADDR_MASK (~0x7) +#define BB1_PROTECTED (1<<0) +#define BB1_UNPROTECTED (0<<0) +#define BB2_END_ADDR_MASK (~0x7) + +#define I830REG_HWSTAM 0x02098 +#define I830REG_INT_IDENTITY_R 0x020a4 +#define I830REG_INT_MASK_R 0x020a8 +#define I830REG_INT_ENABLE_R 0x020a0 + +#define LP_RING 0x2030 +#define HP_RING 0x2040 +#define RING_TAIL 0x00 +#define TAIL_ADDR 0x000FFFF8 +#define RING_HEAD 0x04 +#define HEAD_WRAP_COUNT 0xFFE00000 +#define HEAD_WRAP_ONE 0x00200000 +#define HEAD_ADDR 0x001FFFFC +#define RING_START 0x08 +#define START_ADDR 0x00FFFFF8 +#define RING_LEN 0x0C +#define RING_NR_PAGES 0x000FF000 +#define RING_REPORT_MASK 0x00000006 +#define RING_REPORT_64K 0x00000002 +#define RING_REPORT_128K 0x00000004 +#define RING_NO_REPORT 0x00000000 +#define RING_VALID_MASK 0x00000001 +#define RING_VALID 0x00000001 +#define RING_INVALID 0x00000000 + +#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19)) +#define SC_UPDATE_SCISSOR (0x1<<1) +#define SC_ENABLE_MASK (0x1<<0) +#define SC_ENABLE (0x1<<0) + +#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1)) +#define SCI_YMIN_MASK (0xffff<<16) +#define SCI_XMIN_MASK (0xffff<<0) +#define SCI_YMAX_MASK (0xffff<<16) +#define SCI_XMAX_MASK (0xffff<<0) + +#define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19)) +#define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1) +#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0) +#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) +#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4) +#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0) +#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) +#define GFX_OP_PRIMITIVE ((0x3<<29)|(0x1f<<24)) + +#define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) + + +#define BR00_BITBLT_CLIENT 0x40000000 +#define BR00_OP_COLOR_BLT 0x10000000 +#define BR00_OP_SRC_COPY_BLT 0x10C00000 +#define BR13_SOLID_PATTERN 0x80000000 + +#define BUF_3D_ID_COLOR_BACK (0x3<<24) +#define BUF_3D_ID_DEPTH (0x7<<24) +#define BUF_3D_USE_FENCE (1<<23) +#define BUF_3D_PITCH(x) (((x)/4)<<2) + +#define CMD_OP_MAP_PALETTE_LOAD ((3<<29)|(0x1d<<24)|(0x82<<16)|255) +#define MAP_PALETTE_NUM(x) ((x<<8) & (1<<8)) +#define MAP_PALETTE_BOTH (1<<11) + +#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4) +#define XY_COLOR_BLT_WRITE_ALPHA (1<<21) +#define XY_COLOR_BLT_WRITE_RGB (1<<20) + +#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) +#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) +#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) + +#define MI_BATCH_BUFFER ((0x30<<23)|1) +#define MI_BATCH_NON_SECURE (1) + + +#endif + 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.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c:1.11 Tue Apr 10 12:08:04 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c Fri Aug 17 22:51:17 2001 @@ -292,10 +292,9 @@ } #endif -static int mga_freelist_init( drm_device_t *dev ) +static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv ) { 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; @@ -458,7 +457,6 @@ 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) ); @@ -497,14 +495,63 @@ break; } } + if(!dev_priv->sarea) { + DRM_ERROR( "failed to find sarea!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR( "failed to find framebuffer!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR( "failed to find mmio region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->status, init->status_offset ); + if(!dev_priv->status) { + DRM_ERROR( "failed to find status page!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->warp, init->warp_offset ); + if(!dev_priv->warp) { + DRM_ERROR( "failed to find warp microcode region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->primary, init->primary_offset ); + if(!dev_priv->primary) { + DRM_ERROR( "failed to find primary dma region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR( "failed to find dma buffer region!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return -EINVAL; + } dev_priv->sarea_priv = (drm_mga_sarea_t *)((u8 *)dev_priv->sarea->handle + @@ -514,16 +561,30 @@ DRM_IOREMAP( dev_priv->primary ); DRM_IOREMAP( dev_priv->buffers ); - ret = mga_warp_install_microcode( dev ); + if(!dev_priv->warp->handle || + !dev_priv->primary->handle || + !dev_priv->buffers->handle ) { + DRM_ERROR( "failed to ioremap agp regions!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; + mga_do_cleanup_dma( dev ); + return -ENOMEM; + } + + ret = mga_warp_install_microcode( dev_priv ); if ( ret < 0 ) { DRM_ERROR( "failed to install WARP ucode!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; mga_do_cleanup_dma( dev ); return ret; } - ret = mga_warp_init( dev ); + ret = mga_warp_init( dev_priv ); if ( ret < 0 ) { DRM_ERROR( "failed to init WARP engine!\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; mga_do_cleanup_dma( dev ); return ret; } @@ -566,12 +627,16 @@ dev_priv->sarea_priv->last_frame.head = 0; dev_priv->sarea_priv->last_frame.wrap = 0; - if ( mga_freelist_init( dev ) < 0 ) { + if ( mga_freelist_init( dev, dev_priv ) < 0 ) { DRM_ERROR( "could not initialize freelist\n" ); + /* Assign dev_private so we can do cleanup. */ + dev->dev_private = (void *)dev_priv; mga_do_cleanup_dma( dev ); return -ENOMEM; } + /* Make dev_private visable to others. */ + dev->dev_private = (void *)dev_priv; return 0; } 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.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c:1.11 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c Fri Aug 17 22:51:18 2001 @@ -70,6 +70,27 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" + +#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. + */ + +/* JH- We have to hand expand the string ourselves because of the cpp. If + * anyone can think of a way that we can fit into the __setup macro without + * changing it, then please send the solution my way. + */ +static int __init mga_options( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", mga_options ); +#endif + + #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.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.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h:1.10 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h Fri Aug 17 22:51:18 2001 @@ -139,20 +139,34 @@ 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 ); +extern int mga_warp_install_microcode( drm_mga_private_t *dev_priv ); +extern int mga_warp_init( drm_mga_private_t *dev_priv ); #define mga_flush_write_combine() mb() -#define MGA_BASE( reg ) ((u32)(dev_priv->mmio->handle)) +#define MGA_BASE( reg ) ((unsigned long)(dev_priv->mmio->handle)) #define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) #define MGA_DEREF( reg ) *(volatile u32 *)MGA_ADDR( reg ) +#define MGA_DEREF8( reg ) *(volatile u8 *)MGA_ADDR( reg ) + +#ifdef __alpha__ +#define MGA_READ( reg ) (_MGA_READ((u32 *)MGA_ADDR(reg))) +#define MGA_WRITE( reg, val ) do { wmb(); MGA_DEREF( reg ) = val; } while (0) +#define MGA_WRITE8( reg, val ) do { wmb(); MGA_DEREF8( reg ) = val; } while (0) + +static inline u32 _MGA_READ(u32 *addr) +{ + mb(); + return *(volatile u32 *)addr; +} + +#else #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) +#endif #define DWGREG0 0x1c00 #define DWGREG0_END 0x1dff 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.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c:1.11 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c Fri Aug 17 22:51:18 2001 @@ -943,6 +943,7 @@ sizeof(vertex) ) ) return -EFAULT; + if(vertex.idx < 0 || vertex.idx > dma->buf_count) return -EINVAL; buf = dma->buflist[vertex.idx]; buf_priv = buf->dev_private; @@ -984,6 +985,8 @@ sizeof(indices) ) ) return -EFAULT; + if(indices.idx < 0 || indices.idx > dma->buf_count) return -EINVAL; + buf = dma->buflist[indices.idx]; buf_priv = buf->dev_private; @@ -1030,6 +1033,7 @@ return -EBUSY; } #endif + if(iload.idx < 0 || iload.idx > dma->buf_count) return -EINVAL; buf = dma->buflist[iload.idx]; buf_priv = buf->dev_private; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c:1.1 Wed Mar 21 13:08:56 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c Fri Aug 17 22:51:18 2001 @@ -160,11 +160,8 @@ return 0; } -int mga_warp_install_microcode( drm_device_t *dev ) +int mga_warp_install_microcode( drm_mga_private_t *dev_priv ) { - 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 ); @@ -177,11 +174,9 @@ #define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) -int mga_warp_init( drm_device_t *dev ) +int mga_warp_init( drm_mga_private_t *dev_priv ) { - drm_mga_private_t *dev_priv = dev->dev_private; u32 wmisc; - DRM_DEBUG( "%s\n", __FUNCTION__ ); /* FIXME: Get rid of these damned magic numbers... */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c:1.6 Wed Nov 8 00:03:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c Wed Jan 16 10:36:43 2002 @@ -22,14 +22,9 @@ #define CONFIG_AGP 0 #endif -#ifndef CONFIG_FB_SIS -#define CONFIG_FB_SIS 0 -#endif - SMP = CONFIG_SMP MODULES = CONFIG_MODULES MODVERSIONS = CONFIG_MODVERSIONS AGP = CONFIG_AGP AGP_MODULE = CONFIG_AGP_MODULE RELEASE = UTS_RELEASE -SIS = CONFIG_FB_SIS 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.5.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c:1.5.2.1 Wed May 23 14:58:00 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c Tue Oct 2 07:44:17 2001 @@ -314,9 +314,9 @@ return 0; } -static void r128_cce_init_ring_buffer( drm_device_t *dev ) +static void r128_cce_init_ring_buffer( drm_device_t *dev, + drm_r128_private_t *dev_priv ) { - drm_r128_private_t *dev_priv = dev->dev_private; u32 ring_start; u32 tmp; @@ -351,11 +351,10 @@ 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 ); + entry->busaddr[page_ofs]); + DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", + entry->busaddr[page_ofs], + entry->handle + tmp_ofs ); } /* Set watermark control */ @@ -383,17 +382,15 @@ dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); if ( dev_priv == NULL ) return -ENOMEM; - dev->dev_private = (void *)dev_priv; memset( dev_priv, 0, sizeof(drm_r128_private_t) ); dev_priv->is_pci = init->is_pci; if ( dev_priv->is_pci && !dev->sg ) { - DRM_DEBUG( "PCI GART memory not allocated!\n" ); DRM_ERROR( "PCI GART memory not allocated!\n" ); - DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); - dev->dev_private = NULL; + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); return -EINVAL; } @@ -401,8 +398,8 @@ if ( dev_priv->usec_timeout < 1 || dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { DRM_DEBUG( "TIMEOUT problem!\n" ); - DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); - dev->dev_private = NULL; + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); return -EINVAL; } @@ -421,8 +418,8 @@ ( init->cce_mode != R128_PM4_64BM_128INDBM ) && ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { DRM_DEBUG( "Bad cce_mode!\n" ); - DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); - dev->dev_private = NULL; + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); return -EINVAL; } @@ -494,16 +491,58 @@ break; } } + if(!dev_priv->sarea) { + DRM_ERROR("could not find sarea!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR("could not find framebuffer!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR("could not find mmio region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); + if(!dev_priv->cce_ring) { + DRM_ERROR("could not find cce ring region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + if(!dev_priv->ring_rptr) { + DRM_ERROR("could not find ring read pointer!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR("could not find dma buffer region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -EINVAL; + } if ( !dev_priv->is_pci ) { DRM_FIND_MAP( dev_priv->agp_textures, init->agp_textures_offset ); + if(!dev_priv->agp_textures) { + DRM_ERROR("could not find agp texture region!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -EINVAL; + } } dev_priv->sarea_priv = @@ -514,6 +553,14 @@ DRM_IOREMAP( dev_priv->cce_ring ); DRM_IOREMAP( dev_priv->ring_rptr ); DRM_IOREMAP( dev_priv->buffers ); + if(!dev_priv->cce_ring->handle || + !dev_priv->ring_rptr->handle || + !dev_priv->buffers->handle) { + DRM_ERROR("Could not ioremap agp regions!\n"); + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -ENOMEM; + } } else { dev_priv->cce_ring->handle = (void *)dev_priv->cce_ring->offset; @@ -551,21 +598,21 @@ 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" ); + if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, + &dev_priv->bus_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; + dev->dev_private = (void *)dev_priv; + r128_do_cleanup_cce( dev ); + return -ENOMEM; } - R128_WRITE( R128_PCI_GART_PAGE, - virt_to_bus( (void *)dev_priv->phys_pci_gart ) ); + R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart ); } - r128_cce_init_ring_buffer( dev ); + r128_cce_init_ring_buffer( dev, dev_priv ); r128_cce_load_microcode( dev_priv ); + + dev->dev_private = (void *)dev_priv; + r128_do_engine_reset( dev ); return 0; @@ -580,6 +627,11 @@ DRM_IOREMAPFREE( dev_priv->cce_ring ); DRM_IOREMAPFREE( dev_priv->ring_rptr ); DRM_IOREMAPFREE( dev_priv->buffers ); + } else { + if (!DRM(ati_pcigart_cleanup)( dev, + dev_priv->phys_pci_gart, + dev_priv->bus_pci_gart )) + DRM_ERROR( "failed to cleanup PCI GART!\n" ); } DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), 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.13 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c:1.16 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c:1.13 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c Mon Nov 26 16:46:38 2001 @@ -39,11 +39,11 @@ #define DRIVER_NAME "r128" #define DRIVER_DESC "ATI Rage 128" -#define DRIVER_DATE "20010405" +#define DRIVER_DATE "20010917" #define DRIVER_MAJOR 2 -#define DRIVER_MINOR 1 -#define DRIVER_PATCHLEVEL 6 +#define DRIVER_MINOR 2 +#define DRIVER_PATCHLEVEL 0 #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \ @@ -81,6 +81,26 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" + +#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. + */ + +/* JH- We have to hand expand the string ourselves because of the cpp. If + * anyone can think of a way that we can fit into the __setup macro without + * changing it, then please send the solution my way. + */ +static int __init r128_options( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", r128_options ); +#endif + #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.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.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h:1.11 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h Fri Aug 17 22:51:18 2001 @@ -72,6 +72,7 @@ int usec_timeout; int is_pci; unsigned long phys_pci_gart; + dma_addr_t bus_pci_gart; unsigned long cce_buffers_offset; atomic_t idle_count; 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.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c:1.5 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c Tue Oct 2 07:44:17 2001 @@ -910,7 +910,7 @@ return -EFAULT; } - buffer = kmalloc( depth->n * sizeof(u32), 0 ); + buffer = kmalloc( depth->n * sizeof(u32), GFP_KERNEL ); if ( buffer == NULL ) return -ENOMEM; if ( copy_from_user( buffer, depth->buffer, @@ -920,7 +920,7 @@ } if ( depth->mask ) { - mask = kmalloc( depth->n * sizeof(u8), 0 ); + mask = kmalloc( depth->n * sizeof(u8), GFP_KERNEL ); if ( mask == NULL ) { kfree( buffer ); return -ENOMEM; @@ -997,11 +997,11 @@ count = depth->n; - x = kmalloc( count * sizeof(*x), 0 ); + x = kmalloc( count * sizeof(*x), GFP_KERNEL ); if ( x == NULL ) { return -ENOMEM; } - y = kmalloc( count * sizeof(*y), 0 ); + y = kmalloc( count * sizeof(*y), GFP_KERNEL ); if ( y == NULL ) { kfree( x ); return -ENOMEM; @@ -1017,7 +1017,7 @@ return -EFAULT; } - buffer = kmalloc( depth->n * sizeof(u32), 0 ); + buffer = kmalloc( depth->n * sizeof(u32), GFP_KERNEL ); if ( buffer == NULL ) { kfree( x ); kfree( y ); @@ -1032,7 +1032,7 @@ } if ( depth->mask ) { - mask = kmalloc( depth->n * sizeof(u8), 0 ); + mask = kmalloc( depth->n * sizeof(u8), GFP_KERNEL ); if ( mask == NULL ) { kfree( x ); kfree( y ); @@ -1157,11 +1157,11 @@ count = dev_priv->depth_pitch; } - x = kmalloc( count * sizeof(*x), 0 ); + x = kmalloc( count * sizeof(*x), GFP_KERNEL ); if ( x == NULL ) { return -ENOMEM; } - y = kmalloc( count * sizeof(*y), 0 ); + y = kmalloc( count * sizeof(*y), GFP_KERNEL ); if ( y == NULL ) { kfree( x ); return -ENOMEM; @@ -1519,10 +1519,75 @@ { 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; + drm_buf_t *buf; + drm_r128_buf_priv_t *buf_priv; + drm_r128_indirect_t indirect; +#if 0 + RING_LOCALS; +#endif LOCK_TEST_WITH_RETURN( dev ); - /* Indirect buffer firing is not supported at this time. + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &indirect, (drm_r128_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; + +#if 0 + /* Wait for the 3D stream to idle before the indirect buffer + * containing 2D acceleration commands is processed. */ - return -EINVAL; + BEGIN_RING( 2 ); + RADEON_WAIT_UNTIL_3D_IDLE(); + ADVANCE_RING(); +#endif + + /* Dispatch the indirect buffer full of commands from the + * X server. This is insecure and is thus only available to + * privileged clients. + */ + r128_cce_dispatch_indirect( dev, buf, indirect.start, indirect.end ); + + return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_bufs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_bufs.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_bufs.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_bufs.c:1.1 Sun Jan 7 20:07:39 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_bufs.c Fri Jan 18 15:26:07 2002 @@ -1,298 +0,0 @@ -/* 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 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c:1.4.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c:1.4.2.1 Thu May 31 04:36:15 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c Tue Oct 2 07:44:17 2001 @@ -543,8 +543,7 @@ RADEON_SOFT_RESET_RE | RADEON_SOFT_RESET_PP | RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB | - RADEON_SOFT_RESET_HDP ) ); + RADEON_SOFT_RESET_RB ) ); RADEON_READ( RADEON_RBBM_SOFT_RESET ); RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset & ~( RADEON_SOFT_RESET_CP | @@ -553,8 +552,7 @@ RADEON_SOFT_RESET_RE | RADEON_SOFT_RESET_PP | RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB | - RADEON_SOFT_RESET_HDP ) ) ); + RADEON_SOFT_RESET_RB ) ) ); RADEON_READ( RADEON_RBBM_SOFT_RESET ); @@ -574,12 +572,11 @@ return 0; } -static void radeon_cp_init_ring_buffer( drm_device_t *dev ) +static void radeon_cp_init_ring_buffer( drm_device_t *dev, + drm_radeon_private_t *dev_priv ) { - 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, @@ -625,10 +622,9 @@ 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->busaddr[page_ofs]); + DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", + entry->busaddr[page_ofs], entry->handle + tmp_ofs ); } @@ -659,7 +655,6 @@ 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) ); @@ -670,16 +665,16 @@ */ 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; + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); 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; + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); return -EINVAL; } @@ -687,8 +682,8 @@ 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; + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); return -EINVAL; } @@ -705,8 +700,8 @@ 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; + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); return -EINVAL; } @@ -782,16 +777,58 @@ break; } } + if(!dev_priv->sarea) { + DRM_ERROR("could not find sarea!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + if(!dev_priv->fb) { + DRM_ERROR("could not find framebuffer!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + if(!dev_priv->mmio) { + DRM_ERROR("could not find mmio region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset ); + if(!dev_priv->cp_ring) { + DRM_ERROR("could not find cp ring region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + if(!dev_priv->ring_rptr) { + DRM_ERROR("could not find ring read pointer!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -EINVAL; + } DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + if(!dev_priv->buffers) { + DRM_ERROR("could not find dma buffer region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -EINVAL; + } if ( !dev_priv->is_pci ) { DRM_FIND_MAP( dev_priv->agp_textures, init->agp_textures_offset ); + if(!dev_priv->agp_textures) { + DRM_ERROR("could not find agp texture region!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -EINVAL; + } } dev_priv->sarea_priv = @@ -802,6 +839,14 @@ DRM_IOREMAP( dev_priv->cp_ring ); DRM_IOREMAP( dev_priv->ring_rptr ); DRM_IOREMAP( dev_priv->buffers ); + if(!dev_priv->cp_ring->handle || + !dev_priv->ring_rptr->handle || + !dev_priv->buffers->handle) { + DRM_ERROR("could not find ioremap agp regions!\n"); + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -EINVAL; + } } else { dev_priv->cp_ring->handle = (void *)dev_priv->cp_ring->offset; @@ -881,13 +926,12 @@ 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 ) { + if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, + &dev_priv->bus_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; + dev->dev_private = (void *)dev_priv; + radeon_do_cleanup_cp(dev); + return -ENOMEM; } /* Turn on PCI GART */ @@ -897,8 +941,7 @@ /* set PCI GART page-table base address */ - RADEON_WRITE( RADEON_AIC_PT_BASE, - virt_to_bus( (void *)dev_priv->phys_pci_gart ) ); + RADEON_WRITE( RADEON_AIC_PT_BASE, dev_priv->bus_pci_gart ); /* set address range for PCI address translate */ @@ -919,13 +962,16 @@ } radeon_cp_load_microcode( dev_priv ); - radeon_cp_init_ring_buffer( dev ); - radeon_do_engine_reset( dev ); + radeon_cp_init_ring_buffer( dev, dev_priv ); #if ROTATE_BUFS dev_priv->last_buf = 0; #endif + dev->dev_private = (void *)dev_priv; + + radeon_do_engine_reset( dev ); + return 0; } @@ -940,6 +986,11 @@ DRM_IOREMAPFREE( dev_priv->cp_ring ); DRM_IOREMAPFREE( dev_priv->ring_rptr ); DRM_IOREMAPFREE( dev_priv->buffers ); + } else { + if (!DRM(ati_pcigart_cleanup)( dev, + dev_priv->phys_pci_gart, + dev_priv->bus_pci_gart )) + DRM_ERROR( "failed to cleanup PCI GART!\n" ); } DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t), Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c:1.3 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c Fri Aug 17 22:51:19 2001 @@ -78,6 +78,26 @@ #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" + +#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. + */ + +/* JH- We have to hand expand the string ourselves because of the cpp. If + * anyone can think of a way that we can fit into the __setup macro without + * changing it, then please send the solution my way. + */ +static int __init radeon_options( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", radeon_options ); +#endif + #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h:1.4 Wed May 2 11:06:10 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h Fri Aug 17 22:51:19 2001 @@ -84,6 +84,7 @@ int usec_timeout; int is_pci; unsigned long phys_pci_gart; + dma_addr_t bus_pci_gart; atomic_t idle_count; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c:1.3 Tue Apr 10 12:08:05 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c Mon Jan 7 16:44:36 2002 @@ -1058,7 +1058,7 @@ DRM_ERROR( "EFAULT on tex->image\n" ); return -EFAULT; } - } else if ( size < 4 ) { + } else if ( size < 4 && size > 0 ) { size = 4; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h:1.1.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h:1.1.2.1 Tue May 22 17:54:54 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h Wed Dec 19 16:25:59 2001 @@ -24,7 +24,7 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h,v 1.2 2001/12/19 21:25:59 dawes Exp $ */ #ifndef __SIS_H__ #define __SIS_H__ @@ -46,5 +46,11 @@ */ #define DRIVER_AGP_BUFFERS_MAP( dev ) \ ((drm_sis_private_t *)((dev)->dev_private))->buffers + +extern int sis_init_context(int context); +extern int sis_final_context(int context); + +#define DRIVER_CTX_CTOR sis_init_context +#define DRIVER_CTX_DTOR sis_final_context #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.10.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c:1.10.2.1 Tue May 22 17:25:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c Thu Jan 10 14:05:41 2002 @@ -40,12 +40,12 @@ #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 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 0 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 0 }, \ /* 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 } + [DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sisp_agp_init, 1, 0 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sisp_agp_alloc, 1, 0 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sisp_agp_free, 1, 0 } #if 0 /* these don't appear to be defined */ /* SIS Stereo */ [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 }, Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c:1.3 Tue Sep 26 12:21:25 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c Wed Jan 16 10:36:43 2002 @@ -33,7 +33,7 @@ #include <linux/delay.h> #include <linux/errno.h> #include <linux/kernel.h> -#include <linux/malloc.h> +#include <linux/slab.h> #include <linux/poll.h> #include <asm/io.h> #include <linux/pci.h> 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.9.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c:1.9.2.1 Tue May 22 17:25:46 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c Wed Dec 19 16:25:59 2001 @@ -72,7 +72,7 @@ } /* fb management via fb device */ -#if 0 +#if 1 int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -90,7 +90,7 @@ fb.offset = req.offset; fb.free = req.offset; if(!add_alloc_set(fb.context, VIDEO_TYPE, fb.free)){ - DRM_DEBUG("adding to allocation set fails"); + DRM_DEBUG("adding to allocation set fails\n"); sis_free(req.offset); retval = -1; } @@ -185,7 +185,7 @@ agp.offset = block->ofs; agp.free = (unsigned int)block; if(!add_alloc_set(agp.context, AGP_TYPE, agp.free)){ - DRM_DEBUG("adding to allocation set fails"); + DRM_DEBUG("adding to allocation set fails\n"); mmFreeMem((PMemBlock)agp.free); retval = -1; } @@ -279,9 +279,7 @@ 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 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h:1.1 Wed Mar 21 13:08:56 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h Fri Jan 18 15:26:07 2002 @@ -1,44 +0,0 @@ -/* 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_drv.c diff -u 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.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c:1.11 Wed Mar 21 13:08:56 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c Fri Aug 17 22:51:19 2001 @@ -44,13 +44,63 @@ #define DRIVER_MINOR 0 #define DRIVER_PATCHLEVEL 0 +#ifndef PCI_VENDOR_ID_3DFX +#define PCI_VENDOR_ID_3DFX 0x121A +#endif +#ifndef PCI_DEVICE_ID_3DFX_VOODOO5 +#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 +#endif +#ifndef PCI_DEVICE_ID_3DFX_VOODOO4 +#define PCI_DEVICE_ID_3DFX_VOODOO4 0x0007 +#endif +#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_3000 /* Voodoo3 3000 */ +#define PCI_DEVICE_ID_3DFX_VOODOO3_3000 0x0005 +#endif +#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_2000 /* Voodoo3 3000 */ +#define PCI_DEVICE_ID_3DFX_VOODOO3_2000 0x0004 +#endif +#ifndef PCI_DEVICE_ID_3DFX_BANSHEE +#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 +#endif +static drm_pci_list_t DRM(idlist)[] = { + { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE }, + { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3_2000 }, + { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3_3000 }, + { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO4 }, + { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO5 }, + { 0, 0 } +}; + +#define DRIVER_CARD_LIST DRM(idlist) + + #include "drm_auth.h" #include "drm_bufs.h" #include "drm_context.h" #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" + +#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. + */ + +/* JH- We have to hand expand the string ourselves because of the cpp. If + * anyone can think of a way that we can fit into the __setup macro without + * changing it, then please send the solution my way. + */ +static int __init tdfx_options( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", tdfx_options ); +#endif + #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" Index: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile:3.10 xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile:3.11 --- xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile:3.10 Thu Nov 2 14:10:56 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile Mon Nov 19 10:44:18 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile,v 3.10 2000/11/02 19:10:56 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile,v 3.11 2001/11/19 15:44:18 tsi Exp $ @@ -10,9 +10,6 @@ #if defined(i386Architecture) && !defined(cygwinArchitecture) XSRCS = BUSmemcpy.S IODelay.S SlowBcopy.S -XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o -#elif defined(SparcArchitecture) -XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o #else XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c Index: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c diff -u xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c:1.4 Sat Feb 12 15:45:44 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c Mon Nov 19 10:44:18 2001 @@ -4,7 +4,7 @@ for Alpha Linux *******************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c,v 1.4 2000/02/12 20:45:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c,v 1.5 2001/11/19 15:44:18 tsi Exp $ */ /* * Create a dependency that should be immune from the effect of register @@ -29,7 +29,7 @@ while(len--) { *dst++ = *src++; -#ifndef __sparc__ +#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) outb(0x80, 0x00); #endif } Index: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c diff -u xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c:3.7 xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c:3.8 --- xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c:3.7 Thu Jan 14 08:05:05 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c Sat Oct 27 23:34:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c,v 3.7 1999/01/14 13:05:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c,v 3.8 2001/10/28 03:34:02 tsi Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@goblin.org> * @@ -32,7 +32,7 @@ #include <ctype.h> /* To prevent empty source file warnings */ -static int _xf86misc; +int _xf86misc; #if 0 /* For use only with gcc */ Index: xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile:1.5 Tue Aug 15 12:05:38 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile Fri Nov 16 11:47:56 2001 @@ -1,27 +1,36 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile,v 1.5 2000/08/15 16:05:38 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile,v 1.6 2001/11/16 16:47:56 dawes Exp $ XCOMM #include <Server.tmpl> SRCS = nto_io.c nto_init.c nto_kbdEv.c nto_ioperm.c nto_video.c \ - VTsw_noop.c posix_tty.c std_mseEv.c std_mouse.c kmod_noop.c agp_noop.c + VTsw_noop.c posix_tty.c kmod_noop.c agp_noop.c stdResource.c \ + stdPci.c libc_wrapper.c sigiostubs.c pm_noop.c nto_mouse.c OBJS = nto_io.o nto_init.o nto_kbdEv.o nto_ioperm.o nto_video.o \ - VTsw_noop.o posix_tty.o std_mseEv.o std_mouse.o kmod_noop.o agp_noop.o + VTsw_noop.o posix_tty.o kmod_noop.o agp_noop.o stdResource.o \ + stdPci.o libc_wrapper.o sigiostubs.o pm_noop.o nto_mouse.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) +RESDEFINES = -DUSESTDRES + +DEFINES = $(RESDEFINES) + SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() + +LinkSourceFile(libc_wrapper.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(IO_utils.c,../shared) LinkSourceFile(VTsw_noop.c,../shared) LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -LinkSourceFile(std_mouse.c,../shared) LinkSourceFile(kmod_noop.c,../shared) LinkSourceFile(agp_noop.c,../shared) Index: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c:1.2 Sun Dec 26 19:45:45 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c Fri Nov 16 11:47:56 2001 @@ -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 Sebastien Marineau. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c,v 1.2 1999/12/27 00:45:45 robin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c,v 1.3 2001/11/16 16:47:56 dawes Exp $ */ /* This module contains the NTO-specific functions used at server init. @@ -73,7 +73,6 @@ ThreadCtl(_NTO_TCTL_IO, 0); - if (serverGeneration == 1) xf86Config(FALSE); /* Read in xf86Config file */ if((NTO_con_fd = open("/dev/con1", O_RDWR)) == -1) { ErrorF("Unable to open console\n"); Index: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c:1.2 Sun Dec 26 19:45:45 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c Fri Nov 16 11:47:56 2001 @@ -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 Sebastien Marineau. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c,v 1.2 1999/12/27 00:45:45 robin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c,v 1.3 2001/11/16 16:47:56 dawes Exp $ */ /* This module contains the NTO-specific functions to access the keyboard @@ -105,29 +105,3 @@ return (-1); } -void xf86MouseInit(mouse) -MouseDevPtr mouse; -{ - return; -} - -int xf86MouseOn(mouse) -MouseDevPtr mouse; -{ - if ((mouse->mseFd = open(mouse->mseDevice, O_RDWR | O_NDELAY)) < 0) - { - if (xf86AllowMouseOpenFail) { - ErrorF("Cannot open mouse (%s) - Continuing...\n", - strerror(errno)); - return(-2); - } - FatalError("Cannot open mouse (%s)\n", strerror(errno)); - } - - xf86SetupMouse(mouse); - - /* Flush any pending input */ - tcflush(mouse->mseFd, TCIFLUSH); - - return(mouse->mseFd); -} Index: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c:1.2 Sun Dec 26 19:45:45 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c Fri Nov 16 11:47:56 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/os-support/nto/nto_ioperm.c,v 1.2 1999/12/27 00:45:45 robin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c,v 1.3 2001/11/16 16:47:56 dawes Exp $ */ /* I/O functions to enable access to I/O ports under Neutrino */ @@ -27,38 +27,17 @@ #include <sys/neutrino.h> #include <errno.h> -void xf86ClearIOPortList(ScreenNum) -int ScreenNum; -{ - return; -} -/* ARGSUSED */ -void xf86AddIOPorts(ScreenNum, NumPorts, Ports) -int ScreenNum; -int NumPorts; -unsigned *Ports; +void xf86EnableIO() { - return; -} - -void xf86EnableIOPorts(ScreenNum) -int ScreenNum; -{ - ErrorF("xf86EnableIOPorts: enabling I/O access\n"); + ErrorF("xf86EnableIO: enabling I/O access\n"); if(ThreadCtl(_NTO_TCTL_IO, 0)) { - ErrorF("xf86EnableIOPorts: could not set I/O privilege, errno %d\n",errno); + ErrorF("xf86EnableIO: could not set I/O privilege, errno %d\n",errno); } return; } - -void xf86DisableIOPorts(ScreenNum) -int ScreenNum; -{ - return; -} -void xf86DisableIOPrivs() +void xf86DisableIO() { return; } Index: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c:1.2 Sun Dec 26 19:45:46 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c Fri Nov 16 11:47:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c,v 1.2 1999/12/27 00:45:46 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c,v 1.3 2001/11/16 16:47:56 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Dawes <dawes@physics.su.oz.au> @@ -31,7 +31,6 @@ #include "inputstr.h" #include "scrnintstr.h" -#include "xf86Procs.h" #include "xf86_OSlib.h" extern int NTO_kbd_fd; Index: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c:1.1 --- /dev/null Fri Jan 18 15:26:11 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c Fri Nov 16 11:47:56 2001 @@ -0,0 +1,207 @@ +/* + * Written by Frank Liu Oct 10, 2001 + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c,v 1.1 2001/11/16 16:47:56 dawes Exp $ */ + + +#include "X.h" +#include "xf86.h" +#include "xf86Xinput.h" +#include "xf86OSmouse.h" + +/* copied from mipointer.h */ +extern int miPointerGetMotionEvents( +#if NeedFunctionPrototypes + DeviceIntPtr /*pPtr*/, + xTimecoord * /*coords*/, + unsigned long /*start*/, + unsigned long /*stop*/, + ScreenPtr /*pScreen*/ +#endif +); + +#include <sys/dcmd_input.h> +#define NUMEVENTS 64 /* don't want to stuck in the mouse read loop */ + +/* + * OsMouseReadInput -- + * Get some events from our queue. Process outstanding events now. + */ +static void +OsMouseReadInput(InputInfoPtr pInfo) +{ + int n = 0; + int buttons, col, row; + struct _mouse_packet mp; + MouseDevPtr pMse; + + pMse = pInfo->private; + + while ( (read(pInfo->fd, &mp, sizeof(struct _mouse_packet)) > 0 ) + && (n < NUMEVENTS ) ) + { + col = mp.dx; + row = -mp.dy; + buttons = mp.hdr.buttons; + pMse->PostEvent(pInfo, buttons, col, row, 0, 0); + n++; + } +} + +/* + * OsMouseProc -- + * Handle the initialization, etc. of a mouse + */ +static int +OsMouseProc(pPointer, what) +DeviceIntPtr pPointer; +int what; +{ + int nbuttons; + unsigned char map[MSE_MAXBUTTONS + 1]; + MouseDevPtr pMse; + InputInfoPtr pInfo; + + pInfo = pPointer->public.devicePrivate; + pMse = pInfo->private; + pMse->device = pPointer; + + 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 { + AddEnabledDevice(pInfo->fd); + } + pMse->lastButtons = 0; + pMse->emulateState = 0; + pPointer->public.on = TRUE; + break; + + case DEVICE_CLOSE: + case DEVICE_OFF: + if (pInfo->fd != -1) { + RemoveEnabledDevice(pInfo->fd); + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + } + pPointer->public.on = FALSE; + break; + } + return (Success); +} + +static int +SupportedInterfaces(void) +{ + /* FIXME: Is this correct? Should we just return MSE_MISC? */ + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_MISC | MSE_AUTO; +} + +static const char *internalNames[] = { + "OSMouse", + NULL +}; + +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; +} + +/* XXX Is this appropriate? If not, this function should be removed. */ +static const char * +DefaultProtocol(void) +{ + return "OSMouse"; +} + +static Bool +OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) +{ + MouseDevPtr pMse; + + /* This is called when the protocol is "OSMouse". */ + + pMse = pInfo->private; + 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(pMse); + return FALSE; + } + } + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + + /* Process common mouse options (like Emulate3Buttons, etc). */ + pMse->CommonOptions(pInfo); + + /* Setup the local procs. */ + pInfo->device_control = OsMouseProc; + pInfo->read_input = OsMouseReadInput; + + pInfo->flags |= XI86_CONFIGURED; + return TRUE; +} + +OSMouseInfoPtr +xf86OSMouseInit(int flags) +{ + OSMouseInfoPtr p; + + p = xcalloc(sizeof(OSMouseInfoRec), 1); + if (!p) + return NULL; + p->SupportedInterfaces = SupportedInterfaces; + p->BuiltinNames = BuiltinNames; + p->DefaultProtocol = DefaultProtocol; + p->CheckProtocol = CheckProtocol; + p->PreInit = OsMousePreInit; + return p; +} Index: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c:1.2 Sun Dec 26 19:45:46 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c Fri Nov 16 11:47:56 2001 @@ -23,7 +23,7 @@ * 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/nto/nto_video.c,v 1.2 1999/12/27 00:45:46 robin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c,v 1.3 2001/11/16 16:47:56 dawes Exp $ */ /* This module contains the NTO-specific functions to deal with video @@ -69,12 +69,8 @@ /* Map a chunk of physical video memory, using mmap */ - -pointer xf86MapVidMem(ScreenNum, Region, Base, Size) -int ScreenNum; -int Region; -pointer Base; -unsigned long Size; +pointer +xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) { int fd; unsigned char *base; @@ -97,11 +93,9 @@ return base; } -void xf86UnMapVidMem(ScreenNum, Region, Base, Size) -int ScreenNum; -int Region; -pointer Base; -unsigned long Size; +/* ARGSUSED */ +void +xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) { ErrorF("xf86UnmapVidMem: base %x size %x\n", Base, Size); @@ -155,3 +149,17 @@ return Len; } + +void +xf86MapReadSideEffects(int ScreenNum, int Flags, pointer base, + unsigned long Size) +{ + return; +} + +Bool +xf86CheckMTRR(int s) +{ + return FALSE; +} + Index: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c:1.3 Thu Feb 10 17:33:45 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c Mon Jan 7 15:38:29 2002 @@ -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 Sebastien Marineau. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c,v 1.3 2000/02/10 22:33:45 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c,v 1.4 2002/01/07 20:38:29 dawes Exp $ */ /* This module contains the qnx-specific functions to access the keyboard @@ -84,7 +84,6 @@ buttons = events[i].buttons; pMse->PostEvent(pInfo, buttons, col, row, 0, 0); } - xf86Info.inputPending = TRUE; } if (!armed) ErrorF("Drained mouse queue, armed = 0??\n"); QNX_mouse_event = FALSE; @@ -180,6 +179,7 @@ mouse_close (QNX_mouse); QNX_mouse = NULL; } + pPointer->public.on = FALSE; break; } return (Success); @@ -189,7 +189,7 @@ SupportedInterfaces(void) { /* XXX Need to check this. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_MISC | MSE_AUTO; } static const char *internalNames[] = { @@ -224,6 +224,20 @@ static Bool OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) { + MouseDevPtr pMse; + + /* This is called when the protocol is "OSMouse". */ + + pMse = pInfo->private; + 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); + + /* Process common mouse options (like Emulate3Buttons, etc). */ + pMse->CommonOptions(pInfo); /* Setup the local procs. */ pInfo->device_control = OsMouseProc; Index: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c:1.2 Thu Jan 20 21:30:06 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c Mon Jan 7 15:38:29 2002 @@ -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 Sebastien Marineau. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c,v 1.2 2000/01/21 02:30:06 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c,v 1.3 2002/01/07 20:38:29 dawes Exp $ */ /* This module contains the qnx-specific functions to deal with video @@ -166,5 +166,12 @@ xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, unsigned long Size) { + return; +} + +Bool +xf86CheckMTRR(int s) +{ + return FALSE; } Index: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile:3.11 xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile:3.12 --- xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile:3.11 Wed Dec 13 13:38:05 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile Sat Jun 30 18:41:49 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile,v 3.11 2000/12/13 18:38:05 robin Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile,v 3.12 2001/06/30 22:41:49 tsi Exp $ @@ -7,18 +7,18 @@ #include <Server.tmpl> -SRCS = sco_init.c sco_video.c sco_io.c bios_devmem.c VTsw_sco.c \ - sysv_kbd.c std_kbdEv.c sysv_tty.c sco_mouse.c \ +SRCS = sco_init.c sco_video.c sco_io.c sco_mouse.c VTsw_sco.c \ + std_kbdEv.c posix_tty.c bios_devmem.c vidmem.c \ libc_wrapper.c stdResource.c stdPci.o sigiostubs.c pm_noop.c \ kmod_noop.c agp_noop.c -OBJS = sco_init.o sco_video.o sco_io.o bios_devmem.o VTsw_sco.o \ - sysv_kbd.o std_kbdEv.o sysv_tty.o sco_mouse.o \ +OBJS = sco_init.o sco_video.o sco_io.o sco_mouse.o VTsw_sco.o \ + std_kbdEv.o posix_tty.o bios_devmem.o vidmem.o \ libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \ kmod_noop.o agp_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) + -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) RESDEFINES = -DUSESTDRES @@ -28,9 +28,8 @@ NormalLibraryObjectRule() LinkSourceFile(bios_devmem.c,../shared) -LinkSourceFile(sysv_kbd.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(sysv_tty.c,../shared) +LinkSourceFile(posix_tty.c,../shared) LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) LinkSourceFile(stdPci.c,../shared) @@ -38,6 +37,7 @@ LinkSourceFile(pm_noop.c,../shared) LinkSourceFile(kmod_noop.c,../shared) LinkSourceFile(agp_noop.c,../shared) +LinkSourceFile(vidmem.c,../shared) DependTarget() Index: xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c:1.2 Sat Jul 25 12:56:57 1998 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c Sat Jun 30 18:41:49 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c,v 1.2 1998/07/25 16:56:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c,v 1.3 2001/06/30 22:41:49 tsi Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@goblin.org> * Copyright 1993 by David McCullough <davidm@stallion.oz.au> @@ -30,66 +30,85 @@ #include "xf86Priv.h" #include "xf86_OSlib.h" +/* For the event driver prototypes */ +#include <sys/event.h> +#include <mouse.h> + /* * Handle the VT-switching interface for SCO */ /* * This function is the signal handler for the VT-switching signal. It - * is only referenced inside the OS-support layer. + * is only referenced inside the OS-support layer. NOTE: we do NOT need + * to re-arm the signal here, since we used sigaction() to set the signal + * disposition in sco_init.c. If we had used signal(), we would need to + * re-arm the signal here. All we need to do now is record the fact that + * we got the signal. XFree86 handles the rest. */ void xf86VTRequest(int sig) { - signal(sig, (void(*)())xf86VTRequest); - xf86Info.vtRequestsPending = TRUE; - return; + xf86Info.vtRequestsPending = TRUE; + return; } Bool xf86VTSwitchPending() { - return(xf86Info.vtRequestsPending ? TRUE : FALSE); + return(xf86Info.vtRequestsPending ? TRUE : FALSE); } +/* + * When we switch away, we need to flush and suspend the event driver + * before the VT_RELDISP. We also need to get the current LED status + * and preserve it, so that we can restore it when we come back. + */ +static int sco_ledstatus = -1; +static unsigned int sco_ledstate = 0; + Bool xf86VTSwitchAway() { - xf86Info.vtRequestsPending = FALSE; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) - { - return(FALSE); - } - else - { - return(TRUE); - } + ev_flush(); + ev_suspend(); + sco_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &sco_ledstate); + + xf86Info.vtRequestsPending = FALSE; + if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_TRUE) < 0) { + return(FALSE); + } else { + return(TRUE); + } } +/* + * When we come back to the X server, we need to resume the event driver, + * and we need to restore the LED settings to what they were when we + * switched away. + */ Bool xf86VTSwitchTo() { - xf86Info.vtRequestsPending = FALSE; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) - { - return(FALSE); - } - else - { - /* - * make sure the console driver thinks the console is in - * graphics mode. Under mono we have to do the two as the - * console driver only allows valid modes for the current - * video card and Herc or vga are the only devices currently - * supported. - */ - if (ioctl(xf86Info.consoleFd, SW_VGA12, 0) < 0) - if (ioctl(xf86Info.consoleFd, SW_HGC_P0, 0) < 0) - { - ErrorF("Failed to set graphics mode : %s\n", - strerror(errno)); - } + ev_resume(); + + xf86Info.vtRequestsPending = FALSE; + if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) { + return(FALSE); + } else { + if (sco_ledstatus >= 0) { + ioctl (xf86Info.consoleFd, KDSETLED, &sco_ledstate); + } + sco_ledstatus = -1; + + /* + * Convince the console driver this screen is in graphics mode, + * otherwise it assumes it can do more to the screen than it should. + */ + if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) { + ErrorF("Failed to set graphics mode (%s)\n", strerror(errno)); + } - return(TRUE); - } + return TRUE; + } } Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c:3.11 xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c:3.12 --- xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c:3.11 Sat Jul 25 12:56:57 1998 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c Sat Jun 30 18:41:49 2001 @@ -1,29 +1,28 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c,v 3.11 1998/07/25 16:56:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c,v 3.12 2001/06/30 22:41:49 tsi Exp $ */ /* - * Copyright 1993 by David McCullough <davidm@stallion.oz.au> - * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * * 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 David McCullough and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. David McCullough 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. + * documentation, and that the name J. Kean Johnston not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. J. Kean Johnston makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. * - * DAVID MCCULLOUGH AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL DAVID MCCULLOUGH 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. - * + * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL J. KEAN JOHNSTON 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: sco_init.c /main/7 1996/10/25 11:38:01 kaleb $ */ +/* $XConsortium$ */ + +/* Re-written May 2001 to represent the current state of reality */ #include "X.h" #include "Xmd.h" @@ -36,214 +35,290 @@ static Bool KeepTty = FALSE; static int VTnum = -1; +static char *vtdevice = NULL; static int sco_console_mode = -1; +Bool mpxLock = TRUE; + void xf86OpenConsole() { - int fd,wc; - struct vt_mode VT; - struct stat status; - char vtname[11]; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* - * setup the virtual terminal manager - * - * SCO vts start at tty01 which is vt00, if you could call them VT's. - * We use the numbers 1..X as it fits nicer with the device naming - * scheme. - * - * In os/osinit.c we took the precuation of not closing stdin so that - * we can use the current vt if no vt was specified on the command line - * - * Under SCO VT_OPENQRY does nothing at all - * if nothing was specified we try to determine the VT from stdin - */ - if ((VTnum != -1) && (VTnum != 0)) - { - wc = VTnum - 1; - } - else - { - if ((fstat(0, &status) >= 0) && (status.st_mode & S_IFCHR)) - { - wc = minor(status.st_rdev); - } - else - { - ErrorF("%s: Failed to stat stdin, using tty02 (%s)\n", - "xf86OpenConsole", strerror(errno)); - wc = 1; /* tty02 */ - } - } - ErrorF("(using VT number %d)\n\n", wc + 1); - - sprintf(vtname,"/dev/tty%02d", wc+1); /* /dev/tty[01-12] */ - - if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) < 0) - { - FatalError("xf86OpenConsole: Cannot open %s (%s)\n", - vtname, strerror(errno)); - } - - /* now we can dispose of stdin */ - - if (freopen(vtname, "r+", stdin) == (FILE *) NULL) - { - FatalError("xf86OpenConsole: Cannot reopen stdin as %s (%s)\n", - vtname, strerror(errno)); - } - - /* now we can fixup stdout */ - - if (freopen(vtname, "r+", stdout) == (FILE *) NULL) - { - FatalError("xf86OpenConsole: Cannot reopen stdout as %s (%s)\n", - vtname, strerror(errno)); - } - - /* We activate the console just in case its not the one we are on */ - xf86Info.vtno = wc; - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, wc) != 0) - { - ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n"); - } - - if (!KeepTty) - { - setpgrp(); - } - - /* - * now get the VT - */ - if ((sco_console_mode = ioctl(xf86Info.consoleFd, CONS_GET, 0L)) < 0) - { - FatalError("xf86OpenConsole: VT_GETMODE failed on console (%s)\n", - strerror(errno)); - } - if (ioctl(xf86Info.consoleFd, VGA_IOPRIVL, 1) < 0) - { - FatalError("xf86OpenConsole: VGA_IOPRIVL failed for VGA acc (%s)\n", - strerror(errno)); - } - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_GETMODE failed (%s)\n", + int fd,i, ioctl_ret; + struct vt_mode VT; + static char vtname[32]; + struct vid_info vidinf; + struct sigaction sigvtsw; + + if (serverGeneration == 1) { + /* check if we're run with euid==0 */ + if (geteuid() != 0) { + FatalError("xf86OpenConsole: Server must be setuid root\n"); + } + + /* + * Set up the virtual terminal (multiscreen in SCO parlance). + * For the actual console itself, screens are numbered from + * 1 to (usually) 16. However, it is possible to have a nested + * server, and it is also possible to be on a multi-console + * system such as MaxSpeed or SunRiver. Therefore, we should + * not make any assumptions about the TTY name we are on, and + * instead we rely on ttyname() to give us the real TTY name. + * Previously, XFree86 tried to determine the TTY name manually. + * This is wrong. The only time we need to futz with the TTY name + * if if we were given the name of a TTY to run on explicity on + * the command line. + */ + + if (VTnum == -1) { + /* + * We can query the current VT number using CONS_GETINFO. + */ + char *ttn; + + vidinf.size = sizeof(vidinf); + if (ioctl (0, CONS_GETINFO, &vidinf) < 0) { + FatalError ("xf86OpenConsole: Not on a console device " + "or error querying device (%s)\n", strerror (errno)); + } + + VTnum = vidinf.m_num + 1; /* 0-based */ + ttn = ttyname (0); + + if (ttn == (char *)0) { + ErrorF ("xf86OpenConsole: Error determining TTY name (%s)\n", + strerror(errno)); + snprintf (vtname, sizeof(vtname)-1, "/dev/tty%02d", VTnum); + } else { + strlcpy (vtname, ttn, sizeof(vtname)); + } + vtdevice = vtname; + } else if (VTnum == -2 || VTnum >= 0) { + /* + * An explicit device was specified. Make sure its a console device. + */ + if (VTnum != -2) { + snprintf (vtname, sizeof(vtname)-1, "/dev/tty%02d", VTnum); + vtdevice = vtname; + } + + fd = open (vtdevice, O_RDWR | O_NDELAY, 0); + if (fd < 0) { + FatalError ("xf86OpenConsole: Can not open device '%s' (%s)\n", + vtdevice, strerror(errno)); + } + + vidinf.size = sizeof(vidinf); + if (ioctl (fd, CONS_GETINFO, &vidinf) < 0) { + FatalError ("xf86OpenConsole: '%s' is not a console device " + "or error querying device (%s)\n", vtname, strerror (errno)); + } + VTnum = vidinf.m_num + 1; /* 0-based */ + close (fd); /* We're done with it for now */ + } + + ErrorF("(using VT%02d device %s)\n\n", VTnum, vtdevice); + + if ((xf86Info.consoleFd = open(vtdevice, O_RDWR | O_NDELAY, 0)) < 0) { + FatalError("xf86OpenConsole: Cannot open %s (%s)\n", vtdevice, strerror(errno)); - } + } + + /* Dispose of stdin and stdout */ + if (freopen(vtdevice, "r+", stdin) == (FILE *) NULL) { + FatalError("xf86OpenConsole: Cannot reopen stdin as %s (%s)\n", + vtdevice, strerror(errno)); + } + + if (freopen(vtname, "r+", stdout) == (FILE *) NULL) { + FatalError("xf86OpenConsole: Cannot reopen stdout as %s (%s)\n", + vtdevice, strerror(errno)); + } + + /* + * We make 100% sure we use the correct VT number. This can get ugly + * where there are multi-consoles in use, so we make sure we query + * the kernel for the correct VT number. It knows best, we don't. + */ + vidinf.size = sizeof(vidinf); + if (ioctl (xf86Info.consoleFd, CONS_GETINFO, &vidinf) < 0) { + FatalError ("xf86OpenConsole: Failed to query console number (%s)\n", + strerror (errno)); + } + xf86Info.vtno = vidinf.m_num; + + /* We activate the console just in case its not the one we are on */ + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) { + ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno)); + } + + /* Disassociate from controling TTY */ + if (!KeepTty) { + setpgrp(); + } - signal(SIGUSR1, xf86VTRequest); + /* + * Now we get the current mode that the console device is on. We will + * use this later when we close the console device to restore it to + * that same mode. + */ + if ((sco_console_mode = ioctl(xf86Info.consoleFd, CONS_GET, 0L)) < 0) { + FatalError("xf86OpenConsole: CONS_GET failed on console (%s)\n", + strerror(errno)); + } + + if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) { + FatalError("xf86OpenConsole: VT_GETMODE failed (%s)\n", strerror(errno)); + } - VT.mode = VT_PROCESS; - VT.relsig = SIGUSR1; - VT.acqsig = SIGUSR1; - VT.frsig = SIGUSR1; - VT.waitv = 0; - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); - } - /* - * make sure the console driver thinks the console is in graphics - * mode. Under mono we have to do the two as the console driver only - * allows valid modes for the current video card and Herc or vga are - * the only devices currently supported. - */ - if (ioctl(xf86Info.consoleFd, SW_VGA12, 0) < 0) - if (ioctl(xf86Info.consoleFd, SW_HGC_P0, 0) < 0) - { - ErrorF("Failed to set graphics mode (%s)\n", - strerror(errno)); - } - - } - else - { - /* serverGeneration != 1 */ - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n"); - } + sigvtsw.sa_handler = xf86VTRequest; + sigfillset(&sigvtsw.sa_mask); + sigvtsw.sa_flags = 0; + + /* NOTE: Using sigaction means we dont have to re-arm the signal */ + sigaction(SIGUSR1, &sigvtsw, NULL); + + VT.mode = VT_PROCESS; + VT.relsig = SIGUSR1; + VT.acqsig = SIGUSR1; + VT.frsig = SIGINT; /* Not implemented */ + VT.waitv = 0; + + /* + * The SCO X server tries the following call 5 times. Lets do the same + * thing. It shouldn't really be required but sometimes things take a + * while to settle down when switching screens. *helpless shrug* I know + * its sucks but ... + */ + + ioctl_ret = 0; + for (i = 0; i < 5; i++) { + ioctl_ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); + if (ioctl_ret >= 0) + break; + usleep(999999); /* Dont use nap() - it forces linking with -lx */ } - return; + + if (ioctl_ret < 0) { + FatalError("xf86OpenConsole: VT_SETMODE failed (%s)\n", strerror(errno)); + } + + /* + * Convince the console driver we are in graphics mode. + */ + if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) { + ErrorF("Failed to set graphics mode (%s)\n", strerror(errno)); + } + } else { /* serverGeneration != 1 */ + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) { + ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno)); + } + } } +/* + * Restore the console to its previous state. This may cause flicker if + * the screen was previous in a graphics mode, because we first set it + * to text mode. This has the advantage of getting the console driver + * to do a soft reset on the card, which really does help settle the + * video card down again after coming out of Xfree86. + */ void xf86CloseConsole() { - struct vt_mode VT; + struct vt_mode VT; + struct sigaction sigvtsw; - ioctl(xf86Info.consoleFd, VT_RELDISP, 1); - if (sco_console_mode != -1) - { - ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L); - } - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) - { - VT.mode = VT_AUTO; - ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ - } - close(xf86Info.consoleFd); /* make the vt-manager happy */ - return; + ioctl(xf86Info.consoleFd, VT_RELDISP, 1); /* Release the display */ + + sigvtsw.sa_handler = SIG_DFL; + sigfillset(&sigvtsw.sa_mask); + sigvtsw.sa_flags = 0; + + sigaction(SIGUSR1, &sigvtsw, NULL); + + VT.mode = VT_AUTO; + VT.waitv = 0; + VT.relsig = SIGUSR1; + VT.acqsig = SIGUSR1; + VT.frsig = SIGINT; + ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* Revert to auto handling */ + + /* Set text mode (possibly briefly) */ + ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT0); + + /* Restore the original mode */ + if (sco_console_mode != -1) { + ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L); + } + + close(xf86Info.consoleFd); /* We're done with the device */ } int xf86ProcessArgument(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); - } - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0) - { - UseMsg(); - VTnum = -1; - return(0); - } - return(1); - } - if (!strcmp(argv[i], "-crt")) - { - if ((++i > argc) || - (sscanf(argv[i], "/dev/tty%2d", &VTnum) == 0)) - { - UseMsg(); - VTnum = -1; - return(0); - } - else - { - return(2); - } - } - return(0); + /* + * 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); + } + + /* + * By default, the X server wants to bind itself to CPU 0. This makes + * sure that the server has full access to the I/O ports at IOPL 3. + * Some SMP systems have trouble with I/O on CPU's other than 0. If, + * however, you have a system that is well behaved, you can specify + * this argument and let the scheduler decide which CPU the server + * should run on. + */ + if (!strcmp(argv[i], "-nompxlock")) { + mpxLock = FALSE; + return (1); + } + + /* + * Specify the VT number to run on (NOT the device). + */ + if ((argv[i][0] == 'v') && (argv[i][1] == 't')) { + if (sscanf(argv[i], "vt%2d", &VTnum) == 0) { + UseMsg(); + VTnum = -1; + return(0); + } + if (VTnum <= 0) { + UseMsg(); + VTnum = -1; + return(0); + } + return(1); + } + + /* + * Use a device the user specifies. + */ + if (!strcmp(argv[i], "-crt")) { + if (++i > argc) { + UseMsg(); + VTnum = -1; + return(0); + } else { + VTnum = -2; + vtdevice = argv[i]; + return(2); + } + } + return(0); } void xf86UseMsg() { ErrorF("vtXX use the specified VT number\n"); - ErrorF("-crt /dev/ttyXX use the specified VT number\n"); + ErrorF("-crt DEVICE use the specified VT device\n"); + ErrorF("-nompxlock dont bind X server to CPU 0\n"); ErrorF("-keeptty "); ErrorF("don't detach controlling tty (for debugging only)\n"); - return; } Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c:3.6 xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c:3.7 --- xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c:3.6 Thu May 6 22:56:22 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c Sat Jun 30 18:41:49 2001 @@ -1,29 +1,28 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c,v 3.6 1999/05/07 02:56:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c,v 3.7 2001/06/30 22:41:49 tsi Exp $ */ /* - * Copyright 1993 by David McCullough <davidm@stallion.oz.au> - * Copyright 1993 by David Dawes <dawes@xfree86.org> + * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * * 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 David McCullough and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. David McCullough - * and David Dawes makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. + * documentation, and that the name J. Kean Johnston not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. J. Kean Johnston makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. * - * DAVID MCCULLOUGH AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL DAVID MCCULLOUGH OR DAVID DAWES BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * + * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL J. KEAN JOHNSTON 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: sco_io.c /main/7 1996/10/19 18:07:31 kaleb $ */ +/* $XConsortium$ */ + +/* Re-written May 2001 to represent the current state of reality */ #include "X.h" @@ -33,78 +32,233 @@ #include "xf86Priv.h" #include "xf86_OSlib.h" +#include <sys/param.h> +#include <sys/emap.h> +#include <sys/nmap.h> + void xf86SoundKbdBell(int loudness, int pitch, int duration) { - if (loudness && pitch) - { - ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch); - usleep(duration * loudness * 20); - ioctl(xf86Info.consoleFd, KIOCSOUND, 0); - } + if (loudness && pitch) { + ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch); + usleep(duration * loudness * 20); + ioctl(xf86Info.consoleFd, KIOCSOUND, 0); + } } void xf86SetKbdLeds(int leds) +{ + /* + * sleep the first time through under SCO. There appears to be a + * timing problem in the driver which causes the keyboard to be lost. + * This usleep stops it from occurring. NOTE: this was in the old code. + * I am not convinced it is true any longer, but it doesn't hurt to + * leave this in here. + */ + static int once = 1; + + if (once) { + usleep(100); + once = 0; + } + + ioctl(xf86Info.consoleFd, KDSETLED, leds ); +} + +int +xf86GetKbdLeds() +{ + int leds; + + ioctl (xf86Info.consoleFd, KDGETLED, &leds); + return leds; +} + +/* + * Much of the code in this function is duplicated from the Linux code + * by Orest Zborowski <obz@Kodak.com> and David Dawes <dawes@xfree86.org>. + * Please see the file ../linux/lnx_io.c for full copyright information. + * + * NOTE: Only OpenServer Release 5.0.6 with Release Supplement 5.0.6A + * and later have the required ioctl. 5.0.6A or higher is HIGHLY + * recommended. The console driver is quite a different beast on that OS. + */ +void +xf86SetKbdRepeat(char rad) { - /* - * sleep the first time through under SCO. There appears to be a - * timing problem in the driver which causes the keyboard to be lost. - * This sleep stops it from occurring. The sleep could proably be - * a lot shorter as even trace can fix the problem. You may - * prefer a usleep(100). - */ - static int once = 1; - - if (once) - { - sleep(1); - once = 0; - } - ioctl(xf86Info.consoleFd, KDSETLED, leds ); +#if defined(KBIO_SETRATE) + int i; + int value = 0x7f; /* Maximum delay with slowest rate */ + int delay = 250; /* Default delay */ + int rate = 300; /* Default repeat rate */ + + static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150, + 133, 120, 109, 100, 92, 86, 80, 75, 67, + 60, 55, 50, 46, 43, 40, 37, 33, 30, 27, + 25, 23, 21, 20 }; +#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int )) + + static int valid_delays[] = { 250, 500, 750, 1000 }; +#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int )) + + if (xf86Info.kbdRate >= 0) + rate = xf86Info.kbdRate * 10; + if (xf86Info.kbdDelay >= 0) + delay = xf86Info.kbdDelay; + + for (i = 0; i < RATE_COUNT; i++) + if (rate >= valid_rates[i]) { + value &= 0x60; + value |= i; + break; + } + + for (i = 0; i < DELAY_COUNT; i++) + if (delay <= valid_delays[i]) { + value &= 0x1f; + value |= i << 5; + break; + } + + ioctl (xf86Info.consoleFd, KBIO_SETRATE, value); +#endif /* defined(KBIO_SETRATE) */ } +static Bool use_tcs = TRUE, use_kd = TRUE; +static Bool no_nmap = TRUE, no_emap = TRUE; +static int orig_getsc, orig_kbm; +static struct termios orig_termios; +static keymap_t keymap, noledmap; +static uchar_t *sc_mapbuf; +static uchar_t *sc_mapbuf2; + void -xf86MouseInit(MouseDevPtr mouse) +xf86KbdInit() { - if ((mouse->mseFd = open(mouse->mseDevice, O_RDWR | O_NDELAY)) < 0) - { - if (xf86Info.allowMouseOpenFail) { - ErrorF("Cannot open mouse (%s) - Continuing...\n", - strerror(errno)); - return; - } - FatalError("Cannot open mouse (%s)\n", strerror(errno)); - } + orig_getsc = 0; + if (ioctl (xf86Info.consoleFd, TCGETSC, &orig_getsc) < 0) + use_tcs = FALSE; + if (ioctl (xf86Info.consoleFd, KDGKBMODE, &orig_kbm) < 0) + use_kd = FALSE; + + if (!use_tcs && !use_kd) + FatalError ("xf86KbdInit: Could not determine keyboard mode\n"); + + /* + * One day this should be fixed to translate normal ASCII characters + * back into scancodes or into events that XFree86 wants, but not + * now. For the time being, we only support scancode mode screens. + */ + if (use_tcs && !(orig_getsc & KB_ISSCANCODE)) + FatalError ("xf86KbdInit: Keyboard can not send scancodes\n"); + + /* + * We need to get the original keyboard map and NUL out the lock + * modifiers. This prevents the scancode API from messing with + * the keyboard LED's. We restore the original map when we exit. + */ + if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &keymap) < 0) { + FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n", + strerror(errno)); + } + if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &noledmap) < 0) { + FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n", + strerror(errno)); + } else { + int i, j; + + for (i = 0; i < noledmap.n_keys; i++) { + for (j = 0; j < NUM_STATES; j++) { + if (IS_SPECIAL(noledmap, i, j) && + ((noledmap.key[i].map[j] == K_CLK) || + (noledmap.key[i].map[j] == K_NLK) || + (noledmap.key[i].map[j] == K_SLK))) { + noledmap.key[i].map[j] = K_NOP; + } + } + } + } + + if (ioctl (xf86Info.consoleFd, XCGETA, &orig_termios) < 0) { + FatalError ("xf86KbdInit: Failed to get terminal modes (%s)\n", + strerror(errno)); + } + + sc_mapbuf = xalloc (10*BSIZE); + sc_mapbuf2 = xalloc(10*BSIZE); + + /* Get the emap */ + if (ioctl (xf86Info.consoleFd, LDGMAP, sc_mapbuf) < 0) { + if (errno != ENAVAIL) { + FatalError ("xf86KbdInit: Failed to retrieve e-map (%s)\n", + strerror (errno)); + } + no_emap = FALSE; + } + + /* Get the nmap */ + if (ioctl (xf86Info.consoleFd, NMGMAP, sc_mapbuf2) < 0) { + if (errno != ENAVAIL) { + FatalError ("xf86KbdInit: Failed to retrieve n-map (%s)\n", + strerror (errno)); + } + no_nmap = FALSE; + } } int -xf86MouseOn(MouseDevPtr mouse) +xf86KbdOn() { - xf86SetupMouse(mouse); + struct termios newtio; - /* Flush any pending input */ - ioctl(mouse->mseFd, TCFLSH, 0); + ioctl (xf86Info.consoleFd, LDNMAP); /* Turn e-mapping off */ + ioctl (xf86Info.consoleFd, NMNMAP); /* Turn n-mapping off */ - return(mouse->mseFd); + newtio = orig_termios; /* structure copy */ + newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); + newtio.c_oflag = 0; + newtio.c_cflag = CREAD | CS8 | B9600; + newtio.c_lflag = 0; + newtio.c_cc[VTIME]=0; + newtio.c_cc[VMIN]=1; + cfsetispeed(&newtio, 9600); + cfsetospeed(&newtio, 9600); + ioctl(xf86Info.consoleFd, XCSETA, &newtio); + + /* Now tell the keyboard driver to send us raw scancodes */ + if (use_tcs) { + int nm = orig_getsc; + nm &= ~KB_XSCANCODE; + ioctl (xf86Info.consoleFd, TCSETSC, &nm); + } + + if (use_kd) + ioctl (xf86Info.consoleFd, KDSKBMODE, K_RAW); + + ioctl (xf86Info.consoleFd, PIO_KEYMAP, &noledmap); + + return(xf86Info.consoleFd); } int -xf86MouseOff(MouseDevPtr mouse, Bool doclose) +xf86KbdOff() { - if (mouse->mseFd >= 0) - { - if (mouse->mseType == P_LOGI) - { - write(mouse->mseFd, "U", 1); - xf86SetMouseSpeed(mouse, mouse->baudRate, - mouse->oldBaudRate, - xf86MouseCflags[P_LOGI]); - } - if (doclose) - { - close(mouse->mseFd); - } - } - return(mouse->mseFd); + /* Revert back to original translate scancode mode */ + if (use_tcs) + ioctl (xf86Info.consoleFd, TCSETSC, &orig_getsc); + if (use_kd) + ioctl (xf86Info.consoleFd, KDSKBMODE, orig_kbm); + + ioctl (xf86Info.consoleFd, PIO_KEYMAP, &keymap); + + if (no_emap) + ioctl (xf86Info.consoleFd, LDSMAP, sc_mapbuf); + if (no_nmap) + ioctl (xf86Info.consoleFd, NMSMAP, sc_mapbuf2); + + ioctl(xf86Info.consoleFd, XCSETA, &orig_termios); + + return(xf86Info.consoleFd); } + Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c:3.11 xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c:3.12 --- xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c:3.11 Thu Jan 14 08:05:09 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c Sat Jun 30 18:41:49 2001 @@ -1,12 +1,27 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c,v 3.11 1999/01/14 13:05:09 dawes Exp $ */ - - - - - -/* $XConsortium: sco_mouse.c /main/6 1996/10/23 11:46:17 kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c,v 3.12 2001/06/30 22:41:49 tsi Exp $ */ +/* + * Copyright 2001 by J. Kean Johnston <jkj@sco.com> + * + * 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 J. Kean Johnston not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. J. Kean Johnston makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL J. KEAN JOHNSTON 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$ */ #include "X.h" #include "compiler.h" @@ -14,180 +29,239 @@ #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" +#include "xf86Xinput.h" +#include "xf86OSmouse.h" +#include "mipointer.h" +#include <sys/event.h> +#include <mouse.h> -/******************************************************************************/ -#ifdef USE_OSMOUSE -/******************************************************************************/ - -#include <sys/event.h> -#include <mouse.h> -#include "xf86Config.h" - -static dmask_t real_mask = (dmask_t) (D_REL | D_BUTTON); -static int config_buttons = 0; - -extern int miPointerGetMotionEvents(DeviceIntPtr pPtr, xTimecoord *coords, - unsigned long start, unsigned long stop, - ScreenPtr pScreen); +static int +SupportedInterfaces (void) +{ + /* FIXME: Is this correct? Should we just return MSE_MISC? */ + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_MISC | MSE_AUTO; +} -/******************************************************************************/ -/* - * Handle any XF86Config options for "OsMouse", How you treat errors - * is up to you, they may or may not be Fatal - */ +static const char *internalNames[] = { + "OSMouse", + NULL +}; -void -xf86OsMouseOption(int lt, pointer lp) +static const char ** +BuiltinNames (void) { - if (lt != NUMBER) { - ErrorF("%s: Invalid Argument to OsMouse, %s\n", - "xf86OsMouseOption", "Number of buttons expected"); - return; - } - config_buttons = ((LexPtr)lp)->num; + return internalNames; } -/******************************************************************************/ -/* - * xf86OsMouseProc -- - * Handle the initialization, etc. of a mouse - */ +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 const char * +DefaultProtocol (void) +{ + return "OSMouse"; +} + +static const char * +evtErrStr (int evterr) +{ + switch (evterr) { + case -1: return "error in config files"; + case -2: return "no mouse devices to attach"; + case -3: return "unable to open device"; + case -4: return "unable to open event queue"; + case -999: return "unable to initialize event driver"; + default: return "unknown event driver error"; + } +} -int -xf86OsMouseProc(DeviceIntPtr pPointer, int what) +static int +OsMouseProc (DeviceIntPtr pPointer, int what) { - unchar *map; - int i, err, buttons; - struct devinfo *dip; - dmask_t dmask; + InputInfoPtr pInfo; + MouseDevPtr pMse; + unsigned char map[9]; + dmask_t dmask; + struct devinfo *di; + MessageType from = X_CONFIG; + int evi; + + pInfo = pPointer->public.devicePrivate; + pMse = pInfo->private; + pMse->device = pPointer; switch (what) { - case DEVICE_INIT: - - pPointer->public.on = FALSE; - - if (ev_init() < 0) - ErrorF("ev_init: Failed to initialize event driver\n"); - - dmask = real_mask; - xf86Info.mouseDev->mseFd = ev_open(&dmask); - switch (xf86Info.mouseDev->mseFd) { - case -1: FatalError("ev_open: Error in Configuration files\n"); - case -2: FatalError("ev_open: No mouse devices to attach\n"); - case -3: FatalError("ev_open: Unable to open a found device\n"); - case -4: FatalError("ev_open: unable to open an event queue\n"); - default: - if (xf86Info.mouseDev->mseFd < 0) - FatalError("ev_open: Failed to open device, reason unkown\n"); - break; + case DEVICE_INIT: + pPointer->public.on = FALSE; + + dmask = D_REL | D_BUTTON; + if ((evi = ev_init()) < 0) { + FatalError ("OsMouseProc: Event driver initialization failed (%s)\n", + evtErrStr(evi)); + } + pInfo->fd = ev_open (&dmask); + if (pInfo->fd < 0) { + FatalError ("OsMouseProc: DEVICE_INIT failed (%s)\n", evtErrStr(pInfo->fd)); + } + + /* + * We need to loop here since we will accept either relative device + * types (mice) or absolute ones (bitpads / lightpens). + */ + di = (struct devinfo *)0; + di = ev_getdev(D_REL|D_BUTTON, di); + if (di == (struct devinfo *)0) { + FatalError ("OsMouseProc: Could not extract mouse device info\n"); + } + pMse->buttons = xf86SetIntOption (pInfo->options, "Buttons", 0); + if (pMse->buttons == 0) { + pMse->buttons = (int)di->buttons; + from = X_PROBED; + if (pMse->buttons <= 0) { + pMse->buttons = MSE_DFLTBUTTONS; + from = X_DEFAULT; } - if (dmask != real_mask) - FatalError("Could not attach the mouse device (0x%x)\n", dmask); - - dip = (struct devinfo *) NULL; - if ((dip = ev_getdev(D_REL, dip)) == (struct devinfo *) NULL) - FatalError("Could not find info on mouse device\n"); - - buttons = config_buttons > 0 ? config_buttons : ((int) dip->buttons); - buttons = buttons > 0 ? buttons : 3; /* just in case */ - -#ifdef XCONFIG_GIVEN - ErrorF("%s OsMouse has %d buttons\n", - buttons == config_buttons ? XCONFIG_GIVEN : XCONFIG_PROBED, - buttons); -#endif - - map = xalloc(buttons + 1); - if (map == (unchar *) NULL) - FatalError("Failed to allocate OsMouse map structure\n"); - - for (i = 1; i <= buttons; i++) - map[i] = i; - - InitPointerDeviceStruct((DevicePtr)pPointer, - map, - buttons, - miPointerGetMotionEvents, - (PtrCtrlProcPtr)xf86MseCtrl, - 0); - xfree(map); - -#ifdef XINPUT - InitValuatorAxisStruct(pPointer, - 0, - 0, /* min val */ - screenInfo.screens[0]->width, /* max val */ - 1, /* resolution */ - 0, /* min_res */ - 1); /* max_res */ - InitValuatorAxisStruct(pPointer, - 1, - 0, /* min val */ - screenInfo.screens[0]->height, /* max val */ - 1, /* resolution */ - 0, /* min_res */ - 1); /* max_res */ - /* - * Initialize valuator values in synch - * with dix/event.c DefineInitialRootWindow - */ - *pPointer->valuator->axisVal = screenInfo.screens[0]->width / 2; - *(pPointer->valuator->axisVal+1) = screenInfo.screens[0]->height / 2; -#endif - - ev_suspend(); /* suspend device until its turned on */ - break; - - case DEVICE_ON: - ev_resume(); - AddEnabledDevice(xf86Info.mouseDev->mseFd); - xf86Info.mouseDev->lastButtons = 0; - xf86Info.mouseDev->emulateState = 0; - pPointer->public.on = TRUE; - break; - - case DEVICE_CLOSE: - case DEVICE_OFF: - pPointer->public.on = FALSE; - RemoveEnabledDevice(xf86Info.mouseDev->mseFd); - if (what == DEVICE_CLOSE) { - ev_close(); - xf86Info.mouseDev->mseFd = -1; - } else - ev_suspend(); - break; } - + xf86Msg (from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons); + + map[1] = 1; + map[2] = 2; + map[3] = 3; + map[4] = 6; + map[5] = 7; + map[6] = 8; + map[7] = 4; + map[8] = 5; /* Compatibile with SCO X server */ + + InitPointerDeviceStruct((DevicePtr)pPointer, map, 8, + 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); + + ev_flush(); + ev_suspend(); + break; + + case DEVICE_ON: + pMse->lastButtons = 0; + pMse->emulateState = 0; + pPointer->public.on = TRUE; + ev_resume(); + AddEnabledDevice (pInfo->fd); + break; + + case DEVICE_OFF: + case DEVICE_CLOSE: + pPointer->public.on = TRUE; + RemoveEnabledDevice (pInfo->fd); + if (what == DEVICE_CLOSE) { + ev_close(); + pInfo->fd = -1; + } else { + ev_suspend(); + } + break; + } + return Success; } -/******************************************************************************/ -/* - * xf86OsMouseEvents -- - * Get some events from our queue. Process all outstanding events now. - */ +static void +OsMouseReadInput (InputInfoPtr pInfo) +{ + MouseDevPtr pMse; + EVENT *evp; -void -xf86OsMouseEvents() + pMse = pInfo->private; + + while ((evp = ev_read()) != (EVENT *)0) { + pMse->PostEvent (pInfo, EV_BUTTONS(*evp), EV_DX(*evp), -(EV_DY(*evp)),0,0); + ev_pop(); + } +} + +static Bool +OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) { - EVENT *evp; - static long time = -1; + MouseDevPtr pMse; - while ((evp = ev_read()) != (EVENT *) NULL ) { -#if DEBUG - if (time == -1) - time = EV_TIME(*evp); - ErrorF("sco_event time(%ld) tag(%d) butts(%d) x(%ld) y(%ld)\n", - EV_TIME(*evp) - time, EV_TAG(*evp), EV_BUTTONS(*evp), - EV_DX(*evp), EV_DY(*evp)); -#endif - xf86PostMseEvent(xf86Info.pMouse,EV_BUTTONS(*evp), EV_DX(*evp), -(EV_DY(*evp))); - ev_pop(); - } - - xf86Info.inputPending = TRUE; -} - -/******************************************************************************/ -#endif /* USE_OSMOUSE */ -/******************************************************************************/ + /* This is called when the protocol is "OSMouse". */ + + pMse = pInfo->private; + 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 = ev_init(); + if (pInfo->fd != -1) { + dmask_t dmask = (D_REL | D_BUTTON); + pInfo->fd = ev_open(&dmask); + } else { + pInfo->fd = -999; + } + + if (pInfo->fd < 0) { + if (xf86GetAllowMouseOpenFail()) + xf86Msg(X_WARNING, "%s: cannot open event manager (%s)\n", + pInfo->name, evtErrStr(pInfo->fd)); + else { + xf86Msg(X_ERROR, "%s: cannot open event manager (%s)\n", + pInfo->name, evtErrStr(pInfo->fd)); + xfree(pMse); + return FALSE; + } + } + ev_close(); + pInfo->fd = -1; + + /* Process common mouse options (like Emulate3Buttons, etc). */ + pMse->CommonOptions(pInfo); + + /* Setup the local procs. */ + pInfo->device_control = OsMouseProc; + pInfo->read_input = OsMouseReadInput; + + pInfo->flags |= XI86_CONFIGURED; + return TRUE; +} + +OSMouseInfoPtr +xf86OSMouseInit (int flags) +{ + OSMouseInfoPtr p; + + p = xcalloc(sizeof(OSMouseInfoRec), 1); + if (!p) + return NULL; + + p->SupportedInterfaces = SupportedInterfaces; + p->BuiltinNames = BuiltinNames; + p->DefaultProtocol = DefaultProtocol; + p->CheckProtocol = CheckProtocol; + p->PreInit = OsMousePreInit; + + return p; +} Index: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c:3.6 xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c:3.7 --- xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c:3.6 Sun Apr 18 00:08:54 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c Sat Jun 30 18:41:49 2001 @@ -1,29 +1,41 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.6 1999/04/18 04:08:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.7 2001/06/30 22:41:49 tsi Exp $ */ /* - * Copyright 1993 by David McCullough <davidm@stallion.oz.au> - * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * * 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 David McCullough and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. David McCullough 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. + * documentation, and that the name J. Kean Johnston not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. J. Kean Johnston makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. * - * DAVID MCCULLOUGH AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL DAVID MCCULLOUGH 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. + * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL J. KEAN JOHNSTON 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$ */ + +/* Re-written May 2001 to represent the current state of reality */ + +/* + * This file contains the completely re-written SCO OpenServer video + * routines for XFree86 4.x. Much of this is based on the SCO X server + * code (which is an X11R5 server) and will probably only work on + * OpenServer versions 5.0.5, 5.0.6 and later. Please send me (jkj@sco.com) + * email if you have any questions. * + * Ideally, you should use OSR5.0.6A or later, with the updated console + * driver for 5.0.6A (its the default driver in 5.0.7 and later). + * However, if you are running on an older system, this code will detect + * that and adjust accordingly. */ -/* $XConsortium: sco_video.c /main/4 1996/02/22 10:46:34 kaleb $ */ #include "X.h" #include "input.h" @@ -32,247 +44,336 @@ #define _NEED_SYSI86 #include "xf86.h" #include "xf86Priv.h" +#include "xf86OSpriv.h" #include "xf86_OSlib.h" +#include <sys/ci/ciioctl.h> +#define MPXNAME "/dev/atp1" +#define BASECPU 1 + +extern Bool mpxLock; + +#define USE_VASMETHOD 1 + /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ -static struct kd_memloc MapDSC[MAXSCREENS][NUM_REGIONS]; -static int ver_once = 1; +static int sco_mcdone = 0, sco_ismc = 0; /***************************************************************************/ /* - * To map the video-memory, we use the MAP_CLASS ioctl. - * Different drivers may have to do another one of these - * for their own special registers (ie., ATI). To find - * out which strings are valid look in /etc/conf/pack.d/cn/class.h + * To map the video memory, we first need to see if we are on a multi-console + * system. If we are, we need to try to use an existing video class in the + * kernel. We do this by retrieving the list of currently defined classes + * (via the new CONS_GETCLASS ioctl()) to see if we have a class that will + * match the range of memory we desire. If we can't find one, we have an + * error and we abort. * - * if we fail to find one of these we try for the dmmap driver + * If we are not using a multi-console, we can simply use mmap() to map in + * the frame buffer, using the classs-access method as a fall-back only if + * the mmap() fails (it shouldn't). We always set the appropriate pointers + * in the config structure to point ot the right function to map and unmap + * the video memory. An alternative to using mmap() is to use the new + * CONS_ADDVAS call, which will use vasmalloc() and vasbind() in the kernel + * to map the physical address to a virtual one, which it then returns. + * I am not 100% sure if this is faster or not, but it may prove easier to + * debug things. Just to be on the safe side, I have included both methods + * here, and the mmap() method can be used by setting USE_VASMETHOD to 0 + * above. */ -struct { - unsigned long base, size; - char *class; -} SCO_Mapping[] = { - {0xA0000, 0x10000, "VGA"}, - {0xA0000, 0x20000, "SVGA"}, - {0xB0000, 0x08000, "HGA"}, - {0x0, 0x0, ""}, -}; +#if !defined(CONS_ADDVAS) +# undef USE_VASMETHOD +# define USE_VASMETHOD 0 +#endif -/* ARGSUSED */ -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) +static int +scoIsMultiConsole (void) { - int i; - char *class = (char *)NULL; - pointer base; - - for (i=0; SCO_Mapping[i].base != 0; i++) - { - if (((pointer)SCO_Mapping[i].base == Base) && - (SCO_Mapping[i].size == Size)) - { - class = SCO_Mapping[i].class; - break; - } - } - if (class == (char *)NULL) - { - int fd; - -#if defined(SVR4) || defined(SCO325) - if ((fd = open(DEV_MEM, O_RDWR)) < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - } - base = (pointer)mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)Base); - close(fd); - if ((long)base == -1) - { - FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - } + int x; - return(base); -#else - MapDSC[ScreenNum][Region].vaddr = (char *) NULL; - MapDSC[ScreenNum][Region].physaddr = (char *) Base; - MapDSC[ScreenNum][Region].length = Size; - MapDSC[ScreenNum][Region].ioflg = 1; - if ((fd = open("/dev/dmmap", O_RDWR)) >= 0) { - if (ioctl(fd, KDMAPDISP, &MapDSC[ScreenNum][Region]) == -1) - ErrorF("xf86MapVidMem: dmmap KDMAPDISP failed (%s)\n", - strerror(errno)); - else { - if (ver_once) - ErrorF("Using dmmap version 0x%04x.\n", - ioctl(fd, -1)); - ver_once = 0; - close(fd); - return(MapDSC[ScreenNum][Region].vaddr); - } - close(fd); - } - FatalError("xf86MapVidMem:No class map defined for (%x,%x)\n", - Base, Size); - /* NOTREACHED */ + if (sco_mcdone) + return sco_ismc; + x = access ("/usr/lib/vidconf/.multiconsole", F_OK); + if (x == 0) + sco_ismc = 1; + sco_mcdone = 1; + return sco_ismc; +} + +/* + * This maps memory using mmap() + */ +static pointer +mapVidMemMMAP(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + int fd; + unsigned long realBase, alignOff; + pointer base; + + fd = open (DEV_MEM, O_RDWR); + if (fd < 0) { + FatalError("xf86MapVidMem: failed to open %s (%s)\n", DEV_MEM, + strerror(errno)); + return 0; /* NOTREACHED */ + } + + realBase = Base & ~(getpagesize() - 1); + alignOff = Base - realBase; + +#ifdef DEBUG + ErrorF("base: %lx, realBase: %lx, alignOff: %lx\n", Base,realBase,alignOff); #endif - } + + base = mmap((caddr_t)0, Size + alignOff, PROT_READ|PROT_WRITE, + MAP_SHARED, fd, (off_t)realBase); + close(fd); + if (base == MAP_FAILED) { + FatalError("xf86MapVidMem: Could not mmap framebuffer (0x%08x,0x%x) (%s)\n", + Base, Size, strerror(errno)); + return 0; /* NOTREACHED */ + } - base = (pointer)ioctl(xf86Info.consoleFd, MAP_CLASS, class); - if ((int)base == -1) - { - FatalError("xf86MapVidMem:Failed to map video mem class %s\n", - class); - /* NOTREACHED */ - } - return(base); +#ifdef DEBUG + ErrorF("base: %lx aligned base: %lx\n",base, base + alignOff); +#endif + return (pointer)((char *)base + alignOff); } +#if (USE_VASMETHOD) /* - * Nothing to do here if it wasn't mapped using the dmmap driver + * This maps memory using the virtual address space (VAS) console calls. */ -/* ARGSUSED */ -void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) +static pointer +mapVidMemVAS(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { - int fd; + struct vidvasmem vas; + pointer base; -#if defined (SVR4) || defined(SCO325) - munmap(Base, Size); -#else /* SVR4 */ - if (MapDSC[ScreenNum][Region].vaddr) { - if ((fd = open("/dev/dmmap", O_RDWR)) < 0) { - if (ioctl(fd, KDUNMAPDISP, &MapDSC[ScreenNum][Region]) == -1) - ErrorF("xf86UnMapVidMem: dmmap KDUNMAPDISP failed (%s)\n", - strerror(errno)); - close(fd); - } - MapDSC[ScreenNum][Region].vaddr = (char *) NULL; - MapDSC[ScreenNum][Region].physaddr = (char *) NULL; - MapDSC[ScreenNum][Region].length = 0; - MapDSC[ScreenNum][Region].ioflg = 0; - } + vas.base = (long)Base; + vas.size = (long)Size; + + base = (pointer)ioctl (xf86Info.consoleFd, CONS_ADDVAS, &vas); + if (base == (pointer)-1) { + return mapVidMemMMAP(ScreenNum, Base, Size, flags); + } + return base; +} +#endif /* USE_VASMETHOD */ + +struct vidclass vidclasslist[] = { + { "VBE", "", 0xf0000000, 0x2000000, 0 }, + { "P9000", "", 0xc0000000, 0x400000, 0 }, + { "TULIP", "", 0x80000000, 0x400000, 0 }, + { "VIPER", "", 0xa0000000, 0x400000, 0 }, + { "S3T", "", 0xa0000000, 0x200000, 0 }, + { "S3DT", "", 0x4000000, 0x400000, 0 }, + { "MGA", "", 0x2200000, 0x4000, 0 }, + { "CLVGA", "", 0xa0000, 0x20000, 0 }, + { "OLIVE", "", 0xd8000000, 0x400000, 0 }, + { "S3C", "", 0xa0000, 0x10000, 0 }, + { "MGAVLB", "", 0xac000, 0x34000, 0 }, + { "ATI8514", "", 0xFF000, 0x1000, 0 }, + { "GXREGS", "", 0xb0000, 0x10000, 0 }, + { "GX", "", 0xa0000, 0x10000, 0 }, + { "CT64300", "", 0xa0000000, 0x400000, 0 }, + { "SVGA", "", 0xa0000, 0x20000, 0 }, + { "S3V", "", 0xa0000000, 0x400000, 0 }, + { "8514A", "", 0xFF000, 0x1000, 0 }, + { "VGA", "", 0xa0000, 0x10000, 0 }, + { 0 } +}; + +static pointer +mapVidMemVC(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + struct vidclass *vcp; + char *class = NULL; + pointer base; + + for (vcp = vidclasslist; vcp->name; vcp++) { + if ((vcp->base == Base) && (vcp->size == Size)) { + class = vcp->name; + break; + } + } + + if (class == NULL) { + /* + * As a fall-back, we will try and use the mmap() approach. This may + * prove to be the wrong thing to do, but time and testing will tell. + */ + ErrorF("xf86MapVidMem: No class map defined for (0x%08x,0x%08x)\n", Base, Size); +#if USE_VASMETHOD + return mapVidMemVAS(ScreenNum, Base, Size, flags); +#else /* !USE_VASMETHOD */ + return mapVidMemMMAP(ScreenNum, Base, Size, flags); #endif - return; + } + + /* + * We found a suitable class. Try and use it. + */ + base = (pointer)ioctl(xf86Info.consoleFd, MAP_CLASS, class); + if ((int)base == -1) { + FatalError("xf86MapVidMem: Failed to map video memory class `%s'\n", class); + return 0; /* NOTREACHED */ + } + + return base; } + +/* + * Unmapping the video memory is easy. We always call munmap(), as it is + * safe to do so even if we haven't actually mapped in any pages via mmap(). + * In the case where we used the video class, we don't need to do anything + * as the kernel will clean up the TSS when we exit, and will undo the + * vasbind() that was done when the class was originally mapped. If we used + * vasmap, we simply undo the map. Again, it is benign to call vasunmap + * even if we got the frame buffer via some other mechanism (like mmap). + */ -/* ARGSUSED */ -Bool xf86LinearVidMem() +static void +unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) { - int fd, ver; +#if USE_VASMETHOD + struct vidvasmem vas; + int x; + + vas.base = (long)Base; + vas.size = (long)Size; + + x = ioctl (xf86Info.consoleFd, CONS_DELVAS, &vas); + if (x == 0) + return; +#endif /* USE_VASMETHOD */ -#if defined(SVR4) || defined(SCO325) - return TRUE; + munmap(Base, Size); +} + +/* + * Set things up to point to our local functions. When the kernel gets + * MTRR support, we will need to add the required functions for that + * here too. MTRR support will most likely appear in 5.0.8 or 5.1.0. + * + * We also want to lock the X server process to the base CPU in an MPX + * system, since we will be going to IOPL 3. Most engine drivers can cope + * with I/O access on any CPU but there are a few (AST Manhattan I believe) + * that can't, so the server needs to be locked to CPU0. + */ +void +xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + int mpx_fd; + + if (scoIsMultiConsole ()) { + pVidMem->mapMem = mapVidMemVC; + } else { +#if USE_VASMETHOD + pVidMem->mapMem = mapVidMemVAS; #else - if ((fd = open("/dev/dmmap", O_RDWR)) >= 0) { - ver = ioctl(fd, -1); - close(fd); - if (ver >= 0) { - if (ver_once) - ErrorF("Using dmmap version 0x%04x.\n", ver); - ver_once = 0; - return(TRUE); - } - } - return(FALSE); + pVidMem->mapMem = mapVidMemMMAP; #endif + } + + pVidMem->unmapMem = unmapVidMem; + pVidMem->linearSupported = TRUE; + pVidMem->initialised = TRUE; + + if (mpxLock && (mpx_fd = open (MPXNAME, O_RDONLY)) > 0) { + if (ioctl (mpx_fd, ACPU_XLOCK, BASECPU) < 0) + ErrorF ("xf86OSInitVidMem: Can not bind to CPU 0 (%s)\n", + strerror(errno)); + close (mpx_fd); + } } /***************************************************************************/ /* I/O Permissions section */ /***************************************************************************/ - -static Bool ScreenEnabled[MAXSCREENS]; -static Bool IOEnabled = FALSE; -static Bool InitDone = FALSE; -void xf86ClearIOPortList(ScreenNum) -int ScreenNum; -{ - int i; +/* + * There is a right way and a wrong way of doing this. Unfortunately, we + * are forced to do it the wrong way. The right way is to be told the range + * or ranges of I/O ports the driver(s) need access to, in order to use the + * CONS_IOPERM ioctl() to grant access only to those ports we care about. + * This way we can guarantee some small level of stability because a driver + * does not have access to all ports (which would mean it could play with + * the PIT and thus affect scheduling times, or a whole slew of other + * nasty things). However, because XFree86 currently only enables or disables + * ALL port access, we need to run at IOPL 3, which basically means the + * X Server runs at the same level as the kernel. You can image why this is + * unsafe. Oh, and this is not a problem unique to OSR5, other OSes are + * affected by this as well. + * + * So, for the time being, we change our IOPL until such time as the XFree86 + * architecture is changed to allow for tighter control of I/O ports. If and + * when it is, then the CONS_ADDIOP/DELIOP ioctl() should be used to enable + * or disable access to the desired ports. + */ - if (!InitDone) - { - for (i = 0; i < MAXSCREENS; i++) - ScreenEnabled[i] = FALSE; - InitDone = TRUE; - } -} +extern long sysi86 (int cmd, ...); -/* ARGSUSED */ -void xf86AddIOPorts(ScreenNum, NumPorts, Ports) -int ScreenNum; -int NumPorts; -unsigned *Ports; -{ -} +static Bool IOEnabled = FALSE; -void xf86EnableIOPorts(ScreenNum) -int ScreenNum; +void xf86EnableIO(void) { - ScreenEnabled[ScreenNum] = TRUE; - if (IOEnabled) return; if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) FatalError("Failed to set IOPL for extended I/O\n"); IOEnabled = TRUE; - return; } -void xf86DisableIOPorts(ScreenNum) -int ScreenNum; +void xf86DisableIO(void) { - int i; - - ScreenEnabled[ScreenNum] = FALSE; - if (!IOEnabled) return; - for (i = 0; i < MAXSCREENS; i++) - if (ScreenEnabled[i]) - return; sysi86(SI86V86, V86SC_IOPL, 0); IOEnabled = FALSE; - return; } -void xf86DisableIOPrivs() -{ - if (IOEnabled) - sysi86(SI86V86, V86SC_IOPL, 0); - return; -} - /***************************************************************************/ /* Interrupt Handling section */ /***************************************************************************/ Bool xf86DisableInterrupts() { + if (!IOEnabled) { + if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) + return FALSE; + } + #ifdef __GNUC__ - __asm__ __volatile__("cli"); + __asm__ __volatile__("cli"); #else - asm("cli"); + asm("cli"); #endif /* __GNUC__ */ - - return(TRUE); + + if (!IOEnabled) { + sysi86(SI86V86, V86SC_IOPL, PS_IOPL); + } + + return(TRUE); } void xf86EnableInterrupts() { + if (!IOEnabled) { + if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) + return; + } + #ifdef __GNUC__ - __asm__ __volatile__("sti"); + __asm__ __volatile__("sti"); #else - asm("sti"); + asm("sti"); #endif /* __GNUC__ */ - return; + if (!IOEnabled) { + sysi86(SI86V86, V86SC_IOPL, PS_IOPL); + } } 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.4.1 xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c:1.9 --- xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c:1.8.4.1 Wed May 23 10:47:45 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c Wed May 23 10:46:05 2001 @@ -1,4 +1,4 @@ -/* $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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c,v 1.9 2001/05/23 14:46:05 alanh Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@goblin.org> * Index: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c:3.3 xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c:3.4 --- xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c:3.3 Sat Jul 25 12:57:00 1998 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c Mon Jul 23 09:15:48 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c,v 3.3 1998/07/25 16:57:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c,v 3.4 2001/07/23 13:15:48 dawes Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@XFree86.org> * @@ -24,7 +24,7 @@ /* $XConsortium: ioperm_noop.c /main/3 1996/02/21 17:53:39 kaleb $ */ /* - * Amoeba, Minix and 386BSD don't bother with I/O permissions, + * Some platforms don't bother with I/O permissions, * or the permissions are implicit with opening/enabling the console. */ 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.75 xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c:1.83 --- xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c:1.75 Fri May 18 16:22:30 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c Mon Jan 14 13:34:34 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.75 2001/05/18 20:22:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.83 2002/01/14 18:34:34 dawes Exp $ */ /* * Copyright 1997 by The XFree86 Project, Inc. * @@ -23,6 +23,9 @@ * */ +#if defined(linux) && !defined(__GLIBC__) +#undef __STRICT_ANSI__ +#endif #include <X.h> #include <Xmd.h> #include <Xos.h> @@ -34,11 +37,13 @@ #endif #include <sys/time.h> #include <math.h> +#ifdef sun +#include <ieeefp.h> +#endif #include <stdarg.h> #include <fcntl.h> #include "Xfuncproto.h" #include "os.h" -#include <stdarg.h> #include <ctype.h> #include <unistd.h> #include <string.h> @@ -77,11 +82,6 @@ #include <stdlib.h> #endif -#ifdef __CYGWIN__ -#define vsscanf sscanf -#define vfscanf fscanf -#endif - #define NEED_XF86_TYPES #define NEED_XF86_PROTOTYPES #define DONT_DEFINE_WRAPPERS @@ -133,7 +133,7 @@ #include <sys/wait.h> #undef _POSIX_SOURCE #else -#if defined(MINIX) || defined(AMOEBA) || (defined(ISC) && defined(_POSIX_SOURCE)) || defined(Lynx) || (defined (__alpha__) && defined(linux)) +#if (defined(ISC) && defined(_POSIX_SOURCE)) || defined(Lynx) || (defined (__alpha__) && defined(linux)) #include <sys/types.h> #endif #include <sys/wait.h> @@ -399,7 +399,9 @@ va_start(ap, flags); flags = xfToOsOpenFlags(flags); if (flags & O_CREAT) { - mode_t mode = va_arg(ap, mode_t); + /* can't request a mode_t directly on systems where mode_t + is an unsigned short */ + mode_t mode = (mode_t)va_arg(ap, unsigned int); fd = open(path, flags, mode); } else { fd = open(path, flags); @@ -1171,18 +1173,13 @@ return bsearch(key, base, (size_t)nmemb, (size_t)size, compar); } -/*VARARGS1*/ int xf86execl(const char *pathname, const char *arg, ...) { #ifndef __EMX__ int i; pid_t pid; -#ifdef MACH386 - union wait exit_status; -#else int exit_status; -#endif char *arglist[5]; va_list args; va_start(args, arg); @@ -1206,7 +1203,7 @@ xf86DisableIO(); #endif setuid(getuid()); -#if !defined(SELF_CONTAINED_WRAPPER) && !defined(AMOEBA) && !defined(MINIX) +#if !defined(SELF_CONTAINED_WRAPPER) /* set stdin, stdout to the consoleFD, and leave stderr alone */ for (i = 0; i < 2; i++) { @@ -1538,6 +1535,17 @@ xf86fabs(double x) { return(fabs(x)); +} + +int +xf86finite(double x) +{ +#ifndef QNX4 + return(finite(x)); +#else + /* XXX Replace this with something that really works. */ + return 1; +#endif } double Index: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c:1.12 xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c:1.13 --- xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c:1.12 Tue Nov 14 16:59:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c Mon Dec 24 17:30:45 2001 @@ -25,7 +25,7 @@ * * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.12 2000/11/14 21:59:24 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.13 2001/12/24 22:30:45 dawes Exp $ * */ @@ -107,7 +107,7 @@ #endif } -int +static int xf86IsPipe (int fd) { struct stat buf; @@ -123,6 +123,7 @@ struct sigaction sa; struct sigaction osa; int i; + int blocked; for (i = 0; i < MAX_FUNCS; i++) { @@ -140,6 +141,7 @@ #endif return 0; } + blocked = xf86BlockSIGIO(); if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) { #ifdef XFree86Server xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", @@ -148,6 +150,7 @@ fprintf(stderr,"fcntl(%d, O_ASYNC): %s\n", fd, strerror(errno)); #endif + xf86UnblockSIGIO(blocked); return 0; } sigemptyset(&sa.sa_mask); @@ -163,6 +166,7 @@ if (fd >= xf86SigIOMaxFd) xf86SigIOMaxFd = fd + 1; FD_SET (fd, &xf86SigIOMask); + xf86UnblockSIGIO(blocked); return 1; } /* Allow overwriting of the closure and callback */ Index: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c:1.14 xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c:1.15 --- xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c:1.14 Fri May 4 15:05:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c Sat Oct 27 23:34:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.14 2001/05/04 19:05:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.15 2001/10/28 03:34:02 tsi Exp $ */ /* * Copyright 1993-1999 by The XFree86 Project, Inc * @@ -135,6 +135,29 @@ } } +void +xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base, unsigned long Size, pointer Vbase) +{ + VidMapPtr vp; + MappingPtr mp; + + vp = getVidMapRec(ScreenNum); + mp = newMapping(vp); + mp->physBase = Base; + mp->size = Size; + mp->virtBase = Vbase; + mp->flags = Flags; +} + +void +xf86InitVidMem(void) +{ + if (!vidMemInfo.initialised) { + memset(&vidMemInfo, 0, sizeof(VidMemInfo)); + xf86OSInitVidMem(&vidMemInfo); + } +} + pointer xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) { @@ -146,10 +169,7 @@ (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)))) FatalError("Mapping memory with more than one type\n"); - if (!vidMemInfo.initialised) { - memset(&vidMemInfo, 0, sizeof(VidMemInfo)); - xf86OSInitVidMem(&vidMemInfo); - } + xf86InitVidMem(); if (!vidMemInfo.initialised || !vidMemInfo.mapMem) return NULL; @@ -231,10 +251,7 @@ Bool xf86LinearVidMem() { - if (!vidMemInfo.initialised) { - memset(&vidMemInfo, 0, sizeof(VidMemInfo)); - xf86OSInitVidMem(&vidMemInfo); - } + xf86InitVidMem(); return vidMemInfo.linearSupported; } Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile:1.8 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile:1.8 Sat Apr 7 12:37:16 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile Fri Jan 18 15:26:12 2002 @@ -1,52 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile,v 1.8 2001/04/07 16:37:16 dawes Exp $ - - - - - -XCOMM $XConsortium: Imakefile /main/5 1996/09/28 17:24:30 rws $ - -#include <Server.tmpl> - -#if !HasGcc -PROWORKS_INOUT_SRC = sol8_iout.s -PROWORKS_INOUT_OBJ = sol8_iout.o -#endif - -MOUSESRC = sol8_mouse.c -MOUSEOBJ = sol8_mouse.o - -SRCS = sol8_init.c sol8_vid.c sol8_bios.c sol8_kbd.c sol8_io.c \ - VTsw_noop.c sol8_kbd.c sol8_kbdEv.c posix_tty.c $(MOUSESRC) \ - libc_wrapper.c $(PROWORKS_INOUT_SRC) stdResource.c stdPci.c \ - sol8_kbdgetmapping.c sol8_postkbdevents.c sigiostubs.c pm_noop.c \ - kmod_noop.c agp_noop.c - -OBJS = sol8_init.o sol8_vid.o sol8_bios.o sol8_kbd.o sol8_io.o \ - VTsw_noop.o sol8_kbd.o sol8_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - libc_wrapper.o $(PROWORKS_INOUT_OBJ) stdResource.o stdPci.o \ - sol8_kbdgetmapping.o sol8_postkbdevents.o sigiostubs.o pm_noop.o \ - kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalAsmObjectRule() - -LinkSourceFile(VTsw_noop.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c:1.3 Sun Nov 19 11:38:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c Fri Jan 18 15:26:12 2002 @@ -1,95 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c,v 1.3 2000/11/19 16:38:07 tsi Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * Copyright 1999 by David Holland <davidh@iquest.net> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell, David Wexelblat, - * and David Holland not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. Thomas Roell, David Wexelblat, and David Holland - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL, DAVID WEXELBLAT, AND DAVID HOLLAND DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * THOMAS ROELL, DAVID WEXELBLAT OR DAVID HOLLAND BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#undef usleep -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -extern char *apertureDevName; - -/* - * Read BIOS via mmap()ing physical memory. - */ -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - unsigned char *ptr; - int psize; - int mlen; - - /* - * Solaris 2.1 x86 SVR4 (10/27/93) - * The server must treat the virtual terminal device file - * as the standard SVR4 /dev/pmem. By default, then used VT - * is considered the "default" file to open. - * - * Solaris 2.8 x86 (7/26/99) - DWH - * - * Use /dev/xsvc to gain access to any bit of physical memory - */ - if (!apertureDevName) - if (!xf86LinearVidMem()) - FatalError("xf86ReadBIOS: Could not mmap " - "BIOS [a=%x]\n", Base); - - if ((fd = open(apertureDevName, O_RDONLY)) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - return(-1); - } - psize = xf86getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t)Base); - if (ptr == MAP_FAILED) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed\n", - apertureDevName); - close(fd); - return(-1); - } - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); - (void)close(fd); - return(Len); -} - Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c:1.3 Fri Aug 11 15:51:04 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c Fri Jan 18 15:26:12 2002 @@ -1,196 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c,v 1.3 2000/08/11 19:51:04 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * Copyright 1999 by David Holland <davidh@iquest.net> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * DAVID HOLLAND, THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DAVID HOLLAND, THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sol8_init.c /main/4 1996/02/21 17:54:10 kaleb $ */ - -#include <signal.h> -#include <sys/time.h> -#include <unistd.h> - -#include "X.h" -#include "Xmd.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -static Bool KeepTty = FALSE; -#ifdef SVR4 -static Bool Protect0 = FALSE; -#endif - -char fb_dev[PATH_MAX] = "/dev/console"; - -#define MAX_SECONDS 60 -#define USEC_IN_SEC (unsigned long)1000000 - -#ifndef __SOL8__ -int xf86_sol8usleep(unsigned long); -static void xf86_sol8sleep(int); -#endif - -void sol8_setkbdinitiate(double value); -void sol8_setkbdrepeat(double value); - -void -xf86OpenConsole() -{ - int fd; - int i; - MessageType from = X_PROBED; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* Protect page 0 to help find NULL dereferencing */ - /* mprotect() doesn't seem to work */ - if (Protect0) - { - int fd = -1; - - if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: cannot open /dev/zero (%s)\n", - strerror(errno)); - } - else - { - if ((int)mmap(0, 0x1000, PROT_NONE, - MAP_FIXED | MAP_SHARED, fd, 0) == -1) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: failed to protect page 0 (%s)\n", - strerror(errno)); - } - close(fd); - } - } - - if (!KeepTty) - { - setpgrp(); - } - - if (((xf86Info.consoleFd = open(fb_dev, O_RDWR | O_NDELAY, 0)) < 0)) - { - FatalError("xf86OpenConsole: Cannot open %s (%s)\n", - fb_dev, strerror(errno)); - } - - } - return; -} - -void xf86CloseConsole() -{ - - int tmp; - - close(xf86Info.consoleFd); - -/* - * This probably shouldn't be here, however, there is no corresonding - * xf86CloseKbd() routine - DWH - */ - -/* - * Next set the keyboard into "indirect" mode and turn off - * event translation. - */ - - tmp = 0; - (void) ioctl(xf86Info.kbdFd, KIOCSDIRECT, &tmp); - tmp = TR_ASCII; - (void) ioctl(xf86Info.kbdFd, KIOCTRANS, &tmp); - - close(xf86Info.kbdFd); - - return; -} - -int xf86ProcessArgument(argc, argv, i) -int argc; -char *argv[]; -int i; -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } - /* - * Undocumented flag to protect page 0 from read/write to help - * catch NULL pointer dereferences. This is purely a debugging - * flag. - */ - if (!strcmp(argv[i], "-protect0")) - { - Protect0 = TRUE; - return(1); - } - if (!strcmp(argv[i], "-dev") && i+1 < argc) { - strncpy(fb_dev, argv[i+1], PATH_MAX); - fb_dev[PATH_MAX-1] = '\0'; - return(2); - } - - if (!strcmp(argv[i], "-ar1") && i+1 < argc) { - sol8_setkbdinitiate(atof(argv[i+1])); - return(2); - } - if (!strcmp(argv[i], "-ar2") && i+1 < argc) { - sol8_setkbdrepeat(atof(argv[i+1])); - return(2); - } - - return(0); -} - -void xf86UseMsg() -{ - ErrorF("-ar1 <float> Set autorepeat initiate time (sec)\n"); - ErrorF(" (If not using XKB)\n"); - ErrorF("-ar2 <float> Set autorepeat interval time (sec)\n"); - ErrorF(" (If not using XKB)\n"); - ErrorF("-dev <fb> FrameBuffer device\n"); - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} - Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c:1.2 Wed Oct 13 00:21:36 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c Fri Jan 18 15:26:12 2002 @@ -1,64 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c,v 1.2 1999/10/13 04:21:36 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes <dawes@xfree86.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Dawes makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sysv_io.c /main/8 1996/10/19 18:08:06 kaleb $ */ - -#include "X.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -void -xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - int kbdCmd; - - if (loudness && pitch) - { - kbdCmd = KBD_CMD_BELL; - if (ioctl (xf86Info.kbdFd, KIOCCMD, &kbdCmd) == -1) { - ErrorF("Failed to activate bell\n"); - return; - } - - usleep(xf86Info.bell_duration * loudness * 20); - - kbdCmd = KBD_CMD_NOBELL; - if (ioctl (xf86Info.kbdFd, KIOCCMD, &kbdCmd) == -1) - ErrorF ("Failed to deactivate bell\n"); - } -} - -void -xf86SetKbdLeds(int leds) -{ - if( ioctl(xf86Info.kbdFd, KIOCSLED, &leds) < 0 ) - ErrorF("Failed to set Keyboard LED's\n"); -} Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s:1.1 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s:1.1 Sat Sep 25 10:38:09 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s Fri Jan 18 15:26:12 2002 @@ -1,104 +0,0 @@ -/ $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s,v 1.1 1999/09/25 14:38:09 dawes Exp $ -/ -/ -/ -/ -/ $XConsortium: sol8_iout.s /main/4 1996/02/21 17:54:14 kaleb $ -/ -/ File: sol8_iout.s -/ -/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions -/ for Solaris 2.8 x86 using the ProWorks compiler by SunPro -/ -/ Author: Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com) -/ Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com) -/ -/ Synopsis: (c callable external declarations) -/ extern unsigned char inb(int port); -/ extern unsigned short inw(int port); -/ extern unsigned long inl(int port); -/ extern void outb(int port, unsigned char value); -/ extern void outw(int port, unsigned short value); -/ extern void outl(int port, unsigned long value); - - -.file "sol8_iout.s" -.text - -.globl inb -.globl inw -.globl inl -.globl outb -.globl outw -.globl outl - -/ -/ unsigned char inb(int port); -/ -.align 4 -inb: - movl 4(%esp),%edx - subl %eax,%eax - inb (%dx) - ret -.type inb,@function -.size inb,.-inb - -/ -/ unsigned short inw(int port); -/ -.align 4 -inw: - movl 4(%esp),%edx - subl %eax,%eax - inw (%dx) - ret -.type inw,@function -.size inw,.-inw - -/ -/ unsigned long inl(int port); -/ -.align 4 -inl: - movl 4(%esp),%edx - inl (%dx) - ret -.type inl,@function -.size inl,.-inl - -/ -/ void outb(int port, unsigned char value); -/ -.align 4 -outb: - movl 4(%esp),%edx - movl 8(%esp),%eax - outb (%dx) - ret -.type outb,@function -.size outb,.-outb - -/ -/ void outw(int port, unsigned short value); -/ -.align 4 -outw: - movl 4(%esp),%edx - movl 8(%esp),%eax - outw (%dx) - ret -.type outw,@function -.size outw,.-outw - -/ -/ void outl(int port, unsigned long value); -/ -.align 4 -outl: - movl 4(%esp),%edx - movl 8(%esp),%eax - outl (%dx) - ret -.type outl,@function -.size outl,.-outl Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c:1.3 Fri Nov 19 08:55:03 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c Fri Jan 18 15:26:12 2002 @@ -1,146 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c,v 1.3 1999/11/19 13:55:03 hohndel Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes <dawes@XFree86.org> - * Copyright 1999 by David Holland <davidh@iquest.net) - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell, David Dawes, and - * David Holland not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. Thomas Roell, David Dawes, and David Holland - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL, DAVID DAWES, AND DAVID HOLLAND DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELL, DAVID DAWES, - * OR DAVID HOLLAND BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include "X.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include <sys/kbd.h> - -void sol8_setkbdinitiate(double value); -void sol8_setkbdrepeat(double value); - -static int sol8_otranslation = -1; -static int sol8_odirect = -1; - -int -xf86GetKbdLeds() -{ - int leds; - - ioctl(xf86Info.kbdFd, KIOCGLED, &leds); - return(leds); -} - -void -xf86SetKbdRepeat(char rad) -{ - - sol8_setkbdinitiate( (double) xf86Info.kbdDelay / 1000.0 ); - sol8_setkbdrepeat( (double) xf86Info.kbdRate / 1000.0 ); - return; -} - - -/* - * Save initial keyboard state. This is called at the start of each server - * generation. - * - * Solx86_8: Should determine keyboard type. - * Should save keyboard state. - */ - -void xf86KbdInit() -{ - int ktype, klayout; - - if(xf86Info.kbdFd < 0) { - xf86Info.kbdFd = open("/dev/kbd", O_RDWR|O_NONBLOCK); - if(xf86Info.kbdFd < 0) { - FatalError("Unable to open keyboard: /dev/kbd\n"); - } - } - -/* - * None of the followin should ever fail. If it does, something is broke - * (IMO) - DWH 8/21/99 - */ - - if( ioctl(xf86Info.kbdFd, KIOCTYPE, &ktype) < 0) { - FatalError("Unable to determine keyboard type: %d\n", errno); - } - - if( ioctl(xf86Info.kbdFd, KIOCLAYOUT, &klayout) < 0) { - FatalError("Unable to determine keyboard layout: %d\n", errno); - } - - if( ioctl(xf86Info.kbdFd, KIOCGTRANS, &sol8_otranslation) < 0) { - FatalError("Unable to determine keyboard translation mode\n"); - } - - if( ioctl(xf86Info.kbdFd, KIOCGDIRECT, &sol8_odirect) < 0) { - FatalError("Unable to determine keyboard direct setting\n"); - } - - return; - -} - -int xf86KbdOn(void) -{ - int tmp = 1; - - if(ioctl(xf86Info.kbdFd, KIOCSDIRECT, &tmp) == -1) { - FatalError("Setting keyboard direct mode on\n"); - return -1; - } - - /* Setup translation */ - - tmp = TR_UNTRANS_EVENT; - - if(ioctl(xf86Info.kbdFd, KIOCTRANS, &tmp) == -1) { - FatalError("Setting keyboard translation\n"); - return -1; - } - return(xf86Info.kbdFd); -} - -int -xf86KbdOff() -{ - - if(sol8_otranslation != -1) { - if( ioctl(xf86Info.kbdFd, KIOCTRANS, &sol8_otranslation) < 0) { - FatalError("Unable to restore keyboard translation mode\n"); - } - } - - if(sol8_odirect != 0) { - if( ioctl(xf86Info.kbdFd, KIOCSDIRECT, &sol8_odirect) < 0 ){ - FatalError("Unable to restore keyboard direct setting\n"); - } - } - - return(xf86Info.kbdFd); -} Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c:1.1 Sat Sep 25 10:38:09 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c Fri Jan 18 15:26:12 2002 @@ -1,70 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c,v 1.1 1999/09/25 14:38:09 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes <dawes@xfree86.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Dawes makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: std_kbdEv.c /main/4 1996/03/11 10:47:33 kaleb $ */ - -#include "X.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - - -#include <stdio.h> -#include <stdlib.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/stream.h> -#include <sys/stropts.h> -#include <sys/vuid_event.h> -#include <sys/kbio.h> -#include <sys/kbd.h> -#include <termio.h> - -extern sol8PostKbdEvent(Firm_event *event); - -/* Lets try reading more than one keyboard event at a time in the - * hopes that this will be slightly more efficient. - * Or we could just try the MicroSoft method, and forget about - * efficiency. :-) - */ -void -xf86KbdEvents() -{ - Firm_event event[64]; - - int nBytes, i; - -/* I certainly hope its not possible to read partial events. */ - - if ((nBytes = read( xf86Info.kbdFd, (char *)event, sizeof(event))) - > 0) - { - for (i = 0; i < (nBytes / sizeof(Firm_event)); i++) - sol8PostKbdEvent(&event[i]); - } -} - Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c:1.1 Sat Sep 25 10:38:09 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c Fri Jan 18 15:26:12 2002 @@ -1,136 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c,v 1.1 1999/09/25 14:38:09 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sol8Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */ - -#include "X.h" -#include "Xmd.h" -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "sol8_keynames.h" -#include "xf86Config.h" - -#include "sol8_keymap.h" - - -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return (TRUE); -} - - - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -xf86KbdGetMapping (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; -{ - KeySym *k; - char type; - int i; - KeySym *pMap; - - xf86Info.kbdType = 0; - pMap = sol8defaultKeymap; - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = pMap, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - xf86Info.kbdType = 0; - - pKeySyms->map = pMap; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h:1.2 Mon Sep 27 10:59:28 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h Fri Jan 18 15:26:12 2002 @@ -1,144 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h,v 1.2 1999/09/27 14:59:28 dawes Exp $ */ -/* - * replacement for xf86Keymap.h - for Solaris8_x86 - */ - -/* Assumes a US English keyboard as default - sorry 'bout that - * - * Hopefully it'll be enough someone can have a sorta working - * keyboard, if they're not using XKB - * - * DWH 9/12/99 - */ - -static KeySym sol8defaultKeymap[NUM_KEYCODES * GLYPHS_PER_KEY] = { - - /* 000 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 001 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, /* ` */ - /* 002 */ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 1 */ - /* 003 */ XK_2, XK_at, NoSymbol, NoSymbol, /* 2 */ - /* 004 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 3 */ - /* 005 */ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 4 */ - /* 006 */ XK_5, XK_percent, NoSymbol, NoSymbol, /* 5 */ - /* 007 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 6 */ - /* 008 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 7 */ - /* 009 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 8 */ - /* 010 */ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 9 */ - /* 011 */ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 10 */ - /* 012 */ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* - */ - /* 013 */ XK_equal, XK_plus, NoSymbol, NoSymbol, /* = */ - /* 014 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 015 */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* ^H */ - /* 016 */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* ^I */ - /* 017 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* q */ - /* 018 */ XK_W, NoSymbol, NoSymbol, NoSymbol, /* w */ - /* 019 */ XK_E, NoSymbol, NoSymbol, NoSymbol, /* e */ - /* 020 */ XK_R, NoSymbol, NoSymbol, NoSymbol, /* r */ - /* 021 */ XK_T, NoSymbol, NoSymbol, NoSymbol, /* t */ - /* 022 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* y */ - /* 023 */ XK_U, NoSymbol, NoSymbol, NoSymbol, /* u */ - /* 024 */ XK_I, NoSymbol, NoSymbol, NoSymbol, /* i */ - /* 025 */ XK_O, NoSymbol, NoSymbol, NoSymbol, /* o */ - /* 026 */ XK_P, NoSymbol, NoSymbol, NoSymbol, /* p */ - /* 027 */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* [ */ - /* 028 */ XK_bracketright, XK_braceright, NoSymbol, NoSymbol, /* { */ - /* 029 */ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* | */ - /* 030 */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 031 */ XK_A, NoSymbol, NoSymbol, NoSymbol, /* a */ - /* 032 */ XK_S, NoSymbol, NoSymbol, NoSymbol, /* s */ - /* 033 */ XK_D, NoSymbol, NoSymbol, NoSymbol, /* d */ - /* 034 */ XK_F, NoSymbol, NoSymbol, NoSymbol, /* f */ - /* 035 */ XK_G, NoSymbol, NoSymbol, NoSymbol, /* g */ - /* 036 */ XK_H, NoSymbol, NoSymbol, NoSymbol, /* h */ - /* 037 */ XK_J, NoSymbol, NoSymbol, NoSymbol, /* j */ - /* 038 */ XK_K, NoSymbol, NoSymbol, NoSymbol, /* k */ - /* 039 */ XK_L, NoSymbol, NoSymbol, NoSymbol, /* l */ - /* 040 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* ; */ - /* 041 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, /* ' */ - /* 042 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 043 */ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 044 */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 045 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 046 */ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* z */ - /* 047 */ XK_X, NoSymbol, NoSymbol, NoSymbol, /* x */ - /* 048 */ XK_C, NoSymbol, NoSymbol, NoSymbol, /* c */ - /* 049 */ XK_V, NoSymbol, NoSymbol, NoSymbol, /* v */ - /* 050 */ XK_B, NoSymbol, NoSymbol, NoSymbol, /* b */ - /* 051 */ XK_N, NoSymbol, NoSymbol, NoSymbol, /* n */ - /* 052 */ XK_M, NoSymbol, NoSymbol, NoSymbol, /* m */ - /* 053 */ XK_comma, XK_less, NoSymbol, NoSymbol, /* , */ - /* 054 */ XK_period, XK_greater, NoSymbol, NoSymbol, /* . */ - /* 055 */ XK_slash, XK_question, NoSymbol, NoSymbol, /* / */ - /* 056 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 057 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 058 */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 059 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 060 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, /* hmmm */ - /* 061 */ XK_space, NoSymbol, NoSymbol, NoSymbol, /* */ - /* 062 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, /* hmmm */ - /* 063 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 064 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 065 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 066 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 067 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 068 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 069 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 070 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 071 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 072 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 073 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 074 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 075 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 076 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 077 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 078 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 079 */ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 080 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 081 */ XK_End, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 082 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 083 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 084 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 085 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 086 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 087 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 088 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 089 */ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 090 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 091 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* hmm */ - /* 092 */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* hmm */ - /* 093 */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /* hmm */ - /* 094 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 095 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* / */ - /* 096 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* hmm */ - /* 097 */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 5 */ - /* 098 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /* hmm */ - /* 099 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* hmm */ - /* 100 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* * */ - /* 101 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, - /* 102 */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, - /* 103 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, - /* 104 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, - /* 105 */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* - */ - /* 106 */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /* + */ - /* 107 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 108 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, - /* 109 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 110 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* Esc */ - /* 111 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 112 */ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* F1 */ - /* 113 */ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* F2 */ - /* 114 */ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* F3 */ - /* 115 */ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* F4 */ - /* 116 */ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* F5 */ - /* 117 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* F6 */ - /* 118 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* F7 */ - /* 119 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* F8 */ - /* 120 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* F9 */ - /* 121 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* F10 */ - /* 122 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, /* F11 */ - /* 123 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, /* F12 */ - /* 124 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, /* Print Screen */ - /* 125 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* Scroll Lock */ - /* 126 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, /* Pause */ -}; - 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.10 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h:1.10 Sat Apr 7 12:37:16 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h Fri Jan 18 15:26:12 2002 @@ -1,150 +0,0 @@ -/* $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 - -#include "atKeynames.h" - -#ifdef DEFINE_SOL8_MAP -/* Map the Solaris 8 keycodes to the "XFree86" keycodes. */ -unsigned char sol8map[256] = { - KEY_NOTUSED, /* 0 */ - KEY_Tilde, /* 1 */ - KEY_1, /* 2 */ - KEY_2, /* 3 */ - KEY_3, /* 4 */ - KEY_4, /* 5 */ - KEY_5, /* 6 */ - KEY_6, /* 7 */ - KEY_7, /* 8 */ - KEY_8, /* 9 */ - KEY_9, /* 10 */ - KEY_0, /* 11 */ - KEY_Minus, /* 12 */ - KEY_Equal, /* 13 */ - 0x7D, /*KEY_P_YEN*/ /* 14 */ - KEY_BackSpace, /* 15 */ - KEY_Tab, /* 16 */ - KEY_Q, /* 17 */ - KEY_W, /* 18 */ - KEY_E, /* 19 */ - KEY_R, /* 20 */ - KEY_T, /* 21 */ - KEY_Y, /* 22 */ - KEY_U, /* 23 */ - KEY_I, /* 24 */ - KEY_O, /* 25 */ - KEY_P, /* 26 */ - KEY_LBrace, /* 27 */ - KEY_RBrace, /* 28 */ - KEY_BSlash, /* 29 */ - KEY_CapsLock, /* 30 */ - KEY_A, /* 31 */ - KEY_S, /* 32 */ - KEY_D, /* 33 */ - KEY_F, /* 34 */ - KEY_G, /* 35 */ - KEY_H, /* 36 */ - KEY_J, /* 37 */ - KEY_K, /* 38 */ - KEY_L, /* 39 */ - KEY_SemiColon, /* 40 */ - KEY_Quote, /* 41 */ - KEY_UNKNOWN, /* 42 */ - KEY_Enter, /* 43 */ - KEY_ShiftL, /* 44 */ - KEY_Less, /* 45 */ - KEY_Z, /* 46 */ - KEY_X, /* 47 */ - KEY_C, /* 48 */ - KEY_V, /* 49 */ - KEY_B, /* 50 */ - KEY_N, /* 51 */ - KEY_M, /* 52 */ - KEY_Comma, /* 53 */ - KEY_Period, /* 54 */ - KEY_Slash, /* 55 */ - KEY_BSlash2, /* 56 */ - KEY_ShiftR, /* 57 */ - KEY_LCtrl, /* 58 */ - KEY_LMeta, /* 59 */ - KEY_Alt, /* 60 */ - KEY_Space, /* 61 */ - KEY_AltLang, /* 62 */ - KEY_RMeta, /* 63 */ - KEY_RCtrl, /* 64 */ - KEY_Menu, /* 65 */ - KEY_UNKNOWN, /* 66 */ - KEY_UNKNOWN, /* 67 */ - KEY_UNKNOWN, /* 68 */ - KEY_UNKNOWN, /* 69 */ - KEY_UNKNOWN, /* 70 */ - KEY_UNKNOWN, /* 71 */ - KEY_UNKNOWN, /* 72 */ - KEY_UNKNOWN, /* 73 */ - KEY_UNKNOWN, /* 74 */ - KEY_Insert, /* 75 */ - KEY_Delete, /* 76 */ - KEY_UNKNOWN, /* 77 */ - KEY_UNKNOWN, /* 78 */ - KEY_Left, /* 79 */ - KEY_Home, /* 80 */ - KEY_End, /* 81 */ - KEY_UNKNOWN, /* 82 */ - KEY_Up, /* 83 */ - KEY_Down, /* 84 */ - KEY_PgUp, /* 85 */ - KEY_PgDown, /* 86 */ - KEY_UNKNOWN, /* 87 */ - KEY_UNKNOWN, /* 88 */ - KEY_Right, /* 89 */ - KEY_NumLock, /* 90 */ - KEY_KP_7, /* 91 */ - KEY_KP_4, /* 92 */ - KEY_KP_1, /* 93 */ - KEY_UNKNOWN, /* 94 */ - KEY_KP_Divide, /* 95 */ - KEY_KP_8, /* 96 */ - KEY_KP_5, /* 97 */ - KEY_KP_2, /* 98 */ - KEY_KP_0, /* 99 */ - KEY_KP_Multiply, /* 100 */ - KEY_KP_9, /* 101 */ - KEY_KP_6, /* 102 */ - KEY_KP_3, /* 103 */ - KEY_KP_Decimal, /* 104 */ - KEY_KP_Minus, /* 105 */ - KEY_KP_Plus, /* 106 */ - KEY_UNKNOWN, /* 107 */ - KEY_KP_Enter, /* 108 */ - KEY_UNKNOWN, /* 109 */ - KEY_Escape, /* 110 */ - KEY_UNKNOWN, /* 111 */ - KEY_F1, /* 112 */ - KEY_F2, /* 113 */ - KEY_F3, /* 114 */ - KEY_F4, /* 115 */ - KEY_F5, /* 116 */ - KEY_F6, /* 117 */ - KEY_F7, /* 118 */ - KEY_F8, /* 119 */ - KEY_F9, /* 120 */ - KEY_F10, /* 121 */ - KEY_F11, /* 122 */ - KEY_F12, /* 123 */ - KEY_Print, /* 124 */ - KEY_ScrollLock, /* 125 */ - KEY_Pause, /* 126 */ - KEY_UNKNOWN, /* 127 */ - KEY_UNKNOWN, /* 128 */ - KEY_UNKNOWN, /* 129 */ - KEY_UNKNOWN, /* 130 */ - KEY_NFER, /* 131 */ - KEY_XFER, /* 132 */ - KEY_HKTG, /* 133 */ - KEY_UNKNOWN, /* 134 */ - /* The rest default to KEY_UNKNOWN */ -}; -#endif - -#endif /* _SOL8KEYNAMES_H */ 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.2 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c:1.2 Thu Apr 5 22:16:25 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c Fri Jan 18 15:26:12 2002 @@ -1,286 +0,0 @@ -/* $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-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 | MSE_MISC; -} - -static const char * -DefaultProtocol(void) -{ - return "VUID"; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - 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.4 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c:1.4 Sun Jan 21 16:19:38 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c Fri Jan 18 15:26:12 2002 @@ -1,395 +0,0 @@ -/* $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. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sol8PostKbdEvents.c /main/46 1996/10/25 11:36:30 kaleb $ */ - -/* [JCH-96/01/21] Extended std reverse map to four buttons. */ - -#include "X.h" -#include "Xproto.h" -#include "misc.h" - -#include "compiler.h" - -#include "Xpoll.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSlib.h" - - -#ifdef XINPUT -#include "XI.h" -#include "XIproto.h" -#include "xf86Xinput.h" -#else -#include "inputstr.h" -#endif - -#include <sys/vuid_event.h> -#define DEFINE_SOL8_MAP -#include "sol8_keynames.h" - -#ifdef XKB -extern Bool noXkbExtension; -#endif - -#define XE_POINTER 1 -#define XE_KEYBOARD 2 - -#ifdef XTESTEXT1 - -#define XTestSERVER_SIDE -#include "xtestext1.h" -extern short xtest_mousex; -extern short xtest_mousey; -extern int on_steal_input; -extern Bool XTestStealKeyData(); -extern void XTestStealMotionData(); - -#ifdef XINPUT -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - xf86eqEnqueue((ev)) -#else -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - mieqEnqueue((ev)) -#endif - -#define MOVEPOINTER(dx, dy, time) \ - if (on_steal_input) \ - XTestStealMotionData(dx, dy, XE_POINTER, xtest_mousex, xtest_mousey); \ - miPointerDeltaCursor (dx, dy, time) - -#else /* ! XTESTEXT1 */ - -#ifdef XINPUT -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - xf86eqEnqueue((ev)) -#else -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - mieqEnqueue((ev)) -#endif -#define MOVEPOINTER(dx, dy, time) \ - miPointerDeltaCursor (dx, dy, time) - -#endif - - -/* - * Static variables to handle auto-repeat of keyboard keys. - * (Only needed if not using XKB) - * - */ - -void sol8_setkbdinitiate(double value); -void sol8_setkbdrepeat(double value); -void sol8_startautorepeat(int keycode); -CARD32 sol8_processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg); - - -static int sol8AutoRepeatInitiate = 400; /* defaults .4 sec */ -static int sol8AutoRepeatDelay = 50; /* default of .05 sec */ - -static OsTimerPtr sol8Timer = NULL; - - -/* - * sol8PostKbdEvent -- - * Translate the raw hardware Firm_event into an XEvent, and tell DIX - * about it. KeyCode preprocessing and so on is done ... - * - * Most of the Solaris 8 stuff has whacked Panix/PC98 support in the - * interests of simplicity - DWH 8/30/99 - * - */ - -void sol8PostKbdEvent(Firm_event *event) -{ - int specialkey; - Bool down; - KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; - Bool updateLeds = FALSE; - Bool UsePrefix = FALSE; - Bool Direction = FALSE; - xEvent kevent; - KeySym *keysym; - int keycode; - static int lockkeys = 0; - -/* - * Give down a value - */ - - if(event->value == VKEY_DOWN) - down = TRUE; - else - down = FALSE; - - /* - * and now get some special keysequences - */ - - specialkey = sol8map[event->id]; - - if ((ModifierDown(ControlMask | AltMask)) || - (ModifierDown(ControlMask | AltLangMask))) - { - - switch (specialkey) { - - case KEY_BackSpace: - if (!xf86Info.dontZap) { - DGAShutdown(); - GiveUp(0); - } - break; - - /* - * The idea here is to pass the scancode down to a list of - * registered routines. There should be some standard conventions - * for processing certain keys. - */ - case KEY_KP_Minus: /* Keypad - */ - if (!xf86Info.dontZoom) { - if (down) xf86ZoomViewport(xf86Info.currentScreen, -1); - return; - } - break; - - case KEY_KP_Plus: /* Keypad + */ - if (!xf86Info.dontZoom) { - if (down) xf86ZoomViewport(xf86Info.currentScreen, 1); - return; - } - break; - } - } - - - /* - * Now map the scancodes to real X-keycodes ... - */ - keycode = sol8map[event->id]; - if (keycode == KEY_NOTUSED) { - xf86MsgVerb(X_INFO, 0, - "raw code %d mapped to KEY_NOTUSED -- please report\n", event->id); - return; - } else if (keycode == KEY_UNKNOWN) { - xf86MsgVerb(X_INFO, 0, - "raw code %d mapped to KEY_UNKNOWN -- please report\n", event->id); - return; - } - keycode += MIN_KEYCODE; - keysym = (keyc->curKeySyms.map + - keyc->curKeySyms.mapWidth * - (keycode - keyc->curKeySyms.minKeyCode)); - -#ifdef XKB - if (noXkbExtension) { -#endif - /* - * Toggle lock keys. - */ -#define CAPSFLAG 0x01 -#define NUMFLAG 0x02 -#define SCROLLFLAG 0x04 -#define MODEFLAG 0x08 - -/* - * Handle the KeyPresses of the lock keys. - */ - - if(down) { - switch( keysym[0] ) { - case XK_Caps_Lock: - if(lockkeys & CAPSFLAG) { - lockkeys &= ~CAPSFLAG; - return; - } else { - lockkeys |= CAPSFLAG; - updateLeds = TRUE; - } - xf86Info.capsLock = down; - break; - - case XK_Num_Lock: - if(lockkeys & NUMFLAG) { - lockkeys &= ~NUMFLAG; - return; - } else { - lockkeys |= NUMFLAG; - updateLeds = TRUE; - } - xf86Info.numLock = down; - break; - - case XK_Scroll_Lock: - if(lockkeys & SCROLLFLAG) { - lockkeys &= ~SCROLLFLAG; - return; - } else { - lockkeys |= SCROLLFLAG; - updateLeds = TRUE; - } - xf86Info.scrollLock = down; - break; - } - } else { - -/* - * Handle the releases of the lock keys. - */ - switch( keysym[0] ) { - case XK_Caps_Lock: - if(lockkeys & CAPSFLAG) { - return; - } else { - updateLeds = TRUE; - } - xf86Info.capsLock = down; - break; - - case XK_Num_Lock: - if(lockkeys & NUMFLAG) { - return; - } else { - updateLeds = TRUE; - } - xf86Info.numLock = down; - break; - - case XK_Scroll_Lock: - if(lockkeys & SCROLLFLAG) { - return; - } else { - updateLeds = TRUE; - } - xf86Info.scrollLock = down; - break; - } - } - - if (updateLeds) xf86KbdLeds(); -#ifdef XKB - } -#endif - -/* - * If this keycode is not a modifier key, and its down - * initiate the autorepeate sequence. - * (Only necessary if not using XKB) - * - * If its not down, then reset the timer - */ -#ifdef XKB - if(noXkbExtension) { -#endif - if( !keyc->modifierMap[keycode] ) { - if( down ) { - sol8_startautorepeat(keycode); - } else { - TimerFree(sol8Timer); - sol8Timer = NULL; - } - } -#ifdef XKB - } -#endif - - xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis(); - - /* - * And now send these prefixes ... - * NOTE: There cannot be multiple Mode_Switch keys !!!! - */ - - ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); -} - -/* - * Autorepeat stuff - * - */ - -void sol8_setkbdinitiate(double value) -{ - sol8AutoRepeatInitiate = value * 1000; - return; -} - -void sol8_setkbdrepeat(double value) -{ - sol8AutoRepeatDelay = value * 1000; - return; -} - - -void sol8_startautorepeat(int keycode) -{ - - sol8Timer = TimerSet( - sol8Timer, /* Timer */ - 0, /* Flags */ - sol8AutoRepeatInitiate, /* millis */ - (OsTimerCallback) sol8_processautorepeat, /* callback */ - (pointer) keycode); /* arg for timer */ - return; -} - - -CARD32 sol8_processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg) -{ - xEvent kevent; - int keycode; - - keycode = (int)arg; - - xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis(); - - /* - * Repeat a key by faking a KeyRelease, and a KeyPress event in rapid - * succession - */ - - ENQUEUE(&kevent, keycode, KeyRelease, XE_KEYBOARD); - ENQUEUE(&kevent, keycode, KeyPress, XE_KEYBOARD); - - /* And return the appropriate value so we get rescheduled */ - return(sol8AutoRepeatDelay); - -} - Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c:1.2 Tue Feb 8 12:19:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c Fri Jan 18 15:26:12 2002 @@ -1,208 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c,v 1.2 2000/02/08 17:19:24 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sol8_vid.c /main/4 1996/02/21 17:54:20 kaleb $ */ - -#include "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#undef usleep -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -char *apertureDevName = NULL; - -Bool -xf86LinearVidMem() -{ - - int mmapFd; - - apertureDevName = "/dev/xsvc"; - if ((mmapFd = open(apertureDevName, O_RDWR)) < 0) - { - xf86Msg(X_WARNING, - "xf86LinearVidMem: failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - xf86Msg(X_WARNING, - "xf86LinearVidMem: /dev/xsvc device driver required\n"); - xf86Msg(X_WARNING, - "xf86LinearVidMem: linear memory access disabled\n"); - return FALSE; - } - close(mmapFd); - return TRUE; - -} - -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - pointer base; - int fd; - - /* - * Solaris 2.8 7/26/99 - * Use /dev/xsvc for everything - * - * DWH - 7/26/99 - Solaris8/dev/xsvc changes - */ - - if (!apertureDevName) - if (!xf86LinearVidMem()) - FatalError("xf86MapVidMem: Could not mmap " - "linear framebuffer [s=%x,a=%x]\n", - Size, Base); - - - if ((fd = open(apertureDevName, O_RDWR,0)) < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - } - base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)Base); - close(fd); - if (base == MAP_FAILED) - { - FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - } - return(base); -} - -/* ARGSUSED */ -void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap(Base, Size); -} - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -static Bool ExtendedEnabled = FALSE; - -void -xf86EnableIO() -{ - - if (ExtendedEnabled) - return; - - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - FatalError("%s: Failed to set IOPL for I/O\n", - "xf86EnableIOPorts"); - } - - ExtendedEnabled = TRUE; - return; -} - -void -xf86DisableIO() -{ - if(!ExtendedEnabled) - return; - - sysi86(SI86V86, V86SC_IOPL, 0); - - ExtendedEnabled = FALSE; - return; -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool xf86DisableInterrupts() -{ - if (!ExtendedEnabled) - { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - return(FALSE); - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - sysi86(SI86V86, V86SC_IOPL, 0); - } - return(TRUE); -} - -void xf86EnableInterrupts() -{ - if (!ExtendedEnabled) - { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - return; - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - sysi86(SI86V86, V86SC_IOPL, 0); - } - return; -} - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, - unsigned long Size) -{ -} - -Bool -xf86CheckMTRR(int s) -{ - return FALSE; -} Index: xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile:3.18 xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile:3.18 Tue Aug 15 12:05:40 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile Fri Jan 18 15:26:12 2002 @@ -1,53 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile,v 3.18 2000/08/15 16:05:40 dawes Exp $ - - - - - -XCOMM $XConsortium: Imakefile /main/5 1996/09/28 17:24:30 rws $ - -#include <Server.tmpl> - -#if !HasGcc -PROWORKS_INOUT_SRC = solx86_iout.s -PROWORKS_INOUT_OBJ = solx86_iout.o -#endif - -MOUSESRC = solx86_mouse.c -MOUSEOBJ = solx86_mouse.o - -SRCS = solx86_init.c solx86_vid.c solx86_bios.c sysv_io.c \ - VTsw_usl.c sysv_kbd.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ - libc_wrapper.c $(PROWORKS_INOUT_SRC) stdResource.c stdPci.c \ - sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c - -OBJS = solx86_init.o solx86_vid.o solx86_bios.o sysv_io.o \ - VTsw_usl.o sysv_kbd.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - libc_wrapper.o $(PROWORKS_INOUT_OBJ) stdResource.o stdPci.o \ - sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalAsmObjectRule() - -LinkSourceFile(VTsw_usl.c,../shared) -LinkSourceFile(sysv_kbd.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(sysv_io.c,../sysv) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() Index: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c diff -u xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c:1.6 Sun Nov 19 11:38:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c Fri Jan 18 15:26:12 2002 @@ -1,96 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c,v 1.6 2000/11/19 16:38:07 tsi Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#undef usleep -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -extern char *apertureDevName; - -/* - * Read BIOS via mmap()ing physical memory. - */ -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - unsigned char *ptr; - char solx86_vtname[20]; - int psize; - int mlen; - - /* - * Solaris 2.1 x86 SVR4 (10/27/93) - * The server must treat the virtual terminal device file - * as the standard SVR4 /dev/pmem. By default, then used VT - * is considered the "default" file to open. - */ - psize = xf86getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - if (Base >= 0xA0000 && Base + mlen < 0xFFFFF && xf86Info.vtno >= 0) - sprintf(solx86_vtname,"/dev/vt%02d",xf86Info.vtno); - else - { - if (!apertureDevName) - if (!xf86LinearVidMem()) - FatalError("xf86ReadBIOS: Could not mmap " - "BIOS [a=%x]\n", Base); - sprintf(solx86_vtname, apertureDevName); - } - - if ((fd = open(solx86_vtname, O_RDONLY)) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - solx86_vtname, strerror(errno)); - return(-1); - } - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t)Base); - if (ptr == MAP_FAILED) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed " - "[0x%05x, 0x%04x]\n", - solx86_vtname, Base, mlen); - close(fd); - return(-1); - } - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); - (void)close(fd); - return(Len); -} - Index: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c:3.5 xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c:3.5 Sat Jul 25 12:57:04 1998 +++ xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c Fri Jan 18 15:26:12 2002 @@ -1,387 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c,v 3.5 1998/07/25 16:57:04 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: solx86_init.c /main/4 1996/02/21 17:54:10 kaleb $ */ - -#include <signal.h> -#include <sys/time.h> -#include <unistd.h> - -#include "X.h" -#include "Xmd.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -static Bool KeepTty = FALSE; -#ifdef SVR4 -static Bool Protect0 = FALSE; -#endif -static int VTnum = -1; -static int xf86StartVT = -1; - -#define MAX_SECONDS 60 -#define USEC_IN_SEC (unsigned long)1000000 - -int xf86_solx86usleep(unsigned long); -static void xf86_solx86sleep(int); - -void -xf86OpenConsole() -{ - int fd; - struct vt_mode VT; - struct vt_stat vtinfo; - char vtname1[10]; - int i, FreeVTslot; - MessageType from = X_PROBED; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* Protect page 0 to help find NULL dereferencing */ - /* mprotect() doesn't seem to work */ - if (Protect0) - { - int fd = -1; - - if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: cannot open /dev/zero (%s)\n", - strerror(errno)); - } - else - { - if ((int)mmap(0, 0x1000, PROT_NONE, - MAP_FIXED | MAP_SHARED, fd, 0) == -1) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: failed to protect page 0 (%s)\n", - strerror(errno)); - } - close(fd); - } - } - /* - * setup the virtual terminal manager - */ - if (VTnum != -1) - { - xf86Info.vtno = VTnum; - from = X_CMDLINE; - } - else - { - if ((fd = open("/dev/vt00",O_RDWR,0)) < 0) - { - FatalError( - "xf86OpenConsole: Cannot open /dev/vt00 (%s)\n", - strerror(errno)); - } - if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) - { - FatalError("xf86OpenConsole: Cannot determine current VT\n"); - } - xf86StartVT=vtinfo.v_active; - -/* There is a SEVERE problem with x86's VT's the VT_OPENQRY ioctl() - * will panic the entire system if all 8 (7 VT's+Console) terminals - * are used. - * The only other way I've found to determine if there is a free - * is to try activating all the the available VT's and see if they - * all succeed - if they do, there there is not a free VT, and - * the Xserver cannot continue with out panic'ing the system. - * (Its ugly, however, it seems to work) - * Note there is a possible race condition here, btw. - * - * David Holland 2/23/94 - */ - - FreeVTslot = 0; - for(i=7; (i>=0) && (!FreeVTslot); i--) - if (ioctl(fd, VT_ACTIVATE, i) != 0) - FreeVTslot = 1; - - if(!FreeVTslot) - { - FatalError("xf86OpenConsole: Cannot find a free VT\n"); - } - - if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || - (xf86Info.vtno == -1)) - { - FatalError("xf86OpenConsole: Cannot find a free VT\n"); - } - close(fd); - } - xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); - - sprintf(vtname1,"/dev/vt%02d",xf86Info.vtno); /* Solaris 2.1 x86 */ - - if (!KeepTty) - { - setpgrp(); - } - - if (((xf86Info.consoleFd = open(vtname1, O_RDWR | O_NDELAY, 0)) < 0)) - { - FatalError("xf86OpenConsole: Cannot open %s (%s)\n", - vtname1, strerror(errno)); - } - - /* change ownership of the vt */ - chown(vtname1, getuid(), getgid()); - - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); - } - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_GETMODE failed\n"); - } - - signal(SIGUSR1, xf86VTRequest); - - VT.mode = VT_PROCESS; - VT.relsig = SIGUSR1; - VT.acqsig = SIGUSR1; - - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); - } - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) - { - FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n"); - } - } - else - { - /* serverGeneration != 1 */ - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); - } - /* - * If the server doesn't have the VT when the reset occurs, - * this is to make sure we don't continue until the activate - * signal is received. - */ - if (!xf86Screens[0]->vtSema) - sleep(5); - } - return; -} - -void xf86CloseConsole() -{ - struct vt_mode VT; - char *console = "/dev/vt00"; - int console_fd; - - /* - * Solaris 2.1 x86 doesnt seem to "switch" back to the console - * when the VT is relinquished and its mode is reset to auto. - * Also, Solaris 2.1 also seems to associate vt00 with the - * console so I've opened the "console" back up and made it - * the active vt again in text mode and then closed it. - * There must be a better hack for this but I'm not aware of - * one at this time. - * - * Doug Anson 11/6/93 - * danson@lgc.com - * - * Fixed - 12/5/93 - David Holland - davidh@dorite.use.com - * Did the whole thing similarly to the way linux does it - */ - - /* reset the display back to text mode */ - - ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */ - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) - { - VT.mode = VT_AUTO; - ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ - } - - /* Activate the VT that X was started on */ - - ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT); - close(xf86Info.consoleFd); /* make the vt-manager happy */ - return; -} - -int xf86ProcessArgument(argc, argv, i) -int argc; -char *argv[]; -int i; -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } - /* - * Undocumented flag to protect page 0 from read/write to help - * catch NULL pointer dereferences. This is purely a debugging - * flag. - */ - if (!strcmp(argv[i], "-protect0")) - { - Protect0 = TRUE; - return(1); - } - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0) - { - UseMsg(); - VTnum = -1; - return(0); - } - return(1); - } - return(0); -} - -void xf86UseMsg() -{ - ErrorF("vtXX use the specified VT number\n"); - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} - -/* - * xf86_solx86usleep() - Solaris 2.1 x86 does not have a suitable - * replacement (SYSV) for usleep. Although - * usleep exists in the BSD compatiblity libs - * I dont want to use those libs if possible. - * - * Doug Anson - * danson@lgc.com - */ -int -xf86_solx86usleep(unsigned long usec) -{ - int retval = 0; - struct itimerval naptime; - struct itimerval savetime; - unsigned long useconds = 0; - unsigned long seconds = 0; - int i; - unsigned long tmp; - -/* - * WHY DOESN'T THIS SIMPLY DO A select() WITH NO FILE DESCRIPTORS? - */ - - /* this time will allow a max of MAX_SECONDS seconds sleeping */ - for(i=MAX_SECONDS;i>=0;--i) - { - tmp = (unsigned long)((unsigned long)(i)*USEC_IN_SEC); - if (tmp <= usec) - { - seconds = i; - if (i == MAX_SECONDS) - useconds = 0; - else - useconds = (unsigned long)(usec - tmp); - i = -1; - } - } - - /* get the current time */ - if ((retval=getitimer(ITIMER_REAL,&savetime)) == 0) - { - /* set the itimer to reflect requested time to sleep */ - naptime.it_value.tv_sec = savetime.it_value.tv_sec + seconds; - naptime.it_value.tv_usec = savetime.it_value.tv_usec + useconds; - - /* specify a one-shot clock */ - naptime.it_interval.tv_usec = 0; - naptime.it_interval.tv_sec = 0; - - /* redisposition SIGALRM */ - signal(SIGALRM,xf86_solx86sleep); - - /* use SIGLARM */ - if ((retval=setitimer(ITIMER_REAL,&naptime,NULL)) == 0) - /* now just pause */ - retval = pause(); - - /* restore the timer */ - retval = setitimer(ITIMER_REAL,&savetime,NULL); - - /* restore the SIGALRM disposition */ - signal(SIGALRM,SIG_DFL); - } - - /* return the return value */ - return retval; -} - -/* - * xf86_solx86sleep() - This function is a NOP disposition for - * the SIGALRM that is used to implement - * usleep() in Solaris 2.1 x86. - * - * Doug Anson - * danson@lgc.com - */ -static void -xf86_solx86sleep(int signo) -{ - /* do nothing */ - return; -} Index: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s diff -u xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s:3.1 xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s:removed --- xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s:3.1 Mon Dec 23 01:51:18 1996 +++ xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s Fri Jan 18 15:26:12 2002 @@ -1,104 +0,0 @@ -/ $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s,v 3.1 1996/12/23 06:51:18 dawes Exp $ -/ -/ -/ -/ -/ $XConsortium: solx86_iout.s /main/4 1996/02/21 17:54:14 kaleb $ -/ -/ File: solx86_iout.s -/ -/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions -/ for Solaris x86 using the ProWorks compiler by SunPro -/ -/ Author: Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com) -/ Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com) -/ -/ Synopsis: (c callable external declarations) -/ extern unsigned char inb(int port); -/ extern unsigned short inw(int port); -/ extern unsigned long inl(int port); -/ extern void outb(int port, unsigned char value); -/ extern void outw(int port, unsigned short value); -/ extern void outl(int port, unsigned long value); - - -.file "solx86_iout.s" -.text - -.globl inb -.globl inw -.globl inl -.globl outb -.globl outw -.globl outl - -/ -/ unsigned char inb(int port); -/ -.align 4 -inb: - movl 4(%esp),%edx - subl %eax,%eax - inb (%dx) - ret -.type inb,@function -.size inb,.-inb - -/ -/ unsigned short inw(int port); -/ -.align 4 -inw: - movl 4(%esp),%edx - subl %eax,%eax - inw (%dx) - ret -.type inw,@function -.size inw,.-inw - -/ -/ unsigned long inl(int port); -/ -.align 4 -inl: - movl 4(%esp),%edx - inl (%dx) - ret -.type inl,@function -.size inl,.-inl - -/ -/ void outb(int port, unsigned char value); -/ -.align 4 -outb: - movl 4(%esp),%edx - movl 8(%esp),%eax - outb (%dx) - ret -.type outb,@function -.size outb,.-outb - -/ -/ void outw(int port, unsigned short value); -/ -.align 4 -outw: - movl 4(%esp),%edx - movl 8(%esp),%eax - outw (%dx) - ret -.type outw,@function -.size outw,.-outw - -/ -/ void outl(int port, unsigned long value); -/ -.align 4 -outl: - movl 4(%esp),%edx - movl 8(%esp),%eax - outl (%dx) - ret -.type outl,@function -.size outl,.-outl Index: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c diff -u xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c:1.2 Sat Jul 25 12:57:05 1998 +++ xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c Fri Jan 18 15:26:12 2002 @@ -1,99 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c,v 1.2 1998/07/25 16:57:05 dawes Exp $ */ - -/* - * Copyright 1995-1997 by The XFree86 Project, Inc - */ - -#include <signal.h> -#include <sys/time.h> -#include <unistd.h> - -#define MAX_SECONDS 60 -#define USEC_IN_SEC (unsigned long)1000000 - -int xf86_solx86usleep(unsigned long); -static void xf86_solx86sleep(int); - -/* - * xf86_solx86usleep() - Solaris 2.1 x86 does not have a suitable - * replacement (SYSV) for usleep. Although - * usleep exists in the BSD compatiblity libs - * I dont want to use those libs if possible. - * - * Doug Anson - * danson@lgc.com - */ -int -xf86_solx86usleep(unsigned long usec) -{ - int retval = 0; - struct itimerval naptime; - struct itimerval savetime; - unsigned long useconds = 0; - unsigned long seconds = 0; - int i; - unsigned long tmp; - -/* - * WHY DOESN'T THIS SIMPLY DO A select() WITH NO FILE DESCRIPTORS? - */ - - /* this time will allow a max of MAX_SECONDS seconds sleeping */ - for(i=MAX_SECONDS;i>=0;--i) - { - tmp = (unsigned long)((unsigned long)(i)*USEC_IN_SEC); - if (tmp <= usec) - { - seconds = i; - if (i == MAX_SECONDS) - useconds = 0; - else - useconds = (unsigned long)(usec - tmp); - i = -1; - } - } - - /* get the current time */ - if ((retval=getitimer(ITIMER_REAL,&savetime)) == 0) - { - /* set the itimer to reflect requested time to sleep */ - naptime.it_value.tv_sec = savetime.it_value.tv_sec + seconds; - naptime.it_value.tv_usec = savetime.it_value.tv_usec + useconds; - - /* specify a one-shot clock */ - naptime.it_interval.tv_usec = 0; - naptime.it_interval.tv_sec = 0; - - /* redisposition SIGALRM */ - signal(SIGALRM,xf86_solx86sleep); - - /* use SIGLARM */ - if ((retval=setitimer(ITIMER_REAL,&naptime,NULL)) == 0) - /* now just pause */ - retval = pause(); - - /* restore the timer */ - retval = setitimer(ITIMER_REAL,&savetime,NULL); - - /* restore the SIGALRM disposition */ - signal(SIGALRM,SIG_DFL); - } - - /* return the return value */ - return retval; -} - -/* - * xf86_solx86sleep() - This function is a NOP disposition for - * the SIGALRM that is used to implement - * usleep() in Solaris 2.1 x86. - * - * Doug Anson - * danson@lgc.com - */ -static void -xf86_solx86sleep(int signo) -{ - /* do nothing */ - return; -} Index: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c:1.2 Sat Jun 12 11:37:12 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c Fri Jan 18 15:26:12 2002 @@ -1,30 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c,v 1.2 1999/06/12 15:37:12 dawes Exp $ */ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#include "X.h" -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -static int -SupportedInterfaces(void) -{ - /* XXX This needs to be checked. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - return p; -} - Index: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c diff -u xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c:3.16 xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c:3.16 Sun Dec 12 21:32:19 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c Fri Jan 18 15:26:12 2002 @@ -1,233 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c,v 3.16 1999/12/13 02:32:19 robin Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: solx86_vid.c /main/4 1996/02/21 17:54:20 kaleb $ */ - -#include "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#undef usleep -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -char *apertureDevName = NULL; - -Bool -xf86CheckMTRR(int ScreenNum) -{ - return FALSE; -} - -Bool -xf86LinearVidMem() -{ - - int mmapFd; - - apertureDevName = "/dev/xsvc"; - if ((mmapFd = open(apertureDevName, O_RDWR)) < 0) - { - apertureDevName = "/dev/fbs/aperture"; - if((mmapFd = open(apertureDevName, O_RDWR)) < 0) - { - xf86Msg(X_WARNING, - "xf86LinearVidMem: failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - xf86Msg(X_WARNING, "xf86LinearVidMem: either /dev/fbs/aperture, or /dev/xsvc device " - "driver required\n"); - xf86Msg(X_WARNING, - "xf86LinearVidMem: linear memory access disabled\n"); - return FALSE; - } - } - close(mmapFd); - return TRUE; - -} - -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - pointer base; - int fd; - char solx86_vtname[20]; - - /* - * Solaris 2.1 x86 SVR4 (10/27/93) - * The server must treat the virtual terminal device file - * as the standard SVR4 /dev/pmem. - * - * Uning the /dev/vtXX device as /dev/pmem only works for the - * A0000-FFFFF region - If we wish you mmap the linear aperture - * it requires a device driver. - * - * So what we'll do is use /dev/vtXX for the A0000-FFFFF stuff, and - * try to use the /dev/fbs/aperture or /dev/xsvc driver if the server - * tries to mmap anything > FFFFF - * its very very unlikely that the server will try to mmap - * anything below FFFFF that can't be handled by /dev/vtXX. - * - * DWH - 2/23/94 - * DWH - 1/31/99 (Gee has it really been 5 years?) - */ - - if(Base < 0xFFFFF) - sprintf(solx86_vtname,"/dev/vt%02d",xf86Info.vtno); - else - - { - if (!apertureDevName) - if (!xf86LinearVidMem()) - FatalError("xf86MapVidMem: Could not mmap " - "linear framebuffer [s=%x,a=%x]\n", - Size, Base); - - sprintf(solx86_vtname, apertureDevName); - } - - if ((fd = open(solx86_vtname, O_RDWR,0)) < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - solx86_vtname, strerror(errno)); - } - base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)Base); - close(fd); - if (base == MAP_FAILED) - { - FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - } - return(base); -} - -/* ARGSUSED */ -void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap(Base, Size); -} - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -static Bool ExtendedEnabled = FALSE; - -void -xf86EnableIO() -{ - - if (ExtendedEnabled) - return; - - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - FatalError("%s: Failed to set IOPL for I/O\n", - "xf86EnableIOPorts"); - } - - ExtendedEnabled = TRUE; - return; -} - -void -xf86DisableIO() -{ - if(!ExtendedEnabled) - return; - - sysi86(SI86V86, V86SC_IOPL, 0); - - ExtendedEnabled = FALSE; - return; -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool xf86DisableInterrupts() -{ - if (!ExtendedEnabled) - { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - return(FALSE); - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - sysi86(SI86V86, V86SC_IOPL, 0); - } - return(TRUE); -} - -void xf86EnableInterrupts() -{ - if (!ExtendedEnabled) - { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - return; - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - sysi86(SI86V86, V86SC_IOPL, 0); - } - return; -} - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, - unsigned long Size) -{ -} - Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile:1.2 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile Fri Aug 17 18:08:15 2001 @@ -0,0 +1,85 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile,v 1.2 2001/08/17 22:08:15 tsi Exp $ +XCOMM +XCOMM Copyright 2001 The XFree86 Project, Inc. All Rights Reserved. +XCOMM +XCOMM Permission is hereby granted, free of charge, to any person obtaining a +XCOMM copy of this software and associated documentation files (the +XCOMM "Software"), to deal in the Software without restriction, including +XCOMM without limitation the rights to use, copy, modify, merge, publish, +XCOMM distribute, sublicense, and/or sell copies of the Software, and to permit +XCOMM persons to whom the Software is furnished to do so, subject to the +XCOMM following conditions: +XCOMM +XCOMM The above copyright notice and this permission notice shall be included +XCOMM in all copies or substantial portions of the Software. +XCOMM +XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +XCOMM OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +XCOMM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +XCOMM IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR +XCOMM OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +XCOMM ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +XCOMM OTHER DEALINGS IN THE SOFTWARE. +XCOMM +XCOMM Except as contained in this notice, the name of the XFree86 Project shall +XCOMM not be used in advertising or otherwise to promote the sale, use or other +XCOMM dealings in this Software without prior written authorization from the +XCOMM XFree86 Project. +XCOMM + +/* This is a combined Imakefile intended for all SunOS variants */ + +#include <Server.tmpl> + +#if !HasGcc && defined(i386Architecture) +PROWORKS_INOUT_SRC = sun_inout.s +PROWORKS_INOUT_OBJ = sun_inout.s +#endif + +#if defined(i386Architecture) && (OSMinorVersion < 8) +IO_SRC = sysv_io.c +IO_OBJ = sysv_io.o +KBD_SRCS = sysv_kbd.c std_kbdEv.c +KBD_OBJS = sysv_kbd.o std_kbdEv.o +VTSW_SRC = VTsw_usl.c +VTSW_OBJ = VTsw_usl.o +#else +IO_SRC = sun_io.c +IO_OBJ = sun_io.o +KBD_SRCS = sun_kbd.c sun_kbdEv.c +KBD_OBJS = sun_kbd.o sun_kbdEv.o +VTSW_SRC = VTsw_noop.c +VTSW_OBJ = VTsw_noop.o +#endif + +SRCS = sun_bios.c sun_init.c $(IO_SRC) $(KBD_SRCS) $(PROWORKS_INOUT_SRC) \ + sun_mouse.c sun_vid.c agp_noop.c libc_wrapper.c kmod_noop.c pm_noop.c \ + posix_tty.c sigiostubs.c stdPci.c stdResource.c $(VTSW_SRC) +OBJS = sun_bios.o sun_init.o $(IO_OBJ) $(KBD_OBJS) $(PROWORKS_INOUT_OBJ) \ + sun_mouse.o sun_vid.o agp_noop.o libc_wrapper.o kmod_noop.o pm_noop.o \ + posix_tty.o sigiostubs.o stdPci.o stdResource.o $(VTSW_OBJ) + +INCLUDES = -I. -I$(XF86OSSRC) -I$(XF86COMSRC) \ + -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(SERVERSRC)/Xext \ + -I$(XINCLUDESRC) -I$(EXTINCSRC) + +DEFINES = -DUSESTDRES + +SubdirLibraryRule($(OBJS)) +NormalLibraryObjectRule() +NormalAsmObjectRule() + +LinkSourceFile($(VTSW_SRC),../shared) +LinkSourceFile(agp_noop.c,../shared) +LinkSourceFile(libc_wrapper.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(posix_tty.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(stdPci.c,../shared) +LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(std_kbdEv.c,../shared) +LinkSourceFile(sysv_io.c,../sysv) +LinkSourceFile(sysv_kbd.c,../shared) + +DependTarget() Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_bios.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_bios.c:1.2 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_bios.c Sat Oct 27 23:34:02 2001 @@ -0,0 +1,100 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_bios.c,v 1.2 2001/10/28 03:34:02 tsi 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 the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT + * SHALL THE COPYRIGHT HOLDERS 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. + */ + +#ifdef i386 +#define _NEED_SYSI86 +#endif +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +extern char *apertureDevName; + +/* + * Read BIOS via mmap()ing physical memory. + */ +int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + int fd; + unsigned char *ptr; + char solx86_vtname[20]; + int psize; + int mlen; + + /* + * Solaris 2.1 x86 SVR4 (10/27/93) + * The server must treat the virtual terminal device file + * as the standard SVR4 /dev/pmem. By default, then used VT + * is considered the "default" file to open. + * + * Solaris 2.8 x86 (7/26/99) - DWH + * + * Use /dev/xsvc for everything. + */ + psize = xf86getpagesize(); + Offset += Base & (psize - 1); + Base &= ~(psize - 1); + mlen = (Offset + Len + psize - 1) & ~(psize - 1); +#if defined(i386) && !defined(__SOL8__) + if (Base >= 0xA0000 && Base + mlen < 0xFFFFF && xf86Info.vtno >= 0) + sprintf(solx86_vtname, "/dev/vt%02d", xf86Info.vtno); + else +#endif + { + if (!xf86LinearVidMem()) + FatalError("xf86ReadBIOS: Could not mmap BIOS" + " [a=%x]\n", Base); + sprintf(solx86_vtname, apertureDevName); + } + + if ((fd = open(solx86_vtname, O_RDONLY)) < 0) + { + xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", + solx86_vtname, strerror(errno)); + return(-1); + } + ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, + MAP_SHARED, fd, (off_t)Base); + if (ptr == MAP_FAILED) + { + xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed " + "[0x%05x, 0x%04x]\n", + solx86_vtname, Base, mlen); + close(fd); + return -1; + } + + (void)memcpy(Buf, (void *)(ptr + Offset), Len); + (void)munmap((caddr_t)ptr, mlen); + (void)close(fd); + + return Len; +} Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c:1.5 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c Sun Nov 25 08:51:24 2001 @@ -0,0 +1,375 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c,v 1.5 2001/11/25 13:51:24 tsi 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 the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS 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 "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +static Bool KeepTty = FALSE; +static Bool Protect0 = FALSE; +#ifdef HAS_USL_VTS +static int VTnum = -1; +static int xf86StartVT = -1; +#endif + +static char fb_dev[PATH_MAX] = "/dev/console"; + +void +xf86OpenConsole(void) +{ +#ifdef HAS_USL_VTS + int fd, i; + struct vt_mode VT; + struct vt_stat vtinfo; + int FreeVTslot; + MessageType from = X_PROBED; +#endif + + 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); + } + } + +#ifdef HAS_USL_VTS + + /* + * Setup the virtual terminal manager + */ + if (VTnum != -1) + { + xf86Info.vtno = VTnum; + from = X_CMDLINE; + } + else + { + if ((fd = open("/dev/vt00",O_RDWR,0)) < 0) + FatalError("xf86OpenConsole: Cannot open /dev/vt00 (%s)\n", + strerror(errno)); + + if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) + FatalError("xf86OpenConsole: Cannot determine current VT\n"); + + xf86StartVT = vtinfo.v_active; + + /* + * There is a SEVERE problem with x86's VT's. The VT_OPENQRY + * ioctl() will panic the entire system if all 8 (7 VT's+Console) + * terminals are used. The only other way I've found to determine + * if there is a free VT is to try activating all the the available + * VT's and see if they all succeed - if they do, there there is no + * free VT, and the Xserver cannot continue without panic'ing the + * system. (It's ugly, but it seems to work.) Note there is a + * possible race condition here. + * + * David Holland 2/23/94 + */ + + FreeVTslot = 0; + for (i = 7; (i >= 0) && !FreeVTslot; i--) + if (ioctl(fd, VT_ACTIVATE, i) != 0) + FreeVTslot = 1; + + if (!FreeVTslot) || + (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || + (xf86Info.vtno == -1)) + FatalError("xf86OpenConsole: Cannot find a free VT\n"); + + close(fd); + } + + xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); + + sprintf(fb_dev, "/dev/vt%02d", xf86Info.vtno); /* Solaris 2.1 x86 */ + +#endif /* HAS_USL_VTS */ + + 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)); + +#ifdef HAS_USL_VTS + + /* Change ownership of the vt */ + chown(fb_dev, getuid(), getgid()); + + /* + * Now get the VT + */ + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) + xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); + + if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) + xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); + + if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) + FatalError("xf86OpenConsole: VT_GETMODE failed\n"); + + signal(SIGUSR1, xf86VTRequest); + + VT.mode = VT_PROCESS; + VT.relsig = SIGUSR1; + VT.acqsig = SIGUSR1; + + if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) + FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); + + if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) + FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n"); + } + else /* serverGeneration != 1 */ + { + /* + * Now re-get the VT + */ + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) + xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); + + if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) + xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); + + /* + * If the server doesn't have the VT when the reset occurs, + * this is to make sure we don't continue until the activate + * signal is received. + */ + if (!xf86Screens[0]->vtSema) + sleep(5); + +#endif /* HAS_USL_VTS */ + + } +} + +void +xf86CloseConsole(void) +{ +#ifdef HAS_USL_VTS + struct vt_mode VT; +#endif +#if defined(__SOL8__) || !defined(i386) + int tmp; +#endif + +#ifndef i386 + + if (!xf86DoProbe && !xf86DoConfigure) { + int fd; + + /* + * Wipe out framebuffer just like the non-SI Xsun server does. This + * could be improved by saving framebuffer contents in + * xf86OpenConsole() above and restoring them here. Also, it's unclear + * at this point whether this should be done for all framebuffers in + * the system, rather than only the console. + */ + if ((fd = open("/dev/fb", O_RDWR, 0)) < 0) { + xf86Msg(X_WARNING, + "xf86CloseConsole(): unable to open framebuffer (%s)\n", + strerror(errno)); + } else { + struct fbgattr fbattr; + + if ((ioctl(fd, FBIOGATTR, &fbattr) < 0) && + (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0)) { + xf86Msg(X_WARNING, + "xf86CloseConsole(): unable to retrieve framebuffer" + " attributes (%s)\n", strerror(errno)); + } else { + pointer fbdata; + + fbdata = mmap(NULL, fbattr.fbtype.fb_size, + PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (fbdata == MAP_FAILED) { + xf86Msg(X_WARNING, + "xf86CloseConsole(): unable to mmap framebuffer" + " (%s)\n", strerror(errno)); + } else { + (void)memset(fbdata, 0, fbattr.fbtype.fb_size); + (void)munmap(fbdata, fbattr.fbtype.fb_size); + } + } + + close(fd); + } + } + +#endif + +#ifdef HAS_USL_VTS + + /* + * Solaris 2.1 x86 doesn't seem to "switch" back to the console when the VT + * is relinquished and its mode is reset to auto. Also, Solaris 2.1 seems + * to associate vt00 with the console so I've opened the "console" back up + * and made it the active vt again in text mode and then closed it. There + * must be a better hack for this but I'm not aware of one at this time. + * + * Doug Anson 11/6/93 + * danson@lgc.com + * + * Fixed - 12/5/93 - David Holland - davidh@dorite.use.com + * Did the whole thing similarly to the way linux does it + */ + + /* Reset the display back to text mode */ + ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); + if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) + { + VT.mode = VT_AUTO; /* Set default vt handling */ + ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); + } + + /* Activate the VT that X was started on */ + ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT); + +#endif /* HAS_USL_VTS */ + + close(xf86Info.consoleFd); + +#if defined(__SOL8__) || !defined(i386) + + /* + * This probably shouldn't be here. However, there is no corresponding + * xf86CloseKbd() routine - DWH + */ + + /* Set the keyboard into "indirect" mode and turn off even translation */ + tmp = 0; + (void) ioctl(xf86Info.kbdFd, KIOCSDIRECT, &tmp); + tmp = TR_ASCII; + (void) ioctl(xf86Info.kbdFd, KIOCTRANS, &tmp); + + close(xf86Info.kbdFd); + +#endif +} + +int +xf86ProcessArgument(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; + } + +#ifdef HAS_USL_VTS + + if ((argv[i][0] == 'v') && (argv[i][1] == 't')) + { + if (sscanf(argv[i], "vt%2d", &VTnum) == 0) + { + UseMsg(); + VTnum = -1; + return 0; + } + + return 1; + } + +#endif /* HAS_USL_VTS */ + +#if defined(__SOL8__) || !defined(i386) + + if ((i + 1) < argc) { + if (!strcmp(argv[i], "-dev")) { + strncpy(fb_dev, argv[i+1], PATH_MAX); + fb_dev[PATH_MAX - 1] = '\0'; + return 2; + } + + if (!strcmp(argv[i], "-ar1")) { + xf86Info.kbdDelay = atoi(argv[i + 1]) * 1000; + return 2; + } + + if (!strcmp(argv[i], "-ar2")) { + xf86Info.kbdRate = atoi(argv[i + 1]) * 1000; + return 2; + } + } + +#endif + + return 0; +} + +void xf86UseMsg() +{ +#ifdef HAS_USL_VTS + ErrorF("vtXX Use the specified VT number\n"); +#endif +#if defined(__SOL8__) || !defined(i386) + ErrorF("-dev <fb> Framebuffer device\n"); + 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"); +#endif + ErrorF("-keeptty Don't detach controlling tty\n"); + ErrorF(" (for debugging only)\n"); +} Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_inout.s diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_inout.s:1.1 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_inout.s Sun May 27 22:42:31 2001 @@ -0,0 +1,124 @@ +/ $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_inout.s,v 1.1 2001/05/28 02:42:31 tsi Exp $ +/ +/ Copyright 1994-2001 The XFree86 Project, Inc. All Rights Reserved. +/ +/ Permission is hereby granted, free of charge, to any person obtaining a copy +/ of this software and associated documentation files (the "Software"), to deal +/ 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. +/ +/ +/ File: sun_inout.s +/ +/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions +/ for Solaris x86 using the ProWorks compiler by SunPro +/ +/ Author: Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com) +/ Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com) +/ +/ Synopsis: (c callable external declarations) +/ extern unsigned char inb(int port); +/ extern unsigned short inw(int port); +/ extern unsigned long inl(int port); +/ extern void outb(int port, unsigned char value); +/ extern void outw(int port, unsigned short value); +/ extern void outl(int port, unsigned long value); +/ + +.file "sunos_inout.s" +.text + +.globl inb +.globl inw +.globl inl +.globl outb +.globl outw +.globl outl + +/ +/ unsigned char inb(int port); +/ +.align 4 +inb: + movl 4(%esp),%edx + subl %eax,%eax + inb (%dx) + ret +.type inb,@function +.size inb,.-inb + +/ +/ unsigned short inw(int port); +/ +.align 4 +inw: + movl 4(%esp),%edx + subl %eax,%eax + inw (%dx) + ret +.type inw,@function +.size inw,.-inw + +/ +/ unsigned long inl(int port); +/ +.align 4 +inl: + movl 4(%esp),%edx + inl (%dx) + ret +.type inl,@function +.size inl,.-inl + +/ +/ void outb(int port, unsigned char value); +/ +.align 4 +outb: + movl 4(%esp),%edx + movl 8(%esp),%eax + outb (%dx) + ret +.type outb,@function +.size outb,.-outb + +/ +/ void outw(int port, unsigned short value); +/ +.align 4 +outw: + movl 4(%esp),%edx + movl 8(%esp),%eax + outw (%dx) + ret +.type outw,@function +.size outw,.-outw + +/ +/ void outl(int port, unsigned long value); +/ +.align 4 +outl: + movl 4(%esp),%edx + movl 8(%esp),%eax + outl (%dx) + ret +.type outl,@function +.size outl,.-outl Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c:1.1 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c Sun May 27 22:42:31 2001 @@ -0,0 +1,56 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c,v 1.1 2001/05/28 02:42:31 tsi Exp $ */ +/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany + * Copyright 1993 by David Dawes <dawes@xfree86.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Thomas Roell and David Dawes + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Thomas Roell and + * David Dawes makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +void +xf86SoundKbdBell(int loudness, int pitch, int duration) +{ + int kbdCmd; + + if (loudness && pitch) + { + kbdCmd = KBD_CMD_BELL; + if (ioctl (xf86Info.kbdFd, KIOCCMD, &kbdCmd) == -1) { + ErrorF("Failed to activate bell\n"); + return; + } + + usleep(xf86Info.bell_duration * loudness * 20); + + kbdCmd = KBD_CMD_NOBELL; + if (ioctl (xf86Info.kbdFd, KIOCCMD, &kbdCmd) == -1) + ErrorF ("Failed to deactivate bell\n"); + } +} + +void +xf86SetKbdLeds(int leds) +{ + if( ioctl(xf86Info.kbdFd, KIOCSLED, &leds) < 0 ) + ErrorF("Failed to set Keyboard LED's\n"); +} Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.c:1.1 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.c Sun May 27 22:42:31 2001 @@ -0,0 +1,112 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.c,v 1.1 2001/05/28 02:42:31 tsi Exp $ */ +/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany + * Copyright 1993 by David Dawes <dawes@XFree86.org> + * Copyright 1999 by David Holland <davidh@iquest.net) + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the names of Thomas Roell, David Dawes, and David Holland not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Thomas Roell, David Dawes, and + * David Holland make no representations about the suitability of this software + * for any purpose. It is provided "as is" without express or implied + * warranty. + * + * THOMAS ROELL, DAVID DAWES, AND DAVID HOLLAND DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THOMAS ROELL, DAVID DAWES, OR DAVID HOLLAND + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +static int sun_otranslation = -1; +static int sun_odirect = -1; + +int +xf86GetKbdLeds() +{ + int leds; + + ioctl(xf86Info.kbdFd, KIOCGLED, &leds); + return leds; +} + +void +xf86SetKbdRepeat(char rad) +{ + /* Nothing to do */ +} + +/* + * Save initial keyboard state. This is called at the start of each server + * generation. + */ + +void +xf86KbdInit() +{ + int ktype, klayout; + + if (xf86Info.kbdFd < 0) { + xf86Info.kbdFd = open("/dev/kbd", O_RDWR|O_NONBLOCK); + if(xf86Info.kbdFd < 0) + FatalError("Unable to open keyboard: /dev/kbd\n"); + } + + /* + * None of the followin should ever fail. If it does, something is + * broken (IMO) - DWH 8/21/99 + */ + + if (ioctl(xf86Info.kbdFd, KIOCTYPE, &ktype) < 0) + FatalError("Unable to determine keyboard type: %d\n", errno); + + if (ioctl(xf86Info.kbdFd, KIOCLAYOUT, &klayout) < 0) + FatalError("Unable to determine keyboard layout: %d\n", errno); + + if (ioctl(xf86Info.kbdFd, KIOCGTRANS, &sun_otranslation) < 0) + FatalError("Unable to determine keyboard translation mode\n"); + + if (ioctl(xf86Info.kbdFd, KIOCGDIRECT, &sun_odirect) < 0) + FatalError("Unable to determine keyboard direct setting\n"); +} + +int +xf86KbdOn(void) +{ + int tmp = 1; + + if (ioctl(xf86Info.kbdFd, KIOCSDIRECT, &tmp) == -1) + FatalError("Setting keyboard direct mode on\n"); + + /* Setup translation */ + + tmp = TR_UNTRANS_EVENT; + + if (ioctl(xf86Info.kbdFd, KIOCTRANS, &tmp) == -1) + FatalError("Setting keyboard translation\n"); + + return xf86Info.kbdFd; +} + +int +xf86KbdOff() +{ + if ((sun_otranslation != -1) && + (ioctl(xf86Info.kbdFd, KIOCTRANS, &sun_otranslation) < 0)) + FatalError("Unable to restore keyboard translation mode\n"); + + if ((sun_odirect != 0) && + (ioctl(xf86Info.kbdFd, KIOCSDIRECT, &sun_odirect) < 0 )) + FatalError("Unable to restore keyboard direct setting\n"); + + return xf86Info.kbdFd; +} Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbdEv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbdEv.c:1.4 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbdEv.c Wed Nov 7 23:15:33 2001 @@ -0,0 +1,672 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbdEv.c,v 1.4 2001/11/08 04:15:33 tsi Exp $ */ +/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * Copyright 1993 by David Dawes <dawes@xfree86.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the names of Thomas Roell and David Dawes not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Thomas Roell and David Dawes make no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* [JCH-96/01/21] Extended std reverse map to four buttons. */ + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#ifdef XINPUT +#include "XI.h" +#include "XIproto.h" +#include "xf86Xinput.h" +#else +#include "inputstr.h" +#endif + +#ifdef XFreeXDGA +#include "dgaproc.h" +#endif + +#include <sys/vuid_event.h> +#include "atKeynames.h" + +#ifdef XKB +extern Bool noXkbExtension; +#endif + +#define XE_POINTER 1 +#define XE_KEYBOARD 2 + +#ifdef XTESTEXT1 + +#define XTestSERVER_SIDE +#include "xtestext1.h" +extern short xtest_mousex; +extern short xtest_mousey; +extern int on_steal_input; +extern Bool XTestStealKeyData(); +extern void XTestStealMotionData(); + +#ifdef XINPUT +#define ENQUEUE(ev, code, direction, dev_type) \ + (ev)->u.u.detail = (code); \ + (ev)->u.u.type = (direction); \ + if (!on_steal_input || \ + XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ + xtest_mousex, xtest_mousey)) \ + xf86eqEnqueue((ev)) +#else +#define ENQUEUE(ev, code, direction, dev_type) \ + (ev)->u.u.detail = (code); \ + (ev)->u.u.type = (direction); \ + if (!on_steal_input || \ + XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ + xtest_mousex, xtest_mousey)) \ + mieqEnqueue((ev)) +#endif + +#else /* ! XTESTEXT1 */ + +#ifdef XINPUT +#define ENQUEUE(ev, code, direction, dev_type) \ + (ev)->u.u.detail = (code); \ + (ev)->u.u.type = (direction); \ + xf86eqEnqueue((ev)) +#else +#define ENQUEUE(ev, code, direction, dev_type) \ + (ev)->u.u.detail = (code); \ + (ev)->u.u.type = (direction); \ + mieqEnqueue((ev)) +#endif + +#endif + +static void startautorepeat(long keycode); +static CARD32 processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg); + +static OsTimerPtr sunTimer = NULL; + +/* Map the Solaris keycodes to the "XFree86" keycodes. */ +/* + * This doesn't seem right. It probably needs to be dependent on a keyboard + * type. + */ +static unsigned char map[256] = { +#if defined(i368) || defined(__i386) || defined(__i386__) + KEY_NOTUSED, /* 0 */ + KEY_Tilde, /* 1 */ + KEY_1, /* 2 */ + KEY_2, /* 3 */ + KEY_3, /* 4 */ + KEY_4, /* 5 */ + KEY_5, /* 6 */ + KEY_6, /* 7 */ + KEY_7, /* 8 */ + KEY_8, /* 9 */ + KEY_9, /* 10 */ + KEY_0, /* 11 */ + KEY_Minus, /* 12 */ + KEY_Equal, /* 13 */ + 0x7D, /*KEY_P_YEN*/ /* 14 */ + KEY_BackSpace, /* 15 */ + KEY_Tab, /* 16 */ + KEY_Q, /* 17 */ + KEY_W, /* 18 */ + KEY_E, /* 19 */ + KEY_R, /* 20 */ + KEY_T, /* 21 */ + KEY_Y, /* 22 */ + KEY_U, /* 23 */ + KEY_I, /* 24 */ + KEY_O, /* 25 */ + KEY_P, /* 26 */ + KEY_LBrace, /* 27 */ + KEY_RBrace, /* 28 */ + KEY_BSlash, /* 29 */ + KEY_CapsLock, /* 30 */ + KEY_A, /* 31 */ + KEY_S, /* 32 */ + KEY_D, /* 33 */ + KEY_F, /* 34 */ + KEY_G, /* 35 */ + KEY_H, /* 36 */ + KEY_J, /* 37 */ + KEY_K, /* 38 */ + KEY_L, /* 39 */ + KEY_SemiColon, /* 40 */ + KEY_Quote, /* 41 */ + KEY_UNKNOWN, /* 42 */ + KEY_Enter, /* 43 */ + KEY_ShiftL, /* 44 */ + KEY_Less, /* 45 */ + KEY_Z, /* 46 */ + KEY_X, /* 47 */ + KEY_C, /* 48 */ + KEY_V, /* 49 */ + KEY_B, /* 50 */ + KEY_N, /* 51 */ + KEY_M, /* 52 */ + KEY_Comma, /* 53 */ + KEY_Period, /* 54 */ + KEY_Slash, /* 55 */ + KEY_BSlash2, /* 56 */ + KEY_ShiftR, /* 57 */ + KEY_LCtrl, /* 58 */ + KEY_LMeta, /* 59 */ + KEY_Alt, /* 60 */ + KEY_Space, /* 61 */ + KEY_AltLang, /* 62 */ + KEY_RMeta, /* 63 */ + KEY_RCtrl, /* 64 */ + KEY_Menu, /* 65 */ + KEY_UNKNOWN, /* 66 */ + KEY_UNKNOWN, /* 67 */ + KEY_UNKNOWN, /* 68 */ + KEY_UNKNOWN, /* 69 */ + KEY_UNKNOWN, /* 70 */ + KEY_UNKNOWN, /* 71 */ + KEY_UNKNOWN, /* 72 */ + KEY_UNKNOWN, /* 73 */ + KEY_UNKNOWN, /* 74 */ + KEY_Insert, /* 75 */ + KEY_Delete, /* 76 */ + KEY_UNKNOWN, /* 77 */ + KEY_UNKNOWN, /* 78 */ + KEY_Left, /* 79 */ + KEY_Home, /* 80 */ + KEY_End, /* 81 */ + KEY_UNKNOWN, /* 82 */ + KEY_Up, /* 83 */ + KEY_Down, /* 84 */ + KEY_PgUp, /* 85 */ + KEY_PgDown, /* 86 */ + KEY_UNKNOWN, /* 87 */ + KEY_UNKNOWN, /* 88 */ + KEY_Right, /* 89 */ + KEY_NumLock, /* 90 */ + KEY_KP_7, /* 91 */ + KEY_KP_4, /* 92 */ + KEY_KP_1, /* 93 */ + KEY_UNKNOWN, /* 94 */ + KEY_KP_Divide, /* 95 */ + KEY_KP_8, /* 96 */ + KEY_KP_5, /* 97 */ + KEY_KP_2, /* 98 */ + KEY_KP_0, /* 99 */ + KEY_KP_Multiply, /* 100 */ + KEY_KP_9, /* 101 */ + KEY_KP_6, /* 102 */ + KEY_KP_3, /* 103 */ + KEY_KP_Decimal, /* 104 */ + KEY_KP_Minus, /* 105 */ + KEY_KP_Plus, /* 106 */ + KEY_UNKNOWN, /* 107 */ + KEY_KP_Enter, /* 108 */ + KEY_UNKNOWN, /* 109 */ + KEY_Escape, /* 110 */ + KEY_UNKNOWN, /* 111 */ + KEY_F1, /* 112 */ + KEY_F2, /* 113 */ + KEY_F3, /* 114 */ + KEY_F4, /* 115 */ + KEY_F5, /* 116 */ + KEY_F6, /* 117 */ + KEY_F7, /* 118 */ + KEY_F8, /* 119 */ + KEY_F9, /* 120 */ + KEY_F10, /* 121 */ + KEY_F11, /* 122 */ + KEY_F12, /* 123 */ + KEY_Print, /* 124 */ + KEY_ScrollLock, /* 125 */ + KEY_Pause, /* 126 */ + KEY_UNKNOWN, /* 127 */ + KEY_UNKNOWN, /* 128 */ + KEY_UNKNOWN, /* 129 */ + KEY_UNKNOWN, /* 130 */ + KEY_NFER, /* 131 */ + KEY_XFER, /* 132 */ + KEY_HKTG, /* 133 */ + KEY_UNKNOWN, /* 134 */ +#elif defined(sparc) || defined(__sparc__) + KEY_UNKNOWN, /* 0x00 */ + KEY_UNKNOWN, /* 0x01 */ + KEY_UNKNOWN, /* 0x02 */ + KEY_UNKNOWN, /* 0x03 */ + KEY_UNKNOWN, /* 0x04 */ + KEY_F1, /* 0x05 */ + KEY_F2, /* 0x06 */ + KEY_F10, /* 0x07 */ + KEY_F3, /* 0x08 */ + KEY_F11, /* 0x09 */ + KEY_F4, /* 0x0A */ + KEY_F12, /* 0x0B */ + KEY_F5, /* 0x0C */ + KEY_UNKNOWN, /* 0x0D */ + KEY_F6, /* 0x0E */ + KEY_UNKNOWN, /* 0x0F */ + KEY_F7, /* 0x10 */ + KEY_F8, /* 0x11 */ + KEY_F9, /* 0x12 */ + KEY_Alt, /* 0x13 */ + KEY_Up, /* 0x14 */ + KEY_Pause, /* 0x15 */ + KEY_SysReqest, /* 0x16 */ + KEY_ScrollLock, /* 0x17 */ + KEY_Left, /* 0x18 */ + KEY_UNKNOWN, /* 0x19 */ + KEY_UNKNOWN, /* 0x1A */ + KEY_Down, /* 0x1B */ + KEY_Right, /* 0x1C */ + KEY_Escape, /* 0x1D */ + KEY_1, /* 0x1E */ + KEY_2, /* 0x1F */ + KEY_3, /* 0x20 */ + KEY_4, /* 0x21 */ + KEY_5, /* 0x22 */ + KEY_6, /* 0x23 */ + KEY_7, /* 0x24 */ + KEY_8, /* 0x25 */ + KEY_9, /* 0x26 */ + KEY_0, /* 0x27 */ + KEY_Minus, /* 0x28 */ + KEY_Equal, /* 0x29 */ + KEY_Tilde, /* 0x2A */ + KEY_BackSpace, /* 0x2B */ + KEY_Insert, /* 0x2C */ + KEY_UNKNOWN, /* 0x2D */ + KEY_KP_Divide, /* 0x2E */ + KEY_KP_Multiply, /* 0x2F */ + KEY_UNKNOWN, /* 0x30 */ + KEY_UNKNOWN, /* 0x31 */ + KEY_KP_Decimal, /* 0x32 */ + KEY_UNKNOWN, /* 0x33 */ + KEY_Home, /* 0x34 */ + KEY_Tab, /* 0x35 */ + KEY_Q, /* 0x36 */ + KEY_W, /* 0x37 */ + KEY_E, /* 0x38 */ + KEY_R, /* 0x39 */ + KEY_T, /* 0x3A */ + KEY_Y, /* 0x3B */ + KEY_U, /* 0x3C */ + KEY_I, /* 0x3D */ + KEY_O, /* 0x3E */ + KEY_P, /* 0x3F */ + KEY_LBrace, /* 0x40 */ + KEY_RBrace, /* 0x41 */ + KEY_Delete, /* 0x42 */ + KEY_UNKNOWN, /* 0x43 */ + KEY_KP_7, /* 0x44 */ + KEY_KP_8, /* 0x45 */ + KEY_KP_9, /* 0x46 */ + KEY_KP_Minus, /* 0x47 */ + KEY_UNKNOWN, /* 0x48 */ + KEY_UNKNOWN, /* 0x49 */ + KEY_End, /* 0x4A */ + KEY_UNKNOWN, /* 0x4B */ + KEY_LCtrl, /* 0x4C */ + KEY_A, /* 0x4D */ + KEY_S, /* 0x4E */ + KEY_D, /* 0x4F */ + KEY_F, /* 0x50 */ + KEY_G, /* 0x51 */ + KEY_H, /* 0x52 */ + KEY_J, /* 0x53 */ + KEY_K, /* 0x54 */ + KEY_L, /* 0x55 */ + KEY_SemiColon, /* 0x56 */ + KEY_Quote, /* 0x57 */ + KEY_BSlash, /* 0x58 */ + KEY_Enter, /* 0x59 */ + KEY_KP_Enter, /* 0x5A */ + KEY_KP_4, /* 0x5B */ + KEY_KP_5, /* 0x5C */ + KEY_KP_6, /* 0x5D */ + KEY_KP_0, /* 0x5E */ + KEY_UNKNOWN, /* 0x5F */ + KEY_PgUp, /* 0x60 */ + KEY_UNKNOWN, /* 0x61 */ + KEY_NumLock, /* 0x62 */ + KEY_ShiftL, /* 0x63 */ + KEY_Z, /* 0x64 */ + KEY_X, /* 0x65 */ + KEY_C, /* 0x66 */ + KEY_V, /* 0x67 */ + KEY_B, /* 0x68 */ + KEY_N, /* 0x69 */ + KEY_M, /* 0x6A */ + KEY_Comma, /* 0x6B */ + KEY_Period, /* 0x6C */ + KEY_Slash, /* 0x6D */ + KEY_ShiftR, /* 0x6E */ + KEY_UNKNOWN, /* 0x6F */ + KEY_KP_1, /* 0x70 */ + KEY_KP_2, /* 0x71 */ + KEY_KP_3, /* 0x72 */ + KEY_UNKNOWN, /* 0x73 */ + KEY_UNKNOWN, /* 0x74 */ + KEY_UNKNOWN, /* 0x75 */ + KEY_UNKNOWN, /* 0x76 */ + KEY_CapsLock, /* 0x77 */ + KEY_LMeta, /* 0x78 */ + KEY_Space, /* 0x79 */ + KEY_RMeta, /* 0x7A */ + KEY_PgDown, /* 0x7B */ + KEY_UNKNOWN, /* 0x7C */ + KEY_KP_Plus, /* 0x7D */ + KEY_UNKNOWN, /* 0x7E */ + KEY_UNKNOWN, /* 0x7F */ +#endif + /* The rest default to KEY_UNKNOWN */ +}; + +/* + * sunPostKbdEvent -- + * Translate the raw hardware Firm_event into an XEvent, and tell DIX + * about it. KeyCode preprocessing and so on is done ... + * + * Most of the Solaris stuff has whacked Panix/PC98 support in the + * interests of simplicity - DWH 8/30/99 + */ + +static void +sunPostKbdEvent(Firm_event *event) +{ + Bool down; + KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; + Bool updateLeds = FALSE; + xEvent kevent; + KeySym *keysym; + int keycode; + static int lockkeys = 0; + + /* Give down a value */ + if (event->value == VKEY_DOWN) + down = TRUE; + else + down = FALSE; + + /* + * and now get some special keysequences + */ + + keycode = map[event->id]; + + if ((ModifierDown(ControlMask | AltMask)) || + (ModifierDown(ControlMask | AltLangMask))) + { + switch (keycode) { + /* + * The idea here is to pass the scancode down to a list of registered + * routines. There should be some standard conventions for processing + * certain keys. + */ + + case KEY_BackSpace: + if (!xf86Info.dontZap) { + DGAShutdown(); + GiveUp(0); + } + break; + + /* Check grabs */ + case KEY_KP_Divide: + if (!xf86Info.grabInfo.disabled && + xf86Info.grabInfo.allowDeactivate) { + if (inputInfo.pointer && inputInfo.pointer->grab != NULL && + inputInfo.pointer->DeactivateGrab) + (*inputInfo.pointer->DeactivateGrab)(inputInfo.pointer); + if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL && + inputInfo.keyboard->DeactivateGrab) + (*inputInfo.keyboard->DeactivateGrab)(inputInfo.keyboard); + } + break; + + case KEY_KP_Multiply: + if (!xf86Info.grabInfo.disabled && + xf86Info.grabInfo.allowClosedown) { + ClientPtr pointer, keyboard, server; + + pointer = keyboard = server = NULL; + if (inputInfo.pointer && inputInfo.pointer->grab != NULL) + pointer = + clients[CLIENT_ID(inputInfo.pointer->grab->resource)]; + + if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) { + keyboard = + clients[CLIENT_ID(inputInfo.keyboard->grab->resource)]; + if (keyboard == pointer) + keyboard = NULL; + } + + if ((xf86Info.grabInfo.server.grabstate == SERVER_GRABBED) && + (((server = xf86Info.grabInfo.server.client) == pointer) || + (server == keyboard))) + server = NULL; + + if (pointer) + CloseDownClient(pointer); + if (keyboard) + CloseDownClient(keyboard); + if (server) + CloseDownClient(server); + } + break; + + case KEY_KP_Minus: /* Keypad - */ + if (!xf86Info.dontZoom) { + if (down) + xf86ZoomViewport(xf86Info.currentScreen, -1); + return; + } + break; + + case KEY_KP_Plus: /* Keypad + */ + if (!xf86Info.dontZoom) { + if (down) + xf86ZoomViewport(xf86Info.currentScreen, 1); + return; + } + break; + } + } + + /* + * Now map the scancodes to real X-keycodes ... + */ + if (keycode == KEY_NOTUSED) { + xf86MsgVerb(X_INFO, 0, + "raw code %d mapped to KEY_NOTUSED -- please report\n", event->id); + return; + } + if (keycode == KEY_UNKNOWN) { + xf86MsgVerb(X_INFO, 0, + "raw code %d mapped to KEY_UNKNOWN -- please report\n", event->id); + return; + } + keycode += MIN_KEYCODE; + keysym = keyc->curKeySyms.map + + (keyc->curKeySyms.mapWidth * + (keycode - keyc->curKeySyms.minKeyCode)); + +#ifdef XKB + if (noXkbExtension) +#endif + { + /* + * Toggle lock keys. + */ +#define CAPSFLAG 0x01 +#define NUMFLAG 0x02 +#define SCROLLFLAG 0x04 +#define MODEFLAG 0x08 + + if (down) { + /* + * Handle the KeyPresses of the lock keys. + */ + + switch (keysym[0]) { + + case XK_Caps_Lock: + if (lockkeys & CAPSFLAG) { + lockkeys &= ~CAPSFLAG; + return; + } + lockkeys |= CAPSFLAG; + updateLeds = TRUE; + xf86Info.capsLock = down; + break; + + case XK_Num_Lock: + if (lockkeys & NUMFLAG) { + lockkeys &= ~NUMFLAG; + return; + } + lockkeys |= NUMFLAG; + updateLeds = TRUE; + xf86Info.numLock = down; + break; + + case XK_Scroll_Lock: + if (lockkeys & SCROLLFLAG) { + lockkeys &= ~SCROLLFLAG; + return; + } + lockkeys |= SCROLLFLAG; + updateLeds = TRUE; + xf86Info.scrollLock = down; + break; + } + } else { + /* + * Handle the releases of the lock keys. + */ + + switch (keysym[0]) { + + case XK_Caps_Lock: + if (lockkeys & CAPSFLAG) + return; + updateLeds = TRUE; + xf86Info.capsLock = down; + break; + + case XK_Num_Lock: + if (lockkeys & NUMFLAG) + return; + updateLeds = TRUE; + xf86Info.numLock = down; + break; + + case XK_Scroll_Lock: + if (lockkeys & SCROLLFLAG) + return; + updateLeds = TRUE; + xf86Info.scrollLock = down; + break; + } + } + + if (updateLeds) + xf86KbdLeds(); + + /* + * If this keycode is not a modifier key, and its down initiate the + * autorepeate sequence. (Only necessary if not using XKB). + * + * If its not down, then reset the timer. + */ + if (!keyc->modifierMap[keycode]) { + if (down) { + startautorepeat(keycode); + } else { + TimerFree(sunTimer); + sunTimer = NULL; + } + } + } + + xf86Info.lastEventTime = + kevent.u.keyButtonPointer.time = + GetTimeInMillis(); + + /* + * And now send these prefixes ... + * NOTE: There cannot be multiple Mode_Switch keys !!!! + */ + + ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); +} + +/* + * Lets try reading more than one keyboard event at a time in the hopes that + * this will be slightly more efficient. Or we could just try the MicroSoft + * method, and forget about efficiency. :-) + */ +void +xf86KbdEvents() +{ + Firm_event event[64]; + int nBytes, i; + + /* I certainly hope its not possible to read partial events */ + + if ((nBytes = read(xf86Info.kbdFd, (char *)event, sizeof(event))) > 0) + { + for (i = 0; i < (nBytes / sizeof(Firm_event)); i++) + sunPostKbdEvent(&event[i]); + } +} + +/* + * Autorepeat stuff + */ + +void +startautorepeat(long keycode) +{ + sunTimer = TimerSet(sunTimer, /* Timer */ + 0, /* Flags */ + xf86Info.kbdDelay, /* millis */ + processautorepeat, /* callback */ + (pointer) keycode); /* arg for timer */ +} + +CARD32 +processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg) +{ + xEvent kevent; + int keycode; + + keycode = (long)arg; + + xf86Info.lastEventTime = + kevent.u.keyButtonPointer.time = + GetTimeInMillis(); + + /* + * Repeat a key by faking a KeyRelease, and a KeyPress event in rapid + * succession + */ + + ENQUEUE(&kevent, keycode, KeyRelease, XE_KEYBOARD); + ENQUEUE(&kevent, keycode, KeyPress, XE_KEYBOARD); + + /* And return the appropriate value so we get rescheduled */ + return xf86Info.kbdRate; +} Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c:1.3 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c Sat Oct 27 23:34:03 2001 @@ -0,0 +1,315 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c,v 1.3 2001/10/28 03:34:03 tsi Exp $ */ +/* + * Copyright 1999-2001 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal 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. + */ + +#include "xf86.h" +#include "xf86_OSlib.h" +#include "xf86OSmouse.h" + +#if defined(__SOL8__) || !defined(i386) + +#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; + + 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 +sunMousePreInit(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 const char * +DefaultProtocol(void) +{ + return "VUID"; +} + +#else /* __SOL8__ || !i386 */ + +#undef MSE_MISC +#define MSE_MISC 0 + +#endif /* !__SOL8__ && i386 */ + +static int +SupportedInterfaces(void) +{ + /* XXX This needs to be checked. */ + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2 | MSE_MISC; +} + +OSMouseInfoPtr +xf86OSMouseInit(int flags) +{ + OSMouseInfoPtr p; + + p = xcalloc(sizeof(OSMouseInfoRec), 1); + if (!p) + return NULL; + p->SupportedInterfaces = SupportedInterfaces; +#if defined(__SOL8__) || !defined(i386) + p->BuiltinNames = BuiltinNames; + p->DefaultProtocol = DefaultProtocol; + p->CheckProtocol = CheckProtocol; + p->PreInit = sunMousePreInit; +#endif + return p; +} + Index: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c:1.2 --- /dev/null Fri Jan 18 15:26:13 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c Sat Oct 27 23:34:03 2001 @@ -0,0 +1,230 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c,v 1.2 2001/10/28 03:34:03 tsi Exp $ */ +/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany + * Copyright 1993 by David Wexelblat <dwex@goblin.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the names of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT + * SHALL THE COPYRIGHT HOLDERS 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. + * + */ + +#ifdef i386 +#define _NEED_SYSI86 +#endif +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +/***************************************************************************/ +/* Video Memory Mapping section */ +/***************************************************************************/ + +char *apertureDevName = NULL; + +Bool +xf86LinearVidMem(void) +{ + int mmapFd; + + if (apertureDevName) + return TRUE; + + apertureDevName = "/dev/xsvc"; + if ((mmapFd = open(apertureDevName, O_RDWR)) < 0) + { + apertureDevName = "/dev/fbs/aperture"; + if((mmapFd = open(apertureDevName, O_RDWR)) < 0) + { + xf86Msg(X_WARNING, + "xf86LinearVidMem: failed to open %s (%s)\n", + apertureDevName, strerror(errno)); + xf86Msg(X_WARNING, "xf86LinearVidMem:" + " either /dev/fbs/aperture or" + " /dev/xsvc device driver" + " required\n"); + xf86Msg(X_WARNING, + "xf86LinearVidMem: linear memory access disabled\n"); + apertureDevName = NULL; + return FALSE; + } + } + close(mmapFd); + return TRUE; +} + +pointer +xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) +{ + pointer base; + int fd; + char vtname[20]; + + /* + * Solaris 2.1 x86 SVR4 (10/27/93) + * The server must treat the virtual terminal device file as the + * standard SVR4 /dev/pmem. + * + * Using the /dev/vtXX device as /dev/pmem only works for the + * A0000-FFFFF region - If we wish you mmap the linear aperture + * it requires a device driver. + * + * So what we'll do is use /dev/vtXX for the A0000-FFFFF stuff, and + * try to use the /dev/fbs/aperture or /dev/xsvc driver if the server + * tries to mmap anything > FFFFF. Its very very unlikely that the + * server will try to mmap anything below FFFFF that can't be handled + * by /dev/vtXX. + * + * DWH - 2/23/94 + * DWH - 1/31/99 (Gee has it really been 5 years?) + * + * Solaris 2.8 7/26/99 + * Use /dev/xsvc for everything + * + * DWH - 7/26/99 - Solaris8/dev/xsvc changes + * + * TSI - 2001.09 - SPARC changes + */ + +#if defined(i386) && !defined(__SOL8__) + if(Base < 0xFFFFF) + sprintf(vtname, "/dev/vt%02d", xf86Info.vtno); + else +#endif + { + if (!xf86LinearVidMem()) + FatalError("xf86MapVidMem: no aperture device\n"); + + strcpy(vtname, apertureDevName); + } + + fd = open(vtname, (Flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR); + if (fd < 0) + FatalError("xf86MapVidMem: failed to open %s (%s)\n", + vtname, strerror(errno)); + + base = mmap(NULL, Size, + (Flags & VIDMEM_READONLY) ? + PROT_READ : (PROT_READ | PROT_WRITE), + MAP_SHARED, fd, (off_t)Base); + close(fd); + if (base == MAP_FAILED) + FatalError("xf86MapVidMem: mmap failure: %s\n", + strerror(errno)); + + return(base); +} + +/* ARGSUSED */ +void +xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) +{ + munmap(Base, Size); +} + +/***************************************************************************/ +/* I/O Permissions section */ +/***************************************************************************/ + +#ifdef i386 +static Bool ExtendedEnabled = FALSE; +#endif + +void +xf86EnableIO(void) +{ +#ifdef i386 + if (ExtendedEnabled) + return; + + if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) + FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n"); + + ExtendedEnabled = TRUE; +#endif /* i386 */ +} + +void +xf86DisableIO(void) +{ +#ifdef i386 + if(!ExtendedEnabled) + return; + + sysi86(SI86V86, V86SC_IOPL, 0); + + ExtendedEnabled = FALSE; +#endif /* i386 */ +} + + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +Bool xf86DisableInterrupts(void) +{ +#ifdef i386 + if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)) + return FALSE; + +#ifdef __GNUC__ + __asm__ __volatile__("cli"); +#else + asm("cli"); +#endif /* __GNUC__ */ + + if (!ExtendedEnabled) + sysi86(SI86V86, V86SC_IOPL, 0); +#endif /* i386 */ + + return TRUE; +} + +void xf86EnableInterrupts(void) +{ +#ifdef i386 + if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)) + return; + +#ifdef __GNUC__ + __asm__ __volatile__("sti"); +#else + asm("sti"); +#endif /* __GNUC__ */ + + if (!ExtendedEnabled) + sysi86(SI86V86, V86SC_IOPL, 0); +#endif /* i386 */ +} + +void +xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, + unsigned long Size) +{ +} + +Bool +xf86CheckMTRR(int ScreenNum) +{ + return FALSE; +} + Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile:1.8 xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile:1.8 Tue May 23 00:47:49 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile Fri Aug 17 18:08:15 2001 @@ -1,34 +1,37 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile,v 1.8 2000/05/23 04:47:49 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile,v 1.10 2001/08/17 22:08:15 tsi Exp $ -#if DoLoadableServer -#define IHaveSubdirs -SUBDIRS = module -#endif - +#define IHaveModules #include <Server.tmpl> -SRCS = vbe.c vbe_module.c +#if DoLoadableServer +MODSRC = vbe_module.c +MODOBJ = vbe_module.o +#endif -OBJS = vbe.o vbe_module.o +SRCS = vbe.c $(MODSRC) +OBJS = vbe.o $(MODOBJ) INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XF86SRC)/int10 -I$(XF86SRC)/ddc \ -I$(XF86SRC)/i2c +ModuleObjectRule() + #if DoLoadableServer -#define IHaveSubdirs -SUBDIRS = module -#endif + +LibraryModuleTarget(vbe, $(OBJS)) +InstallLibraryModule(vbe,$(MODULEDIR),.) + +#else SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -#if DoLoadableServer -ForceSubdirs($(SUBDIRS)) -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) #endif DependTarget() + +InstallDriverSDKLibraryModule(vbe,$(DRIVERSDKMODULEDIR),.) + +InstallDriverSDKNonExecFile(vbe.h,$(DRIVERSDKINCLUDEDIR)) Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:1.16 xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:1.19 --- xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:1.16 Fri May 4 15:05:51 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c Fri Nov 16 14:17:27 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.16 2001/05/04 19:05:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.19 2001/11/16 19:17:27 dawes Exp $ */ /* * XFree86 vbe module @@ -166,6 +166,7 @@ xf86ExecX86int10(pVbe->pInt10); if ((pVbe->pInt10->ax & 0xff) != 0x4f) { + xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC not supported\n"); pVbe->ddc = DDC_NONE; return FALSE; } @@ -212,11 +213,13 @@ } typedef enum { - VBEOPT_NOVBE + VBEOPT_NOVBE, + VBEOPT_NODDC } VBEOpts; static const OptionInfoRec VBEOptions[] = { { VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE }, + { VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -227,6 +230,7 @@ pointer page = pVbe->memory; unsigned char *tmp = NULL; Bool novbe = FALSE; + Bool noddc = FALSE; int screen = pVbe->pInt10->scrnIndex; OptionInfoPtr options; @@ -236,8 +240,9 @@ (void)memcpy(options, VBEOptions, sizeof(VBEOptions)); xf86ProcessOptions(screen, xf86Screens[screen]->options, options); xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); + xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); xfree(options); - if (novbe) return NULL; + if (novbe || noddc) return NULL; if (!vbeProbeDDC(pVbe)) goto error; @@ -687,7 +692,7 @@ if (pVbe->pInt10->ax != 0x4f) return (FALSE); - return (0); + return (TRUE); } Bool Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile:1.1 Wed Apr 5 14:13:57 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile Fri Jan 18 15:26:13 2002 @@ -1,31 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile,v 1.1 2000/04/05 18:13:57 dawes Exp $ - -#define IHaveModules -#include <Server.tmpl> - -SRCS = vbe.c vbe_module.c - -OBJS = vbe.o vbe_module.o - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XF86SRC)/int10 -I$(XF86SRC)/ddc \ - -I$(XF86SRC)/i2c - -LinkSourceFile(vbe.c,..) -LinkSourceFile(vbe.h,..) -LinkSourceFile(vbe_module.c,..) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -LibraryModuleTarget(vbe, $(OBJS)) - -InstallLibraryModule(vbe,$(MODULEDIR),.) - -DependTarget() - -InstallDriverSDKLibraryModule(vbe,$(DRIVERSDKMODULEDIR),.) - -InstallDriverSDKNonExecFile(vbe.h,$(DRIVERSDKINCLUDEDIR)) - Index: xc/programs/Xserver/hw/xfree86/parser/Configint.h diff -u xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.17 xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.19 --- xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.17 Wed Feb 21 18:37:04 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Configint.h Mon Aug 6 16:51:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.17 2001/02/21 23:37:04 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.19 2001/08/06 20:51:12 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -38,6 +38,7 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> +#include <stddef.h> #include "xf86Parser.h" typedef struct @@ -48,10 +49,6 @@ } LexRec, *LexPtr; -#ifndef NULL -#define NULL 0 -#endif - #ifndef TRUE #define TRUE 1 #endif @@ -69,7 +66,7 @@ #define TestFree(a) if (a) { xf86conffree (a); a = NULL; } -#define parsePrologue(typeptr,typerec) int token; typeptr ptr; \ +#define parsePrologue(typeptr,typerec) typeptr ptr; \ if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return NULL; } \ memset(ptr,0,sizeof(typerec)); Index: xc/programs/Xserver/hw/xfree86/parser/DRI.c diff -u xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.9 xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.12 --- xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.9 Thu Mar 8 16:32:35 2001 +++ xc/programs/Xserver/hw/xfree86/parser/DRI.c Mon Aug 6 16:51:12 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.9 2001/03/08 21:32:35 anderson Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.12 2001/08/06 20:51:12 dawes Exp $ * */ @@ -48,23 +48,25 @@ XF86ConfBuffersPtr xf86parseBuffers (void) { + int token; parsePrologue (XF86ConfBuffersPtr, XF86ConfBuffersRec) - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->buf_comment)) != NUMBER) Error ("Buffers count expected", NULL); ptr->buf_count = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->buf_comment)) != NUMBER) Error ("Buffers size expected", NULL); ptr->buf_size = val.num; - if ((token = xf86getToken (NULL)) == STRING) { + if ((token = xf86getSubToken (&(ptr->buf_comment))) == STRING) { ptr->buf_flags = val.str; - } else { - ptr->buf_flags = NULL; - xf86unGetToken (token); + if ((token = xf86getToken (NULL)) == COMMENT) + ptr->buf_comment = xf86addComment(ptr->buf_comment, val.str); + else + xf86unGetToken(token); } - + #ifdef DEBUG printf ("Buffers parsed\n"); #endif @@ -79,6 +81,7 @@ XF86ConfDRIPtr xf86parseDRISection (void) { + int token; parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec); /* Zero is a valid value for this. */ @@ -87,7 +90,7 @@ switch (token) { case GROUP: - if ((token = xf86getToken (NULL)) == STRING) + if ((token = xf86getSubToken (&(ptr->dri_comment))) == STRING) ptr->dri_group_name = val.str; else if (token == NUMBER) ptr->dri_group = val.num; @@ -95,7 +98,7 @@ Error (GROUP_MSG, NULL); break; case MODE: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER) Error (NUMBER_MSG, "Mode"); ptr->dri_mode = val.num; break; @@ -106,6 +109,9 @@ case EOF_TOKEN: Error (UNEXPECTED_EOF_MSG, NULL); break; + case COMMENT: + ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str); + break; default: Error (INVALID_KEYWORD_MSG, xf86tokenString ()); break; @@ -130,6 +136,8 @@ return; fprintf (cf, "Section \"DRI\"\n"); + if (ptr->dri_comment) + fprintf (cf, "%s", ptr->dri_comment); if (ptr->dri_group_name) fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name); else if (ptr->dri_group >= 0) @@ -140,7 +148,10 @@ fprintf (cf, "\tBuffers %d %d", bufs->buf_count, bufs->buf_size); if (bufs->buf_flags) fprintf (cf, " \"%s\"", bufs->buf_flags); - fprintf (cf, "\n"); + if (bufs->buf_comment) + fprintf(cf, "%s", bufs->buf_comment); + else + fprintf (cf, "\n"); } fprintf (cf, "EndSection\n\n"); } @@ -152,6 +163,7 @@ return; xf86freeBuffersList (ptr->dri_buffers_lst); + TestFree (ptr->dri_comment); xf86conffree (ptr); } @@ -162,6 +174,7 @@ while (ptr) { TestFree (ptr->buf_flags); + TestFree (ptr->buf_comment); prev = ptr; ptr = ptr->list.next; xf86conffree (prev); Index: xc/programs/Xserver/hw/xfree86/parser/Device.c diff -u xc/programs/Xserver/hw/xfree86/parser/Device.c:1.18 xc/programs/Xserver/hw/xfree86/parser/Device.c:1.22 --- xc/programs/Xserver/hw/xfree86/parser/Device.c:1.18 Wed Feb 21 18:37:04 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Device.c Mon Aug 6 16:51:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.18 2001/02/21 23:37:04 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.22 2001/08/06 20:51:12 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -38,7 +38,6 @@ static xf86ConfigSymTabRec DeviceTab[] = { - {COMMENT, "###"}, {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {VENDOR, "vendorname"}, @@ -71,6 +70,7 @@ { int i; int has_ident = FALSE; + int token; parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec) /* Zero is a valid value for these */ @@ -82,12 +82,10 @@ switch (token) { case COMMENT: - if (xf86getToken (NULL) != STRING) - Error (QUOTE_MSG, "###"); - ptr->dev_comment = val.str; + ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str); break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error (MULTIPLE_MSG, "Identifier"); @@ -95,39 +93,39 @@ has_ident = TRUE; break; case VENDOR: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "Vendor"); ptr->dev_vendor = val.str; break; case BOARD: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "Board"); ptr->dev_board = val.str; break; case CHIPSET: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "Chipset"); ptr->dev_chipset = val.str; break; case CARD: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "Card"); ptr->dev_card = val.str; break; case DRIVER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "Driver"); ptr->dev_driver = val.str; break; case RAMDAC: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "Ramdac"); ptr->dev_ramdac = val.str; break; case DACSPEED: for (i = 0; i < CONF_MAXDACSPEEDS; i++) ptr->dev_dacSpeeds[i] = 0; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) { Error (DACSPEED_MSG, CONF_MAXDACSPEEDS); } @@ -136,7 +134,7 @@ ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5); for (i = 1; i < CONF_MAXDACSPEEDS; i++) { - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) == NUMBER) ptr->dev_dacSpeeds[i] = (int) (val.realnum * 1000.0 + 0.5); else @@ -148,87 +146,71 @@ } break; case VIDEORAM: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) Error (NUMBER_MSG, "VideoRam"); ptr->dev_videoram = val.num; break; case BIOSBASE: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) Error (NUMBER_MSG, "BIOSBase"); ptr->dev_bios_base = val.num; break; case MEMBASE: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) Error (NUMBER_MSG, "MemBase"); ptr->dev_mem_base = val.num; break; case IOBASE: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) Error (NUMBER_MSG, "IOBase"); ptr->dev_io_base = val.num; break; case CLOCKCHIP: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "ClockChip"); ptr->dev_clockchip = val.str; break; case CHIPID: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) Error (NUMBER_MSG, "ChipID"); ptr->dev_chipid = val.num; break; case CHIPREV: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) Error (NUMBER_MSG, "ChipRev"); ptr->dev_chiprev = val.num; break; case CLOCKS: - token = xf86getToken(NULL); + token = xf86getSubToken(&(ptr->dev_comment)); for( i = ptr->dev_clocks; token == NUMBER && i < CONF_MAXCLOCKS; i++ ) { ptr->dev_clock[i] = (int)(val.realnum * 1000.0 + 0.5); - token = xf86getToken(NULL); + token = xf86getSubToken(&(ptr->dev_comment)); } ptr->dev_clocks = i; xf86unGetToken (token); break; case TEXTCLOCKFRQ: - if ((token = xf86getToken(NULL)) != NUMBER) + if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER) Error (NUMBER_MSG, "TextClockFreq"); ptr->dev_textclockfreq = (int)(val.realnum * 1000.0 + 0.5); break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->dev_option_lst = xf86addNewOption (ptr->dev_option_lst, - name, val.str); - } - else - { - ptr->dev_option_lst = xf86addNewOption (ptr->dev_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst); break; case BUSID: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->dev_comment)) != STRING) Error (QUOTE_MSG, "BusID"); ptr->dev_busid = val.str; break; case IRQ: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) Error (QUOTE_MSG, "IRQ"); ptr->dev_irq = val.num; break; case SCREEN: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER) Error (NUMBER_MSG, "Screen"); ptr->dev_screen = val.num; break; @@ -256,14 +238,13 @@ void xf86printDeviceSection (FILE * cf, XF86ConfDevicePtr ptr) { - XF86OptionPtr optr; int i; while (ptr) { fprintf (cf, "Section \"Device\"\n"); if (ptr->dev_comment) - fprintf (cf, "\t### %s", ptr->dev_comment); + fprintf (cf, "%s", ptr->dev_comment); if (ptr->dev_identifier) fprintf (cf, "\tIdentifier \"%s\"\n", ptr->dev_identifier); if (ptr->dev_driver) @@ -300,13 +281,7 @@ if (ptr->dev_chiprev != -1) fprintf (cf, "\tChipRev 0x%x\n", ptr->dev_chiprev); - for (optr = ptr->dev_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); - } + xf86printOptionList(cf, ptr->dev_option_lst, 1); if (ptr->dev_clocks > 0 ) { fprintf (cf, "\tClocks "); for (i = 0; i < ptr->dev_clocks; i++ ) @@ -343,6 +318,7 @@ TestFree (ptr->dev_driver); TestFree (ptr->dev_ramdac); TestFree (ptr->dev_clockchip); + TestFree (ptr->dev_comment); xf86optionListFree (ptr->dev_option_lst); prev = ptr; Index: xc/programs/Xserver/hw/xfree86/parser/Files.c diff -u xc/programs/Xserver/hw/xfree86/parser/Files.c:1.8 xc/programs/Xserver/hw/xfree86/parser/Files.c:1.12 --- xc/programs/Xserver/hw/xfree86/parser/Files.c:1.8 Fri Oct 20 10:59:02 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Files.c Mon Aug 6 16:51:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Files.c,v 1.8 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Files.c,v 1.12 2001/08/06 20:51:13 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -38,7 +38,6 @@ static xf86ConfigSymTabRec FilesTab[] = { - {COMMENT, "###"}, {ENDSECTION, "endsection"}, {FONTPATH, "fontpath"}, {RGBPATH, "rgbpath"}, @@ -66,6 +65,7 @@ int i, j; int k, l; char *str; + int token; parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec) while ((token = xf86getToken (FilesTab)) != ENDSECTION) @@ -73,12 +73,10 @@ switch (token) { case COMMENT: - if (xf86getToken (NULL) != STRING) - Error (QUOTE_MSG, "###"); - ptr->file_comment = val.str; + ptr->file_comment = xf86addComment(ptr->file_comment, val.str); break; case FONTPATH: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->file_comment)) != STRING) Error (QUOTE_MSG, "FontPath"); j = FALSE; str = prependRoot (val.str); @@ -106,12 +104,12 @@ xf86conffree (val.str); break; case RGBPATH: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->file_comment)) != STRING) Error (QUOTE_MSG, "RGBPath"); ptr->file_rgbpath = val.str; break; case MODULEPATH: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->file_comment)) != STRING) Error (QUOTE_MSG, "ModulePath"); l = FALSE; str = prependRoot (val.str); @@ -138,7 +136,7 @@ xf86conffree (val.str); break; case LOGFILEPATH: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->file_comment)) != STRING) Error (QUOTE_MSG, "LogFile"); ptr->file_logfile = val.str; break; @@ -169,7 +167,7 @@ return; if (ptr->file_comment) - fprintf (cf, "\t### \"%s\"\n", ptr->file_comment); + fprintf (cf, "%s", ptr->file_comment); if (ptr->file_logfile) fprintf (cf, "\tLogFile \"%s\"\n", ptr->file_logfile); if (ptr->file_rgbpath) @@ -216,6 +214,7 @@ TestFree (p->file_rgbpath); TestFree (p->file_modulepath); TestFree (p->file_fontpath); + TestFree (p->file_comment); xf86conffree (p); } Index: xc/programs/Xserver/hw/xfree86/parser/Flags.c diff -u xc/programs/Xserver/hw/xfree86/parser/Flags.c:1.14 xc/programs/Xserver/hw/xfree86/parser/Flags.c:1.18 --- xc/programs/Xserver/hw/xfree86/parser/Flags.c:1.14 Fri Oct 20 10:59:02 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Flags.c Wed Sep 5 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Flags.c,v 1.14 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Flags.c,v 1.18 2001/09/05 21:36:57 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -38,7 +38,6 @@ static xf86ConfigSymTabRec ServerFlagsTab[] = { - {COMMENT, "###"}, {ENDSECTION, "endsection"}, {NOTRAPSIGNALS, "notrapsignals"}, {DONTZAP, "dontzap"}, @@ -62,6 +61,7 @@ XF86ConfFlagsPtr xf86parseFlagsSection (void) { + int token; parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec) while ((token = xf86getToken (ServerFlagsTab)) != ENDSECTION) @@ -72,8 +72,7 @@ switch (token) { case COMMENT: - if ((token = xf86getToken (NULL)) != STRING) - Error (QUOTE_MSG, "###"); + ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str); break; /* * these old keywords are turned into standard generic options. @@ -107,7 +106,7 @@ tmp = xf86configStrdup (ServerFlagsTab[i].name); if (hasvalue) { - tokentype = xf86getToken(NULL); + tokentype = xf86getSubToken(&(ptr->flg_comment)); if (strvalue) { if (tokentype != STRING) Error (QUOTE_MSG, tmp); @@ -128,27 +127,7 @@ } break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - { - Error (BAD_OPTION_MSG, NULL); - break; - } - - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->flg_option_lst = xf86addNewOption (ptr->flg_option_lst, - name, val.str); - } - else - { - ptr->flg_option_lst = xf86addNewOption (ptr->flg_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->flg_option_lst = xf86parseOption(ptr->flg_option_lst); break; case EOF_TOKEN: @@ -178,16 +157,9 @@ return; p = flags->flg_option_lst; fprintf (f, "Section \"ServerFlags\"\n"); - if (p->opt_comment) - fprintf (f, "\t### \"%s\" \n", p->opt_comment); - while (p) - { - if (p->opt_val) - fprintf (f, "\tOption \"%s\" \"%s\"\n", p->opt_name, p->opt_val); - else - fprintf (f, "\tOption \"%s\"\n", p->opt_name); - p = p->list.next; - } + if (flags->flg_comment) + fprintf (f, "%s", flags->flg_comment); + xf86printOptionList(f, p, 1); fprintf (f, "EndSection\n\n"); } @@ -226,6 +198,7 @@ if (flags == NULL) return; xf86optionListFree (flags->flg_option_lst); + TestFree(flags->flg_comment); xf86conffree (flags); } @@ -238,6 +211,8 @@ { newopt = xf86addNewOption(newopt, opt->opt_name, opt->opt_val); newopt->opt_used = opt->opt_used; + if (opt->opt_comment) + newopt->opt_comment = xf86configStrdup(opt->opt_comment); opt = opt->list.next; } return newopt; @@ -252,6 +227,7 @@ { TestFree (opt->opt_name); TestFree (opt->opt_val); + TestFree (opt->opt_comment); prev = opt; opt = opt->list.next; xf86conffree (prev); @@ -458,3 +434,75 @@ } } +XF86OptionPtr +xf86parseOption(XF86OptionPtr head) +{ + XF86OptionPtr option, cnew, old; + char *name, *comment = NULL; + int token; + + if ((token = xf86getSubToken(&comment)) != STRING) { + xf86parseError(BAD_OPTION_MSG, NULL); + if (comment) + xf86conffree(comment); + return (head); + } + + name = val.str; + if ((token = xf86getSubToken(&comment)) == STRING) { + option = xf86newOption(name, val.str); + option->opt_comment = comment; + if ((token = xf86getToken(NULL)) == COMMENT) + option->opt_comment = xf86addComment(option->opt_comment, val.str); + else + xf86unGetToken(token); + } + else { + option = xf86newOption(name, NULL); + option->opt_comment = comment; + if (token == COMMENT) + option->opt_comment = xf86addComment(option->opt_comment, val.str); + else + xf86unGetToken(token); + } + + old = NULL; + + /* Don't allow duplicates */ + if (head != NULL && (old = xf86findOption(head, name)) != NULL) { + cnew = old; + xf86conffree(option->opt_name); + TestFree(option->opt_val); + TestFree(option->opt_comment); + xf86conffree(option); + } + else + cnew = option; + + if (old == NULL) + return ((XF86OptionPtr)xf86addListItem((glp)head, (glp)cnew)); + + return (head); +} + +void +xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs) +{ + int i; + + if (!list) + return; + while (list) { + for (i = 0; i < tabs; i++) + fputc('\t', fp); + if (list->opt_val) + fprintf(fp, "Option \"%s\" \"%s\"", list->opt_name, list->opt_val); + else + fprintf(fp, "Option \"%s\"", list->opt_name); + if (list->opt_comment) + fprintf(fp, "%s", list->opt_comment); + else + fputc('\n', fp); + list = list->list.next; + } +} Index: xc/programs/Xserver/hw/xfree86/parser/Input.c diff -u xc/programs/Xserver/hw/xfree86/parser/Input.c:1.6 xc/programs/Xserver/hw/xfree86/parser/Input.c:1.10 --- xc/programs/Xserver/hw/xfree86/parser/Input.c:1.6 Wed Feb 21 18:37:04 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Input.c Mon Aug 6 16:51:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.6 2001/02/21 23:37:04 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.10 2001/08/06 20:51:13 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -38,7 +38,6 @@ static xf86ConfigSymTabRec InputTab[] = { - {COMMENT, "###"}, {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, @@ -52,6 +51,7 @@ xf86parseInputSection (void) { int has_ident = FALSE; + int token; parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) while ((token = xf86getToken (InputTab)) != ENDSECTION) @@ -59,12 +59,10 @@ switch (token) { case COMMENT: - if (xf86getToken (NULL) != STRING) - Error (QUOTE_MSG, "###"); - ptr->inp_comment = val.str; + ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error (MULTIPLE_MSG, "Identifier"); @@ -72,28 +70,12 @@ has_ident = TRUE; break; case DRIVER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "Driver"); ptr->inp_driver = val.str; break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->inp_option_lst = xf86addNewOption (ptr->inp_option_lst, - name, val.str); - } - else - { - ptr->inp_option_lst = xf86addNewOption (ptr->inp_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst); break; case EOF_TOKEN: Error (UNEXPECTED_EOF_MSG, NULL); @@ -119,24 +101,16 @@ void xf86printInputSection (FILE * cf, XF86ConfInputPtr ptr) { - XF86OptionPtr optr; - while (ptr) { fprintf (cf, "Section \"InputDevice\"\n"); if (ptr->inp_comment) - fprintf (cf, "\t### \"%s\"\n", ptr->inp_comment); + fprintf (cf, "%s", ptr->inp_comment); if (ptr->inp_identifier) fprintf (cf, "\tIdentifier \"%s\"\n", ptr->inp_identifier); if (ptr->inp_driver) fprintf (cf, "\tDriver \"%s\"\n", ptr->inp_driver); - for (optr = ptr->inp_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); - } + xf86printOptionList(cf, ptr->inp_option_lst, 1); fprintf (cf, "EndSection\n\n"); ptr = ptr->list.next; } @@ -151,6 +125,7 @@ { TestFree (ptr->inp_identifier); TestFree (ptr->inp_driver); + TestFree (ptr->inp_comment); xf86optionListFree (ptr->inp_option_lst); prev = ptr; Index: xc/programs/Xserver/hw/xfree86/parser/Keyboard.c diff -u xc/programs/Xserver/hw/xfree86/parser/Keyboard.c:1.10 xc/programs/Xserver/hw/xfree86/parser/Keyboard.c:1.12 --- xc/programs/Xserver/hw/xfree86/parser/Keyboard.c:1.10 Fri Oct 20 10:59:02 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Keyboard.c Mon Aug 6 16:51:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Keyboard.c,v 1.10 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Keyboard.c,v 1.12 2001/08/06 20:51:13 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -87,25 +87,28 @@ { char *s, *s1, *s2; int l; - int ntoken; + int token, ntoken; parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) while ((token = xf86getToken (KeyboardTab)) != ENDSECTION) { switch (token) { + case COMMENT: + ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); + break; case KPROTOCOL: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "Protocol"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Protocol"), val.str); break; case AUTOREPEAT: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER) Error (AUTOREPEAT_MSG, NULL); s1 = xf86uLongToString(val.num); - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER) Error (AUTOREPEAT_MSG, NULL); s2 = xf86uLongToString(val.num); l = strlen(s1) + 1 + strlen(s2) + 1; @@ -117,11 +120,11 @@ xf86configStrdup("AutoRepeat"), s); break; case XLEDS: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER) Error (XLEDS_MSG, NULL); s = xf86uLongToString(val.num); l = strlen(s) + 1; - while ((token = xf86getToken (NULL)) == NUMBER) + while ((token = xf86getSubToken (&(ptr->inp_comment))) == NUMBER) { s1 = xf86uLongToString(val.num); l += (1 + strlen(s1)); @@ -156,7 +159,7 @@ } break; case VTINIT: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "VTInit"); xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTInit"); break; @@ -169,77 +172,77 @@ NULL); break; case XKBKEYMAP: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBKeymap"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbKeymap"), val.str); break; case XKBCOMPAT: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBCompat"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbCompat"), val.str); break; case XKBTYPES: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBTypes"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbTypes"), val.str); break; case XKBKEYCODES: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBKeycodes"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbKeycodes"), val.str); break; case XKBGEOMETRY: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBGeometry"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbGeometry"), val.str); break; case XKBSYMBOLS: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBSymbols"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbSymbols"), val.str); break; case XKBRULES: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBRules"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbRules"), val.str); break; case XKBMODEL: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBModel"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbModel"), val.str); break; case XKBLAYOUT: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBLayout"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbLayout"), val.str); break; case XKBVARIANT: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBVariant"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbVariant"), val.str); break; case XKBOPTIONS: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBOptions"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbOptions"), Index: xc/programs/Xserver/hw/xfree86/parser/Layout.c diff -u xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.14 xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.18 --- xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.14 Wed Feb 21 18:37:04 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Layout.c Mon Aug 6 16:51:14 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.14 2001/02/21 23:37:04 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.18 2001/08/06 20:51:14 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -38,7 +38,6 @@ static xf86ConfigSymTabRec LayoutTab[] = { - {COMMENT, "###"}, {ENDSECTION, "endsection"}, {SCREEN, "screen"}, {IDENTIFIER, "identifier"}, @@ -64,6 +63,7 @@ xf86parseLayoutSection (void) { int has_ident = FALSE; + int token; parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec) while ((token = xf86getToken (LayoutTab)) != ENDSECTION) @@ -71,12 +71,10 @@ switch (token) { case COMMENT: - if (xf86getToken (NULL) != STRING) - Error (QUOTE_MSG, "###"); - ptr->lay_comment = val.str; + ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str); break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->lay_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error (MULTIPLE_MSG, "Identifier"); @@ -89,7 +87,7 @@ iptr = xf86confcalloc (1, sizeof (XF86ConfInactiveRec)); iptr->list.next = NULL; - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->lay_comment)) != STRING) Error (INACTIVE_MSG, NULL); iptr->inactive_device_str = val.str; ptr->lay_inactive_lst = (XF86ConfInactivePtr) @@ -107,16 +105,16 @@ aptr->adj_x = 0; aptr->adj_y = 0; aptr->adj_refscreen = NULL; - if ((token = xf86getToken (NULL)) == NUMBER) + if ((token = xf86getSubToken (&(ptr->lay_comment))) == NUMBER) aptr->adj_scrnum = val.num; else xf86unGetToken (token); - token = xf86getToken(NULL); + token = xf86getSubToken(&(ptr->lay_comment)); if (token != STRING) Error (SCREEN_MSG, NULL); aptr->adj_screen_str = val.str; - token = xf86getToken(AdjTab); + token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab); switch (token) { case RIGHTOF: @@ -139,7 +137,7 @@ break; default: xf86unGetToken (token); - token = xf86getToken(NULL); + token = xf86getSubToken(&(ptr->lay_comment)); if (token == STRING) aptr->adj_where = CONF_ADJ_OBSOLETE; else @@ -151,7 +149,7 @@ if (token == NUMBER) { aptr->adj_x = val.num; - token = xf86getToken(NULL); + token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) Error(INVALID_SCR_MSG, NULL); aptr->adj_y = val.num; @@ -163,17 +161,17 @@ case CONF_ADJ_ABOVE: case CONF_ADJ_BELOW: case CONF_ADJ_RELATIVE: - token = xf86getToken(NULL); + token = xf86getSubToken(&(ptr->lay_comment)); if (token != STRING) Error(INVALID_SCR_MSG, NULL); aptr->adj_refscreen = val.str; if (aptr->adj_where == CONF_ADJ_RELATIVE) { - token = xf86getToken(NULL); + token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) Error(INVALID_SCR_MSG, NULL); aptr->adj_x = val.num; - token = xf86getToken(NULL); + token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) Error(INVALID_SCR_MSG, NULL); aptr->adj_y = val.num; @@ -184,17 +182,17 @@ aptr->adj_top_str = val.str; /* bottom */ - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->lay_comment)) != STRING) Error (SCREEN_MSG, NULL); aptr->adj_bottom_str = val.str; /* left */ - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->lay_comment)) != STRING) Error (SCREEN_MSG, NULL); aptr->adj_left_str = val.str; /* right */ - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->lay_comment)) != STRING) Error (SCREEN_MSG, NULL); aptr->adj_right_str = val.str; @@ -210,10 +208,10 @@ iptr = xf86confcalloc (1, sizeof (XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->lay_comment)) != STRING) Error (INPUTDEV_MSG, NULL); iptr->iref_inputdev_str = val.str; - while ((token = xf86getToken (NULL)) == STRING) + while ((token = xf86getSubToken (&(ptr->lay_comment))) == STRING) { iptr->iref_option_lst = xf86addNewOption (iptr->iref_option_lst, val.str, NULL); @@ -224,25 +222,7 @@ } break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->lay_option_lst = - xf86addNewOption (ptr->lay_option_lst, - name, val.str); - } - else - { - ptr->lay_option_lst = - xf86addNewOption (ptr->lay_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst); break; case EOF_TOKEN: Error (UNEXPECTED_EOF_MSG, NULL); @@ -277,7 +257,7 @@ { fprintf (cf, "Section \"ServerLayout\"\n"); if (ptr->lay_comment) - fprintf (cf, "\t### \"%s\"\n", ptr->lay_comment); + fprintf (cf, "%s", ptr->lay_comment); if (ptr->lay_identifier) fprintf (cf, "\tIdentifier \"%s\"\n", ptr->lay_identifier); @@ -331,14 +311,8 @@ fprintf(cf, " \"%s\"", optr->opt_name); } fprintf(cf, "\n"); - } - for (optr = ptr->lay_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); } + xf86printOptionList(cf, ptr->lay_option_lst, 1); fprintf (cf, "EndSection\n\n"); ptr = ptr->list.next; } @@ -352,6 +326,7 @@ while (ptr) { TestFree (ptr->lay_identifier); + TestFree (ptr->lay_comment); xf86freeAdjacencyList (ptr->lay_adjacency_lst); xf86freeInputrefList (ptr->lay_input_lst); prev = ptr; Index: xc/programs/Xserver/hw/xfree86/parser/Module.c diff -u xc/programs/Xserver/hw/xfree86/parser/Module.c:1.6 xc/programs/Xserver/hw/xfree86/parser/Module.c:1.9 --- xc/programs/Xserver/hw/xfree86/parser/Module.c:1.6 Fri Oct 20 10:59:02 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Module.c Mon Aug 6 16:51:14 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Module.c,v 1.6 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Module.c,v 1.9 2001/08/06 20:51:14 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -56,6 +56,7 @@ XF86LoadPtr xf86parseModuleSubSection (XF86LoadPtr head, char *name) { + int token; parsePrologue (XF86LoadPtr, XF86LoadRec) ptr->load_name = name; @@ -67,28 +68,11 @@ { switch (token) { + case COMMENT: + ptr->load_comment = xf86addComment(ptr->load_comment, val.str); + break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - { - xf86parseError (BAD_OPTION_MSG, NULL); - xf86conffree(ptr); - return NULL; - } - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->load_opt = xf86addNewOption (ptr->load_opt, - name, val.str); - } - else - { - ptr->load_opt = xf86addNewOption (ptr->load_opt, - name, NULL); - xf86unGetToken (token); - } - } + ptr->load_opt = xf86parseOption(ptr->load_opt); break; case EOF_TOKEN: xf86parseError (UNEXPECTED_EOF_MSG, NULL); @@ -110,28 +94,32 @@ XF86ConfModulePtr xf86parseModuleSection (void) { + int token; parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec) while ((token = xf86getToken (ModuleTab)) != ENDSECTION) { switch (token) { + case COMMENT: + ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str); + break; case LOAD: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->mod_comment)) != STRING) Error (QUOTE_MSG, "Load"); ptr->mod_load_lst = xf86addNewLoadDirective (ptr->mod_load_lst, val.str, XF86_LOAD_MODULE, NULL); break; case LOAD_DRIVER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->mod_comment)) != STRING) Error (QUOTE_MSG, "LoadDriver"); ptr->mod_load_lst = xf86addNewLoadDirective (ptr->mod_load_lst, val.str, XF86_LOAD_DRIVER, NULL); break; case SUBSECTION: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->mod_comment)) != STRING) Error (QUOTE_MSG, "SubSection"); ptr->mod_load_lst = xf86parseModuleSubSection (ptr->mod_load_lst, val.str); @@ -162,33 +150,41 @@ if (ptr == NULL) return; + if (ptr->mod_comment) + fprintf(cf, "%s", ptr->mod_comment); for (lptr = ptr->mod_load_lst; lptr; lptr = lptr->list.next) { switch (lptr->load_type) { case XF86_LOAD_MODULE: - if( lptr->load_opt == NULL ) - fprintf (cf, "\tLoad \"%s\"\n", lptr->load_name); + if( lptr->load_opt == NULL ) { + fprintf (cf, "\tLoad \"%s\"", lptr->load_name); + if (lptr->load_comment) + fprintf(cf, "%s", lptr->load_comment); + else + fputc('\n', cf); + } else { - XF86OptionPtr optr; fprintf (cf, "\tSubSection \"%s\"\n", lptr->load_name); - for(optr=lptr->load_opt;optr;optr=optr->list.next) - { - fprintf (cf, "\t\tOption \"%s\"", optr->opt_name); - if( optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n" ); - } + if (lptr->load_comment) + fprintf(cf, "%s", lptr->load_comment); + xf86printOptionList(cf, lptr->load_opt, 2); fprintf (cf, "\tEndSubSection\n"); } break; case XF86_LOAD_DRIVER: - fprintf (cf, "\tLoadDriver \"%s\"\n", lptr->load_name); + fprintf (cf, "\tLoadDriver \"%s\"", lptr->load_name); + if (lptr->load_comment) + fprintf(cf, "%s", lptr->load_comment); + else + fputc('\n', cf); break; +#if 0 default: fprintf (cf, "#\tUnknown type \"%s\"\n", lptr->load_name); break; +#endif } } } @@ -197,6 +193,7 @@ xf86addNewLoadDirective (XF86LoadPtr head, char *name, int type, XF86OptionPtr opts) { XF86LoadPtr new; + int token; new = xf86confcalloc (1, sizeof (XF86LoadRec)); new->load_name = name; @@ -204,6 +201,11 @@ new->load_opt = opts; new->list.next = NULL; + if ((token = xf86getToken(NULL)) == COMMENT) + new->load_comment = xf86addComment(new->load_comment, val.str); + else + xf86unGetToken(token); + return ((XF86LoadPtr) xf86addListItem ((glp) head, (glp) new)); } @@ -219,9 +221,11 @@ while (lptr) { TestFree (lptr->load_name); + TestFree (lptr->load_comment); prev = lptr; lptr = lptr->list.next; xf86conffree (prev); } + TestFree (ptr->mod_comment); xf86conffree (ptr); } Index: xc/programs/Xserver/hw/xfree86/parser/Monitor.c diff -u xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.20 xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.24 --- xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.20 Wed Feb 21 18:37:04 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Monitor.c Mon Aug 6 16:51:14 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.20 2001/02/21 23:37:04 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.24 2001/08/06 20:51:14 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -37,7 +37,6 @@ static xf86ConfigSymTabRec MonitorTab[] = { - {COMMENT, "###"}, {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {VENDOR, "vendorname"}, @@ -98,59 +97,60 @@ XF86ConfModeLinePtr xf86parseModeLine (void) { + int token; parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec) /* Identifier */ - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->ml_comment)) != STRING) Error ("ModeLine identifier expected", NULL); ptr->ml_identifier = val.str; /* DotClock */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine dotclock expected", NULL); ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5); /* HDisplay */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine Hdisplay expected", NULL); ptr->ml_hdisplay = val.num; /* HSyncStart */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine HSyncStart expected", NULL); ptr->ml_hsyncstart = val.num; /* HSyncEnd */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine HSyncEnd expected", NULL); ptr->ml_hsyncend = val.num; /* HTotal */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine HTotal expected", NULL); ptr->ml_htotal = val.num; /* VDisplay */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine Vdisplay expected", NULL); ptr->ml_vdisplay = val.num; /* VSyncStart */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine VSyncStart expected", NULL); ptr->ml_vsyncstart = val.num; /* VSyncEnd */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine VSyncEnd expected", NULL); ptr->ml_vsyncend = val.num; /* VTotal */ - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("ModeLine VTotal expected", NULL); ptr->ml_vtotal = val.num; - token = xf86getToken (TimingTab); + token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab); while ((token == TT_INTERLACE) || (token == TT_PHSYNC) || (token == TT_NHSYNC) || (token == TT_PVSYNC) || (token == TT_NVSYNC) || (token == TT_CSYNC) || @@ -189,7 +189,7 @@ ptr->ml_flags |= XF86CONF_DBLSCAN; break; case TT_HSKEW: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error (NUMBER_MSG, "Hskew"); ptr->ml_hskew = val.num; ptr->ml_flags |= XF86CONF_HSKEW; @@ -198,7 +198,7 @@ ptr->ml_flags |= XF86CONF_BCAST; break; case TT_VSCAN: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error (NUMBER_MSG, "Vscan"); ptr->ml_vscan = val.num; ptr->ml_flags |= XF86CONF_VSCAN; @@ -213,7 +213,7 @@ Error (INVALID_KEYWORD_MSG, xf86tokenString ()); break; } - token = xf86getToken (TimingTab); + token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab); } xf86unGetToken (token); @@ -226,69 +226,72 @@ XF86ConfModeLinePtr xf86parseVerboseMode (void) { - int token2; + int token, token2; int had_dotclock = 0, had_htimings = 0, had_vtimings = 0; parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec) - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->ml_comment)) != STRING) Error ("Mode name expected", NULL); ptr->ml_identifier = val.str; while ((token = xf86getToken (ModeTab)) != ENDMODE) { switch (token) { + case COMMENT: + ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str); + break; case DOTCLOCK: - if ((token = xf86getToken (NULL)) != NUMBER) + if ((token = xf86getSubToken (&(ptr->ml_comment))) != NUMBER) Error (NUMBER_MSG, "DotClock"); ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5); had_dotclock = 1; break; case HTIMINGS: - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER) ptr->ml_hdisplay = val.num; else Error ("Horizontal display expected", NULL); - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER) ptr->ml_hsyncstart = val.num; else Error ("Horizontal sync start expected", NULL); - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER) ptr->ml_hsyncend = val.num; else Error ("Horizontal sync end expected", NULL); - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER) ptr->ml_htotal = val.num; else Error ("Horizontal total expected", NULL); had_htimings = 1; break; case VTIMINGS: - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER) ptr->ml_vdisplay = val.num; else Error ("Vertical display expected", NULL); - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER) ptr->ml_vsyncstart = val.num; else Error ("Vertical sync start expected", NULL); - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER) ptr->ml_vsyncend = val.num; else Error ("Vertical sync end expected", NULL); - if (xf86getToken (NULL) == NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER) ptr->ml_vtotal = val.num; else Error ("Vertical total expected", NULL); had_vtimings = 1; break; case FLAGS: - token = xf86getToken (NULL); + token = xf86getSubToken (&(ptr->ml_comment)); if (token != STRING) Error (QUOTE_MSG, "Flags"); while (token == STRING) @@ -333,18 +336,18 @@ Error ("Unknown flag string", NULL); break; } - token = xf86getToken (NULL); + token = xf86getSubToken (&(ptr->ml_comment)); } xf86unGetToken (token); break; case HSKEW: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("Horizontal skew expected", NULL); ptr->ml_flags |= XF86CONF_HSKEW; ptr->ml_hskew = val.num; break; case VSCAN: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER) Error ("Vertical scan count expected", NULL); ptr->ml_flags |= XF86CONF_VSCAN; ptr->ml_vscan = val.num; @@ -377,6 +380,7 @@ xf86parseMonitorSection (void) { int has_ident = FALSE; + int token; parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) while ((token = xf86getToken (MonitorTab)) != ENDSECTION) @@ -384,12 +388,10 @@ switch (token) { case COMMENT: - if (xf86getToken (NULL) != STRING) - Error (QUOTE_MSG, "###"); - ptr->mon_comment = val.str; + ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str); break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->mon_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error (MULTIPLE_MSG, "Identifier"); @@ -397,12 +399,12 @@ has_ident = TRUE; break; case VENDOR: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->mon_comment)) != STRING) Error (QUOTE_MSG, "Vendor"); ptr->mon_vendor = val.str; break; case MODEL: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->mon_comment)) != STRING) Error (QUOTE_MSG, "ModelName"); ptr->mon_modelname = val.str; break; @@ -415,31 +417,31 @@ XF86ConfModeLinePtr); break; case DISPLAYSIZE: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER) Error (DISPLAYSIZE_MSG, NULL); ptr->mon_width = val.realnum; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER) Error (DISPLAYSIZE_MSG, NULL); ptr->mon_height = val.realnum; break; case HORIZSYNC: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER) Error (HORIZSYNC_MSG, NULL); do { ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum; - switch (token = xf86getToken (NULL)) + switch (token = xf86getSubToken (&(ptr->mon_comment))) { case COMMA: ptr->mon_hsync[ptr->mon_n_hsync].hi = ptr->mon_hsync[ptr->mon_n_hsync].lo; break; case DASH: - if (xf86getToken (NULL) != NUMBER || + if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER || (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; - if (token = xf86getToken (NULL) == COMMA) + if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA) break; ptr->mon_n_hsync++; goto HorizDone; @@ -455,28 +457,28 @@ if (ptr->mon_n_hsync == CONF_MAX_HSYNC) Error ("Sorry. Too many horizontal sync intervals.", NULL); ptr->mon_n_hsync++; - } while ((token = xf86getToken (NULL)) == NUMBER); + } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER); HorizDone: xf86unGetToken (token); break; case VERTREFRESH: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER) Error (VERTREFRESH_MSG, NULL); do { ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum; - switch (token = xf86getToken (NULL)) + switch (token = xf86getSubToken (&(ptr->mon_comment))) { case COMMA: ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo; break; case DASH: - if (xf86getToken (NULL) != NUMBER || + if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER || (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; - if (token = xf86getToken (NULL) == COMMA) + if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA) break; ptr->mon_n_vrefresh++; goto VertDone; @@ -492,13 +494,13 @@ if (ptr->mon_n_vrefresh == CONF_MAX_VREFRESH) Error ("Sorry. Too many vertical refresh intervals.", NULL); ptr->mon_n_vrefresh++; - } while ((token = xf86getToken (NULL)) == NUMBER); + } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER); VertDone: xf86unGetToken (token); break; case GAMMA: - if( xf86getToken (NULL) != NUMBER ) + if( xf86getSubToken (&(ptr->mon_comment)) != NUMBER ) { Error (INVALID_GAMMA_MSG, NULL); } @@ -506,10 +508,10 @@ { ptr->mon_gamma_red = ptr->mon_gamma_green = ptr->mon_gamma_blue = val.realnum; - if( xf86getToken (NULL) == NUMBER ) + if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER ) { ptr->mon_gamma_green = val.realnum; - if( xf86getToken (NULL) == NUMBER ) + if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER ) { ptr->mon_gamma_blue = val.realnum; } @@ -523,31 +525,13 @@ } break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->mon_option_lst = - xf86addNewOption (ptr->mon_option_lst, - name, val.str); - } - else - { - ptr->mon_option_lst = - xf86addNewOption (ptr->mon_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst); break; case USEMODES: { XF86ConfModesLinkPtr mptr; - if ((token = xf86getToken (NULL)) != STRING) + if ((token = xf86getSubToken (&(ptr->mon_comment))) != STRING) Error (QUOTE_MSG, "UseModes"); /* add to the end of the list of modes sections @@ -588,14 +572,18 @@ xf86parseModesSection (void) { int has_ident = FALSE; + int token; parsePrologue (XF86ConfModesPtr, XF86ConfModesRec) while ((token = xf86getToken (ModesTab)) != ENDSECTION) { switch (token) { + case COMMENT: + ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str); + break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->modes_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error (MULTIPLE_MSG, "Identifier"); @@ -635,14 +623,13 @@ int i; XF86ConfModeLinePtr mlptr; XF86ConfModesLinkPtr mptr; - XF86OptionPtr optr; while (ptr) { mptr = ptr->mon_modes_sect_lst; fprintf (cf, "Section \"Monitor\"\n"); if (ptr->mon_comment) - fprintf (cf, "\t### \"%s\"\n", ptr->mon_comment); + fprintf (cf, "%s", ptr->mon_comment); if (ptr->mon_identifier) fprintf (cf, "\tIdentifier \"%s\"\n", ptr->mon_identifier); if (ptr->mon_vendor) @@ -714,14 +701,8 @@ if (mlptr->ml_flags & XF86CONF_BCAST) fprintf (cf, " bcast"); fprintf (cf, "\n"); - } - for (optr = ptr->mon_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); } + xf86printOptionList(cf, ptr->mon_option_lst, 1); fprintf (cf, "EndSection\n\n"); ptr = ptr->list.next; } @@ -735,6 +716,8 @@ while (ptr) { fprintf (cf, "Section \"Modes\"\n"); + if (ptr->modes_comment) + fprintf (cf, "%s", ptr->modes_comment); if (ptr->modes_identifier) fprintf (cf, "\tIdentifier \"%s\"\n", ptr->modes_identifier); for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next) @@ -770,7 +753,10 @@ fprintf (cf, " vscan %d", mlptr->ml_vscan); if (mlptr->ml_flags & XF86CONF_BCAST) fprintf (cf, " bcast"); - fprintf (cf, "\n"); + if (mlptr->ml_comment) + fprintf (cf, "%s", mlptr->ml_comment); + else + fprintf (cf, "\n"); } fprintf (cf, "EndSection\n\n"); ptr = ptr->list.next; @@ -787,6 +773,7 @@ TestFree (ptr->mon_identifier); TestFree (ptr->mon_vendor); TestFree (ptr->mon_modelname); + TestFree (ptr->mon_comment); xf86optionListFree (ptr->mon_option_lst); xf86freeModeLineList (ptr->mon_modeline_lst); prev = ptr; @@ -803,6 +790,7 @@ while (ptr) { TestFree (ptr->modes_identifier); + TestFree (ptr->modes_comment); xf86freeModeLineList (ptr->mon_modeline_lst); prev = ptr; ptr = ptr->list.next; @@ -817,6 +805,7 @@ while (ptr) { TestFree (ptr->ml_identifier); + TestFree (ptr->ml_comment); prev = ptr; ptr = ptr->list.next; xf86conffree (prev); Index: xc/programs/Xserver/hw/xfree86/parser/Pointer.c diff -u xc/programs/Xserver/hw/xfree86/parser/Pointer.c:1.8 xc/programs/Xserver/hw/xfree86/parser/Pointer.c:1.10 --- xc/programs/Xserver/hw/xfree86/parser/Pointer.c:1.8 Fri Oct 20 10:59:03 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Pointer.c Mon Aug 6 16:51:14 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Pointer.c,v 1.8 2000/10/20 14:59:03 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Pointer.c,v 1.10 2001/08/06 20:51:14 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -71,21 +71,25 @@ { char *s, *s1, *s2; int l; + int token; parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) while ((token = xf86getToken (PointerTab)) != ENDSECTION) { switch (token) { + case COMMENT: + ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); + break; case PROTOCOL: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "Protocol"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Protocol"), val.str); break; case PDEVICE: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "Device"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Device"), @@ -97,7 +101,7 @@ NULL); break; case EM3TIMEOUT: - if (xf86getToken (NULL) != NUMBER || val.num < 0) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "Emulate3Timeout"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, @@ -110,28 +114,28 @@ NULL); break; case PBUTTONS: - if (xf86getToken (NULL) != NUMBER || val.num < 0) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "Buttons"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Buttons"), s); break; case BAUDRATE: - if (xf86getToken (NULL) != NUMBER || val.num < 0) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "BaudRate"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("BaudRate"), s); break; case SAMPLERATE: - if (xf86getToken (NULL) != NUMBER || val.num < 0) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "SampleRate"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("SampleRate"), s); break; case PRESOLUTION: - if (xf86getToken (NULL) != NUMBER || val.num < 0) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "Resolution"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, @@ -151,7 +155,7 @@ if (val.num < 0) Error (ZAXISMAPPING_MSG, NULL); s1 = xf86uLongToString(val.num); - if (xf86getToken (NULL) != NUMBER || val.num < 0) + if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (ZAXISMAPPING_MSG, NULL); s2 = xf86uLongToString(val.num); l = strlen(s1) + 1 + strlen(s2) + 1; Index: xc/programs/Xserver/hw/xfree86/parser/Screen.c diff -u xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.17 xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.21 --- xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.17 Thu Feb 15 14:54:40 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Screen.c Mon Aug 6 16:51:14 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.17 2001/02/15 19:54:40 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.21 2001/08/06 20:51:14 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -37,7 +37,6 @@ static xf86ConfigSymTabRec DisplayTab[] = { - {COMMENT, "###"}, {ENDSUBSECTION, "endsubsection"}, {MODES, "modes"}, {VIEWPORT, "viewport"}, @@ -57,6 +56,7 @@ XF86ConfDisplayPtr xf86parseDisplaySubSection (void) { + int token; parsePrologue (XF86ConfDisplayPtr, XF86ConfDisplayRec) ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1; @@ -66,71 +66,69 @@ switch (token) { case COMMENT: - if (xf86getToken (NULL) != STRING) - Error (QUOTE_MSG, "###"); - ptr->disp_comment = val.str; + ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str); break; case VIEWPORT: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (VIEWPORT_MSG, NULL); ptr->disp_frameX0 = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (VIEWPORT_MSG, NULL); ptr->disp_frameY0 = val.num; break; case VIRTUAL: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (VIRTUAL_MSG, NULL); ptr->disp_virtualX = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (VIRTUAL_MSG, NULL); ptr->disp_virtualY = val.num; break; case DEPTH: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (NUMBER_MSG, "Display"); ptr->disp_depth = val.num; break; case BPP: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (NUMBER_MSG, "Display"); ptr->disp_bpp = val.num; break; case VISUAL: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->disp_comment)) != STRING) Error (QUOTE_MSG, "Display"); ptr->disp_visual = val.str; break; case WEIGHT: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (WEIGHT_MSG, NULL); ptr->disp_weight.red = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (WEIGHT_MSG, NULL); ptr->disp_weight.green = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (WEIGHT_MSG, NULL); ptr->disp_weight.blue = val.num; break; case BLACK_TOK: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (BLACK_MSG, NULL); ptr->disp_black.red = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (BLACK_MSG, NULL); ptr->disp_black.green = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (BLACK_MSG, NULL); ptr->disp_black.blue = val.num; break; case WHITE_TOK: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (WHITE_MSG, NULL); ptr->disp_white.red = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (WHITE_MSG, NULL); ptr->disp_white.green = val.num; - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER) Error (WHITE_MSG, NULL); ptr->disp_white.blue = val.num; break; @@ -138,7 +136,7 @@ { XF86ModePtr mptr; - while ((token = xf86getToken (DisplayTab)) == STRING) + while ((token = xf86getSubTokenWithTab (&(ptr->disp_comment), DisplayTab)) == STRING) { mptr = xf86confcalloc (1, sizeof (XF86ModeRec)); mptr->mode_name = val.str; @@ -150,25 +148,7 @@ } break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->disp_option_lst = - xf86addNewOption (ptr->disp_option_lst, - name, val.str); - } - else - { - ptr->disp_option_lst = - xf86addNewOption (ptr->disp_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst); break; case EOF_TOKEN: @@ -191,7 +171,6 @@ static xf86ConfigSymTabRec ScreenTab[] = { - {COMMENT, "###"}, {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {OBSDRIVER, "driver"}, @@ -214,6 +193,7 @@ { int has_ident = FALSE; int has_driver= FALSE; + int token; parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec) @@ -222,12 +202,10 @@ switch (token) { case COMMENT: - if (xf86getToken (NULL) != STRING) - Error (QUOTE_MSG, "###"); - ptr->scrn_comment = val.str; + ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str); break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); ptr->scrn_identifier = val.str; if (has_ident || has_driver) @@ -235,7 +213,7 @@ has_ident = TRUE; break; case OBSDRIVER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "Driver"); ptr->scrn_obso_driver = val.str; if (has_ident || has_driver) @@ -243,27 +221,27 @@ has_driver = TRUE; break; case DEFAULTDEPTH: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER) Error (NUMBER_MSG, "DefaultDepth"); ptr->scrn_defaultdepth = val.num; break; case DEFAULTBPP: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER) Error (NUMBER_MSG, "DefaultBPP"); ptr->scrn_defaultbpp = val.num; break; case DEFAULTFBBPP: - if (xf86getToken (NULL) != NUMBER) + if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER) Error (NUMBER_MSG, "DefaultFbBPP"); ptr->scrn_defaultfbbpp = val.num; break; case MDEVICE: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "Device"); ptr->scrn_device_str = val.str; break; case MONITOR: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "Monitor"); ptr->scrn_monitor_str = val.str; break; @@ -271,7 +249,7 @@ { XF86ConfAdaptorLinkPtr aptr; - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "VideoAdaptor"); /* Don't allow duplicates */ @@ -291,28 +269,10 @@ } break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->scrn_option_lst = - xf86addNewOption (ptr->scrn_option_lst, - name, val.str); - } - else - { - ptr->scrn_option_lst = - xf86addNewOption (ptr->scrn_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst); break; case SUBSECTION: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->scrn_comment)) != STRING) Error (QUOTE_MSG, "SubSection"); { xf86conffree(val.str); @@ -345,13 +305,12 @@ XF86ConfAdaptorLinkPtr aptr; XF86ConfDisplayPtr dptr; XF86ModePtr mptr; - XF86OptionPtr optr; while (ptr) { fprintf (cf, "Section \"Screen\"\n"); if (ptr->scrn_comment) - fprintf (cf, "\t### \"%s\"\n", ptr->scrn_comment); + fprintf (cf, "%s", ptr->scrn_comment); if (ptr->scrn_identifier) fprintf (cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier); if (ptr->scrn_obso_driver) @@ -369,13 +328,7 @@ if (ptr->scrn_defaultfbbpp) fprintf (cf, "\tDefaultFbBPP %d\n", ptr->scrn_defaultfbbpp); - for (optr = ptr->scrn_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); - } + xf86printOptionList(cf, ptr->scrn_option_lst, 1); for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next) { fprintf (cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str); @@ -384,8 +337,7 @@ { fprintf (cf, "\tSubSection \"Display\"\n"); if (dptr->disp_comment) - fprintf (cf, "\t\t### %s\n", - dptr->disp_comment); + fprintf (cf, "%s", dptr->disp_comment); if (dptr->disp_frameX0 != 0 || dptr->disp_frameY0 != 0) { fprintf (cf, "\t\tViewport %d %d\n", @@ -434,14 +386,8 @@ if (dptr->disp_mode_lst) { fprintf (cf, "\n"); - } - for (optr = dptr->disp_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); } + xf86printOptionList(cf, dptr->disp_option_lst, 2); fprintf (cf, "\tEndSubSection\n"); } fprintf (cf, "EndSection\n\n"); @@ -460,6 +406,7 @@ TestFree (ptr->scrn_identifier); TestFree (ptr->scrn_monitor_str); TestFree (ptr->scrn_device_str); + TestFree (ptr->scrn_comment); xf86optionListFree (ptr->scrn_option_lst); xf86freeAdaptorLinkList (ptr->scrn_adaptor_lst); xf86freeDisplayList (ptr->scrn_display_lst); Index: xc/programs/Xserver/hw/xfree86/parser/Vendor.c diff -u xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.9 xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.13 --- xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.9 Wed Feb 21 18:37:04 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Vendor.c Mon Aug 6 16:51:15 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.9 2001/02/21 23:37:04 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.13 2001/08/06 20:51:15 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -49,14 +49,18 @@ xf86parseVendorSubSection (void) { int has_ident = FALSE; + int token; parsePrologue (XF86ConfVendSubPtr, XF86ConfVendSubRec) while ((token = xf86getToken (VendorSubTab)) != ENDSUBSECTION) { switch (token) { + case COMMENT: + ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str); + break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->vs_comment))) Error (QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error (MULTIPLE_MSG, "Identifier"); @@ -64,25 +68,7 @@ has_ident = TRUE; break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->vs_option_lst = - xf86addNewOption (ptr->vs_option_lst, - name, val.str); - } - else - { - ptr->vs_option_lst = - xf86addNewOption (ptr->vs_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->vs_option_lst = xf86parseOption(ptr->vs_option_lst); break; case EOF_TOKEN: @@ -105,7 +91,6 @@ static xf86ConfigSymTabRec VendorTab[] = { - {COMMENT, "###"}, {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, @@ -119,6 +104,7 @@ xf86parseVendorSection (void) { int has_ident = FALSE; + int token; parsePrologue (XF86ConfVendorPtr, XF86ConfVendorRec) while ((token = xf86getToken (VendorTab)) != ENDSECTION) @@ -126,12 +112,10 @@ switch (token) { case COMMENT: - if (xf86getToken (NULL) != STRING) - Error (QUOTE_MSG, "###"); - ptr->vnd_comment = val.str; + ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str); break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->vnd_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error (MULTIPLE_MSG, "Identifier"); @@ -139,26 +123,10 @@ has_ident = TRUE; break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->vnd_option_lst = xf86addNewOption (ptr->vnd_option_lst, - name, val.str); - } - else - { - ptr->vnd_option_lst = xf86addNewOption (ptr->vnd_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->vnd_option_lst = xf86parseOption(ptr->vnd_option_lst); break; case SUBSECTION: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->vnd_comment)) != STRING) Error (QUOTE_MSG, "SubSection"); { HANDLE_LIST (vnd_sub_lst, xf86parseVendorSubSection, @@ -191,35 +159,24 @@ xf86printVendorSection (FILE * cf, XF86ConfVendorPtr ptr) { XF86ConfVendSubPtr pptr; - XF86OptionPtr optr; while (ptr) { fprintf (cf, "Section \"Vendor\"\n"); if (ptr->vnd_comment) - fprintf (cf, "\t### \"%s\"\n", ptr->vnd_comment); + fprintf (cf, "%s", ptr->vnd_comment); if (ptr->vnd_identifier) fprintf (cf, "\tIdentifier \"%s\"\n", ptr->vnd_identifier); - for (optr = ptr->vnd_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); - } + xf86printOptionList(cf, ptr->vnd_option_lst, 1); for (pptr = ptr->vnd_sub_lst; pptr; pptr = pptr->list.next) { fprintf (cf, "\tSubSection \"Vendor\"\n"); + if (pptr->vs_comment) + fprintf (cf, "%s", pptr->vs_comment); if (pptr->vs_identifier) - fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier); - for (optr = pptr->vs_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\t\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); - } + fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier); + xf86printOptionList(cf, pptr->vs_option_lst, 2); fprintf (cf, "\tEndSubSection\n"); } fprintf (cf, "EndSection\n\n"); @@ -234,6 +191,7 @@ return; xf86freeVendorSubList (p->vnd_sub_lst); TestFree (p->vnd_identifier); + TestFree (p->vnd_comment); xf86optionListFree (p->vnd_option_lst); xf86conffree (p); } @@ -247,6 +205,7 @@ { TestFree (ptr->vs_identifier); TestFree (ptr->vs_name); + TestFree (ptr->vs_comment); xf86optionListFree (ptr->vs_option_lst); prev = ptr; ptr = ptr->list.next; Index: xc/programs/Xserver/hw/xfree86/parser/Video.c diff -u xc/programs/Xserver/hw/xfree86/parser/Video.c:1.7 xc/programs/Xserver/hw/xfree86/parser/Video.c:1.10 --- xc/programs/Xserver/hw/xfree86/parser/Video.c:1.7 Wed Feb 21 18:37:04 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Video.c Mon Aug 6 16:51:15 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.7 2001/02/21 23:37:04 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.10 2001/08/06 20:51:15 dawes Exp $ */ /* View/edit this file with tab stops set to 4 */ @@ -49,14 +49,18 @@ xf86parseVideoPortSubSection (void) { int has_ident = FALSE; + int token; parsePrologue (XF86ConfVideoPortPtr, XF86ConfVideoPortRec) while ((token = xf86getToken (VideoPortTab)) != ENDSUBSECTION) { switch (token) { + case COMMENT: + ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str); + break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->vp_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error (MULTIPLE_MSG, "Identifier"); @@ -64,25 +68,7 @@ has_ident = TRUE; break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->vp_option_lst = - xf86addNewOption (ptr->vp_option_lst, - name, val.str); - } - else - { - ptr->vp_option_lst = - xf86addNewOption (ptr->vp_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->vp_option_lst = xf86parseOption(ptr->vp_option_lst); break; case EOF_TOKEN: @@ -122,6 +108,7 @@ xf86parseVideoAdaptorSection (void) { int has_ident = FALSE; + int token; parsePrologue (XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec) @@ -129,8 +116,11 @@ { switch (token) { + case COMMENT: + ptr->va_comment = xf86addComment(ptr->va_comment, val.str); + break; case IDENTIFIER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->va_comment)) != STRING) Error (QUOTE_MSG, "Identifier"); ptr->va_identifier = val.str; if (has_ident == TRUE) @@ -138,46 +128,30 @@ has_ident = TRUE; break; case VENDOR: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->va_comment)) != STRING) Error (QUOTE_MSG, "Vendor"); ptr->va_vendor = val.str; break; case BOARD: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->va_comment)) != STRING) Error (QUOTE_MSG, "Board"); ptr->va_board = val.str; break; case BUSID: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->va_comment)) != STRING) Error (QUOTE_MSG, "BusID"); ptr->va_busid = val.str; break; case DRIVER: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->va_comment)) != STRING) Error (QUOTE_MSG, "Driver"); ptr->va_driver = val.str; break; case OPTION: - { - char *name; - if ((token = xf86getToken (NULL)) != STRING) - Error (BAD_OPTION_MSG, NULL); - name = val.str; - if ((token = xf86getToken (NULL)) == STRING) - { - ptr->va_option_lst = xf86addNewOption (ptr->va_option_lst, - name, val.str); - } - else - { - ptr->va_option_lst = xf86addNewOption (ptr->va_option_lst, - name, NULL); - xf86unGetToken (token); - } - } + ptr->va_option_lst = xf86parseOption(ptr->va_option_lst); break; case SUBSECTION: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->va_comment)) != STRING) Error (QUOTE_MSG, "SubSection"); { HANDLE_LIST (va_port_lst, xf86parseVideoPortSubSection, @@ -208,11 +182,12 @@ xf86printVideoAdaptorSection (FILE * cf, XF86ConfVideoAdaptorPtr ptr) { XF86ConfVideoPortPtr pptr; - XF86OptionPtr optr; while (ptr) { fprintf (cf, "Section \"VideoAdaptor\"\n"); + if (ptr->va_comment) + fprintf (cf, "%s", ptr->va_comment); if (ptr->va_identifier) fprintf (cf, "\tIdentifier \"%s\"\n", ptr->va_identifier); if (ptr->va_vendor) @@ -223,25 +198,15 @@ fprintf (cf, "\tBusID \"%s\"\n", ptr->va_busid); if (ptr->va_driver) fprintf (cf, "\tDriver \"%s\"\n", ptr->va_driver); - for (optr = ptr->va_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); - } + xf86printOptionList(cf, ptr->va_option_lst, 1); for (pptr = ptr->va_port_lst; pptr; pptr = pptr->list.next) { fprintf (cf, "\tSubSection \"VideoPort\"\n"); + if (pptr->vp_comment) + fprintf (cf, "%s", pptr->vp_comment); if (pptr->vp_identifier) fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vp_identifier); - for (optr = pptr->vp_option_lst; optr; optr = optr->list.next) - { - fprintf (cf, "\t\tOption \"%s\"", optr->opt_name); - if (optr->opt_val) - fprintf (cf, " \"%s\"", optr->opt_val); - fprintf (cf, "\n"); - } + xf86printOptionList(cf, pptr->vp_option_lst, 2); fprintf (cf, "\tEndSubSection\n"); } fprintf (cf, "EndSection\n\n"); @@ -263,6 +228,7 @@ TestFree (ptr->va_busid); TestFree (ptr->va_driver); TestFree (ptr->va_fwdref); + TestFree (ptr->va_comment); xf86freeVideoPortList (ptr->va_port_lst); xf86optionListFree (ptr->va_option_lst); prev = ptr; @@ -279,6 +245,7 @@ while (ptr) { TestFree (ptr->vp_identifier); + TestFree (ptr->vp_comment); xf86optionListFree (ptr->vp_option_lst); prev = ptr; ptr = ptr->list.next; Index: xc/programs/Xserver/hw/xfree86/parser/configProcs.h diff -u xc/programs/Xserver/hw/xfree86/parser/configProcs.h:1.14 xc/programs/Xserver/hw/xfree86/parser/configProcs.h:1.16 --- xc/programs/Xserver/hw/xfree86/parser/configProcs.h:1.14 Thu Nov 2 14:58:20 2000 +++ xc/programs/Xserver/hw/xfree86/parser/configProcs.h Mon Aug 6 16:51:15 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/configProcs.h,v 1.14 2000/11/02 19:58:20 anderson Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/configProcs.h,v 1.16 2001/08/06 20:51:15 dawes Exp $ */ /* Private procs. Public procs are in xf86Parser.h and xf86Optrec.h */ @@ -74,6 +74,8 @@ /* scan.c */ unsigned int xf86strToUL(char *str); int xf86getToken(xf86ConfigSymTabRec *tab); +int xf86getSubToken(char **comment); +int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab); void xf86unGetToken(int token); char *xf86tokenString(void); void xf86parseError(char *format, ...); @@ -89,6 +91,8 @@ void xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr); void xf86freeDRI (XF86ConfDRIPtr ptr); +#ifndef IN_XSERVER /* Externally provided functions */ void ErrorF(const char *f, ...); void VErrorF(const char *f, va_list args); +#endif Index: xc/programs/Xserver/hw/xfree86/parser/read.c diff -u xc/programs/Xserver/hw/xfree86/parser/read.c:1.18 xc/programs/Xserver/hw/xfree86/parser/read.c:1.20 --- xc/programs/Xserver/hw/xfree86/parser/read.c:1.18 Thu Feb 15 14:54:40 2001 +++ xc/programs/Xserver/hw/xfree86/parser/read.c Mon Jul 2 11:38:34 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.18 2001/02/15 19:54:40 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.20 2001/07/02 15:38:34 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -59,8 +59,11 @@ { switch (token) { + case COMMENT: + ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str); + break; case SECTION: - if (xf86getToken (NULL) != STRING) + if (xf86getSubToken (&(ptr->conf_comment)) != STRING) { xf86parseError (QUOTE_MSG, "Section"); CLEANUP (ptr); @@ -274,6 +277,7 @@ xf86freeInputList (p->conf_input_lst); xf86freeVendorList (p->conf_vendor_lst); xf86freeDRI (p->conf_dri); + TestFree(p->conf_comment); xf86conffree (p); } Index: xc/programs/Xserver/hw/xfree86/parser/scan.c diff -u xc/programs/Xserver/hw/xfree86/parser/scan.c:1.16 xc/programs/Xserver/hw/xfree86/parser/scan.c:1.19 --- xc/programs/Xserver/hw/xfree86/parser/scan.c:1.16 Thu Feb 15 14:54:41 2001 +++ xc/programs/Xserver/hw/xfree86/parser/scan.c Mon Jul 23 09:15:49 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/scan.c,v 1.16 2001/02/15 19:54:41 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/scan.c,v 1.19 2001/07/23 13:15:49 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -149,32 +149,60 @@ /* * Get start of next Token. EOF is handled, - * whitespaces & comments are* skipped. + * whitespaces are skipped. */ - do + +again: + if (!c) { - if (!c) + if (fgets (configBuf, CONFIG_BUF_LEN - 1, configFile) == NULL) { - if (fgets (configBuf, CONFIG_BUF_LEN - 1, configFile) == NULL) - { - return (pushToken = EOF_TOKEN); - } - configLineNo++; - configStart = configPos = 0; + return (pushToken = EOF_TOKEN); + } + configLineNo++; + configStart = configPos = 0; + } + + i = 0; + for (;;) { + c = configBuf[configPos++]; + configRBuf[i++] = c; + switch (c) { + case ' ': + case '\t': + case '\r': + continue; + case '\n': + i = 0; + continue; } + break; + } + if (c == '\0') + goto again; + + if (c == '#') + { + do + { + configRBuf[i++] = (c = configBuf[configPos++]); #ifndef __EMX__ - while (((c = configBuf[configPos++]) == ' ') || (c == '\t') || (c == '\n')); + } + while ((c != '\n') && (c != '\0')); #else - while (((c = configBuf[configPos++]) == ' ') || (c == '\t') || (c == '\n') - || (c == '\r')); + } + while ((c != '\n') && (c != '\r') && (c != '\0')); #endif - if (c == '#') - c = '\0'; + configRBuf[i] = '\0'; + /* XXX no private copy. + * Use xf86addComment when setting a comment. + */ + val.str = configRBuf; + return (COMMENT); } - while (!c); /* GJA -- handle '-' and ',' * Be careful: "-hsync" is a keyword. */ - if ((c == ',') && !isalpha (configBuf[configPos])) + else if ((c == ',') && !isalpha (configBuf[configPos])) { configStart = configPos; return COMMA; @@ -293,6 +321,40 @@ return (ERROR_TOKEN); /* Error catcher */ } +int +xf86getSubToken (char **comment) +{ + int token; + + for (;;) { + token = xf86getToken(NULL); + if (token == COMMENT) { + if (comment) + *comment = xf86addComment(*comment, val.str); + } + else + return (token); + } + /*NOTREACHED*/ +} + +int +xf86getSubTokenWithTab (char **comment, xf86ConfigSymTabRec *tab) +{ + int token; + + for (;;) { + token = xf86getToken(tab); + if (token == COMMENT) { + if (comment) + *comment = xf86addComment(*comment, val.str); + } + else + return (token); + } + /*NOTREACHED*/ +} + void xf86unGetToken (int token) { @@ -757,16 +819,8 @@ if (getuid () == 0 && xconfig) strcat (configPaths[pcount], xconfig); strcat (configPaths[pcount], "."); -#ifdef AMOEBA - { - extern char *XServerHostName; - - strcat (configPaths[pcount], XServerHostName); - } -#else gethostname (configPaths[pcount] + strlen (configPaths[pcount]), MAXHOSTNAMELEN); -#endif if ((configFile = fopen (configPaths[pcount], "r")) != 0) break; #endif /* !__EMX__ */ @@ -977,4 +1031,50 @@ c2 = (isupper (*s2) ? tolower (*s2) : *s2); } return (c1 - c2); +} + +char * +xf86addComment(char *cur, char *add) +{ + char *str; + int len, curlen, iscomment, hasnewline = 0, endnewline; + + if (add == NULL || add[0] == '\0') + return (cur); + + if (cur) { + curlen = strlen(cur); + if (curlen) + hasnewline = cur[curlen - 1] == '\n'; + } + else + curlen = 0; + + str = add; + iscomment = 0; + while (*str) { + if (*str != ' ' && *str != '\t') + break; + ++str; + } + iscomment = (*str == '#'); + + len = strlen(add); + endnewline = add[len - 1] == '\n'; + len += 1 + iscomment + (!hasnewline) + (!endnewline); + + if ((str = xf86confrealloc(cur, len + curlen)) == NULL) + return (cur); + + cur = str; + + if (curlen && !hasnewline) + cur[curlen++] = '\n'; + if (!iscomment) + cur[curlen++] = '#'; + strcpy(cur + curlen, add); + if (!endnewline) + strcat(cur, "\n"); + + return (cur); } Index: xc/programs/Xserver/hw/xfree86/parser/write.c diff -u xc/programs/Xserver/hw/xfree86/parser/write.c:1.13 xc/programs/Xserver/hw/xfree86/parser/write.c:1.15 --- xc/programs/Xserver/hw/xfree86/parser/write.c:1.13 Thu Mar 8 16:32:35 2001 +++ xc/programs/Xserver/hw/xfree86/parser/write.c Wed Jul 25 11:05:08 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.13 2001/03/08 21:32:35 anderson Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.15 2001/07/25 15:05:08 dawes Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -39,7 +39,7 @@ #include <signal.h> #include <errno.h> -#if (defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__) +#if ((defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__) #ifndef strerror extern char *sys_errlist[]; extern int sys_nerr; @@ -71,6 +71,9 @@ { return 0; } + + if (cptr->conf_comment) + fprintf (cf, "%s\n", cptr->conf_comment); xf86printLayoutSection (cf, cptr->conf_layout_lst); Index: xc/programs/Xserver/hw/xfree86/parser/xf86Optrec.h diff -u xc/programs/Xserver/hw/xfree86/parser/xf86Optrec.h:1.9 xc/programs/Xserver/hw/xfree86/parser/xf86Optrec.h:1.10 --- xc/programs/Xserver/hw/xfree86/parser/xf86Optrec.h:1.9 Thu Nov 2 14:58:21 2000 +++ xc/programs/Xserver/hw/xfree86/parser/xf86Optrec.h Sat Jun 30 00:00:24 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86Optrec.h,v 1.9 2000/11/02 19:58:21 anderson Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86Optrec.h,v 1.10 2001/06/30 04:00:24 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -33,6 +33,7 @@ */ #ifndef _xf86Optrec_h_ #define _xf86Optrec_h_ +#include <stdio.h> /* * all records that need to be linked lists should contain a GenericList as @@ -74,8 +75,8 @@ int xf86nameCompare (const char *s1, const char *s2); char *xf86uLongToString(unsigned long i); void xf86debugListOptions(XF86OptionPtr); - - +XF86OptionPtr xf86parseOption(XF86OptionPtr head); +void xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs); #endif /* _xf86Optrec_h_ */ Index: xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h diff -u xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h:1.27 xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h:1.29 --- xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h:1.27 Wed Dec 6 10:35:33 2000 +++ xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h Mon Jul 2 11:38:34 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h,v 1.27 2000/12/06 15:35:33 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h,v 1.29 2001/07/02 15:38:34 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -58,12 +58,14 @@ int load_type; char *load_name; XF86OptionPtr load_opt; + char *load_comment; } XF86LoadRec, *XF86LoadPtr; typedef struct { XF86LoadPtr mod_load_lst; + char *mod_comment; } XF86ConfModuleRec, *XF86ConfModulePtr; @@ -101,6 +103,7 @@ int ml_vscan; int ml_flags; int ml_hskew; + char *ml_comment; } XF86ConfModeLineRec, *XF86ConfModeLinePtr; @@ -109,6 +112,7 @@ GenericListRec list; char *vp_identifier; XF86OptionPtr vp_option_lst; + char *vp_comment; } XF86ConfVideoPortRec, *XF86ConfVideoPortPtr; @@ -123,6 +127,7 @@ XF86OptionPtr va_option_lst; XF86ConfVideoPortPtr va_port_lst; char *va_fwdref; + char *va_comment; } XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr; @@ -146,6 +151,7 @@ GenericListRec list; char *modes_identifier; XF86ConfModeLinePtr mon_modeline_lst; + char *modes_comment; } XF86ConfModesRec, *XF86ConfModesPtr; @@ -240,6 +246,7 @@ typedef struct { XF86OptionPtr flg_option_lst; + char *flg_comment; } XF86ConfFlagsRec, *XF86ConfFlagsPtr; @@ -345,6 +352,7 @@ char *vs_name; char *vs_identifier; XF86OptionPtr vs_option_lst; + char *vs_comment; } XF86ConfVendSubRec, *XF86ConfVendSubPtr; @@ -364,6 +372,7 @@ int buf_count; int buf_size; char *buf_flags; + char *buf_comment; } XF86ConfBuffersRec, *XF86ConfBuffersPtr; @@ -373,6 +382,7 @@ int dri_group; int dri_mode; XF86ConfBuffersPtr dri_buffers_lst; + char *dri_comment; } XF86ConfDRIRec, *XF86ConfDRIPtr; @@ -390,6 +400,7 @@ XF86ConfLayoutPtr conf_layout_lst; XF86ConfVendorPtr conf_vendor_lst; XF86ConfDRIPtr conf_dri; + char *conf_comment; } XF86ConfigRec, *XF86ConfigPtr; @@ -427,5 +438,6 @@ int xf86pathIsAbsolute(const char *path); int xf86pathIsSafe(const char *path); +char *xf86addComment(char *cur, char *add); #endif /* _xf86Parser_h_ */ Index: xc/programs/Xserver/hw/xfree86/ramdac/IBM.h diff -u xc/programs/Xserver/hw/xfree86/ramdac/IBM.h:1.7 xc/programs/Xserver/hw/xfree86/ramdac/IBM.h:1.8 --- xc/programs/Xserver/hw/xfree86/ramdac/IBM.h:1.7 Fri Feb 12 17:52:11 1999 +++ xc/programs/Xserver/hw/xfree86/ramdac/IBM.h Sat Oct 27 23:34:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/IBM.h,v 1.7 1999/02/12 22:52:11 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/IBM.h,v 1.8 2001/10/28 03:34:03 tsi Exp $ */ #include <xf86RamDac.h> @@ -18,16 +18,16 @@ void IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr); void IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr); -#define IBM524_RAMDAC (VENDOR_IBM << 16) | 0x00 -#define IBM524A_RAMDAC (VENDOR_IBM << 16) | 0x01 -#define IBM525_RAMDAC (VENDOR_IBM << 16) | 0x02 -#define IBM526_RAMDAC (VENDOR_IBM << 16) | 0x03 -#define IBM526DB_RAMDAC (VENDOR_IBM << 16) | 0x04 -#define IBM528_RAMDAC (VENDOR_IBM << 16) | 0x05 -#define IBM528A_RAMDAC (VENDOR_IBM << 16) | 0x06 -#define IBM624_RAMDAC (VENDOR_IBM << 16) | 0x07 -#define IBM624DB_RAMDAC (VENDOR_IBM << 16) | 0x08 -#define IBM640_RAMDAC (VENDOR_IBM << 16) | 0x09 +#define IBM524_RAMDAC ((VENDOR_IBM << 16) | 0x00) +#define IBM524A_RAMDAC ((VENDOR_IBM << 16) | 0x01) +#define IBM525_RAMDAC ((VENDOR_IBM << 16) | 0x02) +#define IBM526_RAMDAC ((VENDOR_IBM << 16) | 0x03) +#define IBM526DB_RAMDAC ((VENDOR_IBM << 16) | 0x04) +#define IBM528_RAMDAC ((VENDOR_IBM << 16) | 0x05) +#define IBM528A_RAMDAC ((VENDOR_IBM << 16) | 0x06) +#define IBM624_RAMDAC ((VENDOR_IBM << 16) | 0x07) +#define IBM624DB_RAMDAC ((VENDOR_IBM << 16) | 0x08) +#define IBM640_RAMDAC ((VENDOR_IBM << 16) | 0x09) /* * IBM Ramdac registers Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.9 xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.12 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.9 Fri May 18 16:22:31 2001 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c Wed Nov 7 23:15:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c,v 1.9 2001/05/18 20:22:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c,v 1.12 2001/11/08 04:15:33 tsi Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -36,7 +36,7 @@ static Bool xf86CursorSwitchMode(int, DisplayModePtr,int); static Bool xf86CursorEnterVT(int, int); static void xf86CursorLeaveVT(int, int); -static int xf86SetDGAMode(int, int, DGADevicePtr); +static int xf86CursorSetDGAMode(int, int, DGADevicePtr); Bool xf86InitCursor( @@ -103,7 +103,7 @@ pScrn->SwitchMode = xf86CursorSwitchMode; pScrn->EnterVT = xf86CursorEnterVT; pScrn->LeaveVT = xf86CursorLeaveVT; - pScrn->SetDGAMode = xf86SetDGAMode; + pScrn->SetDGAMode = xf86CursorSetDGAMode; return TRUE; } @@ -149,8 +149,10 @@ pScreen->devPrivates[xf86CursorScreenIndex].ptr; if (class == CursorShape) { - *width = ScreenPriv->CursorInfoPtr->MaxWidth; - *height = ScreenPriv->CursorInfoPtr->MaxHeight; + if(*width > ScreenPriv->CursorInfoPtr->MaxWidth) + *width = ScreenPriv->CursorInfoPtr->MaxWidth; + if(*height > ScreenPriv->CursorInfoPtr->MaxHeight) + *height = ScreenPriv->CursorInfoPtr->MaxHeight; } else (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); } @@ -243,7 +245,7 @@ } static int -xf86SetDGAMode(int index, int num, DGADevicePtr devRet) +xf86CursorSetDGAMode(int index, int num, DGADevicePtr devRet) { ScreenPtr pScreen = screenInfo.screens[index]; xf86CursorScreenPtr ScreenPriv = @@ -333,7 +335,7 @@ xf86SetCursor(pScreen, pCurs, x, y); ScreenPriv->SWCursor = FALSE; ScreenPriv->isUp = TRUE; - PointPriv->waitForUpdate = !infoPtr->pScrn->silkenMouse; + PointPriv->waitForUpdate = FALSE; return; } Index: xc/programs/Xserver/hw/xfree86/reconfig/os.h diff -u xc/programs/Xserver/hw/xfree86/reconfig/os.h:3.6 xc/programs/Xserver/hw/xfree86/reconfig/os.h:3.7 --- xc/programs/Xserver/hw/xfree86/reconfig/os.h:3.6 Mon Dec 23 01:51:43 1996 +++ xc/programs/Xserver/hw/xfree86/reconfig/os.h Wed Jul 25 11:05:08 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/reconfig/os.h,v 3.6 1996/12/23 06:51:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/reconfig/os.h,v 3.7 2001/07/25 15:05:08 dawes Exp $ */ @@ -6,32 +6,7 @@ /* $XConsortium: os.h /main/5 1996/10/19 18:08:25 kaleb $ */ -/* from <X11/Xosdefs.h> */ -#ifdef NOSTDHDRS -#define X_NOT_STDC_ENV -#endif -#if defined(USL) && defined(SYSV) -#define X_NOT_STDC_ENV -#endif -#if defined(SYSV) && defined(i386) -#ifndef SCO -#define X_NOT_STDC_ENV -#endif -#endif - -/* from <X11/Xlibint.h> */ -#ifndef X_NOT_STDC_ENV #include <stdlib.h> #include <string.h> -#else -char *malloc(), *realloc(), *calloc(); -#ifdef SYSV -#include <string.h> -#else -#include <strings.h> -#endif -#endif - -#if defined(MACH) || defined(__bsdi__) #include <ctype.h> -#endif + Index: xc/programs/Xserver/hw/xfree86/vgafb/Imakefile diff -u xc/programs/Xserver/hw/xfree86/vgafb/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/vgafb/Imakefile:removed --- xc/programs/Xserver/hw/xfree86/vgafb/Imakefile:1.2 Sat Jul 25 12:58:11 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/Imakefile Fri Jan 18 15:26:24 2002 @@ -1,184 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/10 1996/10/25 10:34:08 kaleb $ - - - - - - -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/Imakefile,v 1.2 1998/07/25 16:58:11 dawes Exp $ -#include <Server.tmpl> - -#ifdef i386Architecture -FSRCS = fBitBlt.s fFillCopy.s fFillOr.s fFillAnd.s \ - fFillXor.s fFillSet.s vgabres.s vgalineH.s vgalineV.s -BSRCS = BitBlt.s BitBlt2.s Box.s Line.s VHLine.s vgaBank.s - -FOBJS = fBitBlt.o fFillCopy.o fFillOr.o fFillAnd.o \ - fFillXor.o fFillSet.o vgabres.o vgalineH.o vgalineV.o -BOBJS = BitBlt.o BitBlt2.o Box.o Line.o VHLine.o vgaBank.o -#else -FSRCS = vgaBltFillc.c vgaLinec.c -BSRCS = vgaBankc.c - -FOBJS = vgaBltFillc.o vgaLinec.o -BOBJS = vgaBankc.o -#endif - -SRCS = vgagc.c vgawindow.c vgascrinit.c \ - vgapntwin.c vgapwinS.c vgabitblt.c \ - vgafillsp.c vgasetsp.c vgaimage.c \ - vgagetsp.c vgafillrct.c vgaBitBlt1.c \ - vgasolidC.c vgasolidCS.c vgasolidX.c \ - vgasolidO.c vgasolidA.c vgasolidG.c \ - vgatile32C.c vgatile32G.c \ - vgatileoddC.c vgatileoddG.c \ - vgazerarcC.c vgazerarcX.c vgazerarcG.c \ - vgafillarcC.c vgafillarcG.c \ - vgategblt.c vgabstore.c vga8cppl.c \ - vgabltC.c vgabltCS.c vgabltX.c vgabltO.c vgabltG.c \ - vgateblt8.c vgateblt8S.c vgaglblt8.c vgaglrop8.c \ - vgapush8.c vgarctstp8.c vgarctstp8S.c vgapolypnt.c \ - vgaline.c vgalineS.c vgabresd.c \ - vgalined.c vgasegd.c vgaseg.c vgasegS.c \ - vgaply1rctC.c vgaply1rctG.c \ - SpeedUpBlt.c $(BSRCS) \ - vgaBanks.c $(FSRCS) - -OBJS = vgagc.o vgawindow.o vgascrinit.o \ - vgagetsp.o vgafillrct.o vgaimage.o \ - vgasolidC.o vgasolidCS.o vgasolidX.o \ - vgasolidO.o vgasolidA.o vgasolidG.o \ - vgatile32C.o vgatile32G.o \ - vgatileoddC.o vgatileoddG.o \ - vgafillsp.o vgasetsp.o \ - vgapntwin.o vgapwinS.o vgaBitBlt1.o \ - vgazerarcC.o vgazerarcX.o vgazerarcG.o \ - vgafillarcC.o vgafillarcG.o \ - vgategblt.o vgabstore.o vga8cppl.o \ - vgateblt8.o vgateblt8S.o vgaglblt8.o vgaglrop8.o \ - vgarctstp8.o vgarctstp8S.o vgapolypnt.o \ - vgaline.o vgalineS.o vgabresd.o \ - vgalined.o vgasegd.o vgaseg.o vgasegS.o \ - vgabitblt.o vgabltC.o vgabltCS.o vgabltX.o \ - vgabltO.o vgabltG.o \ - vgapush8.o vgaply1rctC.o vgaply1rctG.o $(STIPPLEOBJ) \ - SpeedUpBlt.o $(BOBJS) \ - vgaBanks.o $(FOBJS) - - INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(XF86HWSRC) \ - -I$(SERVERSRC)/cfb -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ - -I../../xaa - LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/llib-los.ln \ - ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln - -#if DirtyStartup -STARTUPDEFINES = -DDIRTY_STARTUP -#endif - -#if XF86Vga2Banked -BANKEDDEFINES = -DBANKEDMONOVGA -#endif - -#if MakeDllModules - -XCOMM DEFINES is not a good place to put this, but it works - - EXTRA_DEFINES = $(PICFLAGS) - -#endif - - DEFINES = $(SPEEDUPDEFINES) $(STARTUPDEFINES) $(BANKEDDEFINES) -DPSZ=8 - -#ifdef i386Architecture -SUDEFINE = -DSPEEDUP -#endif - -VGADRIVERS = XF86Vga256Drivers - -#if MakeDllModules -DynamicModuleTarget(vgafb.so,$(OBJS)) -#else -NormalDepLibraryTarget(vgafb,$(OBJS),$(OBJS)) -NormalLibraryObjectRule() -#endif -NormalAsmObjectRule() - -NormalLintTarget($(SRCS)) - -ObjectFromSpecialSource(vgaBanks,enhanced/gBanks,NullParameter) -#ifdef i386Architecture -ObjectFromSpecialAsmSource(BitBlt,enhanced/suBitBlt,NullParameter) -ObjectFromSpecialAsmSource(BitBlt2,enhanced/suBBlt2,NullParameter) -ObjectFromSpecialAsmSource(Box,enhanced/suBox,NullParameter) -ObjectFromSpecialAsmSource(Line,enhanced/suLine,NullParameter) -ObjectFromSpecialAsmSource(VHLine,enhanced/suVHLine,NullParameter) -ObjectFromSpecialAsmSource(vgabres,enhanced/fLineBres,NullParameter) -ObjectFromSpecialAsmSource(vgalineH,enhanced/fLineH,NullParameter) -ObjectFromSpecialAsmSource(vgalineV,enhanced/fLineV,NullParameter) -LinkSourceFile(fBitBlt.s,enhanced) -LinkSourceFile(fFill.s,enhanced) -LinkSourceFile(fFillSet.s,enhanced) -#else -LinkSourceFile(vgaBltFillc.c,enhanced) -LinkSourceFile(vgaLinec.c,enhanced) -#endif -LinkFile(vgaBitBlt1.c,enhanced/vgaBitBlt.c) -LinkSourceFile(SpeedUpBlt.c,enhanced) -LinkSourceFile(vgaFasm.h,enhanced) - -ObjectFromSpecialSource(vgaseg,vgaline,-DPOLYSEGMENT) -ObjectFromSpecialSource(vgasegd,vgalined,-DPOLYSEGMENT) -ObjectFromSpecialSource(vgaglrop8,vgaglblt8,-DGLYPHROP) -SpecialObjectRule(vgaglblt8.o,vgaglblt8.c,$(STIPPLEDEF)) - -ObjectFromSpecialSource(vgalineS,vgaline,$(SUDEFINE)) -ObjectFromSpecialSource(vgasegS,vgaline,$(SUDEFINE) -DPOLYSEGMENT) -ObjectFromSpecialSource(vgateblt8S,vgateblt8,$(SUDEFINE)) -ObjectFromSpecialSource(vgarctstp8S,vgarctstp8,$(SUDEFINE)) - -ObjectFromSpecialSource(vgafillarcC,vgafillarc,-DRROP=GXcopy) -ObjectFromSpecialSource(vgafillarcG,vgafillarc,-DRROP=GXset) - -ObjectFromSpecialSource(vgazerarcC,vgazerarc,-DRROP=GXcopy) -ObjectFromSpecialSource(vgazerarcX,vgazerarc,-DRROP=GXxor) -ObjectFromSpecialSource(vgazerarcG,vgazerarc,-DRROP=GXset) - -ObjectFromSpecialSource(vgabltCS,vgablt,-DMROP=Mcopy $(SUDEFINE)) -ObjectFromSpecialSource(vgabltX,vgablt,-DMROP=Mxor) -ObjectFromSpecialSource(vgabltO,vgablt,-DMROP=Mor) -ObjectFromSpecialSource(vgabltG,vgablt,-DMROP=0) - -ObjectFromSpecialSource(vgasolidC,vgasolid,-DRROP=GXcopy) -ObjectFromSpecialSource(vgasolidCS,vgasolid,-DRROP=GXcopy $(SUDEFINE)) -ObjectFromSpecialSource(vgasolidX,vgasolid,-DRROP=GXxor) -ObjectFromSpecialSource(vgasolidO,vgasolid,-DRROP=GXor) -ObjectFromSpecialSource(vgasolidA,vgasolid,-DRROP=GXand) -ObjectFromSpecialSource(vgasolidG,vgasolid,-DRROP=GXset) - -ObjectFromSpecialSource(vgatile32C,vgatile32,-DMROP=Mcopy) -ObjectFromSpecialSource(vgatile32G,vgatile32,-DMROP=0) - -ObjectFromSpecialSource(vgatileoddC,vgatileodd,-DMROP=Mcopy) -ObjectFromSpecialSource(vgatileoddG,vgatileodd,-DMROP=0) - -ObjectFromSpecialSource(vgaply1rctC,vgaply1rct,-DRROP=GXcopy) -ObjectFromSpecialSource(vgaply1rctG,vgaply1rct,-DRROP=GXset) - -#ifdef i386Architecture -ObjectFromSpecialAsmSource(fFillAnd,fFill,-DRROP=GXAnd) -ObjectFromSpecialAsmSource(fFillCopy,fFill,-DRROP=GXCopy) -ObjectFromSpecialAsmSource(fFillOr,fFill,-DRROP=GXOr) -ObjectFromSpecialAsmSource(fFillXor,fFill,-DRROP=GXXor) -#endif - -InstallLinkKitNonExecFile(vga.h,$(LINKKITDIR)/drivers) -InstallLinkKitNonExecFile(vga256.h,$(LINKKITDIR)/drivers) -InstallLinkKitNonExecFile(vgaBank.h,$(LINKKITDIR)/drivers) -InstallLinkKitNonExecFile(vgaFasm.h,$(LINKKITDIR)/drivers) -InstallLinkKitNonExecFile(vgaHW.c,$(LINKKITDIR)/VGADriverDoc) -InstallLinkKitNonExecFile(vgaPCI.h,$(LINKKITDIR)/drivers) - -#ifndef OS2Architecture -DependTarget() -#endif Index: xc/programs/Xserver/hw/xfree86/vgafb/README diff -u xc/programs/Xserver/hw/xfree86/vgafb/README:1.1 xc/programs/Xserver/hw/xfree86/vgafb/README:removed --- xc/programs/Xserver/hw/xfree86/vgafb/README:1.1 Sat Jul 25 12:58:12 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/README Fri Jan 18 15:26:24 2002 @@ -1,2 +0,0 @@ -This directory is included for reference only. It may be removed at some -point. Index: xc/programs/Xserver/hw/xfree86/vgafb/vga8cppl.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vga8cppl.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vga8cppl.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vga8cppl.c:1.2 Sat Jul 25 12:58:12 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vga8cppl.c Fri Jan 18 15:26:24 2002 @@ -1,232 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vga8cppl.c,v 1.2 1998/07/25 16:58:12 dawes Exp $ */ -/* - * -Copyright (c) 1990 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - * - * Author: Keith Packard, MIT X Consortium - */ -/* $XConsortium: vga8cppl.c /main/3 1996/02/21 18:09:56 kaleb $ */ - -#define NO_CFBMSKBITS -#include "vgafb.h" -#undef PSZ -#undef BitLeft -#undef BitRight -#include "maskbits.h" -#include "mergerop.h" - -#if BITMAP_BIT_ORDER == MSBFirst -#define LeftMost (MFB_PPW-1) -#define StepBit(bit, inc) ((bit) -= (inc)) -#else -#define LeftMost 0 -#define StepBit(bit, inc) ((bit) += (inc)) -#endif - -#define GetBits(psrc, nBits, curBit, bitPos, bits) {\ - bits = 0; \ - while (nBits--) \ - { \ - bits |= (PixelType)(((*psrc++ >> bitPos) & 1)) << curBit; \ - StepBit (curBit, 1); \ - CHECKRWO(psrc); \ - } \ -} - -void -vga256CopyImagePlane (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask) - DrawablePtr pSrcDrawable; - DrawablePtr pDstDrawable; - int rop; - unsigned long planemask; - RegionPtr prgnDst; - DDXPointPtr pptSrc; -{ - vga256CopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, - (unsigned long) ~0L, planemask); -} - -void -vga256CopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane) - DrawablePtr pSrcDrawable; - DrawablePtr pDstDrawable; - int rop; - RegionPtr prgnDst; - DDXPointPtr pptSrc; - unsigned long planemask; - unsigned long bitPlane; -{ - int srcx, srcy, dstx, dsty, width, height; - unsigned char *psrcBase; - PixelType *pdstBase; - int widthSrc, widthDst; - unsigned char *psrcLine; - PixelType *pdstLine; - register unsigned char *psrc; - register int i; - register int curBit; - register int bitPos; - register unsigned long bits; - register PixelType *pdst; - PixelType startmask, endmask; - int niStart, niEnd; - int bitStart, bitEnd; - int nl, nlMiddle; - int nbox; - BoxPtr pbox; - MROP_DECLARE() - - /* - * If nothing is going to touch the frame buffer, then just use - * the regular cfb routines. They should be faster. - */ - if ( (pSrcDrawable->type != DRAWABLE_WINDOW) && - (pDstDrawable->type != DRAWABLE_WINDOW)) - { - cfbCopyPlane8to1(pSrcDrawable, pDstDrawable, - rop, prgnDst, pptSrc, planemask, bitPlane); - return; - } - - if (!(planemask & 1)) - return; - - if (rop != GXcopy) - MROP_INITIALIZE (rop, planemask); - - cfbGetByteWidthAndPointer (pSrcDrawable, widthSrc, psrcBase) - - mfbGetPixelWidthAndPointer (pDstDrawable, widthDst, pdstBase) - - BANK_FLAG(psrcBase) - - bitPos = xf86ffs (bitPlane) - 1; - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - srcx = pptSrc->x; - srcy = pptSrc->y; - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - pbox++; - pptSrc++; - psrcLine = psrcBase + srcy * widthSrc + srcx; - pdstLine = mfbScanline(pdstBase, dstx, dsty, widthDst); - dstx &= MFB_PIM; - if (dstx + width <= MFB_PPW) - { - maskpartialbits(dstx, width, startmask); - nlMiddle = 0; - endmask = 0; - } - else - { - maskbits (dstx, width, startmask, endmask, nlMiddle); - } - if (startmask) - { - niStart = min(MFB_PPW - dstx, width); - bitStart = LeftMost; - StepBit (bitStart, dstx); - } - if (endmask) - { - niEnd = (dstx + width) & MFB_PIM; - bitEnd = LeftMost; - } - if (rop == GXcopy) - { - while (height--) - { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - mfbScanlineInc(pdstLine, widthDst); - SETRW(psrc); - if (startmask) - { - i = niStart; - curBit = bitStart; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = *pdst & ~startmask | bits; - pdst++; - } - nl = nlMiddle; - while (nl--) - { - i = MFB_PPW; - curBit = LeftMost; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst++ = bits; - } - if (endmask) - { - i = niEnd; - curBit = bitEnd; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = *pdst & ~endmask | bits; - } - } - } - else - { - while (height--) - { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - mfbScanlineInc(pdstLine, widthDst); - SETRW(psrc); - if (startmask) - { - i = niStart; - curBit = bitStart; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = MROP_MASK(bits, *pdst, startmask); - pdst++; - } - nl = nlMiddle; - while (nl--) - { - i = MFB_PPW; - curBit = LeftMost; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = MROP_SOLID(bits, *pdst); - pdst++; - } - if (endmask) - { - i = niEnd; - curBit = bitEnd; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = MROP_MASK (bits, *pdst, endmask); - } - } - } - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgaAsm.h diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgaAsm.h:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgaAsm.h:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgaAsm.h:1.2 Sat Jul 25 12:58:13 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgaAsm.h Fri Jan 18 15:26:24 2002 @@ -1,16 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgaAsm.h,v 1.2 1998/07/25 16:58:13 dawes Exp $ */ - - - - - -/* $XConsortium: vgaAsm.h /main/6 1996/02/21 18:10:00 kaleb $ */ - -/* Definitions for VGA bank assembler routines */ - -#ifdef CSRG_BASED -#define VGABASE CONST(0xFF000000) -#else -#define VGABASE CONST(0xF0000000) -#endif - Index: xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.h diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.h:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.h:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.h:1.2 Sat Jul 25 12:58:13 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.h Fri Jan 18 15:26:24 2002 @@ -1,250 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.h,v 1.2 1998/07/25 16:58:13 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. - * - * Author: Thomas Roell, roell@informatik.tu-muenchen.de - * - */ -/* $XConsortium: vgaBank.h /main/7 1996/02/21 18:10:03 kaleb $ */ - -#ifndef VGA_BANK_H -#define VGA_BANK_H - -extern void *vgaReadBottom; -extern void *vgaReadTop; -extern void *vgaWriteBottom; -extern void *vgaWriteTop; -extern Bool vgaReadFlag, vgaWriteFlag; -#if defined(__alpha__) || defined(__powerpc__) -extern unsigned long writeseg; -#else /* __alpha__ */ -extern void *writeseg; -#endif /* __alpha__ */ - -/* vgaBank.s or vgaBankc.c */ - -void *vgaSetReadWrite( -#if NeedFunctionPrototypes - void * -#endif -); - -#if !defined(__alpha__) && !defined(__powerpc__) -void *vga16SetReadWrite( -#if NeedFunctionPrototypes - void * -#endif -); -#endif - -void *vgaReadWriteNext( -#if NeedFunctionPrototypes - void * -#endif -); - -void *vgaReadWritePrev( -#if NeedFunctionPrototypes - void * -#endif -); - -void *vgaSetRead( -#if NeedFunctionPrototypes - void * -#endif -); - -#if !defined(__alpha__) && !defined(__powerpc__) -void *vga16SetRead( -#if NeedFunctionPrototypes - void * -#endif -); -#endif - -void *vgaReadNext( -#if NeedFunctionPrototypes - void * -#endif -); - -void *vgaReadPrev( -#if NeedFunctionPrototypes - void * -#endif -); - -void *vgaSetWrite( -#if NeedFunctionPrototypes - void * -#endif -); - -#if !defined(__alpha__) && !defined(__powerpc__) -void *vga16SetWrite( -#if NeedFunctionPrototypes - void * -#endif -); -#endif - -void *vgaWriteNext( -#if NeedFunctionPrototypes - void * -#endif -); - -void *vgaWritePrev( -#if NeedFunctionPrototypes - void * -#endif -); - -void vgaSaveBank( -#if NeedFunctionPrototypes - void -#endif -); - -void vgaRestoreBank( -#if NeedFunctionPrototypes - void -#endif -); - -void vgaPushRead( -#if NeedFunctionPrototypes - void -#endif -); - -void vgaPopRead( -#if NeedFunctionPrototypes - void -#endif -); - -void vgaSetVidPage( -#if NeedFunctionPrototypes - int -#endif -); - -extern int vgaSegmentMask; - -extern void SpeedUpComputeNext( -#if NeedFunctionPrototypes - unsigned, - unsigned -#endif -); - -extern void SpeedUpComputePrev( -#if NeedFunctionPrototypes - unsigned, - unsigned -#endif -); - -extern unsigned SpeedUpRowsNext[]; -extern unsigned SpeedUpRowsPrev[]; - - -#ifdef CSRG_BASED -#define VGABASE 0xFF000000 -#else -#if defined(__alpha__) -#define VGABASE 0xFFFFFFFFF0000000UL -#else /* __alpha__ */ -#define VGABASE 0xF0000000 -#endif /* __alpha__ */ -#endif - -/* Clear these first -- since they are defined in mfbcustom.h */ -#undef CHECKSCREEN -#undef SETRWF -#undef CHECKRWOF -#undef CHECKRWUF -#undef BANK_FLAG -#undef BANK_FLAG_BOTH -#undef SETR -#undef SETW -#undef SETRW -#undef CHECKRO -#undef CHECKWO -#undef CHECKRWO -#undef CHECKRU -#undef CHECKWU -#undef CHECKRWU -#undef NEXTR -#undef NEXTW -#undef PREVR -#undef PREVW -#undef SAVE_BANK -#undef RESTORE_BANK -#undef PUSHR -#undef POPR - -#define CHECKSCREEN(x) (((unsigned long)(x) >= VGABASE) ? TRUE : FALSE) - -#define SETRWF(f,x) { if(f) x = vgaSetReadWrite(x); } -#define CHECKRWOF(f,x) { if(f && ((void *)x >= vgaWriteTop)) \ - x = vgaReadWriteNext(x); } -#define CHECKRWUF(f,x) { if(f && ((void *)x < vgaWriteBottom)) \ - x = vgaReadWritePrev(x); } -#define BANK_FLAG(a) \ - vgaWriteFlag = CHECKSCREEN((a)); \ - vgaReadFlag = FALSE; - -#define BANK_FLAG_BOTH(a,b) \ - vgaReadFlag = CHECKSCREEN((a)); \ - vgaWriteFlag = CHECKSCREEN((b)); - -#define SETR(x) { if(vgaReadFlag) x = vgaSetRead(x); } -#define SETW(x) { if(vgaWriteFlag) x = vgaSetWrite(x); } -#define SETRW(x) { if(vgaWriteFlag) x = vgaSetReadWrite(x); } -#define CHECKRO(x) { if(vgaReadFlag && ((void *)x >= vgaReadTop)) \ - x = vgaReadNext(x); } -#define CHECKRU(x) { if(vgaReadFlag && ((void *)x < vgaReadBottom)) \ - x = vgaReadPrev(x); } -#define CHECKWO(x) { if(vgaWriteFlag && ((void *)x >= vgaWriteTop)) \ - x = vgaWriteNext(x); } -#define CHECKWU(x) { if(vgaWriteFlag && ((void *)x < vgaWriteBottom)) \ - x = vgaWritePrev(x); } -#define CHECKRWO(x) { if(vgaWriteFlag && ((void *)x >= vgaWriteTop)) \ - x = vgaReadWriteNext(x); } -#define CHECKRWU(x) { if(vgaWriteFlag && ((void *)x < vgaWriteBottom)) \ - x = vgaReadWritePrev(x); } - -#define NEXTR(x) { x = vgaReadNext(x);} -#define NEXTW(x) { x = vgaWriteNext(x); } -#define PREVR(x) { x = vgaReadPrev(x); } -#define PREVW(x) { x = vgaWritePrev(x); } - -#define SAVE_BANK() { if (vgaWriteFlag) vgaSaveBank(); } -#define RESTORE_BANK() { if (vgaWriteFlag) vgaRestoreBank(); } - -#define PUSHR() { if(vgaWriteFlag) vgaPushRead(); } -#define POPR() { if(vgaWriteFlag) vgaPopRead(); } - - -#endif /* VGA_BANK_H */ Index: xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.s:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.s:1.2 Sat Jul 25 12:58:13 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.s Fri Jan 18 15:26:24 2002 @@ -1,650 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgaBank.s,v 1.2 1998/07/25 16:58:13 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. - * - * Author: Thomas Roell, roell@informatik.tu-muenchen.de - * - */ -/* $XConsortium: vgaBank.s /main/7 1996/02/21 18:10:07 kaleb $ */ - -#include "assyntax.h" - - FILE("vgaBank.s") - AS_BEGIN - -/* - * Because a modern VGA has more than 128kBytes (which are mappable into the - * 386' memory some logic is required. The VGA's memory (logical VGA - * address space) is devided into smaller parts (called logical segments). - * These segments are mapped to logical areas. - * - * There are there different logical mapping areas: - * - * Read: an area which can be read from - * Write: an area which can be written to - * ReadWrite: here is both read an write possible - * - * It is permissable to use simultaneously a Read and a Write, but you can use - * ReadWrite only as a single. - * For example the bitblitting code uses a Read area as source and a Write - * area as destination. Most other routines use only a ReadWrite. - * - * A logical mapping area is described by some parameters (here I will for - * example describe a Read area: - * - * ReadBottom lowest accessable byte relative to the beginning of the - * VGA boards mapped memory. - * - * ReadTop highes accessable byte plus one. - * - * SegmentSize size of such an mapped area (common for all three) - * - * SegmentShift log2(SegmentSize) (used to compute the logical segment) - * - * SegmentMask SegmentSize - 1 (used to mask the offset inter an area) - * - * - * All that the following routines are doing is computing for a given offset - * into the logical VGA adress space the offset into such an logical area - * and the logical segment number. By the way they call also the VGA board's - * driver to set up the VGA's physical memory mapping according to the logical - * that was requested by the calliie. - * - * For shake of simplicity Write and ReadWrite share the same Bottom & Top. - * NOTE: Read & Write may have differnt starting addresses, or even common. - * - * There are multible routines present for the same effect. This was made - * for effectivly interface lowlevel assembly language best. - */ - -/* - * BUGALERT: this should be gotten from vga.h. But since there some C lang. - * things, too ... - */ - -#include "vgaAsm.h" - - - SEG_DATA - GLOBL GLNAME(writeseg) -#ifdef PC98_PEGC - GLOBL GLNAME(readseg) /* PC98_PEGC */ -#endif -GLNAME(writeseg): - D_LONG 0 -GLNAME(readseg): - D_LONG 0 -GLNAME(saveseg): - D_LONG 0 - - SEG_TEXT -/* - *----------------------------------------------------------------------- - * vgaSetReadWrite --- - * select a memory bank of the VGA board for read & write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * pointer - * vgaSetReadWrite(p) - * register pointer p; - * { - * #ifdef XF86VGA16 - * writeseg = ((unsigned long)p - vgaBase) >> vgaSegmentShift; - * (vgaSetReadWriteFunc)(writeseg); - * return (vgaWriteBottom + (((unsigned int)p - vgaBase) & vgaSegmentMask)); - * #else - * writeseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; - * (vgaSetReadWriteFunc)(writeseg); - * return (vgaWriteBottom + ((unsigned int)p & vgaSegmentMask)); - * #endif - * } - * - * - * since we now have 1/4/8bpp in the same binary, we need to have - * both versions of the function in here - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaSetReadWrite) -GLNAME(vgaSetReadWrite): - MOV_L (REGOFF(4,ESP),EAX) - PUSH_L (ECX) - PUSH_L (EDX) - SUB_L (VGABASE,EAX) - MOV_L (CONTENT(GLNAME(vgaSegmentShift)),ECX) - SHR_L (CL,EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - POP_L (ECX) - MOV_L (REGOFF(4,ESP),EAX) - AND_L (CONTENT(GLNAME(vgaSegmentMask)),EAX) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)),EAX) - RET - - ALIGNTEXT4 - GLOBL GLNAME(vga16SetReadWrite) -GLNAME(vga16SetReadWrite): - MOV_L (REGOFF(4,ESP),EAX) - PUSH_L (ECX) - PUSH_L (EDX) - SUB_L (CONTENT(GLNAME(vgaBase)),EAX) - MOV_L (CONTENT(GLNAME(vgaSegmentShift)),ECX) - SHR_L (CL,EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - POP_L (ECX) - MOV_L (REGOFF(4,ESP),EAX) - SUB_L (CONTENT(GLNAME(vgaBase)),EAX) - AND_L (CONTENT(GLNAME(vgaSegmentMask)),EAX) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaReadWriteNext --- - * switch to next memory bank of the VGA board for read & write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * - * pointer - * vgaReadWriteNext(p) - * register pointer p; - * { - * (vgaSetReadWriteFunc)(++writeseg); - * return (p - vgaSegmentSize); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaReadWriteNext) -GLNAME(vgaReadWriteNext): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(writeseg)),EAX) - INC_L (EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - MOV_L (REGOFF(4,ESP),EAX) - SUB_L (CONTENT(GLNAME(vgaSegmentSize)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaReadWritePrev --- - * switch to previous memory bank of the VGA board for read & write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * pointer - * vgaReadWritePrev(p) - * register pointer p; - * { - * (vgaSetReadWriteFunc)(--writeseg); - * return (p + vgaSegmentSize); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaReadWritePrev) -GLNAME(vgaReadWritePrev): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(writeseg)),EAX) - DEC_L (EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - MOV_L (REGOFF(4,ESP),EAX) - ADD_L (CONTENT(GLNAME(vgaSegmentSize)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaSetRead --- - * select a memory bank of the VGA board for read access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * pointer - * vgaSetRead(p) - * register pointer p; - * { - * #ifdef XF86VGA16 - * readseg = ((unsigned long)p - vgaBase) >> vgaSegmentShift; - * (vgaSetReadFunc)(readseg); - * return (vgaReadBottom + (((unsigned int)p - vgaBase) & vgaSegmentMask)); - * #else - * readseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; - * (vgaSetReadFunc)(readseg); - * return (vgaReadBottom + ((unsigned int)p & vgaSegmentMask)); - * #endif - * } - * - * since we now have 1/4/8bpp in the same binary, we need to have - * both versions of the function in here - * - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaSetRead) -GLNAME(vgaSetRead): - MOV_L (REGOFF(4,ESP),EAX) - PUSH_L (ECX) - PUSH_L (EDX) - SUB_L (VGABASE,EAX) - MOV_L (CONTENT(GLNAME(vgaSegmentShift)),ECX) - SHR_L (CL,EAX) - MOV_L (EAX,CONTENT(GLNAME(readseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - POP_L (ECX) - MOV_L (REGOFF(4,ESP),EAX) - AND_L (CONTENT(GLNAME(vgaSegmentMask)),EAX) - ADD_L (CONTENT(GLNAME(vgaReadBottom)),EAX) - RET - - ALIGNTEXT4 - GLOBL GLNAME(vga16SetRead) -GLNAME(vga16SetRead): - MOV_L (REGOFF(4,ESP),EAX) - PUSH_L (ECX) - PUSH_L (EDX) - SUB_L (CONTENT(GLNAME(vgaBase)),EAX) - MOV_L (CONTENT(GLNAME(vgaSegmentShift)),ECX) - SHR_L (CL,EAX) - MOV_L (EAX,CONTENT(GLNAME(readseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - POP_L (ECX) - MOV_L (REGOFF(4,ESP),EAX) - SUB_L (CONTENT(GLNAME(vgaBase)),EAX) - AND_L (CONTENT(GLNAME(vgaSegmentMask)),EAX) - ADD_L (CONTENT(GLNAME(vgaReadBottom)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaReadNext --- - * switch to next memory bank of the VGA board for read access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * - * pointer - * vgaReadNext(p) - * register pointer p; - * { - * (vgaSetReadFunc)(++readseg); - * return (p - vgaSegmentSize); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaReadNext) -GLNAME(vgaReadNext): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(readseg)),EAX) - INC_L (EAX) - MOV_L (EAX,CONTENT(GLNAME(readseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - MOV_L (REGOFF(4,ESP),EAX) - SUB_L (CONTENT(GLNAME(vgaSegmentSize)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaReadPrev --- - * switch to previous memory bank of the VGA board for read access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * pointer - * vgaReadPrev(p) - * register pointer p; - * { - * (vgaSetReadFunc)(--readseg); - * return (p + vgaSegmentSize); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaReadPrev) -GLNAME(vgaReadPrev): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(readseg)),EAX) - DEC_L (EAX) - MOV_L (EAX,CONTENT(GLNAME(readseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - MOV_L (REGOFF(4,ESP),EAX) - ADD_L (CONTENT(GLNAME(vgaSegmentSize)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaSetWrite --- - * select a memory bank of the VGA board for write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * pointer - * vgaSetWrite(p) - * register pointer p; - * { - * #ifdef XF86VGA16 - * writeseg = ((unsigned long)p - vgaBase) >> vgaSegmentShift; - * (vgaSetWriteFunc)(writeseg); - * return (vgaWriteBottom + (((unsigned int)p - vgaBase) & vgaSegmentMask)); - * #else - * writeseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; - * (vgaSetWriteFunc)(writeseg); - * return (vgaWriteBottom + ((unsigned int)p & vgaSegmentMask)); - * #endif - * } - * - * since we now have 1/4/8bpp in the same binary, we need to have - * both versions of the function in here - * - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaSetWrite) -GLNAME(vgaSetWrite): - MOV_L (REGOFF(4,ESP),EAX) - PUSH_L (ECX) - PUSH_L (EDX) - SUB_L (VGABASE,EAX) - MOV_L (CONTENT(GLNAME(vgaSegmentShift)),ECX) - SHR_L (CL,EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - POP_L (ECX) - MOV_L (REGOFF(4,ESP),EAX) - AND_L (CONTENT(GLNAME(vgaSegmentMask)),EAX) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)),EAX) - RET - - ALIGNTEXT4 - GLOBL GLNAME(vga16SetWrite) -GLNAME(vga16SetWrite): - MOV_L (REGOFF(4,ESP),EAX) - PUSH_L (ECX) - PUSH_L (EDX) - SUB_L (CONTENT(GLNAME(vgaBase)),EAX) - MOV_L (CONTENT(GLNAME(vgaSegmentShift)),ECX) - SHR_L (CL,EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - POP_L (ECX) - MOV_L (REGOFF(4,ESP),EAX) - SUB_L (CONTENT(GLNAME(vgaBase)),EAX) - AND_L (CONTENT(GLNAME(vgaSegmentMask)),EAX) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaWriteNext --- - * switch to next memory bank of the VGA board for write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * - * pointer - * vgaWriteNext(p) - * register pointer p; - * { - * (vgaSetWriteFunc)(++writeseg); - * return (p - vgaSegmentSize); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaWriteNext) -GLNAME(vgaWriteNext): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(writeseg)),EAX) - INC_L (EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - MOV_L (REGOFF(4,ESP),EAX) - SUB_L (CONTENT(GLNAME(vgaSegmentSize)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaWritePrev --- - * switch to previous memory bank of the VGA board for write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * pointer - * vgaWritePrev(p) - * register pointer p; - * { - * (vgaSetWriteFunc)(--writeseg); - * return (p + vgaSegmentSize); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaWritePrev) -GLNAME(vgaWritePrev): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(writeseg)),EAX) - DEC_L (EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - MOV_L (REGOFF(4,ESP),EAX) - ADD_L (CONTENT(GLNAME(vgaSegmentSize)),EAX) - RET - -/* - *----------------------------------------------------------------------- - * vgaSaveBank -- - * save Banking-state - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * void - * vgaSaveBank() - * { - * saveseg = writeseg; - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaSaveBank) -GLNAME(vgaSaveBank): - MOV_L (CONTENT(GLNAME(writeseg)),EAX) - MOV_L (EAX,CONTENT(GLNAME(saveseg))) - RET - -/* - *----------------------------------------------------------------------- - * vgaRestoreBank -- - * restore the banking after vgaSaveBank was called - * - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * void - * vgaRestoreBank() - * { - * (vgaSetWriteFunc)(saveseg); - * (vgaSetReadFunc)(saveseg); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaRestoreBank) -GLNAME(vgaRestoreBank): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(saveseg)),EAX) - MOV_L (EAX,CONTENT(GLNAME(writeseg))) - MOV_L (CONTENT(GLNAME(vgaSetWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - MOV_L (CONTENT(GLNAME(saveseg)),EAX) - MOV_L (EAX,CONTENT(GLNAME(readseg))) - MOV_L (CONTENT(GLNAME(vgaSetReadFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - RET - - -/* - *----------------------------------------------------------------------- - * vgaPushRead --- - * make the write-bank also readable. no acces to the former read bank ! - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * void - * vgaPushRead(p) - * { - * (vgaSetReadWriteFunc)(writeseg); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaPushRead) -GLNAME(vgaPushRead): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(writeseg)),EAX) - MOV_L (CONTENT(GLNAME(vgaSetReadWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - RET - -/* - *----------------------------------------------------------------------- - * vgaPopRead --- - * restore the banking after vgaPushRead was called - * - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * - * void - * vgaPopRead(p) - * { - * (vgaSetWriteFunc)(writeseg); - * (vgaSetReadFunc)(readseg); - * } - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaPopRead) -GLNAME(vgaPopRead): - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(writeseg)),EAX) - MOV_L (CONTENT(GLNAME(vgaSetWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - MOV_L (CONTENT(GLNAME(readseg)),EAX) - MOV_L (CONTENT(GLNAME(vgaSetReadFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - RET - -/* - *----------------------------------------------------------------------- - * vgaSetVidPage --- - * select a memory bank of the VGA board for read & write access - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - * void - * vgaSetVidPage(page) - * register int page; - * { - * (vgaSetReadWriteFunc)(page); - * return; - * } - * - */ - ALIGNTEXT4 - GLOBL GLNAME(vgaSetVidPage) -GLNAME(vgaSetVidPage): - MOV_L (REGOFF(4,ESP),EAX) - PUSH_L (EDX) - MOV_L (CONTENT(GLNAME(vgaSetReadWriteFunc)),EDX) - CALL (CODEPTR(EDX)) - POP_L (EDX) - RET - Index: xc/programs/Xserver/hw/xfree86/vgafb/vgaBankc.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgaBankc.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgaBankc.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgaBankc.c:1.2 Sat Jul 25 12:58:14 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgaBankc.c Fri Jan 18 15:26:24 2002 @@ -1,358 +0,0 @@ -/* - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgaBankc.c,v 1.2 1998/07/25 16:58:14 dawes Exp $ */ - -/* - * Because a modern VGA has more than 128kBytes (which are mappable into the - * 386' memory some logic is required. The VGA's memory (logical VGA - * address space) is devided into smaller parts (called logical segments). - * These segments are mapped to logical areas. - * - * There are there different logical mapping areas: - * - * Read: an area which can be read from - * Write: an area which can be written to - * ReadWrite: here is both read an write possible - * - * It is permissable to use simultaneously a Read and a Write, but you can use - * ReadWrite only as a single. - * For example the bitblitting code uses a Read area as source and a Write - * area as destination. Most other routines use only a ReadWrite. - * - * A logical mapping area is described by some parameters (here I will for - * example describe a Read area: - * - * ReadBottom lowest accessable byte relative to the beginning of the - * VGA boards mapped memory. - * - * ReadTop highes accessable byte plus one. - * - * SegmentSize size of such an mapped area (common for all three) - * - * SegmentShift log2(SegmentSize) (used to compute the logical segment) - * - * SegmentMask SegmentSize - 1 (used to mask the offset inter an area) - * - * - * All that the following routines are doing is computing for a given offset - * into the logical VGA adress space the offset into such an logical area - * and the logical segment number. By the way they call also the VGA board's - * driver to set up the VGA's physical memory mapping according to the logical - * that was requested by the calliie. - * - * For shake of simplicity Write and ReadWrite share the same Bottom & Top. - * NOTE: Read & Write may have differnt starting addresses, or even common. - * - * There are multible routines present for the same effect. This was made - * for effectivly interface lowlevel assembly language best. - */ - -/* - * BUGALERT: this should be gotten from vga.h. But since there some C lang. - * things, too ... - */ -#include "X.h" -#include "misc.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86_HWlib.h" - -#include "vga.h" - -unsigned long readseg, writeseg, saveseg; - -/* - *----------------------------------------------------------------------- - * vgaSetReadWrite --- - * select a memory bank of the VGA board for read & write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -pointer -vgaSetReadWrite(p) - register pointer p; -{ - if (xf86bpp == 4) { - writeseg = ((unsigned long)p - (unsigned long)vgaBase) >> vgaSegmentShift; - (vgaSetReadWriteFunc)(writeseg); - return ((pointer)((unsigned long)vgaWriteBottom + (((unsigned long)p - (unsigned long)vgaBase) & vgaSegmentMask))); - } else { - writeseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; - (vgaSetReadWriteFunc)(writeseg); - return (pointer) - ((unsigned long)vgaWriteBottom + - (((unsigned long)p - VGABASE) & vgaSegmentMask)); - } -} - -/* - *----------------------------------------------------------------------- - * vgaReadWriteNext --- - * switch to next memory bank of the VGA board for read & write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ - -pointer -vgaReadWriteNext(p) - register pointer p; -{ - (vgaSetReadWriteFunc)(++writeseg); - return (pointer)((unsigned long)p - vgaSegmentSize); -} - -/* - *----------------------------------------------------------------------- - * vgaReadWritePrev --- - * switch to previous memory bank of the VGA board for read & write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ - -pointer -vgaReadWritePrev(p) - register pointer p; -{ - (vgaSetReadWriteFunc)(--writeseg); - return (pointer)((unsigned long)p + vgaSegmentSize); -} - -/* - *----------------------------------------------------------------------- - * vgaSetRead --- - * select a memory bank of the VGA board for read access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -pointer -vgaSetRead(p) - register pointer p; -{ - if (xf86bpp == 4) { - readseg = ((unsigned long)p - (unsigned long)vgaBase) >> vgaSegmentShift; - (vgaSetReadFunc)(readseg); - return ((pointer)((unsigned long)vgaReadBottom + (((unsigned long)p - (unsigned long)vgaBase) & vgaSegmentMask))); - } else { - readseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; - (vgaSetReadFunc)(readseg); - return (pointer) - ((unsigned long)vgaReadBottom + - (((unsigned long)p - VGABASE) & vgaSegmentMask)); - } -} - -/* - *----------------------------------------------------------------------- - * vgaReadNext --- - * switch to next memory bank of the VGA board for read access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ - -pointer -vgaReadNext(p) - register pointer p; -{ - (vgaSetReadFunc)(++readseg); - return (pointer)((unsigned long)p - vgaSegmentSize); -} - -/* - *----------------------------------------------------------------------- - * vgaReadPrev --- - * switch to previous memory bank of the VGA board for read access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -pointer -vgaReadPrev(p) - register pointer p; -{ - (vgaSetReadFunc)(--readseg); - return (pointer)((unsigned long)p + vgaSegmentSize); -} - -/* - *----------------------------------------------------------------------- - * vgaSetWrite --- - * select a memory bank of the VGA board for write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -pointer -vgaSetWrite(p) - register pointer p; -{ - if (xf86bpp == 4) { - writeseg = ((unsigned long)p - (unsigned long)vgaBase) >> vgaSegmentShift; - (vgaSetWriteFunc)(writeseg); - return ((pointer)((unsigned long)vgaWriteBottom + (((unsigned long)p - (unsigned long)vgaBase) & vgaSegmentMask))); - } else { - writeseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; - (vgaSetWriteFunc)(writeseg); - return (pointer) - ((unsigned long)vgaWriteBottom + - (((unsigned long)p - VGABASE) & vgaSegmentMask)); - } -} - -/* - *----------------------------------------------------------------------- - * vgaWriteNext --- - * switch to next memory bank of the VGA board for write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -pointer -vgaWriteNext(p) - register pointer p; -{ - (vgaSetWriteFunc)(++writeseg); - return (pointer)((unsigned long)p - vgaSegmentSize); -} - -/* - *----------------------------------------------------------------------- - * vgaWritePrev --- - * switch to previous memory bank of the VGA board for write access - * Results: - * The adjusted pointer into the memory. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -pointer -vgaWritePrev(p) - register pointer p; -{ - (vgaSetWriteFunc)(--writeseg); - return (pointer)((unsigned long)p + vgaSegmentSize); -} - -/* - *----------------------------------------------------------------------- - * vgaSaveBank -- - * save Banking-state - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -void -vgaSaveBank() -{ - saveseg = writeseg; -} - -/* - *----------------------------------------------------------------------- - * vgaRestoreBank -- - * restore the banking after vgaSaveBank was called - * - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -void -vgaRestoreBank() -{ - (vgaSetWriteFunc)(saveseg); - (vgaSetReadFunc)(saveseg); -} - -/* - *----------------------------------------------------------------------- - * vgaPushRead --- - * make the write-bank also readable. no acces to the former read bank ! - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -void -vgaPushRead(void) -{ - (vgaSetReadWriteFunc)(writeseg); -} - -/* - *----------------------------------------------------------------------- - * vgaPopRead --- - * restore the banking after vgaPushRead was called - * - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -void -vgaPopRead(void) -{ - (vgaSetWriteFunc)(writeseg); - (vgaSetReadFunc)(readseg); -} - -/* - *----------------------------------------------------------------------- - * vgaSetVidPage --- - * select a memory bank of the VGA board for read & write access - * Results: - * None. - * - * Side Effects: - * None. - *----------------------------------------------------------------------- - */ -void -vgaSetVidPage(page) - register int page; -{ - (vgaSetReadWriteFunc)(page); -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgabitblt.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgabitblt.c:1.3 xc/programs/Xserver/hw/xfree86/vgafb/vgabitblt.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgabitblt.c:1.3 Sat Nov 28 05:43:18 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgabitblt.c Fri Jan 18 15:26:24 2002 @@ -1,792 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgabitblt.c,v 1.3 1998/11/28 10:43:18 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -Author: Keith Packard - -*/ -/* $XConsortium: vgabitblt.c /main/3 1996/02/21 18:10:26 kaleb $ */ - -/* - * vga256 copy area - */ - - -#include "vgafb.h" -#include "fastblt.h" -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -RegionPtr -vga256BitBlt(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane) - register DrawablePtr pSrcDrawable; - register DrawablePtr pDstDrawable; - GC *pGC; - int srcx, srcy; - int width, height; - int dstx, dsty; - void (*doBitBlt)( -#if NeedFunctionPrototypes -DrawablePtr, -DrawablePtr, -int, -RegionPtr, -DDXPointPtr, -unsigned long, -unsigned long -#endif -); - unsigned long bitPlane; -{ - RegionPtr prgnSrcClip; /* may be a new region, or just a copy */ - Bool freeSrcClip = FALSE; - - RegionPtr prgnExposed; - RegionRec rgnDst; - DDXPointPtr pptSrc; - register DDXPointPtr ppt; - register BoxPtr pbox; - int i; - register int dx; - register int dy; - xRectangle origSource; - DDXPointRec origDest; - int numRects; - BoxRec fastBox; - int fastClip = 0; /* for fast clipping with pixmap source */ - int fastExpose = 0; /* for fast exposures with pixmap source */ - - origSource.x = srcx; - origSource.y = srcy; - origSource.width = width; - origSource.height = height; - origDest.x = dstx; - origDest.y = dsty; - - if ((pSrcDrawable != pDstDrawable) && - pSrcDrawable->pScreen->SourceValidate) - { - (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height); - } - - srcx += pSrcDrawable->x; - srcy += pSrcDrawable->y; - - /* clip the source */ - - if (pSrcDrawable->type == DRAWABLE_PIXMAP) - { - if ((pSrcDrawable == pDstDrawable) && - (pGC->clientClipType == CT_NONE)) - { - prgnSrcClip = cfbGetCompositeClip(pGC); - } - else - { - fastClip = 1; - } - } - else - { - if (pGC->subWindowMode == IncludeInferiors) - { - if (!((WindowPtr) pSrcDrawable)->parent) - { - /* - * special case bitblt from root window in - * IncludeInferiors mode; just like from a pixmap - */ - fastClip = 1; - } - else if ((pSrcDrawable == pDstDrawable) && - (pGC->clientClipType == CT_NONE)) - { - prgnSrcClip = cfbGetCompositeClip(pGC); - } - else - { - prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable); - freeSrcClip = TRUE; - } - } - else - { - prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; - } - } - - fastBox.x1 = srcx; - fastBox.y1 = srcy; - fastBox.x2 = srcx + width; - fastBox.y2 = srcy + height; - - /* Don't create a source region if we are doing a fast clip */ - if (fastClip) - { - fastExpose = 1; - /* - * clip the source; if regions extend beyond the source size, - * make sure exposure events get sent - */ - if (fastBox.x1 < pSrcDrawable->x) - { - fastBox.x1 = pSrcDrawable->x; - fastExpose = 0; - } - if (fastBox.y1 < pSrcDrawable->y) - { - fastBox.y1 = pSrcDrawable->y; - fastExpose = 0; - } - if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) - { - fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; - fastExpose = 0; - } - if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) - { - fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; - fastExpose = 0; - } - } - else - { - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); - REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); - } - - dstx += pDstDrawable->x; - dsty += pDstDrawable->y; - - if (pDstDrawable->type == DRAWABLE_WINDOW) - { - if (!((WindowPtr)pDstDrawable)->realized) - { - if (!fastClip) - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return NULL; - } - } - - dx = srcx - dstx; - dy = srcy - dsty; - - /* Translate and clip the dst to the destination composite clip */ - if (fastClip) - { - RegionPtr cclip; - - /* Translate the region directly */ - fastBox.x1 -= dx; - fastBox.x2 -= dx; - fastBox.y1 -= dy; - fastBox.y2 -= dy; - - /* If the destination composite clip is one rectangle we can - do the clip directly. Otherwise we have to create a full - blown region and call intersect */ - - /* XXX because CopyPlane uses this routine for 8-to-1 bit - * copies, this next line *must* also correctly fetch the - * composite clip from an mfb gc - */ - - cclip = cfbGetCompositeClip(pGC); - if (REGION_NUM_RECTS(cclip) == 1) - { - BoxPtr pBox = REGION_RECTS(cclip); - - if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1; - if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2; - if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1; - if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2; - - /* Check to see if the region is empty */ - if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) - { - REGION_INIT(pGC->pScreen, &rgnDst, NullBox, 0); - } - else - { - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); - } - } - else - { - /* We must turn off fastClip now, since we must create - a full blown region. It is intersected with the - composite clip below. */ - fastClip = 0; - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1); - } - } - else - { - REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); - } - - if (!fastClip) - { - REGION_INTERSECT(pGC->pScreen, &rgnDst, - &rgnDst, - cfbGetCompositeClip(pGC)); - } - - /* Do bit blitting */ - numRects = REGION_NUM_RECTS(&rgnDst); - if (numRects && width && height) - { - if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects * - sizeof(DDXPointRec)))) - { - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return NULL; - } - pbox = REGION_RECTS(&rgnDst); - ppt = pptSrc; - for (i = numRects; --i >= 0; pbox++, ppt++) - { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane); - DEALLOCATE_LOCAL(pptSrc); - } - - prgnExposed = NULL; - if (pGC->fExpose) - { - /* Pixmap sources generate a NoExposed (we return NULL to do this) */ - if (!fastExpose) - prgnExposed = - miHandleExposures(pSrcDrawable, pDstDrawable, pGC, - origSource.x, origSource.y, - (int)origSource.width, - (int)origSource.height, - origDest.x, origDest.y, bitPlane); - } - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return prgnExposed; -} -void -vga256DoBitblt (pSrc, pDst, alu, prgnDst, pptSrc, planemask) - DrawablePtr pSrc, pDst; - int alu; - RegionPtr prgnDst; - DDXPointPtr pptSrc; - unsigned long planemask; -{ - void (*blt)( -#if NeedFunctionPrototypes -DrawablePtr, -DrawablePtr, -int, -RegionPtr, -DDXPointPtr, -unsigned long, -unsigned long -#endif -) = vga256DoBitbltGeneral; - if ((planemask & PMSK) == PMSK) { - switch (alu) { - case GXcopy: - blt = vga256LowlevFuncs.doBitbltCopy; - break; - case GXxor: - blt = vga256DoBitbltXor; - break; - case GXor: - blt = vga256DoBitbltOr; - break; - } - } - (*blt) (pSrc, pDst, alu, prgnDst, pptSrc, planemask, ~0L); - return; -} - -RegionPtr -vga256CopyArea(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty) - register DrawablePtr pSrcDrawable; - register DrawablePtr pDstDrawable; - GC *pGC; - int srcx, srcy; - int width, height; - int dstx, dsty; -{ - void (*localDoBitBlt)( -#if NeedFunctionPrototypes -DrawablePtr, -DrawablePtr, -int, -RegionPtr, -DDXPointPtr, -unsigned long, -unsigned long -#endif -); -/* - localDoBitBlt = doBitBlt ? doBitBlt : vga256LowlevFuncs.doBitbltCopy; - doBitBlt = vga256LowlevFuncs.doBitbltCopy; - - if (localDoBitBlt == vga256LowlevFuncs.doBitbltCopy) - { -*/ - localDoBitBlt = vga256LowlevFuncs.doBitbltCopy; - if (pGC->alu != GXcopy || (pGC->planemask & PMSK) != PMSK) - { - localDoBitBlt = vga256DoBitbltGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - switch (pGC->alu) { - case GXxor: - localDoBitBlt = vga256DoBitbltXor; - break; - case GXor: - localDoBitBlt = vga256DoBitbltOr; - break; - } - } - } -/* - } -*/ - - return cfbBitBlt (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, localDoBitBlt, 0L); -} - -void -vga256CopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane) - DrawablePtr pSrcDrawable; - DrawablePtr pDstDrawable; - int rop; - RegionPtr prgnDst; - DDXPointPtr pptSrc; - unsigned long planemask; - unsigned long bitPlane; -{ - int srcx, srcy; /* upper left corner of box being copied in source */ - int dstx, dsty; /* upper left corner of box being copied in dest */ - int width, height; /* in pixels, unpadded, of box being copied */ - int xoffSrc; /* bit # in leftmost word of row from which copying starts */ - int xoffDst; /* byte # in leftmost word of row from which copying starts */ - unsigned long *psrcBase, *pdstBase; /* start of drawable's pixel data */ - int widthSrc; /* # of groups of 32 pixels (1 bit/pixel) in src bitmap*/ - int widthDst; /* # of groups of 4 pixels (8 bits/pixel) in dst */ - unsigned long *psrcLine, *pdstLine; /* steps a row at a time thru src/dst; - * may point into middle of row */ - register unsigned long *psrc, *pdst; /* steps within the row */ - register unsigned long bits, tmp; /* bits from source */ - register int leftShift; - register int rightShift; - unsigned long startmask; /* left edge pixel mask */ - unsigned long endmask; /* right edge pixel mask */ - register int nlMiddle; /* number of words in middle of the row to draw */ - register int nl; - int firstoff; - int secondoff; - unsigned long src; - int nbox; /* number of boxes in region to copy */ - BoxPtr pbox; /* steps thru boxes in region */ - int pixelsRemainingOnRightEdge; /* # pixels to be drawn on a row after - * the main "middle" loop */ - - cfbGetLongWidthAndPointer (pSrcDrawable, widthSrc, psrcBase) - cfbGetLongWidthAndPointer (pDstDrawable, widthDst, pdstBase) - - BANK_FLAG(pdstBase) - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - srcx = pptSrc->x; - srcy = pptSrc->y; - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - pbox++; - pptSrc++; - - psrcLine = psrcBase + srcy * widthSrc + (srcx >> MFB_PWSH); - pdstLine = pdstBase + dsty * widthDst + (dstx >> PWSH); - xoffSrc = srcx & MFB_PIM; /* finds starting bit in src */ - xoffDst = dstx & PIM; /* finds starting byte in dst */ - - /* compute startmask, endmask, nlMiddle */ - - if (xoffDst + width < PPW) /* XXX should this be '<= PPW' ? */ - { /* the copy only affects one word per row in destination */ - maskpartialbits(dstx, width, startmask); - endmask = 0; - nlMiddle = 0; - } - else - { /* the copy will affect multiple words per row in destination */ - maskbits(dstx, width, startmask, endmask, nlMiddle); - } - - /* - * compute constants for the first four bits to be - * copied. This avoids troubles with partial first - * writes, and difficult shift computation - */ - if (startmask) - { - firstoff = xoffSrc - xoffDst; - if (firstoff > (MFB_PPW-PPW)) - secondoff = MFB_PPW - firstoff; - if (xoffDst) - { - srcx += (PPW-xoffDst); - xoffSrc = srcx & MFB_PIM; - } - } - leftShift = xoffSrc; - rightShift = MFB_PPW - leftShift; - - pixelsRemainingOnRightEdge = (nlMiddle & 7) * PPW + - ((dstx + width) & PIM); - - /* setup is done; now let's move some bits */ - - /* caller must call cfb8CheckOpaqueStipple before this function - * to set cfb8StippleRRop! - */ - - if (cfb8StippleRRop == GXcopy) - { - while (height--) - { /* one iteration of this loop copies one row */ - psrc = psrcLine; - pdst = pdstLine; - SETRW(pdst); - psrcLine += widthSrc; - pdstLine += widthDst; - bits = *psrc++; - if (startmask) - { - if (firstoff < 0) - tmp = BitRight (bits, -firstoff); - else - { - tmp = BitLeft (bits, firstoff); - /* - * need a more cautious test for partialmask - * case... - */ - if (firstoff >= (MFB_PPW-PPW)) - { - bits = *psrc++; - if (firstoff != (MFB_PPW-PPW)) - tmp |= BitRight (bits, secondoff); - } - } - *pdst = (*pdst & ~startmask) | (GetPixelGroup(tmp) & startmask); - pdst++; - CHECKRWO(pdst); - } - nl = nlMiddle; - while (nl >= 8) - { - nl -= 8; - tmp = BitLeft(bits, leftShift); - bits = *psrc++; - if (rightShift != MFB_PPW) - tmp |= BitRight(bits, rightShift); - -#ifdef FAST_CONSTANT_OFFSET_MODE -# define StorePixels(pdst,o,pixels) (pdst)[o] = (pixels) -# define EndStep(pdst,o) (pdst) += (o) -# define StoreRopPixels(pdst,o,and,xor) (pdst)[o] = DoRRop((pdst)[o],and,xor); -#else -# define StorePixels(pdst,o,pixels) *(pdst)++ = (pixels); CHECKRWO(pdst) -# define EndStep(pdst,o) -# define StoreRopPixels(pdst,o,and,xor) *(pdst) = DoRRop(*(pdst),and,xor); (pdst)++; CHECKRWO(pdst); -#endif - -#define Step(c) NextBitGroup(c); -#define StoreBitsPlain(o,c) StorePixels(pdst,o,GetPixelGroup(c)) -#define StoreRopBitsPlain(o,c) StoreRopPixels(pdst,o,\ - cfb8StippleAnd[GetBitGroup(c)], \ - cfb8StippleXor[GetBitGroup(c)]) -#define StoreBits0(c) StoreBitsPlain(0,c) -#define StoreRopBits0(c) StoreRopBitsPlain(0,c) - -#if (BITMAP_BIT_ORDER == MSBFirst) -# define StoreBits(o,c) StoreBitsPlain(o,c) -# define StoreRopBits(o,c) StoreRopBitsPlain(o,c) -# define FirstStep(c) Step(c) -#else /* BITMAP_BIT_ORDER == LSBFirst */ -#if PGSZ == 64 -# define StoreBits(o,c) StorePixels(pdst,o, (cfb8Pixels[c & 0xff])) -# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \ - (cfb8StippleAnd[c & 0xff]), \ - (cfb8StippleXor[c & 0xff])) -# define FirstStep(c) c = BitLeft (c, 8); -#else -/* 0x3c is 0xf << 2 (4 bits, long word) */ -# define StoreBits(o,c) StorePixels(pdst,o,*((unsigned long *)\ - (((char *) cfb8Pixels) + (c & 0x3c)))) -# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \ - *((unsigned long *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \ - *((unsigned long *) (((char *) cfb8StippleXor) + (c & 0x3c)))) -# define FirstStep(c) c = BitLeft (c, 2); -#endif /* PGSZ */ -#endif /* BITMAP_BIT_ORDER */ - - StoreBits0(tmp); FirstStep(tmp); - StoreBits(1,tmp); Step(tmp); - StoreBits(2,tmp); Step(tmp); - StoreBits(3,tmp); Step(tmp); - StoreBits(4,tmp); Step(tmp); - StoreBits(5,tmp); Step(tmp); - StoreBits(6,tmp); Step(tmp); - StoreBits(7,tmp); EndStep (pdst,8); - } - - /* do rest of middle and partial word on right edge */ - - if (pixelsRemainingOnRightEdge) - { - tmp = BitLeft(bits, leftShift); - - if (pixelsRemainingOnRightEdge > rightShift) - { - bits = *psrc++; - tmp |= BitRight (bits, rightShift); - } - EndStep (pdst, nl); - switch (nl) - { - case 7: - StoreBitsPlain(-7,tmp); Step(tmp); - case 6: - StoreBitsPlain(-6,tmp); Step(tmp); - case 5: - StoreBitsPlain(-5,tmp); Step(tmp); - case 4: - StoreBitsPlain(-4,tmp); Step(tmp); - case 3: - StoreBitsPlain(-3,tmp); Step(tmp); - case 2: - StoreBitsPlain(-2,tmp); Step(tmp); - case 1: - StoreBitsPlain(-1,tmp); Step(tmp); - } - if (endmask) - *pdst = (*pdst & ~endmask) | GetPixelGroup(tmp) & endmask; - } - } - } - else /* cfb8StippleRRop != GXcopy */ - { - while (height--) - { /* one iteration of this loop copies one row */ - psrc = psrcLine; - pdst = pdstLine; - SETRW(pdst); - psrcLine += widthSrc; - pdstLine += widthDst; - bits = *psrc++; - - /* do partial word on left edge */ - - if (startmask) - { - if (firstoff < 0) - tmp = BitRight (bits, -firstoff); - else - { - tmp = BitLeft (bits, firstoff); - if (firstoff >= (MFB_PPW-PPW)) - { - bits = *psrc++; - if (firstoff != (MFB_PPW-PPW)) - tmp |= BitRight (bits, secondoff); - } - } - src = GetBitGroup(tmp); - *pdst = MaskRRopPixels (*pdst, src, startmask); - pdst++; - CHECKRWO(pdst); - } - - /* do middle of row */ - - nl = nlMiddle; - while (nl >= 8) - { - nl -= 8; - tmp = BitLeft(bits, leftShift); - bits = *psrc++; - if (rightShift != MFB_PPW) - tmp |= BitRight(bits, rightShift); - StoreRopBits0(tmp); FirstStep(tmp); - StoreRopBits(1,tmp); Step(tmp); - StoreRopBits(2,tmp); Step(tmp); - StoreRopBits(3,tmp); Step(tmp); - StoreRopBits(4,tmp); Step(tmp); - StoreRopBits(5,tmp); Step(tmp); - StoreRopBits(6,tmp); Step(tmp); - StoreRopBits(7,tmp); EndStep(pdst,8); - } - - /* do rest of middle and partial word on right edge */ - - if (pixelsRemainingOnRightEdge) - { - tmp = BitLeft(bits, leftShift); - - if (pixelsRemainingOnRightEdge > rightShift) - { - bits = *psrc++; - tmp |= BitRight (bits, rightShift); - } - while (nl--) - { - src = GetBitGroup (tmp); - *pdst = RRopPixels (*pdst, src); - pdst++; - CHECKRWO(pdst); - NextBitGroup(tmp); - } - if (endmask) - { - src = GetBitGroup (tmp); - *pdst = MaskRRopPixels (*pdst, src, endmask); - } - } - } /* end copy one row */ - } /* end alu is non-copy-mode case */ - } /* end iteration over region boxes */ -} - - -RegionPtr vga256CopyPlane(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane) - DrawablePtr pSrcDrawable; - DrawablePtr pDstDrawable; - GCPtr pGC; - int srcx, srcy; - int width, height; - int dstx, dsty; - unsigned long bitPlane; -{ - RegionPtr ret; - - /* - * If nothing is going to touch the frame buffer, then just use - * the regular cfb routines. They should be faster. - */ - if ( (pSrcDrawable->type != DRAWABLE_WINDOW) && - (pDstDrawable->type != DRAWABLE_WINDOW)) - return cfbCopyPlane(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, - dstx, dsty, bitPlane); - - if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == 8) - { - if (bitPlane == 1) - { - cfb8CheckOpaqueStipple (pGC->alu, - pGC->fgPixel, pGC->bgPixel, - pGC->planemask); - ret = cfbBitBlt (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, - vga256LowlevFuncs.copyPlane1to8, bitPlane); - } - else - ret = miHandleExposures (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - } - else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 1) - { - extern int InverseAlu[16]; - int oldalu; - - oldalu = pGC->alu; - if ((pGC->fgPixel & 1) == 0 && (pGC->bgPixel&1) == 1) - pGC->alu = InverseAlu[pGC->alu]; - else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) - pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel); - ret = cfbBitBlt (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, - vga256CopyPlane8to1, bitPlane); - pGC->alu = oldalu; - } - else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 8) - { - PixmapPtr pBitmap; - ScreenPtr pScreen = pSrcDrawable->pScreen; - GCPtr pGC1; - - pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1); - if (!pBitmap) - return NULL; - pGC1 = GetScratchGC (1, pScreen); - if (!pGC1) - { - (*pScreen->DestroyPixmap) (pBitmap); - return NULL; - } - /* - * don't need to set pGC->fgPixel,bgPixel as copyPlane8to1 - * ignores pixel values, expecting the rop to "do the - * right thing", which GXcopy will. - */ - ValidateGC ((DrawablePtr) pBitmap, pGC1); - /* no exposures here, scratch GC's don't get graphics expose */ - cfbBitBlt (pSrcDrawable, (DrawablePtr) pBitmap, - pGC1, srcx, srcy, width, height, 0, 0, - vga256CopyPlane8to1, bitPlane); - cfb8CheckOpaqueStipple (pGC->alu, - pGC->fgPixel, pGC->bgPixel, - pGC->planemask); - /* no exposures here, copy bits from inside a pixmap */ - cfbBitBlt ((DrawablePtr) pBitmap, pDstDrawable, pGC, - 0, 0, width, height, dstx, dsty, - vga256LowlevFuncs.copyPlane1to8, 1L); - FreeScratchGC (pGC1); - (*pScreen->DestroyPixmap) (pBitmap); - /* compute resultant exposures */ - ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, bitPlane); - } - else - ErrorF( "vga256CopyPlane(). Unhandled combinations of bitsPerPixel\n"); - return ret; -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgablt.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgablt.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgablt.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgablt.c:1.2 Sat Jul 25 12:58:15 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgablt.c Fri Jan 18 15:26:24 2002 @@ -1,516 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgablt.c,v 1.2 1998/07/25 16:58:15 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -Author: Keith Packard - -*/ -/* $XConsortium: vgablt.c /main/4 1996/02/21 18:10:30 kaleb $ */ -/* - * cfb copy area - */ - - -#include "vgafb.h" -#include "fastblt.h" -#include "mergerop.h" - -#if PGSZ == 32 -#define LEFTSHIFT_AMT (5 - PWSH) -#else /* PGSZ == 64 */ -#define LEFTSHIFT_AMT (6 - PWSH) -#endif /* PGSZ */ - -#ifdef notdef /* XXX fails right now, walks off end of pixmaps */ -#if defined (FAST_UNALIGNED_READS) && (PSZ == 8) -#define DO_UNALIGNED_BITBLT -#endif -#endif - -#if (MROP == Mcopy) -#ifdef SPEEDUP -void -speedupvga256DoBitbltCopy(pSrc, pDst, alu, prgnDst, pptSrc, planemask, bitPlane) -#else -void -MROP_NAME(vga256DoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask, bitPlane) -#endif -#else -void -MROP_NAME(vga256DoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask, bitPlane) -#endif - DrawablePtr pSrc, pDst; - int alu; - RegionPtr prgnDst; - DDXPointPtr pptSrc; - unsigned long planemask; - unsigned long bitPlane; -{ - unsigned long *psrcBase, *pdstBase; - /* start of src and dst bitmaps */ - int widthSrc, widthDst; /* add to get to same position in next line */ - - BoxPtr pbox; - int nbox; - - BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; - /* temporaries for shuffling rectangles */ - DDXPointPtr pptTmp, pptNew1, pptNew2; - /* shuffling boxes entails shuffling the - source points too */ - int w, h; - int xdir; /* 1 = left right, -1 = right left/ */ - int ydir; /* 1 = top down, -1 = bottom up */ - - unsigned long *psrcLine, *pdstLine; - /* pointers to line with current src and dst */ - register unsigned long *psrc;/* pointer to current src longword */ - register unsigned long *pdst;/* pointer to current dst longword */ - - MROP_DECLARE_REG() - - /* following used for looping through a line */ - unsigned long startmask, endmask; /* masks for writing ends of dst */ - int nlMiddle; /* whole longwords in dst */ - int xoffSrc, xoffDst; - register int leftShift, rightShift; - register unsigned long bits; - register unsigned long bits1; - register int nl; /* temp copy of nlMiddle */ - - /* place to store full source word */ - int careful; - -#ifdef SPEEDUP - void SpeedUpBitBlt(); -#endif - -#ifndef SPEEDUP -#if 0 - /* - * If nothing is going to touch the frame buffer, then just use - * the regular cfb routines. They should be faster. - */ - /* - * Doing this causes a problem saving/restoring the screen on VT switch. - */ - if ( (pSrc->type != DRAWABLE_WINDOW) && - (pDst->type != DRAWABLE_WINDOW)) - { - MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask); - return; - } -#endif -#endif - - MROP_INITIALIZE(alu,planemask); - - cfbGetLongWidthAndPointer (pSrc, widthSrc, psrcBase) - - cfbGetLongWidthAndPointer (pDst, widthDst, pdstBase) - - BANK_FLAG_BOTH(psrcBase,pdstBase) - - /* XXX we have to err on the side of safety when both are windows, - * because we don't know if IncludeInferiors is being used. - */ - careful = ((pSrc == pDst) || - ((pSrc->type == DRAWABLE_WINDOW) && - (pDst->type == DRAWABLE_WINDOW))); - - pbox = REGION_RECTS(prgnDst); - nbox = REGION_NUM_RECTS(prgnDst); - - pboxNew1 = NULL; - pptNew1 = NULL; - pboxNew2 = NULL; - pptNew2 = NULL; - if (careful && (pptSrc->y < pbox->y1)) - { - /* walk source botttom to top */ - ydir = -1; - widthSrc = -widthSrc; - widthDst = -widthDst; - - 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 - { - /* walk source top to bottom */ - ydir = 1; - } - - if (careful && (pptSrc->x < pbox->x1)) - { - /* walk source right to left */ - 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) - { - 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 - { - /* walk source left to right */ - xdir = 1; - } - - while(nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - -#if (MROP) == Mcopy && defined(SPEEDUP) - if ((planemask&0xFF) == 0xFF) { - if (h | w) - SpeedUpBitBlt(psrcBase, pdstBase, widthSrc << 2, widthDst << 2, - pptSrc->x, pptSrc->y, pbox->x1, pbox->y1, - w, h, xdir, ydir); - pbox++; - pptSrc++; - continue; - } -#endif - - - if (ydir == -1) /* start at last scanline of rectangle */ - { - psrcLine = psrcBase + ((pptSrc->y+h-1) * -widthSrc); - pdstLine = pdstBase + ((pbox->y2-1) * -widthDst); - } - else /* start at first scanline */ - { - psrcLine = psrcBase + (pptSrc->y * widthSrc); - pdstLine = pdstBase + (pbox->y1 * widthDst); - } - if ((pbox->x1 & PIM) + w <= PPW) - { - maskpartialbits (pbox->x1, w, endmask); - startmask = 0; - nlMiddle = 0; - } - else - { - maskbits(pbox->x1, w, startmask, endmask, nlMiddle); - } - if (xdir == 1) - { - xoffSrc = pptSrc->x & PIM; - xoffDst = pbox->x1 & PIM; - pdstLine += (pbox->x1 >> PWSH); - psrcLine += (pptSrc->x >> PWSH); - if (xoffSrc == xoffDst) - { - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - SETW(pdst); - SETR(psrc); - pdstLine += widthDst; - psrcLine += widthSrc; - if (startmask) - { - bits = *psrc; - PUSHR(); - *pdst = MROP_MASK(bits, *pdst, startmask); - pdst++; CHECKWO(pdst); - POPR(); - psrc++; CHECKRO(psrc); - } - nl = nlMiddle; - - DuffL(nl, label1, - bits = *psrc; - PUSHR(); - *pdst = MROP_SOLID (bits, *pdst); - pdst++; CHECKWO(pdst); - POPR(); - psrc++; CHECKRO(psrc); ) - - if (endmask) - { - bits = *psrc; - PUSHR(); - *pdst = MROP_MASK(bits, *pdst, endmask); - POPR(); - } - } - } - else - { - if (xoffSrc > xoffDst) - { - leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; - rightShift = PGSZ - leftShift; - } - else - { - rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; - leftShift = PGSZ - rightShift; - } - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - SETW(pdst); - SETR(psrc); - pdstLine += widthDst; - psrcLine += widthSrc; - bits = 0; - if (xoffSrc > xoffDst) - { - bits = *psrc++; - CHECKRO(psrc); - } - if (startmask) - { - bits1 = BitLeft(bits,leftShift); - bits = *psrc++; - CHECKRO(psrc); - bits1 |= BitRight(bits,rightShift); - PUSHR(); - *pdst = MROP_MASK(bits1, *pdst, startmask); - pdst++; - CHECKWO(pdst); - POPR(); - } - nl = nlMiddle; - - DuffL (nl,label2, - bits1 = BitLeft(bits, leftShift); - bits = *psrc++; CHECKRO(psrc); - PUSHR(); - *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), - *pdst); - pdst++; CHECKWO(pdst); - POPR(); - ) - - if (endmask) - { - bits1 = BitLeft(bits, leftShift); - if (BitLeft(endmask, rightShift)) - { - bits = *psrc; - bits1 |= BitRight(bits, rightShift); - } - PUSHR(); - *pdst = MROP_MASK (bits1, *pdst, endmask); - POPR(); - } - } - } - } - else /* xdir == -1 */ - { - xoffSrc = (pptSrc->x + w - 1) & PIM; - xoffDst = (pbox->x2 - 1) & PIM; - pdstLine += ((pbox->x2-1) >> PWSH) + 1; - psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1; - if (xoffSrc == xoffDst) - { - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - SETW(pdst); - SETR(psrc); - pdstLine += widthDst; - psrcLine += widthSrc; - if (endmask) - { - psrc--; CHECKRU(psrc); - bits = *psrc; - PUSHR(); - pdst--; CHECKRWU(pdst); - *pdst = MROP_MASK (bits, *pdst, endmask); - POPR(); - } - nl = nlMiddle; - - DuffL(nl,label3, - --psrc; CHECKRU(psrc); - bits = *psrc; - PUSHR(); - --pdst; CHECKRWU(pdst); - *pdst = MROP_SOLID (bits, *pdst); - POPR();) - - if (startmask) - { - --psrc; CHECKRU(psrc); - bits = *psrc; - PUSHR(); - --pdst; CHECKRWU(pdst); - *pdst = MROP_MASK(bits, *pdst, startmask); - POPR(); - } - } - } - else - { - if (xoffDst > xoffSrc) - { - rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; - leftShift = PGSZ - rightShift; - } - else - { - leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; - rightShift = PGSZ - leftShift; - } - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - SETW(pdst); - SETR(psrc); - pdstLine += widthDst; - psrcLine += widthSrc; - bits = 0; - if (xoffDst > xoffSrc) { - --psrc; CHECKRU(psrc); - bits = *psrc; - } - if (endmask) - { - bits1 = BitRight(bits, rightShift); - --psrc; CHECKRU(psrc); - bits = *psrc; - bits1 |= BitLeft(bits, leftShift); - PUSHR(); - pdst--; CHECKRWU(pdst); - *pdst = MROP_MASK(bits1, *pdst, endmask); - POPR(); - } - nl = nlMiddle; - - DuffL (nl, label4, - bits1 = BitRight(bits, rightShift); - --psrc; CHECKRU(psrc); - bits = *psrc; - PUSHR(); - --pdst; CHECKRWU(pdst); - *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift), - *pdst); - POPR(); - ) - - if (startmask) - { - bits1 = BitRight(bits, rightShift); - if (BitRight (startmask, leftShift)) - { - --psrc; CHECKRU(psrc); - bits = *psrc; - bits1 |= BitLeft(bits, leftShift); - } - PUSHR(); - --pdst; CHECKRWU(pdst); - *pdst = MROP_MASK(bits1, *pdst, startmask); - POPR(); - } - } - } - } - pbox++; - pptSrc++; - } - if (pboxNew2) - { - DEALLOCATE_LOCAL(pptNew2); - DEALLOCATE_LOCAL(pboxNew2); - } - if (pboxNew1) - { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgabltC.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgabltC.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgabltC.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgabltC.c:1.2 Sat Jul 25 12:58:15 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgabltC.c Fri Jan 18 15:26:24 2002 @@ -1,245 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgabltC.c,v 1.2 1998/07/25 16:58:15 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -Author: Keith Packard - -*/ -/* $XConsortium: vgabltC.c /main/4 1996/02/21 18:10:34 kaleb $ */ - -#include "vgafb.h" - -void -vga256DoBitbltCopy(pSrc, pDst, alu, prgnDst, pptSrc, planemask, bitPlane) - DrawablePtr pSrc, pDst; - int alu; - RegionPtr prgnDst; - DDXPointPtr pptSrc; - unsigned long planemask; - unsigned long bitPlane; -{ - unsigned char *psrcBase, *pdstBase; - /* start of src and dst bitmaps */ - int widthSrc, widthDst; /* add to get to same position in next line */ - register void (*fnp)( -#if NeedFunctionPrototypes - unsigned char*, - unsigned char*, - int, - int, - int, - int, - int, - int, - int, - int, - int, - int, - int, - unsigned long -#endif -); - - BoxPtr pbox; - int nbox; - - BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; - /* temporaries for shuffling rectangles */ - DDXPointPtr pptTmp, pptNew1, pptNew2; - /* shuffling boxes entails shuffling the - source points too */ - - int xdir; /* 1 = left right, -1 = right left/ */ - int ydir; /* 1 = top down, -1 = bottom up */ - int careful; - - if (pSrc->type == DRAWABLE_WINDOW) - { - psrcBase = (unsigned char *) - (((PixmapPtr)(pSrc->pScreen->devPrivate))->devPrivate.ptr); - widthSrc = (int)((PixmapPtr)(pSrc->pScreen->devPrivate))->devKind; - } - else - { - psrcBase = (unsigned char *)(((PixmapPtr)pSrc)->devPrivate.ptr); - widthSrc = (int)(((PixmapPtr)pSrc)->devKind); - } - - if (pDst->type == DRAWABLE_WINDOW) - { - pdstBase = (unsigned char *) - (((PixmapPtr)(pDst->pScreen->devPrivate))->devPrivate.ptr); - widthDst = (int) - ((PixmapPtr)(pDst->pScreen->devPrivate))->devKind; - } - else - { - pdstBase = (unsigned char *)(((PixmapPtr)pDst)->devPrivate.ptr); - widthDst = (int)(((PixmapPtr)pDst)->devKind); - } - - if (CHECKSCREEN(psrcBase)) - if (CHECKSCREEN(pdstBase)) - fnp = vga256LowlevFuncs.vgaBitblt; - else - fnp = vgaImageRead; - else - if (CHECKSCREEN(pdstBase)) - fnp = vgaImageWrite; - else - fnp = vgaPixBitBlt; - - - /* XXX we have to err on the side of safety when both are windows, - * because we don't know if IncludeInferiors is being used. - */ - careful = ((pSrc == pDst) || - ((pSrc->type == DRAWABLE_WINDOW) && - (pDst->type == DRAWABLE_WINDOW))); - - pbox = REGION_RECTS(prgnDst); - nbox = REGION_NUM_RECTS(prgnDst); - - pboxNew1 = NULL; - pptNew1 = NULL; - pboxNew2 = NULL; - pptNew2 = NULL; - if (careful && (pptSrc->y < pbox->y1)) - { - /* walk source botttom to top */ - ydir = -1; - widthSrc = -widthSrc; - widthDst = -widthDst; - - 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 - { - /* walk source top to bottom */ - ydir = 1; - } - - if (careful && (pptSrc->x < pbox->x1)) - { - /* walk source right to left */ - 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) - { - 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 - { - /* walk source left to right */ - xdir = 1; - } - - while(nbox--) { - (*fnp)(pdstBase, psrcBase,widthSrc,widthDst, - pptSrc->x, pptSrc->y, pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, - xdir, ydir, alu, planemask); - pbox++; - pptSrc++; - } - - /* free up stuff */ - if (pboxNew2) - { - DEALLOCATE_LOCAL(pptNew2); - DEALLOCATE_LOCAL(pboxNew2); - } - if (pboxNew1) - { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); - } -} - - Index: xc/programs/Xserver/hw/xfree86/vgafb/vgabresd.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgabresd.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgabresd.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgabresd.c:1.2 Sat Jul 25 12:58:16 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgabresd.c Fri Jan 18 15:26:24 2002 @@ -1,178 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgabresd.c,v 1.2 1998/07/25 16:58:16 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgabresd.c /main/4 1996/02/21 18:10:38 kaleb $ */ - -#include "vgafb.h" -#include "miline.h" - -/* Dashed bresenham line */ - -void -vga256BresD(rrops, - pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, e, e1, e2, len) -cfbRRopPtr rrops; -int *pdashIndex; /* current dash */ -unsigned char *pDash; /* dash list */ -int numInDashList; /* total length of dash list */ -int *pdashOffset; /* offset into current dash */ -int isDoubleDash; -unsigned long *addrl; /* pointer to base of bitmap */ -int nlwidth; /* width in longwords of bitmap */ -int signdx, signdy; /* signs of directions */ -int axis; /* major axis (Y_AXIS or X_AXIS) */ -int x1, y1; /* initial point */ -register int e; /* error accumulator */ -register int e1; /* bresenham increments */ -int e2; -int len; /* length of line */ -{ - register unsigned char *addrb; - register unsigned char Oflag, Uflag; - register int e3 = e2-e1; - int dashIndex; - int dashOffset; - int dashRemaining; - unsigned long xorFg, andFg, xorBg, andBg; - Bool isCopy; - int thisDash; - - BANK_FLAG(addrl) - Oflag = vgaWriteFlag && (signdx > 0 || signdy > 0); - Uflag = vgaWriteFlag && (signdx < 0 || signdy < 0); - - dashOffset = *pdashOffset; - dashIndex = *pdashIndex; - dashRemaining = pDash[dashIndex] - dashOffset; - isCopy = (rrops[0].rop == GXcopy && rrops[1].rop == GXcopy); - xorFg = rrops[0].xor; - andFg = rrops[0].and; - xorBg = rrops[1].xor; - andBg = rrops[1].and; - if ((thisDash = dashRemaining) >= len) - { - thisDash = len; - dashRemaining -= len; - } - /* point to first point */ - nlwidth <<= PWSH; - addrb = (unsigned char *)(addrl) + (y1 * nlwidth) + x1; - SETRW(addrb); - signdy *= nlwidth; - if (axis == Y_AXIS) - { - int t; - - t = signdx; - signdx = signdy; - signdy = t; - } - e = e-e1; /* to make looping easier */ - -#define BresStep(minor,major) {if ((e += e1) >= 0) { e += e3; minor; } major;} -#define Loop(store) while (thisDash--) {\ - store; \ - BresStep(addrb+=signdy,addrb+=signdx) \ - CHECKRWOF(Oflag,addrb); CHECKRWUF(Uflag,addrb); \ - } - -#define NextDash {\ - dashIndex++; \ - if (dashIndex == numInDashList) \ - dashIndex = 0; \ - dashRemaining = pDash[dashIndex]; \ - if ((thisDash = dashRemaining) >= len) \ - { \ - dashRemaining -= len; \ - thisDash = len; \ - } \ -} - - if (isCopy) - { - for (;;) - { - len -= thisDash; - if (dashIndex & 1) { - if (isDoubleDash) { - Loop(*addrb = xorBg) - } else { - Loop(;) - } - } else { - Loop(*addrb = xorFg) - } - if (!len) - break; - NextDash - } - } - else - { - for (;;) - { - len -= thisDash; - if (dashIndex & 1) { - if (isDoubleDash) { - Loop(*addrb = DoRRop(*addrb,andBg, xorBg)) - } else { - Loop(;) - } - } else { - Loop(*addrb = DoRRop(*addrb,andFg, xorFg)) - } - if (!len) - break; - NextDash - } - } - *pdashIndex = dashIndex; - *pdashOffset = pDash[dashIndex] - dashRemaining; -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgabstore.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgabstore.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgabstore.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgabstore.c:1.2 Sat Jul 25 12:58:16 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgabstore.c Fri Jan 18 15:26:24 2002 @@ -1,137 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgabstore.c,v 1.2 1998/07/25 16:58:16 dawes Exp $ */ -/* - * This file was derived from cfbbstore.c. - */ -/*- - * cfbbstore.c -- - * Functions required by the backing-store implementation in MI. - * - * Copyright (c) 1987 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - * - * - */ -/* $XConsortium: vgabstore.c /main/4 1996/02/21 18:10:42 kaleb $ */ - -#include "vgafb.h" - - -/*- - *----------------------------------------------------------------------- - * vga256SaveAreas -- - * Function called by miSaveAreas to actually fetch the areas to be - * saved into the backing pixmap. This is very simple to do, since - * cfbDoBitblt is designed for this very thing. The region to save is - * already destination-relative and we're given the offset to the - * window origin, so we have only to create an array of points of the - * u.l. corners of the boxes in the region translated to the screen - * coordinate system and fetch the screen pixmap out of its devPrivate - * field.... - * - * Results: - * None. - * - * Side Effects: - * Data are copied from the screen into the pixmap. - * - *----------------------------------------------------------------------- - */ -void -vga256SaveAreas(pPixmap, prgnSave, xorg, yorg, pWin) - PixmapPtr pPixmap; /* Backing pixmap */ - RegionPtr prgnSave; /* Region to save (pixmap-relative) */ - int xorg; /* X origin of region */ - int yorg; /* Y origin of region */ - WindowPtr pWin; -{ - register DDXPointPtr pPt; - DDXPointPtr pPtsInit; - register BoxPtr pBox; - register int i; - - i = REGION_NUM_RECTS(prgnSave); - pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec)); - if (!pPtsInit) - return; - - pBox = REGION_RECTS(prgnSave); - pPt = pPtsInit; - while (--i >= 0) { - pPt->x = pBox->x1 + xorg; - pPt->y = pBox->y1 + yorg; - pPt++; - pBox++; - } - - - (*vga256LowlevFuncs.doBitbltCopy)((DrawablePtr)pPixmap->drawable.pScreen->devPrivate, - (DrawablePtr)pPixmap, - GXcopy, - prgnSave, - pPtsInit, ~0L, ~0L); - - DEALLOCATE_LOCAL (pPtsInit); -} - -/*- - *----------------------------------------------------------------------- - * vga256RestoreAreas -- - * Function called by miRestoreAreas to actually fetch the areas to be - * restored from the backing pixmap. This is very simple to do, since - * cfbDoBitblt is designed for this very thing. The region to restore is - * already destination-relative and we're given the offset to the - * window origin, so we have only to create an array of points of the - * u.l. corners of the boxes in the region translated to the pixmap - * coordinate system and fetch the screen pixmap out of its devPrivate - * field.... - * - * Results: - * None. - * - * Side Effects: - * Data are copied from the pixmap into the screen. - * - *----------------------------------------------------------------------- - */ -void -vga256RestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin) - PixmapPtr pPixmap; /* Backing pixmap */ - RegionPtr prgnRestore; /* Region to restore (screen-relative)*/ - int xorg; /* X origin of window */ - int yorg; /* Y origin of window */ - WindowPtr pWin; -{ - register DDXPointPtr pPt; - DDXPointPtr pPtsInit; - register BoxPtr pBox; - register int i; - - i = REGION_NUM_RECTS(prgnRestore); - pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec)); - if (!pPtsInit) - return; - - pBox = REGION_RECTS(prgnRestore); - pPt = pPtsInit; - while (--i >= 0) { - pPt->x = pBox->x1 - xorg; - pPt->y = pBox->y1 - yorg; - pPt++; - pBox++; - } - - - (*vga256LowlevFuncs.doBitbltCopy)((DrawablePtr)pPixmap, - (DrawablePtr)pPixmap->drawable.pScreen->devPrivate, - GXcopy, - prgnRestore, - pPtsInit, ~0L, ~0L); - DEALLOCATE_LOCAL (pPtsInit); -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgafb.h diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgafb.h:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgafb.h:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgafb.h:1.2 Sat Jul 25 12:58:17 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgafb.h Fri Jan 18 15:26:24 2002 @@ -1,1314 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgafb.h,v 1.2 1998/07/25 16:58:17 dawes Exp $ */ - - - - - -/* $XConsortium: vga256.h /main/5 1996/02/21 18:09:52 kaleb $ */ - -#ifndef _VGA256_H -#define VGA256_H - -#include "X.h" -#include "Xmd.h" -#include "servermd.h" -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "region.h" -#include "mistruct.h" -#include "mibstore.h" -#include "fontstruct.h" -#include "dixfontstr.h" -#include "cfb.h" -#ifndef NO_CFBMSKBITS -#include "cfbmskbits.h" -#include "cfb8bit.h" -#endif -#include "vgaFasm.h" -#include "vgaBank.h" -#include "gcstruct.h" - -extern GCOps vga256TEOps1Rect, vga256TEOps, vga256NonTEOps1Rect, vga256NonTEOps; - -typedef struct _Cfbfunc{ - void (*vgaBitblt)( -#if NeedFunctionPrototypes - unsigned char*, - unsigned char*, - int, - int, - int, - int, - int, - int, - int, - int, - int, - int, - int, - unsigned long -#endif -); - void (*doBitbltCopy)( -#if NeedFunctionPrototypes - DrawablePtr, - DrawablePtr, - int, - RegionPtr, - DDXPointPtr, - unsigned long, - unsigned long -#endif -); - void (*fillRectSolidCopy)( -#if NeedFunctionPrototypes - DrawablePtr, - GCPtr, - int, - BoxPtr -#endif -); - void (*fillRectTransparentStippled32)(); - void (*fillRectOpaqueStippled32)(); - void (*segmentSS)( -#if NeedFunctionPrototypes - DrawablePtr, - GCPtr, - int, - xSegment * -#endif -); - void (*lineSS)( -#if NeedFunctionPrototypes - DrawablePtr, - GCPtr, - int, - int, - DDXPointPtr -#endif -); - void (*fillBoxSolid)( -#if NeedFunctionPrototypes - DrawablePtr, - int, - BoxPtr, - unsigned long, - unsigned long, - int -#endif -); - void (*teGlyphBlt8)( -#if NeedFunctionPrototypes - DrawablePtr, - GCPtr, - int, - int, - unsigned int, - CharInfoPtr *, - pointer -#endif -); - void (*copyPlane1to8)( -#if NeedFunctionPrototypes - DrawablePtr, - DrawablePtr, - int, - RegionPtr, - DDXPointPtr, - unsigned long, - unsigned long -#endif -); - void (*fillSolidSpans)( /* Solid spans, any rop. */ -#if NeedFunctionPrototypes /* Must include clipping etc. */ - DrawablePtr, - GCPtr, - int, - DDXPointPtr, - int *, - int -#endif -); -} CfbfuncRec, *CfbfuncPtr; - -extern CfbfuncRec vga256LowlevFuncs; - -/* BitBlt.s */ - -void WinWin( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int , - int , - int -#endif -); - -/* BitBlt2.s */ - -void PixWin( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int -#endif -); - -void WinPix( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int -#endif -); - -void PixPix( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int , - int -#endif -); - -/* Box.s */ - -void SpeedUpBox( -#if NeedFunctionPrototypes - unsigned char *, - int , - int , - int , - int -#endif -); - -/* Line.s */ - -void SpeedUpBresS ( -#if NeedFunctionPrototypes - int, - unsigned, - unsigned, - unsigned long *, - int, - int, - int, - int, - int, - int, - int, - int, - int, - int -#endif -); - -/* VHLine.s */ - -void SpeedUpHLine( -#if NeedFunctionPrototypes - unsigned char *, - int , - int , - int -#endif -); - -void SpeedUpVLine( -#if NeedFunctionPrototypes - unsigned char *, - int , - int , - int -#endif -); - -/* fBitBlt.s */ - -void fastBitBltCopy( -#if NeedFunctionPrototypes - int , - unsigned char *, - unsigned char *, - int , - int , - int , - int -#endif -); - -/* fFillAnd.s */ - -unsigned char *fastFillSolidGXand( -#if NeedFunctionPrototypes - unsigned char *, - unsigned long , - unsigned long , - int , - int , - int , - int -#endif -); - -/* fFillOr.s */ - -unsigned char *fastFillSolidGXor( -#if NeedFunctionPrototypes - unsigned char *, - unsigned long , - unsigned long , - int , - int , - int , - int -#endif -); - -/* fFillXor.s */ - -unsigned char *fastFillSolidGXxor( -#if NeedFunctionPrototypes - unsigned char *, - unsigned long , - unsigned long , - int , - int , - int , - int -#endif -); - -/* fFillCopy.s */ - -unsigned char *fastFillSolidGXcopy( -#if NeedFunctionPrototypes - unsigned char *, - unsigned long , - unsigned long , - int , - int , - int , - int -#endif -); - -/* fFillSet.s */ - -unsigned char *fastFillSolidGXset( -#if NeedFunctionPrototypes - unsigned char *, - unsigned long , - unsigned long , - int , - int , - int , - int -#endif -); - -/* vgabres.s */ -void fastvga256BresS( -#if NeedFunctionPrototypes - int , - unsigned long , - unsigned long , - unsigned long *, - int , - register int , - int , - int , - int , - int , - register int , - register int , - int , - int -#endif -); - -/* vgalineH.s */ -int fastvga256HorzS( -#if NeedFunctionPrototypes - int , - unsigned long , - register unsigned long , - register unsigned long *, - int , - int , - int , - int -#endif -); - -/* vgalineV.s */ -void fastvga256VertS( -#if NeedFunctionPrototypes - int , - unsigned long , - unsigned long , - unsigned long *, - int , - int , - int , - register int -#endif -); - -/* vgaBitBlt.c */ - -void vgaBitBlt( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - unsigned long -#endif -); -void OneBankvgaBitBlt( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - unsigned long -#endif -); -void vgaImageRead( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - unsigned long -#endif -); -void vgaImageWrite( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - unsigned long -#endif -); -void vgaPixBitBlt( -#if NeedFunctionPrototypes - unsigned char *, - unsigned char *, - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - int , - unsigned long -#endif -); - -/* vgagc.c */ -Bool vga256CreateGC( -#if NeedFunctionPrototypes - register GCPtr -#endif -); -/* vgawindow.c */ -void vga256CopyWindow( -#if NeedFunctionPrototypes - WindowPtr , - DDXPointRec , - RegionPtr -#endif -); -/* vgascrinit.c */ -int vga256FinishScreenInit( -#if NeedFunctionPrototypes - register ScreenPtr , - pointer , - int , - int , - int , - int , - int -#endif -); -Bool vga256ScreenInit( register ScreenPtr , vgaHwPtr, pointer , int , int , int , int , int ); - -/* vgagetsp.c */ -void vga256GetSpans( -#if NeedFunctionPrototypes - DrawablePtr , - int , - register DDXPointPtr , - int *, - int , - char * -#endif -); -/* vgafillrct.c */ -void vga256FillBoxTileOdd( -#if NeedFunctionPrototypes - DrawablePtr , - int , - BoxPtr , - PixmapPtr , - int , - int -#endif -); -void vga256FillRectTileOdd( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga256PolyFillRect( -#if NeedFunctionPrototypes - DrawablePtr , - register GCPtr , - int , - xRectangle * -#endif -); -/* vgaimage.c */ -void vga256GetImage( -#if NeedFunctionPrototypes - DrawablePtr , - int , - int , - int , - int , - unsigned int , - unsigned long , - char * -#endif -); -/* vgasolidC.c */ -void vga256FillRectSolidCopy( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga256SolidSpansCopy( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -/* vgasolidCS.c */ -void speedupvga256FillRectSolidCopy( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -/* vgasolidX.c */ -void vga256FillRectSolidXor( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga256SolidSpansXor( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -/* vgasolidO.c */ -void vga256FillRectSolidOr( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga256SolidSpansOr( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -/* vgasolidA.c */ -void vga256FillRectSolidAnd( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga256SolidSpansAnd( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -/* vgasolidG.c */ -void vga256FillRectSolidGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga256SolidSpansGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -/* vgatile32C.c */ -void vga256FillRectTile32Copy( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga256Tile32FSCopy( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -/* vgatile32G.c */ -void vga256FillRectTile32General( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga256Tile32FSGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -/* vgatileoddC.c */ -void vga256FillBoxTileOddCopy( -#if NeedFunctionPrototypes - DrawablePtr , - int , - register BoxPtr , - PixmapPtr , - int , - int , - int , - unsigned long -#endif -); -void vga256FillSpanTileOddCopy( -#if NeedFunctionPrototypes - DrawablePtr , - int , - DDXPointPtr , - int *, - PixmapPtr , - int , - int , - int , - unsigned long -#endif -); -void vga256FillBoxTile32sCopy( -#if NeedFunctionPrototypes - DrawablePtr , - int , - BoxPtr , - PixmapPtr , - int , - int , - int , - unsigned long -#endif -); -void vga256FillSpanTile32sCopy( -#if NeedFunctionPrototypes - DrawablePtr , - int , - DDXPointPtr , - int *, - PixmapPtr , - int , - int , - int , - unsigned long -#endif -); -/* vgatileoddG.c */ -void vga256FillBoxTileOddGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - int , - register BoxPtr , - PixmapPtr , - int , - int , - int , - unsigned long -#endif -); -void vga256FillSpanTileOddGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - int , - DDXPointPtr , - int *, - PixmapPtr , - int , - int , - int , - unsigned long -#endif -); -void vga256FillBoxTile32sGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - int , - BoxPtr , - PixmapPtr , - int , - int , - int , - unsigned long -#endif -); -void vga256FillSpanTile32sGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - int , - DDXPointPtr , - int *, - PixmapPtr , - int , - int , - int , - unsigned long -#endif -); -/* vgafillsp.c */ -void vga256UnnaturalTileFS( -#if NeedFunctionPrototypes - DrawablePtr , - GC *, - int , - DDXPointPtr , - int *, - int -#endif -); -void vga256UnnaturalStippleFS( -#if NeedFunctionPrototypes - DrawablePtr , - GC *, - int , - DDXPointPtr , - int *, - int -#endif -); -void vga2568Stipple32FS( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -void vga2568OpaqueStipple32FS( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - DDXPointPtr , - int *, - int -#endif -); -/* vgasetsp.c */ -int vga256SetScanline( -#if NeedFunctionPrototypes - int , - int , - int , - int , - register unsigned int *, - register int , - int *, - int , - unsigned long -#endif -); -void vga256SetSpans( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - char *, - register DDXPointPtr , - int *, - int , - int -#endif -); -/* vgapntwin.c */ -void vga256PaintWindow( -#if NeedFunctionPrototypes - WindowPtr , - RegionPtr , - int -#endif -); -void vga256FillBoxSolid( -#if NeedFunctionPrototypes - DrawablePtr , - int , - BoxPtr , - unsigned long , - unsigned long , - int -#endif -); -void vga256FillBoxTile32( -#if NeedFunctionPrototypes - DrawablePtr , - int , - BoxPtr , - PixmapPtr -#endif -); -/* vgapntwinS.c */ -void speedupvga256FillBoxSolid( -#if NeedFunctionPrototypes - DrawablePtr , - int , - BoxPtr , - unsigned long , - unsigned long , - int -#endif -); -/* vgazerarcC.c */ -void vga256ZeroPolyArcSS8Copy( -#if NeedFunctionPrototypes - register DrawablePtr , - GCPtr , - int , - xArc * -#endif -); -/* vgazerarcX.c */ -void vga256ZeroPolyArcSS8Xor( -#if NeedFunctionPrototypes - register DrawablePtr , - GCPtr , - int , - xArc * -#endif -); -/* vgazerarcG.c */ -void vga256ZeroPolyArcSS8General( -#if NeedFunctionPrototypes - register DrawablePtr , - GCPtr , - int , - xArc * -#endif -); -/* vgafillarcC.c */ -void vga256PolyFillArcSolidCopy( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - xArc * -#endif -); -/* vgafillarcG.c */ -void vga256PolyFillArcSolidGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - xArc * -#endif -); -/* vgategblt.c */ -void vga256TEGlyphBlt( -#if NeedFunctionPrototypes - DrawablePtr , - GC *, - int , - int , - unsigned int , - CharInfoPtr *, - pointer -#endif -); -/* vgabstore.c */ -void vga256SaveAreas( -#if NeedFunctionPrototypes - PixmapPtr , - RegionPtr , - int , - int , - WindowPtr -#endif -); -void vga256RestoreAreas( -#if NeedFunctionPrototypes - PixmapPtr , - RegionPtr , - int , - int , - WindowPtr -#endif -); -/* vga8cppl.c */ -void vga256CopyImagePlane( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long -#endif -); -void vga256CopyPlane8to1( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long , - unsigned long -#endif -); -/* vgateblt8.c */ -void vga256TEGlyphBlt8( -#if NeedFunctionPrototypes - DrawablePtr , - GC *, - int , - int , - unsigned int , - CharInfoPtr *, - pointer -#endif -); -/* vgateblt8S.c */ -void speedupvga256TEGlyphBlt8( -#if NeedFunctionPrototypes - DrawablePtr , - GC *, - int , - int , - unsigned int , - CharInfoPtr *, - pointer -#endif -); -/* vgaglblt8.c */ -void vga256PolyGlyphBlt8( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - int , - unsigned int , - CharInfoPtr *, - pointer -#endif -); -/* vgaglrop8.c */ -void vga256PolyGlyphRop8( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - int , - unsigned int , - CharInfoPtr *, - pointer -#endif -); -/* vgarctstp8.c */ -void vga2568FillRectOpaqueStippled32( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - register BoxPtr -#endif -); -void vga2568FillRectTransparentStippled32( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -/* vgarctstp8S.c */ -void speedupvga2568FillRectOpaqueStippled32( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - register BoxPtr -#endif -); -void speedupvga2568FillRectTransparentStippled32( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - BoxPtr -#endif -); -void vga2568FillRectStippledUnnatural( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - register BoxPtr -#endif -); -/* vgapolypnt.c */ -void vga256PolyPoint( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - int , - xPoint * -#endif -); -/* vgaline.c */ -void vga256LineSS( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - int , - DDXPointPtr -#endif -); -void vga256LineSD( -#if NeedFunctionPrototypes - DrawablePtr , - register GCPtr , - int , - int , - DDXPointPtr -#endif -); -/* vgalineS.c */ -void speedupvga256LineSS( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - int , - DDXPointPtr -#endif -); -/* vgabresd.c */ -void vga256BresD( -#if NeedFunctionPrototypes - cfbRRopPtr , - int *, - unsigned char *, - int , - int *, - int , - unsigned long *, - int , - int , - int , - int , - int , - int , - register int , - register int , - int , - int -#endif -); -/* vgaseg.c */ -void vga256SegmentSS( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - register xSegment * -#endif -); -void vga256SegmentSD( -#if NeedFunctionPrototypes - DrawablePtr , - register GCPtr , - int , - register xSegment * -#endif -); -/* vgasegS.c */ -void speedupvga256SegmentSS( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - register xSegment * -#endif -); -/* vgabitblt.c */ -void vga256DoBitblt( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long -#endif -); -RegionPtr vga256CopyArea( -#if NeedFunctionPrototypes - register DrawablePtr , - register DrawablePtr , - GC *, - int , - int , - int , - int , - int , - int -#endif -); -void vga256CopyPlane1to8( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long , - unsigned long -#endif -); -RegionPtr vga256CopyPlane( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - GCPtr , - int , - int , - int , - int , - int , - int , - unsigned long -#endif -); -/* vgabltC.c */ -void vga256DoBitbltCopy( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long , - unsigned long -#endif -); -/* vgabltCS.c */ -void speedupvga256DoBitbltCopy( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long , - unsigned long -#endif -); -/* vgabltX.c */ -void vga256DoBitbltXor( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long , - unsigned long -#endif -); -/* vgabltO.c */ -void vga256DoBitbltOr( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long , - unsigned long -#endif -); -/* vgabltG.c */ -void vga256DoBitbltGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - DrawablePtr , - int , - RegionPtr , - DDXPointPtr , - unsigned long , - unsigned long -#endif -); -/* vgapush8.c */ -void vga256PushPixels8( -#if NeedFunctionPrototypes - GCPtr , - PixmapPtr , - DrawablePtr , - int , - int , - int , - int -#endif -); -/* vgaply1rctC.c */ -void vga256FillPoly1RectCopy( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - int , - int , - DDXPointPtr -#endif -); -/* vgaply1rctG.c */ -void vga256FillPoly1RectGeneral( -#if NeedFunctionPrototypes - DrawablePtr , - GCPtr , - int , - int , - int , - DDXPointPtr -#endif -); -/* vgafuncs.c */ - -#endif /* _VGA256_H */ Index: xc/programs/Xserver/hw/xfree86/vgafb/vgafillarc.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgafillarc.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgafillarc.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgafillarc.c:1.2 Sat Jul 25 12:58:17 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgafillarc.c Fri Jan 18 15:26:24 2002 @@ -1,284 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgafillarc.c,v 1.2 1998/07/25 16:58:17 dawes Exp $ */ -/************************************************************ - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -********************************************************/ - -/* $XConsortium: vgafillarc.c /main/3 1996/02/21 18:10:46 kaleb $ */ - -#include "vgafb.h" -#include "mifillarc.h" -#include "cfbrrop.h" - -/* gcc 1.35 is stupid */ -#if defined(__GNUC__) && defined(mc68020) -#define VOLITILE volatile -#else -#define VOLITILE -#endif - -static void -RROP_NAME(vga256FillEllipseSolid) (pDraw, pGC, arc) - DrawablePtr pDraw; - GCPtr pGC; - xArc *arc; -{ - VOLITILE int x, y, e; - VOLITILE int yk, xk, ym, xm, dx, dy, xorg, yorg; - miFillArcRec info; - unsigned long *addrlt, *addrlb; - register unsigned long *addrl EDI; - register int n; - int nlwidth; - RROP_DECLARE - register int xpos; - register int slw; - unsigned long startmask, endmask; - int nlmiddle; - int nl; - - CLD; - - cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt) - - BANK_FLAG(addrlt) - - RROP_FETCH_GC(pGC); - miFillArcSetup(arc, &info); - MIFILLARCSETUP(); - xorg += pDraw->x; - yorg += pDraw->y; - addrlb = addrlt; - addrlt += nlwidth * (yorg - y); - addrlb += nlwidth * (yorg + y + dy); - while (y) - { - addrlt += nlwidth; - addrlb -= nlwidth; - MIFILLARCSTEP(slw); - if (!slw) - continue; - xpos = xorg - x; - addrl = addrlt + (xpos >> PWSH); - SETRW(addrl); - if (((xpos & PIM) + slw) <= PPW) - { - maskpartialbits(xpos, slw, startmask); - RROP_SOLID_MASK(addrl,startmask); - if (miFillArcLower(slw)) - { - addrl = addrlb + (xpos >> PWSH); - SETRW(addrl); - RROP_SOLID_MASK(addrl, startmask); - } - continue; - } - maskbits(xpos, slw, startmask, endmask, nlmiddle); - if (startmask) - { - RROP_SOLID_MASK(addrl, startmask); - addrl++; CHECKRWO(addrl); - } - n = nlmiddle; - RROP_SPAN_STD(addrl,n,FA_1); - CHECKRWO(addrl); - if (endmask) - RROP_SOLID_MASK(addrl, endmask); - if (!miFillArcLower(slw)) - continue; - addrl = addrlb + (xpos >> PWSH); - SETRW(addrl); - if (startmask) - { - RROP_SOLID_MASK(addrl, startmask); - addrl++; CHECKRWO(addrl); - } - n = nlmiddle; - RROP_SPAN_STD(addrl,n,FA_2); - CHECKRWO(addrl); - if (endmask) - RROP_SOLID_MASK(addrl, endmask); - } -} - -#define FILLSPAN(xl,xr,addr,dummy) \ - if (xr >= xl) \ - { \ - n = xr - xl + 1; \ - addrl = addr + (xl >> PWSH); \ - SETRW(addrl); \ - if (((xl & PIM) + n) <= PPW) \ - { \ - maskpartialbits(xl, n, startmask); \ - RROP_SOLID_MASK(addrl, startmask); \ - } \ - else \ - { \ - maskbits(xl, n, startmask, endmask, n); \ - if (startmask) \ - { \ - RROP_SOLID_MASK(addrl, startmask); \ - addrl++; CHECKRWO(addrl); \ - } \ - RROP_SPAN_STD(addrl,n,dummy); \ - CHECKRWO(addrl); \ - if (endmask) \ - RROP_SOLID_MASK(addrl, endmask); \ - } \ - } - -/* -#define FILLSLICESPANS(flip,addr,dummy) \ - if (!flip) \ - { \ - FILLSPAN(xl, xr, addr, RROP_NAME_CAT(FA_d1,dummy)); \ - } \ - else \ - { \ - xc = xorg - x; \ - FILLSPAN(xc, xr, addr, RROP_NAME_CAT(FA_d2,dummy)); \ - xc += slw - 1; \ - FILLSPAN(xl, xc, addr, RROP_NAME_CAT(FA_d3,dummy)); \ - } -*/ - -static void -RROP_NAME(vga256FillArcSliceSolid)(pDraw, pGC, arc) - DrawablePtr pDraw; - GCPtr pGC; - xArc *arc; -{ - int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; - register int x, y, e; - miFillArcRec info; - miArcSliceRec slice; - int xl, xr, xc; - unsigned long *addrlt, *addrlb; - register unsigned long *addrl EDI; - register int n; - int nlwidth; - int nl; - RROP_DECLARE - unsigned long startmask, endmask; - - CLD; - - cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt) - - BANK_FLAG(addrlt) - - RROP_FETCH_GC(pGC); - miFillArcSetup(arc, &info); - miFillArcSliceSetup(arc, &slice, pGC); - MIFILLARCSETUP(); - xorg += pDraw->x; - yorg += pDraw->y; - addrlb = addrlt; - addrlt += nlwidth * (yorg - y); - addrlb += nlwidth * (yorg + y + dy); - slice.edge1.x += pDraw->x; - slice.edge2.x += pDraw->x; - while (y > 0) - { - addrlt += nlwidth; - addrlb -= nlwidth; - MIFILLARCSTEP(slw); - MIARCSLICESTEP(slice.edge1); - MIARCSLICESTEP(slice.edge2); - if (miFillSliceUpper(slice)) - { - MIARCSLICEUPPER(xl, xr, slice, slw); - if (!slice.flip_top) - { - FILLSPAN(xl,xr,addrlt,FS_1); - } - else - { - xc = xorg - x; - FILLSPAN(xc,xr,addrlt,FS_2); - xc += slw - 1; - FILLSPAN(xl,xc,addrlt,FS_3); - } -/* - FILLSLICESPANS(slice.flip_top, addrlt, __LINE__); -*/ - } - if (miFillSliceLower(slice)) - { - MIARCSLICELOWER(xl, xr, slice, slw); - if (!slice.flip_bot) - { - FILLSPAN(xl,xr,addrlb,FS_4); - } - else - { - xc = xorg - x; - FILLSPAN(xc,xr,addrlb,FS_5); - xc += slw - 1; - FILLSPAN(xl,xc,addrlb,FS_6); - } -/* - FILLSLICESPANS(slice.flip_bot, addrlb, __LINE__); -*/ - } - } -} - -void -RROP_NAME(vga256PolyFillArcSolid) (pDraw, pGC, narcs, parcs) - DrawablePtr pDraw; - GCPtr pGC; - int narcs; - xArc *parcs; -{ - register xArc *arc; - register int i; - BoxRec box; - RegionPtr cclip; - - cclip = pGC->pCompositeClip; - for (arc = parcs, i = narcs; --i >= 0; arc++) - { - if (miFillArcEmpty(arc)) - continue; - if (miCanFillArc(arc)) - { - box.x1 = arc->x + pDraw->x; - box.y1 = arc->y + pDraw->y; - box.x2 = box.x1 + (int)arc->width + 1; - box.y2 = box.y1 + (int)arc->height + 1; - if ((*pDraw->pScreen->RectIn)(cclip, &box) == rgnIN) - { - if ((arc->angle2 >= FULLCIRCLE) || - (arc->angle2 <= -FULLCIRCLE)) - RROP_NAME(vga256FillEllipseSolid)(pDraw, pGC, arc); - else - RROP_NAME(vga256FillArcSliceSolid)(pDraw, pGC, arc); - continue; - } - } - miPolyFillArc(pDraw, pGC, 1, arc); - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgafillrct.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgafillrct.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgafillrct.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgafillrct.c:1.2 Sat Jul 25 12:58:18 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgafillrct.c Fri Jan 18 15:26:24 2002 @@ -1,287 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgafillrct.c,v 1.2 1998/07/25 16:58:18 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. -*/ - -/* $XConsortium: vgafillrct.c /main/3 1996/02/21 18:10:49 kaleb $ */ - -/* - * Fill rectangles. - */ - -#include "vgafb.h" -#include "cfbrrop.h" - -void -vga256FillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot) - DrawablePtr pDrawable; - int n; - BoxPtr rects; - PixmapPtr tile; - int xrot, yrot; -{ - if (tile->drawable.width & PIM) - vga256FillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0); - else - vga256FillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0); -} - -void -vga256FillRectTileOdd (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; - BoxPtr pBox; -{ - int xrot, yrot; - void (*fill)(); - - xrot = pDrawable->x + pGC->patOrg.x; - yrot = pDrawable->y + pGC->patOrg.y; - if (pGC->tile.pixmap->drawable.width & PIM) - { - fill = vga256FillBoxTileOddGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - if (pGC->alu == GXcopy) - fill = vga256FillBoxTileOddCopy; - } - } - else - { - fill = vga256FillBoxTile32sGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - if (pGC->alu == GXcopy) - fill = vga256FillBoxTile32sCopy; - } - } - (*fill) (pDrawable, nBox, pBox, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask); -} - -#define NUM_STACK_RECTS 1024 - -void -vga256PolyFillRect(pDrawable, pGC, nrectFill, prectInit) - DrawablePtr pDrawable; - register GCPtr pGC; - int nrectFill; /* number of rectangles to fill */ - xRectangle *prectInit; /* Pointer to first rectangle to fill */ -{ - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - register BoxPtr pboxClipped; - BoxPtr pboxClippedBase; - BoxPtr pextent; - BoxRec stackRects[NUM_STACK_RECTS]; - cfbPrivGC *priv; - int numRects; - void (*BoxFill)(); - int n; - int xorg, yorg; - RROP_DECLARE - - priv = (cfbPrivGC *) pGC->devPrivates[cfbGCPrivateIndex].ptr; - prgnClip = pGC->pCompositeClip; - - BoxFill = 0; - switch (pGC->fillStyle) - { - case FillSolid: - RROP_FETCH_GCPRIV(priv) - switch (priv->rop) { - case GXcopy: - BoxFill = vga256LowlevFuncs.fillRectSolidCopy; - break; - case GXxor: - BoxFill = vga256FillRectSolidXor; - break; - case GXand: - BoxFill = (rrop_xor == 0) ? - vga256FillRectSolidAnd : vga256FillRectSolidGeneral; - break; - case GXor: - BoxFill = (rrop_and == 0) ? - vga256FillRectSolidOr : vga256FillRectSolidGeneral; - break; - default: - BoxFill = vga256FillRectSolidGeneral; - break; - } - break; - case FillTiled: - if (!pGC->pRotatedPixmap) - BoxFill = vga256FillRectTileOdd; - else - { - if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) - BoxFill = vga256FillRectTile32Copy; - else - BoxFill = vga256FillRectTile32General; - } - break; -#if PSZ == 8 - case FillStippled: - if (!pGC->pRotatedPixmap) - BoxFill = vga2568FillRectStippledUnnatural; - else - BoxFill = vga256LowlevFuncs.fillRectTransparentStippled32; - break; - case FillOpaqueStippled: - if (!pGC->pRotatedPixmap) - BoxFill = vga2568FillRectStippledUnnatural; - else - BoxFill = vga256LowlevFuncs.fillRectOpaqueStippled32; - break; -#endif - } - 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 = (*pGC->pScreen->RegionExtents)(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) - (*BoxFill) (pDrawable, pGC, - pboxClipped-pboxClippedBase, pboxClippedBase); - if (pboxClippedBase != stackRects) - DEALLOCATE_LOCAL(pboxClippedBase); -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgafillsp.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgafillsp.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgafillsp.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgafillsp.c:1.2 Sat Jul 25 12:58:18 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgafillsp.c Fri Jan 18 15:26:24 2002 @@ -1,796 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgafillsp.c,v 1.2 1998/07/25 16:58:18 dawes Exp $ */ -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or X Consortium -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and X Consortium make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgafillsp.c /main/4 1996/02/21 18:10:53 kaleb $ */ - -#include "vgafb.h" -#include "mergerop.h" - -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -#include "mispans.h" - -extern void mfbInvertSolidFS(), mfbBlackSolidFS(), mfbWhiteSolidFS(); - -/* scanline filling for color frame buffer - written by drewry, oct 1986 modified by smarks - changes for compatibility with Little-endian systems Jul 1987; MIT:yba. - - these routines all clip. they assume that anything that has called -them has already translated the points (i.e. pGC->miTranslate is -non-zero, which is howit gets set in cfbCreateGC().) - - the number of new scnalines created by clipping == -MaxRectsPerBand * nSpans. - - FillSolid is overloaded to be used for OpaqueStipple as well, -if fgPixel == bgPixel. -Note that for solids, PrivGC.rop == PrivGC.ropOpStip - - - FillTiled is overloaded to be used for OpaqueStipple, if -fgPixel != bgPixel. based on the fill style, it uses -{RotatedTile, gc.alu} or {RotatedStipple, PrivGC.ropOpStip} -*/ - -/* Fill spans with tiles that aren't 32 bits wide */ -void -vga256UnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) -DrawablePtr pDrawable; -GC *pGC; -int nInit; /* number of spans to fill */ -DDXPointPtr pptInit; /* pointer to list of start points */ -int *pwidthInit; /* pointer to list of n widths */ -int fSorted; -{ - int n; /* number of spans to fill */ - register DDXPointPtr ppt; /* pointer to list of start points */ - register int *pwidth; /* pointer to list of n widths */ - void (*fill)(); - int xrot, yrot; - - if (!(pGC->planemask)) - return; - - if (pGC->tile.pixmap->drawable.width & PIM) - { - fill = vga256FillSpanTileOddGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - if (pGC->alu == GXcopy) - fill = vga256FillSpanTileOddCopy; - } - } - else - { - fill = vga256FillSpanTile32sGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - if (pGC->alu == GXcopy) - fill = vga256FillSpanTile32sCopy; - } - } - n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); - if ( n == 0 ) - return; - pwidth = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - ppt = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); - if(!ppt || !pwidth) - { - if (ppt) DEALLOCATE_LOCAL(ppt); - if (pwidth) DEALLOCATE_LOCAL(pwidth); - return; - } - n = miClipSpans( cfbGetCompositeClip(pGC), - pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - xrot = pDrawable->x + pGC->patOrg.x; - yrot = pDrawable->y + pGC->patOrg.y; - - (*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask); - - DEALLOCATE_LOCAL(ppt); - DEALLOCATE_LOCAL(pwidth); -} - -void -vga256UnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) -DrawablePtr pDrawable; -GC *pGC; -int nInit; /* number of spans to fill */ -DDXPointPtr pptInit; /* pointer to list of start points */ -int *pwidthInit; /* pointer to list of n widths */ -int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidth; /* pointer to list of n widths */ - int *pwidthFree;/* copies of the pointers to free */ - DDXPointPtr pptFree; - unsigned long *pdstBase; /* pointer to start of bitmap */ - int nlwDst; /* width in longwords of bitmap */ - register unsigned long *pdst; /* pointer to current word in bitmap */ - PixmapPtr pStipple; /* pointer to stipple we want to fill with */ - int nlw; - int x, y, w, xrem, xSrc, ySrc; - int stwidth, stippleWidth; - int stippleHeight; - register unsigned long bits, inputBits; - register int partBitsLeft; - int nextPartBits; - int bitsLeft, bitsWhole; - unsigned long *srcTemp, *srcStart; - unsigned long *psrcBase; - unsigned long startmask, endmask; - - /* - * If nothing is going to actually touch the framebuffer, then - * do the work with the cfb routines as they should be slightly faster. - */ - - if( pDrawable->type != DRAWABLE_WINDOW ) - { - cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, - pwidthInit, fSorted); - return; - } - - if (pGC->fillStyle == FillStippled) - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - else - cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - - if (cfb8StippleRRop == GXnoop) - return; - - n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); - if ( n == 0 ) - return; - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); - return; - } - - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans( cfbGetCompositeClip(pGC), - pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - /* - * OK, so what's going on here? We have two Drawables: - * - * The Stipple: - * Depth = 1 - * Width = stippleWidth - * Words per scanline = stwidth - * Pointer to pixels = pStipple->devPrivate.ptr - */ - - pStipple = pGC->stipple; - - stwidth = pStipple->devKind >> PWSH; - stippleWidth = pStipple->drawable.width; - stippleHeight = pStipple->drawable.height; - psrcBase = (unsigned long *) pStipple->devPrivate.ptr; - - /* - * The Target: - * Depth = PSZ - * Width = determined from *pwidth - * Words per scanline = nlwDst - * Pointer to pixels = addrlBase - */ - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase) - - BANK_FLAG(pdstBase) - - /* this replaces rotating the stipple. Instead we just adjust the offset - * at which we start grabbing bits from the stipple. - * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, - * so that iline and xrem always stay within the stipple bounds. - */ - - modulus (pGC->patOrg.x, stippleWidth, xSrc); - xSrc += pDrawable->x - stippleWidth; - modulus (pGC->patOrg.y, stippleHeight, ySrc); - ySrc += pDrawable->y - stippleHeight; - - bitsWhole = stippleWidth; - - while (n--) - { - x = ppt->x; - y = ppt->y; - ppt++; - w = *pwidth++; - pdst = pdstBase + y * nlwDst + (x >> PWSH); - SETRW(pdst); - y = (y - ySrc) % stippleHeight; - srcStart = psrcBase + y * stwidth; - xrem = ((x & ~(PGSZB-1)) - xSrc) % stippleWidth; - srcTemp = srcStart + (xrem >> MFB_PWSH); - bitsLeft = stippleWidth - (xrem & ~MFB_PIM); - xrem &= MFB_PIM; - NextUnnaturalStippleWord - if (partBitsLeft < xrem) - FatalError ("vga256UnnaturalStippleFS bad partBitsLeft %d xrem %d", - partBitsLeft, xrem); - NextSomeBits (inputBits, xrem); - partBitsLeft -= xrem; - if (((x & PIM) + w) <= PPW) - { - maskpartialbits (x, w, startmask) - NextUnnaturalStippleBits - *pdst = MaskRRopPixels(*pdst,bits,startmask); - } - else - { - maskbits (x, w, startmask, endmask, nlw); - nextPartBits = (x & (PGSZB-1)) + w; - if (nextPartBits < partBitsLeft) - { - if (startmask) - { - MaskRRopBitGroup(pdst,GetBitGroup(inputBits),startmask) - pdst++; CHECKRWO(pdst); - NextBitGroup (inputBits); - } - while (nlw--) - { - RRopBitGroup (pdst, GetBitGroup (inputBits)); - pdst++; CHECKRWO(pdst); - NextBitGroup (inputBits); - } - if (endmask) - { - MaskRRopBitGroup(pdst,GetBitGroup(inputBits),endmask) - } - } - else if (bitsLeft != bitsWhole && nextPartBits < partBitsLeft + bitsLeft) - { - NextUnnaturalStippleBitsFast - if (startmask) - { - *pdst = MaskRRopPixels(*pdst,bits,startmask); - pdst++; CHECKRWO(pdst); - NextUnnaturalStippleBitsFast - } - while (nlw--) - { - *pdst = RRopPixels(*pdst,bits); - pdst++; CHECKRWO(pdst); - NextUnnaturalStippleBitsFast - } - if (endmask) - *pdst = MaskRRopPixels (*pdst,bits,endmask); - } - else - { - NextUnnaturalStippleBits - if (startmask) - { - *pdst = MaskRRopPixels(*pdst,bits,startmask); - pdst++; CHECKRWO(pdst); - NextUnnaturalStippleBits - } - while (nlw--) - { - *pdst = RRopPixels(*pdst,bits); - pdst++; CHECKRWO(pdst); - NextUnnaturalStippleBits - } - if (endmask) - *pdst = MaskRRopPixels(*pdst,bits,endmask); - } - } - } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); -} - -void -vga2568Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidth; /* pointer to list of n widths */ - unsigned long *src; /* pointer to bits in stipple, if needed */ - int stippleHeight; /* height of the stipple */ - PixmapPtr stipple; - - int nlwDst; /* width in longwords of the dest pixmap */ - int x,y,w; /* current span */ - unsigned long startmask; - unsigned long endmask; - register unsigned long *dst; /* pointer to bits we're writing */ - register int nlw; - unsigned long *dstTmp; - int nlwTmp; - - unsigned long *pbits; /* pointer to start of pixmap */ - register unsigned long xor; - register unsigned long mask; - register unsigned long bits; /* bits from stipple */ - int wEnd; - - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - cfbPrivGCPtr devPriv; - - /* - * If nothing is going to actually touch the framebuffer, then - * do the work with the cfb routines as they should be slightly faster. - */ - - if( pDrawable->type != DRAWABLE_WINDOW ) - { - cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - return; - } - - devPriv = cfbGetGCPrivate(pGC); - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - n = nInit * miFindMaxBand(pGC->pCompositeClip); - if ( n == 0 ) - return; - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - stipple = pGC->pRotatedPixmap; - src = (unsigned long *)stipple->devPrivate.ptr; - stippleHeight = stipple->drawable.height; - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - BANK_FLAG(pbits) - - while (n--) - { - w = *pwidth++; - x = ppt->x; - y = ppt->y; - ppt++; - dst = pbits + (y * nlwDst) + (x >> PWSH); - if (((x & PIM) + w) <= PPW) - { - maskpartialbits(x, w, startmask); - endmask = 0; - nlw = 0; - } - else - { - maskbits (x, w, startmask, endmask, nlw); - } - bits = src[y % stippleHeight]; - RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM))); -#if PPW == 4 - if (cfb8StippleRRop == GXcopy) - { - SETRW(dst); - xor = devPriv->xor; - if (w < (PGSZ*2)) - { - if (startmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dst = (*dst & ~(mask & startmask)) | - (xor & (mask & startmask)); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - while (nlw--) - { - WriteBitGroup (dst,xor,GetBitGroup(bits)) - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dst = (*dst & ~(mask & endmask)) | - (xor & (mask & endmask)); - } - } - else - { - wEnd = 7 - (nlw & 7); - nlw = (nlw >> 3) + 1; - dstTmp = dst; - nlwTmp = nlw; - if (startmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dstTmp = (*dstTmp & ~(mask & startmask)) | - (xor & (mask & startmask)); - dstTmp++; CHECKRWO(dstTmp); - RotBitsLeft (bits, PGSZB); - } - w = 7 - wEnd; - SAVE_BANK(); - while (w--) - { - dst = dstTmp; - RESTORE_BANK(); - SAVE_BANK(); - CHECKRWO(dst); - dstTmp++; - nlw = nlwTmp; - mask = cfb8PixelMasks[GetBitGroup(bits)]; - xor = xor & mask; - mask = ~mask; - while (nlw--) - { - *dst = (*dst & mask) | xor; - dst += 8; CHECKRWO(dst); - } - xor = devPriv->xor; - NextBitGroup (bits); - } - nlwTmp--; - w = wEnd + 1; - if (endmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - dst = dstTmp + (nlwTmp << 3); - RESTORE_BANK(); - SAVE_BANK(); - CHECKRWO(dst); - *dst = (*dst & ~(mask & endmask)) | - (xor & (mask & endmask)); - } - while (w--) - { - nlw = nlwTmp; - dst = dstTmp; - RESTORE_BANK(); - SAVE_BANK(); - CHECKRWO(dst); - dstTmp++; - mask = cfb8PixelMasks[GetBitGroup(bits)]; - xor = xor & mask; - mask = ~mask; - while (nlw--) - { - *dst = (*dst & mask) | xor; - dst += 8; CHECKRWO(dst); - } - xor = devPriv->xor; - NextBitGroup (bits); - } - } - } - else -#endif /* PPW == 4 */ - { - SETRW(dst); - if (startmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, startmask); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - while (nlw--) - { - RRopBitGroup(dst, GetBitGroup(bits)); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, endmask); - } - } - } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); -} - -void -vga2568OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidth; /* pointer to list of n widths */ - unsigned long *src; /* pointer to bits in stipple, if needed */ - int stippleHeight; /* height of the stipple */ - PixmapPtr stipple; - - int nlwDst; /* width in longwords of the dest pixmap */ - int x,y,w; /* current span */ - unsigned long startmask; - unsigned long endmask; - register unsigned long *dst; /* pointer to bits we're writing */ - register int nlw; - unsigned long *dstTmp; - int nlwTmp; - - unsigned long *pbits; /* pointer to start of pixmap */ - register unsigned long xor; - register unsigned long bits; /* bits from stipple */ - int wEnd; - - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - cfbPrivGCPtr devPriv; - - /* - * If nothing is going to actually touch the framebuffer, then - * do the work with the cfb routines as they should be slightly faster. - */ - - if( pDrawable->type != DRAWABLE_WINDOW ) - { - cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, - pwidthInit, fSorted); - return; - } - - devPriv = cfbGetGCPrivate(pGC); - - cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - if ( n == 0 ) - return; - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - stipple = pGC->pRotatedPixmap; - src = (unsigned long *)stipple->devPrivate.ptr; - stippleHeight = stipple->drawable.height; - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - BANK_FLAG(pbits) - - while (n--) - { - w = *pwidth++; - x = ppt->x; - y = ppt->y; - ppt++; - dst = pbits + (y * nlwDst) + (x >> PWSH); - if (((x & PIM) + w) <= PPW) - { - maskpartialbits(x, w, startmask); - endmask = 0; - nlw = 0; - } - else - { - maskbits (x, w, startmask, endmask, nlw); - } - bits = src[y % stippleHeight]; - RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM))); -#if PPW == 4 - if (cfb8StippleRRop == GXcopy) - { - SETRW(dst); - xor = devPriv->xor; - if (w < PGSZ*2) - { - if (startmask) - { - *dst = *dst & ~startmask | - GetPixelGroup (bits) & startmask; - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - while (nlw--) - { - *dst++ = GetPixelGroup(bits); - RotBitsLeft (bits, PGSZB); - CHECKRWO(dst); - } - if (endmask) - { - *dst = *dst & ~endmask | - GetPixelGroup (bits) & endmask; - } - } - else - { - wEnd = 7 - (nlw & 7); - nlw = (nlw >> 3) + 1; - dstTmp = dst; - nlwTmp = nlw; - if (startmask) - { - *dstTmp = *dstTmp & ~startmask | - GetPixelGroup (bits) & startmask; - dstTmp++; CHECKRWO(dstTmp); - RotBitsLeft (bits, PGSZB); - } - w = 7 - wEnd; - SAVE_BANK(); - while (w--) - { - nlw = nlwTmp; - dst = dstTmp; - RESTORE_BANK(); - SAVE_BANK(); - CHECKRWO(dst); - dstTmp++; - xor = GetPixelGroup (bits); - while (nlw--) - { - *dst = xor; - dst += 8; CHECKRWO(dst); - } - NextBitGroup (bits); - } - nlwTmp--; - w = wEnd + 1; - if (endmask) - { - dst = dstTmp + (nlwTmp << 3); - RESTORE_BANK(); - SAVE_BANK(); - CHECKRWO(dst); - *dst = (*dst & ~endmask) | - GetPixelGroup (bits) & endmask; - } - while (w--) - { - nlw = nlwTmp; - dst = dstTmp; - RESTORE_BANK(); - SAVE_BANK(); - CHECKRWO(dst); - dstTmp++; - xor = GetPixelGroup (bits); - while (nlw--) - { - *dst = xor; - dst += 8; CHECKRWO(dst); - } - NextBitGroup (bits); - } - } - } - else -#endif /* PPW == 4 */ - { - SETRW(dst); - if (startmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, startmask); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - while (nlw--) - { - RRopBitGroup(dst, GetBitGroup(bits)); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, endmask); - } - } - } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgagc.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgagc.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgagc.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgagc.c:1.2 Sat Jul 25 12:58:18 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgagc.c Fri Jan 18 15:26:24 2002 @@ -1,657 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgagc.c,v 1.2 1998/07/25 16:58:18 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgagc.c /main/6 1996/02/21 18:11:05 kaleb $ */ - -#include "vgafb.h" -#include "migc.h" - -void vga256ValidateGC(); - -static GCFuncs vga256Funcs = { - vga256ValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip, -}; - -GCOps vga256TEOps1Rect = { - vga256SolidSpansCopy, - vga256SetSpans, - cfbPutImage, - vga256CopyArea, - vga256CopyPlane, - vga256PolyPoint, - vga256LineSS, - vga256SegmentSS, - miPolyRectangle, - vga256ZeroPolyArcSS8Copy, - vga256FillPoly1RectCopy, - vga256PolyFillRect, - vga256PolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - vga256TEGlyphBlt8, - vga256PolyGlyphBlt8, - vga256PushPixels8, - NULL, -}; - -GCOps vga256TEOps = { - vga256SolidSpansCopy, - vga256SetSpans, - cfbPutImage, - vga256CopyArea, - vga256CopyPlane, - vga256PolyPoint, - vga256LineSS, - vga256SegmentSS, - miPolyRectangle, - vga256ZeroPolyArcSS8Copy, - miFillPolygon, - vga256PolyFillRect, - vga256PolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - vga256TEGlyphBlt8, - vga256PolyGlyphBlt8, - vga256PushPixels8, - NULL, -}; - -GCOps vga256NonTEOps1Rect = { - vga256SolidSpansCopy, - vga256SetSpans, - cfbPutImage, - vga256CopyArea, - vga256CopyPlane, - vga256PolyPoint, - vga256LineSS, - vga256SegmentSS, - miPolyRectangle, - vga256ZeroPolyArcSS8Copy, - vga256FillPoly1RectCopy, - vga256PolyFillRect, - vga256PolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - cfbImageGlyphBlt8, - vga256PolyGlyphBlt8, - vga256PushPixels8, - NULL, -}; - -GCOps vga256NonTEOps = { - vga256SolidSpansCopy, - vga256SetSpans, - cfbPutImage, - vga256CopyArea, - vga256CopyPlane, - vga256PolyPoint, - vga256LineSS, - vga256SegmentSS, - miPolyRectangle, - vga256ZeroPolyArcSS8Copy, - miFillPolygon, - vga256PolyFillRect, - vga256PolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - cfbImageGlyphBlt8, - vga256PolyGlyphBlt8, - vga256PushPixels8, - NULL, -}; - -GCOps * -vga256matchCommon (pGC, devPriv) - GCPtr pGC; - cfbPrivGCPtr devPriv; -{ - if (pGC->lineWidth != 0) - return 0; - if (pGC->lineStyle != LineSolid) - return 0; - if (pGC->fillStyle != FillSolid) - return 0; - if (devPriv->rop != GXcopy) - return 0; - if (pGC->font && - FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 && - FONTMINBOUNDS(pGC->font,characterWidth) >= 0) - { - - if (TERMINALFONT(pGC->font) - && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB - ) - if (devPriv->oneRect) - return &vga256TEOps1Rect; - else - return &vga256TEOps; - else - if (devPriv->oneRect) - return &vga256NonTEOps1Rect; - else - return &vga256NonTEOps; - } - return 0; -} - -Bool -vga256CreateGC(pGC) - register GCPtr pGC; -{ - cfbPrivGC *pPriv; - - switch (pGC->depth) { - case 1: - return (mfbCreateGC(pGC)); - case PSZ: - break; - default: - ErrorF("vga256CreateGC: unsupported depth: %d\n", pGC->depth); - return FALSE; - } - pGC->clientClip = NULL; - pGC->clientClipType = CT_NONE; - - /* - * some of the output primitives aren't really necessary, since they - * will be filled in ValidateGC because of dix/CreateGC() setting all - * the change bits. Others are necessary because although they depend - * on being a color frame buffer, they don't change - */ - - pGC->ops = &vga256NonTEOps; - pGC->funcs = &vga256Funcs; - - /* cfb wants to translate before scan conversion */ - pGC->miTranslate = 1; - - pPriv = (cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr); - pPriv->rop = pGC->alu; - pPriv->oneRect = FALSE; - pGC->fExpose = TRUE; - pGC->freeCompClip = FALSE; - pGC->pRotatedPixmap = (PixmapPtr) NULL; - return TRUE; -} - -/* Clipping conventions - if the drawable is a window - CT_REGION ==> pCompositeClip really is the composite - CT_other ==> pCompositeClip is the window clip region - if the drawable is a pixmap - CT_REGION ==> pCompositeClip is the translated client region - clipped to the pixmap boundary - CT_other ==> pCompositeClip is the pixmap bounding box -*/ - -void -vga256ValidateGC(pGC, changes, pDrawable) - register GCPtr pGC; - Mask changes; - DrawablePtr pDrawable; -{ - int mask; /* stateChanges */ - int index; /* used for stepping through bitfields */ - int new_rrop; - int new_line, new_text, new_fillspans, new_fillarea; - int new_rotate; - int xrot, yrot; - /* flags for changing the proc vector */ - cfbPrivGCPtr devPriv; - int oneRect; - - new_rotate = pGC->lastWinOrg.x != pDrawable->x || - pGC->lastWinOrg.y != pDrawable->y; - - pGC->lastWinOrg.x = pDrawable->x; - pGC->lastWinOrg.y = pDrawable->y; - devPriv = cfbGetGCPrivate(pGC); - - new_rrop = FALSE; - new_line = FALSE; - new_text = FALSE; - new_fillspans = FALSE; - new_fillarea = FALSE; - - /* - * if the client clip is different or moved OR the subwindowMode has - * changed OR the window's clip has changed since the last validation - * we need to recompute the composite clip - */ - - if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || - (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) - ) - { - miComputeCompositeClip (pGC, pDrawable); -#ifdef NO_ONE_RECT - devPriv->oneRect = FALSE; -#else - oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1; - if (oneRect != devPriv->oneRect) - new_line = TRUE; - devPriv->oneRect = oneRect; -#endif - } - - mask = changes; - while (mask) { - index = lowbit (mask); - mask &= ~index; - - /* - * this switch acculmulates a list of which procedures might have - * to change due to changes in the GC. in some cases (e.g. - * changing one 16 bit tile for another) we might not really need - * a change, but the code is being paranoid. this sort of batching - * wins if, for example, the alu and the font have been changed, - * or any other pair of items that both change the same thing. - */ - switch (index) { - case GCFunction: - case GCForeground: - new_rrop = TRUE; - break; - case GCPlaneMask: - new_rrop = TRUE; - new_text = TRUE; - break; - case GCBackground: - break; - case GCLineStyle: - case GCLineWidth: - new_line = TRUE; - break; - case GCJoinStyle: - case GCCapStyle: - break; - case GCFillStyle: - new_text = TRUE; - new_fillspans = TRUE; - new_line = TRUE; - new_fillarea = TRUE; - break; - case GCFillRule: - break; - case GCTile: - new_fillspans = TRUE; - new_fillarea = TRUE; - break; - - case GCStipple: - if (pGC->stipple) - { - int width = pGC->stipple->drawable.width; - PixmapPtr nstipple; - - if ((width <= PGSZ) && !(width & (width - 1)) && - (nstipple = cfbCopyPixmap(pGC->stipple))) - { - cfbPadPixmap(nstipple); - (*pGC->pScreen->DestroyPixmap)(pGC->stipple); - pGC->stipple = nstipple; - } - } - new_fillspans = TRUE; - new_fillarea = TRUE; - break; - - case GCTileStipXOrigin: - new_rotate = TRUE; - break; - - case GCTileStipYOrigin: - new_rotate = TRUE; - break; - - case GCFont: - new_text = TRUE; - break; - case GCSubwindowMode: - break; - case GCGraphicsExposures: - break; - case GCClipXOrigin: - break; - case GCClipYOrigin: - break; - case GCClipMask: - break; - case GCDashOffset: - break; - case GCDashList: - break; - case GCArcMode: - break; - default: - break; - } - } - - /* - * If the drawable has changed, check its depth & ensure suitable - * entries are in the proc vector. - */ - if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) { - new_fillspans = TRUE; /* deal with FillSpans later */ - } - - if (new_rotate || new_fillspans) - { - Bool new_pix = FALSE; - - xrot = pGC->patOrg.x + pDrawable->x; - yrot = pGC->patOrg.y + pDrawable->y; - - switch (pGC->fillStyle) - { - case FillTiled: - if (!pGC->tileIsPixel) - { - int width = pGC->tile.pixmap->drawable.width * PSZ; - - if ((width <= PGSZ) && !(width & (width - 1))) - { - cfbCopyRotatePixmap(pGC->tile.pixmap, - &pGC->pRotatedPixmap, - xrot, yrot); - new_pix = TRUE; - } - } - break; - case FillStippled: - case FillOpaqueStippled: - { - int width = pGC->stipple->drawable.width; - - if ((width <= PGSZ) && !(width & (width - 1))) - { - mfbCopyRotatePixmap(pGC->stipple, - &pGC->pRotatedPixmap, xrot, yrot); - new_pix = TRUE; - } - } - break; - } - if (!new_pix && pGC->pRotatedPixmap) - { - (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap); - pGC->pRotatedPixmap = (PixmapPtr) NULL; - } - } - - if (new_rrop) - { - int old_rrop; - - old_rrop = devPriv->rop; - devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel, - pGC->planemask, - &devPriv->and, &devPriv->xor); - if (old_rrop == devPriv->rop) - new_rrop = FALSE; - else - { - new_line = TRUE; - new_text = TRUE; - new_fillspans = TRUE; - new_fillarea = TRUE; - } - } - - if (new_rrop || new_fillspans || new_text || new_fillarea || new_line) - { - GCOps *newops; - - if (newops = vga256matchCommon (pGC, devPriv)) - { - if (pGC->ops->devPrivate.val) - miDestroyGCOps (pGC->ops); - pGC->ops = newops; - new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0; - } - else - { - if (!pGC->ops->devPrivate.val) - { - pGC->ops = miCreateGCOps (pGC->ops); - pGC->ops->devPrivate.val = 1; - } - } - } - - /* deal with the changes we've collected */ - if (new_line) - { - pGC->ops->FillPolygon = miFillPolygon; - if (devPriv->oneRect && pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillPolygon = vga256FillPoly1RectCopy; - break; - default: - pGC->ops->FillPolygon = vga256FillPoly1RectGeneral; - break; - } - } - if (pGC->lineWidth == 0) - { -#ifdef PIXEL_ADDR - if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)) - { - switch (devPriv->rop) - { - case GXxor: - pGC->ops->PolyArc = vga256ZeroPolyArcSS8Xor; - break; - case GXcopy: - pGC->ops->PolyArc = vga256ZeroPolyArcSS8Copy; - break; - default: - pGC->ops->PolyArc = vga256ZeroPolyArcSS8General; - break; - } - } - else -#endif - pGC->ops->PolyArc = miZeroPolyArc; - } - else - pGC->ops->PolyArc = miPolyArc; - pGC->ops->PolySegment = miPolySegment; - switch (pGC->lineStyle) - { - case LineSolid: - if(pGC->lineWidth == 0) - { - if (pGC->fillStyle == FillSolid) - { - pGC->ops->Polylines = vga256LowlevFuncs.lineSS; - pGC->ops->PolySegment = vga256LowlevFuncs.segmentSS; - } - else - pGC->ops->Polylines = miZeroLine; - } - else - pGC->ops->Polylines = miWideLine; - break; - case LineOnOffDash: - case LineDoubleDash: - if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) - { - pGC->ops->Polylines = vga256LineSD; - pGC->ops->PolySegment = vga256SegmentSD; - } else - pGC->ops->Polylines = miWideDash; - break; - } - } - - if (new_text && (pGC->font)) - { - if (FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || - FONTMINBOUNDS(pGC->font,characterWidth) < 0) - { - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - else - { - if (pGC->fillStyle == FillSolid) - { - if (devPriv->rop == GXcopy) - pGC->ops->PolyGlyphBlt = vga256PolyGlyphBlt8; - else - pGC->ops->PolyGlyphBlt = vga256PolyGlyphRop8; - } - else - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - /* special case ImageGlyphBlt for terminal emulator fonts */ - if (TERMINALFONT(pGC->font) && - (pGC->planemask & PMSK) == PMSK - && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB - ) - { - pGC->ops->ImageGlyphBlt = vga256LowlevFuncs.teGlyphBlt8; - } - else - { - if (devPriv->rop == GXcopy && - pGC->fillStyle == FillSolid && - (pGC->planemask & PMSK) == PMSK) - pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8; - else - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - } - } - - - if (new_fillspans) { - switch (pGC->fillStyle) { - case FillSolid: - if (vga256LowlevFuncs.fillSolidSpans != vga256SolidSpansGeneral) { - pGC->ops->FillSpans = vga256LowlevFuncs.fillSolidSpans; - break; - } - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillSpans = vga256SolidSpansCopy; - break; - case GXxor: - pGC->ops->FillSpans = vga256SolidSpansXor; - break; - default: - pGC->ops->FillSpans = vga256SolidSpansGeneral; - break; - } - break; - case FillTiled: - if (pGC->pRotatedPixmap) - { - if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) - pGC->ops->FillSpans = vga256Tile32FSCopy; - else - pGC->ops->FillSpans = vga256Tile32FSGeneral; - } - else - pGC->ops->FillSpans = vga256UnnaturalTileFS; - break; - case FillStippled: - if (pGC->pRotatedPixmap) - pGC->ops->FillSpans = vga2568Stipple32FS; - else - pGC->ops->FillSpans = vga256UnnaturalStippleFS; - break; - case FillOpaqueStippled: - if (pGC->pRotatedPixmap) - pGC->ops->FillSpans = vga2568OpaqueStipple32FS; - else - pGC->ops->FillSpans = vga256UnnaturalStippleFS; - break; - default: - FatalError("vga256ValidateGC: illegal fillStyle\n"); - } - } /* end of new_fillspans */ - - if (new_fillarea) { - pGC->ops->PushPixels = mfbPushPixels; - if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy) - pGC->ops->PushPixels = vga256PushPixels8; - pGC->ops->PolyFillArc = miPolyFillArc; - if (pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) - { - case GXcopy: - pGC->ops->PolyFillArc = vga256PolyFillArcSolidCopy; - break; - default: - pGC->ops->PolyFillArc = vga256PolyFillArcSolidGeneral; - break; - } - } - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgagetsp.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgagetsp.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgagetsp.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgagetsp.c:1.2 Sat Jul 25 12:58:19 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgagetsp.c Fri Jan 18 15:26:24 2002 @@ -1,169 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgagetsp.c,v 1.2 1998/07/25 16:58:19 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgagetsp.c /main/3 1996/02/21 18:11:09 kaleb $ */ - -#include "vgafb.h" - -/* GetSpans -- for each span, gets bits from drawable starting at ppt[i] - * and continuing for pwidth[i] bits - * Each scanline returned will be server scanline padded, i.e., it will come - * out to an integral number of words. - */ -void -vga256GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) - DrawablePtr pDrawable; /* drawable from which to get bits */ - int wMax; /* largest value of all *pwidths */ - register DDXPointPtr ppt; /* points to start copying from */ - int *pwidth; /* list of number of bits to copy */ - int nspans; /* number of scanlines to copy */ - char *pchardstStart; /* where to put the bits */ -{ - PixelGroup *pdstStart = (PixelGroup *)pchardstStart; - register PixelGroup *pdst; /* where to put the bits */ - register PixelGroup *psrc; /* where to get the bits */ - register PixelGroup tmpSrc; /* scratch buffer for bits */ - PixelGroup *psrcBase; /* start of src bitmap */ - int widthSrc; /* width of pixmap in bytes */ - register DDXPointPtr pptLast; /* one past last point to get */ - int xEnd; /* last pixel to copy from */ - register int nstart; - int nend; - PixelGroup startmask, endmask; - int nlMiddle, nl, srcBit; - int w; - PixelGroup *pdstNext; - - /* - * If nothing is going to actually touch the framebuffer, then - * do the work with the cfb routines as they should be slightly faster. - */ - - if( pDrawable->type != DRAWABLE_WINDOW ) - { - cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart); - return; - } - - switch (pDrawable->bitsPerPixel) { - case 1: - mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart); - return; - case PSZ: - break; - default: - FatalError("cfbGetSpans: invalid depth\n"); - } - - - cfbGetLongWidthAndPointer (pDrawable, widthSrc, psrcBase) - - BANK_FLAG(psrcBase) - -#ifdef PIXEL_ADDR - if ((nspans == 1) && (*pwidth == 1)) - { - psrc = ((PixelGroup *)(psrcBase + (ppt->y * widthSrc)) + ppt->x); - SETRW(psrc); - tmpSrc = *psrc; -#if BITMAP_BIT_ORDER == MSBFirst - tmpSrc <<= (sizeof (unsigned long) - sizeof (PixelType)) * 8; -#endif - *pdstStart = tmpSrc; - return; - } -#endif - pdst = pdstStart; - pptLast = ppt + nspans; - while(ppt < pptLast) - { - xEnd = min(ppt->x + *pwidth, widthSrc << PWSH); - psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH); - SETRW(psrc); - w = xEnd - ppt->x; - srcBit = ppt->x & PIM; - pdstNext = pdst + ((w + PPW - 1) >> PWSH); - - if (srcBit + w <= PPW) - { - getbits(psrc, srcBit, w, tmpSrc); - putbits(tmpSrc, 0, w, pdst, ~((unsigned long)0)); - pdst++; - } - else - { - maskbits(ppt->x, w, startmask, endmask, nlMiddle); - nstart = 0; - if (startmask) - { - nstart = PPW - srcBit; - getbits(psrc, srcBit, nstart, tmpSrc); - putbits(tmpSrc, 0, nstart, pdst, ~((unsigned long)0)); - if(srcBit + nstart >= PPW) - {psrc++;CHECKRWO(psrc);} - } - nl = nlMiddle; - while (nl--) - { - tmpSrc = *psrc; - putbits(tmpSrc, nstart, PPW, pdst, ~((unsigned long)0)); - psrc++;CHECKRWO(psrc); - pdst++; - } - if (endmask) - { - nend = xEnd & PIM; - getbits(psrc, 0, nend, tmpSrc); - putbits(tmpSrc, nstart, nend, pdst, ~((unsigned long)0)); - } - pdst = pdstNext; - } - ppt++; - pwidth++; - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgaglblt8.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgaglblt8.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgaglblt8.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgaglblt8.c:1.2 Sat Jul 25 12:58:19 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgaglblt8.c Fri Jan 18 15:26:24 2002 @@ -1,422 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgaglblt8.c,v 1.2 1998/07/25 16:58:19 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. -*/ -/* $XConsortium: vgaglblt8.c /main/3 1996/02/21 18:11:13 kaleb $ */ - -/* - * Poly glyph blt for 8 bit displays. Accepts - * an arbitrary font <= 32 bits wide, in Copy mode only. - */ - -#include "vgafb.h" - -#define BOX_OVERLAP(box1, box2, xoffset, yoffset) \ - ((box1)->x1 <= ((int) (box2)->x2 + (xoffset)) && \ - ((int) (box2)->x1 + (xoffset)) <= (box1)->x2 && \ - (box1)->y1 <= ((int) (box2)->y2 + (yoffset)) && \ - ((int) (box2)->y1 + (yoffset)) <= (box1)->y2) - -#define BOX_CONTAINS(box1, box2, xoffset, yoffset) \ - ((box1)->x1 <= ((int) (box2)->x1 + (xoffset)) && \ - ((int) (box2)->x2 + (xoffset)) <= (box1)->x2 && \ - (box1)->y1 <= ((int) (box2)->y1 + (yoffset)) && \ - ((int) (box2)->y2 + (yoffset)) <= (box1)->y2) - -#if GLYPHPADBYTES != 4 -#define USE_LEFTBITS -#endif - -#ifdef USE_LEFTBITS -typedef unsigned char *glyphPointer; -extern unsigned long endtab[]; - -#define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \ - (dst) &= widthMask; \ - (bits) += widthGlyph; -#define GlyphBitsS(bits,width,dst,off) GlyphBits(bits,width,dst); \ - dst = BitRight (dst, off); -#else -typedef CARD32 *glyphPointer; - -#define GlyphBits(bits,width,dst) dst = *bits++; -#define GlyphBitsS(bits,width,dst,off) dst = BitRight(*bits++, off); -#endif - -#ifdef GLYPHROP -#define vga256PolyGlyphBlt8 vga256PolyGlyphRop8 -#define vga256PolyGlyphBlt8Clipped vga256PolyGlyphRop8Clipped - -#undef WriteBitGroup -#define WriteBitGroup(dst,pixel,bits) RRopBitGroup(dst,bits) - -#endif - -static void vga256PolyGlyphBlt8Clipped(); - -#if defined(HAS_STIPPLE_CODE) && !defined(GLYPHROP) && !defined(USE_LEFTBITS) -#define USE_STIPPLE_CODE -#endif - -#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && !defined(USE_LEFTBITS) -#include <stip68kgnu.h> -#endif - -#if PSZ == 24 -#define DST_INC 3 -#else -#define DST_INC (PGSZB >> PWSH) -#endif - -void -vga256PolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - pointer pglyphBase; /* start of array of glyphs */ -{ - register unsigned long c; -#ifndef GLYPHROP - register unsigned long pixel; -#endif - register unsigned long *dst; - register glyphPointer glyphBits; - register int xoff; - - FontPtr pfont = pGC->font; - CharInfoPtr pci; - unsigned long *dstLine; - unsigned long *pdstBase; - int hTmp; - int bwidthDst; - int widthDst; - int h; - BoxRec bbox; /* for clipping */ - int w; - RegionPtr clip; - BoxPtr extents; -#ifdef USE_LEFTBITS - int widthGlyph; - unsigned long widthMask; -#endif -#ifndef STIPPLE -#ifdef USE_STIPPLE_CODE - void (*stipple)(); - extern void stipplestack (), stipplestackte (); - - stipple = stipplestack; - if (FONTCONSTMETRICS(pfont)) - stipple = stipplestackte; -#endif -#endif - - x += pDrawable->x; - y += pDrawable->y; - - /* compute an approximate (but covering) bounding box */ - bbox.x1 = 0; - if ((ppci[0]->metrics.leftSideBearing < 0)) - bbox.x1 = ppci[0]->metrics.leftSideBearing; - h = nglyph - 1; - w = ppci[h]->metrics.rightSideBearing; - while (--h >= 0) - w += ppci[h]->metrics.characterWidth; - bbox.x2 = w; - bbox.y1 = -FONTMAXBOUNDS(pfont,ascent); - bbox.y2 = FONTMAXBOUNDS(pfont,descent); - - clip = cfbGetCompositeClip(pGC); - extents = &clip->extents; - - if (!clip->data) - { - if (!BOX_CONTAINS(extents, &bbox, x, y)) - { - if (BOX_OVERLAP (extents, &bbox, x, y)) - vga256PolyGlyphBlt8Clipped(pDrawable, pGC, x, y, - nglyph, ppci, pglyphBase); - return; - } - } - else - { - /* check to make sure some of the text appears on the screen */ - if (!BOX_OVERLAP (extents, &bbox, x, y)) - return; - - bbox.x1 += x; - bbox.x2 += x; - bbox.y1 += y; - bbox.y2 += y; - - switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox)) - { - case rgnPART: - vga256PolyGlyphBlt8Clipped(pDrawable, pGC, x, y, - nglyph, ppci, pglyphBase); - case rgnOUT: - return; - } - } - -#ifdef GLYPHROP - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); -#else - pixel = cfbGetGCPrivate(pGC)->xor; -#endif - - cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long) - - BANK_FLAG(pdstBase) - - widthDst = bwidthDst / PGSZB; - while (nglyph--) - { - pci = *ppci++; - glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci); - xoff = x + pci->metrics.leftSideBearing; - dstLine = pdstBase + - (y - pci->metrics.ascent) * widthDst + (xoff >> PWSH); - x += pci->metrics.characterWidth; - if (hTmp = pci->metrics.descent + pci->metrics.ascent) - { - xoff &= PIM; -#ifdef STIPPLE - STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); -#else -#ifdef USE_STIPPLE_CODE - (*stipple)(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); -#else -#ifdef USE_LEFTBITS - widthGlyph = GLYPHWIDTHBYTESPADDED (pci); - widthMask = endtab[w]; -#endif - do { - dst = dstLine; SETRW(dst); - dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); - GlyphBits(glyphBits, w, c) - WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); - dst+= DST_INC; CHECKRWO(dst); - c = BitLeft(c,PGSZB-xoff); - while (c) - { - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst+=DST_INC; CHECKRWO(dst); - } - } while (--hTmp); -#endif /* USE_STIPPLE_CODE else */ -#endif /* STIPPLE else */ - } - } -} - -static void -vga256PolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - unsigned char *pglyphBase; /* start of array of glyphs */ -{ - register unsigned long c; -#ifndef GLYPHROP - register unsigned long pixel; -#endif - register unsigned long *dst; - register glyphPointer glyphBits; - register int xoff; - - CharInfoPtr pci; - FontPtr pfont = pGC->font; - unsigned long *dstLine; - unsigned long *pdstBase; - CARD32 *clips; - int maxAscent, maxDescent; - int minLeftBearing; - int hTmp; - int widthDst; - int bwidthDst; - int xG, yG; - BoxPtr pBox; - int numRects; - int w; - RegionPtr pRegion; - int yBand; -#ifdef GLYPHROP - unsigned long bits; -#endif -#ifdef USE_LEFTBITS - CARD32 *cTmp; - int widthGlyph; - unsigned long widthMask; -#endif - -#ifdef GLYPHROP - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); -#else - pixel = cfbGetGCPrivate(pGC)->xor; -#endif - - cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long) - - BANK_FLAG(pdstBase) - - widthDst = bwidthDst / PGSZB; - maxAscent = FONTMAXBOUNDS(pfont,ascent); - maxDescent = FONTMAXBOUNDS(pfont,descent); - minLeftBearing = FONTMINBOUNDS(pfont,leftSideBearing); - - pRegion = cfbGetCompositeClip(pGC); - - pBox = REGION_RECTS(pRegion); - numRects = REGION_NUM_RECTS (pRegion); - while (numRects && pBox->y2 <= y - maxAscent) - { - ++pBox; - --numRects; - } - if (!numRects || pBox->y1 >= y + maxDescent) - return; - yBand = pBox->y1; - while (numRects && pBox->y1 == yBand && pBox->x2 <= x + minLeftBearing) - { - ++pBox; - --numRects; - } - if (!numRects) - return; - clips = (CARD32 *)ALLOCATE_LOCAL ((maxAscent + maxDescent) * - sizeof (CARD32)); - while (nglyph--) - { - pci = *ppci++; - glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci); - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - xG = x + pci->metrics.leftSideBearing; - yG = y - pci->metrics.ascent; - x += pci->metrics.characterWidth; - if (hTmp = pci->metrics.descent + pci->metrics.ascent) - { - dstLine = pdstBase + yG * widthDst + (xG >> PWSH); - xoff = xG & PIM; -#ifdef USE_LEFTBITS - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - widthGlyph = PADGLYPHWIDTHBYTES(w); - widthMask = endtab[w]; -#endif - switch (cfb8ComputeClipMasks32 (pBox, numRects, xG, yG, w, hTmp, clips)) - { - case rgnPART: -#ifdef USE_LEFTBITS - cTmp = clips; - do { - dst = dstLine; SETRW(dst); - dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); - GlyphBits(glyphBits, w, c) - c &= *cTmp++; - if (c) - { - WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); - c = BitLeft(c,PGSZB - xoff); - dst+=DST_INC; CHECKRWO(dst); - while (c) - { - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst+=DST_INC; CHECKRWO(dst); - } - } - } while (--hTmp); - break; -#else - { - int h; - - h = hTmp; - do - { - --h; - clips[h] = clips[h] & glyphBits[h]; - } while (h); - } - glyphBits = clips; - /* fall through */ -#endif - case rgnIN: -#ifdef STIPPLE - STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); -#else -#ifdef USE_STIPPLE_CODE - stipplestackte(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); -#else - do { - dst = dstLine; SETRW(dst); - dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); - GlyphBits(glyphBits, w, c) - if (c) - { - /* This code originally could read memory locations - * that were not mapped. Hence we have to check the - * trailing bits to see whether they are zero and if - * then skip them correctly. This is no problem for - * the GXcopy case, since there only the pixels that - * are non-zero are written ... - */ -#ifndef GLYPHROP - WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); - c = BitLeft(c,PGSZB - xoff); - dst+=DST_INC; CHECKRWO(dst); -#else /* GLYPHROP */ - if (bits = GetBitGroup(BitRight(c,xoff))) - WriteBitGroup(dst, pixel, bits); - c = BitLeft(c,PGSZB - xoff); - dst+=DST_INC; CHECKRWO(dst); - - while (c && ((bits = GetBitGroup(c)) == 0)) - { - NextBitGroup(c); - dst+=DST_INC; CHECKRWO(dst); - } -#endif /* GLYPHROP */ - while (c) - { - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst+=DST_INC; CHECKRWO(dst); - } - } - } while (--hTmp); -#endif /* USE_STIPPLE_CODE else */ -#endif /* STIPPLE else */ - break; - } - } - } - DEALLOCATE_LOCAL (clips); -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgaimage.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgaimage.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgaimage.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgaimage.c:1.2 Sat Jul 25 12:58:20 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgaimage.c Fri Jan 18 15:26:24 2002 @@ -1,115 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgaimage.c,v 1.2 1998/07/25 16:58:20 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgaimage.c /main/3 1996/02/21 18:11:16 kaleb $ */ - -#include "vgafb.h" - -void -vga256GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine) - DrawablePtr pDrawable; - int sx, sy, w, h; - unsigned int format; - unsigned long planeMask; - char *pdstLine; -{ - BoxRec box; - DDXPointRec ptSrc; - RegionRec rgnDst; - ScreenPtr pScreen; - PixmapPtr pPixmap; - - if ((w == 0) || (h == 0)) - return; - if (pDrawable->bitsPerPixel == 1) - { - mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - return; - } - pScreen = pDrawable->pScreen; - if (format == ZPixmap) - { - pPixmap = GetScratchPixmapHeader(pScreen, w, h, - pDrawable->depth, pDrawable->bitsPerPixel, - PixmapBytePad(w,pDrawable->depth), (pointer)pdstLine); - if (!pPixmap) - return; - if ((planeMask & PMSK) != PMSK) - xf86memset((char *)pdstLine,0, pPixmap->devKind * h); - ptSrc.x = sx + pDrawable->x; - ptSrc.y = sy + pDrawable->y; - box.x1 = 0; - box.y1 = 0; - box.x2 = w; - box.y2 = h; - REGION_INIT(pScreen, &rgnDst, &box, 1); - vga256DoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, - &ptSrc, planeMask); - REGION_UNINIT(pScreen, &rgnDst); - FreeScratchPixmapHeader(pPixmap); - } - else - { - pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1, - /*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine); - if (!pPixmap) - return; - - ptSrc.x = sx + pDrawable->x; - ptSrc.y = sy + pDrawable->y; - box.x1 = 0; - box.y1 = 0; - box.x2 = w; - box.y2 = h; - REGION_INIT(pScreen, &rgnDst, &box, 1); - vga256CopyImagePlane (pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, - &ptSrc, planeMask); - REGION_UNINIT(pScreen, &rgnDst); - FreeScratchPixmapHeader(pPixmap); - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgaline.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgaline.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgaline.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgaline.c:1.2 Sat Jul 25 12:58:20 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgaline.c Fri Jan 18 15:26:24 2002 @@ -1,492 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgaline.c,v 1.2 1998/07/25 16:58:20 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgaline.c /main/7 1996/02/21 18:11:20 kaleb $ */ - -#include "vgafb.h" -#include "miline.h" -#if 0 -#include "xf86.h" /* for xf86VTSema */ -#else -extern Bool xf86VTSema; -#endif - -extern Bool vgaUseLinearAddressing; -extern pointer vgaLinearBase; - -void -#ifdef POLYSEGMENT -#ifdef SPEEDUP -speedupvga256SegmentSS (pDrawable, pGC, nseg, pSeg) -#else -vga256SegmentSS (pDrawable, pGC, nseg, pSeg) -#endif - DrawablePtr pDrawable; - GCPtr pGC; - int nseg; - register xSegment *pSeg; -#else -#ifdef SPEEDUP -speedupvga256LineSS (pDrawable, pGC, mode, npt, pptInit) -#else -vga256LineSS (pDrawable, pGC, mode, npt, pptInit) -#endif - DrawablePtr pDrawable; - GCPtr pGC; - int mode; /* Origin or Previous */ - int npt; /* number of points */ - DDXPointPtr pptInit; -#endif -{ - int nboxInit; - register int nbox; - BoxPtr pboxInit; - register BoxPtr pbox; -#ifndef POLYSEGMENT - register DDXPointPtr ppt; /* pointer to list of translated points */ -#endif - - unsigned int oc1; /* outcode of point 1 */ - unsigned int oc2; /* outcode of point 2 */ - - unsigned long *addrl; /* address of destination pixmap */ - int nlwidth; /* width in longwords of destination pixmap */ - int xorg, yorg; /* origin of window */ - - int adx; /* abs values of dx and dy */ - int ady; - int signdx; /* sign of dx and dy */ - int signdy; - int e, e1, e2; /* bresenham error and increments */ - int len; /* length of segment */ - int axis; /* major axis */ - int octant; - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - - /* a bunch of temporaries */ - int tmp; - register int y1, y2; - register int x1, x2; - RegionPtr cclip; - cfbPrivGCPtr devPriv; - unsigned long xor, and; - int alu; - - /* - * The following check does NOT work when writing to the - * virtualized screen when VT-switched away. - * The current inconsistent behaviour is to use cfb for off-screen - * pixmaps, the fastvga256 routines for on-screen lines, and the - * fastvga256 routines also for the off-screen pixmap of the - * virtualized screen when VT-switched away. - * If SPEEDUP is defined, which would apply to ET4000, the speedup - * routines are always used. - */ -#ifndef SPEEDUP - if( pDrawable->type != DRAWABLE_WINDOW ) - { -#ifdef POLYSEGMENT - cfbSegmentSS(pDrawable, pGC, nseg, pSeg); -#else - cfbLineSS(pDrawable, pGC, mode, npt, pptInit); -#endif - return; - } -#endif - - devPriv = cfbGetGCPrivate(pGC); - cclip = pGC->pCompositeClip; - pboxInit = REGION_RECTS(cclip); - nboxInit = REGION_NUM_RECTS(cclip); - - cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl) - - /* - * This is a temporary hack to really use the non-bankchecking routines - * in the fXF86 functions if linear addressing is enabled. - */ - if (vgaUseLinearAddressing && xf86VTSema) - addrl = (unsigned long*)((unsigned char *)vgaLinearBase + - (unsigned long)((unsigned char *)addrl - (unsigned long)VGABASE)); - - BANK_FLAG(addrl) - - alu = devPriv->rop; - xor = devPriv->xor; - and = devPriv->and; - xorg = pDrawable->x; - yorg = pDrawable->y; -#ifdef POLYSEGMENT - while (nseg--) -#else - ppt = pptInit; - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; - while(--npt) -#endif - { - nbox = nboxInit; - pbox = pboxInit; - -#ifdef POLYSEGMENT - x1 = pSeg->x1 + xorg; - y1 = pSeg->y1 + yorg; - x2 = pSeg->x2 + xorg; - y2 = pSeg->y2 + yorg; - pSeg++; -#else - x1 = x2; - y1 = y2; - ++ppt; - if (mode == CoordModePrevious) - { - xorg = x1; - yorg = y1; - } - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; -#endif - - if (x1 == x2) - { - /* make the line go top to bottom of screen, keeping - endpoint semantics - */ - if (y1 > y2) - { - register int tmp; - - tmp = y2; - y2 = y1 + 1; - y1 = tmp + 1; -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - y1--; -#endif - } -#ifdef POLYSEGMENT - else if (pGC->capStyle != CapNotLast) - y2++; -#endif - /* get to first band that might contain part of line */ - while ((nbox) && (pbox->y2 <= y1)) - { - pbox++; - nbox--; - } - - if (nbox) - { - /* stop when lower edge of box is beyond end of line */ - while((nbox) && (y2 >= pbox->y1)) - { - if ((x1 >= pbox->x1) && (x1 < pbox->x2)) - { - int y1t; - /* this box has part of the line in it */ - y1t = max(y1, pbox->y1); - len = min(y2, pbox->y2) - y1t; - -#ifdef SPEEDUP -if (alu == GXcopy) - SpeedUpVLine((unsigned char*)(addrl+y1t*nlwidth) + x1, xor, len, - nlwidth << 2); -else -#endif - - if (len != 0) - { - fastvga256VertS (alu, and, xor, - addrl, nlwidth, - x1, y1t, len); - } - } - nbox--; - pbox++; - } - } -#ifndef POLYSEGMENT - y2 = ppt->y + yorg; -#endif - } - else if (y1 == y2) - { - /* force line from left to right, keeping - endpoint semantics - */ - if (x1 > x2) - { - register int tmp; - - tmp = x2; - x2 = x1 + 1; - x1 = tmp + 1; -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - x1--; -#endif - } -#ifdef POLYSEGMENT - else if (pGC->capStyle != CapNotLast) - x2++; -#endif - - /* find the correct band */ - while( (nbox) && (pbox->y2 <= y1)) - { - pbox++; - nbox--; - } - - /* try to draw the line, if we haven't gone beyond it */ - if ((nbox) && (pbox->y1 <= y1)) - { - /* when we leave this band, we're done */ - tmp = pbox->y1; - while((nbox) && (pbox->y1 == tmp)) - { - int x1t; - - if (pbox->x2 <= x1) - { - /* skip boxes until one might contain start point */ - nbox--; - pbox++; - continue; - } - - /* stop if left of box is beyond right of line */ - if (pbox->x1 >= x2) - { - nbox = 0; - break; - } - - x1t = max(x1, pbox->x1); - len = min(x2, pbox->x2) - x1t; - -#ifdef SPEEDUP -if (alu == GXcopy) - SpeedUpHLine((unsigned char*)(addrl+y1*nlwidth) + x1t, xor, len, - nlwidth << 2); -else -#endif - - if (len != 0) - { - fastvga256HorzS (alu, and, xor, - addrl, nlwidth, - x1t, y1, len); - } - nbox--; - pbox++; - } - } -#ifndef POLYSEGMENT - x2 = ppt->x + xorg; -#endif - } - else /* sloped line */ - { - CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, - 1, 1, octant); - - if (adx > ady) - { - axis = X_AXIS; - e1 = ady << 1; - e2 = e1 - (adx << 1); - e = e1 - adx; - } - else - { - axis = Y_AXIS; - e1 = adx << 1; - e2 = e1 - (ady << 1); - e = e1 - ady; - SetYMajorOctant(octant); - } - - FIXUP_ERROR(e, octant, bias); - - /* we have bresenham parameters and two points. - all we have to do now is clip and draw. - */ - - while(nbox--) - { - oc1 = 0; - oc2 = 0; - OUTCODES(oc1, x1, y1, pbox); - OUTCODES(oc2, x2, y2, pbox); - if ((oc1 | oc2) == 0) - { - if (axis == X_AXIS) - len = adx; - else - len = ady; -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - len++; -#endif -#ifdef SPEEDUP - SpeedUpBresS (alu, and, xor, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, - e, e1, e2, len); -#else - fastvga256BresS (alu, and, xor, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, - e, e1, e2, len); -#endif - break; - } - else if (oc1 & oc2) - { - pbox++; - } - else - { - int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; - int clip1 = 0, clip2 = 0; - int clipdx, clipdy; - int err; - - if (miZeroClipLine (pbox->x1, pbox->y1, pbox->x2-1, - pbox->y2-1, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, &clip1, &clip2, - octant, bias, oc1, oc2) == -1) - { - pbox++; - continue; - } - if (axis == X_AXIS) - len = abs(new_x2 - new_x1); - else - len = abs(new_y2 - new_y1); - -#ifdef POLYSEGMENT - if (clip2 != 0 || pGC->capStyle != CapNotLast) - len++; -#else - len += (clip2 != 0); -#endif - if (len) - { - /* unwind bresenham error term to first point */ - if (clip1) - { - clipdx = abs(new_x1 - x1); - clipdy = abs(new_y1 - y1); - if (axis == X_AXIS) - err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); - else - err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); - } - else - err = e; -#ifdef SPEEDUP - SpeedUpBresS - (alu, and, xor, - addrl, nlwidth, - signdx, signdy, axis, new_x1, new_y1, - err, e1, e2, len); -#else - fastvga256BresS - (alu, and, xor, - addrl, nlwidth, - signdx, signdy, axis, new_x1, new_y1, - err, e1, e2, len); -#endif - } - pbox++; - } - } /* while (nbox--) */ - } /* sloped line */ - } /* while (nline--) */ - -#ifndef POLYSEGMENT - /* paint the last point if the end style isn't CapNotLast. - (Assume that a projecting, butt, or round cap that is one - pixel wide is the same as the single pixel of the endpoint.) - */ - - if ((pGC->capStyle != CapNotLast) && - ((ppt->x + xorg != pptInit->x + pDrawable->x) || - (ppt->y + yorg != pptInit->y + pDrawable->y) || - (ppt == pptInit + 1))) - { - nbox = nboxInit; - pbox = pboxInit; - while (nbox--) - { - if ((x2 >= pbox->x1) && - (y2 >= pbox->y1) && - (x2 < pbox->x2) && - (y2 < pbox->y2)) - { - unsigned long *addrb; /* address of destination pixmap */ - unsigned long mask; - unsigned long scrbits; - - mask = cfbmask[x2 & PIM]; - addrl += (y2 * nlwidth) + (x2 >> PWSH); - addrb = addrl; SETRW(addrb); - scrbits = *addrb; - *addrb = (scrbits & ~mask) | - (DoRRop (scrbits, and, xor) & mask); - break; - } - else - pbox++; - } - } -#endif -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgalined.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgalined.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgalined.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgalined.c:1.2 Sat Jul 25 12:58:21 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgalined.c Fri Jan 18 15:26:24 2002 @@ -1,360 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgalined.c,v 1.2 1998/07/25 16:58:21 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgalined.c /main/4 1996/02/21 18:11:24 kaleb $ */ - -#include "vgafb.h" -#include "miline.h" - -/* - * Draw dashed 1-pixel lines. - */ - -void -#ifdef POLYSEGMENT -vga256SegmentSD (pDrawable, pGC, nseg, pSeg) - DrawablePtr pDrawable; - register GCPtr pGC; - int nseg; - register xSegment *pSeg; -#else -vga256LineSD( pDrawable, pGC, mode, npt, pptInit) - DrawablePtr pDrawable; - register GCPtr pGC; - int mode; /* Origin or Previous */ - int npt; /* number of points */ - DDXPointPtr pptInit; -#endif -{ - int nboxInit; - register int nbox; - BoxPtr pboxInit; - register BoxPtr pbox; -#ifndef POLYSEGMENT - register DDXPointPtr ppt; /* pointer to list of translated points */ -#endif - - register unsigned int oc1; /* outcode of point 1 */ - register unsigned int oc2; /* outcode of point 2 */ - - unsigned long *addrl; /* address of destination pixmap */ - int nlwidth; /* width in longwords of destination pixmap */ - int xorg, yorg; /* origin of window */ - - int adx; /* abs values of dx and dy */ - int ady; - int signdx; /* sign of dx and dy */ - int signdy; - int e, e1, e2; /* bresenham error and increments */ - int len; /* length of segment */ - int axis; /* major axis */ - int octant; - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - int x1, x2, y1, y2; - RegionPtr cclip; - cfbRRopRec rrops[2]; - unsigned char *pDash; - int dashOffset; - int numInDashList; - int dashIndex; - int isDoubleDash; - int dashIndexTmp, dashOffsetTmp; - int unclippedlen; - cfbPrivGCPtr devPriv; - - if( pDrawable->type != DRAWABLE_WINDOW ) - { -#ifdef POLYSEGMENT - cfbSegmentSD(pDrawable, pGC, nseg, pSeg); -#else - cfbLineSD(pDrawable, pGC, mode, npt, pptInit); -#endif - return; - } - - devPriv = cfbGetGCPrivate(pGC); - cclip = pGC->pCompositeClip; - rrops[0].rop = devPriv->rop; - rrops[0].and = devPriv->and; - rrops[0].xor = devPriv->xor; - if (pGC->alu == GXcopy) - { - rrops[1].rop = GXcopy; - rrops[1].and = 0; - rrops[1].xor = PFILL (pGC->bgPixel); - } - else - { - rrops[1].rop = cfbReduceRasterOp (pGC->alu, - pGC->bgPixel, pGC->planemask, - &rrops[1].and, &rrops[1].xor); - } - pboxInit = REGION_RECTS(cclip); - nboxInit = REGION_NUM_RECTS(cclip); - - cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl) - - BANK_FLAG(addrl) - - /* compute initial dash values */ - - pDash = (unsigned char *) pGC->dash; - numInDashList = pGC->numInDashList; - isDoubleDash = (pGC->lineStyle == LineDoubleDash); - dashIndex = 0; - dashOffset = 0; - miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, - numInDashList, &dashOffset); - - xorg = pDrawable->x; - yorg = pDrawable->y; -#ifdef POLYSEGMENT - while (nseg--) -#else - ppt = pptInit; - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; - while(--npt) -#endif - { - nbox = nboxInit; - pbox = pboxInit; - -#ifdef POLYSEGMENT - x1 = pSeg->x1 + xorg; - y1 = pSeg->y1 + yorg; - x2 = pSeg->x2 + xorg; - y2 = pSeg->y2 + yorg; - pSeg++; -#else - x1 = x2; - y1 = y2; - ++ppt; - if (mode == CoordModePrevious) - { - xorg = x1; - yorg = y1; - } - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; -#endif - - CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); - - if (adx > ady) - { - axis = X_AXIS; - e1 = ady << 1; - e2 = e1 - (adx << 1); - e = e1 - adx; - unclippedlen = adx; - } - else - { - axis = Y_AXIS; - e1 = adx << 1; - e2 = e1 - (ady << 1); - e = e1 - ady; - unclippedlen = ady; - SetYMajorOctant(octant); - } - - FIXUP_ERROR(e, octant, bias); - - /* we have bresenham parameters and two points. - all we have to do now is clip and draw. - */ - - while(nbox--) - { - oc1 = 0; - oc2 = 0; - OUTCODES(oc1, x1, y1, pbox); - OUTCODES(oc2, x2, y2, pbox); - if ((oc1 | oc2) == 0) - { -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - unclippedlen++; - dashIndexTmp = dashIndex; - dashOffsetTmp = dashOffset; - vga256BresD (rrops, - &dashIndexTmp, pDash, numInDashList, - &dashOffsetTmp, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, - e, e1, e2, unclippedlen); - break; -#else - vga256BresD (rrops, - &dashIndex, pDash, numInDashList, - &dashOffset, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, - e, e1, e2, unclippedlen); - goto dontStep; -#endif - } - else if (oc1 & oc2) - { - pbox++; - } - else /* have to clip */ - { - int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; - int clip1 = 0, clip2 = 0; - int clipdx, clipdy; - int err; - - if (miZeroClipLine (pbox->x1, pbox->y1, pbox->x2-1, - pbox->y2-1, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, &clip1, &clip2, - octant, bias, oc1, oc2) == -1) - { - pbox++; - continue; - } - dashIndexTmp = dashIndex; - dashOffsetTmp = dashOffset; - if (clip1) - { - int dlen; - - if (axis == X_AXIS) - dlen = abs(new_x1 - x1); - else - dlen = abs(new_y2 - y1); - miStepDash (dlen, &dashIndexTmp, pDash, - numInDashList, &dashOffsetTmp); - } - if (axis == X_AXIS) - len = abs(new_x2 - new_x1); - else - len = abs(new_y2 - new_y1); - -#ifdef POLYSEGMENT - if (clip2 != 0 || pGC->capStyle != CapNotLast) - len++; -#else - len += (clip2 != 0); -#endif - if (len) - { - /* unwind bresenham error term to first point */ - if (clip1) - { - clipdx = abs(new_x1 - x1); - clipdy = abs(new_y1 - y1); - if (axis == X_AXIS) - err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); - else - err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); - } - else - err = e; - vga256BresD (rrops, - &dashIndexTmp, pDash, numInDashList, - &dashOffsetTmp, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, new_x1, new_y1, - err, e1, e2, len); - } - pbox++; - } - } /* while (nbox--) */ -#ifndef POLYSEGMENT - /* - * walk the dash list around to the next line - */ - miStepDash (unclippedlen, &dashIndex, pDash, - numInDashList, &dashOffset); -dontStep: ; -#endif - } /* while (nline--) */ - -#ifndef POLYSEGMENT - /* paint the last point if the end style isn't CapNotLast. - (Assume that a projecting, butt, or round cap that is one - pixel wide is the same as the single pixel of the endpoint.) - */ - - if ((pGC->capStyle != CapNotLast) && - ((dashIndex & 1) == 0 || isDoubleDash) && - ((ppt->x + xorg != pptInit->x + pDrawable->x) || - (ppt->y + yorg != pptInit->y + pDrawable->y) || - (ppt == pptInit + 1))) - { - nbox = nboxInit; - pbox = pboxInit; - while (nbox--) - { - unsigned long *addrb; /* address of destination pixmap */ - if ((x2 >= pbox->x1) && - (y2 >= pbox->y1) && - (x2 < pbox->x2) && - (y2 < pbox->y2)) - { - unsigned long mask; - int pix; - - pix = 0; - if (dashIndex & 1) - pix = 1; - mask = cfbmask[x2 & PIM]; - addrl += (y2 * nlwidth) + (x2 >> PWSH); - addrb = addrl; SETRW(addrb); - *addrb = DoMaskRRop (*addrb, rrops[pix].and, rrops[pix].xor, mask); - break; - } - else - pbox++; - } - } -#endif -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgaply1rct.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgaply1rct.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgaply1rct.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgaply1rct.c:1.2 Sat Jul 25 12:58:21 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgaply1rct.c Fri Jan 18 15:26:24 2002 @@ -1,324 +0,0 @@ -/* - * $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgaply1rct.c,v 1.2 1998/07/25 16:58:21 dawes Exp $ - * -Copyright (c) 1990 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - * - * Author: Keith Packard, MIT X Consortium - */ -/* $XConsortium: vgaply1rct.c /main/4 1996/02/21 18:11:28 kaleb $ */ - -#include "vgafb.h" -#include "cfbrrop.h" - -void -RROP_NAME(vga256FillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) - DrawablePtr pDrawable; - GCPtr pGC; - int count; - DDXPointPtr ptsIn; -{ - cfbPrivGCPtr devPriv; - int nwidth; - unsigned long *addrl, *addr; - int maxy; - int origin; - register int vertex1, vertex2; - int c; - BoxPtr extents; - int clip; - int y; - int *vertex1p, *vertex2p; - int *endp; - int x1, x2; - int dx1, dx2; - int dy1, dy2; - int e1, e2; - int step1, step2; - int sign1, sign2; - int h; - int l, r; - unsigned long mask, bits = ~((unsigned long) 0); - int nmiddle; - RROP_DECLARE - - if (mode == CoordModePrevious) - { - miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); - return; - } - - devPriv = (cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr); -#ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) - { - miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); - return; - } -#endif - origin = *((int *) &pDrawable->x); -#if defined(PC98_WAB) || defined(PC98_WABEP) - origin -= (origin & 0x4000) << 1; -#else - origin -= (origin & 0x8000) << 1; -#endif - extents = &pGC->pCompositeClip->extents; - RROP_FETCH_GCPRIV(devPriv); - vertex1 = *((int *) &extents->x1) - origin; - vertex2 = *((int *) &extents->x2) - origin - 0x00010001; - clip = 0; - y = 32767; - maxy = 0; - vertex2p = (int *) ptsIn; - endp = vertex2p + count; - if (shape == Convex) - { - while (count--) - { - c = *vertex2p; - clip |= (c - vertex1) | (vertex2 - c); - c = intToY(c); - if (c < y) - { - y = c; - vertex1p = vertex2p; - } - vertex2p++; - if (c > maxy) - maxy = c; - } - } - else - { - int yFlip = 0; - dx1 = 1; - x2 = -1; - x1 = -1; - while (count--) - { - c = *vertex2p; - clip |= (c - vertex1) | (vertex2 - c); - c = intToY(c); - if (c < y) - { - y = c; - vertex1p = vertex2p; - } - vertex2p++; - if (c > maxy) - maxy = c; - if (c == x1) - continue; - if (dx1 > 0) - { - if (x2 < 0) - x2 = c; - else - dx2 = dx1 = (c - x1) >> 31; - } - else - if ((c - x1) >> 31 != dx1) - { - dx1 = ~dx1; - yFlip++; - } - x1 = c; - } - x1 = (x2 - c) >> 31; - if (x1 != dx1) - yFlip++; - if (x1 != dx2) - yFlip++; - if (yFlip != 2) -#if defined(PC98_WAB) || defined(PC98_WABEP) - clip = 0x4000; -#else - clip = 0x8000; -#endif - } - if (y == maxy) - return; - -#if defined(PC98_WAB) || defined(PC98_WABEP) - if (clip & 0x40004000) -#else - if (clip & 0x80008000) -#endif - { - miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn); - return; - } - -#define AddrYPlus(a,y) (unsigned long *) (((unsigned char *) (a)) + (y) * nwidth) - - cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, unsigned long); - - BANK_FLAG(addrl) - - addrl = AddrYPlus(addrl,y + pDrawable->y); - origin = intToX(origin); - vertex2p = vertex1p; - vertex2 = vertex1 = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; -#define Setup(c,x,vertex,dx,dy,e,sign,step) {\ - x = intToX(vertex); \ - if (dy = intToY(c) - y) { \ - dx = intToX(c) - x; \ - step = 0; \ - if (dx >= 0) \ - { \ - e = 0; \ - sign = 1; \ - if (dx >= dy) {\ - step = dx / dy; \ - dx = dx % dy; \ - } \ - } \ - else \ - { \ - e = 1 - dy; \ - sign = -1; \ - dx = -dx; \ - if (dx >= dy) { \ - step = - (dx / dy); \ - dx = dx % dy; \ - } \ - } \ - } \ - x += origin; \ - vertex = c; \ -} - -#define Step(x,dx,dy,e,sign,step) {\ - x += step; \ - if ((e += dx) > 0) \ - { \ - x += sign; \ - e -= dy; \ - } \ -} - for (;;) - { - if (y == intToY(vertex1)) - { - do - { - if (vertex1p == (int *) ptsIn) - vertex1p = endp; - c = *--vertex1p; - Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1) - } while (y >= intToY(vertex1)); - h = dy1; - } - else - { - Step(x1,dx1,dy1,e1,sign1,step1) - h = intToY(vertex1) - y; - } - if (y == intToY(vertex2)) - { - do - { - c = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; - Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2) - } while (y >= intToY(vertex2)); - if (dy2 < h) - h = dy2; - } - else - { - Step(x2,dx2,dy2,e2,sign2,step2) - if ((c = (intToY(vertex2) - y)) < h) - h = c; - } - /* fill spans for this segment */ - y += h; - for (;;) - { - l = x1; - r = x2; - nmiddle = x2 - x1; - if (nmiddle < 0) - { - nmiddle = -nmiddle; - l = x2; - r = x1; - } -#if PPW > 1 - c = l & PIM; - l -= c; -#endif - -#if PGSZ == 32 -#define LWRD_SHIFT 2 -#else /* PGSZ == 64 */ -#define LWRD_SHIFT 3 -#endif /* PGSZ */ - -#if PWSH > LWRD_SHIFT - l = l >> (PWSH - LWRD_SHIFT); -#endif -#if PWSH < LWRD_SHIFT - l = l << (LWRD_SHIFT - PWSH); -#endif - addr = (unsigned long *) (((char *) addrl) + l); - SETRW(addr); -#if PPW > 1 - if (c + nmiddle < PPW) - { - mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle); - RROP_SOLID_MASK(addr,mask); - } - else - { - if (c) - { - mask = SCRRIGHT(bits, c); - RROP_SOLID_MASK(addr,mask); - nmiddle += c - PPW; - addr++; CHECKRWO(addr); - } -#endif - nmiddle >>= PWSH; - while (--nmiddle >= 0) { - RROP_SOLID(addr); addr++; CHECKRWO(addr); - } -#if PPW > 1 - if (mask = ~SCRRIGHT(bits, r & PIM)) - RROP_SOLID_MASK(addr,mask); - } -#endif - if (!--h) - break; - addrl = AddrYPlus (addrl, 1); - Step(x1,dx1,dy1,e1,sign1,step1) - Step(x2,dx2,dy2,e2,sign2,step2) - } - if (y == maxy) - break; - addrl = AddrYPlus (addrl, 1); - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgapntwin.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgapntwin.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgapntwin.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgapntwin.c:1.2 Sat Jul 25 12:58:21 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgapntwin.c Fri Jan 18 15:26:24 2002 @@ -1,405 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgapntwin.c,v 1.2 1998/07/25 16:58:21 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgapntwin.c /main/3 1996/02/21 18:11:32 kaleb $ */ - -#include "vgafb.h" - -void -vga256PaintWindow(pWin, pRegion, what) - WindowPtr pWin; - RegionPtr pRegion; - int what; -{ - register cfbPrivWin *pPrivWin; - WindowPtr pBgWin; - - pPrivWin = cfbGetWindowPrivate(pWin); - - switch (what) { - case PW_BACKGROUND: - switch (pWin->backgroundState) { - case None: - return; - case ParentRelative: - do { - pWin = pWin->parent; - } while (pWin->backgroundState == ParentRelative); - (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, - what); - return; - case BackgroundPixmap: - if (pPrivWin->fastBackground) - { - vga256FillBoxTile32 ((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pPrivWin->pRotatedBackground); - return; - } - else - { - vga256FillBoxTileOdd ((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pWin->background.pixmap, - (int) pWin->drawable.x, (int) pWin->drawable.y); - return; - } - break; - case BackgroundPixel: - (*vga256LowlevFuncs.fillBoxSolid) ((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pWin->background.pixel, - 0, - GXcopy); - return; - } - break; - case PW_BORDER: - if (pWin->borderIsPixel) - { - (*vga256LowlevFuncs.fillBoxSolid) ((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pWin->border.pixel, - 0, - GXcopy); - return; - } - else if (pPrivWin->fastBorder) - { - vga256FillBoxTile32 ((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pPrivWin->pRotatedBorder); - return; - } - else - { - for (pBgWin = pWin; - pBgWin->backgroundState == ParentRelative; - pBgWin = pBgWin->parent); - - vga256FillBoxTileOdd ((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pWin->border.pixmap, - (int) pBgWin->drawable.x, - (int) pBgWin->drawable.y); - } - break; - } -} - -void -vga256FillBoxSolid (pDrawable, nBox, pBox, pixel1, pixel2, alu) - DrawablePtr pDrawable; - int nBox; - BoxPtr pBox; - unsigned long pixel1; - unsigned long pixel2; - int alu; -{ - unsigned char *pdstBase; - unsigned long fill2; - unsigned char *pdst; - register int hcount, vcount, count; - int widthPitch; - Bool flag; - unsigned char * (* func)( -#if NeedFunctionPrototypes - unsigned char *, - unsigned long , - unsigned long , - int , - int , - int , - int -#endif -); - int widthDst; - int h; - unsigned long fill1; - int w; - - if (pDrawable->type == DRAWABLE_WINDOW) - { - pdstBase = (unsigned char *) - (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr); - widthDst = (int) - (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind); - } - else - { - pdstBase = (unsigned char *)(((PixmapPtr)pDrawable)->devPrivate.ptr); - widthDst = (int)(((PixmapPtr)pDrawable)->devKind); - } - - flag = CHECKSCREEN(pdstBase); - fill1 = PFILL(pixel1); - fill2 = PFILL(pixel2); - - switch (alu) { - case GXcopy: func = fastFillSolidGXcopy; break; - case GXor: func = fastFillSolidGXor; break; - case GXand: func = fastFillSolidGXand; break; - case GXxor: func = fastFillSolidGXxor; break; - case GXset: func = fastFillSolidGXset; break; - default: return; - } - - for (; nBox; nBox--, pBox++) - { - pdst = pdstBase + pBox->y1 * widthDst + pBox->x1; - - h = pBox->y2 - pBox->y1; - w = pBox->x2 - pBox->x1; - widthPitch = widthDst - w; - - SETRWF(flag,pdst); - vcount = 0; - - while ( h || vcount ) { - if (vcount == 0) { - hcount = h; - if (flag) { - hcount = min( hcount,((unsigned char *)vgaWriteTop - pdst) / widthDst); - if (hcount == 0) vcount = w; - } - } - if (vcount != 0) { - hcount = 1; - if (((count = (unsigned char *)vgaWriteTop - pdst) == 0) || - (count >= vcount)) { - count = vcount; - vcount = 0; - h--; - } else { - vcount -= count; - } - } else { - count = w; - h -= hcount; - } - if (vcount) - pdst = (func)(pdst,fill1,fill2,hcount,count,0,0); - else - pdst = (func)(pdst,fill1,fill2,hcount,count,w,widthPitch); - CHECKRWOF(flag,pdst); - } - } -} - -/* This can be further optimized but it is tricky */ -void -vga256FillBoxTile32 (pDrawable, nBox, pBox, tile) - DrawablePtr pDrawable; - int nBox; /* number of boxes to fill */ - BoxPtr pBox; /* pointer to list of boxes to fill */ - PixmapPtr tile; /* rotated, expanded tile */ -{ - register unsigned long srcpix; - unsigned long *psrc; /* pointer to bits in tile, if needed */ - unsigned long *lpsrc, *fpsrc; /* loop version of psrc */ - int tileHeight; /* height of the tile */ - - int nlwDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - register int h; /* height of current box */ - register unsigned long startmask; - register unsigned long endmask; /* masks for reggedy bits at either end of line */ - register unsigned long notstartmask; - register unsigned long notendmask; - - int nlwMiddle; /* number of longwords between sides of boxes */ - int nlwExtra; /* to get from right of box to left of next span */ - register unsigned int nlw; /* loop version of nlwMiddle */ - register unsigned long *p; /* pointer to bits we're writing */ - int y; /* current scan line */ - Bool flag; - - unsigned long *pbits;/* pointer to start of pixmap */ - - tileHeight = tile->drawable.height; - psrc = (unsigned long *)tile->devPrivate.ptr; - - if (pDrawable->type == DRAWABLE_WINDOW) - { - pbits = (unsigned long *) - (((PixmapPtr) - (pDrawable->pScreen->devPrivate))->devPrivate.ptr); - nlwDst = (int) - (((PixmapPtr) - (pDrawable->pScreen->devPrivate))->devKind) >> PWSH; - } - else - { - pbits = (unsigned long *)(((PixmapPtr)pDrawable)->devPrivate.ptr); - nlwDst = (int)(((PixmapPtr)pDrawable)->devKind) >> PWSH; - } - - flag = CHECKSCREEN(pbits); - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - y = pBox->y1; - p = pbits + (pBox->y1 * nlwDst) + (pBox->x1 >> PWSH); - - if(flag)p=vgaSetReadWrite(p); - - lpsrc = &psrc[y % tileHeight]; - fpsrc = &psrc[tileHeight]; - if ( ((pBox->x1 & PIM) + w) < PPW) - { - maskpartialbits(pBox->x1, w, startmask); - notstartmask = ~startmask; - nlwExtra = nlwDst; - while (h--) - { - srcpix = *lpsrc++; - if (lpsrc == fpsrc) lpsrc = psrc; - *p = (*p & notstartmask) | (srcpix & startmask); - p += nlwExtra; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - } - else - { - maskbits(pBox->x1, w, startmask, endmask, nlwMiddle); - notstartmask = ~startmask; - notendmask = ~endmask; - nlwExtra = nlwDst - nlwMiddle; - - if (startmask && endmask) - { - nlwExtra -= 1; - while (h--) - { - srcpix = *lpsrc++; - if (lpsrc == fpsrc) lpsrc = psrc; - nlw = nlwMiddle; - *p = (*p & notstartmask) | (srcpix & startmask); - p++; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - while (nlw--) { - *p++ = srcpix; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - *p = (*p & notendmask) | (srcpix & endmask); - p += nlwExtra; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - } - else if (startmask && !endmask) - { - nlwExtra -= 1; - while (h--) - { - srcpix = *lpsrc++; - if (lpsrc == fpsrc) lpsrc = psrc; - nlw = nlwMiddle; - *p = (*p & notstartmask) | (srcpix & startmask); - p++; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - while (nlw--) { - *p++ = srcpix; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - p += nlwExtra; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - } - else if (!startmask && endmask) - { - while (h--) - { - srcpix = *lpsrc++; - if (lpsrc == fpsrc) lpsrc = psrc; - nlw = nlwMiddle; - while (nlw--) { - *p++ = srcpix; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - *p = (*p & notendmask) | (srcpix & endmask); - p += nlwExtra; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - } - else /* no ragged bits at either end */ - { - while (h--) - { - srcpix = *lpsrc++; - if (lpsrc == fpsrc) lpsrc = psrc; - nlw = nlwMiddle; - while (nlw--) { - *p++ = srcpix; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - p += nlwExtra; - if(flag && (void*)p >= vgaWriteTop) - p = vgaReadWriteNext(p); - } - } - } - pBox++; - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgapolypnt.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgapolypnt.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgapolypnt.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgapolypnt.c:1.2 Sat Jul 25 12:58:22 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgapolypnt.c Fri Jan 18 15:26:24 2002 @@ -1,128 +0,0 @@ -/* $XConsortium: vgapolypnt.c /main/4 1996/02/21 18:11:36 kaleb $ */ -/************************************************************ - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -********************************************************/ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgapolypnt.c,v 1.2 1998/07/25 16:58:22 dawes Exp $ */ - -#include "vgafb.h" - -#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask) - -#define PointLoop(fill) { \ - for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip); \ - --nbox >= 0; \ - pbox++) \ - { \ - c1 = *((INT32 *) &pbox->x1) - off; \ - c2 = *((INT32 *) &pbox->x2) - off - 0x00010001; \ - for (ppt = (INT32 *) pptInit, i = npt; --i >= 0;) \ - { \ - pt = *ppt++; \ - if (!isClipped(pt,c1,c2)) { \ - fill \ - } \ - } \ - } \ -} - -void -vga256PolyPoint(pDrawable, pGC, mode, npt, pptInit) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; - int npt; - xPoint *pptInit; -{ - register INT32 pt; - register INT32 c1, c2; -#if defined(PC98_WAB) || defined(PC98_WABEP) - register unsigned long ClipMask = 0x40004000; -#else - register unsigned long ClipMask = 0x80008000; -#endif - register unsigned long xor; - register unsigned char *addrb; - register int nbwidth; - unsigned char *addrbt; - register INT32 *ppt; - RegionPtr cclip; - int nbox; - register int i; - register BoxPtr pbox; - unsigned long and; - int rop = pGC->alu; - int off; - cfbPrivGCPtr devPriv; - xPoint *pptPrev; - - devPriv = cfbGetGCPrivate(pGC); - rop = devPriv->rop; - if (rop == GXnoop) - return; - cclip = pGC->pCompositeClip; - xor = devPriv->xor; - if ((mode == CoordModePrevious) && (npt > 1)) - { - for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++) - { - pptPrev->x += (pptPrev-1)->x; - pptPrev->y += (pptPrev-1)->y; - } - } - off = *((int *) &pDrawable->x); -#if defined(PC98_WAB) || defined(PC98_WABEP) - off -= (off & 0x4000) << 1; -#else - off -= (off & 0x8000) << 1; -#endif - cfbGetByteWidthAndPointer(pDrawable, nbwidth, addrb); - - BANK_FLAG(addrb) - - addrb = addrb + pDrawable->y * nbwidth + pDrawable->x; - if (rop == GXcopy) - { - if (!(nbwidth & (nbwidth - 1))) - { - nbwidth = xf86ffs(nbwidth) - 1; - PointLoop(addrbt = addrb + (intToY(pt) << nbwidth) + intToX(pt); - SETRW(addrbt); *addrbt = xor;) - } - else - { - PointLoop(addrbt = addrb + intToY(pt) * nbwidth + intToX(pt); - SETRW(addrbt); *addrbt = xor;) - } - } - else - { - and = devPriv->and; - PointLoop( addrbt = addrb + intToY(pt) * nbwidth + intToX(pt); - SETRW(addrbt); - *addrbt = DoRRop (*addrbt, and, xor);) - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgapush8.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgapush8.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgapush8.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgapush8.c:1.2 Sat Jul 25 12:58:22 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgapush8.c Fri Jan 18 15:26:24 2002 @@ -1,182 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgapush8.c,v 1.2 1998/07/25 16:58:22 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. -*/ -/* $XConsortium: vgapush8.c /main/3 1996/02/21 18:11:39 kaleb $ */ - -/* - * Push Pixels for 8 bit displays. - */ - -#include "vgafb.h" - -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -void -vga256PushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg) - GCPtr pGC; - PixmapPtr pBitmap; - DrawablePtr pDrawable; - int dx, dy, xOrg, yOrg; -{ - register unsigned long *src, *dst; - register unsigned long pixel; - register unsigned long c, bits; - unsigned long *pdstLine, *psrcLine; - unsigned long *pdstBase; - int srcWidth; - int dstWidth; - int xoff; - int nBitmapLongs, nPixmapLongs; - int nBitmapTmp, nPixmapTmp; - unsigned long rightMask; - BoxRec bbox; - cfbPrivGCPtr devPriv; - - bbox.x1 = xOrg; - bbox.y1 = yOrg; - bbox.x2 = bbox.x1 + dx; - bbox.y2 = bbox.y1 + dy; - devPriv = cfbGetGCPrivate(pGC); - - switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) - { - case rgnPART: - mfbPushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg); - case rgnOUT: - return; - } - /* - * If nothing is going to actually touch the framebuffer, then - * do the work with the cfb routines as they should be slightly faster. - */ - - if( pDrawable->type != DRAWABLE_WINDOW ) - { - cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg); - return; - } - - cfbGetLongWidthAndPointer (pDrawable, dstWidth, pdstBase) - - BANK_FLAG(pdstBase) - - psrcLine = (unsigned long *) pBitmap->devPrivate.ptr; - srcWidth = (int) pBitmap->devKind >> PWSH; - - pixel = devPriv->xor; - xoff = xOrg & PIM; - nBitmapLongs = (dx + xoff) >> MFB_PWSH; - nPixmapLongs = (dx + PGSZB + xoff) >> PWSH; - - rightMask = ~cfb8BitLenMasks[((dx + xoff) & MFB_PIM)]; - - pdstLine = pdstBase + (yOrg * dstWidth) + (xOrg >> PWSH); - - while (dy--) - { - c = 0; - nPixmapTmp = nPixmapLongs; - nBitmapTmp = nBitmapLongs; - src = psrcLine; - dst = pdstLine; - SETRW(dst); - while (nBitmapTmp--) - { - bits = *src++; - c |= BitRight (bits, xoff); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - nPixmapTmp -= 8; - c = 0; - if (xoff) - c = BitLeft (bits, PGSZ - xoff); - } - if (BitLeft (rightMask, xoff)) - c |= BitRight (*src, xoff); - c &= rightMask; - switch (nPixmapTmp) { - case 8: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - case 7: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - case 6: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - case 5: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - case 4: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - case 3: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - case 2: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - case 1: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; CHECKRWO(dst); - case 0: - break; - } - pdstLine += dstWidth; - psrcLine += srcWidth; - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgapwinS.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgapwinS.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgapwinS.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgapwinS.c:1.2 Sat Jul 25 12:58:23 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgapwinS.c Fri Jan 18 15:26:24 2002 @@ -1,82 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgapwinS.c,v 1.2 1998/07/25 16:58:23 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgapwinS.c /main/3 1996/02/21 18:11:43 kaleb $ */ - -#include "vgafb.h" - -void -speedupvga256FillBoxSolid (pDrawable, nBox, pBox, pixel1, pixel2, alu) - DrawablePtr pDrawable; - int nBox; - BoxPtr pBox; - unsigned long pixel1; - unsigned long pixel2; - int alu; -{ - unsigned long *pdstBase; - register unsigned char *pdstb; - int widthDst; - int h; - unsigned long fill1; - int m; - int w; - - cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase); - fill1 = PFILL(pixel1); - for (; nBox; nBox--, pBox++) - { - - pdstb = (unsigned char*)(pdstBase+pBox->y1*widthDst)+pBox->x1; - - h = pBox->y2 - pBox->y1; - w = pBox->x2 - pBox->x1; - - SpeedUpBox(pdstb, fill1, h, w, widthDst << PWSH); - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgarctstp8.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgarctstp8.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgarctstp8.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgarctstp8.c:1.2 Sat Jul 25 12:58:23 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgarctstp8.c Fri Jan 18 15:26:24 2002 @@ -1,626 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgarctstp8.c,v 1.2 1998/07/25 16:58:23 dawes Exp $ */ -/* - * Fill 32 bit stippled rectangles for 8 bit frame buffers - */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -Author: Keith Packard, MIT X Consortium - -*/ -/* $XConsortium: vgarctstp8.c /main/4 1996/02/21 18:11:47 kaleb $ */ - -#include "vgafb.h" - -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -void -#ifdef SPEEDUP -speedupvga2568FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) -#else -vga2568FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) -#endif - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; /* number of boxes to fill */ - register BoxPtr pBox; /* pointer to list of boxes to fill */ -{ - unsigned long *src; - int stippleHeight; - - int nlwDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - register int h; /* height of current box */ - unsigned long startmask; - unsigned long endmask; /* masks for reggedy bits at either end of line */ - int nlwMiddle; /* number of longwords between sides of boxes */ - register int nlw; /* loop version of nlwMiddle */ - unsigned long *dstLine; - register unsigned long *dst; /* pointer to bits we're writing */ - int y; /* current scan line */ - - unsigned long *pbits;/* pointer to start of pixmap */ - register unsigned long bits; /* bits from stipple */ - int rot; - register unsigned long xor; - PixmapPtr stipple; -#ifdef SPEEDUP - unsigned long *dstTmp; - int wEnd; -#endif - - stipple = pGC->pRotatedPixmap; - - cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - - stippleHeight = stipple->drawable.height; - src = (unsigned long *)stipple->devPrivate.ptr; - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - BANK_FLAG(pbits); - - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - y = pBox->y1; - dstLine = pbits + (pBox->y1 * nlwDst) + ((pBox->x1 & ~PIM) >> PWSH); - if (((pBox->x1 & PIM) + w) <= PPW) - { - maskpartialbits(pBox->x1, w, startmask); - nlwMiddle = 0; - endmask = 0; - } - else - { - maskbits (pBox->x1, w, startmask, endmask, nlwMiddle); - } - rot = (pBox->x1 & ((PGSZ-1) & ~PIM)); - pBox++; - y = y % stippleHeight; - -#ifdef SPEEDUP - if (cfb8StippleRRop == GXcopy) - { - if (w < PGSZ*2) - { - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot) - RotBitsLeft(bits,rot); - dst = dstLine; - SETRW(dst); - dstLine += nlwDst; - if (startmask) - { - *dst = *dst & ~startmask | - GetPixelGroup (bits) & startmask; - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - nlw = nlwMiddle; - while (nlw--) - { - *dst++ = GetPixelGroup(bits); - RotBitsLeft (bits, PGSZB); - CHECKRWO(dst); - } - if (endmask) - { - *dst = *dst & ~endmask | - GetPixelGroup (bits) & endmask; - } - } - } - else - { - wEnd = 7 - (nlwMiddle & 7); - nlwMiddle = (nlwMiddle >> 3) + 1; - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot != 0) - RotBitsLeft (bits, rot); - dstTmp = dstLine; - SETRW(dstTmp); - dstLine += nlwDst; - if (startmask) - { - *dstTmp = *dstTmp & ~startmask | - GetPixelGroup (bits) & startmask; - dstTmp++; CHECKRWO(dstTmp); - RotBitsLeft (bits, PGSZB); - } - w = 7 - wEnd; - SAVE_BANK() - while (w--) - { - nlw = nlwMiddle; - dst = dstTmp; - RESTORE_BANK() - CHECKRWO(dst); - SAVE_BANK() - dstTmp++; - xor = GetPixelGroup (bits); - while (nlw--) - { - *dst = xor; - dst += 8; CHECKRWO(dst); - } - NextBitGroup (bits); - } - nlwMiddle--; - w = wEnd + 1; - if (endmask) - { - dst = dstTmp + (nlwMiddle << 3); - RESTORE_BANK() - SAVE_BANK() - CHECKRWO(dst); - *dst = (*dst & ~endmask) | - GetPixelGroup (bits) & endmask; - } - while (w--) - { - nlw = nlwMiddle; - dst = dstTmp; - RESTORE_BANK() - CHECKRWO(dst); - SAVE_BANK() - dstTmp++; - xor = GetPixelGroup (bits); - while (nlw--) - { - *dst = xor; - dst += 8; CHECKRWO(dst); - } - NextBitGroup (bits); - } - nlwMiddle++; - } - } - } - else -#endif - { - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot) - RotBitsLeft(bits,rot); - dst = dstLine; - SETRW(dst); - dstLine += nlwDst; - if (startmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, startmask); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - nlw = nlwMiddle; - while (nlw--) - { - RRopBitGroup(dst, GetBitGroup(bits)); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, endmask); - } - } - } - } -} - -void -#ifdef SPEEDUP -speedupvga2568FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox) -#else -vga2568FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox) -#endif - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; /* number of boxes to fill */ - BoxPtr pBox; /* pointer to list of boxes to fill */ -{ - int x, y, w, h; - int nlwMiddle, nlwDst; - unsigned long startmask, endmask; - register unsigned long *dst; - unsigned long *dstLine, *pbits; - unsigned long *src; - register unsigned long xor; - register unsigned long bits; - int rot; - cfbPrivGCPtr devPriv; - PixmapPtr stipple; - int stippleHeight; - register int nlw; -#ifdef SPEEDUP - unsigned long *dstTmp; - register unsigned long mask; - int wEnd; -#endif - - devPriv = cfbGetGCPrivate(pGC); - stipple = pGC->pRotatedPixmap; - src = (unsigned long *)stipple->devPrivate.ptr; - stippleHeight = stipple->drawable.height; - - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - BANK_FLAG(pbits); - - while (nBox--) - { - x = pBox->x1; - w = pBox->x2 - x; - if (((x & PIM) + w) <= PPW) - { - maskpartialbits(x, w, startmask); - endmask = 0; - nlwMiddle = 0; - } - else - { - maskbits (x, w, startmask, endmask, nlwMiddle); - } - rot = (x & ((PGSZ-1) & ~PIM)); - y = pBox->y1; - dstLine = pbits + (y * nlwDst) + (x >> PWSH); - h = pBox->y2 - y; - pBox++; - y %= stippleHeight; -#ifdef SPEEDUP - if (cfb8StippleRRop == GXcopy) - { - xor = devPriv->xor; - if (w < PGSZ*2) - { - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot != 0) - RotBitsLeft (bits, rot); - dst = dstLine; - SETRW(dst); - dstLine += nlwDst; - if (startmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dst = (*dst & ~(mask & startmask)) | - (xor & (mask & startmask)); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - nlw = nlwMiddle; - while (nlw--) - { - WriteBitGroup (dst,xor,GetBitGroup(bits)) - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dst = (*dst & ~(mask & endmask)) | - (xor & (mask & endmask)); - } - } - } - else - { - wEnd = 7 - (nlwMiddle & 7); - nlwMiddle = (nlwMiddle >> 3) + 1; - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot != 0) - RotBitsLeft (bits, rot); - dstTmp = dstLine; - SETRW(dstTmp); - dstLine += nlwDst; - if (startmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dstTmp = (*dstTmp & ~(mask & startmask)) | - (xor & (mask & startmask)); - dstTmp++; CHECKRWO(dstTmp); - RotBitsLeft (bits, PGSZB); - } - w = 7 - wEnd; - SAVE_BANK() - while (w--) - { - nlw = nlwMiddle; - dst = dstTmp; - RESTORE_BANK() - CHECKRWO(dst); - SAVE_BANK() - dstTmp++; -#if defined(__GNUC__) && defined(mc68020) - mask = cfb8PixelMasks[GetBitGroup(bits)]; - xor = xor & mask; - mask = ~mask; - while (nlw--) - { - *dst = (*dst & mask) | xor; - dst += 8; - } - xor = devPriv->xor; -#else -#define SwitchBitsLoop(body) \ - while (nlw--) \ - { \ - body \ - dst += 8; CHECKRWO(dst); \ - } - SwitchBitGroup(dst, xor, GetBitGroup(bits)); -#undef SwitchBitsLoop -#endif - NextBitGroup (bits); - } - nlwMiddle--; - w = wEnd + 1; - if (endmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - dst = dstTmp + (nlwMiddle << 3); - RESTORE_BANK() - SAVE_BANK() - CHECKRWO(dst); - *dst = (*dst & ~(mask & endmask)) | - (xor & (mask & endmask)); - } - while (w--) - { - nlw = nlwMiddle; - dst = dstTmp; - RESTORE_BANK() - CHECKRWO(dst); - SAVE_BANK() - dstTmp++; -#if defined(__GNUC__) && defined(mc68020) - mask = cfb8PixelMasks[GetBitGroup(bits)]; - xor = xor & mask; - mask = ~mask; - while (nlw--) - { - *dst = (*dst & mask) | xor; - dst += 8; - } - xor = devPriv->xor; -#else -#define SwitchBitsLoop(body) \ - while (nlw--) \ - { \ - body \ - dst += 8; CHECKRWO(dst); \ - } - SwitchBitGroup(dst, xor, GetBitGroup(bits)); -#undef SwitchBitsLoop -#endif - NextBitGroup (bits); - } - nlwMiddle++; - } - } - } - else -#endif - { - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot != 0) - RotBitsLeft (bits, rot); - dst = dstLine; - SETRW(dst); - dstLine += nlwDst; - if (startmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, startmask); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - nlw = nlwMiddle; - while (nlw--) - { - RRopBitGroup(dst, GetBitGroup(bits)); - dst++; CHECKRWO(dst); - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, endmask); - } - } - } - } -} - -#if defined(SPEEDUP) || defined(__alpha__) || defined(__powerpc__) -void -vga2568FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; - register BoxPtr pBox; -{ - unsigned long *pdstBase; /* pointer to start of bitmap */ - unsigned long *pdstLine; /* current destination line */ - int nlwDst; /* width in longwords of bitmap */ - PixmapPtr pStipple; /* pointer to stipple we want to fill with */ - int nlwMiddle; - register int nlw; - int x, y, w, h, xrem, xSrc, ySrc; - int stwidth, stippleWidth; - int stippleHeight; - register unsigned long bits, inputBits; - register int partBitsLeft; - int nextPartBits; - int bitsLeft, bitsWhole; - register unsigned long *pdst; /* pointer to current word in bitmap */ - unsigned long *srcTemp, *srcStart; - unsigned long *psrcBase; - unsigned long startmask, endmask; - - if (pGC->fillStyle == FillStippled) - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - else - cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - - if (cfb8StippleRRop == GXnoop) - return; - - /* - * OK, so what's going on here? We have two Drawables: - * - * The Stipple: - * Depth = 1 - * Width = stippleWidth - * Words per scanline = stwidth - * Pointer to pixels = pStipple->devPrivate.ptr - */ - - pStipple = pGC->stipple; - - stwidth = pStipple->devKind >> PWSH; - stippleWidth = pStipple->drawable.width; - stippleHeight = pStipple->drawable.height; - psrcBase = (unsigned long *) pStipple->devPrivate.ptr; - - /* - * The Target: - * Depth = PSZ - * Width = determined from *pwidth - * Words per scanline = nlwDst - * Pointer to pixels = addrlBase - */ - - xSrc = pDrawable->x; - ySrc = pDrawable->y; - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase) - - BANK_FLAG(pdstBase) - - /* this replaces rotating the stipple. Instead we just adjust the offset - * at which we start grabbing bits from the stipple. - * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, - * so that iline and xrem always stay within the stipple bounds. - */ - - xSrc += (pGC->patOrg.x % stippleWidth) - stippleWidth; - ySrc += (pGC->patOrg.y % stippleHeight) - stippleHeight; - - bitsWhole = stippleWidth; - - while (nBox--) - { - x = pBox->x1; - y = pBox->y1; - w = pBox->x2 - x; - h = pBox->y2 - y; - pBox++; - pdstLine = pdstBase + y * nlwDst + (x >> PWSH); - y = (y - ySrc) % stippleHeight; - srcStart = psrcBase + y * stwidth; - xrem = ((x & ~PIM) - xSrc) % stippleWidth; - if (((x & PIM) + w) < PPW) - { - maskpartialbits (x, w, startmask); - nlwMiddle = 0; - endmask = 0; - } - else - { - maskbits (x, w, startmask, endmask, nlwMiddle); - } - while (h--) - { - srcTemp = srcStart + (xrem >> MFB_PWSH); - bitsLeft = stippleWidth - (xrem & ~MFB_PIM); - NextUnnaturalStippleWord - NextSomeBits (inputBits, (xrem & MFB_PIM)); - partBitsLeft -= (xrem & MFB_PIM); - NextUnnaturalStippleBits - nlw = nlwMiddle; - pdst = pdstLine; - SETRW(pdst); - if (startmask) - { - *pdst = MaskRRopPixels(*pdst,bits,startmask); - pdst++; CHECKRWO(pdst); - NextUnnaturalStippleBits - } - while (nlw--) - { - *pdst = RRopPixels(*pdst,bits); - pdst++; CHECKRWO(pdst); - NextUnnaturalStippleBits - } - if (endmask) - *pdst = MaskRRopPixels(*pdst,bits,endmask); - pdstLine += nlwDst; - y++; - srcStart += stwidth; - if (y == stippleHeight) - { - y = 0; - srcStart = psrcBase; - } - } - } -} -#endif /* SPEEDUP || __alpha__ */ Index: xc/programs/Xserver/hw/xfree86/vgafb/vgascrinit.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgascrinit.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgascrinit.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgascrinit.c:1.2 Sat Jul 25 12:58:24 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgascrinit.c Fri Jan 18 15:26:24 2002 @@ -1,153 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgascrinit.c,v 1.2 1998/07/25 16:58:24 dawes Exp $ */ -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or X Consortium -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and X Consortium make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ -/* $XConsortium: vgascrinit.c /main/4 1996/10/25 06:21:10 kaleb $ */ - -#include "vgafb.h" -#include "mibstore.h" - -/* - * we need some global variables in this module; let's make them module - * specific and figure out how to fill them in from the values in the - * ScrnInfoRec - */ -void *vgaReadBottom = NULL; -void *vgaReadTop = NULL; -void *vgaWriteBottom = NULL; -void *vgaWriteTop = NULL; -Bool vgaReadFlag, vgaWriteFlag; -int vgaSegmentShift,vgaSegmentMask,vgaSegmentSize; -int vgaBase,vgaLinearBase; -Bool vgaUseLinearAddressing; -void (*vgaSetReadFunc)(int); -void (*vgaSetWriteFunc)(int); -void (*vgaSetReadWriteFunc)(int); -CfbfuncRec vga256LowlevFuncs; - -/* - * Most of this code is copied from cfbscrinit.c. It is necessary - * to copy the code because of the call to miInitializeBackingStore() - * which can't be called twice due to the wrapper mechanism used. - * - * This code should be kept in sync with Xserver/cfb/cfbscrinit.c. - */ - -BSFuncRec vga256BSFuncRec = { - vga256SaveAreas, - vga256RestoreAreas, - (BackingStoreSetClipmaskRgnProcPtr) 0, - (BackingStoreGetImagePixmapProcPtr) 0, - (BackingStoreGetSpansPixmapProcPtr) 0, -}; - -vga256FinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ -{ -#ifdef CFB_NEED_SCREEN_PRIVATE - pointer oldDevPrivate; -#endif - VisualPtr visuals; - DepthPtr depths; - int nvisuals; - int ndepths; - int rootdepth; - VisualID defaultVisual; - /* - * we need to figure out where to get this information from - */ - Bool vgaDAC8BitComponents = FALSE; - - rootdepth = 0; - if (!cfbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth, - &defaultVisual,((unsigned long)1<<(PSZ-1)), - vgaDAC8BitComponents ? 8 : 6)) - return FALSE; -#ifdef CFB_NEED_SCREEN_PRIVATE - oldDevPrivate = pScreen->devPrivate; -#endif - if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, - rootdepth, ndepths, depths, - defaultVisual, nvisuals, visuals)) - return FALSE; - /* overwrite miCloseScreen with our own */ - pScreen->CloseScreen = cfbCloseScreen; - pScreen->BackingStoreFuncs = vga256BSFuncRec; -#ifdef CFB_NEED_SCREEN_PRIVATE - pScreen->CreateScreenResources = cfbCreateScreenResources; - pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate; - pScreen->devPrivate = oldDevPrivate; -#endif - pScreen->GetScreenPixmap = cfbGetScreenPixmap; - pScreen->SetScreenPixmap = cfbSetScreenPixmap; - return TRUE; -} - -Bool -vga256ScreenInit(ScreenPtr pScreen, vgaHWPtr hwp, pointer pbits, - int xsize, int ysize, int dpix, int dpiy, int width) -{ - /* - * first we init our globals from the information that was passed in - */ - vgaReadBottom = hwp->ReadBottom; - vgaReadTop = hwp->ReadTop; - vgaWriteBottom = hwp->WriteBottom; - vgaWriteTop = hwp->WriteTop; - vgaSegmentShift = hwp->SegmentShift; - vgaSegmentMask = hwp->SegmentMask; - vgaSegmentSize = hwp->SegmentSize; - vgaBase = hwp->Base; - vgaLinearBase = hwp->LinearBase; - vgaUseLinearAddressing = hwp->UseLinearAddressing; - - vgaSetReadFunc = hwp->SetReadFunc; - vgaSetWriteFunc = hwp->SetWriteFunc; - vgaSetReadWriteFunc = hwp->SetReadWriteFunc; - - if (!cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)) - return FALSE; - - /* These overrides what was being set in cfbSetupScreen() */ - - pScreen->GetImage = vga256GetImage; - pScreen->GetSpans = vga256GetSpans; - pScreen->PaintWindowBackground = vga256PaintWindow; - pScreen->PaintWindowBorder = vga256PaintWindow; - pScreen->CopyWindow = vga256CopyWindow; - pScreen->CreateGC = vga256CreateGC; - - mfbRegisterCopyPlaneProc (pScreen, vga256CopyPlane); - - return vga256FinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width); -} - Index: xc/programs/Xserver/hw/xfree86/vgafb/vgasetsp.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgasetsp.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgasetsp.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgasetsp.c:1.2 Sat Jul 25 12:58:24 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgasetsp.c Fri Jan 18 15:26:24 2002 @@ -1,284 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgasetsp.c,v 1.2 1998/07/25 16:58:24 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgasetsp.c /main/3 1996/02/21 18:11:54 kaleb $ */ - -#include "vgafb.h" -#include <mergerop.h> - -/* cfbSetScanline -- copies the bits from psrc to the drawable starting at - * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc - * starts on the scanline. (I.e., if this scanline passes through multiple - * boxes, we may not want to start grabbing bits at psrc but at some offset - * further on.) - */ -vga256SetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemask) - int y; - int xOrigin; /* where this scanline starts */ - int xStart; /* first bit to use from scanline */ - int xEnd; /* last bit to use from scanline + 1 */ - register unsigned int *psrc; - register int alu; /* raster op */ - int *pdstBase; /* start of the drawable */ - int widthDst; /* width of drawable in words */ - unsigned long planemask; -{ - int w; /* width of scanline in bits */ - register int *pdst; /* where to put the bits */ - register int tmpSrc; /* scratch buffer to collect bits in */ - int dstBit; /* offset in bits from beginning of - * word */ - register int nstart; /* number of bits from first partial */ - register int nend; /* " " last partial word */ - int offSrc; - int startmask, endmask, nlMiddle, nl; - DeclareMergeRop() - - InitializeMergeRop(alu,planemask); - pdst = pdstBase + (y * widthDst) + (xStart >> PWSH); - SETRW(pdst); - psrc += (xStart - xOrigin) >> PWSH; - offSrc = (xStart - xOrigin) & PIM; - w = xEnd - xStart; - dstBit = xStart & PIM; - - if (dstBit + w <= PPW) - { - maskpartialbits(dstBit, w, startmask); - endmask = 0; - nlMiddle = 0; - } - else - { - maskbits(xStart, w, startmask, endmask, nlMiddle); - } - if (startmask) - nstart = PPW - dstBit; - else - nstart = 0; - if (endmask) - nend = xEnd & PIM; - else - nend = 0; - if (startmask) - { - getbits(psrc, offSrc, nstart, tmpSrc); - putbitsmropshort(tmpSrc, dstBit, nstart, pdst); - pdst++; CHECKRWO(pdst); - offSrc += nstart; - if (offSrc > PLST) - { - psrc++; - offSrc -= PPW; - } - } - nl = nlMiddle; - while (nl--) - { - getbits(psrc, offSrc, PPW, tmpSrc); - *pdst = DoMergeRop(tmpSrc, *pdst); - pdst++; CHECKRWO(pdst); - psrc++; - } - if (endmask) - { - getbits(psrc, offSrc, nend, tmpSrc); - putbitsmropshort(tmpSrc, 0, nend, pdst); - } -} - - - -/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at - * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines - * are in increasing Y order. - * Source bit lines are server scanline padded so that they always begin - * on a word boundary. - */ -void -vga256SetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - char *pcharsrc; - register DDXPointPtr ppt; - int *pwidth; - int nspans; - int fSorted; -{ - unsigned int *psrc = (unsigned int *)pcharsrc; - unsigned long *pdstBase; /* start of dst bitmap */ - int widthDst; /* width of bitmap in words */ - register BoxPtr pbox, pboxLast, pboxTest; - register DDXPointPtr pptLast; - int alu; - RegionPtr prgnDst; - int xStart, xEnd; - int yMax; - - /* - * If nothing is going to actually touch the framebuffer, then - * do the work with the cfb routines as they should be slightly faster. - */ - - if( pDrawable->type != DRAWABLE_WINDOW ) - { - cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); - return; - } - - alu = pGC->alu; - prgnDst = cfbGetCompositeClip(pGC); - pptLast = ppt + nspans; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - BANK_FLAG(pdstBase) - - yMax = (int) pDrawable->y + (int) pDrawable->height; - - pbox = REGION_RECTS(prgnDst); - pboxLast = pbox + REGION_NUM_RECTS(prgnDst); - - if(fSorted) - { - /* scan lines sorted in ascending order. Because they are sorted, we - * don't have to check each scanline against each clip box. We can be - * sure that this scanline only has to be clipped to boxes at or after the - * beginning of this y-band - */ - pboxTest = pbox; - while(ppt < pptLast) - { - pbox = pboxTest; - if(ppt->y >= yMax) - break; - while(pbox < pboxLast) - { - if(pbox->y1 > ppt->y) - { - /* scanline is before clip box */ - break; - } - else if(pbox->y2 <= ppt->y) - { - /* clip box is before scanline */ - pboxTest = ++pbox; - continue; - } - else if(pbox->x1 > ppt->x + *pwidth) - { - /* clip box is to right of scanline */ - break; - } - else if(pbox->x2 <= ppt->x) - { - /* scanline is to right of clip box */ - pbox++; - continue; - } - - /* at least some of the scanline is in the current clip box */ - xStart = max(pbox->x1, ppt->x); - xEnd = min(ppt->x + *pwidth, pbox->x2); - cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, - (int *)pdstBase, widthDst, pGC->planemask); - if(ppt->x + *pwidth <= pbox->x2) - { - /* End of the line, as it were */ - break; - } - else - pbox++; - } - /* We've tried this line against every box; it must be outside them - * all. move on to the next point */ - ppt++; - psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth); - pwidth++; - } - } - else - { - /* scan lines not sorted. We must clip each line against all the boxes */ - while(ppt < pptLast) - { - if(ppt->y >= 0 && ppt->y < yMax) - { - - for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++) - { - if(pbox->y1 > ppt->y) - { - /* rest of clip region is above this scanline, - * skip it */ - break; - } - if(pbox->y2 <= ppt->y) - { - /* clip box is below scanline */ - pbox++; - break; - } - if(pbox->x1 <= ppt->x + *pwidth && - pbox->x2 > ppt->x) - { - xStart = max(pbox->x1, ppt->x); - xEnd = min(pbox->x2, ppt->x + *pwidth); - cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, - (int *)pdstBase, widthDst, pGC->planemask); - } - - } - } - psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth); - ppt++; - pwidth++; - } - } -} - Index: xc/programs/Xserver/hw/xfree86/vgafb/vgasolid.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgasolid.c:1.3 xc/programs/Xserver/hw/xfree86/vgafb/vgasolid.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgasolid.c:1.3 Sun Dec 26 19:39:48 1999 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgasolid.c Fri Jan 18 15:26:24 2002 @@ -1,189 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgasolid.c,v 1.3 1999/12/27 00:39:48 robin Exp $ */ -/* - * -Copyright (c) 1990 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - * - * Author: Keith Packard, MIT X Consortium - */ -/* $XConsortium: vgasolid.c /main/3 1996/02/21 18:11:58 kaleb $ */ - - -#include "vgafb.h" -#include "cfbrrop.h" -#include "mispans.h" - -void -#if (RROP == GXcopy) -#ifdef SPEEDUP -speedupvga256FillRectSolidCopy (pDrawable, pGC, nBox, pBox) -#else -vga256FillRectSolidCopy (pDrawable, pGC, nBox, pBox) -#endif -#else -RROP_NAME(vga256FillRectSolid) (pDrawable, pGC, nBox, pBox) -#endif - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; - BoxPtr pBox; -{ - RROP_DECLARE -#ifdef SPEEDUP - unsigned long *pdstBase, *pdstRect; - int h; - int w; - int widthDst; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) -#endif /* SPEEDUP */ - - RROP_FETCH_GC(pGC) -#ifdef SPEEDUP -#if (RROP == GXcopy) - for (; nBox; nBox--, pBox++) - { - pdstRect = pdstBase + pBox->y1 * widthDst; - h = pBox->y2 - pBox->y1; - w = pBox->x2 - pBox->x1; - - SpeedUpBox((unsigned char*)pdstRect + pBox->x1, - rrop_xor, h, w, widthDst << PWSH); - } -#endif /* GXcopy */ -#else /* SPEEDUP */ -#if RROP == GXcopy - vga256FillBoxSolid (pDrawable, nBox, pBox, rrop_xor, 0L, GXcopy); -#endif /* GXcopy */ -#endif /* SPEEDUP */ -#if RROP == GXxor - vga256FillBoxSolid (pDrawable, nBox, pBox, rrop_xor, 0L, GXxor); -#endif /* GXxor */ -#if RROP == GXor - vga256FillBoxSolid (pDrawable, nBox, pBox, rrop_or, 0L, GXor); -#endif /* GXor */ -#if RROP == GXand - vga256FillBoxSolid (pDrawable, nBox, pBox, rrop_and, 0L, GXand); -#endif /* GXand */ -#if RROP == GXset - vga256FillBoxSolid (pDrawable, nBox, pBox, rrop_and, rrop_xor, GXset); -#endif /* GXset */ -} - -#ifndef SPEEDUP - -void -RROP_NAME(vga256SolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - unsigned long *pdstBase; - int widthDst; - - RROP_DECLARE - - register unsigned long *pdst EDI; - int nlmiddle, nl; - register unsigned long startmask, endmask; - int w; - int x; - - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidthFree;/* copies of the pointers to free */ - DDXPointPtr pptFree; - int *pwidth; - cfbPrivGCPtr devPriv; - - devPriv = cfbGetGCPrivate(pGC); - RROP_FETCH_GCPRIV(devPriv) - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - BANK_FLAG(pdstBase) - - CLD; - - while (n--) - { - x = ppt->x; - pdst = pdstBase + (ppt->y * widthDst); - ++ppt; - w = *pwidth++; - if (!w) - continue; - if (w <= PGSZB) - { - register char *addrb; - - addrb = ((char *) pdst) + x; - SETRW(addrb); - while (w--) - { - RROP_SOLID (addrb); - addrb++; CHECKRWO(addrb); - } - } - else - { - pdst += x >> PWSH; - SETRW(pdst); - maskbits (x, w, startmask, endmask, nlmiddle); - if (startmask) - { - RROP_SOLID_MASK (pdst, startmask); - ++pdst; CHECKRWO(pdst); - } - - RROP_SPAN_STD(pdst,nlmiddle,SO_1); - CHECKRWO(pdst); - - if (endmask) - { - CHECKRWO(pdst); - RROP_SOLID_MASK (pdst, endmask); - } - } - } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); -} -#endif /* SPEEDUP */ Index: xc/programs/Xserver/hw/xfree86/vgafb/vgateblt8.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgateblt8.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgateblt8.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgateblt8.c:1.2 Sat Jul 25 12:58:25 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgateblt8.c Fri Jan 18 15:26:25 2002 @@ -1,721 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgateblt8.c,v 1.2 1998/07/25 16:58:25 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. -*/ - -/* $XConsortium: vgateblt8.c /main/3 1996/02/21 18:12:01 kaleb $ */ -/* - * TEGblt - ImageText expanded glyph fonts only. For - * 8 bit displays, in Copy mode with no clipping. - */ - - -#include "vgafb.h" - -#ifdef SPEEDUP -#define SIMPLER_CHECKRWO(x) {if(vgaWriteFlag) x = vgaReadWriteNext(x);} -#endif - - -/* - * this code supports up to 5 characters at a time. The performance - * differences between 4 and 5 is usually small (~7% on PMAX) and - * frequently negative (SPARC and Sun3), so this file is compiled - * only once for now. If you want to use the other options, you'll - * need to hack cfbgc.c as well. - */ - - -#ifndef NGLYPHS -#define NGLYPHS 4 -#define DO_COMMON -#endif - - -#ifdef DO_COMMON -#ifdef SPEEDUP -#define CFBTEGBLT8 speedupvga256TEGlyphBlt8 -#else -#define CFBTEGBLT8 vga256TEGlyphBlt8 -#endif -#endif - -/* - * On little-endian machines (or where fonts are padded to 32-bit - * boundaries) we can use some magic to avoid the expense of getleftbits - */ - -#if ((BITMAP_BIT_ORDER == LSBFirst && NGLYPHS >= 4) || GLYPHPADBYTES == 4) - -#if GLYPHPADBYTES == 1 -typedef unsigned char *glyphPointer; -#define USE_LEFTBITS -#endif - -#if GLYPHPADBYTES == 2 -typedef unsigned short *glyphPointer; -#define USE_LEFTBITS -#endif - -#if GLYPHPADBYTES == 4 -typedef unsigned int *glyphPointer; -#endif - -#define GetBitsL c = BitLeft (*leftChar++, lshift) - -#define GetBits1S c = BitRight(*char1++, xoff1) -#define GetBits1L GetBitsL | BitRight(*char1++, xoff1) -#define GetBits1U c = *char1++ -#define GetBits2S GetBits1S | BitRight(*char2++, xoff2) -#define GetBits2L GetBits1L | BitRight(*char2++, xoff2) -#define GetBits2U GetBits1U | BitRight(*char2++, xoff2) -#define GetBits3S GetBits2S | BitRight(*char3++, xoff3) -#define GetBits3L GetBits2L | BitRight(*char3++, xoff3) -#define GetBits3U GetBits2U | BitRight(*char3++, xoff3) -#define GetBits4S GetBits3S | BitRight(*char4++, xoff4) -#define GetBits4L GetBits3L | BitRight(*char4++, xoff4) -#define GetBits4U GetBits3U | BitRight(*char4++, xoff4) -#define GetBits5S GetBits4S | BitRight(*char5++, xoff5) -#define GetBits5L GetBits4L | BitRight(*char5++, xoff5) -#define GetBits5U GetBits4U | BitRight(*char5++, xoff5) - -#else - -typedef unsigned char *glyphPointer; - -#define USE_LEFTBITS - -#define GetBitsL WGetBitsL -#define GetBits1S WGetBits1S -#define GetBits1L WGetBits1L -#define GetBits1U WGetBits1U - -#define GetBits2S GetBits1S Get1Bits (char2, tmpSrc) \ - c |= BitRight(tmpSrc, xoff2); -#define GetBits2L GetBits1L Get1Bits (char2, tmpSrc) \ - c |= BitRight(tmpSrc, xoff2); -#define GetBits2U GetBits1U Get1Bits (char2, tmpSrc) \ - c |= BitRight(tmpSrc, xoff2); - -#define GetBits3S GetBits2S Get1Bits (char3, tmpSrc) \ - c |= BitRight(tmpSrc, xoff3); -#define GetBits3L GetBits2L Get1Bits (char3, tmpSrc) \ - c |= BitRight(tmpSrc, xoff3); -#define GetBits3U GetBits2U Get1Bits (char3, tmpSrc) \ - c |= BitRight(tmpSrc, xoff3); - -#define GetBits4S GetBits3S Get1Bits (char4, tmpSrc) \ - c |= BitRight(tmpSrc, xoff4); -#define GetBits4L GetBits3L Get1Bits (char4, tmpSrc) \ - c |= BitRight(tmpSrc, xoff4); -#define GetBits4U GetBits3U Get1Bits (char4, tmpSrc) \ - c |= BitRight(tmpSrc, xoff4); - -#define GetBits5S GetBits4S Get1Bits (char5, tmpSrc) \ - c |= BitRight(tmpSrc, xoff5); -#define GetBits5L GetBits4L Get1Bits (char5, tmpSrc) \ - c |= BitRight(tmpSrc, xoff5); -#define GetBits5U GetBits4U Get1Bits (char5, tmpSrc) \ - c |= BitRight(tmpSrc, xoff5); - -#endif - -#ifdef USE_LEFTBITS -extern unsigned long endtab[]; - -#define IncChar(c) (c = (glyphPointer) (((char *) c) + glyphBytes)) - -#define Get1Bits(ch,dst) glyphbits (ch, widthGlyph, glyphMask, dst); \ - IncChar (ch); - -#define glyphbits(bits,width,mask,dst) getleftbits(bits,width,dst); \ - dst &= mask; - -#define WGetBitsL Get1Bits(leftChar,c); \ - c = BitLeft (c, lshift); -#define WGetBits1S Get1Bits (char1, c) \ - c = BitRight (c, xoff1); -#define WGetBits1L WGetBitsL Get1Bits (char1, tmpSrc) \ - c |= BitRight (tmpSrc, xoff1); -#define WGetBits1U Get1Bits (char1, c) - -#else -#define WGetBitsL GetBitsL -#define WGetBits1S GetBits1S -#define WGetBits1L GetBits1L -#define WGetBits1U GetBits1U -#endif - -#if NGLYPHS == 2 -# define GetBitsNS GetBits2S -# define GetBitsNL GetBits2L -# define GetBitsNU GetBits2U -# define LastChar char2 -#ifndef CFBTEGBLT8 -# define CFBTEGBLT8 vga256TEGlyphBlt8x2 -#endif -#endif -#if NGLYPHS == 3 -# define GetBitsNS GetBits3S -# define GetBitsNL GetBits3L -# define GetBitsNU GetBits3U -# define LastChar char3 -#ifndef CFBTEGBLT8 -# define CFBTEGBLT8 vga256TEGlyphBlt8x3 -#endif -#endif -#if NGLYPHS == 4 -# define GetBitsNS GetBits4S -# define GetBitsNL GetBits4L -# define GetBitsNU GetBits4U -# define LastChar char4 -#ifndef CFBTEGBLT8 -# define CFBTEGBLT8 vga256TEGlyphBlt8x4 -#endif -#endif -#if NGLYPHS == 5 -# define GetBitsNS GetBits5S -# define GetBitsNL GetBits5L -# define GetBitsNU GetBits5U -# define LastChar char5 -#ifndef CFBTEGBLT8 -# define CFBTEGBLT8 vga256TEGlyphBlt8x5 -#endif -#endif - -/* another ugly giant macro */ -#ifdef SPEEDUP -#define SwitchEm hTmp = SpeedUpRowsNext[hGlenn = 0]; \ - switch (ew) \ - { \ - case 0: \ - break; \ - case 1: \ -do { \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 \ - Loop \ - } \ - hTmp = SpeedUpRowsNext[++hGlenn]; \ - SIMPLER_CHECKRWO(dst) \ -} while (hTmp); \ - break; \ - case 2: \ -do { \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) \ - Loop \ - } \ - hTmp = SpeedUpRowsNext[++hGlenn]; \ - SIMPLER_CHECKRWO(dst) \ -} while (hTmp); \ - break; \ - case 3: \ -do { \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step StoreBits(2) \ - Loop \ - } \ - hTmp = SpeedUpRowsNext[++hGlenn]; \ - SIMPLER_CHECKRWO(dst) \ -} while (hTmp); \ - break; \ - case 4: \ -do { \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) \ - Loop \ - } \ - hTmp = SpeedUpRowsNext[++hGlenn]; \ - SIMPLER_CHECKRWO(dst) \ -} while (hTmp); \ - break; \ - case 5: \ -do { \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) \ - Loop \ - } \ - hTmp = SpeedUpRowsNext[++hGlenn]; \ - SIMPLER_CHECKRWO(dst) \ -} while (hTmp); \ - break; \ - case 6: \ -do { \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) \ - Loop \ - } \ - hTmp = SpeedUpRowsNext[++hGlenn]; \ - SIMPLER_CHECKRWO(dst) \ -} while (hTmp); \ - break; \ - case 7: \ -do { \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) Step \ - StoreBits(6) \ - Loop \ - } \ - hTmp = SpeedUpRowsNext[++hGlenn]; \ - SIMPLER_CHECKRWO(dst) \ -} while (hTmp); \ - break; \ - case 8: \ -do { \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) Step \ - StoreBits(6) Step StoreBits(7) \ - Loop \ - } \ - hTmp = SpeedUpRowsNext[++hGlenn]; \ - SIMPLER_CHECKRWO(dst) \ -} while (hTmp); \ - break; \ - } - -#else /* SPEEDUP */ -#define SwitchEm switch (ew) \ - { \ - case 0: \ - break; \ - case 1: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 \ - Loop \ - } \ - break; \ - case 2: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) \ - Loop \ - } \ - break; \ - case 3: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step StoreBits(2) \ - Loop \ - } \ - break; \ - case 4: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) \ - Loop \ - } \ - break; \ - case 5: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) \ - Loop \ - } \ - break; \ - case 6: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) \ - Loop \ - } \ - break; \ - case 7: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) Step \ - StoreBits(6) \ - Loop \ - } \ - break; \ - case 8: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) Step \ - StoreBits(6) Step StoreBits(7) \ - Loop \ - } \ - break; \ - } -#endif /* SPEEDUP */ - -#ifdef FAST_CONSTANT_OFFSET_MODE -#define StorePixels(o,p) dst[o] = p -#define Loop dst += widthDst; -#else -#ifdef SPEEDUP -#define StorePixels(o,p) *dst = (p); dst++; -#define Loop dst += widthLeft; -#else -#define StorePixels(o,p) *dst = (p); dst++; CHECKRWO(dst); -/* *dst++ = (p); CHECKRWO(dst); */ -#define Loop dst += widthLeft; CHECKRWO(dst); -#endif -#endif - -#define Step NextBitGroup(c); - -#if (BITMAP_BIT_ORDER == MSBFirst) -#define StoreBits(o) StorePixels(o,GetPixelGroup(c)); -#define FirstStep Step -#else -#if PGSZ == 64 -#define StoreBits(o) StorePixels(o,cfb8Pixels[(c) & PGSZBMSK]); -#define FirstStep Step -#else /* PGSZ == 32 */ -#define StoreBits(o) StorePixels(o,*((unsigned long *) (((char *) cfb8Pixels) + (c & 0x3c)))); -#define FirstStep c = BitLeft (c, 2); -#endif /* PGSZ */ -#endif - -void -CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GC *pGC; - int xInit, yInit; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - pointer pglyphBase; /* start of array of glyphs */ -{ - register unsigned long c; - register unsigned long *dst EDI; - register unsigned long leftMask, rightMask; - register int hTmp; - register int xoff1; - register int xoff2; -#if NGLYPHS >= 3 - register int xoff3; -#endif -#if NGLYPHS >= 4 - register int xoff4; -#endif -#if NGLYPHS >= 5 - register int xoff5; -#endif - register glyphPointer char1; - register glyphPointer char2; -#if NGLYPHS >= 3 - register glyphPointer char3; -#endif -#if NGLYPHS >= 4 - register glyphPointer char4; -#endif -#if NGLYPHS >= 5 - register glyphPointer char5; -#endif - - -#ifdef SPEEDUP - int hGlenn; -#endif - - - FontPtr pfont = pGC->font; - unsigned long *dstLine; - glyphPointer oldRightChar; - unsigned long *pdstBase; - glyphPointer leftChar; - int widthDst, widthLeft; - int widthGlyph; - int h; - int ew; - int x, y; - BoxRec bbox; /* for clipping */ - int lshift; - int widthGlyphs; -#ifdef USE_LEFTBITS - register unsigned long glyphMask; - register unsigned long tmpSrc; - register int glyphBytes; -#endif - - widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - -#ifdef SPEEDUP - if ((h | widthGlyph) == 0) return; -#endif - -#ifndef SPEEDUP - if (!h) - return; -#endif - - x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x; - y = yInit - FONTASCENT(pfont) + pDrawable->y; - bbox.x1 = x; - bbox.x2 = x + (widthGlyph * nglyph); - bbox.y1 = y; - bbox.y2 = y + h; - - switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox)) - { - case rgnPART: - cfbImageGlyphBlt8(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase); - case rgnOUT: - return; - } - - if (!cfb8CheckPixels (pGC->fgPixel, pGC->bgPixel)) - cfb8SetPixels (pGC->fgPixel, pGC->bgPixel); - - leftChar = 0; - - cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase) - - BANK_FLAG(pdstBase) - -#if NGLYPHS == 2 - widthGlyphs = widthGlyph << 1; -#else -#if NGLYPHS == 4 - widthGlyphs = widthGlyph << 2; -#else - widthGlyphs = widthGlyph * NGLYPHS; -#endif -#endif - -#ifdef USE_LEFTBITS - glyphMask = endtab[widthGlyph]; - glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci); -#endif - - pdstBase += y * widthDst; - - -#ifdef SPEEDUP -SpeedUpComputeNext((unsigned)pdstBase, h); -#endif - - -#ifdef DO_COMMON - if (widthGlyphs <= 32) -#endif - while (nglyph >= NGLYPHS) - { - nglyph -= NGLYPHS; - hTmp = h; - dstLine = pdstBase + (x >> PWSH); - xoff1 = x & PIM; - char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); - char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); - xoff2 = xoff1 + widthGlyph; -#if NGLYPHS >= 3 - char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); - xoff3 = xoff2 + widthGlyph; -#endif -#if NGLYPHS >= 4 - char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); - xoff4 = xoff3 + widthGlyph; -#endif -#if NGLYPHS >= 5 - char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); - xoff5 = xoff4 + widthGlyph; -#endif - oldRightChar = LastChar; - dst = dstLine; - SETRW(dst); - if (xoff1) - { - ew = ((widthGlyphs - (PGSZB - xoff1)) >> PWSH) + 1; -#ifndef FAST_CONSTANT_OFFSET_MODE - widthLeft = widthDst - ew; -#endif - if (!leftChar) - { - leftMask = cfbendtab[xoff1]; - rightMask = cfbstarttab[xoff1]; - -#define StoreBits0 StorePixels (0,dst[0] & leftMask | \ - GetPixelGroup(c) & rightMask); -#define GetBits GetBitsNS - - SwitchEm - -#undef GetBits -#undef StoreBits0 - - } - else - { - lshift = widthGlyph - xoff1; - -#define StoreBits0 StorePixels (0,GetPixelGroup(c)); -#define GetBits GetBitsNL - - SwitchEm - -#undef GetBits -#undef StoreBits0 - - } - } - else - { -#if NGLYPHS == 4 && PGSZ == 32 - ew = widthGlyph; /* widthGlyphs >> 2 */ -#else - ew = widthGlyphs >> PWSH; -#endif -#ifndef FAST_CONSTANT_OFFSET_MODE - widthLeft = widthDst - ew; -#endif - -#define StoreBits0 StorePixels (0,GetPixelGroup(c)); -#define GetBits GetBitsNU - - SwitchEm - -#undef GetBits -#undef StoreBits0 - - } - x += widthGlyphs; - leftChar = oldRightChar; - } - while (nglyph--) - { - xoff1 = x & PIM; - char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); - hTmp = h; - dstLine = pdstBase + (x >> PWSH); - oldRightChar = char1; - dst = dstLine; - SETRW(dst); - if (xoff1) - { - ew = ((widthGlyph - (PGSZB - xoff1)) >> PWSH) + 1; -#ifndef FAST_CONSTANT_OFFSET_MODE - widthLeft = widthDst - ew; -#endif - if (!leftChar) - { - leftMask = cfbendtab[xoff1]; - rightMask = cfbstarttab[xoff1]; - -#define StoreBits0 StorePixels (0,dst[0] & leftMask | GetPixelGroup(c) & rightMask); -#define GetBits WGetBits1S - - SwitchEm -#undef GetBits -#undef StoreBits0 - - } - else - { - lshift = widthGlyph - xoff1; - -#define StoreBits0 StorePixels (0,GetPixelGroup(c)); -#define GetBits WGetBits1L - - SwitchEm -#undef GetBits -#undef StoreBits0 - - } - } - else - { - ew = widthGlyph >> PWSH; - -#ifndef FAST_CONSTANT_OFFSET_MODE - widthLeft = widthDst - ew; -#endif - -#define StoreBits0 StorePixels (0,GetPixelGroup(c)); -#define GetBits WGetBits1U - - SwitchEm - -#undef GetBits -#undef StoreBits0 - - } - x += widthGlyph; - leftChar = oldRightChar; - } - /* - * draw the tail of the last character - */ - xoff1 = x & PIM; - if (xoff1) - { - rightMask = cfbstarttab[xoff1]; - leftMask = cfbendtab[xoff1]; - lshift = widthGlyph - xoff1; - dst = pdstBase + (x >> PWSH); - SETRW(dst); - -#ifndef SPEEDUP - hTmp = h; -#else - hTmp = SpeedUpRowsNext[hGlenn = 0]; - do { -#endif - while (hTmp--) - { - GetBitsL; - *dst = (*dst & rightMask) | (GetPixelGroup(c) & leftMask); - dst += widthDst; -#ifndef SPEEDUP - CHECKRWO(dst); -#endif - } -#ifdef SPEEDUP - hTmp = SpeedUpRowsNext[++hGlenn]; - SIMPLER_CHECKRWO(dst) - } while (hTmp); -#endif - - - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgategblt.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgategblt.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgategblt.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgategblt.c:1.2 Sat Jul 25 12:58:25 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgategblt.c Fri Jan 18 15:26:25 2002 @@ -1,198 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgategblt.c,v 1.2 1998/07/25 16:58:25 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgategblt.c /main/3 1996/02/21 18:12:05 kaleb $ */ - -#include "vgafb.h" -#include "compiler.h" - -#define MFB_CONSTS_ONLY -#include "maskbits.h" - - -/* - this works for fonts with glyphs <= 32 bits wide, on an - arbitrarily deep display. Use cfbTEGlyphBlt8 for 8 bit displays. - - This should be called only with a terminal-emulator font; -this means that the FIXED_METRICS flag is set, and that -glyphbounds == charbounds. - - in theory, this goes faster; even if it doesn't, it reduces the -flicker caused by writing a string over itself with image text (since -the background gets repainted per character instead of per string.) -this seems to be important for some converted X10 applications. - - Image text looks at the bits in the glyph and the fg and bg in the -GC. it paints a rectangle, as defined in the protocol dcoument, -and the paints the characters. - -*/ - -void -vga256TEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GC *pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - pointer pglyphBase; /* start of array of glyphs */ -{ - FontPtr pfont = pGC->font; - int widthDst; - unsigned long *pdstBase; /* pointer to longword with top row - of current glyph */ - - int w; /* width of glyph and char */ - int h; /* height of glyph and char */ - register int xpos=x; /* current x%32 */ - int ypos=y; /* current y%32 */ - register unsigned char *pglyph; - int widthGlyph; - - register unsigned long *pdst;/* pointer to current longword in dst */ - int hTmp; /* counter for height */ - BoxRec bbox; /* for clipping */ - - register int wtmp,xtemp,width; - unsigned long bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp; - int tmpx; - - xpos += pDrawable->x; - ypos += pDrawable->y; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - BANK_FLAG(pdstBase) - - wtmp = FONTMAXBOUNDS(pfont,characterWidth); - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - widthGlyph = GLYPHWIDTHBYTESPADDED(*ppci); - - xpos += FONTMAXBOUNDS(pfont,leftSideBearing); - ypos -= FONTASCENT(pfont); - - bbox.x1 = xpos; - bbox.x2 = xpos + (wtmp * nglyph); - bbox.y1 = ypos; - bbox.y2 = ypos + h; - - fgfill = PFILL(pGC->fgPixel); - bgfill = PFILL(pGC->bgPixel); - - switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox)) - { - case rgnOUT: - break; - case rgnPART: - /* this is the WRONG thing to do, but it works. - calling the non-terminal text is easy, but slow, given - what we know about the font. - - the right thing to do is something like: - for each clip rectangle - compute at which row the glyph starts to be in it, - and at which row the glyph ceases to be in it - compute which is the first glyph inside the left - edge, and the last one inside the right edge - draw a fractional first glyph, using only - the rows we know are in - draw all the whole glyphs, using the appropriate rows - draw any pieces of the last glyph, using the right rows - - this way, the code would take advantage of knowing that - all glyphs are the same height and don't overlap. - - one day... - */ - miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - break; - case rgnIN: - - pdtmp = pdstBase + (widthDst * ypos); - while(nglyph--) - { - - pglyph = FONTGLYPHBITS(pglyphBase, *ppci++); - pdst = pdtmp; - hTmp = h; - - while (hTmp--) - { - x = xpos; - width = wtmp; - xtemp = 0; - - while (width > 0) - { - tmpx = x & PIM; - w = min(width, PPW - tmpx); - w = min(w, (PGSZ - xtemp)); - - ptemp = (unsigned long *)(pglyph + (xtemp >> MFB_PWSH)); - getstipplepixels(ptemp,xtemp,w,0,&bgfill,&tmpDst1); - getstipplepixels(ptemp,xtemp,w,1,&fgfill,&tmpDst2); - - { - unsigned long tmpDst = tmpDst1 | tmpDst2; - unsigned long *pdsttmp = pdst + (x >> PWSH); - SETRW(pdsttmp); - putbits(tmpDst,tmpx,w,pdsttmp,pGC->planemask); - } - x += w; - xtemp += w; - width -= w; - } - pglyph += widthGlyph; - pdst += widthDst; - } - xpos += wtmp; - } - break; - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgatile32.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgatile32.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgatile32.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgatile32.c:1.2 Sat Jul 25 12:58:26 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgatile32.c Fri Jan 18 15:26:25 2002 @@ -1,358 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgatile32.c,v 1.2 1998/07/25 16:58:26 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. -*/ - -/* $XConsortium: vgatile32.c /main/3 1996/02/21 18:12:09 kaleb $ */ -/* - * Fill 32 bit tiled rectangles. Used by both PolyFillRect and PaintWindow. - * no depth dependencies. - */ - -#include "vgafb.h" -#include "mergerop.h" -#include "mi.h" -#include "mispans.h" - -#ifdef sparc -#define SHARED_IDCACHE -#endif - -#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p))) - -#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) -# define Expand(left,right) {\ - int part = nlwMiddle & ((PGSZB*2)-1); \ - nlwMiddle >>= PWSH + 1; \ - while (h--) { \ - srcpix = psrc[srcy]; \ - MROP_PREBUILD(srcpix); \ - ++srcy; \ - if (srcy == tileHeight) \ - srcy = 0; \ - left \ - p += part; \ - switch (part) { \ - case 7: \ - STORE(p - 7); \ - case 6: \ - STORE(p - 6); \ - case 5: \ - STORE(p - 5); \ - case 4: \ - STORE(p - 4); \ - case 3: \ - STORE(p - 3); \ - case 2: \ - STORE(p - 2); \ - case 1: \ - STORE(p - 1); \ - } \ - nlw = nlwMiddle; \ - while (nlw) { \ - STORE (p + 0); \ - STORE (p + 1); \ - STORE (p + 2); \ - STORE (p + 3); \ - STORE (p + 4); \ - STORE (p + 5); \ - STORE (p + 6); \ - STORE (p + 7); \ - p += 8; \ - nlw--; \ - } \ - right \ - p += nlwExtra; \ - } \ -} -#else -#define Expand(left,right) {\ - while (h--) { \ - srcpix = psrc[srcy]; \ - MROP_PREBUILD(srcpix); \ - ++srcy; \ - if (srcy == tileHeight) \ - srcy = 0; \ - left \ - nlw = nlwMiddle; \ - while (nlw--) \ - { \ - STORE(p); \ - p++; CHECKRWO(p); \ - } \ - right \ - p += nlwExtra; CHECKRWO(p); \ - } \ -} -#endif - -void -MROP_NAME(vga256FillRectTile32) (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; /* number of boxes to fill */ - BoxPtr pBox; /* pointer to list of boxes to fill */ -{ - register unsigned long srcpix; - unsigned long *psrc; /* pointer to bits in tile, if needed */ - int tileHeight; /* height of the tile */ - - int nlwDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - register int h; /* height of current box */ - register unsigned long startmask; - register unsigned long endmask; /* masks for reggedy bits at either end of line */ - int nlwMiddle; /* number of longwords between sides of boxes */ - int nlwExtra; /* to get from right of box to left of next span */ - register int nlw; /* loop version of nlwMiddle */ - register unsigned long *p; /* pointer to bits we're writing */ - int y; /* current scan line */ - int srcy; /* current tile position */ - - unsigned long *pbits;/* pointer to start of pixmap */ - PixmapPtr tile; /* rotated, expanded tile */ - MROP_DECLARE_REG() - MROP_PREBUILT_DECLARE() - - tile = pGC->pRotatedPixmap; - tileHeight = tile->drawable.height; - psrc = (unsigned long *)tile->devPrivate.ptr; - - MROP_INITIALIZE(pGC->alu, pGC->planemask); - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - BANK_FLAG(pbits) - - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - y = pBox->y1; - p = pbits + (pBox->y1 * nlwDst) + (pBox->x1 >> PWSH); - SETRW(p); - srcy = y % tileHeight; - - if ( ((pBox->x1 & PIM) + w) <= PPW) - { - maskpartialbits(pBox->x1, w, startmask); - nlwExtra = nlwDst; - while (h--) - { - srcpix = psrc[srcy]; - MROP_PREBUILD(srcpix); - ++srcy; - if (srcy == tileHeight) - srcy = 0; - *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); - p += nlwExtra; CHECKRWO(p); - } - } - else - { - maskbits(pBox->x1, w, startmask, endmask, nlwMiddle); - nlwExtra = nlwDst - nlwMiddle; - - if (startmask) - { - nlwExtra -= 1; - if (endmask) - { - Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++; CHECKRWO(p); , - *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);) - } - else - { - Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++; CHECKRWO(p);, - ;) - } - } - else - { - if (endmask) - { - Expand(;, - *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);) - } - else - { - Expand(;, - ;) - } - } - } - pBox++; - } -} - -void -MROP_NAME(vga256Tile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidth;/* pointer to list of n widths */ - unsigned long *pbits; /* pointer to start of bitmap */ - int nlwDst; /* width in longwords of bitmap */ - register unsigned long *p; /* pointer to current longword in bitmap */ - register int w; /* current span width */ - register int nlw; - register int x; - register unsigned long startmask; - register unsigned long endmask; - register unsigned long srcpix; - int y; - int *pwidthFree;/* copies of the pointers to free */ - DDXPointPtr pptFree; - PixmapPtr tile; - unsigned long *psrc; /* pointer to bits in tile */ - int tileHeight;/* height of the tile */ - MROP_DECLARE_REG () - MROP_PREBUILT_DECLARE() - - /* - * If nothing is going to actually touch the framebuffer, then - * do the work with the cfb routines as they should be slightly faster. - */ - - if( pDrawable->type != DRAWABLE_WINDOW ) - { - MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - return; - } - - n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans( cfbGetCompositeClip(pGC), - pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - tile = pGC->pRotatedPixmap; - tileHeight = tile->drawable.height; - psrc = (unsigned long *)tile->devPrivate.ptr; - - MROP_INITIALIZE(pGC->alu, pGC->planemask); - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - BANK_FLAG(pbits) - -#if MROP == Mcopy - if (!(tileHeight & (tileHeight-1))) - { - tileHeight--; - while (n--) - { - x = ppt->x; - y = ppt->y; - ++ppt; - w = *pwidth++; - p = pbits + (y * nlwDst) + (x >> PWSH); - SETRW(p); - srcpix = psrc[y & tileHeight]; - MROP_PREBUILD(srcpix); - - if ((x & PIM) + w < PPW) - { - maskpartialbits(x, w, startmask); - *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); - } - else - { - maskbits(x, w, startmask, endmask, nlw); - if (startmask) - { - *p = MROP_PREBUILT_MASK(srcpix, *p, startmask); - p++; CHECKRWO(p); - } - while (nlw--) - { - STORE(p); - ++p; CHECKRWO(p); - } - if (endmask) - { - *p = MROP_PREBUILT_MASK(srcpix, *p, endmask); - } - } - } - } - else -#endif - { - while (n--) - { - x = ppt->x; - y = ppt->y; - ++ppt; - w = *pwidth++; - p = pbits + (y * nlwDst) + (x >> PWSH); - SETRW(p); - srcpix = psrc[y % tileHeight]; - MROP_PREBUILD(srcpix); - - if ((x & PIM) + w < PPW) - { - maskpartialbits(x, w, startmask); - *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); - } - else - { - maskbits(x, w, startmask, endmask, nlw); - if (startmask) - { - *p = MROP_PREBUILT_MASK(srcpix, *p, startmask); - p++; CHECKRWO(p); - } - while (nlw--) - { - STORE(p); - ++p; CHECKRWO(p); - } - if (endmask) - { - *p = MROP_PREBUILT_MASK(srcpix, *p, endmask); - } - } - } - } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgatileodd.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgatileodd.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgatileodd.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgatileodd.c:1.2 Sat Jul 25 12:58:26 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgatileodd.c Fri Jan 18 15:26:25 2002 @@ -1,1070 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgatileodd.c,v 1.2 1998/07/25 16:58:26 dawes Exp $ */ -/* - -Copyright (c) 1989 X Consortium -Copyright 1992 by James Tsillas, Arlington, Massachusetts - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from the X Consortium. - -*/ -/* $XConsortium: vgatileodd.c /main/3 1996/02/21 18:12:13 kaleb $ */ - -/* - * Fill odd tiled rectangles and spans. - * no depth dependencies. - */ - -#include "vgafb.h" -#include "mergerop.h" - -#if PGSZ == 32 -#define LEFTSHIFT_AMT (5 - PWSH) -#else /* PGSZ == 64 */ -#define LEFTSHIFT_AMT (6 - PWSH) -#endif /* PGSZ */ - -#define LastTileBits {\ - tmp = bits; \ - if (tileEndPart) \ - bits = (*pSrc & tileEndMask) | BitRight (*pSrcLine, tileEndLeftShift); \ - else \ - bits = *pSrc; \ -} - -#define ResetTileBits {\ - pSrc = pSrcLine; \ - nlwSrc = widthSrc;\ - if (tileEndPart) { \ - if (PPW - xoff + tileEndPart <= PPW) {\ - bits = *pSrc++; \ - nlwSrc--; \ - } else \ - bits = BitLeft(tmp, tileEndLeftShift) | \ - BitRight(bits, tileEndRightShift); \ - xoff = (xoff + xoffStep) & PIM; \ - leftShift = xoff << LEFTSHIFT_AMT; \ - rightShift = PGSZ - leftShift; \ - }\ -} - -#define NextTileBits {\ - if (nlwSrc == 1) {\ - LastTileBits\ - } else { \ - if (nlwSrc == 0) {\ - ResetTileBits\ - } \ - tmp = bits; \ - bits = *pSrc++; \ - }\ - nlwSrc--; \ -} - -void -MROP_NAME(vga256FillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask) - DrawablePtr pDrawable; - int nBox; /* number of boxes to fill */ - register BoxPtr pBox; /* pointer to list of boxes to fill */ - PixmapPtr tile; /* tile */ - int xrot, yrot; - int alu; - unsigned long planemask; -{ - int tileWidth; /* width of tile in pixels */ - int tileHeight; /* height of the tile */ - int widthSrc; - - int widthDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - int h; /* height of current box */ - unsigned long startmask; - unsigned long endmask; /* masks for reggedy bits at either end of line */ - int nlwMiddle; /* number of longwords between sides of boxes */ - int nlwSrc; /* number of whole longwords in source */ - - register int nlw; /* loop version of nlwMiddle */ - int srcy; /* current tile y position */ - int srcx; /* current tile x position */ - int xoffDst, xoffSrc; - int leftShift, rightShift; - - MROP_DECLARE_REG() - - unsigned long *pDstBase; /* pointer to start of dest */ - unsigned long *pDstLine; /* poitner to start of dest box */ - unsigned long *pSrcBase; /* pointer to start of source */ - unsigned long *pSrcLine; /* pointer to start of source line */ - register unsigned long *pDst; - register unsigned long *pSrc; - register unsigned long bits, tmp; - register int nlwPart; - int xoffStart, xoff; - int leftShiftStart, rightShiftStart, nlwSrcStart; - unsigned long tileEndMask; - int tileEndLeftShift, tileEndRightShift; - int xoffStep; - int tileEndPart; - int needFirst; - unsigned long narrow[2]; - unsigned long narrowMask; - int narrowShift; - Bool narrowTile; - - MROP_INITIALIZE (alu, planemask) - - tileHeight = tile->drawable.height; - tileWidth = tile->drawable.width; - widthSrc = tile->devKind / PGSZB; - narrowTile = FALSE; - if (widthSrc == 1) - { - narrowShift = tileWidth; - narrowMask = cfbendpartial [tileWidth]; - tileWidth *= 2; - widthSrc = 2; - narrowTile = TRUE; - } - pSrcBase = (unsigned long *)tile->devPrivate.ptr; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pDstBase) - - BANK_FLAG(pDstBase) - - tileEndPart = tileWidth & PIM; - tileEndMask = cfbendpartial[tileEndPart]; - tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT; - tileEndRightShift = PGSZ - tileEndLeftShift; - xoffStep = PPW - tileEndPart; - /* - * current assumptions: tile > 32 bits wide. - */ - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - modulus (pBox->x1 - xrot, tileWidth, srcx); - modulus (pBox->y1 - yrot, tileHeight, srcy); - xoffDst = pBox->x1 & PIM; - if (xoffDst + w < PPW) - { - maskpartialbits(pBox->x1, w, startmask); - endmask = 0; - nlwMiddle = 0; - } - else - { - maskbits (pBox->x1, w, startmask, endmask, nlwMiddle) - } - pDstLine = pDstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); - pSrcLine = pSrcBase + (srcy * widthSrc); - xoffSrc = srcx & PIM; - if (xoffSrc >= xoffDst) - { - xoffStart = xoffSrc - xoffDst; - needFirst = 1; - } - else - { - xoffStart = PPW - (xoffDst - xoffSrc); - needFirst = 0; - } - leftShiftStart = (xoffStart) << LEFTSHIFT_AMT; - rightShiftStart = PGSZ - leftShiftStart; - nlwSrcStart = widthSrc - (srcx >> PWSH); - while (h--) - { - /* XXX only works when narrowShift >= PPW/2 */ - if (narrowTile) - { - tmp = pSrcLine[0] & narrowMask; - narrow[0] = tmp | SCRRIGHT (tmp, narrowShift); - narrow[1] = SCRLEFT (tmp, PPW - narrowShift) | - SCRRIGHT(tmp, 2 * narrowShift - PPW); - pSrcLine = narrow; - } - xoff = xoffStart; - leftShift = leftShiftStart; - rightShift = rightShiftStart; - nlwSrc = nlwSrcStart; - pSrc = pSrcLine + (srcx >> PWSH); - pDst = pDstLine; - SETRW(pDst); - bits = 0; - if (needFirst) - { - NextTileBits - } - if (startmask) - { - NextTileBits - tmp = BitLeft(tmp, leftShift); - if (rightShift != PGSZ) - tmp |= BitRight(bits,rightShift); - *pDst = MROP_MASK (tmp, *pDst, startmask); - ++pDst; CHECKRWO(pDst); - } - nlw = nlwMiddle; - while (nlw) - { -#if MROP == Mcopy - if (nlwSrc > 1) - { - nlwPart = nlw; - if (nlwPart >= nlwSrc) - nlwPart = nlwSrc - 1; - nlw -= nlwPart; - nlwSrc -= nlwPart; - if (rightShift != PGSZ) - { - while (nlwPart--) - { - tmp = bits; - bits = *pSrc++; - *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | - BitRight (bits, rightShift), - *pDst); - ++pDst; CHECKRWO(pDst); - } - } - else - { - if (nlwPart) - { - *pDst = MROP_SOLID (bits, *pDst); - ++pDst; CHECKRWO(pDst); - nlwPart--; - while (nlwPart--) - { - *pDst = MROP_SOLID(*pSrc, *pDst); - ++pDst; ++pSrc; CHECKRWO(pDst); - } - bits = *pSrc++; - } - } - } - else -#endif - { - NextTileBits - if (rightShift != PGSZ) - { - *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | - BitRight(bits, rightShift), - *pDst); - ++pDst; CHECKRWO(pDst); - } - else - { - *pDst = MROP_SOLID (tmp, *pDst); - ++pDst; CHECKRWO(pDst); - } - nlw--; - } - } - if (endmask) - { - NextTileBits - if (rightShift == PGSZ) - bits = 0; - *pDst = MROP_MASK (BitLeft(tmp, leftShift) | - BitRight(bits,rightShift), - *pDst, endmask); - } - pDstLine += widthDst; - pSrcLine += widthSrc; - if (++srcy == tileHeight) - { - srcy = 0; - pSrcLine = pSrcBase; - } - } - pBox++; - } -} - -void -MROP_NAME(vga256FillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask) - DrawablePtr pDrawable; - int n; - DDXPointPtr ppt; - int *pwidth; - PixmapPtr tile; - int xrot, yrot; - int alu; - unsigned long planemask; -{ - int tileWidth; /* width of tile in pixels */ - int tileHeight; /* height of the tile */ - int widthSrc; - - int widthDst; /* width in longwords of the dest pixmap */ - int w; /* width of current span */ - unsigned long startmask; - unsigned long endmask; /* masks for reggedy bits at either end of line */ - int nlwSrc; /* number of whole longwords in source */ - - register int nlw; /* loop version of nlwMiddle */ - int srcy; /* current tile y position */ - int srcx; /* current tile x position */ - int xoffDst, xoffSrc; - int leftShift, rightShift; - - MROP_DECLARE_REG() - - unsigned long *pDstBase; /* pointer to start of dest */ - unsigned long *pDstLine; /* poitner to start of dest box */ - unsigned long *pSrcBase; /* pointer to start of source */ - unsigned long *pSrcLine; /* pointer to start of source line */ - register unsigned long *pDst; - register unsigned long *pSrc; - register unsigned long bits, tmp; - register int nlwPart; - int xoffStart, xoff; - int leftShiftStart, rightShiftStart, nlwSrcStart; - unsigned long tileEndMask; - int tileEndLeftShift, tileEndRightShift; - int xoffStep; - int tileEndPart; - int needFirst; - unsigned long narrow[2]; - unsigned long narrowMask; - int narrowShift; - Bool narrowTile; - - MROP_INITIALIZE (alu, planemask) - - tileHeight = tile->drawable.height; - tileWidth = tile->drawable.width; - widthSrc = tile->devKind / PGSZB; - narrowTile = FALSE; - if (widthSrc == 1) - { - narrowShift = tileWidth; - narrowMask = cfbendpartial [tileWidth]; - tileWidth *= 2; - widthSrc = 2; - narrowTile = TRUE; - } - pSrcBase = (unsigned long *)tile->devPrivate.ptr; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pDstBase) - - BANK_FLAG(pDstBase) - - tileEndPart = tileWidth & PIM; - tileEndMask = cfbendpartial[tileEndPart]; - tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT; - tileEndRightShift = PGSZ - tileEndLeftShift; - xoffStep = PPW - tileEndPart; - while (n--) - { - w = *pwidth++; - modulus (ppt->x - xrot, tileWidth, srcx); - modulus (ppt->y - yrot, tileHeight, srcy); - xoffDst = ppt->x & PIM; - if (xoffDst + w < PPW) - { - maskpartialbits(ppt->x, w, startmask); - endmask = 0; - nlw = 0; - } - else - { - maskbits (ppt->x, w, startmask, endmask, nlw) - } - pDstLine = pDstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); - pSrcLine = pSrcBase + (srcy * widthSrc); - xoffSrc = srcx & PIM; - if (xoffSrc >= xoffDst) - { - xoffStart = xoffSrc - xoffDst; - needFirst = 1; - } - else - { - xoffStart = PPW - (xoffDst - xoffSrc); - needFirst = 0; - } - leftShiftStart = (xoffStart) << LEFTSHIFT_AMT; - rightShiftStart = PGSZ - leftShiftStart; - nlwSrcStart = widthSrc - (srcx >> PWSH); - /* XXX only works when narrowShift >= PPW/2 */ - if (narrowTile) - { - tmp = pSrcLine[0] & narrowMask; - narrow[0] = tmp | SCRRIGHT (tmp, narrowShift); - narrow[1] = SCRLEFT (tmp, PPW - narrowShift) | - SCRRIGHT(tmp, 2 * narrowShift - PPW); - pSrcLine = narrow; - } - xoff = xoffStart; - leftShift = leftShiftStart; - rightShift = rightShiftStart; - nlwSrc = nlwSrcStart; - pSrc = pSrcLine + (srcx >> PWSH); - pDst = pDstLine; - SETRW(pDst); - bits = 0; - if (needFirst) - { - NextTileBits - } - if (startmask) - { - NextTileBits - tmp = BitLeft(tmp, leftShift); - if (rightShift != PGSZ) - tmp |= BitRight(bits,rightShift); - *pDst = MROP_MASK (tmp, *pDst, startmask); - ++pDst; CHECKRWO(pDst); - } - while (nlw) - { -#if MROP == Mcopy - if (nlwSrc > 1) - { - nlwPart = nlw; - if (nlwPart >= nlwSrc) - nlwPart = nlwSrc - 1; - nlw -= nlwPart; - nlwSrc -= nlwPart; - if (rightShift != PGSZ) - { - while (nlwPart--) - { - tmp = bits; - bits = *pSrc++; - *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | - BitRight (bits, rightShift), - *pDst); - ++pDst; CHECKRWO(pDst); - } - } - else - { - if (nlwPart) - { - *pDst = MROP_SOLID (bits, *pDst); - ++pDst; CHECKRWO(pDst); - nlwPart--; - while (nlwPart--) - { - *pDst = MROP_SOLID(*pSrc, *pDst); - ++pDst; ++pSrc; CHECKRWO(pDst); - } - bits = *pSrc++; - } - } - } - else -#endif - { - NextTileBits - if (rightShift != PGSZ) - { - *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | - BitRight(bits, rightShift), - *pDst); - ++pDst; CHECKRWO(pDst); - } - else - { - *pDst = MROP_SOLID (tmp, *pDst); - ++pDst; CHECKRWO(pDst); - } - nlw--; - } - } - if (endmask) - { - NextTileBits - if (rightShift == PGSZ) - bits = 0; - *pDst = MROP_MASK (BitLeft(tmp, leftShift) | - BitRight(bits,rightShift), - *pDst, endmask); - } - ppt++; - } -} - -# include "fastblt.h" - -#define IncSrcPtr psrc++; if (!--srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } - -void -MROP_NAME(vga256FillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask) - DrawablePtr pDrawable; - int nBox; /* number of boxes to fill */ - BoxPtr pBox; /* pointer to list of boxes to fill */ - PixmapPtr tile; /* tile */ - int xrot, yrot; - int alu; - unsigned long planemask; -{ - int tileWidth; /* width of tile */ - int tileHeight; /* height of the tile */ - int widthSrc; /* width in longwords of the source tile */ - - int widthDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - int h; /* height of current box */ - int maxh; - unsigned long startmask; - unsigned long endmask; /* masks for reggedy bits at either end of line */ - int nlMiddle; /* number of longwords between sides of boxes */ - - int srcy; /* current tile y position */ - int srcx; /* current tile x position */ - int srcRemaining; /* number of longwords remaining in source */ - int xoffDst, xoffSrc; - int srcStart; /* number of longwords source offset at left of box */ - int leftShift, rightShift; - - MROP_DECLARE_REG() - - unsigned long *pdstBase; /* pointer to start of dest */ - unsigned long *pdstLine; /* poitner to start of dest box */ - unsigned long *psrcBase; /* pointer to start of source */ - unsigned long *psrcLine; /* pointer to fetch point of source */ - unsigned long *psrcStart; /* pointer to start of source line */ - register unsigned long *pdst EDI; - register unsigned long *psrc ESI; - register unsigned long bits, bits1; - int nlTemp; - int nlTemp2; - int fnl; - unsigned long *pdstT; - MROP_INITIALIZE (alu, planemask) - - psrcBase = (unsigned long *)tile->devPrivate.ptr; - tileHeight = tile->drawable.height; - tileWidth = tile->drawable.width; - widthSrc = tileWidth >> PWSH; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - BANK_FLAG(pdstBase) - - CLD; - - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - - /* set up source */ - modulus (pBox->x1 - xrot, tileWidth, srcx); - modulus (pBox->y1 - yrot, tileHeight, srcy); - xoffSrc = srcx & PIM; - srcStart = (srcx >> PWSH); - psrcStart = psrcBase + (srcy * widthSrc); - psrcLine = psrcStart + srcStart; - - /* set up dest */ - xoffDst = pBox->x1 & PIM; - pdstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); - /* set up masks */ - if (xoffDst + w < PPW) - { - maskpartialbits(pBox->x1, w, startmask); - endmask = 0; - nlMiddle = 0; - } - else - { - maskbits (pBox->x1, w, startmask, endmask, nlMiddle) - } - - if (xoffSrc == xoffDst) - { - if (pdstLine < (unsigned long *)VGABASE) { - maxh = h; - h = 0; - goto fastpath1; - } - pdstT = pdstLine; - SETRW(pdstLine); - while (h) { - maxh = min(h,((long*)vgaWriteTop - (long*)pdstLine) / widthDst); - pdstT += (maxh * widthDst); - h -= maxh; - fastpath1: - while (maxh--) { /***/ - psrc = psrcLine; pdst = pdstLine; /***/ - srcRemaining = widthSrc - srcStart; /***/ - if (startmask) { /***/ - *pdst = MROP_MASK (*psrc, *pdst, startmask); /***/ - pdst++; IncSrcPtr } /***/ - nlTemp = nlMiddle; - fCopyAL1 (psrc, pdst, nlTemp, srcRemaining, - widthSrc, psrcStart); - if (endmask) *pdst = MROP_MASK (*psrc, *pdst, endmask); /***/ - pdstLine += widthDst; psrcLine += widthSrc; /***/ - psrcStart += widthSrc; /***/ - if (++srcy == tileHeight) { /***/ - psrcStart = psrcBase; psrcLine = psrcStart + srcStart; /***/ - srcy = 0; } /***/ - } /***/ - if (h) { - h--; - psrc = psrcLine; srcRemaining = widthSrc - srcStart; - if (pdstLine >= (unsigned long *)vgaWriteTop) { - pdstLine = pdstT; - SETRW(pdstLine); - } - pdst = pdstLine; - if (startmask) { - *pdst = MROP_MASK (*psrc, *pdst, startmask); - pdst++; IncSrcPtr - if (pdst >= (unsigned long *)vgaWriteTop) - pdst = vgaReadWriteNext(pdst); - } - nlTemp2 = (long*)vgaWriteTop - (long*)pdst; - nlTemp = min(nlMiddle, nlTemp2); - nlTemp2 = nlMiddle - nlTemp; - fCopyAL2 (psrc, pdst, nlTemp, srcRemaining, widthSrc, - psrcStart); - if (nlTemp2) { - pdst = vgaReadWriteNext(pdst); - fCopyAL3 (psrc, pdst, nlTemp2, srcRemaining, - widthSrc, psrcStart); - } - if (endmask) { - if (pdst >= (unsigned long *)vgaWriteTop) - pdst = vgaReadWriteNext(pdst); - *pdst = MROP_MASK (*psrc, *pdst, endmask); - } - pdstT += widthDst; pdstLine += widthDst; - if (pdstLine >= (unsigned long *)vgaWriteTop) { - pdstLine = pdstT; SETRW(pdstLine); - } - psrcLine += widthSrc; psrcStart += widthSrc; - if (++srcy == tileHeight) { - psrcStart = psrcBase; psrcLine = psrcStart + srcStart; - srcy = 0; } - } - } - } - else - { - if (xoffSrc > xoffDst) { - leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; - rightShift = PGSZ - leftShift; - } - else { - rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; - leftShift = PGSZ - rightShift; - } - if (pdstLine < (unsigned long *)VGABASE) { - maxh = h; - h = 0; - goto fastpath2; - } - pdstT = pdstLine; - SETRW(pdstLine); - while (h) { - maxh = min(h, ((long*)vgaWriteTop - (long*)pdstLine) / widthDst); - h -= maxh; - pdstT += (maxh * widthDst); - fastpath2: - while (maxh--) { - psrc = psrcLine; pdst = pdstLine; bits = 0; - srcRemaining = widthSrc - srcStart; - if (xoffSrc > xoffDst) { - bits = *psrc; IncSrcPtr - } - if (startmask) { - bits1 = BitLeft(bits,leftShift); bits = *psrc; IncSrcPtr - bits1 |= BitRight(bits,rightShift); - *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; - } - nlTemp = nlMiddle; - while (nlTemp) { - fnl = nlTemp; - if (fnl > srcRemaining) - fnl = srcRemaining; - nlTemp -= fnl; srcRemaining -= fnl; - DuffL (fnl, label000, - fCopyUL(psrc, pdst, bits, leftShift, rightShift);) - if (!srcRemaining) { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - if (endmask) { - bits1 = BitLeft(bits, leftShift); - if (BitLeft(endmask, rightShift)) { - bits = *psrc; - bits1 |= BitRight(bits, rightShift); - } - *pdst = MROP_MASK (bits1, *pdst, endmask); - } - pdstLine += widthDst; psrcLine += widthSrc; - psrcStart += widthSrc; - if (++srcy == tileHeight) { - psrcStart = psrcBase; psrcLine = psrcStart + srcStart; - srcy = 0; - } - } - if (h) { - h--; - psrc = psrcLine; bits = 0; - srcRemaining = widthSrc - srcStart; - if (pdstLine >= (unsigned long *)vgaWriteTop) { - pdstLine = pdstT; - SETRW(pdstLine); - } - pdst = pdstLine; - if (xoffSrc > xoffDst) { - bits = *psrc; IncSrcPtr - } - if (startmask) { - bits1 = BitLeft(bits,leftShift); bits = *psrc; IncSrcPtr - bits1 |= BitRight(bits,rightShift); - *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; - if (pdst >= (unsigned long *)vgaWriteTop) - pdst = vgaReadWriteNext(pdst); - } - nlTemp2 = (long*)vgaWriteTop - (long*)pdst; - nlTemp = min(nlMiddle, nlTemp2); - nlTemp2 = nlMiddle - nlTemp; - while (nlTemp) { - fnl = nlTemp; - if (fnl > srcRemaining) - fnl = srcRemaining; - nlTemp -= fnl; srcRemaining -= fnl; - while (fnl--) { - bits1 = BitLeft(bits, leftShift); bits = *psrc++; - *pdst = MROP_SOLID (bits1 | - BitRight(bits, rightShift), *pdst); - pdst++; - } - if (!srcRemaining) { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - if (nlTemp2) { - pdst = vgaReadWriteNext(pdst); - while (nlTemp2) { - fnl = nlTemp2; - if (fnl > srcRemaining) - fnl = srcRemaining; - nlTemp2 -= fnl; srcRemaining -= fnl; - while (fnl--) { - bits1 = BitLeft(bits, leftShift); bits = *psrc++; - *pdst = MROP_SOLID (bits1 | - BitRight(bits, rightShift), *pdst); - pdst++; - } - if (!srcRemaining) { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - } - if (endmask) { - if (pdst >= (unsigned long *)vgaWriteTop) - pdst = vgaReadWriteNext(pdst); - bits1 = BitLeft(bits, leftShift); - if (BitLeft(endmask, rightShift)) { - bits = *psrc; - bits1 |= BitRight(bits, rightShift); - } - *pdst = MROP_MASK (bits1, *pdst, endmask); - } - pdstT += widthDst; pdstLine += widthDst; - if (pdstLine >= (unsigned long *)vgaWriteTop) { - pdstLine = pdstT; SETRW(pdstLine); - } - psrcLine += widthSrc; psrcStart += widthSrc; - if (++srcy == tileHeight) { - psrcStart = psrcBase; psrcLine = psrcStart + srcStart; - srcy = 0; - } - } - } - } - pBox++; - } -} - -void -MROP_NAME(vga256FillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask) - DrawablePtr pDrawable; - int n; - DDXPointPtr ppt; - int *pwidth; - PixmapPtr tile; - int xrot, yrot; - int alu; - unsigned long planemask; -{ - int tileWidth; /* width of tile */ - int tileHeight; /* height of the tile */ - int widthSrc; /* width in longwords of the source tile */ - - int widthDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - unsigned long startmask; - unsigned long endmask; /* masks for reggedy bits at either end of line */ - int nlMiddle; /* number of longwords between sides of boxes */ - - register int nl; /* loop version of nlMiddle */ - int srcy; /* current tile y position */ - int srcx; /* current tile x position */ - int srcRemaining; /* number of longwords remaining in source */ - int xoffDst, xoffSrc; - int srcStart; /* number of longwords source offset at left of box */ - int leftShift, rightShift; - - MROP_DECLARE_REG() - - unsigned long *pdstBase; /* pointer to start of dest */ - unsigned long *pdstLine; /* poitner to start of dest box */ - unsigned long *psrcBase; /* pointer to start of source */ - unsigned long *psrcLine; /* pointer to fetch point of source */ - unsigned long *psrcStart; /* pointer to start of source line */ - register unsigned long *pdst; - register unsigned long *psrc; - register unsigned long bits, bits1; - register int nlTemp; - - MROP_INITIALIZE (alu, planemask) - - psrcBase = (unsigned long *)tile->devPrivate.ptr; - tileHeight = tile->drawable.height; - tileWidth = tile->drawable.width; - widthSrc = tileWidth >> PWSH; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - BANK_FLAG(pdstBase) - - while (n--) - { - w = *pwidth++; - - /* set up source */ - modulus (ppt->x - xrot, tileWidth, srcx); - modulus (ppt->y - yrot, tileHeight, srcy); - xoffSrc = srcx & PIM; - srcStart = (srcx >> PWSH); - psrcStart = psrcBase + (srcy * widthSrc); - psrcLine = psrcStart + srcStart; - - /* set up dest */ - xoffDst = ppt->x & PIM; - pdstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); - /* set up masks */ - if (xoffDst + w < PPW) - { - maskpartialbits(ppt->x, w, startmask); - endmask = 0; - nlMiddle = 0; - } - else - { - maskbits (ppt->x, w, startmask, endmask, nlMiddle) - } - - if (xoffSrc == xoffDst) - { - psrc = psrcLine; - pdst = pdstLine; - SETRW(pdst); - srcRemaining = widthSrc - srcStart; - if (startmask) - { - *pdst = MROP_MASK (*psrc, *pdst, startmask); - pdst++; CHECKRWO(pdst); - IncSrcPtr - } - nlTemp = nlMiddle; - while (nlTemp) - { - nl = nlTemp; - if (nl > srcRemaining) - nl = srcRemaining; - - nlTemp -= nl; - srcRemaining -= nl; - -#ifdef LARGE_INSTRUCTION_CACHE -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); -#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; CHECKRWO(pdst); -#define BodyEven(n) BodyOdd(n) - -#define LoopReset ; - -#endif - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL(nl, label1, - *pdst = MROP_SOLID (*psrc, *pdst); - pdst++; psrc++; CHECKRWO(pdst); ) -#endif - if (!srcRemaining) - { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - if (endmask) - { - *pdst = MROP_MASK (*psrc, *pdst, endmask); - } - } - else - { - if (xoffSrc > xoffDst) - { - leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; - rightShift = PGSZ - leftShift; - } - else - { - rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; - leftShift = PGSZ - rightShift; - } - psrc = psrcLine; - pdst = pdstLine; - SETRW(pdst); - bits = 0; - srcRemaining = widthSrc - srcStart; - if (xoffSrc > xoffDst) - { - bits = *psrc; - IncSrcPtr - } - if (startmask) - { - bits1 = BitLeft(bits,leftShift); - bits = *psrc; - IncSrcPtr - bits1 |= BitRight(bits,rightShift); - *pdst = MROP_MASK(bits1, *pdst, startmask); - pdst++; CHECKRWO(pdst); - } - nlTemp = nlMiddle; - while (nlTemp) - { - nl = nlTemp; - if (nl > srcRemaining) - nl = srcRemaining; - - nlTemp -= nl; - srcRemaining -= nl; - -#ifdef LARGE_INSTRUCTION_CACHE - bits1 = bits; - -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) \ -bits = psrc[-n]; \ -pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); - -#define BodyEven(n) \ -bits1 = psrc[-n]; \ -pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#define BodyOdd(n) \ -bits = *psrc++; \ -*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ -pdst++; CHECKRWO(pdst); - -#define BodyEven(n) \ -bits1 = *psrc++; \ -*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ -pdst++; CHECKRWO(pdst); - -#define LoopReset ; - -#endif /* !FAST_CONSTANT_OFFSET_MODE */ - - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL (nl,label2, - bits1 = BitLeft(bits, leftShift); - bits = *psrc++; - *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); - pdst++; CHECKRWO(pdst); - ) -#endif - if (!srcRemaining) - { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - - if (endmask) - { - bits1 = BitLeft(bits, leftShift); - if (BitLeft(endmask, rightShift)) - { - bits = *psrc; - bits1 |= BitRight(bits, rightShift); - } - *pdst = MROP_MASK (bits1, *pdst, endmask); - } - } - ppt++; - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgawindow.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgawindow.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgawindow.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgawindow.c:1.2 Sat Jul 25 12:58:27 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgawindow.c Fri Jan 18 15:26:25 2002 @@ -1,100 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgawindow.c,v 1.2 1998/07/25 16:58:27 dawes Exp $ */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: vgawindow.c /main/3 1996/02/21 18:12:18 kaleb $ */ - -#include "vgafb.h" - -extern WindowPtr *WindowTable; - -void -vga256CopyWindow(pWin, ptOldOrg, prgnSrc) - WindowPtr pWin; - DDXPointRec ptOldOrg; - RegionPtr prgnSrc; -{ - DDXPointPtr pptSrc; - register DDXPointPtr ppt; - RegionRec rgnDst; - register BoxPtr pbox; - register int dx, dy; - register int i, nbox; - WindowPtr pwinRoot; - - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - - REGION_INIT(pWin->drawable.pScreen, &rgnDst, NullBox, 0); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc -); - - pbox = REGION_RECTS(&rgnDst); - nbox = REGION_NUM_RECTS(&rgnDst); - - if(!nbox || !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) - { - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); - return; - } - ppt = pptSrc; - - for (i = nbox; --i >= 0; ppt++, pbox++) - { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - (*vga256LowlevFuncs.doBitbltCopy)((DrawablePtr)pwinRoot, - (DrawablePtr)pwinRoot, - GXcopy, &rgnDst, pptSrc, ~0L, ~0L); - DEALLOCATE_LOCAL(pptSrc); - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); -} Index: xc/programs/Xserver/hw/xfree86/vgafb/vgazerarc.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/vgazerarc.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/vgazerarc.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/vgazerarc.c:1.2 Sat Jul 25 12:58:27 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/vgazerarc.c Fri Jan 18 15:26:25 2002 @@ -1,201 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/vgazerarc.c,v 1.2 1998/07/25 16:58:27 dawes Exp $ */ -/************************************************************ - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -********************************************************/ - -/* $XConsortium: vgazerarc.c /main/3 1996/02/21 18:12:21 kaleb $ */ - -/* Derived from: - * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" - * by M. L. V. Pitteway - * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289 - */ - -#include "vgafb.h" -#include "mizerarc.h" -#include "cfbrrop.h" - -#define __RROP_SOLID(a) { register unsigned char *addrbt = (a); \ - SETRW(addrbt); RROP_SOLID(addrbt); } -#ifdef PIXEL_ADDR - -static void -RROP_NAME(vga256ZeroArcSS8) (pDraw, pGC, arc) - DrawablePtr pDraw; - GCPtr pGC; - xArc *arc; -{ - miZeroArcRec info; - Bool do360; - register int x; - unsigned char *addrb; - register unsigned char *yorgb, *yorgob; - RROP_DECLARE - register int yoffset; - int nbwidth, dyoffset; - register int y, a, b, d, mask; - register int k1, k3, dx, dy; - - cfbGetByteWidthAndPointer(pDraw,nbwidth, addrb) - - BANK_FLAG(addrb) - - RROP_FETCH_GC (pGC); - do360 = miZeroArcSetup(arc, &info, TRUE); - yorgb = addrb + ((info.yorg + pDraw->y) * nbwidth); - yorgob = addrb + ((info.yorgo + pDraw->y) * nbwidth); - info.xorg += pDraw->x; - info.xorgo += pDraw->x; - MIARCSETUP(); - yoffset = y ? nbwidth : 0; - dyoffset = 0; - mask = info.initialMask; - if (!(arc->width & 1)) - { - if (mask & 2) - __RROP_SOLID((yorgb + info.xorgo)); - if (mask & 8) - __RROP_SOLID((yorgob + info.xorgo)); - } - if (!info.end.x || !info.end.y) - { - mask = info.end.mask; - info.end = info.altend; - } - if (do360 && (arc->width == arc->height) && !(arc->width & 1)) - { - register int xoffset = nbwidth; - unsigned char *yorghb = yorgb + (info.h * nbwidth) + info.xorg; - unsigned char *yorgohb = yorghb - info.h; - - yorgb += info.xorg; - yorgob += info.xorg; - yorghb += info.h; - while (1) - { - __RROP_SOLID(yorgb + yoffset + x); - __RROP_SOLID(yorgb + yoffset - x); - __RROP_SOLID(yorgob - yoffset - x); - __RROP_SOLID(yorgob - yoffset + x); - if (a < 0) - break; - __RROP_SOLID(yorghb - xoffset - y); - __RROP_SOLID(yorgohb - xoffset + y); - __RROP_SOLID(yorgohb + xoffset + y); - __RROP_SOLID(yorghb + xoffset - y); - xoffset += nbwidth; - MIARCCIRCLESTEP(yoffset += nbwidth;); - } - yorgb -= info.xorg; - yorgob -= info.xorg; - x = info.w; - yoffset = info.h * nbwidth; - } - else if (do360) - { - while (y < info.h || x < info.w) - { - MIARCOCTANTSHIFT(dyoffset = nbwidth;); - __RROP_SOLID(yorgb + yoffset + info.xorg + x); - __RROP_SOLID(yorgb + yoffset + info.xorgo - x); - __RROP_SOLID(yorgob - yoffset + info.xorgo - x); - __RROP_SOLID(yorgob - yoffset + info.xorg + x); - MIARCSTEP(yoffset += dyoffset;, yoffset += nbwidth;); - } - } - else - { - while (y < info.h || x < info.w) - { - MIARCOCTANTSHIFT(dyoffset = nbwidth;); - if ((x == info.start.x) || (y == info.start.y)) - { - mask = info.start.mask; - info.start = info.altstart; - } - if (mask & 1) - __RROP_SOLID(yorgb + yoffset + info.xorg + x); - if (mask & 2) - __RROP_SOLID(yorgb + yoffset + info.xorgo - x); - if (mask & 4) - __RROP_SOLID(yorgob - yoffset + info.xorgo - x); - if (mask & 8) - __RROP_SOLID(yorgob - yoffset + info.xorg + x); - if ((x == info.end.x) || (y == info.end.y)) - { - mask = info.end.mask; - info.end = info.altend; - } - MIARCSTEP(yoffset += dyoffset;, yoffset += nbwidth;); - } - } - if ((x == info.start.x) || (y == info.start.y)) - mask = info.start.mask; - if (mask & 1) - __RROP_SOLID(yorgb + yoffset + info.xorg + x); - if (mask & 4) - __RROP_SOLID(yorgob - yoffset + info.xorgo - x); - if (arc->height & 1) - { - if (mask & 2) - __RROP_SOLID(yorgb + yoffset + info.xorgo - x); - if (mask & 8) - __RROP_SOLID(yorgob - yoffset + info.xorg + x); - } -} - -void -RROP_NAME (vga256ZeroPolyArcSS8) (pDraw, pGC, narcs, parcs) - register DrawablePtr pDraw; - GCPtr pGC; - int narcs; - xArc *parcs; -{ - register xArc *arc; - register int i; - BoxRec box; - RegionPtr cclip; - - cclip = cfbGetCompositeClip(pGC); - for (arc = parcs, i = narcs; --i >= 0; arc++) - { - if (miCanZeroArc(arc)) - { - box.x1 = arc->x + pDraw->x; - box.y1 = arc->y + pDraw->y; - box.x2 = box.x1 + (int)arc->width + 1; - box.y2 = box.y1 + (int)arc->height + 1; - if ((*pDraw->pScreen->RectIn)(cclip, &box) == rgnIN) - RROP_NAME (vga256ZeroArcSS8) (pDraw, pGC, arc); - else - miZeroPolyArc(pDraw, pGC, 1, arc); - } - else - miPolyArc(pDraw, pGC, 1, arc); - } -} - -#endif Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/SpeedUpBlt.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/SpeedUpBlt.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/SpeedUpBlt.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/SpeedUpBlt.c:1.2 Sat Jul 25 12:58:27 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/SpeedUpBlt.c Fri Jan 18 15:26:25 2002 @@ -1,92 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/SpeedUpBlt.c,v 1.2 1998/07/25 16:58:27 dawes Exp $ */ -/******************************************************************************* - Copyr 1992 by Glenn G. Lai - - All Rs Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyr notice appear in all copies and that -both that copyr notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -glenn@cs.utexas.edu) -8/17/92 -*******************************************************************************/ -/* $XConsortium: SpeedUpBlt.c /main/4 1996/02/21 18:08:35 kaleb $ */ - -#include "vgafb.h" - -static char copyright[] = "Copyright 8/17/1992 by Glenn G. Lai"; - -void -SpeedUpBitBlt(sBase, dBase, widthS, widthD, x, y, x1, y1, w, h, xdir, ydir) - unsigned char *sBase, *dBase; - int widthS, widthD; - int x, y, x1, y1, w, h; - int xdir, ydir; -{ - if (sBase >= (unsigned char*)VGABASE) - if (dBase >= (unsigned char*)VGABASE) { - unsigned char *src, *dst; - - if (y == y1 && xdir == -1) { - src = sBase + (y+h-1) * widthS + x + w - 1 - VGABASE; - dst = dBase + (y1+h-1) * widthD + x1 + w - 1-VGABASE; - WinWin(src, dst, h, w, -1, -1, widthS, 1); - } else if (ydir == -1) { - src = sBase - (y + h - 1) * widthS + x - VGABASE; - dst = dBase - (y1 + h - 1) * widthD + x1 - VGABASE; - WinWin(src, dst, h, w, xdir, -1, widthS, 0); - } else { /* ydir == 1 */ - src = sBase + y * widthS + x - VGABASE; - dst = dBase + y1 * widthD + x1 - VGABASE; - WinWin(src, dst, h, w, xdir, 1, widthS, 0); - } - } else { - if (widthS <0) - widthS = -widthS; - if (widthD <0) - widthD = -widthD; - WinPix(sBase+(y*widthS)+x,dBase+(y1*widthD)+x1, - h, w, widthS, widthD); - } - else if (dBase >= (unsigned char*)VGABASE) { - if (widthS <0) - widthS = -widthS; - if (widthD <0) - widthD = -widthD; - PixWin(sBase+(y*widthS)+x,dBase+(y1*widthD)+x1, h, w, widthS, widthD); - } else { - if (ydir == 1) - if ((y == y1) && (xdir == -1)) - PixPix(sBase+((y+h-1)*widthS)+x+w-1, - dBase+((y1+h-1)*widthD)+x1+w-1, - h, w, -widthS + w, -widthD + w, -1); - else - PixPix(sBase+(y*widthS)+x,dBase+(y1*widthD)+x1, - h, w, widthS - w, widthD - w, 1); - else - if (w > 4) - PixPix(sBase-((y+h-1)*widthS)+x+w-1, - dBase-((y1+h-1)*widthD)+x1+w-1, - h, w, widthS + w, widthD + w, -1); - else - PixPix(sBase-((y+h-1)*widthS)+x, - dBase-((y1+h-1)*widthD)+x1, - h, w, widthS - w, widthD - w, -1); - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fBitBlt.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fBitBlt.s:1.3 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fBitBlt.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fBitBlt.s:1.3 Sun Dec 26 19:39:49 1999 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fBitBlt.s Fri Jan 18 15:26:25 2002 @@ -1,698 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fBitBlt.s,v 1.3 1999/12/27 00:39:49 robin 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. - * - * Author: Thomas Roell, roell@informatik.tu-muenchen.de - */ -/* $XConsortium: fBitBlt.s /main/4 1996/02/21 18:08:39 kaleb $ */ - - -/* - * Just copy the fastest way you can !!!! - * Not questions of style here, please. - * Since our dragon is SSOOOOOOOOOOOOOO slow don't compute timings the normal - * way. - * ----->>>>> a 'movsl' takes about 144(!!!) cycles on my 33MHz 386 <<<<<----- - * - * But cause of the BRAINDAMAGED 386 you cann't use movsl -- it does only - * post-decrement/increment !!! - * - * (7/28/90 TR) - */ - -#include "assyntax.h" - - FILE("fBitBlt.s") - AS_BEGIN - -#define tmp EBX -#define xdir REGOFF(8,EBP) -#define psrc ESI -#define pdst EDI -#define hcount EDX -#define count REGOFF(24,EBP) -#define srcPitch REGOFF(28,EBP) -#define dstPitch REGOFF(32,EBP) -#define srcPitchReg ECX -#define dstPitchReg EAX -#define xSrc REGOFF(-4,EBP) -#define xDst REGOFF(-8,EBP) -#define countS REGOFF(-12,EBP) -#define Shift ECX -#define low EAX -#define lowb AH -#define lowbl AL -#define loww AX -#define high EDX -#define highb DH -#define highbl DL -#define highw DX -#define hcountS REGOFF(20,EBP) - -SEG_TEXT - ALIGNTEXT4 -GLOBL GLNAME(fastBitBltCopy) -GLNAME(fastBitBltCopy): - PUSH_L (EBP) - MOV_L (ESP,EBP) - SUB_L (CONST(12),ESP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - MOV_L (REGOFF(12,EBP),psrc) - MOV_L (REGOFF(16,EBP),pdst) - MOV_L (REGOFF(20,EBP),hcount) - MOV_L (count,tmp) - - CMP_L (CONST(1),xdir) - JE (.fastmove) - std -.fastmove: - - CMP_L (CONST(5),tmp) - JG (.BlockSetup) - MOV_L (srcPitch,srcPitchReg) - MOV_L (dstPitch,dstPitchReg) - CMP_L (CONST(1),xdir) - JNE (.RightFast) - -.LeftFast: - ADD_L (tmp,srcPitchReg) - ADD_L (tmp,dstPitchReg) - CMP_L (CONST(4),tmp) - JG (.LeftFiveLoop) - JE (.LeftFourLoop) - CMP_L (CONST(2),tmp) - JG (.LeftThreeLoop) - JE (.LeftTwoLoop) - JMP (.LeftOneLoop) - - ALIGNTEXT4 -.LeftOneBody: - MOV_B (REGIND(psrc),BL) - MOV_B (BL,REGIND(pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.LeftOneLoop: - DEC_L (hcount) - JNS (.LeftOneBody) - JMP (.finish) - - ALIGNTEXT4 -.LeftTwoBody: - MOV_W (REGIND(psrc),BX) - MOV_W (BX,REGIND(pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.LeftTwoLoop: - DEC_L (hcount) - JNS (.LeftTwoBody) - JMP (.finish) - - ALIGNTEXT4 -.LeftThreeBody: - MOV_W (REGIND(psrc),BX) - MOV_W (BX,REGIND(pdst)) - MOV_B (REGOFF(2,psrc),BL) - MOV_B (BL,REGOFF(2,pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.LeftThreeLoop: - DEC_L (hcount) - JNS (.LeftThreeBody) - JMP (.finish) - - ALIGNTEXT4 -.LeftFourBody: - MOV_L (REGIND(psrc),EBX) - MOV_L (EBX,REGIND(pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.LeftFourLoop: - DEC_L (hcount) - JNS (.LeftFourBody) - JMP (.finish) - - ALIGNTEXT4 -.LeftFiveBody: - MOV_L (REGIND(psrc),EBX) - MOV_L (EBX,REGIND(pdst)) - MOV_B (REGOFF(4,psrc),BL) - MOV_B (BL,REGOFF(4,pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.LeftFiveLoop: - DEC_L (hcount) - JNS (.LeftFiveBody) - JMP (.finish) - -.RightFast: - SUB_L (tmp,srcPitchReg) - SUB_L (tmp,dstPitchReg) - CMP_L (CONST(4),tmp) - JG (.RightFiveLoop) - JE (.RightFourLoop) - CMP_L (CONST(2),tmp) - JG (.RightThreeLoop) - JE (.RightTwoLoop) - JMP (.RightOneLoop) - - ALIGNTEXT4 -.RightOneBody: - MOV_B (REGOFF(-1,psrc),BL) - MOV_B (BL,REGOFF(-1,pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.RightOneLoop: - DEC_L (hcount) - JNS (.RightOneBody) - JMP (.finish) - - ALIGNTEXT4 -.RightTwoBody: - MOV_W (REGOFF(-2,psrc),BX) - MOV_W (BX,REGOFF(-2,pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.RightTwoLoop: - DEC_L (hcount) - JNS (.RightTwoBody) - JMP (.finish) - - ALIGNTEXT4 -.RightThreeBody: - MOV_W (REGOFF(-3,psrc),BX) - MOV_W (BX,REGOFF(-3,pdst)) - MOV_B (REGOFF(-1,psrc),BL) - MOV_B (BL,REGOFF(-1,pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.RightThreeLoop: - DEC_L (hcount) - JNS (.RightThreeBody) - JMP (.finish) - - ALIGNTEXT4 -.RightFourBody: - MOV_L (REGOFF(-4,psrc),EBX) - MOV_L (EBX,REGOFF(-4,pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.RightFourLoop: - DEC_L (hcount) - JNS (.RightFourBody) - JMP (.finish) - - ALIGNTEXT4 -.RightFiveBody: - MOV_L (REGOFF(-5,psrc),EBX) - MOV_L (EBX,REGOFF(-5,pdst)) - MOV_B (REGOFF(-1,psrc),BL) - MOV_B (BL,REGOFF(-1,pdst)) - ADD_L (srcPitchReg,psrc) - ADD_L (dstPitchReg,pdst) -.RightFiveLoop: - DEC_L (hcount) - JNS (.RightFiveBody) - JMP (.finish) - - -.BlockSetup: - MOV_L (psrc,tmp) - AND_L (CONST(3),tmp) - MOV_L (pdst,Shift) - AND_L (CONST(3),Shift) - CMP_L (Shift,tmp) - JNE (.UnalignedBlock) - - CMP_L (CONST(1),xdir) - JE (.LeftBlockLoop) - JMP (.RightBlockLoop) - -.LeftBlockBody: - TEST_L (CONST(1),pdst) /* align to word ? */ - JZ (.LeftAlignWord) - MOVS_B - DEC_L (tmp) -.LeftAlignWord: - TEST_L (CONST(2),pdst) /* align to dword ? */ - JZ (.LeftStartBlock) - MOVS_W - SUB_L (CONST(2),tmp) -.LeftStartBlock: - MOV_L (tmp,ECX) - SHR_L (CONST(2),ECX) - REPZ - MOVS_L /* tricky: this is really the fastest way !! */ - TEST_L (CONST(2),tmp) /* finish requires a word ? */ - JZ (.LeftFixupByte) - MOVS_W -.LeftFixupByte: - TEST_L (CONST(1),tmp) /* finish requires a byte ? */ - JZ (.LeftBlockEnd) - MOVS_B -.LeftBlockEnd: - ADD_L (srcPitch,psrc) /* ok, goto next line */ - ADD_L (dstPitch,pdst) -.LeftBlockLoop: - MOV_L (count,tmp) /* reload linecounter */ - DEC_L (hcount) - JNS (.LeftBlockBody) - JMP (.finish) - -.RightBlockBody: - TEST_L (CONST(1),pdst) /* align to word ? */ - JZ (.RightAlignWord) - DEC_L (psrc) - DEC_L (pdst) - MOV_B (REGIND(psrc),AL) - MOV_B (AL,REGIND(pdst)) - DEC_L (tmp) -.RightAlignWord: - TEST_L (CONST(2),pdst) /* align to dword ? */ - JZ (.RightStartBlock) - SUB_L (CONST(2),psrc) - SUB_L (CONST(2),pdst) - MOV_W (REGIND(psrc),AX) - MOV_W (AX,REGIND(pdst)) - SUB_L (CONST(2),tmp) -.RightStartBlock: - MOV_L (tmp,ECX) - SHR_L (CONST(2),ECX) - SUB_L (CONST(4),psrc) - SUB_L (CONST(4),pdst) - REPZ - MOVS_L /* tricky: this is really the fastest way !! */ - ADD_L (CONST(4),psrc) - ADD_L (CONST(4),pdst) - TEST_L (CONST(2),tmp) /* finish requires a word ? */ - JZ (.RightFixupByte) - SUB_L (CONST(2),psrc) - SUB_L (CONST(2),pdst) - MOV_W (REGIND(psrc),AX) - MOV_W (AX,REGIND(pdst)) -.RightFixupByte: - TEST_L (CONST(1),tmp) /* finish requires a byte ? */ - JZ (.RightBlockEnd) - DEC_L (psrc) - DEC_L (pdst) - MOV_B (REGIND(psrc),AL) - MOV_B (AL,REGIND(pdst)) -.RightBlockEnd: - ADD_L (srcPitch,psrc) /* ok, goto next line */ - ADD_L (dstPitch,pdst) -.RightBlockLoop: - MOV_L (count,tmp) /* reload linecounter */ - DEC_L (hcount) - JNS (.RightBlockBody) - JMP (.finish) - -/* - * ok, now the cases when Src & Dst are not at the same offset - */ -.UnalignedBlock: - - MOV_L (tmp,xSrc) - MOV_L (Shift,xDst) - CMP_L (CONST(1),xdir) - JNE (.rightShiftSetup) - - SUB_L (tmp,Shift) - JS (.lsAdjustShift) - SUB_L (CONST(4),Shift) -.lsAdjustShift: - NEG_L (Shift) - SHL_L (CONST(3),Shift) - JMP (.leftShiftLoop) - - -.leftShiftBody: - MOV_L (CONST(0),low) - MOV_L (CONST(0),high) -/* - * first load (4-xSrc) Pixels, so that psrc is dword-aligned - */ - MOV_L (xSrc,tmp) - MOV_L (REGDIS(.lseTab,tmp,4),tmp) - JMP (CODEPTR(tmp)) - SEG_DATA - ALIGNDATA4 -.lseTab: D_LONG .lse0, .lse1, .lse2, .lse3 - SEG_TEXT - ALIGNTEXT4 -.lse0: MOV_L (REGIND(psrc),low) - ADD_L (CONST(4),psrc) - SUB_L (CONST(4),countS) - JMP (.lse) -.lse1: MOV_W (REGOFF(1,psrc),loww) - SHL_L (CONST(16),low) - MOV_B (REGIND(psrc),lowb) - ADD_L (CONST(3),psrc) - SUB_L (CONST(3),countS) - JMP (.lse) -.lse2: MOV_W (REGIND(psrc),loww) - SHL_L (CONST(16),low) - ADD_L (CONST(2),psrc) - SUB_L (CONST(2),countS) - JMP (.lse) -.lse3: MOV_B (REGIND(psrc),lowb) - SHL_L (CONST(16),low) - INC_L (psrc) - DEC_L (countS) -/* - * get now the rest of Pixels neccessary to align pdst to a dword - * i.e if (4 - xDst) > (4 - xSrc) get 4 additional Pixels - * i.e if xDst < xSrc !!!! - */ -.lse: MOV_L (xDst,tmp) - OR_L (tmp,tmp) - JZ (.lsf0) - CMP_L (tmp,xSrc) - JL (.lsfirst) - MOV_L (low,high) - MOV_L (REGIND(psrc),low) - ADD_L (CONST(4),psrc) - SUB_L (CONST(4),countS) -/* - * now store (4- xDst) Pixel - */ -.lsfirst: - SHRD2_L (low,high) - MOV_L (REGDIS(.lsfTab,tmp,4),tmp) - JMP (CODEPTR(tmp)) - SEG_DATA - ALIGNDATA4 -.lsfTab: D_LONG .lsf0, .lsf1, .lsf2, .lsf3 - SEG_TEXT - ALIGNTEXT4 -.lsf1: MOV_B (highb,REGIND(pdst)) - SHR_L (CONST(16),high) - MOV_W (highw,REGOFF(1,pdst)) - ADD_L (CONST(3),pdst) - JMP (.lsf0) -.lsf2: SHR_L (CONST(16),high) - MOV_W (highw,REGIND(pdst)) - ADD_L (CONST(2),pdst) - JMP (.lsf0) -.lsf3: SHR_L (CONST(16),high) - MOV_B (highb,REGIND(pdst)) - INC_L (pdst) -/* - * we have countS Pixel to load. Get them as dword, i.e as 4 Pixel group. - * that means we can get (countS >> 2) dwords ! - * since psrc and pdst are aligned dword, this is the fast case. - */ -.lsf0: MOV_L (low,high) - MOV_L (countS,tmp) - SHR_L (CONST(2),tmp) - JMP (.lsdl) - - ALIGNTEXT4 -.lsdb: LODS_L - SHRD2_L (low,high) - XCHG_L (low,high) - STOS_L -.lsdl: DEC_L (tmp) - JNS (.lsdb) -/* - * the are (countS & 3) Pixles to get. - * but be carefull, these pixels are now aligned LEFT !!!! ( on the screen) - */ - XOR_L (low,low) - MOV_L (countS,tmp) - AND_L (CONST(3),tmp) - ADD_L (tmp,psrc) - MOV_L (REGDIS(.lsaTab,tmp,4),tmp) - JMP (CODEPTR(tmp)) - SEG_DATA - ALIGNDATA4 -.lsaTab: D_LONG .lsa0, .lsa1, .lsa2, .lsa3 - SEG_TEXT - ALIGNTEXT4 -.lsa3: MOV_B (REGOFF(-1,psrc),lowbl) - SHL_L (CONST(16),low) - MOV_W (REGOFF(-3,psrc),loww) - JMP (.lsa0) -.lsa2: MOV_W (REGOFF(-2,psrc),loww) - JMP (.lsa0) -.lsa1: MOV_B (REGOFF(-1,psrc),lowbl) - -.lsa0: SHRD2_L (low,high) - SHR_L (CL,low) -/* - * at this point we have read all Pixels, but there are still some to store - * the number of Pixel in [low,high] seems to be ((countS&3)+(4 - Shift)) - * that maens we have here to store 1,2,3,4,5,6 Pixel (0 & 7 are impossible) - */ - MOV_L (countS,tmp) - AND_L (CONST(3),tmp) - ADD_L (CONST(4),tmp) - SHL_L (CONST(3),tmp) - SUB_L (Shift,tmp) - SHR_L (CONST(3),tmp) - ADD_L (tmp,pdst) - MOV_L (REGDIS(.lsgTab,tmp,4),tmp) - JMP (CODEPTR(tmp)) - SEG_DATA - ALIGNDATA4 -.lsgTab: D_LONG .lsg0, .lsg1, .lsg2, .lsg3, .lsg4, .lsg5, .lsg6, .lsg0 - SEG_TEXT - ALIGNTEXT4 -.lsg6: MOV_L (high,REGOFF(-6,pdst)) - MOV_W (loww,REGOFF(-2,pdst)) - JMP (.lsg0) - -.lsg5: MOV_L (high,REGOFF(-5,pdst)) - MOV_B (lowbl,REGOFF(-1,pdst)) - JMP (.lsg0) - -.lsg4: MOV_L (high,REGOFF(-4,pdst)) - JMP (.lsg0) - -.lsg3: MOV_W (highw,REGOFF(-3,pdst)) - SHR_L (CONST(16),high) - MOV_B (highbl,REGOFF(-1,pdst)) - JMP (.lsg0) - -.lsg2: MOV_W (highw,REGOFF(-2,pdst)) - JMP (.lsg0) - -.lsg1: MOV_B (highbl,REGOFF(-1,pdst)) - -.lsg0: MOV_L (countS,tmp) - AND_L (CONST(3),tmp) - ADD_L (CONST(4),tmp) - SHL_L (CONST(3),tmp) - SUB_L (Shift,tmp) - SHR_L (CONST(3),tmp) - - - ADD_L (srcPitch,psrc) - ADD_L (dstPitch,pdst) - -.leftShiftLoop: - MOV_L (count,tmp) - MOV_L (tmp,countS) - DEC_L (hcountS) - JNS (.leftShiftBody) - JMP (.finish) - -/* - * now, descending x-direction - */ -.rightShiftSetup: - - SUB_L (tmp,Shift) - JNS (.rsAdjustShift) - ADD_L (CONST(4),Shift) -.rsAdjustShift: - SHL_L (CONST(3),Shift) - JMP (.rightShiftLoop) - -.rightShiftBody: - MOV_L (CONST(0),low) - MOV_L (CONST(0),high) -/* - * first load (xSrc) Pixels, so that psrc is dword-aligned - */ - MOV_L (xSrc,tmp) - MOV_L (REGDIS(.rseTab,tmp,4),tmp) - JMP (CODEPTR(tmp)) - SEG_DATA - ALIGNDATA4 -.rseTab: D_LONG .rse0, .rse1, .rse2, .rse3 - SEG_TEXT - ALIGNTEXT4 -.rse3: SUB_L (CONST(3),psrc) - SUB_L (CONST(3),countS) - MOV_B (REGOFF(2,psrc),lowbl) - SHL_L (CONST(16),low) - MOV_W (REGIND(psrc),loww) - JMP (.rse0) -.rse2: SUB_L (CONST(2),psrc) - SUB_L (CONST(2),countS) - MOV_W (REGIND(psrc),loww) - JMP (.rse0) -.rse1: DEC_L (psrc) - DEC_L (countS) - MOV_B (REGIND(psrc),lowbl) -/* - * get now the rest of Pixels neccessary to align pdst to a dword - * i.e if (xDst > xSrc) get 4 additional Pixels - */ -.rse0: MOV_L (xDst,tmp) - OR_L (tmp,tmp) - JZ (.rsf0) - CMP_L (tmp,xSrc) - JG (.rsfirst) - SUB_L (CONST(4),psrc) - SUB_L (CONST(4),countS) - MOV_L (low,high) - MOV_L (REGIND(psrc),low) -/* - * now store (xDst) Pixels - */ -.rsfirst: - SHLD2_L (low,high) - MOV_L (REGDIS(.rsfTab,tmp,4),tmp) - JMP (CODEPTR(tmp)) - SEG_DATA - ALIGNDATA4 -.rsfTab: D_LONG .rsf0, .rsf1, .rsf2, .rsf3 - SEG_TEXT - ALIGNTEXT4 -.rsf3: SUB_L (CONST(3),pdst) - MOV_W (highw,REGIND(pdst)) - SHR_L (CONST(16),high) - MOV_B (highbl,REGOFF(2,pdst)) - JMP (.rsf0) -.rsf2: SUB_L (CONST(2),pdst) - MOV_W (highw,REGIND(pdst)) - JMP (.rsf0) -.rsf1: DEC_L (pdst) - MOV_B (highbl,REGIND(pdst)) -/* - * we have countS Pixel to load. Get them as dword, i.e as 4 Pixel group. - * that means we can get (countS >> 2) dwords ! - * since psrc and pdst are aligned dword, this is the fast case. - */ -.rsf0: MOV_L (low,high) - MOV_L (countS,tmp) - SHR_L (CONST(2),tmp) - JMP (.rsdl) - - ALIGNTEXT4 -.rsdb: SUB_L (CONST(4),psrc) - SUB_L (CONST(4),pdst) - MOV_L (REGIND(psrc),low) - SHLD2_L (low,high) - MOV_L (high,REGIND(pdst)) - MOV_L (low,high) -.rsdl: DEC_L (tmp) - JNS (.rsdb) -/* - * the are (countS & 3) Pixles to get. - * but be carefull, these pixels are now aligned RIGHT !!!! ( on the screen) - */ - XOR_L (low,low) - MOV_L (countS,tmp) - AND_L (CONST(3),tmp) - SUB_L (tmp,psrc) - MOV_L (REGDIS(.rsaTab,tmp,4),tmp) - JMP (CODEPTR(tmp)) - SEG_DATA - ALIGNDATA4 -.rsaTab: D_LONG .rsa0, .rsa1, .rsa2, .rsa3 - SEG_TEXT - ALIGNTEXT4 -.rsa3: MOV_W (REGOFF(1,psrc),loww) - SHL_L (CONST(16),low) - MOV_B (REGIND(psrc),lowb) - JMP (.rsa0) -.rsa2: MOV_W (REGIND(psrc),loww) - SHL_L (CONST(16),low) - JMP (.rsa0) -.rsa1: MOV_B (REGIND(psrc),lowb) - SHL_L (CONST(16),low) -.rsa0: SHLD2_L (low,high) - SHL_L (CL,low) -/* - * at this point we have read all Pixels, but there are still some to store - * the number of Pixel in [low,high] seems to be ((countS&3)+(4 - Shift)) - * that maens we have here to store 1,2,3,4,5,6 Pixel (0 & 7 are impossible) - */ - MOV_L (countS,tmp) - AND_L (CONST(3),tmp) - ADD_L (CONST(4),tmp) - SHL_L (CONST(3),tmp) - SUB_L (Shift,tmp) - SHR_L (CONST(3),tmp) - SUB_L (tmp,pdst) - MOV_L (REGDIS(.rsgTab,tmp,4),tmp) - JMP (CODEPTR(tmp)) - SEG_DATA - ALIGNDATA4 -.rsgTab: D_LONG .rsg0, .rsg1, .rsg2, .rsg3, .rsg4, .rsg5, .rsg6, .rsg0 - SEG_TEXT - ALIGNTEXT4 -.rsg6: MOV_L (high,REGOFF(2,pdst)) - SHR_L (CONST(16),low) - MOV_W (loww,REGIND(pdst)) - JMP (.rsg0) -.rsg5: MOV_L (high,REGOFF(1,pdst)) - SHR_L (CONST(16),low) - MOV_B (lowb,REGIND(pdst)) - JMP (.rsg0) -.rsg4: MOV_L (high,REGIND(pdst)) - JMP (.rsg0) -.rsg3: MOV_B (highb,REGIND(pdst)) - SHR_L (CONST(16),high) - MOV_W (highw,REGOFF(1,pdst)) - JMP (.rsg0) -.rsg2: SHR_L (CONST(16),high) - MOV_W (highw,REGIND(pdst)) - JMP (.rsg0) -.rsg1: SHR_L (CONST(16),high) - MOV_B (highb,REGIND(pdst)) - -.rsg0: ADD_L (srcPitch,psrc) - ADD_L (dstPitch,pdst) - -.rightShiftLoop: - MOV_L (count,tmp) - MOV_L (tmp,countS) - DEC_L (hcountS) - JNS (.rightShiftBody) - JMP (.finish) - -.finish: - CLD - LEA_L (REGOFF(-24,EBP),ESP) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFill.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFill.s:1.3 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFill.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFill.s:1.3 Sun Dec 26 19:39:49 1999 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFill.s Fri Jan 18 15:26:25 2002 @@ -1,238 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFill.s,v 1.3 1999/12/27 00:39:49 robin 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. - * - * Author: Thomas Roell, roell@informatik.tu-muenchen.de - * - * This file was derived from a similar X11R4 file (X386 1.1) for X11R5 - * (X386 1.2) by James Tsillas. This file was further derived to its current - * form by David Wexelblat (dwex@goblin.org). - * - */ -/* $XConsortium: fFill.s /main/6 1996/02/21 18:08:43 kaleb $ */ - -#include "assyntax.h" - -#if __STDC__ && !defined(UNIXCPP) -#define RROP_NAME_CAT(prefix,suffix) prefix##suffix -#else -#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix -#endif - -#define GXAnd 1 -#define GXCopy 2 -#define GXOr 3 -#define GXXor 4 - -#if RROP == GXAnd - FILE("fFillAnd.s") -# define RROPB AND_B -# define RROPW AND_W -# define RROPL AND_L -# define RROP_NAME(pref) RROP_NAME_CAT(pref,GXand) -#elif RROP == GXOr - FILE("fFillOr.s") -# define RROPB OR_B -# define RROPW OR_W -# define RROPL OR_L -# define RROP_NAME(pref) RROP_NAME_CAT(pref,GXor) -#elif RROP == GXXor - FILE("fFillXor.s") -# define RROPB XOR_B -# define RROPW XOR_W -# define RROPL XOR_L -# define RROP_NAME(pref) RROP_NAME_CAT(pref,GXxor) -#elif RROP == GXCopy - FILE("fFillCopy.s") -# define RROPB MOV_B -# define RROPW MOV_W -# define RROPL MOV_L -# define RROP_NAME(pref) RROP_NAME_CAT(pref,GXcopy) -#endif - - AS_BEGIN - -#define GL_RROP_NAME RROP_NAME(GLNAME(fastFillSolid)) - -/* - * - * This routine implements a fast Solid Fill in GXcopy - * No segment checking is done. - * - * SYNTAX: - * unchar * fastFillSolid<RROP>(pdst,fill,dummy,hcount,count,width,widthPitch); - * - * (7/27/90 TR) - * (4/92 JT) - * (5/92 DW) - */ - -#define pdst EDI -#define fill EAX -#define fillw AX -#define fillb AL -#define count ESI -#define hcount ECX -#define width REGOFF(28,EBP) -#define widthPitch EBX -#define tmp EAX - - - SEG_DATA - ALIGNDATA4 -countt: - D_LONG 0 - SEG_TEXT - ALIGNTEXT4 - -#define rrop_name /**/RROP_NAME(fastFillSolid) - -GLOBL GL_RROP_NAME - -GL_RROP_NAME: - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - MOV_L (REGOFF(8,EBP),pdst) - MOV_L (REGOFF(12,EBP),fill) - MOV_L (REGOFF(20,EBP),hcount) - MOV_L (REGOFF(24,EBP),count) - MOV_L (REGOFF(32,EBP),widthPitch) - OR_L (hcount,hcount) - JZ (.finish) - OR_L (count,count) - JZ (.finish) - CMP_L (CONST(3),count) - JG (.startblockloop) - JE (.tribbleloop) - CMP_L (CONST(2),count) - JE (.wordloop) -/* - * do a fast vertical line - */ - ALIGNTEXT4ifNOP -.byteloop: - RROPB (fillb,REGIND(pdst)) - LEA_L (REGBID(widthPitch,pdst,1),pdst) - DEC_L (ECX) - JNZ (.byteloop) - JMP (.finish) - - ALIGNTEXT4 -.wordloop: - RROPW (fillw,REGIND(pdst)) - LEA_L (REGBID(widthPitch,pdst,2),pdst) - DEC_L (ECX) - JNZ (.wordloop) - JMP (.finish) - - ALIGNTEXT4 -.tribbleloop: - RROPW (fillw,REGIND(pdst)) - RROPB (fillb,REGOFF(2,pdst)) - LEA_L (REGBID(widthPitch,pdst,3),pdst) - DEC_L (ECX) - JNZ (.tribbleloop) - JMP (.finish) - -#undef count -#define count ECX -#undef hcount -#define hcount ESI - -.startblockloop: - XCHG_L (ECX, ESI) - ALIGNTEXT4ifNOP -.blockloop: - TEST_L (CONST(1),pdst) - JZ (.alignword) -#if RROP == GXCopy - STOS_B -#else - RROPB (fillb,REGIND(pdst)) - INC_L (pdst) -#endif - DEC_L (count) -.alignword: - TEST_L (CONST(2),pdst) - JZ (.aligneddword) -#if RROP == GXCopy - STOS_W -#else - RROPW (fillw,REGIND(pdst)) - ADD_L (CONST(2),pdst) -#endif - LEA_L (REGOFF(-2,count),count) -.aligneddword: - MOV_L (count, CONTENT(countt)) - AND_L (CONST(3), CONTENT(countt)) - SHR_L (CONST(2), count) -#if RROP == GXCopy - REPZ - STOS_L -#else - OR_L (ECX, ECX) - JZ (.endloop) - ALIGNTEXT4ifNOP -.loop0: RROPL (fill,REGIND(pdst)) - ADD_L (CONST(4),pdst) - DEC_L (ECX) - JNZ (.loop0) -.endloop: -#endif - TEST_L (CONST(2),CONTENT(countt)) - JZ (.fixupbyte) -#if RROP == GXCopy - STOS_W -#else - RROPW (fillw,REGIND(pdst)) - ADD_L (CONST(2),pdst) -#endif -.fixupbyte: - TEST_L (CONST(1),CONTENT(countt)) - JZ (.enditeration) -#if RROP == GXCopy - STOS_B -#else - RROPB (fillb,REGIND(pdst)) - INC_L (pdst) -#endif -.enditeration: - LEA_L (REGBI(widthPitch,pdst),pdst) - MOV_L (width,count) - DEC_L (hcount) - JNZ (.blockloop) -.finish: - MOV_L (pdst,EAX) - LEA_L (REGOFF(-12,EBP),ESP) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET - - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFillSet.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFillSet.s:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFillSet.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFillSet.s:1.2 Sat Jul 25 12:58:28 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFillSet.s Fri Jan 18 15:26:25 2002 @@ -1,261 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fFillSet.s,v 1.2 1998/07/25 16:58:28 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. - * - * Author: Thomas Roell, roell@informatik.tu-muenchen.de - * - * This file was derived from a similar X11R4 file (X386 1.1) for X11R5 - * (X386 1.2) by James Tsillas. This file was further derived to its current - * form by David Wexelblat (dwex@goblin.org). - * - */ -/* $XConsortium: fFillSet.s /main/5 1996/02/21 18:08:46 kaleb $ */ - -#include "assyntax.h" - - FILE("fFillSet.s") - AS_BEGIN - -/* - * - * This routine implements a fast Solid Fill in GXset mode. - * no segment checking is done. - * - * SYNTAX: - * unchar * fastFillSolidGXset(pdst,fill1,fill2,hcount,count,width,widthPitch); - * - * (7/27/90 TR) - * (4/92 JT) - * (5/92 DW) - */ - -#define pdst EBX -#define lp ECX -#define count EDX -#define hcount EDI -#define width REGOFF(28,EBP) -#define widthPitch ESI -#define tmp EAX -#define tmpw AX -#define tmpb AL -#define fill1 REGOFF(12,EBP) -#define fill2 REGOFF(16,EBP) - - SEG_TEXT - ALIGNTEXT4 -GLOBL GLNAME(fastFillSolidGXset) - -GLNAME(fastFillSolidGXset): - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) - MOV_L (REGOFF(8,EBP),pdst) - MOV_L (REGOFF(20,EBP),hcount) - MOV_L (REGOFF(24,EBP),count) - MOV_L (REGOFF(32,EBP),widthPitch) - OR_L (hcount,hcount) - JZ (.finish) - OR_L (count,count) - JZ (.finish) - CMP_L (CONST(3),count) - JG (.blockloop) - JE (.tribbleloop) - CMP_L (CONST(2),count) - JE (.wordloop) -/* - * do a fast vertical line - */ - ALIGNTEXT4ifNOP -.byteloop: - MOV_B (fill1,tmpb) - AND_B (REGIND(pdst),tmpb) - XOR_B (fill2,tmpb) - MOV_B (tmpb,REGIND(pdst)) - LEA_L (REGBID(widthPitch,pdst,1),pdst) - DEC_L (hcount) - JNZ (.byteloop) - JMP (.finish) - - ALIGNTEXT4 -.wordloop: - MOV_W (fill1,tmpw) - AND_W (REGIND(pdst),tmpw) - XOR_W (fill2,tmpw) - MOV_W (tmpw,REGIND(pdst)) - LEA_L (REGBID(widthPitch,pdst,2),pdst) - DEC_L (hcount) - JNZ (.wordloop) - JMP (.finish) - - ALIGNTEXT4 -.tribbleloop: - MOV_W (fill1,tmpw) - AND_W (REGIND(pdst),tmpw) - XOR_W (fill2,tmpw) - MOV_W (tmpw,REGIND(pdst)) - MOV_B (fill1,tmpb) - AND_B (REGOFF(2,pdst),tmpb) - XOR_B (fill2,tmpb) - MOV_B (tmpb,REGOFF(2,pdst)) - LEA_L (REGBID(widthPitch,pdst,3),pdst) - DEC_L (hcount) - JNZ (.tribbleloop) - JMP (.finish) - - ALIGNTEXT4 -.blockloop: - TEST_L (CONST(1),pdst) - JZ (.alignword) - MOV_B (fill1,tmpb) - AND_B (REGIND(pdst),tmpb) - XOR_B (fill2,tmpb) - MOV_B (tmpb,REGIND(pdst)) - INC_L (pdst) - DEC_L (count) -.alignword: - TEST_L (CONST(2),pdst) - JZ (.aligneddword) - MOV_W (fill1,tmpw) - AND_W (REGIND(pdst),tmpw) - XOR_W (fill2,tmpw) - MOV_W (tmpw,REGIND(pdst)) - LEA_L (REGOFF(2,pdst),pdst) - LEA_L (REGOFF(-2,count),count) -.aligneddword: - MOV_L (count,lp) - SHR_L (CONST(5),lp) - JZ (.fixupdword) - - ALIGNTEXT4ifNOP -.dwordloop: - MOV_L (REGOFF(0,pdst),tmp) - AND_L (fill1,tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(0,pdst)) - MOV_L (REGOFF(4,pdst),tmp) - AND_L (fill1,tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(4,pdst)) - MOV_L (REGOFF(8,pdst),tmp) - AND_L (fill1,tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(8,pdst)) - MOV_L (REGOFF(12,pdst),tmp) - AND_L (fill1,tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(12,pdst)) - MOV_L (REGOFF(16,pdst),tmp) - AND_L (fill1,tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(16,pdst)) - MOV_L (REGOFF(20,pdst),tmp) - AND_L (fill1,tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(20,pdst)) - MOV_L (REGOFF(24,pdst),tmp) - AND_L (fill1,tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(24,pdst)) - MOV_L (REGOFF(28,pdst),tmp) - AND_L (fill1,tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(28,pdst)) - LEA_L (REGOFF(32,pdst),pdst) - DEC_L (lp) - JNZ (.dwordloop) - -.fixupdword: - MOV_L (count,lp) - AND_L (CONST(28),lp) - LEA_L (REGBI(lp,pdst),pdst) - MOV_L (REGDB(.jumptab1,lp),tmp) - JMP (CODEPTR(tmp)) - - SEG_DATA - ALIGNDATA4 -.jumptab1: - D_LONG .Lnoop, .L0, .L1, .L2, .L3, .L4, .L5, .L6 - - SEG_TEXT - ALIGNTEXT4 -.L6: MOV_L (fill1,tmp) - AND_L (REGOFF(-28,pdst),tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(-28,pdst)) -.L5: MOV_L (fill1,tmp) - AND_L (REGOFF(-24,pdst),tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(-24,pdst)) -.L4: MOV_L (fill1,tmp) - AND_L (REGOFF(-20,pdst),tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(-20,pdst)) -.L3: MOV_L (fill1,tmp) - AND_L (REGOFF(-16,pdst),tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(-16,pdst)) -.L2: MOV_L (fill1,tmp) - AND_L (REGOFF(-12,pdst),tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(-12,pdst)) -.L1: MOV_L (fill1,tmp) - AND_L (REGOFF(-8,pdst),tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(-8,pdst)) -.L0: MOV_L (fill1,tmp) - AND_L (REGOFF(-4,pdst),tmp) - XOR_L (fill2,tmp) - MOV_L (tmp,REGOFF(-4,pdst)) -.Lnoop: - - TEST_L (CONST(2),count) - JZ (.fixupbyte) - MOV_W (fill1,tmpw) - AND_W (REGIND(pdst),tmpw) - XOR_W (fill2,tmpw) - MOV_W (tmpw,REGIND(pdst)) - LEA_L (REGOFF(2,pdst),pdst) -.fixupbyte: - TEST_L (CONST(1),count) - JZ (.enditeration) - MOV_B (fill1,tmpb) - AND_B (REGIND(pdst),tmpb) - XOR_B (fill2,tmpb) - MOV_B (tmpb,REGIND(pdst)) - INC_L (pdst) - -.enditeration: - LEA_L (REGBI(widthPitch,pdst),pdst) - MOV_L (width,count) - DEC_L (hcount) - JNZ (.blockloop) - -.finish: - MOV_L (pdst,EAX) - LEA_L (REGOFF(-12,EBP),ESP) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineBres.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineBres.s:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineBres.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineBres.s:1.2 Sat Jul 25 12:58:29 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineBres.s Fri Jan 18 15:26:25 2002 @@ -1,206 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineBres.s,v 1.2 1998/07/25 16:58:29 dawes Exp $ */ -/* Copyright 1992 by James Tsillas, Arlington, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. - -JAMES TSILLAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -*/ -/* $XConsortium: fLineBres.s /main/5 1996/02/21 18:08:50 kaleb $ */ - -#include "assyntax.h" -#include "vgaAsm.h" - - FILE("fLineBres.s") - AS_BEGIN - -#define rop REGOFF(8,EBP) -#define andv DH -#define xorv DL -#define addrl REGOFF(20,EBP) -#define nlwidth REGOFF(24,EBP) -#define signdx REGOFF(28,EBP) -#define signdy REGOFF(32,EBP) -#define axis REGOFF(36,EBP) -#define x1 REGOFF(40,EBP) -#define y1 REGOFF(44,EBP) -#define e EDI -#define e1 ESI -#define e2 REGOFF(56,EBP) -#define len ECX - -#define addrb EBX -#define tmp EAX - -#define GXcopy CONST(3) -#define Y_AXIS CONST(1) - - SEG_DATA - ALIGNDATA4 -e3: - D_LONG 0 - - SEG_TEXT - ALIGNTEXT4 -GLOBL GLNAME(fastvga256BresS) - -GLNAME(fastvga256BresS): - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) - MOV_L (REGOFF(60,EBP),len) - CMP_L (CONST(0),len) /* check for zero length first */ - JZ (.allfinish) - MOV_B (REGOFF(12,EBP),andv) - MOV_B (REGOFF(16,EBP),xorv) - MOV_L (REGOFF(48,EBP),e) - MOV_L (REGOFF(52,EBP),e1) - MOV_L (e2,tmp) - SUB_L (e1,tmp) - MOV_L (tmp,CONTENT(e3)) - SHL_L (CONST(2),nlwidth) - MOV_L (nlwidth,tmp) - IMUL_L (y1,tmp) - ADD_L (x1,tmp) - ADD_L (addrl,tmp) - MOV_L (tmp,addrb) - CMP_L (CONST(0),signdy) - JGE (.L1) - NEG_L (nlwidth) -.L1: SUB_L (e1,e) - CMP_L (Y_AXIS,axis) - JNZ (.L2) - PUSH_L (nlwidth) - PUSH_L (signdx) - POP_L (nlwidth) - POP_L (signdx) -.L2: CMP_L (GXcopy,rop) - JNZ (.LSet) - -.LCopy: CMP_L (VGABASE,addrl) - JB (.nocheckloopC) - PUSH_L (addrb) - CALL (GLNAME(vgaSetWrite)) - MOV_L (tmp,addrb) - ADD_L (CONST(4),ESP) - - ALIGNTEXT4ifNOP -.writeloopC: - MOV_B (xorv,REGIND(addrb)) - ADD_L (e1,e) - JS (.L3) - ADD_L (nlwidth,addrb) - ADD_L (CONTENT(e3),e) -.L3: ADD_L (signdx,addrb) - CMP_L (CONTENT(GLNAME(vgaWriteBottom)),addrb) - /* was JBE */ - JB (.L4) - CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrb) - JAE (.L9) - DEC_L (ECX) - JNZ (.writeloopC) - JMP (.allfinish) -.L9: PUSH_L (addrb) - CALL (GLNAME(vgaWriteNext)) - MOV_L (tmp,addrb) - ADD_L (CONST(4),ESP) - DEC_L (ECX) - JNZ (.writeloopC) - JMP (.allfinish) -.L4: PUSH_L (addrb) - CALL (GLNAME(vgaWritePrev)) - MOV_L (tmp,addrb) - ADD_L (CONST(4),ESP) - DEC_L (ECX) - JNZ (.writeloopC) - JMP (.allfinish) - - ALIGNTEXT4 -.nocheckloopC: - MOV_B (xorv,REGIND(addrb)) - ADD_L (e1,e) - JS (.L5) - ADD_L (nlwidth,addrb) - ADD_L (CONTENT(e3),e) -.L5: ADD_L (signdx,addrb) - DEC_L (ECX) - JNZ (.nocheckloopC) - - ALIGNTEXT4ifNOP -.allfinish: - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET - -.LSet: CMP_L (VGABASE,addrl) - JB (.nocheckloopS) - PUSH_L (addrb) - CALL (GLNAME(vgaSetReadWrite)) - MOV_L (tmp,addrb) - ADD_L (CONST(4),ESP) - - ALIGNTEXT4ifNOP -.writeloopS: - MOV_B (REGIND(addrb),AL) /* Minimize slow memory access */ - AND_B (andv,AL) - XOR_B (xorv,AL) - MOV_B (AL,REGIND(addrb)) - ADD_L (e1,e) - JS (.L6) - ADD_L (nlwidth,addrb) - ADD_L (CONTENT(e3),e) -.L6: ADD_L (signdx,addrb) - CMP_L (CONTENT(GLNAME(vgaWriteBottom)),addrb) - /* was JBE */ - JB (.L7) - CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrb) - JAE (.L10) - DEC_L (ECX) - JNZ (.writeloopS) - JMP (.allfinish) -.L10: PUSH_L (addrb) - CALL (GLNAME(vgaReadWriteNext)) - MOV_L (tmp,addrb) - ADD_L (CONST(4),ESP) - DEC_L (ECX) - JNZ (.writeloopS) - JMP (.allfinish) -.L7: PUSH_L (addrb) - CALL (GLNAME(vgaReadWritePrev)) - MOV_L (EAX,addrb) - ADD_L (CONST(4),ESP) - DEC_L (ECX) - JNZ (.writeloopS) - JMP (.allfinish) - - ALIGNTEXT4 -.nocheckloopS: - MOV_B (REGIND(addrb),AL) /* Minimize slow memory access */ - AND_B (andv,AL) - XOR_B (xorv,AL) - MOV_B (AL,REGIND(addrb)) - ADD_L (e1,e) - JS (.L8) - ADD_L (nlwidth,addrb) - ADD_L (CONTENT(e3),e) -.L8: ADD_L (signdx,addrb) - DEC_L (ECX) - JNZ (.nocheckloopS) - JMP (.allfinish) - - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineH.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineH.s:1.3 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineH.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineH.s:1.3 Sun Dec 26 19:39:49 1999 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineH.s Fri Jan 18 15:26:25 2002 @@ -1,475 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineH.s,v 1.3 1999/12/27 00:39:49 robin Exp $ */ -/* Copyright 1992 by James Tsillas, Arlington, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. - -JAMES TSILLAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -*/ -/* $XConsortium: fLineH.s /main/5 1996/02/21 18:08:54 kaleb $ */ - -#include "assyntax.h" -#include "vgaAsm.h" - - FILE("fLineH.s") - AS_BEGIN - -#define rop REGOFF(8,EBP) -#define andv EBX -#define andvb BL -#define andvw BX -#define xorv EDX -#define xorvb DL -#define xorvw DX -#define addrl EDI -#define nlwidth REGOFF(24,EBP) -#define x1 REGOFF(28,EBP) -#define y1 REGOFF(32,EBP) -#define len ESI - -#define count ECX -#define tmp EAX - -#define GXcopy CONST(3) -#define GXxor CONST(6) - -SEG_TEXT - ALIGNTEXT4 -GLOBL GLNAME(fastvga256HorzS) - -GLNAME(fastvga256HorzS): - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (ESI) - PUSH_L (EDI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - MOV_L (REGOFF(16,EBP),xorv) - MOV_L (REGOFF(20,EBP),addrl) - MOV_L (REGOFF(36,EBP),len) - CLD - MOV_L (nlwidth,tmp) - SHL_L (CONST(2),tmp) - IMUL_L (y1,tmp) - ADD_L (x1,tmp) - ADD_L (tmp,addrl) - CMP_L (VGABASE,addrl) - JB (.noClongL) - PUSH_L (addrl) - CALL (GLNAME(vgaSetReadWrite)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) - MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp) - SUB_L (addrl,tmp) - CMP_L (len,tmp) - JAE (.noClongL) - -.ClongL: - CMP_L (GXcopy,rop) - JNE (.XlongL) - CMP_L (CONST(2),len) - JE (.L14) - JB (.L15) -.L13: TEST_L (CONST(3),addrl) - JZ (.L8) - MOV_B (xorvb,REGIND(addrl)) - INC_L (addrl) - DEC_L (len) -.L14: TEST_L (CONST(3),addrl) - JZ (.L8A) - MOV_B (xorvb,REGIND(addrl)) - INC_L (addrl) - DEC_L (len) -.L15: TEST_L (CONST(3),addrl) - JZ (.L8A) - MOV_B (xorvb,REGIND(addrl)) - INC_L (addrl) - DEC_L (len) -.L8A: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl) - JB (.L8) - PUSH_L (addrl) - CALL (GLNAME(vgaWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) -.L8: MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp) - SUB_L (addrl,tmp) - CMP_L (tmp,count) - JBE (.L16) - MOV_L (tmp,count) -.L16: SUB_L (count,len) - SHR_L (CONST(2),count) - JZ (.L10) - MOV_L (xorv,tmp) - REPZ - STOS_L - CMP_L (CONST(3),len) - JBE (.L17) - PUSH_L (addrl) - CALL (GLNAME(vgaWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) - MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - SUB_L (count,len) - SHR_L (CONST(2),count) - MOV_L (xorv,tmp) - REPZ - STOS_L -.L17: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl) - JB (.L10) - PUSH_L (addrl) - CALL (GLNAME(vgaWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) -.L10: CMP_L (CONST(2),len) - JA (.L11) - JE (.L12) - CMP_L (CONST(0),len) - JE (.allfinish) - MOV_B (xorvb,REGIND(addrl)) - JMP (.allfinish) -.L11: MOV_W (xorvw,REGIND(addrl)) - MOV_B (xorvb,REGOFF(2,addrl)) /**/ - JMP (.allfinish) -.L12: MOV_W (xorvw,REGIND(addrl)) /**/ -.allfinish: - POP_L (EBX) - POP_L (EDI) - POP_L (ESI) - LEAVE - RET - -.XlongL: - MOV_L (REGOFF(12,EBP),andv) - CMP_L (GXxor,rop) - JNE (.SlongL) - CMP_L (CONST(2),len) - JE (.LX14) - JB (.LX15) -.LX13: TEST_L (CONST(3),addrl) - JZ (.LX8) - XOR_B (xorvb,REGIND(addrl)) /**/ - INC_L (addrl) - DEC_L (len) -.LX14: TEST_L (CONST(3),addrl) - JZ (.LX8A) - XOR_B (xorvb,REGIND(addrl)) /**/ - INC_L (addrl) - DEC_L (len) -.LX15: TEST_L (CONST(3),addrl) - JZ (.LX8A) - XOR_B (xorvb,REGIND(addrl)) /**/ - INC_L (addrl) - DEC_L (len) -.LX8A: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl) - JB (.LX8) - PUSH_L (addrl) - CALL (GLNAME(vgaReadWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) -.LX8: MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp) - SUB_L (addrl,tmp) - CMP_L (tmp,count) - JBE (.LX16) - MOV_L (tmp,count) -.LX16: SUB_L (count,len) - SHR_L (CONST(2),count) - JZ (.LX10) -.LX9: XOR_L (xorv,REGIND(addrl)) /**/ - ADD_L (CONST(4),addrl) - DEC_L (ECX) - JNZ (.LX9) - CMP_L (CONST(3),len) - JBE (.LX17) - PUSH_L (addrl) - CALL (GLNAME(vgaReadWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) - MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - SUB_L (count,len) - SHR_L (CONST(2),count) -.LX18: XOR_L (xorv,REGIND(addrl)) /**/ - ADD_L (CONST(4),addrl) - DEC_L (ECX) - JNZ (.LX18) -.LX17: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl) - JB (.LX10) - PUSH_L (addrl) - CALL (GLNAME(vgaReadWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) -.LX10: CMP_L (CONST(2),len) - JA (.LX11) - JE (.LX12) - CMP_L (CONST(0),len) - JE (.allfinish) - XOR_B (xorvb,REGIND(addrl)) /**/ - JMP (.allfinish) -.LX11: XOR_W (xorvw,REGIND(addrl)) /**/ - XOR_B (xorvb,REGOFF(2,addrl)) /**/ - JMP (.allfinish) -.LX12: XOR_W (xorvw,REGIND(addrl)) /**/ - JMP (.allfinish) - -.SlongL: - CMP_L (CONST(2),len) - JE (.LS14) - JB (.LS15) -.LS13: TEST_L (CONST(3),addrl) - JZ (.LS8) - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - STOS_B - DEC_L (len) -.LS14: TEST_L (CONST(3),addrl) - JZ (.LS8A) - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - STOS_B - DEC_L (len) -.LS15: TEST_L (CONST(3),addrl) - JZ (.LS8A) - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - STOS_B - DEC_L (len) -.LS8A: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl) - JB (.LS8) - PUSH_L (addrl) - CALL (GLNAME(vgaReadWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) -.LS8: MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp) - SUB_L (addrl,tmp) - CMP_L (tmp,count) - JBE (.LS16) - MOV_L (tmp,count) -.LS16: SUB_L (count,len) - SHR_L (CONST(2),count) - JZ (.LS10) -.LS9: MOV_L (REGIND(addrl),tmp) - AND_L (andv,tmp) - XOR_L (xorv,tmp) /**/ - STOS_L - DEC_L (ECX) - JNZ (.LS9) - CMP_L (CONST(3),len) - JBE (.LS17) - PUSH_L (addrl) - CALL (GLNAME(vgaReadWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) - MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - SUB_L (count,len) - SHR_L (CONST(2),count) -.LS18: MOV_L (REGIND(addrl),tmp) - AND_L (andv,tmp) - XOR_L (xorv,tmp) /**/ - STOS_L - DEC_L (ECX) - JNZ (.LS18) -.LS17: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl) - JB (.LS10) - PUSH_L (addrl) - CALL (GLNAME(vgaReadWriteNext)) - MOV_L (tmp,addrl) - ADD_L (CONST(4),ESP) -.LS10: CMP_L (CONST(2),len) - JA (.LS11) - JE (.LS12) - CMP_L (CONST(0),len) - JE (.allfinish) - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - MOV_B (AL,REGIND(addrl)) - JMP (.allfinish) -.LS11: MOV_W (REGIND(addrl),AX) - AND_W (andvw,AX) - XOR_W (xorvw,AX) /**/ - STOS_W - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - MOV_B (AL,REGIND(addrl)) - JMP (.allfinish) -.LS12: MOV_W (REGIND(addrl),AX) - AND_W (andvw,AX) - XOR_W (xorvw,AX) /**/ - MOV_W (AX,REGIND(addrl)) - JMP (.allfinish) - -.noClongL: - CMP_L (GXcopy,rop) - JNE (.noXlongL) - CMP_L (CONST(2),len) - JE (.LC6) - JB (.LC7) -.LC5: TEST_L (CONST(3),addrl) - JZ (.LC0) - MOV_B (xorvb,REGIND(addrl)) - INC_L (addrl) - DEC_L (len) -.LC6: TEST_L (CONST(3),addrl) - JZ (.LC0) - MOV_B (xorvb,REGIND(addrl)) - INC_L (addrl) - DEC_L (len) -.LC7: TEST_L (CONST(3),addrl) - JZ (.LC0) - MOV_B (xorvb,REGIND(addrl)) - INC_L (addrl) - DEC_L (len) -.LC0: MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - SUB_L (count,len) - SHR_L (CONST(2),count) - JZ (.LC2) - MOV_L (xorv,tmp) - CLD - REPZ - STOS_L -.LC2: CMP_L (CONST(2),len) - JA (.LC3) - JE (.LC4) - CMP_L (CONST(0),len) - JE (.allfinish) - MOV_B (xorvb,REGIND(addrl)) /**/ - JMP (.allfinish) -.LC3: MOV_W (xorvw,REGIND(addrl)) /**/ - MOV_B (xorvb,REGOFF(2,addrl)) /**/ - JMP (.allfinish) -.LC4: MOV_W (xorvw,REGIND(addrl)) /**/ - JMP (.allfinish) - - -.noXlongL: - MOV_L (REGOFF(12,EBP),andv) - CMP_L (GXxor,rop) - JNE (.noSlongL) - CMP_L (CONST(2),len) - JE (.LX6) - JB (.LX7) -.LX5: TEST_L (CONST(3),addrl) - JZ (.LX0) - XOR_B (xorvb,REGIND(addrl)) /**/ - INC_L (addrl) - DEC_L (len) -.LX6: TEST_L (CONST(3),addrl) - JZ (.LX0) - XOR_B (xorvb,REGIND(addrl)) /**/ - INC_L (addrl) - DEC_L (len) -.LX7: TEST_L (CONST(3),addrl) - JZ (.LX0) - XOR_B (xorvb,REGIND(addrl)) /**/ - INC_L (addrl) - DEC_L (len) -.LX0: MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - SUB_L (count,len) - SHR_L (CONST(2),count) - JZ (.LX2) -.LX1: XOR_L (xorv,REGIND(addrl)) /**/ - ADD_L (CONST(4),addrl) - DEC_L (ECX) - JNZ (.LX1) -.LX2: CMP_L (CONST(2),len) - JA (.LX3) - JE (.LX4) - CMP_L (CONST(0),len) - JE (.allfinish) - XOR_B (xorvb,REGIND(addrl)) /**/ - JMP (.allfinish) -.LX3: XOR_W (xorvw,REGIND(addrl)) /**/ - XOR_B (xorvb,REGOFF(2,addrl)) /**/ - JMP (.allfinish) -.LX4: XOR_W (xorvw,REGIND(addrl)) /**/ - JMP (.allfinish) - -.noSlongL: - CMP_L (CONST(2),len) - JE (.LS6) - JB (.LS7) -.LS5: TEST_L (CONST(3),addrl) - JZ (.LS0) - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - STOS_B - DEC_L (len) -.LS6: TEST_L (CONST(3),addrl) - JZ (.LS0) - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - STOS_B - DEC_L (len) -.LS7: TEST_L (CONST(3),addrl) - JZ (.LS0) - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - STOS_B - DEC_L (len) -.LS0: MOV_L (len,count) - AND_L (CONST(0xfffffffc),count) - SUB_L (count,len) - SHR_L (CONST(2),count) - JZ (.LS2) -.LS1: MOV_L (REGIND(addrl),tmp) - AND_L (andv,tmp) - XOR_L (xorv,tmp) /**/ - STOS_L - DEC_L (ECX) - JNZ (.LS1) -.LS2: CMP_L (CONST(2),len) - JA (.LS3) - JE (.LS4) - CMP_L (CONST(0),len) - JE (.allfinish) - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - MOV_B (AL,REGIND(addrl)) - JMP (.allfinish) -.LS3: MOV_W (REGIND(addrl),AX) - AND_W (andvw,AX) - XOR_W (xorvw,AX) /**/ - STOS_W - MOV_B (REGIND(addrl),AL) - AND_B (andvb,AL) - XOR_B (xorvb,AL) /**/ - MOV_B (AL,REGIND(addrl)) - JMP (.allfinish) -.LS4: MOV_W (REGIND(addrl),AX) - AND_W (andvw,AX) - XOR_W (xorvw,AX) /**/ - MOV_W (AX,REGIND(addrl)) - JMP (.allfinish) - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineV.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineV.s:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineV.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineV.s:1.2 Sat Jul 25 12:58:30 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineV.s Fri Jan 18 15:26:25 2002 @@ -1,237 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/fLineV.s,v 1.2 1998/07/25 16:58:30 dawes Exp $ */ -/* Copyright 1992 by James Tsillas, Arlington, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. - -JAMES TSILLAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -*/ -/* $XConsortium: fLineV.s /main/5 1996/02/21 18:08:57 kaleb $ */ - -#include "assyntax.h" -#include "vgaAsm.h" - - FILE("fLineV.s") - AS_BEGIN - -#define rop REGOFF(8,EBP) -#define andv BL -#define xorv BH -#define pdst EDI -#define nlwidth ESI -#define x1 REGOFF(28,EBP) -#define y1 REGOFF(32,EBP) -#define len REGOFF(36,EBP) - -#define len0 ECX -#define tmp EAX - -#define GXcopy CONST(3) -#define GXxor CONST(6) - - - SEG_TEXT -GLOBL GLNAME(fastvga256VertS) - ALIGNTEXT4 -GLNAME(fastvga256VertS): - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (EBX) - PUSH_L (ESI) - PUSH_L (EDI) - MOV_B (REGOFF(12,EBP),andv) - MOV_B (REGOFF(16,EBP),xorv) - MOV_L (REGOFF(20,EBP),pdst) - MOV_L (REGOFF(24,EBP),nlwidth) - SHL_L (CONST(2),nlwidth) - MOV_L (y1,tmp) - IMUL_L (nlwidth,tmp) - ADD_L (x1,tmp) - ADD_L (tmp,pdst) - MOV_L (pdst,REGOFF(20,EBP)) - CMP_L (GXcopy,rop) - JNE (.GXxorloop) - -.GXcopyloop: - CMP_L (VGABASE,pdst) - JB (.nocheckC) - - ALIGNTEXT4ifNOP -.checkC: - PUSH_L (REGOFF(20,EBP)) - CALL (GLNAME(vgaSetWrite)) - MOV_L (tmp,pdst) - ADD_L (CONST(4),ESP) - MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp) - SUB_L (pdst,tmp) - XOR_L (EDX,EDX) - DIV_L (nlwidth) - OR_L (tmp,tmp) - JZ (.L3) - CMP_L (len,tmp) - JAE (.nocheckC) - MOV_L (tmp,len0) - SUB_L (len0,len) - IMUL_L (nlwidth,tmp) - ADD_L (tmp,REGOFF(20,EBP)) -.L1: MOV_B (xorv,REGIND(pdst)) - ADD_L (nlwidth,pdst) - DEC_L (ECX) - JNZ (.L1) /* len0 is %ecx */ - CMP_L (CONTENT(GLNAME(vgaWriteTop)),pdst) - JAE (.checkC) -.L3: MOV_B (xorv,REGIND(pdst)) - DEC_L (len) - JZ (.allfinish) - ADD_L (nlwidth,REGOFF(20,EBP)) - JMP (.checkC) - - ALIGNTEXT4 -.nocheckC: - CMP_L (CONST(0),len) - JZ (.allfinish) - MOV_L (len,len0) - CMP_L (CONST(8),ECX) - JB (.L2) - /* Unrolled loop */ -.L10: MOV_B (xorv,REGIND(pdst)) /* line 0 */ - MOV_B (xorv,REGBI(pdst,nlwidth)) /* line 1 */ - MOV_B (xorv,REGBISD(pdst,nlwidth,2,0)) /* line 2 */ - MOV_B (xorv,REGBISD(pdst,nlwidth,4,0)) /* line 4 */ - ADD_L (nlwidth,pdst) - MOV_B (xorv,REGBISD(pdst,nlwidth,2,0)) /* line 3 */ - MOV_B (xorv,REGBISD(pdst,nlwidth,4,0)) /* line 5 */ - ADD_L (nlwidth,pdst) - MOV_B (xorv,REGBISD(pdst,nlwidth,4,0)) /* line 6 */ - ADD_L (nlwidth,pdst) - LEA_L (REGBISD(pdst,nlwidth,4,0),pdst) - MOV_B (xorv,REGIND(pdst)) /* line 7 */ - ADD_L (nlwidth,pdst) - SUB_L (CONST(8),ECX) - JZ (.allfinish) - CMP_L (CONST(8),ECX) - JAE (.L10) -.L2: MOV_B (xorv,REGIND(pdst)) - ADD_L (nlwidth,pdst) - DEC_L (ECX) - JNZ (.L2) /* len0 is %ecx */ -.allfinish: - POP_L (EDI) - POP_L (ESI) - POP_L (EBX) - LEAVE - RET - -.GXxorloop: - CMP_L (GXxor,rop) - JNE (.GXsetloop) - CMP_L (VGABASE,pdst) - JB (.nocheckX) - - ALIGNTEXT4ifNOP -.checkX: - PUSH_L (REGOFF(20,EBP)) - CALL (GLNAME(vgaSetReadWrite)) - MOV_L (tmp,pdst) - ADD_L (CONST(4),ESP) - MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp) - SUB_L (pdst,tmp) - XOR_L (EDX,EDX) - DIV_L (nlwidth) - OR_L (tmp,tmp) - JZ (.L6) - CMP_L (len,tmp) - JAE (.nocheckX) - MOV_L (tmp,len0) - SUB_L (len0,len) - IMUL_L (nlwidth,tmp) - ADD_L (tmp,REGOFF(20,EBP)) -.L4: XOR_B (xorv,REGIND(pdst)) - ADD_L (nlwidth,pdst) - DEC_L (ECX) - JNZ (.L4) /* len0 is %ecx */ - CMP_L (CONTENT(GLNAME(vgaWriteTop)),pdst) - JAE (.checkX) -.L6: XOR_B (xorv,REGIND(pdst)) - DEC_L (len) - JZ (.allfinish) - ADD_L (nlwidth,REGOFF(20,EBP)) - JMP (.checkX) - - ALIGNTEXT4 -.nocheckX: - CMP_L (CONST(0),len) - JZ (.allfinish) - MOV_L (len,len0) -.L5: XOR_B (xorv,REGIND(pdst)) - ADD_L (nlwidth,pdst) - DEC_L (ECX) - JNZ (.L5) /* len0 is %ecx */ - JMP (.allfinish) - -.GXsetloop: - CMP_L (VGABASE,pdst) - JB (.nocheckS) - - ALIGNTEXT4ifNOP -.checkS: - PUSH_L (REGOFF(20,EBP)) - CALL (GLNAME(vgaSetReadWrite)) - MOV_L (tmp,pdst) - ADD_L (CONST(4),ESP) - MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp) - SUB_L (pdst,tmp) - XOR_L (EDX,EDX) - DIV_L (nlwidth) - OR_L (tmp,tmp) - JZ (.L9) - CMP_L (len,tmp) - JAE (.nocheckS) - MOV_L (tmp,len0) - SUB_L (len0,len) - IMUL_L (nlwidth,tmp) - ADD_L (tmp,REGOFF(20,EBP)) -.L7: MOV_B (REGIND(pdst),AL) - AND_B (andv,AL) - XOR_B (xorv,AL) - MOV_B (AL,REGIND(pdst)) - ADD_L (nlwidth,pdst) - DEC_L (ECX) - JNZ (.L7) /* len0 is %ecx */ - CMP_L (CONTENT(GLNAME(vgaWriteTop)),pdst) - JAE (.checkS) -.L9: MOV_B (REGIND(pdst),AL) - AND_B (andv,AL) - XOR_B (xorv,AL) - MOV_B (AL,REGIND(pdst)) - DEC_L (len) - JZ (.allfinish) - ADD_L (nlwidth,REGOFF(20,EBP)) - JMP (.checkS) - - ALIGNTEXT4 -.nocheckS: - CMP_L (CONST(0),len) - JZ (.allfinish) - MOV_L (len,len0) -.L8: MOV_B (REGIND(pdst),AL) - AND_B (andv,AL) - XOR_B (xorv,AL) - MOV_B (AL,REGIND(pdst)) - ADD_L (nlwidth,pdst) - DEC_L (ECX) - JNZ (.L8) /* len0 is %ecx */ - JMP (.allfinish) - - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/gBanks.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/gBanks.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/gBanks.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/gBanks.c:1.2 Sat Jul 25 12:58:30 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/gBanks.c Fri Jan 18 15:26:25 2002 @@ -1,55 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/gBanks.c,v 1.2 1998/07/25 16:58:30 dawes Exp $ */ -/******************************************************************************* - Copyright 1992 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -(glenn@cs.utexas.edu) -6/3/92 -*******************************************************************************/ -/* $XConsortium: gBanks.c /main/4 1996/02/21 18:09:02 kaleb $ */ - -#include "misc.h" -#include "vgaBank.h" -unsigned SpeedUpRowsNext[17]; -unsigned SpeedUpRowsPrev[17]; - -void -SpeedUpComputeNext(dst, h) -unsigned dst, h; -{ - if (vgaWriteFlag) { - register unsigned int i, j = h, k = 0, l = vgaSegmentMask + 1 >> 10; - - i = l - ((dst & vgaSegmentMask) >> 10); - do { - if (i > j) i = j; - j -= i; - SpeedUpRowsNext[k++] = i; - i = l; - } while (j); - SpeedUpRowsNext[k] = 0; - } else { - SpeedUpRowsNext[0] = h; - SpeedUpRowsNext[1] = 0; - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBBlt2.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBBlt2.s:1.3 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBBlt2.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBBlt2.s:1.3 Sun Dec 26 19:39:50 1999 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBBlt2.s Fri Jan 18 15:26:25 2002 @@ -1,872 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBBlt2.s,v 1.3 1999/12/27 00:39:50 robin Exp $ */ -/******************************************************************************* - Copyright 1992 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -(glenn@cs.utexas.edu) -7/27/92 -*******************************************************************************/ -/* $XConsortium: suBBlt2.s /main/4 1996/02/21 18:09:05 kaleb $ */ - -#include "assyntax.h" - - FILE("suBitBlt2.s") - AS_BEGIN - -#include "vgaAsm.h" - -/* void PixWin(src, dst, height, width, sWidth, dWidth) */ - -#define src REGOFF(8,EBP) -#define dst REGOFF(12,EBP) -#define height REGOFF(16,EBP) -#define width REGOFF(20,EBP) -#define sWidth REGOFF(24,EBP) -#define dWidth REGOFF(28,EBP) - - SEG_DATA -copyright: - STRING("Copyright 7/27/1992 by Glenn G. Lai") - ALIGNDATA4 -speedUpTop: - D_LONG 0 -sOffset: - D_LONG 0 -dOffset: - D_LONG 0 -allowance: - D_LONG 0 -lCount: - D_LONG 0 -mCount: - D_LONG 0 -rCount: - D_LONG 0 -heightCount: - D_LONG 0 -func: - D_LONG 0 -sPixWinTable: - D_LONG 0, sPixWin1, sPixWin2, sPixWin3, sPixWin4 -pixWinTable: - D_LONG pwM, pwMR, pwLM, pwLMR -segment: - D_BYTE 0 -/*************************************/ - SEG_TEXT - ALIGNTEXT4 - GLOBL GLNAME(PixWin) -GLNAME(PixWin): - MOV_L (REGOFF(12,ESP), EAX) - OR_L (REGOFF(16,ESP), EAX) - JZ (return) - - CLD - PUSH_L (EBP) - MOV_L (ESP, EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - - MOV_L (dWidth, EAX) - MOV_L (width, ECX) - SUB_L (ECX, EAX) - MOV_L (EAX, CONTENT(dOffset)) - ADD_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - MOV_L (EAX, CONTENT(speedUpTop)) - - MOV_L (sWidth, EAX) - SUB_L (ECX, EAX) - MOV_L (EAX, CONTENT(sOffset)) - - MOV_L (src, ESI) - MOV_L (dst, EDI) - SUB_L (VGABASE, EDI) - CMP_L (CONST(5), ECX) - JNC (pixWin1) - MOV_L (REGDIS(sPixWinTable,ECX,4), EAX) - MOV_L (EAX, CONTENT(func)) - JMP (pixWin2) -/*************************************/ - ALIGNTEXT4 -pixWin1: - MOV_L (ADDR(pixWinTable), EAX) - TEST_L (CONST(1), EDI) - JZ (pixWin3) - ADD_L (CONST(8), EAX) - DEC_L (ECX) -pixWin3: - MOV_L (ECX, EBX) - AND_L (CONST(3), EBX) - JZ (pixWin4) - ADD_L (CONST(4), EAX) -pixWin4: - MOV_L (REGIND(EAX), EAX) - MOV_L (EAX, CONTENT(func)) - MOV_L (EBX, CONTENT(rCount)) - SHR_L (CONST(2), ECX) - MOV_L (ECX, CONTENT(mCount)) -pixWin2: - MOV_L (EDI, EAX) - SHR_L (CONST(16), EAX) - MOV_B (AL, CONTENT(segment)) - - AND_L (CONST(0xffff), EDI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JMP (pwLoop3) -/*************************************/ - ALIGNTEXT4 -pwLoop: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JC (pwLoop1) - SUB_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - INC_B (AL) - MOV_B (AL, CONTENT(segment)) -pwLoop3: - MOV_W (CONST(0x3cd), DX) - OUT_B -pwLoop1: - MOV_L (CONTENT(speedUpTop), EAX) - SUB_L (EDI, EAX) - XOR_L (EDX, EDX) - DIV_L (dWidth) - - OR_L (EAX, EAX) - JZ (pwPartial) - - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (pwLoop2) - MOV_L (EBX, EAX) -pwLoop2: - MOV_L (EAX, CONTENT(allowance)) - MOV_L (EAX, EDX) - MOV_L (CONTENT(sOffset), EAX) - MOV_L (CONTENT(dOffset), EBX) - - CALL (VARINDIRECT(func)) - - MOV_L (height, EAX) - SUB_L (CONTENT(allowance), EAX) - MOV_L (EAX, height) - JNZ (pwLoop) - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE -return: - RET -/********************************/ - ALIGNTEXT4 -pwM: -wpM: - MOV_L (CONTENT(mCount), ECX) - REP - MOVS_L - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (pwM) - RET -/********************************/ - ALIGNTEXT4 -pwMR: -wpMR: - MOV_L (CONTENT(mCount), ECX) - REP - MOVS_L - MOV_L (CONTENT(rCount), ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (pwMR) - RET -/********************************/ - ALIGNTEXT4 -pwLM: -wpLM: - MOVS_B - MOV_L (CONTENT(mCount), ECX) - REP - MOVS_L - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (pwLM) - RET -/********************************/ - ALIGNTEXT4 -pwLMR: -wpLMR: - MOVS_B - MOV_L (CONTENT(mCount), ECX) - REP - MOVS_L - MOV_L (CONTENT(rCount), ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (pwLMR) - RET -/********************************/ -pwPartial: - SUB_L (CONTENT(dOffset), EDX) - MOV_L (EDX, ECX) - MOV_L (width, EBX) - SUB_L (ECX, EBX) - - TEST_L (CONST(1), EDI) - JZ (pwPartial1) - MOVS_B - DEC_L (ECX) - JZ (pwPartial2) -pwPartial1: - SHR_L (CONST(1), ECX) - REP - MOVS_W -pwPartial2: - SUB_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - INC_B (AL) - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - - MOV_L (EBX, ECX) - SHR_L (CONST(1), ECX) - JZ (pwPartial3) - REP - MOVS_W - JNC (pwPartial4) -pwPartial3: - MOVS_B -pwPartial4: - ADD_L (CONTENT(sOffset), ESI) - ADD_L (CONTENT(dOffset), EDI) - DEC_L (height) - JNZ (pwLoop1) - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -sPixWin1: -sWinPix1: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (sPixWin1) - RET -/********************************/ - ALIGNTEXT4 -sPixWin2: -sWinPix2: - MOVS_W - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (sPixWin2) - RET -/********************************/ - ALIGNTEXT4 -sPixWin3: -sWinPix3: - TEST_L (CONST(1), EDI) - JNZ (sPixWin31) -sPixWin32: - MOVS_W - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (sPixWin32) - RET -/********************************/ - ALIGNTEXT4 -sPixWin31: -sWinPix31: - MOVS_B - MOVS_W - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (sPixWin31) - RET -/********************************/ - ALIGNTEXT4 -sPixWin4: -sWinPix4: - MOVS_L - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (sPixWin4) - RET -/********************************/ - ALIGNTEXT4 -winPixDone: -pixWinDone: - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET - -/* void WinPix(src, dst, h, w, srcOffset, dstOffset) */ - SEG_DATA - ALIGNDATA4 -sWinPixTable: - D_LONG 0, sWinPix1, sWinPix2, sWinPix3, sWinPix4 -winPixTable: - D_LONG wpM, wpMR, wpLM, wpLMR -/********************************/ - SEG_TEXT - ALIGNTEXT4 - GLOBL GLNAME(WinPix) -GLNAME(WinPix): - MOV_L (REGOFF(12,ESP), EAX) - OR_L (REGOFF(16,ESP), EAX) - JZ (return) - - CLD - PUSH_L (EBP) - MOV_L (ESP, EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - - MOV_L (sWidth, EAX) - MOV_L (width, ECX) - SUB_L (ECX, EAX) - MOV_L (EAX, CONTENT(sOffset)) - ADD_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - MOV_L (EAX, CONTENT(speedUpTop)) - - MOV_L (dWidth, EAX) - SUB_L (ECX, EAX) - MOV_L (EAX, CONTENT(dOffset)) - - MOV_L (src, ESI) - MOV_L (dst, EDI) - SUB_L (VGABASE, ESI) - CMP_L (CONST(5), ECX) - JNC (winPix1) - MOV_L (REGDIS(sWinPixTable,ECX,4), EAX) - MOV_L (EAX, CONTENT(func)) - JMP (winPix2) -/********************************/ - ALIGNTEXT4 -winPix1: - MOV_L (ADDR(winPixTable), EAX) - TEST_L (CONST(1), ESI) - JZ (winPix3) - ADD_L (CONST(8), EAX) - DEC_L (ECX) -winPix3: - MOV_L (ECX, EBX) - AND_L (CONST(3), EBX) - JZ (winPix4) - ADD_L (CONST(4), EAX) -winPix4: - MOV_L (REGIND(EAX), EAX) - MOV_L (EAX, CONTENT(func)) - MOV_L (EBX, CONTENT(rCount)) - SHR_L (CONST(2), ECX) - MOV_L (ECX, CONTENT(mCount)) -winPix2: - MOV_L (ESI, EAX) - SHR_L (CONST(16), EAX) - SHL_B (CONST(4), AL) - MOV_B (AL, CONTENT(segment)) - - AND_L (CONST(0xffff), ESI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), ESI) - JMP (wpLoop3) -/********************************/ - ALIGNTEXT4 -wpLoop: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), ESI) - JC (wpLoop1) - SUB_L (CONST(0x10000), ESI) - MOV_B (CONTENT(segment), AL) - ADD_B (CONST(16), AL) - MOV_B (AL, CONTENT(segment)) -wpLoop3: - MOV_W (CONST(0x3cd), DX) - OUT_B -wpLoop1: - MOV_L (CONTENT(speedUpTop), EAX) - SUB_L (ESI, EAX) - XOR_L (EDX, EDX) - DIV_L (sWidth) - - OR_L (EAX, EAX) - JZ (wpPartial) - - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (wpLoop2) - MOV_L (EBX, EAX) -wpLoop2: - MOV_L (EAX, CONTENT(allowance)) - MOV_L (EAX, EDX) - MOV_L (CONTENT(sOffset), EAX) - MOV_L (CONTENT(dOffset), EBX) - - CALL (VARINDIRECT(func)) - - MOV_L (height, EAX) - SUB_L (CONTENT(allowance), EAX) - MOV_L (EAX, height) - JNZ (wpLoop) - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ -wpPartial: - SUB_L (CONTENT(sOffset), EDX) - MOV_L (EDX, ECX) - MOV_L (width, EBX) - SUB_L (ECX, EBX) - - TEST_L (CONST(1), ESI) - JZ (wpPartial1) - MOVS_B - DEC_L (ECX) - JZ (wpPartial2) -wpPartial1: - SHR_L (CONST(1), ECX) - REP - MOVS_W -wpPartial2: - SUB_L (CONST(0x10000), ESI) - MOV_B (CONTENT(segment), AL) - ADD_B (CONST(16), AL) - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - - MOV_L (EBX, ECX) - SHR_L (CONST(1), ECX) - JZ (wpPartial3) - REP - MOVS_W - JNC (wpPartial4) -wpPartial3: - MOVS_B -wpPartial4: - ADD_L (CONTENT(sOffset), ESI) - ADD_L (CONTENT(dOffset), EDI) - DEC_L (height) - JNZ (wpLoop1) - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - SEG_DATA - ALIGNDATA4 -sPixPixTable: - D_LONG 0, sPixPix1, sPixPix2, sPixPix3, sPixPix4 -/********************************/ - SEG_TEXT - ALIGNTEXT4 -/* void PixPix(src, dst, h, w, srcOffset, dstOffset, ydir) */ - GLOBL GLNAME(PixPix) -GLNAME(PixPix): - MOV_L (REGOFF(12,ESP), EAX) - OR_L (REGOFF(16,ESP), EAX) - JZ (return) - PUSH_L (EBP) - MOV_L (ESP, EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - MOV_L (REGOFF(8,EBP), ESI) - MOV_L (REGOFF(12,EBP), EDI) - CMP_L (ESI, EDI) - JZ (pixPixDone) - MOV_L (REGOFF(20,EBP), EDX) - MOV_L (REGOFF(28,EBP), EBX) - CMP_L (CONST(4), EDX) - JLE (sPixPix) - MOV_L (REGOFF(16,EBP), EAX) - MOV_L (EAX, CONTENT(heightCount)) - CMP_L (CONST(1), REGOFF(32,EBP)) - JNE (pixPixRL) - CLD - MOV_L (ESI, EAX) - ADD_L (CONST(3), EAX) - AND_L (CONST(0xfffffffc), EAX) - SUB_L (ESI, EAX) - MOV_L (EAX, CONTENT(lCount)) - SUB_L (EAX, EDX) - MOV_L (EDX, EAX) - SAR_L (CONST(2), EDX) - JZ (pixPixLRLR) - AND_L (CONST(3), EAX) - JZ (pixPixLRLMorM) - MOV_L (EAX, CONTENT(rCount)) - MOV_L (REGOFF(24,EBP), EAX) - CMP_L (CONST(0), CONTENT(lCount)) - JE (pixPixLRMR) -/********************************/ -pixPixLRLMR: - MOV_L (CONTENT(lCount), ECX) - REP - MOVS_B - MOV_L (EDX, ECX) - REP - MOVS_L - MOV_L (CONTENT(rCount), ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixLRLMR) -pixPixDone: - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -pixPixLRMR: - MOV_L (EDX, ECX) - REP - MOVS_L - MOV_L (CONTENT(rCount), ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixLRMR) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -pixPixLRLMorM: - MOV_L (REGOFF(24,EBP), EAX) - CMP_L (CONST(0), CONTENT(lCount)) - JE (pixPixLRM) -pixPixLRLM: - MOV_L (CONTENT(lCount), ECX) - REP - MOVS_B - MOV_L (EDX, ECX) - REP - MOVS_L - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixLRLM) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -pixPixLRM: - MOV_L (EDX, ECX) - REP - MOVS_L - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixLRM) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -pixPixLRLR: - MOV_L (REGOFF(24,EBP), EAX) - MOV_L (REGOFF(20,EBP), EDX) - SUB_L (CONST(4), EDX) -pixPixLRLR1: - MOVS_L - MOV_L (EDX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixLRLR1) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********0************************/ - ALIGNTEXT4 -pixPixRL: - STD - MOV_L (ESI, EAX) - INC_L (EAX) - AND_L (CONST(3), EAX) - MOV_L (EAX, CONTENT(rCount)) - SUB_L (EAX, EDX) - MOV_L (EDX, EAX) - SAR_L (CONST(2), EDX) - JZ (pixPixRLLR) - AND_L (CONST(3), EAX) - JZ (pixPixRLMRorM) - MOV_L (EAX, CONTENT(lCount)) - MOV_L (REGOFF(24,EBP), EAX) - CMP_L (CONST(0), CONTENT(rCount)) - JE (pixPixRLLM) -pixPixRLLMR: - MOV_L (CONTENT(rCount), ECX) - REP - MOVS_B - SUB_L (CONST(3), ESI) - SUB_L (CONST(3), EDI) - MOV_L (EDX, ECX) - REP - MOVS_L - ADD_L (CONST(3), ESI) - ADD_L (CONST(3), EDI) - MOV_L (CONTENT(lCount), ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixRLLMR) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - CLD - LEAVE - RET -/********************************/ - ALIGNTEXT4 -pixPixRLLM: - SUB_L (CONST(3), ESI) - SUB_L (CONST(3), EDI) - SUB_L (CONST(3), EAX) - SUB_L (CONST(3), EBX) -pixPixRLLM1: - MOV_L (EDX, ECX) - REP - MOVS_L - MOV_L (CONTENT(lCount), ECX) - ADD_L (CONST(3), ESI) - ADD_L (CONST(3), EDI) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixRLLM1) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - CLD - LEAVE - RET -/********************************/ - ALIGNTEXT4 -pixPixRLMRorM: - MOV_L (REGOFF(24,EBP), EAX) - CMP_L (CONST(0), CONTENT(rCount)) - JE (pixPixRLM) - ADD_L (CONST(3), EAX) - ADD_L (CONST(3), EBX) -pixPixRLMR: - MOV_L (CONTENT(rCount), ECX) - REP - MOVS_B - SUB_L (CONST(3), ESI) - SUB_L (CONST(3), EDI) - MOV_L (EDX, ECX) - REP - MOVS_L - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixRLMR) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - CLD - LEAVE - RET -/********************************/ - ALIGNTEXT4 -pixPixRLM: - SUB_L (CONST(3), ESI) - SUB_L (CONST(3), EDI) -pixPixRLM1: - MOV_L (EDX, ECX) - REP - MOVS_L - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixRLM1) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - CLD - LEAVE - RET -/********************************/ - ALIGNTEXT4 -pixPixRLLR: - MOV_L (REGOFF(24,EBP), EAX) - MOV_L (REGOFF(20,EBP), EDX) -pixPixRLLR1: - MOV_L (EDX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(heightCount)) - JNZ (pixPixRLLR1) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - CLD - LEAVE - RET -/********************************/ - ALIGNTEXT4 -sPixPix: - CLD - MOV_L (REGOFF(16,EBP), ECX) - MOV_L (REGOFF(24,EBP), EAX) - JMP (CODEPTR(REGDIS(sPixPixTable,EDX,4))) -/********************************/ - ALIGNTEXT4 -sPixPix4: - MOVS_L - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (ECX) - JNZ (sPixPix4) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -sPixPix3: - TEST_L (CONST(1), ESI) - JNZ (sPixPix3U) - INC_L (EAX) - INC_L (EBX) -sPixPix31: - MOV_B (REGOFF(2,ESI), DL) - MOVS_W - MOV_B (DL, REGIND(EDI)) - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (ECX) - JNZ (sPixPix31) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -sPixPix3U: - ADD_L (CONST(2), EAX) - ADD_L (CONST(2), EBX) -sPixPix3U1: - MOV_W (REGOFF(1,ESI), DX) - MOVS_B - MOV_W (DX, REGIND(EDI)) - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (ECX) - JNZ (sPixPix3U1) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -sPixPix2: - MOVS_W - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (ECX) - JNZ (sPixPix2) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/********************************/ - ALIGNTEXT4 -sPixPix1: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EBX, EDI) - DEC_L (ECX) - JNZ (sPixPix1) - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBitBlt.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBitBlt.s:1.3 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBitBlt.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBitBlt.s:1.3 Sun Dec 26 19:39:50 1999 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBitBlt.s Fri Jan 18 15:26:25 2002 @@ -1,1576 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBitBlt.s,v 1.3 1999/12/27 00:39:50 robin Exp $ */ -/******************************************************************************* - Copyr 1992 by Glenn G. Lai - - All Rs Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyr notice appear in all copies and that -both that copyr notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -(glenn@cs.utexas.edu) -8/17/92 -*******************************************************************************/ -/* $XConsortium: suBitBlt.s /main/5 1996/02/21 18:09:09 kaleb $ */ - -#include "assyntax.h" - - FILE("suBitBlt.s") - AS_BEGIN - -#include "vgaAsm.h" - -/* WinWin(src, dst, h, w, xdir, ydir, screen, special) */ - -#define src REGOFF(8,EBP) -#define dst REGOFF(12,EBP) -#define height REGOFF(16,EBP) -#define width REGOFF(20,EBP) -#define xdir REGOFF(24,EBP) -#define ydir REGOFF(28,EBP) -#define screen REGOFF(32,EBP) -#define special REGOFF(36,EBP) - - SEG_DATA -copyright: - STRING("Copyright 8/17/1992 by Glenn G. Lai") - ALIGNDATA4 -tmp: - D_LONG 0 -speedUpBound: - D_LONG 0 -sM: - D_LONG 0 -dM: - D_LONG 0 -sM1: - D_LONG 0 -dM1: - D_LONG 0 -func: - D_LONG 0 -partial: - D_LONG 0 -npPartialJump: - D_LONG 0 -pPartialJump: - D_LONG 0 -pMOffset: - D_LONG 0 -pLROffset: - D_LONG 0 -allowance: - D_LONG 0 -lCount: - D_LONG 0 -mCount: - D_LONG 0 -rCount: - D_LONG 0 -hCount: - D_LONG 0 -offset: - D_LONG 0 -wwLRTable: - D_LONG wBoxLR, wbBoxLR, bwBoxLR, bBoxLR -wwRLTable: - D_LONG bBoxRL, bwBoxRL, wbBoxRL, wBoxRL -pTable: - D_LONG pM, pMR, pLM, pLMR -pTable1: - D_LONG pM, pMRa, pLMa, pLMRa -lMaskTable: - D_WORD 0x0f02, 0x0802, 0x0c02, 0x0e02 -rMaskTable: - D_WORD 0x0f02, 0x0102, 0x0302, 0x0702 -lMask: - D_WORD 0 -rMask: - D_WORD 0 -segment: - D_BYTE 0 - - SEG_TEXT - ALIGNTEXT4 - GLOBL GLNAME(WinWin) -#define THRESHOLD CONST(10) -GLNAME(WinWin): - MOV_L (REGOFF(4,ESP), EAX) - CMP_L (REGOFF(8,ESP), EAX) - JE (return) - - MOV_L (REGOFF(16,ESP), EAX) - OR_L (REGOFF(20,ESP), EAX) - JZ (return) - - PUSH_L (EBP) - MOV_L (ESP, EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - CLD - - MOV_L (width, ECX) - MOV_L (src, ESI) - MOV_L (dst, EDI) - - CMP_L (CONST(1), special) - JE (nP) - - MOV_L (ESI, EAX) - MOV_L (EDI, EBX) - SUB_L (EBX, EAX) - AND_L (CONST(3), EAX) - JNZ (nP) - - CMP_L (THRESHOLD, ECX) - JNC (pMode) -nP: - MOV_L (ESI, EAX) - SHR_L (CONST(12), EAX) - AND_B (CONST(0x0f0), AL) - MOV_L (EDI, EBX) - SHR_L (CONST(16), EBX) - OR_B (BL, AL) - MOV_B (AL, CONTENT(segment)) - - AND_L (CONST(0xffff), ESI) - AND_L (CONST(0xffff), EDI) - ADD_L (CONTENT(GLNAME(vgaReadBottom)), ESI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - - MOV_L (ADDR(wwLRTable), EAX) - CMP_L (CONST(1), special) - JNE (wwLeftToRight) - STD - MOV_L (ADDR(wwRLTable), EAX) -wwLeftToRight: - TEST_L (CONST(1), ESI) - JZ (ww3) - ADD_L (CONST(8), EAX) -ww3: - TEST_L (CONST(1), EDI) - JZ (ww4) - ADD_L (CONST(4), EAX) -ww4: - CMP_L (CONST(6), ECX) - JNC (ww2) - - MOV_L (ADDR(sWW), CONTENT(func)) - JMP (ww5) - ALIGNTEXT4 -ww2: - MOV_L (REGIND(EAX), EAX) - MOV_L (EAX, CONTENT(func)) -ww5: - CMP_L (CONST(1), special) - JNE (npUpOrDown) -npRL: - MOV_L (screen, EAX) - NEG_L (EAX) - ADD_L (ECX, EAX) - MOV_L (EAX, CONTENT(offset)) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EAX) - DEC_L (EAX) - MOV_L (EAX, CONTENT(speedUpBound)) - MOV_B (CONTENT(segment), AL) - JMP (npRL2) -/***************************/ - ALIGNTEXT4 -npRL5: - MOV_B (CONTENT(segment), AL) - CMP_L (CONTENT(GLNAME(vgaReadBottom)), ESI) - JNC (npRL1) - SUB_B (CONST(16), AL) - ADD_L (CONST(0x10000), ESI) -npRL1: - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JNC (npRL7) - DEC_B (AL) - ADD_L (CONST(0x10000), EDI) -npRL7: - MOV_B (AL, CONTENT(segment)) -npRL2: - MOV_W (CONST(0x3cd), DX) - OUT_B -npRL6: - MOV_L (ESI, EAX) - MOV_L (EDI, EBX) - SUB_L (CONTENT(speedUpBound), EAX) - SUB_L (CONTENT(speedUpBound), EBX) - - MOV_L (screen, ECX) - XOR_L (EDX, EDX) - DIV_L (ECX) - XCHG_L (EAX, EBX) - - XOR_L (EDX, EDX) - DIV_L (ECX) - - CMP_L (EBX, EAX) - JC (npRL3) - - MOV_L (EBX, EAX) -npRL3: - OR_L (EAX, EAX) - JZ (npRLPartial) - - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (npRL4) - - MOV_L (EBX, EAX) -npRL4: - SUB_L (EAX, EBX) - MOV_L (EBX, height) - - MOV_L (CONTENT(offset), EBX) - MOV_L (width, ECX) - MOV_L (EAX, EDX) - CALL (VARINDIRECT(func)) - - CMP_L (CONST(0), height) - JNE (npRL5) - - CLD - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE -return: - RET -/***************************/ - ALIGNTEXT4 -npRLPartial: - MOV_L (width, EBX) - MOV_W (CONST(0x3cd), DX) -npRLPartial5: - MOV_L (ESI, EAX) - MOV_L (EDI, ECX) - SUB_L (CONTENT(GLNAME(vgaReadBottom)), EAX) - SUB_L (CONTENT(GLNAME(vgaWriteBottom)), ECX) - - CMP_L (EAX, ECX) - JC (npRLPartial1) - - MOV_L (EAX, ECX) -npRLPartial1: - INC_L (ECX) - CMP_L (EBX, ECX) - JC (npRLPartial2) - - MOV_L (EBX, ECX) -npRLPartial2: - SUB_L (ECX, EBX) - - REP - MOVS_B - - MOV_B (CONTENT(segment), AL) - CMP_L (CONTENT(GLNAME(vgaReadBottom)), ESI) - JNC (npRLPartial3) - - ADD_L (CONST(0x10000), ESI) - SUB_B (CONST(16), AL) -npRLPartial3: - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JNC (npRLPartial4) - - ADD_L (CONST(0x10000), EDI) - DEC_B (AL) -npRLPartial4: - MOV_B (AL, CONTENT(segment)) - OUT_B - - OR_L (EBX, EBX) - JNZ (npRLPartial5) - - MOV_L (CONTENT(offset), EAX) - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - - DEC_L (height) - JNZ (npRL5) - - CLD - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/***************************/ -npUpOrDown: - CMP_L (CONST(1), ydir) - JE (npDown) -npUp: - MOV_L (screen, EAX) - MOV_L (EAX, EBX) - NEG_L (EBX) - MOV_L (EBX, screen) - MOV_L (width, ECX) - SUB_L (ECX, EAX) - MOV_L (EAX, CONTENT(offset)) - MOV_L (ADDR(npUp3), CONTENT(npPartialJump)) - MOV_B (CONTENT(segment), AL) - JMP (npUp5) -/***************************/ - ALIGNTEXT4 -npUp3: - MOV_B (CONTENT(segment), AL) - CMP_L (CONTENT(GLNAME(vgaReadBottom)), ESI) - JNC (npUp4) - SUB_B (CONST(16), AL) - ADD_L (CONST(0x10000), ESI) -npUp4: - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JNC (npUp6) - DEC_B (AL) - ADD_L (CONST(0x10000), EDI) -npUp6: - MOV_B (AL, CONTENT(segment)) -npUp5: - MOV_W (CONST(0x3cd), DX) - OUT_B - - MOV_L (width, EBX) - MOV_L (CONTENT(GLNAME(vgaReadTop)), EAX) - SUB_L (ESI, EAX) - CMP_L (EBX, EAX) - JC (npPartial) - - MOV_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - SUB_L (EDI, EAX) - CMP_L (EBX, EAX) - JC (npPartial) - - MOV_L (ESI, EAX) - MOV_L (EDI, EBX) - SUB_L (CONTENT(GLNAME(vgaReadBottom)), EAX) - SUB_L (CONTENT(GLNAME(vgaWriteBottom)), EBX) - - MOV_L (screen, ECX) - XOR_L (EDX, EDX) - DIV_L (ECX) - XCHG_L (EAX, EBX) - - XOR_L (EDX, EDX) - DIV_L (ECX) - - CMP_L (EBX, EAX) - JC (npUp1) - - MOV_L (EBX, EAX) -npUp1: - INC_L (EAX) - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (npUp2) - - MOV_L (EBX, EAX) -npUp2: - SUB_L (EAX, EBX) - MOV_L (EBX, height) - - MOV_L (CONTENT(offset), EBX) - MOV_L (width, ECX) - MOV_L (EAX, EDX) - CALL (VARINDIRECT(func)) - - CMP_L (CONST(0), height) - JNE (npUp3) - - CLD - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/***************************/ - ALIGNTEXT4 -npDown: - MOV_L (screen, EAX) - SUB_L (width, EAX) - MOV_L (EAX, CONTENT(offset)) - ADD_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - MOV_L (EAX, CONTENT(speedUpBound)) - MOV_L (ADDR(npDown3), CONTENT(npPartialJump)) - MOV_B (CONTENT(segment), AL) - JMP (npDown5) -/***************************/ - ALIGNTEXT4 -npDown3: - MOV_B (CONTENT(segment), AL) - CMP_L (CONTENT(GLNAME(vgaReadTop)), ESI) - JC (npDown4) - ADD_B (CONST(16), AL) - SUB_L (CONST(0x10000), ESI) -npDown4: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JC (npDown6) - INC_B (AL) - SUB_L (CONST(0x10000), EDI) -npDown6: - MOV_B (AL, CONTENT(segment)) -npDown5: - MOV_W (CONST(0x3cd), DX) - OUT_B - - MOV_L (CONTENT(speedUpBound), EAX) - MOV_L (CONTENT(speedUpBound), EBX) - SUB_L (ESI, EAX) - SUB_L (EDI, EBX) - - MOV_L (screen, ECX) - XOR_L (EDX, EDX) - DIV_L (ECX) - XCHG_L (EAX, EBX) - - XOR_L (EDX, EDX) - DIV_L (ECX) - - CMP_L (EBX, EAX) - JC (npDown1) - - MOV_L (EBX, EAX) -npDown1: - OR_L (EAX, EAX) - JZ (npPartial) - - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (npDown2) - - MOV_L (EBX, EAX) -npDown2: - SUB_L (EAX, EBX) - MOV_L (EBX, height) - - MOV_L (CONTENT(offset), EBX) - MOV_L (width, ECX) - MOV_L (EAX, EDX) - CALL (VARINDIRECT(func)) - - CMP_L (CONST(0), height) - JNE (npDown3) - - CLD - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/***************************/ - ALIGNTEXT4 -bBoxLR: - DEC_L (ECX) - MOV_L (ECX, EAX) - SHR_L (CONST(1), EAX) - AND_L (CONST(1), ECX) - JNZ (bBoxLRR) -bBoxLR1: - MOVS_B - MOV_L (EAX, ECX) - REP - MOVS_W - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (bBoxLR1) - RET -/***************************/ - ALIGNTEXT4 -bBoxLRR: - MOVS_B - MOV_L (EAX, ECX) - REP - MOVS_W - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (bBoxLRR) - RET -/***************************/ - ALIGNTEXT4 -wBoxLR: - MOV_L (ECX, EAX) - SHR_L (CONST(1), EAX) - AND_L (CONST(1), ECX) - JNZ (wBoxLRR) -wBoxLR1: - MOV_L (EAX, ECX) - REP - MOVS_W - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (wBoxLR1) - RET -/***************************/ - ALIGNTEXT4 -wBoxLRR: - MOV_L (EAX, ECX) - REP - MOVS_W - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (wBoxLRR) - RET -/***************************/ - ALIGNTEXT4 -bwBoxLR: - MOV_L (EDX, CONTENT(hCount)) - DEC_L (ECX) - MOV_L (ECX, EAX) - SAR_L (CONST(2), ECX) - MOV_L (ECX, CONTENT(mCount)) - AND_L (CONST(3), EAX) - JNZ (bwBoxLRR) -bwBoxLR1: - MOV_B (REGIND(ESI), DL) - INC_L (ESI) - MOV_L (CONTENT(mCount), ECX) -bwBoxLR2: - LODS_L - ROL_L (CONST(8), EAX) - XCHG_B (AL, DL) - STOS_L - DEC_L (ECX) - JNZ (bwBoxLR2) - MOV_B (DL, REGIND(EDI)) - INC_L (EDI) - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(hCount)) - JNZ (bwBoxLR1) - RET -/***************************/ - ALIGNTEXT4 -bwBoxLRR: - MOV_L (EAX, CONTENT(rCount)) -bwBoxLRR1: - MOV_B (REGIND(ESI), DL) - INC_L (ESI) - MOV_L (CONTENT(mCount), ECX) -bwBoxLRR2: - LODS_L - ROL_L (CONST(8), EAX) - XCHG_B (AL, DL) - STOS_L - DEC_L (ECX) - JNZ (bwBoxLRR2) - MOV_B (DL, REGIND(EDI)) - INC_L (EDI) - MOV_L (CONTENT(rCount), ECX) - REP - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(hCount)) - JNZ (bwBoxLRR1) - RET -/***************************/ - ALIGNTEXT4 -wbBoxLR: - MOV_L (EDX, CONTENT(hCount)) - SUB_L (CONST(2), ECX) - MOV_L (ECX, EAX) - SHR_L (CONST(2), ECX) - MOV_L (ECX, CONTENT(mCount)) - AND_L (CONST(3), EAX) - JNZ (wbBoxLRR) -wbBoxLR2: - LODS_W - STOS_B - MOV_B (AH, DL) - MOV_L (CONTENT(mCount), ECX) -wbBoxLR1: - LODS_L - ROL_L (CONST(8), EAX) - XCHG_B (AL, DL) - STOS_L - DEC_L (ECX) - JNZ (wbBoxLR1) - MOV_B (DL, REGIND(EDI)) - INC_L (EDI) - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(hCount)) - JNZ (wbBoxLR2) - RET -/***************************/ - ALIGNTEXT4 -wbBoxLRR: - MOV_L (EAX, CONTENT(rCount)) -wbBoxLRR1: - LODS_W - STOS_B - MOV_B (AH, DL) - MOV_L (CONTENT(mCount), ECX) -wbBoxLRR2: - LODS_L - ROL_L (CONST(8), EAX) - XCHG_B (AL, DL) - STOS_L - DEC_L (ECX) - JNZ (wbBoxLRR2) - MOV_B (DL, REGIND(EDI)) - INC_L (EDI) - MOV_L (CONTENT(rCount), ECX) - REP - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(hCount)) - JNZ (wbBoxLRR1) - RET -/***************************/ - ALIGNTEXT4 -bBoxRL: - DEC_L (ECX) - MOV_L (ECX, EAX) - SAR_L (CONST(2), EAX) - AND_L (CONST(3), ECX) - JNZ (bBoxRLL) - ADD_L (CONST(3), EBX) -bBoxRL1: - MOVS_B - SUB_L (CONST(3), ESI) - SUB_L (CONST(3), EDI) - MOV_L (EAX, ECX) - REP - MOVS_L - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (bBoxRL1) - RET -/***************************/ - ALIGNTEXT4 -bBoxRLL: - MOV_L (ECX, CONTENT(lCount)) -bBoxRLL1: - MOVS_B - SUB_L (CONST(3), ESI) - SUB_L (CONST(3), EDI) - MOV_L (EAX, ECX) - REP - MOVS_L - ADD_L (CONST(3), ESI) - ADD_L (CONST(3), EDI) - MOV_L (CONTENT(lCount), ECX) - REP - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (bBoxRLL1) - RET -/***************************/ - ALIGNTEXT4 -wBoxRL: - MOV_L (ECX, EAX) - SAR_L (CONST(2), EAX) - AND_L (CONST(3), ECX) - JNZ (wBoxRLL) - ADD_L (CONST(3), EBX) -wBoxRL1: - SUB_L (CONST(3), ESI) - SUB_L (CONST(3), EDI) - MOV_L (EAX, ECX) - REP - MOVS_L - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (wBoxRL1) - RET -/***************************/ - ALIGNTEXT4 -wBoxRLL: - MOV_L (ECX, CONTENT(lCount)) -wBoxRLL1: - SUB_L (CONST(3), ESI) - SUB_L (CONST(3), EDI) - MOV_L (EAX, ECX) - REP - MOVS_L - ADD_L (CONST(3), ESI) - ADD_L (CONST(3), EDI) - MOV_L (CONTENT(lCount), ECX) - REP - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (wBoxRLL1) - RET -/***************************/ - ALIGNTEXT4 -bwBoxRL: - MOV_L (EDX, CONTENT(hCount)) - DEC_L (ECX) - MOV_L (ECX, EAX) - SAR_L (CONST(2), ECX) - MOV_L (ECX, CONTENT(mCount)) - AND_L (CONST(3), EAX) - JNZ (bwBoxRLL) - ADD_L (CONST(3), EBX) -bwBoxRL1: - MOV_B (REGIND(ESI), DL) - SUB_L (CONST(4), ESI) - SUB_L (CONST(3), EDI) - MOV_L (CONTENT(mCount), ECX) -bwBoxRL2: - LODS_L - XCHG_B (AL, DL) - ROR_L (CONST(8), EAX) - STOS_L - DEC_L (ECX) - JNZ (bwBoxRL2) - MOV_B (DL, REGOFF(3,EDI)) - DEC_L (EDI) - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(hCount)) - JNZ (bwBoxRL1) - RET -/***************************/ - ALIGNTEXT4 -bwBoxRLL: - MOV_L (EAX, CONTENT(lCount)) -bwBoxRLL1: - MOV_B (REGIND(ESI), DL) - SUB_L (CONST(4), ESI) - SUB_L (CONST(3), EDI) - MOV_L (CONTENT(mCount), ECX) -bwBoxRLL2: - LODS_L - XCHG_B (AL, DL) - ROR_L (CONST(8), EAX) - STOS_L - DEC_L (ECX) - JNZ (bwBoxRLL2) - MOV_B (DL, REGOFF(3,EDI)) - ADD_L (CONST(3), ESI) - ADD_L (CONST(2), EDI) - MOV_L (CONTENT(lCount), ECX) - REP - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(hCount)) - JNZ (bwBoxRLL1) - RET -/***************************/ - ALIGNTEXT4 -wbBoxRL: - MOV_L (EDX, CONTENT(hCount)) - SUB_L (CONST(2), ECX) - MOV_L (ECX, EAX) - SAR_L (CONST(2), ECX) - MOV_L (ECX, CONTENT(mCount)) - AND_L (CONST(3), EAX) - JNZ (wbBoxRLL) - ADD_L (CONST(3), EBX) -wbBoxRL1: - DEC_L (ESI) - MOV_W (REGIND(ESI), AX) - MOV_B (AH, REGIND(EDI)) - MOV_B (AL, DL) - SUB_L (CONST(4), ESI) - SUB_L (CONST(4), EDI) - MOV_L (CONTENT(mCount), ECX) -wbBoxRL2: - LODS_L - XCHG_B (AL, DL) - ROR_L (CONST(8), EAX) - STOS_L - DEC_L (ECX) - JNZ (wbBoxRL2) - MOV_B (DL, REGOFF(3,EDI)) - DEC_L (EDI) - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(hCount)) - JNZ (wbBoxRL1) - RET -/***************************/ - ALIGNTEXT4 -wbBoxRLL: - MOV_L (EAX, CONTENT(lCount)) -wbBoxRLL1: - DEC_L (ESI) - MOV_W (REGIND(ESI), AX) - MOV_B (AH, REGIND(EDI)) - MOV_B (AL, DL) - SUB_L (CONST(4), ESI) - SUB_L (CONST(4), EDI) - MOV_L (CONTENT(mCount), ECX) -wbBoxRLL2: - LODS_L - XCHG_B (AL, DL) - ROR_L (CONST(8), EAX) - STOS_L - DEC_L (ECX) - JNZ (wbBoxRLL2) - MOV_B (DL, REGOFF(3,EDI)) - ADD_L (CONST(3), ESI) - ADD_L (CONST(2), EDI) - MOV_L (CONTENT(lCount), ECX) - REP - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (CONTENT(hCount)) - JNZ (wbBoxRLL1) - RET -/***************************/ - ALIGNTEXT4 -npPartial: - MOV_L (width, EBX) - MOV_W (CONST(0x3cd), DX) -npPartial5: - MOV_L (CONTENT(GLNAME(vgaReadTop)), EAX) - MOV_L (CONTENT(GLNAME(vgaWriteTop)), ECX) - SUB_L (ESI, EAX) - SUB_L (EDI, ECX) - - CMP_L (EAX, ECX) - JC (npPartial1) - - MOV_L (EAX, ECX) -npPartial1: - CMP_L (EBX, ECX) - JC (npPartial2) - - MOV_L (EBX, ECX) -npPartial2: - SUB_L (ECX, EBX) - - REP - MOVS_B - - MOV_B (CONTENT(segment), AL) - CMP_L (CONTENT(GLNAME(vgaReadTop)), ESI) - JC (npPartial3) - - SUB_L (CONST(0x10000), ESI) - ADD_B (CONST(16), AL) -npPartial3: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JC (npPartial4) - - SUB_L (CONST(0x10000), EDI) - INC_B (AL) -npPartial4: - MOV_B (AL, CONTENT(segment)) - OUT_B - - OR_L (EBX, EBX) - JNZ (npPartial5) - - MOV_L (CONTENT(offset), EAX) - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - - DEC_L (height) - JZ (npPartial6) - JMP (VARINDIRECT(npPartialJump)) - ALIGNTEXT4 -npPartial6: - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/***************************/ - ALIGNTEXT4 -sWW: - MOV_L (ECX, EAX) -sWW1: - MOV_L (EAX, ECX) - REP - MOVS_B - ADD_L (EBX, ESI) - ADD_L (EBX, EDI) - DEC_L (EDX) - JNZ (sWW1) - RET -/***************************/ - ALIGNTEXT4 -pMode: - MOV_W (CONST(0x0604), AX) - MOV_W (CONST(0x3c4), DX) - OUT_W - MOV_W (CONST(0x4105), AX) - MOV_W (CONST(0x3ce), DX) - OUT_W - - MOV_L (ESI, EAX) - MOV_L (ADDR(pTable), EBX) - MOV_L (width, ECX) - - ADD_L (CONST(3), EAX) - AND_L (CONST(0xfffffffc), EAX) - SUB_L (ESI, EAX) - SUB_L (EAX, ECX) - - XOR_L (EDX, EDX) - SAL_L (CONST(1), EAX) - JZ (pNoL) - - ADD_L (CONST(8), EBX) - INC_L (EDX) -pNoL: - MOV_W (lMaskTable(EAX), AX) - MOV_W (AX, CONTENT(lMask)) - - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - - SAL_L (CONST(1), EAX) - JZ (pNoR) - - ADD_L (CONST(4), EBX) - INC_L (EDX) -pNoR: - CMP_L (CONST(1), xdir) - JE (pModeLR) - ADD_L (CONST(16), EBX) -pModeLR: - MOV_L (REGIND(EBX), EBX) - MOV_L (EBX, CONTENT(func)) - - MOV_W (rMaskTable(EAX), AX) - MOV_W (AX, CONTENT(rMask)) - - SHR_L (CONST(2), ECX) - MOV_L (ECX, CONTENT(mCount)) - - ADD_L (ECX, EDX) - MOV_L (EDX, width) - - MOV_L (ESI, EAX) - SHR_L (CONST(14), EAX) - AND_B (CONST(0xf0), AL) - MOV_L (EDI, EBX) - SHR_L (CONST(18), EBX) - OR_B (BL, AL) - MOV_B (AL, CONTENT(segment)) - - SHR_L (CONST(2), ESI) - AND_L (CONST(0xffff), ESI) - ADD_L (CONTENT(GLNAME(vgaReadBottom)), ESI) - SHR_L (CONST(2), EDI) - AND_L (CONST(0xffff), EDI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - - MOV_L (screen, EBX) - SAR_L (CONST(2), EBX) - MOV_L (EBX, EAX) - - DEC_L (EBX) - MOV_L (EBX, CONTENT(pLROffset)) - - INC_L (EBX) - SUB_L (ECX, EBX) - MOV_L (EBX, CONTENT(pMOffset)) -/***************************/ - CMP_L (CONST(1), ydir) - JE (pDown) -pUp: - MOV_L (EAX, EBX) - NEG_L (EBX) - MOV_L (EBX, screen) - SUB_L (width, EAX) - MOV_L (EAX, CONTENT(offset)) - MOV_L (ADDR(pUp3), CONTENT(pPartialJump)) - MOV_B (CONTENT(segment), AL) - JMP (pUp5) -/***************************/ - ALIGNTEXT4 -pUp3: - MOV_B (CONTENT(segment), AL) - CMP_L (CONTENT(GLNAME(vgaReadBottom)), ESI) - JNC (pUp4) - SUB_B (CONST(16), AL) - ADD_L (CONST(0x10000), ESI) -pUp4: - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JNC (pUp6) - DEC_B (AL) - ADD_L (CONST(0x10000), EDI) -pUp6: - MOV_B (AL, CONTENT(segment)) -pUp5: - MOV_W (CONST(0x3cd), DX) - OUT_B - - MOV_L (ESI, CONTENT(sM)) - MOV_L (EDI, CONTENT(dM)) - - MOV_L (width, EBX) - MOV_L (CONTENT(GLNAME(vgaReadTop)), EAX) - SUB_L (ESI, EAX) - CMP_L (EBX, EAX) - JC (pPartial) - - MOV_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - SUB_L (EDI, EAX) - CMP_L (EBX, EAX) - JC (pPartial) - - MOV_L (ESI, EAX) - MOV_L (EDI, EBX) - SUB_L (CONTENT(GLNAME(vgaReadBottom)), EAX) - SUB_L (CONTENT(GLNAME(vgaWriteBottom)), EBX) - - MOV_L (screen, ECX) - XOR_L (EDX, EDX) - DIV_L (ECX) - XCHG_L (EAX, EBX) - - XOR_L (EDX, EDX) - DIV_L (ECX) - - CMP_L (EBX, EAX) - JC (pUp1) - - MOV_L (EBX, EAX) -pUp1: - INC_L (EAX) - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (pUp2) - - MOV_L (EBX, EAX) -pUp2: - SUB_L (EAX, EBX) - MOV_L (EBX, height) - - MOV_L (EAX, CONTENT(allowance)) - CALL (VARINDIRECT(func)) - - CMP_L (CONST(0), height) - JNE (pUp3) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - MOV_W (CONST(0x0c04), AX) - OUT_W - MOV_W (CONST(0x4005), AX) - MOV_W (CONST(0x3ce), DX) - OUT_W - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/***************************/ - ALIGNTEXT4 -pDown: - MOV_L (EAX, screen) - SUB_L (width, EAX) - MOV_L (EAX, CONTENT(offset)) - ADD_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - MOV_L (EAX, CONTENT(speedUpBound)) - MOV_L (ADDR(pDown3), CONTENT(pPartialJump)) - MOV_B (CONTENT(segment), AL) - JMP (pDown5) -/***************************/ - ALIGNTEXT4 -pDown3: - MOV_B (CONTENT(segment), AL) - CMP_L (CONTENT(GLNAME(vgaReadTop)), ESI) - JC (pDown4) - ADD_B (CONST(16), AL) - SUB_L (CONST(0x10000), ESI) -pDown4: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JC (pDown6) - INC_B (AL) - SUB_L (CONST(0x10000), EDI) -pDown6: - MOV_B (AL, CONTENT(segment)) -pDown5: - MOV_W (CONST(0x3cd), DX) - OUT_B - - MOV_L (ESI, CONTENT(sM)) - MOV_L (EDI, CONTENT(dM)) - - MOV_L (CONTENT(speedUpBound), EAX) - MOV_L (CONTENT(speedUpBound), EBX) - SUB_L (ESI, EAX) - SUB_L (EDI, EBX) - - MOV_L (screen, ECX) - XOR_L (EDX, EDX) - DIV_L (ECX) - XCHG_L (EAX, EBX) - - XOR_L (EDX, EDX) - DIV_L (ECX) - - CMP_L (EBX, EAX) - JC (pDown1) - - MOV_L (EBX, EAX) -pDown1: - OR_L (EAX, EAX) - JZ (pPartial) - - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (pDown2) - - MOV_L (EBX, EAX) -pDown2: - SUB_L (EAX, EBX) - MOV_L (EBX, height) - - MOV_L (EAX, CONTENT(allowance)) - CALL (VARINDIRECT(func)) - - CMP_L (CONST(0), height) - JNE (pDown3) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - MOV_W (CONST(0x0c04), AX) - OUT_W - MOV_W (CONST(0x4005), AX) - MOV_W (CONST(0x3ce), DX) - OUT_W - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/************************************/ - ALIGNTEXT4 -pLMR: - MOV_W (CONST(0x3c4), DX) - MOV_W (CONTENT(lMask), AX) - OUT_W - - MOV_L (CONTENT(pLROffset), EAX) - MOV_L (CONTENT(allowance), EDX) -pLMR1: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLMR1) - - MOV_L (ESI, CONTENT(sM1)) - MOV_L (EDI, CONTENT(dM1)) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - - MOV_L (CONTENT(sM), ESI) - MOV_L (CONTENT(dM), EDI) - INC_L (ESI) - INC_L (EDI) - - MOV_L (CONTENT(pMOffset), EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(allowance), EDX) -pLMR2: - MOV_L (EBX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLMR2) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONTENT(rMask), AX) - OUT_W - - MOV_L (CONTENT(pLROffset), EAX) - MOV_L (CONTENT(allowance), EDX) - - MOV_L (CONTENT(sM), ESI) - MOV_L (CONTENT(dM), EDI) - MOV_L (CONTENT(mCount), ECX) - INC_L (ECX) - ADD_L (ECX, ESI) - ADD_L (ECX, EDI) -pLMR3: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLMR3) - - MOV_L (CONTENT(sM1), ESI) - MOV_L (CONTENT(dM1), EDI) - - RET -/************************************/ - ALIGNTEXT4 -pLMRa: - MOV_W (CONST(0x3c4), DX) - MOV_W (CONTENT(rMask), AX) - OUT_W - - MOV_L (CONTENT(pLROffset), EAX) - MOV_L (CONTENT(allowance), EDX) - - MOV_L (CONTENT(mCount), ECX) - INC_L (ECX) - ADD_L (ECX, ESI) - ADD_L (ECX, EDI) -pLMRa3: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLMRa3) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - - MOV_L (CONTENT(sM), ESI) - MOV_L (CONTENT(dM), EDI) - INC_L (ESI) - INC_L (EDI) - - MOV_L (CONTENT(pMOffset), EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(allowance), EDX) -pLMRa2: - MOV_L (EBX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLMRa2) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONTENT(lMask), AX) - OUT_W - - MOV_L (CONTENT(pLROffset), EAX) - MOV_L (CONTENT(allowance), EDX) - - MOV_L (CONTENT(sM), ESI) - MOV_L (CONTENT(dM), EDI) -pLMRa1: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLMRa1) - - RET -/************************************/ - ALIGNTEXT4 -pLM: - MOV_W (CONST(0x3c4), DX) - MOV_W (CONTENT(lMask), AX) - OUT_W - - MOV_L (CONTENT(pLROffset), EAX) - MOV_L (CONTENT(allowance), EDX) -pLM1: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLM1) - - MOV_L (ESI, CONTENT(sM1)) - MOV_L (EDI, CONTENT(dM1)) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - - MOV_L (CONTENT(sM), ESI) - MOV_L (CONTENT(dM), EDI) - INC_L (ESI) - INC_L (EDI) - - MOV_L (CONTENT(pMOffset), EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(allowance), EDX) -pLM2: - MOV_L (EBX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLM2) - - MOV_L (CONTENT(sM1), ESI) - MOV_L (CONTENT(dM1), EDI) - - RET -/************************************/ - ALIGNTEXT4 -pLMa: - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - - INC_L (ESI) - INC_L (EDI) - - MOV_L (CONTENT(pMOffset), EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(allowance), EDX) -pLMa2: - MOV_L (EBX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLMa2) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONTENT(lMask), AX) - OUT_W - - MOV_L (CONTENT(pLROffset), EAX) - MOV_L (CONTENT(allowance), EDX) - - MOV_L (CONTENT(sM), ESI) - MOV_L (CONTENT(dM), EDI) -pLMa1: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pLMa1) - - RET -/************************************/ - ALIGNTEXT4 -pMR: - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - - MOV_L (CONTENT(pMOffset), EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(allowance), EDX) -pMR2: - MOV_L (EBX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pMR2) - - MOV_L (ESI, CONTENT(sM1)) - MOV_L (EDI, CONTENT(dM1)) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONTENT(rMask), AX) - OUT_W - - MOV_L (CONTENT(pLROffset), EAX) - MOV_L (CONTENT(allowance), EDX) - - MOV_L (CONTENT(sM), ESI) - MOV_L (CONTENT(dM), EDI) - MOV_L (CONTENT(mCount), ECX) - ADD_L (ECX, ESI) - ADD_L (ECX, EDI) -pMR3: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pMR3) - - MOV_L (CONTENT(sM1), ESI) - MOV_L (CONTENT(dM1), EDI) - - RET -/************************************/ - ALIGNTEXT4 -pMRa: - MOV_W (CONST(0x3c4), DX) - MOV_W (CONTENT(rMask), AX) - OUT_W - - MOV_L (CONTENT(pLROffset), EAX) - MOV_L (CONTENT(allowance), EDX) - - MOV_L (CONTENT(mCount), ECX) - ADD_L (ECX, ESI) - ADD_L (ECX, EDI) -pMRa3: - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pMRa3) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - - MOV_L (CONTENT(sM), ESI) - MOV_L (CONTENT(dM), EDI) - - MOV_L (CONTENT(pMOffset), EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(allowance), EDX) -pMRa2: - MOV_L (EBX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pMRa2) - - RET -/************************************/ - ALIGNTEXT4 -pM: - MOV_L (CONTENT(pMOffset), EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(allowance), EDX) -pM2: - MOV_L (EBX, ECX) - REP - MOVS_B - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - DEC_L (EDX) - JNZ (pM2) - - RET -/************************************/ - ALIGNTEXT4 -pPartial: - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONST(0), CONTENT(tmp)) - - MOV_W (CONTENT(lMask), AX) - CMP_W (CONST(0x0f02), AX) - JE (pPartial7) -pPartial9: - MOV_W (CONST(0x3c4), DX) - OUT_W - MOVS_B - - MOV_W (CONST(0x0f02), AX) - OUT_W - JMP (pPartial6) - ALIGNTEXT4 -pPartial7: - MOV_W (CONST(0x3c4), DX) - OUT_W -pPartial5: - MOV_L (CONTENT(GLNAME(vgaReadTop)), EAX) - MOV_L (CONTENT(GLNAME(vgaWriteTop)), ECX) - SUB_L (ESI, EAX) - SUB_L (EDI, ECX) - - CMP_L (EAX, ECX) - JC (pPartial1) - - MOV_L (EAX, ECX) -pPartial1: - CMP_L (EBX, ECX) - JC (pPartial2) - - MOV_L (EBX, ECX) -pPartial2: - SUB_L (ECX, EBX) - - REP - MOVS_B -pPartial6: - MOV_B (CONTENT(segment), AL) - CMP_L (CONTENT(GLNAME(vgaReadTop)), ESI) - JC (pPartial3) - - SUB_L (CONST(0x10000), ESI) - ADD_B (CONST(16), AL) -pPartial3: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JC (pPartial4) - - SUB_L (CONST(0x10000), EDI) - INC_B (AL) -pPartial4: - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - - OR_L (EBX, EBX) - JNZ (pPartial5) - - CMP_L (CONST(1), CONTENT(tmp)) - JE (pPartial8) - - MOV_L (CONST(1), CONTENT(tmp)) - MOV_W (CONTENT(rMask), AX) - CMP_W (CONST(0x0f02), AX) - JNE (pPartial9) -pPartial8: - MOV_L (CONTENT(GLNAME(vgaReadTop)), EAX) - MOV_L (CONTENT(offset), EAX) - ADD_L (EAX, ESI) - ADD_L (EAX, EDI) - - DEC_L (height) - JZ (pPartial10) - JMP (VARINDIRECT(pPartialJump)) - ALIGNTEXT4 -pPartial10: - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - MOV_W (CONST(0x0c04), AX) - OUT_W - MOV_W (CONST(0x4005), AX) - MOV_W (CONST(0x3ce), DX) - OUT_W - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBox.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBox.s:1.3 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBox.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBox.s:1.3 Sun Dec 26 19:39:50 1999 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBox.s Fri Jan 18 15:26:25 2002 @@ -1,710 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suBox.s,v 1.3 1999/12/27 00:39:50 robin Exp $ */ -/******************************************************************************* - Copyright 1992 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -(glenn@cs.utexas.edu) -7/27/92 -*******************************************************************************/ -/* $XConsortium: suBox.s /main/5 1996/02/21 18:09:14 kaleb $ */ - -#include "assyntax.h" - - FILE("suBox.s") - AS_BEGIN - -#include "vgaAsm.h" - -/* - void SpeedUpBox(dst, fill, h, w, screen) -*/ - -#define dst REGOFF(8,EBP) -#define fill REGOFF(12,EBP) -#define height REGOFF(16,EBP) -#define width REGOFF(20,EBP) -#define screen REGOFF(24,EBP) - - SEG_DATA -copyright: - STRING("Copyright 7/27/1992 by Glenn G. Lai") - ALIGNDATA4 -pixTable: - D_LONG pix0D, pix1D, pix2D, pix3D -pixMiddle: - D_LONG 0 -/****************************************/ - SEG_TEXT - ALIGNTEXT4 - GLOBL GLNAME(SpeedUpBox) -GLNAME(SpeedUpBox): - MOV_L (REGOFF(12,ESP), EAX) - MOV_L (REGOFF(16,ESP), ECX) - MOV_L (EAX, EDX) - OR_L (ECX, EDX) - JZ (return) - - CMP_L (CONST(1), EAX) - JNE (notHLine) - - MOV_L (ECX, REGOFF(12,ESP)) - MOV_L (REGOFF(20,ESP), EAX) - MOV_L (EAX, REGOFF(16,ESP)) - JMP (GLNAME(SpeedUpHLine1)) - ALIGNTEXT4 -notHLine: - CMP_L (CONST(1), ECX) - JNE (notVHLine) - - MOV_L (EAX, REGOFF(12,ESP)) - MOV_L (EAX, ECX) - MOV_L (REGOFF(20,ESP), EAX) - MOV_L (EAX, REGOFF(16,ESP)) - JMP (GLNAME(SpeedUpVLine1)) -/****************************************/ - ALIGNTEXT4 -notVHLine: - MOV_L (REGOFF(4,ESP), EAX) - CMP_L (VGABASE, EAX) - JNC (window) - - PUSH_L (EBP) - MOV_L (ESP, EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif -pix: - MOV_L (fill, EBX) - MOV_L (width, ECX) - MOV_L (height, EDX) - MOV_L (screen, ESI) - MOV_L (EAX, EDI) - - ADD_L (CONST(3), EAX) - AND_L (CONST(0xfffffffc), EAX) - MOV_L (EAX, CONTENT(pixMiddle)) - - SUB_L (EDI, EAX) - CMP_L (EAX, ECX) - JNC (fillLeft) - MOV_L (ECX, EAX) -fillLeft: - SUB_L (EAX, ECX) - CALL (CODEPTR(REGDIS(pixTable,EAX,4))) -fillRight: - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - JZ (fillMiddle) - - MOV_L (ECX, EDI) - AND_L (CONST(0xfffffffc), EDI) - ADD_L (CONTENT(pixMiddle), EDI) - CALL (CODEPTR(REGDIS(pixTable,EAX,4))) -fillMiddle: - SAR_L (CONST(2), ECX) - JZ (done) - MOV_L (ECX, CONTENT(tmp)) - MOV_L (EBX, EAX) - MOV_L (CONTENT(pixMiddle), EBX) -fillMiddle1: - MOV_L (CONTENT(tmp), ECX) - MOV_L (EBX, EDI) - REP - STOS_L - ADD_L (ESI, EBX) - DEC_L (EDX) - JNZ (fillMiddle1) - JMP (done) -/****************/ - ALIGNTEXT4 -pix0D: - RET -/****************/ - ALIGNTEXT4 -pix1D: - MOV_L (EDX, EAX) -p1D: - MOV_B (BL, REGIND(EDI)) - ADD_L (ESI, EDI) - DEC_L (EAX) - JNZ (p1D) - RET -/****************/ - ALIGNTEXT4 -pix2D: - MOV_L (EDX, EAX) -p2D: - MOV_W (BX, REGIND(EDI)) - ADD_L (ESI, EDI) - DEC_L (EAX) - JNZ (p2D) - RET -/****************/ - ALIGNTEXT4 -pix3D: - MOV_L (EDX, EAX) -p3D: - MOV_B (BL, REGIND(EDI)) - MOV_W (BX, REGOFF(1,EDI)) - ADD_L (ESI, EDI) - DEC_L (EAX) - JNZ (p3D) - RET -/****************************************/ - SEG_DATA - ALIGNDATA4 -npTable: - D_LONG npM, npMR, npLM, npLMR -/****************************************/ - SEG_TEXT - ALIGNTEXT4 -window: - SUB_L (VGABASE, EAX) - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (EDI) - MOV_L (EAX, EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - -/* Change THRESHOLD at your own risk!!! */ -#define THRESHOLD CONST(22) - CMP_L (THRESHOLD, ECX) - JGE (pMode) - - MOV_L (screen, EAX) - SUB_L (ECX, EAX) - MOV_L (EAX, CONTENT(offset)) - ADD_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - MOV_L (EAX, CONTENT(speedUpTop)) - - MOV_L (ADDR(npTable), EAX) - TEST_L (CONST(1), EDI) - JZ (window1) - ADD_L (CONST(8), EAX) - DEC_L (ECX) -window1: - SHR_L (CONST(1), ECX) - JZ (window2) - JNC (window3) - ADD_L (CONST(4), EAX) - JMP (window3) -window2: - MOV_L (ADDR(npTable), EAX) - MOV_L (CONST(1), ECX) -window3: - MOV_L (REGIND(EAX), EAX) - MOV_L (EAX, CONTENT(func)) - MOV_L (ECX, CONTENT(mCount)) - - MOV_L (EDI, EAX) - SHR_L (CONST(16), EAX) - MOV_B (AL, CONTENT(segment)) - - AND_L (CONST(0xffff), EDI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JMP (npLoop3) - ALIGNTEXT4 -npLoop: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JC (npLoop1) - SUB_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - INC_B (AL) - MOV_B (AL, CONTENT(segment)) -npLoop3: - MOV_W (CONST(0x3cd), DX) - OUT_B -npLoop1: - MOV_L (CONTENT(speedUpTop), EAX) - SUB_L (EDI, EAX) - XOR_L (EDX, EDX ) - DIV_L (screen) - - OR_L (EAX, EAX) - JZ (npPartial) - - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (npLoop2) - MOV_L (EBX, EAX) -npLoop2: - SUB_L (EAX, EBX) - MOV_L (EBX, height) - MOV_L (EAX, EDX) - - MOV_L (fill, EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(offset), ESI) - - CALL (VARINDIRECT(func)) - - CMP_L (CONST(0), height) - JNZ (npLoop) - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/****************************************/ - ALIGNTEXT4 -npM: - MOV_L (EBX, ECX) - REP - STOS_W - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (npM) - RET -/****************************************/ - ALIGNTEXT4 -npMR: - MOV_L (EBX, ECX) - REP - STOS_W - STOS_B - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (npMR) - RET -/****************************************/ - ALIGNTEXT4 -npLM: - MOV_L (EBX, ECX) - STOS_B - REP - STOS_W - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (npLM) - RET -/****************************************/ - ALIGNTEXT4 -npLMR: - MOV_L (EBX, ECX) - STOS_B - REP - STOS_W - STOS_B - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (npLMR) - RET -/****************************************/ - ALIGNTEXT4 -npPartial: - SUB_L (CONTENT(offset), EDX) - - MOV_L (fill, EAX) - MOV_L (width, EBX) - MOV_L (EDX, ECX) - SUB_L (ECX, EBX) - - TEST_L (CONST(1), EDI) - JZ (npPartial1) - STOS_B - DEC_L (ECX) - JZ (npPartial2) -npPartial1: - SHR_L (CONST(1), ECX) - REP - STOS_W -npPartial2: - SUB_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - INC_B (AL) - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - - MOV_L (fill, EAX) - MOV_L (EBX, ECX) - SHR_L (CONST(1), ECX) - JZ (npPartial3) - REP - STOS_W - JNC (npPartial4) -npPartial3: - STOS_B -npPartial4: - ADD_L (CONTENT(offset), EDI) - DEC_L (height) - JNZ (npLoop1) - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/****************************************/ - SEG_DATA - ALIGNDATA4 -lCount: - D_LONG 0 -mCount: - D_LONG 0 -rCount: - D_LONG 0 -offset: - D_LONG 0 -allowance: - D_LONG 0 -func: - D_LONG 0 -speedUpTop: - D_LONG 0 -tmp: - D_LONG 0 -pCorrect: - D_LONG 0 -pTable: - D_LONG pM, pMR, pLM, pLMR -lMaskTable: - D_WORD 0x0f02, 0x0802, 0x0c02, 0x0e02 -rMaskTable: - D_WORD 0x0f02, 0x0102, 0x0302, 0x0702 -lMask: - D_WORD 0 -rMask: - D_WORD 0 -segment: - D_BYTE 0 -/****************************************/ - SEG_TEXT - ALIGNTEXT4 -pMode: - MOV_L (EDI, ESI) - ADD_L (CONST(3), ESI) - AND_L (CONST(0xfffffffc), ESI) - SUB_L (EDI, ESI) - - SUB_L (ESI, ECX) - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - - MOV_L (CONST(0), CONTENT(tmp)) - MOV_L (ADDR(pTable), EBX) - XOR_L (EDX, EDX) - SAL_L (CONST(1), ESI) - JZ (pNoL) - - ADD_L (CONST(8), EBX) - MOV_L (CONST(1), EDX) - MOV_L (CONST(1), CONTENT(tmp)) -pNoL: - MOV_L (EDX, CONTENT(pCorrect)) - MOV_W (lMaskTable(ESI), DX) - MOV_W (DX, CONTENT(lMask)) - - SAR_L (CONST(2), ECX) - MOV_L (ECX, CONTENT(mCount)) - - SAL_L (CONST(1), EAX) - JZ (pNoR) - ADD_L (CONST(4), EBX) - INC_L (CONTENT(tmp)) -pNoR: - MOV_L (REGIND(EBX), EBX) - MOV_L (EBX, CONTENT(func)) - MOV_W (rMaskTable(EAX), DX) - MOV_W (DX, CONTENT(rMask)) - - MOV_L (screen, EAX) - SAR_L (CONST(2), EAX) - MOV_L (EAX, screen) - SUB_L (ECX, EAX) - MOV_L (EAX, CONTENT(offset)) - SUB_L (CONTENT(tmp), EAX) - ADD_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - MOV_L (EAX, CONTENT(speedUpTop)) -/***************************/ - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0604), AX ) - OUT_W - MOV_W (CONST(0x3ce), DX) - MOV_W (CONST(0x0001), AX) - OUT_W - MOV_W (CONST(0x0003), AX) - OUT_W - MOV_W (CONST(0x4005), AX) - OUT_W - MOV_W (CONST(0xff08), AX) - OUT_W -/***************************/ - MOV_L (EDI, EAX) - SHR_L (CONST(18), EAX) - MOV_B (AL, CONTENT(segment)) - - AND_L (CONST(0x3ffff), EDI) - SAR_L (CONST(2), EDI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JMP (pLoop3) -/***************************/ - ALIGNTEXT4 -pLoop: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JC (pLoop1) - SUB_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - INC_B (AL) - MOV_B (AL, CONTENT(segment)) -pLoop3: - MOV_W (CONST(0x3cd), DX) - OUT_B -pLoop1: - MOV_L (CONTENT(speedUpTop), EAX) - SUB_L (EDI, EAX) - XOR_L (EDX, EDX) - DIV_L (screen) - - OR_L (EAX, EAX) - JZ (pPartial) - - MOV_L (height, EBX) - CMP_L (EBX, EAX) - JC (pLoop2) - MOV_L (EBX, EAX) -pLoop2: - MOV_L (EAX, CONTENT(allowance)) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(offset), ESI) - - CALL (VARINDIRECT(func)) - - SUB_L (CONTENT(pCorrect), EDI) -pLoop4: - MOV_L (height, EBX) - SUB_L (CONTENT(allowance), EBX) - MOV_L (EBX, height) - JNZ (pLoop) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - MOV_W (CONST(0x0c04), AX) - OUT_W - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/****************************************/ - ALIGNTEXT4 -pPartial: - MOV_L (CONTENT(GLNAME(vgaWriteTop)), ECX) - SUB_L (EDI, ECX) - - MOV_W (CONTENT(lMask), AX) - MOV_W (CONST(0x3c4), DX) - OUT_W - - MOV_L (fill, EAX) - MOV_L (CONTENT(mCount), EBX) - - CMP_L (CONST(0), CONTENT(pCorrect)) - JE (pPartial1) - - STOS_B - DEC_L (ECX) - MOV_W (CONST(0x0f02), AX) - OUT_W - MOV_L (fill, EAX) -pPartial1: - SUB_L (ECX, EBX) - OR_L (ECX, ECX) - JZ (pPartial2) - SHR_L (CONST(1), ECX) - JNC (pPartial3) - STOS_B - JZ (pPartial2) -pPartial3: - REP - STOS_W -pPartial2: - SUB_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - INC_B (AL) - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - - MOV_L (fill, EAX) - MOV_L (EBX, ECX) - OR_L (ECX, ECX) - JZ (pPartial4) - - SHR_L (CONST(1), ECX) - JZ (pPartial6) - REP - STOS_W - JNC (pPartial4) -pPartial6: - STOS_B -pPartial4: - MOV_W (CONTENT(rMask), AX) - CMP_W (CONST(0x0f02), AX) - JE (pPartial5) - MOV_W (CONST(0x3c4), DX) - OUT_W - MOV_L (fill, EAX) - MOV_B (AL, REGIND(EDI)) -pPartial5: - ADD_L (CONTENT(offset), EDI) - SUB_L (CONTENT(pCorrect), EDI) - DEC_L (height) - JNZ (pLoop1) - - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0f02), AX) - OUT_W - MOV_W (CONST(0x0c04), AX) - OUT_W -done: - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE -return: - RET -/****************************/ - ALIGNTEXT4 -pMR: - MOV_W (CONTENT(rMask), AX) - MOV_W (CONST(0x3c4), DX) - OUT_W - - MOV_L (fill, EAX) - MOV_L (CONTENT(allowance), EBX) - MOV_L (EDI, EDX) - ADD_L (CONTENT(mCount), EDX) - MOV_L (screen, ESI) -pMR1: - MOV_B (AL, REGIND(EDX)) - ADD_L (ESI, EDX) - DEC_L (EBX) - JNZ (pMR1) - JMP (pM) -/****************************/ - ALIGNTEXT4 -pLMR: - MOV_W (CONTENT(rMask), AX) - MOV_W (CONST(0x3c4), DX) - OUT_W - - MOV_L (fill, EAX) - MOV_L (CONTENT(allowance), EBX) - LEA_L (REGOFF(1,EDI), EDX) - ADD_L (CONTENT(mCount), EDX) - MOV_L (screen, ESI) -pLMR1: - MOV_B (AL, REGIND(EDX)) - ADD_L (ESI, EDX) - DEC_L (EBX) - JNZ (pLMR1) -/****************************/ -pLM: - MOV_W (CONTENT(lMask), AX) - MOV_W (CONST(0x3c4), DX) - OUT_W - - MOV_L (fill, EAX) - MOV_L (CONTENT(allowance), EBX) - MOV_L (EDI, EDX) - MOV_L (screen, ESI) -pLM1: - MOV_B (AL, REGIND(EDX)) - ADD_L (ESI, EDX) - DEC_L (EBX) - JNZ (pLM1) - - INC_L (EDI) -/****************************/ -pM: - MOV_W (CONST(0x0f02), AX) - MOV_W (CONST(0x3c4), DX) - OUT_W - - MOV_L (fill, EAX) - MOV_L (CONTENT(mCount), EBX) - MOV_L (CONTENT(allowance), EDX) - MOV_L (CONTENT(offset), ESI) - TEST_L (CONST(1), EDI) - JNZ (pM1) - SHR_L (CONST(1), EBX) - JC (pM2) -pM3: - MOV_L (EBX, ECX) - REP - STOS_W - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (pM3) - RET -/****************************/ - ALIGNTEXT4 -pM2: - MOV_L (EBX, ECX) - REP - STOS_W - STOS_B - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (pM2) - RET -/****************************/ - ALIGNTEXT4 -pM1: - DEC_L (EBX) - SHR_L (CONST(1), EBX) - JC (pM4) -pM5: - STOS_B - MOV_L (EBX, ECX) - REP - STOS_W - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (pM5) - RET -/****************************/ - ALIGNTEXT4 -pM4: - STOS_B - MOV_L (EBX, ECX) - REP - STOS_W - STOS_B - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (pM4) - RET Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suLine.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suLine.s:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suLine.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suLine.s:1.2 Sat Jul 25 12:58:31 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suLine.s Fri Jan 18 15:26:25 2002 @@ -1,762 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suLine.s,v 1.2 1998/07/25 16:58:31 dawes Exp $ */ -/******************************************************************************* - Copyright 1992, 1993 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -(glenn@cs.utexas.edu) -8/18/92 -7/8/93 -*******************************************************************************/ -/* $XConsortium: suLine.s /main/5 1996/02/21 18:09:18 kaleb $ */ - -#include "assyntax.h" - - FILE("suLine.s") - AS_BEGIN - -#include "vgaAsm.h" - -/* SpeedUpBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, - x1, y1, e, e1, e2, len); -*/ - -#define rop REGOFF(8,EBP) -#define AND REGOFF(12,EBP) -#define XOR REGOFF(16,EBP) -#define addrl REGOFF(20,EBP) -#define nlwidth REGOFF(24,EBP) -#define signdx REGOFF(28,EBP) -#define signdy REGOFF(32,EBP) -#define axis REGOFF(36,EBP) -#define x1 REGOFF(40,EBP) -#define y1 REGOFF(44,EBP) -#define e REGOFF(48,EBP) -#define e1 REGOFF(52,EBP) -#define e2 REGOFF(56,EBP) -#define len REGOFF(60,EBP) -#define GXcopy CONST(3) -#define Y_AXIS CONST(1) - - SEG_DATA -copyright: - STRING("Copyright 1992, 7/8/1993 by Glenn G. Lai" ) - - ALIGNDATA4 -speedUpBound1: - D_LONG 0 -speedUpBound2: - D_LONG 0 -jump: - D_LONG 0 -e3: - D_LONG 0 -allowance: - D_LONG 0 -tmp: - D_LONG 0 -tmp1: - D_LONG 0 -carefulJump: - D_LONG 0 -divisor: - D_LONG 0 -segment: - D_BYTE 0 -/****************************/ - SEG_TEXT - ALIGNTEXT4 - GLOBL GLNAME(SpeedUpBresS) -GLNAME(SpeedUpBresS): - CMP_L (CONST(0), REGOFF(56,ESP)) - JZ (return) - - PUSH_L (EBP) - MOV_L (ESP, EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) - - MOV_L (e2, EAX) - SUB_L (e1, EAX) - MOV_L (EAX, CONTENT(e3)) - - MOV_L (nlwidth, EAX) - SHL_L (CONST(2), EAX) - MOV_L (EAX, nlwidth) - MOV_L (EAX, CONTENT(divisor)) - - IMUL_L (y1, EAX) - ADD_L (addrl, EAX) - ADD_L (x1, EAX) - MOV_L (EAX, EDI) - - MOV_L (nlwidth, EAX) - MOV_L (EAX, EBX) - - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EAX) - MOV_L (EAX, CONTENT(speedUpBound2)) - - NEG_L (EBX) - MOV_L (EBX, EAX) - ADD_L (CONTENT(GLNAME(vgaWriteTop)), EBX) - INC_L (EBX) - MOV_L (EBX, CONTENT(speedUpBound1)) - - CMP_L (CONST(0), signdy) - JGE (goingDown) - - MOV_L (EAX, nlwidth) -goingDown: - MOV_L (e, EAX) - SUB_L (e1, EAX) - MOV_L (EAX, e) - - SUB_L (VGABASE, EDI) - JC (pixmap) -/****************************/ -window: - MOV_L (EDI, EAX) - SHR_L (CONST(16), EAX) - MOV_B (AL, AH) - SHL_B (CONST(4), AH) - OR_B (AH, AL) - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - - AND_L (CONST(0xffff), EDI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - - MOV_L (e, EBX) - MOV_L (ADDR(downLoop2), CONTENT(carefulJump)) - - CMP_L (CONST(1), signdy) - JE (downLoop0) - - MOV_L (ADDR(upLoop2), CONTENT(carefulJump)) - JMP (upLoop0) -/****************************/ - ALIGNTEXT4 -upLoop: - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JNC (upLoop0) - - MOV_L (ADDR(upLoop0), CONTENT(jump)) - JMP (prev) - ALIGNTEXT4 -upLoop0: - CMP_L (CONTENT(speedUpBound1), EDI) - JNC (careful) -upLoop2: - MOV_L (EDI, EAX) - INC_L (EAX) - SUB_L (CONTENT(GLNAME(vgaWriteBottom)), EAX) - XOR_L (EDX, EDX) - DIV_L (CONTENT(divisor)) - - CMP_L (EDX, EAX) - JNC (upLoop3) - INC_L (EAX) -upLoop3: - MOV_L (len, ECX) - CMP_L (ECX, EAX) - JC (upLoop1) - - MOV_L (ECX, EAX) -upLoop1: - SUB_L (EAX, ECX) - MOV_L (ECX, len) - - CALL (line) - - CMP_L (CONST(0), len) - JNZ (upLoop) -done: - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE -return: - RET -/****************************/ - ALIGNTEXT4 -downLoop: - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JC (downLoop0) - - MOV_L (ADDR(downLoop0), CONTENT(jump)) - JMP (next) - ALIGNTEXT4 -downLoop0: - CMP_L (CONTENT(speedUpBound2), EDI) - JC (careful) -downLoop2: - MOV_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - SUB_L (EDI, EAX) - XOR_L (EDX, EDX) - DIV_L (CONTENT(divisor)) - - CMP_L (EDX, EAX) - JNC (downLoop3) - INC_L (EAX) -downLoop3: - MOV_L (len, ECX) - CMP_L (ECX, EAX) - JC (downLoop1) - - MOV_L (ECX, EAX) -downLoop1: - SUB_L (EAX, ECX) - MOV_L (ECX, len) - - CALL (line) - - CMP_L (CONST(0), len) - JNZ (downLoop) - - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE - RET -/****************************/ - ALIGNTEXT4 -line: - MOV_L (e1, ECX) - MOV_L (nlwidth, ESI) - - CMP_L (GXcopy, rop) - JNE (wMix) -/****************************/ - MOV_L (EAX, EDX) - MOV_L (XOR, EAX) - CMP_L (Y_AXIS, axis) - JE (setY) -/****************************/ -setX: - CMP_L (CONST(1), signdx) - JNE (setXLeft) - JMP (setXRight) -/****************************/ - ALIGNTEXT4 -setXRight: - MOV_B (AL, REGIND(EDI)) - ADD_L (ECX, EBX) - JL (setXRight1) - - ADD_L (ESI, EDI) - ADD_L (CONTENT(e3), EBX) -setXRight1: - INC_L (EDI) - DEC_L (EDX) - JNZ (setXRight) - RET -/****************************/ - ALIGNTEXT4 -setXLeft: - MOV_B (AL, REGIND(EDI)) - ADD_L (ECX, EBX) - JL (setXLeft1) - - ADD_L (ESI, EDI) - ADD_L (CONTENT(e3), EBX) -setXLeft1: - DEC_L (EDI) - DEC_L (EDX) - JNZ (setXLeft) - RET -/****************************/ - ALIGNTEXT4 -setY: - CMP_L (CONST(1), signdx) - JNE (setYLeft) - JMP (setYRight) -/****************************/ - ALIGNTEXT4 -setYRight: - MOV_B (AL, REGIND(EDI)) - ADD_L (ECX, EBX) - JL (setYRight1) - - INC_L (EDI) - ADD_L (CONTENT(e3), EBX) -setYRight1: - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (setYRight) - RET -/****************************/ - ALIGNTEXT4 -setYLeft: - MOV_B (AL, REGIND(EDI)) - ADD_L (ECX, EBX) - JL (setYLeft1) - - DEC_L (EDI) - ADD_L (CONTENT(e3), EBX) -setYLeft1: - ADD_L (ESI, EDI) - DEC_L (EDX) - JNZ (setYLeft) - RET -/****************************/ - ALIGNTEXT4 -wMix: - MOV_L (EAX, CONTENT(allowance)) - MOV_L (XOR, EAX) - MOV_L (AND, EDX) - MOV_B (AL, DL) - - CMP_L (Y_AXIS, axis) - JE (mixY) -/****************************/ -mixX: - CMP_L (CONST(1), signdx) - JNE (mixXLeft) - JMP (mixXRight) -/****************************/ - ALIGNTEXT4 -mixXRight: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - - ADD_L (ECX, EBX) - JL (mixXRight1) - - ADD_L (ESI, EDI) - ADD_L (CONTENT(e3), EBX) -mixXRight1: - INC_L (EDI) - DEC_L (CONTENT(allowance)) - JNZ (mixXRight) - RET -/****************************/ - ALIGNTEXT4 -mixXLeft: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - - ADD_L (ECX, EBX) - JL (mixXLeft1) - - ADD_L (ESI, EDI) - ADD_L (CONTENT(e3), EBX) -mixXLeft1: - DEC_L (EDI) - DEC_L (CONTENT(allowance)) - JNZ (mixXLeft) - RET -/****************************/ - ALIGNTEXT4 -mixY: - CMP_L (CONST(1), signdx) - JNE (mixYLeft) - JMP (mixYRight) -/****************************/ - ALIGNTEXT4 -mixYRight: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - - ADD_L (ECX, EBX) - JL (mixYRight1) - - INC_L (EDI) - ADD_L (CONTENT(e3), EBX) -mixYRight1: - ADD_L (ESI, EDI) - DEC_L (CONTENT(allowance)) - JNZ (mixYRight) - RET -/****************************/ - ALIGNTEXT4 -mixYLeft: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - - ADD_L (ECX, EBX) - JL (mixYLeft1) - - DEC_L (EDI) - ADD_L (CONTENT(e3), EBX) -mixYLeft1: - ADD_L (ESI, EDI) - DEC_L (CONTENT(allowance)) - JNZ (mixYLeft) - RET -/****************************/ - ALIGNTEXT4 -careful: - MOV_L (XOR, EAX) - MOV_L (e1, ECX) - MOV_L (CONST(0), CONTENT(tmp)) - - CMP_L (Y_AXIS, axis) - JE (carefulY) -/****************************/ -carefulX: - MOV_L (signdx, ESI) - - CMP_L (GXcopy, rop) - JNE (cXMix0) - - MOV_L (len, EDX) - MOV_L (ADDR(cXSet2), CONTENT(jump)) - JMP (cXSet) -/****************************/ - ALIGNTEXT4 -cXSet: - MOV_B (AL, REGIND(EDI)) - ADD_L (ECX, EBX) - JL (cXSet1) - - MOV_L (CONST(1), CONTENT(tmp)) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -cXSet1: - ADD_L (ESI, EDI) - - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JNC (next) - - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JC (prev) -cXSet2: - DEC_L (EDX) - JZ (done) - - CMP_L (CONST(1), CONTENT(tmp)) - JNE (cXSet) - - MOV_L (EDX, len) - JMP (VARINDIRECT(carefulJump)) -/****************************/ - ALIGNTEXT4 -cXMix0: - MOV_L (AND, EDX) - MOV_B (AL, DL) - MOV_L (ADDR(cXMix2), CONTENT(jump)) -cXMix: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - - ADD_L (ECX, EBX) - JL (cXMix1) - - MOV_L (CONST(1), CONTENT(tmp)) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -cXMix1: - ADD_L (ESI, EDI) - - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JNC (next) - - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JC (prev) -cXMix2: - DEC_L (len) - JZ (done) - - CMP_L (CONST(1), CONTENT(tmp)) - JNE (cXMix) - - JMP (VARINDIRECT(carefulJump)) -/****************************/ - ALIGNTEXT4 -carefulY: - MOV_L (nlwidth, ESI) - - CMP_L (GXcopy, rop) - JNE (cYMix0) - - MOV_L (len, EDX) - MOV_L (ADDR(cYSet2), CONTENT(jump)) - JMP (cYSet) -/****************************/ - ALIGNTEXT4 -cYSet: - MOV_B (AL, REGIND(EDI)) - ADD_L (ECX, EBX) - JL (cYSet1) - - ADD_L (signdx, EDI) - ADD_L (CONTENT(e3), EBX) -cYSet1: - ADD_L (ESI, EDI) - - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JNC (next) - - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JC (prev) -cYSet2: - DEC_L (EDX) - JZ (done) - - MOV_L (EDX, len) - JMP (VARINDIRECT(carefulJump)) -/****************************/ - ALIGNTEXT4 -cYMix0: - MOV_L (AND, EDX) - MOV_B (AL, DL) - MOV_L (ADDR(cYMix2), CONTENT(jump)) -cYMix: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - - ADD_L (ECX, EBX) - JL (cYMix1) - - ADD_L (signdx, EDI) - ADD_L (CONTENT(e3), EBX) -cYMix1: - ADD_L (ESI, EDI) - - CMP_L (CONTENT(GLNAME(vgaWriteTop)), EDI) - JNC (next) - - CMP_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - JC (prev) -cYMix2: - DEC_L (len) - JZ (done) - - JMP (VARINDIRECT(carefulJump)) -/****************************/ - ALIGNTEXT4 -next: - MOV_L (EDX, CONTENT(tmp1)) - SUB_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - ADD_B (CONST(17), AL) - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - MOV_L (XOR, EAX) - MOV_L (CONTENT(tmp1), EDX) - JMP (VARINDIRECT(jump)) -/****************************/ - ALIGNTEXT4 -prev: - MOV_L (EDX, CONTENT(tmp1)) - ADD_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - SUB_B (CONST(17), AL) - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - MOV_L (XOR, EAX) - MOV_L (CONTENT(tmp1), EDX) - JMP (VARINDIRECT(jump)) -/****************************/ - ALIGNTEXT4 -pixmap: - CMP_L (Y_AXIS, axis) - JNE (pixmap1) - - MOV_L (nlwidth, EAX) - MOV_L (signdx, EBX) - MOV_L (EBX, nlwidth) - MOV_L (EAX, signdx) -pixmap1: - ADD_L (VGABASE, EDI) - MOV_L (len, ECX) - CMP_L (GXcopy, rop) - JNE (mmLine2) -mmLine1: - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - MOV_L (REGDIS(fsTable,EAX,4), EAX) - MOV_L (EAX, CONTENT(jump) ) - MOV_L (XOR, EAX) - MOV_L (e, EBX) - MOV_L (e1, EDX) - MOV_L (signdx, ESI) - SHR_L (CONST(2), ECX) - JZ (fs1) -fs6: - MOV_B (AL, REGIND(EDI)) - ADD_L (EDX, EBX) - JL (fs2) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fs2: - ADD_L (ESI, EDI) - MOV_B (AL, REGIND(EDI)) - ADD_L (EDX, EBX) - JL (fs3) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fs3: - ADD_L (ESI, EDI) - MOV_B (AL, REGIND(EDI)) - ADD_L (EDX, EBX) - JL (fs4) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fs4: - ADD_L (ESI, EDI) - MOV_B (AL, REGIND(EDI)) - ADD_L (EDX, EBX) - JL (fs5) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fs5: - ADD_L (ESI, EDI) - DEC_L (ECX) - JNZ (fs6) -fs1: - JMP (VARINDIRECT(jump)) - SEG_DATA - ALIGNDATA4 -fsTable: - D_LONG done, fs8, fs9, fs10 - SEG_TEXT - ALIGNTEXT4 -fs10: - MOV_B (AL, REGIND(EDI)) - ADD_L (EDX, EBX) - JL (fs11) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fs11: - ADD_L (ESI, EDI) -fs9: - MOV_B (AL, REGIND(EDI)) - ADD_L (EDX, EBX) - JL (fs12) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fs12: - ADD_L (ESI, EDI) -fs8: - MOV_B (AL, REGIND(EDI)) - JMP (done) -/****************************/ - ALIGNTEXT4 -mmLine2: - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - MOV_L (REGDIS(fmTable,EAX,4), EAX) - MOV_L (EAX, CONTENT(jump)) - MOV_L (XOR, EAX) - MOV_L (AND, EDX) - MOV_B (AL, DL) - MOV_L (e, EBX) - MOV_L (signdx, ESI) - SHR_L (CONST(2), ECX) - JZ (fm1) -fm6: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - ADD_L (e1, EBX) - JL (fm2) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fm2: - ADD_L (ESI, EDI) - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - ADD_L (e1, EBX) - JL (fm3) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fm3: - ADD_L (ESI, EDI) - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - ADD_L (e1, EBX) - JL (fm4) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fm4: - ADD_L (ESI, EDI) - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - ADD_L (e1, EBX) - JL (fm5) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fm5: - ADD_L (ESI, EDI) - DEC_L (ECX) - JNZ (fm6) -fm1: - JMP (VARINDIRECT(jump)) - SEG_DATA - ALIGNDATA4 -fmTable: - D_LONG done, fm8, fm9, fm10 - SEG_TEXT - ALIGNTEXT4 -fm10: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - ADD_L (e1, EBX) - JL (fm11) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fm11: - ADD_L (ESI, EDI) -fm9: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - ADD_L (e1, EBX) - JL (fm12) - ADD_L (nlwidth, EDI) - ADD_L (CONTENT(e3), EBX) -fm12: - ADD_L (ESI, EDI) -fm8: - MOV_B (REGIND(EDI), AL) - AND_B (DH, AL) - XOR_B (DL, AL) - MOV_B (AL, REGIND(EDI)) - JMP (done) - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suVHLine.s diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suVHLine.s:1.3 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suVHLine.s:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suVHLine.s:1.3 Sun Dec 26 19:39:51 1999 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suVHLine.s Fri Jan 18 15:26:25 2002 @@ -1,429 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/suVHLine.s,v 1.3 1999/12/27 00:39:51 robin Exp $ */ -/******************************************************************************* - Copyright 1992, 1993 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -(glenn@cs.utexas.edu) -8/21/92 -7/10/93 -*******************************************************************************/ -/* $XConsortium: suVHLine.s /main/5 1996/02/21 18:09:22 kaleb $ */ - -#include "assyntax.h" - - FILE("suVHLine.s") - AS_BEGIN - -#include "vgaAsm.h" - -/* - void SpeedUpHLine(dst, fill, len, screen); - void SpeedUpVLine(dst, fill, len, screen); -*/ - -#define dst REGOFF(8,EBP) -#define fill REGOFF(12,EBP) -#define len REGOFF(16,EBP) -#define screen REGOFF(20,EBP) -/****************************************/ - SEG_DATA -copyright: - STRING("Copyright 1992, 7/10/1993 by Glenn G. Lai") - ALIGNDATA4 -speedUpTop: - D_LONG 0 -lMaskTable: - D_WORD 0x0f02 - D_WORD 0x0802 - D_WORD 0x0c02 - D_WORD 0x0e02 -rMaskTable: - D_WORD 0x0f02 - D_WORD 0x0102 - D_WORD 0x0302 - D_WORD 0x0702 -segment: - D_BYTE 0 -/****************************************/ - SEG_TEXT - ALIGNTEXT4 - GLOBL GLNAME(SpeedUpVLine) - GLOBL GLNAME(SpeedUpVLine1) -GLNAME(SpeedUpVLine): - MOV_L (REGOFF(12,ESP), ECX) - OR_L (ECX, ECX) - JZ (return) -GLNAME(SpeedUpVLine1): - MOV_L (REGOFF(4,ESP), EAX) - CMP_L (VGABASE, EAX) - JC (pixmapV) -windowV: - CMP_L (CONST(1), ECX) - JNE (moreThanOnePoint) - MOV_L (EAX, ECX) - SHR_L (CONST(16), EAX) - MOV_L (CONST(0x3cd), EDX) - OUT_B - AND_L (CONST(0xffff), ECX) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), ECX) - MOV_L (REGOFF(8,ESP), EAX) - MOV_B (AL, REGIND(ECX)) - RET -/****************************************/ - ALIGNTEXT4 -moreThanOnePoint: - PUSH_L (EBP) - MOV_L (ESP, EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - - MOV_L (screen, ESI) - MOV_L (ESI, EBX) - DEC_L (EBX) - ADD_L (CONTENT(GLNAME(vgaWriteTop)), EBX) - MOV_L (EBX, CONTENT(speedUpTop)) - - MOV_L (EAX, EDI) - SHR_L (CONST(16), EAX) - MOV_B (AL, CONTENT(segment)) - - AND_L (CONST(0xffff), EDI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - - MOV_L (fill, EBX) - MOV_L (len, ECX) -wVLoop: - MOV_L (CONST(0x3cd), EDX) - OUT_B - - XOR_L (EDX, EDX) - MOV_L (CONTENT(speedUpTop), EAX) - SUB_L (EDI, EAX) - DIV_L (ESI) - - CMP_L (ECX, EAX) - JC (wVLoop1) - MOV_L (ECX, EAX) -wVLoop1: - SUB_L (EAX, ECX) -wvLoop2: - MOV_B (BL, REGIND(EDI)) - ADD_L (ESI, EDI) - DEC_L (EAX) - JNZ (wvLoop2) - - OR_L (ECX, ECX) - JZ (npDone) - - SUB_L (CONST(0x10000), EDI) - MOV_B (CONTENT(segment), AL) - INC_B (AL) - MOV_B (AL, CONTENT(segment)) - JMP (wVLoop) -/*****************************************/ - ALIGNTEXT4 -pixmapV: - PUSH_L (EDI) - PUSH_L (ESI) - MOV_L (REGOFF(16,ESP), EDX) - MOV_L (REGOFF(24,ESP), ESI) - MOV_L (ECX, EDI) - AND_L (CONST(3), EDI) - MOV_L (REGDIS(pixmapVTable,EDI,4), EDI) - SHR_L (CONST(2), ECX) - JZ (pixmapV4) -pixmapV5: - MOV_B (DL, REGIND(EAX)) - ADD_L (ESI, EAX) - MOV_B (DL, REGIND(EAX)) - ADD_L (ESI, EAX) - MOV_B (DL, REGIND(EAX)) - ADD_L (ESI, EAX) - MOV_B (DL, REGIND(EAX)) - ADD_L (ESI, EAX) - DEC_L (ECX) - JNZ (pixmapV5) -pixmapV4: - JMP (CODEPTR(EDI)) -/*******************/ - SEG_DATA - ALIGNDATA4 -pixmapVTable: - D_LONG pixmapV0, pixmapV1, pixmapV2, pixmapV3 -/*******************/ - SEG_TEXT - ALIGNTEXT4 -pixmapV3: - MOV_B (DL, REGIND(EAX)) - ADD_L (ESI, EAX) -pixmapV2: - MOV_B (DL, REGIND(EAX)) - ADD_L (ESI, EAX) -pixmapV1: - MOV_B (DL, REGIND(EAX)) -pixmapV0: - POP_L (ESI) - POP_L (EDI) - RET -/*****************************************/ - GLOBL GLNAME(SpeedUpHLine) - GLOBL GLNAME(SpeedUpHLine1) - ALIGNTEXT4 -GLNAME(SpeedUpHLine): - MOV_L (REGOFF(12,ESP), ECX) - OR_L (ECX, ECX) - JZ (return) -GLNAME(SpeedUpHLine1): - MOV_L (REGOFF(4,ESP), EAX) - SUB_L (VGABASE, EAX) - JC (pixmapH) -windowH: - CMP_L (CONST(1), ECX) - JNE (windowH1) - MOV_L (EAX, ECX) - SHR_L (CONST(16), EAX) - MOV_W (CONST(0x3cd), DX) - OUT_B - AND_L (CONST(0xffff), ECX) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), ECX) - MOV_L (REGOFF(8,ESP), EAX) - MOV_B (AL, REGIND(ECX)) - RET -/****************/ - ALIGNTEXT4 -windowH1: -/* Change THRESHOLD at YOUR OWN RISK!!! */ -#define THRESHOLD CONST(80) - CMP_L (THRESHOLD, ECX) - JNC (pMode) -windowH8: - PUSH_L (EDI) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endi - MOV_L (EAX, EDI) - SHR_L (CONST(16), EAX) - MOV_B (AL, CONTENT(segment)) - MOV_W (CONST(0x3cd), DX) - OUT_B - - AND_L (CONST(0xffff), EDI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - MOV_L (CONTENT(GLNAME(vgaWriteTop)), EAX) - SUB_L (EDI, EAX) - - XOR_L (EDX, EDX) - CMP_L (ECX, EAX) - JNC (windowH7) - - MOV_L (ECX, EDX) - MOV_L (EAX, ECX) - SUB_L (EAX, EDX) -windowH7: - MOV_L (REGOFF(12,ESP), EAX) - TEST_L (CONST(1), EDI) - JZ (windowH2) - STOS_B - DEC_L (ECX) - JZ (windowH5) -windowH2: - SHR_L (CONST(1), ECX) - JZ (windowH3) - REP - STOS_W - JNC (windowH4) -windowH3: - STOS_B -windowH4: - OR_L (EDX, EDX) - JNZ (windowH5) - POP_L (EDI) - RET - ALIGNTEXT4 -windowH5: - MOV_L (EDX, ECX) - MOV_B (CONTENT(segment), AL) - INC_B (AL) - MOV_L (CONST(0x3cd), EDX) - OUT_B - MOV_L (REGOFF(12,ESP), EAX) - SUB_L (CONST(0x10000), EDI) - SHR_L (CONST(1), ECX) - JZ (windowH6) - REP - STOS_W - JNC (windowH9) -windowH6: - STOS_B -windowH9: - POP_L (EDI) - RET -/****************************/ - ALIGNTEXT4 -pixmapH: - ADD_L (VGABASE, EAX) - CMP_L (CONST(7), ECX) - JC (pixmapH0) - - PUSH_L (EDI) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif - MOV_L (EAX, EDI) - MOV_L (REGOFF(12,ESP), EAX) - - TEST_L (CONST(1), EDI) - JZ (pixmapH1) - STOS_B - DEC_L (ECX) -pixmapH1: - TEST_L (CONST(2), EDI) - JZ (pixmapH2) - STOS_W - SUB_L (CONST(2), ECX) -pixmapH2: - MOV_L (ECX, EDX) - SHR_L (CONST(2), ECX) - REP - STOS_L - TEST_L (CONST(2), EDX) - JZ (pixmapH4) - STOS_W -pixmapH4: - TEST_L (CONST(1), EDX) - JZ (pixmapH5) - MOV_B (AL, REGIND(EDI)) -pixmapH5: - POP_L (EDI) - RET -/****************/ - ALIGNTEXT4 -pixmapH0: - MOV_L (REGOFF(8,ESP), EDX) -pixmapH01: - MOV_B (DL, REGIND(EAX)) - INC_L (EAX) - DEC_L (ECX) - JNZ (pixmapH01) - RET -/****************************/ - ALIGNTEXT4 -pMode: - MOV_L (EAX, EDX) - AND_L (CONST(0x3ffff), EDX) - SUB_L (CONST(0x40000), EDX) - NEG_L (EDX) - CMP_L (ECX, EDX) - JC (windowH8) - - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (EDI) - PUSH_L (ESI) - PUSH_L (EBX) -#ifdef QNX4 - PUSH_SR (DS) - POP_SR (ES) -#endif -/***************************/ - MOV_W (CONST(0x3c4), DX) - MOV_W (CONST(0x0604), AX ) - OUT_W - MOV_W (CONST(0x3ce), DX) - MOV_W (CONST(0x0001), AX) - OUT_W - MOV_W (CONST(0x0003), AX) - OUT_W - MOV_W (CONST(0x4005), AX) - OUT_W - MOV_W (CONST(0xff08), AX) - OUT_W -/***************************/ - MOV_L (fill, EBX) - MOV_L (dst, EDI) - MOV_L (EDI, EAX) - SHR_L (CONST(18), EAX) - DEC_W (DX) - OUT_B - MOV_W (CONST(0x3c4), DX) - - AND_L (CONST(0x3ffff), EDI) - MOV_L (EDI, EAX) - SHR_L (CONST(2), EDI) - ADD_L (CONTENT(GLNAME(vgaWriteBottom)), EDI) - - MOV_L (EAX, ESI) - ADD_L (CONST(3), ESI) - AND_L (CONST(0xfffffffc), ESI) - SUB_L (EAX, ESI) - JZ (pMode1) - - MOV_W (REGDIS(lMaskTable,ESI,2), AX) - OUT_W - SUB_L (ESI, ECX) - MOV_B (BL, REGIND(EDI)) - INC_L (EDI) -pMode1: - MOV_W (CONST(0x0f02), AX) - OUT_W - - MOV_L (EBX, EAX) - MOV_L (ECX, ESI) - AND_L (CONST(3), ESI) - SHR_L (CONST(2), ECX) - - TEST_L (CONST(1), EDI) - JZ (pMode2) - STOS_B - DEC_L (ECX) -pMode2: - SHR_L (CONST(1), ECX) - REP - STOS_W - JNC (pMode3) - STOS_B -pMode3: - SHL_L (CONST(1), ESI) - JZ (pMode4) - MOV_W (rMaskTable(ESI), AX) - OUT_W - MOV_B (BL, REGIND(EDI)) - MOV_W (CONST(0x0f02), AX) - OUT_W -pMode4: - MOV_W (CONST(0x0c04), AX) - OUT_W -npDone: - POP_L (EBX) - POP_L (ESI) - POP_L (EDI) - LEAVE -return: - RET Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBitBlt.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBitBlt.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBitBlt.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBitBlt.c:1.2 Sat Jul 25 12:58:32 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBitBlt.c Fri Jan 18 15:26:25 2002 @@ -1,541 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBitBlt.c,v 1.2 1998/07/25 16:58:32 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. - * - * Author: Thomas Roell, roell@informatik.tu-muenchen.de - * - */ -/* $XConsortium: vgaBitBlt.c /main/4 1996/02/21 18:09:26 kaleb $ */ - -#include "vgafb.h" -#include "fastblt.h" -#include "mergerop.h" - - -void (*ourvgaBitBlt)(); - -void -vgaBitBlt(pdstBase, psrcBase, widthSrc, widthDst, x, y, - x1, y1, w, h, xdir, ydir, alu, planemask) - unsigned char *psrcBase, *pdstBase; /* start of src and dst bitmaps */ - int widthSrc, widthDst; - int x, y, x1, y1, w, h; - int xdir, ydir; - int alu; - unsigned long planemask; - -{ - unsigned char *psrc, *pdst; - int hcount, vcount, count, srcPitch, dstPitch, tmp; - - if (alu == GXcopy && (planemask & 0xFF) == 0xFF) { - if (xdir == 1) { /* left to right */ - if (ydir == 1) /* top to bottom */ - { - psrc = psrcBase+(y*widthSrc)+x; - pdst = pdstBase+(y1*widthDst)+x1; - } - else /* bottom to top */ - { - psrc = psrcBase-((y+h-1)*widthSrc)+x; - pdst = pdstBase-((y1+h-1)*widthDst)+x1; - } - srcPitch = widthSrc - w; - dstPitch = widthDst - w; - - } else {/* right to left */ - - if (ydir == 1) /* top to bottom */ - { - psrc = psrcBase+(y*widthSrc)+x+w; - pdst = pdstBase+(y1 * widthDst)+x1+w; - } - else /* bottom to top */ - { - psrc = psrcBase-((y+h-1)*widthSrc)+x+w; - pdst = pdstBase-((y1+h-1)*widthDst)+x1+w; - } - srcPitch = widthSrc + w; - dstPitch = widthDst + w; - } - - psrc = (unsigned char *)vgaSetRead(psrc); - pdst = (unsigned char *)vgaSetWrite(pdst); - - vcount = 0; - while (h || vcount) { - /* - * compute here the maximal linecount(hcount) before a - * segment switch has to be made - */ - if (!vcount) { - if (ydir == 1) { - tmp = ((unsigned char *)vgaReadTop - psrc) / widthSrc; - if ((xdir == -1) && - ((psrc - (unsigned char *)vgaReadBottom) <= w)) tmp = 0; - } else { - tmp = (psrc - (unsigned char *)vgaReadBottom) / (-widthSrc); - if ((xdir == 1) && - (((unsigned char *)vgaReadTop - psrc) <= w)) tmp = 0; - } - hcount=min( h, tmp ); - if(!hcount) vcount = w; - - if (ydir == 1) { - tmp = ((unsigned char *)vgaWriteTop - pdst) / widthDst; - if ((xdir == -1) && - ((pdst - (unsigned char *)vgaWriteBottom) <= w)) tmp = 0; - } else { - tmp = (pdst - (unsigned char *)vgaWriteBottom) / (-widthDst); - if ((xdir == 1) && - (((unsigned char *)vgaWriteTop - pdst) <= w)) tmp = 0; - } - hcount=min( hcount, tmp ); - if(!hcount) vcount = w; - } - - /* - * if we now have to make a segment switch within a line, - * divide this line into small parts. - */ - if (vcount) { - count = vcount; - - /* check which segment to switch first */ - if (xdir == 1) { - if (tmp = (unsigned char *)vgaReadTop - psrc) - count = min(count, tmp); - else - psrc = (unsigned char *)vgaReadNext(psrc); - } else { - if (tmp = psrc - (unsigned char *)vgaReadBottom) - count = min(count, tmp); - else - psrc = (unsigned char *)vgaReadPrev(psrc); - } - - if (xdir == 1) { - if (tmp = (unsigned char *)vgaWriteTop - pdst) - count = min(count, tmp); - else - pdst = (unsigned char *)vgaWriteNext(pdst); - } else { - if (tmp = pdst - (unsigned char *)vgaWriteBottom) - count = min(count, tmp); - else - pdst = (unsigned char *)vgaWritePrev(pdst); - } - - fastBitBltCopy(xdir,psrc, pdst, 1, count, 0, 0); - - if (!(vcount -= count)) { - h--; /* partial line finish */ - if (xdir == 1) { - psrc += (srcPitch + count); - pdst += (dstPitch + count); - } else { - psrc += (srcPitch - count); - pdst += (dstPitch - count); - } - - if ( psrc >= (unsigned char *)vgaReadTop ) - psrc = (unsigned char *)vgaReadNext(psrc); - if ( psrc < (unsigned char *)vgaReadBottom ) - psrc = (unsigned char *)vgaReadPrev(psrc); - - if ( pdst >= (unsigned char *)vgaWriteTop ) - pdst = (unsigned char *)vgaWriteNext(pdst); - if ( pdst < (unsigned char *)vgaWriteBottom ) - pdst = (unsigned char *)vgaWritePrev(pdst); - - } else { - if (xdir == 1) { - psrc += count; - pdst += count; - } else { - psrc -= count; - pdst -= count; - } - } - } else { - - h -= hcount; - - fastBitBltCopy(xdir, psrc, pdst, hcount, w, srcPitch, dstPitch); - - psrc += (hcount*widthSrc); - pdst += (hcount*widthDst); - } - } - } -} - -void -OneBankvgaBitBlt(pdstBase, psrcBase, widthSrc, widthDst, x, y, - x1, y1, w, h, xdir, ydir, alu, planemask) - unsigned char *psrcBase, *pdstBase; /* start of src and dst bitmaps */ - int widthSrc, widthDst; - int x, y, x1, y1, w, h; - int xdir, ydir; - int alu; - unsigned long planemask; - -{ -#define BUFSIZE 4096 - - unsigned char buf[BUFSIZE]; - int m,n,ww; - - if (alu == GXcopy && (planemask & 0xFF) == 0xFF) { - if (w == 0) - return; - if (widthSrc != widthDst) - return; - ww = widthSrc >= 0 ? widthSrc : -widthSrc; - m = BUFSIZE/ww; - if (ydir == 1) { - while (h) { - n = m>h ? h : m; - (void)vgaImageRead(buf, psrcBase, widthSrc,ww,x,y,0,0,w,n,xdir,ydir,alu,planemask); - (void)vgaImageWrite(pdstBase, buf,ww,widthDst,0,0,x1,y1,w,n,xdir,ydir,alu,planemask); - y += n; - y1 += n; - h -= n; - } - } - else { - y += h; - y1 += h; - while (h) { - n = m>h ? h : m; - y -= n; - y1 -= n; - h -= n; - (void)vgaImageRead(buf+BUFSIZE-ww,psrcBase,widthSrc,ww,x,y,0,0,w,n,xdir,ydir,alu,planemask); - (void)vgaImageWrite(pdstBase,buf+BUFSIZE-ww,ww,widthDst,0,0,x1,y1,w,n,xdir,ydir,alu,planemask); - } - } - } -} - -void -vgaImageRead(pdstBase, psrcBase, widthSrc, widthDst, x, y, - x1, y1, w, h, xdir, ydir, alu, planemask) - unsigned char *psrcBase, *pdstBase; /* start of src and dst bitmaps */ - int widthSrc, widthDst; - int x, y, x1, y1, w, h; - int xdir, ydir; - int alu; - unsigned long planemask; - -{ - register unsigned char *psrc, *pdst; - int hcount, vcount, count, srcPitch, dstPitch, tmp; - - if (alu == GXcopy && (planemask & 0xFF) == 0xFF) { - if (xdir == 1) { /* left to right */ - if (ydir == 1) /* top to bottom */ - { - psrc = psrcBase+(y*widthSrc)+x; - pdst = pdstBase+(y1*widthDst)+x1; - } - else /* bottom to top */ - { - psrc = psrcBase-((y+h-1)*widthSrc)+x; - pdst = pdstBase-((y1+h-1)*widthDst)+x1; - } - srcPitch = widthSrc - w; - dstPitch = widthDst - w; - - } else {/* right to left */ - - if (ydir == 1) /* top to bottom */ - { - psrc = psrcBase+(y*widthSrc)+x+w; - pdst = pdstBase+(y1 * widthDst)+x1+w; - } - else /* bottom to top */ - { - psrc = psrcBase-((y+h-1)*widthSrc)+x+w; - pdst = pdstBase-((y1+h-1)*widthDst)+x1+w; - } - srcPitch = widthSrc + w; - dstPitch = widthDst + w; - } - - psrc = (unsigned char *)vgaSetRead(psrc); - - vcount = 0; - while (h || vcount) { - /* - * compute here the maximal linecount(hcount) before a - * segment switch has to be made - */ - if (!vcount) { - if (ydir == 1) { - tmp = ((unsigned char *)vgaReadTop - psrc) / widthSrc; - if ((xdir == -1) && - ((psrc - (unsigned char *)vgaReadBottom) <= w)) tmp = 0; - } else { - tmp = (psrc - (unsigned char *)vgaReadBottom) / (-widthSrc); - if ((xdir == 1) && - (((unsigned char *)vgaReadTop - psrc) <= w)) tmp = 0; - } - hcount=min( h, tmp ); - if(!hcount) vcount = w; - } - - /* - * if we now have to make a segment switch within a line, - * divide this line into small parts. - */ - if (vcount) { - count = vcount; - - /* check which segment to switch first */ - if (xdir == 1) { - if (tmp = (unsigned char *)vgaReadTop - psrc) - count = min(count, tmp); - else - psrc = (unsigned char *)vgaReadNext(psrc); - } else { - if (tmp = psrc - (unsigned char *)vgaReadBottom) - count = min(count, tmp); - else - psrc = (unsigned char *)vgaReadPrev(psrc); - } - - fastBitBltCopy(xdir,psrc, pdst, 1, count, 0, 0); - - if (!(vcount -= count)) { - h--; /* partial line finish */ - if (xdir == 1) { - psrc += (srcPitch + count); - pdst += (dstPitch + count); - } else { - psrc += (srcPitch - count); - pdst += (dstPitch - count); - } - - if ( psrc >= (unsigned char *)vgaReadTop ) - psrc = (unsigned char *)vgaReadNext(psrc); - if ( psrc < (unsigned char *)vgaReadBottom ) - psrc = (unsigned char *)vgaReadPrev(psrc); - - } else { - if (xdir == 1) { - psrc += count; - pdst += count; - } else { - psrc -= count; - pdst -= count; - } - } - } else { - - h -= hcount; - - fastBitBltCopy(xdir, psrc, pdst, hcount, w, srcPitch, dstPitch); - - psrc += (hcount*widthSrc); - pdst += (hcount*widthDst); - } - } - } -} - - -void -vgaImageWrite(pdstBase, psrcBase, widthSrc, widthDst, x, y, - x1, y1, w, h, xdir, ydir, alu, planemask) - unsigned char *psrcBase, *pdstBase; /* start of src and dst bitmaps */ - int widthSrc, widthDst; - int x, y, x1, y1, w, h; - int xdir, ydir; - int alu; - unsigned long planemask; - -{ - register unsigned char *psrc, *pdst; - int hcount, vcount, count, srcPitch, dstPitch, tmp; - - if (alu == GXcopy && (planemask & 0xFF) == 0xFF) { - if (xdir == 1) { /* left to right */ - if (ydir == 1) /* top to bottom */ - { - psrc = psrcBase+(y*widthSrc)+x; - pdst = pdstBase+(y1*widthDst)+x1; - } - else /* bottom to top */ - { - psrc = psrcBase-((y+h-1)*widthSrc)+x; - pdst = pdstBase-((y1+h-1)*widthDst)+x1; - } - srcPitch = widthSrc - w; - dstPitch = widthDst - w; - - } else {/* right to left */ - - if (ydir == 1) /* top to bottom */ - { - psrc = psrcBase+(y*widthSrc)+x+w; - pdst = pdstBase+(y1 * widthDst)+x1+w; - } - else /* bottom to top */ - { - psrc = psrcBase-((y+h-1)*widthSrc)+x+w; - pdst = pdstBase-((y1+h-1)*widthDst)+x1+w; - } - srcPitch = widthSrc + w; - dstPitch = widthDst + w; - } - - pdst = (unsigned char *)vgaSetWrite(pdst); - - vcount = 0; - while (h || vcount) { - /* - * compute here the maximal linecount(hcount) before a - * segment switch has to be made - */ - if (!vcount) { - if (ydir == 1) { - tmp = ((unsigned char *)vgaWriteTop - pdst) / widthDst; - if ((xdir == -1) && - ((pdst - (unsigned char *)vgaWriteBottom) <= w)) tmp = 0; - } else { - tmp = (pdst - (unsigned char *)vgaWriteBottom) / (-widthDst); - if ((xdir == 1) && - (((unsigned char *)vgaWriteTop - pdst) <= w)) tmp = 0; - } - hcount=min( h, tmp ); - if(!hcount) vcount = w; - } - - /* - * if we now have to make a segment switch within a line, - * divide this line into small parts. - */ - if (vcount) { - count = vcount; - - /* check which segment to switch first */ - if (xdir == 1) { - if (tmp = (unsigned char *)vgaWriteTop - pdst) - count = min(count, tmp); - else - pdst = (unsigned char *)vgaWriteNext(pdst); - } else { - if (tmp = pdst - (unsigned char *)vgaWriteBottom) - count = min(count, tmp); - else - pdst = (unsigned char *)vgaWritePrev(pdst); - } - - fastBitBltCopy(xdir,psrc, pdst, 1, count, 0, 0); - - if (!(vcount -= count)) { - h--; /* partial line finish */ - if (xdir == 1) { - psrc += (srcPitch + count); - pdst += (dstPitch + count); - } else { - psrc += (srcPitch - count); - pdst += (dstPitch - count); - } - - if ( (void *)pdst >= vgaWriteTop ) - pdst = (unsigned char *)vgaWriteNext(pdst); - if ( (void *)pdst < vgaWriteBottom ) - pdst = (unsigned char *)vgaWritePrev(pdst); - - } else { - if (xdir == 1) { - psrc += count; - pdst += count; - } else { - psrc -= count; - pdst -= count; - } - } - } else { - - h -= hcount; - - fastBitBltCopy(xdir, psrc, pdst, hcount, w, srcPitch, dstPitch); - - psrc += (hcount*widthSrc); - pdst += (hcount*widthDst); - } - } - } -} - - -void -vgaPixBitBlt(pdstBase, psrcBase, widthSrc, widthDst, x, y, - x1, y1, w, h, xdir, ydir, alu, planemask) - unsigned char *psrcBase, *pdstBase; /* start of src and dst bitmaps */ - int widthSrc, widthDst; - int x, y, x1, y1, w, h; - int xdir, ydir; - int alu; - unsigned long planemask; - -{ - register unsigned char *psrc, *pdst; - int srcPitch, dstPitch; - - if (alu == GXcopy && (planemask & 0xFF) == 0xFF) { - if (xdir == 1) { /* left to right */ - if (ydir == 1) /* top to bottom */ - { - psrc = psrcBase+(y*widthSrc)+x; - pdst = pdstBase+(y1*widthDst)+x1; - } - else /* bottom to top */ - { - psrc = psrcBase-((y+h-1)*widthSrc)+x; - pdst = pdstBase-((y1+h-1)*widthDst)+x1; - } - srcPitch = widthSrc - w; - dstPitch = widthDst - w; - - } else {/* right to left */ - - if (ydir == 1) /* top to bottom */ - { - psrc = psrcBase+(y*widthSrc)+x+w; - pdst = pdstBase+(y1 * widthDst)+x1+w; - } - else /* bottom to top */ - { - psrc = psrcBase-((y+h-1)*widthSrc)+x+w; - pdst = pdstBase-((y1+h-1)*widthDst)+x1+w; - } - srcPitch = widthSrc + w; - dstPitch = widthDst + w; - } - - fastBitBltCopy(xdir, psrc, pdst, h, w, srcPitch, dstPitch); - - } -} Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBltFillc.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBltFillc.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBltFillc.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBltFillc.c:1.2 Sat Jul 25 12:58:33 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBltFillc.c Fri Jan 18 15:26:25 2002 @@ -1,835 +0,0 @@ -/* - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaBltFillc.c,v 1.2 1998/07/25 16:58:33 dawes Exp $ */ - -#include "X.h" -#include "misc.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86_HWlib.h" - -#include "vga.h" -#include "cfb.h" - -/* fBitBlt.s */ - -void fastBitBltCopy( - int xdir, - unsigned char *psrc, - unsigned char *pdst, - int h, - int w, - int srcPitch, - int dstPitch -) -{ - if (xdir <= 0) { - while (h--) { - xf86memmove(pdst-w, psrc-w, w); - pdst += dstPitch - w; - psrc += srcPitch - w; - } - } else { - while (h--) { - xf86memcpy(pdst, psrc, w); - pdst += dstPitch + w; - psrc += srcPitch + w; - } - } -} - -/* fFillAnd.s */ - -unsigned char *fastFillSolidGXand( - unsigned char *pdst, - unsigned long fill1, - unsigned long fill2, - int hcount, - int count, - int w, - int widthPitch -) -{ - /* - * NOTES: original assembly code presumes hcount > 0 to start with - * New code assumes that all bytes of fill1, fill2 are - * consistent. i.e. 0xefefefef, and not 0x12345678. - * This is because the caller of this routine does a PFILL() - * of the [fill1, fill2] values before they get here. - * For large block cases (count > 3), the original code - * assumed that width == count. - * Fills hcount trips of count bytes each trip through loop - */ - - if (count == 0) - return pdst; - - while (hcount > 0) { - /* No special 'fast' cases here */ - int cur_count; - unsigned char tmpb = fill1; - unsigned short tmph = fill1; - unsigned int tmpi = fill1; - - cur_count = count; - - /* Fiddle with leading bits up to large block */ - if (((long)pdst & 0x1) && cur_count >= 1) { - /* To next 0mod2 */ - *(unsigned char *) pdst &= tmpb; - pdst++; - cur_count--; - } - - if (((long)pdst & 0x2) && cur_count >= 2) { - /* To next 0mod4 */ - *(unsigned short *) pdst &= tmph; - pdst += 2; - cur_count -= 2; - } - - if (((long)pdst & 0x4) && cur_count >= 4) { - /* To next 0mod8 */ - *(unsigned int *) pdst &= tmpi; - pdst += 4; - cur_count -= 4; - } - -#if defined(__alpha__) - /* - * Perform bulk copy, knowing 0mod8 alignment - * Assumes 64-bit longs. - */ - - while (cur_count >= 64) { - - /* Hand unrolled x8, assumes scheduler does a good job */ - *(unsigned long *) ((long) pdst + 0 ) &= fill1; - *(unsigned long *) ((long) pdst + 8 ) &= fill1; - *(unsigned long *) ((long) pdst + 16) &= fill1; - *(unsigned long *) ((long) pdst + 24) &= fill1; - *(unsigned long *) ((long) pdst + 32) &= fill1; - *(unsigned long *) ((long) pdst + 40) &= fill1; - *(unsigned long *) ((long) pdst + 48) &= fill1; - *(unsigned long *) ((long) pdst + 56) &= fill1; - - pdst += 64; - cur_count -= 64; - } - - /* Perform trailing bits cleanup */ - while (cur_count >= 8) { - *(unsigned long *) ((long) pdst + 0) &= fill1; - pdst += 8; - cur_count -= 8; - } -#else - /* - * Perform bulk copy, knowing 0mod4 alignment - * Assumes 32-bit longs. - */ - - while (cur_count >= 32) { - - /* Hand unrolled x8, assumes scheduler does a good job */ - *(unsigned long *) ((long) pdst + 0 ) &= fill1; - *(unsigned long *) ((long) pdst + 4 ) &= fill1; - *(unsigned long *) ((long) pdst + 8 ) &= fill1; - *(unsigned long *) ((long) pdst + 12) &= fill1; - *(unsigned long *) ((long) pdst + 16) &= fill1; - *(unsigned long *) ((long) pdst + 20) &= fill1; - *(unsigned long *) ((long) pdst + 24) &= fill1; - *(unsigned long *) ((long) pdst + 28) &= fill1; - - pdst += 32; - cur_count -= 32; - } - - /* Perform trailing bits cleanup */ - while (cur_count >= 4) { - *(unsigned long *) ((long) pdst + 0) &= fill1; - pdst += 4; - cur_count -= 4; - } -#endif - - if (cur_count >= 4) { - /* On 0mod4 boundary already */ - *(unsigned int *) pdst &= tmpi; - pdst += 4; - cur_count -= 4; - } - - if (cur_count >= 2) { - /* On 0mod2 boundary already */ - *(unsigned short *) pdst &= tmph; - pdst += 2; - cur_count -= 2; - } - - if (cur_count >= 1) { - /* last possible byte */ - *(unsigned char *) pdst &= tmpb; - pdst++; - cur_count--; - } - - /* Loop epilogue */ -/* assert(cur_count == 0); */ - pdst += widthPitch; - hcount--; - } - - return pdst; -} - -/* fFillOr.s */ - -unsigned char *fastFillSolidGXor( - unsigned char *pdst, - unsigned long fill1, - unsigned long fill2, - int hcount, - int count, - int w, - int widthPitch -) -{ - /* - * NOTES: original assembly code presumes hcount > 0 to start with - * New code assumes that all bytes of fill1, fill2 are - * consistent. i.e. 0xefefefef, and not 0x12345678. - * This is because the caller of this routine does a PFILL() - * of the [fill1, fill2] values before they get here. - * For large block cases (count > 3), the original code - * assumed that width == count. - * Fills hcount trips of count bytes each trip through loop - */ - - if (count == 0) - return pdst; - - while (hcount > 0) { - /* No special 'fast' cases here */ - int cur_count; - unsigned char tmpb = fill1; - unsigned short tmph = fill1; - unsigned int tmpi = fill1; - - cur_count = count; - - /* Fiddle with leading bits up to large block */ - if (((long)pdst & 0x1) && cur_count >= 1) { - /* To next 0mod2 */ - *(unsigned char *) pdst |= tmpb; - pdst++; - cur_count--; - } - - if (((long)pdst & 0x2) && cur_count >= 2) { - /* To next 0mod4 */ - *(unsigned short *) pdst |= tmph; - pdst += 2; - cur_count -= 2; - } - - if (((long)pdst & 0x4) && cur_count >= 4) { - /* To next 0mod8 */ - *(unsigned int *) pdst |= tmpi; - pdst += 4; - cur_count -= 4; - } - -#if defined(__alpha__) - /* - * Perform bulk copy, knowing 0mod8 alignment - * Assumes 64-bit longs. - */ - - while (cur_count >= 64) { - - /* Hand unrolled x8, assumes scheduler does a good job */ - *(unsigned long *) ((long) pdst + 0 ) |= fill1; - *(unsigned long *) ((long) pdst + 8 ) |= fill1; - *(unsigned long *) ((long) pdst + 16) |= fill1; - *(unsigned long *) ((long) pdst + 24) |= fill1; - *(unsigned long *) ((long) pdst + 32) |= fill1; - *(unsigned long *) ((long) pdst + 40) |= fill1; - *(unsigned long *) ((long) pdst + 48) |= fill1; - *(unsigned long *) ((long) pdst + 56) |= fill1; - - pdst += 64; - cur_count -= 64; - } - - /* Perform trailing bits cleanup */ - while (cur_count >= 8) { - *(unsigned long *) ((long) pdst + 0) |= fill1; - pdst += 8; - cur_count -= 8; - } -#else - /* - * Perform bulk copy, knowing 0mod4 alignment - * Assumes 32-bit longs. - */ - - while (cur_count >= 32) { - - /* Hand unrolled x8, assumes scheduler does a good job */ - *(unsigned long *) ((long) pdst + 0 ) |= fill1; - *(unsigned long *) ((long) pdst + 4 ) |= fill1; - *(unsigned long *) ((long) pdst + 8 ) |= fill1; - *(unsigned long *) ((long) pdst + 12) |= fill1; - *(unsigned long *) ((long) pdst + 16) |= fill1; - *(unsigned long *) ((long) pdst + 20) |= fill1; - *(unsigned long *) ((long) pdst + 24) |= fill1; - *(unsigned long *) ((long) pdst + 28) |= fill1; - - pdst += 32; - cur_count -= 32; - } - - /* Perform trailing bits cleanup */ - while (cur_count >= 4) { - *(unsigned long *) ((long) pdst + 0) |= fill1; - pdst += 4; - cur_count -= 4; - } -#endif - - if (cur_count >= 4) { - /* On 0mod4 boundary already */ - *(unsigned int *) pdst |= tmpi; - pdst += 4; - cur_count -= 4; - } - - if (cur_count >= 2) { - /* On 0mod2 boundary already */ - *(unsigned short *) pdst |= tmph; - pdst += 2; - cur_count -= 2; - } - - if (cur_count >= 1) { - /* last possible byte */ - *(unsigned char *) pdst |= tmpb; - pdst++; - cur_count--; - } - - /* Loop epilogue */ -/* assert(cur_count == 0); */ - pdst += widthPitch; - hcount--; - } - - return pdst; -} - -/* fFillXor.s */ - -unsigned char *fastFillSolidGXxor( - unsigned char *pdst, - unsigned long fill1, - unsigned long fill2, - int hcount, - int count, - int w, - int widthPitch -) -{ - /* - * NOTES: original assembly code presumes hcount > 0 to start with - * New code assumes that all bytes of fill1, fill2 are - * consistent. i.e. 0xefefefef, and not 0x12345678. - * This is because the caller of this routine does a PFILL() - * of the [fill1, fill2] values before they get here. - * For large block cases (count > 3), the original code - * assumed that width == count. - * Fills hcount trips of count bytes each trip through loop - */ - - if (count == 0) - return pdst; - - while (hcount > 0) { - /* No special 'fast' cases here */ - int cur_count; - unsigned char tmpb = fill1; - unsigned short tmph = fill1; - unsigned int tmpi = fill1; - - cur_count = count; - - /* Fiddle with leading bits up to large block */ - if (((long)pdst & 0x1) && cur_count >= 1) { - /* To next 0mod2 */ - *(unsigned char *) pdst ^= tmpb; - pdst++; - cur_count--; - } - - if (((long)pdst & 0x2) && cur_count >= 2) { - /* To next 0mod4 */ - *(unsigned short *) pdst ^= tmph; - pdst += 2; - cur_count -= 2; - } - - if (((long)pdst & 0x4) && cur_count >= 4) { - /* To next 0mod8 */ - *(unsigned int *) pdst ^= tmpi; - pdst += 4; - cur_count -= 4; - } - -#if defined(__alpha__) - /* - * Perform bulk copy, knowing 0mod8 alignment - * Assumes 64-bit longs. - */ - - while (cur_count >= 64) { - - /* Hand unrolled x8, assumes scheduler does a good job */ - *(unsigned long *) ((long) pdst + 0 ) ^= fill1; - *(unsigned long *) ((long) pdst + 8 ) ^= fill1; - *(unsigned long *) ((long) pdst + 16) ^= fill1; - *(unsigned long *) ((long) pdst + 24) ^= fill1; - *(unsigned long *) ((long) pdst + 32) ^= fill1; - *(unsigned long *) ((long) pdst + 40) ^= fill1; - *(unsigned long *) ((long) pdst + 48) ^= fill1; - *(unsigned long *) ((long) pdst + 56) ^= fill1; - - pdst += 64; - cur_count -= 64; - } - - /* Perform trailing bits cleanup */ - while (cur_count >= 8) { - *(unsigned long *) ((long) pdst + 0) ^= fill1; - pdst += 8; - cur_count -= 8; - } -#else - /* - * Perform bulk copy, knowing 0mod4 alignment - * Assumes 32-bit longs. - */ - - while (cur_count >= 32) { - - /* Hand unrolled x8, assumes scheduler does a good job */ - *(unsigned long *) ((long) pdst + 0 ) ^= fill1; - *(unsigned long *) ((long) pdst + 4 ) ^= fill1; - *(unsigned long *) ((long) pdst + 8 ) ^= fill1; - *(unsigned long *) ((long) pdst + 12) ^= fill1; - *(unsigned long *) ((long) pdst + 16) ^= fill1; - *(unsigned long *) ((long) pdst + 20) ^= fill1; - *(unsigned long *) ((long) pdst + 24) ^= fill1; - *(unsigned long *) ((long) pdst + 28) ^= fill1; - - pdst += 32; - cur_count -= 32; - } - - /* Perform trailing bits cleanup */ - while (cur_count >= 4) { - *(unsigned long *) ((long) pdst + 0) ^= fill1; - pdst += 4; - cur_count -= 4; - } -#endif - - if (cur_count >= 4) { - /* On 0mod4 boundary already */ - *(unsigned int *) pdst ^= tmpi; - pdst += 4; - cur_count -= 4; - } - - if (cur_count >= 2) { - /* On 0mod2 boundary already */ - *(unsigned short *) pdst ^= tmph; - pdst += 2; - cur_count -= 2; - } - - if (cur_count >= 1) { - /* last possible byte */ - *(unsigned char *) pdst ^= tmpb; - pdst++; - cur_count--; - } - - /* Loop epilogue */ -/* assert(cur_count == 0); */ - pdst += widthPitch; - hcount--; - } - - return pdst; -} - -/* fFillCopy.s */ - -unsigned char *fastFillSolidGXcopy( - unsigned char *pdst, - unsigned long fill1, - unsigned long fill2, - int hcount, - int count, - int w, - int widthPitch -) -{ - /* - * NOTES: original assembly code presumes hcount > 0 to start with - * New code assumes that all bytes of fill1, fill2 are - * consistent. i.e. 0xefefefef, and not 0x12345678. - * This is because the caller of this routine does a PFILL() - * of the [fill1, fill2] values before they get here. - * For large block cases (count > 3), the original code - * assumed that width == count. - * Fills hcount trips of count bytes each trip through loop - */ - - if (count == 0) - return pdst; - - while (hcount > 0) { - /* No special 'fast' cases here */ - int cur_count; - unsigned char tmpb = fill1; - unsigned short tmph = fill1; - unsigned int tmpi = fill1; - - cur_count = count; - - /* Fiddle with leading bits up to large block */ - if (((long)pdst & 0x1) && cur_count >= 1) { - /* To next 0mod2 */ - *(unsigned char *) pdst = tmpb; - pdst++; - cur_count--; - } - - if (((long)pdst & 0x2) && cur_count >= 2) { - /* To next 0mod4 */ - *(unsigned short *) pdst = tmph; - pdst += 2; - cur_count -= 2; - } - - if (((long)pdst & 0x4) && cur_count >= 4) { - /* To next 0mod8 */ - *(unsigned int *) pdst = tmpi; - pdst += 4; - cur_count -= 4; - } - -#if defined(__alpha__) - /* - * Perform bulk copy, knowing 0mod8 alignment - * Assumes 64-bit longs. - */ - - while (cur_count >= 64) { - - /* Hand unrolled x8, assumes scheduler does a good job */ - *(unsigned long *) ((long) pdst + 0 ) = fill1; - *(unsigned long *) ((long) pdst + 8 ) = fill1; - *(unsigned long *) ((long) pdst + 16) = fill1; - *(unsigned long *) ((long) pdst + 24) = fill1; - *(unsigned long *) ((long) pdst + 32) = fill1; - *(unsigned long *) ((long) pdst + 40) = fill1; - *(unsigned long *) ((long) pdst + 48) = fill1; - *(unsigned long *) ((long) pdst + 56) = fill1; - - pdst += 64; - cur_count -= 64; - } - - /* Perform trailing bits cleanup */ - while (cur_count >= 8) { - *(unsigned long *) ((long) pdst + 0) = fill1; - pdst += 8; - cur_count -= 8; - } -#else - /* - * Perform bulk copy, knowing 0mod4 alignment - * Assumes 32-bit longs. - */ - - while (cur_count >= 32) { - - /* Hand unrolled x8, assumes scheduler does a good job */ - *(unsigned long *) ((long) pdst + 0 ) = fill1; - *(unsigned long *) ((long) pdst + 4 ) = fill1; - *(unsigned long *) ((long) pdst + 8 ) = fill1; - *(unsigned long *) ((long) pdst + 12) = fill1; - *(unsigned long *) ((long) pdst + 16) = fill1; - *(unsigned long *) ((long) pdst + 20) = fill1; - *(unsigned long *) ((long) pdst + 24) = fill1; - *(unsigned long *) ((long) pdst + 28) = fill1; - - pdst += 32; - cur_count -= 32; - } - /* Perform trailing bits cleanup */ - while (cur_count >= 4) { - *(unsigned long *) ((long) pdst + 0) = fill1; - pdst += 4; - cur_count -= 4; - } -#endif - - if (cur_count >= 4) { - /* On 0mod4 boundary already */ - *(unsigned int *) pdst = tmpi; - pdst += 4; - cur_count -= 4; - } - - if (cur_count >= 2) { - /* On 0mod2 boundary already */ - *(unsigned short *) pdst = tmph; - pdst += 2; - cur_count -= 2; - } - - if (cur_count >= 1) { - /* last possible byte */ - *(unsigned char *) pdst = tmpb; - pdst++; - cur_count--; - } - - /* Loop epilogue */ -/* assert(cur_count == 0); */ - pdst += widthPitch; - hcount--; - } - - return pdst; -} - -/* - * Reverse engineered version of XFree86 code for fFillSet.s by - * Rick Gorton (gorton@tallis.enet.dec.com) - * This version should work well on strongly aligned RISC architectures - * in general. In particular, the even-odd trip performance problem - * with 'tribbleloop' is eliminated. - * - * Jay, please put the original header back in here... - */ - -unsigned char *fastFillSolidGXset( - unsigned char *pdst, - unsigned long fill1, - unsigned long fill2, - int hcount, - int count, - int w, - int widthPitch) -{ - /* - * NOTES: original assembly code presumes hcount > 0 to start with - * New code assumes that all bytes of fill1, fill2 are - * consistent. i.e. 0xefefefef, and not 0x12345678. - * This is because the caller of this routine does a PFILL() - * of the [fill1, fill2] values before they get here. - * For large block cases (count > 3), the original code - * assumed that width == count. - * Fills hcount trips of count bytes each trip through loop - */ - - if (count == 0) - return pdst; - - while (hcount > 0) { - /* No special 'fast' cases here */ - int cur_count; - char tmpb; - short tmph; - int tmpi; - - cur_count = count; - - /* Fiddle with leading bits up to large block */ - if (((long)pdst & 0x1) && cur_count >= 1) { - /* To next 0mod2 */ - tmpb = *(unsigned char *) pdst; - tmpb = (tmpb & fill1) ^ fill2; - *(unsigned char *) pdst = tmpb; - pdst++; - cur_count--; - } - - if (((long)pdst & 0x2) && cur_count >= 2) { - /* To next 0mod4 */ - tmph = *(unsigned short *) pdst; - tmph = (tmph & fill1) ^ fill2; - *(unsigned short *) pdst = tmph; - pdst += 2; - cur_count -= 2; - } - - if (((long)pdst & 0x4) && cur_count >= 4) { - /* To next 0mod8 */ - tmpi = *(unsigned int *) pdst; - tmpi = (tmpi & fill1) ^ fill2; - *(unsigned int *) pdst = tmpi; - pdst += 4; - cur_count -= 4; - } - -#if defined(__alpha__) - /* - * Perform bulk copy, knowing 0mod8 alignment - * Assumes 64-bit longs. - */ - - while (cur_count >= 64) { - unsigned long tmp_1, tmp_2, tmp_3, tmp_4; - unsigned long tmp_5, tmp_6, tmp_7, tmp_8; - - /* Hand unrolled x8, assumes scheduler does a good job */ - tmp_1 = *(unsigned long *) ((long) pdst + 0); - tmp_2 = *(unsigned long *) ((long) pdst + 8); - tmp_3 = *(unsigned long *) ((long) pdst + 16); - tmp_4 = *(unsigned long *) ((long) pdst + 24); - tmp_5 = *(unsigned long *) ((long) pdst + 32); - tmp_6 = *(unsigned long *) ((long) pdst + 40); - tmp_7 = *(unsigned long *) ((long) pdst + 48); - tmp_8 = *(unsigned long *) ((long) pdst + 56); - - tmp_1 = (fill1 & tmp_1) ^ fill2; - tmp_2 = (fill1 & tmp_2) ^ fill2; - tmp_3 = (fill1 & tmp_3) ^ fill2; - tmp_4 = (fill1 & tmp_4) ^ fill2; - tmp_5 = (fill1 & tmp_5) ^ fill2; - tmp_6 = (fill1 & tmp_6) ^ fill2; - tmp_7 = (fill1 & tmp_7) ^ fill2; - tmp_8 = (fill1 & tmp_8) ^ fill2; - - *(unsigned long *) ((long) pdst + 0) = tmp_1; - *(unsigned long *) ((long) pdst + 8) = tmp_2; - *(unsigned long *) ((long) pdst + 16) = tmp_3; - *(unsigned long *) ((long) pdst + 24) = tmp_4; - *(unsigned long *) ((long) pdst + 32) = tmp_5; - *(unsigned long *) ((long) pdst + 40) = tmp_6; - *(unsigned long *) ((long) pdst + 48) = tmp_7; - *(unsigned long *) ((long) pdst + 56) = tmp_8; - - pdst += 64; - cur_count -= 64; - } - - /* Perform trailing bits cleanup */ - while (cur_count >= 8) { - unsigned long tmpl; - - tmpl = *(unsigned long *) ((long) pdst + 0); - tmpl = (tmpl & fill1) ^ fill2; - *(unsigned long *) ((long) pdst + 0) = tmpl; - pdst += 8; - cur_count -= 8; - } -#else - /* - * Perform bulk copy, knowing 0mod4 alignment - * Assumes 32-bit longs. - */ - - while (cur_count >= 32) { - unsigned long tmp_1, tmp_2, tmp_3, tmp_4; - unsigned long tmp_5, tmp_6, tmp_7, tmp_8; - - /* Hand unrolled x8, assumes scheduler does a good job */ - tmp_1 = *(unsigned long *) ((long) pdst + 0); - tmp_2 = *(unsigned long *) ((long) pdst + 4); - tmp_3 = *(unsigned long *) ((long) pdst + 8 ); - tmp_4 = *(unsigned long *) ((long) pdst + 12); - tmp_5 = *(unsigned long *) ((long) pdst + 16); - tmp_6 = *(unsigned long *) ((long) pdst + 20); - tmp_7 = *(unsigned long *) ((long) pdst + 24); - tmp_8 = *(unsigned long *) ((long) pdst + 28); - - tmp_1 = (fill1 & tmp_1) ^ fill2; - tmp_2 = (fill1 & tmp_2) ^ fill2; - tmp_3 = (fill1 & tmp_3) ^ fill2; - tmp_4 = (fill1 & tmp_4) ^ fill2; - tmp_5 = (fill1 & tmp_5) ^ fill2; - tmp_6 = (fill1 & tmp_6) ^ fill2; - tmp_7 = (fill1 & tmp_7) ^ fill2; - tmp_8 = (fill1 & tmp_8) ^ fill2; - - *(unsigned long *) ((long) pdst + 0) = tmp_1; - *(unsigned long *) ((long) pdst + 4) = tmp_2; - *(unsigned long *) ((long) pdst + 8 ) = tmp_3; - *(unsigned long *) ((long) pdst + 12) = tmp_4; - *(unsigned long *) ((long) pdst + 16) = tmp_5; - *(unsigned long *) ((long) pdst + 20) = tmp_6; - *(unsigned long *) ((long) pdst + 24) = tmp_7; - *(unsigned long *) ((long) pdst + 28) = tmp_8; - - pdst += 32; - cur_count -= 32; - } - /* Perform trailing bits cleanup */ - while (cur_count >= 4) { - unsigned long tmpl; - - tmpl = *(unsigned long *) ((long) pdst + 0); - tmpl = (tmpl & fill1) ^ fill2; - *(unsigned long *) ((long) pdst + 0) = tmpl; - pdst += 4; - cur_count -= 4; - } -#endif - - if (cur_count >= 4) { - /* On 0mod4 boundary already */ - tmpi = *(unsigned int *) pdst; - tmpi = (tmpi & fill1) ^ fill2; - *(unsigned int *) pdst = tmpi; - pdst += 4; - cur_count -= 4; - } - - if (cur_count >= 2) { - /* On 0mod2 boundary already */ - tmph = *(unsigned short *) pdst; - tmph = (tmph & fill1) ^ fill2; - *(unsigned short *) pdst = tmph; - pdst += 2; - cur_count -= 2; - } - - if (cur_count >= 1) { - /* last possible byte */ - tmpb = *(unsigned char *) pdst; - tmpb = (tmpb & fill1) ^ fill2; - *(unsigned char *) pdst = tmpb; - pdst++; - cur_count--; - } - - /* Loop epilogue */ -/* assert(cur_count == 0); */ - pdst += widthPitch; - hcount--; - } - - return pdst; -} - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaFasm.h diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaFasm.h:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaFasm.h:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaFasm.h:1.2 Sat Jul 25 12:58:33 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaFasm.h Fri Jan 18 15:26:25 2002 @@ -1,318 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaFasm.h,v 1.2 1998/07/25 16:58:33 dawes Exp $ */ -/* Copyright 1992 by James Tsillas, Arlington, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. - -JAMES TSILLAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -*/ -/* $XConsortium: vgaFasm.h /main/7 1996/10/25 10:34:03 kaleb $ */ - -#include "fastblt.h" - - -#ifndef RROP_NAME_CAT -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) || (defined (sun) && defined (__STDC__) && !defined (__GNUC__)) -#define RROP_NAME_CAT(prefix,suffix) prefix##suffix -#else -#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix -#endif -#endif - -#define fCopyAL1_C(psrc, pdst, nl, srcR, widS, psrcS) \ - while (nl) { \ - fnl = nl; \ - if (fnl > srcR) fnl = srcR; \ - nl -= fnl; srcR -= fnl; \ - DuffL ( fnl, label00, \ - *pdst = MROP_SOLID (*psrc, *pdst); \ - pdst++; psrc++; ) \ - if (!srcR) { \ - srcR = widS; \ - psrc = psrcS; } \ - } -#define fCopyAL2_C(psrc, pdst, nl, srcR, widS, psrcS) \ - while (nl) { \ - fnl = nl; \ - if (fnl > srcR) fnl = srcR; \ - nl -= fnl; srcR -= fnl; \ - DuffL ( fnl, label01, \ - *pdst = MROP_SOLID (*psrc, *pdst); \ - pdst++; psrc++; ) \ - if (!srcR) { \ - srcR = widS; \ - psrc = psrcS; } \ - } -#define fCopyAL3_C(psrc, pdst, nl, srcR, widS, psrcS) \ - while (nl) { \ - fnl = nl; \ - if (fnl > srcR) fnl = srcR; \ - nl -= fnl; srcR -= fnl; \ - DuffL ( fnl, label02, \ - *pdst = MROP_SOLID (*psrc, *pdst); \ - pdst++; psrc++; ) \ - if (!srcR) { \ - srcR = widS; \ - psrc = psrcS; } \ - } -#define fCopyUL_C(psrc, pdst, bits, lShift, rShift) \ - bits1 = BitLeft(bits, (leftShift)); bits = *psrc++; \ - *pdst = MROP_SOLID (bits1 | \ - BitRight(bits, (rightShift)), *pdst); \ - pdst++; - -/* The in-line assembler here only works for gcc2 */ -#if __GNUC__ > 1 && defined(__STDC__) && defined(i386) -#define ESI __asm__ ("esi") -#define EDI __asm__ ("edi") - -#define fBitBltC(xdir, dst, src, w, count, sP, dP) \ - __asm__ __volatile__ ("pushl %8 \n\ - pushl %7 \n\ - pushl %6 \n\ - pushl %5 \n\ - pushl %4 \n\ - call fastBitBltCopy \n\ - addl $16, %%esp" \ - : "=D" (/*(unsigned char *)*/ (dst)), \ - "=S" (/*(unsigned char *)*/ (src)) \ - : "D0" ((unsigned char *) (dst)), \ - "S1" ((unsigned char *) (src)), \ - "g" ((unsigned int) (xdir)), \ - "g" ((unsigned int) (w)), \ - "g" ((unsigned int) (count)), \ - "g" ((unsigned int) (sP)), \ - "g" ((unsigned int) (dP)) \ - : "edx", "ecx", "eax"); - -#if MROP == Mcopy -#define CLD __asm__ __volatile__ ("cld") -#define fCopyAL1_X(psrc, pdst, nl, srcR, widS, psrcS, rep) \ - __asm__ __volatile__ (".label00: orl %6, %6 \n\ - jz .label02 \n\ - movl %6, %%ecx \n\ - cmpl %%ecx, %2 \n\ - ja .label01 \n\ - movl %2, %%ecx \n\ - .label01: subl %%ecx, %6 \n\ - subl %%ecx, %2 \n"\ - ##rep## \ - "movsl \n\ - orl %2, %2 \n\ - jnz .label00 \n\ - movl %7, %2 \n\ - movl %8, %0 \n\ - jmp .label00 \n\ - .label02:" \ - : "=S" (/*(unsigned long *)*/ (psrc)), \ - "=D" (/*(unsigned long *)*/ (pdst)), \ - "=b" (/*(unsigned int)*/ (srcR)) \ - : "S0" ((unsigned long *) (psrc)), \ - "D1" ((unsigned long *) (pdst)), \ - "b2" ((unsigned int) (srcR)), \ - "d" ((unsigned int) (nl)), \ - "g" ((unsigned int) (widS)), \ - "g" ((unsigned long *) (psrcS)) \ - : "ecx"); -#ifdef GCCUSESGAS -#define fCopyAL1(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL1_X((psrc),(pdst),(nl),(srcR),(widS),(psrcS), \ - "repe\n"); -#else -#define fCopyAL1(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL1_X((psrc),(pdst),(nl),(srcR),(widS),(psrcS), \ - "repz\n"); -#endif -#define fCopyAL2_X(psrc, pdst, nl, srcR, widS, psrcS, rep) \ - __asm__ __volatile__ (".label10: orl %6, %6 \n\ - jz .label12 \n\ - movl %6, %%ecx \n\ - cmpl %%ecx, %2 \n\ - ja .label11 \n\ - movl %2, %%ecx \n\ - .label11: subl %%ecx, %6 \n\ - subl %%ecx, %2 \n"\ - ##rep## \ - "movsl \n\ - orl %2, %2 \n\ - jnz .label10 \n\ - movl %7, %2 \n\ - movl %8, %0 \n\ - jmp .label10 \n\ - .label12:" \ - : "=S" (/*(unsigned long *)*/ (psrc)), \ - "=D" (/*(unsigned long *)*/ (pdst)), \ - "=b" (/*(unsigned int)*/ (srcR)) \ - : "S0" ((unsigned long *) (psrc)), \ - "D1" ((unsigned long *) (pdst)), \ - "b2" ((unsigned int) (srcR)), \ - "d" ((unsigned int) (nl)), \ - "g" ((unsigned int) (widS)), \ - "g" ((unsigned long *) (psrcS)) \ - : "ecx"); -#ifdef GCCUSESGAS -#define fCopyAL2(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL2_X((psrc),(pdst),(nl),(srcR),(widS),(psrcS), \ - "repe\n"); -#else -#define fCopyAL2(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL2_X((psrc),(pdst),(nl),(srcR),(widS),(psrcS), \ - "repz\n"); -#endif -#define fCopyAL3_X(psrc, pdst, nl, srcR, widS, psrcS, rep) \ - __asm__ __volatile__ (".label20: orl %6, %6 \n\ - jz .label22 \n\ - movl %6, %%ecx \n\ - cmpl %%ecx, %2 \n\ - ja .label21 \n\ - movl %2, %%ecx \n\ - .label21: subl %%ecx, %6 \n\ - subl %%ecx, %2 \n"\ - ##rep## \ - "movsl \n\ - orl %2, %2 \n\ - jnz .label20 \n\ - movl %7, %2 \n\ - movl %8, %0 \n\ - jmp .label20 \n\ - .label22:" \ - : "=S" (/*(unsigned long *)*/ (psrc)), \ - "=D" (/*(unsigned long *)*/ (pdst)), \ - "=b" (/*(unsigned int)*/ (srcR)) \ - : "S0" ((unsigned long *) (psrc)), \ - "D1" ((unsigned long *) (pdst)), \ - "b2" ((unsigned int) (srcR)), \ - "d" ((unsigned int) (nl)), \ - "g" ((unsigned int) (widS)), \ - "g" ((unsigned long *) (psrcS)) \ - : "ecx"); -#ifdef GCCUSESGAS -#define fCopyAL3(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL3_X((psrc),(pdst),(nl),(srcR),(widS),(psrcS), \ - "repe\n"); -#else -#define fCopyAL3(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL3_X((psrc),(pdst),(nl),(srcR),(widS),(psrcS), \ - "repz\n"); -#endif -#define fCopyUL(psrc, pdst, bits, lShift, rShift) \ - __asm__ __volatile__ (" movl %4, %%edx \n\ - movl %5, %%ecx \n\ - shrl %%cl, %%edx \n\ - lodsl \n\ - movl %%eax, %4 \n\ - movl %6, %%ecx \n\ - shll %%cl, %%eax \n\ - orl %%edx, %%eax \n\ - stosl" \ - : "=S" (/*(unsigned long *)*/ (psrc)), \ - "=D" (/*(unsigned long *)*/ (pdst)) \ - : "S0" ((unsigned long *) (psrc)), \ - "D1" ((unsigned long *) (pdst)), \ - "g" ((unsigned long) (bits)), \ - "g" ((unsigned long) (lShift)), \ - "g" ((unsigned long) (rShift)) \ - : "edx", "ecx", "eax"); -#elif !defined(RROP) -#define fCopyAL1(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL1_C((psrc),(pdst),(nl),(srcR),(widS),(psrcS)) -#define fCopyAL2(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL2_C((psrc),(pdst),(nl),(srcR),(widS),(psrcS)) -#define fCopyAL3(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL3_C((psrc),(pdst),(nl),(srcR),(widS),(psrcS)) -#define fCopyUL(psrc, pdst, bits, lShift, rShift) \ - fCopyUL_C((psrc),(pdst),(bits),(lShift),(rShift)) -#define CLD -#endif /* Mcopy */ -#if RROP == GXcopy -#define CLD __asm__ __volatile__ ("cld") -#define RROP_SOLID_L_X(pdst, nl, fill, rep) \ - __asm__ __volatile__ ( rep## \ - "stosl" \ - : "=D" (/*(unsigned long *)*/ (pdst)) \ - : "D0" ((unsigned long *) (pdst)), \ - "c" ((unsigned long) (nl)), \ - "a" ((unsigned long) (fill))); -#ifdef GCCUSESGAS -#define RROP_SOLID_L(pdst, nl, fill) \ - RROP_SOLID_L_X((pdst),(nl),(fill),"repe\n") -#else -#define RROP_SOLID_L(pdst, nl, fill) \ - RROP_SOLID_L_X((pdst),(nl),(fill),"repz\n") -#endif -#define RROP_SPAN_STD(pdst, nlm, dummy) \ -__extension__ ({ \ - __label__ label1; \ - if (!vgaWriteFlag) goto label1; \ - nl = min(nlm, (unsigned long *) vgaWriteTop - \ - (unsigned long *) pdst); \ - nlm -= nl; \ - RROP_SOLID_L(pdst, nl, rrop_xor); \ - if (nlm) { \ - pdst = vgaReadWriteNext(pdst); \ - label1: \ - RROP_SOLID_L (pdst, nlm, rrop_xor); \ - } \ -}) -#elif !defined(MROP) -#define RROP_SOLID_L(pdst, nlm, label) \ - DuffL(nlm, label, RROP_SOLID(pdst); pdst++;) -#define RROP_SPAN_STD(pdst, nlm, dummy) \ -__extension__ ({ \ - __label__ label1, label2, label3; \ - if (!vgaWriteFlag) goto label1; \ - nl = min(nlm, (unsigned long *) vgaWriteTop - \ - (unsigned long *) pdst); \ - nlm -= nl; \ - RROP_SOLID_L(pdst, nl, label2); \ - if (nlm) { \ - pdst = vgaReadWriteNext(pdst); \ - label1: \ - RROP_SOLID_L(pdst, nlm, label3); \ - } \ -}) -#endif - -#else /* __GNUC__ > 1 */ - -#define ESI -#define EDI -#define CLD -#define fCopyAL1(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL1_C((psrc),(pdst),(nl),(srcR),(widS),(psrcS)) -#define fCopyAL2(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL2_C((psrc),(pdst),(nl),(srcR),(widS),(psrcS)) -#define fCopyAL3(psrc, pdst, nl, srcR, widS, psrcS) \ - fCopyAL3_C((psrc),(pdst),(nl),(srcR),(widS),(psrcS)) -#define fCopyUL(psrc, pdst, bits, lShift, rShift) \ - fCopyUL_C((psrc),(pdst),(bits),(lShift),(rShift)) - -#define RROP_SOLID_L(pdst, nlm, label) \ - DuffL(nlm, label, RROP_SOLID(pdst); pdst++;) -#define RROP_SPAN_STD(pdst, nlm, dummy) \ -{ \ - if (!vgaWriteFlag) goto RROP_NAME_CAT(_X_l1,dummy); \ - nl = min(nlm, (unsigned long *) vgaWriteTop - \ - (unsigned long *) pdst); \ - nlm -= nl; \ - RROP_SOLID_L(pdst, nl, RROP_NAME_CAT(_X_l2,dummy)); \ - if (nlm) { \ - pdst = vgaReadWriteNext(pdst); \ - RROP_NAME_CAT(_X_l1,dummy): \ - RROP_SOLID_L(pdst, nlm, RROP_NAME_CAT(_X_l3,dummy)); \ - } \ -} - -#endif /* __GNUC__ > 1 */ - Index: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaLinec.c diff -u xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaLinec.c:1.2 xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaLinec.c:removed --- xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaLinec.c:1.2 Sat Jul 25 12:58:33 1998 +++ xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaLinec.c Fri Jan 18 15:26:25 2002 @@ -1,71 +0,0 @@ -/* - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgafb/enhanced/vgaLinec.c,v 1.2 1998/07/25 16:58:33 dawes Exp $ */ - -#include "X.h" -#include "misc.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86_HWlib.h" - -#include "vga.h" -#include "cfb.h" - -/* vgabres.s */ -void fastvga256BresS( - int alu, - unsigned long and, - unsigned long xor, - unsigned long *addrl, - int nlwidth, - register int signdx, - int signdy, - int axis, - int x, - int y, - register int e, - register int e1, - int e2, - int len -) -{ - SETRW(addrl); - cfbBresS(alu,and,xor,addrl,nlwidth,signdx,signdy,axis,x,y,e,e1,e2,len); -} - -/* vgalineH.s */ -int fastvga256HorzS( - int alu, - unsigned long and, - register unsigned long xor, - register unsigned long *addrl, - int nlwidth, - int x, - int y, - int len -) -{ - SETRW(addrl); - cfbHorzS(alu,and,xor,addrl,nlwidth,x,y,len); -} - -/* vgalineV.s */ -int fastvga256VertS( - int alu, - unsigned long and, - unsigned long xor, - unsigned long *addrl, - int nlwidth, - int x, - int y, - register int len -) -{ - SETRW(addrl); - cfbVertS(alu,and,xor,addrl,nlwidth,x,y,len); -} Index: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c diff -u xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.50 xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.53 --- xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.50 Thu May 10 18:18:57 2001 +++ xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c Tue Sep 18 17:23:23 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.50 2001/05/10 22:18:57 dbateman Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.53 2001/09/18 21:23:23 herrb Exp $ */ /* * @@ -10,9 +10,7 @@ * */ -#if !defined(AMOEBA) && !defined(MINIX) #define _NEED_SYSI86 -#endif #include "X.h" #include "misc.h" @@ -30,7 +28,10 @@ #define SAVE_FONT1 #endif -#if defined(Lynx) || defined(CSRG_BASED) || defined(MACH386) || defined(linux) || defined(AMOEBA) || defined(MINIX) || defined(__QNX__) || defined(sun) || defined(__GNU__) +/* + * These used to be OS-specific, which made this module have an undesirable + * OS dependency. Define them by default for all platforms. + */ #ifndef NEED_SAVED_CMAP #define NEED_SAVED_CMAP #endif @@ -40,13 +41,12 @@ #ifndef SAVE_FONT2 #define SAVE_FONT2 #endif -#endif /* bytes per plane to save for text */ #define TEXT_AMOUNT 16384 /* bytes per plane to save for font data */ -#define FONT_AMOUNT 8192 +#define FONT_AMOUNT (8*8192) #if 0 /* Override all of these for now */ @@ -652,8 +652,10 @@ on = xf86IsUnblank(mode); +#if 0 if (on) SetTimeSinceLastInputEvent(); +#endif if ((pScrn != NULL) && pScrn->vtSema) { vgaHWBlankScreen(pScrn, on); @@ -1818,6 +1820,9 @@ { hwp->IOBase = (hwp->readMiscOut(hwp) & 0x01) ? VGA_IOBASE_COLOR : VGA_IOBASE_MONO; + xf86DrvMsgVerb(hwp->pScrn->scrnIndex, X_INFO, 3, + "vgaHWGetIOBase: hwp->IOBase is 0x%04x, hwp->PIOOffset is 0x%04x\n", + hwp->IOBase, hwp->PIOOffset); } Index: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h diff -u xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.28 xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.29 --- xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.28 Thu May 10 18:18:58 2001 +++ xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h Tue Dec 11 19:12:48 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h,v 1.28 2001/05/10 22:18:58 dbateman Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h,v 1.29 2001/12/12 00:12:48 mvojkovi Exp $ */ /* @@ -188,11 +188,15 @@ #define BITS_PER_GUN 6 #define COLORMAP_SIZE 256 +#if defined(__powerpc__) +#define DACDelay(hw) /* No legacy VGA support */ +#else #define DACDelay(hw) \ do { \ unsigned char temp = inb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ temp = inb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ } while (0) +#endif /* Function Prototypes */ Index: xc/programs/Xserver/hw/xfree86/xaa/Imakefile.EXP diff -u xc/programs/Xserver/hw/xfree86/xaa/Imakefile.EXP:1.7 xc/programs/Xserver/hw/xfree86/xaa/Imakefile.EXP:1.8 --- xc/programs/Xserver/hw/xfree86/xaa/Imakefile.EXP:1.7 Tue Sep 19 22:05:41 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/Imakefile.EXP Mon Dec 17 15:00:46 2001 @@ -1,9 +1,9 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xaa/Imakefile.EXP,v 1.7 2000/09/20 02:05:41 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xaa/Imakefile.EXP,v 1.8 2001/12/17 20:00:46 dawes Exp $ #define IHaveModules #include <Server.tmpl> -INCLUDES = -I.. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(XF86HWSRC) \ +INCLUDES = -I.. -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(SERVERSRC)/cfb -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ -I$(SERVERSRC)/render -I$(EXTINCSRC) Index: xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO diff -u xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO:1.12 xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO:1.13 --- xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO:1.12 Wed Apr 12 10:44:42 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO Tue May 22 14:51:09 2001 @@ -3,8 +3,6 @@ XAA.HOWTO This file describes how to add basic XAA support to a chipset driver. -For a more in-depth discussion of XAA, one should read the XAA.DESIGN -document as well. 0) What is XAA 1) XAA Initialization and Shutdown @@ -889,8 +887,7 @@ caching mechanism to store all 8x8 patterns linearly in video memory. If the accelerator needs the patterns stored in a more unusual fashion, the driver will need to provide its own 8x8 mono pattern caching - routines for XAA to use. How to do this will be described in the - XAA.DESIGN document. + routines for XAA to use. The following table describes the meanings of the "patx" and "paty" fields in both the SetupFor and Subsequent functions. @@ -1097,8 +1094,7 @@ that the accelerator is capable of accessing data stored on 8 pixel boundaries. If the accelerator has stricter alignment requirements than this the dirver will need to provide its own - 8x8 color pattern caching routines. How to do this will be - described in the XAA.DESIGN document. + 8x8 color pattern caching routines. void SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, @@ -1428,4 +1424,4 @@ pixmap with a particular dimension is allowed, then your driver will be expected to render primitives as large as that pixmap. -$XFree86: xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO,v 1.12 2000/04/12 14:44:42 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO,v 1.13 2001/05/22 18:51:09 mvojkovi Exp $ Index: xc/programs/Xserver/hw/xfree86/xaa/xaa.h diff -u xc/programs/Xserver/hw/xfree86/xaa/xaa.h:1.35 xc/programs/Xserver/hw/xfree86/xaa/xaa.h:1.36 --- xc/programs/Xserver/hw/xfree86/xaa/xaa.h:1.35 Sat Nov 18 14:37:24 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaa.h Sun Jun 3 15:47:59 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaa.h,v 1.35 2000/11/18 19:37:24 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaa.h,v 1.36 2001/06/03 19:47:59 mvojkovi Exp $ */ #ifndef _XAA_H #define _XAA_H @@ -196,10 +196,12 @@ /* render flags */ +#define XAA_RENDER_POWER_OF_2_TILE_ONLY 0x00000008 #define XAA_RENDER_NO_SRC_ALPHA 0x00000004 #define XAA_RENDER_IMPRECISE_ONLY 0x00000002 #define XAA_RENDER_NO_TILE 0x00000001 +#define XAA_RENDER_REPEAT 0x00000001 typedef void (* ValidateGCProcPtr)( GCPtr pGC, Index: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyPlane.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaCpyPlane.c:1.11 xc/programs/Xserver/hw/xfree86/xaa/xaaCpyPlane.c:1.13 --- xc/programs/Xserver/hw/xfree86/xaa/xaaCpyPlane.c:1.11 Mon Sep 25 19:56:13 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaCpyPlane.c Mon Oct 1 09:44:15 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyPlane.c,v 1.11 2000/09/25 23:56:13 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyPlane.c,v 1.13 2001/10/01 13:44:15 eich Exp $ */ /* A CopyPlane function that handles bitmap->screen copies and @@ -127,14 +127,15 @@ h = height = pbox->y2 - pbox->y1; pitch = BitmapBytePad(width); - if(!(data = ALLOCATE_LOCAL(height * pitch))) + if(!(data = xalloc(height * pitch))) goto ALLOC_FAILED; bzero(data, height * pitch); dataPtr = data; - srcPtr = ((pbox->y1 + pSrc->y) * srcwidth) + src + - ((pbox->x1 + pSrc->x) * Bpp) + offset; + srcPtr = ((pptSrc->y) * srcwidth) + src + + ((pptSrc->x) * Bpp) + offset; + while(h--) { for(i = index = 0; i < width; i++, index += Bpp) { if(mask & srcPtr[index]) @@ -148,7 +149,7 @@ pbox->x1, pbox->y1, width, height, data, pitch, 0, pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask); - DEALLOCATE_LOCAL(data); + xfree(data); ALLOC_FAILED: Index: xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c:1.3 xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c:1.4 --- xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c:1.3 Sat May 29 23:03:30 1999 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c Sat Oct 27 23:34:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c,v 1.3 1999/05/30 03:03:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaDashLine.c,v 1.4 2001/10/28 03:34:04 tsi Exp $ */ #include "X.h" #include "misc.h" @@ -109,6 +109,8 @@ len = dmaj; dmin <<= 1; dmaj <<= 1; + } else { /* Muffle compiler */ + dmin = dmaj = e = octant = len = 0; } while(nbox--) { Index: xc/programs/Xserver/hw/xfree86/xaa/xaaFillPoly.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaFillPoly.c:1.13 xc/programs/Xserver/hw/xfree86/xaa/xaaFillPoly.c:1.15 --- xc/programs/Xserver/hw/xfree86/xaa/xaaFillPoly.c:1.13 Tue May 2 20:44:22 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaFillPoly.c Sat Oct 27 23:34:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaFillPoly.c,v 1.13 2000/05/03 00:44:22 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaFillPoly.c,v 1.15 2001/10/28 03:34:04 tsi Exp $ */ /* * Copyright 1996 The XFree86 Project @@ -41,8 +41,7 @@ #include "pixmapstr.h" #include "xf86str.h" #include "mi.h" -#define PSZ 8 /* PSZ doesn't matter */ -#include "cfb.h" +#include "micoord.h" #include "xaa.h" #include "xaalocal.h" @@ -124,7 +123,7 @@ int *topY, int *bottomY, /* return */ int shape ){ - int c,vertex1, vertex2; + int c = 0, vertex1, vertex2; *topY = 32767; *bottomY = 0; @@ -153,7 +152,7 @@ int dx2, dx1, x1, x2; x2 = x1 = -1; - dx1 = 1; + dx2 = dx1 = 1; while (count--) { c = *((int*)ptsIn); @@ -205,8 +204,10 @@ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); int origin, vertex1, vertex2; int *vertex1p, *vertex2p, *endp; - int x1, x2, dx1, dx2, dy1, dy2, DX1, DX2, e1, e2; - int step1, step2, sign1, sign2; + int x1 = 0, x2 = 0; + int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0; + int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0; + int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0; int c, y, maxy, h, yoffset; DDXPointPtr topPoint; @@ -357,8 +358,10 @@ ){ int *vertex1p, *vertex2p, *endp; int vertex1, vertex2; - int x1, x2, dx1, dx2, dy1, dy2, DX1, DX2, e1, e2; - int step1, step2, sign1, sign2; + int x1 = 0, x2 = 0; + int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0; + int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0; + int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0; int c, h, yoffset; Index: xc/programs/Xserver/hw/xfree86/xaa/xaaFillRect.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaFillRect.c:1.13 xc/programs/Xserver/hw/xfree86/xaa/xaaFillRect.c:1.15 --- xc/programs/Xserver/hw/xfree86/xaa/xaaFillRect.c:1.13 Mon Mar 27 20:21:04 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaFillRect.c Thu Dec 13 13:01:51 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaFillRect.c,v 1.13 2000/03/28 01:21:04 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaFillRect.c,v 1.15 2001/12/13 18:01:51 eich Exp $ */ #include "misc.h" #include "xf86.h" @@ -156,6 +156,10 @@ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); fg = pPriv->fg; bg = pPriv->bg; break; + default: /* Muffle compiler */ + pPriv = NULL; /* Kaboom */ + fg = -1; bg = -1; + break; } (*infoRec->FillMono8x8PatternRects) (infoRec->pScrn, @@ -177,24 +181,24 @@ ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); XAACacheInfoPtr pCache; - XAAPixmapPtr pPriv; PixmapPtr pPix; int fg, bg; switch(pGC->fillStyle) { case FillStippled: pPix = pGC->stipple; - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); fg = pGC->fgPixel; bg = -1; break; case FillOpaqueStippled: pPix = pGC->stipple; - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); fg = pGC->fgPixel; bg = pGC->bgPixel; break; case FillTiled: pPix = pGC->tile.pixmap; - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); + fg = -1; bg = -1; + break; + default: /* Muffle compiler */ + pPix = NULL; fg = -1; bg = -1; break; } @@ -227,6 +231,9 @@ case FillOpaqueStippled: fg = pGC->fgPixel; bg = pGC->bgPixel; break; + default: /* Muffle compiler */ + fg = -1; bg = -1; + break; } (*infoRec->FillColorExpandRects) (infoRec->pScrn, fg, bg, @@ -262,6 +269,9 @@ case FillTiled: pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap); break; + default: /* Muffle compiler */ + pCache = NULL; + break; } (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu, @@ -291,6 +301,9 @@ case FillOpaqueStippled: fg = pGC->fgPixel; bg = pGC->bgPixel; break; + default: /* Muffle compiler */ + fg = -1; bg = -1; + break; } (*infoRec->FillCacheExpandRects) (infoRec->pScrn, fg, bg, @@ -405,8 +418,8 @@ if(!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){ XAARotateMonoPattern(&patx, &paty, xorg, yorg, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); + (infoRec->Mono8x8PatternFillFlags & + BIT_ORDER_IN_BYTE_MSBFIRST)); xorg = patx; yorg = paty; } } else { Index: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c:1.33 xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c:1.35 --- xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c:1.33 Tue May 15 14:22:23 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c Thu Jul 19 14:50:16 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.33 2001/05/15 18:22:23 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.35 2001/07/19 18:50:16 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -87,6 +87,10 @@ #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif + + /* Return successfully if no acceleration wanted */ + if (!infoRec) + return TRUE; if (XAAGeneration != serverGeneration) { if ( ((XAAScreenIndex = AllocateScreenPrivateIndex()) < 0) || @@ -535,6 +539,7 @@ pPriv->flags = OFFSCREEN; pPriv->offscreenArea = area; + pPriv->freeData = FALSE; pLink->next = infoRec->OffscreenPixmaps; pLink->pPix = pPix; @@ -550,6 +555,7 @@ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); pPriv->flags = 0; pPriv->offscreenArea = NULL; + pPriv->freeData = FALSE; if(!w || !h) /* either scratch or shared memory */ pPriv->flags |= SHARED_PIXMAP; } @@ -565,22 +571,35 @@ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); Bool ret; - if((pPix->refcnt == 1) && (pPriv->flags & OFFSCREEN)) { - if(pPriv->flags & DGA_PIXMAP) - xfree(pPriv->offscreenArea); - else { - FBAreaPtr area = pPriv->offscreenArea; - if(!area) { + if(pPix->refcnt == 1) { + if(pPriv->flags & OFFSCREEN) { + if(pPriv->flags & DGA_PIXMAP) + xfree(pPriv->offscreenArea); + else { + FBAreaPtr area = pPriv->offscreenArea; PixmapLinkPtr pLink = infoRec->OffscreenPixmaps; - while(pLink->pPix != pPix) + PixmapLinkPtr prev = NULL; + + while(pLink->pPix != pPix) { + prev = pLink; pLink = pLink->next; - xfree(pPix->devPrivate.ptr); - area = pLink->area; - } - xf86FreeOffscreenArea(area); - pPriv->offscreenArea = NULL; - DELIST_OFFSCREEN_PIXMAP(pPix); - } + } + + if(prev) prev->next = pLink->next; + else infoRec->OffscreenPixmaps = pLink->next; + + if(!area) area = pLink->area; + + xf86FreeOffscreenArea(area); + pPriv->offscreenArea = NULL; + xfree(pLink); + } + } + + if(pPriv->freeData) { /* pixmaps that were once in video ram */ + xfree(pPix->devPrivate.ptr); + pPix->devPrivate.ptr = NULL; + } } XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap); Index: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.31 xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.32 --- xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.31 Tue May 15 14:22:23 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c Sun Jun 3 15:47:59 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c,v 1.31 2001/05/15 18:22:23 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c,v 1.32 2001/06/03 19:47:59 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -1263,19 +1263,23 @@ } #ifdef RENDER - /* Render stuff */ - if(!infoRec->Composite && - infoRec->SetupForCPUToScreenAlphaTexture && - infoRec->SubsequentCPUToScreenAlphaTexture) { - infoRec->Composite = XAADoComposite; + Bool haveTexture = infoRec->CPUToScreenTextureFormats && + infoRec->SetupForCPUToScreenTexture && + infoRec->SubsequentCPUToScreenTexture; + Bool haveAlphaTexture = infoRec->CPUToScreenAlphaTextureFormats && + infoRec->SetupForCPUToScreenAlphaTexture && + infoRec->SubsequentCPUToScreenAlphaTexture; + + if(!infoRec->Composite && (haveTexture || haveAlphaTexture)) + infoRec->Composite = XAADoComposite; + + if(!infoRec->Glyphs && infoRec->WriteBitmap && + !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) + { + infoRec->Glyphs = XAADoGlyphs; + } } - - if(!infoRec->Glyphs && infoRec->WriteBitmap && - !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) - { - infoRec->Glyphs = XAADoGlyphs; - } #endif /************ Validation Functions **************/ Index: xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c:1.4 xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c:1.5 --- xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c:1.4 Sat May 29 23:03:32 1999 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c Sat Oct 27 23:34:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c,v 1.4 1999/05/30 03:03:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaLine.c,v 1.5 2001/10/28 03:34:04 tsi Exp $ */ #include "X.h" #include "misc.h" @@ -187,13 +187,15 @@ len = dmaj; dmin <<= 1; dmaj <<= 1; + } else { /* Muffle compiler */ + dmin = dmaj = e = octant = len = 0; } while(nbox--) { oc1 = oc2 = 0; OUTCODES(oc1, x1, y1, pbox); OUTCODES(oc2, x2, y2, pbox); - if (!(oc1 | oc2)) { /* uncliped */ + if (!(oc1 | oc2)) { /* unclipped */ if(infoRec->SubsequentSolidTwoPointLine) { (*infoRec->SubsequentSolidTwoPointLine)( infoRec->pScrn, x1, y1, x2, y2, Index: xc/programs/Xserver/hw/xfree86/xaa/xaaOffscreen.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaOffscreen.c:1.5 xc/programs/Xserver/hw/xfree86/xaa/xaaOffscreen.c:1.6 --- xc/programs/Xserver/hw/xfree86/xaa/xaaOffscreen.c:1.5 Sun Jul 4 02:39:17 1999 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaOffscreen.c Thu Jul 19 14:50:16 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaOffscreen.c,v 1.5 1999/07/04 06:39:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaOffscreen.c,v 1.6 2001/07/19 18:50:16 mvojkovi Exp $ */ /* Copyright (c) 1999 - The XFree86 Project Inc. @@ -66,6 +66,7 @@ pPix->drawable.depth, pPix->drawable.bitsPerPixel, pPix->devKind, data); + pPriv->freeData = FALSE; pPix->drawable.x = area->box.x1; pPix->drawable.y = area->box.y1; @@ -155,4 +156,5 @@ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPriv->offscreenArea = NULL; + pPriv->freeData = TRUE; } Index: xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c:1.12 xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c:1.13 --- xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c:1.12 Thu Sep 28 16:48:01 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c Sat Oct 27 23:34:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c,v 1.12 2000/09/28 20:48:01 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaOverlay.c,v 1.13 2001/10/28 03:34:04 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -108,7 +108,7 @@ BoxPtr pBox = REGION_RECTS(prgn); PixmapPtr pPix = NULL; int depth = pWin->drawable.depth; - int fg, pm; + int fg = 0, pm; if(!infoRec->pScrn->vtSema) goto BAILOUT; Index: xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c:1.9 xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c:1.10 --- xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c:1.9 Mon Mar 27 20:21:05 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c Sat Oct 27 23:34:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c,v 1.9 2000/03/28 01:21:05 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c,v 1.10 2001/10/28 03:34:04 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -33,7 +33,7 @@ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable)); int nBox = REGION_NUM_RECTS(prgn); BoxPtr pBox = REGION_RECTS(prgn); - int fg; + int fg = -1; PixmapPtr pPix = NULL; if(!infoRec->pScrn->vtSema) goto BAILOUT; Index: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.12 xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.14 --- xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.12 Sat Apr 21 19:32:56 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c Sun Jun 3 15:47:59 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.12 2001/04/21 23:32:56 mvojkovi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.14 2001/06/03 19:47:59 mvojkovi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -191,8 +191,9 @@ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); RegionRec region; CARD32 *formats; + int flags = 0; BoxPtr pbox; - int nbox; + int nbox, w, h; if(!REGION_NUM_RECTS(pDst->pCompositeClip)) return TRUE; @@ -227,7 +228,7 @@ /* pull out color expandable operations here */ if((pMask->format == PICT_a1) && (alpha == 0xffff) && - (op == PictOpOver) && infoRec->WriteBitmap && + (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat && !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) && (!(infoRec->WriteBitmapFlags & RGB_EQUAL) || (red == green == blue))) @@ -269,12 +270,27 @@ return TRUE; } + if(!(formats = infoRec->CPUToScreenAlphaTextureFormats)) + return FALSE; + + w = pMask->pDrawable->width; + h = pMask->pDrawable->height; + + if(pMask->repeat) { + if((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE) || + ((infoRec->CPUToScreenAlphaTextureFlags & + XAA_RENDER_POWER_OF_2_TILE_ONLY) && + ((h & (h - 1)) || (w & (w - 1))))) + { + return FALSE; + } + flags |= XAA_RENDER_REPEAT; + } + if((alpha != 0xffff) && (infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA)) return FALSE; - formats = infoRec->CPUToScreenAlphaTextureFormats; - while(*formats != pMask->format) { if(!(*formats)) return FALSE; formats++; @@ -297,7 +313,7 @@ op, red, green, blue, alpha, pMask->format, ((PixmapPtr)(pMask->pDrawable))->devPrivate.ptr, ((PixmapPtr)(pMask->pDrawable))->devKind, - pMask->pDrawable->width, pMask->pDrawable->height, 0)) + w, h, flags)) { REGION_UNINIT(pScreen, ®ion); return FALSE; @@ -319,8 +335,24 @@ return TRUE; } } else { - formats = infoRec->CPUToScreenTextureFormats; + if(!(formats = infoRec->CPUToScreenTextureFormats)) + return FALSE; + w = pSrc->pDrawable->width; + h = pSrc->pDrawable->height; + + if(pSrc->repeat) { + if((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) || + ((infoRec->CPUToScreenTextureFlags & + XAA_RENDER_POWER_OF_2_TILE_ONLY) && + ((h & (h - 1)) || (w & (w - 1))))) + { + return FALSE; + } + flags |= XAA_RENDER_REPEAT; + } + + while(*formats != pSrc->format) { if(!(*formats)) return FALSE; formats++; @@ -339,12 +371,11 @@ return TRUE; } - if(!(infoRec->SetupForCPUToScreenTexture)(infoRec->pScrn, op, pSrc->format, ((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr, ((PixmapPtr)(pSrc->pDrawable))->devKind, - pSrc->pDrawable->width, pSrc->pDrawable->height, 0)) + w, h, flags)) { REGION_UNINIT(pScreen, ®ion); return FALSE; Index: xc/programs/Xserver/hw/xfree86/xaa/xaaSpans.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaSpans.c:1.14 xc/programs/Xserver/hw/xfree86/xaa/xaaSpans.c:1.15 --- xc/programs/Xserver/hw/xfree86/xaa/xaaSpans.c:1.14 Mon Mar 27 20:21:05 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaSpans.c Sat Oct 27 23:34:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaSpans.c,v 1.14 2000/03/28 01:21:05 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaSpans.c,v 1.15 2001/10/28 03:34:04 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -181,6 +181,10 @@ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); fg = pPriv->fg; bg = pPriv->bg; break; + default: /* Muffle compiler */ + pPriv = NULL; /* Kaboom */ + fg = -1; bg = -1; + break; } (*infoRec->FillMono8x8PatternSpans) (infoRec->pScrn, @@ -206,24 +210,24 @@ ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); XAACacheInfoPtr pCache; - XAAPixmapPtr pPriv; PixmapPtr pPix; int fg, bg; switch(pGC->fillStyle) { case FillStippled: pPix = pGC->stipple; - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); fg = pGC->fgPixel; bg = -1; break; case FillOpaqueStippled: pPix = pGC->stipple; - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); fg = pGC->fgPixel; bg = pGC->bgPixel; break; case FillTiled: pPix = pGC->tile.pixmap; - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); + fg = -1; bg = -1; + break; + default: /* Muffle compiler */ + pPix = NULL; fg = -1; bg = -1; break; } @@ -260,6 +264,9 @@ case FillOpaqueStippled: fg = pGC->fgPixel; bg = pGC->bgPixel; break; + default: /* Muffle compiler */ + fg = -1; bg = -1; + break; } (*infoRec->FillColorExpandSpans) (infoRec->pScrn, fg, bg, @@ -299,6 +306,9 @@ case FillTiled: pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap); break; + default: /* Muffle compiler */ + pCache = NULL; + break; } (*infoRec->FillCacheBltSpans) (infoRec->pScrn, @@ -332,6 +342,9 @@ case FillOpaqueStippled: fg = pGC->fgPixel; bg = pGC->bgPixel; break; + default: /* Muffle compiler */ + fg = -1; bg = -1; + break; } (*infoRec->FillCacheExpandSpans) (infoRec->pScrn, fg, bg, @@ -490,7 +503,7 @@ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); int patx = pattern0, paty = pattern1; int xorg, yorg, slot; - XAACacheInfoPtr pCache; + XAACacheInfoPtr pCache = NULL; if(!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)){ Index: xc/programs/Xserver/hw/xfree86/xaa/xaaStipple.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaStipple.c:1.10 xc/programs/Xserver/hw/xfree86/xaa/xaaStipple.c:1.11 --- xc/programs/Xserver/hw/xfree86/xaa/xaaStipple.c:1.10 Fri Sep 1 01:49:45 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaStipple.c Sat Oct 27 23:34:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaStipple.c,v 1.10 2000/09/01 05:49:45 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaStipple.c,v 1.11 2001/10/28 03:34:04 tsi Exp $ */ #include "xaa.h" #include "xaalocal.h" @@ -131,6 +131,8 @@ funcNo = 0; } StippleFunc = stipple_scanline_func[funcNo]; + SecondFunc = stipple_scanline_func[funcNo]; + FirstFunc = stipple_scanline_func[funcNo + 3]; #ifdef TRIPLE_BITS if((bg == -1) || @@ -149,8 +151,6 @@ } else { /* gotta do two passes */ TwoPass = TRUE; - SecondFunc = stipple_scanline_func[funcNo]; - FirstFunc = stipple_scanline_func[funcNo + 3]; } if(!TwoPass) @@ -266,6 +266,8 @@ funcNo = 0; } StippleFunc = stipple_scanline_func[funcNo]; + SecondFunc = stipple_scanline_func[funcNo]; + FirstFunc = stipple_scanline_func[funcNo + 3]; #ifdef TRIPLE_BITS if((bg == -1) || @@ -285,8 +287,6 @@ } else { /* gotta do two passes */ TwoPass = TRUE; - SecondFunc = stipple_scanline_func[funcNo]; - FirstFunc = stipple_scanline_func[funcNo + 3]; } if(!TwoPass) @@ -377,6 +377,8 @@ funcNo = 0; } StippleFunc = stipple_scanline_func[funcNo]; + SecondFunc = stipple_scanline_func[funcNo]; + FirstFunc = stipple_scanline_func[funcNo + 3]; #ifdef TRIPLE_BITS if((bg == -1) || @@ -395,8 +397,6 @@ } else { /* gotta do two passes */ TwoPass = TRUE; - SecondFunc = stipple_scanline_func[funcNo]; - FirstFunc = stipple_scanline_func[funcNo + 3]; } if(!TwoPass) @@ -490,6 +490,8 @@ funcNo = 0; } StippleFunc = stipple_scanline_func[funcNo]; + SecondFunc = stipple_scanline_func[funcNo]; + FirstFunc = stipple_scanline_func[funcNo + 3]; #ifdef TRIPLE_BITS if((bg == -1) || @@ -509,8 +511,6 @@ } else { /* gotta do two passes */ TwoPass = TRUE; - SecondFunc = stipple_scanline_func[funcNo]; - FirstFunc = stipple_scanline_func[funcNo + 3]; } if(!TwoPass) Index: xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c:1.7 xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c:1.10 --- xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c:1.7 Sun Oct 31 18:52:57 1999 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c Fri Nov 16 11:47:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c,v 1.7 1999/10/31 23:52:57 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c,v 1.10 2001/11/16 16:47:56 dawes Exp $ */ /* @@ -15,7 +15,7 @@ */ #ifndef XFree86LOADER -#ifdef _XOPEN_SOURCE +#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) #include <math.h> #else #define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ @@ -149,15 +149,20 @@ BoxPtr extents = infoRec->ClipBox; int left_x, left_e, left_stepx, left_signdx, left_dy, left_dx; int right_x, right_e, right_stepx, right_signdx, right_dy, right_dx; - int height; - int left_height = 0; - int right_height = 0; - int xorg = 0; + int height, left_height, right_height; + int xorg; Bool hardClip; if((y >= extents->y2) || ((y + overall_height) <= extents->y1)) return; + /* Muffle compiler */ + left_x = left_e = left_stepx = left_signdx = left_dy = left_dx = 0; + right_x = right_e = right_stepx = right_signdx = right_dy = right_dx = 0; + + left_height = right_height = 0; + xorg = 0; + hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL); while ((left_count || left_height) && (right_count || right_height)) { @@ -189,32 +194,22 @@ left_height -= height; right_height -= height; - if(infoRec->SubsequentSolidFillTrap && (height > 6)) { - int right_DX, left_DX, left_box, right_box; + if(hardClip && infoRec->SubsequentSolidFillTrap && (height > 6)) { + int right_DX, left_DX; right_DX = (right_dx * right_signdx) + (right_stepx * right_dy); left_DX = (left_dx * left_signdx) + (left_stepx * left_dy); - if(!hardClip) { - left_box = (left_DX < 0) ? (left_x + left_DX) : left_x; - right_box = (right_DX < 0) ? right_x : (right_x + right_DX); - } - - if(hardClip || ((left_box >= extents->x1) && - (right_box < extents->x2) && - (y >= extents->y1) && - ((y + height) < extents->y2))){ - (*infoRec->SubsequentSolidFillTrap)(infoRec->pScrn, y, height, + (*infoRec->SubsequentSolidFillTrap)(infoRec->pScrn, y, height, left_x, left_DX, left_dy, left_e, right_x - 1, right_DX, right_dy, right_e); - FixError(left_x, left_dx, left_dy, left_e, left_signdx, + FixError(left_x, left_dx, left_dy, left_e, left_signdx, left_stepx, height); - FixError(right_x, right_dx, right_dy, right_e, right_signdx, + FixError(right_x, right_dx, right_dy, right_e, right_signdx, right_stepx, height); - y += height; - continue; - } + y += height; + continue; } while (height--) { @@ -268,7 +263,7 @@ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL); /* draw top-to-bottom always */ - if (y2 < y1 || y2 == y1 && x2 < x1) { + if ((y2 < y1) || ((y2 == y1) && (x2 < x1))) { x = x1; x1 = x2; x2 = x; @@ -302,7 +297,6 @@ rightFace->dx = -dx; rightFace->dy = -dy; - if (!dy) { rightFace->xa = 0; rightFace->ya = (double) lw / 2.0; @@ -356,10 +350,8 @@ ya = -r * dx; xa = r * dy; - if (projectLeft | projectRight) { - projectXoff = -ya; - projectYoff = xa; - } + projectXoff = -ya; + projectYoff = xa; /* xa * dy - ya * dx */ k = l * L; @@ -624,6 +616,8 @@ if (isInt) { xorgi = leftFace ? leftFace->x : rightFace->x; yorgi = leftFace ? leftFace->y : rightFace->y; + } else { /* Muffle compiler */ + xorgi = yorgi = 0; } edgey1 = 65536; edgey2 = 65536; @@ -635,8 +629,8 @@ edgeleft2 = FALSE; if ((pGC->lineWidth > 2) && - (pGC->capStyle == CapRound && pGC->joinStyle != JoinRound || - pGC->joinStyle == JoinRound && pGC->capStyle == CapButt)) { + ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) || + (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) { if (isInt) { xorg = (double) xorgi; yorg = (double) yorgi; @@ -673,8 +667,8 @@ LineFacePtr pLeft, LineFacePtr pRight ) { - double mx, my; - double denom; + double mx = 0, my = 0; + double denom = 0; PolyVertexRec vertices[4]; PolySlopeRec slopes[4]; int edgecount; Index: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h diff -u xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.34 xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.35 --- xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.34 Sun Apr 15 19:16:01 2001 +++ xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h Thu Jul 19 14:50:16 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.34 2001/04/15 23:16:01 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.35 2001/07/19 18:50:16 mvojkovi Exp $ */ #ifndef _XAALOCAL_H #define _XAALOCAL_H @@ -97,6 +97,7 @@ int fg; int bg; FBAreaPtr offscreenArea; + Bool freeData; } XAAPixmapRec, *XAAPixmapPtr; Index: xc/programs/Xserver/hw/xfree86/xf24_32bpp/cfbgc.c diff -u xc/programs/Xserver/hw/xfree86/xf24_32bpp/cfbgc.c:1.2 xc/programs/Xserver/hw/xfree86/xf24_32bpp/cfbgc.c:1.3 --- xc/programs/Xserver/hw/xfree86/xf24_32bpp/cfbgc.c:1.2 Sat Aug 21 09:48:43 1999 +++ xc/programs/Xserver/hw/xfree86/xf24_32bpp/cfbgc.c Fri Dec 14 14:59:51 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf24_32bpp/cfbgc.c,v 1.2 1999/08/21 13:48:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf24_32bpp/cfbgc.c,v 1.3 2001/12/14 19:59:51 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c:1.4 Wed Oct 13 16:04:26 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c Tue Jul 31 20:44:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c,v 1.4 1999/10/13 20:04:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c,v 1.5 2001/08/01 00:44:56 tsi Exp $ */ /* * Copyright 1993 Gerrit Jan Akkerman * @@ -231,8 +231,8 @@ { register unsigned char bits ; unsigned const char *lineptr, *cptr ; - register shift ; - register wrap ; + register int shift ; + register int wrap ; x = x % Width; y = y % Height; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c:1.6 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c:1.6 Tue Sep 26 11:57:21 2000 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c Sat Oct 27 23:34:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c,v 1.6 2000/09/26 15:57:21 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcGC.c,v 1.7 2001/10/28 03:34:06 tsi Exp $ */ /* Copyright (c) 1987 X Consortium @@ -142,7 +142,7 @@ #ifdef NEED_LINEHELPER miMiter, /* void (* LineHelper)() */ #endif - NULL + {NULL} /* devPrivate */ }; Bool @@ -343,8 +343,6 @@ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) ) { - ScreenPtr pScreen = pGC->pScreen; - if (pWin) { RegionPtr pregWin; Bool freeTmpClip, freeCompClip; @@ -368,7 +366,7 @@ */ if (pGC->clientClipType == CT_NONE) { if (freeCompClip) - REGION_DESTROY(pScreen, pGC->pCompositeClip); + REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); pGC->pCompositeClip = pregWin; pGC->freeCompClip = freeTmpClip; } @@ -383,7 +381,7 @@ * neither is real, create a new region. */ - REGION_TRANSLATE(pScreen, pGC->clientClip, + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, pDrawable->x + pGC->clipOrg.x, pDrawable->y + pGC->clipOrg.y); @@ -392,22 +390,22 @@ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin, pGC->clientClip); if (freeTmpClip) - REGION_DESTROY(pScreen, pregWin); + REGION_DESTROY(pGC->pScreen, pregWin); } else if (freeTmpClip) { - REGION_INTERSECT(pScreen, pregWin, pregWin, + REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip); pGC->pCompositeClip = pregWin; } else { - pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0); - REGION_INTERSECT(pScreen, pGC->pCompositeClip, + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0); + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin, pGC->clientClip); } pGC->freeCompClip = TRUE; - REGION_TRANSLATE(pScreen, pGC->clientClip, + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, -(pDrawable->x + pGC->clipOrg.x), -(pDrawable->y + pGC->clipOrg.y)); @@ -423,19 +421,19 @@ pixbounds.y2 = pDrawable->height; if (pGC->freeCompClip) { - REGION_RESET(pScreen, pGC->pCompositeClip, &pixbounds); + REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds); } else { pGC->freeCompClip = TRUE; - pGC->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1); + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1); } if (pGC->clientClipType == CT_REGION) { - REGION_TRANSLATE(pScreen, pGC->pCompositeClip, + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x, -pGC->clipOrg.y); - REGION_INTERSECT(pScreen, pGC->pCompositeClip, + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pGC->pCompositeClip, pGC->clientClip); - REGION_TRANSLATE(pScreen, pGC->pCompositeClip, + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x, pGC->clipOrg.y); } } /* end of composute clip for pixmap */ Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcIO.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcIO.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcIO.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcIO.c:1.4 Sun Jun 6 04:48:59 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcIO.c Sat Oct 27 23:34:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcIO.c,v 1.4 1999/06/06 08:48:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcIO.c,v 1.5 2001/10/28 03:34:06 tsi Exp $ */ /* Copyright (c) 1990 X Consortium @@ -80,8 +80,7 @@ int xf4bppNeverCalled() { - ErrorF("xf4bppNeverCalled was nevertheless called\n"); - abort(); + FatalError("xf4bppNeverCalled was nevertheless called\n"); } static BSFuncRec ppcBSFuncRec = { Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcPixFS.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcPixFS.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcPixFS.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcPixFS.c:1.3 Sun Jun 6 04:49:00 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcPixFS.c Tue Jul 31 20:44:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcPixFS.c,v 1.3 1999/06/06 08:49:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcPixFS.c,v 1.4 2001/08/01 00:44:56 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -174,8 +174,8 @@ { register unsigned char bits ; register const unsigned char *cptr ; -register shift ; -register wrap ; +register int shift ; +register int wrap ; cptr = lineptr + ( x >> 3 ) ; bits = *cptr ; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcRslvC.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/ppcRslvC.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/ppcRslvC.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf4bpp/ppcRslvC.c:1.4 Sun Jun 6 04:49:01 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/ppcRslvC.c Mon Dec 17 15:00:46 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcRslvC.c,v 1.4 1999/06/06 08:49:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcRslvC.c,v 1.5 2001/12/17 20:00:46 dawes Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -137,10 +137,10 @@ void xf4bppResolveColor( pred, pgreen, pblue, pVisual ) -register unsigned short* const pred ; -register unsigned short* const pgreen ; -register unsigned short* const pblue ; -register VisualPtr const pVisual ; +register unsigned short* pred ; +register unsigned short* pgreen ; +register unsigned short* pblue ; +register VisualPtr pVisual ; { unsigned lim, maxent, shift; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c:1.3 Sun Jun 6 04:49:07 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c Tue Jul 31 20:44:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c,v 1.3 1999/06/06 08:49:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaSolid.c,v 1.4 2001/08/01 00:44:56 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -171,9 +171,9 @@ register const int ly ; /* MUST BE > 0 !! */ { register volatile unsigned char *dst ; -register tmp ; -register tmp2 ; -register tmp3 ; +register int tmp ; +register int tmp2 ; +register int tmp3 ; unsigned int data_rotate_value = VGA_COPY_MODE ; unsigned int read_write_modify = FALSE ; unsigned int invert_existing_data = FALSE ; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.3 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.3 Sun Jun 6 04:49:07 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c Tue Jul 31 20:44:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c,v 1.3 1999/06/06 08:49:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c,v 1.4 2001/08/01 00:44:56 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -42,8 +42,8 @@ { register unsigned char bits ; register const unsigned char *cptr ; -register shift ; -register wrap ; +register int shift ; +register int wrap ; cptr = lineptr + ( x >> 3 ) ; bits = *cptr ; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.18 xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.20 --- xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.18 Sun Apr 22 04:36:31 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile Mon Jul 9 19:45:24 2001 @@ -1,10 +1,10 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.18 2001/04/22 08:36:31 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.20 2001/07/09 23:45:24 paulo Exp $ XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic #if DoLoadableServer -LDSRCS = libc_wrapper.c loader.c -LDOBJS = libc_wrapper.o loader.o +LDSRCS = libc_wrapper.c loader.c loadmod.c +LDOBJS = libc_wrapper.o loader.o loadmod.o #endif #if HasNCurses @@ -83,7 +83,8 @@ LOADERLIB = -L../loader -lxloader -L../dummylib -ldummy MODULEDEFINES = -DUSE_MODULES INCLUDES = -I../common -I../loader -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(FONTLIBSRC)/include #if !HasSnprintf SNPRINTF_DEFS = -DNEED_SNPRINTF #endif Index: xc/programs/Xserver/hw/xfree86/xf86cfg/TODO diff -u /dev/null xc/programs/Xserver/hw/xfree86/xf86cfg/TODO:1.1 --- /dev/null Fri Jan 18 15:26:28 2002 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/TODO Wed Jul 4 12:09:14 2001 @@ -0,0 +1,33 @@ +$XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/TODO,v 1.1 2001/07/04 16:09:14 paulo Exp $ + +o Have code to fetch the SymTabRec chipset list from a video driver. + This is mostly useful for the testing tool/interface, so that the + Cards file "uptodate" state can also be verified. + Probably it is better to forgot about the Cards file, and + either parse the output of scanpci, or link libscanpci.a + (and whatever else be required) in xf86cfg. + +o Check if a module is "certified", there was some talk about a + certification process in the past. + +o Rewrite mouse driver to use the same code as video drivers, so that + it is possible to store all available options in a single place. + This would also require rewriting all existing input device modules. + (Probably most of this can be made with cpp macros). + +o Create a protocol to allow 3rd part xf86cfg modules. + +o Write an interface for testing extensions/accel, maybe a frontend to + xdpyinfo, x11perf, glxinfo, etc. + +o Write a "wizard" mode, as several users find the graphical interface + too complicated, but find the text one easier to user. + +o Write code to use a Monitors database, either update the old Monitors + file or use RedHat MonitorsDB. + Chris Morgan is writting code to use MonitorsDB. + If xf86cfg could be changed to ddcprobe (in all supported platforms), + it would be even be a better solution than using a database. + +o Add interface to allow changing comments without the need of editing + XF86Config with a text editor. Index: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad:1.13 xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad:1.14 --- xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad:1.13 Tue May 15 14:22:23 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad Fri Jun 22 21:45:56 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.13 2001/05/15 18:22:23 paulo Exp $ +!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.14 2001/06/23 01:45:56 paulo Exp $ !! *Form.background: gray85 @@ -469,6 +469,8 @@ <Message>WM_PROTOCOLS: error-cancel() .xf86cfg.force.translations: #override \ <Message>WM_PROTOCOLS: addmode-cancel() +.xf86cfg.addMode.translations: #override \ +<Message>WM_PROTOCOLS: addmode-cancel() .xf86cfg.accessx.translations: #override \ <Message>WM_PROTOCOLS: accessx-close() .xf86cfg.test.translations: #override \ @@ -818,6 +820,16 @@ .xf86cfg.force.maxHeight: 58 .xf86cfg.force.?.label: There is already a modeline with the\n\ specified identifier. Add anyway? + +.xf86cfg.addMode.geometry: 350x80 +.xf86cfg.addMode.minWidth: 350 +.xf86cfg.addMode.maxWidth: 350 +.xf86cfg.addMode.minHeight: 80 +.xf86cfg.addMode.maxHeight: 80 +.xf86cfg.addMode.?.label: XF86VidModeAddModeLine returned True,\n\ +but no modeline was added to the current Screen.\n\ +Do you want to add it to the Monitor section? + .xf86cfg.test.?.label: \ Testing modeline...\n\n\ Press ESC or stop button to quit. .xf86cfg.test.geometry: 250x72 Index: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c:1.6.2.2 xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c:1.11 --- xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c:1.6.2.2 Wed May 23 10:45:15 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c Thu Nov 1 14:08:58 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.6.2.2 2001/05/23 14:45:15 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.11 2001/11/01 19:08:58 paulo Exp $ */ #include "xf86config.h" @@ -258,14 +258,16 @@ { Arg args[1]; XawListReturnStruct *info = (XawListReturnStruct *)call_data; - char tip[4096], *str; + char tip[4096]; int len; - static int first = 1; XtSetArg(args[0], XtNstring, info->string); XtSetValues(filter, args, 1); card_entry = LookupCard(info->string); + if (card_entry == NULL) + return; + len = XmuSnprintf(tip, sizeof(tip), "Name: %s\n", card_entry->name); if (card_entry->flags & F_UNSUPPORTED) len += XmuSnprintf(tip + len, sizeof(tip) - len, @@ -297,25 +299,13 @@ len += XmuSnprintf(tip + len, sizeof(tip) - len, "\n%s\n", card_entry->lines); - /* the first tip memory, if any, cannot be released */ - if (!first) { - XtSetArg(args[0], XtNtip, &str); - XtGetValues(filter, args, 1); - XtFree(str); - } - else - first = 0; - #ifndef USE_MODULES - if (!nomodules) { - XtSetArg(args[0], XtNstring, - card_entry->driver ? card_entry->driver : "vga"); - XtSetValues(driver, args, 1); - } + XtSetArg(args[0], XtNstring, + card_entry->driver ? card_entry->driver : "vga"); + XtSetValues(driver, args, 1); #endif - str = XtNewString(tip); - XtSetArg(args[0], XtNtip, str); + XtSetArg(args[0], XtNtip, tip); XtSetValues(filter, args, 1); } Index: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c:1.1 xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c:1.11 --- xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c:1.1 Tue Apr 4 18:36:57 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c Sat Oct 27 23:34:06 2001 @@ -26,11 +26,14 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c,v 1.1 2000/04/04 22:36:57 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c,v 1.11 2001/10/28 03:34:06 tsi Exp $ */ +#define CARDS_PRIVATE #include "cards.h" +#undef SERVER /* defined in config.h, but of no use here */ + /* return values from ReadCardsLine. */ #define ERROR -3 #define UNKNOWN -2 @@ -54,7 +57,20 @@ static int ReadCardsLine(FILE*, char*); /* must have 256 bytes */ static int CompareCards(_Xconst void *left, _Xconst void *right); static int BCompareCards(_Xconst void *left, _Xconst void *right); +static void DoReadCardsDatabase(void); +static char **DoFilterCardNames(char *pattern, int *result); + +#ifdef USE_MODULES +typedef struct { + int ivendor; + unsigned short vendor; + unsigned short valid_vendor; + char *chipsets; + int num_chipsets; +} chipset_check; +#endif + /* * Initialization */ @@ -66,9 +82,227 @@ /* * Implementation */ +#ifdef USE_MODULES +pciVendorDeviceInfo *xf86PCIVendorInfo; +SymTabPtr xf86PCIVendorNameInfo; +#endif + +#ifdef USE_MODULES +void +InitializePciInfo(void) +{ + xf86PCIVendorInfo = xf86PCIVendorInfoData; + xf86PCIVendorNameInfo = xf86PCIVendorNameInfoData; +} + void +CheckChipsets(xf86cfgModuleOptions *opts, int *err) +{ + int i, j, ichk, ivnd, vendor = -1, device; + SymTabPtr chips = opts->chipsets; + chipset_check *check = NULL; + int num_check = 0; + + if (!chips) { + CheckMsg(CHECKER_NO_CHIPSETS, "WARNING No chipsets specified.\n"); + ++*err; + return; + } + + while (chips->name) { + device = chips->token & 0xffff; + vendor = (chips->token & 0xffff0000) >> 16; + if (vendor == 0) + vendor = opts->vendor; + + for (ichk = 0; ichk < num_check; ichk++) + if (check[ichk].vendor == vendor) + break; + if (ichk >= num_check) { + check = (chipset_check*) + XtRealloc((XtPointer)check, + sizeof(chipset_check) * (num_check + 1)); + check[num_check].vendor = vendor; + memset(&check[num_check], 0, sizeof(chipset_check)); + ++num_check; + } + + /* Search for vendor in xf86PCIVendorInfoData */ + for (ivnd = 0; xf86PCIVendorInfoData[ivnd].VendorID; ivnd++) + if (vendor == xf86PCIVendorInfoData[ivnd].VendorID) + break; + if (xf86PCIVendorInfoData[ivnd].VendorID) { + check[ichk].valid_vendor = 1; + check[ichk].ivendor = ivnd; + } + else { + CheckMsg(CHECKER_CANNOT_VERIFY_CHIPSET, + "WARNING Cannot verify chipset \"%s\" (0x%x)\n", + chips->name, device); + ++*err; + ++chips; + continue; + } + + if (check[ichk].chipsets == NULL) { + for (j = 0; xf86PCIVendorInfoData[ivnd].Device[j].DeviceName; j++) + ; + check[ichk].chipsets = (char*)XtCalloc(1, j); + } + for (j = 0; xf86PCIVendorInfoData[ivnd].Device[j].DeviceName; j++) { + if (device == xf86PCIVendorInfoData[ivnd].Device[j].DeviceID) { + if (strcmp(chips->name, xf86PCIVendorInfoData[ivnd].Device[j].DeviceName)) { + CheckMsg(CHECKER_NOMATCH_CHIPSET_STRINGS, + "WARNING chipset strings don't match: \"%s\" \"%s\" (0x%x)\n", + chips->name, xf86PCIVendorInfoData[ivnd].Device[j].DeviceName, + device); + ++*err; + } + break; + } + } + if (!xf86PCIVendorInfoData[ivnd].Device[j].DeviceName) { + CheckMsg(CHECKER_CHIPSET_NOT_LISTED, + "WARNING chipset \"%s\" (0x%x) not in list.\n", chips->name, device); + ++*err; + } + else + check[ichk].chipsets[j] = 1; + + ++chips; + } + + for (i = 0; i < num_check; i++) { + if (!check[i].valid_vendor) { + CheckMsg(CHECKER_CHIPSET_NO_VENDOR, + "WARNING No such vendor 0x%x\n", vendor); + ++*err; + } + for (j = 0; j < check[i].num_chipsets; j++) { + if (!check[i].chipsets[j]) { + CheckMsg(CHECKER_CHIPSET_NOT_SUPPORTED, + "NOTICE chipset \"%s\" (0x%x) not listed as supported.\n", + xf86PCIVendorInfoData[check[i].ivendor].Device[j].DeviceName, + xf86PCIVendorInfoData[check[i].ivendor].Device[j].DeviceID); + } + } + XtFree(check[i].chipsets); + } + + XtFree((XtPointer)check); +} +#endif + +void ReadCardsDatabase(void) { +#ifdef USE_MODULES + if (!nomodules) { + int i, j, ivendor, idevice; + char name[256]; + _Xconst char *vendor, *device; + CardsEntry *entry = NULL, *tmp; + xf86cfgModuleOptions *opts = module_options; + + /* Only list cards that have a driver installed */ + while (opts) { + if (opts->chipsets) { + SymTabPtr chips = opts->chipsets; + + while (chips->name) { + vendor = opts->name; + device = chips->name; + ivendor = (chips->token & 0xffff0000) >> 16; + idevice = chips->token & 0xffff0; + if (ivendor == 0) + ivendor = opts->vendor; + + for (i = 0; xf86PCIVendorInfoData[i].VendorID; i++) + if (ivendor == xf86PCIVendorInfoData[i].VendorID) + break; + if (xf86PCIVendorInfoData[i].VendorID) { + for (j = 0; xf86PCIVendorNameInfoData[j].name; j++) + if (xf86PCIVendorNameInfoData[j].token == ivendor) { + vendor = xf86PCIVendorNameInfoData[j].name; + break; + } + + for (j = 0; xf86PCIVendorInfoData[i].Device[j].DeviceName; j++) + if (idevice == xf86PCIVendorInfoData[i].Device[j].DeviceID) + break; + + if (xf86PCIVendorInfoData[i].Device[j].DeviceName) + device = xf86PCIVendorInfoData[i].Device[j].DeviceName; + } + + /* Since frequently there is more than one driver for a + * single vendor, it is required to avoid duplicates. + */ + XmuSnprintf(name, sizeof(name), "%s %s", vendor, device); + tmp = LookupCard(name); + + if (tmp == NULL || strcmp(tmp->chipset, chips->name) || + strcmp(tmp->driver, opts->name)) { + entry = (CardsEntry*)XtCalloc(1, sizeof(CardsEntry)); + if (NumCardsEntry % 16 == 0) { + CardsDB = (CardsEntry**)XtRealloc((XtPointer)CardsDB, + sizeof(CardsEntry*) * (NumCardsEntry + 16)); + } + CardsDB[NumCardsEntry++] = entry; + entry->name = XtNewString(name); + + /* XXX no private copy of strings */ + entry->chipset = (char*)chips->name; + entry->driver = opts->name; + + /* better than linear searchs to find duplicates */ + qsort(CardsDB, NumCardsEntry, sizeof(CardsEntry*), + CompareCards); + } + ++chips; + } + } + opts = opts->next; + } + + /* fix entries with the same name */ + for (i = 0; i < NumCardsEntry - 2;) { + for (j = i + 1; j < NumCardsEntry - 1 && + strcmp(CardsDB[i]->name, CardsDB[j]->name) == 0; j++) + ; + + if (i + 1 != j) { + while (i < j) { + char *str; + + if (strcmp(CardsDB[i]->chipset, CardsDB[j]->chipset)) + str = CardsDB[i]->chipset; + else + str = CardsDB[i]->driver; + + XmuSnprintf(name, sizeof(name), "%s (%s)", + CardsDB[i]->name, str); + XtFree(CardsDB[i]->name); + CardsDB[i]->name = XtNewString(name); + + ++i; + } + } + else + ++i; + } + + /* make sure data is valid to bsearch in */ + qsort(CardsDB, NumCardsEntry, sizeof(CardsEntry*), CompareCards); + } + else +#endif + DoReadCardsDatabase(); +} + +static void +DoReadCardsDatabase(void) +{ char buffer[256]; FILE *fp = fopen(Cards, "r"); int i, result; @@ -107,8 +341,10 @@ if (entry == NULL || entry->chipset != NULL) { fprintf(stderr, CardsError, linenum, buffer); } +#if 0 else entry->chipset = strdup(buffer); +#endif break; case SERVER: if (entry == NULL || entry->server != NULL) { @@ -281,6 +517,36 @@ char ** FilterCardNames(char *pattern, int *result) { +#ifdef USE_MODULES + if (!nomodules) { + char **cards = NULL; + int i, ncards = 0; + + for (i = 0; i < NumCardsEntry; i++) { + if (strstr(CardsDB[i]->name, pattern) == NULL) + continue; + if (ncards % 16 == 0) { + if ((cards = (char**)realloc(cards, sizeof(char*) * + (ncards + 16))) == NULL) { + fprintf(stderr, "Out of memory.\n"); + exit(1); + } + } + cards[ncards] = strdup(CardsDB[i]->name); + ++ncards; + } + + *result = ncards; + + return (cards); + } +#endif + return (DoFilterCardNames(pattern, result)); +} + +static char ** +DoFilterCardNames(char *pattern, int *result) +{ FILE *fp; char **cards = NULL; int len, ncards = 0; @@ -414,49 +680,11 @@ static int CompareCards(_Xconst void *left, _Xconst void *right) { - return strcmp((*(CardsEntry**)left)->name, (*(CardsEntry**)right)->name); + return strcasecmp((*(CardsEntry**)left)->name, (*(CardsEntry**)right)->name); } static int BCompareCards(_Xconst void *name, _Xconst void *card) { - return (strcmp((char*)name, (*(CardsEntry**)card)->name)); -} - -#ifdef TEST_CARDS -int -main(int argc, char *argv[]) -{ - int i; - - chdir("/usr/X11R6"); - ReadCardsDatabase(); - - for (i = 0; i < NumCardsEntry; i++) { - CardsEntry *entry = CardsDB[i]; - - printf("name: %s\n", entry->name); - if (entry->chipset) - printf("chipset: %s\n", entry->chipset); - if (entry->server) - printf("server: %s\n", entry->server); - if (entry->driver) - printf("driver: %s\n", entry->driver); - if (entry->ramdac) - printf("%s\n", entry->ramdac); - if (entry->clockchip) - printf("%s\n", entry->clockchip); - if (entry->dacspeed) - printf("%s\n", entry->dacspeed); - if (entry->flags & F_NOCLOCKPROBE) - printf("NOCLOCKPROBE\n"); - if (entry->flags & F_UNSUPPORTED) - printf("UNSUPPORTED\n"); - if (entry->lines) - printf("%s\n", entry->lines); - printf("\n"); - } - - return (0); + return (strcasecmp((char*)name, (*(CardsEntry**)card)->name)); } -#endif /* TEST_CARDS */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h:1.1 xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h:1.2 --- xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h:1.1 Tue Apr 4 18:36:57 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h Thu Jul 5 22:04:10 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h,v 1.1 2000/04/04 22:36:57 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h,v 1.2 2001/07/06 02:04:10 paulo Exp $ */ #include <stdio.h> @@ -34,10 +34,24 @@ #include <string.h> #include <ctype.h> #include <X11/Xfuncproto.h> +#include <X11/Xmd.h> +#include <X11/Intrinsic.h> +#include <X11/Xmu/SysUtil.h> #ifndef _xf86cfg_cards_h #define _xf86cfg_cards_h +#ifdef USE_MODULES +#ifdef CARDS_PRIVATE +#include "loader.h" + +#define SELF_CONTAINED_PCI_INFO +#define INIT_PCI_VENDOR_NAME_INFO +#define INIT_PCI_VENDOR_INFO +#include "xf86PciInfo.h" +#endif /* CARDS_PRIVATE */ +#endif /* USE_MODULES */ + /* Flags in CardsEntry */ #define F_NOCLOCKPROBE 0x1 /* Never probe clocks of the card. */ #define F_UNSUPPORTED 0x2 /* Card is not supported (only VGA). */ @@ -69,5 +83,10 @@ CardsEntry *LookupCard(char*); char **GetCardNames(int*); char **FilterCardNames(char*, int*); +#ifdef USE_MODULES +void InitializePciInfo(void); +typedef struct _xf86cfgModuleOptions *xf86cfgModuleOptionsPtr; +void CheckChipsets(xf86cfgModuleOptionsPtr, int*); +#endif #endif /* _xf86cfg_cards_h */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/config.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/config.c:1.6 xc/programs/Xserver/hw/xfree86/xf86cfg/config.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/config.c:1.6 Fri Dec 8 16:51:04 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/config.c Mon Oct 1 09:44:15 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.c,v 1.6 2000/12/08 21:51:04 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.c,v 1.7 2001/10/01 13:44:15 eich Exp $ */ #include "config.h" @@ -116,7 +116,7 @@ /* Read initial configuration */ if ((filename = xf86openConfigFile(getuid() == 0 ? CONFPATH : USER_CONFPATH, XF86Config_path, NULL)) == NULL) { - fprintf(stderr, "Cannot to open config file.\n"); + fprintf(stderr, "Cannot open config file.\n"); exit(1); } XF86Config_path = (char *)filename; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.10.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.15 --- xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.10.2.1 Mon May 21 18:24:02 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/config.h Fri Aug 17 18:08:15 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.10.2.1 2001/05/21 22:24:02 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.15 2001/08/17 22:08:15 tsi Exp $ */ #include <X11/IntrinsicP.h> @@ -37,14 +37,11 @@ #include <dirent.h> #include <string.h> #include <unistd.h> +#if defined(sun) && defined(SVR4) +#include <strings.h> +#endif -#if NeedVarargsPrototypes #include <stdarg.h> -#define Va_start(a,b) va_start(a,b) -#else -#include <varargs.h> -#define Va_start(a,b) va_start(a) -#endif #ifdef __EMX__ #define strcasecmp stricmp @@ -94,6 +91,12 @@ #define UNUSED 0 #define USED 1 +#define CONFIG_LAYOUT 0 +#define CONFIG_SCREEN 1 +#define CONFIG_MODELINE 2 +#define CONFIG_ACCESSX 3 +extern int config_mode; + #define CONFPATH "%A," "%R," \ "/etc/X11/%R," "%P/etc/X11/%R," \ "%E," "%F," \ @@ -217,6 +220,8 @@ extern Atom wm_delete_window; extern Display *DPY; extern Pixmap menuPixmap; -extern Bool nomodules; +#ifdef USE_MODULES +extern int nomodules; +#endif #endif /* _xf86cfg_config_h */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.8.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.12 --- xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.8.2.1 Mon May 21 18:24:02 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c Sat Jul 7 20:44:33 2001 @@ -26,15 +26,17 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.8.2.1 2001/05/21 22:24:02 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.12 2001/07/08 00:44:33 paulo Exp $ */ #include "config.h" #include "xf86config.h" #include "options.h" #include "screen.h" +#include "vidmode.h" #include "monitor-cfg.h" #include <X11/Shell.h> +#include <X11/CompositeP.h> #include <X11/Xaw/AsciiText.h> #include <X11/Xaw/Box.h> #include <X11/Xaw/Command.h> @@ -258,6 +260,7 @@ static void CreateInputField(TreeNode*, Bool); static void InputDestroy(TreeNode*); static void NewInputCallback(Widget, XtPointer, XtPointer); +static void InputUpdate(TreeNode*); static void CreateLayout(TreeNode*, XF86ConfLayoutPtr); static void CreateLayoutField(TreeNode*, Bool); @@ -294,14 +297,21 @@ static void NewBuffersCallback(Widget, XtPointer, XtPointer); static void BuffersUpdate(TreeNode*); -extern void CreateOptionsShell(void); extern void RemoveDeviceCallback(Widget, XtPointer, XtPointer); +/* interface.c */ +extern void InitializeDevices(void); +extern void SelectLayoutCallback(Widget, XtPointer, XtPointer); +extern void UpdateMenuDeviceList(int); +extern void SetConfigModeCallback(Widget, XtPointer, XtPointer); +extern void DefaultLayoutCallback(Widget, XtPointer, XtPointer); +extern void RemoveLayoutCallback(Widget, XtPointer, XtPointer); + /* * Initialization */ static Widget shell, expert, tree, panner; -extern Widget work, optionsShell, config; +extern Widget work, optionsShell, config, layoutp, topMenu; extern xf86cfgDevice cpu_device; static TreeNode *mainNode, *monitorTree, *screenTree, *layoutTree; @@ -322,35 +332,13 @@ void ExpertConfigureEnd(void) { - int i; + int i, save_config_mode = config_mode; + Widget sme, layopt, layoutsme = NULL; + XF86ConfLayoutPtr lay; XtVaSetValues(optionsShell, XtNtransientFor, toplevel, NULL, 0); XtPopdown(shell); - for (i = 0; i < computer.num_screens; i++) { - XF86OptionPtr option, options; - int rotate; - - options = computer.screens[i]->screen->scrn_option_lst; - if ((option = xf86findOption(options, "Rotate")) != NULL) { - if (option->opt_val != NULL) - rotate = strcasecmp(option->opt_val, "CW") == 0 ? 1 : - strcasecmp(option->opt_val, "CCW") == 0 ? -1 : 0; - XtFree(option->opt_val); - option->opt_val = XtNewString(rotate > 0 ? "CW" : "CCW"); - computer.screens[i]->rotate = rotate; - } - else - computer.screens[i]->rotate = 0; - UpdateScreenUI(); - AdjustScreenUI(); - SetTip((xf86cfgDevice*)computer.screens[i]); - } - if (XF86Config->conf_flags && XF86Config->conf_flags->flg_option_lst) - SetTip(&cpu_device); - for (i = 0; i < computer.num_devices; i++) - SetTip(computer.devices[i]); - /* Need to do this to avoid all code elsewhere needing to update the * "expert" widget tree */ @@ -358,6 +346,94 @@ DestroyTree(mainNode); XtDestroyWidget(shell); expert = NULL; + + if (save_config_mode != CONFIG_LAYOUT) + SetConfigModeCallback(topMenu, (XtPointer)CONFIG_LAYOUT, NULL); + + /* Reset everything as the "expert" interface can do almost anything + * to the configuration. + */ + for (i = 0; i < computer.num_screens; i++) { + XtDestroyWidget(computer.screens[i]->widget); + XtFree((XtPointer)computer.screens[i]); + } + XtFree((XtPointer)computer.screens); + computer.screens = NULL; + computer.num_screens = 0; + + for (i = 0; i < computer.num_devices; i++) { + XtDestroyWidget(computer.devices[i]->widget); + XtFree((XtPointer)computer.devices[i]); + } + XtFree((XtPointer)computer.devices); + computer.devices = NULL; + computer.num_devices = 0; + + for (i = 0; i < computer.num_layouts; i++) { + XtFree((XtPointer)computer.layouts[i]->position); + XtFree((XtPointer)computer.layouts[i]); + } + XtFree((XtPointer)computer.layouts); + computer.layouts = NULL; + computer.num_layouts = 0; + + for (i = 0; i < computer.num_vidmodes; i++) + XtFree((XtPointer)computer.vidmodes[i]); + XtFree((XtPointer)computer.vidmodes); + computer.vidmodes = NULL; + computer.num_vidmodes = 0; + + /* Reinitialize devices/screens */ + InitializeDevices(); + UpdateMenuDeviceList(MOUSE); + UpdateMenuDeviceList(KEYBOARD); + UpdateMenuDeviceList(CARD); + UpdateMenuDeviceList(MONITOR); + + /* Update layout menu */ + /* first entry is "New server layout" */ + for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++) + XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]); + for (i = 0; i < layoutp->core.num_popups; i++) + XtDestroyWidget(layoutp->core.popup_list[i]); + lay = XF86Config->conf_layout_lst; + while (lay != NULL) { + sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, + layoutp, + XtNlabel, lay->lay_identifier, + XtNmenuName, lay->lay_identifier, + XtNleftBitmap, menuPixmap, + NULL, 0); + XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); + if (layoutsme == NULL) + layoutsme = sme; + layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass, + layoutp, NULL, 0); + sme = XtCreateManagedWidget("default", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); + sme = XtCreateManagedWidget("remove", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); + XtRealizeWidget(layopt); + + lay = (XF86ConfLayoutPtr)(lay->list.next); + } + computer.layout = NULL; + SelectLayoutCallback(layoutsme, + XF86Config->conf_layout_lst, NULL); + + + if (XF86Config->conf_flags && XF86Config->conf_flags->flg_option_lst) + SetTip(&cpu_device); + for (i = 0; i < computer.num_devices; i++) + SetTip(computer.devices[i]); + + /* Reinitialize vidmodes */ + InitializeVidmodes(); + + if (save_config_mode != CONFIG_LAYOUT) + SetConfigModeCallback(topMenu, (XtPointer)save_config_mode, NULL); } /*ARGSUSED*/ @@ -465,7 +541,7 @@ static void CreateFontPath(TreeNode *fontpath, char *path) { - TreeNode *prev, *node; + TreeNode *prev = NULL, *node; Widget w; if (path == NULL) { @@ -642,7 +718,7 @@ static void CreateModulePath(TreeNode *modulepath, char *path) { - TreeNode *prev, *node; + TreeNode *prev = NULL, *node; Widget w; if (path == NULL) { @@ -3362,6 +3438,7 @@ data->input.input = input; node = NewNode(parent, NULL, NULL, parent->node, data); node->destroy = InputDestroy; + node->update = InputUpdate; CreateInputField(node, False); if (parent->child == NULL) parent->child = node; @@ -3508,6 +3585,20 @@ RemoveDeviceCallback(NULL, NULL, NULL); } } +} + +static void +InputUpdate(TreeNode *node) +{ + char *str; + + /* vendor */ + XtVaGetValues(node->data->input.text, XtNstring, &str, NULL, 0); + XtFree(node->data->input.input->inp_driver); + if (*str) + node->data->input.input->inp_driver = XtNewString(str); + else + node->data->input.input->inp_driver = NULL; } /* Layout */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.4 xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.6 --- xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.4 Tue May 15 14:22:23 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/help.c Sat Oct 27 23:34:06 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.4 2001/05/15 18:22:23 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.6 2001/10/28 03:34:06 tsi Exp $ */ #include <X11/IntrinsicP.h> @@ -42,9 +42,7 @@ #include <X11/Xaw/TextSrcP.h> #include <X11/Xmu/SysUtil.h> #include <X11/Xmu/Xmu.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> /* for bsearch() */ -#endif #include <ctype.h> #include "help.h" #include "options.h" @@ -1242,9 +1240,9 @@ static void Html_FormatTag(Html_Parser *parser) { - int ch, sz = 0; + int ch = 0, sz = 0; char buf[32]; - Html_TagInfo *info; + Html_TagInfo *info = NULL; switch (Html_Peek(parser)) { case '!': @@ -1686,7 +1684,7 @@ } } else if (strcmp(name, "size") == 0) { - int size, sign; + int size, sign = 0; if (isalnum(*value)) { size = atoi(value); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.23.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.33 --- xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.23.2.1 Mon May 21 18:24:02 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c Fri Nov 30 07:12:04 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.23.2.1 2001/05/21 22:24:02 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.33 2001/11/30 12:12:04 eich Exp $ */ #include <X11/IntrinsicP.h> @@ -101,7 +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); +void UpdateMenuDeviceList(int); extern void AccessXConfigureStart(void); extern void AccessXConfigureEnd(void); @@ -111,10 +111,12 @@ extern void TextMode(void); #endif +static void Usage(void); + /* * Initialization */ -Widget toplevel, work, config, layout, layoutsme, layoutp; +Widget toplevel, work, config, layout, layoutsme, layoutp, topMenu; XtAppContext appcon; Pixmap menuPixmap; @@ -130,12 +132,16 @@ static char XkbConfig_path_static[1024]; Bool xf86config_set = False; -Bool textmode = False, nomodules = False; +int textmode = False; +#ifdef USE_MODULES +int nomodules = False; +#endif +int noverify = False; xf86cfgComputer computer; xf86cfgDevice cpu_device; Cursor no_cursor; -static Widget device, menu, layoutm, popup, commands; +static Widget device, layoutm, popup, commands; static int xpos, ypos; int sxpos, sypos; static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 }; @@ -145,11 +151,7 @@ static Widget mouseSme, mouseMenu, keyboardSme, keyboardMenu, cardSme, cardMenu, monitorSme, monitorMenu; -#define CONFIG_LAYOUT 0 -#define CONFIG_SCREEN 1 -#define CONFIG_MODELINE 2 -#define CONFIG_ACCESSX 3 -static int config_mode = CONFIG_LAYOUT; +int config_mode = CONFIG_LAYOUT; static XtActionsRec actions[] = { {"filter-card", CardFilterAction}, @@ -166,7 +168,7 @@ {"options-cancel", OptionsCancelAction}, {"error-cancel", ErrorCancelAction}, {"quit-cancel", QuitCancelAction}, - {"addmode-cancel", CancelForceAddModeAction}, + {"addmode-cancel", CancelAddModeAction}, {"accessx-close", CloseAccessXAction}, {"testmode-cancel", CancelTestModeAction}, {"help-close", HelpCancelAction}, @@ -198,12 +200,32 @@ 0, XtRString, "menu10"}, }; -/* -static XrmOptionDescRec optionDescList[] = { - {"-xf86config", "*xf86config", XrmoptionSepArg, (XtPointer)"/etc/X11/XF86Config"}, -}; -*/ +static void +Usage(void) +{ + fprintf(stderr, +"Usage:\n" +" xf86cfg [-option ...]\n" +"\n" +"Options:\n" +" -xf86config <XF86Config> Alternate configuration file.\n" +" -modulepath <module-path> XFree86 modules location.\n" +" -serverpath <server-path> X server to start (if $DISPLAY is not defined).\n" +" -fontpath <font-path> Font path for fonts.\n" +" -rgbpath <rgb-path> Where the rgb.txt file is located.\n" +#ifdef HAS_NCURSES +" -textmode Use this option for the text only interface.\n" +#endif +#ifdef USE_MODULES +" -nomodules Use this option if xf86cfg is slow to start.\n" +" -verbose <number> Verbosity used in the loader (default 1).\n" +#endif +" -verify Verify modules/options integrity.\n" +); + exit(1); +} + /* * Implementation */ @@ -220,15 +242,16 @@ char *menuPixmapPath = NULL; XrmValue from, to; -#ifdef USE_MODULES - xf86Verbose = 1; -#endif - if ((XFree86Dir = getenv("XWINHOME")) == NULL) XFree86Dir = DefaultXFree86Dir; chdir(XFree86Dir); +#ifdef USE_MODULES + xf86Verbose = 1; +#endif + noverify = True; + for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-xf86config") == 0) { if (i + 1 < argc) { @@ -252,8 +275,18 @@ else if (strcmp(argv[i], "-textmode") == 0) textmode = True; #endif +#ifdef USE_MODULES else if (strcmp(argv[i], "-nomodules") == 0) nomodules = True; + else if (strcmp(argv[i], "-verbose") == 0) { + if (i + 1 < argc) + xf86Verbose = atoi(argv[++i]); + } +#endif + else if (strcmp(argv[i], "-verify") == 0) + noverify = False; + else + Usage(); } #ifdef HAS_NCURSES @@ -269,7 +302,6 @@ if (XkbConfig_path == NULL) XkbConfig_path = XkbConfigDir XkbConfigFile; toplevel = XtAppInitialize(&appcon, "XF86Cfg", -/* optionDescList, XtNumber(optionDescList),*/ NULL, 0, &argc, argv, NULL, NULL, 0); @@ -297,12 +329,12 @@ toplevel, NULL, 0); hpane = XtVaCreateManagedWidget("hpane", panedWidgetClass, pane, XtNorientation, XtorientHorizontal, NULL, 0); - menu = XtCreateManagedWidget("topM", menuButtonWidgetClass, + topMenu = XtCreateManagedWidget("topM", menuButtonWidgetClass, hpane, NULL, 0); expert = XtCreateManagedWidget("expert", commandWidgetClass, hpane, NULL, 0); XtAddCallback(expert, XtNcallback, ExpertCallback, NULL); popup = XtCreatePopupShell("menu", simpleMenuWidgetClass, - menu, NULL, 0); + topMenu, NULL, 0); sme = XtCreateManagedWidget("layout", smeBSBObjectClass, popup, NULL, 0); XtAddCallback(sme, XtNcallback, SetConfigModeCallback, @@ -394,19 +426,8 @@ bottom, NULL, 0); XtAddCallback(quit, XtNcallback, QuitCallback, NULL); - layopt = XtCreatePopupShell("options", simpleMenuWidgetClass, - layoutp, NULL, 0); - sme = XtCreateManagedWidget("default", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); - sme = XtCreateManagedWidget("remove", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); - - XtRealizeWidget(layopt); - XtRealizeWidget(toplevel); - XtRealizeWidget(menu); + XtRealizeWidget(topMenu); pixmap = XCreateBitmapFromData(XtDisplay(toplevel), XtWindow(toplevel), no_cursor_data, 8, 8); @@ -446,26 +467,35 @@ UpdateMenuDeviceList(CARD); UpdateMenuDeviceList(MONITOR); XtSetSensitive(smemodeline, VideoModeInitialize()); - ReadCardsDatabase(); lay = XF86Config->conf_layout_lst; while (lay != NULL) { sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, layoutp, XtNlabel, lay->lay_identifier, - XtNmenuName, "options", + XtNmenuName, lay->lay_identifier, XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); if (layoutsme == NULL) layoutsme = sme; + layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass, + layoutp, NULL, 0); + sme = XtCreateManagedWidget("default", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); + sme = XtCreateManagedWidget("remove", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); + XtRealizeWidget(layopt); + lay = (XF86ConfLayoutPtr)(lay->list.next); } SelectLayoutCallback(layoutsme, XF86Config->conf_layout_lst, NULL); + startaccessx(); if (startedx) { - startaccessx(); switch (fork()) { case 0: { char path[PATH_MAX]; @@ -488,6 +518,9 @@ LoaderInitializeOptions(); #endif + /* ReadCardsDatabase() must be called after LoaderInitializeOptions() */ + ReadCardsDatabase(); + if (!config_set && startedx) { XtFree(XF86Config_path); #ifdef XF86CONFIG @@ -574,7 +607,7 @@ else { Arg args[2]; Cardinal num_args = 0; - char *l, *label, *str = ""; + char *l, *label = NULL, *str = ""; XtSetArg(args[0], XtNlabel, &l); XtGetValues(dialog, args, 1); @@ -747,23 +780,25 @@ keyboard_y = work->core.height - DEFAULT_KEYBOARD_HEIGHT; while (input != NULL) { - if (strcasecmp(input->inp_driver, "mouse") == 0) { - device = AddDevice(MOUSE, (XtPointer)input, mouse_x, mouse_y); - SetTip(device); - if ((mouse_x += DEFAULT_MOUSE_WIDTH) > work->core.width) { - if ((mouse_y -= DEFAULT_MOUSE_HEIGHT) < (work->core.height >> 1)) - mouse_y = work->core.height >> 1; - mouse_x = work->core.width - (work->core.width >> 2); - } - } - else if (strcasecmp(input->inp_driver, "keyboard") == 0) { - device = AddDevice(KEYBOARD, (XtPointer)input, keyboard_x, keyboard_y); - SetTip(device); - if ((keyboard_x += DEFAULT_KEYBOARD_WIDTH) > - work->core.width - (work->core.width >> 2)) { - if ((keyboard_y -= DEFAULT_KEYBOARD_HEIGHT) < (work->core.height >> 1)) - keyboard_y = work->core.height >> 1; - keyboard_x = 6; + if (input->inp_driver) { + if (strcasecmp(input->inp_driver, "mouse") == 0) { + device = AddDevice(MOUSE, (XtPointer)input, mouse_x, mouse_y); + SetTip(device); + if ((mouse_x += DEFAULT_MOUSE_WIDTH) > work->core.width) { + if ((mouse_y -= DEFAULT_MOUSE_HEIGHT) < (work->core.height >> 1)) + mouse_y = work->core.height >> 1; + mouse_x = work->core.width - (work->core.width >> 2); + } + } + else if (strcasecmp(input->inp_driver, "keyboard") == 0) { + device = AddDevice(KEYBOARD, (XtPointer)input, keyboard_x, keyboard_y); + SetTip(device); + if ((keyboard_x += DEFAULT_KEYBOARD_WIDTH) > + work->core.width - (work->core.width >> 2)) { + if ((keyboard_y -= DEFAULT_KEYBOARD_HEIGHT) < (work->core.height >> 1)) + keyboard_y = work->core.height >> 1; + keyboard_x = 6; + } } } input = (XF86ConfInputPtr)(input->list.next); @@ -907,10 +942,15 @@ XF86ConfLayoutPtr lay = (XF86ConfLayoutPtr)user_data; XF86ConfInputrefPtr input; XF86ConfAdjacencyPtr adj; + Widget sme, layopt; Arg args[1]; char *str; - if (lay == computer.layout) + /* XXX Needs to check computer.layout, + * because this function should also create + * a new layout... + */ + if (lay == computer.layout && computer.layout) return; if (computer.layout != NULL) { @@ -1003,8 +1043,8 @@ l = (XF86ConfLayoutPtr)(l->list.next); } do { - ++num_layouts; XmuSnprintf(name, sizeof(name), "Layout%d", num_layouts); + ++num_layouts; } while (xf86findLayout(name, XF86Config->conf_layout_lst) != NULL); l = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec)); @@ -1015,11 +1055,22 @@ layoutsme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, layoutp, XtNlabel, name, - XtNmenuName, "options", + XtNmenuName, l->lay_identifier, XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(layoutsme, XtNcallback, SelectLayoutCallback, (XtPointer)l); + + layopt = XtCreatePopupShell(l->lay_identifier, simpleMenuWidgetClass, + layoutp, NULL, 0); + sme = XtCreateManagedWidget("default", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); + sme = XtCreateManagedWidget("remove", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); + XtRealizeWidget(layopt); + computer.layout = l; XtSetArg(args[0], XtNstring, name); XtSetValues(layout, args, 1); @@ -1082,15 +1133,14 @@ void DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) { - Widget sme = (Widget)(((SimpleMenuWidget)(w->core.parent->core.parent)) - ->simple_menu.entry_set); + Widget layopt, sme; int i; char *str; - Arg args[1]; XF86ConfLayoutPtr prev, tmp, lay; - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(sme, args, 1); + str = w && XtParent(w) ? XtName(XtParent(w)) : NULL; + if (str == NULL) + return; prev = XF86Config->conf_layout_lst; lay = xf86findLayout(str, prev); @@ -1107,6 +1157,8 @@ for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++) XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]); + for (i = 0; i < layoutp->core.num_popups; i++) + XtDestroyWidget(layoutp->core.popup_list[i]); prev->list.next = lay->list.next; lay->list.next = XF86Config->conf_layout_lst; @@ -1118,12 +1170,22 @@ sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, layoutp, XtNlabel, lay->lay_identifier, - XtNmenuName, "options", + XtNmenuName, lay->lay_identifier, XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); if (layoutsme == NULL) layoutsme = sme; + layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass, + layoutp, NULL, 0); + sme = XtCreateManagedWidget("default", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); + sme = XtCreateManagedWidget("remove", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); + XtRealizeWidget(layopt); + lay = (XF86ConfLayoutPtr)(lay->list.next); } SelectLayoutCallback(layoutsme, @@ -1135,13 +1197,15 @@ RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) { XF86ConfLayoutPtr prev, tmp, lay, rem; - Widget sme = (Widget)(((SimpleMenuWidget)(w->core.parent->core.parent)) - ->simple_menu.entry_set); + Widget sme = NULL; + int i; char *str; Arg args[1]; + + str = w && XtParent(w) ? XtName(XtParent(w)) : NULL; + if (str == NULL) + return; - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(sme, args, 1); prev = XF86Config->conf_layout_lst; lay = xf86findLayout(str, prev); tmp = prev; @@ -1174,8 +1238,6 @@ SelectLayoutCallback(layoutsme, lay, NULL); } else { - int i; - computer.layout = NULL; XtSetArg(args[0], XtNstring, ""); XtSetValues(layout, args, 1); @@ -1185,22 +1247,30 @@ DrawCables(); } + for (i = 0; i < ((CompositeWidget)layoutp)->composite.num_children; i++) { + XtSetArg(args[0], XtNlabel, &str); + XtGetValues(((CompositeWidget)layoutp)->composite.children[i], args, 1); + if (strcmp(rem->lay_identifier, str) == 0) { + sme = ((CompositeWidget)layoutp)->composite.children[i]; + break; + } + } + xf86removeLayout(XF86Config, rem); - XtDestroyWidget(sme); + if (sme) + XtDestroyWidget(sme); } void SetTip(xf86cfgDevice *device) { - XF86OptionPtr option; + XF86OptionPtr option = NULL; char *tip, buffer[4096]; Arg args[1]; - int len; + int len = 0; XtSetArg(args[0], XtNtip, &tip); XtGetValues(device->widget, args, 1); - if (tip) - XtFree((XtPointer)tip); switch (device->type) { case MOUSE: { @@ -1288,7 +1358,7 @@ option = (XF86OptionPtr)(option->list.next); } - tip = XtNewString(buffer); + tip = buffer; XtSetArg(args[0], XtNtip, tip); XtSetValues(device->widget, args, 1); } @@ -1423,7 +1493,7 @@ OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data) { int i; - XF86OptionPtr *options; + XF86OptionPtr *options = NULL; #ifdef USE_MODULES xf86cfgModuleOptions *drv_opts = NULL; #endif @@ -1506,7 +1576,7 @@ #endif if (config_mode == CONFIG_SCREEN) { XF86OptionPtr option, options; - int rotate; + int rotate = 0; options = computer.screens[i]->screen->scrn_option_lst; if ((option = xf86findOption(options, "Rotate")) != NULL) { @@ -1736,7 +1806,7 @@ } } -static void +void UpdateMenuDeviceList(int type) { Widget sme = NULL, menu = NULL; @@ -2126,7 +2196,7 @@ XtSetArg(args[0], XtNlabel, &ptr); XtGetValues(w, args, 1); XtSetArg(args[0], XtNlabel, ptr); - XtSetValues(menu, args, 1); + XtSetValues(topMenu, args, 1); if (config_mode == CONFIG_LAYOUT) { XtSetArg(args[0], XtNheight, &height); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.14 xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.17 --- xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.14 Thu Mar 29 11:54:30 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c Fri Nov 30 07:12:04 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.14 2001/03/29 16:54:30 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.17 2001/11/30 12:12:04 eich Exp $ */ #include "xf86config.h" @@ -771,7 +771,9 @@ conf->mk_max_speed); fprintf(fp, "MouseKeysCurve = %d\n", conf->mk_curve); - fprintf(fp, "AccessXTimeout = %d\n", conf->ax_timeout); + if (conf->ax_timeout) + fprintf(fp, "AccessXTimeout = %d\n", + conf->ax_timeout); if (conf->initial_ctrls != 0) { fprintf(fp, "Controls %c= ", conf->replace_initial_ctrls ? ' ' : '+'); @@ -979,7 +981,7 @@ model = xkb_info->defs.model = omodel; layout = xkb_info->defs.layout = olayout; variant = xkb_info->defs.variant = ovariant; - options = xkb_info->defs.options = ooptions; + options = XtNewString(xkb_info->defs.options = ooptions); xkb_rules = oxkb_rules; rules = xkb_rules->rules; @@ -1160,7 +1162,7 @@ { int i; char *optname; - Widget sme, optpopup, optparent; + Widget sme, optpopup = NULL, optparent; /* MODEL */ if (modelp) Index: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.5.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.18 --- xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.5.2.1 Mon May 28 17:36:44 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c Sat Nov 3 15:32:31 2001 @@ -26,373 +26,372 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.5.2.1 2001/05/28 21:36:44 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.18 2001/11/03 20:32:31 paulo Exp $ */ -#define LOADER_PRIVATE -#include "loader.h" -/* XXX beware (or fix it) libc functions called here are the xf86 ones */ +#include "config.h" +#include "cards.h" +#include "options.h" +#include "loader.h" +#include "stubs.h" +#include <X11/Xresource.h> #ifdef USE_MODULES -static void AddModuleOptions(char*, OptionInfoPtr); -void xf86AddDriver(DriverPtr, void*, int); -Bool xf86ServerIsOnlyDetecting(void); -void xf86AddInputDriver(InputDriverPtr, pointer, int); -void xf86AddModuleInfo(ModuleInfoPtr, void*); -Bool xf86LoaderCheckSymbol(const char*); -void xf86LoaderReqSymLists(const char **, ...); -void xf86Msg(int, const char*, ...); - -xf86cfgModuleOptions *module_options; - -int xf86ShowUnresolved = 1; - -LOOKUP miLookupTab[] = {{0,0}}; -LOOKUP dixLookupTab[] = {{0,0}}; -LOOKUP fontLookupTab[] = {{0,0}}; -LOOKUP extLookupTab[] = {{0,0}}; -LOOKUP xfree86LookupTab[] = { - /* Loader functions */ - SYMFUNC(LoaderDefaultFunc) - SYMFUNC(LoadSubModule) - SYMFUNC(DuplicateModule) - SYMFUNC(LoaderErrorMsg) - SYMFUNC(LoaderCheckUnresolved) - SYMFUNC(LoadExtension) - SYMFUNC(LoadFont) - SYMFUNC(LoaderReqSymbols) - SYMFUNC(LoaderReqSymLists) - SYMFUNC(LoaderRefSymbols) - SYMFUNC(LoaderRefSymLists) - SYMFUNC(UnloadSubModule) - SYMFUNC(LoaderSymbol) - SYMFUNC(LoaderListDirs) - SYMFUNC(LoaderFreeDirList) - SYMFUNC(LoaderGetOS) - - /* - * these here are our own interfaces to libc functions - */ - SYMFUNC(xf86abort) - SYMFUNC(xf86abs) - SYMFUNC(xf86acos) - SYMFUNC(xf86asin) - SYMFUNC(xf86atan) - SYMFUNC(xf86atan2) - SYMFUNC(xf86atof) - SYMFUNC(xf86atoi) - SYMFUNC(xf86atol) - SYMFUNC(xf86bsearch) - SYMFUNC(xf86ceil) - SYMFUNC(xf86calloc) - SYMFUNC(xf86clearerr) - SYMFUNC(xf86close) - SYMFUNC(xf86cos) - SYMFUNC(xf86exit) - SYMFUNC(xf86exp) - SYMFUNC(xf86fabs) - SYMFUNC(xf86fclose) - SYMFUNC(xf86feof) - SYMFUNC(xf86ferror) - SYMFUNC(xf86fflush) - SYMFUNC(xf86fgetc) - SYMFUNC(xf86fgetpos) - SYMFUNC(xf86fgets) - SYMFUNC(xf86floor) - SYMFUNC(xf86fmod) - SYMFUNC(xf86fopen) - SYMFUNC(xf86fprintf) - SYMFUNC(xf86fputc) - SYMFUNC(xf86fputs) - SYMFUNC(xf86fread) - SYMFUNC(xf86free) - SYMFUNC(xf86freopen) - SYMFUNC(xf86frexp) - SYMFUNC(xf86fscanf) - SYMFUNC(xf86fseek) - SYMFUNC(xf86fsetpos) - SYMFUNC(xf86ftell) - SYMFUNC(xf86fwrite) - SYMFUNC(xf86getc) - SYMFUNC(xf86getenv) - SYMFUNC(xf86getpagesize) - SYMFUNC(xf86hypot) - SYMFUNC(xf86ioctl) - SYMFUNC(xf86isalnum) - SYMFUNC(xf86isalpha) - SYMFUNC(xf86iscntrl) - SYMFUNC(xf86isdigit) - SYMFUNC(xf86isgraph) - SYMFUNC(xf86islower) - SYMFUNC(xf86isprint) - SYMFUNC(xf86ispunct) - SYMFUNC(xf86isspace) - SYMFUNC(xf86isupper) - SYMFUNC(xf86isxdigit) - SYMFUNC(xf86labs) - SYMFUNC(xf86ldexp) - SYMFUNC(xf86log) - SYMFUNC(xf86log10) - SYMFUNC(xf86lseek) - SYMFUNC(xf86malloc) - SYMFUNC(xf86memchr) - SYMFUNC(xf86memcmp) - SYMFUNC(xf86memcpy) -#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__ia64__) - /* - * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle - * structure copies. This causes a problem both here and in shared - * libraries as there is no way to map the name of the call to the - * correct function. - */ - SYMFUNC(memcpy) - /* - * Some PPC, SPARC, and IA64 compilers generate calls to memset to handle - * aggregate initializations. - */ - SYMFUNC(memset) +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <setjmp.h> +#include <signal.h> +#include <ctype.h> + +#include <stdarg.h> + +#ifndef SIGNALRETURNSINT +void sig_handler(int); +#else +int sig_handler(int); +#endif /* SIGNALRETURNSINT */ + +static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList, + XrmRepresentation*, XrmValue*, XPointer); +extern void CheckChipsets(xf86cfgModuleOptions*, int*); + +static sigjmp_buf jmp; +int signal_caught; +int error_level; +char *loaderPath, **loaderList, **ploaderList; +extern XrmDatabase options_xrm; +extern int noverify; +extern ModuleType module_type; +static OptionInfoPtr option; + +extern FontModule *font_module; +extern int numFontModules; + +char **checkerLegend; +int *checkerErrors; + +#ifndef SIGNALRETURNSINT +void +#else +int #endif - SYMFUNC(xf86memmove) - SYMFUNC(xf86memset) - SYMFUNC(xf86mmap) - SYMFUNC(xf86modf) - SYMFUNC(xf86munmap) - SYMFUNC(xf86open) - SYMFUNC(xf86perror) - SYMFUNC(xf86pow) - SYMFUNC(xf86printf) - SYMFUNC(xf86qsort) - SYMFUNC(xf86read) - SYMFUNC(xf86realloc) - SYMFUNC(xf86remove) - SYMFUNC(xf86rename) - SYMFUNC(xf86rewind) - SYMFUNC(xf86setbuf) - SYMFUNC(xf86setvbuf) - SYMFUNC(xf86sin) - SYMFUNC(xf86snprintf) - SYMFUNC(xf86sprintf) - SYMFUNC(xf86sqrt) - SYMFUNC(xf86sscanf) - SYMFUNC(xf86strcat) - SYMFUNC(xf86strcmp) - SYMFUNC(xf86strcasecmp) - SYMFUNC(xf86strcpy) - SYMFUNC(xf86strcspn) - SYMFUNC(xf86strerror) - SYMFUNC(xf86strlen) - SYMFUNC(xf86strncmp) - SYMFUNC(xf86strncasecmp) - SYMFUNC(xf86strncpy) - SYMFUNC(xf86strpbrk) - SYMFUNC(xf86strchr) - SYMFUNC(xf86strrchr) - SYMFUNC(xf86strspn) - SYMFUNC(xf86strstr) - SYMFUNC(xf86strtod) - SYMFUNC(xf86strtok) - SYMFUNC(xf86strtol) - SYMFUNC(xf86strtoul) - SYMFUNC(xf86tan) - SYMFUNC(xf86tmpfile) - SYMFUNC(xf86tolower) - SYMFUNC(xf86toupper) - SYMFUNC(xf86ungetc) - SYMFUNC(xf86vfprintf) - SYMFUNC(xf86vsnprintf) - SYMFUNC(xf86vsprintf) - SYMFUNC(xf86write) - -/* non-ANSI C functions */ - SYMFUNC(xf86opendir) - SYMFUNC(xf86closedir) - SYMFUNC(xf86readdir) - SYMFUNC(xf86rewinddir) - SYMFUNC(xf86ffs) - SYMFUNC(xf86strdup) - SYMFUNC(xf86bzero) - SYMFUNC(xf86usleep) - SYMFUNC(xf86execl) - - SYMFUNC(xf86getsecs) - SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */ - - SYMFUNC(xf86stat) - SYMFUNC(xf86fstat) - SYMFUNC(xf86access) - SYMFUNC(xf86geteuid) - SYMFUNC(xf86getegid) - SYMFUNC(xf86getpid) - SYMFUNC(xf86mknod) - SYMFUNC(xf86chmod) - SYMFUNC(xf86chown) - SYMFUNC(xf86sleep) - SYMFUNC(xf86mkdir) - SYMFUNC(xf86shmget) - SYMFUNC(xf86shmat) - SYMFUNC(xf86shmdt) - SYMFUNC(xf86shmctl) - SYMFUNC(xf86setjmp) - SYMFUNC(xf86longjmp) - - SYMFUNC(xf86AddDriver) - SYMFUNC(xf86ServerIsOnlyDetecting) - SYMFUNC(xf86AddInputDriver) - SYMFUNC(xf86AddModuleInfo) - SYMFUNC(xf86LoaderCheckSymbol) - - SYMFUNC(xf86LoaderReqSymLists) - SYMFUNC(xf86Msg) - SYMFUNC(ErrorF) - {0,0} -}; - -static DriverPtr driver; -static ModuleInfoPtr info; -static ModuleType type = GenericModule; +sig_handler(int sig) +{ + char *str; -static void -AddModuleOptions(char *name, OptionInfoPtr option) + switch (sig) { + case SIGTRAP: + str = "TRAP"; + break; + case SIGBUS: + str = "BUS"; + break; + case SIGSEGV: + str = "SEGV"; + break; + case SIGILL: + str = "ILL"; + break; + case SIGFPE: + str = "FPE"; + break; + default: + str = "???"; + break; + } + + if (signal_caught == 1) { + ErrorF(" ERROR I am dead.\n"); + exit(1); + } + else if (signal_caught == 2) + abort(); + ++signal_caught; + ErrorF(" ERROR SIG%s caught!\n", str); + if (!noverify) + error_level += 50; + siglongjmp(jmp, 1); + /*NOTREACHED*/ +} + +void +CheckMsg(int code, char *fmt, ...) { - xf86cfgModuleOptions *ptr; - OptionInfoPtr tmp; + va_list ap; + + ++checkerErrors[code]; + ErrorF("%3d ", code); - 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); + va_start(ap, fmt); + VErrorF(fmt, ap); + va_end(ap); +} + +static Bool +EnumDatabase(XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, + XrmRepresentation *type, XrmValue *value, XPointer closure) +{ + char *res = XrmQuarkToString(quarks[1]); + + if (res) { + option = module_options->option; + while (option->name) { + if (strcasecmp(option->name, res) == 0) + return (False); + ++option; } + CheckMsg(CHECKER_OPTION_UNUSED, + "WARNING %s.%s is not used\n", + XrmQuarkToString(quarks[0]), res); + ++error_level; } - else - ptr->option = NULL; - ptr->next = module_options; - module_options = ptr; + return (False); } Bool LoaderInitializeOptions(void) { static int first = 1; - static char *path = NULL, *modules = "lib/modules"; - int saveVerbose = xf86Verbose; + static char *modules = "lib/modules"; + volatile Bool options_ok = False; + char *ptr, query[256]; + char *ptr2, query2[256]; + char *type; + XrmValue value; + XrmQuark names[2]; + XrmQuark classes[2]; + volatile int i; + static ModuleType module_types[] = { + GenericModule, FontRendererModule, InputModule, VideoModule, NullModule + }; + + /* The offset in this vector must match loader.h:enum ModuleType values */ + static char *module_strs[] = { + "Null Module", "Video Module", "Input Module", "Generic Module", "Font Module" + }; if (first) { - xf86Verbose = 10; - LoaderInit(); + checkerLegend = (char**) + XtCalloc(1, sizeof(char*) * (CHECKER_LAST_MESSAGE + 1)); + checkerErrors = (int*) + XtCalloc(1, sizeof(int) * (CHECKER_LAST_MESSAGE + 1)); + xf86cfgLoaderInit(); first = 0; + + checkerLegend[CHECKER_OPTIONS_FILE_MISSING] = + "The Options file, normally /usr/X11R6/lib/X11/Options was not found.\n" + "In the sources, it is at xc/programs/Xserver/hw/xfree86/Options."; + checkerLegend[CHECKER_OPTION_DESCRIPTION_MISSING] = + "No description for the module option. The description should be in\n" + "in the Options file, and using the sintax:\n" + "Module.Option: any text describing the option"; + checkerLegend[CHECKER_LOAD_FAILED] = + "Failed to load the module. Usually the loader will print a complete\n" + "description for the reason the module was not loaded. Use the -verbose\n" + "command line option if it is not printing any messages."; + checkerLegend[CHECKER_RECOGNIZED_AS] = + "This message means the module code did not follow what was expected\n" + "by the checker. For video drivers, it did not call xf86AddDriver,\n" + "a input module did not call xf86AddInputDriver and a font renderer\n" + "module did not call LoadFont. This message can also be printed if\n" + "the module is in the incorrect directory."; + checkerLegend[CHECKER_NO_OPTIONS_AVAILABLE] = + "The driver does not have an AvailableOptions function, or that\n" + "function is returning NULL. If the driver is returning NULL, and\n" + "really does not need any options from XF86Config, than the message\n" + "can be ignored."; + checkerLegend[CHECKER_NO_VENDOR_CHIPSET] = + "The checker could not fetch the PCI chipset/vendor information from\n" + "the module. The checker currently wraps xf86PrintChipsets and\n" + "xf86MatchPciInstances to read the information from the module."; + checkerLegend[CHECKER_CANNOT_VERIFY_CHIPSET] = + "The vendor id was not found, so it is not possible to search the list\n" + "of chipsets."; + checkerLegend[CHECKER_OPTION_UNUSED] = + "The option description is defined in the Options file, but the option\n" + "was name not retrieved when calling the module AvailableOptions."; + checkerLegend[CHECKER_NOMATCH_CHIPSET_STRINGS] = + "The string specified in the module does not match the one in\n" + "common/xf86PciInfo.h"; + checkerLegend[CHECKER_CHIPSET_NOT_LISTED] = + "This means that common/xf86PciInfo.h does not have an entry for the\n" + "given vendor and id."; + checkerLegend[CHECKER_CHIPSET_NOT_SUPPORTED] = + "The chipset is listed in common/xf86PciInfo.h, but the driver does\n" + "not support it, or does not list it in the chipsets fetched by the checker."; + checkerLegend[CHECKER_CHIPSET_NO_VENDOR] = + "The vendor id specified to xf86MatchPciInstances is not defined in\n" + "common/xf86PciInfo.h"; + checkerLegend[CHECKER_NO_CHIPSETS] = + "No chipsets were passed to xf86MatchPciIntances."; + checkerLegend[CHECKER_FILE_MODULE_NAME_MISMATCH] = + "The module name string does not match the the modname field of the\n" + "XF86ModuleVersionInfo structure. This generally is not an error, but\n" + "to may be a good idea to use the same string to avoid confusion."; } - xf86Verbose = saveVerbose; if (XF86Module_path == NULL) { - XF86Module_path = XtMalloc(strlen(XFree86Dir) + strlen(modules) + 2); + XF86Module_path = malloc(strlen(XFree86Dir) + strlen(modules) + 2); sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules); } - if (path == NULL || strcmp(XF86Module_path, path)) { - char **list, **l; - const char *subdirs[] = { - ".", - "drivers", - "input", - NULL - }; - int errmaj, errmin; - ModuleDescPtr module; - - path = strdup(XF86Module_path); - LoaderSetPath(path); - - list = LoaderListDirs(subdirs, NULL); - if (list) { -#if 0 - if (ptr) { - while (module_options) { - module_options = module_options->next; - XtFree(ptr->name); - XtFree((XtPointer)ptr->option); - XtFree((XtPointer)ptr); - ptr = module_options; - } - } -#endif + + if (loaderPath == NULL || strcmp(XF86Module_path, loaderPath)) + loaderPath = strdup(XF86Module_path); + else + /* nothing new */ + return (True); - for (l = list; *l; l++) { - driver = NULL; - info = NULL; - type = GenericModule; - xf86Verbose = 0; - if ((module = LoadModule(*l, NULL, NULL, NULL, NULL, - NULL, &errmaj, &errmin)) == NULL) - LoaderErrorMsg(NULL, *l, errmaj, errmin); - else if (driver && driver->AvailableOptions) - AddModuleOptions(*l, (*driver->AvailableOptions)(-1, -1)); - else if (info && info->AvailableOptions) - AddModuleOptions(*l, (*info->AvailableOptions)(NULL)); + if (!noverify) { + options_ok = InitializeOptionsDatabase(); + InitializePciInfo(); + } - UnloadModule(module); - xf86Verbose = saveVerbose; + for (i = 0; module_types[i] != NullModule; i++) { + xf86cfgLoaderInitList(module_types[i]); + if (!noverify) + ErrorF("================= Checking modules of type \"%s\" =================\n", + module_strs[module_types[i]]); + + if (loaderList) { + for (ploaderList = loaderList; *ploaderList; ploaderList++) { + signal_caught = 0; + signal(SIGTRAP, sig_handler); + signal(SIGBUS, sig_handler); + signal(SIGSEGV, sig_handler); + signal(SIGILL, sig_handler); + signal(SIGFPE, sig_handler); + if (sigsetjmp(jmp, 1) == 0) { + if (!noverify) { + int ok, nfont_modules; + + nfont_modules = numFontModules; + error_level = 0; + ErrorF("CHECK MODULE %s\n", *ploaderList); + if ((ok = xf86cfgCheckModule()) == 0) { + CheckMsg(CHECKER_LOAD_FAILED, + "ERROR Failed to load module.\n"); + error_level += 50; + } + else if (module_type != module_types[i]) { + CheckMsg(CHECKER_RECOGNIZED_AS, + "WARNING %s recognized as a \"%s\"\n", *ploaderList, + module_strs[module_type]); + ++error_level; + } + if (ok) { + if (options_ok) { + if ((module_options == NULL || module_options->option == NULL) && + module_type != GenericModule) { + CheckMsg(CHECKER_NO_OPTIONS_AVAILABLE, + "WARNING Not a generic module, but no options available.\n"); + ++error_level; + } + else if (module_options && strcmp(module_options->name, *ploaderList) == 0) { + ErrorF(" CHECK OPTIONS\n"); + option = module_options->option; + + while (option->name) { + XmuSnprintf(query, sizeof(query), "%s.%s", *ploaderList, option->name); + for (ptr = query, ptr2 = query2; *ptr; ptr++) { + if (*ptr != '_' && *ptr != ' ' && *ptr != '\t') + *ptr2 = tolower(*ptr); + } + *ptr2 = '\0'; + /* all resources are in lowercase */ + if (!XrmGetResource(options_xrm, query2, "Module.Option", &type, &value) || + value.addr == NULL) { + CheckMsg(CHECKER_OPTION_DESCRIPTION_MISSING, + "WARNING no description for %s\n", query); + ++error_level; + } + ++option; + } + + /* now do a linear search for Options file entries that are not + * in the driver. + */ + names[0] = XrmPermStringToQuark(module_options->name); + classes[0] = XrmPermStringToQuark("Option"); + names[1] = classes[1] = NULLQUARK; + (void)XrmEnumerateDatabase(options_xrm, (XrmNameList)&names, (XrmClassList)&classes, + XrmEnumOneLevel, EnumDatabase, NULL); + } + } + else { + CheckMsg(CHECKER_OPTIONS_FILE_MISSING, + "ERROR Options file missing.\n"); + error_level += 10; + } + + if (module_type == VideoModule && + (module_options == NULL || module_options->vendor < 0 || + module_options->chipsets == NULL)) { + CheckMsg(CHECKER_NO_VENDOR_CHIPSET, + "WARNING No vendor/chipset information available.\n"); + ++error_level; + } + else if (module_type == VideoModule) { + if (module_options == NULL) { + /* No description for this, if this happen, + * something really strange happened. */ + ErrorF(" ERROR No module_options!?!\n"); + error_level += 50; + } + else { + ErrorF(" CHECK CHIPSETS\n"); + CheckChipsets(module_options, &error_level); + } + } + + /* font modules check */ + if (module_type == FontRendererModule) { + if (strcmp(*ploaderList, font_module->name)) { + /* not an error */ + ErrorF(" NOTICE FontModule->name specification mismatch: \"%s\" \"%s\"\n", + *ploaderList, font_module->name); + } + if (nfont_modules + 1 != numFontModules) { + /* not an error */ + ErrorF(" NOTICE font module \"%s\" loaded more than one font renderer.\n", + *ploaderList); + } + } + else if (nfont_modules != numFontModules) { + ErrorF(" WARNING number of font modules changed from %d to %d.\n", + nfont_modules, numFontModules); + ++error_level; + } + } + ErrorF(" SUMMARY error_level set to %d.\n\n", error_level); + } + else + (void)xf86cfgCheckModule(); + } + signal(SIGTRAP, SIG_DFL); + signal(SIGBUS, SIG_DFL); + signal(SIGSEGV, SIG_DFL); + signal(SIGILL, SIG_DFL); + signal(SIGFPE, SIG_DFL); } - LoaderFreeDirList(list); - } - else { - xf86Verbose = saveVerbose; - return (False); + xf86cfgLoaderFreeList(); } + else + ErrorF(" ERROR Failed to initialize module list.\n"); } - - xf86Verbose = saveVerbose; - return (True); -} - -void -xf86AddDriver(DriverPtr drv, void *module, int flags) -{ - driver = drv; - type = VideoModule; -} + if (!noverify) { + ErrorF("===================================== LEGEND ===============================\n"); + ErrorF("NOTICE lines are just informative.\n"); + ErrorF("WARNING lines add 1 to error_level.\n"); + ErrorF("ERROR lines add 2 or more (based on the severity of the error) to error_level.\n\n"); + for (i = 0; i <= CHECKER_LAST_MESSAGE; i++) + if (checkerErrors[i]) { + ErrorF("%3d\n%s\n\n", i, checkerLegend[i]); + } + } -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.4 xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h:1.4 Fri May 18 16:22:31 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h Mon Jul 9 19:45:24 2001 @@ -26,80 +26,45 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h,v 1.4 2001/05/18 20:22:31 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h,v 1.7 2001/07/09 23:45:24 paulo Exp $ */ + #ifdef USE_MODULES +#ifndef LOADER_PRIVATE #include "config.h" #include "stubs.h" -#ifndef _xf86cfg_loader_h -#define _xf86cfg_loader_h +#else -#ifdef LOADER_PRIVATE -#include <sym.h> - #define XFree86LOADER /* not really */ -#include <xf86_ansic.h> +#define IN_LOADER + +#include "xf86.h" +#include "xf86str.h" +#include "xf86Opt.h" +#include "xf86Module.h" -/* common/xf86Module.h */ -pointer LoadModule(const char *, const char *, const char **, - const char **, pointer, const pointer *, - int *, int *); -pointer LoadSubModule(pointer, const char *, const char **, - const char **, pointer, const pointer *, - int *, int *); -void UnloadSubModule(pointer); -void LoadFont(pointer); -void UnloadModule (pointer); -pointer LoaderSymbol(const char *); -char **LoaderListDirs(const char **, const char **); -void LoaderFreeDirList(char **); -void LoaderErrorMsg(const char *, const char *, int, int); -void LoadExtension(pointer, Bool); -void LoaderRefSymLists(const char **, ...); -void LoaderRefSymbols(const char *, ...); -void LoaderReqSymLists(const char **, ...); -void LoaderReqSymbols(const char *, ...); -int LoaderCheckUnresolved(int); -void LoaderGetOS(const char **name, int *major, int *minor, int *teeny); +#define XINPUT +#include "xf86Xinput.h" -typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *); -typedef void (*ModuleTearDownProc)(pointer); +#include "fontmod.h" +#include "loaderProcs.h" -/* loader/loader.h */ +#include <sym.h> +#include <xf86_ansic.h> + void LoaderDefaultFunc(void); +#endif -/* loader/loaderProcs.h */ -typedef struct module_desc { - struct module_desc *child; - struct module_desc *sib; - struct module_desc *parent; - struct module_desc *demand_next; - char *name; - char *filename; - char *identifier; - XID client_id; - int in_use; - int handle; - ModuleSetupProc SetupProc; - ModuleTearDownProc TearDownProc; - void *TearDownData; /* returned from SetupProc */ - const char *path; -} ModuleDesc, *ModuleDescPtr; - -void LoaderInit(void); - -ModuleDescPtr LoadDriver(const char *, const char *, int, pointer, int *, - int *); -ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent); -void UnloadDriver (ModuleDescPtr); -void FreeModuleDesc (ModuleDescPtr mod); -ModuleDescPtr NewModuleDesc (const char *); -ModuleDescPtr AddSibling (ModuleDescPtr head, ModuleDescPtr new); -void LoaderSetPath(const char *path); -void LoaderSortExtensions(void); -#endif /* LOADER_PRIVATE */ +#ifndef _xf86cfg_loader_h +#define _xf86cfg_loader_h + +void xf86cfgLoaderInit(void); +void xf86cfgLoaderInitList(int); +void xf86cfgLoaderFreeList(void); +int xf86cfgCheckModule(void); +#ifndef LOADER_PRIVATE /* common/xf86Opt.h */ typedef struct { double freq; @@ -138,78 +103,69 @@ Bool found; } OptionInfoRec, *OptionInfoPtr; -#ifdef LOADER_PRIVATE -/* common/xf86str.h */ -typedef struct _DriverRec { - int driverVersion; - char * driverName; - void (*Identify)(int flags); - Bool (*Probe)(struct _DriverRec *drv, int flags); - OptionInfoPtr (*AvailableOptions)(int chipid, int bustype); - 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 ; +/* fontmod.h */ +typedef void (*InitFont)(void); + +typedef struct { + InitFont initFunc; + char * name; + void *module; +} FontModule; + +extern FontModule *FontModuleList; -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 struct { + int token; /* id of the token */ + const char * name; /* token name */ +} SymTabRec, *SymTabPtr; +#endif /* !LOADER_PRIVATE */ typedef enum { + NullModule = 0, VideoModule, InputModule, - GenericModule + GenericModule, + FontRendererModule } ModuleType; typedef struct _xf86cfgModuleOptions { char *name; ModuleType type; OptionInfoPtr option; + int vendor; + SymTabPtr chipsets; struct _xf86cfgModuleOptions *next; } xf86cfgModuleOptions; extern xf86cfgModuleOptions *module_options; + +/* When adding a new code to the LEGEND, also update checkerLegend + * in loader.c + */ +extern char **checkerLegend; +extern int *checkerErrors; +#define CHECKER_OPTIONS_FILE_MISSING 1 +#define CHECKER_OPTION_DESCRIPTION_MISSING 2 +#define CHECKER_LOAD_FAILED 3 +#define CHECKER_RECOGNIZED_AS 4 +#define CHECKER_NO_OPTIONS_AVAILABLE 5 +#define CHECKER_NO_VENDOR_CHIPSET 6 +#define CHECKER_CANNOT_VERIFY_CHIPSET 7 +#define CHECKER_OPTION_UNUSED 8 +#define CHECKER_NOMATCH_CHIPSET_STRINGS 9 +#define CHECKER_CHIPSET_NOT_LISTED 10 +#define CHECKER_CHIPSET_NOT_SUPPORTED 11 +#define CHECKER_CHIPSET_NO_VENDOR 12 +#define CHECKER_NO_CHIPSETS 13 +#define CHECKER_FILE_MODULE_NAME_MISMATCH 14 -Bool LoaderInitializeOptions(void); +#define CHECKER_LAST_MESSAGE 14 + +extern void CheckMsg(int, char*, ...); + +#ifndef LOADER_PRIVATE +int LoaderInitializeOptions(void); +#endif #endif /* USE_MODULES */ #endif /* _xf86cfg_loader_h */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c:1.8 --- /dev/null Fri Jan 18 15:26:29 2002 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c Mon Dec 31 13:15:10 2001 @@ -0,0 +1,596 @@ +/* + * 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/loadmod.c,v 1.8 2001/12/31 18:15:10 herrb Exp $ + */ + +#ifdef USE_MODULES +#define LOADER_PRIVATE +#include "loader.h" + +#define True 1 +#define False 0 +#define XtPointer char* +#define XtMalloc malloc +#define XtCalloc calloc +#define XtRealloc realloc +#define XtFree free +#define XtNew(t) malloc(sizeof(t)) +#define XtNewString(s) ((s) ? strdup(s) : NULL) + +#define pointer void* + +/* XXX beware (or fix it) libc functions called here are the xf86 ones */ + +static void AddModuleOptions(char*, const OptionInfoRec*); +#if 0 +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*, ...); +void xf86PrintChipsets(const char*, const char*, SymTabPtr); +void xf86ErrorFVerb(int verb, const char *format, ...); +pciVideoPtr *xf86GetPciVideoInfo(void); +int xf86MatchDevice(const char*, GDevPtr**); +int xf86MatchPciInstances(const char*, int, SymTabPtr, PciChipsets*, GDevPtr*, int, DriverPtr,int**); +int xf86MatchIsaInstances(const char*, SymTabPtr, pointer*, DriverPtr, pointer, GDevPtr*, int, int**); +void *xf86LoadDrvSubModule(DriverPtr drv, const char*); +void xf86DrvMsg(int, int, const char*, ...); +#endif +void *xf86GetPciConfigInfo(void); + +extern char *loaderPath, **loaderList, **ploaderList; +xf86cfgModuleOptions *module_options; +FontModule *font_module; +int numFontModules; + +extern int noverify, error_level; + +int xf86ShowUnresolved = 1; + +LOOKUP miLookupTab[] = {{0,0}}; +LOOKUP dixLookupTab[] = {{0,0}}; +LOOKUP fontLookupTab[] = {{0,0}}; +LOOKUP extLookupTab[] = {{0,0}}; +LOOKUP xfree86LookupTab[] = { + /* Loader functions */ + SYMFUNC(LoaderDefaultFunc) + SYMFUNC(LoadSubModule) + SYMFUNC(DuplicateModule) + SYMFUNC(LoaderErrorMsg) + SYMFUNC(LoaderCheckUnresolved) + SYMFUNC(LoadExtension) + SYMFUNC(LoadFont) + SYMFUNC(LoaderReqSymbols) + SYMFUNC(LoaderReqSymLists) + SYMFUNC(LoaderRefSymbols) + SYMFUNC(LoaderRefSymLists) + SYMFUNC(UnloadSubModule) + SYMFUNC(LoaderSymbol) + SYMFUNC(LoaderListDirs) + SYMFUNC(LoaderFreeDirList) + SYMFUNC(LoaderGetOS) + + /* + * these here are our own interfaces to libc functions + */ + SYMFUNC(xf86abort) + SYMFUNC(xf86abs) + SYMFUNC(xf86acos) + SYMFUNC(xf86asin) + SYMFUNC(xf86atan) + SYMFUNC(xf86atan2) + SYMFUNC(xf86atof) + SYMFUNC(xf86atoi) + SYMFUNC(xf86atol) + SYMFUNC(xf86bsearch) + SYMFUNC(xf86ceil) + SYMFUNC(xf86calloc) + SYMFUNC(xf86clearerr) + SYMFUNC(xf86close) + SYMFUNC(xf86cos) + SYMFUNC(xf86exit) + SYMFUNC(xf86exp) + SYMFUNC(xf86fabs) + SYMFUNC(xf86fclose) + SYMFUNC(xf86feof) + SYMFUNC(xf86ferror) + SYMFUNC(xf86fflush) + SYMFUNC(xf86fgetc) + SYMFUNC(xf86fgetpos) + SYMFUNC(xf86fgets) + SYMFUNC(xf86finite) + SYMFUNC(xf86floor) + SYMFUNC(xf86fmod) + SYMFUNC(xf86fopen) + SYMFUNC(xf86fprintf) + SYMFUNC(xf86fputc) + SYMFUNC(xf86fputs) + SYMFUNC(xf86fread) + SYMFUNC(xf86free) + SYMFUNC(xf86freopen) + SYMFUNC(xf86frexp) + SYMFUNC(xf86fscanf) + SYMFUNC(xf86fseek) + SYMFUNC(xf86fsetpos) + SYMFUNC(xf86ftell) + SYMFUNC(xf86fwrite) + SYMFUNC(xf86getc) + SYMFUNC(xf86getenv) + SYMFUNC(xf86getpagesize) + SYMFUNC(xf86hypot) + SYMFUNC(xf86ioctl) + SYMFUNC(xf86isalnum) + SYMFUNC(xf86isalpha) + SYMFUNC(xf86iscntrl) + SYMFUNC(xf86isdigit) + SYMFUNC(xf86isgraph) + SYMFUNC(xf86islower) + SYMFUNC(xf86isprint) + SYMFUNC(xf86ispunct) + SYMFUNC(xf86isspace) + SYMFUNC(xf86isupper) + SYMFUNC(xf86isxdigit) + SYMFUNC(xf86labs) + SYMFUNC(xf86ldexp) + SYMFUNC(xf86log) + SYMFUNC(xf86log10) + SYMFUNC(xf86lseek) + SYMFUNC(xf86malloc) + SYMFUNC(xf86memchr) + SYMFUNC(xf86memcmp) + SYMFUNC(xf86memcpy) +#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__ia64__) + /* + * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle + * structure copies. This causes a problem both here and in shared + * libraries as there is no way to map the name of the call to the + * correct function. + */ + SYMFUNC(memcpy) + /* + * Some PPC, SPARC, and IA64 compilers generate calls to memset to handle + * aggregate initializations. + */ + SYMFUNC(memset) +#endif + SYMFUNC(xf86memmove) + SYMFUNC(xf86memset) + SYMFUNC(xf86mmap) + SYMFUNC(xf86modf) + SYMFUNC(xf86munmap) + SYMFUNC(xf86open) + SYMFUNC(xf86perror) + SYMFUNC(xf86pow) + SYMFUNC(xf86printf) + SYMFUNC(xf86qsort) + SYMFUNC(xf86read) + SYMFUNC(xf86realloc) + SYMFUNC(xf86remove) + SYMFUNC(xf86rename) + SYMFUNC(xf86rewind) + SYMFUNC(xf86setbuf) + SYMFUNC(xf86setvbuf) + SYMFUNC(xf86sin) + SYMFUNC(xf86snprintf) + SYMFUNC(xf86sprintf) + SYMFUNC(xf86sqrt) + SYMFUNC(xf86sscanf) + SYMFUNC(xf86strcat) + SYMFUNC(xf86strcmp) + SYMFUNC(xf86strcasecmp) + SYMFUNC(xf86strcpy) + SYMFUNC(xf86strcspn) + SYMFUNC(xf86strerror) + SYMFUNC(xf86strlen) + SYMFUNC(xf86strncmp) + SYMFUNC(xf86strncasecmp) + SYMFUNC(xf86strncpy) + SYMFUNC(xf86strpbrk) + SYMFUNC(xf86strchr) + SYMFUNC(xf86strrchr) + SYMFUNC(xf86strspn) + SYMFUNC(xf86strstr) + SYMFUNC(xf86strtod) + SYMFUNC(xf86strtok) + SYMFUNC(xf86strtol) + SYMFUNC(xf86strtoul) + SYMFUNC(xf86tan) + SYMFUNC(xf86tmpfile) + SYMFUNC(xf86tolower) + SYMFUNC(xf86toupper) + SYMFUNC(xf86ungetc) + SYMFUNC(xf86vfprintf) + SYMFUNC(xf86vsnprintf) + SYMFUNC(xf86vsprintf) + SYMFUNC(xf86write) + +/* non-ANSI C functions */ + SYMFUNC(xf86opendir) + SYMFUNC(xf86closedir) + SYMFUNC(xf86readdir) + SYMFUNC(xf86rewinddir) + SYMFUNC(xf86ffs) + SYMFUNC(xf86strdup) + SYMFUNC(xf86bzero) + SYMFUNC(xf86usleep) + SYMFUNC(xf86execl) + + SYMFUNC(xf86getsecs) + SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */ + + SYMFUNC(xf86stat) + SYMFUNC(xf86fstat) + SYMFUNC(xf86access) + SYMFUNC(xf86geteuid) + SYMFUNC(xf86getegid) + SYMFUNC(xf86getpid) + SYMFUNC(xf86mknod) + SYMFUNC(xf86chmod) + SYMFUNC(xf86chown) + SYMFUNC(xf86sleep) + SYMFUNC(xf86mkdir) + SYMFUNC(xf86shmget) + SYMFUNC(xf86shmat) + SYMFUNC(xf86shmdt) + SYMFUNC(xf86shmctl) + SYMFUNC(xf86setjmp) + SYMFUNC(xf86longjmp) + + SYMFUNC(xf86AddDriver) + SYMFUNC(xf86ServerIsOnlyDetecting) + SYMFUNC(xf86AddInputDriver) + SYMFUNC(xf86AddModuleInfo) + SYMFUNC(xf86LoaderCheckSymbol) + + SYMFUNC(xf86LoaderReqSymLists) + SYMFUNC(xf86Msg) + SYMFUNC(ErrorF) + SYMFUNC(xf86PrintChipsets) + SYMFUNC(xf86ErrorFVerb) + SYMFUNC(xf86GetPciVideoInfo) + SYMFUNC(xf86MatchDevice) + SYMFUNC(xf86MatchPciInstances) + SYMFUNC(xf86MatchIsaInstances) + SYMFUNC(Xfree) + SYMFUNC(xf86LoadDrvSubModule) + SYMFUNC(xf86DrvMsg) + SYMFUNC(xf86GetPciConfigInfo) + {0,0} +}; + +static DriverPtr driver; +static ModuleInfoPtr info; +static SymTabPtr chips; +static int vendor; +ModuleType module_type = GenericModule; + +static void +AddModuleOptions(char *name, const OptionInfoRec *option) +{ + xf86cfgModuleOptions *ptr; + const OptionInfoRec *tmp; + SymTabPtr ctmp; + int count; + + ptr = XtNew(xf86cfgModuleOptions); + ptr->name = XtNewString(name); + ptr->type = module_type; + if (option) { + for (count = 0, tmp = option; tmp->name != NULL; tmp++, count++) + ; + ++count; + ptr->option = 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; + if (vendor != -1 && chips) { + ptr->vendor = vendor; + for (count = 0, ctmp = chips; ctmp->name; ctmp++, count++) + ; + ++count; + ptr->chipsets = XtCalloc(1, count * sizeof(SymTabRec)); + for (count = 0, ctmp = chips; ctmp->name != NULL; count++, ctmp++) { + memcpy(&ptr->chipsets[count], ctmp, sizeof(SymTabRec)); + ptr->chipsets[count].name = XtNewString(ctmp->name); + } + } + else + ptr->chipsets = NULL; + + ptr->next = module_options; + module_options = ptr; +} + +extern void xf86WrapperInit(void); + +void +xf86cfgLoaderInit(void) +{ + LoaderInit(); + xf86WrapperInit(); +} + +void +xf86cfgLoaderInitList(int type) +{ + static const char *generic[] = { + ".", + NULL + }; + static const char *video[] = { + "drivers", + NULL + }; + static const char *input[] = { + "input", + NULL + }; + static const char *font[] = { + "fonts", + NULL + }; + const char **subdirs; + + switch (type) { + case GenericModule: + subdirs = generic; + break; + case VideoModule: + subdirs = video; + break; + case InputModule: + subdirs = input; + break; + case FontRendererModule: + subdirs = font; + break; + default: + fprintf(stderr, "Invalid value passed to xf86cfgLoaderInitList.\n"); + subdirs = generic; + break; + } + LoaderSetPath(loaderPath); + loaderList = LoaderListDirs(subdirs, NULL); +} + +void +xf86cfgLoaderFreeList(void) +{ + LoaderFreeDirList(loaderList); +} + +int +xf86cfgCheckModule(void) +{ + int errmaj, errmin; + ModuleDescPtr module; + int nfonts; + FontModule *fonts, *pfont_module; + + driver = NULL; + chips = NULL; + info = NULL; + pfont_module = NULL; + vendor = -1; + module_type = GenericModule; + + if ((module = LoadModule(*ploaderList, NULL, NULL, NULL, NULL, + NULL, &errmaj, &errmin)) == NULL) { + LoaderErrorMsg(NULL, *ploaderList, errmaj, errmin); + return (0); + } + else if (driver && driver->AvailableOptions) { + /* at least fbdev does not call xf86MatchPciInstances in Probe */ + if (driver->Identify) + (*driver->Identify)(-1); + if (driver->Probe) + (*driver->Probe)(driver, PROBE_DETECT); + AddModuleOptions(*ploaderList, (*driver->AvailableOptions)(-1, -1)); + } + else if (info && info->AvailableOptions) + AddModuleOptions(*ploaderList, (*info->AvailableOptions)(NULL)); + + if (!noverify) { + XF86ModuleData *initdata = NULL; + char *p; + + p = XtMalloc(strlen(*ploaderList) + strlen("ModuleData") + 1); + strcpy(p, *ploaderList); + strcat(p, "ModuleData"); + initdata = LoaderSymbol(p); + if (initdata) { + XF86ModuleVersionInfo *vers; + + vers = initdata->vers; + if (vers && strcmp(*ploaderList, vers->modname)) { + /* This was a problem at some time for some video drivers */ + CheckMsg(CHECKER_FILE_MODULE_NAME_MISMATCH, + "WARNING file/module name mismatch: \"%s\" \"%s\"\n", + *ploaderList, vers->modname); + ++error_level; + } + } + XtFree(p); + } + + nfonts = numFontModules; + numFontModules = 0; + fonts = FontModuleList; + if (fonts) { + while (fonts->name) { + if (strcmp(fonts->name, *ploaderList) == 0) + pfont_module = fonts; + ++numFontModules; + ++fonts; + } + } + if (pfont_module) + module_type = FontRendererModule; + else if (nfonts + 1 <= numFontModules) { + /* loader.c will flag a warning if -noverify is not set */ + pfont_module = &FontModuleList[nfonts]; + module_type = FontRendererModule; + } + + if (font_module) { + XtFree((XtPointer)font_module->name); + XtFree((XtPointer)font_module); + font_module = NULL; + } + if (pfont_module) { + font_module = XtNew(FontModule); + memcpy(font_module, pfont_module, sizeof(FontModule)); + font_module->name = XtNewString(pfont_module->name); + } + + UnloadModule(module); + + return (1); +} + +void +xf86AddDriver(DriverPtr drv, void *module, int flags) +{ + driver = drv; + if (driver) + driver->module = module; + module_type = VideoModule; +} + +Bool +xf86ServerIsOnlyDetecting(void) +{ + return (True); +} + +void +xf86AddInputDriver(InputDriverPtr inp, void *module, int flags) +{ + module_type = InputModule; +} + +void +xf86AddModuleInfo(ModuleInfoPtr inf, void *module) +{ + info = inf; +} + +Bool +xf86LoaderCheckSymbol(const char *symbol) +{ + return LoaderSymbol(symbol) != NULL; +} + +void +xf86LoaderReqSymLists(const char **list0, ...) +{ +} + +#if 0 +void xf86Msg(int type, const char *format, ...) +{ +} +#endif + +/*ARGSUSED*/ +void +xf86PrintChipsets(const char *name, const char *msg, SymTabPtr chipsets) +{ + vendor = 0; + chips = chipsets; +} + +pciVideoPtr * +xf86GetPciVideoInfo(void) +{ + static pciVideoRec pci_video; + static pciVideoPtr pci_video_ptr[2] = { &pci_video }; + + memset(&pci_video, 0, sizeof(pciVideoRec)); + + return (pci_video_ptr); +} + +int +xf86MatchDevice(const char *name, GDevPtr **gdev) +{ + *gdev = NULL; + + return (1); +} + +int +xf86MatchPciInstances(const char *name, int VendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets, + GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities) +{ + vendor = VendorID; + chips = chipsets; + *foundEntities = NULL; + + return (0); +} + +int +xf86MatchIsaInstances(const char *name, SymTabPtr chipsets, IsaChipsets *ISAchipsets, DriverPtr drvp, + FindIsaDevProc FindIsaDevice, GDevPtr *devList, int numDevs, int **foundEntities) +{ + *foundEntities = NULL; + + return (0); +} + +/*ARGSUSED*/ +void * +xf86LoadDrvSubModule(DriverPtr drv, const char *name) +{ + pointer ret; + int errmaj = 0, errmin = 0; + + ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL, + &errmaj, &errmin); + if (!ret) + LoaderErrorMsg(NULL, name, errmaj, errmin); + return (ret); +} + +void * +xf86GetPciConfigInfo(void) +{ + return (NULL); +} +#endif Index: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/options.c:1.6.2.2 xc/programs/Xserver/hw/xfree86/xf86cfg/options.c:1.12 --- xc/programs/Xserver/hw/xfree86/xf86cfg/options.c:1.6.2.2 Fri May 25 17:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/options.c Sat Nov 3 15:32:31 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.6.2.2 2001/05/25 21:45:01 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.12 2001/11/03 20:32:31 paulo Exp $ */ #include "options.h" @@ -41,6 +41,7 @@ #include <X11/Xaw/SimpleMenP.h> #include <X11/Xaw/SmeBSB.h> #include <X11/Xaw/Viewport.h> +#include <ctype.h> /* * Prototypes @@ -57,6 +58,8 @@ static void SelectModuleOptionCallback(Widget, XtPointer, XtPointer); static void ModuleOptionsPopdown(Widget, XtPointer, XtPointer); #endif +static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList, + XrmRepresentation*, XrmValue*, XPointer); /* * Initialization @@ -67,7 +70,11 @@ static char *option_str; static int option_index, popped = False; static char *Options = "lib/X11/Options"; -static XrmDatabase xrm; +XrmDatabase options_xrm; +struct { + char *string; + int offset; +} rebuild_xrm; #ifdef USE_MODULES static Widget modList, optList, desc, modOptionsShell, labelType; static char *module_sel; @@ -242,7 +249,7 @@ option_str = NULL; options = opts; if (first) { - Widget pane, form, viewport, bottom, popdown, command; + Widget pane, form, viewport, bottom, popdown; first = 0; @@ -264,6 +271,8 @@ XtAddCallback(update, XtNcallback, UpdateOption, NULL); #ifdef USE_MODULES if (!nomodules) { + Widget command; + command = XtCreateManagedWidget("help", commandWidgetClass, form, NULL, 0); XtAddCallback(command, XtNcallback, ModuleOptionsPopup, NULL); @@ -552,6 +561,10 @@ XtVaSetValues(desc, XtNstring, "", NULL); XawListUnhighlight(optList); + + /* force relayout */ + XtUnmanageChild(optList); + XtManageChild(optList); } } @@ -579,7 +592,7 @@ OptionInfoPtr opts = mod->option; while (opts && opts->name) { - if (strcmp(info->string, opts->name) == 0) + if (strcasecmp(opts->name, info->string) == 0) break; ++opts; } @@ -644,25 +657,131 @@ XtSetSensitive(update, True); } -char * -GetOptionDescription(char *module, char *option) +/*ARGUSED*/ +static Bool +EnumDatabase(XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, + XrmRepresentation *type, XrmValue *value, XPointer closure) +{ + char *module = XrmQuarkToString(quarks[0]), + *option = XrmQuarkToString(quarks[1]); + + /* handle *.Option: value */ + if (module && option == NULL) { + option = module; + module = "*"; + } + + /* + * NOTE: If the Options file is changed to support any other format than + * + * Module.Option: description text + * + * this code will also need to be updated. + */ + + if (module) { + XrmValue xrm; + char *type, *value, query[256]; + + XmuSnprintf(query, sizeof(query), "%s.%s", module, option); + if (XrmGetResource(options_xrm, query, "Module.Option", &type, &xrm)) + value = (char*)xrm.addr; + else + value = NULL; + + if (value) { + char *norm; + unsigned char *ptr; + int position; + int length = strlen(module) + strlen(option) + strlen(value) + 4; + + rebuild_xrm.string = XtRealloc(rebuild_xrm.string, + rebuild_xrm.offset + length); + position = rebuild_xrm.offset + + sprintf(rebuild_xrm.string + rebuild_xrm.offset, "%s.%s:", + module, option); + + /* removes underlines and spaces */ + norm = strchr(rebuild_xrm.string + rebuild_xrm.offset, '.') + 1; + for (; *norm; norm++) { + if (*norm == '_' || *norm == ' ' || *norm == '\t') { + memmove(norm, norm + 1, strlen(norm) + 1); + --position; + --length; + } + } + + for (ptr = (unsigned char*)rebuild_xrm.string + rebuild_xrm.offset; + *ptr; ptr++) + *ptr = tolower(*ptr); + sprintf(rebuild_xrm.string + position, "%s\n", value); + rebuild_xrm.offset += length - 1; + } + } + + return (False); +} + +Bool +InitializeOptionsDatabase(void) { static int first = 1; - char *type; - XrmValue value; - char query[256]; + static Bool result = True; if (first) { + XrmQuark names[2]; + XrmQuark classes[2]; + first = 0; XrmInitialize(); - if ((xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) { + if ((options_xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) { fprintf(stderr, "Cannot open '%s' database.\n", Options); - return (NULL); + return (False); + } + + /* rebuild database, using only lowercase characters */ + names[0] = classes[0] = names[1] = classes[1] = NULLQUARK; + (void)XrmEnumerateDatabase(options_xrm, (XrmNameList)&names, + (XrmClassList)&classes, XrmEnumAllLevels, + EnumDatabase, NULL); + + /* free previous database, as it is not guaranteed to be + * "case insensitive" */ + XrmDestroyDatabase(options_xrm); + + /* create case insensitive database by making everything lowercase */ + if (rebuild_xrm.string == NULL || + (options_xrm = XrmGetStringDatabase(rebuild_xrm.string)) == + (XrmDatabase)0) { + fprintf(stderr, "Cannot rebuild '%s' database.\n", Options); + XtFree(rebuild_xrm.string); + return (False); } + XtFree(rebuild_xrm.string); } + return (result); +} + +char * +GetOptionDescription(char *module, char *option) +{ + char *type; + XrmValue value; + char query[256]; + unsigned char *ptr; + + InitializeOptionsDatabase(); + XmuSnprintf(query, sizeof(query), "%s.%s", module, option); - if (XrmGetResource(xrm, query, "Module.Option", &type, &value)) + ptr = (unsigned char*)strchr(query, '.') + 1; + for (; *ptr; ptr++) { + if (*ptr == '_' || *ptr == ' ' || *ptr == '\t') + memmove(ptr, ptr + 1, strlen((char*)ptr) + 1); + } + for (ptr = (unsigned char*)query; *ptr; ptr++) + *ptr = tolower(*ptr); + if (XrmGetResource(options_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.4.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/options.h:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/options.h:1.4.2.1 Fri May 25 17:45:01 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/options.h Thu Jul 5 22:04:10 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.4.2.1 2001/05/25 21:45:01 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.7 2001/07/06 02:04:10 paulo Exp $ */ #include "config.h" @@ -46,5 +46,6 @@ void OptionsCancelAction(Widget, XEvent*, String*, Cardinal*); void ModuleOptionsCancelAction(Widget, XEvent*, String*, Cardinal*); char *GetOptionDescription(char *module, char *option); +Bool InitializeOptionsDatabase(void); -void CreateOptionsShell(void); \ No newline at end of file +void CreateOptionsShell(void); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.8.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.10 --- xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.8.2.1 Mon May 21 18:24:02 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c Sat Oct 27 23:34:08 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.8.2.1 2001/05/21 22:24:02 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.10 2001/10/28 03:34:08 tsi Exp $ */ #include "xf86config.h" @@ -146,7 +146,7 @@ (&xf86info); if (ConfigLoop(NULL) == True) { - XF86ModePtr prev, mod; + XF86ModePtr prev = NULL, mod; /* user may have changed the default depth, read variables again */ disp = screen->scrn_display_lst; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.6 xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.8 --- xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.6 Fri Mar 23 20:17:21 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c Sat Oct 27 23:34:08 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.6 2001/03/24 01:17:21 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.8 2001/10/28 03:34:08 tsi Exp $ */ #include <X11/IntrinsicP.h> @@ -563,7 +563,7 @@ { double xfact, yfact; XPoint points[(sizeof(lin) / sizeof(lin[0])) >> 1]; - int i, x, y, width, height; + int i = 0, x = 0, y = 0, width, height; if (rotate) { xfact = (xe - xs) / 80.0; @@ -650,48 +650,46 @@ XtUnmapWidget(work); while (adj) { - xf86cfgScreen *scr, *topscr, *botscr, *lefscr, *rigscr; + xf86cfgScreen *scr = NULL, + *topscr = NULL, *botscr = NULL, *lefscr = NULL, *rigscr = NULL; for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_screen) break; + if (i < computer.num_screens) scr = computer.screens[i]; if (adj->adj_top != NULL) { for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_top) break; - topscr = computer.screens[i]; + if (i < computer.num_screens) + topscr = computer.screens[i]; } - else - topscr = NULL; if (adj->adj_bottom != NULL) { for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_bottom) break; - botscr = computer.screens[i]; + if (i < computer.num_screens) + botscr = computer.screens[i]; } - else - botscr = NULL; if (adj->adj_left != NULL) { for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_left) break; - lefscr = computer.screens[i]; + if (i < computer.num_screens) + lefscr = computer.screens[i]; } - else - lefscr = NULL; if (adj->adj_right != NULL) { for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_right) break; - rigscr = computer.screens[i]; + if (i < computer.num_screens) + rigscr = computer.screens[i]; } - else - rigscr = NULL; if (lefscr == NULL && rigscr == NULL && topscr == NULL && lefscr == NULL) { XF86ConfScreenPtr s; @@ -700,20 +698,22 @@ s = xf86findScreen(adj->adj_refscreen, XF86Config->conf_screen_lst); for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == s) - break; - switch (adj->adj_where) { - case CONF_ADJ_RIGHTOF: - lefscr = computer.screens[i]; - break; - case CONF_ADJ_LEFTOF: - rigscr = computer.screens[i]; - break; - case CONF_ADJ_ABOVE: - botscr = computer.screens[i]; - break; - case CONF_ADJ_BELOW: - topscr = computer.screens[i]; break; + if (i < computer.num_screens) { + switch (adj->adj_where) { + case CONF_ADJ_RIGHTOF: + lefscr = computer.screens[i]; + break; + case CONF_ADJ_LEFTOF: + rigscr = computer.screens[i]; + break; + case CONF_ADJ_ABOVE: + botscr = computer.screens[i]; + break; + case CONF_ADJ_BELOW: + topscr = computer.screens[i]; + break; + } } } } @@ -923,7 +923,7 @@ qsort(computer.screens, computer.num_screens, sizeof(xf86cfgScreen*), qcmp_screen); - adj = prev, base = NULL; + adj = prev = left = base = NULL; for (i = p = scrno = 0; i < computer.num_screens; i++) { XF86ConfScreenPtr scr = computer.screens[i]->screen; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c:1.6 xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c:1.6 Wed Dec 6 10:35:34 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c Mon Jan 7 15:38:29 2002 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c,v 1.6 2000/12/06 15:35:34 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/startx.c,v 1.7 2002/01/07 20:38:29 dawes Exp $ */ #include "config.h" @@ -86,7 +86,12 @@ if ((home = getenv("HOME")) == NULL) home = "/"; +#ifndef QNX4 XmuSnprintf(filename, sizeof(filename), "%s/XF86Config.new", home); +#else + XmuSnprintf(filename, sizeof(filename), "//%d%s/XF86Config.new", + getnid(), home); +#endif /* this memory is never released, even if the value of XF86Config_path is * changed. Index: xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h:1.2 xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h:1.3 --- xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h:1.2 Mon Oct 23 17:16:52 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h Tue Jul 31 20:44:57 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h,v 1.2 2000/10/23 21:16:52 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h,v 1.3 2001/08/01 00:44:57 tsi Exp $ */ #ifndef _xf86cfg_stubs_h @@ -34,10 +34,9 @@ #include <stdarg.h> -#if !defined(USE_MODULES) int ErrorF(const char*, ...); int VErrorF(const char*, va_list); -#else +#if defined(USE_MODULES) extern int xf86Verbose; #endif Index: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.10.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.14 --- xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.10.2.1 Mon May 21 18:24:02 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c Wed Oct 31 17:50:30 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.10.2.1 2001/05/21 22:24:02 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.14 2001/10/31 22:50:30 tsi Exp $ */ #include <stdio.h> @@ -40,6 +40,7 @@ #include "cards.h" #include "config.h" #include "xf86config.h" +#include "loader.h" #define XKB_RULES_DIR "/usr/X11R6/lib/X11/xkb/rules" @@ -80,14 +81,6 @@ static XF86ConfInactivePtr CopyInactive(XF86ConfInactivePtr); static void FreeLayout(XF86ConfLayoutPtr); -#ifdef USE_MODULES -extern void LoaderInit(void); -extern void LoaderSetPath(char*); -extern char **LoaderListDirs(char**, char**); - -extern int xf86Verbose; -#endif - extern int string_to_parser_range(char*, parser_range*, int); #define PARSER_RANGE_SIZE 256 /* string must have at least 256 bytes */ @@ -130,6 +123,10 @@ static int first = 1; int i, choice = CONF_MOUSE; +#ifdef USE_MODULES + if (!nomodules) + LoaderInitializeOptions(); +#endif initscr(); noecho(); nonl(); @@ -656,7 +653,7 @@ refresh(); input->inp_identifier = DialogInput("Keyboard identifier", - "Enter an identifier for your mouse definition:", + "Enter an identifier for your keyboard definition:", 11, 40, label, " Next >>", " Cancel ", 0); if (input->inp_identifier == NULL) { @@ -1057,13 +1054,6 @@ CardsEntry *entry = NULL; static char **drivers; static int ndrivers; -#ifdef USE_MODULES - static char *path = NULL, *modules = "lib/modules"; - const char *subdirs[] = { - "drivers", - NULL - }; -#endif static char *xdrivers[] = { "apm", "ark", @@ -1095,19 +1085,19 @@ #ifdef USE_MODULES if (!nomodules) { - if (XF86Module_path == NULL) { - XF86Module_path = XtMalloc(strlen(XFree86Dir) + strlen(modules) + 2); - sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules); - } + xf86cfgModuleOptions *opts = module_options; - if (drivers == NULL) { - xf86Verbose = 0; - LoaderInit(); - path = XtNewString(XF86Module_path); - LoaderSetPath(path); - drivers = LoaderListDirs((char**)subdirs, NULL); - for (; drivers[ndrivers]; ndrivers++) - ; + drivers = NULL; + ndrivers = 0; + while (opts) { + if (opts->chipsets) { + ++ndrivers; + drivers = (char**)XtRealloc((XtPointer)drivers, + ndrivers * sizeof(char*)); + /* XXX no private copy */ + drivers[ndrivers - 1] = opts->name; + } + opts = opts->next; } } else @@ -1240,6 +1230,7 @@ for (i = ncards; i > 0; i--) cards[i] = cards[i - 1]; cards[0] = "** Unlisted card **"; + ++ncards; } if (device->dev_card) entry = LookupCard(device->dev_card); @@ -1364,7 +1355,7 @@ XF86ConfDevicePtr device; XF86ConfMonitorPtr monitor; XF86ConfDisplayPtr display; - XF86ModePtr mode, ptr; + XF86ModePtr mode, ptr = NULL; char *checks; nlist = 0; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c:1.4 xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c:1.4 Tue Nov 14 16:59:24 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c Sat Jul 7 19:00:43 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.4 2000/11/14 21:59:24 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.7 2001/07/07 23:00:43 paulo Exp $ */ /* @@ -118,7 +118,8 @@ static void TestCallback(Widget, XtPointer, XtPointer); static void TestTimeout(XtPointer, XtIntervalId*); static void StopTestCallback(Widget, XtPointer, XtPointer); - +static int ForceAddMode(void); +static int AddMode(void); /* * Initialization */ @@ -133,7 +134,7 @@ static int invert_vclk, blank1, blank2, early_sc, screenno; static int (*XtErrorFunc)(Display*, XErrorEvent*); static Widget labels[VSYNC + 1], values[VSYNC + 1], repeater, monitor, - monitorb, add, text, vesab, vesap, forceshell, testshell; + monitorb, add, text, vesab, vesap, forceshell, testshell, addshell; static int MajorVersion, MinorVersion, EventBase, ErrorBase; static XtIntervalId timeout; @@ -441,21 +442,9 @@ fprintf(stderr, "Minimum required version is %d.%d\n", MINMAJOR, MINMINOR); return (False); - } - else { - int i; - Display *display = XtDisplay(toplevel); - - computer.num_vidmodes = ScreenCount(display); - computer.vidmodes = (xf86cfgVidmode**) - XtMalloc(sizeof(xf86cfgVidmode*) * computer.num_vidmodes); - for (i = 0; i < computer.num_vidmodes; i++) { - - computer.vidmodes[i] = (xf86cfgVidmode*) - XtCalloc(1, sizeof(xf86cfgVidmode)); - computer.vidmodes[i]->screen = i; - } } + else + InitializeVidmodes(); vtune = XtCreateWidget("vidtune", formWidgetClass, work, NULL, 0); @@ -588,6 +577,23 @@ } void +InitializeVidmodes(void) +{ + int i; + Display *display = XtDisplay(toplevel); + + computer.num_vidmodes = ScreenCount(display); + computer.vidmodes = (xf86cfgVidmode**) + XtMalloc(sizeof(xf86cfgVidmode*) * computer.num_vidmodes); + for (i = 0; i < computer.num_vidmodes; i++) { + + computer.vidmodes[i] = (xf86cfgVidmode*) + XtCalloc(1, sizeof(xf86cfgVidmode)); + computer.vidmodes[i]->screen = i; + } +} + +void VideoModeConfigureStart(void) { vidtune = computer.vidmodes[screenno]; @@ -686,10 +692,14 @@ vidtune->monitor->mon_identifier, NULL); XtSetSensitive(add, True); - XmuSnprintf(string, sizeof(string), "%dx%d@%d", - modeline.hdisplay, modeline.vdisplay, - (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / - (double)modeline.vtotal)); + if (modeline.htotal && modeline.vtotal) + XmuSnprintf(string, sizeof(string), "%dx%d@%d", + modeline.hdisplay, modeline.vdisplay, + (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / + (double)modeline.vtotal)); + else + XmuSnprintf(string, sizeof(string), "%dx%d", + modeline.hdisplay, modeline.vdisplay); XtVaSetValues(text, XtNstring, string, NULL); } else { @@ -715,15 +725,17 @@ static void UpdateSyncRates(Bool update) { - hsync_rate = (dot_clock * 1000) / modeline.htotal; - vsync_rate = (hsync_rate * 1000) / modeline.vtotal; - if (modeline.flags & V_INTERLACE) - vsync_rate *= 2; - else if (modeline.flags & V_DBLSCAN) - vsync_rate /= 2; - if (update) { - SetLabel(HSYNC, hsync_rate); - SetLabel(VSYNC, vsync_rate); + if (modeline.htotal && modeline.vtotal) { + hsync_rate = (dot_clock * 1000) / modeline.htotal; + vsync_rate = (hsync_rate * 1000) / modeline.vtotal; + if (modeline.flags & V_INTERLACE) + vsync_rate *= 2; + else if (modeline.flags & V_DBLSCAN) + vsync_rate /= 2; + if (update) { + SetLabel(HSYNC, hsync_rate); + SetLabel(VSYNC, vsync_rate); + } } } @@ -988,10 +1000,14 @@ UpdateCallback(w, call_data, client_data); - XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", - modeline.hdisplay, modeline.vdisplay, - (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / - (double)modeline.vtotal)); + if (modeline.htotal && modeline.vtotal) + XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", + modeline.hdisplay, modeline.vdisplay, + (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / + (double)modeline.vtotal)); + else + XmuSnprintf(label, sizeof(label), "%dx%d", + modeline.hdisplay, modeline.vdisplay); XtSetArg(args[0], XtNlabel, label); XtSetValues(mode, args, 1); } @@ -1056,6 +1072,7 @@ { xf86cfgVesaModeInfo *vesa = (xf86cfgVesaModeInfo*)call_data; XF86VidModeModeInfo mode; + int num_infos = vidtune->num_infos; memcpy(&mode, &vesa->info, sizeof(XF86VidModeModeInfo)); if (XF86VidModeAddModeLine(XtDisplay(toplevel), vidtune->screen, @@ -1063,8 +1080,54 @@ XSync(XtDisplay(toplevel), False); GetModes(); } - else - XBell(XtDisplay(w), 80); + else { + XBell(XtDisplayOfObject(w), 80); + return; + } + + if (vidtune && num_infos == vidtune->num_infos) { + /* XF86VidModeAddModeLine returned True, but no modeline was added */ + XBell(XtDisplayOfObject(w), 80); + if (vidtune->monitor && AddMode()) { + XF86ConfModeLinePtr mode; + char label[256], *ptr, *str; + + XmuSnprintf(label, sizeof(label), "%s", vesa->ident); + + /* format mode name to not have spaces */ + ptr = strchr(label, ')'); + if (ptr) + *++ptr = '\0'; + ptr = str = label; + while (*ptr) { + if (*ptr != ' ') + *str++ = *ptr; + ++ptr; + } + *str = '\0'; + + if (xf86findModeLine(label, vidtune->monitor->mon_modeline_lst) + != NULL && !ForceAddMode()) + return; + + mode = (XF86ConfModeLinePtr)XtCalloc(1, sizeof(XF86ConfModeLineRec)); + mode->ml_identifier = XtNewString(label); + mode->ml_clock = vesa->info.dotclock; + mode->ml_hdisplay = vesa->info.hdisplay; + mode->ml_hsyncstart = vesa->info.hsyncstart; + mode->ml_hsyncend = vesa->info.hsyncend; + mode->ml_htotal = vesa->info.htotal; + mode->ml_vdisplay = vesa->info.vdisplay; + mode->ml_vsyncstart = vesa->info.vsyncstart; + mode->ml_vsyncend = vesa->info.vsyncend; + mode->ml_vtotal = vesa->info.vtotal; +/* mode->ml_vscan = ???;*/ + mode->ml_flags = vesa->info.flags; + mode->ml_hskew = vesa->info.hskew; + vidtune->monitor->mon_modeline_lst = + xf86addModeLine(vidtune->monitor->mon_modeline_lst, mode); + } + } } static void @@ -1089,21 +1152,31 @@ for (i = 0; i < vidtune->num_infos; i++) { Widget sme; - XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", - vidtune->infos[i]->hdisplay, - vidtune->infos[i]->vdisplay, - (int)((double)vidtune->infos[i]->dotclock / - (double)vidtune->infos[i]->htotal * 1000.0 / - (double)vidtune->infos[i]->vtotal)); + if ((double)vidtune->infos[i]->htotal && + (double)vidtune->infos[i]->vtotal) + XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", + vidtune->infos[i]->hdisplay, + vidtune->infos[i]->vdisplay, + (int)((double)vidtune->infos[i]->dotclock / + (double)vidtune->infos[i]->htotal * 1000.0 / + (double)vidtune->infos[i]->vtotal)); + else + XmuSnprintf(label, sizeof(label), "%dx%d", + vidtune->infos[i]->hdisplay, + vidtune->infos[i]->vdisplay); sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0); XtAddCallback(sme, XtNcallback, SelectCallback, (XtPointer)vidtune->infos[i]); } - XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", - modeline.hdisplay, modeline.vdisplay, - (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / - (double)modeline.vtotal)); + if (modeline.htotal && modeline.vtotal) + XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", + modeline.hdisplay, modeline.vdisplay, + (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / + (double)modeline.vtotal)); + else + XmuSnprintf(label, sizeof(label), "%dx%d", + modeline.hdisplay, modeline.vdisplay); XtSetArg(args[0], XtNlabel, label); XtSetValues(mode, args, 1); } @@ -1118,13 +1191,6 @@ do_force = (long)user_data; } -void -CancelForceAddModeAction(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - PopdownForce(w, (XtPointer)False, NULL); -} - static int ForceAddMode(void) { @@ -1148,6 +1214,51 @@ XtAppProcessEvent(XtWidgetToApplicationContext(forceshell), XtIMAll); return (do_force); +} + +static int do_add, asking_add; + +static void +PopdownAdd(Widget w, XtPointer user_data, XtPointer call_data) +{ + asking_add = 0; + XtPopdown(addshell); + do_add = (long)user_data; +} + +void +CancelAddModeAction(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + if (asking_force) + PopdownForce(w, (XtPointer)False, NULL); + else if (asking_add) + PopdownAdd(w, (XtPointer)False, NULL); +} + +static int +AddMode(void) +{ + if (addshell == NULL) { + Widget dialog; + + addshell = XtCreatePopupShell("addMode", transientShellWidgetClass, + toplevel, NULL, 0); + dialog = XtVaCreateManagedWidget("dialog", dialogWidgetClass, + addshell, XtNvalue, NULL, NULL, 0); + XawDialogAddButton(dialog, "yes", PopdownAdd, (XtPointer)True); + XawDialogAddButton(dialog, "no", PopdownAdd, (XtPointer)False); + XtRealizeWidget(addshell); + XSetWMProtocols(DPY, XtWindow(addshell), &wm_delete_window, 1); + } + + asking_add = 1; + + XtPopup(addshell, XtGrabExclusive); + while (asking_add) + XtAppProcessEvent(XtWidgetToApplicationContext(addshell), XtIMAll); + + return (do_add); } /*ARGSUSED*/ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h:1.1 xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h:1.3 --- xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h:1.1 Thu May 18 12:30:00 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h Sat Jul 7 19:00:43 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h,v 1.1 2000/05/18 16:30:00 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h,v 1.3 2001/07/07 23:00:43 paulo Exp $ */ #ifndef _xf86cfg_vidmode_h @@ -52,8 +52,9 @@ void VideoModeConfigureStart(void); void VideoModeConfigureEnd(void); void VidmodeRestoreAction(Widget, XEvent*, String*, Cardinal*); -void CancelForceAddModeAction(Widget, XEvent*, String*, Cardinal*); +void CancelAddModeAction(Widget, XEvent*, String*, Cardinal*); void CancelTestModeAction(Widget, XEvent*, String*, Cardinal*); +void InitializeVidmodes(void); /* * Initialization Index: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man:1.6.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man:1.6.2.1 Mon May 21 18:24:02 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man Mon May 21 18:21:57 2001 @@ -26,7 +26,7 @@ .\" .\" Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.6.2.1 2001/05/21 22:24:02 paulo Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.7 2001/05/21 22:21:57 paulo Exp $ .\" .TH xf86cfg 1 __vendorversion__ .SH NAME Index: xc/programs/Xserver/hw/xfree86/xf86config/Cards diff -u xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.76 xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.78 --- xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.76 Sun Apr 1 10:00:16 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/Cards Fri Jun 22 21:55:12 2001 @@ -18,18 +18,20 @@ # 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.76 2001/04/01 14:00:16 tsi Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.78 2001/06/23 01:55:12 paulo Exp $ # VGA -NAME Generic VGA compatible -CHIPSET Generic VGA +NAME * Generic VGA compatible SERVER VGA16 DRIVER vga -NAME Unsupported VGA compatible -CHIPSET Generic VGA +NAME * Generic VESA compatible SERVER VGA16 +DRIVER vesa + +NAME * Unsupported VGA compatible +SERVER VGA16 DRIVER vga UNSUPPORTED @@ -151,7 +153,6 @@ #tested NAME Cirrus Logic GD542x -CHIPSET CL-GD5420/2/4/6/8/9 SERVER SVGA DRIVER vga UNSUPPORTED @@ -407,7 +408,6 @@ SEE Cirrus Logic GD542x NAME Octek AVGA-20 -CHIPSET CL-GD5420 SEE Cirrus Logic GD542x # S3 801/805 @@ -550,7 +550,6 @@ # S3 864/Trio64/Trio32/868 NAME S3 864 (generic) -CHIPSET S3 864 SERVER S3 DRIVER vga UNSUPPORTED @@ -624,7 +623,6 @@ SEE S3 868 with ATT 20C498 or 21C498 NAME S3 Trio64 (generic) -CHIPSET S3 Trio64 SERVER S3 DRIVER vga UNSUPPORTED @@ -634,7 +632,6 @@ SEE S3 Trio64 (generic) NAME S3 Trio64V+ (generic) -CHIPSET S3 Trio64V+ SERVER S3 DRIVER vga UNSUPPORTED @@ -796,7 +793,6 @@ # S3 Trio64V2 NAME S3 Trio64V2 (generic) -CHIPSET S3 Trio64V2 SERVER S3 DRIVER vga UNSUPPORTED @@ -1426,16 +1422,16 @@ # currently unsupported S3 NAME S3 86C365 (Trio3D) -SEE Unsupported VGA compatible +SEE * Unsupported VGA compatible NAME S3 86C391 (Savage3D) -SEE Unsupported VGA compatible +SEE * Unsupported VGA compatible NAME S3 Trio3D -SEE Unsupported VGA compatible +SEE * Unsupported VGA compatible NAME S3 Savage3D -SEE Unsupported VGA compatible +SEE * Unsupported VGA compatible NAME S3 Savage4 SERVER SVGA @@ -2155,7 +2151,6 @@ UNSUPPORTED NAME Trident 8900D (generic) -CHIPSET TVGA8900D SERVER SVGA DRIVER vga UNSUPPORTED @@ -2281,10 +2276,10 @@ NOCLOCKPROBE NAME Trident TVGA 8800BR -SEE Generic VGA compatible +SEE * Generic VGA compatible NAME Trident TVGA 8800CS -SEE Generic VGA compatible +SEE * Generic VGA compatible NAME Trident CyberBlade (generic) CHIPSET CyberBlade @@ -2301,7 +2296,7 @@ # SiS NAME SiS 530 -CHIPSET SIS520 +CHIPSET SIS530 SERVER SVGA DRIVER sis Index: xc/programs/Xserver/hw/xfree86/xf86config/cards.c diff -u xc/programs/Xserver/hw/xfree86/xf86config/cards.c:3.15 xc/programs/Xserver/hw/xfree86/xf86config/cards.c:3.16 --- xc/programs/Xserver/hw/xfree86/xf86config/cards.c:3.15 Mon Jul 5 08:12:05 1999 +++ xc/programs/Xserver/hw/xfree86/xf86config/cards.c Wed Jul 25 11:05:09 2001 @@ -4,7 +4,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.c,v 3.15 1999/07/05 12:12:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.c,v 3.16 2001/07/25 15:05:09 dawes Exp $ */ /* * Functions to manipulate card database. @@ -273,14 +273,8 @@ return 0; } -#ifdef __STDC__ -#define CONST const -#else -#define CONST -#endif - static int -compare_card(CONST void *e1, CONST void *e2) +compare_card(const void *e1, const void *e2) { return strcmp(((Card *)e1)->name, ((Card *)e2)->name); } Index: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c diff -u xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.57 xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.59 --- xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.57 Mon Apr 23 13:15:58 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c Sat Oct 27 23:34:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.57 2001/04/23 17:15:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.59 2001/10/28 03:34:09 tsi Exp $ */ /* * This is a configuration program that will create a base XF86Config @@ -205,6 +205,9 @@ char *config_ramdac; char *config_dacspeed; char *config_clockchip; +#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) +char *config_keyboard_dev = "/dev/wskbd0"; +#endif int config_xkbdisable = 0; char *config_xkbrules; char *config_xkbmodel = "pc101"; @@ -297,7 +300,8 @@ #ifndef __EMX__ /* length of prefix + 20 (digits in 2**64) + 1 (slash) + 1 */ temp_dir = Malloc(strlen(TEMPORARY_XF86CONFIG_DIR_PREFIX) + 22); - sprintf(temp_dir, "%s%d", TEMPORARY_XF86CONFIG_DIR_PREFIX, getpid()); + sprintf(temp_dir, "%s%ld", TEMPORARY_XF86CONFIG_DIR_PREFIX, + (long)getpid()); if (mkdir(temp_dir, 0700) != 0) { printf("Cannot create directory %s\n", temp_dir); exit(-1); @@ -590,6 +594,12 @@ "Do you want to select additional XKB options (group switcher,\n" "group indicator, etc.)? "; +#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) +static char *kbdevtext = +"Please enter the device name for your keyboard or just press enter\n" +"for the default of wskbd0\n\n"; +#endif + static void keyboard_configuration(void) { @@ -599,6 +609,15 @@ int number, options[MAX_XKBOPTIONS], num_options; XkbRF_RulesPtr rules; +#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) + printf(kbdevtext); + getstring(s); + if (strlen(s) != 0) { + config_keyboard_dev = Malloc(strlen(s) + 1); + strcpy(config_keyboard_dev, s); + } +#endif + #ifdef XFREE98_XKB config_xkbrules = "xfree98"; /* static */ rulesfile = XKB_RULES_DIR "/xfree98"; @@ -2353,6 +2372,12 @@ fprintf(f, "# Option \"LeftAlt\" \"Meta\"\n"); fprintf(f, "# Option \"RightAlt\" \"ModeShift\"\n"); } +#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) + /* wscons keyoards need a protocol line */ + fprintf(f, " Option \"Protocol\" \"wskbd\"\n"); + fprintf(f, " Option \"Device\" \"%s\"\n", config_keyboard_dev); + fprintf(f, " Option \"XkbKeycodes\" \"wscons(ppc)\"\n"); +#endif fprintf(f, "%s", keyboardchunk2_text); fprintf(f, "%s", keyboardchunk3_text); Index: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man diff -u xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man:1.4 xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man:1.5 --- xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man:1.4 Sat Jan 27 13:20:59 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man Thu Nov 1 18:35:34 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man,v 1.4 2001/01/27 18:20:59 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man,v 1.5 2001/11/01 23:35:34 dawes Exp $ .TH xf86config 1 __vendorversion__ .SH NAME xf86config \- generate an XF86Config file @@ -7,6 +7,10 @@ .SH DESCRIPTION \fIxf86config\fP is an interactive program for generating an XF86Config file for use with XFree86 X servers. +.PP +Note that the default name used by \fIxf86config\fP for the XF86Config file +is system-dependent. For instance, on some systems, XF86Config-4 is used, +and on OS/2, XConfig is used. .SH FILES <xroot>/lib/X11/Cards Video cards database .SH "SEE ALSO" Index: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgc.c diff -u xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgc.c:1.3 xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgc.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgc.c:1.3 Fri Feb 11 01:33:46 2000 +++ xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgc.c Fri Dec 14 14:59:52 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgc.c,v 1.3 2000/02/11 06:33:46 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgc.c,v 1.4 2001/12/14 19:59:52 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgcunder.c diff -u xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgcunder.c:1.2 xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgcunder.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgcunder.c:1.2 Sat Feb 12 00:43:24 2000 +++ xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgcunder.c Fri Dec 14 14:59:52 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgcunder.c,v 1.2 2000/02/12 05:43:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbgcunder.c,v 1.5 2001/12/14 19:59:52 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -58,6 +62,7 @@ #include "mistruct.h" #include "mibstore.h" #include "migc.h" +#include "mioverlay.h" #include "cfbmskbits.h" #include "cfb8bit.h" @@ -400,7 +405,7 @@ { GCOps *newops; - if (newops = cfb32MatchCommon_Underlay (pGC, devPriv)) + if ((newops = cfb32MatchCommon_Underlay (pGC, devPriv))) { if (pGC->ops->devPrivate.val) miDestroyGCOps (pGC->ops); Index: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbpntwin.c diff -u xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbpntwin.c:1.4 xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbpntwin.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbpntwin.c:1.4 Mon Feb 28 19:17:16 2000 +++ xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbpntwin.c Mon Oct 1 09:44:15 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbpntwin.c,v 1.4 2000/02/29 00:17:16 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbpntwin.c,v 1.5 2001/10/01 13:44:15 eich Exp $ */ #include "X.h" @@ -52,7 +52,7 @@ } } #endif - cfb32FillBoxTileOddCopy ((DrawablePtr)pWin, + cfb32FillBoxTileOddGeneral ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pWin->background.pixmap, xorg, yorg, GXcopy, (pWin->drawable.depth == 24) ? 0x00ffffff : 0xff000000); @@ -100,7 +100,7 @@ } } #endif - cfb32FillBoxTileOddCopy ((DrawablePtr)pWin, + cfb32FillBoxTileOddGeneral ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pWin->border.pixmap, xorg, yorg, GXcopy, (pWin->drawable.depth == 24) ? 0x00ffffff : 0xff000000); Index: xc/programs/Xserver/hw/xfree86/xf8_32wid/cfbwindow.c diff -u xc/programs/Xserver/hw/xfree86/xf8_32wid/cfbwindow.c:1.1 xc/programs/Xserver/hw/xfree86/xf8_32wid/cfbwindow.c:1.2 --- xc/programs/Xserver/hw/xfree86/xf8_32wid/cfbwindow.c:1.1 Sat May 20 21:02:44 2000 +++ xc/programs/Xserver/hw/xfree86/xf8_32wid/cfbwindow.c Sat Oct 27 23:34:09 2001 @@ -7,7 +7,7 @@ Mark Vojkovich's work. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32wid/cfbwindow.c,v 1.1 2000/05/21 01:02:44 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32wid/cfbwindow.c,v 1.2 2001/10/28 03:34:09 tsi Exp $ */ #include "X.h" #include "scrnintstr.h" @@ -63,16 +63,15 @@ static void SegregateChildrenBpp(WindowPtr pWin, RegionPtr pReg, int subtract, int bpp, int other_bpp) { - ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pChild; for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->drawable.bitsPerPixel == bpp) { if (subtract) { - REGION_SUBTRACT(pScreen, pReg, + REGION_SUBTRACT(pWin->drawable.pScreen, pReg, pReg, &pChild->borderClip); } else { - REGION_UNION(pScreen, pReg, + REGION_UNION(pWin->drawable.pScreen, pReg, pReg, &pChild->borderClip); } if (pChild->firstChild) Index: xc/programs/Xserver/hw/xnest/Display.c diff -u xc/programs/Xserver/hw/xnest/Display.c:3.2 xc/programs/Xserver/hw/xnest/Display.c:3.4 --- xc/programs/Xserver/hw/xnest/Display.c:3.2 Wed Jan 17 17:36:55 2001 +++ xc/programs/Xserver/hw/xnest/Display.c Sat Oct 27 23:34:10 2001 @@ -12,11 +12,11 @@ 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Display.c,v 3.4 2001/10/28 03:34:10 tsi Exp $ */ -#include "X.h" -#include "Xproto.h" +#include <X11/X.h> +#include <X11/Xproto.h> #include "screenint.h" #include "input.h" #include "misc.h" @@ -185,8 +185,6 @@ void xnestCloseDisplay() { - int i; - if (!xnestDoFullGeneration || !xnestDisplay) return; /* Index: xc/programs/Xserver/hw/xnest/Events.c diff -u xc/programs/Xserver/hw/xnest/Events.c:1.1.1.4 xc/programs/Xserver/hw/xnest/Events.c:1.2 --- xc/programs/Xserver/hw/xnest/Events.c:1.1.1.4 Tue Jan 16 17:43:44 2001 +++ xc/programs/Xserver/hw/xnest/Events.c Tue Jul 31 20:44:57 2001 @@ -12,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Events.c,v 1.2 2001/08/01 00:44:57 tsi Exp $ */ + #include "X.h" #define NEED_EVENTS #include "Xproto.h" @@ -22,8 +24,11 @@ #include "windowstr.h" #include "servermd.h" +#include "mi.h" + #include "Xnest.h" +#include "Color.h" #include "Display.h" #include "Screen.h" #include "XNWindow.h" Index: xc/programs/Xserver/hw/xnest/GC.c diff -u xc/programs/Xserver/hw/xnest/GC.c:3.5 xc/programs/Xserver/hw/xnest/GC.c:3.6 --- xc/programs/Xserver/hw/xnest/GC.c:3.5 Wed Jan 17 17:36:55 2001 +++ xc/programs/Xserver/hw/xnest/GC.c Sat Oct 27 23:34:11 2001 @@ -12,7 +12,7 @@ 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/GC.c,v 3.6 2001/10/28 03:34:11 tsi Exp $ */ #include "X.h" #include "Xproto.h" @@ -132,11 +132,12 @@ if (mask & GCFillRule) values.fill_rule = pGC->fillRule; - if (mask & GCTile) + if (mask & GCTile) { if (pGC->tileIsPixel) mask &= ~GCTile; else values.tile = xnestPixmap(pGC->tile.pixmap); + } if (mask & GCStipple) values.stipple = xnestPixmap(pGC->stipple); @@ -327,8 +328,6 @@ GCPtr pGCDst; { RegionPtr pRgn; - int nRects, size; - xRectangle *pRects; switch (pGCSrc->clientClipType) { Index: xc/programs/Xserver/hw/xnest/Handlers.c diff -u xc/programs/Xserver/hw/xnest/Handlers.c:1.1.1.3 xc/programs/Xserver/hw/xnest/Handlers.c:1.2 --- xc/programs/Xserver/hw/xnest/Handlers.c:1.1.1.3 Tue Jan 16 17:43:46 2001 +++ xc/programs/Xserver/hw/xnest/Handlers.c Tue Jul 31 20:44:57 2001 @@ -12,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Handlers.c,v 1.2 2001/08/01 00:44:57 tsi Exp $ */ + #include "X.h" #include "Xproto.h" #include "screenint.h" @@ -24,6 +26,7 @@ #include "Xnest.h" #include "Display.h" +#include "Events.h" #include "Handlers.h" void xnestBlockHandler(blockData, pTimeout, pReadMask) Index: xc/programs/Xserver/hw/xnest/Imakefile diff -u xc/programs/Xserver/hw/xnest/Imakefile:3.21 xc/programs/Xserver/hw/xnest/Imakefile:3.23 --- xc/programs/Xserver/hw/xnest/Imakefile:3.21 Fri Apr 20 11:51:21 2001 +++ xc/programs/Xserver/hw/xnest/Imakefile Sun Sep 30 13:31:52 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.21 2001/04/20 15:51:21 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.23 2001/09/30 17:31:52 herrb Exp $ #include <Server.tmpl> @@ -59,8 +59,8 @@ -I../../mi -I../../include -I../../os \ -I$(EXTINCSRC) -I$(XINCLUDESRC) -DEFINES = $(OS_DEFINES) $(EXT_DEFINES) -UXINPUT -UMITSHM \ - -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI -UXFree86LOADER +DEFINES = $(OS_DEFINES) $(EXT_DEFINES) -DNO_HW_ONLY_EXTS \ + -UXFree86LOADER -UMITSHM all:: $(OBJS) Index: xc/programs/Xserver/hw/xnest/Init.c diff -u xc/programs/Xserver/hw/xnest/Init.c:3.21 xc/programs/Xserver/hw/xnest/Init.c:3.23 --- xc/programs/Xserver/hw/xnest/Init.c:3.21 Sun Mar 4 12:40:13 2001 +++ xc/programs/Xserver/hw/xnest/Init.c Tue Jul 31 20:44:57 2001 @@ -12,7 +12,7 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Init.c,v 3.21 2001/03/04 17:40:13 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Init.c,v 3.23 2001/08/01 00:44:57 tsi Exp $ */ #include "X.h" #include "Xproto.h" @@ -22,6 +22,8 @@ #include "scrnintstr.h" #include "windowstr.h" #include "servermd.h" +#include "mi.h" +#include "fontstruct.h" #include "Xnest.h" @@ -36,15 +38,6 @@ #include "XNGC.h" #include "XNFont.h" -#ifdef XFree86Server -/* - * when building the loader, we add some code that tries to - * switch bit ordering based on xf86bpp; since Xnest doesn't - * use that, we have to add this dummy here - */ -int xf86bpp = 8; -#endif - Bool xnestDoFullGeneration = True; void InitOutput(screenInfo, argc, argv) @@ -94,7 +87,7 @@ int argc; char *argv[]; { - DeviceIntPtr ptr, kbd; + pointer ptr, kbd; ptr = AddInputDevice(xnestPointerProc, TRUE); kbd = AddInputDevice(xnestKeyboardProc, TRUE); Index: xc/programs/Xserver/hw/xnest/Keyboard.c diff -u xc/programs/Xserver/hw/xnest/Keyboard.c:1.6 xc/programs/Xserver/hw/xnest/Keyboard.c:1.8 --- xc/programs/Xserver/hw/xnest/Keyboard.c:1.6 Sun Mar 25 00:32:15 2001 +++ xc/programs/Xserver/hw/xnest/Keyboard.c Sat Oct 27 23:34:11 2001 @@ -12,7 +12,7 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Keyboard.c,v 1.6 2001/03/25 05:32:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Keyboard.c,v 1.8 2001/10/28 03:34:11 tsi Exp $ */ #define NEED_EVENTS #include "X.h" @@ -55,6 +55,14 @@ #endif ); +extern Status XkbGetControls( +#if NeedFunctionPrototypes + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +#endif +); + #ifndef XKB_BASE_DIRECTORY #define XKB_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb/" #endif @@ -173,9 +181,9 @@ for (j = 0; j < 8; j++) for(i = 0; i < modifier_keymap->max_keypermod; i++) { CARD8 keycode; - if (keycode = + if ((keycode = modifier_keymap-> - modifiermap[j * modifier_keymap->max_keypermod + i]) + modifiermap[j * modifier_keymap->max_keypermod + i])) modmap[keycode] |= 1<<j; } XFreeModifiermap(modifier_keymap); Index: xc/programs/Xserver/hw/xnest/Pixmap.c diff -u xc/programs/Xserver/hw/xnest/Pixmap.c:3.2 xc/programs/Xserver/hw/xnest/Pixmap.c:3.3 --- xc/programs/Xserver/hw/xnest/Pixmap.c:3.2 Wed Jan 17 17:36:55 2001 +++ xc/programs/Xserver/hw/xnest/Pixmap.c Sat Oct 27 23:34:11 2001 @@ -12,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Pixmap.c,v 3.3 2001/10/28 03:34:11 tsi Exp $ */ + #include "X.h" #include "Xproto.h" #include "miscstruct.h" @@ -82,7 +84,6 @@ register int x, y; unsigned long previousPixel, currentPixel; BoxRec Box; - int nWidth; Bool overlap; ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0, Index: xc/programs/Xserver/hw/xnest/TestExt.c diff -u xc/programs/Xserver/hw/xnest/TestExt.c:3.3 xc/programs/Xserver/hw/xnest/TestExt.c:3.5 --- xc/programs/Xserver/hw/xnest/TestExt.c:3.3 Wed Jan 17 17:36:55 2001 +++ xc/programs/Xserver/hw/xnest/TestExt.c Mon Aug 27 13:41:00 2001 @@ -12,17 +12,18 @@ 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/TestExt.c,v 3.5 2001/08/27 17:41:00 dawes Exp $ */ -#include "X.h" -#include "Xproto.h" -#include "Xlib.h" +#include <X11/X.h> +#include <X11/Xproto.h> +#include <X11/Xlib.h> #undef Bool #include "screenint.h" #include "input.h" #include "misc.h" #include "scrnintstr.h" #include "servermd.h" +#include "mipointer.h" #define XTestSERVER_SIDE #include "xtestext1.h" Index: xc/programs/Xserver/hw/xnest/Window.c diff -u xc/programs/Xserver/hw/xnest/Window.c:3.5 xc/programs/Xserver/hw/xnest/Window.c:3.7 --- xc/programs/Xserver/hw/xnest/Window.c:3.5 Wed Jan 17 17:36:55 2001 +++ xc/programs/Xserver/hw/xnest/Window.c Sat Oct 27 23:34:11 2001 @@ -12,7 +12,7 @@ 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Window.c,v 3.7 2001/10/28 03:34:11 tsi Exp $ */ #include "X.h" #include "Xproto.h" @@ -24,6 +24,8 @@ #include "scrnintstr.h" #include "region.h" +#include "mi.h" + #include "Xnest.h" #include "Display.h" @@ -290,23 +292,26 @@ break; } - if (mask & CWBackPixel) + if (mask & CWBackPixel) { if (pWin->backgroundState == BackgroundPixel) attributes.background_pixel = xnestPixel(pWin->background.pixel); else mask &= ~CWBackPixel; + } - if (mask & CWBorderPixmap) + if (mask & CWBorderPixmap) { if (pWin->borderIsPixel) mask &= ~CWBorderPixmap; else attributes.border_pixmap = xnestPixmap(pWin->border.pixmap); + } - if (mask & CWBorderPixel) + if (mask & CWBorderPixel) { if (pWin->borderIsPixel) attributes.border_pixel = xnestPixel(pWin->border.pixel); else mask &= ~CWBorderPixel; + } if (mask & CWBitGravity) attributes.bit_gravity = pWin->bitGravity; @@ -490,7 +495,6 @@ BoxPtr pBox; XRectangle rect; int i; - Bool overlap; if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape, wBoundingShape(pWin))) { Index: xc/programs/Xserver/hw/xnest/Xnest.h diff -u xc/programs/Xserver/hw/xnest/Xnest.h:1.1.1.2 xc/programs/Xserver/hw/xnest/Xnest.h:1.3 --- xc/programs/Xserver/hw/xnest/Xnest.h:1.1.1.2 Tue Jan 16 17:43:54 2001 +++ xc/programs/Xserver/hw/xnest/Xnest.h Tue Aug 28 12:48:08 2001 @@ -28,6 +28,7 @@ from the X Consortium. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Xnest.h,v 1.3 2001/08/28 16:48:08 tsi Exp $ */ /* ** Machines with a 64 bit library interface and a 32 bit server require @@ -65,8 +66,8 @@ #endif /*_XSERVER64*/ #define GC XlibGC -#include "Xlib.h" -#include "Xutil.h" +#include <X11/Xlib.h> +#include <X11/Xutil.h> #include <X11/extensions/shape.h> #undef GC Index: xc/programs/Xserver/hw/xwin/Imakefile diff -u xc/programs/Xserver/hw/xwin/Imakefile:1.6 xc/programs/Xserver/hw/xwin/Imakefile:1.12 --- xc/programs/Xserver/hw/xwin/Imakefile:1.6 Wed Apr 25 15:44:02 2001 +++ xc/programs/Xserver/hw/xwin/Imakefile Sun Nov 11 17:45:57 2001 @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.6 2001/04/25 19:44:02 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.12 2001/11/11 22:45:57 alanh Exp $ #include <Server.tmpl> @@ -9,7 +9,7 @@ MMAPDEF = -DHAS_MMAP -SRCSA = InitInput.c \ +SRCS = InitInput.c \ InitOutput.c \ stubs.c \ wingc.c \ @@ -35,9 +35,15 @@ winshadddnl.c \ winpfbdd.c \ winkeybd.c \ - winmouse.c + winmouse.c \ + wincutpaste.c \ + winnativegdi.c \ + winlayer.c \ + winerror.c \ + winengine.c \ + wincreatewnd.c -OBJSA = InitInput.o \ +OBJS = InitInput.o \ InitOutput.o \ stubs.o \ wingc.o \ @@ -63,32 +69,29 @@ winshadddnl.o \ winpfbdd.o \ winkeybd.o \ - winmouse.o + winmouse.o \ + wincutpaste.o \ + winnativegdi.o \ + winlayer.o \ + winerror.o \ + winengine.o \ + wincreatewnd.o -INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) -I$(SERVERSRC)/render \ +INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/miext/shadow -I$(SERVERSRC)/miext/layer \ -I$(SERVERSRC)/include -I$(SERVERSRC)/os \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/miext/shadow + -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/render -I$(SERVERSRC)/randr DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI -#if BuildDPMS -SRCSB = dpmsstubs.c -OBJSB = dpmsstubs.o -#endif - -SRCS = $(SRCSA) $(SRCSB) $(SRCSC) -OBJS = $(OBJSA) $(OBJSB) $(OBJSC) - LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) SpecialCObjectRule(stubs,$(ICONFIGFILES),$(EXT_DEFINES)) -#if BuildDPMS -LinkSourceFile(dpmsstubs.c,$(SERVERSRC)/Xext) -SpecialCObjectRule(dpmsstubs,$(ICONFIGFILES),$(EXT_DEFINES)) -#endif - NormalLibraryObjectRule() NormalLibraryTarget(Xwin,$(OBJS)) + +InstallManPage(XWin,$(MANDIR)) DependTarget() Index: xc/programs/Xserver/hw/xwin/InitInput.c diff -u xc/programs/Xserver/hw/xwin/InitInput.c:1.4 xc/programs/Xserver/hw/xwin/InitInput.c:1.9 --- xc/programs/Xserver/hw/xwin/InitInput.c:1.4 Tue May 1 20:45:26 2001 +++ xc/programs/Xserver/hw/xwin/InitInput.c Fri Dec 14 14:59:52 2001 @@ -3,7 +3,11 @@ Copyright 1993, 1998 The Open Group - All Rights Reserved. + 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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,12 +26,13 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.4 2001/05/02 00:45:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.9 2001/12/14 19:59:52 dawes Exp $ */ #include "win.h" CARD32 g_c32LastInputEventTime = 0; + /* Called from dix/devices.c */ /* * All of our keys generate up and down transition notifications, @@ -36,29 +41,44 @@ * An example of a modifier is mapping the A key to the Control key. * A has to be a legal modifier. I think. */ + Bool LegalModifier (unsigned int uiKey, DevicePtr pDevice) { return TRUE; } + /* Called from dix/dispatch.c */ -/* We tell mi to dequeue the events that we have sent it */ +/* + * Run through the Windows message queue(s) one more time. + * Tell mi to dequeue the events that we have sent it. + */ void ProcessInputEvents (void) { +#if CYGDEBUG + ErrorF ("ProcessInputEvents ()\n"); +#endif + mieqProcessInputEvents (); miPointerUpdate (); + +#if CYGDEBUG + ErrorF ("ProcessInputEvents () - returning\n"); +#endif } + int TimeSinceLastInputEvent () { - if (g_c32LastInputEventTime == 0) - g_c32LastInputEventTime = GetTickCount (); - return GetTickCount () - g_c32LastInputEventTime; + if (g_c32LastInputEventTime == 0) + g_c32LastInputEventTime = GetTickCount (); + return GetTickCount () - g_c32LastInputEventTime; } + /* See Porting Layer Definition - p. 17 */ void InitInput (int argc, char *argv[]) @@ -87,11 +107,21 @@ /* Open a file descriptor for the Windows message queue */ g_fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY); + if (g_fdMessageQueue == -1) + { + FatalError ("InitInput () - Failed opening /dev/windows\n"); + } + /* Add the message queue as a device to wait for in WaitForSomething */ AddEnabledDevice (g_fdMessageQueue); } + +#if CYGDEBUG + ErrorF ("InitInput () - returning\n"); +#endif } + #ifdef XTESTEXT1 void XTestGenerateEvent (int dev_type, int keycode, int keystate, @@ -100,11 +130,13 @@ ErrorF ("XTestGenerateEvent ()\n"); } + void XTestGetPointerPos (short *fmousex, short *fmousey) { ErrorF ("XTestGetPointerPos ()\n"); } + void XTestJumpPointer (int jx, int jy, int dev_type) Index: xc/programs/Xserver/hw/xwin/InitOutput.c diff -u xc/programs/Xserver/hw/xwin/InitOutput.c:1.8 xc/programs/Xserver/hw/xwin/InitOutput.c:1.27 --- xc/programs/Xserver/hw/xwin/InitOutput.c:1.8 Tue May 8 04:14:09 2001 +++ xc/programs/Xserver/hw/xwin/InitOutput.c Fri Dec 14 14:59:53 2001 @@ -3,7 +3,11 @@ Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,18 +26,24 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.8 2001/05/08 08:14:09 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.27 2001/12/14 19:59:53 dawes Exp $ */ #include "win.h" -int g_nNumScreens; -winScreenInfo g_winScreens[MAXSCREENS]; -int g_nLastScreen = -1; -ColormapPtr g_cmInstalledMaps[MAXSCREENS]; +int g_iNumScreens = 0; +winScreenInfo g_ScreenInfo[MAXSCREENS]; +int g_iLastScreen = -1; int g_fdMessageQueue = WIN_FD_INVALID; -int g_winScreenPrivateIndex = -1; -unsigned long g_winGeneration = 0; +int g_iScreenPrivateIndex = -1; +int g_iCmapPrivateIndex = -1; +int g_iGCPrivateIndex = -1; +int g_iPixmapPrivateIndex = -1; +unsigned long g_ulServerGeneration = 0; +Bool g_fInitializedDefaultScreens = FALSE; +FILE *g_pfLog = NULL; +extern void OsVendorVErrorF (const char *pszFormat, va_list va_args); + static PixmapFormatRec g_PixmapFormats[] = { { 1, 1, BITMAP_SCANLINE_PAD }, { 4, 8, BITMAP_SCANLINE_PAD }, @@ -43,29 +53,57 @@ { 24, 24, BITMAP_SCANLINE_PAD }, { 32, 32, BITMAP_SCANLINE_PAD } }; + const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]); + void winInitializeDefaultScreens (void) { int i; + DWORD dwWidth, dwHeight; - for (i = 0; i < MAXSCREENS; i++) - { - g_winScreens[i].dwScreen = i; - g_winScreens[i].dwWidth = WIN_DEFAULT_WIDTH; - g_winScreens[i].dwHeight = WIN_DEFAULT_HEIGHT; - g_winScreens[i].dwDepth = WIN_DEFAULT_DEPTH; - g_winScreens[i].pixelBlack = WIN_DEFAULT_BLACKPIXEL; - g_winScreens[i].pixelWhite = WIN_DEFAULT_WHITEPIXEL; - g_winScreens[i].dwLineBias = WIN_DEFAULT_LINEBIAS; - g_winScreens[i].pfb = NULL; - g_winScreens[i].fFullScreen = FALSE; - g_winScreens[i].iE3BTimeout = WIN_E3B_OFF; + /* Bail out early if default screens have already been initialized */ + if (g_fInitializedDefaultScreens) + return; + + /* Zero the memory used for storing the screen info */ + ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo)); + + /* Get default width and height */ + dwWidth = GetSystemMetrics (SM_CXSCREEN); + dwHeight = GetSystemMetrics (SM_CYSCREEN); + + ErrorF ("winInitializeDefaultScreens () - w %d h %d\n", dwWidth, dwHeight); + + /* Set a default DPI, if no parameter was passed */ + if (monitorResolution == 0) + monitorResolution = WIN_DEFAULT_DPI; + + for (i = 0; i < MAXSCREENS; ++i) + { + g_ScreenInfo[i].dwScreen = i; + g_ScreenInfo[i].dwWidth = dwWidth; + g_ScreenInfo[i].dwHeight = dwHeight; + g_ScreenInfo[i].dwDepth = WIN_DEFAULT_DEPTH; + g_ScreenInfo[i].dwRefreshRate = WIN_DEFAULT_REFRESH; + g_ScreenInfo[i].pfb = NULL; + g_ScreenInfo[i].fFullScreen = FALSE; + g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF; + g_ScreenInfo[i].dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) + * 25.4; + g_ScreenInfo[i].dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI) + * 25.4; + g_ScreenInfo[i].fUseWinKillKey = WIN_DEFAULT_WIN_KILL; + g_ScreenInfo[i].fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; + g_ScreenInfo[i].fIgnoreInput = FALSE; } - g_nNumScreens = 1; + + /* Signal that the default screens have been initialized */ + g_fInitializedDefaultScreens = TRUE; } + DWORD winBitsPerPixel (DWORD dwDepth) { @@ -75,6 +113,7 @@ else return 32; } + /* See Porting Layer Definition - p. 57 */ void ddxGiveUp() @@ -93,10 +132,21 @@ g_fdMessageQueue = WIN_FD_INVALID; } + /* Close the log file handle */ + if (g_pfLog != NULL) + { + /* Close log file */ + fclose (g_pfLog); + + /* Set the file handle to invalid */ + g_pfLog = NULL; + } + /* Tell Windows that we want to end the app */ PostQuitMessage (0); } + /* See Porting Layer Definition - p. 57 */ void AbortDDX (void) @@ -107,169 +157,365 @@ ddxGiveUp (); } + void OsVendorInit (void) { -#if CYGDEBUG - ErrorF ("OsVendorInit ()\n"); +#ifdef DDXOSVERRORF + if (!OsVendorVErrorFProc) + OsVendorVErrorFProc = OsVendorVErrorF; + + /* Open log file if not yet open */ + if (g_pfLog == NULL) + g_pfLog = fopen (WIN_LOG_FNAME, "w"); #endif + + /* Add a default screen if no screens were specified */ + if (g_iNumScreens == 0) + { + /* + * We need to initialize default screens if no arguments + * were processed. Otherwise, the default screens would + * already have been initialized by ddxProcessArgument (). + */ + winInitializeDefaultScreens (); + + /* + * Add a screen 0 using the defaults set by + * winInitializeDefaultScreens () and any additional parameters + * processed by ddxProcessArgument (). + */ + g_iNumScreens = 1; + g_iLastScreen = 0; + } } + /* See Porting Layer Definition - p. 57 */ void ddxUseMsg (void) { - ErrorF ("-screen n WxHxD\n"\ - "\tSet screen n's width, height, and bit depth\n"); - ErrorF ("-linebias n\n"\ - "\tAdjust thin line pixelization\n"); - ErrorF ("-blackpixel n\n"\ - "\tPixel value for black\n"); - ErrorF ("-whitepixel n\n"\ - "\tPixel value for white\n"); - ErrorF ("-engine n\n"\ - "\tOverride the server's detected engine type:\n"\ - "\t\tGDI blitter\t\t1\n"\ - "\t\tDirectDraw blitter\t2\n"\ - "\t\tDirectDraw4 blitter\t4\n"); + ErrorF ("-depth bits_per_pixel\n" + "\tSpecify an optional bitdepth to use in fullscreen mode\n" + "\twith a DirectDraw engine.\n"); + + ErrorF ("-emulate3buttons [timeout]\n" + "\tEmulate 3 button mouse with an optional timeout in " + "milliseconds\n"); + + ErrorF ("-engine engine_type_id\n" + "\tOverride the server's automatically selected engine type:\n" + "\t\t1 - Shadow GDI\n" + "\t\t2 - Shadow DirectDraw\n" + "\t\t4 - Shadow DirectDraw4\n" + "\t\t16 - Native GDI - experimental\n"); + ErrorF ("-fullscreen\n" - "\tRun the specified server engine in fullscreen mode\n"); - ErrorF ("-emulate3buttons [n]\n" - "\tEmulate 3 button mouse with timeout of n milliseconds\n"); + "\tRun the server in fullscreen mode\n"); + + ErrorF ("-refresh rate_in_Hz\n" + "\tSpecify an optional refresh rate to use in fullscreen mode\n" + "\twith a DirectDraw engine.\n"); + + ErrorF ("-screen scr_num width height\n" + "\tSet screen scr_num's width and height\n"); + + ErrorF ("-[no]unixkill\n" + "\tCtrl+Alt+Backspace exits the X Server\n"); + + ErrorF ("-[no]winkill\n" + "\tAlt+F4 exits the X Server\n"); } + /* See Porting Layer Definition - p. 57 */ +/* + * INPUT + * argv: pointer to an array of null-terminated strings, one for + * each token in the X Server command line; the first token + * is 'XWin.exe', or similar. + * argc: a count of the number of tokens stored in argv. + * i: a zero-based index into argv indicating the current token being + * processed. + * + * OUTPUT + * return: return the number of tokens processed correctly. + * + * NOTE + * When looking for n tokens, check that i + n is less than argc. Or, + * you may check if i is greater than or equal to argc, in which case + * you should display the UseMsg () and return 0. + */ + int ddxProcessArgument (int argc, char *argv[], int i) { - static Bool fFirstTime = TRUE; + static Bool beenHere = FALSE; - /* Run some initialization procedures the first time through */ - if (fFirstTime) + /* Initialize once */ + if (!beenHere) { +#ifdef DDXOSVERRORF + /* + * This initialises our hook into VErrorF () for catching log messages + * that are generated before OsInit () is called. + */ + OsVendorVErrorFProc = OsVendorVErrorF; + + /* Open log file if not yet open */ + if (g_pfLog == NULL) + g_pfLog = fopen (WIN_LOG_FNAME, "w"); +#endif + + beenHere = TRUE; + + /* Detach from any console we are connected to */ + FreeConsole (); + + /* + * Initialize default screen settings. We have to do this before + * OsVendorInit () gets called, otherwise we will overwrite + * settings changed by parameters such as -fullscreen, etc. + */ + ErrorF ("ddxProcessArgument () - Initializing default screens\n"); winInitializeDefaultScreens (); - fFirstTime = FALSE; - } + } + +#if CYGDEBUG + ErrorF ("ddxProcessArgument ()\n"); +#endif /* - * Look for the '-screen n WxHxD' arugment + * Look for the '-screen scr_num width height' argument */ if (strcmp (argv[i], "-screen") == 0) { + int iArgsProcessed = 1; int nScreenNum; + ErrorF ("ddxProcessArgument () - screen - argc: %d i: %d\n", + argc, i); + /* Display the usage message if the argument is malformed */ if (i + 2 >= argc) { - UseMsg (); return 0; } - - nScreenNum = atoi (argv[i+1]); + + /* Grab screen number */ + nScreenNum = atoi (argv[i + 1]); /* Validate the specified screen number */ if (nScreenNum < 0 || nScreenNum >= MAXSCREENS) { - ErrorF ("Invalid screen number %d\n", nScreenNum); + ErrorF ("ddxProcessArgument () - Invalid screen number %d\n", + nScreenNum); UseMsg (); return 0; } - - /* Grab the height, width, and depth parameters */ - if (3 != sscanf (argv[i+2], "%dx%dx%d", - (int*)&g_winScreens[nScreenNum].dwWidth, - (int*)&g_winScreens[nScreenNum].dwHeight, - (int*)&g_winScreens[nScreenNum].dwDepth)) - { - /* I see no height, width, and depth here */ - ErrorF ("Invalid screen configuration %s\n", argv[i+2]); - UseMsg (); + + /* Look for 'WxD' or 'W D' */ + if (2 == sscanf (argv[i + 2], "%dx%d", + (int *) &g_ScreenInfo[nScreenNum].dwWidth, + (int *) &g_ScreenInfo[nScreenNum].dwHeight)) + { + iArgsProcessed = 3; + } + else if (i + 3 < argc + && 1 == sscanf (argv[i + 2], "%d", + (int *) &g_ScreenInfo[nScreenNum].dwWidth) + && 1 == sscanf (argv[i + 3], "%d", + (int *) &g_ScreenInfo[nScreenNum].dwHeight)) + { + iArgsProcessed = 4; + } + else + { + /* I see no height and width here */ + ErrorF ("ddxProcessArgument () - Invalid screen width and " + "height: %s\n", + argv[i + 2]); return 0; - } + } + - if (nScreenNum >= g_nNumScreens) - g_nNumScreens = nScreenNum + 1; - g_nLastScreen = nScreenNum; - return 3; + /* Calculate the screen width and height in millimeters */ + g_ScreenInfo[nScreenNum].dwWidth_mm + = (g_ScreenInfo[nScreenNum].dwWidth + / monitorResolution) * 25.4; + g_ScreenInfo[nScreenNum].dwHeight_mm + = (g_ScreenInfo[nScreenNum].dwHeight + / monitorResolution) * 25.4; + + /* + * Keep track of the last screen number seen, as parameters seen + * before a screen number apply to all screens, whereas parameters + * seen after a screen number apply to that screen number only. + */ + g_iLastScreen = nScreenNum; + + /* Keep a count of the number of screens */ + ++g_iNumScreens; + + return iArgsProcessed; } /* - * Look for the '-blackpixel n' argument + * Look for the '-engine n' argument */ - if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */ + if (strcmp (argv[i], "-engine") == 0) { - Pixel pix; - + DWORD dwEngine = 0; + CARD8 c8OnBits = 0; + /* Display the usage message if the argument is malformed */ if (++i >= argc) { UseMsg (); return 0; } + + /* Grab the argument */ + dwEngine = atoi (argv[i]); - pix = atoi (argv[i]); + /* Count the one bits in the engine argument */ + c8OnBits = winCountBits (dwEngine); + + /* Argument should only have a single bit on */ + if (c8OnBits != 1) + { + UseMsg (); + return 0; + } /* Is this parameter attached to a screen or global? */ - if (-1 == g_nLastScreen) - { - int j; + if (-1 == g_iLastScreen) + { + int j; /* Parameter is for all screens */ - for (j = 0; j < MAXSCREENS; j++) - { - g_winScreens[j].pixelBlack = pix; - } - } + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].dwEnginePreferred = dwEngine; + } + } else - { + { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].pixelBlack = pix; - } + g_ScreenInfo[g_iLastScreen].dwEnginePreferred = dwEngine; + } + + /* Indicate that we have processed the argument */ return 2; } /* - * Look for the '-whitepixel n' argument + * Look for the '-fullscreen' argument */ - if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel n */ + if (strcmp(argv[i], "-fullscreen") == 0) { - Pixel pix; + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; - /* Display the usage message if the argument is malformed */ - if (++i >= argc) + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fFullScreen = TRUE; + } + } + else { - UseMsg (); - return 0; + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fFullScreen = TRUE; } - pix = atoi (argv[i]); + /* Indicate that we have processed this argument */ + return 1; + } - /* Is this parameter attached to a screen or global? */ - if (-1 == g_nLastScreen) - { - int j; + /* + * Look for the '-ignoreinput' argument + */ + if (strcmp(argv[i], "-ignoreinput") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; /* Parameter is for all screens */ - for (j = 0; j < MAXSCREENS; j++) - { - g_winScreens[j].pixelWhite = pix; - } - } + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fIgnoreInput = TRUE; + } + } else - { + { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].pixelWhite = pix; - } - return 2; + g_ScreenInfo[g_iLastScreen].fIgnoreInput = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; } /* - * Look for the '-linebias n' argument + * Look for the '-emulate3buttons' argument */ - if (strcmp (argv[i], "-linebias") == 0) + if (strcmp(argv[i], "-emulate3buttons") == 0) { - unsigned int uiLinebias; + int iArgsProcessed = 1; + int iE3BTimeout = WIN_DEFAULT_E3B_TIME; + + /* Grab the optional timeout value */ + if (i + 1 < argc + && 1 == sscanf (argv[i + 1], "%d", + &iE3BTimeout)) + { + /* Indicate that we have processed the next argument */ + iArgsProcessed++; + } + else + { + /* + * sscanf () won't modify iE3BTimeout if it doesn't find + * the specified format; however, I want to be explicit + * about setting the default timeout in such cases to + * prevent some programs (me) from getting confused. + */ + iE3BTimeout = WIN_DEFAULT_E3B_TIME; + } + + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].iE3BTimeout = iE3BTimeout; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].iE3BTimeout = TRUE; + } + + /* Indicate that we have processed this argument */ + return iArgsProcessed; + } + + /* + * Look for the '-depth n' argument + */ + if (strcmp (argv[i], "-depth") == 0) + { + DWORD dwDepth = 0; + /* Display the usage message if the argument is malformed */ if (++i >= argc) { @@ -277,34 +523,36 @@ return 0; } - uiLinebias = atoi (argv[i]); + /* Grab the argument */ + dwDepth = atoi (argv[i]); /* Is this parameter attached to a screen or global? */ - if (-1 == g_nLastScreen) - { - int j; + if (-1 == g_iLastScreen) + { + int j; /* Parameter is for all screens */ - for (j = 0; j < MAXSCREENS; j++) - { - g_winScreens[j].dwLineBias = uiLinebias; - } - } + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].dwDepth = dwDepth; + } + } else - { + { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].dwLineBias = uiLinebias; - } + g_ScreenInfo[g_iLastScreen].dwDepth = dwDepth; + } + + /* Indicate that we have processed the argument */ return 2; } /* - * Look for the '-engine n' argument + * Look for the '-refresh n' argument */ - if (strcmp (argv[i], "-engine") == 0) + if (strcmp (argv[i], "-refresh") == 0) { - DWORD dwEngine = 0; - CARD8 c8OnBits = 0; + DWORD dwRefreshRate = 0; /* Display the usage message if the argument is malformed */ if (++i >= argc) @@ -314,33 +562,23 @@ } /* Grab the argument */ - dwEngine = atoi (argv[i]); - - /* Count the one bits in the engine argument */ - c8OnBits = winCountBits (dwEngine); - - /* Argument should only have a single bit on */ - if (c8OnBits != 1) - { - UseMsg (); - return 0; - } + dwRefreshRate = atoi (argv[i]); /* Is this parameter attached to a screen or global? */ - if (-1 == g_nLastScreen) + if (-1 == g_iLastScreen) { int j; /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { - g_winScreens[j].dwEnginePreferred = dwEngine; + g_ScreenInfo[j].dwRefreshRate = dwRefreshRate; } } else { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].dwEnginePreferred = dwEngine; + g_ScreenInfo[g_iLastScreen].dwRefreshRate = dwRefreshRate; } /* Indicate that we have processed the argument */ @@ -348,25 +586,25 @@ } /* - * Look for the '-fullscreen' argument + * Look for the '-nowinkill' argument */ - if (strcmp(argv[i], "-fullscreen") == 0) + if (strcmp(argv[i], "-nowinkill") == 0) { /* Is this parameter attached to a screen or is it global? */ - if (-1 == g_nLastScreen) + if (-1 == g_iLastScreen) { int j; /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { - g_winScreens[j].fFullScreen = TRUE; + g_ScreenInfo[j].fUseWinKillKey = FALSE; } } else { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].fFullScreen = TRUE; + g_ScreenInfo[g_iLastScreen].fUseWinKillKey = FALSE; } /* Indicate that we have processed this argument */ @@ -374,56 +612,87 @@ } /* - * Look for the '-emulate3buttons' argument + * Look for the '-winkill' argument */ - if (strcmp(argv[i], "-emulate3buttons") == 0) + if (strcmp(argv[i], "-winkill") == 0) { - int iArgsProcessed = 1; - int iE3BTimeout = WIN_DEFAULT_E3B_TIME; + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; - /* Grab the optional timeout value */ - if (i + 1 < argc - && 1 == sscanf (argv[i + 1], "%d", - &iE3BTimeout)) - { - /* Indicate that we have processed the next argument */ - iArgsProcessed++; - } + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fUseWinKillKey = TRUE; + } + } else { - /* - * sscanf () won't modify iE3BTimeout if it doesn't find - * the specified format; however, I want to be explicit - * about setting the default timeout in such cases to - * prevent some programs (me) from getting confused. - */ - iE3BTimeout = WIN_DEFAULT_E3B_TIME; + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fUseWinKillKey = TRUE; } + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-nounixkill' argument + */ + if (strcmp(argv[i], "-nounixkill") == 0) + { /* Is this parameter attached to a screen or is it global? */ - if (-1 == g_nLastScreen) + if (-1 == g_iLastScreen) { int j; /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { - g_winScreens[j].iE3BTimeout = iE3BTimeout; + g_ScreenInfo[j].fUseUnixKillKey = FALSE; } } else { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].iE3BTimeout = TRUE; + g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = FALSE; } /* Indicate that we have processed this argument */ - return iArgsProcessed; + return 1; } + /* + * Look for the '-unixkill' argument + */ + if (strcmp(argv[i], "-unixkill") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fUseUnixKillKey = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + return 0; } + #ifdef DDXTIME /* from ServerOSDefines */ CARD32 GetTimeInMillis (void) @@ -432,6 +701,7 @@ } #endif /* DDXTIME */ + /* See Porting Layer Definition - p. 20 */ /* We use ddxProcessArgument, so we don't need to touch argc and argv */ void @@ -439,13 +709,17 @@ { int i; +#if CYGDEBUG + ErrorF ("InitOutput ()\n"); +#endif + /* Setup global screen info parameters */ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; screenInfo->numPixmapFormats = NUMFORMATS; - + /* Describe how we want common pixmap formats padded */ for (i = 0; i < NUMFORMATS; i++) { @@ -453,7 +727,7 @@ } /* Initialize each screen */ - for (i = 0; i < g_nNumScreens; i++) + for (i = 0; i < g_iNumScreens; i++) { if (-1 == AddScreen (winScreenInit, argc, argv)) { Index: xc/programs/Xserver/hw/xwin/XWin.man diff -u /dev/null xc/programs/Xserver/hw/xwin/XWin.man:1.3 --- /dev/null Fri Jan 18 15:26:44 2002 +++ xc/programs/Xserver/hw/xwin/XWin.man Tue Oct 23 04:32:05 2001 @@ -0,0 +1,95 @@ +.\" $XFree86: xc/programs/Xserver/hw/xwin/XWin.man,v 1.3 2001/10/23 08:32:05 alanh Exp $ +.TH XWIN 1 __vendorversion__ +.SH NAME +XWin \- X Server for the Cygwin environment on Microsoft Windows +.SH SYNOPSIS +.B XWin +[ options ] ... +.SH DESCRIPTION +.I XWin +is an X Server for the X Window System on the Cygwin environment +running on Microsoft Windows. +.SH OPTIONS +.PP +In addition to the normal server options described in the \fIXserver(1)\fP +manual page, \fIXWin\fP accepts the following command line switches: +.TP 8 +.B "\-depth \fIdepth\fP" +Specify the color depth, in bits per pixel, to use when running in +fullscreen with a DirectDraw engine. This parameter is ignored if +\fB\-fullscreen\fP is not specified. +.TP 8 +.B "\-emulate3buttons \fItimeout\fP" +Emulate a three button mouse; pressing both buttons within +.I timeout +milliseconds causes an emulated middle button press. The default +.I timeout +is 50 milliseconds. +.TP 8 +.B "\-engine \fIengine_type_id\fP" +Override the server's automatically supported engine type. This +parameter will be ignored if the specified engine type is not +supported on the current system. The supported engine type ids are 1 +- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw4. +Additionally, there is a barely functional experimental engine type id +16 - Native GDI. +.TP 8 +.B \-fullscreen +Run the server in fullscreen mode, as opposed to the default windowed +mode. +.TP 8 +.B "\-refresh \fIrate_in_Hz\fP" +Specify an optional refresh rate to use when running in +fullscreen with a DirectDraw engine. This parameter is ignored if +\fB\-fullscreen\fP is not specified. +.TP 8 +.B "\-screen \fIscreen_number\fP \fIwidth\fP \fIheight\fP" +Sets the display resolution for the X server to use on screen +.I screen_number. +.TP 8 +.B \-[no]unixkill +Ctrl+Alt+Backspace exits the X Server +.TP 8 +.B \-[no]winkill +Alt+F4 exits the X Server +.SH "SEE ALSO" +.PP +X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1) +.SH BUGS +.I XWin +and this man page still have many limitations. Some of the more obvious +ones are: +.br +- The display mode can not be changed once the X server has started. +.PP +.SH AUTHORS +XFree86 was originally ported to Cygwin by Dakshinamurthy Karra, +Dr. Peter Busch, John Fortin, and Suhaib Siddiqi. +.I XWin +is maintained by the Cygwin/XFree86 project, with hosting services +provided by RedHat. +.PP +The following members, in alphabetical order by last name, of the +Cygwin/XFree86 Team contributed to the XFree86 4.1.0 release: +.PP +Robert Collins +.br +Christopher Faylor - Management of hosting services, general +programming guru +.br +Alexander Gottwald - AltGr handling for non-U.S. keyboards +.br +Alan Hourihane - Developer, patch reviewer, general programming guru +.br +Pierre A Humblet - Debugging of socket-related crashes, developer +.br +Harold L Hunt II - Lead developer, documentation, and website updates +.br +Suhaib Siddiqi - Project lead + + + + + + + Index: xc/programs/Xserver/hw/xwin/ddraw.h diff -u xc/programs/Xserver/hw/xwin/ddraw.h:1.2 xc/programs/Xserver/hw/xwin/ddraw.h:1.4 --- xc/programs/Xserver/hw/xwin/ddraw.h:1.2 Thu Apr 5 16:13:49 2001 +++ xc/programs/Xserver/hw/xwin/ddraw.h Sun Jul 29 18:08:15 2001 @@ -1,12 +1,18 @@ -/* $XFree86: xc/programs/Xserver/hw/xwin/ddraw.h,v 1.2 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/ddraw.h,v 1.4 2001/07/29 22:08:15 tsi Exp $ */ #ifndef __WINE_DDRAW_H #define __WINE_DDRAW_H -#include <winnt.h> /* LARGE_INTEGER ... */ -#include <wingdi.h> /* PALETTE stuff ... */ +#include <winnt.h> +#include <wingdi.h> #include "obj_base.h" +#ifdef NONAMELESSUNION +#ifndef DUMMYUNIONNAME1 +#define DUMMYUNIONNAME1 u1 +#endif +#endif + # ifdef UNICODE # define WINELIB_NAME_AW(func) func##W # else @@ -19,7 +25,7 @@ #endif /* defined(__cplusplus) */ #ifndef DIRECTDRAW_VERSION -#define DIRECTDRAW_VERSION 0x0500 +#define DIRECTDRAW_VERSION 0x0700 #endif /* DIRECTDRAW_VERSION */ /***************************************************************************** @@ -234,6 +240,14 @@ #define DDGBS_CANBLT 0x00000001 #define DDGBS_ISBLTDONE 0x00000002 +/* dwFlags for IDirectDrawSurface7::GetFlipStatus */ +#define DDGFS_CANFLIP 1L +#define DDGFS_ISFLIPDONE 2L + +/* dwFlags for IDirectDrawSurface7::SetPrivateData */ +#define DDSPD_IUNKNOWNPTR 1L +#define DDSPD_VOLATILE 2L + /* DDSCAPS.dwCaps */ /* reserved1, was 3d capable */ #define DDSCAPS_RESERVED1 0x00000001 @@ -284,7 +298,7 @@ #define DDSCAPS_RESERVED2 0x00800000 /* memory allocation delayed until Load() */ #define DDSCAPS_ALLOCONLOAD 0x04000000 -/* Indicates that the surface will recieve data from a video port */ +/* Indicates that the surface will receive data from a video port */ #define DDSCAPS_VIDEOPORT 0x08000000 /* surface is in local videomemory */ #define DDSCAPS_LOCALVIDMEM 0x10000000 @@ -712,22 +726,32 @@ 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*/ - } DUMMYUNIONNAME; + DWORD dwLuminanceBitCount; + DWORD dwBumpBitCount; + } DUMMYUNIONNAME1; union { DWORD dwRBitMask; /* 10: mask for red bit*/ DWORD dwYBitMask; /* 10: mask for Y bits*/ + DWORD dwStencilBitDepth; + DWORD dwLuminanceBitMask; + DWORD dwBumpDuBitMask; } DUMMYUNIONNAME2; union { DWORD dwGBitMask; /* 14: mask for green bits*/ DWORD dwUBitMask; /* 14: mask for U bits*/ + DWORD dwZBitMask; + DWORD dwBumpDvBitMask; } DUMMYUNIONNAME3; union { DWORD dwBBitMask; /* 18: mask for blue bits*/ DWORD dwVBitMask; /* 18: mask for V bits*/ + DWORD dwStencilBitMask; + DWORD dwBumpLuminanceBitMask; } DUMMYUNIONNAME4; union { DWORD dwRGBAlphaBitMask; /* 1C: mask for alpha channel */ DWORD dwYUVAlphaBitMask; /* 1C: mask for alpha channel */ + DWORD dwLuminanceAlphaBitMask; DWORD dwRGBZBitMask; /* 1C: mask for Z channel */ DWORD dwYUVZBitMask; /* 1C: mask for Z channel */ } DUMMYUNIONNAME5; @@ -923,26 +947,25 @@ #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*/ union { + LONG lPitch; /* 10: distance to start of next line (return value only)*/ + DWORD dwLinearSize; + } DUMMYUNIONNAME1; + 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)*/ - } DUMMYUNIONNAME; + } DUMMYUNIONNAME2; DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/ DWORD dwReserved; /* 20:reserved*/ - union { - DWORD dwLinearSize; - LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ - } DUMMYUNIONNAME2; + LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ DDCOLORKEY ddckCKDestOverlay;/* 28: CK for dest overlay use*/ DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/ DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/ @@ -950,36 +973,6 @@ 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 { @@ -990,12 +983,13 @@ union { LONG lPitch; /*10: distance to start of next line (return value only)*/ DWORD dwLinearSize; /*10: formless late-allocated optimized surface size */ - } DUMMYUNIONNAME; + } DUMMYUNIONNAME1; 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 dwSrcVBHandle;/* 18:source used in VB::Optimize */ + } DUMMYUNIONNAME2; DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/ DWORD dwReserved; /* 20:reserved*/ LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ @@ -1003,12 +997,16 @@ 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 */ + DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/ + DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/ + DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/ + + union { + DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/ + DWORD dwFVF; /* 48: vertex format description of vertex buffers */ + } DUMMYUNIONNAME4; + DDSCAPS2 ddsCaps; /* 68: DDraw surface caps */ + DWORD dwTextureStage; /* 78: stage in multitexture cascade */ } DDSURFACEDESC2,*LPDDSURFACEDESC2; /* DDCOLORCONTROL.dwFlags */ @@ -1033,13 +1031,20 @@ DWORD dwReserved1; } DDCOLORCONTROL,*LPDDCOLORCONTROL; +typedef struct { + WORD red[256]; + WORD green[256]; + WORD blue[256]; +} DDGAMMARAMP,*LPDDGAMMARAMP; + 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 (*LPDDENUMMODESCALLBACK7)(LPDDSURFACEDESC2, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMMODESCALLBACK2)(LPDDSURFACEDESC2, LPVOID); typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK2)(LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID); typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK7)(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); typedef BOOL CALLBACK (*LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); @@ -1055,6 +1060,10 @@ #define DDENUM_DETACHEDSECONDARYDEVICES 0x00000002 #define DDENUM_NONDISPLAYDEVICES 0x00000004 +/* flags for DirectDrawCreate or IDirectDraw::Initialize */ +#define DDCREATE_HARDWAREONLY 1L +#define DDCREATE_EMULATIONONLY 2L + typedef struct _DDBLTFX { DWORD dwSize; /* size of structure */ @@ -1071,7 +1080,7 @@ { DWORD dwZDestConst; /* Constant to use as Z buffer for dest */ LPDIRECTDRAWSURFACE lpDDSZBufferDest; /* Surface to use as Z buffer for dest */ - } DUMMYUNIONNAME; + } DUMMYUNIONNAME1; DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */ union { @@ -1135,7 +1144,7 @@ { DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as alpha channel for dest */ - } DUMMYUNIONNAME; + } DUMMYUNIONNAME1; DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ union { @@ -1316,15 +1325,15 @@ /*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) \ +/*18*/ ICOM_METHOD3(HRESULT,CreateSurface, LPDDSURFACEDESC,lpDDSurfaceDesc, LPDIRECTDRAWSURFACE2*,lplpDDSurface, IUnknown*,pUnkOuter) \ +/*1c*/ ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE2,lpDDSurface, LPDIRECTDRAWSURFACE2*,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) \ +/*38*/ ICOM_METHOD1(HRESULT,GetGDISurface, LPDIRECTDRAWSURFACE2*,lplpGDIDDSurface) \ /*3c*/ ICOM_METHOD1(HRESULT,GetMonitorFrequency, LPDWORD,lpdwFrequency) \ /*40*/ ICOM_METHOD1(HRESULT,GetScanLine, LPDWORD,lpdwScanLine) \ /*44*/ ICOM_METHOD1(HRESULT,GetVerticalBlankStatus, BOOL*,lpbIsInVB) \ @@ -1375,14 +1384,37 @@ */ #define ICOM_INTERFACE IDirectDraw4 #define IDirectDraw4_METHODS \ - ICOM_METHOD2(HRESULT,GetSurfaceFromDC, HDC,, LPDIRECTDRAWSURFACE*,) \ +/*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, LPDIRECTDRAWSURFACE4*,lplpDDSurface, IUnknown*,pUnkOuter) \ +/*1c*/ ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE4,lpDDSurface, LPDIRECTDRAWSURFACE4*,lplpDupDDSurface) \ +/*20*/ ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC2,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK2,lpEnumModesCallback) \ +/*24*/ ICOM_METHOD4(HRESULT,EnumSurfaces, DWORD,dwFlags, LPDDSURFACEDESC2,lpDDSD, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK2,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, LPDIRECTDRAWSURFACE4*,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 */ \ + ICOM_METHOD2(HRESULT,GetSurfaceFromDC, HDC,, LPDIRECTDRAWSURFACE4*,) \ ICOM_METHOD (HRESULT,RestoreAllSurfaces) \ ICOM_METHOD (HRESULT,TestCooperativeLevel) \ ICOM_METHOD2(HRESULT,GetDeviceIdentifier, LPDDDEVICEIDENTIFIER,, DWORD,) #define IDirectDraw4_IMETHODS \ - IDirectDraw2_IMETHODS \ + IUnknown_IMETHODS \ IDirectDraw4_METHODS -ICOM_DEFINE(IDirectDraw4,IDirectDraw2) +ICOM_DEFINE(IDirectDraw4,IUnknown) #undef ICOM_INTERFACE /*** IUnknown methods ***/ @@ -1413,7 +1445,7 @@ /*** IDirectDraw2 methods ***/ #define IDirectDraw4_GetAvailableVidMem(p,a,b,c) ICOM_CALL3(GetAvailableVidMem,p,a,b,c) /*** IDirectDraw4 methods ***/ -#define IDirectDraw4_GetSurfaceFromDC(p,a,b) ICOM_CALL2(GetSurfaceFromDC,p,a,b,c) +#define IDirectDraw4_GetSurfaceFromDC(p,a,b) ICOM_CALL2(GetSurfaceFromDC,p,a,b) #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) @@ -1432,7 +1464,7 @@ /*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) \ +/*20*/ ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC2,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK2,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) \ @@ -1453,7 +1485,7 @@ /*60*/ ICOM_METHOD2(HRESULT,GetSurfaceFromDC, HDC,, LPDIRECTDRAWSURFACE7*,) \ /*64*/ ICOM_METHOD (HRESULT,RestoreAllSurfaces) \ /*68*/ ICOM_METHOD (HRESULT,TestCooperativeLevel) \ -/*6c*/ ICOM_METHOD2(HRESULT,GetDeviceIdentifier, LPDDDEVICEIDENTIFIER,, DWORD,) \ +/*6c*/ ICOM_METHOD2(HRESULT,GetDeviceIdentifier, LPDDDEVICEIDENTIFIER2,, DWORD,) \ /* added in v7 */ \ /*70*/ ICOM_METHOD3(HRESULT,StartModeTest, LPSIZE,, DWORD,, DWORD,) \ /*74*/ ICOM_METHOD2(HRESULT,EvaluateMode, DWORD,, DWORD *,) @@ -1491,8 +1523,8 @@ /*** 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_GetSurfaceFromDC(p,a,b) ICOM_CALL2(GetSurfaceFromDC,p,a,b) +#define IDirectDraw7_RestoreAllSurfaces(p) 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 ***/ @@ -1574,7 +1606,7 @@ #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) ICOM_CALL (Restore,p) -#define IDirectDrawSurface_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) +#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) @@ -1664,8 +1696,8 @@ #define IDirectDrawSurface2_IsLost(p) ICOM_CALL (IsLost,p) #define IDirectDrawSurface2_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) #define IDirectDrawSurface2_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) -#define IDirectDrawSurface2_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) -#define IDirectDrawSurface2_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) +#define IDirectDrawSurface2_Restore(p) ICOM_CALL (Restore,p) +#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) @@ -1761,8 +1793,8 @@ #define IDirectDrawSurface3_IsLost(p) ICOM_CALL (IsLost,p) #define IDirectDrawSurface3_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) #define IDirectDrawSurface3_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) -#define IDirectDrawSurface3_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) -#define IDirectDrawSurface3_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) +#define IDirectDrawSurface3_Restore(p) ICOM_CALL (Restore,p) +#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) @@ -1780,13 +1812,8 @@ /***************************************************************************** * IDirectDrawSurface4 interface - */ -/* Cannot inherit from IDirectDrawSurface2 because the LPDIRECTDRAWSURFACE2 parameters - * have been converted to LPDIRECTDRAWSURFACE3. */ -/* FIXME: I assumed IDirectDrawSurface4 does not inherit from IDirectDrawSurface3 but I - * have actually not proof of that. Can someone check and remove this comment or patch - * accordingly ? +/* Cannot inherit from IDirectDrawSurface2 because DDSCAPS changed to DDSCAPS2. */ #define ICOM_INTERFACE IDirectDrawSurface4 #define IDirectDrawSurface4_METHODS \ @@ -1799,9 +1826,9 @@ ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE4,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ - ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS,lpDDSCaps, LPDIRECTDRAWSURFACE4*,lplpDDAttachedSurface) \ + ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS2,lpDDSCaps, LPDIRECTDRAWSURFACE4*,lplpDDAttachedSurface) \ ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ - ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS,lpDDSCaps) \ + 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) \ @@ -1819,7 +1846,7 @@ 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_METHOD1(HRESULT,Unlock, LPRECT,lpSurfaceData) \ ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE4,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE4,lpDDSReference) \ @@ -1870,8 +1897,8 @@ #define IDirectDrawSurface4_IsLost(p) ICOM_CALL (IsLost,p) #define IDirectDrawSurface4_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) #define IDirectDrawSurface4_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) -#define IDirectDrawSurface4_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) -#define IDirectDrawSurface4_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) +#define IDirectDrawSurface4_Restore(p) ICOM_CALL (Restore,p) +#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) @@ -1884,7 +1911,7 @@ #define IDirectDrawSurface4_PageLock(p,a) ICOM_CALL1(PageLock,p,a) #define IDirectDrawSurface4_PageUnlock(p,a) ICOM_CALL1(PageUnlock,p,a) /*** IDirectDrawSurface3 methods ***/ -#define IDirectDrawSurface4_SetSurfaceDesc(p,a) ICOM_CALL(SetSurfaceDesc,p,a) +#define IDirectDrawSurface4_SetSurfaceDesc(p,a,b) ICOM_CALL2(SetSurfaceDesc,p,a,b) /*** IDirectDrawSurface4 methods ***/ #define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) ICOM_CALL4(SetPrivateData,p,a,b,c,d) #define IDirectDrawSurface4_GetPrivateData(p,a,b,c) ICOM_CALL3(GetPrivateData,p,a,b,c) @@ -1904,8 +1931,8 @@ 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,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK7,lpEnumSurfacesCallback) \ + ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK7,lpfnCallback) \ ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE7,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS2,lpDDSCaps, LPDIRECTDRAWSURFACE7*,lplpDDAttachedSurface) \ ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ @@ -1927,7 +1954,7 @@ 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_METHOD1(HRESULT,Unlock, LPRECT,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) \ @@ -1954,6 +1981,61 @@ ICOM_DEFINE(IDirectDrawSurface7,IUnknown) #undef ICOM_INTERFACE + /*** IUnknown methods ***/ +#define IDirectDrawSurface7_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawSurface7_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawSurface7_Release(p) ICOM_CALL (Release,p) +/*** IDirectDrawSurface (almost) methods ***/ +#define IDirectDrawSurface7_AddAttachedSurface(p,a) ICOM_CALL1(AddAttachedSurface,p,a) +#define IDirectDrawSurface7_AddOverlayDirtyRect(p,a) ICOM_CALL1(AddOverlayDirtyRect,p,a) +#define IDirectDrawSurface7_Blt(p,a,b,c,d,e) ICOM_CALL5(Blt,p,a,b,c,d,e) +#define IDirectDrawSurface7_BltBatch(p,a,b,c) ICOM_CALL3(BltBatch,p,a,b,c) +#define IDirectDrawSurface7_BltFast(p,a,b,c,d,e) ICOM_CALL5(BltFast,p,a,b,c,d,e) +#define IDirectDrawSurface7_DeleteAttachedSurface(p,a,b) ICOM_CALL2(DeleteAttachedSurface,p,a,b) +#define IDirectDrawSurface7_EnumAttachedSurfaces(p,a,b) ICOM_CALL2(EnumAttachedSurfaces,p,a,b) +#define IDirectDrawSurface7_EnumOverlayZOrders(p,a,b,c) ICOM_CALL3(EnumOverlayZOrders,p,a,b,c) +#define IDirectDrawSurface7_Flip(p,a,b) ICOM_CALL2(Flip,p,a,b) +#define IDirectDrawSurface7_GetAttachedSurface(p,a,b) ICOM_CALL2(GetAttachedSurface,p,a,b) +#define IDirectDrawSurface7_GetBltStatus(p,a) ICOM_CALL1(GetBltStatus,p,a) +#define IDirectDrawSurface7_GetCaps(p,a) ICOM_CALL1(GetCaps,p,a) +#define IDirectDrawSurface7_GetClipper(p,a) ICOM_CALL1(GetClipper,p,a) +#define IDirectDrawSurface7_GetColorKey(p,a,b) ICOM_CALL2(GetColorKey,p,a,b) +#define IDirectDrawSurface7_GetDC(p,a) ICOM_CALL1(GetDC,p,a) +#define IDirectDrawSurface7_GetFlipStatus(p,a) ICOM_CALL1(GetFlipStatus,p,a) +#define IDirectDrawSurface7_GetOverlayPosition(p,a,b) ICOM_CALL2(GetOverlayPosition,p,a,b) +#define IDirectDrawSurface7_GetPalette(p,a) ICOM_CALL1(GetPalette,p,a) +#define IDirectDrawSurface7_GetPixelFormat(p,a) ICOM_CALL1(GetPixelFormat,p,a) +#define IDirectDrawSurface7_GetSurfaceDesc(p,a) ICOM_CALL1(GetSurfaceDesc,p,a) +#define IDirectDrawSurface7_Initialize(p,a,b) ICOM_CALL2(Initialize,p,a,b) +#define IDirectDrawSurface7_IsLost(p) ICOM_CALL (IsLost,p) +#define IDirectDrawSurface7_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) +#define IDirectDrawSurface7_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) +#define IDirectDrawSurface7_Restore(p) ICOM_CALL (Restore,p) +#define IDirectDrawSurface7_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) +#define IDirectDrawSurface7_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) +#define IDirectDrawSurface7_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) +#define IDirectDrawSurface7_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) +#define IDirectDrawSurface7_Unlock(p,a) ICOM_CALL1(Unlock,p,a) +#define IDirectDrawSurface7_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL5(UpdateOverlay,p,a,b,c,d,e) +#define IDirectDrawSurface7_UpdateOverlayDisplay(p,a) ICOM_CALL1(UpdateOverlayDisplay,p,a) +#define IDirectDrawSurface7_UpdateOverlayZOrder(p,a,b) ICOM_CALL2(UpdateOverlayZOrder,p,a,b) +/*** IDirectDrawSurface2 methods ***/ +#define IDirectDrawSurface7_GetDDInterface(p,a) ICOM_CALL1(GetDDInterface,p,a) +#define IDirectDrawSurface7_PageLock(p,a) ICOM_CALL1(PageLock,p,a) +#define IDirectDrawSurface7_PageUnlock(p,a) ICOM_CALL1(PageUnlock,p,a) +/*** IDirectDrawSurface3 methods ***/ +#define IDirectDrawSurface7_SetSurfaceDesc(p,a,b) ICOM_CALL2(SetSurfaceDesc,p,a,b) +/*** IDirectDrawSurface4 methods ***/ +#define IDirectDrawSurface7_SetPrivateData(p,a,b,c,d) ICOM_CALL4(SetPrivateData,p,a,b,c,d) +#define IDirectDrawSurface7_GetPrivateData(p,a,b,c) ICOM_CALL3(GetPrivateData,p,a,b,c) +#define IDirectDrawSurface7_FreePrivateData(p,a) ICOM_CALL1(FreePrivateData,p,a) +#define IDirectDrawSurface7_GetUniquenessValue(p,a) ICOM_CALL1(GetUniquenessValue,p,a) +#define IDirectDrawSurface7_ChangeUniquenessValue(p) ICOM_CALL (ChangeUniquenessValue,p) +/*** IDirectDrawSurface7 methods ***/ +#define IDirectDrawSurface7_SetPriority(p,a) ICOM_CALL1(SetPriority,p,a) +#define IDirectDrawSurface7_GetPriority(p,a) ICOM_CALL1(GetPriority,p,a) +#define IDirectDrawSurface7_SetLOD(p,a) ICOM_CALL1(SetLOD,p,a) +#define IDirectDrawSurface7_GetLOD(p,a) ICOM_CALL1(GetLOD,p,a) /***************************************************************************** * IDirectDrawColorControl interface @@ -1975,6 +2057,27 @@ /*** IDirectDrawColorControl methods ***/ #define IDirectDrawColorControl_GetColorControls(p,a) ICOM_CALL(GetColorControls,p,a) #define IDirectDrawColorControl_SetColorControls(p,a) ICOM_CALL(SetColorControls,p,a) + +/***************************************************************************** + * IDirectDrawGammaControl interface + */ +#define ICOM_INTERFACE IDirectDrawGammaControl +#define IDirectDrawGammaControl_METHODS \ + ICOM_METHOD2(HRESULT,GetGammaRamp, DWORD,dwFlags, LPDDGAMMARAMP,lpGammaRamp) \ + ICOM_METHOD2(HRESULT,SetGammaRamp, DWORD,dwFlags, LPDDGAMMARAMP,lpGammaRamp) +#define IDirectDrawGammaControl_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawGammaControl_METHODS +ICOM_DEFINE(IDirectDrawGammaControl,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IDirectDrawGammaControl_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDrawGammaControl_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDrawGammaControl_Release(p) ICOM_CALL (Release,p) + /*** IDirectDrawGammaControl methods ***/ +#define IDirectDrawGammaControl_GetGammaRamp(p,a,b) ICOM_CALL(GetGammaRamp,p,a,b) +#define IDirectDrawGammaControl_SetGammaRamp(p,a,b) ICOM_CALL(SetGammaRamp,p,a,b) HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN); Index: xc/programs/Xserver/hw/xwin/win.h diff -u xc/programs/Xserver/hw/xwin/win.h:1.6 xc/programs/Xserver/hw/xwin/win.h:1.27 --- xc/programs/Xserver/hw/xwin/win.h:1.6 Tue May 8 04:14:09 2001 +++ xc/programs/Xserver/hw/xwin/win.h Wed Nov 21 03:51:24 2001 @@ -30,11 +30,12 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/win.h,v 1.27 2001/11/21 08:51:24 alanh Exp $ */ #ifndef _WIN_H_ #define _WIN_H_ + #ifndef NO #define NO 0 #endif @@ -42,51 +43,51 @@ #define YES 1 #endif +/* + * Build toggles for experimental features + */ +#define WIN_NATIVE_GDI_SUPPORT YES +#define WIN_LAYER_SUPPORT YES + /* 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 WIN_LOG_FNAME "/tmp/XWin.log" #define NEED_EVENTS #define WIN_DEFAULT_WIDTH 640 #define WIN_DEFAULT_HEIGHT 480 -#define WIN_DEFAULT_DEPTH 16 +#define WIN_DEFAULT_DEPTH 0 #define WIN_DEFAULT_WHITEPIXEL 255 #define WIN_DEFAULT_BLACKPIXEL 0 #define WIN_DEFAULT_LINEBIAS 0 #define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */ +#define WIN_DEFAULT_DPI 75 +#define WIN_DEFAULT_REFRESH 0 +#define WIN_DEFAULT_WIN_KILL TRUE +#define WIN_DEFAULT_UNIX_KILL FALSE + +#define WIN_DIB_MAXIMUM_SIZE 0x08000000 /* 16 MB on Windows 95, 98, Me */ +#define WIN_DIB_MAXIMUM_SIZE_MB (WIN_DIB_MAXIMUM_SIZE / 8 / 1024 / 1024) + +/* + * Windows only supports 256 color palettes + */ +#define WIN_NUM_PALETTE_ENTRIES 256 + +/* + * Build a supported display depths mask by shifting one to the left + * by the number of bits in the supported depth. + */ +#define WIN_SUPPORTED_DEPTHS ( (1 << (32-1)) | (1 << (24-1)) \ + | (1 << (16-1)) | (1 << (15-1)) | (1 << (8-1))) +#define WIN_CHECK_DEPTH YES #define WIN_E3B_OFF -1 #define WIN_E3B_TIMER_ID 1 @@ -97,6 +98,7 @@ #define WIN_SERVER_SHADOW_DD 0x2L /* 2 */ #define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */ #define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */ +#define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */ #define AltMapIndex Mod1MapIndex #define NumLockMapIndex Mod2MapIndex @@ -108,11 +110,6 @@ #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> @@ -157,36 +154,84 @@ #include "miline.h" #include "shadow.h" #include "fb.h" +#include "layer.h" #ifdef RENDER #include "mipict.h" #include "picturestr.h" #endif +#ifdef RANDR +#include "randrstr.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> /* + * Debugging macros + */ + +#if CYGDEBUG +#define DEBUG_MSG(str,...) \ +if (fDebugProcMsg) \ +{ \ + char *pszTemp; \ + int iLength; \ + \ + iLength = sprintf (NULL, str, ##__VA_ARGS__); \ + \ + pszTemp = xalloc (iLength + 1); \ + \ + sprintf (pszTemp, str, ##__VA_ARGS__); \ + \ + MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ + \ + xfree (pszTemp); \ +} +#else +#define DEBUG_MSG(str,...) +#endif + +#if CYGDEBUG || YES +#define DEBUG_FN_NAME(str) PTSTR szFunctionName = str +#else +#define DEBUG_FN_NAME(str) +#endif + +#if CYGDEBUG || YES +#define DEBUGVARS BOOL fDebugProcMsg = FALSE +#else +#define DEBUGVARS +#endif + +#if CYGDEBUG || YES +#define DEBUGPROC_MSG fDebugProcMsg = TRUE +#else +#define DEBUGPROC_MSG +#endif + +/* We use xor this macro for detecting toggle key state changes */ +#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) + + +/* * 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 void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr); typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr); @@ -194,7 +239,7 @@ typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr); -typedef void (*winCreateBoundingWindowProcPtr)(ScreenPtr); +typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr); typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **); @@ -202,17 +247,52 @@ typedef Bool (*winActivateAppProcPtr)(ScreenPtr); +typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen); + +typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen); + +typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap); + +typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap, + int ndef, xColorItem *pdefs); + +typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap); + +typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap); + +typedef Bool (*winHotKeyAltTabPtr)(ScreenPtr); + /* * Privates structures */ -typedef struct { +typedef struct +{ DWORD dwDummy; -} winPrivWin; +} winPrivWinRec, *winPrivWinPtr; -typedef struct { - DWORD dwDummy; -} winPrivGC; +typedef struct +{ + HDC hdc; + HDC hdcMem; +} winPrivGCRec, *winPrivGCPtr; + +typedef struct +{ + HDC hdcSelected; + HBITMAP hBitmap; + BYTE *pbBits; + DWORD dwScanlineBytes; + BITMAPINFOHEADER *pbmih; +} winPrivPixmapRec, *winPrivPixmapPtr; + +typedef struct +{ + HPALETTE hPalette; + LPDIRECTDRAWPALETTE lpDDPalette; + RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES]; + PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES]; +} winPrivCmapRec, *winPrivCmapPtr; typedef struct { @@ -221,23 +301,25 @@ DWORD dwWidth; DWORD dwPaddedWidth; DWORD dwHeight; + DWORD dwWidth_mm; + DWORD dwHeight_mm; DWORD dwDepth; - DWORD dwDPIx; - DWORD dwDPIy; + DWORD dwRefreshRate; 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; + /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */ + Bool fUseWinKillKey; + Bool fUseUnixKillKey; + Bool fIgnoreInput; } winScreenInfo, *winScreenInfoPtr; typedef struct @@ -248,7 +330,7 @@ Bool fClosed; Bool fActive; Bool fCursor; - + int iDeltaZ; CloseScreenProcPtr CloseScreen; @@ -260,6 +342,22 @@ DWORD dwModeKeyStates; + /* Clipboard support */ + HWND hwndNextViewer; + void *display; + int window; + + /* Layer support */ + DWORD dwLayerKind; + DWORD dwOrigDepth; + LayerPtr pLayer; + + /* Palette management */ + ColormapPtr pcmapInstalled; + + /* Pointer to the root visual so we only have to look it up once */ + VisualPtr pRootVisual; + /* 3 button emulation variables */ int iE3BCachedPress; Bool fE3BFakeButton2Sent; @@ -272,14 +370,15 @@ /* Privates used by shadow fb and primary fb DirectDraw servers */ LPDIRECTDRAW pdd; - LPDIRECTDRAWSURFACE pddsPrimary; + LPDIRECTDRAWSURFACE2 pddsPrimary; + LPDIRECTDRAW2 pdd2; /* Privates used by shadow fb DirectDraw server */ - LPDIRECTDRAWSURFACE pddsShadow; + LPDIRECTDRAWSURFACE2 pddsShadow; LPDDSURFACEDESC pddsdShadow; /* Privates used by primary fb DirectDraw server */ - LPDIRECTDRAWSURFACE pddsOffscreen; + LPDIRECTDRAWSURFACE2 pddsOffscreen; LPDDSURFACEDESC pddsdOffscreen; LPDDSURFACEDESC pddsdPrimary; @@ -294,7 +393,6 @@ /* Engine specific functions */ winAllocateFBProcPtr pwinAllocateFB; winShadowUpdateProcPtr pwinShadowUpdate; - winShadowWindowProcPtr pwinShadowWindow; winCloseScreenProcPtr pwinCloseScreen; winInitVisualsProcPtr pwinInitVisuals; winAdjustVideoModeProcPtr pwinAdjustVideoMode; @@ -302,44 +400,114 @@ winFinishScreenInitProcPtr pwinFinishScreenInit; winBltExposedRegionsProcPtr pwinBltExposedRegions; winActivateAppProcPtr pwinActivateApp; + winRedrawScreenProcPtr pwinRedrawScreen; + winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette; + winInstallColormapProcPtr pwinInstallColormap; + winStoreColorsProcPtr pwinStoreColors; + winCreateColormapProcPtr pwinCreateColormap; + winDestroyColormapProcPtr pwinDestroyColormap; + winHotKeyAltTabPtr pwinHotKeyAltTab; } winPrivScreenRec, *winPrivScreenPtr; -extern ColormapPtr g_cmInstalledMaps[]; -extern winScreenInfo g_winScreens[]; -extern char *g_pcDisplay; +extern winScreenInfo g_ScreenInfo[]; extern miPointerScreenFuncRec g_winPointerCursorFuncs; extern DWORD g_dwEvents; extern int g_fdMessageQueue; -extern int g_winScreenPrivateIndex; -extern unsigned long g_winGeneration; +extern int g_iScreenPrivateIndex; +extern int g_iCmapPrivateIndex; +extern int g_iGCPrivateIndex; +extern int g_iPixmapPrivateIndex; +extern unsigned long g_ulServerGeneration; extern CARD32 g_c32LastInputEventTime; + /* * Screen privates macros + */ + +#define winGetScreenPriv(pScreen) \ + ((winPrivScreenPtr) (pScreen)->devPrivates[g_iScreenPrivateIndex].ptr) + +#define winSetScreenPriv(pScreen,v) \ + ((pScreen)->devPrivates[g_iScreenPrivateIndex].ptr = (pointer) v) + +#define winScreenPriv(pScreen) \ + winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) + + +/* + * Colormap privates macros + */ + +#define winGetCmapPriv(pCmap) \ + ((winPrivCmapPtr) (pCmap)->devPrivates[g_iCmapPrivateIndex].ptr) + +#define winSetCmapPriv(pCmap,v) \ + ((pCmap)->devPrivates[g_iCmapPrivateIndex].ptr = (pointer) v) + +#define winCmapPriv(pCmap) \ + winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap) + + +/* + * GC privates macros */ -#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ - (pScreen)->devPrivates[g_winScreenPrivateIndex].ptr) + +#define winGetGCPriv(pGC) \ + ((winPrivGCPtr) (pGC)->devPrivates[g_iGCPrivateIndex].ptr) + +#define winSetGCPriv(pGC,v) \ + ((pGC)->devPrivates[g_iGCPrivateIndex].ptr = (pointer) v) + +#define winGCPriv(pGC) \ + winPrivGCPtr pGCPriv = winGetGCPriv(pGC) + + +/* + * Pixmap privates macros + */ + +#define winGetPixmapPriv(pPixmap) \ + ((winPrivPixmapPtr) (pPixmap)->devPrivates[g_iPixmapPrivateIndex].ptr) -#define winSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[g_winScreenPrivateIndex].ptr = \ - (pointer) v) +#define winSetPixmapPriv(pPixmap,v) \ + ((pPixmap)->devPrivates[g_iPixmapPrivateIndex].ptr = (pointer) v) -#define winScreenPriv(pScreen) winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) +#define winPixmapPriv(pPixmap) \ + winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap) + /* * 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 */ + +/* + * FIXME: Windows shell API defines. Should be in w32api shellapi.h + */ + +#ifndef ABS_AUTOHIDE +#define ABS_AUTOHIDE 0x00000001 +#endif +#ifndef ABS_ALWAYSONTOP +#define ABS_ALWAYSONTOP 0x00000002 +#endif + + /* * BEGIN DDX and DIX Function Prototypes */ @@ -351,6 +519,7 @@ DWORD winBitsPerPixel (DWORD dwDepth); + /* * winallpriv.c */ @@ -358,15 +527,24 @@ Bool winAllocatePrivates (ScreenPtr pScreen); +Bool +winInitCmapPrivates (ColormapPtr pCmap); + +Bool +winAllocateCmapPrivates (ColormapPtr pCmap); + + /* * winblock.c */ void -winBlockHandler (pointer pBlockData, - OSTimePtr pptv, +winBlockHandler (int nScreen, + pointer pBlockData, + pointer pTimeout, pointer pReadMask); + /* * winclip.c */ @@ -374,40 +552,41 @@ RegionPtr winPixmapToRegionNativeGDI (PixmapPtr pPix); + /* * wincmap.c */ int -winListInstalledColormapsNativeGDI (ScreenPtr pScreen, Colormap *pmaps); - -Bool -winInitVisualsNativeGDI (ScreenPtr pScreen); +winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps); void -winStoreColorsNativeGDI (ColormapPtr pmap, int ndef, xColorItem *pdefs); +winStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs); void -winInstallColormapNativeGDI (ColormapPtr pmap); +winInstallColormap (ColormapPtr pmap); void -winUninstallColormapNativeGDI (ColormapPtr pmap); +winUninstallColormap (ColormapPtr pmap); void -winResolveColorNativeGDI (unsigned short *pred, - unsigned short *pgreen, - unsigned short *pblue, - VisualPtr pVisual); +winResolveColor (unsigned short *pred, + unsigned short *pgreen, + unsigned short *pblue, + VisualPtr pVisual); Bool -winInitializeColormapNativeGDI (ColormapPtr pmap); +winCreateColormap (ColormapPtr pmap); +void +winDestroyColormap (ColormapPtr pmap); + int -winExpandDirectColorsNativeGDI (ColormapPtr pmap, int ndef, - xColorItem *indefs, xColorItem *outdefs); +winExpandDirectColors (ColormapPtr pmap, int ndef, + xColorItem *indefs, xColorItem *outdefs); Bool -winCreateDefColormapNativeGDI (ScreenPtr pScreen); +winCreateDefColormap (ScreenPtr pScreen); Bool winSetVisualTypesNativeGDI (int nDepth, int nVisuals, int nBitsPerRGB); @@ -415,6 +594,18 @@ void winClearVisualTypes (void); + +/* + * wincreatewnd.c + */ + +Bool +winCreateBoundingWindowFullScreen (ScreenPtr pScreen); + +Bool +winCreateBoundingWindowWindowed (ScreenPtr pScreen); + + /* * wincursor.c */ @@ -425,7 +616,27 @@ void winCrossScreen (ScreenPtr pScreen, Bool fEntering); + +/* + * winengine.c + */ + +Bool +winDetectSupportedEngines (ScreenPtr pScreen); + +Bool +winSetEngine (ScreenPtr pScreen); + + /* + * winerror.c + */ + +void +OSVenderVErrorF (const char *pszFormat, va_list va_args); + + +/* * winfillsp.c */ @@ -437,6 +648,7 @@ int *pWidths, int fSorted); + /* * winfont.c */ @@ -447,6 +659,7 @@ Bool winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); + /* * wingc.c */ @@ -480,6 +693,7 @@ void winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc); + /* * wingetsp.c */ @@ -492,6 +706,7 @@ int nSpans, char *pDst); + /* * winkeybd.c */ @@ -524,6 +739,39 @@ Bool winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam); +void +winKeybdReleaseModifierKeys (); + +void +winSendKeyEvent (DWORD dwKey, Bool fDown); + + +/* + * winlayer.c + */ + +LayerPtr +winLayerCreate (ScreenPtr pScreen); + +int +winLayerAdd (WindowPtr pWindow, pointer value); + +int +winLayerRemove (WindowPtr pWindow, pointer value); + +Bool +winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations); + +Bool +winRandRSetConfig (ScreenPtr pScreen, + Rotation rotateKind, + RRScreenSizePtr pSize, + RRVisualGroupPtr pVisualGroup); + +Bool +winRandRInit (ScreenPtr pScreen); + + /* * winmisc.c */ @@ -538,6 +786,10 @@ Bool winUpdateFBPointer (ScreenPtr pScreen, void *pbits); +BOOL +winPaintBackground (HWND hwnd, COLORREF colorref); + + /* * winmouse.c */ @@ -559,6 +811,62 @@ int iEventType, int iButton, WPARAM wParam); + +/* + * winnativegdi.c + */ + +HBITMAP +winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth, + BYTE **ppbBits, BITMAPINFO **ppbmi); + +Bool +winAllocateFBNativeGDI (ScreenPtr pScreen); + +void +winShadowUpdateNativeGDI (ScreenPtr pScreen, + shadowBufPtr pBuf); + +Bool +winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsNativeGDI (ScreenPtr pScreen); + +Bool +winAdjustVideoModeNativeGDI (ScreenPtr pScreen); + +Bool +winBltExposedRegionsNativeGDI (ScreenPtr pScreen); + +Bool +winActivateAppNativeGDI (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsNativeGDI (ScreenPtr pScreen); + +Bool +winRedrawScreenNativeGDI (ScreenPtr pScreen); + +Bool +winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen); + +Bool +winInstallColormapNativeGDI (ColormapPtr pColormap); + +Bool +winStoreColorsNativeGDI (ColormapPtr pmap, + int ndef, + xColorItem *pdefs); + +Bool +winCreateColormapNativeGDI (ColormapPtr pColormap); + +Bool +winDestroyColormapNativeGDI (ColormapPtr pColormap); + + + /* * winpfbddd.c */ @@ -581,6 +889,10 @@ Bool winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen); +Bool +winHotKeyAltTabPrimaryDD (ScreenPtr pScreen); + + /* * winpixmap.c */ @@ -601,6 +913,15 @@ winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix, int xrot, int yrot); +Bool +winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap, + int iWidth, int iHeight, + int iDepth, + int iBitsPerPixel, + int devKind, + pointer pPixData); + + /* * winpntwin.c */ @@ -608,6 +929,7 @@ void winPaintWindowNativeGDI (WindowPtr pWin, RegionPtr pRegion, int what); + /* * winpolyline.c */ @@ -619,6 +941,7 @@ int npt, DDXPointPtr ppt); + /* * winscrinit.c */ @@ -647,18 +970,7 @@ void winSetWindowPixmap (WindowPtr pWin, PixmapPtr pPix); -Bool -winDetectSupportedEngines (ScreenPtr pScreen); - -Bool -winSetEngine (ScreenPtr pScreen); - -void -winCreateBoundingWindowFullScreen (ScreenPtr pScreen); -void -winCreateBoundingWindowWindowed (ScreenPtr pScreen); - /* * winsetsp.c */ @@ -681,22 +993,7 @@ 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); + shadowBufPtr pBuf); Bool winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen); @@ -716,6 +1013,27 @@ Bool winSetEngineFunctionsShadowDD (ScreenPtr pScreen); +Bool +winRedrawScreenShadowDD (ScreenPtr pScreen); + +Bool +winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen); + +Bool +winInstallColormapShadowDD (ColormapPtr pColormap); + +Bool +winStoreColorsShadowDD (ColormapPtr pmap, + int ndef, + xColorItem *pdefs); + +Bool +winCreateColormapShadowDD (ColormapPtr pColormap); + +Bool +winDestroyColormapShadowDD (ColormapPtr pColormap); + + /* * winshadddnl.c */ @@ -725,22 +1043,7 @@ 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); + shadowBufPtr pBuf); Bool winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen); @@ -760,6 +1063,27 @@ Bool winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen); +Bool +winRedrawScreenShadowDDNL (ScreenPtr pScreen); + +Bool +winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen); + +Bool +winInstallColormapShadowDDNL (ColormapPtr pColormap); + +Bool +winStoreColorsShadowDDNL (ColormapPtr pmap, + int ndef, + xColorItem *pdefs); + +Bool +winCreateColormapShadowDDNL (ColormapPtr pColormap); + +Bool +winDestroyColormapShadowDDNL (ColormapPtr pColormap); + + /* * winshadgdi.c */ @@ -769,23 +1093,8 @@ void winShadowUpdateGDI (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); + shadowBufPtr pBuf); -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); @@ -799,17 +1108,40 @@ winActivateAppShadowGDI (ScreenPtr pScreen); Bool +winRedrawScreenShadowGDI (ScreenPtr pScreen); + +Bool winSetEngineFunctionsShadowGDI (ScreenPtr pScreen); +Bool +winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen); + +Bool +winInstallColormapShadowGDI (ColormapPtr pColormap); + +Bool +winStoreColorsShadowGDI (ColormapPtr pmap, + int ndef, + xColorItem *pdefs); + +Bool +winCreateColormapShadowGDI (ColormapPtr pColormap); + +Bool +winDestroyColormapShadowGDI (ColormapPtr pColormap); + + /* * winwakeup.c */ void -winWakeupHandler (pointer pWakeupData, - int err, +winWakeupHandler (int nScreen, + pointer pWakeupData, + unsigned long ulResult, pointer pReadmask); + /* * winwindow.c */ @@ -837,6 +1169,7 @@ Bool winMapWindowNativeGDI (WindowPtr pWindow); + /* * winwndproc.c */ @@ -845,8 +1178,6 @@ winWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); -void -winRestoreModeKeyStates (ScreenPtr pScreen); /* * END DDX and DIX Function Prototypes Index: xc/programs/Xserver/hw/xwin/winallpriv.c diff -u xc/programs/Xserver/hw/xwin/winallpriv.c:1.3 xc/programs/Xserver/hw/xwin/winallpriv.c:1.8 --- xc/programs/Xserver/hw/xwin/winallpriv.c:1.3 Mon May 14 12:52:33 2001 +++ xc/programs/Xserver/hw/xwin/winallpriv.c Mon Oct 29 16:10:23 2001 @@ -28,29 +28,47 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winallpriv.c,v 1.8 2001/10/29 21:10:23 alanh Exp $ */ #include "win.h" + + /* See Porting Layer Definition - p. 58 */ +/* + * Allocate indexes for the privates that we use. + * Allocate memory directly for the screen privates. + * Reserve space in GCs and Pixmaps for our privates. + * Colormap privates are handled in winAllocateCmapPrivates () + */ + Bool winAllocatePrivates (ScreenPtr pScreen) { winPrivScreenPtr pScreenPriv; +#if CYGDEBUG + ErrorF ("winAllocateScreenPrivates () - g_ulServerGeneration: %d " + "serverGeneration: %d\n", + g_ulServerGeneration, serverGeneration); +#endif + /* We need a new slot for our privates if the screen gen has changed */ - if (g_winGeneration != serverGeneration) + if (g_ulServerGeneration != serverGeneration) { /* Get an index that we can store our privates at */ - g_winScreenPrivateIndex = AllocateScreenPrivateIndex (); - g_winGeneration = serverGeneration; + g_iScreenPrivateIndex = AllocateScreenPrivateIndex (); + g_iGCPrivateIndex = AllocateGCPrivateIndex (); + g_iPixmapPrivateIndex = AllocatePixmapPrivateIndex (); + + g_ulServerGeneration = serverGeneration; } - /* Allocate memory for our private structure */ - pScreenPriv = (winPrivScreenPtr) xalloc (sizeof (*pScreenPriv)); + /* Allocate memory for the screen private structure */ + pScreenPriv = (winPrivScreenPtr) xalloc (sizeof (winPrivScreenRec)); if (!pScreenPriv) { - ErrorF ("winAllocatePrivates () - xalloc () failed\n"); + ErrorF ("winAllocateScreenPrivates () - xalloc () failed\n"); return FALSE; } @@ -63,6 +81,93 @@ /* Save the screen private pointer */ winSetScreenPriv (pScreen, pScreenPriv); + + /* Reserve GC memory for our privates */ + if (!AllocateGCPrivate (pScreen, g_iGCPrivateIndex, + sizeof (winPrivGCRec))) + { + ErrorF ("winAllocatePrivates () - AllocateGCPrivate () failed\n"); + return FALSE; + } + + /* Reserve Pixmap memory for our privates */ + if (!AllocatePixmapPrivate (pScreen, g_iPixmapPrivateIndex, + sizeof (winPrivPixmapRec))) + { + ErrorF ("winAllocatePrivates () - AllocatePixmapPrivates () failed\n"); + return FALSE; + } + + return TRUE; +} + + +/* + * Colormap privates may be allocated after the default colormap has + * already been created for some screens. This initialization procedure + * is called for each default colormap that is found. + */ + +Bool +winInitCmapPrivates (ColormapPtr pcmap) +{ +#if CYGDEBUG + ErrorF ("winInitCmapPrivates ()\n"); +#endif + + /* + * I see no way that this function can do anything useful + * with only a ColormapPtr. We don't have the index for + * our dev privates yet, so we can't really initialize + * anything. Perhaps I am misunderstanding the purpose + * of this function. + */ + + return TRUE; +} + + +/* + * Allocate memory for our colormap privates + */ + +Bool +winAllocateCmapPrivates (ColormapPtr pCmap) +{ + winPrivCmapPtr pCmapPriv; + static unsigned long ulPrivateGeneration = 0; + +#if CYGDEBUG + ErrorF ("winAllocateCmapPrivates ()\n"); +#endif + + /* Get a new privates index when the server generation changes */ + if (ulPrivateGeneration != serverGeneration) + { + /* Get an index that we can store our privates at */ + g_iCmapPrivateIndex = AllocateColormapPrivateIndex (winInitCmapPrivates); + + /* Save the new server generation */ + ulPrivateGeneration = serverGeneration; + } + + /* Allocate memory for our private structure */ + pCmapPriv = (winPrivCmapPtr) xalloc (sizeof (winPrivCmapRec)); + if (!pCmapPriv) + { + ErrorF ("winAllocateCmapPrivates () - xalloc () failed\n"); + return FALSE; + } + + /* Initialize the memory of the private structure */ + ZeroMemory (pCmapPriv, sizeof (winPrivCmapRec)); + + /* Save the cmap private pointer */ + winSetCmapPriv (pCmap, pCmapPriv); + +#if CYGDEBUG + ErrorF ("winAllocateCmapPrivates () - Returning\n"); +#endif return TRUE; } Index: xc/programs/Xserver/hw/xwin/winblock.c diff -u xc/programs/Xserver/hw/xwin/winblock.c:1.2 xc/programs/Xserver/hw/xwin/winblock.c:1.4 --- xc/programs/Xserver/hw/xwin/winblock.c:1.2 Wed Apr 18 13:14:06 2001 +++ xc/programs/Xserver/hw/xwin/winblock.c Wed Nov 21 03:51:24 2001 @@ -27,14 +27,23 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.4 2001/11/21 08:51:24 alanh Exp $ */ #include "win.h" /* See Porting Layer Definition - p. 6 */ void -winBlockHandler (pointer pBlockData, - OSTimePtr pptv, +winBlockHandler (int nScreen, + pointer pBlockData, + pointer pTimeout, pointer pReadMask) { + winScreenPriv((ScreenPtr)pBlockData); + MSG msg; + + /* Process all messages on our queue */ + while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) + { + DispatchMessage (&msg); + } } Index: xc/programs/Xserver/hw/xwin/winclip.c diff -u xc/programs/Xserver/hw/xwin/winclip.c:1.1 xc/programs/Xserver/hw/xwin/winclip.c:1.2 --- xc/programs/Xserver/hw/xwin/winclip.c:1.1 Thu Apr 5 16:13:49 2001 +++ xc/programs/Xserver/hw/xwin/winclip.c Mon Jun 4 09:04:41 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */ #include "win.h" @@ -35,6 +35,6 @@ RegionPtr winPixmapToRegionNativeGDI (PixmapPtr pPix) { - fprintf (stderr, "winPixmapToRegion()\n"); + ErrorF ("winPixmapToRegion()\n"); return NULL; } Index: xc/programs/Xserver/hw/xwin/wincmap.c diff -u xc/programs/Xserver/hw/xwin/wincmap.c:1.4 xc/programs/Xserver/hw/xwin/wincmap.c:1.8 --- xc/programs/Xserver/hw/xwin/wincmap.c:1.4 Mon May 14 12:52:33 2001 +++ xc/programs/Xserver/hw/xwin/wincmap.c Tue Jul 31 05:46:57 2001 @@ -30,129 +30,407 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincmap.c,v 1.8 2001/07/31 09:46:57 alanh Exp $ */ #include "win.h" + /* See Porting Layer Definition - p. 30 */ +/* + * Walk the list of installed colormaps, filling the pmaps list + * with the resource ids of the installed maps, and return + * a count of the total number of installed maps. + */ int -winListInstalledColormapsNativeGDI (ScreenPtr pScreen, Colormap *pmaps) +winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps) { - /* - * By the time we are processing requests, we can guarantee that there - * is always a colormap installed + winScreenPriv(pScreen); + + /* + * There will only be one installed colormap, so we only need + * to return one id, and the count of installed maps will always + * be one. */ - - ErrorF ("\nwinListInstalledColormaps ()\n"); - return miListInstalledColormaps (pScreen, pmaps); + *pmaps = pScreenPriv->pcmapInstalled->mid; + return 1; } + /* See Porting Layer Definition - p. 30 */ /* See Programming Windows - p. 663 */ void -winInstallColormapNativeGDI (ColormapPtr pmap) +winInstallColormap (ColormapPtr pColormap) { - ErrorF ("\nwinInstallColormap ()\n"); - miInstallColormap (pmap); + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + ColormapPtr oldpmap = pScreenPriv->pcmapInstalled; + +#if CYGDEBUG + ErrorF ("winInstallColormap ()\n"); +#endif + + /* Did the colormap actually change? */ + if (pColormap != oldpmap) + { +#if CYGDEBUG + ErrorF ("winInstallColormap () - Colormap has changed, attempt " + "to install.\n"); +#endif + + /* Was there a previous colormap? */ + if (oldpmap != (ColormapPtr) None) + { + /* There was a previous colormap; tell clients it is gone */ + WalkTree (pColormap->pScreen, TellLostMap, (char *)&oldpmap->mid); + } + + /* Install new colormap */ + pScreenPriv->pcmapInstalled = pColormap; + WalkTree (pColormap->pScreen, TellGainedMap, (char *)&pColormap->mid); + + /* Call the engine specific colormap install procedure */ + if (!((*pScreenPriv->pwinInstallColormap) (pColormap))) + { + ErrorF ("winInstallColormap () - Screen specific colormap install " + "procedure failed. Continuing, but colors may be " + "messed up from now on.\n"); + } + } + + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; } + /* See Porting Layer Definition - p. 30 */ void -winUninstallColormapNativeGDI (ColormapPtr pmap) +winUninstallColormap (ColormapPtr pmap) { - ErrorF ("\nwinUninstallColormap ()\n"); - miUninstallColormap (pmap); + winScreenPriv(pmap->pScreen); + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + +#if CYGDEBUG + ErrorF ("winUninstallColormap ()\n"); +#endif + + /* Is the colormap currently installed? */ + if (pmap != curpmap) + { + /* Colormap not installed, nothing to do */ + return; + } + + /* Clear the installed colormap flag */ + pScreenPriv->pcmapInstalled = NULL; + + /* + * NOTE: The default colormap does not get "uninstalled" before + * it is destroyed. + */ + + /* Install the default cmap in place of the cmap to be uninstalled */ + if (pmap->mid != pmap->pScreen->defColormap) + { + curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, + RT_COLORMAP); + (*pmap->pScreen->InstallColormap) (curpmap); + } } + /* See Porting Layer Definition - p. 30 */ void -winStoreColorsNativeGDI (ColormapPtr pmap, int ndef, xColorItem *pdefs) +winStoreColors (ColormapPtr pmap, + int ndef, + xColorItem *pdefs) { - ErrorF ("winStoreColors ()\n"); -#if 0 - miStoreColors (pmap, ndef, pdefs); + ScreenPtr pScreen = pmap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pmap); + int i; + unsigned short nRed, nGreen, nBlue; + +#if CYGDEBUG + if (ndef != 1) + ErrorF ("winStoreColors () - ndef: %d\n", + ndef); #endif + + /* Save the new colors in the colormap privates */ + for (i = 0; i < ndef; ++i) + { + /* Adjust the colors from the X color spec to the Windows color spec */ + nRed = pdefs[i].red >> 8; + nGreen = pdefs[i].green >> 8; + nBlue = pdefs[i].blue >> 8; + + /* Copy the colors to a palette entry table */ + pCmapPriv->peColors[pdefs[0].pixel + i].peRed = nRed; + pCmapPriv->peColors[pdefs[0].pixel + i].peGreen = nGreen; + pCmapPriv->peColors[pdefs[0].pixel + i].peBlue = nBlue; + + /* Copy the colors to a RGBQUAD table */ + pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbRed = nRed; + pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbGreen = nGreen; + pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue; + +#if CYGDEBUG + ErrorF ("winStoreColors () - nRed %d nGreen %d nBlue %d\n", + nRed, nGreen, nBlue); +#endif + } + + /* Call the engine specific store colors procedure */ + if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs))) + { + ErrorF ("winStoreColors () - Engine cpecific color storage procedure " + "failed. Continuing, but colors may be messed up from now " + "on.\n"); + } } + /* See Porting Layer Definition - p. 30 */ void -winResolveColorNativeGDI (unsigned short *pred, - unsigned short *pgreen, - unsigned short *pblue, - VisualPtr pVisual) +winResolveColor (unsigned short *pred, + unsigned short *pgreen, + unsigned short *pblue, + VisualPtr pVisual) { - ErrorF ("\nwinResolveColor ()\n"); +#if CYGDEBUG + ErrorF ("winResolveColor ()\n"); +#endif + miResolveColor (pred, pgreen, pblue, pVisual); } + /* See Porting Layer Definition - p. 29 */ -/* Also refered to as CreateColormap */ Bool -winInitializeColormapNativeGDI (ColormapPtr pmap) +winCreateColormap (ColormapPtr pmap) { - ErrorF ("\nwinInitializeColormap ()\n"); -#if 0 - return miInitializeColormap (pmap); + winPrivCmapPtr pCmapPriv = NULL; + ScreenPtr pScreen = pmap->pScreen; + winScreenPriv(pScreen); + +#if CYGDEBUG + ErrorF ("winCreateColormap ()\n"); #endif + + /* Allocate colormap privates */ + if (!winAllocateCmapPrivates (pmap)) + { + ErrorF ("winCreateColorma () - Couldn't allocate cmap privates\n"); + return FALSE; + } + + /* Get a pointer to the newly allocated privates */ + pCmapPriv = winGetCmapPriv (pmap); + + /* + * FIXME: This is some evil hackery to help in handling some X clients + * that expect the top pixel to be white. This "help" only lasts until + * some client overwrites the top colormap entry. + * + * We don't want to actually allocate the top entry, as that causes + * problems with X clients that need 7 planes (128 colors) in the default + * colormap, such as Magic 7.1. + */ + pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbRed = 255; + pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbGreen = 255; + pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbBlue = 255; + pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peRed = 255; + pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peGreen = 255; + pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peBlue = 255; + + /* Call the engine specific colormap initialization procedure */ + if (!((*pScreenPriv->pwinCreateColormap) (pmap))) + { + ErrorF ("winCreateColormap () - Engine specific colormap creation " + "procedure failed. Aborting.\n"); + return FALSE; + } + return TRUE; } + +/* See Porting Layer Definition - p. 29, 30 */ +void +winDestroyColormap (ColormapPtr pColormap) +{ + winScreenPriv(pColormap->pScreen); + winCmapPriv(pColormap); + + /* Call the engine specific colormap destruction procedure */ + if (!((*pScreenPriv->pwinDestroyColormap) (pColormap))) + { + ErrorF ("winDestroyColormap () - Engine specific colormap destruction " + "procedure failed. Continuing, but it is possible that memory " + "was leaked, or that colors will be messed up from now on.\n"); + } + + /* Free the colormap privates */ + xfree (pCmapPriv); + winSetCmapPriv (pColormap, NULL); + +#if CYGDEBUG + ErrorF ("winDestroyColormap () - Returning\n"); +#endif +} + + int -winExpandDirectColorsNativeGDI (ColormapPtr pmap, int ndef, - xColorItem *indefs, xColorItem *outdefs) +winExpandDirectColors (ColormapPtr pmap, int ndef, + xColorItem *indefs, xColorItem *outdefs) { ErrorF ("\nwinExpandDirectColors ()\n"); return miExpandDirectColors (pmap, ndef, indefs, outdefs); } + +/* + * Load the palette used by the Shadow DIB + */ + +static Bool -winCreateDefColormapNativeGDI (ScreenPtr pScreen) +winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap) { 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++); + Pixel pixel; /* Pixel == CARD32 */ + CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */ + UINT uiColorsRetrieved = 0; + RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES]; + + /* Get the color table for the screen */ + uiColorsRetrieved = GetDIBColorTable (pScreenPriv->hdcScreen, + 0, + WIN_NUM_PALETTE_ENTRIES, + rgbColors); + if (uiColorsRetrieved == 0) + { + ErrorF ("winGetPaletteDIB () - Could not retrieve screen color table\n"); + return FALSE; + } - /* - * AllocNone for Dynamic visual classes, - * AllocAll for non-Dynamic visual classes. - */ +#if CYGDEBUG + ErrorF ("winGetPaletteDIB () - Retrieved %d colors from DIB\n", + uiColorsRetrieved); +#endif - /* Allocate an X colormap, owned by client 0 */ - if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pcmap, - AllocNone, 0) != Success) + /* Set the DIB color table to the default screen palette */ + if (SetDIBColorTable (pScreenPriv->hdcShadow, + 0, + uiColorsRetrieved, + rgbColors) == 0) { - ErrorF ("winCreateDefColormapNativeGDI () - CreateColormap failed\n"); + ErrorF ("winGetPaletteDIB () - SetDIBColorTable () failed\n"); return FALSE; } - if (pcmap == NULL) + + /* Alloc each color in the DIB color table */ + for (i = 0; i < uiColorsRetrieved; ++i) { - ErrorF ("winCreateDefColormap () - Colormap could not be created\n"); + pixel = i; + + /* Extract the color values for current palette entry */ + nRed = rgbColors[i].rgbRed << 8; + nGreen = rgbColors[i].rgbGreen << 8; + nBlue = rgbColors[i].rgbBlue << 8; + +#if CYGDEBUG + ErrorF ("winGetPaletteDIB () - Allocating a color: %d; "\ + "%d %d %d\n", + pixel, nRed, nGreen, nBlue); +#endif + + /* Allocate a entry in the X colormap */ + if (AllocColor (pcmap, + &nRed, + &nGreen, + &nBlue, + &pixel, + 0) != Success) + { + ErrorF ("winGetPaletteDIB () - AllocColor () failed, pixel %d\n", + i); + return FALSE; + } + + if (i != pixel + || nRed != rgbColors[i].rgbRed + || nGreen != rgbColors[i].rgbGreen + || nBlue != rgbColors[i].rgbBlue) + { + ErrorF ("winGetPaletteDIB () - Got: %d; "\ + "%d %d %d\n", + pixel, nRed, nGreen, nBlue); + } + + /* FIXME: Not sure that this bit is needed at all */ + pcmap->red[i].co.local.red = nRed; + pcmap->red[i].co.local.green = nGreen; + pcmap->red[i].co.local.blue = nBlue; + } + + /* System is using a colormap */ + /* Set the black and white pixel indices */ + pScreen->whitePixel = uiColorsRetrieved - 1; + pScreen->blackPixel = 0; + + return TRUE; +} + + +/* + * Load the standard system palette being used by GDI + */ +static +Bool +winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap) +{ + int i; + Pixel pixel; /* Pixel == CARD32 */ + CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */ + UINT uiSystemPaletteEntries; + LPPALETTEENTRY ppeColors = NULL; + HDC hdc = NULL; + + /* Get a DC to obtain the default palette */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winGetPaletteDD () - Couldn't get a DC\n"); return FALSE; } - ErrorF ("winCreateDefColormap () - Created a colormap\n"); /* Get the number of entries in the system palette */ - uiSystemPaletteEntries = GetSystemPaletteEntries (pScreenPriv->hdcScreen, + uiSystemPaletteEntries = GetSystemPaletteEntries (hdc, 0, 0, NULL); - ErrorF ("winCreateDefColormap () - uiSystemPaletteEntries %d\n", + if (uiSystemPaletteEntries == 0) + { + ErrorF ("winGetPaletteDD () - Unable to determine number of " + "system palette entries\n"); + return FALSE; + } + +#if CYGDEBUG + ErrorF ("winGetPaletteDD () - uiSystemPaletteEntries %d\n", uiSystemPaletteEntries); +#endif /* Allocate palette entries structure */ ppeColors = xalloc (uiSystemPaletteEntries * sizeof (PALETTEENTRY)); - + if (ppeColors == NULL) + { + ErrorF ("winGetPaletteDD () - xalloc () for colormap failed\n"); + return FALSE; + } + /* Get system palette entries */ - GetSystemPaletteEntries (pScreenPriv->hdcScreen, + GetSystemPaletteEntries (hdc, 0, uiSystemPaletteEntries, ppeColors); /* Allocate an X colormap entry for every system palette entry */ @@ -164,268 +442,187 @@ 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 ", +#if CYGDEBUG + ErrorF ("winGetPaletteDD () - Allocating a color: %d; "\ + "%d %d %d\n", pixel, nRed, nGreen, nBlue); +#endif if (AllocColor (pcmap, &nRed, &nGreen, &nBlue, &pixel, 0) != Success) - break; -#endif + { + ErrorF ("winGetPaletteDD () - AllocColor () failed, pixel %d\n", + i); + free (ppeColors); + ppeColors = NULL; + return FALSE; + } pcmap->red[i].co.local.red = nRed; pcmap->red[i].co.local.green = nGreen; pcmap->red[i].co.local.blue = nBlue; } - if (uiSystemPaletteEntries == 0) + /* System is using a colormap */ + /* Set the black and white pixel indices */ + pScreen->whitePixel = uiSystemPaletteEntries - 1; + pScreen->blackPixel = 0; + + /* Free colormap */ + if (ppeColors != NULL) { - fbInitializeColormap (pcmap); + free (ppeColors); + ppeColors = NULL; } - else + + /* Free the DC */ + if (hdc != NULL) { - /* Set the black and white pixel indices */ - pScreen->whitePixel = uiSystemPaletteEntries - 1; - pScreen->blackPixel = 0; + ReleaseDC (NULL, hdc); + hdc = NULL; } - - /* Free colormap */ - free (ppeColors); - /* Install the created colormap */ - (*pScreen->InstallColormap)(pcmap); - - return fReturn; -} - -void -winClearVisualTypes (void) -{ -#if CYGDEBUG - ErrorF ("winClearVisualTypes ()\n"); -#endif - miClearVisualTypes (); + return TRUE; } -Bool -winSetVisualTypesNativeGDI (int nDepth, int nVisuals, int nBitsPerRGB) -{ -#if CYGDEBUG - ErrorF ("winSetVisualTypes ()\n"); -#endif - return miSetVisualTypes (nDepth, nVisuals, nBitsPerRGB, -1); -} +/* + * Install the standard fb colormap, or the GDI colormap, + * depending on the current screen depth. + */ Bool -winInitVisualsNativeGDI (ScreenPtr pScreen) +winCreateDefColormap (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); + unsigned short zero = 0, ones = 0xFFFF; + VisualPtr pVisual = pScreenPriv->pRootVisual; + ColormapPtr pcmap = NULL; + Pixel wp, bp; + +#if CYGDEBUG + ErrorF ("winCreateDefColormap ()\n"); +#endif - /* Exit if we could not allocate a bitmapinfo structure */ - if (pbmi == NULL) + /* Use standard fb colormaps for non palettized color modes */ + if (pScreenInfo->dwDepth > 8) { - ErrorF ("winInitVisuals () - Could not allocate a "\ - "bitmapinfo structure\n"); - return FALSE; + ErrorF ("winCreateDefColormap () - Deferring to " \ + "fbCreateDefColormap ()\n"); + return fbCreateDefColormap (pScreen); } - /* Create a bitmap compatible with the primary display */ - hbmp = CreateCompatibleBitmap (hdc, 1, 1); + /* + * AllocAll for non-Dynamic visual classes, + * AllocNone for Dynamic visual classes. + */ - 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. + * Dynamic visual classes allow the colors of the color map + * to be changed by clients. */ - 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); + ErrorF ("winCreateDefColormap () - defColormap: %d\n", + pScreen->defColormap); #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)) + /* Allocate an X colormap, owned by client 0 */ + if (CreateColormap (pScreen->defColormap, + pScreen, + pVisual, + &pcmap, + (pVisual->class & DynamicClass) ? AllocNone : AllocAll, + 0) != Success) { - GetDIBits (hdc, hbmp, - 0, 0, - NULL, - pbmi, - 0); + ErrorF ("winCreateDefColormap () - CreateColormap failed\n"); + return FALSE; } - -#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) + if (pcmap == NULL) { - case 32: - case 24: - if (pbmih->bV4RedMask != 0x00FF0000) - { - pbmih->bV4RedMask = 0x00FF0000; - } - if (pbmih->bV4GreenMask != 0x0000FF00) - { - pbmih->bV4GreenMask = 0x0000FF00; - } - if (pbmih->bV4BlueMask != 0x000000FF) - { - pbmih->bV4BlueMask = 0x000000FF; - } - break; - - case 16: - if (pbmih->bV4RedMask != 0x0000F800 && pbmih->bV4RedMask != 0x00007C00) - { - pbmih->bV4RedMask = 0x0000F800; - } - if (pbmih->bV4GreenMask != 0x00007E0 - && pbmih->bV4GreenMask != 0x000003E0) - { - pbmih->bV4GreenMask = 0x000007E0; - } - if (pbmih->bV4BlueMask != 0x0000001F) - { - pbmih->bV4BlueMask = 0x0000001F; - } - break; + ErrorF ("winCreateDefColormap () - Colormap could not be created\n"); + return FALSE; } #if CYGDEBUG - ErrorF ("winInitVisuals () - 3rd comp %08x rm %08x gm %08x bm %08x\n", - pbmi->bmiHeader.biCompression, - pbmih->bV4RedMask, - pbmih->bV4GreenMask, - pbmih->bV4BlueMask); + ErrorF ("winCreateDefColormap () - Created a colormap\n"); #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) + /* Branch on the visual class */ + if (!(pVisual->class & DynamicClass)) { - case 32: - case 24: - pScreenPriv->dwBitsPerRGB = 8; - break; - - case 16: - if (pScreenPriv->dwRedMask == 0xF800) + /* Branch on engine type */ + if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI) { - pScreenPriv->dwBitsPerRGB = 6; + /* Load the colors being used by the Shadow DIB */ + if (!winGetPaletteDIB (pScreen, pcmap)) + { + ErrorF ("winCreateDefColormap () - Couldn't get DIB colors\n"); + return FALSE; + } } else { - pScreenPriv->dwBitsPerRGB = 5; + /* Load the colors from the default system palette */ + if (!winGetPaletteDD (pScreen, pcmap)) + { + ErrorF ("winCreateDefColormap () - Couldn't get colors " + "for DD\n"); + return FALSE; + } } - break; - - case 15: - pScreenPriv->dwBitsPerRGB = 5; - break; + } + else + { + wp = pScreen->whitePixel; + bp = pScreen->blackPixel; - 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)) + /* Allocate a black and white pixel */ + if ((AllocColor (pcmap, &ones, &ones, &ones, &wp, 0) != + Success) + || + (AllocColor (pcmap, &zero, &zero, &zero, &bp, 0) != + Success)) { - ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winCreateDefColormap () - Couldn't allocate bp or wp\n"); return FALSE; } - break; + + pScreen->whitePixel = wp; + pScreen->blackPixel = bp; - case 8: - ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - PseudoColorMask, - pScreenPriv->dwBitsPerRGB, - PseudoColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) +#if 0 + /* Have to reserve first 10 and last ten pixels in DirectDraw windowed */ + if (pScreenInfo->dwEngine != WIN_SERVER_SHADOW_GDI) { - ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); - return FALSE; + int k; + Pixel p; + + for (k = 1; k < 10; ++k) + { + p = k; + if (AllocColor (pcmap, &ones, &ones, &ones, &p, 0) != Success) + FatalError ("Foo!\n"); + } + + for (k = 245; k < 255; ++k) + { + p = k; + if (AllocColor (pcmap, &zero, &zero, &zero, &p, 0) != Success) + FatalError ("Baz!\n"); + } } -#if CYGDEBUG - ErrorF ("winInitVisuals () - Returned from miSetVisualTypesAndMasks\n"); #endif - break; - - default: - break; } - /* Free memory */ - xfree (pbmi); + /* Install the created colormap */ + (*pScreen->InstallColormap)(pcmap); #if CYGDEBUG - ErrorF ("winInitVisuals () - Returning\n"); + ErrorF ("winCreateDefColormap () - Returning\n"); #endif return TRUE; Index: xc/programs/Xserver/hw/xwin/wincreatewnd.c diff -u /dev/null xc/programs/Xserver/hw/xwin/wincreatewnd.c:1.1 --- /dev/null Fri Jan 18 15:26:44 2002 +++ xc/programs/Xserver/hw/xwin/wincreatewnd.c Sun Nov 11 18:07:40 2001 @@ -0,0 +1,324 @@ +/* + *Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal 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/wincreatewnd.c,v 1.1 2001/11/11 23:07:40 alanh Exp $ */ + +#include "win.h" +#include "shellapi.h" + + +/* + * Local function prototypes + */ + +static Bool +winAdjustForAutoHide (RECT *prcWorkArea); + + +/* + * Create a full screen window + */ + +Bool +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); + + return TRUE; +} + + +/* + * Create our primary Windows display window + */ + +Bool +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); + + /* Adjust for auto-hide taskbars */ + winAdjustForAutoHide (&rcWorkArea); + + /* 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)) + { + iHeight = rcWorkArea.bottom - rcWorkArea.top; + 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 OverlappedWindow */ + rcWorkArea.left, /* Horizontal position */ + rcWorkArea.top, /* 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 */ + if (*phwnd == NULL) + { + ErrorF ("winCreateBoundingWindowWindowed () CreateWindowEx () failed\n"); + return FALSE; + } + +#if CYGDEBUG + ErrorF ("winCreateBoundingWindowWindowed () - CreateWindowEx () returned\n"); +#endif + + /* Get the client area coordinates */ + if (!GetClientRect (*phwnd, &rcClient)) + { + ErrorF ("winCreateBoundingWindowWindowed () - GetClientRect () " + "failed\n"); + return FALSE; + } + ErrorF ("winCreateBoundingWindowWindowed () - WindowClient "\ + "w %d h %d r %d l %d b %d t %d\n", + rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top, + rcClient.right, rcClient.left, + rcClient.bottom, rcClient.top); + + /* + * Transform the client relative coords to screen relative coords. + * It is almost impossible to tell if the function has failed, thus + * we do not want to check for a return value of 0, as that could + * simply indicated that the window was positioned with the upper + * left corner at (0,0). + */ + MapWindowPoints (*phwnd, + HWND_DESKTOP, + (LPPOINT)&rcClient, + 2); + + /* Show the window */ + ShowWindow (*phwnd, SW_SHOW); + if (!UpdateWindow (*phwnd)) + { + ErrorF ("winCreateBoundingWindowWindowed () - UpdateWindow () failed\n"); + return FALSE; + } + + /* Attempt to bring our window to the top of the display */ + if (!BringWindowToTop (*phwnd)) + { + ErrorF ("winCreateBoundingWindowWindowed () - BringWindowToTop () " + "failed\n"); + return FALSE; + } + + /* Paint window background blue */ + if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI) + winPaintBackground (*phwnd, RGB (0x00, 0x00, 0xFF)); + + ErrorF ("winCreateBoundingWindowWindowed () - Returning\n"); + + return TRUE; +} + + +/* + * Adjust the client area so that any auto-hide toolbars + * will work correctly. + */ + +static Bool +winAdjustForAutoHide (RECT *prcWorkArea) +{ + APPBARDATA abd; + HWND hwndAutoHide; + + ErrorF ("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n", + prcWorkArea->top, prcWorkArea->left, + prcWorkArea->bottom, prcWorkArea->right); + + /* Find out if the Windows taskbar is set to auto-hide */ + ZeroMemory (&abd, sizeof (abd)); + abd.cbSize = sizeof (abd); + if (SHAppBarMessage (ABM_GETSTATE, &abd) & ABS_AUTOHIDE) + ErrorF ("winAdjustForAutoHide - Taskbar is auto hide\n"); + + /* Look for a TOP auto-hide taskbar */ + abd.uEdge = ABE_TOP; + hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd); + if (hwndAutoHide != NULL) + { + ErrorF ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n"); + prcWorkArea->top += 1; + } + + /* Look for a LEFT auto-hide taskbar */ + abd.uEdge = ABE_LEFT; + hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd); + if (hwndAutoHide != NULL) + { + ErrorF ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n"); + prcWorkArea->left += 1; + } + + /* Look for a BOTTOM auto-hide taskbar */ + abd.uEdge = ABE_BOTTOM; + hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd); + if (hwndAutoHide != NULL) + { + ErrorF ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n"); + prcWorkArea->bottom -= 1; + } + + /* Look for a RIGHT auto-hide taskbar */ + abd.uEdge = ABE_RIGHT; + hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd); + if (hwndAutoHide != NULL) + { + ErrorF ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n"); + prcWorkArea->right -= 1; + } + + ErrorF ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n", + prcWorkArea->top, prcWorkArea->left, + prcWorkArea->bottom, prcWorkArea->right); + +#if 0 + /* Obtain the task bar window dimensions */ + abd.hWnd = hwndAutoHide; + hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETTASKBARPOS, &abd); + ErrorF ("hwndAutoHide %08x abd.hWnd %08x %d %d %d %d\n", + hwndAutoHide, abd.hWnd, + abd.rc.top, abd.rc.left, abd.rc.bottom, abd.rc.right); +#endif + + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/wincutpaste.c diff -u /dev/null xc/programs/Xserver/hw/xwin/wincutpaste.c:1.2 --- /dev/null Fri Jan 18 15:26:44 2002 +++ xc/programs/Xserver/hw/xwin/wincutpaste.c Fri Sep 7 04:41:54 2001 @@ -0,0 +1,154 @@ +/* + *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/wincutpaste.c,v 1.2 2001/09/07 08:41:54 alanh Exp $ */ + +#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 "Xos.h" +#include "miscstruct.h" +#include "keysym.h" +#include <X11/Xlib.h> + +#undef MINSHORT +#undef MAXSHORT + +#define NONAMELESSUNION +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + + +#include <windows.h> +#include <windowsx.h> + +#undef CreateWindow +#undef FreeResource + +Display *g_display = NULL; +Window g_window = 0; + +Bool +winInitializeClipboard () +{ + g_display = XOpenDisplay (NULL); + if (g_display == NULL) + FatalError ("winInitializeClipboard () - XOpenDisplay () returned NULL\n"); + + g_window = XCreateSimpleWindow (g_display, + RootWindow (g_display, 0), + 1, 1, + 500, 500, + 0, + BlackPixel (g_display, 0), + BlackPixel (g_display, 0)); + if (g_window == 0) + FatalError ("winInitializeClipboard () - XCreateSimpleWindow () returned " + "0\n"); + + + + + /* Don't display our message window */ +#if 0 + XMapWindow (g_display, g_window); +#endif + + return TRUE; +} + + + + +#if 0 +#define NEED_EVENTS +#include <X.h> +#include <Xproto.h> +#include "selection.h" +#include "input.h" +#include <Xatom.h> + +extern WindowPtr *WindowTable; /* Why isn't this in a header file? */ +extern Selection *CurrentSelections; +extern int NumCurrentSelections; + + +static Bool inSetXCutText = FALSE; + +void +winSetXCutText (char *str, int len) +{ + int i = 0; + + inSetXCutText = TRUE; + ChangeWindowProperty (WindowTable[0], XA_CUT_BUFFER0, XA_STRING, + 8, PropModeReplace, len, + (pointer)str, TRUE); + + while ((i < NumCurrentSelections) && + CurrentSelections[i].selection != XA_PRIMARY) + i++; + + if (i < NumCurrentSelections) { + xEvent event; + + if (CurrentSelections[i].client) { + event.u.u.type = SelectionClear; + event.u.selectionClear.time = GetTimeInMillis(); + event.u.selectionClear.window = CurrentSelections[i].window; + event.u.selectionClear.atom = CurrentSelections[i].selection; + (void) TryClientEvents (CurrentSelections[i].client, + &event, + 1, + NoEventMask, + NoEventMask, + NullGrab); + } + + CurrentSelections[i].window = None; + CurrentSelections[i].pWin = NULL; + CurrentSelections[i].client = NullClient; + } + + inSetXCutText = FALSE; +} +#endif Index: xc/programs/Xserver/hw/xwin/winengine.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winengine.c:1.1 --- /dev/null Fri Jan 18 15:26:44 2002 +++ xc/programs/Xserver/hw/xwin/winengine.c Sun Nov 11 18:07:40 2001 @@ -0,0 +1,259 @@ +/* + *Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal 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/winengine.c,v 1.1 2001/11/11 23:07:40 alanh Exp $ */ + +#include "win.h" + + +/* + * 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; + +#if WIN_NATIVE_GDI_SUPPORT + pScreenInfo->dwEnginesSupported |= WIN_SERVER_NATIVE_GDI; +#endif + + /* 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 */ + 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; + HDC hdc; + DWORD dwDepth; + + /* Get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winSetEngine () - Couldn't get an HDC\n"); + return FALSE; + } + + /* + * pScreenInfo->dwDepth may be 0 to indicate that the current screen + * depth is to be used. Thus, we must query for the current display + * depth here. + */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Release the DC */ + ReleaseDC (NULL, hdc); + hdc = NULL; + + /* ShadowGDI is the only engine that supports windowed PseudoColor */ + if (dwDepth == 8 && !pScreenInfo->fFullScreen) + { + ErrorF ("winSetEngine () - Windowed && PseudoColor => ShadowGDI\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowGDI (pScreen); + return TRUE; + } + + /* 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; + case WIN_SERVER_NATIVE_GDI: + winSetEngineFunctionsNativeGDI (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; +} Index: xc/programs/Xserver/hw/xwin/winerror.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winerror.c:1.3 --- /dev/null Fri Jan 18 15:26:44 2002 +++ xc/programs/Xserver/hw/xwin/winerror.c Tue Oct 23 18:22:47 2001 @@ -0,0 +1,65 @@ +/* + *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/winerror.c,v 1.3 2001/10/23 22:22:47 alanh Exp $ */ + +#include "win.h" + +extern FILE *g_pfLog; + +#ifdef DDXOSVERRORF +void +OsVendorVErrorF (const char *pszFormat, va_list va_args) +{ + /* Check we opened the log file first */ + if (g_pfLog == NULL) return; + + /* Print the error message to a log file, could be stderr */ + vfprintf (g_pfLog, pszFormat, va_args); + + /* Flush after every write, to make updates show up quickly */ + fflush (g_pfLog); +} +#endif + + +/* + * os/util.c/FatalError () calls our vendor ErrorF, so the message + * from a FatalError will be logged. Thus, the message for the + * fatal error is not passed to this function. + * + * Attempt to do last-ditch, safe, important cleanup here. + */ +#ifdef DDXOSFATALERROR +void +OsVendorFatalError (void) +{ + +} +#endif Index: xc/programs/Xserver/hw/xwin/winfillsp.c diff -u xc/programs/Xserver/hw/xwin/winfillsp.c:1.1 xc/programs/Xserver/hw/xwin/winfillsp.c:1.9 --- xc/programs/Xserver/hw/xwin/winfillsp.c:1.1 Thu Apr 5 16:13:49 2001 +++ xc/programs/Xserver/hw/xwin/winfillsp.c Thu Nov 1 07:19:40 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winfillsp.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winfillsp.c,v 1.9 2001/11/01 12:19:40 alanh Exp $ */ #include "win.h" @@ -35,228 +35,503 @@ void winFillSpansNativeGDI (DrawablePtr pDrawable, GCPtr pGC, - int nSpans, + int iSpans, DDXPointPtr pPoints, - int *pWidths, + int *piWidths, 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; + winGCPriv(pGC); + int iSpan; + DDXPointPtr pPoint = NULL; + int *piWidth = 0; + HBITMAP hbmpOrig = NULL, hbmpOrigStipple = NULL; + PixmapPtr pPixmap = NULL; + winPrivPixmapPtr pPixmapPriv = NULL; + HBITMAP hbmpFilledStipple = NULL, hbmpMaskedForeground = NULL; + PixmapPtr pStipple = NULL; + winPrivPixmapPtr pStipplePriv = NULL; + PixmapPtr pTile = NULL; + winPrivPixmapPtr pTilePriv = NULL; + HBRUSH hbrushStipple = NULL; + HDC hdcStipple = NULL; + BYTE *pbbitsFilledStipple = NULL; + int iX; DEBUG_FN_NAME("winFillSpans"); DEBUGVARS; - //DEBUGPROC_MSG; - - fprintf (stderr, "winFillSpans () - pDrawable: %08x\n", - pDrawable); + DEBUGPROC_MSG; - /* Branch on the fill type */ - switch (pGC->fillStyle) + /* Branch on the type of drawable we have */ + switch (pDrawable->type) { - 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) + case DRAWABLE_PIXMAP: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP\n"); +#if 0 + /* Branch on the raster operation type */ + switch (pGC->alu) { - /* 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); + case GXclear: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXclear\n"); + break; + case GXand: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXand\n"); + break; + case GXandReverse: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXandReverse\n"); + break; + case GXcopy: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXcopy\n"); + break; + case GXandInverted: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXandInverted\n"); + break; + case GXnoop: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXnoop\n"); + break; + case GXxor: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXxor\n"); + break; + case GXor: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXor\n"); + break; + case GXnor: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXnor\n"); + break; + case GXequiv: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXequiv\n"); + break; + case GXinvert: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXinvert\n"); + break; + case GXorReverse: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXorReverse\n"); + break; + case GXcopyInverted: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXcopyInverted\n"); + break; + case GXorInverted: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXorInverted\n"); + break; + case GXnand: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXnand\n"); + break; + case GXset: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - GXset\n"); + break; + default: + FatalError ("winFillSpans - DRAWABLE_PIXMAP - Unknown ROP\n"); + break; } +#endif - 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); + /* Get a pixmap pointer from the drawable pointer, and fetch privates */ + pPixmap = (PixmapPtr) pDrawable; + pPixmapPriv = winGetPixmapPriv (pPixmap); + + /* Select the drawable pixmap into memory hdc */ + hbmpOrig = SelectObject (pGCPriv->hdcMem, pPixmapPriv->hBitmap); + if (hbmpOrig == NULL) + FatalError ("winFillSpans - DRAWABLE_PIXMAP - " + "SelectObject () failed on pPixmapPriv->hBitmap\n"); - /* 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) + /* Branch on the fill type */ + switch (pGC->fillStyle) { - 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)); + case FillSolid: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - FillSolid %08x\n", + pDrawable); + + /* + * REMOVE - Visual verification only. + */ + BitBlt (pGCPriv->hdc, + pDrawable->width, pDrawable->height, + pDrawable->width, pDrawable->height, + pGCPriv->hdcMem, + 0, 0, + SRCCOPY); + DEBUG_MSG ("FillSolid - Original bitmap"); - /* 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); + /* Enumerate spans */ + for (iSpan = 0; iSpan < iSpans; ++iSpan) + { + /* Get pointers to the current span location and width */ + pPoint = pPoints + iSpan; + piWidth = piWidths + iSpan; + + /* Display some useful information */ + ErrorF ("(%dx%dx%d) (%d,%d) fg: %d bg: %d w: %d\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, + pGC->fgPixel, pGC->bgPixel, + *piWidth); + + /* Draw the requested line */ + MoveToEx (pGCPriv->hdcMem, pPoint->x, pPoint->y, NULL); + LineTo (pGCPriv->hdcMem, pPoint->x + *piWidth, pPoint->y); + } - /* 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"); + /* + * REMOVE - Visual verification only. + */ + BitBlt (pGCPriv->hdc, + pDrawable->width * 2, pDrawable->height, + pDrawable->width, pDrawable->height, + pGCPriv->hdcMem, + 0, 0, + SRCCOPY); + DEBUG_MSG ("FillSolid - Filled bitmap"); - /* Release the stipple DC */ - DeleteDC (hdcStipple); + + /* Push the drawable pixmap out of the GC HDC */ + SelectObject (pGCPriv->hdcMem, hbmpOrig); + break; + + case FillStippled: + ErrorF ("winFillSpans - DRAWABLE_PIXMAP - FillStippled %08x\n", + pDrawable); + + /* + * FIXME: Assuming that pGC->patOrg.x = pGC->patOrg.y = 0 + */ + + pStipple = pGC->stipple; + pStipplePriv = winGetPixmapPriv (pStipple); + + /* Create a memory DC to hold the stipple */ + hdcStipple = CreateCompatibleDC (pGCPriv->hdc); + + /* Create a destination sized compatible bitmap */ + hbmpFilledStipple = winCreateDIBNativeGDI (pDrawable->width, + pDrawable->height, + pDrawable->depth, + &pbbitsFilledStipple, + NULL); + + /* Select the stipple bitmap into the stipple DC */ + hbmpOrigStipple = SelectObject (hdcStipple, hbmpFilledStipple); + if (hbmpOrigStipple == NULL) + FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - " + "SelectObject () failed on hbmpFilledStipple\n"); + + /* Create a pattern brush from the original stipple */ + hbrushStipple = CreatePatternBrush (pStipplePriv->hBitmap); + + /* 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); + + /* + * REMOVE - Visual verification only. + */ + BitBlt (pGCPriv->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, + pGCPriv->hdcMem, + 0, 0, + SRCERASE); + + /* + * REMOVE - Visual verification only. + */ + BitBlt (pGCPriv->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 = winCreateDIBNativeGDI (pDrawable->width, + pDrawable->height, + pDrawable->depth, + NULL, + NULL); + + /* + * Select the masked foreground bitmap into the default memory DC; + * this should pop the drawable bitmap out of the default DC. + */ + if (SelectObject (pGCPriv->hdcMem, hbmpMaskedForeground) == NULL) + FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - " + "SelectObject () failed on hbmpMaskedForeground\n"); + + /* Free the original drawable */ + DeleteObject (pPixmapPriv->hBitmap); + pPixmapPriv->hBitmap = NULL; + pPixmapPriv->pbBits = NULL; + + /* Select the stipple brush into the default memory DC */ + SelectObject (pGCPriv->hdcMem, hbrushStipple); + + /* Create the masked foreground bitmap using the original stipple */ + PatBlt (pGCPriv->hdcMem, + 0, 0, + pDrawable->width, pDrawable->height, + PATCOPY); + + /* + * REMOVE - Visual verification only. + */ + BitBlt (pGCPriv->hdc, + pDrawable->width * 3, 0, + pDrawable->width, pDrawable->height, + pGCPriv->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, + pGCPriv->hdcMem, + 0, 0, + SRCPAINT); + + /* + * REMOVE - Visual verification only. + */ + BitBlt (pGCPriv->hdc, + pDrawable->width * 4, 0, + pDrawable->width, pDrawable->height, + hdcStipple, + 0, 0, + SRCCOPY); + DEBUG_MSG("Completed stipple"); + + /* Release the stipple DC */ + SelectObject (hdcStipple, hbmpOrig); + DeleteDC (hdcStipple); - /* Pop the stipple pattern brush out of the default mem DC */ - SelectObject (g_hdcMem, GetStockObject (WHITE_BRUSH)); + /* Pop the stipple pattern brush out of the default mem DC */ + SelectObject (pGCPriv->hdcMem, GetStockObject (WHITE_BRUSH)); - /* Destroy the original stipple pattern brush */ - DeleteObject (hbrushStipple); + /* Destroy the original stipple pattern brush */ + DeleteObject (hbrushStipple); - /* Select the result into the default memory DC */ - SelectObject (g_hdcMem, hbmpFilledStipple); + /* Clear the memory DC */ + SelectObject (pGCPriv->hdcMem, hbmpOrig); - /* 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"); + /* Free the masked foreground bitmap */ + DeleteObject (hbmpMaskedForeground); + + /* Point the drawable to the new bitmap */ + pPixmapPriv->hBitmap = hbmpFilledStipple; + pPixmapPriv->pbBits = pbbitsFilledStipple; + break; + + case FillTiled: + FatalError ("\nwinFillSpans - DRAWABLE_PIXMAP - FillTiled\n\n"); + break; + + case FillOpaqueStippled: + FatalError ("winFillSpans - DRAWABLE_PIXMAP - OpaqueStippled\n"); + break; + + default: + FatalError ("winFillSpans - DRAWABLE_PIXMAP - Unknown " + "fillStyle\n"); + break; + } 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); + + case DRAWABLE_WINDOW: + /* Branch on fill style */ + switch (pGC->fillStyle) + { + case FillSolid: + ErrorF ("\nwinFillSpans - DRAWABLE_WINDOW - FillSolid\n\n"); + + /* Enumerate spans */ + for (iSpan = 0; iSpan < iSpans; ++iSpan) + { + /* Get pointers to the current span location and width */ + pPoint = pPoints + iSpan; + piWidth = piWidths + iSpan; + + /* Display some useful information */ + ErrorF ("(%dx%dx%d) (%d,%d) fg: %d bg: %d w: %d\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, + pGC->fgPixel, pGC->bgPixel, + *piWidth); + + /* Draw the requested line */ + MoveToEx (pGCPriv->hdc, pPoint->x, pPoint->y, NULL); + LineTo (pGCPriv->hdc, pPoint->x + *piWidth, pPoint->y); + } + break; - PatBlt (g_hdc, 0, 0, pDrawable->width, pDrawable->height, PATCOPY); + case FillStippled: + FatalError ("winFillSpans - DRAWABLE_WINDOW - FillStippled\n\n"); + break; + + case FillTiled: + ErrorF ("\nwinFillSpans - DRAWABLE_WINDOW - FillTiled\n\n"); + + /* Get a pixmap pointer from the tile pointer, and fetch privates */ + pTile = (PixmapPtr) pGC->tile.pixmap; + pTilePriv = winGetPixmapPriv (pTile); + + /* Select the tile into a DC */ + hbmpOrig = SelectObject (pGCPriv->hdcMem, pTilePriv->hBitmap); + if (hbmpOrig == NULL) + FatalError ("winFillSpans - DRAWABLE_WINDOW - FillTiled - " + "SelectObject () failed on pTilePric->hBitmap\n"); - hBrush = SelectObject (g_hdc, hBrush); + /* Enumerate spans */ + for (iSpan = 0; iSpan < iSpans; ++iSpan) + { + /* Get pointers to the current span location and width */ + pPoint = pPoints + iSpan; + piWidth = piWidths + iSpan; + + for (iX = 0; iX < *piWidth; iX += pTile->drawable.width) + { + /* Blit the tile to the screen, one line at a time */ + BitBlt (pGCPriv->hdc, + pPoint->x + iX, pPoint->y, + pTile->drawable.width, 1, + pGCPriv->hdcMem, + 0, pPoint->y % pTile->drawable.height, + SRCCOPY); + } + } - DeleteObject (hBrush); + /* Push the drawable pixmap out of the GC HDC */ + SelectObject (pGCPriv->hdcMem, hbmpOrig); + +#if 0 + DEBUG_MSG("Completed tile fill"); #endif + break; + + case FillOpaqueStippled: + FatalError ("winFillSpans - DRAWABLE_WINDOW - " + "OpaqueStippled\n"); + break; + + default: + FatalError ("winFillSpans - DRAWABLE_WINDOW - Unknown " + "fillStyle\n"); + } - /* Enumerate spans */ - for (iIdx = 0; iIdx < nSpans; ++iIdx) + /* Branch on the raster operation type */ + switch (pGC->alu) { - /* 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); - } + case GXclear: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXclear\n"); + break; + case GXand: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXand\n"); + break; + case GXandReverse: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXandReverse\n"); + break; + case GXcopy: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXcopy\n"); + break; + case GXandInverted: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXandInverted\n"); + break; + case GXnoop: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXnoop\n"); + break; + case GXxor: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXxor\n"); + break; + case GXor: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXor\n"); + break; + case GXnor: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXnor\n"); + break; + case GXequiv: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXequiv\n"); + break; + case GXinvert: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXinvert\n"); + break; + case GXorReverse: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXorReverse\n"); + break; + case GXcopyInverted: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXcopyInverted\n"); + break; + case GXorInverted: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXorInverted\n"); + break; + case GXnand: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXnand\n"); + break; + case GXset: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - GXset\n"); + break; + default: + ErrorF ("winFillSpans - DRAWABLE_WINDOW - Unknown ROP\n"); + break; } break; + + case UNDRAWABLE_WINDOW: + FatalError ("winFillSpans - UNDRAWABLE_WINDOW\n\n"); + + switch (pGC->fillStyle) + { + case FillSolid: + ErrorF ("\nwinFillSpans - UNDRAWABLE_WINDOW - FillSolid\n\n"); + break; + + case FillStippled: + ErrorF ("\nwinFillSpans - UNDRAWABLE_WINDOW - FillStippled\n\n"); + break; + + case FillTiled: + ErrorF ("\nwinFillSpans - UNDRAWABLE_WINDOW - FillTiled\n\n"); + break; + + case FillOpaqueStippled: + FatalError ("winFillSpans () - UNDRAWABLE_WINDOW - " + "OpaqueStippled\n"); + break; + + default: + FatalError ("winFillSpans () - UNDRAWABLE_WINDOW - Unknown " + "fillStyle\n"); + } + break; + + case DRAWABLE_BUFFER: + FatalError ("winFillSpansNativeGDI - DRAWABLE_BUFFER\n"); + break; + default: - fprintf (stderr, "winFillSpans () - Unknown fillStyle\n"); - exit (1); + FatalError ("winFillSpansNativeGDI - Unknown drawable type\n"); break; } -#endif } Index: xc/programs/Xserver/hw/xwin/winfont.c diff -u xc/programs/Xserver/hw/xwin/winfont.c:1.1 xc/programs/Xserver/hw/xwin/winfont.c:1.2 --- xc/programs/Xserver/hw/xwin/winfont.c:1.1 Thu Apr 5 16:13:49 2001 +++ xc/programs/Xserver/hw/xwin/winfont.c Mon Jun 4 09:04:41 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winfont.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winfont.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */ #include "win.h" @@ -36,7 +36,7 @@ Bool winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont) { - fprintf (stderr, "winRealizeFont()\n"); + ErrorF ("winRealizeFont()\n"); return TRUE; } @@ -45,6 +45,6 @@ Bool winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont) { - fprintf (stderr, "winUnrealizeFont()\n"); + ErrorF ("winUnrealizeFont()\n"); return TRUE; } Index: xc/programs/Xserver/hw/xwin/wingc.c diff -u xc/programs/Xserver/hw/xwin/wingc.c:1.2 xc/programs/Xserver/hw/xwin/wingc.c:1.10 --- xc/programs/Xserver/hw/xwin/wingc.c:1.2 Thu Apr 19 08:56:03 2001 +++ xc/programs/Xserver/hw/xwin/wingc.c Tue Oct 30 10:39:09 2001 @@ -27,10 +27,11 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.2 2001/04/19 12:56:03 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.10 2001/10/30 15:39:09 alanh Exp $ */ #include "win.h" +#if 0 /* GC Handling Routines */ const GCFuncs winGCFuncs = { winValidateGCNativeGDI, @@ -41,6 +42,17 @@ winDestroyClipNativeGDI, winCopyClipNativeGDI, }; +#else +const GCFuncs winGCFuncs = { + winValidateGCNativeGDI, + winChangeGCNativeGDI, + winCopyGCNativeGDI, + winDestroyGCNativeGDI, + miChangeClip, + miDestroyClip, + miCopyClip, +}; +#endif /* Drawing Primitives */ const GCOps winGCOps = { @@ -69,220 +81,290 @@ #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); + winPrivGCPtr pGCPriv = NULL; + winPrivScreenPtr pScreenPriv = NULL; + ErrorF ("winCreateGCNativeGDI () depth: %d\n", + pGC->depth); + pGC->clientClip = NULL; pGC->clientClipType = CT_NONE; pGC->ops = (GCOps *) &winGCOps; pGC->funcs = (GCFuncs *) &winGCFuncs; + + /* + * Setting miTranslate to 1 causes the coordinates passed to + * FillSpans, GetSpans, and SetSpans to be screen relative, rather + * than drawable relative. + * + * miTranslate was set to 0 prior to 2001-08-17. + */ + pGC->miTranslate = 1; + + /* Allocate privates for this GC */ + pGCPriv = winGetGCPriv (pGC); + if (pGCPriv == NULL) + { + ErrorF ("winCreateGCNativeGDI () - Privates pointer was NULL\n"); + return FALSE; + } + + /* Copy the screen DC to the local privates */ + pScreenPriv = winGetScreenPriv (pGC->pScreen); + pGCPriv->hdc = pScreenPriv->hdcScreen; - pGC->miTranslate = 0; + /* Allocate a memory DC for the GC */ + pGCPriv->hdcMem = CreateCompatibleDC (pGCPriv->hdc); - /* - 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) { - +#if CYGDEBUG + ErrorF ("winChangeGCNativeGDI () - Doing nothing\n"); +#endif } -/* 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, + unsigned long ulChanges, DrawablePtr pDrawable) { -#if 0 - PixmapPtr pPixmap; - int nIndex, iResult; - unsigned long dwMask = dwChanges; - HPEN hPen; - HBRUSH hBrush; - HBITMAP hBitmap; + winGCPriv(pGC); + HBITMAP hbmpOrig = NULL; + PixmapPtr pPixmap = NULL; + winPrivPixmapPtr pPixmapPriv = NULL; + RGBQUAD rgbColors[2] = {{0, 0, 0, 0}, {0, 0, 0, 0}}; + PixmapPtr pStipple = NULL; + winPrivPixmapPtr pStipplePriv = NULL; + int i; DEBUG_FN_NAME("winValidateGC"); DEBUGVARS; - //DEBUGPROC_MSG; - - fprintf (stderr, "winValidateGC - pDrawable: %08x, pGC: %08x\n", - pDrawable, pGC); + DEBUGPROC_MSG; + /* Branch on drawable type */ 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 */ + /* Branch on the fill style */ switch (pGC->fillStyle) { case FillSolid: + ErrorF ("winValidateGC - DRAWABLE_PIXMAP - FillSolid\n"); + /* Select a stock pen */ if (pDrawable->depth == 1 && pGC->fgPixel) { - SelectObject (g_hdcMem, GetStockObject (WHITE_PEN)); + ErrorF ("winValidateGC - Selecting WHITE_PEN\n"); + SelectObject (pGCPriv->hdcMem, GetStockObject (WHITE_PEN)); } else if (pDrawable->depth == 1 && !pGC->fgPixel) { - SelectObject (g_hdcMem, GetStockObject (BLACK_PEN)); + ErrorF ("winValidateGC - Selecting BLACK_PEN\n"); + SelectObject (pGCPriv->hdcMem, GetStockObject (BLACK_PEN)); } else if (pGC->fgPixel) { - SelectObject (g_hdcMem, CreatePen (PS_SOLID, 0, pGC->fgPixel)); + ErrorF ("winValidateGC - Selecting custom pen: %d\n", + pGC->fgPixel); + /* + * FIXME: So far I've only seen a white pen selected here. + */ +#if 1 + SelectObject (pGCPriv->hdcMem, GetStockObject (WHITE_PEN)); +#else + /* FIXME: This leaks a pen */ + SelectObject (pGCPriv->hdcMem, + CreatePen (PS_SOLID, 0, pGC->fgPixel)); +#endif } else { - SelectObject (g_hdcMem, GetStockObject (BLACK_PEN)); + ErrorF ("winValidateGC - Selecting BLACK_PEN\n"); + SelectObject (pGCPriv->hdcMem, GetStockObject (BLACK_PEN)); } break; + case FillStippled: + ErrorF ("winValidateGC - DRAWABLE_PIXMAP - FillStippled\n"); + /* + * NOTE: Setting the brush color has no effect on DIB fills. + * You need to set the stipple bitmap's color table instead. + */ +#if 1 + /* Pick the white color index */ + if (pGC->fgPixel) + i = 1; + else + i = 0; + + /* Set the white color, black is default */ + rgbColors[i].rgbRed = 255; + rgbColors[i].rgbGreen = 255; + rgbColors[i].rgbBlue = 255; + + /* Get stipple and privates pointers */ + pStipple = pGC->stipple; + pStipplePriv = winGetPixmapPriv (pStipple); + + /* Select the stipple bitmap */ + hbmpOrig = SelectObject (pGCPriv->hdcMem, pStipplePriv->hBitmap); + + /* Set the stipple color table */ + SetDIBColorTable (pGCPriv->hdcMem, 0, 2, rgbColors); + + /* Pop the stipple out of the hdc */ + SelectObject (pGCPriv->hdcMem, hbmpOrig); + +#else + /* Set the foreground color for the stipple fill */ + if (pGC->fgPixel == 0x1) + { + SetTextColor (pGCPriv->hdcMem, RGB(0x00, 0x00, 0x00)); + } + else if (pGC->fgPixel == 0xFFFF) + { + SetTextColor (pGCPriv->hdcMem, RGB(0xFF, 0xFF, 0xFF)); + } + else + { + SetTextColor (pGCPriv->hdcMem, RGB(0x00, 0x00, 0x00)); + } + SetBkColor (pGCPriv->hdcMem, RGB(0x00, 0x00, 0x00)); +#endif + break; + + case FillOpaqueStippled: + FatalError ("winValidateGC - DRAWABLE_PIXMAP - " + "FillOpaqueStippled\n"); + break; + + case FillTiled: + FatalError ("winValidateGC - DRAWABLE_PIXMAP - FillTiled\n"); break; + default: + FatalError ("winValidateGC - DRAWABLE_PIXMAP - Unknown fill " + "style\n"); break; } - break; + case DRAWABLE_WINDOW: + /* Branch on the fill style */ switch (pGC->fillStyle) { case FillTiled: - /* Need to select the tile into the memory DC */ - SelectObject (g_hdcMem, pGC->tile.pixmap->devPrivate.ptr); + ErrorF ("winValidateGC - DRAWABLE_WINDOW - FillTiled\n"); + /* + * Do nothing here for now. Select the tile bitmap into the + * appropriate DC in the drawing function. + */ + + /* + * BEGIN REMOVE - Visual verification only. + */ + /* Get pixmap and privates pointers for the tile */ + pPixmap = pGC->tile.pixmap; + pPixmapPriv = winGetPixmapPriv (pPixmap); + + /* Push the tile into the GC's DC */ + hbmpOrig = SelectObject (pGCPriv->hdcMem, pPixmapPriv->hBitmap); + if (hbmpOrig == NULL) + FatalError ("winValidateGC - DRAWABLE_WINDOW - FillTiled - " + "SelectObject () failed on pPixmapPriv->hBitmap\n"); /* Blit the tile to a remote area of the screen */ - BitBlt (g_hdc, 64, 64, + BitBlt (pGCPriv->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"); + pGCPriv->hdcMem, + 0, 0, + SRCCOPY); + DEBUG_MSG ("Blitted the tile to a remote area of the screen"); + + /* Pop the tile out of the GC's DC */ + SelectObject (pGCPriv->hdcMem, hbmpOrig); + /* + * END REMOVE - Visual verification only. + */ break; + case FillStippled: + FatalError ("winValidateGC - DRAWABLE_WINDOW - FillStippled\n"); + break; + + case FillOpaqueStippled: + FatalError ("winValidateGC - DRAWABLE_WINDOW - " + "FillOpaqueStippled\n"); + break; + case FillSolid: + ErrorF ("winValidateGC - DRAWABLE_WINDOW - FillSolid\n"); + + /* Select a stock pen */ + if (pDrawable->depth == 1 && pGC->fgPixel) + { + ErrorF ("winValidateGC - Selecting WHITE_PEN\n"); + SelectObject (pGCPriv->hdc, GetStockObject (WHITE_PEN)); + } + else if (pDrawable->depth == 1 && !pGC->fgPixel) + { + ErrorF ("winValidateGC - Selecting BLACK_PEN\n"); + SelectObject (pGCPriv->hdc, GetStockObject (BLACK_PEN)); + } + else if (pGC->fgPixel) + { + ErrorF ("winValidateGC - Selecting custom pen: %d\n", + pGC->fgPixel); + /* + * FIXME: So far I've only seen a white pen selected here. + */ + SelectObject (pGCPriv->hdc, GetStockObject (WHITE_PEN)); + } + else + { + ErrorF ("winValidateGC - Selecting BLACK_PEN\n"); + SelectObject (pGCPriv->hdc, GetStockObject (BLACK_PEN)); + } + break; + default: + FatalError ("winValidateGC - DRAWABLE_WINDOW - Unknown fill " + "style\n"); break; } break; + case UNDRAWABLE_WINDOW: + ErrorF ("\nwinValidateGC - UNDRAWABLE_WINDOW\n\n"); break; + case DRAWABLE_BUFFER: + FatalError ("winValidateGC - DRAWABLE_BUFFER\n"); break; + default: + FatalError ("winValidateGC - Unknown drawable type\n"); 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) @@ -290,13 +372,28 @@ } + /* See Porting Layer Definition - p. 46 */ void winDestroyGCNativeGDI (GCPtr pGC) { + winGCPriv(pGC); + /* Free the memory DC */ + if (pGCPriv->hdcMem != NULL) + { + DeleteDC (pGCPriv->hdcMem); + pGCPriv->hdcMem = NULL; + } + + /* Invalidate the screen DC pointer */ + pGCPriv->hdc = NULL; + + /* Invalidate the GC privates pointer */ + winSetGCPriv (pGC, NULL); } + /* See Porting Layer Definition - p. 46 */ void winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects) @@ -304,12 +401,14 @@ } + /* See Porting Layer Definition - p. 47 */ void winDestroyClipNativeGDI (GCPtr pGC) { } + /* See Porting Layer Definition - p. 47 */ void Index: xc/programs/Xserver/hw/xwin/wingetsp.c diff -u xc/programs/Xserver/hw/xwin/wingetsp.c:1.1 xc/programs/Xserver/hw/xwin/wingetsp.c:1.7 --- xc/programs/Xserver/hw/xwin/wingetsp.c:1.1 Thu Apr 5 16:13:49 2001 +++ xc/programs/Xserver/hw/xwin/wingetsp.c Thu Nov 1 07:19:40 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/wingetsp.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wingetsp.c,v 1.7 2001/11/01 12:19:40 alanh Exp $ */ #include "win.h" @@ -36,65 +36,129 @@ winGetSpansNativeGDI (DrawablePtr pDrawable, int nMax, DDXPointPtr pPoints, - int *pWidths, - int nSpans, + int *piWidths, + int iSpans, char *pDsts) { -#if 0 - int iIdx; + PixmapPtr pPixmap = NULL; + winPrivPixmapPtr pPixmapPriv = NULL; + int iSpan; DDXPointPtr pPoint = NULL; - int *pWidth = NULL; + int *piWidth = 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); + int iBytesToCopy; + HBITMAP hbmpWindow, hbmpOrig; + BYTE *pbWindow = NULL; + HDC hdcMem; + ScreenPtr pScreen = pDrawable->pScreen; + winScreenPriv(pScreen); + int iByteWidth; - /* Calculate offset of next bit destination */ - pDst += 4 * ((*pWidth + 31) / 32); + /* Branch on the drawable type */ + switch (pDrawable->type) + { + case DRAWABLE_PIXMAP: + ErrorF ("winGetSpans - DRAWABLE_PIXMAP %08x\n", + pDrawable); + + pPixmap = (PixmapPtr) pDrawable; + pPixmapPriv = winGetPixmapPriv (pPixmap); + + /* Loop through spans */ + for (iSpan = 0; iSpan < iSpans; ++iSpan) + { + pPoint = pPoints + iSpan; + piWidth = piWidths + iSpan; + + iBytesToCopy = PixmapBytePad (*piWidth, pDrawable->depth); + + memcpy (pDst, + pPixmapPriv->pbBits + + pPixmapPriv->dwScanlineBytes * pPoint->y, + iBytesToCopy); + + ErrorF ("(%dx%dx%d) (%d,%d) w: %d\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *piWidth); + + /* Calculate offset of next bit destination */ + pDst += 4 * ((*piWidth + 31) / 32); + } + break; + + case DRAWABLE_WINDOW: + ErrorF ("winGetSpans - DRAWABLE_WINDOW\n"); + + /* + * FIXME: Making huge assumption here that we are copying the + * area behind where the cursor will be displayed. We already + * know the size of the cursor, so this works, for now. + */ + + /* Create a bitmap to blit the window data to */ + hbmpWindow = winCreateDIBNativeGDI (*piWidths, + *piWidths, + pDrawable->depth, + &pbWindow, + NULL); + + /* Open a memory HDC */ + hdcMem = CreateCompatibleDC (NULL); + + /* Select the window bitmap */ + hbmpOrig = SelectObject (hdcMem, hbmpWindow); + + /* Transfer the window bits to the window bitmap */ + BitBlt (hdcMem, + 0, 0, + *piWidths, *piWidths, /* FIXME: Assuming square region */ + pScreenPriv->hdcScreen, + pPoints->x, pPoints->y, + SRCCOPY); + + /* Pop the window bitmap out of the HDC */ + SelectObject (hdcMem, hbmpOrig); + + /* Delete the memory HDC */ + DeleteDC (hdcMem); + hdcMem = NULL; + + iByteWidth = PixmapBytePad (*piWidths, pDrawable->depth); + + /* Loop through spans */ + for (iSpan = 0; iSpan < iSpans; ++iSpan) + { + pPoint = pPoints + iSpan; + piWidth = piWidths + iSpan; + + iBytesToCopy = PixmapBytePad (*piWidth, pDrawable->depth); + + memcpy (pDst, + pbWindow + iByteWidth * (pPoint->y - pPoints->y), + iBytesToCopy); + + ErrorF ("(%dx%dx%d) (%d,%d) w: %d\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *piWidth); + + /* Calculate offset of next bit destination */ + pDst += 4 * ((*piWidth + 31) / 32); + } + + /* Delete the window bitmap */ + DeleteObject (hbmpWindow); + break; + + case UNDRAWABLE_WINDOW: + FatalError ("winGetSpans - UNDRAWABLE_WINDOW\n"); + break; + + case DRAWABLE_BUFFER: + FatalError ("winGetSpans - DRAWABLE_BUFFER\n"); + break; + + default: + FatalError ("winGetSpans - Unknown drawable type\n"); + break; } -#endif } Index: xc/programs/Xserver/hw/xwin/winkeybd.c diff -u xc/programs/Xserver/hw/xwin/winkeybd.c:1.2 xc/programs/Xserver/hw/xwin/winkeybd.c:1.8 --- xc/programs/Xserver/hw/xwin/winkeybd.c:1.2 Tue May 1 20:45:26 2001 +++ xc/programs/Xserver/hw/xwin/winkeybd.c Mon Nov 12 03:47:53 2001 @@ -30,16 +30,12 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winkeybd.c,v 1.8 2001/11/12 08:47:53 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" +#include "winkeybd.h" /* * Translate a Windows WM_[SYS]KEY(UP/DOWN) message @@ -49,122 +45,28 @@ * 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; + int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1]; + int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2]; - 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; - } - } + /* Branch on special extended, special non-extended, or normal key */ + if ((HIWORD (lParam) & KF_EXTENDED) && iKeyFixupEx) + *piScanCode = iKeyFixupEx; + else if (iKeyFixup) + *piScanCode = iKeyFixup; + else + *piScanCode = LOBYTE (HIWORD (lParam)); } + /* * We call this function from winKeybdProc when we are * initializing the keyboard. */ + void winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap) { @@ -173,9 +75,7 @@ /* 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 */ - } + pModMap[i] = NoSymbol; /* make sure it is restored */ /* Loop through all valid entries in the key symbol table */ for (i = MIN_KEYCODE; @@ -224,12 +124,13 @@ } } - pKeySyms->map = (KeySym*)map; + 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, @@ -243,6 +144,7 @@ Beep (0, 0); } + /* Change some keyboard configuration parameters */ void winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) @@ -250,10 +152,12 @@ } + /* * See Porting Layer Definition - p. 18 * winKeybdProc is known as a DeviceProc. */ + int winKeybdProc (DeviceIntPtr pDeviceInt, int iState) { @@ -284,86 +188,52 @@ 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); + winSendKeyEvent (KEY_NumLock, TRUE); + winSendKeyEvent (KEY_NumLock, FALSE); } /* 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); + winSendKeyEvent (KEY_CapsLock, TRUE); + winSendKeyEvent (KEY_CapsLock, FALSE); } /* 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); + winSendKeyEvent (KEY_ScrollLock, TRUE); + winSendKeyEvent (KEY_ScrollLock, FALSE); } /* 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); + winSendKeyEvent (KEY_HKTG, TRUE); + winSendKeyEvent (KEY_HKTG, FALSE); } } + /* * We have to store the last state of each mode * key before we lose the keyboard focus. */ + void winStoreModeKeyStates (ScreenPtr pScreen) { @@ -385,91 +255,64 @@ (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)); + DWORD dwKeyState; + + /* + * NOTE: The C XOR operator, ^, will not work here because it is + * a bitwise operator, not a logical operator. C does not + * have a logical XOR operator, so we use a macro instead. + */ /* Has the key state changed? */ - if ((pScreenPriv->dwModeKeyStates & NumLockMask) - ^ (GetKeyState (VK_NUMLOCK) & 0x0001)) + dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001; + if (WIN_XOR (pScreenPriv->dwModeKeyStates & NumLockMask, dwKeyState)) { - 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); + winSendKeyEvent (KEY_NumLock, TRUE); + winSendKeyEvent (KEY_NumLock, FALSE); } - + /* Has the key state changed? */ - if ((pScreenPriv->dwModeKeyStates & LockMask) - ^ (GetKeyState (VK_CAPITAL) & 0x0001)) + dwKeyState = GetKeyState (VK_CAPITAL) & 0x0001; + if (WIN_XOR (pScreenPriv->dwModeKeyStates & LockMask, dwKeyState)) { - 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); + winSendKeyEvent (KEY_CapsLock, TRUE); + winSendKeyEvent (KEY_CapsLock, FALSE); } /* Has the key state changed? */ - if ((pScreenPriv->dwModeKeyStates & ScrollLockMask) - ^ (GetKeyState (VK_SCROLL) & 0x0001)) + dwKeyState = GetKeyState (VK_SCROLL) & 0x0001; + if (WIN_XOR (pScreenPriv->dwModeKeyStates & ScrollLockMask, dwKeyState)) { - 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); + winSendKeyEvent (KEY_ScrollLock, TRUE); + winSendKeyEvent (KEY_ScrollLock, FALSE); } /* Has the key state changed? */ - if ((pScreenPriv->dwModeKeyStates & KanaMask) - ^ (GetKeyState (VK_KANA) & 0x0001)) + dwKeyState = GetKeyState (VK_KANA) & 0x0001; + if (WIN_XOR (pScreenPriv->dwModeKeyStates & KanaMask, dwKeyState)) { - 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); + winSendKeyEvent (KEY_HKTG, TRUE); + winSendKeyEvent (KEY_HKTG, FALSE); } } + /* * 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) { @@ -511,7 +354,7 @@ /* * Fake Ctrl_L releases will be followed by an Alt_R release - * with the same timestamp as the Ctrl_L press. + * with the same timestamp as the Ctrl_L release. */ if ((message == WM_KEYUP || message == WM_SYSKEYUP) && wParam == VK_CONTROL @@ -549,3 +392,42 @@ } +/* + * Lift any modifier keys that are pressed + */ + +void +winKeybdReleaseModifierKeys () +{ + /* Verify that the mi input system has been initialized */ + if (g_fdMessageQueue == WIN_FD_INVALID) + return; + + winSendKeyEvent (KEY_Alt, FALSE); + winSendKeyEvent (KEY_AltLang, FALSE); + winSendKeyEvent (KEY_LCtrl, FALSE); + winSendKeyEvent (KEY_RCtrl, FALSE); + winSendKeyEvent (KEY_ShiftL, FALSE); + winSendKeyEvent (KEY_ShiftR, FALSE); +} + + +/* + * Take a raw X key code and send an up or down event for it. + * + * Thanks to VNC for inspiration, though it is a simple function. + */ + +void +winSendKeyEvent (DWORD dwKey, Bool fDown) +{ + xEvent xCurrentEvent; + + ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); + + xCurrentEvent.u.u.type = fDown ? KeyPress : KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = + g_c32LastInputEventTime = GetTickCount (); + xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE; + mieqEnqueue (&xCurrentEvent); +} Index: xc/programs/Xserver/hw/xwin/winkeybd.h diff -u /dev/null xc/programs/Xserver/hw/xwin/winkeybd.h:1.1 --- /dev/null Fri Jan 18 15:26:44 2002 +++ xc/programs/Xserver/hw/xwin/winkeybd.h Wed Sep 26 09:00:34 2001 @@ -0,0 +1,306 @@ +/* + *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/winkeybd.h,v 1.1 2001/09/26 13:00:34 alanh Exp $ */ + +/* + * We need symbols for the scan codes of keys. + */ +#include "../xfree86/common/atKeynames.h" + + +/* + * Include the standard XFree86 ASCII keymap. + * + * This header declares a static KeySym array called 'map'. + */ +#include "../xfree86/common/xf86Keymap.h" + +#define WIN_KEYMAP_COLS 3 + +const int +g_iKeyMap [] = { + /* count Windows VK, ASCII, ASCII when extended VK */ + /* 0 */ 0, 0, 0, + /* 1 */ 0, 0, 0, + /* 2 */ 0, 0, 0, + /* 3 */ VK_CANCEL, 0, KEY_Break, + /* 4 */ 0, 0, 0, + /* 5 */ 0, 0, 0, + /* 6 */ 0, 0, 0, + /* 7 */ 0, 0, 0, + /* 8 */ 0, 0, 0, + /* 9 */ 0, 0, 0, + /* 10 */ 0, 0, 0, + /* 11 */ 0, 0, 0, + /* 12 */ 0, 0, 0, + /* 13 */ VK_RETURN, 0, KEY_KP_Enter, + /* 14 */ 0, 0, 0, + /* 15 */ 0, 0, 0, + /* 16 */ VK_SHIFT, 0, KEY_ShiftR, + /* 17 */ VK_CONTROL, 0, KEY_RCtrl, + /* 18 */ VK_MENU, 0, KEY_AltLang, + /* 19 */ VK_PAUSE, KEY_Pause, 0, + /* 20 */ 0, 0, 0, + /* 21 */ 0, 0, 0, + /* 22 */ 0, 0, 0, + /* 23 */ 0, 0, 0, + /* 24 */ 0, 0, 0, + /* 25 */ 0, 0, 0, + /* 26 */ 0, 0, 0, + /* 27 */ 0, 0, 0, + /* 28 */ 0, 0, 0, + /* 29 */ 0, 0, 0, + /* 30 */ 0, 0, 0, + /* 31 */ 0, 0, 0, + /* 32 */ 0, 0, 0, + /* 33 */ VK_PRIOR, 0, KEY_PgUp, + /* 34 */ VK_NEXT, 0, KEY_PgDown, + /* 35 */ VK_END, 0, KEY_End, + /* 36 */ VK_HOME, 0, KEY_Home, + /* 37 */ VK_LEFT, 0, KEY_Left, + /* 38 */ VK_UP, 0, KEY_Up, + /* 39 */ VK_RIGHT, 0, KEY_Right, + /* 40 */ VK_DOWN, 0, KEY_Down, + /* 41 */ 0, 0, 0, + /* 42 */ 0, 0, 0, + /* 43 */ 0, 0, 0, + /* 44 */ VK_SNAPSHOT, 0, KEY_Print, + /* 45 */ VK_INSERT, 0, KEY_Insert, + /* 46 */ VK_DELETE, 0, KEY_Delete, + /* 47 */ 0, 0, 0, + /* 48 */ 0, 0, 0, + /* 49 */ 0, 0, 0, + /* 50 */ 0, 0, 0, + /* 51 */ 0, 0, 0, + /* 52 */ 0, 0, 0, + /* 53 */ 0, 0, 0, + /* 54 */ 0, 0, 0, + /* 55 */ 0, 0, 0, + /* 56 */ 0, 0, 0, + /* 57 */ 0, 0, 0, + /* 58 */ 0, 0, 0, + /* 59 */ 0, 0, 0, + /* 60 */ 0, 0, 0, + /* 61 */ 0, 0, 0, + /* 62 */ 0, 0, 0, + /* 63 */ 0, 0, 0, + /* 64 */ 0, 0, 0, + /* 65 */ 0, 0, 0, + /* 66 */ 0, 0, 0, + /* 67 */ 0, 0, 0, + /* 68 */ 0, 0, 0, + /* 69 */ 0, 0, 0, + /* 70 */ 0, 0, 0, + /* 71 */ 0, 0, 0, + /* 72 */ 0, 0, 0, + /* 73 */ 0, 0, 0, + /* 74 */ 0, 0, 0, + /* 75 */ 0, 0, 0, + /* 76 */ 0, 0, 0, + /* 77 */ 0, 0, 0, + /* 78 */ 0, 0, 0, + /* 79 */ 0, 0, 0, + /* 80 */ 0, 0, 0, + /* 81 */ 0, 0, 0, + /* 82 */ 0, 0, 0, + /* 83 */ 0, 0, 0, + /* 84 */ 0, 0, 0, + /* 85 */ 0, 0, 0, + /* 86 */ 0, 0, 0, + /* 87 */ 0, 0, 0, + /* 88 */ 0, 0, 0, + /* 89 */ 0, 0, 0, + /* 90 */ 0, 0, 0, + /* 91 */ 0, 0, 0, + /* 92 */ 0, 0, 0, + /* 93 */ 0, 0, 0, + /* 94 */ 0, 0, 0, + /* 95 */ 0, 0, 0, + /* 96 */ 0, 0, 0, + /* 97 */ 0, 0, 0, + /* 98 */ 0, 0, 0, + /* 99 */ 0, 0, 0, + /* 100 */ 0, 0, 0, + /* 101 */ 0, 0, 0, + /* 102 */ 0, 0, 0, + /* 103 */ 0, 0, 0, + /* 104 */ 0, 0, 0, + /* 105 */ 0, 0, 0, + /* 106 */ 0, 0, 0, + /* 107 */ 0, 0, 0, + /* 108 */ 0, 0, 0, + /* 109 */ 0, 0, 0, + /* 110 */ 0, 0, 0, + /* 111 */ VK_DIVIDE, 0, KEY_KP_Divide, + /* 112 */ 0, 0, 0, + /* 113 */ 0, 0, 0, + /* 114 */ 0, 0, 0, + /* 115 */ 0, 0, 0, + /* 116 */ 0, 0, 0, + /* 117 */ 0, 0, 0, + /* 118 */ 0, 0, 0, + /* 119 */ 0, 0, 0, + /* 120 */ 0, 0, 0, + /* 121 */ 0, 0, 0, + /* 122 */ 0, 0, 0, + /* 123 */ 0, 0, 0, + /* 124 */ 0, 0, 0, + /* 125 */ 0, 0, 0, + /* 126 */ 0, 0, 0, + /* 127 */ 0, 0, 0, + /* 128 */ 0, 0, 0, + /* 129 */ 0, 0, 0, + /* 130 */ 0, 0, 0, + /* 131 */ 0, 0, 0, + /* 132 */ 0, 0, 0, + /* 133 */ 0, 0, 0, + /* 134 */ 0, 0, 0, + /* 135 */ 0, 0, 0, + /* 136 */ 0, 0, 0, + /* 137 */ 0, 0, 0, + /* 138 */ 0, 0, 0, + /* 139 */ 0, 0, 0, + /* 140 */ 0, 0, 0, + /* 141 */ 0, 0, 0, + /* 142 */ 0, 0, 0, + /* 143 */ 0, 0, 0, + /* 144 */ 0, 0, 0, + /* 145 */ 0, 0, 0, + /* 146 */ 0, 0, 0, + /* 147 */ 0, 0, 0, + /* 148 */ 0, 0, 0, + /* 149 */ 0, 0, 0, + /* 150 */ 0, 0, 0, + /* 151 */ 0, 0, 0, + /* 152 */ 0, 0, 0, + /* 153 */ 0, 0, 0, + /* 154 */ 0, 0, 0, + /* 155 */ 0, 0, 0, + /* 156 */ 0, 0, 0, + /* 157 */ 0, 0, 0, + /* 158 */ 0, 0, 0, + /* 159 */ 0, 0, 0, + /* 160 */ 0, 0, 0, + /* 161 */ 0, 0, 0, + /* 162 */ 0, 0, 0, + /* 163 */ 0, 0, 0, + /* 164 */ 0, 0, 0, + /* 165 */ 0, 0, 0, + /* 166 */ 0, 0, 0, + /* 167 */ 0, 0, 0, + /* 168 */ 0, 0, 0, + /* 169 */ 0, 0, 0, + /* 170 */ 0, 0, 0, + /* 171 */ 0, 0, 0, + /* 172 */ 0, 0, 0, + /* 173 */ 0, 0, 0, + /* 174 */ 0, 0, 0, + /* 175 */ 0, 0, 0, + /* 176 */ 0, 0, 0, + /* 177 */ 0, 0, 0, + /* 178 */ 0, 0, 0, + /* 179 */ 0, 0, 0, + /* 180 */ 0, 0, 0, + /* 181 */ 0, 0, 0, + /* 182 */ 0, 0, 0, + /* 183 */ 0, 0, 0, + /* 184 */ 0, 0, 0, + /* 185 */ 0, 0, 0, + /* 186 */ 0, 0, 0, + /* 187 */ 0, 0, 0, + /* 188 */ 0, 0, 0, + /* 189 */ 0, 0, 0, + /* 190 */ 0, 0, 0, + /* 191 */ 0, 0, 0, + /* 192 */ 0, 0, 0, + /* 193 */ 0, 0, 0, + /* 194 */ 0, 0, 0, + /* 195 */ 0, 0, 0, + /* 196 */ 0, 0, 0, + /* 197 */ 0, 0, 0, + /* 198 */ 0, 0, 0, + /* 199 */ 0, 0, 0, + /* 200 */ 0, 0, 0, + /* 201 */ 0, 0, 0, + /* 202 */ 0, 0, 0, + /* 203 */ 0, 0, 0, + /* 204 */ 0, 0, 0, + /* 205 */ 0, 0, 0, + /* 206 */ 0, 0, 0, + /* 207 */ 0, 0, 0, + /* 208 */ 0, 0, 0, + /* 209 */ 0, 0, 0, + /* 210 */ 0, 0, 0, + /* 211 */ 0, 0, 0, + /* 212 */ 0, 0, 0, + /* 213 */ 0, 0, 0, + /* 214 */ 0, 0, 0, + /* 215 */ 0, 0, 0, + /* 216 */ 0, 0, 0, + /* 217 */ 0, 0, 0, + /* 218 */ 0, 0, 0, + /* 219 */ 0, 0, 0, + /* 220 */ 0, 0, 0, + /* 221 */ 0, 0, 0, + /* 222 */ 0, 0, 0, + /* 223 */ 0, 0, 0, + /* 224 */ 0, 0, 0, + /* 225 */ 0, 0, 0, + /* 226 */ 0, 0, 0, + /* 227 */ 0, 0, 0, + /* 228 */ 0, 0, 0, + /* 229 */ 0, 0, 0, + /* 230 */ 0, 0, 0, + /* 231 */ 0, 0, 0, + /* 232 */ 0, 0, 0, + /* 233 */ 0, 0, 0, + /* 234 */ 0, 0, 0, + /* 235 */ 0, 0, 0, + /* 236 */ 0, 0, 0, + /* 237 */ 0, 0, 0, + /* 238 */ 0, 0, 0, + /* 239 */ 0, 0, 0, + /* 240 */ 0, 0, 0, + /* 241 */ 0, 0, 0, + /* 242 */ 0, 0, 0, + /* 243 */ 0, 0, 0, + /* 244 */ 0, 0, 0, + /* 245 */ 0, 0, 0, + /* 246 */ 0, 0, 0, + /* 247 */ 0, 0, 0, + /* 248 */ 0, 0, 0, + /* 249 */ 0, 0, 0, + /* 250 */ 0, 0, 0, + /* 251 */ 0, 0, 0, + /* 252 */ 0, 0, 0, + /* 253 */ 0, 0, 0, + /* 254 */ 0, 0, 0, + /* 255 */ 0, 0, 0 +}; Index: xc/programs/Xserver/hw/xwin/winlayer.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winlayer.c:1.6 --- /dev/null Fri Jan 18 15:26:44 2002 +++ xc/programs/Xserver/hw/xwin/winlayer.c Thu Aug 16 04:23:36 2001 @@ -0,0 +1,236 @@ +/* + *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/winlayer.c,v 1.6 2001/08/16 08:23:36 alanh Exp $ */ + +#include "win.h" + + +/* + * Create initial layer. Cygwin only needs one initial layer. + */ + +LayerPtr +winLayerCreate (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + PixmapPtr pPixmap = NULL; + DWORD dwLayerKind; + + ErrorF ("winLayerCreate () - dwDepth %d\n", + pScreenInfo->dwDepth); + + /* We only need a single layer kind: shadow */ + dwLayerKind = LAYER_SHADOW; + pPixmap = LAYER_SCREEN_PIXMAP; + + return LayerCreate (pScreen, + dwLayerKind, + pScreenInfo->dwDepth, + pPixmap, + pScreenPriv->pwinShadowUpdate, + NULL, /* No ShadowWindowProc */ + 0, /* Rotate */ + 0); +} + +#ifdef RANDR +/* + * Used as a function parameter to WalkTree. + */ + +int +winLayerAdd (WindowPtr pWindow, pointer value) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + LayerPtr pLayer = (LayerPtr) value; + + ErrorF ("winLayerAdd ()\n"); + + if (!LayerWindowAdd (pScreen, pLayer, pWindow)) + return WT_STOPWALKING; + + return WT_WALKCHILDREN; +} + + +/* + * Used as a function parameter to WalkTree. + */ + +int +winLayerRemove (WindowPtr pWindow, pointer value) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + LayerPtr pLayer = (LayerPtr) value; + + ErrorF ("winLayerRemove ()\n"); + + LayerWindowRemove (pScreen, pLayer, pWindow); + + return WT_WALKCHILDREN; +} + + +/* + * Answer queries about the RandR features supported. + */ + +Bool +winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + int n; + RRVisualGroupPtr pVisualGroup; + RRGroupOfVisualGroupPtr pGroupOfVisualGroup = NULL; + Rotation rotateKind; + RRScreenSizePtr pSize; + + ErrorF ("winRandRGetInfo ()\n"); + + /* Don't support rotations, yet */ + *pRotations = RR_Rotate_0; /* | RR_Rotate_90 | RR_Rotate_180 | ... */ + + /* Check for something naughty. Don't know what exactly... */ + for (n = 0; n < pScreen->numDepths; n++) + if (pScreen->allowedDepths[n].numVids) + break; + if (n == pScreen->numDepths) + return FALSE; + + /* Create an RandR visual group */ + pVisualGroup = RRCreateVisualGroup (pScreen); + if (!pVisualGroup) + return FALSE; + + + /* Not sure what this does */ + if (!RRAddDepthToVisualGroup (pScreen, + pVisualGroup, + &pScreen->allowedDepths[n])) + { + RRDestroyVisualGroup (pScreen, pVisualGroup); + return FALSE; + } + + /* Register the RandR visual group */ + pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup); + if (!pVisualGroup) + return FALSE; + + pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, + pGroupOfVisualGroup); + + /* You have to be kidding */ + if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen, + pGroupOfVisualGroup, + pVisualGroup)) + { + RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); + /* pVisualGroup left until screen closed */ + return FALSE; + } + + /* I can't afford a clue */ + pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, + pGroupOfVisualGroup); + if (!pGroupOfVisualGroup) + return FALSE; + + /* + * Register supported sizes. This can be called many times, but + * we only support one size for now. + */ + pSize = RRRegisterSize (pScreen, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwWidth_mm, + pScreenInfo->dwHeight_mm, + pGroupOfVisualGroup); + + /* Only one allowed rotation for now */ + rotateKind = RR_Rotate_0; + + /* Tell RandR what the current config is */ + RRSetCurrentConfig (pScreen, rotateKind, pSize, pVisualGroup); + + return TRUE; +} + + +/* + * Configure which RandR features are supported. + */ + +Bool +winRandRSetConfig (ScreenPtr pScreen, + Rotation rotateKind, + RRScreenSizePtr pSize, + RRVisualGroupPtr pVisualGroup) +{ + ErrorF ("winRandRSetConfig ()\n"); + + /* + * Apparently the only thing that can change is rotation. + * We don't support rotation, so that means nothing can change, right? + */ + + assert (rotateKind == RR_Rotate_0); + + return TRUE; +} + + +/* + * Initialize the RandR layer. + */ + +Bool +winRandRInit (ScreenPtr pScreen) +{ + rrScrPrivPtr pRRScrPriv; + + ErrorF ("winRandRInit ()\n"); + + if (!RRScreenInit (pScreen)) + { + ErrorF ("winRandRInit () - RRScreenInit () failed\n"); + return FALSE; + } + + /* Set some RandR function pointers */ + pRRScrPriv = rrGetScrPriv (pScreen); + pRRScrPriv->rrGetInfo = winRandRGetInfo; + pRRScrPriv->rrSetConfig = winRandRSetConfig; + + return TRUE; +} +#endif Index: xc/programs/Xserver/hw/xwin/winmisc.c diff -u xc/programs/Xserver/hw/xwin/winmisc.c:1.3 xc/programs/Xserver/hw/xwin/winmisc.c:1.5 --- xc/programs/Xserver/hw/xwin/winmisc.c:1.3 Tue May 1 20:45:26 2001 +++ xc/programs/Xserver/hw/xwin/winmisc.c Sun Nov 11 17:45:57 2001 @@ -27,15 +27,17 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.3 2001/05/02 00:45:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.5 2001/11/11 22:45:57 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) @@ -43,9 +45,11 @@ ErrorF ("winQueryBestSize()\n"); } + /* * Count the number of one bits in a color mask. */ + CARD8 winCountBits (DWORD dw) { @@ -60,9 +64,11 @@ return dwBits; } + /* * Modify the screen pixmap to point to the new framebuffer address */ + Bool winUpdateFBPointer (ScreenPtr pScreen, void *pbits) { @@ -71,7 +77,7 @@ /* Location of shadow framebuffer has changed */ pScreenInfo->pfb = pbits; - + /* Update the screen pixmap */ if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, pScreen->width, @@ -85,6 +91,57 @@ FatalError ("winUpdateFramebufferPointer () - Failed modifying "\ "screen pixmap\n"); } + + return TRUE; +} + + +/* + * Paint the window background with the specified color + */ + +BOOL +winPaintBackground (HWND hwnd, COLORREF colorref) +{ + HDC hdc; + HBRUSH hbrush; + RECT rect; + + /* Create an hdc */ + hdc = GetDC (hwnd); + if (hdc == NULL) + { + printf ("gdiWindowProc - GetDC failed\n"); + exit (1); + } + + /* Create and select blue brush */ + hbrush = CreateSolidBrush (colorref); + if (hbrush == NULL) + { + printf ("gdiWindowProc - CreateSolidBrush failed\n"); + exit (1); + } + + /* Get window extents */ + if (GetClientRect (hwnd, &rect) == FALSE) + { + printf ("gdiWindowProc - GetClientRect failed\n"); + exit (1); + } + + /* Fill window with blue brush */ + if (FillRect (hdc, &rect, hbrush) == 0) + { + printf ("gdiWindowProc - FillRect failed\n"); + exit (1); + } + + /* Delete blue brush */ + DeleteObject (hbrush); + + /* Release the hdc */ + ReleaseDC (hwnd, hdc); return TRUE; } Index: xc/programs/Xserver/hw/xwin/winmouse.c diff -u xc/programs/Xserver/hw/xwin/winmouse.c:1.3 xc/programs/Xserver/hw/xwin/winmouse.c:1.4 --- xc/programs/Xserver/hw/xwin/winmouse.c:1.3 Tue May 8 04:14:09 2001 +++ xc/programs/Xserver/hw/xwin/winmouse.c Mon Oct 29 16:10:24 2001 @@ -30,7 +30,7 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmouse.c,v 1.4 2001/10/29 21:10:24 alanh Exp $ */ #include "win.h" @@ -39,10 +39,12 @@ { } + /* * See Porting Layer Definition - p. 18 * This is known as a DeviceProc */ + int winMouseProc (DeviceIntPtr pDeviceInt, int iState) { @@ -77,6 +79,7 @@ return Success; } + /* Handle the mouse wheel */ int winMouseWheel (ScreenPtr pScreen, int iDeltaZ) @@ -169,9 +172,11 @@ return 0; } + /* * Enqueue a mouse button event */ + void winMouseButtonsSendEvent (int iEventType, int iButton) { @@ -185,9 +190,11 @@ mieqEnqueue (&xCurrentEvent); } + /* * Decide what to do with a Windows mouse message */ + int winMouseButtonsHandle (ScreenPtr pScreen, int iEventType, int iButton, Index: xc/programs/Xserver/hw/xwin/winnativegdi.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winnativegdi.c:1.11 --- /dev/null Fri Jan 18 15:26:44 2002 +++ xc/programs/Xserver/hw/xwin/winnativegdi.c Wed Nov 21 03:51:24 2001 @@ -0,0 +1,456 @@ +/* + *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/winnativegdi.c,v 1.11 2001/11/21 08:51:24 alanh Exp $ */ + +#include "win.h" + +Bool +winAllocateFBNativeGDI (ScreenPtr pScreen) +{ + FatalError ("winAllocateFBNativeGDI ()\n"); + + return TRUE; +} + +/* + * We wrap whatever CloseScreen procedure was specified by fb; + * a pointer to said procedure is stored in our privates. + */ +Bool +winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + ErrorF ("winCloseScreenNativeGDI () - Freeing screen resources\n"); + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* + * NOTE: mi doesn't use a CloseScreen procedure, so we do not + * need to call a wrapped procedure here. + */ + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + ErrorF ("winCloseScreenNativeGDI () - Destroying window\n"); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Invalidate our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Free the screen privates for this screen */ + xfree (pScreenPriv); + + ErrorF ("winCloseScreenNativeGDI () - Returning\n"); + + return TRUE; +} + + +void +winShadowUpdateNativeGDI (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + FatalError ("winShadowUpdateNativeGDI ()\n"); + return; +} + + +Bool +winInitVisualsNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set the bitsPerRGB and bit masks */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + pScreenPriv->dwBitsPerRGB = 8; + pScreenPriv->dwRedMask = 0x00FF0000; + pScreenPriv->dwGreenMask = 0x0000FF00; + pScreenPriv->dwBlueMask = 0x000000FF; + break; + + case 16: + pScreenPriv->dwBitsPerRGB = 6; + pScreenPriv->dwRedMask = 0xF800; + pScreenPriv->dwGreenMask = 0x07E0; + pScreenPriv->dwBlueMask = 0x001F; + break; + + case 15: + pScreenPriv->dwBitsPerRGB = 5; + pScreenPriv->dwRedMask = 0x7C00; + pScreenPriv->dwGreenMask = 0x03E0; + pScreenPriv->dwBlueMask = 0x001F; + break; + + case 8: + pScreenPriv->dwBitsPerRGB = 8; + pScreenPriv->dwRedMask = 0; + pScreenPriv->dwGreenMask = 0; + pScreenPriv->dwBlueMask = 0; + break; + + default: + ErrorF ("winInitVisualsNativeGDI () - Unknown screen depth\n"); + return FALSE; + break; + } + + /* Tell the user how many bits per RGB we are using */ + ErrorF ("winInitVisualsNativeGDI () - 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, + StaticColorMask, + pScreenPriv->dwBitsPerRGB, + StaticColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + default: + ErrorF ("winInitVisualsNativeGDI () - Unknown screen depth\n"); + return FALSE; + } + +#if 1 + ErrorF ("winInitVisualsNativeGDI () - Returning\n"); +#endif + + return TRUE; +} + + +/* Adjust the video mode */ +Bool +winAdjustVideoModeNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwDepth; + + hdc = GetDC (NULL); + + /* We're in serious trouble if we can't get a DC */ + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModeNativeGDI () - GetDC () failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* GDI cannot change the screen depth */ + if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + { + /* No -depth parameter passed, let the user know the depth being used */ + ErrorF ("winAdjustVideoModeNativeGDI () - Using Windows display " + "depth of %d bits per pixel\n", dwDepth); + + /* Use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + else if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than -depth parameter */ + ErrorF ("winAdjustVideoModeNativeGDI () - 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 +winActivateAppNativeGDI (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; +} + + +HBITMAP +winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth, + BYTE **ppbBits, BITMAPINFO **ppbmi) +{ + BITMAPINFOHEADER *pbmih = NULL; + HBITMAP hBitmap = NULL; + BITMAPINFO *pbmi = NULL; + + /* Don't create an invalid bitmap */ + if (iWidth == 0 + || iHeight == 0 + || iDepth == 0) + { + ErrorF ("\nwinCreateDIBNativeGDI () - Invalid specs w %d h %d d %d\n\n", + iWidth, iHeight, iDepth); + return NULL; + } + + /* Allocate bitmap info header */ + pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pbmih == NULL) + { + ErrorF ("winCreateDIBNativeGDI () - xalloc () failed\n"); + return FALSE; + } + ZeroMemory (pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); + + /* Describe bitmap to be created */ + pbmih->biSize = sizeof (BITMAPINFOHEADER); + pbmih->biWidth = iWidth; + pbmih->biHeight = -iHeight; + pbmih->biPlanes = 1; + pbmih->biBitCount = iDepth; + pbmih->biCompression = BI_RGB; + pbmih->biSizeImage = 0; + pbmih->biXPelsPerMeter = 0; + pbmih->biYPelsPerMeter = 0; + pbmih->biClrUsed = 0; + pbmih->biClrImportant = 0; + + /* Setup color table for mono DIBs */ + if (iDepth == 1) + { + pbmi = (BITMAPINFO*) pbmih; + pbmi->bmiColors[1].rgbBlue = 255; + pbmi->bmiColors[1].rgbGreen = 255; + pbmi->bmiColors[1].rgbRed = 255; + } + + /* Create a DIB with a bit pointer */ + hBitmap = CreateDIBSection (NULL, + (BITMAPINFO *) pbmih, + DIB_RGB_COLORS, + (void **) ppbBits, + NULL, + 0); + if (hBitmap == NULL) + { + ErrorF ("winCreateDIBNativeGDI () - CreateDIBSection () failed\n"); + return NULL; + } + + /* Free the bitmap info header memory */ + if (ppbmi != NULL) + { + /* Store the address of the BMIH in the ppbmih parameter */ + *ppbmi = (BITMAPINFO *) pbmih; + } + else + { + xfree (pbmih); + pbmih = NULL; + } + + return hBitmap; +} + + +Bool +winBltExposedRegionsNativeGDI (ScreenPtr pScreen) +{ + + return TRUE; +} + + +Bool +winRedrawScreenNativeGDI (ScreenPtr pScreen) +{ + FatalError ("winRedrawScreenNativeGDI ()\n"); + return TRUE; +} + + +Bool +winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen) +{ + FatalError ("winRealizeInstalledPaletteNativeGDI ()\n"); + return TRUE; +} + + +Bool +winInstallColormapNativeGDI (ColormapPtr pColormap) +{ + FatalError ("winInstallColormapNativeGDI ()\n"); + return TRUE; +} + + +Bool +winStoreColorsNativeGDI (ColormapPtr pmap, + int ndef, + xColorItem *pdefs) +{ + FatalError ("winStoreColorsNativeGDI ()\n"); + return TRUE; +} + + +Bool +winCreateColormapNativeGDI (ColormapPtr pColormap) +{ + FatalError ("winCreateColormapNativeGDI ()\n"); + return TRUE; +} + + +Bool +winDestroyColormapNativeGDI (ColormapPtr pColormap) +{ + FatalError ("winDestroyColormapNativeGDI ()\n"); + return TRUE; +} + + +/* Set engine specific funtions */ +Bool +winSetEngineFunctionsNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI; + pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI; + pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI; + pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI; + /* + * WARNING: Do not set the BltExposedRegions procedure pointer to anything + * other than NULL until a working painting procedure is in place. + * Else, winWindowProc will get stuck in an infinite loop because + * Windows expects the BeginPaint and EndPaint functions to be called + * before a WM_PAINT message can be removed from the queue. We are + * using NULL here as a signal for winWindowProc that it should + * not signal that the WM_PAINT message has been processed. + */ + pScreenPriv->pwinBltExposedRegions = NULL; + pScreenPriv->pwinActivateApp = winActivateAppNativeGDI; + pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI; + pScreenPriv->pwinRealizeInstalledPalette = + winRealizeInstalledPaletteNativeGDI; + pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI; + pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI; + pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI; + pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabPtr) (void (*)())NoopDDA; + + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/winpfbdd.c diff -u xc/programs/Xserver/hw/xwin/winpfbdd.c:1.5 xc/programs/Xserver/hw/xwin/winpfbdd.c:1.14 --- xc/programs/Xserver/hw/xwin/winpfbdd.c:1.5 Mon May 14 12:52:33 2001 +++ xc/programs/Xserver/hw/xwin/winpfbdd.c Wed Nov 21 03:51:24 2001 @@ -30,13 +30,15 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpfbdd.c,v 1.14 2001/11/21 08:51:24 alanh Exp $ */ #include "win.h" + /* * Create a DirectDraw primary surface */ + Bool winAllocateFBPrimaryDD (ScreenPtr pScreen) { @@ -60,6 +62,18 @@ ddrval = DirectDrawCreate (NULL, &pScreenPriv->pdd, NULL); if (ddrval != DD_OK) FatalError ("winAllocateFBPrimaryDD () - Could not start DirectDraw\n"); + + /* Get a DirectDraw2 interface pointer */ + ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, + &IID_IDirectDraw2, + (LPVOID*) &pScreenPriv->pdd2); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD () - Failed DD2 query: %08x\n", + ddrval); + return FALSE; + } + ErrorF ("winAllocateFBPrimaryDD () - Created and initialized DD\n"); @@ -67,19 +81,21 @@ if (pScreenInfo->fFullScreen) { /* Full screen mode */ - ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, - pScreenPriv->hwndScreen, - DDSCL_FULLSCREEN - | DDSCL_EXCLUSIVE); + ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, + 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); + ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth, + pScreenInfo->dwRefreshRate, + 0); if (FAILED (ddrval)) FatalError ("winAllocateFBPrimaryDD () - Could not set "\ "full screen display mode\n"); @@ -87,9 +103,9 @@ else { /* Windowed mode */ - ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, - pScreenPriv->hwndScreen, - DDSCL_NORMAL); + ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); if (FAILED (ddrval)) FatalError ("winAllocateFBPrimaryDD () - Could not set "\ "cooperative level\n"); @@ -102,10 +118,10 @@ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; /* Create the primary surface */ - ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, - &ddsd, - &pScreenPriv->pddsPrimary, - NULL); + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); if (FAILED (ddrval)) FatalError ("winAllocateFBPrimaryDD () - Could not create primary "\ "surface %08x\n", ddrval); @@ -138,10 +154,10 @@ ddsd.dwWidth = pScreenInfo->dwWidth; /* Create the shadow surface */ - ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, - &ddsd, - &pScreenPriv->pddsOffscreen, - NULL); + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsOffscreen, + NULL); if (ddrval != DD_OK) FatalError ("winAllocateFBPrimaryDD () - Could not create shadow "\ "surface\n"); @@ -160,7 +176,7 @@ ErrorF ("winAllocateFBPrimaryDD () - Locking primary\n"); /* Lock the primary surface */ - ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsPrimary, + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary, pScreenInfo->fFullScreen ? NULL:&rcClient, pddsdPrimary, DDLOCK_WAIT, @@ -176,13 +192,13 @@ FatalError ("winAllocateFBPrimaryDD () - Color format other than RGB\n"); /* Grab the pitch, and memory pointer from the surface desc */ - pScreenInfo->dwStrideBytes = pddsdPrimary->u.lPitch; + pScreenInfo->dwStrideBytes = pddsdPrimary->u1.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; + pScreenInfo->dwDepth = pddsdPrimary->ddpfPixelFormat.u1.dwRGBBitCount; pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask; pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask; pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask; @@ -192,11 +208,13 @@ return TRUE; } + /* * Call the wrapped CloseScreen function. * * Free our resources and private structures. */ + Bool winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen) { @@ -220,31 +238,27 @@ /* Free the offscreen surface, if there is one */ if (pScreenPriv->pddsOffscreen) { - IDirectDrawSurface_Unlock (pScreenPriv->pddsOffscreen, NULL); - IDirectDrawSurface_Release (pScreenPriv->pddsOffscreen); + IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL); + IDirectDrawSurface2_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); + IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL); + IDirectDrawSurface2_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); + IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw2_Release (pScreenPriv->pdd); pScreenPriv->pdd = NULL; } - /* Redisplay the Windows cursor */ - if (!pScreenPriv->fCursor) - ShowCursor (TRUE); - /* Kill our window */ if (pScreenPriv->hwndScreen) { @@ -264,6 +278,7 @@ return fReturn; } + /* * Tell mi what sort of visuals we need. * @@ -271,6 +286,7 @@ * handle one format at a time, I believe. You may want * to verify that last sentence. */ + Bool winInitVisualsPrimaryDD (ScreenPtr pScreen) { @@ -345,10 +361,6 @@ return FALSE; } - /* Set DPI info */ - pScreenInfo->dwDPIx = 100; - pScreenInfo->dwDPIy = 100; - ErrorF ("winInitVisualsPrimaryDD () - Returning\n"); return TRUE; @@ -362,13 +374,6 @@ 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) @@ -380,12 +385,29 @@ /* Query GDI for current display depth */ dwDepth = GetDeviceCaps (hdc, BITSPIXEL); - /* Is GDI using a depth different than command line parameter? */ - if (dwDepth != pScreenInfo->dwDepth) + /* DirectDraw can only change the depth in fullscreen mode */ + if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + { + /* No -depth parameter passed, let the user know the depth being used */ + ErrorF ("winAdjustVideoModePrimaryDD () - Using Windows display " + "depth of %d bits per pixel\n", dwDepth); + + /* Use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + else if (pScreenInfo->fFullScreen + && pScreenInfo->dwDepth != dwDepth) { - /* Warn user if GDI depth is different than depth specified */ - ErrorF ("winAdjustVideoModePrimaryDD () - Command line depth: %d, "\ - "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + /* FullScreen, and GDI depth differs from -depth parameter */ + ErrorF ("winAdjustVideoModePrimaryDD () - FullScreen, using command " + "line depth: %d\n", pScreenInfo->dwDepth); + } + else if (dwDepth != pScreenInfo->dwDepth) + { + /* Windowed, and GDI depth differs from -depth parameter */ + ErrorF ("winAdjustVideoModePrimaryDD () - Windowed, command line " + "depth: %d, using depth: %d\n", + pScreenInfo->dwDepth, dwDepth); /* We'll use GDI's depth */ pScreenInfo->dwDepth = dwDepth; @@ -397,6 +419,13 @@ return TRUE; } + +/* + * 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. + */ + Bool winActivateAppPrimaryDD (ScreenPtr pScreen) { @@ -405,79 +434,180 @@ RECT rcSrc, rcClient; HRESULT ddrval = DD_OK; + /* Check for errors */ + if (pScreenPriv == NULL + || pScreenPriv->pddsPrimary == NULL + || pScreenPriv->pddsOffscreen == NULL) + return FALSE; + + /* Check for do-nothing */ + if (!pScreenPriv->fActive) + return TRUE; + + /* We are activating */ + ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsOffscreen); + if (ddrval == DD_OK) + { + IDirectDrawSurface2_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 */ + IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen); + IDirectDrawSurface2_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 = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsOffscreen, + &rcSrc, + DDBLT_WAIT, + NULL); + if (ddrval != DD_OK) + FatalError ("winActivateAppPrimaryDD () - Failed blitting offscreen " + "surface to primary surface %08x\n", ddrval); + + /* Lock the primary surface */ + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsdPrimary, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK + || pScreenPriv->pddsdPrimary->lpSurface == NULL) + FatalError ("winActivateAppPrimaryDD () - Could not lock " + "primary surface\n"); + + /* Notify FB of the new memory pointer */ + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdPrimary->lpSurface); + /* - * 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. + * Register the Alt-Tab combo as a hotkey so we can copy + * the primary framebuffer before the display mode changes */ - 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); + RegisterHotKey (pScreenPriv->hwndScreen, 1, MOD_ALT, 9); + + return TRUE; +} + + +/* + * Handle the Alt+Tab hotkey. + * + * 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. + */ + +Bool +winHotKeyAltTabPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RECT rcClient, rcSrc; + HRESULT ddrval = DD_OK; + + ErrorF ("\nwinHotKeyAltTabPrimaryDD ()\n\n"); + + /* Alt+Tab was pressed, we will lose focus very soon */ + pScreenPriv->fActive = FALSE; + + /* Check for error conditions */ + if (pScreenPriv->pddsPrimary == NULL + || pScreenPriv->pddsOffscreen == NULL) + return FALSE; + + /* 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 = IDirectDrawSurface2_IsLost (pScreenPriv->pddsPrimary); + if (ddrval == DD_OK) + { + ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, + NULL); if (FAILED (ddrval)) - FatalError ("winWindowProc () - Failed blitting offscreen "\ - "surface to primary surface %08x\n", ddrval); + FatalError ("winHotKeyAltTabPrimaryDD () - Failed unlocking primary "\ + "surface\n"); + } - /* Lock the primary surface */ - ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsPrimary, - &rcClient, - pScreenPriv->pddsdPrimary, - DDLOCK_WAIT, + /* 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 = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen, + NULL, /* should be rcDest */ + pScreenPriv->pddsPrimary, + NULL, + DDBLT_WAIT, + NULL); + if (ddrval == DDERR_SURFACELOST) + { + IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen); + IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); + + /* Blit the primary surface to the offscreen surface */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen, + NULL, + pScreenPriv->pddsPrimary, + NULL, + DDBLT_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); + if (FAILED (ddrval)) + FatalError ("winHotKeyAltTabPrimaryDD () - Failed blitting primary " + "surface to offscreen surface: %08x\n", + ddrval); } + else + { + FatalError ("winHotKeyAltTabPrimaryDD() - Unknown error from " + "Blt: %08dx\n", ddrval); + } + + /* Lock the offscreen surface */ + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsOffscreen, + NULL, + pScreenPriv->pddsdOffscreen, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK + || pScreenPriv->pddsdPrimary->lpSurface == NULL) + FatalError ("winHotKeyAltTabPrimaryDD () - Could not lock "\ + "offscreen surface\n"); + + /* Notify FB of the new memory pointer */ + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdOffscreen->lpSurface); + /* Unregister our hotkey */ + UnregisterHotKey (pScreenPriv->hwndScreen, 1); + return TRUE; } + /* Set engine specific functions */ Bool winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen) @@ -489,8 +619,6 @@ pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD; pScreenPriv->pwinShadowUpdate = (winShadowUpdateProcPtr) (void (*)())NoopDDA; - pScreenPriv->pwinShadowWindow - = (winShadowWindowProcPtr) (void (*)())NoopDDA; pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD; pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD; @@ -502,6 +630,7 @@ pScreenPriv->pwinBltExposedRegions = (winBltExposedRegionsProcPtr) (void (*)())NoopDDA; pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD; + pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD; return TRUE; } Index: xc/programs/Xserver/hw/xwin/winpixmap.c diff -u xc/programs/Xserver/hw/xwin/winpixmap.c:1.3 xc/programs/Xserver/hw/xwin/winpixmap.c:1.9 --- xc/programs/Xserver/hw/xwin/winpixmap.c:1.3 Tue May 1 20:45:26 2001 +++ xc/programs/Xserver/hw/xwin/winpixmap.c Thu Nov 1 07:19:42 2001 @@ -28,7 +28,7 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpixmap.c,v 1.9 2001/11/01 12:19:42 alanh Exp $ */ #include "win.h" @@ -36,128 +36,171 @@ /* See mfb/mfbpixmap.c - mfbCreatePixmap() */ PixmapPtr winCreatePixmapNativeGDI (ScreenPtr pScreen, - int nWidth, int nHeight, - int nDepth) + int iWidth, int iHeight, + int iDepth) { -#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; + winPrivPixmapPtr pPixmapPriv = NULL; + PixmapPtr pPixmap = NULL; - /* Create the bitmap */ - if (nDepth == 1) - { - hBitmap = CreateDIBitmap (NULL, &bmih, 0, NULL, NULL, 0); - } - else + /* Allocate pixmap memory */ + pPixmap = AllocatePixmap (pScreen, 0); + if (!pPixmap) { - hBitmap = CreateDIBitmap (g_hdcMem, &bmih, 0, NULL, NULL, 0); + ErrorF ("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n"); + return NullPixmap; } - /* Allocate a pixmap structure */ - pPixmap = (PixmapPtr) xalloc (sizeof (PixmapRec)); - if (!pPixmap) - return NullPixmap; + ErrorF ("winCreatePixmap () - w %d h %d d %d bw %d\n", + iWidth, iHeight, iDepth, + PixmapBytePad (iWidth, iDepth)); - /* Set other fields of the pixmap, all fields must be set to - valid values */ + /* Setup pixmap 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.depth = iDepth; + pPixmap->drawable.bitsPerPixel = BitsPerPixel (iDepth); 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->drawable.width = iWidth; + pPixmap->drawable.height = iHeight; + pPixmap->devKind = 0; pPixmap->refcnt = 1; + pPixmap->devPrivate.ptr = NULL; - /* 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); + /* Pixmap privates are allocated by AllocatePixmap */ + pPixmapPriv = winGetPixmapPriv (pPixmap); + + /* Initialize pixmap privates */ + pPixmapPriv->hBitmap = NULL; + pPixmapPriv->hdcSelected = NULL; + pPixmapPriv->pbBits = NULL; + pPixmapPriv->dwScanlineBytes = PixmapBytePad (iWidth, iDepth); + + /* Check for zero width or height pixmaps */ + if (iWidth == 0 || iHeight == 0) + { + /* Don't allocate a real pixmap, just set fields and return */ + return pPixmap; + } + + /* Create a DIB for the pixmap */ + pPixmapPriv->hBitmap = winCreateDIBNativeGDI (iWidth, iHeight, iDepth, + &pPixmapPriv->pbBits, + (BITMAPINFO **) &pPixmapPriv->pbmih); + +#if CYGDEBUG + ErrorF ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \ + "screen: %08x\n", + pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen); +#endif return pPixmap; -#else /* CYGX_GDI */ - return NULL; -#endif /* CYGX_GDI */ } + + +/* + * See Porting Layer Definition - p. 35 + * + * See mfb/mfbpixmap.c - mfbDestroyPixmap() + */ -/* See Porting Layer Definition - p. 35 */ -/* See mfb/mfbpixmap.c - mfbDestroyPixmap() */ Bool winDestroyPixmapNativeGDI (PixmapPtr pPixmap) { - HBITMAP hBitmap; + winPrivPixmapPtr pPixmapPriv = NULL; + + ErrorF ("winDestroyPixmapNativeGDI ()\n"); + + /* Bail early if there is not a pixmap to destroy */ + if (pPixmap == NULL) + { + ErrorF ("winDestroyPixmapNativeGDI () - No pixmap to destroy\n"); + return TRUE; + } - fprintf (stderr, "winDestroyPixmap - pPixmap->devPrivate.ptr: %08x\n", - (UINT) pPixmap->devPrivate.ptr); + /* Get a handle to the pixmap privates */ + pPixmapPriv = winGetPixmapPriv (pPixmap); - /* Decrement reference count, and, if zero, free the pixmap */ - --(pPixmap->refcnt); + ErrorF ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n", + pPixmapPriv->hBitmap); - /* Are there any more references to this pixmap? */ - if (pPixmap->refcnt == 0) + /* Decrement reference count, return if nonzero */ + --pPixmap->refcnt; + if (pPixmap->refcnt != 0) + return TRUE; + + /* Free GDI bitmap */ + if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap); + + /* Free the bitmap info header memory */ + if (pPixmapPriv->pbmih != NULL) { - /* Free GDI bitmap */ - hBitmap = pPixmap->devPrivate.ptr; - if (hBitmap) DeleteObject (hBitmap); - hBitmap = NULL; - - /* Free the PixmapRec */ - xfree (pPixmap); - pPixmap = NULL; + xfree (pPixmapPriv->pbmih); + pPixmapPriv->pbmih = NULL; } + /* Free the pixmap memory */ + xfree (pPixmap); + pPixmap = NULL; + return TRUE; } + -/* See cfb/cfbpixmap.c */ +/* + * Not used yet + */ + +Bool +winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap, + int iWidth, int iHeight, + int iDepth, + int iBitsPerPixel, + int devKind, + pointer pPixData) +{ + FatalError ("winModifyPixmapHeaderNativeGDI ()\n"); + return TRUE; +} + + +/* + * Not used yet. + * See cfb/cfbpixmap.c + */ + void winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw) { - fprintf (stderr, "winXRotatePixmap()\n"); + ErrorF ("winXRotatePixmap()\n"); /* fill in this function, look at CFB */ } -/* See cfb/cfbpixmap.c */ + +/* + * Not used yet. + * See cfb/cfbpixmap.c + */ void winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh) { - fprintf (stderr, "winYRotatePixmap()\n"); + ErrorF ("winYRotatePixmap()\n"); /* fill in this function, look at CFB */ } + + +/* + * Not used yet. + * See cfb/cfbpixmap.c + */ -/* See cfb/cfbpixmap.c */ void winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix, int xrot, int yrot) { - fprintf (stderr, "winCopyRotatePixmap()\n"); + ErrorF ("winCopyRotatePixmap()\n"); /* fill in this function, look at CFB */ } Index: xc/programs/Xserver/hw/xwin/winpntwin.c diff -u xc/programs/Xserver/hw/xwin/winpntwin.c:1.1 xc/programs/Xserver/hw/xwin/winpntwin.c:1.2 --- xc/programs/Xserver/hw/xwin/winpntwin.c:1.1 Thu Apr 5 16:13:50 2001 +++ xc/programs/Xserver/hw/xwin/winpntwin.c Mon Jun 4 09:04:41 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winpntwin.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpntwin.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */ #include "win.h" @@ -41,5 +41,5 @@ RegionPtr pRegion, int nKind) { - fprintf (stderr, "winPaintWindow()\n"); + ErrorF ("winPaintWindow()\n"); } Index: xc/programs/Xserver/hw/xwin/winpolyline.c diff -u xc/programs/Xserver/hw/xwin/winpolyline.c:1.1 xc/programs/Xserver/hw/xwin/winpolyline.c:1.3 --- xc/programs/Xserver/hw/xwin/winpolyline.c:1.1 Thu Apr 5 16:13:50 2001 +++ xc/programs/Xserver/hw/xwin/winpolyline.c Thu Sep 13 04:25:45 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winpolyline.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpolyline.c,v 1.3 2001/09/13 08:25:45 alanh Exp $ */ #include "win.h" @@ -39,5 +39,5 @@ int npt, DDXPointPtr ppt) { - fprintf (stderr, "winPolyLine()\n"); + FatalError ("winPolyLine()\n"); } Index: xc/programs/Xserver/hw/xwin/winscrinit.c diff -u xc/programs/Xserver/hw/xwin/winscrinit.c:1.7 xc/programs/Xserver/hw/xwin/winscrinit.c:1.22 --- xc/programs/Xserver/hw/xwin/winscrinit.c:1.7 Mon May 14 12:52:33 2001 +++ xc/programs/Xserver/hw/xwin/winscrinit.c Sun Nov 11 17:45:57 2001 @@ -30,195 +30,36 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.22 2001/11/11 22:45:57 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]; + winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; winPrivScreenPtr pScreenPriv; + DEBUG_FN_NAME("winScreenInit"); + DEBUGVARS; + /*DEBUGPROC_MSG;*/ + + DEBUG_MSG ("Hello"); /* Allocate privates for this screen */ - winAllocatePrivates (pScreen); + if (!winAllocatePrivates (pScreen)) + { + ErrorF ("winScreenInit () - Couldn't allocate screen privates\n"); + return FALSE; + } /* Get a pointer to the privates structure that was allocated */ pScreenPriv = winGetScreenPriv (pScreen); @@ -247,6 +88,38 @@ return FALSE; } + /* Check for supported display depth */ + if (!(WIN_SUPPORTED_DEPTHS & (1 << (pScreenInfo->dwDepth - 1)))) + { + ErrorF ("winScreenInit () - Unsupported display depth: %d\n" \ + "Change your Windows display depth to 15, 16, 24, or 32 bits " + "per pixel.\n", + pScreenInfo->dwDepth); + ErrorF ("winScreenInit () - Supported depths: %08x\n", + WIN_SUPPORTED_DEPTHS); +#if WIN_CHECK_DEPTH + return FALSE; +#endif + } + + /* Create display window */ + if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) + { + ErrorF ("winScreenInitFB () - pwinCreateBoundingWindow () " + "failed\n"); + return FALSE; + } + + /* Set the padded screen width */ + pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, + pScreenInfo->dwDepth); + + /* Clear the visuals list */ + miClearVisualTypes (); + + pScreenInfo->dwBPP = winBitsPerPixel (pScreenInfo->dwDepth); + pScreenPriv->dwOrigDepth = pScreenInfo->dwDepth; + /* Call the engine dependent screen initialization procedure */ if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) { @@ -254,9 +127,14 @@ return FALSE; } +#if CYGDEBUG || YES + ErrorF ("winScreenInit () - returning\n"); +#endif + return TRUE; } + /* See Porting Layer Definition - p. 20 */ Bool winFinishScreenInitFB (int index, @@ -265,37 +143,20 @@ { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - Bool fReturn = TRUE; + VisualPtr pVisual = NULL; 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); + pScreenPriv->dwLayerKind = LAYER_SHADOW; - /* Clear the visuals list */ - winClearVisualTypes (); - /* Create framebuffer */ - fReturn = (*pScreenPriv->pwinAllocateFB) (pScreen); - if (!fReturn) + if (!(*pScreenPriv->pwinAllocateFB) (pScreen)) { ErrorF ("winFinishScreenInitFB () - Could not allocate framebuffer\n"); return FALSE; } /* Init visuals */ - fReturn = (*pScreenPriv->pwinInitVisuals) (pScreen); - if (!fReturn) + if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) { ErrorF ("winFinishScreenInitFB () - winInitVisuals failed\n"); return FALSE; @@ -307,262 +168,190 @@ /* 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)) + /* Start fb initialization */ + if (!fbSetupScreen (pScreen, + pScreenInfo->pfb, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + monitorResolution, monitorResolution, + pScreenInfo->dwStride, + pScreenInfo->dwBPP)) { - ErrorF ("winFinishScreenInitFB () - fbScreenInit failed\n"); + ErrorF ("winFinishScreenInitFB () - fbSetupScreen failed\n"); return FALSE; } + + /* Override default colormap routines if visual class is dynamic */ + if (pScreenInfo->dwDepth == 8 + && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI + || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL + && pScreenInfo->fFullScreen) + || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + && pScreenInfo->fFullScreen))) + { + pScreen->CreateColormap = winCreateColormap; + pScreen->DestroyColormap = winDestroyColormap; + pScreen->InstallColormap = winInstallColormap; + pScreen->UninstallColormap = winUninstallColormap; + pScreen->ListInstalledColormaps = winListInstalledColormaps; + pScreen->StoreColors = winStoreColors; + pScreen->ResolveColor = winResolveColor; + + /* + * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its + * own colormap, as it cannot allocate 7 planes in the default + * colormap. Setting whitePixel to 1 allows Magic to get 7 + * planes in the default colormap, so it doesn't create its + * own colormap. This latter situation is highly desireable, + * as it keeps the Magic window viewable when switching to + * other X clients that use the default colormap. + */ + pScreen->blackPixel = 0; + pScreen->whitePixel = 1; + } - pScreen->GetWindowPixmap = winGetWindowPixmap; - pScreen->SetWindowPixmap = winSetWindowPixmap; + /* Place our save screen function */ + pScreen->SaveScreen = winSaveScreen; + + /* Backing store functions */ + /* + * FIXME: Backing store support still doesn't seem to be working. + */ + pScreen->BackingStoreFuncs.SaveAreas = fbSaveAreas; + pScreen->BackingStoreFuncs.RestoreAreas = fbRestoreAreas; + + /* Finish fb initialization */ + if (!fbFinishScreenInit (pScreen, + pScreenInfo->pfb, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + monitorResolution, monitorResolution, + pScreenInfo->dwStride, + pScreenInfo->dwBPP)) + { + ErrorF ("winFinishScreenInitFB () - fbFinishScreenInit failed\n"); + return FALSE; + } + + /* Save a pointer to the root visual */ + for (pVisual = pScreen->visuals; + pVisual->vid != pScreen->rootVisual; + pVisual++); + pScreenPriv->pRootVisual = pVisual; + + /* + * Setup points to the block and wakeup handlers. Pass a pointer + * to the current screen as pWakeupdata. + */ + pScreen->BlockHandler = winBlockHandler; + pScreen->WakeupHandler = winWakeupHandler; + pScreen->blockData = pScreen; + pScreen->wakeupData = pScreen; #ifdef RENDER /* Render extension initialization, calls miPictureInit */ - fbPictureInit (pScreen, NULL, 0); + if (!fbPictureInit (pScreen, NULL, 0)) + { + ErrorF ("winFinishScreenInitFB () - fbPictureInit () failed\n"); + return FALSE; + } #endif +#if WIN_LAYER_SUPPORT + /* KDrive does LayerStartInit right after fbPictureInit */ + if (!LayerStartInit (pScreen)) + { + ErrorF ("winFinishScreenInitFB () - LayerStartInit () failed\n"); + return FALSE; + } + + /* Not sure what we're adding to shadow, but add it anyway */ + if (!shadowAdd (pScreen, 0, pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) + { + ErrorF ("winFinishScreenInitFB () - shadowAdd () failed\n"); + return FALSE; + } + + /* KDrive does LayerFinishInit right after LayerStartInit */ + if (!LayerFinishInit (pScreen)) + { + ErrorF ("winFinishScreenInitFB () - LayerFinishInit () failed\n"); + return FALSE; + } + + /* KDrive does LayerCreate right after LayerFinishInit */ + pScreenPriv->pLayer = winLayerCreate (pScreen); + if (!pScreenPriv->pLayer) + { + ErrorF ("winFinishScreenInitFB () - winLayerCreate () failed\n"); + return FALSE; + } + + /* KDrive does RandRInit right after LayerCreate */ +#ifdef RANDR + if (pScreenInfo->dwDepth != 8 && !winRandRInit (pScreen)) + { + ErrorF ("winFinishScreenInitFB () - winRandRInit () failed\n"); + return FALSE; + } +#endif +#endif + + /* + * Backing store support should reduce network traffic and increase + * performance. + */ + miInitializeBackingStore (pScreen); + + /* KDrive does miDCInitialize right after miInitializeBackingStore */ /* Setup the cursor routines */ +#if CYGDEBUG + ErrorF ("winFinishScreenInitFB () - Calling miDCInitialize ()\n"); +#endif miDCInitialize (pScreen, &g_winPointerCursorFuncs); + /* KDrive does winCreateDefColormap right after miDCInitialize */ /* Create a default colormap */ - fReturn = fbCreateDefColormap (pScreen); - if (!fReturn) +#if CYGDEBUG + ErrorF ("winFinishScreenInitFB () - Calling winCreateDefColormap ()\n"); +#endif + if (!winCreateDefColormap (pScreen)) { ErrorF ("winFinishScreenInitFB () - Could not create colormap\n"); return FALSE; } +#if !WIN_LAYER_SUPPORT /* 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); +#if CYGDEBUG + ErrorF ("winFinishScreenInitFB () - Calling shadowInit ()\n"); +#endif + if (!shadowInit (pScreen, + pScreenPriv->pwinShadowUpdate, + NULL)) + { + ErrorF ("winFinishScreenInitFB () - shadowInit () failed\n"); + return FALSE; + } } - - /* - * Register our block and wakeup handlers; these procedures - * process messages in our Windows message queue; specifically, - * they process mouse and keyboard input. - */ - RegisterBlockAndWakeupHandlers (winBlockHandler, - winWakeupHandler, - pScreen); +#endif /* 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; - } +#if CYGDEBUG + ErrorF ("winFinishScreenInitFB () - returning\n"); +#endif return TRUE; } -/* See Porting Layer Definition - p. 33 */ -Bool -winSaveScreen (ScreenPtr pScreen, int on) -{ - return TRUE; -} /* * @@ -577,130 +366,84 @@ * */ + /* 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; + winScreenPriv(pScreen); + winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; 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)) + /* Ignore user input (mouse, keyboard) */ + pScreenInfo->fIgnoreInput = TRUE; + + /* Get device contexts for the screen and shadow bitmap */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + if (pScreenPriv->hdcScreen == NULL) + FatalError ("winFinishScreenInitNativeGDI () - Couldn't get a DC\n"); + + /* Init visuals */ + if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) { - ErrorF ("winFinishScreenInitNativeGDI () winAllocatePrivates failed\n"); + ErrorF ("winFinishScreenInitNativeGDI () - pwinInitVisuals 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); + /* Initialize the mi visuals */ + if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth, + &rootVisual, + ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8, + TrueColor)) + { + ErrorF ("winFinishScreenInitNativeGDI () - miInitVisuals () failed\n"); + return FALSE; + } - /* Copy the width and height into local variables */ - xsize = pScreenInfo->dwWidth; - ysize = pScreenInfo->dwHeight; + /* Initialize the CloseScreen procedure pointer */ + pScreen->CloseScreen = NULL; - /* 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; + /* Initialize the mi code */ + if (!miScreenInit (pScreen, + NULL, /* No framebuffer */ + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + monitorResolution, monitorResolution, + pScreenInfo->dwStride, + nRootDepth, nDepths, pDepths, rootVisual, + nVisuals, pVisuals)) + { + ErrorF ("winFinishScreenInitNativeGDI () - miScreenInit failed\n"); + return FALSE; + } - 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; + /* + * Register our block and wakeup handlers; these procedures + * process messages in our Windows message queue; specifically, + * they process mouse and keyboard input. + */ + pScreen->BlockHandler = winBlockHandler; + pScreen->WakeupHandler = winWakeupHandler; + pScreen->blockData = pScreen; + pScreen->wakeupData = pScreen; - /* 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; + /* Place our save screen function */ + pScreen->SaveScreen = winSaveScreen; - /* Fonts */ - pScreen->RealizeFont = winRealizeFontNativeGDI; - pScreen->UnrealizeFont = winUnrealizeFontNativeGDI; + /* Pixmaps */ + pScreen->CreatePixmap = winCreatePixmapNativeGDI; + pScreen->DestroyPixmap = winDestroyPixmapNativeGDI; /* 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; + pScreen->GetImage = miGetImage; + pScreen->GetSpans = winGetSpansNativeGDI; /* Window Procedures */ pScreen->CreateWindow = winCreateWindowNativeGDI; @@ -709,128 +452,83 @@ 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; + /* Paint window */ 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->CopyWindow = winCopyWindowNativeGDI; - pScreen->SendGraphicsExpose = miSendGraphicsExpose; + /* Fonts */ + pScreen->RealizeFont = winRealizeFontNativeGDI; + pScreen->UnrealizeFont = winUnrealizeFontNativeGDI; - /* Block and Wakeup Handlers */ - pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA; - pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA; - pScreen->blockData = (pointer) 0; - pScreen->wakeupData = (pointer) 0; + /* GC */ + pScreen->CreateGC = winCreateGCNativeGDI; - fprintf (stderr, "winScreenInit () - calling miInitVisuals()\n"); - if (!winInitVisualsNativeGDI (pScreen)) - { - ErrorF ("winScreenInit () - winInitVisuals returned FALSE\n"); - return FALSE; - } - else - { - ErrorF ("winScreenInit () - winInitVisuals returned TRUE\n"); - } + /* Colormap Routines */ + pScreen->CreateColormap = miInitializeColormap; + pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)()) NoopDDA; + pScreen->InstallColormap = miInstallColormap; + pScreen->UninstallColormap = miUninstallColormap; + pScreen->ListInstalledColormaps = miListInstalledColormaps; + pScreen->StoreColors = (StoreColorsProcPtr) (void (*)()) NoopDDA; + pScreen->ResolveColor = miResolveColor; - /* Visuals */ - pScreen->numDepths = nDepths; - pScreen->rootDepth = nRootDepth; - pScreen->allowedDepths = pDepths; - pScreen->rootVisual = rootVisual; - pScreen->numVisuals = nVisuals; - pScreen->visuals = pVisuals; + /* Bitmap */ + pScreen->BitmapToRegion = winPixmapToRegionNativeGDI; - ErrorF ("winScreenInit () - nDepths: %d, nRootDepth: %d, nVisuals: %d\n", - nDepths, nRootDepth, nVisuals); - - fprintf (stderr, "winScreenInit () - calling miSetZeroLineBias()\n"); - miSetZeroLineBias (pScreen, pScreenInfo->dwLineBias); + ErrorF ("winFinishScreenInitNativeGDI () - calling miDCInitialize\n"); - miPointerSetNewScreen (pScreenInfo->dwScreen, 0, 0); + /* Set the default white and black pixel positions */ + pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0; - ErrorF ("winScreenInit () - calling miDCInitialize()\n"); + /* Initialize the cursor */ if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs)) { - ErrorF ("winScreenInit () - miDCInitialize failed\n"); + ErrorF ("winFinishScreenInitNativeGDI () - miDCInitialize failed\n"); return FALSE; } - else + + /* Create a default colormap */ + if (!miCreateDefColormap (pScreen)) { - ErrorF ("winScreenInit () - miDCInitialize succeeded\n"); + ErrorF ("winFinishScreenInitNativeGDI () - miCreateDefColormap () " + "failed\n"); + return FALSE; } - ErrorF ("winScreenInit () - calling winCreateDefColormap()\n"); - fReturn = winCreateDefColormapNativeGDI (pScreen); - -#ifdef RENDER - ErrorF ("winScreenInit () - calling miPictureInit()\n"); - miPictureInit (pScreen, formats, nformats); -#endif + ErrorF ("winFinishScreenInitNativeGDI () - miCreateDefColormap () " + "returned\n"); - if (fReturn) - { - RegisterBlockAndWakeupHandlers (winBlockHandler, - winWakeupHandler, - NULL); - } - pScreenInfo->pScreen = pScreen; + /* mi doesn't use a CloseScreen procedure, so no need to wrap */ + pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; - miScreenDevPrivateInit (pScreen, xsize, pbits); + /* Tell the server that we are enabled */ + pScreenPriv->fEnabled = TRUE; - ErrorF ("winScreenInit () - Successful addition of Screen %p %p\n", - pScreen->devPrivate, + ErrorF ("winFinishScreenInitNativeGDI () - Successful addition of " + "screen %08x\n", pScreen); + + return TRUE; +} + - return fReturn; +/* See Porting Layer Definition - p. 33 */ +Bool +winSaveScreen (ScreenPtr pScreen, int on) +{ + return TRUE; } + PixmapPtr winGetWindowPixmap (WindowPtr pwin) { ErrorF ("winGetWindowPixmap ()\n"); return NULL; } + void winSetWindowPixmap (WindowPtr pwin, PixmapPtr pPix) Index: xc/programs/Xserver/hw/xwin/winsetsp.c diff -u xc/programs/Xserver/hw/xwin/winsetsp.c:1.1 xc/programs/Xserver/hw/xwin/winsetsp.c:1.7 --- xc/programs/Xserver/hw/xwin/winsetsp.c:1.1 Thu Apr 5 16:13:50 2001 +++ xc/programs/Xserver/hw/xwin/winsetsp.c Thu Nov 1 07:19:42 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winsetsp.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winsetsp.c,v 1.7 2001/11/01 12:19:42 alanh Exp $ */ #include "win.h" @@ -37,165 +37,308 @@ GCPtr pGC, char *pSrcs, DDXPointPtr pPoints, - int *pWidths, - int nSpans, + int *piWidths, + int iSpans, int fSorted) { -#if 0 - int iIdx = 0; - static int iCount = 0; - HBITMAP hBitmap = NULL; - char *pSrc = pSrcs; - int *pWidth = NULL; + winGCPriv(pGC); + PixmapPtr pPixmap = NULL; + winPrivPixmapPtr pPixmapPriv = NULL; + int iSpan; + int *piWidth = NULL; DDXPointPtr pPoint = NULL; + char *pSrc = pSrcs; 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); + BITMAPINFOHEADER *pbmih; + HBITMAP hBitmap = NULL; + HBITMAP hbmpOrig = NULL; + DEBUG_FN_NAME("winSetSpans"); + DEBUGVARS; + DEBUGPROC_MSG; - /* What kind of raster op have we got here? */ - switch (pGC->alu) + /* Branch on the drawable type */ + switch (pDrawable->type) { - 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"); + case DRAWABLE_PIXMAP: + pPixmap = (PixmapPtr) pDrawable; + pPixmapPriv = winGetPixmapPriv (pPixmap); + + /* Select the drawable pixmap into a DC */ + hbmpOrig = SelectObject (pGCPriv->hdcMem, pPixmapPriv->hBitmap); + if (hbmpOrig == NULL) + FatalError ("winSetSpans - DRAWABLE_PIXMAP - SelectObject () " + "failed on pPixmapPriv->hBitmap\n"); - /* Loop through spans */ - for (iIdx = 0; iIdx < nSpans; ++iIdx) + /* Branch on the raster operation type */ + switch (pGC->alu) { - pWidth = pWidths + iIdx; - pPoint = pPoints + iIdx; + case GXclear: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXclear\n"); + break; + + case GXand: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXand\n"); + break; + + case GXandReverse: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXandReverse\n"); + break; + + case GXcopy: + ErrorF ("winSetSpans - DRAWABLE_PIXMAP - GXcopy %08x\n", + pDrawable); + + /* Loop through spans */ + for (iSpan = 0; iSpan < iSpans; ++iSpan) + { + piWidth = piWidths + iSpan; + pPoint = pPoints + iSpan; - /* Blast the bits to the drawable */ - SetDIBits (g_hdcMem, ((PixmapPtr)pDrawable)->devPrivate.ptr, - pPoint->y, 1, pSrc, &bmih, 0); + /* Blast the bits to the drawable */ + SetDIBits (pGCPriv->hdcMem, + pPixmapPriv->hBitmap, + pPoint->y, 1, + pSrc, + (BITMAPINFO *) pPixmapPriv->pbmih, + 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); + /* Display some useful information */ + ErrorF ("(%dx%dx%d) (%d,%d) w: %d ps: %08x\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *piWidth, 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"); + /* Calculate offset of next bit source */ + pSrc += 4 * ((*piWidth + 31) / 32); + } - 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; + /* + * REMOVE - Visual verification only. + */ + BitBlt (pGCPriv->hdc, + pDrawable->width * 2, pDrawable->height, + pDrawable->width, pDrawable->height, + pGCPriv->hdcMem, + 0, 0, + SRCCOPY); + DEBUG_MSG ("DRAWABLE_PIXMAP - GXcopy"); + break; + + case GXandInverted: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXandInverted\n"); + break; + + case GXnoop: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXnoop\n"); + break; + + case GXxor: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXxor\n"); + break; + + case GXor: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXor\n"); + break; + + case GXnor: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXnor\n"); + break; + + case GXequiv: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXequiv\n"); + break; + + case GXinvert: + ErrorF ("winSetSpans - DRAWABLE_PIXMAP - GXinvert %08x\n", + pDrawable); - /* Create a DIB from span line */ - if (pDrawable->depth == 1) - { - hBitmap = CreateDIBitmap (NULL, &bmih, 0, pSrc, NULL, 0); - } - else + /* Create a temporary DC */ + hdcMem = CreateCompatibleDC (NULL); + + /* Loop through spans */ + for (iSpan = 0; iSpan < iSpans; ++iSpan) { - hBitmap = CreateDIBitmap (g_hdcMem, &bmih, 0, pSrc, NULL, 0); + piWidth = piWidths + iSpan; + pPoint = pPoints + iSpan; + + /* Create a one-line DIB for the bit data */ + hBitmap = winCreateDIBNativeGDI (*piWidth, 1, pDrawable->depth, + NULL, (BITMAPINFO **) &pbmih); + + /* Select the span line line bitmap into the temporary DC */ + hbmpOrig = SelectObject (hdcMem, hBitmap); + + /* Blast bit data to the one-line DIB */ + SetDIBits (hdcMem, hBitmap, + 0, 1, + pSrc, + (BITMAPINFO *) pbmih, + DIB_RGB_COLORS); + + /* Blit the span line to the drawable */ + BitBlt (pGCPriv->hdcMem, + pPoint->x, pPoint->y, + *piWidth, 1, + hdcMem, + 0, 0, + NOTSRCCOPY); + + /* + * REMOVE - Visual verification only. + */ + BitBlt (pGCPriv->hdc, + pDrawable->width, pDrawable->height + pPoint->y, + *piWidth, 1, + hdcMem, + 0, 0, + SRCCOPY); + + /* Display some useful information */ + ErrorF ("(%dx%dx%d) (%d,%d) w: %d ps: %08x\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *piWidth, pSrc); + + /* Calculate offset of next bit source */ + pSrc += 4 * ((*piWidth + 31) / 32); + + /* Pop the span line bitmap out of the memory DC */ + SelectObject (hdcMem, hbmpOrig); + + /* Free the temporary bitmap */ + DeleteObject (hBitmap); + hBitmap = NULL; } - 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; + /* + * REMOVE - Visual verification only. + */ + DEBUG_MSG ("DRAWABLE_PIXMAP - GXinvert - Prior to invert"); + BitBlt (pGCPriv->hdc, + pDrawable->width * 2, pDrawable->height, + pDrawable->width, pDrawable->height, + pGCPriv->hdcMem, + 0, 0, + SRCCOPY); + DEBUG_MSG ("DRAWABLE_PIXMAP - GXinvert - Finished invert"); + + /* Release the scratch DC */ + DeleteDC (hdcMem); + break; + + case GXorReverse: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXorReverse\n"); + break; + + case GXcopyInverted: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXcopyInverted\n"); + break; + + case GXorInverted: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXorInverted\n"); + break; + + case GXnand: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXnand\n"); + break; + + case GXset: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - GXset\n"); + break; + + default: + FatalError ("winSetSpans - DRAWABLE_PIXMAP - Unknown ROP\n"); + break; } - /* Release the scratch DC */ - DeleteDC (hdcMem); - - break; - case GXorReverse: - fprintf (stderr, "winSetSpans () - GXorReverse\n"); + /* Push the drawable pixmap out of the GC HDC */ + SelectObject (pGCPriv->hdcMem, hbmpOrig); break; - case GXcopyInverted: - fprintf (stderr, "winSetSpans () - GXcopyInverted\n"); + + case DRAWABLE_WINDOW: + FatalError ("\nwinSetSpansNativeGDI - DRAWABLE_WINDOW\n\n"); + + /* Branch on the raster operation type */ + switch (pGC->alu) + { + case GXclear: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXclear\n"); + break; + + case GXand: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXand\n"); + break; + + case GXandReverse: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXandReverse\n"); + break; + + case GXcopy: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXcopy\n"); + break; + + case GXandInverted: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXandInverted\n"); + break; + + case GXnoop: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXnoop\n"); + break; + + case GXxor: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXxor\n"); + break; + + case GXor: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXor\n"); + break; + + case GXnor: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXnor\n"); + break; + + case GXequiv: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXequiv\n"); + break; + + case GXinvert: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXinvert\n"); + break; + + case GXorReverse: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXorReverse\n"); + break; + + case GXcopyInverted: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXcopyInverted\n"); + break; + + case GXorInverted: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXorInverted\n"); + break; + + case GXnand: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXnand\n"); + break; + + case GXset: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - GXset\n"); + break; + + default: + ErrorF ("winSetSpans () - DRAWABLE_WINDOW - Unknown ROP\n"); + break; + } break; - case GXorInverted: - fprintf (stderr, "winSetSpans () - GXorInverted\n"); + + case UNDRAWABLE_WINDOW: + FatalError ("\nwinSetSpansNativeGDI - UNDRAWABLE_WINDOW\n\n"); break; - case GXnand: - fprintf (stderr, "winSetSpans () - GXnand\n"); + + case DRAWABLE_BUFFER: + FatalError ("\nwinSetSpansNativeGDI - DRAWABLE_BUFFER\n\n"); break; - case GXset: - fprintf (stderr, "winSetSpans () - GXset\n"); + default: - fprintf (stderr, "winSetSpans () - Unknown ROP\n"); + FatalError ("\nwinSetSpansNativeGDI - Unknown drawable type\n\n"); break; } -#endif } Index: xc/programs/Xserver/hw/xwin/winshaddd.c diff -u xc/programs/Xserver/hw/xwin/winshaddd.c:1.5 xc/programs/Xserver/hw/xwin/winshaddd.c:1.19 --- xc/programs/Xserver/hw/xwin/winshaddd.c:1.5 Mon May 14 12:52:33 2001 +++ xc/programs/Xserver/hw/xwin/winshaddd.c Wed Nov 21 03:51:24 2001 @@ -30,11 +30,29 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshaddd.c,v 1.19 2001/11/21 08:51:24 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_IDirectDraw2 +DEFINE_GUID( IID_IDirectDraw2,0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +#endif /* IID_IDirectDraw2 */ + +/* * Create a DirectDraw surface for the shadow framebuffer; also create * a primary surface object so we can blit to the display. * @@ -60,7 +78,8 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not create clipper\n"); + ErrorF ("winAllocateFBShadowDD () - Could not create clipper: %08x\n", + ddrval); return FALSE; } @@ -74,7 +93,9 @@ pScreenPriv->hwndScreen); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Clipper not attached to window\n"); + ErrorF ("winAllocateFBShadowDD () - Clipper not attached to " + "window: %08x\n", + ddrval); return FALSE; } @@ -84,9 +105,10 @@ /* Create a DirectDraw object, store the address at lpdd */ ddrval = DirectDrawCreate (NULL, &pScreenPriv->pdd, NULL); - if (ddrval != DD_OK) + if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Could not start DirectDraw\n"); + ErrorF ("winAllocateFBShadowDD () - Could not start DirectDraw: %08x\n", + ddrval); return FALSE; } @@ -94,43 +116,123 @@ ErrorF ("winAllocateFBShadowDD () - Created and initialized DD\n"); #endif + /* Get a DirectDraw2 interface pointer */ + ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, + &IID_IDirectDraw2, + (LPVOID*) &pScreenPriv->pdd2); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD () - Failed DD2 query: %08x\n", + ddrval); + return FALSE; + } + /* FIXME: If we are full screen we don't need the clipper */ if (pScreenInfo->fFullScreen) { + DDSURFACEDESC ddsdCurrent; + DWORD dwRefreshRateCurrent = 0; + HDC hdc = NULL; + /* Set the cooperative level to full screen */ - ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, - pScreenPriv->hwndScreen, - DDSCL_EXCLUSIVE - | DDSCL_FULLSCREEN); + ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, + pScreenPriv->hwndScreen, + DDSCL_EXCLUSIVE + | DDSCL_FULLSCREEN); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ - "cooperative level\n"); + ErrorF ("winAllocateFBShadowDD () - Could not set "\ + "cooperative level: %08x\n", + ddrval); 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; - } + /* + * We only need to get the current refresh rate for comparison + * if a refresh rate has been passed on the command line. + */ + if (pScreenInfo->dwRefreshRate != 0) + { + ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent)); + ddsdCurrent.dwSize = sizeof (ddsdCurrent); + + /* Get information about current display settings */ + ddrval = IDirectDraw2_GetDisplayMode (pScreenPriv->pdd2, + &ddsdCurrent); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD () - Could not get current " + "refresh rate: %08x. Continuing.\n", + ddrval); + dwRefreshRateCurrent = 0; + } + else + { + /* Grab the current refresh rate */ + dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate; + } + } + + /* Clean up the refresh rate */ + if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) + { + /* + * Refresh rate is non-specified or equal to current. + */ + pScreenInfo->dwRefreshRate = 0; + } + + /* Grab a device context for the screen */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAllocateFBShadowDD () - GetDC () failed\n"); + return FALSE; + } + + /* Only change the video mode when different than current mode */ + if (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) + || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) + || pScreenInfo->dwDepth != GetDeviceCaps (hdc, BITSPIXEL) + || pScreenInfo->dwRefreshRate != 0) + { + ErrorF ("winAllocateFBShadowDD () - Changing video mode\n"); + + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth, + pScreenInfo->dwRefreshRate, + 0); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD () - Could not set "\ + "full screen display mode: %08x\n", + ddrval); + return FALSE; + } + } + else + { + ErrorF ("winAllocateFBShadowDD () - Not changing video mode\n"); + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + hdc = NULL; } else { /* Set the cooperative level for windowed mode */ - ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, - pScreenPriv->hwndScreen, - DDSCL_NORMAL); + ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ - "cooperative level\n"); + ErrorF ("winAllocateFBShadowDD () - Could not set "\ + "cooperative level: %08x\n", + ddrval); return FALSE; } } @@ -142,14 +244,14 @@ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; /* Create the primary surface */ - ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, - &ddsd, - &pScreenPriv->pddsPrimary, - NULL); + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDD () - Could not create primary "\ - "surface %08x\n", ddrval); + "surface: %08x\n", ddrval); return FALSE; } @@ -161,11 +263,13 @@ * Attach a clipper to the primary surface that will clip our blits to our * display window. */ - ddrval = IDirectDrawSurface_SetClipper (pScreenPriv->pddsPrimary, - pScreenPriv->pddcPrimary); + ddrval = IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, + pScreenPriv->pddcPrimary); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDD () - Primary attach clipper failed\n"); + ErrorF ("winAllocateFBShadowDD () - Primary attach clipper " + "failed: %08x\n", + ddrval); return FALSE; } @@ -189,11 +293,11 @@ ddsd.dwWidth = pScreenInfo->dwWidth; /* Create the shadow surface */ - ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, - &ddsd, - &pScreenPriv->pddsShadow, - NULL); - if (ddrval != DD_OK) + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsShadow, + NULL); + if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDD () - Could not create shadow "\ "surface: %08x\n", ddrval); @@ -220,12 +324,12 @@ #endif /* Lock the shadow surface */ - ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, - NULL, - pddsdShadow, - DDLOCK_WAIT, - NULL); - if (ddrval != DD_OK || pddsdShadow->lpSurface == NULL) + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, + NULL, + pddsdShadow, + DDLOCK_WAIT, + NULL); + if (FAILED (ddrval) || pddsdShadow->lpSurface == NULL) { ErrorF ("winAllocateFBShadowDD () - Could not lock shadow "\ "surface: %08x\n", ddrval); @@ -244,13 +348,13 @@ } /* Grab the pitch, and memory pointer from the surface desc */ - pScreenInfo->dwStrideBytes = pddsdShadow->u.lPitch; + pScreenInfo->dwStrideBytes = pddsdShadow->u1.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; + pScreenInfo->dwDepth = pddsdShadow->ddpfPixelFormat.u1.dwRGBBitCount; pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask; pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask; pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask; @@ -267,11 +371,11 @@ */ void winShadowUpdateDD (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) + shadowBufPtr pBuf) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RegionPtr damage = &pBuf->damage; HRESULT ddrval = DD_OK; RECT rcClient, rcDest, rcSrc; DWORD dwBox = REGION_NUM_RECTS (damage); @@ -287,7 +391,7 @@ (LPPOINT)&rcClient, 2); /* Unlock the shadow surface, so we can blit */ - ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); + ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); if (FAILED (ddrval)) { ErrorF ("winShadowUpdateProcDD () - Unlock failed\n"); @@ -310,23 +414,23 @@ rcDest.bottom = rcClient.top + rcSrc.bottom; /* Blit the damaged areas */ - ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary, - &rcDest, - pScreenPriv->pddsShadow, - &rcSrc, - DDBLT_WAIT, - NULL); + ddrval = IDirectDrawSurface2_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); + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); if (FAILED (ddrval)) { ErrorF ("winShadowUpdateProcDD () - Lock failed\n"); @@ -357,46 +461,6 @@ } /* - * 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. @@ -426,30 +490,33 @@ /* Free the shadow surface, if there is one */ if (pScreenPriv->pddsShadow) { - IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); - IDirectDrawSurface_Release (pScreenPriv->pddsShadow); + IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); + IDirectDrawSurface2_Release (pScreenPriv->pddsShadow); pScreenPriv->pddsShadow = NULL; } /* Release the primary surface, if there is one */ if (pScreenPriv->pddsPrimary) { - IDirectDrawSurface_Release (pScreenPriv->pddsPrimary); + IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); pScreenPriv->pddsPrimary = NULL; } + /* Free the DirectDraw2 object, if there is one */ + if (pScreenPriv->pdd2) + { + IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2); + IDirectDraw2_Release (pScreenPriv->pdd2); + pScreenPriv->pdd2 = 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) { @@ -489,18 +556,21 @@ dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); /* Store the maximum number of ones in a color mask as the bitsPerRGB */ - if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0) + pScreenPriv->dwBitsPerRGB = 8; + else 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", + ErrorF ("winInitVisualsShadowDD () - Masks %08x %08x %08x BPRGB %d d %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask, - pScreenPriv->dwBitsPerRGB); + pScreenPriv->dwBitsPerRGB, + pScreenInfo->dwDepth); /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) @@ -509,6 +579,7 @@ case 24: case 16: case 15: + /* Create the real visual */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, TrueColorMask, pScreenPriv->dwBitsPerRGB, @@ -524,26 +595,20 @@ break; case 8: -#if CYGDEBUG - ErrorF ("winInitVisualsShadowDD () - Calling "\ - "miSetVisualTypesAndMasks\n"); -#endif /* CYGDEBUG */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - PseudoColorMask, + pScreenInfo->fFullScreen + ? PseudoColorMask : StaticColorMask, pScreenPriv->dwBitsPerRGB, - PseudoColor, + pScreenInfo->fFullScreen + ? PseudoColor : StaticColor, pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - ErrorF ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks "\ - "failed\n"); + ErrorF ("winInitVisualsShadowDD () - "\ + "miSetVisualTypesAndMasks failed\n"); return FALSE; } -#if CYGDEBUG - ErrorF ("winInitVisualsShadowDD () - Returned from "\ - "miSetVisualTypesAndMasks\n"); -#endif /* CYGDEBUG */ break; default: @@ -551,11 +616,9 @@ return FALSE; } - /* Set DPI info */ - pScreenInfo->dwDPIx = 100; - pScreenInfo->dwDPIy = 100; - +#if CYGDEBUG ErrorF ("winInitVisualsShadowDD () - Returning\n"); +#endif return TRUE; } @@ -568,13 +631,6 @@ 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) @@ -586,17 +642,45 @@ /* Query GDI for current display depth */ dwDepth = GetDeviceCaps (hdc, BITSPIXEL); - /* Is GDI using a depth different than command line parameter? */ - if (dwDepth != pScreenInfo->dwDepth) + /* DirectDraw can only change the depth in fullscreen mode */ + if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) { - /* Warn user if GDI depth is different than depth specified */ - ErrorF ("winAdjustVideoModeShadowDD () - Command line depth: %d, "\ - "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + /* No -depth parameter passed, let the user know the depth being used */ + ErrorF ("winAdjustVideoModeShadowDD () - Using Windows display " + "depth of %d bits per pixel\n", dwDepth); + /* Use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + else if (pScreenInfo->fFullScreen + && pScreenInfo->dwDepth != dwDepth) + { + /* FullScreen, and GDI depth differs from -depth parameter */ + ErrorF ("winAdjustVideoModeShadowDD () - FullScreen, using command line " + "depth: %d\n", pScreenInfo->dwDepth); + } + else if (dwDepth != pScreenInfo->dwDepth) + { + /* Windowed, and GDI depth differs from -depth parameter */ + ErrorF ("winAdjustVideoModeShadowDD () - Windowed, command line depth: " + "%d, using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + /* We'll use GDI's depth */ pScreenInfo->dwDepth = dwDepth; } + /* See if the shadow bitmap will be larger than the DIB size limit */ + if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwDepth + >= WIN_DIB_MAXIMUM_SIZE) + { + ErrorF ("winAdjustVideoModeShadowDD () - Requested DirectDraw surface " + "will be larger than %d MB. The surface may fail to be " + "allocated on Windows 95, 98, or Me, due to a %d MB limit in " + "DIB size. This limit does not apply to Windows NT/2000, and " + "this message may be ignored on those platforms.\n", + WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); + } + /* Release our DC */ ReleaseDC (NULL, hdc); return TRUE; @@ -613,23 +697,44 @@ PAINTSTRUCT ps; HRESULT ddrval = DD_OK; Bool fReturn = TRUE; + Bool fLocked = TRUE; /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); - + if (hdcUpdate == NULL) + { + ErrorF ("winBltExposedRegionsShadowDD () - BeginPaint () returned " + "a NULL device context handle. Aborting blit attempt.\n"); + return FALSE; + } + /* Unlock the shadow surface, so we can blit */ - ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); + ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); if (FAILED (ddrval)) { fReturn = FALSE; goto winBltExposedRegionsShadowDD_Exit; } - + else + { + /* Flag that we have unlocked the shadow surface */ + fLocked = FALSE; + } + /* Get client area in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); + fReturn = GetClientRect (pScreenPriv->hwndScreen, &rcClient); + if (!fReturn) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDD () - GetClientRect () failed\n"); + goto winBltExposedRegionsShadowDD_Exit; + } + + /* Map the client coords to screen coords */ MapWindowPoints (pScreenPriv->hwndScreen, HWND_DESKTOP, - (LPPOINT)&rcClient, 2); + (LPPOINT)&rcClient, + 2); /* Source can be enter shadow surface, as Blt should clip */ rcSrc.left = 0; @@ -638,24 +743,37 @@ 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); + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDD () - Blt from shadow to primary " + " failed\n"); + } /* Relock the shadow surface */ - ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, - NULL, - pScreenPriv->pddsdShadow, - DDLOCK_WAIT, - NULL); + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); if (FAILED (ddrval)) { fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDD () - IDirectDrawSurface2_Lock " + "failed\n"); goto winBltExposedRegionsShadowDD_Exit; } + else + { + /* Indicate that we have relocked the shadow surface */ + fLocked = TRUE; + } /* Has our memory pointer changed? */ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) @@ -666,6 +784,26 @@ /* EndPaint frees the DC */ if (hdcUpdate != NULL) EndPaint (pScreenPriv->hwndScreen, &ps); + + /* + * Relock the surface if it is not locked. We don't care if locking fails, + * as it will cause the server to shutdown within a few more operations. + */ + if (!fLocked) + { + IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); + + /* Has our memory pointer changed? */ + if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdShadow->lpSurface); + + fLocked = TRUE; + } return fReturn; } @@ -685,12 +823,207 @@ ) { /* Primary surface was lost, restore it */ - IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary); + IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); + } + + return TRUE; +} + + +/* + * Reblit the shadow framebuffer to the screen. + */ + +Bool +winRedrawScreenShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + RECT rcClient, rcSrc; + + /* Get location of display window's client area, in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Source can be entire shadow surface, as Blt should clip for us */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Redraw the whole window, to take account for the new colors */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winRedrawScreenShadowDD () - IDirectDrawSurface_Blt () " + "failed: %08x\n", + ddrval); + } + + return TRUE; +} + + +/* Realize the currently installed colormap */ +Bool +winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen) +{ + return TRUE; +} + + +/* Install the specified colormap */ +Bool +winInstallColormapShadowDD (ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + HRESULT ddrval = DD_OK; + + /* Install the DirectDraw palette on the primary surface */ + ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary, + pCmapPriv->lpDDPalette); + if (FAILED (ddrval)) + { + ErrorF ("winInstallColormapShadowDD () - Failed installing the " + "DirectDraw palette.\n"); + return FALSE; + } + + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; + + return TRUE; +} + + +/* Store the specified colors in the specified colormap */ +Bool +winStoreColorsShadowDD (ColormapPtr pColormap, + int ndef, + xColorItem *pdefs) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + HRESULT ddrval = DD_OK; + + /* Put the X colormap entries into the Windows logical palette */ + ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette, + 0, + pdefs[0].pixel, + ndef, + pCmapPriv->peColors + + pdefs[0].pixel); + if (FAILED (ddrval)) + { + ErrorF ("winStoreColorsShadowDDNL () - SetEntries () failed\n"); + return FALSE; + } + + /* Don't install the DirectDraw palette if the colormap is not installed */ + if (pColormap != curpmap) + { + return TRUE; + } + + if (!winInstallColormapShadowDD (pColormap)) + { + ErrorF ("winStoreColorsShadowDDNL () - Failed installing colormap\n"); + return FALSE; } return TRUE; } + +/* Colormap initialization procedure */ +Bool +winCreateColormapShadowDD (ColormapPtr pColormap) +{ + HRESULT ddrval = DD_OK; + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + + /* Create a DirectDraw palette */ + ddrval = IDirectDraw2_CreatePalette (pScreenPriv->pdd, + DDPCAPS_8BIT | DDPCAPS_ALLOW256, + pCmapPriv->peColors, + &pCmapPriv->lpDDPalette, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winCreateColormapShadowDDNL () - CreatePalette failed\n"); + return FALSE; + } + + return TRUE; +} + + +/* Colormap destruction procedure */ +Bool +winDestroyColormapShadowDD (ColormapPtr pColormap) +{ + winScreenPriv(pColormap->pScreen); + winCmapPriv(pColormap); + HRESULT ddrval = DD_OK; + + /* + * Is colormap to be destroyed the default? + * + * Non-default colormaps should have had winUninstallColormap + * called on them before we get here. The default colormap + * will not have had winUninstallColormap called on it. Thus, + * we need to handle the default colormap in a special way. + */ + if (pColormap->flags & IsDefault) + { +#if CYGDEBUG + ErrorF ("winDestroyColormapShadowDDNL () - Destroying default " + "colormap\n"); +#endif + + /* + * FIXME: Walk the list of all screens, popping the default + * palette out of each screen device context. + */ + + /* Pop the palette out of the primary surface */ + ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winDestroyColormapShadowDDNL () - Failed freeing the " + "default colormap DirectDraw palette.\n"); + return FALSE; + } + + /* Clear our private installed colormap pointer */ + pScreenPriv->pcmapInstalled = NULL; + } + + /* Release the palette */ + IDirectDrawPalette_Release (pCmapPriv->lpDDPalette); + + /* Invalidate the colormap privates */ + pCmapPriv->lpDDPalette = NULL; + + return TRUE; +} + + /* Set engine specific functions */ Bool winSetEngineFunctionsShadowDD (ScreenPtr pScreen) @@ -701,7 +1034,6 @@ /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD; pScreenPriv->pwinShadowUpdate = winShadowUpdateDD; - pScreenPriv->pwinShadowWindow = winShadowWindowDD; pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD; pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD; @@ -712,6 +1044,14 @@ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDD; pScreenPriv->pwinActivateApp = winActivateAppShadowDD; + pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDD; + pScreenPriv->pwinRealizeInstalledPalette + = winRealizeInstalledPaletteShadowDD; + pScreenPriv->pwinInstallColormap = winInstallColormapShadowDD; + pScreenPriv->pwinStoreColors = winStoreColorsShadowDD; + pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD; + pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabPtr) (void (*)())NoopDDA; return TRUE; } Index: xc/programs/Xserver/hw/xwin/winshadddnl.c diff -u xc/programs/Xserver/hw/xwin/winshadddnl.c:1.5 xc/programs/Xserver/hw/xwin/winshadddnl.c:1.20 --- xc/programs/Xserver/hw/xwin/winshadddnl.c:1.5 Mon May 14 12:52:33 2001 +++ xc/programs/Xserver/hw/xwin/winshadddnl.c Wed Nov 21 03:51:24 2001 @@ -30,7 +30,7 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadddnl.c,v 1.20 2001/11/21 08:51:24 alanh Exp $ */ #include "win.h" @@ -81,7 +81,7 @@ ErrorF ("winAllocateFBShadowDDNL () - Could not allocate bits\n"); return FALSE; } - + /* * Initialize the framebuffer memory so we don't get a * strange display at startup @@ -94,7 +94,8 @@ NULL); if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not attach clipper\n"); + ErrorF ("winAllocateFBShadowDDNL () - Could not attach clipper: %08x\n", + ddrval); return FALSE; } @@ -109,7 +110,8 @@ if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDDNL () - Clipper not attached "\ - "to window\n"); + "to window: %08x\n", + ddrval); return FALSE; } @@ -121,9 +123,11 @@ ddrval = DirectDrawCreate (NULL, (LPDIRECTDRAW*) &pScreenPriv->pdd, NULL); - if (ddrval != DD_OK) + if (FAILED (ddrval)) { - ErrorF ("winAllocateFBShadowDDNL () - Could not start DirectDraw\n"); + ErrorF ("winAllocateFBShadowDDNL () - Could not start " + "DirectDraw: %08x\n", + ddrval); return FALSE; } @@ -146,40 +150,109 @@ /* FIXME: If we are full screen we don't need the clipper */ if (pScreenInfo->fFullScreen) { + DDSURFACEDESC2 ddsdCurrent; + DWORD dwRefreshRateCurrent = 0; + HDC hdc = NULL; + /* Set the cooperative level to full screen */ - ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd4, - pScreenPriv->hwndScreen, - DDSCL_EXCLUSIVE - | DDSCL_FULLSCREEN); + ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4, + pScreenPriv->hwndScreen, + DDSCL_EXCLUSIVE + | DDSCL_FULLSCREEN); if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ - "cooperative level\n"); + "cooperative level: %08x\n", + ddrval); + return FALSE; + } + + /* + * We only need to get the current refresh rate for comparison + * if a refresh rate has been passed on the command line. + */ + if (pScreenInfo->dwRefreshRate != 0) + { + ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent)); + ddsdCurrent.dwSize = sizeof (ddsdCurrent); + + /* Get information about current display settings */ + ddrval = IDirectDraw4_GetDisplayMode (pScreenPriv->pdd4, + &ddsdCurrent); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not get current " + "refresh rate: %08x. Continuing.\n", + ddrval); + dwRefreshRateCurrent = 0; + } + else + { + /* Grab the current refresh rate */ + dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate; + } + } + + /* Clean up the refresh rate */ + if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) + { + /* + * Refresh rate is non-specified or equal to current. + */ + pScreenInfo->dwRefreshRate = 0; + } + + /* Grab a device context for the screen */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAllocateFBShadowDDNL () - GetDC () failed\n"); return FALSE; } + + /* Only change the video mode when different than current mode */ + if (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) + || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) + || pScreenInfo->dwDepth != GetDeviceCaps (hdc, BITSPIXEL) + || pScreenInfo->dwRefreshRate != 0) + { + ErrorF ("winAllocateFBShadowDDNL () - Changing video mode\n"); - /* 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; - } + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth, + pScreenInfo->dwRefreshRate, + 0); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "full screen display mode: %08x\n", + ddrval); + return FALSE; + } + } + else + { + ErrorF ("winAllocateFBShadowDDNL () - Not changing video mode\n"); + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + hdc = NULL; } else { /* Set the cooperative level for windowed mode */ - ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd4, - pScreenPriv->hwndScreen, - DDSCL_NORMAL); + ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ - "cooperative level\n"); + "cooperative level: %08x\n", + ddrval); return FALSE; } } @@ -191,15 +264,15 @@ ddsdPrimary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; /* Create the primary surface */ - ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd4, - (LPDDSURFACEDESC)&ddsdPrimary, - (LPDIRECTDRAWSURFACE*) - &pScreenPriv->pddsPrimary4, - NULL); + ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, + &ddsdPrimary, + &pScreenPriv->pddsPrimary4, + NULL); if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDDNL () - Could not create primary "\ - "surface %08x\n", ddrval); + "surface: %08x\n", + ddrval); return FALSE; } @@ -210,12 +283,13 @@ /* Get primary surface's pixel format */ ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary)); ddpfPrimary.dwSize = sizeof (ddpfPrimary); - ddrval = IDirectDrawSurface_GetPixelFormat (pScreenPriv->pddsPrimary4, + ddrval = IDirectDrawSurface4_GetPixelFormat (pScreenPriv->pddsPrimary4, &ddpfPrimary); if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDDNL () - Could not get primary "\ - "pixformat\n"); + "pixformat: %08x\n", + ddrval); return FALSE; } @@ -229,12 +303,13 @@ #endif /* Attach our clipper to our primary surface handle */ - ddrval = IDirectDrawSurface_SetClipper (pScreenPriv->pddsPrimary4, + ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, pScreenPriv->pddcPrimary); if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDDNL () - Primary attach clipper "\ - "failed\n"); + "failed: %08x\n", + ddrval); return FALSE; } @@ -259,26 +334,28 @@ ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; ddsdShadow.dwHeight = pScreenInfo->dwHeight; ddsdShadow.dwWidth = pScreenInfo->dwWidth; - ddsdShadow.u.lPitch = pScreenInfo->dwPaddedWidth; + ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth; ddsdShadow.lpSurface = lpSurface; - ddsdShadow.ddpfPixelFormat = ddpfPrimary; + ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary; + ErrorF ("winAllocateFBShadowDDNL () - lPitch: %d\n", + pScreenInfo->dwPaddedWidth); + /* Create the shadow surface */ - ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd4, - (LPDDSURFACEDESC)&ddsdShadow, - (LPDIRECTDRAWSURFACE*) - &pScreenPriv->pddsShadow4, - NULL); - if (ddrval != DD_OK) + ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, + &ddsdShadow, + &pScreenPriv->pddsShadow4, + NULL); + if (FAILED (ddrval)) { ErrorF ("winAllocateFBShadowDDNL () - Could not create shadow "\ - "surface %08x\n", ddrval); + "surface: %08x\n", ddrval); return FALSE; } #if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Created shadow pitch: %d\n", - ddsdShadow.u.lPitch); + ddsdShadow.u1.lPitch); #endif /* Grab the pitch, and memory pointer from the surface desc */ @@ -288,10 +365,10 @@ 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; + pScreenInfo->dwDepth = ddsdShadow.u4.ddpfPixelFormat.u1.dwRGBBitCount; + pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask; #if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Returning\n"); @@ -305,11 +382,11 @@ */ void winShadowUpdateDDNL (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) + shadowBufPtr pBuf) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RegionPtr damage = &pBuf->damage; HRESULT ddrval = DD_OK; RECT rcClient, rcDest, rcSrc; DWORD dwBox = REGION_NUM_RECTS (damage); @@ -333,68 +410,32 @@ rcSrc.right = pBox->x2; rcSrc.bottom = pBox->y2; - /* Calculate destination rectange */ + /* Calculate destination rectangle */ 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); - + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winShadowUpdateDDNL () - IDirectDrawSurface4_Blt () " + "failed: %08x\n", + ddrval); + } + /* 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. @@ -406,7 +447,7 @@ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn; -#if CYGDEBUG +#if 1 ErrorF ("winCloseScreenShadowDDNL () - Freeing screen resources\n"); #endif @@ -424,7 +465,7 @@ /* Free the shadow surface, if there is one */ if (pScreenPriv->pddsShadow4) { - IDirectDrawSurface_Release (pScreenPriv->pddsShadow4); + IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4); xfree (pScreenInfo->pfb); pScreenInfo->pfb = NULL; pScreenPriv->pddsShadow4 = NULL; @@ -433,29 +474,25 @@ /* Release the primary surface, if there is one */ if (pScreenPriv->pddsPrimary4) { - IDirectDrawSurface_Release (pScreenPriv->pddsPrimary4); + IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4); pScreenPriv->pddsPrimary4 = NULL; } + /* Free the DirectDraw4 object, if there is one */ + if (pScreenPriv->pdd4) + { + IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4); + IDirectDraw4_Release (pScreenPriv->pdd4); + pScreenPriv->pdd4 = 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) { @@ -492,14 +529,16 @@ dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); /* Store the maximum number of ones in a color mask as the bitsPerRGB */ - if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0) + pScreenPriv->dwBitsPerRGB = 8; + else 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", + ErrorF ("winInitVisualsShadowDDNL () - Masks %08x %08x %08x BPRGB %d d %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask, @@ -513,6 +552,7 @@ case 24: case 16: case 15: + /* Setup the real visual */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, TrueColorMask, pScreenPriv->dwBitsPerRGB, @@ -528,14 +568,12 @@ break; case 8: -#if CYGDEBUG - ErrorF ("winInitVisualsShadowDDNL () - Calling "\ - "miSetVisualTypesAndMasks\n"); -#endif /* CYGDEBUG */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - PseudoColorMask, + pScreenInfo->fFullScreen + ? PseudoColorMask : StaticColorMask, pScreenPriv->dwBitsPerRGB, - PseudoColor, + pScreenInfo->fFullScreen + ? PseudoColor : StaticColor, pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) @@ -550,12 +588,10 @@ ErrorF ("winInitVisualsDDNL () - Unknown screen depth\n"); return FALSE; } - - /* Set DPI info */ - pScreenInfo->dwDPIx = 100; - pScreenInfo->dwDPIy = 100; +#if CYGDEBUG ErrorF ("winInitVisualsShadowDDNL () - Returning\n"); +#endif return TRUE; } @@ -568,13 +604,6 @@ 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) @@ -585,17 +614,46 @@ /* Query GDI for current display depth */ dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* DirectDraw can only change the depth in fullscreen mode */ + if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + { + /* No -depth parameter passed, let the user know the depth being used */ + ErrorF ("winAdjustVideoModeShadowDDNL () - Using Windows display " + "depth of %d bits per pixel\n", dwDepth); - /* Is GDI using a depth different than command line parameter? */ - if (dwDepth != pScreenInfo->dwDepth) + /* Use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + else if (pScreenInfo->fFullScreen + && pScreenInfo->dwDepth != dwDepth) { - /* Warn user if GDI depth is different than depth specified */ - ErrorF ("winAdjustVideoModeShadowDDNL () - Command line depth: %d, "\ - "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + /* FullScreen, and GDI depth differs from -depth parameter */ + ErrorF ("winAdjustVideoModeShadowDDNL () - FullScreen, using command " + "line depth: %d\n", pScreenInfo->dwDepth); + } + else if (dwDepth != pScreenInfo->dwDepth) + { + /* Windowed, and GDI depth differs from -depth parameter */ + ErrorF ("winAdjustVideoModeShadowDDNL () - Windowed, command line " + "depth: %d, using depth: %d\n", + pScreenInfo->dwDepth, dwDepth); /* We'll use GDI's depth */ pScreenInfo->dwDepth = dwDepth; } + + /* See if the shadow bitmap will be larger than the DIB size limit */ + if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwDepth + >= WIN_DIB_MAXIMUM_SIZE) + { + ErrorF ("winAdjustVideoModeShadowDDNL () - Requested DirectDraw surface " + "will be larger than %d MB. The surface may fail to be " + "allocated on Windows 95, 98, or Me, due to a %d MB limit in " + "DIB size. This limit does not apply to Windows NT/2000, and " + "this message may be ignored on those platforms.\n", + WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); + } /* Release our DC */ ReleaseDC (NULL, hdc); @@ -613,34 +671,59 @@ HDC hdcUpdate; 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); + if (hdcUpdate == NULL) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDDNL () - BeginPaint () returned " + "a NULL device context handle. Aborting blit attempt.\n"); + goto winBltExposedRegionsShadowDDNL_Exit; + } /* Get client area in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); + fReturn = GetClientRect (pScreenPriv->hwndScreen, &rcClient); + if (!fReturn) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDDNL () - GetClientRect () failed\n"); + goto winBltExposedRegionsShadowDDNL_Exit; + } + + /* Map the client coords to screen coords */ MapWindowPoints (pScreenPriv->hwndScreen, HWND_DESKTOP, - (LPPOINT)&rcClient, 2); + (LPPOINT)&rcClient, + 2); - /* Source can be enter shadow surface, as Blt should clip */ + /* Source can be entire shadow surface, as Blt should clip for us */ 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); + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcClient, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDDNL () - IDirectDrawSurface_Blt " + "failed: %08x %d\n", ddrval, ddrval); + goto winBltExposedRegionsShadowDDNL_Exit; + } + winBltExposedRegionsShadowDDNL_Exit: /* EndPaint frees the DC */ - EndPaint (pScreenPriv->hwndScreen, &ps); - - return TRUE; + if (hdcUpdate != NULL) + EndPaint (pScreenPriv->hwndScreen, &ps); + return fReturn; } Bool @@ -659,12 +742,206 @@ ) { /* Primary surface was lost, restore it */ - IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary4); + IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4); + } + + return TRUE; +} + + +/* + * Reblit the shadow framebuffer to the screen. + */ + +Bool +winRedrawScreenShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + RECT rcClient, rcSrc; + + /* Get location of display window's client area, in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Source can be entire shadow surface, as Blt should clip for us */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Redraw the whole window, to take account for the new colors */ + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcClient, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winRedrawScreenShadowDDNL () - IDirectDrawSurface4_Blt () " + "failed: %08x\n", + ddrval); + } + + return TRUE; +} + + +/* Realize the currently installed colormap */ +Bool +winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen) +{ + return TRUE; +} + +/* Install the specified colormap */ +Bool +winInstallColormapShadowDDNL (ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + HRESULT ddrval = DD_OK; + + /* Install the DirectDraw palette on the primary surface */ + ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4, + pCmapPriv->lpDDPalette); + if (FAILED (ddrval)) + { + ErrorF ("winInstallColormapShadowDDNL () - Failed installing the " + "DirectDraw palette.\n"); + return FALSE; } + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; + return TRUE; } + +/* Store the specified colors in the specified colormap */ +Bool +winStoreColorsShadowDDNL (ColormapPtr pColormap, + int ndef, + xColorItem *pdefs) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + HRESULT ddrval = DD_OK; + + /* Put the X colormap entries into the Windows logical palette */ + ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette, + 0, + pdefs[0].pixel, + ndef, + pCmapPriv->peColors + + pdefs[0].pixel); + if (FAILED (ddrval)) + { + ErrorF ("winStoreColorsShadowDDNL () - SetEntries () failed\n"); + return FALSE; + } + + /* Don't install the DirectDraw palette if the colormap is not installed */ + if (pColormap != curpmap) + { + return TRUE; + } + + if (!winInstallColormapShadowDDNL (pColormap)) + { + ErrorF ("winStoreColorsShadowDDNL () - Failed installing colormap\n"); + return FALSE; + } + + return TRUE; +} + + +/* Colormap initialization procedure */ +Bool +winCreateColormapShadowDDNL (ColormapPtr pColormap) +{ + HRESULT ddrval = DD_OK; + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + + /* Create a DirectDraw palette */ + ddrval = IDirectDraw4_CreatePalette (pScreenPriv->pdd4, + DDPCAPS_8BIT | DDPCAPS_ALLOW256, + pCmapPriv->peColors, + &pCmapPriv->lpDDPalette, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winCreateColormapShadowDDNL () - CreatePalette failed\n"); + return FALSE; + } + + return TRUE; +} + + +/* Colormap destruction procedure */ +Bool +winDestroyColormapShadowDDNL (ColormapPtr pColormap) +{ + winScreenPriv(pColormap->pScreen); + winCmapPriv(pColormap); + HRESULT ddrval = DD_OK; + + /* + * Is colormap to be destroyed the default? + * + * Non-default colormaps should have had winUninstallColormap + * called on them before we get here. The default colormap + * will not have had winUninstallColormap called on it. Thus, + * we need to handle the default colormap in a special way. + */ + if (pColormap->flags & IsDefault) + { +#if CYGDEBUG + ErrorF ("winDestroyColormapShadowDDNL () - Destroying default " + "colormap\n"); +#endif + + /* + * FIXME: Walk the list of all screens, popping the default + * palette out of each screen device context. + */ + + /* Pop the palette out of the primary surface */ + ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winDestroyColormapShadowDDNL () - Failed freeing the " + "default colormap DirectDraw palette.\n"); + return FALSE; + } + + /* Clear our private installed colormap pointer */ + pScreenPriv->pcmapInstalled = NULL; + } + + /* Release the palette */ + IDirectDrawPalette_Release (pCmapPriv->lpDDPalette); + + /* Invalidate the colormap privates */ + pCmapPriv->lpDDPalette = NULL; + + return TRUE; +} + + /* Set pointers to our engine specific functions */ Bool winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen) @@ -675,7 +952,6 @@ /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL; pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL; - pScreenPriv->pwinShadowWindow = winShadowWindowDDNL; pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL; pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL; @@ -686,6 +962,14 @@ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL; pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL; + pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL; + pScreenPriv->pwinRealizeInstalledPalette + = winRealizeInstalledPaletteShadowDDNL; + pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL; + pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL; + pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL; + pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabPtr) (void (*)())NoopDDA; return TRUE; } Index: xc/programs/Xserver/hw/xwin/winshadgdi.c diff -u xc/programs/Xserver/hw/xwin/winshadgdi.c:1.6 xc/programs/Xserver/hw/xwin/winshadgdi.c:1.19 --- xc/programs/Xserver/hw/xwin/winshadgdi.c:1.6 Mon May 14 12:52:33 2001 +++ xc/programs/Xserver/hw/xwin/winshadgdi.c Wed Nov 21 03:51:24 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.6 2001/05/14 16:52:33 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.19 2001/11/21 08:51:24 alanh Exp $ */ #include "win.h" @@ -104,11 +104,12 @@ LPDWORD pdw = NULL; DWORD dwRedBits, dwGreenBits, dwBlueBits; - /* RGB BPP for 8 bit palletes is always 8 bits per pixel */ + /* Color masks for 8 bpp are standardized */ if (GetDeviceCaps (pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE) { - /* - * FIXME: 8bpp doesn't work. + /* + * RGB BPP for 8 bit palletes is always 8 + * and the color masks are always 0. */ pScreenPriv->dwBitsPerRGB = 8; pScreenPriv->dwRedMask = 0x0L; @@ -190,7 +191,9 @@ winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; BITMAPINFOHEADER *pbmih = NULL; +#if CYGDEBUG DIBSECTION dibsection; +#endif Bool fReturn = TRUE; /* Get device contexts for the screen and shadow bitmap */ @@ -216,7 +219,7 @@ /* Create a DI shadow bitmap with a bit pointer */ pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen, (BITMAPINFO *) pbmih, - 0, + DIB_RGB_COLORS, (VOID**) &pScreenInfo->pfb, NULL, 0); @@ -232,11 +235,11 @@ #endif } +#if CYGDEBUG /* 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); @@ -250,6 +253,7 @@ ErrorF ("winAllocateFBShadowGDI () - Attempting a shadow blit\n"); #endif + /* Do a test blit from the shadow to the screen, I think */ fReturn = BitBlt (pScreenPriv->hdcScreen, 0, 0, pScreenInfo->dwWidth, pScreenInfo->dwHeight, @@ -273,17 +277,29 @@ pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) / pScreenInfo->dwDepth; + /* See if the shadow bitmap will be larger than the DIB size limit */ + if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwDepth + >= WIN_DIB_MAXIMUM_SIZE) + { + ErrorF ("winAdjustVideoModeShadowGDI () - Requested DIB (bitmap) " + "will be larger than %d MB. The surface may fail to be " + "allocated on Windows 95, 98, or Me, due to a %d MB limit in " + "DIB size. This limit does not apply to Windows NT/2000, and " + "this message may be ignored on those platforms.\n", + WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); + } + return fReturn; } /* Blit the damaged regions of the shadow fb to the screen */ void winShadowUpdateGDI (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) + shadowBufPtr pBuf) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RegionPtr damage = &pBuf->damage; DWORD dwBox = REGION_NUM_RECTS (damage); BoxPtr pBox = REGION_RECTS (damage); int x, y, w, h; @@ -314,35 +330,11 @@ } } -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 -*/ +/* + * We wrap whatever CloseScreen procedure was specified by fb; + * a pointer to said procedure is stored in our privates. + */ Bool winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) { @@ -374,10 +366,6 @@ /* Free the screen DC */ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); - /* Redisplay the Windows cursor */ - if (!pScreenPriv->fCursor) - ShowCursor (TRUE); - /* Kill our window */ if (pScreenPriv->hwndScreen) { @@ -385,7 +373,7 @@ pScreenPriv->hwndScreen = NULL; } - /* Kill our screeninfo's pointer to the screen */ + /* Invalidate our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; /* Invalidate the ScreenInfo's fb pointer */ @@ -393,7 +381,7 @@ /* Free the screen privates for this screen */ xfree ((pointer) pScreenPriv); - + return fReturn; } @@ -410,13 +398,13 @@ return FALSE; } -#if CYGDEBUG - ErrorF ("winInitVisualsGDI () - Masks: %08x %08x %08x bpRGB: %d\n", + /* Display debugging information */ + ErrorF ("winInitVisualsGDI () - Masks %08x %08x %08x BPRGB %d d %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask, - pScreenPriv->dwBitsPerRGB); -#endif + pScreenPriv->dwBitsPerRGB, + pScreenInfo->dwDepth); /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) @@ -425,6 +413,7 @@ case 24: case 16: case 15: + /* Setup the real visual */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, TrueColorMask, pScreenPriv->dwBitsPerRGB, @@ -439,9 +428,6 @@ break; case 8: -#if CYGDEBUG - ErrorF ("winInitVisualsGDI () - Calling miSetVisualTypesAndMasks\n"); -#endif /* CYGDEBUG */ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, PseudoColorMask, pScreenPriv->dwBitsPerRGB, @@ -454,21 +440,13 @@ 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 @@ -495,11 +473,20 @@ /* Query GDI for current display depth */ dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* GDI cannot change the screen depth */ + if (pScreenInfo->dwDepth == WIN_DEFAULT_DEPTH) + { + /* No -depth parameter passed, let the user know the depth being used */ + ErrorF ("winAdjustVideoModeShadowGDI () - Using Windows display " + "depth of %d bits per pixel\n", dwDepth); - /* Is GDI using a depth different than command line parameter? */ - if (dwDepth != pScreenInfo->dwDepth) + /* Use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + else if (dwDepth != pScreenInfo->dwDepth) { - /* Warn user if GDI depth is different than depth specified */ + /* Warn user if GDI depth is different than -depth parameter */ ErrorF ("winAdjustVideoModeShadowGDI () - Command line depth: %d, "\ "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); @@ -509,6 +496,7 @@ /* Release our DC */ ReleaseDC (NULL, hdc); + hdc = NULL; return TRUE; } @@ -519,12 +507,22 @@ { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + winPrivCmapPtr pCmapPriv = NULL; HDC hdcUpdate; PAINTSTRUCT ps; /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); + /* Realize the palette, if we have one */ + if (pScreenPriv->pcmapInstalled != NULL) + { + pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled); + + SelectPalette (hdcUpdate, pCmapPriv->hPalette, FALSE); + RealizePalette (hdcUpdate); + } + /* Our BitBlt will be clipped to the invalidated region */ BitBlt (hdcUpdate, 0, 0, @@ -545,12 +543,15 @@ winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; +#if CYGDEBUG + ErrorF ("winActivateAppShadowGDI ()\n"); +#endif + /* * Are we active? * Are we fullscreen? */ - if (pScreenPriv != NULL - && pScreenPriv->fActive + if (pScreenPriv->fActive && pScreenInfo->fFullScreen) { /* @@ -559,14 +560,8 @@ */ ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE); } - - /* - * Are we inactive? - * Are we fullscreen? - */ - if (pScreenPriv != NULL - && !pScreenPriv->fActive - && pScreenInfo->fFullScreen) + else if (!pScreenPriv->fActive + && pScreenInfo->fFullScreen) { /* * Deactivating, stuff our window onto the @@ -575,9 +570,293 @@ ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); } +#if CYGDEBUG + ErrorF ("winActivateAppShadowGDI () - Returning\n"); +#endif + + return TRUE; +} + + +/* + * Reblit the shadow framebuffer to the screen. + */ + +Bool +winRedrawScreenShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Redraw the whole window, to take account for the new colors */ + BitBlt (pScreenPriv->hdcScreen, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + + return TRUE; +} + +Bool +winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winPrivCmapPtr pCmapPriv = NULL; + +#if CYGDEBUG + ErrorF ("winRealizeInstalledPaletteShadowGDI ()\n"); +#endif + + /* Don't do anything if there is not a colormap */ + if (pScreenPriv->pcmapInstalled == NULL) + { +#if CYGDEBUG + ErrorF ("winRealizeInstalledPaletteShadowGDI () - No colormap " + "installed\n"); +#endif + return TRUE; + } + + pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled); + + /* Realize our palette for the screen */ + if (RealizePalette (pScreenPriv->hdcScreen) == GDI_ERROR) + { + ErrorF ("winRealizeInstalledPaletteShadowGDI () - RealizePalette () " + "failed\n"); + return FALSE; + } + + /* Set the DIB color table */ + if (SetDIBColorTable (pScreenPriv->hdcShadow, + 0, + WIN_NUM_PALETTE_ENTRIES, + pCmapPriv->rgbColors) == 0) + { + ErrorF ("winRealizeInstalledPaletteShadowGDI () - SetDIBColorTable () " + "failed\n"); + return FALSE; + } + + return TRUE; +} + + +/* Install the specified colormap */ +Bool +winInstallColormapShadowGDI (ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + winCmapPriv(pColormap); + + /* + * Tell Windows to install the new colormap + */ + if (SelectPalette (pScreenPriv->hdcScreen, + pCmapPriv->hPalette, + FALSE) == NULL) + { + ErrorF ("winInstallColormapShadowGDI () - SelectPalette () failed\n"); + return FALSE; + } + + /* Realize the palette */ + if (GDI_ERROR == RealizePalette (pScreenPriv->hdcScreen)) + { + ErrorF ("winInstallColormapShadowGDI () - RealizePalette () failed\n"); + return FALSE; + } + + /* Set the DIB color table */ + if (SetDIBColorTable (pScreenPriv->hdcShadow, + 0, + WIN_NUM_PALETTE_ENTRIES, + pCmapPriv->rgbColors) == 0) + { + ErrorF ("winInstallColormapShadowGDI () - SetDIBColorTable () failed\n"); + return FALSE; + } + + /* Redraw the whole window, to take account for the new colors */ + BitBlt (pScreenPriv->hdcScreen, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; + return TRUE; } + +/* Store the specified colors in the specified colormap */ +Bool +winStoreColorsShadowGDI (ColormapPtr pColormap, + int ndef, + xColorItem *pdefs) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + + /* Put the X colormap entries into the Windows logical palette */ + if (SetPaletteEntries (pCmapPriv->hPalette, + pdefs[0].pixel, + ndef, + pCmapPriv->peColors + pdefs[0].pixel) == 0) + { + ErrorF ("winStoreColorsShadowGDI () - SetPaletteEntries () failed\n"); + return FALSE; + } + + /* Don't install the Windows palette if the colormap is not installed */ + if (pColormap != curpmap) + { + return TRUE; + } + + /* Try to install the newly modified colormap */ + if (!winInstallColormapShadowGDI (pColormap)) + { + ErrorF ("winInstallColormapShadowGDI () - winInstallColormapShadowGDI " + "failed\n"); + return FALSE; + } + +#if 0 + /* Tell Windows that the palette has changed */ + RealizePalette (pScreenPriv->hdcScreen); + + /* Set the DIB color table */ + if (SetDIBColorTable (pScreenPriv->hdcShadow, + pdefs[0].pixel, + ndef, + pCmapPriv->rgbColors + pdefs[0].pixel) == 0) + { + ErrorF ("winInstallColormapShadowGDI () - SetDIBColorTable () failed\n"); + return FALSE; + } + + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; +#endif + + return TRUE; +} + + +/* Colormap initialization procedure */ +Bool +winCreateColormapShadowGDI (ColormapPtr pColormap) +{ + LPLOGPALETTE lpPaletteNew = NULL; + DWORD dwEntriesMax; + VisualPtr pVisual; + HPALETTE hpalNew = NULL; + winCmapPriv(pColormap); + + /* Get a pointer to the visual that the colormap belongs to */ + pVisual = pColormap->pVisual; + + /* Get the maximum number of palette entries for this visual */ + dwEntriesMax = pVisual->ColormapEntries; + + /* Allocate a Windows logical color palette with max entries */ + lpPaletteNew = xalloc (sizeof (LOGPALETTE) + + (dwEntriesMax - 1) * sizeof (PALETTEENTRY)); + if (lpPaletteNew == NULL) + { + ErrorF ("winCreateColormapShadowGDI () - Couldn't allocate palette " + "with %d entries\n", + dwEntriesMax); + return FALSE; + } + + /* Zero out the colormap */ + ZeroMemory (lpPaletteNew, sizeof (LOGPALETTE) + + (dwEntriesMax - 1) * sizeof (PALETTEENTRY)); + + /* Set the logical palette structure */ + lpPaletteNew->palVersion = 0x0300; + lpPaletteNew->palNumEntries = dwEntriesMax; + + /* Tell Windows to create the palette */ + hpalNew = CreatePalette (lpPaletteNew); + if (hpalNew == NULL) + { + ErrorF ("winCreateColormapShadowGDI () - CreatePalette () failed\n"); + free (lpPaletteNew); + return FALSE; + } + + /* Save the Windows logical palette handle in the X colormaps' privates */ + pCmapPriv->hPalette = hpalNew; + + /* Free the palette initialization memory */ + xfree (lpPaletteNew); + + return TRUE; +} + + +/* Colormap destruction procedure */ +Bool +winDestroyColormapShadowGDI (ColormapPtr pColormap) +{ + winScreenPriv(pColormap->pScreen); + winCmapPriv(pColormap); + + /* + * Is colormap to be destroyed the default? + * + * Non-default colormaps should have had winUninstallColormap + * called on them before we get here. The default colormap + * will not have had winUninstallColormap called on it. Thus, + * we need to handle the default colormap in a special way. + */ + if (pColormap->flags & IsDefault) + { +#if CYGDEBUG + ErrorF ("winDestroyColormapShadowGDI () - Destroying default " + "colormap\n"); +#endif + + /* + * FIXME: Walk the list of all screens, popping the default + * palette out of each screen device context. + */ + + /* Pop the palette out of the device context */ + SelectPalette (pScreenPriv->hdcScreen, + GetStockObject (DEFAULT_PALETTE), + FALSE); + + /* Clear our private installed colormap pointer */ + pScreenPriv->pcmapInstalled = NULL; + } + + /* Try to delete the logical palette */ + if (DeleteObject (pCmapPriv->hPalette) == 0) + { + ErrorF ("winDestroyColormap () - DeleteObject () failed\n"); + return FALSE; + } + + /* Invalidate the colormap privates */ + pCmapPriv->hPalette = NULL; + + return TRUE; +} + + /* Set engine specific funtions */ Bool winSetEngineFunctionsShadowGDI (ScreenPtr pScreen) @@ -588,7 +867,6 @@ /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI; pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI; - pScreenPriv->pwinShadowWindow = winShadowWindowGDI; pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI; pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI; @@ -599,6 +877,14 @@ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI; pScreenPriv->pwinActivateApp = winActivateAppShadowGDI; + pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowGDI; + pScreenPriv->pwinRealizeInstalledPalette = + winRealizeInstalledPaletteShadowGDI; + pScreenPriv->pwinInstallColormap = winInstallColormapShadowGDI; + pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI; + pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI; + pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabPtr) (void (*)())NoopDDA; return TRUE; } Index: xc/programs/Xserver/hw/xwin/winwakeup.c diff -u xc/programs/Xserver/hw/xwin/winwakeup.c:1.3 xc/programs/Xserver/hw/xwin/winwakeup.c:1.5 --- xc/programs/Xserver/hw/xwin/winwakeup.c:1.3 Tue May 1 20:45:26 2001 +++ xc/programs/Xserver/hw/xwin/winwakeup.c Wed Nov 21 03:51:24 2001 @@ -30,20 +30,21 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwakeup.c,v 1.5 2001/11/21 08:51:24 alanh Exp $ */ #include "win.h" /* See Porting Layer Definition - p. 7 */ void -winWakeupHandler (pointer pWakeupData, - int err, +winWakeupHandler (int nScreen, + pointer pWakeupData, + unsigned long ulResult, pointer pReadmask) { winScreenPriv((ScreenPtr)pWakeupData); MSG msg; - /* Process all message on our queue */ + /* Process all messages on our queue */ while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) { DispatchMessage (&msg); Index: xc/programs/Xserver/hw/xwin/winwindow.c diff -u xc/programs/Xserver/hw/xwin/winwindow.c:1.1 xc/programs/Xserver/hw/xwin/winwindow.c:1.2 --- xc/programs/Xserver/hw/xwin/winwindow.c:1.1 Thu Apr 5 16:13:51 2001 +++ xc/programs/Xserver/hw/xwin/winwindow.c Mon Jun 4 09:04:41 2001 @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.c,v 1.2 2001/06/04 13:04:41 alanh Exp $ */ #include "win.h" @@ -36,7 +36,7 @@ Bool winCreateWindowNativeGDI (WindowPtr pWin) { - fprintf (stderr, "winCreateWindow()\n"); + ErrorF ("winCreateWindow()\n"); return TRUE; } @@ -45,7 +45,7 @@ Bool winDestroyWindowNativeGDI (WindowPtr pWin) { - fprintf (stderr, "winDestroyWindow()\n"); + ErrorF ("winDestroyWindow()\n"); return TRUE; } @@ -54,7 +54,7 @@ Bool winPositionWindowNativeGDI (WindowPtr pWin, int x, int y) { - fprintf (stderr, "winPositionWindow()\n"); + ErrorF ("winPositionWindow()\n"); return TRUE; } @@ -65,7 +65,7 @@ DDXPointRec ptOldOrg, RegionPtr prgnSrc) { - fprintf (stderr, "winCopyWindow()\n"); + ErrorF ("winCopyWindow()\n"); } /* See Porting Layer Definition - p. 37 */ @@ -73,7 +73,7 @@ Bool winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask) { - fprintf (stderr, "winChangeWindowAttributes()\n"); + ErrorF ("winChangeWindowAttributes()\n"); return TRUE; } @@ -83,7 +83,7 @@ Bool winUnmapWindowNativeGDI (WindowPtr pWindow) { - fprintf (stderr, "winUnmapWindow()\n"); + ErrorF ("winUnmapWindow()\n"); /* This functions is empty in the CFB, * we probably won't need to do anything */ @@ -96,7 +96,7 @@ Bool winMapWindowNativeGDI (WindowPtr pWindow) { - fprintf (stderr, "winMapWindow()\n"); + ErrorF ("winMapWindow()\n"); /* This function is empty in the CFB, * we probably won't need to do anything */ Index: xc/programs/Xserver/hw/xwin/winwndproc.c diff -u xc/programs/Xserver/hw/xwin/winwndproc.c:1.4 xc/programs/Xserver/hw/xwin/winwndproc.c:1.19 --- xc/programs/Xserver/hw/xwin/winwndproc.c:1.4 Tue May 8 04:14:09 2001 +++ xc/programs/Xserver/hw/xwin/winwndproc.c Wed Nov 21 03:51:24 2001 @@ -30,42 +30,70 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwndproc.c,v 1.19 2001/11/21 08:51:24 alanh Exp $ */ #include "win.h" + /* * Called by winWakeupHandler * Processes current Windows message */ + LRESULT CALLBACK -winWindowProc (HWND hWnd, UINT message, +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) + static winPrivScreenPtr pScreenPriv = NULL; + static winScreenInfo *pScreenInfo = NULL; + static ScreenPtr pScreen = NULL; + static HWND hwndLastMouse = NULL; + static unsigned long ulServerGeneration = 0; + winPrivScreenPtr pScreenPrivLast; + int iScanCode; + int i; + static HWND hwndLastPrivates = NULL; + + /* Watch for server regeneration */ + if (g_ulServerGeneration != ulServerGeneration) + { + /* + * Might as well declare that this window received + * the last mouse message + */ + hwndLastMouse = hwnd; + + /* Store new server generation */ + ulServerGeneration = g_ulServerGeneration; + } + + /* Only retrieve new privates pointers if window handle is null or changed */ + if ((pScreenPriv == NULL || hwnd != hwndLastPrivates) + && (pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL) { +#if CYGDEGUG + ErrorF ("winWindowProc () - Setting privates handle\n"); +#endif pScreenInfo = pScreenPriv->pScreenInfo; pScreen = pScreenInfo->pScreen; + hwndLastPrivates = hwnd; + } + else if (pScreenPriv == NULL) + { + /* For safety, handle case that should never happen */ + pScreenInfo = NULL; + pScreen = NULL; + hwndLastPrivates = NULL; } /* Branch on message type */ switch (message) { case WM_CREATE: +#if CYGDEBUG + ErrorF ("winWindowProc () - WM_CREATE\n"); +#endif + /* * Add a property to our display window that references * this screens' privates. @@ -75,18 +103,20 @@ * 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); + pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams; + pScreenInfo = pScreenPriv->pScreenInfo; + pScreen = pScreenInfo->pScreen; + hwndLastPrivates = hwnd; + 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: +#if CYGDEBUG + ErrorF ("winWindowProc () - WM_PAINT\n"); +#endif /* Only paint if we have privates and the server is enabled */ if (pScreenPriv == NULL || !pScreenPriv->fEnabled @@ -95,18 +125,76 @@ /* We don't want to paint */ break; } + + /* Break out here if we don't have a valid paint routine */ + if (pScreenPriv->pwinBltExposedRegions == NULL) + break; /* Call the engine dependent repainter */ (*pScreenPriv->pwinBltExposedRegions) (pScreen); return 0; + case WM_PALETTECHANGED: + { +#if CYGDEBUG + ErrorF ("winWindowProc () WM_PALETTECHANGED\n"); +#endif + /* Don't process if we don't have privates or a colormap */ + if (pScreenPriv == NULL || pScreenPriv->pcmapInstalled == NULL) + break; + + /* Return if we caused the palette to change */ + if ((HWND) wParam == hwnd) + { + /* Redraw the screen */ + (*pScreenPriv->pwinRedrawScreen) (pScreen); + return 0; + } + + /* Reinstall the windows palette */ + (*pScreenPriv->pwinRealizeInstalledPalette) (pScreen); + + /* Redraw the screen */ + (*pScreenPriv->pwinRedrawScreen) (pScreen); + return 0; + } + case WM_MOUSEMOVE: /* We can't do anything without privates */ - if (pScreenPriv == NULL) + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; + + /* Has the mouse pointer crossed screens? */ + if (pScreen != miPointerCurrentScreen ()) + miPointerSetNewScreen (pScreenInfo->dwScreen, 0, 0); /* Sometimes we hide, sometimes we show */ - if (pScreenPriv->fActive + if (hwndLastMouse != NULL && hwndLastMouse != hwnd) + { + /* Cursor is now over NC area of another screen */ + pScreenPrivLast = GetProp (hwndLastMouse, WIN_SCR_PROP); + if (pScreenPrivLast == NULL) + { + ErrorF ("winWindowProc () - WM_MOUSEMOVE - Couldn't obtain " + "last screen privates\n"); + return 0; + } + + /* Show cursor if last screen is still hiding it */ + if (!pScreenPrivLast->fCursor) + { + pScreenPrivLast->fCursor = TRUE; + ShowCursor (TRUE); + } + + /* Hide cursor for our screen if we are not hiding it */ + if (pScreenPriv->fCursor) + { + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + } + else if (pScreenPriv->fActive && pScreenPriv->fCursor) { /* Hide Windows cursor */ @@ -125,39 +213,90 @@ miPointerAbsoluteCursor (GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), g_c32LastInputEventTime = GetTickCount ()); + + /* Store pointer to last window handle */ + hwndLastMouse = hwnd; return 0; case WM_NCMOUSEMOVE: + /* We can't do anything without privates */ + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + /* Non-client mouse movement, show Windows cursor */ - if (!pScreenPriv->fCursor) + if (hwndLastMouse != NULL && hwndLastMouse != hwnd) { + /* Cursor is now over NC area of another screen */ + pScreenPrivLast = GetProp (hwndLastMouse, WIN_SCR_PROP); + if (pScreenPrivLast == NULL) + { + ErrorF ("winWindowProc () - WM_NCMOUSEMOVE - Couldn't obtain " + "last screen privates\n"); + return 0; + } + + /* Show cursor if last screen is still hiding it */ + if (!pScreenPrivLast->fCursor) + { + pScreenPrivLast->fCursor = TRUE; + ShowCursor (TRUE); + } + + /* Hide cursor for our screen if we are not hiding it */ + if (pScreenPriv->fCursor) + { + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + } + else if (!pScreenPriv->fCursor) + { pScreenPriv->fCursor = TRUE; ShowCursor (TRUE); } + + /* Store pointer to last window handle */ + hwndLastMouse = hwnd; return 0; case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; return winMouseButtonsHandle (pScreen, ButtonPress, Button1, wParam); case WM_LBUTTONUP: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; return winMouseButtonsHandle (pScreen, ButtonRelease, Button1, wParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; return winMouseButtonsHandle (pScreen, ButtonPress, Button2, wParam); case WM_MBUTTONUP: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; return winMouseButtonsHandle (pScreen, ButtonRelease, Button2, wParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; return winMouseButtonsHandle (pScreen, ButtonPress, Button3, wParam); case WM_RBUTTONUP: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam); case WM_TIMER: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + + /* Branch on the timer id */ switch (wParam) { case WIN_E3B_TIMER_ID: @@ -175,190 +314,186 @@ return 0; case WM_MOUSEWHEEL: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; return winMouseWheel (pScreen, GET_WHEEL_DELTA_WPARAM(wParam)); + case WM_SETFOCUS: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + + /* Restore the state of all mode keys */ + winRestoreModeKeyStates (pScreen); + return 0; + + case WM_KILLFOCUS: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + + /* Store the state of all mode keys */ + winStoreModeKeyStates (pScreen); + + /* Release any pressed modifiers */ + winKeybdReleaseModifierKeys (); + return 0; + case WM_SYSKEYDOWN: case WM_KEYDOWN: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + + /* + * FIXME: Catching Alt-F4 like this is really terrible. This should + * be generalized to handle other Windows keyboard signals. Actually, + * the list keys to catch and the actions to perform when caught should + * be configurable; that way user's can customize the keys that they + * need to have passed through to their window manager or apps, or they + * can remap certain actions to new key codes that do not conflict + * with the X apps that they are using. Yeah, that'll take awhile. + */ + if ((pScreenInfo->fUseWinKillKey && wParam == VK_F4 + && (GetKeyState (VK_MENU) & 0x8000)) + || (pScreenInfo->fUseUnixKillKey && wParam == VK_BACK + && (GetKeyState (VK_MENU) & 0x8000) + && (GetKeyState (VK_CONTROL) & 0x8000))) + { + /* + * Better leave this message here, just in case some unsuspecting + * user enters Alt + F4 and is surprised when the application + * quits. + */ + ErrorF ("winWindowProc () - Closekey hit, quitting\n"); + + /* Tell our message queue to give up */ + PostMessage (hwnd, WM_CLOSE, 0, 0); + return 0; + } + + /* + * Don't do anything for the Windows keys, as focus will soon + * be returned to Windows. We may be able to trap the Windows keys, + * but we should determine if that is desirable before doing so. + */ + if (wParam == VK_LWIN || wParam == VK_RWIN) + break; + + /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */ if (winIsFakeCtrl_L (message, wParam, lParam)) return 0; + + /* Send the key event(s) */ winTranslateKey (wParam, lParam, &iScanCode); - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.u.detail = iScanCode; - xCurrentEvent.u.keyButtonPointer.time - = g_c32LastInputEventTime = GetTickCount (); - mieqEnqueue (&xCurrentEvent); + for (i = 0; i < LOWORD(lParam); ++i) + winSendKeyEvent (iScanCode, TRUE); return 0; case WM_SYSKEYUP: case WM_KEYUP: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + + /* + * Don't do anything for the Windows keys, as focus will soon + * be returned to Windows. We may be able to trap the Windows keys, + * but we should determine if that is desirable before doing so. + */ + if (wParam == VK_LWIN || wParam == VK_RWIN) + break; + + /* Ignore the fake Ctrl_L that follows an AltGr release */ if (winIsFakeCtrl_L (message, wParam, lParam)) return 0; + + /* Enqueue a keyup event */ winTranslateKey (wParam, lParam, &iScanCode); - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.u.detail = iScanCode; - xCurrentEvent.u.keyButtonPointer.time - = g_c32LastInputEventTime = GetTickCount (); - mieqEnqueue (&xCurrentEvent); + winSendKeyEvent (iScanCode, FALSE); 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; + /* Call the engine-specific hot key handler */ + (*pScreenPriv->pwinHotKeyAltTab) (pScreen); + return 0; case WM_ACTIVATE: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + +#if CYGDEBUG + ErrorF ("winWindowProc () - WM_ACTIVATE\n"); +#endif /* * 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; + + /* Have we changed X screens? */ + if ((LOWORD (wParam) == WA_ACTIVE || LOWORD (wParam) == WA_CLICKACTIVE) + && pScreenPriv->fEnabled && pScreen != miPointerCurrentScreen ()) + miPointerSetNewScreen (pScreenInfo->dwScreen, 0, 0); - /* Activating or deactivating? */ - if (LOWORD (wParam) == WA_ACTIVE || LOWORD (wParam) == WA_CLICKACTIVE) + /* Handle showing or hiding the mouse */ + if (hwndLastMouse != NULL && hwndLastMouse != hwnd) { - /* Restore the state of all mode keys */ - winRestoreModeKeyStates (pScreen); + /* + * Activation has transferred between screens. + * This section is processed by the screen receiving + * focus, as it is the only one that notices the difference + * between hwndLastMouse and hwnd. + */ + pScreenPrivLast = GetProp (hwndLastMouse, WIN_SCR_PROP); + if (pScreenPrivLast == NULL) + { + ErrorF ("winWindowProc () - WM_ACTIVATE - Couldn't obtain last " + "screen privates\n"); + return 0; + } - /* Have we changed input screens? */ - if (pScreenPriv->fEnabled - && pScreen != miPointerCurrentScreen ()) + /* Show cursor if last screen is still hiding it */ + if (!pScreenPrivLast->fCursor) { - /* - * Tell mi that we are changing the screen that receives - * mouse input events. - */ - miPointerSetNewScreen (pScreenInfo->dwScreen, - 0, 0); + pScreenPrivLast->fCursor = TRUE; + ShowCursor (TRUE); } - } - 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 cursor for our screen if we are not hiding it */ + if (pScreenPriv->fCursor) + { + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + } + else 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); } + + /* Store last active window handle */ + hwndLastMouse = hwnd; return 0; case WM_ACTIVATEAPP: - /* We can't do anything if we don't have screen privates */ - if (pScreenPriv == NULL) + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; +#if CYGDEBUG + ErrorF ("winWindowProc () - WM_ACTIVATEAPP\n"); +#endif /* Activate or deactivate */ pScreenPriv->fActive = wParam; @@ -366,14 +501,12 @@ 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); } @@ -388,5 +521,5 @@ return 0; } - return DefWindowProc (hWnd, message, wParam, lParam); + return DefWindowProc (hwnd, message, wParam, lParam); } Index: xc/programs/Xserver/include/closestr.h diff -u xc/programs/Xserver/include/closestr.h:3.3 xc/programs/Xserver/include/closestr.h:3.4 --- xc/programs/Xserver/include/closestr.h:3.3 Wed Jan 17 17:36:56 2001 +++ xc/programs/Xserver/include/closestr.h Fri Dec 14 14:59:53 2001 @@ -1,9 +1,13 @@ -/* $Xorg: closestr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: closestr.h,v 1.4 2001/02/09 02:05:14 xorgcvs Exp $ */ /* Copyright 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/include/closestr.h,v 3.3 2001/01/17 22:36:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/closestr.h,v 3.4 2001/12/14 19:59:53 dawes Exp $ */ #ifndef CLOSESTR_H Index: xc/programs/Xserver/include/closure.h diff -u xc/programs/Xserver/include/closure.h:1.1.1.3 xc/programs/Xserver/include/closure.h:1.2 --- xc/programs/Xserver/include/closure.h:1.1.1.3 Tue Jan 16 17:43:56 2001 +++ xc/programs/Xserver/include/closure.h Fri Dec 14 14:59:53 2001 @@ -1,9 +1,13 @@ -/* $Xorg: closure.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: closure.h,v 1.4 2001/02/09 02:05:14 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/include/colormap.h diff -u xc/programs/Xserver/include/colormap.h:1.4 xc/programs/Xserver/include/colormap.h:1.5 --- xc/programs/Xserver/include/colormap.h:1.4 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/colormap.h Fri Dec 14 14:59:53 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/include/colormap.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/colormap.h,v 1.5 2001/12/14 19:59:53 dawes Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. */ -/* $Xorg: colormap.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: colormap.h,v 1.4 2001/02/09 02:05:14 xorgcvs 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.4 xc/programs/Xserver/include/colormapst.h:1.2 --- xc/programs/Xserver/include/colormapst.h:1.1.1.4 Tue Jan 16 17:43:56 2001 +++ xc/programs/Xserver/include/colormapst.h Fri Dec 14 14:59:53 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ SOFTWARE. */ -/* $Xorg: colormapst.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: colormapst.h,v 1.4 2001/02/09 02:05:14 xorgcvs Exp $ */ #ifndef CMAPSTRUCT_H #define CMAPSTRUCT_H 1 Index: xc/programs/Xserver/include/cursor.h diff -u xc/programs/Xserver/include/cursor.h:1.2 xc/programs/Xserver/include/cursor.h:1.3 --- xc/programs/Xserver/include/cursor.h:1.2 Fri Feb 2 16:39:02 2001 +++ xc/programs/Xserver/include/cursor.h Fri Dec 14 14:59:53 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: cursor.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: cursor.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ #ifndef CURSOR_H #define CURSOR_H Index: xc/programs/Xserver/include/cursorstr.h diff -u xc/programs/Xserver/include/cursorstr.h:1.5 xc/programs/Xserver/include/cursorstr.h:1.6 --- xc/programs/Xserver/include/cursorstr.h:1.5 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/cursorstr.h Fri Dec 14 14:59:54 2001 @@ -1,9 +1,13 @@ -/* $Xorg: cursorstr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: cursorstr.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/cursorstr.h,v 1.5 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/cursorstr.h,v 1.6 2001/12/14 19:59:54 dawes Exp $ */ #ifndef CURSORSTRUCT_H #define CURSORSTRUCT_H Index: xc/programs/Xserver/include/dix.h diff -u xc/programs/Xserver/include/dix.h:3.16 xc/programs/Xserver/include/dix.h:3.22 --- xc/programs/Xserver/include/dix.h:3.16 Fri Feb 16 08:24:09 2001 +++ xc/programs/Xserver/include/dix.h Fri Dec 14 14:59:54 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/include/dix.h,v 3.16 2001/02/16 13:24:09 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/include/dix.h,v 3.22 2001/12/14 19:59:54 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: dix.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: dix.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ #ifndef DIX_H #define DIX_H @@ -266,11 +270,11 @@ ValidateGC(pDraw, pGC); -#define WriteReplyToClient(pClient, size, pReply) \ +#define WriteReplyToClient(pClient, size, pReply) { \ if ((pClient)->swapped) \ (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ (pClient, (int)(size), pReply); \ - else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); + else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); } #define WriteSwappedDataToClient(pClient, size, pbuf) \ if ((pClient)->swapped) \ @@ -668,13 +672,6 @@ #endif ); -#if 0 -extern Bool PointerConfinedToScreen( -#if NeedFunctionPrototypes - void -#endif -); -#endif extern Bool IsParent( #if NeedFunctionPrototypes @@ -695,14 +692,6 @@ #endif ); -#if 0 -extern void GetSpritePosition( -#if NeedFunctionPrototypes - int * /* px */, - int * /* py */ -#endif -); -#endif extern void NoticeEventTime( #if NeedFunctionPrototypes @@ -838,6 +827,15 @@ #endif ); +#ifdef XKB +extern void FixKeyState( +#if NeedFunctionPrototypes + xEvent * /* xE */, + DeviceIntPtr /* keybd */ +#endif +); +#endif /* XKB */ + extern void RecalculateDeliverableEvents( #if NeedFunctionPrototypes WindowPtr /* pWin */ @@ -900,13 +898,6 @@ #endif ); -#if 0 -extern void CheckCursorConfinement( -#if NeedFunctionPrototypes - WindowPtr /* pWin */ -#endif -); -#endif extern Mask EventMaskForClient( #if NeedFunctionPrototypes @@ -926,11 +917,6 @@ #endif ); -extern void SetCriticalEvent( -#if NeedFunctionPrototypes - int /*event*/ -#endif -); extern void WriteEventsToClient( #if NeedFunctionPrototypes @@ -951,38 +937,17 @@ #endif ); -extern int EventSelectForWindow( -#if NeedFunctionPrototypes - WindowPtr /*pWin*/, - ClientPtr /*client*/, - Mask /*mask*/ -#endif -); - -extern int EventSuppressForWindow( +extern void WindowsRestructured( #if NeedFunctionPrototypes - WindowPtr /*pWin*/, - ClientPtr /*client*/, - Mask /*mask*/, - Bool * /*checkOptional*/ + void #endif ); -extern int MaybeDeliverEventsToClient( -#if NeedFunctionPrototypes - WindowPtr /*pWin*/, - xEventPtr /*pEvents*/, - int /*count*/, - Mask /*filter*/, - ClientPtr /*dontClient*/ -#endif -); -extern void WindowsRestructured( -#if NeedFunctionPrototypes - void +#ifdef RANDR +void +ScreenRestructured (ScreenPtr pScreen); #endif -); extern void ResetClientPrivates( #if NeedFunctionPrototypes Index: xc/programs/Xserver/include/dixevents.h diff -u xc/programs/Xserver/include/dixevents.h:3.2 xc/programs/Xserver/include/dixevents.h:3.4 --- xc/programs/Xserver/include/dixevents.h:3.2 Mon Dec 23 21:27:27 1996 +++ xc/programs/Xserver/include/dixevents.h Tue Sep 4 10:03:27 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/dixevents.h,v 3.2 1996/12/24 02:27:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/dixevents.h,v 3.4 2001/09/04 14:03:27 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey <dickey@clark.net> @@ -27,13 +27,6 @@ #ifndef DIXEVENTS_H #define DIXEVENTS_H -extern Mask -GetNextEventMask( -#if NeedFunctionPrototypes - void -#endif - ); - extern void SetCriticalEvent( #if NeedFunctionPrototypes @@ -41,15 +34,6 @@ #endif ); -extern void -ConfineCursorToWindow( -#if NeedFunctionPrototypes - WindowPtr /* pWin */, - Bool /* generateEvents */, - Bool /* confineToScreen */ -#endif - ); - extern CursorPtr GetSpriteCursor( #if NeedFunctionPrototypes @@ -65,18 +49,6 @@ ); extern int -TryClientEvents ( -#if NeedFunctionPrototypes - ClientPtr /* client */, - xEvent * /* pEvents */, - int /* count */, - Mask /* mask */, - Mask /* filter */, - GrabPtr /* grab */ -#endif - ); - -extern int MaybeDeliverEventsToClient( #if NeedFunctionPrototypes WindowPtr /* pWin */, @@ -87,22 +59,6 @@ #endif ); -extern void -WindowsRestructured( -#if NeedFunctionPrototypes - void -#endif - ); - -extern void -NewCurrentScreen( -#if NeedFunctionPrototypes - ScreenPtr /* newScreen */, - int /* x */, - int /* y */ -#endif - ); - extern int ProcWarpPointer( #if NeedFunctionPrototypes @@ -110,6 +66,7 @@ #endif ); +#if 0 extern void #ifdef XKB CoreProcessKeyboardEvent ( @@ -135,6 +92,7 @@ int /* count */ #endif ); +#endif extern int EventSelectForWindow( Index: xc/programs/Xserver/include/dixstruct.h diff -u xc/programs/Xserver/include/dixstruct.h:3.12 xc/programs/Xserver/include/dixstruct.h:3.16 --- xc/programs/Xserver/include/dixstruct.h:3.12 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/dixstruct.h Sat Oct 27 23:34:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/dixstruct.h,v 3.12 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/dixstruct.h,v 3.16 2001/10/28 03:34:12 tsi Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -162,9 +162,20 @@ extern long SmartScheduleInterval; extern long SmartScheduleSlice; extern long SmartScheduleMaxSlice; +extern unsigned long SmartScheduleIdleCount; extern Bool SmartScheduleDisable; +extern Bool SmartScheduleIdle; +extern Bool SmartScheduleTimerStopped; +extern Bool SmartScheduleStartTimer(void); #define SMART_MAX_PRIORITY 20 #define SMART_MIN_PRIORITY -20 + +extern Bool SmartScheduleInit( +#ifdef NeedFunctionPrototypes + void +#endif +); + #endif /* This prototype is used pervasively in Xext, dix */ Index: xc/programs/Xserver/include/extension.h diff -u xc/programs/Xserver/include/extension.h:1.4 xc/programs/Xserver/include/extension.h:1.5 --- xc/programs/Xserver/include/extension.h:1.4 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/extension.h Fri Dec 14 14:59:54 2001 @@ -1,9 +1,13 @@ -/* $Xorg: extension.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: extension.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/extension.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/extension.h,v 1.5 2001/12/14 19:59:54 dawes Exp $ */ #ifndef EXTENSION_H #define EXTENSION_H Index: xc/programs/Xserver/include/extinit.h diff -u xc/programs/Xserver/include/extinit.h:3.1 xc/programs/Xserver/include/extinit.h:3.2 --- xc/programs/Xserver/include/extinit.h:3.1 Mon Apr 15 07:34:30 1996 +++ xc/programs/Xserver/include/extinit.h Tue Jul 31 20:44:58 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/extinit.h,v 3.1 1996/04/15 11:34:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/extinit.h,v 3.2 2001/08/01 00:44:58 tsi Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey <dickey@clark.net> @@ -30,6 +30,8 @@ #ifndef EXTINIT_H #define EXTINIT_H + +#include "extnsionst.h" void XInputExtensionInit( Index: xc/programs/Xserver/include/extnsionst.h diff -u xc/programs/Xserver/include/extnsionst.h:3.5 xc/programs/Xserver/include/extnsionst.h:3.7 --- xc/programs/Xserver/include/extnsionst.h:3.5 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/extnsionst.h Fri Dec 14 14:59:54 2001 @@ -1,9 +1,13 @@ -/* $Xorg: extnsionst.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: extnsionst.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/extnsionst.h,v 3.5 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/extnsionst.h,v 3.7 2001/12/14 19:59:54 dawes Exp $ */ #ifndef EXTENSIONSTRUCT_H #define EXTENSIONSTRUCT_H @@ -77,14 +81,13 @@ #endif } ExtensionEntry; -/* any attempt to declare the types of the parameters to the functions - * in EventSwapVector fails. The functions take pointers to two events, - * but the exact event types that are declared vary from one function - * to another. You can't even put void *, void * (the ibm compiler - * complains, anyway). +/* + * The arguments may be different for extension event swapping functions. + * Deal with this by casting when initializing the event's EventSwapVector[] + * entries. */ typedef void (*EventSwapPtr) ( -#if NeedFunctionPrototypes && defined(EVENT_SWAP_PTR) +#if NeedFunctionPrototypes xEvent *, xEvent * #endif @@ -93,7 +96,7 @@ extern EventSwapPtr EventSwapVector[128]; extern void NotImplemented ( /* FIXME: this may move to another file... */ -#if NeedFunctionPrototypes && defined(EVENT_SWAP_PTR) +#if NeedFunctionPrototypes xEvent *, xEvent * #endif Index: xc/programs/Xserver/include/gc.h diff -u xc/programs/Xserver/include/gc.h:1.4 xc/programs/Xserver/include/gc.h:1.5 --- xc/programs/Xserver/include/gc.h:1.4 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/gc.h Fri Dec 14 14:59:54 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/include/gc.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/gc.h,v 1.5 2001/12/14 19:59:54 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: gc.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: gc.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ #ifndef GC_H #define GC_H Index: xc/programs/Xserver/include/gcstruct.h diff -u xc/programs/Xserver/include/gcstruct.h:1.5 xc/programs/Xserver/include/gcstruct.h:1.6 --- xc/programs/Xserver/include/gcstruct.h:1.5 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/gcstruct.h Fri Dec 14 14:59:54 2001 @@ -1,9 +1,13 @@ -/* $Xorg: gcstruct.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: gcstruct.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/gcstruct.h,v 1.5 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/gcstruct.h,v 1.6 2001/12/14 19:59:54 dawes Exp $ */ #ifndef GCSTRUCT_H #define GCSTRUCT_H Index: xc/programs/Xserver/include/input.h diff -u xc/programs/Xserver/include/input.h:3.6 xc/programs/Xserver/include/input.h:3.7 --- xc/programs/Xserver/include/input.h:3.6 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/input.h Fri Dec 14 14:59:54 2001 @@ -1,9 +1,13 @@ -/* $Xorg: input.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: input.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/include/input.h,v 3.6 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/input.h,v 3.7 2001/12/14 19:59:54 dawes Exp $ */ #ifndef INPUT_H #define INPUT_H Index: xc/programs/Xserver/include/inputstr.h diff -u xc/programs/Xserver/include/inputstr.h:1.4 xc/programs/Xserver/include/inputstr.h:1.5 --- xc/programs/Xserver/include/inputstr.h:1.4 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/inputstr.h Fri Dec 14 14:59:54 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/include/inputstr.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/inputstr.h,v 1.5 2001/12/14 19:59:54 dawes Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ ********************************************************/ -/* $Xorg: inputstr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: inputstr.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ #ifndef INPUTSTRUCT_H #define INPUTSTRUCT_H Index: xc/programs/Xserver/include/misc.h diff -u xc/programs/Xserver/include/misc.h:3.26 xc/programs/Xserver/include/misc.h:3.28 --- xc/programs/Xserver/include/misc.h:3.26 Sun May 6 02:28:46 2001 +++ xc/programs/Xserver/include/misc.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/include/misc.h,v 3.26 2001/05/06 06:28:46 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/include/misc.h,v 3.28 2001/12/14 19:59:55 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -62,7 +66,7 @@ OF THIS SOFTWARE. ******************************************************************/ -/* $Xorg: misc.h,v 1.4 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: misc.h,v 1.5 2001/02/09 02:05:15 xorgcvs Exp $ */ #ifndef MISC_H #define MISC_H 1 /* @@ -81,11 +85,7 @@ #ifndef IN_MODULE #ifndef NULL -#ifndef X_NOT_STDC_ENV #include <stddef.h> -#else -#define NULL ((void *)0) -#endif #endif #endif @@ -146,16 +146,10 @@ #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) #ifndef IN_MODULE -#ifdef X_NOT_STDC_ENV -#ifndef abs -#define abs(a) ((a) > 0 ? (a) : -(a)) -#endif -#else /* abs() is a function, not a macro; include the file declaring * it in case we haven't done that yet. */ #include <stdlib.h> -#endif /* X_NOT_STDC_ENV */ #endif /* IN_MODULE */ #ifndef Fabs #define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */ Index: xc/programs/Xserver/include/miscstruct.h diff -u xc/programs/Xserver/include/miscstruct.h:3.2 xc/programs/Xserver/include/miscstruct.h:3.3 --- xc/programs/Xserver/include/miscstruct.h:3.2 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/miscstruct.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: miscstruct.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: miscstruct.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/miscstruct.h,v 3.2 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/miscstruct.h,v 3.3 2001/12/14 19:59:55 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.9 xc/programs/Xserver/include/opaque.h:1.10 --- xc/programs/Xserver/include/opaque.h:1.9 Fri May 4 15:05:52 2001 +++ xc/programs/Xserver/include/opaque.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: opaque.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: opaque.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.9 2001/05/04 19:05:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.10 2001/12/14 19:59:55 dawes Exp $ */ #ifndef OPAQUE_H #define OPAQUE_H Index: xc/programs/Xserver/include/os.h diff -u xc/programs/Xserver/include/os.h:3.37 xc/programs/Xserver/include/os.h:3.40 --- xc/programs/Xserver/include/os.h:3.37 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/os.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/include/os.h,v 3.37 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/os.h,v 3.40 2001/12/14 19:59:55 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ ******************************************************************/ -/* $Xorg: os.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: os.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ #ifndef OS_H #define OS_H @@ -91,15 +95,7 @@ #ifdef SCO #include <stdio.h> #endif -#ifndef X_NOT_STDC_ENV #include <string.h> -#else -#ifdef SYSV -#include <string.h> -#else -#include <strings.h> -#endif -#endif #endif /* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */ @@ -147,7 +143,7 @@ #endif ); -extern int ResetCurrentRequest( +extern void ResetCurrentRequest( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif @@ -185,6 +181,12 @@ #endif ); +extern void InitConnectionLimits( +#if NeedFunctionPrototypes + void +#endif +); + extern void CreateWellKnownSockets( #if NeedFunctionPrototypes void @@ -197,6 +199,12 @@ #endif ); +extern void CloseWellKnownConnections( +#if NeedFunctionPrototypes + void +#endif +); + extern XID AuthorizationIDOfClient( #if NeedFunctionPrototypes @@ -233,49 +241,49 @@ #endif ); -extern int AddEnabledDevice( +extern void AddEnabledDevice( #if NeedFunctionPrototypes int /*fd*/ #endif ); -extern int RemoveEnabledDevice( +extern void RemoveEnabledDevice( #if NeedFunctionPrototypes int /*fd*/ #endif ); -extern int OnlyListenToOneClient( +extern void OnlyListenToOneClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); -extern int ListenToAllClients( +extern void ListenToAllClients( #if NeedFunctionPrototypes void #endif ); -extern int IgnoreClient( +extern void IgnoreClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); -extern int AttendClient( +extern void AttendClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); -extern int MakeClientGrabImpervious( +extern void MakeClientGrabImpervious( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); -extern int MakeClientGrabPervious( +extern void MakeClientGrabPervious( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif @@ -459,6 +467,12 @@ ); extern int auditTrailLevel; + +extern void AuditPrefix( +#if NeedFunctionPrototypes + const char * +#endif +); extern void AuditF( #if NeedVarargsPrototypes Index: xc/programs/Xserver/include/pixmap.h diff -u xc/programs/Xserver/include/pixmap.h:1.1.1.3 xc/programs/Xserver/include/pixmap.h:1.2 --- xc/programs/Xserver/include/pixmap.h:1.1.1.3 Tue Jan 16 17:44:03 2001 +++ xc/programs/Xserver/include/pixmap.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pixmap.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: pixmap.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/include/pixmapstr.h diff -u xc/programs/Xserver/include/pixmapstr.h:1.1.1.3 xc/programs/Xserver/include/pixmapstr.h:1.2 --- xc/programs/Xserver/include/pixmapstr.h:1.1.1.3 Tue Jan 16 17:44:03 2001 +++ xc/programs/Xserver/include/pixmapstr.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pixmapstr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: pixmapstr.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/include/property.h diff -u xc/programs/Xserver/include/property.h:1.1.1.3 xc/programs/Xserver/include/property.h:1.3 --- xc/programs/Xserver/include/property.h:1.1.1.3 Tue Jan 16 17:44:03 2001 +++ xc/programs/Xserver/include/property.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: property.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ +/* $Xorg: property.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,8 +45,13 @@ SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/include/property.h,v 1.3 2001/12/14 19:59:55 dawes Exp $ */ + #ifndef PROPERTY_H #define PROPERTY_H + +#include "window.h" + typedef struct _Property *PropertyPtr; extern int ChangeWindowProperty( Index: xc/programs/Xserver/include/propertyst.h diff -u xc/programs/Xserver/include/propertyst.h:3.2 xc/programs/Xserver/include/propertyst.h:3.3 --- xc/programs/Xserver/include/propertyst.h:3.2 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/propertyst.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: propertyst.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ +/* $Xorg: propertyst.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/propertyst.h,v 3.2 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/propertyst.h,v 3.3 2001/12/14 19:59:55 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.3 xc/programs/Xserver/include/region.h:1.2 --- xc/programs/Xserver/include/region.h:1.1.1.3 Tue Jan 16 17:44:04 2001 +++ xc/programs/Xserver/include/region.h Fri Dec 14 14:59:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: region.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ +/* $Xorg: region.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/include/regionstr.h diff -u xc/programs/Xserver/include/regionstr.h:1.5 xc/programs/Xserver/include/regionstr.h:1.7 --- xc/programs/Xserver/include/regionstr.h:1.5 Thu Mar 29 21:15:23 2001 +++ xc/programs/Xserver/include/regionstr.h Fri Dec 14 14:59:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: regionstr.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ +/* $Xorg: regionstr.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.5 2001/03/30 02:15:23 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.7 2001/12/14 19:59:56 dawes Exp $ */ #ifndef REGIONSTRUCT_H #define REGIONSTRUCT_H @@ -251,7 +255,10 @@ #define REGION_UNINIT(_pScreen, _pReg) \ { \ - if ((_pReg)->data && (_pReg)->data->size) xfree((_pReg)->data); \ + if ((_pReg)->data && (_pReg)->data->size) { \ + xfree((_pReg)->data); \ + (_pReg)->data = NULL; \ + } \ } #define REGION_RESET(_pScreen, _pReg, _pBox) \ Index: xc/programs/Xserver/include/resource.h diff -u xc/programs/Xserver/include/resource.h:1.9 xc/programs/Xserver/include/resource.h:1.10 --- xc/programs/Xserver/include/resource.h:1.9 Fri Feb 2 16:39:02 2001 +++ xc/programs/Xserver/include/resource.h Fri Dec 14 14:59:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: resource.h,v 1.4 2000/08/17 19:53:30 cpqbld Exp $ */ +/* $Xorg: resource.h,v 1.5 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.9 2001/02/02 21:39:02 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.10 2001/12/14 19:59:56 dawes Exp $ */ #ifndef RESOURCE_H #define RESOURCE_H 1 Index: xc/programs/Xserver/include/rgb.h diff -u xc/programs/Xserver/include/rgb.h:1.1.1.3 xc/programs/Xserver/include/rgb.h:1.2 --- xc/programs/Xserver/include/rgb.h:1.1.1.3 Tue Jan 16 17:44:06 2001 +++ xc/programs/Xserver/include/rgb.h Fri Dec 14 14:59:56 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: rgb.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ +/* $Xorg: rgb.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ #ifndef RGB_H #define RGB_H Index: xc/programs/Xserver/include/screenint.h diff -u xc/programs/Xserver/include/screenint.h:1.4 xc/programs/Xserver/include/screenint.h:1.5 --- xc/programs/Xserver/include/screenint.h:1.4 Wed Jan 17 17:36:57 2001 +++ xc/programs/Xserver/include/screenint.h Fri Dec 14 14:59:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: screenint.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ +/* $Xorg: screenint.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/screenint.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/screenint.h,v 1.5 2001/12/14 19:59:56 dawes Exp $ */ #ifndef SCREENINT_H #define SCREENINT_H Index: xc/programs/Xserver/include/scrnintstr.h diff -u xc/programs/Xserver/include/scrnintstr.h:1.9 xc/programs/Xserver/include/scrnintstr.h:1.10 --- xc/programs/Xserver/include/scrnintstr.h:1.9 Wed Jan 17 17:36:58 2001 +++ xc/programs/Xserver/include/scrnintstr.h Fri Dec 14 14:59:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: scrnintstr.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ +/* $Xorg: scrnintstr.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/scrnintstr.h,v 1.9 2001/01/17 22:36:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/scrnintstr.h,v 1.10 2001/12/14 19:59:56 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.3 xc/programs/Xserver/include/selection.h:1.2 --- xc/programs/Xserver/include/selection.h:1.1.1.3 Tue Jan 16 17:44:07 2001 +++ xc/programs/Xserver/include/selection.h Fri Dec 14 14:59:56 2001 @@ -1,4 +1,4 @@ -/* $Xorg: selection.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ +/* $Xorg: selection.h,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */ #ifndef SELECTION_H #define SELECTION_H 1 @@ -6,7 +6,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/include/servermd.h diff -u xc/programs/Xserver/include/servermd.h:3.44 xc/programs/Xserver/include/servermd.h:3.51 --- xc/programs/Xserver/include/servermd.h:3.44 Thu Apr 12 16:10:00 2001 +++ xc/programs/Xserver/include/servermd.h Fri Dec 14 14:59:56 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.44 2001/04/12 20:10:00 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.51 2001/12/14 19:59:56 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -149,6 +153,20 @@ #endif /* __arm32__ */ +#if defined (__hppa__) + +#define IMAGE_BYTE_ORDER MSBFirst +#define BITMAP_BIT_ORDER MSBFirst +#define GLYPHPADBYTES 4 /* to make fb work */ +#define GETLEFTBITS_ALIGNMENT 1 /* PA forces longs to 4 */ + /* byte boundries */ +#define AVOID_MEMORY_READ +#define FAST_CONSTANT_OFFSET_MODE +#define LARGE_INSTRUCTION_CACHE +#define PLENTIFUL_REGISTERS + +#endif /* __hppa__ */ + #if defined(__powerpc__) #define IMAGE_BYTE_ORDER MSBFirst @@ -170,8 +188,29 @@ #endif /* PowerPC */ +#if defined(__sh__) + +#if defined(__BIG_ENDIAN__) +# define IMAGE_BYTE_ORDER MSBFirst +# define BITMAP_BIT_ORDER MSBFirst +# define GLYPHPADBYTES 4 +# define GETLEFTBITS_ALIGNMENT 1 +#else +# define IMAGE_BYTE_ORDER LSBFirst +# define BITMAP_BIT_ORDER LSBFirst +# define GLYPHPADBYTES 4 +# define GETLEFTBITS_ALIGNMENT 1 +#endif + +#define AVOID_MEMORY_READ +#define FAST_CONSTANT_OFFSET_MODE +#define LARGE_INSTRUCTION_CACHE +#define PLENTIFUL_REGISTERS + +#endif /* SuperH */ + + #if (defined(sun) && !(defined(i386) && defined(SVR4))) || \ - (defined(AMOEBA) && (defined(sparc) || defined(mc68000))) || \ (defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \ defined(__sparc__) || defined(__mc68000__) @@ -311,7 +350,38 @@ #endif /* alpha */ +#if defined (linux) && defined (__s390__) + +#define IMAGE_BYTE_ORDER MSBFirst +#define BITMAP_BIT_ORDER MSBFirst +#define GLYPHPADBYTES 4 +#define GETLEFTBITS_ALIGNMENT 1 + +#define BITMAP_SCANLINE_UNIT 8 +#define LARGE_INSTRUCTION_CACHE +#define FAST_CONSTANT_OFFSET_MODE +#define FAST_UNALIGNED_READ + +#define FAST_MEMCPY +#endif /* linux/s390 */ + +#if defined (linux) && defined (__s390x__) + +#define IMAGE_BYTE_ORDER MSBFirst +#define BITMAP_BIT_ORDER MSBFirst +#define GLYPHPADBYTES 4 +#define GETLEFTBITS_ALIGNMENT 1 + +#define BITMAP_SCANLINE_UNIT 8 +#define LARGE_INSTRUCTION_CACHE +#define FAST_CONSTANT_OFFSET_MODE +#define FAST_UNALIGNED_READ + +#define FAST_MEMCPY +#endif /* linux/s390x */ + + #if defined(__ia64__) || defined(ia64) # define IMAGE_BYTE_ORDER LSBFirst @@ -363,16 +433,14 @@ #endif /* luna */ -#if (defined(AMOEBA) && defined(i80386)) || \ - (defined(SVR4) && defined(i386)) || \ +#if (defined(SVR4) && defined(i386)) || \ defined(__alpha__) || defined(__alpha) || \ defined(__i386__) || \ defined(__EMX__) || \ defined(__OS2ELF__) || \ defined(__QNX__) || \ - defined(MACH386) || \ - defined(MINIX) - + defined(__s390x__) || defined(__s390__) + #ifndef IMAGE_BYTE_ORDER #define IMAGE_BYTE_ORDER LSBFirst #endif Index: xc/programs/Xserver/include/site.h diff -u xc/programs/Xserver/include/site.h:1.6 xc/programs/Xserver/include/site.h:1.8 --- xc/programs/Xserver/include/site.h:1.6 Wed Jan 17 17:36:58 2001 +++ xc/programs/Xserver/include/site.h Wed Dec 19 16:37:35 2001 @@ -1,9 +1,13 @@ -/* $Xorg: site.h,v 1.4 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: site.h,v 1.6 2001/02/09 02:05:16 xorgcvs Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/include/site.h,v 1.6 2001/01/17 22:36:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/site.h,v 1.8 2001/12/19 21:37:35 dawes Exp $ */ #ifndef SITE_H #define SITE_H @@ -59,7 +63,7 @@ * by the vendor. */ #ifndef VENDOR_RELEASE -#define VENDOR_RELEASE 6510 +#define VENDOR_RELEASE 6600 #endif /* Index: xc/programs/Xserver/include/validate.h diff -u xc/programs/Xserver/include/validate.h:1.4 xc/programs/Xserver/include/validate.h:1.5 --- xc/programs/Xserver/include/validate.h:1.4 Wed Jan 17 17:36:58 2001 +++ xc/programs/Xserver/include/validate.h Fri Dec 14 14:59:56 2001 @@ -1,10 +1,14 @@ -/* $Xorg: validate.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: validate.h,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -20,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/include/validate.h,v 1.4 2001/01/17 22:36:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/validate.h,v 1.5 2001/12/14 19:59:56 dawes Exp $ */ #ifndef VALIDATE_H #define VALIDATE_H Index: xc/programs/Xserver/include/window.h diff -u xc/programs/Xserver/include/window.h:1.3 xc/programs/Xserver/include/window.h:1.4 --- xc/programs/Xserver/include/window.h:1.3 Fri Feb 2 17:36:58 2001 +++ xc/programs/Xserver/include/window.h Fri Dec 14 14:59:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: window.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: window.h,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/include/windowstr.h diff -u xc/programs/Xserver/include/windowstr.h:1.4 xc/programs/Xserver/include/windowstr.h:1.6 --- xc/programs/Xserver/include/windowstr.h:1.4 Wed Jan 17 17:36:58 2001 +++ xc/programs/Xserver/include/windowstr.h Fri Dec 14 14:59:57 2001 @@ -1,9 +1,13 @@ -/* $Xorg: windowstr.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: windowstr.h,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,16 +45,12 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/windowstr.h,v 1.4 2001/01/17 22:36:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/windowstr.h,v 1.6 2001/12/14 19:59:57 dawes Exp $ */ #ifndef WINDOWSTRUCT_H #define WINDOWSTRUCT_H -#ifndef __CYGWIN__ #include "window.h" -#else -#include "xxwindow.h" -#endif #include "pixmapstr.h" #include "regionstr.h" #include "cursor.h" Index: xc/programs/Xserver/iplan2p4/iplmap.h diff -u xc/programs/Xserver/iplan2p4/iplmap.h:3.1 xc/programs/Xserver/iplan2p4/iplmap.h:3.2 --- xc/programs/Xserver/iplan2p4/iplmap.h:3.1 Sun Apr 5 12:42:26 1998 +++ xc/programs/Xserver/iplan2p4/iplmap.h Wed Jul 25 11:05:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/iplan2p4/iplmap.h,v 3.1 1998/04/05 16:42:26 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/iplan2p4/iplmap.h,v 3.2 2001/07/25 15:05:09 dawes Exp $ */ /* * $XConsortium: iplmap.h,v 1.9 94/04/17 20:28:54 dpw Exp $ * @@ -46,7 +46,7 @@ #endif -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define CATNAME(prefix,subname) prefix##subname #else #define CATNAME(prefix,subname) prefix/**/subname Index: xc/programs/Xserver/iplan2p4/iplmergerop.h diff -u xc/programs/Xserver/iplan2p4/iplmergerop.h:3.0 xc/programs/Xserver/iplan2p4/iplmergerop.h:3.1 --- xc/programs/Xserver/iplan2p4/iplmergerop.h:3.0 Sat Aug 17 21:54:53 1996 +++ xc/programs/Xserver/iplan2p4/iplmergerop.h Wed Jul 25 11:05:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/iplan2p4/iplmergerop.h,v 3.0 1996/08/18 01:54:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/iplan2p4/iplmergerop.h,v 3.1 2001/07/25 15:05:09 dawes Exp $ */ #ifndef _IPLANMERGEROP_H_ #define _IPLANMERGEROP_H_ @@ -133,7 +133,7 @@ INTER_MROP_MASK(src,dst,mask,dst2) #endif -#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define INTER_MROP_NAME_CAT(prefix,suffix) prefix##suffix #else #define INTER_MROP_NAME_CAT(prefix,suffix) prefix/**/suffix Index: xc/programs/Xserver/iplan2p4/iplpixmap.c diff -u xc/programs/Xserver/iplan2p4/iplpixmap.c:3.0 xc/programs/Xserver/iplan2p4/iplpixmap.c:3.1 --- xc/programs/Xserver/iplan2p4/iplpixmap.c:3.0 Sat Aug 17 21:54:59 1996 +++ xc/programs/Xserver/iplan2p4/iplpixmap.c Mon Dec 17 15:00:46 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/iplan2p4/iplpixmap.c,v 3.0 1996/08/18 01:54:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/iplan2p4/iplpixmap.c,v 3.1 2001/12/17 20:00:46 dawes Exp $ */ /* $XConsortium: iplpixmap.c,v 5.14 94/04/17 20:28:56 dpw Exp $ */ /*********************************************************** @@ -137,7 +137,7 @@ /* replicates a pattern to be a full 32 bits wide. relies on the fact that each scnaline is longword padded. - doesn't do anything if pixmap is not a factor osf 32 wide. + doesn't do anything if pixmap is not a factor of 32 wide. changes width field of pixmap if successful, so that the fast iplXRotatePixmap code gets used if we rotate the pixmap later. iplYRotatePixmap code gets used if we rotate the pixmap later. Index: xc/programs/Xserver/iplan2p4/iplrrop.h diff -u xc/programs/Xserver/iplan2p4/iplrrop.h:3.0 xc/programs/Xserver/iplan2p4/iplrrop.h:3.1 --- xc/programs/Xserver/iplan2p4/iplrrop.h:3.0 Sat Aug 17 21:55:04 1996 +++ xc/programs/Xserver/iplan2p4/iplrrop.h Wed Jul 25 11:05:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/iplan2p4/iplrrop.h,v 3.0 1996/08/18 01:55:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/iplan2p4/iplrrop.h,v 3.1 2001/07/25 15:05:09 dawes Exp $ */ /* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with interleaved planes */ @@ -68,7 +68,7 @@ #endif -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define INTER_RROP_NAME_CAT(prefix,suffix) prefix##suffix #else #define INTER_RROP_NAME_CAT(prefix,suffix) prefix/**/suffix Index: xc/programs/Xserver/lbx/lbxcmap.c diff -u xc/programs/Xserver/lbx/lbxcmap.c:1.8 xc/programs/Xserver/lbx/lbxcmap.c:1.10 --- xc/programs/Xserver/lbx/lbxcmap.c:1.8 Fri Feb 16 08:24:10 2001 +++ xc/programs/Xserver/lbx/lbxcmap.c Fri Dec 14 14:59:59 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxcmap.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: lbxcmap.c,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/lbx/lbxcmap.c,v 1.8 2001/02/16 13:24:10 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxcmap.c,v 1.10 2001/12/14 19:59:59 dawes Exp $ */ #include <sys/types.h> #define NEED_REPLIES @@ -265,7 +269,7 @@ else shift = 15 - (flags & LBX_RGB_BITS_MASK); rgb_sz = rgb2 + 1; - if (channels == DoRed|DoGreen|DoBlue) + if (channels == (DoRed|DoGreen|DoBlue)) rgb_sz *= 3; /* kinda gross, but ddxen use AllocAll on static maps */ allocpriv = (pmap->pVisual->class & DynamicClass) ? AllocPrivate : 0; Index: xc/programs/Xserver/lbx/lbxdix.c diff -u xc/programs/Xserver/lbx/lbxdix.c:1.6 xc/programs/Xserver/lbx/lbxdix.c:1.8 --- xc/programs/Xserver/lbx/lbxdix.c:1.6 Tue May 15 06:19:43 2001 +++ xc/programs/Xserver/lbx/lbxdix.c Fri Dec 14 14:59:59 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxdix.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: lbxdix.c,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxdix.c,v 1.6 2001/05/15 10:19:43 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxdix.c,v 1.8 2001/12/14 19:59:59 dawes Exp $ */ /* various bits of DIX-level mangling */ @@ -74,10 +78,6 @@ #endif #include "swaprep.h" -extern int (*ProcVector[256]) (ClientPtr); -extern int (*SwappedProcVector[256]) (ClientPtr); - - int lbx_font_private = -1; void @@ -96,7 +96,6 @@ proxy->motion_allowed_events += num; } -extern WindowPtr *WindowTable; extern xConnSetupPrefix connSetupPrefix; extern char *ConnectionInfo; extern int connBlockScreenStart; @@ -186,8 +185,6 @@ return client->noClientException; } -extern InputInfo inputInfo; - static XID modifier_map_tag; int @@ -689,7 +686,7 @@ /* see if we're asking for one already in the pipeline */ - for (prev = &queried_tags; stqp = *prev; prev = &stqp->next) { + for (prev = &queried_tags; (stqp = *prev); prev = &stqp->next) { if (stqp->tag == tag) { /* add new client to list */ newlist = (ClientPtr *) xrealloc(stqp->stalled_clients, @@ -746,7 +743,7 @@ { SendTagQPtr stqp, *prev; - for (prev = &queried_tags; stqp = *prev; prev = &stqp->next) { + for (prev = &queried_tags; (stqp = *prev); prev = &stqp->next) { if (stqp->tag == tag) { *prev = stqp->next; LbxFreeQTag(stqp); @@ -861,7 +858,7 @@ keyboard_map_tag = 0; /* clean out any pending tag requests */ - while (stqp = queried_tags) { + while ((stqp = queried_tags)) { queried_tags = stqp->next; LbxFreeQTag(stqp); } Index: xc/programs/Xserver/lbx/lbxgfx.c diff -u xc/programs/Xserver/lbx/lbxgfx.c:1.3 xc/programs/Xserver/lbx/lbxgfx.c:1.4 --- xc/programs/Xserver/lbx/lbxgfx.c:1.3 Wed Jan 17 17:36:59 2001 +++ xc/programs/Xserver/lbx/lbxgfx.c Thu Aug 23 10:46:57 2001 @@ -21,7 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxgfx.c,v 1.3 2001/01/17 22:36:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxgfx.c,v 1.4 2001/08/23 14:46:57 alanh Exp $ */ /* various bits of DIX-level mangling */ @@ -49,8 +49,6 @@ #define DrawableCache(client) (LbxClient(client)->drawableCache) #define GContextCache(client) (LbxClient(client)->gcontextCache) -extern int (*ProcVector[256])(ClientPtr); - static void push (XID cache[GFX_CACHE_SIZE], XID xid) @@ -689,7 +687,7 @@ REQUEST (xLbxGetImageReq); xLbxGetImageReply *reply = NULL; int lbxLen, xLen, n; - int method, bytes, status; + int method = 0, bytes, status; xGetImageReply *theImage; REQUEST_SIZE_MATCH(xLbxGetImageReq); Index: xc/programs/Xserver/lbx/lbxmain.c diff -u xc/programs/Xserver/lbx/lbxmain.c:1.9 xc/programs/Xserver/lbx/lbxmain.c:1.13 --- xc/programs/Xserver/lbx/lbxmain.c:1.9 Wed Jan 17 17:36:59 2001 +++ xc/programs/Xserver/lbx/lbxmain.c Fri Dec 14 15:00:00 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxmain.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: lbxmain.c,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxmain.c,v 1.9 2001/01/17 22:36:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxmain.c,v 1.13 2001/12/14 20:00:00 dawes Exp $ */ #include <sys/types.h> #define NEED_REPLIES @@ -68,9 +72,6 @@ #include "lbxtags.h" #include "Xfuncproto.h" #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #ifndef Lynx #include <sys/uio.h> #else @@ -86,15 +87,6 @@ #define MAXBYTESDIFF 8 -extern void LbxAllowMotion ( ClientPtr client, int num ); -extern int LbxDecodePoints ( char *in, char *inend, short *out ); -extern int LbxDecodeSegment ( char *in, char *inend, short *out ); -extern int LbxDecodeRectangle ( char *in, char *inend, short *out ); -extern int LbxDecodeArc ( char *in, char *inend, short *out ); - - -extern int GrabInProgress; - int LbxWhoAmI = 1; /* * for lbx zlib library to know who we are * server = 1 @@ -930,7 +922,7 @@ int ProcLbxQueryVersion (ClientPtr client) { - REQUEST(xLbxQueryVersionReq); + /* REQUEST(xLbxQueryVersionReq); */ xLbxQueryVersionReply rep; register int n; @@ -1119,7 +1111,7 @@ int ProcLbxStopProxy(ClientPtr client) { - REQUEST(xLbxStopProxyReq); + /* REQUEST(xLbxStopProxyReq); */ LbxProxyPtr proxy; LbxClientPtr lbxClient = LbxClient(client); @@ -1188,7 +1180,7 @@ int ProcLbxEndLargeRequest(ClientPtr client) { - REQUEST(xReq); + /* REQUEST(xReq); */ client->sequence--; REQUEST_SIZE_MATCH(xReq); @@ -1482,7 +1474,7 @@ int ProcLbxGetModifierMapping(ClientPtr client) { - REQUEST(xLbxGetModifierMappingReq); + /* REQUEST(xLbxGetModifierMappingReq); */ REQUEST_SIZE_MATCH(xLbxGetModifierMappingReq); return LbxGetModifierMapping(client); @@ -1491,7 +1483,7 @@ int ProcLbxGetKeyboardMapping(ClientPtr client) { - REQUEST(xLbxGetKeyboardMappingReq); + /* REQUEST(xLbxGetKeyboardMappingReq); */ REQUEST_SIZE_MATCH(xLbxGetKeyboardMappingReq); return LbxGetKeyboardMapping(client); @@ -1500,7 +1492,7 @@ int ProcLbxQueryFont(ClientPtr client) { - REQUEST(xLbxQueryFontReq); + /* REQUEST(xLbxQueryFontReq); */ REQUEST_SIZE_MATCH(xLbxQueryFontReq); return LbxQueryFont(client); @@ -1509,7 +1501,7 @@ int ProcLbxChangeProperty(ClientPtr client) { - REQUEST(xLbxChangePropertyReq); + /* REQUEST(xLbxChangePropertyReq); */ REQUEST_SIZE_MATCH(xLbxChangePropertyReq); return LbxChangeProperty(client); @@ -1518,7 +1510,7 @@ int ProcLbxGetProperty(ClientPtr client) { - REQUEST(xLbxGetPropertyReq); + /* REQUEST(xLbxGetPropertyReq); */ REQUEST_SIZE_MATCH(xLbxGetPropertyReq); return LbxGetProperty(client); Index: xc/programs/Xserver/lbx/lbxopts.c diff -u xc/programs/Xserver/lbx/lbxopts.c:1.5 xc/programs/Xserver/lbx/lbxopts.c:1.6 --- xc/programs/Xserver/lbx/lbxopts.c:1.5 Wed Jan 17 17:37:00 2001 +++ xc/programs/Xserver/lbx/lbxopts.c Sat Oct 27 23:34:12 2001 @@ -21,7 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxopts.c,v 1.5 2001/01/17 22:37:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxopts.c,v 1.6 2001/10/28 03:34:12 tsi Exp $ */ #ifdef OPTDEBUG #include <stdio.h> @@ -420,8 +420,8 @@ unsigned char *preplyStart = preply; int numMethods = *popt++; unsigned char *myIndices, *hisIndices; - unsigned *retFormats; - int **retDepths; + unsigned int *retFormats = NULL; + int **retDepths = NULL; int replyCount = 0; int status, i, j; @@ -484,8 +484,8 @@ for (i = 0; i < numMethods; i++) { - unsigned formatMask, newFormatMask; - int depthCount, *depths, len; + unsigned int formatMask = 0, newFormatMask = 0; + int depthCount, *depths = NULL, len; int freeDepths; char *methodName; Index: xc/programs/Xserver/lbx/lbxprop.c diff -u xc/programs/Xserver/lbx/lbxprop.c:1.4 xc/programs/Xserver/lbx/lbxprop.c:1.5 --- xc/programs/Xserver/lbx/lbxprop.c:1.4 Tue May 15 06:19:43 2001 +++ xc/programs/Xserver/lbx/lbxprop.c Fri Dec 14 15:00:00 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxprop.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: lbxprop.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Copyright 1986, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxprop.c,v 1.4 2001/05/15 10:19:43 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxprop.c,v 1.5 2001/12/14 20:00:00 dawes Exp $ */ /* various bits of DIX-level mangling */ Index: xc/programs/Xserver/lbx/lbxserve.h diff -u xc/programs/Xserver/lbx/lbxserve.h:1.3 xc/programs/Xserver/lbx/lbxserve.h:1.5 --- xc/programs/Xserver/lbx/lbxserve.h:1.3 Wed Jan 17 17:37:00 2001 +++ xc/programs/Xserver/lbx/lbxserve.h Fri Dec 14 15:00:00 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxserve.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: lbxserve.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,9 +45,13 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxserve.h,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxserve.h,v 1.5 2001/12/14 20:00:00 dawes Exp $ */ #ifndef _LBXSERVE_H_ + +#include "colormap.h" +#include "property.h" + #define _LBXSERVE_H_ #define _XLBX_SERVER_ #include "lbxstr.h" @@ -135,9 +143,10 @@ extern void SwitchClientInput ( ClientPtr client, Bool pending ); extern int PrepareLargeReqBuffer ( ClientPtr client ); extern Bool AppendFakeRequest ( ClientPtr client, char *data, int count ); -extern int LbxFreeOsBuffers ( LbxProxyPtr proxy ); +extern void LbxFreeOsBuffers ( LbxProxyPtr proxy ); extern Bool AllocateLargeReqBuffer ( ClientPtr client, int size ); extern Bool AddToLargeReqBuffer ( ClientPtr client, char *data, int size ); +extern void LbxPrimeInput ( ClientPtr client, LbxProxyPtr proxy ); /* lbxcmap.c */ extern int LbxCmapInit ( void ); Index: xc/programs/Xserver/lbx/lbxsquish.c diff -u xc/programs/Xserver/lbx/lbxsquish.c:1.3 xc/programs/Xserver/lbx/lbxsquish.c:1.4 --- xc/programs/Xserver/lbx/lbxsquish.c:1.3 Wed Jan 17 17:37:00 2001 +++ xc/programs/Xserver/lbx/lbxsquish.c Fri Dec 14 15:00:01 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxsquish.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: lbxsquish.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxsquish.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxsquish.c,v 1.4 2001/12/14 20:00:01 dawes Exp $ */ #define NEED_REPLIES #define NEED_EVENTS #include "X.h" Index: xc/programs/Xserver/lbx/lbxswap.c diff -u xc/programs/Xserver/lbx/lbxswap.c:1.3 xc/programs/Xserver/lbx/lbxswap.c:1.4 --- xc/programs/Xserver/lbx/lbxswap.c:1.3 Wed Jan 17 17:37:00 2001 +++ xc/programs/Xserver/lbx/lbxswap.c Fri Dec 14 15:00:01 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxswap.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ +/* $Xorg: lbxswap.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxswap.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxswap.c,v 1.4 2001/12/14 20:00:01 dawes Exp $ */ #include <sys/types.h> #define NEED_REPLIES Index: xc/programs/Xserver/lbx/lbxtags.c diff -u xc/programs/Xserver/lbx/lbxtags.c:1.3 xc/programs/Xserver/lbx/lbxtags.c:1.4 --- xc/programs/Xserver/lbx/lbxtags.c:1.3 Wed Jan 17 17:37:00 2001 +++ xc/programs/Xserver/lbx/lbxtags.c Fri Dec 14 15:00:01 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxtags.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ +/* $Xorg: lbxtags.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxtags.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxtags.c,v 1.4 2001/12/14 20:00:01 dawes Exp $ */ #include "X.h" #include "misc.h" Index: xc/programs/Xserver/lbx/lbxtags.h diff -u xc/programs/Xserver/lbx/lbxtags.h:1.3 xc/programs/Xserver/lbx/lbxtags.h:1.4 --- xc/programs/Xserver/lbx/lbxtags.h:1.3 Wed Jan 17 17:37:00 2001 +++ xc/programs/Xserver/lbx/lbxtags.h Fri Dec 14 15:00:01 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxtags.h,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ +/* $Xorg: lbxtags.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxtags.h,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxtags.h,v 1.4 2001/12/14 20:00:01 dawes Exp $ */ #ifndef _LBXTAGS_H_ #define _LBXTAGS_H_ Index: xc/programs/Xserver/lbx/lbxzerorep.c diff -u xc/programs/Xserver/lbx/lbxzerorep.c:1.3 xc/programs/Xserver/lbx/lbxzerorep.c:1.4 --- xc/programs/Xserver/lbx/lbxzerorep.c:1.3 Wed Jan 17 17:37:00 2001 +++ xc/programs/Xserver/lbx/lbxzerorep.c Fri Dec 14 15:00:02 2001 @@ -1,10 +1,14 @@ -/* $Xorg: lbxzerorep.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ +/* $Xorg: lbxzerorep.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/lbx/lbxzerorep.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxzerorep.c,v 1.4 2001/12/14 20:00:02 dawes Exp $ */ /* * This module handles zeroing out unused pad bytes in core X replies. Index: xc/programs/Xserver/mfb/fastblt.h diff -u xc/programs/Xserver/mfb/fastblt.h:1.4 xc/programs/Xserver/mfb/fastblt.h:1.5 --- xc/programs/Xserver/mfb/fastblt.h:1.4 Wed Jan 17 17:37:01 2001 +++ xc/programs/Xserver/mfb/fastblt.h Fri Dec 14 15:00:03 2001 @@ -1,9 +1,13 @@ -/* $Xorg: fastblt.h,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ +/* $Xorg: fastblt.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mfb/fastblt.h,v 1.4 2001/01/17 22:37:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/fastblt.h,v 1.5 2001/12/14 20:00:03 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.5 xc/programs/Xserver/mfb/maskbits.c:1.6 --- xc/programs/Xserver/mfb/maskbits.c:1.5 Wed Jan 17 17:37:01 2001 +++ xc/programs/Xserver/mfb/maskbits.c Fri Dec 14 15:00:03 2001 @@ -1,10 +1,14 @@ -/* $Xorg: maskbits.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ +/* $Xorg: maskbits.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,7 +48,7 @@ SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/mfb/maskbits.c,v 1.5 2001/01/17 22:37:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/maskbits.c,v 1.6 2001/12/14 20:00:03 dawes Exp $ */ #include "maskbits.h" #include "servermd.h" Index: xc/programs/Xserver/mfb/mergerop.h diff -u xc/programs/Xserver/mfb/mergerop.h:3.11 xc/programs/Xserver/mfb/mergerop.h:3.14 --- xc/programs/Xserver/mfb/mergerop.h:3.11 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mergerop.h Fri Dec 14 15:00:03 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: mergerop.h,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ + * $Xorg: mergerop.h,v 1.4 2001/02/09 02:05:18 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ * * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/Xserver/mfb/mergerop.h,v 3.11 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mergerop.h,v 3.14 2001/12/14 20:00:03 dawes Exp $ */ #ifndef _MERGEROP_H_ #define _MERGEROP_H_ @@ -37,7 +41,7 @@ extern mergeRopRec mergeRopBits[16]; #if defined(PPW) && defined(PGSZ) && (PPW != PGSZ) /* cfb */ -#define DeclareMergeRop() MfbBits _ca1, _cx1, _ca2, _cx2; +#define DeclareMergeRop() MfbBits _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0; #define DeclarePrebuiltMergeRop() MfbBits _cca, _ccx; #if PSZ == 24 /* both for PGSZ == 32 and 64 */ #define DeclareMergeRop24() \ @@ -46,7 +50,7 @@ #define DeclarePrebuiltMergeRop24() MfbBits _ccau[4], _ccxu[4]; #endif /* PSZ == 24 */ #else /* mfb */ -#define DeclareMergeRop() MfbBits _ca1, _cx1, _ca2, _cx2; +#define DeclareMergeRop() MfbBits _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0; #define DeclarePrebuiltMergeRop() MfbBits _cca, _ccx; #endif @@ -320,7 +324,7 @@ #endif #if (MROP) == (Mcopy|Mxor|MandReverse|Mor) -#define MROP_DECLARE() MfbBits _ca1, _cx1; +#define MROP_DECLARE() MfbBits _ca1 = 0, _cx1 = 0; #define MROP_DECLARE_REG() register MROP_DECLARE() #define MROP_INITIALIZE(alu,pm) { \ mergeRopPtr _bits; \ @@ -382,7 +386,7 @@ #define MROP_PREBUILT_MASK24(src,dst,mask,index) MROP_MASK24(src,dst,mask,index) #endif -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define MROP_NAME_CAT(prefix,suffix) prefix##suffix #else #define MROP_NAME_CAT(prefix,suffix) prefix/**/suffix Index: xc/programs/Xserver/mfb/mfb.h diff -u xc/programs/Xserver/mfb/mfb.h:1.17 xc/programs/Xserver/mfb/mfb.h:1.18 --- xc/programs/Xserver/mfb/mfb.h:1.17 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfb.h Fri Dec 14 15:00:04 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.17 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.18 2001/12/14 20:00:04 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfb.h,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfb.h,v 1.4 2001/02/09 02:05:18 xorgcvs Exp $ */ #if !defined(_MFB_H_) || defined(MFB_PROTOTYPES_ONLY) #ifndef MFB_PROTOTYPES_ONLY Index: xc/programs/Xserver/mfb/mfbbitblt.c diff -u xc/programs/Xserver/mfb/mfbbitblt.c:1.4 xc/programs/Xserver/mfb/mfbbitblt.c:1.6 --- xc/programs/Xserver/mfb/mfbbitblt.c:1.4 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbbitblt.c Fri Dec 14 15:00:04 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbbitblt.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbbitblt.c,v 1.6 2001/12/14 20:00:04 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbbitblt.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbbitblt.c,v 1.4 2001/02/09 02:05:18 xorgcvs Exp $ */ #include "X.h" #include "Xprotostr.h" @@ -129,7 +133,7 @@ int width, height; int dstx, dsty; { - RegionPtr prgnSrcClip; /* may be a new region, or just a copy */ + RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ Bool freeSrcClip = FALSE; RegionPtr prgnExposed; Index: xc/programs/Xserver/mfb/mfbblt.c diff -u xc/programs/Xserver/mfb/mfbblt.c:3.2 xc/programs/Xserver/mfb/mfbblt.c:3.4 --- xc/programs/Xserver/mfb/mfbblt.c:3.2 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbblt.c Fri Dec 14 15:00:04 2001 @@ -1,13 +1,17 @@ /* * mfb copy area */ -/* $XFree86: xc/programs/Xserver/mfb/mfbblt.c,v 3.2 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbblt.c,v 3.4 2001/12/14 20:00:04 dawes Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -26,7 +30,7 @@ Author: Keith Packard */ -/* $Xorg: mfbblt.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbblt.c,v 1.4 2001/02/09 02:05:18 xorgcvs Exp $ */ #include "X.h" #include "Xmd.h" @@ -79,14 +83,7 @@ register PixelType bits; register PixelType bits1; register int nl; /* temp copy of nlMiddle */ - - /* place to store full source word */ - int nstart; /* number of ragged bits at start of dst */ - int nend; /* number of ragged bits at end of dst */ - int srcStartOver; /* pulling nstart bits from src - overflows into the next word? */ int careful; - int tmpSrc; MROP_INITIALIZE(alu,0); Index: xc/programs/Xserver/mfb/mfbbres.c diff -u xc/programs/Xserver/mfb/mfbbres.c:1.4 xc/programs/Xserver/mfb/mfbbres.c:1.5 --- xc/programs/Xserver/mfb/mfbbres.c:1.4 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbbres.c Fri Dec 14 15:00:05 2001 @@ -1,10 +1,14 @@ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/* $XFree86: xc/programs/Xserver/mfb/mfbbres.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbbres.c,v 1.5 2001/12/14 20:00:05 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbbres.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbbres.c,v 1.4 2001/02/09 02:05:18 xorgcvs 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.4 xc/programs/Xserver/mfb/mfbbresd.c:1.5 --- xc/programs/Xserver/mfb/mfbbresd.c:1.4 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbbresd.c Fri Dec 14 15:00:05 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbbresd.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbbresd.c,v 1.5 2001/12/14 20:00:05 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbbresd.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbbresd.c,v 1.4 2001/02/09 02:05:18 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbbstore.c:1.2 --- xc/programs/Xserver/mfb/mfbbstore.c:1.1.1.3 Tue Jan 16 17:44:19 2001 +++ xc/programs/Xserver/mfb/mfbbstore.c Fri Dec 14 15:00:05 2001 @@ -1,10 +1,14 @@ -/* $Xorg: mfbbstore.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbbstore.c,v 1.4 2001/02/09 02:05:18 xorgcvs Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/mfb/mfbclip.c diff -u xc/programs/Xserver/mfb/mfbclip.c:1.4 xc/programs/Xserver/mfb/mfbclip.c:1.5 --- xc/programs/Xserver/mfb/mfbclip.c:1.4 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbclip.c Fri Dec 14 15:00:05 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbclip.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbclip.c,v 1.5 2001/12/14 20:00:05 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbclip.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbclip.c,v 1.4 2001/02/09 02:05:18 xorgcvs 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.6 xc/programs/Xserver/mfb/mfbcmap.c:1.7 --- xc/programs/Xserver/mfb/mfbcmap.c:1.6 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbcmap.c Fri Dec 14 15:00:06 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbcmap.c,v 1.6 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbcmap.c,v 1.7 2001/12/14 20:00:06 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbcmap.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbcmap.c,v 1.4 2001/02/09 02:05:18 xorgcvs 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.4 xc/programs/Xserver/mfb/mfbfillarc.c:1.5 --- xc/programs/Xserver/mfb/mfbfillarc.c:1.4 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbfillarc.c Fri Dec 14 15:00:06 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbfillarc.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbfillarc.c,v 1.5 2001/12/14 20:00:06 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ ********************************************************/ -/* $Xorg: mfbfillarc.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbfillarc.c,v 1.4 2001/02/09 02:05:18 xorgcvs Exp $ */ #include "X.h" #include "Xprotostr.h" Index: xc/programs/Xserver/mfb/mfbfillrct.c diff -u xc/programs/Xserver/mfb/mfbfillrct.c:1.4 xc/programs/Xserver/mfb/mfbfillrct.c:1.5 --- xc/programs/Xserver/mfb/mfbfillrct.c:1.4 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbfillrct.c Fri Dec 14 15:00:06 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbfillrct.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbfillrct.c,v 1.5 2001/12/14 20:00:06 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbfillrct.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbfillrct.c,v 1.4 2001/02/09 02:05:18 xorgcvs 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.8 xc/programs/Xserver/mfb/mfbfillsp.c:1.9 --- xc/programs/Xserver/mfb/mfbfillsp.c:1.8 Wed Jan 17 17:37:02 2001 +++ xc/programs/Xserver/mfb/mfbfillsp.c Fri Dec 14 15:00:06 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbfillsp.c,v 1.8 2001/01/17 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbfillsp.c,v 1.9 2001/12/14 20:00:06 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbfillsp.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ +/* $Xorg: mfbfillsp.c,v 1.4 2001/02/09 02:05:18 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbfont.c:1.2 --- xc/programs/Xserver/mfb/mfbfont.c:1.1.1.3 Tue Jan 16 17:44:23 2001 +++ xc/programs/Xserver/mfb/mfbfont.c Fri Dec 14 15:00:07 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ SOFTWARE. */ -/* $Xorg: mfbfont.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbfont.c,v 1.4 2001/02/09 02:05:18 xorgcvs 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.6 xc/programs/Xserver/mfb/mfbgc.c:1.7 --- xc/programs/Xserver/mfb/mfbgc.c:1.6 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbgc.c Fri Dec 14 15:00:07 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbgc.c,v 1.6 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbgc.c,v 1.7 2001/12/14 20:00:07 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbgc.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbgc.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbgetsp.c:1.3 --- xc/programs/Xserver/mfb/mfbgetsp.c:1.1.1.3 Tue Jan 16 17:44:24 2001 +++ xc/programs/Xserver/mfb/mfbgetsp.c Fri Dec 14 15:00:08 2001 @@ -1,9 +1,14 @@ +/* $XFree86: xc/programs/Xserver/mfb/mfbgetsp.c,v 1.3 2001/12/14 20:00:08 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbgetsp.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbgetsp.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ #include "X.h" #include "Xmd.h" @@ -81,7 +86,7 @@ register DDXPointPtr pptLast; /* one past last point to get */ int xEnd; /* last pixel to copy from */ register int nstart; - int nend; + int nend = 0; int srcStartOver; PixelType startmask, endmask; unsigned int srcBit; Index: xc/programs/Xserver/mfb/mfbhrzvert.c diff -u xc/programs/Xserver/mfb/mfbhrzvert.c:1.4 xc/programs/Xserver/mfb/mfbhrzvert.c:1.5 --- xc/programs/Xserver/mfb/mfbhrzvert.c:1.4 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbhrzvert.c Fri Dec 14 15:00:08 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbhrzvert.c,v 1.4 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbhrzvert.c,v 1.5 2001/12/14 20:00:08 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbhrzvert.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbhrzvert.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ #include "X.h" #include "gc.h" Index: xc/programs/Xserver/mfb/mfbimage.c diff -u xc/programs/Xserver/mfb/mfbimage.c:1.5 xc/programs/Xserver/mfb/mfbimage.c:1.6 --- xc/programs/Xserver/mfb/mfbimage.c:1.5 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbimage.c Fri Dec 14 15:00:08 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbimage.c,v 1.5 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbimage.c,v 1.6 2001/12/14 20:00:08 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbimage.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbimage.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ #include "X.h" Index: xc/programs/Xserver/mfb/mfbimggblt.c diff -u xc/programs/Xserver/mfb/mfbimggblt.c:3.3 xc/programs/Xserver/mfb/mfbimggblt.c:3.4 --- xc/programs/Xserver/mfb/mfbimggblt.c:3.3 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbimggblt.c Fri Dec 14 15:00:08 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbimggblt.c,v 3.3 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbimggblt.c,v 3.4 2001/12/14 20:00:08 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbimggblt.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbimggblt.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.6 xc/programs/Xserver/mfb/mfbline.c:1.7 --- xc/programs/Xserver/mfb/mfbline.c:1.6 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbline.c Fri Dec 14 15:00:09 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbline.c,v 1.6 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbline.c,v 1.7 2001/12/14 20:00:09 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbline.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbline.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbmisc.c:1.2 --- xc/programs/Xserver/mfb/mfbmisc.c:1.1.1.3 Tue Jan 16 17:44:25 2001 +++ xc/programs/Xserver/mfb/mfbmisc.c Fri Dec 14 15:00:09 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbmisc.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbmisc.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbpixmap.c:1.2 --- xc/programs/Xserver/mfb/mfbpixmap.c:1.1.1.3 Tue Jan 16 17:44:26 2001 +++ xc/programs/Xserver/mfb/mfbpixmap.c Fri Dec 14 15:00:10 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbpixmap.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbpixmap.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ /* pixmap management written by drewry, september 1986 Index: xc/programs/Xserver/mfb/mfbply1rct.c diff -u xc/programs/Xserver/mfb/mfbply1rct.c:1.5 xc/programs/Xserver/mfb/mfbply1rct.c:1.7 --- xc/programs/Xserver/mfb/mfbply1rct.c:1.5 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbply1rct.c Fri Dec 14 15:00:10 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: mfbply1rct.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ + * $Xorg: mfbply1rct.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/Xserver/mfb/mfbply1rct.c,v 1.5 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbply1rct.c,v 1.7 2001/12/14 20:00:10 dawes Exp $ */ #include "X.h" @@ -70,14 +74,14 @@ BoxPtr extents; int clip; int y; - int *vertex1p, *vertex2p; + int *vertex1p = NULL, *vertex2p; int *endp; - int x1, x2; - int dx1, dx2; - int dy1, dy2; - int e1, e2; - int step1, step2; - int sign1, sign2; + int x1 = 0, x2 = 0; + int dx1 = 0, dx2 = 0; + int dy1 = 0, dy2 = 0; + int e1 = 0, e2 = 0; + int step1 = 0, step2 = 0; + int sign1 = 0, sign2 = 0; int h; int l, r; PixelType mask, bits = ~((PixelType)0); @@ -131,7 +135,7 @@ vertex2p = (int *) ptsIn; #define Setup(c,x,vertex,dx,dy,e,sign,step) {\ x = intToX(vertex); \ - if (dy = intToY(c) - y) { \ + if ((dy = intToY(c) - y)) { \ dx = intToX(c) - x; \ step = 0; \ if (dx >= 0) \ @@ -235,7 +239,7 @@ } nmiddle >>= PWSH; Duff (nmiddle, *addr++ EQWHOLEWORD) - if (mask = ~SCRRIGHT(bits, r & PIM)) + if ((mask = ~SCRRIGHT(bits, r & PIM))) *addr OPEQ mask; } if (!--h) Index: xc/programs/Xserver/mfb/mfbplygblt.c diff -u xc/programs/Xserver/mfb/mfbplygblt.c:3.3 xc/programs/Xserver/mfb/mfbplygblt.c:3.4 --- xc/programs/Xserver/mfb/mfbplygblt.c:3.3 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbplygblt.c Fri Dec 14 15:00:10 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbplygblt.c,v 3.3 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbplygblt.c,v 3.4 2001/12/14 20:00:10 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbplygblt.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbplygblt.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbpntarea.c:1.2 --- xc/programs/Xserver/mfb/mfbpntarea.c:1.1.1.3 Tue Jan 16 17:44:27 2001 +++ xc/programs/Xserver/mfb/mfbpntarea.c Fri Dec 14 15:00:11 2001 @@ -3,7 +3,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbpntarea.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbpntarea.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbpntwin.c:1.2 --- xc/programs/Xserver/mfb/mfbpntwin.c:1.1.1.3 Tue Jan 16 17:44:27 2001 +++ xc/programs/Xserver/mfb/mfbpntwin.c Fri Dec 14 15:00:11 2001 @@ -1,10 +1,14 @@ -/* $Xorg: mfbpntwin.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbpntwin.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/mfb/mfbpolypnt.c diff -u xc/programs/Xserver/mfb/mfbpolypnt.c:1.4 xc/programs/Xserver/mfb/mfbpolypnt.c:1.5 --- xc/programs/Xserver/mfb/mfbpolypnt.c:1.4 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbpolypnt.c Fri Dec 14 15:00:11 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbpolypnt.c,v 1.4 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbpolypnt.c,v 1.5 2001/12/14 20:00:11 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbpolypnt.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbpolypnt.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ #include "X.h" #include "Xprotostr.h" Index: xc/programs/Xserver/mfb/mfbpushpxl.c diff -u xc/programs/Xserver/mfb/mfbpushpxl.c:1.4 xc/programs/Xserver/mfb/mfbpushpxl.c:1.5 --- xc/programs/Xserver/mfb/mfbpushpxl.c:1.4 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbpushpxl.c Fri Dec 14 15:00:11 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbpushpxl.c,v 1.4 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbpushpxl.c,v 1.5 2001/12/14 20:00:11 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbpushpxl.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbpushpxl.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbscrclse.c:1.2 --- xc/programs/Xserver/mfb/mfbscrclse.c:1.1.1.3 Tue Jan 16 17:44:28 2001 +++ xc/programs/Xserver/mfb/mfbscrclse.c Fri Dec 14 15:00:12 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mfbscrclse.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbscrclse.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/mfb/mfbscrinit.c diff -u xc/programs/Xserver/mfb/mfbscrinit.c:3.7 xc/programs/Xserver/mfb/mfbscrinit.c:3.8 --- xc/programs/Xserver/mfb/mfbscrinit.c:3.7 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbscrinit.c Fri Dec 14 15:00:12 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.7 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.8 2001/12/14 20:00:12 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbscrinit.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbscrinit.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.5 xc/programs/Xserver/mfb/mfbsetsp.c:1.6 --- xc/programs/Xserver/mfb/mfbsetsp.c:1.5 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbsetsp.c Fri Dec 14 15:00:12 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbsetsp.c,v 1.5 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbsetsp.c,v 1.6 2001/12/14 20:00:12 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbsetsp.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbsetsp.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ #include "X.h" #include "Xmd.h" Index: xc/programs/Xserver/mfb/mfbtegblt.c diff -u xc/programs/Xserver/mfb/mfbtegblt.c:1.7 xc/programs/Xserver/mfb/mfbtegblt.c:1.8 --- xc/programs/Xserver/mfb/mfbtegblt.c:1.7 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbtegblt.c Fri Dec 14 15:00:12 2001 @@ -1,10 +1,14 @@ -/* $Xorg: mfbtegblt.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ +/* $Xorg: mfbtegblt.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ ******************************************************************/ -/* $XFree86: xc/programs/Xserver/mfb/mfbtegblt.c,v 1.7 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbtegblt.c,v 1.8 2001/12/14 20:00:12 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.3 xc/programs/Xserver/mfb/mfbtile.c:1.2 --- xc/programs/Xserver/mfb/mfbtile.c:1.1.1.3 Tue Jan 16 17:44:30 2001 +++ xc/programs/Xserver/mfb/mfbtile.c Fri Dec 14 15:00:13 2001 @@ -3,7 +3,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mfbtile.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ +/* $Xorg: mfbtile.c,v 1.4 2001/02/09 02:05:19 xorgcvs 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.3 xc/programs/Xserver/mfb/mfbwindow.c:1.2 --- xc/programs/Xserver/mfb/mfbwindow.c:1.1.1.3 Tue Jan 16 17:44:31 2001 +++ xc/programs/Xserver/mfb/mfbwindow.c Fri Dec 14 15:00:13 2001 @@ -1,10 +1,14 @@ -/* $Xorg: mfbwindow.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ +/* $Xorg: mfbwindow.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/mfb/mfbzerarc.c diff -u xc/programs/Xserver/mfb/mfbzerarc.c:3.5 xc/programs/Xserver/mfb/mfbzerarc.c:3.6 --- xc/programs/Xserver/mfb/mfbzerarc.c:3.5 Wed Jan 17 17:37:03 2001 +++ xc/programs/Xserver/mfb/mfbzerarc.c Fri Dec 14 15:00:13 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbzerarc.c,v 3.5 2001/01/17 22:37:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbzerarc.c,v 3.6 2001/12/14 20:00:13 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ ********************************************************/ -/* $Xorg: mfbzerarc.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ +/* $Xorg: mfbzerarc.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" Index: xc/programs/Xserver/mi/cbrt.c diff -u xc/programs/Xserver/mi/cbrt.c:3.2 xc/programs/Xserver/mi/cbrt.c:3.4 --- xc/programs/Xserver/mi/cbrt.c:3.2 Wed Jan 17 17:37:05 2001 +++ xc/programs/Xserver/mi/cbrt.c Fri Dec 14 15:00:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: cbrt.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ +/* $Xorg: cbrt.c,v 1.4 2001/02/09 02:05:19 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,15 +26,20 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/cbrt.c,v 3.2 2001/01/17 22:37:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/cbrt.c,v 3.4 2001/12/14 20:00:19 dawes Exp $ */ /* simple cbrt, in case your math library doesn't have a good one */ -double pow(); +/* + * Would normally include <math.h> for this, but for the sake of compiler + * warnings, we don't want to get duplicate declarations for cbrt(). + */ + +double pow(double, double); +double cbrt(double); double -cbrt(x) - double x; +cbrt(double x) { if (x > 0.0) return pow(x, 1.0/3.0); Index: xc/programs/Xserver/mi/mi.h diff -u xc/programs/Xserver/mi/mi.h:3.7.2.1 xc/programs/Xserver/mi/mi.h:3.10 --- xc/programs/Xserver/mi/mi.h:3.7.2.1 Fri May 25 14:50:12 2001 +++ xc/programs/Xserver/mi/mi.h Fri Dec 14 15:00:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mi.h,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ +/* $Xorg: mi.h,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/mi/mi.h,v 3.7.2.1 2001/05/25 18:50:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mi.h,v 3.10 2001/12/14 20:00:19 dawes Exp $ */ #ifndef MI_H #define MI_H @@ -63,18 +67,15 @@ /* miarc.c */ extern void miPolyArc( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ -#endif ); /* mibitblt.c */ extern RegionPtr miCopyArea( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, @@ -84,11 +85,9 @@ int /*heightSrc*/, int /*xOut*/, int /*yOut*/ -#endif ); extern void miOpqStipDrawable( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, RegionPtr /*prgnSrc*/, @@ -98,11 +97,9 @@ int /*h*/, int /*dstx*/, int /*dsty*/ -#endif ); extern RegionPtr miCopyPlane( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, @@ -113,11 +110,9 @@ int /*dstx*/, int /*dsty*/, unsigned long /*bitPlane*/ -#endif ); extern void miGetImage( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*sx*/, int /*sy*/, @@ -126,11 +121,9 @@ unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/ -#endif ); extern void miPutImage( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*depth*/, @@ -141,54 +134,43 @@ int /*leftPad*/, int /*format*/, char * /*pImage*/ -#endif ); /* miclipn.c */ extern void miClipNotify( -#if NeedFunctionPrototypes void (* /*func*/)( -#if NeedNestedPrototypes WindowPtr /* pWin */, int /* dx */, int /* dy */ -#endif ) -#endif ); /* micursor.c */ extern void miRecolorCursor( -#if NeedFunctionPrototypes ScreenPtr /*pScr*/, CursorPtr /*pCurs*/, Bool /*displayed*/ -#endif ); /* midash.c */ extern miDashPtr miDashLine( -#if NeedFunctionPrototypes int /*npt*/, DDXPointPtr /*ppt*/, unsigned int /*nDash*/, unsigned char * /*pDash*/, unsigned int /*offset*/, int * /*pnseg*/ -#endif ); extern void miStepDash( -#if NeedFunctionPrototypes int /*dist*/, int * /*pDashIndex*/, unsigned char * /*pDash*/, int /*numInDashList*/, int * /*pDashOffset*/ -#endif ); /* mieq.c */ @@ -199,35 +181,26 @@ #endif extern Bool mieqInit( -#if NeedFunctionPrototypes DevicePtr /*pKbd*/, DevicePtr /*pPtr*/ -#endif ); extern void mieqEnqueue( -#if NeedFunctionPrototypes xEventPtr /*e*/ -#endif ); extern void mieqSwitchScreen( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, Bool /*fromDIX*/ -#endif ); extern void mieqProcessInputEvents( -#if NeedFunctionPrototypes void -#endif ); /* miexpose.c */ extern RegionPtr miHandleExposures( -#if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, @@ -238,66 +211,52 @@ int /*dstx*/, int /*dsty*/, unsigned long /*plane*/ -#endif ); extern void miSendGraphicsExpose( -#if NeedFunctionPrototypes ClientPtr /*client*/, RegionPtr /*pRgn*/, XID /*drawable*/, int /*major*/, int /*minor*/ -#endif ); extern void miSendExposures( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*pRgn*/, int /*dx*/, int /*dy*/ -#endif ); extern void miWindowExposures( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*prgn*/, RegionPtr /*other_exposed*/ -#endif ); extern void miPaintWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*prgn*/, int /*what*/ -#endif ); extern void miClearDrawable( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/ -#endif ); /* mifillrct.c */ extern void miPolyFillRect( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrectFill*/, xRectangle * /*prectInit*/ -#endif ); /* miglblt.c */ extern void miPolyGlyphBlt( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, @@ -305,11 +264,9 @@ unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ -#endif ); extern void miImageGlyphBlt( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, @@ -317,82 +274,68 @@ unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ -#endif ); /* mipoly.c */ extern void miFillPolygon( -#if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*pPts*/ -#endif ); /* mipolycon.c */ extern Bool miFillConvexPoly( -#if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, DDXPointPtr /*ptsIn*/ -#endif ); /* mipolygen.c */ extern Bool miFillGeneralPoly( -#if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, DDXPointPtr /*ptsIn*/ -#endif ); /* mipolypnt.c */ extern void miPolyPoint( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, xPoint * /*pptInit*/ -#endif ); /* mipolyrect.c */ extern void miPolyRectangle( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*nrects*/, xRectangle * /*pRects*/ -#endif ); /* mipolyseg.c */ extern void miPolySegment( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegs*/ -#endif ); /* mipolytext.c */ extern int miPolyText( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, @@ -400,33 +343,27 @@ int /*count*/, char * /*chars*/, FontEncoding /*fontEncoding*/ -#endif ); extern int miPolyText8( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/ -#endif ); extern int miPolyText16( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/ -#endif ); extern int miImageText( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, @@ -434,35 +371,29 @@ int /*count*/, char * /*chars*/, FontEncoding /*fontEncoding*/ -#endif ); extern void miImageText8( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/ -#endif ); extern void miImageText16( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/ -#endif ); /* mipushpxl.c */ extern void miPushPixels( -#if NeedFunctionPrototypes GCPtr /*pGC*/, PixmapPtr /*pBitMap*/, DrawablePtr /*pDrawable*/, @@ -470,7 +401,6 @@ int /*dy*/, int /*xOrg*/, int /*yOrg*/ -#endif ); /* miregion.c */ @@ -478,36 +408,30 @@ /* see also region.h */ extern Bool miRectAlloc( -#if NeedFunctionPrototypes RegionPtr /*pRgn*/, int /*n*/ -#endif ); extern void miSetExtents( -#if NeedFunctionPrototypes RegionPtr /*pReg*/ -#endif ); extern int miFindMaxBand( -#if NeedFunctionPrototypes RegionPtr /*prgn*/ -#endif ); #ifdef DEBUG extern Bool miValidRegion( -#if NeedFunctionPrototypes RegionPtr /*prgn*/ -#endif ); #endif +extern Bool miRegionDataCopy(RegionPtr dst, RegionPtr src); +extern Bool miRegionBroken(RegionPtr pReg); + /* miscrinit.c */ extern Bool miModifyPixmapHeader( -#if NeedFunctionPrototypes PixmapPtr /*pPixmap*/, int /*width*/, int /*height*/, @@ -515,32 +439,24 @@ int /*bitsPerPixel*/, int /*devKind*/, pointer /*pPixData*/ -#endif ); extern Bool miCloseScreen( -#if NeedFunctionPrototypes int /*index*/, ScreenPtr /*pScreen*/ -#endif ); extern Bool miCreateScreenResources( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/ -#endif ); extern Bool miScreenDevPrivateInit( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*width*/, pointer /*pbits*/ -#endif ); extern Bool miScreenInit( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, @@ -554,173 +470,130 @@ VisualID /*rootVisual*/, int /*numVisuals*/, VisualPtr /*visuals*/ -#endif ); extern int miAllocateGCPrivateIndex( -#if NeedFunctionPrototypes void -#endif ); extern PixmapPtr miGetScreenPixmap( -#if NeedFunctionPrototypes ScreenPtr pScreen -#endif ); extern void miSetScreenPixmap( -#if NeedFunctionPrototypes PixmapPtr pPix -#endif ); /* mivaltree.c */ extern int miShapedWindowIn( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, RegionPtr /*universe*/, RegionPtr /*bounding*/, BoxPtr /*rect*/, int /*x*/, int /*y*/ -#endif ); extern int miValidateTree( -#if NeedFunctionPrototypes WindowPtr /*pParent*/, WindowPtr /*pChild*/, VTKind /*kind*/ -#endif ); extern void miWideLine( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pPts*/ -#endif ); extern void miWideDash( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pPts*/ -#endif ); extern void miMiter( -#if NeedFunctionPrototypes void -#endif ); extern void miNotMiter( -#if NeedFunctionPrototypes void -#endif ); /* miwindow.c */ extern void miClearToBackground( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/ -#endif ); extern Bool miChangeSaveUnder( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, WindowPtr /*first*/ -#endif ); extern void miPostChangeSaveUnder( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, WindowPtr /*pFirst*/ -#endif ); extern void miMarkWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/ -#endif ); extern Bool miMarkOverlappedWindows( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, WindowPtr /*pFirst*/, WindowPtr * /*ppLayerWin*/ -#endif ); extern void miHandleValidateExposures( -#if NeedFunctionPrototypes WindowPtr /*pWin*/ -#endif ); extern void miMoveWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, WindowPtr /*pNextSib*/, VTKind /*kind*/ -#endif ); extern void miSlideAndSizeWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, WindowPtr /*pSib*/ -#endif ); extern WindowPtr miGetLayerWindow( -#if NeedFunctionPrototypes WindowPtr /*pWin*/ -#endif ); extern void miSetShape( -#if NeedFunctionPrototypes WindowPtr /*pWin*/ -#endif ); extern void miChangeBorderWidth( -#if NeedFunctionPrototypes WindowPtr /*pWin*/, unsigned int /*width*/ -#endif ); extern void miMarkUnrealizedWindow( -#if NeedFunctionPrototypes WindowPtr /*pChild*/, WindowPtr /*pWin*/, Bool /*fromConfigure*/ -#endif ); extern void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth); @@ -728,43 +601,35 @@ /* mizerarc.c */ extern void miZeroPolyArc( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ -#endif ); /* mizerline.c */ extern void miZeroLine( -#if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*mode*/, int /*nptInit*/, DDXPointRec * /*pptInit*/ -#endif ); extern void miZeroDashLine( -#if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*mode*/, int /*nptInit*/, DDXPointRec * /*pptInit*/ -#endif ); extern void miPolyFillArc( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ -#endif ); #endif /* MI_H */ Index: xc/programs/Xserver/mi/miarc.c diff -u xc/programs/Xserver/mi/miarc.c:3.8 xc/programs/Xserver/mi/miarc.c:3.13 --- xc/programs/Xserver/mi/miarc.c:3.8 Wed Jan 17 17:37:05 2001 +++ xc/programs/Xserver/mi/miarc.c Sat Jan 12 17:20:33 2002 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.8 2001/01/17 22:37:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.13 2002/01/12 22:20:33 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: miarc.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ +/* $Xorg: miarc.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ /* Author: Keith Packard and Bob Scheifler */ /* Warning: this code is toxic, do not dally very long here. */ @@ -64,12 +68,11 @@ #include "mifillarc.h" #include "Xfuncproto.h" -static double miDsin(), miDcos(), miDasin(), miDatan2(); -double cbrt( -#if NeedFunctionPrototypes - double -#endif -); +static double miDsin(double a); +static double miDcos(double a); +static double miDasin(double v); +static double miDatan2(double dy, double dx); +double cbrt(double); #ifdef ICEILTEMPDECL ICEILTEMPDECL @@ -98,7 +101,7 @@ #undef max #undef min -#if defined (__GNUC__) && defined (__STDC__) && !defined (__STRICT_ANSI__) +#if defined (__GNUC__) && !defined (__STRICT_ANSI__) #define USE_INLINE #endif @@ -116,13 +119,13 @@ #else static int -max (x, y) +max (int x, int y) { return x>y? x:y; } static int -min (x, y) +min (int x, int y) { return x<y? x:y; } @@ -239,12 +242,27 @@ GCLineWidth | GCCapStyle | GCJoinStyle) static CARD32 gcvals[6]; -static void fillSpans(), newFinalSpan(); -static void drawArc(), drawQuadrant(), drawZeroArc(); -static void miArcJoin(), miArcCap(), miRoundCap(), miFreeArcs(); -static int computeAngleFromPath(); -static miPolyArcPtr miComputeArcs (); -static int miGetArcPts(); +static void fillSpans(DrawablePtr pDrawable, GCPtr pGC); +static void newFinalSpan(int y, register int xmin, register int xmax); +static void drawArc(xArc *tarc, int l, int a0, int a1, miArcFacePtr right, + miArcFacePtr left); +static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc *tarc, int lw, + miArcFacePtr left, miArcFacePtr right); +static void miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft, + miArcFacePtr pRight, int xOrgLeft, int yOrgLeft, + double xFtransLeft, double yFtransLeft, + int xOrgRight, int yOrgRight, + double xFtransRight, double yFtransRight); +static void miArcCap(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pFace, + int end, int xOrg, int yOrg, double xFtrans, + double yFtrans); +static void miRoundCap(DrawablePtr pDraw, GCPtr pGC, SppPointRec pCenter, + SppPointRec pEnd, SppPointRec pCorner, + SppPointRec pOtherCorner, int fLineEnd, + int xOrg, int yOrg, double xFtrans, double yFtrans); +static void miFreeArcs(miPolyArcPtr arcs, GCPtr pGC); +static miPolyArcPtr miComputeArcs(xArc *parcs, int narcs, GCPtr pGC); +static int miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr *ppPts); # define CUBED_ROOT_2 1.2599210498948732038115849718451499938964 # define CUBED_ROOT_4 1.5874010519681993173435330390930175781250 @@ -254,11 +272,12 @@ */ static void -miArcSegment(pDraw, pGC, tarc, right, left) - DrawablePtr pDraw; - GCPtr pGC; - xArc tarc; - miArcFacePtr right, left; +miArcSegment( + DrawablePtr pDraw, + GCPtr pGC, + xArc tarc, + miArcFacePtr right, + miArcFacePtr left) { int l = pGC->lineWidth; int a0, a1, startAngle, endAngle; @@ -394,6 +413,10 @@ #define CACHESIZE 25 +static void drawQuadrant(struct arc_def *def, struct accelerators *acc, + int a0, int a1, int mask, miArcFacePtr right, + miArcFacePtr left, miArcSpanData *spdata); + static arcCacheRec arcCache[CACHESIZE]; static unsigned long lrustamp; static arcCacheRec *lastCacheHit = &arcCache[0]; @@ -430,18 +453,18 @@ } static void -miComputeCircleSpans(lw, parc, spdata) - int lw; - xArc *parc; - miArcSpanData *spdata; +miComputeCircleSpans( + int lw, + xArc *parc, + miArcSpanData *spdata) { register miArcSpan *span; int doinner; register int x, y, e; int xk, yk, xm, ym, dx, dy; register int slw, inslw; - int inx, iny, ine; - int inxk, inyk, inxm, inym; + int inx = 0, iny, ine = 0; + int inxk = 0, inyk = 0, inxm = 0, inym = 0; doinner = -lw; slw = parc->width - doinner; @@ -498,15 +521,15 @@ } static void -miComputeEllipseSpans(lw, parc, spdata) - int lw; - xArc *parc; - miArcSpanData *spdata; +miComputeEllipseSpans( + int lw, + xArc *parc, + miArcSpanData *spdata) { register miArcSpan *span; double w, h, r, xorg; double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs; - double A, T, b, d, x, y, t, inx, outx, hepp, hepm; + double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm; int flip, solution; w = (double)parc->width / 2.0; @@ -691,11 +714,11 @@ } static double -tailX(K, def, bounds, acc) - double K; - struct arc_def *def; - struct arc_bound *bounds; - struct accelerators *acc; +tailX( + double K, + struct arc_def *def, + struct arc_bound *bounds, + struct accelerators *acc) { double w, h, r; double Hs, Hf, WH, Vk, Nk, Fk, Vr, N, Nc, Z, rs; @@ -832,10 +855,10 @@ } static miArcSpanData * -miComputeWideEllipse(lw, parc, mustFree) - int lw; - register xArc *parc; - Bool *mustFree; +miComputeWideEllipse( + int lw, + register xArc *parc, + Bool *mustFree) { register miArcSpanData *spdata; register arcCacheRec *cent, *lruent; @@ -911,10 +934,10 @@ } static void -miFillWideEllipse(pDraw, pGC, parc) - DrawablePtr pDraw; - GCPtr pGC; - xArc *parc; +miFillWideEllipse( + DrawablePtr pDraw, + GCPtr pGC, + xArc *parc) { DDXPointPtr points; register DDXPointPtr pts; @@ -1054,8 +1077,8 @@ register int i; xArc *parc; int xMin, xMax, yMin, yMax; - int pixmapWidth, pixmapHeight; - int xOrg, yOrg; + int pixmapWidth = 0, pixmapHeight = 0; + int xOrg = 0, yOrg = 0; int width; Bool fTricky; DrawablePtr pDrawTo; @@ -1274,8 +1297,7 @@ } static double -angleBetween (center, point1, point2) - SppPointRec center, point1, point2; +angleBetween (SppPointRec center, SppPointRec point1, SppPointRec point2) { double a1, a2, a; @@ -1294,10 +1316,12 @@ } static void -translateBounds (b, x, y, fx, fy) -miArcFacePtr b; -int x, y; -double fx, fy; +translateBounds ( + miArcFacePtr b, + int x, + int y, + double fx, + double fy) { fx += x; fy += y; @@ -1310,16 +1334,11 @@ } static void -miArcJoin (pDraw, pGC, pLeft, pRight, - xOrgLeft, yOrgLeft, xFtransLeft, yFtransLeft, - xOrgRight, yOrgRight, xFtransRight, yFtransRight) - DrawablePtr pDraw; - GCPtr pGC; - miArcFacePtr pRight, pLeft; - int xOrgRight, yOrgRight; - double xFtransRight, yFtransRight; - int xOrgLeft, yOrgLeft; - double xFtransLeft, yFtransLeft; +miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft, + miArcFacePtr pRight, int xOrgLeft, int yOrgLeft, + double xFtransLeft, double yFtransLeft, + int xOrgRight, int yOrgRight, + double xFtransRight, double yFtransRight) { SppPointRec center, corner, otherCorner; SppPointRec poly[5], e; @@ -1327,7 +1346,7 @@ int cpt; SppArcRec arc; miArcFaceRec Right, Left; - int polyLen; + int polyLen = 0; int xOrg, yOrg; double xFtrans, yFtrans; double a; @@ -1425,13 +1444,15 @@ /*ARGSUSED*/ static void -miArcCap (pDraw, pGC, pFace, end, xOrg, yOrg, xFtrans, yFtrans) - DrawablePtr pDraw; - GCPtr pGC; - miArcFacePtr pFace; - int end; - int xOrg, yOrg; - double xFtrans, yFtrans; +miArcCap ( + DrawablePtr pDraw, + GCPtr pGC, + miArcFacePtr pFace, + int end, + int xOrg, + int yOrg, + double xFtrans, + double yFtrans) { SppPointRec corner, otherCorner, center, endPoint, poly[5]; @@ -1476,18 +1497,21 @@ */ /*ARGSUSED*/ static void -miRoundCap(pDraw, pGC, pCenter, pEnd, pCorner, pOtherCorner, fLineEnd, - xOrg, yOrg, xFtrans, yFtrans) - DrawablePtr pDraw; - GCPtr pGC; - SppPointRec pCenter, pEnd; - SppPointRec pCorner, pOtherCorner; - int fLineEnd, xOrg, yOrg; - double xFtrans, yFtrans; +miRoundCap( + DrawablePtr pDraw, + GCPtr pGC, + SppPointRec pCenter, + SppPointRec pEnd, + SppPointRec pCorner, + SppPointRec pOtherCorner, + int fLineEnd, + int xOrg, + int yOrg, + double xFtrans, + double yFtrans) { int cpt; double width; - double miDatan2 (); SppArcRec arc; SppPointPtr pArcPts; @@ -1533,8 +1557,7 @@ # define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) static double -miDcos (a) -double a; +miDcos (double a) { int i; @@ -1551,8 +1574,7 @@ } static double -miDsin (a) -double a; +miDsin (double a) { int i; @@ -1569,8 +1591,7 @@ } static double -miDasin (v) -double v; +miDasin (double v) { if (v == 0) return 0.0; @@ -1582,8 +1603,7 @@ } static double -miDatan2 (dy, dx) -double dy, dx; +miDatan2 (double dy, double dx) { if (dy == 0) { if (dx >= 0) @@ -1621,10 +1641,10 @@ * count on xrealloc() to handle the null pointer correctly. */ static int -miGetArcPts(parc, cpt, ppPts) - SppArcPtr parc; /* points to an arc */ - int cpt; /* number of points already in arc list */ - SppPointPtr *ppPts; /* pointer to pointer to arc-list -- modified */ +miGetArcPts( + SppArcPtr parc, /* points to an arc */ + int cpt, /* number of points already in arc list */ + SppPointPtr *ppPts) /* pointer to pointer to arc-list -- modified */ { double st, /* Start Theta, start angle */ et, /* End Theta, offset from start theta */ @@ -1716,10 +1736,12 @@ # define ADD_REALLOC_STEP 20 static void -addCap (capsp, ncapsp, sizep, end, arcIndex) - miArcCapPtr *capsp; - int *ncapsp, *sizep; - int end, arcIndex; +addCap ( + miArcCapPtr *capsp, + int *ncapsp, + int *sizep, + int end, + int arcIndex) { int newsize; miArcCapPtr cap; @@ -1741,10 +1763,16 @@ } static void -addJoin (joinsp, njoinsp, sizep, end0, index0, phase0, end1, index1, phase1) - miArcJoinPtr *joinsp; - int *njoinsp, *sizep; - int end0, index0, phase0, end1, index1, phase1; +addJoin ( + miArcJoinPtr *joinsp, + int *njoinsp, + int *sizep, + int end0, + int index0, + int phase0, + int end1, + int index1, + int phase1) { int newsize; miArcJoinPtr join; @@ -1770,10 +1798,11 @@ } static miArcDataPtr -addArc (arcsp, narcsp, sizep, xarc) - miArcDataPtr *arcsp; - int *narcsp, *sizep; - xArc *xarc; +addArc ( + miArcDataPtr *arcsp, + int *narcsp, + int *sizep, + xArc *xarc) { int newsize; miArcDataPtr arc; @@ -1795,9 +1824,9 @@ } static void -miFreeArcs(arcs, pGC) - miPolyArcPtr arcs; - GCPtr pGC; +miFreeArcs( + miPolyArcPtr arcs, + GCPtr pGC) { int iphase; @@ -1834,13 +1863,16 @@ double map[DASH_MAP_SIZE]; } dashMap; +static int computeAngleFromPath(int startAngle, int endAngle, dashMap *map, + int *lenp, int backwards); + static void -computeDashMap (arcp, map) - xArc *arcp; - dashMap *map; +computeDashMap ( + xArc *arcp, + dashMap *map) { int di; - double a, x, y, prevx, prevy, dist; + double a, x, y, prevx = 0.0, prevy = 0.0, dist; for (di = 0; di < DASH_MAP_SIZE; di++) { a = dashIndexToAngle (di); @@ -1862,15 +1894,15 @@ /* this routine is a bit gory */ static miPolyArcPtr -miComputeArcs (parcs, narcs, pGC) - xArc *parcs; - int narcs; - GCPtr pGC; +miComputeArcs ( + xArc *parcs, + int narcs, + GCPtr pGC) { int isDashed, isDoubleDash; int dashOffset; miPolyArcPtr arcs; - int start, i, j, k, nexti, nextk; + int start, i, j, k = 0, nexti, nextk = 0; int joinSize[2]; int capSize[2]; int arcSize[2]; @@ -1879,13 +1911,13 @@ struct arcData *data; miArcDataPtr arc; xArc xarc; - int iphase, prevphase, joinphase; + int iphase, prevphase = 0, joinphase; int arcsJoin; int selfJoin; - int iDash, dashRemaining; - int iDashStart, dashRemainingStart, iphaseStart; - int startAngle, spanAngle, endAngle, backwards; + int iDash = 0, dashRemaining; + int iDashStart = 0, dashRemainingStart = 0, iphaseStart; + int startAngle, spanAngle, endAngle, backwards = 0; int prevDashAngle, dashAngle; dashMap map; @@ -2257,9 +2289,9 @@ } static double -angleToLength (angle, map) - int angle; - dashMap *map; +angleToLength ( + int angle, + dashMap *map) { double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen; int di; @@ -2307,9 +2339,9 @@ */ static int -lengthToAngle (len, map) - double len; - dashMap *map; +lengthToAngle ( + double len, + dashMap *map) { double sidelen = map->map[DASH_MAP_SIZE - 1]; int angle, angleexcess; @@ -2379,11 +2411,12 @@ */ static int -computeAngleFromPath (startAngle, endAngle, map, lenp, backwards) - int startAngle, endAngle; /* normalized absolute angles in *64 degrees */ - dashMap *map; - int *lenp; - int backwards; +computeAngleFromPath ( + int startAngle, + int endAngle, /* normalized absolute angles in *64 degrees */ + dashMap *map, + int *lenp, + int backwards) { int a0, a1, a; double len0; @@ -2424,14 +2457,15 @@ */ static void -drawZeroArc (pDraw, pGC, tarc, lw, left, right) - DrawablePtr pDraw; - GCPtr pGC; - xArc *tarc; - int lw; - miArcFacePtr right, left; +drawZeroArc ( + DrawablePtr pDraw, + GCPtr pGC, + xArc *tarc, + int lw, + miArcFacePtr left, + miArcFacePtr right) { - double x0, y0, x1, y1, w, h, x, y; + double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y; double xmax, ymax, xmin, ymin; int a0, a1; double a, startAngle, endAngle; @@ -2558,9 +2592,9 @@ */ static void -tailEllipseY (def, acc) - struct arc_def *def; - struct accelerators *acc; +tailEllipseY ( + struct arc_def *def, + struct accelerators *acc) { double t; @@ -2587,46 +2621,50 @@ */ static double -outerXfromXY (x, y, def, acc) - double x, y; - struct arc_def *def; - struct accelerators *acc; +outerXfromXY ( + double x, + double y, + struct arc_def *def, + struct accelerators *acc) { return x + (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double -outerYfromXY (x, y, def, acc) - double x, y; - struct arc_def *def; - struct accelerators *acc; +outerYfromXY ( + double x, + double y, + struct arc_def *def, + struct accelerators *acc) { return y + (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double -innerXfromXY (x, y, def, acc) - double x, y; - struct arc_def *def; - struct accelerators *acc; +innerXfromXY ( + double x, + double y, + struct arc_def *def, + struct accelerators *acc) { return x - (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double -innerYfromXY (x, y, def, acc) - double x, y; - struct arc_def *def; - struct accelerators *acc; +innerYfromXY ( + double x, + double y, + struct arc_def *def, + struct accelerators *acc) { return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double -innerYfromY (y, def, acc) - double y; - struct arc_def *def; - struct accelerators *acc; +innerYfromY ( + double y, + struct arc_def *def, + struct accelerators *acc) { double x; @@ -2636,9 +2674,12 @@ } static void -computeLine (x1, y1, x2, y2, line) - double x1, y1, x2, y2; - struct line *line; +computeLine ( + double x1, + double y1, + double x2, + double y2, + struct line *line) { if (y1 == y2) line->valid = 0; @@ -2656,11 +2697,11 @@ */ static void -computeAcc (tarc, lw, def, acc) - xArc *tarc; - int lw; - struct arc_def *def; - struct accelerators *acc; +computeAcc ( + xArc *tarc, + int lw, + struct arc_def *def, + struct accelerators *acc) { def->w = ((double) tarc->width) / 2.0; def->h = ((double) tarc->height) / 2.0; @@ -2686,11 +2727,12 @@ */ static void -computeBound (def, bound, acc, right, left) - struct arc_def *def; - struct arc_bound *bound; - struct accelerators *acc; - miArcFacePtr right, left; +computeBound ( + struct arc_def *def, + struct arc_bound *bound, + struct accelerators *acc, + miArcFacePtr right, + miArcFacePtr left) { double t; double innerTaily; @@ -2826,11 +2868,11 @@ */ static double -hookEllipseY (scan_y, bound, acc, left) - double scan_y; - struct arc_bound *bound; - struct accelerators *acc; - int left; +hookEllipseY ( + double scan_y, + struct arc_bound *bound, + struct accelerators *acc, + int left) { double ret; @@ -2852,12 +2894,12 @@ */ static double -hookX (scan_y, def, bound, acc, left) - double scan_y; - struct arc_def *def; - struct arc_bound *bound; - struct accelerators *acc; - int left; +hookX ( + double scan_y, + struct arc_def *def, + struct arc_bound *bound, + struct accelerators *acc, + int left) { double ellipse_y, x; double maxMin; @@ -2909,16 +2951,16 @@ */ static void -arcSpan (y, lx, lw, rx, rw, def, bounds, acc, mask) - int y; - int lx; - int lw; - int rx; - int rw; - struct arc_def *def; - struct arc_bound *bounds; - struct accelerators *acc; - int mask; +arcSpan ( + int y, + int lx, + int lw, + int rx, + int rw, + struct arc_def *def, + struct arc_bound *bounds, + struct accelerators *acc, + int mask) { int linx, loutx, rinx, routx; double x, altx; @@ -2979,15 +3021,15 @@ } static void -arcSpan0 (lx, lw, rx, rw, def, bounds, acc, mask) - int lx; - int lw; - int rx; - int rw; - struct arc_def *def; - struct arc_bound *bounds; - struct accelerators *acc; - int mask; +arcSpan0 ( + int lx, + int lw, + int rx, + int rw, + struct arc_def *def, + struct arc_bound *bounds, + struct accelerators *acc, + int mask) { double x; @@ -3007,14 +3049,14 @@ } static void -tailSpan (y, lw, rw, def, bounds, acc, mask) - int y; - int lw; - int rw; - struct arc_def *def; - struct arc_bound *bounds; - struct accelerators *acc; - int mask; +tailSpan ( + int y, + int lw, + int rw, + struct arc_def *def, + struct arc_bound *bounds, + struct accelerators *acc, + int mask) { double yy, xalt, x, lx, rx; int n; @@ -3116,7 +3158,7 @@ } static void -disposeFinalSpans () +disposeFinalSpans (void) { struct finalSpanChunk *chunk, *next; @@ -3131,9 +3173,9 @@ } static void -fillSpans (pDrawable, pGC) - DrawablePtr pDrawable; - GCPtr pGC; +fillSpans ( + DrawablePtr pDrawable, + GCPtr pGC) { register struct finalSpan *span; register DDXPointPtr xSpan; @@ -3183,8 +3225,7 @@ realFindSpan (y)) static struct finalSpan ** -realFindSpan (y) - int y; +realFindSpan (int y) { struct finalSpan **newSpans; int newSize, newMiny, newMaxy; @@ -3235,9 +3276,10 @@ } static void -newFinalSpan (y, xmin, xmax) - int y; - register int xmin, xmax; +newFinalSpan ( + int y, + register int xmin, + register int xmax) { register struct finalSpan *x; register struct finalSpan **f; @@ -3292,9 +3334,9 @@ } static void -mirrorSppPoint (quadrant, sppPoint) - int quadrant; - SppPointPtr sppPoint; +mirrorSppPoint ( + int quadrant, + SppPointPtr sppPoint) { switch (quadrant) { case 0: @@ -3325,17 +3367,20 @@ */ static void -drawArc (tarc, l, a0, a1, right, left) - xArc *tarc; - int l, a0, a1; - miArcFacePtr right, left; /* save end line points */ +drawArc ( + xArc *tarc, + int l, + int a0, + int a1, + miArcFacePtr right, + miArcFacePtr left) /* save end line points */ { struct arc_def def; struct accelerators acc; int startq, endq, curq; - int rightq, leftq, righta, lefta; + int rightq, leftq = 0, righta = 0, lefta = 0; miArcFacePtr passRight, passLeft; - int q0, q1, mask; + int q0 = 0, q1 = 0, mask; struct band { int a0, a1; int mask; @@ -3564,13 +3609,15 @@ } static void -drawQuadrant (def, acc, a0, a1, mask, right, left, spdata) - struct arc_def *def; - struct accelerators *acc; - int a0, a1; - int mask; - miArcFacePtr right, left; - miArcSpanData *spdata; +drawQuadrant ( + struct arc_def *def, + struct accelerators *acc, + int a0, + int a1, + int mask, + miArcFacePtr right, + miArcFacePtr left, + miArcSpanData *spdata) { struct arc_bound bound; double yy, x, xalt; Index: xc/programs/Xserver/mi/mibank.c diff -u xc/programs/Xserver/mi/mibank.c:1.9 xc/programs/Xserver/mi/mibank.c:1.12 --- xc/programs/Xserver/mi/mibank.c:1.9 Sat Jan 6 15:58:12 2001 +++ xc/programs/Xserver/mi/mibank.c Wed Jan 16 11:22:32 2002 @@ -1,5 +1,5 @@ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.9 2001/01/06 20:58:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibank.c,v 1.12 2002/01/16 16:22:32 tsi Exp $ */ /* * This thing originated from an idea of Edwin Goei and his bank switching @@ -178,8 +178,6 @@ static int miBankScreenIndex; static int miBankGCIndex; static unsigned long miBankGeneration = 0; -static GCOps miBankGCOps; -static GCFuncs miBankGCFuncs; #define BANK_SCRPRIVLVAL pScreen->devPrivates[miBankScreenIndex].ptr @@ -2524,8 +2522,8 @@ if (ysize == 1) return (int)width; - maxBitsPerScanline = (((unsigned long)(-1) >> 1) - minBitsPerScanline) / - (ysize - 1); + maxBitsPerScanline = + (((unsigned long)(-1) >> 1) - minBitsPerScanline) / (ysize - 1); while (nBitsPerScanline <= maxBitsPerScanline) { unsigned long BankBase, BankUnit; @@ -2563,7 +2561,7 @@ if (BankBase != BankUnit) continue; - if (!(nBitsPerBank % x)) + if (!(nBitsPerScanline % x)) return (int)width; BankBase = ((nBitsPerScanline - minBitsPerScanline) / Index: xc/programs/Xserver/mi/mibank.h diff -u xc/programs/Xserver/mi/mibank.h:1.7 xc/programs/Xserver/mi/mibank.h:1.9 --- xc/programs/Xserver/mi/mibank.h:1.7 Sat Jan 6 15:58:12 2001 +++ xc/programs/Xserver/mi/mibank.h Wed Jan 16 11:22:32 2002 @@ -1,5 +1,5 @@ /* - * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2002 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.7 2001/01/06 20:58:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibank.h,v 1.9 2002/01/16 16:22:32 tsi Exp $ */ #ifndef __MIBANK_H__ #define __MIBANK_H__ 1 @@ -37,10 +37,8 @@ * etc. */ typedef int miBankProc( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, unsigned int /*iBank*/ -#endif ); typedef miBankProc *miBankProcPtr; @@ -90,21 +88,17 @@ Bool miInitializeBanking( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, unsigned int /*xsize*/, unsigned int /*ysize*/, unsigned int /*width*/, miBankInfoPtr /*pBankInfo*/ -#endif ); Bool miModifyBanking( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, miBankInfoPtr /*pBankInfo*/ -#endif ); /* @@ -114,14 +108,12 @@ */ int miScanLineWidth( -#if NeedFunctionPrototypes unsigned int /*xsize*/, unsigned int /*ysize*/, unsigned int /*width*/, unsigned long /*BankSize*/, PixmapFormatRec * /*pBankFormat*/, unsigned int /*nWidthUnit*/ -#endif ); #endif /* __MIBANK_H__ */ Index: xc/programs/Xserver/mi/mibitblt.c diff -u xc/programs/Xserver/mi/mibitblt.c:3.9 xc/programs/Xserver/mi/mibitblt.c:3.11 --- xc/programs/Xserver/mi/mibitblt.c:3.9 Wed Jan 17 17:37:05 2001 +++ xc/programs/Xserver/mi/mibitblt.c Fri Dec 14 15:00:20 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mibitblt.c,v 3.9 2001/01/17 22:37:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibitblt.c,v 3.11 2001/12/14 20:00:20 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mibitblt.c,v 1.4 2000/08/17 19:53:36 cpqbld Exp $ */ +/* $Xorg: mibitblt.c,v 1.5 2001/02/09 02:05:20 xorgcvs Exp $ */ /* Author: Todd Newman (aided and abetted by Mr. Drewry) */ #include "X.h" @@ -271,17 +275,20 @@ */ static MiBits * -miGetPlane(pDraw, planeNum, sx, sy, w, h, result) - DrawablePtr pDraw; - int planeNum; /* number of the bitPlane */ - int sx, sy, w, h; - MiBits *result; +miGetPlane( + DrawablePtr pDraw, + int planeNum, /* number of the bitPlane */ + int sx, + int sy, + int w, + int h, + MiBits *result) { int i, j, k, width, bitsPerPixel, widthInBytes; - DDXPointRec pt; + DDXPointRec pt = {0, 0}; MiBits pixel; MiBits bit; - unsigned char *pCharsOut; + unsigned char *pCharsOut = NULL; #if BITMAP_SCANLINE_UNIT == 8 #define OUT_TYPE unsigned char @@ -297,7 +304,7 @@ #endif OUT_TYPE *pOut; - int delta; + int delta = 0; sx += pDraw->x; sy += pDraw->y; @@ -642,10 +649,10 @@ { unsigned char depth; int i, linelength, width, srcx, srcy; - DDXPointRec pt; + DDXPointRec pt = {0, 0}; XID gcv[2]; PixmapPtr pPixmap = (PixmapPtr)NULL; - GCPtr pGC; + GCPtr pGC = NULL; depth = pDraw->depth; if(format == ZPixmap) Index: xc/programs/Xserver/mi/mibstore.c diff -u xc/programs/Xserver/mi/mibstore.c:1.6 xc/programs/Xserver/mi/mibstore.c:1.10 --- xc/programs/Xserver/mi/mibstore.c:1.6 Wed Jan 17 17:37:05 2001 +++ xc/programs/Xserver/mi/mibstore.c Fri Dec 14 15:00:20 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mibstore.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ +/* $Xorg: mibstore.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -38,7 +42,7 @@ ******************************************************************/ -/* $XFree86: xc/programs/Xserver/mi/mibstore.c,v 1.6 2001/01/17 22:37:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibstore.c,v 1.10 2001/12/14 20:00:20 dawes Exp $ */ #define NEED_EVENTS #include "X.h" @@ -48,7 +52,6 @@ #include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" -#include "extnsionst.h" #include "windowstr.h" #include "pixmapstr.h" #include "fontstruct.h" @@ -134,12 +137,12 @@ (pGC)->funcs = oldFuncs; \ } -static void miCreateBSPixmap(); -static void miDestroyBSPixmap(); -static void miTileVirtualBS(); -static void miBSAllocate(), miBSFree(); -static Bool miBSCreateGCPrivate (); -static void miBSClearBackingRegion (); +static void miCreateBSPixmap(WindowPtr pWin, BoxPtr pExtents); +static void miDestroyBSPixmap(WindowPtr pWin); +static void miTileVirtualBS(WindowPtr pWin); +static void miBSAllocate(WindowPtr pWin), miBSFree(WindowPtr pWin); +static Bool miBSCreateGCPrivate(GCPtr pGC); +static void miBSClearBackingRegion(WindowPtr pWin, RegionPtr pRgn); #define MoreCopy0 ; #define MoreCopy2 *dstCopy++ = *srcCopy++; *dstCopy++ = *srcCopy++; @@ -179,22 +182,36 @@ static int miBSScreenIndex; static unsigned long miBSGeneration = 0; -static Bool miBSCloseScreen(); -static void miBSGetImage(); -static void miBSGetSpans(); -static Bool miBSChangeWindowAttributes(); -static Bool miBSCreateGC(); -static Bool miBSDestroyWindow(); +static Bool miBSCloseScreen(int i, ScreenPtr pScreen); +static void miBSGetImage(DrawablePtr pDrawable, int sx, int sy, + int w, int h, unsigned int format, + unsigned long planemask, char *pdstLine); +static void miBSGetSpans(DrawablePtr pDrawable, int wMax, + DDXPointPtr ppt, int *pwidth, int nspans, + char *pdstStart); +static Bool miBSChangeWindowAttributes(WindowPtr pWin, + unsigned long mask); +static Bool miBSCreateGC(GCPtr pGC); +static Bool miBSDestroyWindow(WindowPtr pWin); /* * backing store screen functions */ -static void miBSSaveDoomedAreas(); -static RegionPtr miBSRestoreAreas(); -static void miBSExposeCopy(); -static RegionPtr miBSTranslateBackingStore(), miBSClearBackingStore(); -static void miBSDrawGuarantee(); +static void miBSSaveDoomedAreas(WindowPtr pWin, RegionPtr pObscured, + int dx, int dy); +static RegionPtr miBSRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed); +static void miBSExposeCopy(WindowPtr pSrc, DrawablePtr pDst, + GCPtr pGC, RegionPtr prgnExposed, + int srcx, int srcy, int dstx, int dsty, + unsigned long plane); +static RegionPtr miBSTranslateBackingStore(WindowPtr pWin, int windx, + int windy, RegionPtr oldClip, + int oldx, int oldy); +static RegionPtr miBSClearBackingStore(WindowPtr pWin, int x, int y, + int w, int h, Bool generateExposures); +static void miBSDrawGuarantee(WindowPtr pWin, GCPtr pGC, + int guarantee); /* * wrapper vectors for GC funcs and ops @@ -202,9 +219,14 @@ static int miBSGCIndex; -static void miBSValidateGC (), miBSCopyGC (), miBSDestroyGC(); -static void miBSChangeGC(); -static void miBSChangeClip(), miBSDestroyClip(), miBSCopyClip(); +static void miBSValidateGC(GCPtr pGC, unsigned long stateChanges, + DrawablePtr pDrawable); +static void miBSCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); +static void miBSDestroyGC(GCPtr pGC); +static void miBSChangeGC(GCPtr pGC, unsigned long mask); +static void miBSChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); +static void miBSDestroyClip(GCPtr pGC); +static void miBSCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static GCFuncs miBSGCFuncs = { miBSValidateGC, @@ -216,17 +238,59 @@ miBSCopyClip, }; -static void miBSFillSpans(), miBSSetSpans(), miBSPutImage(); -static RegionPtr miBSCopyArea(), miBSCopyPlane(); -static void miBSPolyPoint(), miBSPolylines(), miBSPolySegment(); -static void miBSPolyRectangle(),miBSPolyArc(), miBSFillPolygon(); -static void miBSPolyFillRect(), miBSPolyFillArc(); -static int miBSPolyText8(), miBSPolyText16(); -static void miBSImageText8(), miBSImageText16(); -static void miBSImageGlyphBlt(),miBSPolyGlyphBlt(); -static void miBSPushPixels(); +static void miBSFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, + DDXPointPtr pptInit, int *pwidthInit, + int fSorted); +static void miBSSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, + DDXPointPtr ppt, int *pwidth, int nspans, + int fSorted); +static void miBSPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, + int x, int y, int w, int h, int leftPad, + int format, char *pBits); +static RegionPtr miBSCopyArea(DrawablePtr pSrc, DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, int h, + int dstx, int dsty); +static RegionPtr miBSCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, int h, + int dstx, int dsty, unsigned long plane); +static void miBSPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, + int npt, xPoint *pptInit); +static void miBSPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, + int npt, DDXPointPtr pptInit); +static void miBSPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, + xSegment *pSegs); +static void miBSPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, + int nrects, xRectangle *pRects); +static void miBSPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, + xArc *parcs); +static void miBSFillPolygon(DrawablePtr pDrawable, GCPtr pGC, + int shape, int mode, int count, + DDXPointPtr pPts); +static void miBSPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit); +static void miBSPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, + int narcs, xArc *parcs); +static int miBSPolyText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars); +static int miBSPolyText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, + unsigned short *chars); +static void miBSImageText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars); +static void miBSImageText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, + unsigned short *chars); +static void miBSImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase); +static void miBSPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase); +static void miBSPushPixels(GCPtr pGC, PixmapPtr pBitMap, + DrawablePtr pDst, int w, int h, + int x, int y); #ifdef NEED_LINEHELPER -static void miBSLineHelper(); +static void miBSLineHelper(void); #endif static GCOps miBSGCOps = { @@ -257,10 +321,15 @@ * store enabled */ -static void miBSCheapValidateGC(), miBSCheapCopyGC(), miBSCheapDestroyGC(); -static void miBSCheapChangeGC (); -static void miBSCheapChangeClip(), miBSCheapDestroyClip(); -static void miBSCheapCopyClip(); +static void miBSCheapValidateGC(GCPtr pGC, unsigned long stateChanges, + DrawablePtr pDrawable); +static void miBSCheapCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); +static void miBSCheapDestroyGC(GCPtr pGC); +static void miBSCheapChangeGC(GCPtr pGC, unsigned long mask); +static void miBSCheapChangeClip(GCPtr pGC, int type, pointer pvalue, + int nrects); +static void miBSCheapDestroyClip(GCPtr pGC); +static void miBSCheapCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static GCFuncs miBSCheapGCFuncs = { miBSCheapValidateGC, @@ -365,7 +434,9 @@ return (*pScreen->CloseScreen) (i, pScreen); } -static void miBSFillVirtualBits(); +static void miBSFillVirtualBits(DrawablePtr pDrawable, GCPtr pGC, + RegionPtr pRgn, int x, int y, int state, + PixUnion pixunion, unsigned long planemask); static void miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) @@ -386,7 +457,7 @@ { PixmapPtr pPixmap; miBSWindowPtr pWindowPriv; - GCPtr pGC; + GCPtr pGC = NULL; WindowPtr pWin, pSrcWin; int xoff, yoff; RegionRec Remaining; @@ -844,8 +915,7 @@ } static void -miBSDestroyGCPrivate (pGC) - GCPtr pGC; +miBSDestroyGCPrivate (GCPtr pGC) { miBSGCRec *pPriv; @@ -1027,6 +1097,11 @@ EPILOGUE (pGC); } +typedef RegionPtr (* CopyAreaProcPtr)(DrawablePtr, DrawablePtr, GCPtr, + int, int, int, int, int, int); +typedef RegionPtr (* CopyPlaneProcPtr)(DrawablePtr, DrawablePtr, GCPtr, + int, int, int, int, int, int, + unsigned long bitPlane); /*- *----------------------------------------------------------------------- * miBSDoCopy -- @@ -1055,18 +1130,18 @@ *----------------------------------------------------------------------- */ static Bool -miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn) - WindowPtr pWin; /* Window being scrolled */ - GCPtr pGC; /* GC we're called through */ - int srcx; /* X of source rectangle */ - int srcy; /* Y of source rectangle */ - int w; /* Width of source rectangle */ - int h; /* Height of source rectangle */ - int dstx; /* X of destination rectangle */ - int dsty; /* Y of destination rectangle */ - unsigned long plane; /* Plane to copy (0 for CopyArea) */ - RegionPtr (*copyProc)(); /* Procedure to call to perform the copy */ - RegionPtr *ppRgn; /* resultant Graphics Expose region */ +miBSDoCopy( + WindowPtr pWin, /* Window being scrolled */ + GCPtr pGC, /* GC we're called through */ + int srcx, /* X of source rectangle */ + int srcy, /* Y of source rectangle */ + int w, /* Width of source rectangle */ + int h, /* Height of source rectangle */ + int dstx, /* X of destination rectangle */ + int dsty, /* Y of destination rectangle */ + unsigned long plane, /* Plane to copy (0 for CopyArea) */ + CopyPlaneProcPtr copyProc, /* Procedure to call to perform the copy */ + RegionPtr *ppRgn) /* resultant Graphics Expose region */ { RegionPtr pRgnExp; /* Exposed region */ RegionPtr pRgnObs; /* Obscured region */ @@ -1083,11 +1158,12 @@ register BoxPtr pBox; int dx, dy, nrects; Bool graphicsExposures; - RegionPtr (*pixCopyProc)(); + CopyPlaneProcPtr pixCopyProc; int numRectsExp, numRectsObs; BoxPtr pBoxExp, pBoxObs; SETUP_BACKING (pWin, pGC); + (void)oldFuncs; /* * Create a region of exposed boxes in pRgnExp. @@ -1307,7 +1383,7 @@ } else { - pixCopyProc = pBackingGC->ops->CopyArea; + pixCopyProc = (CopyPlaneProcPtr)pBackingGC->ops->CopyArea; } for (i = 0; i < nrects; i++) @@ -1322,7 +1398,7 @@ */ if (boxes[sequence[i]].source == pix) { - (void) (* copyProc) (pBackingDrawable, pWin, pGC, + (void) (* copyProc) (pBackingDrawable, &(pWin->drawable), pGC, pBox->x1 - pBackingStore->x, pBox->y1 - pBackingStore->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, @@ -1336,12 +1412,12 @@ } else { - (void) (* pixCopyProc) (pWin, pBackingDrawable, pBackingGC, + (void) (* pixCopyProc) (&(pWin->drawable), pBackingDrawable, pBackingGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx - pBackingStore->x, pBox->y1 + dy - pBackingStore->y, plane); - (void) (* copyProc) (pWin, pWin, pGC, + (void) (* copyProc) (&(pWin->drawable), &(pWin->drawable), pGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); @@ -1428,7 +1504,8 @@ if ((pSrc != pDst) || (!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty, - (unsigned long) 0, pGC->ops->CopyArea, &winExposed))) + (unsigned long) 0, (CopyPlaneProcPtr)pGC->ops->CopyArea, + &winExposed))) { /* * always copy to the backing store first, miBSDoCopy @@ -2593,8 +2670,10 @@ WindowPtr pWin; { miBSWindowPtr pBackingStore; - register ScreenPtr pScreen = pWin->drawable.pScreen; + register ScreenPtr pScreen; + pScreen = pWin->drawable.pScreen; + pBackingStore = (miBSWindowPtr)pWin->backStorage; if (pBackingStore) { @@ -2623,10 +2702,11 @@ *----------------------------------------------------------------------- */ static void -miResizeBackingStore(pWin, dx, dy, saveBits) - WindowPtr pWin; - int dx, dy; /* bits are moving this far */ - Bool saveBits; /* bits are useful */ +miResizeBackingStore( + WindowPtr pWin, + int dx, /* bits are moving this far */ + int dy, /* bits are moving this far */ + Bool saveBits) /* bits are useful */ { miBSWindowPtr pBackingStore; PixmapPtr pBackingPixmap; @@ -3280,7 +3360,7 @@ DrawablePtr pDrawable; { GCPtr pBackingGC; - miBSWindowPtr pWindowPriv; + miBSWindowPtr pWindowPriv = NULL; miBSGCPtr pPriv; WindowPtr pWin; int lift_functions; @@ -3637,7 +3717,7 @@ miBSWindowPtr pBackingStore; ScreenPtr pScreen; PixUnion background; - char backgroundState; + char backgroundState = 0; BoxPtr extents; Bool backSet; @@ -3755,7 +3835,7 @@ { RegionRec tempRgn; miBSWindowPtr pBackingStore; - RegionPtr (*copyProc)(); + CopyPlaneProcPtr copyProc; GCPtr pScratchGC; register BoxPtr pBox; register int i; @@ -3778,7 +3858,7 @@ if (plane != 0) { copyProc = pGC->ops->CopyPlane; } else { - copyProc = pGC->ops->CopyArea; + copyProc = (CopyPlaneProcPtr)pGC->ops->CopyArea; } dx = dstx - srcx; @@ -3809,7 +3889,7 @@ --i >= 0; pBox++) { - (* copyProc) (pBackingStore->pBackingPixmap, pDst, pGC, + (* copyProc) (&(pBackingStore->pBackingPixmap->drawable), pDst, pGC, pBox->x1 - pBackingStore->x, pBox->y1 - pBackingStore->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, Index: xc/programs/Xserver/mi/mibstore.h diff -u xc/programs/Xserver/mi/mibstore.h:1.4 xc/programs/Xserver/mi/mibstore.h:1.5 --- xc/programs/Xserver/mi/mibstore.h:1.4 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/mibstore.h Mon Aug 6 16:51:18 2001 @@ -16,7 +16,7 @@ */ -/* $XFree86: xc/programs/Xserver/mi/mibstore.h,v 1.4 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibstore.h,v 1.5 2001/08/06 20:51:18 dawes Exp $ */ #ifndef _MIBSTORE_H #define _MIBSTORE_H @@ -24,9 +24,7 @@ #include "screenint.h" extern void miInitializeBackingStore( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/ -#endif ); #endif /* _MIBSTORE_H */ Index: xc/programs/Xserver/mi/mibstorest.h diff -u xc/programs/Xserver/mi/mibstorest.h:1.4 xc/programs/Xserver/mi/mibstorest.h:1.5 --- xc/programs/Xserver/mi/mibstorest.h:1.4 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/mibstorest.h Fri Dec 14 15:00:21 2001 @@ -4,13 +4,17 @@ * internal structure definitions for mi backing store */ -/* $Xorg: mibstorest.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: mibstorest.h,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -27,7 +31,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/mibstorest.h,v 1.4 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibstorest.h,v 1.5 2001/12/14 20:00:21 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.3 xc/programs/Xserver/mi/miclipn.c:1.4 --- xc/programs/Xserver/mi/miclipn.c:1.1.1.3 Tue Jan 16 17:44:38 2001 +++ xc/programs/Xserver/mi/miclipn.c Fri Dec 14 15:00:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: miclipn.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: miclipn.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,18 +26,21 @@ from The Open Group. */ +/* $XFree86: xc/programs/Xserver/mi/miclipn.c,v 1.4 2001/12/14 20:00:21 dawes Exp $ */ #include "X.h" #include "windowstr.h" #include "scrnintstr.h" +#include "mi.h" -static void (*clipNotify)() = 0; -static void (*ClipNotifies[MAXSCREENS])(); +static void (*clipNotify)(WindowPtr,int,int) = 0; +static void (*ClipNotifies[MAXSCREENS])(WindowPtr,int,int); static void -miClipNotifyWrapper(pWin, dx, dy) - WindowPtr pWin; - int dx, dy; +miClipNotifyWrapper( + WindowPtr pWin, + int dx, + int dy ) { if (clipNotify) (*clipNotify)(pWin, dx, dy); @@ -51,8 +58,12 @@ static unsigned long clipGeneration = 0; void -miClipNotify (func) - void (*func)(); +miClipNotify ( + void (*func)( + WindowPtr /* pWin */, + int /* dx */, + int /* dy */ + ) ) { int i; Index: xc/programs/Xserver/mi/micmap.c diff -u xc/programs/Xserver/mi/micmap.c:1.10.4.1 xc/programs/Xserver/mi/micmap.c:1.11 --- xc/programs/Xserver/mi/micmap.c:1.10.4.1 Tue May 29 18:28:23 2001 +++ xc/programs/Xserver/mi/micmap.c Tue May 29 18:24:06 2001 @@ -27,7 +27,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/mi/micmap.c,v 1.10.4.1 2001/05/29 22:28:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/micmap.c,v 1.11 2001/05/29 22:24:06 dawes Exp $ */ /* * This is based on cfbcmap.c. The functions here are useful independently Index: xc/programs/Xserver/mi/micoord.h diff -u xc/programs/Xserver/mi/micoord.h:1.1 xc/programs/Xserver/mi/micoord.h:1.3 --- xc/programs/Xserver/mi/micoord.h:1.1 Mon Oct 23 17:16:52 2000 +++ xc/programs/Xserver/mi/micoord.h Sat Oct 27 23:34:15 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/micoord.h,v 1.1 2000/10/23 21:16:52 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/micoord.h,v 1.3 2001/10/28 03:34:15 tsi Exp $ */ /* * Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. * @@ -29,6 +29,8 @@ #ifndef _MICOORD_H_ #define _MICOORD_H_ 1 +#include "servermd.h" + /* Macros which handle a coordinate in a single register */ /* @@ -46,7 +48,8 @@ defined(sparc) || \ defined(__alpha) || defined(__alpha__) || \ defined(__i386__) || defined(i386) || \ - defined(__ia64__) || defined(ia64) + defined(__ia64__) || defined(ia64) || \ + defined(__s390x__) || defined(__s390__) #define GetHighWord(x) (((int) (x)) >> 16) #else #define GetHighWord(x) (((int) (x)) / 65536) Index: xc/programs/Xserver/mi/micursor.c diff -u xc/programs/Xserver/mi/micursor.c:1.1.1.3 xc/programs/Xserver/mi/micursor.c:1.3 --- xc/programs/Xserver/mi/micursor.c:1.1.1.3 Tue Jan 16 17:44:38 2001 +++ xc/programs/Xserver/mi/micursor.c Fri Dec 14 15:00:21 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/micursor.c,v 1.3 2001/12/14 20:00:21 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,10 +45,11 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: micursor.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: micursor.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ #include "scrnintstr.h" #include "cursor.h" #include "misc.h" +#include "mi.h" extern Bool Must_have_memory; Index: xc/programs/Xserver/mi/midash.c diff -u xc/programs/Xserver/mi/midash.c:1.1.1.3 xc/programs/Xserver/mi/midash.c:1.4 --- xc/programs/Xserver/mi/midash.c:1.1.1.3 Tue Jan 16 17:44:39 2001 +++ xc/programs/Xserver/mi/midash.c Fri Dec 14 15:00:21 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/midash.c,v 1.4 2001/12/14 20:00:21 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,12 +45,12 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: midash.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: midash.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ #include "miscstruct.h" #include "mistruct.h" #include "mifpoly.h" -static miDashPtr CheckDashStorage(); +static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax); /* return a list of DashRec. there will be an extra entry at the end holding the last point of the polyline. @@ -246,10 +251,10 @@ static miDashPtr -CheckDashStorage(ppseg, nseg, pnsegMax) -miDashPtr *ppseg; /* base pointer */ -int nseg; /* number of segment we want to write to */ -int *pnsegMax; /* size (in segments) of list so far */ +CheckDashStorage( + miDashPtr *ppseg, /* base pointer */ + int nseg, /* number of segment we want to write to */ + int *pnsegMax) /* size (in segments) of list so far */ { if (nseg > *pnsegMax) { Index: xc/programs/Xserver/mi/midispcur.c diff -u xc/programs/Xserver/mi/midispcur.c:1.4 xc/programs/Xserver/mi/midispcur.c:1.6 --- xc/programs/Xserver/mi/midispcur.c:1.4 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/midispcur.c Fri Dec 14 15:00:21 2001 @@ -3,15 +3,18 @@ * * machine independent cursor display routines */ -/* $XFree86: xc/programs/Xserver/mi/midispcur.c,v 1.4 2001/01/17 22:37:06 dawes Exp $ */ -/* $Xorg: midispcur.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: midispcur.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -27,6 +30,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/midispcur.c,v 1.6 2001/12/14 20:00:21 dawes Exp $ */ #define NEED_EVENTS # include "X.h" @@ -42,14 +46,12 @@ # include "misprite.h" # include "gcstruct.h" -extern WindowPtr *WindowTable; - /* per-screen private data */ static int miDCScreenIndex; static unsigned long miDCGeneration = 0; -static Bool miDCCloseScreen(); +static Bool miDCCloseScreen(int index, ScreenPtr pScreen); typedef struct { GCPtr pSourceGC, pMaskGC; @@ -70,10 +72,20 @@ * sprite/cursor method table */ -static Bool miDCRealizeCursor(), miDCUnrealizeCursor(); -static Bool miDCPutUpCursor(), miDCSaveUnderCursor(); -static Bool miDCRestoreUnderCursor(), miDCMoveCursor(); -static Bool miDCChangeSave(); +static Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +static Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +static Bool miDCPutUpCursor(ScreenPtr pScreen, CursorPtr pCursor, + int x, int y, unsigned long source, + unsigned long mask); +static Bool miDCSaveUnderCursor(ScreenPtr pScreen, int x, int y, + int w, int h); +static Bool miDCRestoreUnderCursor(ScreenPtr pScreen, int x, int y, + int w, int h); +static Bool miDCMoveCursor(ScreenPtr pScreen, CursorPtr pCursor, + int x, int y, int w, int h, int dx, int dy, + unsigned long source, unsigned long mask); +static Bool miDCChangeSave(ScreenPtr pScreen, int x, int y, int w, int h, + int dx, int dy); static miSpriteCursorFuncRec miDCFuncs = { miDCRealizeCursor, @@ -165,9 +177,9 @@ } static miDCCursorPtr -miDCRealize (pScreen, pCursor) - ScreenPtr pScreen; - CursorPtr pCursor; +miDCRealize ( + ScreenPtr pScreen, + CursorPtr pCursor) { miDCCursorPtr pPriv; GCPtr pGC; @@ -247,13 +259,17 @@ } static void -miDCPutBits (pDrawable, pPriv, sourceGC, maskGC, x, y, w, h, source, mask) - DrawablePtr pDrawable; - GCPtr sourceGC, maskGC; - int x, y; - unsigned w, h; - miDCCursorPtr pPriv; - unsigned long source, mask; +miDCPutBits ( + DrawablePtr pDrawable, + miDCCursorPtr pPriv, + GCPtr sourceGC, + GCPtr maskGC, + int x, + int y, + unsigned w, + unsigned h, + unsigned long source, + unsigned long mask) { XID gcvals[1]; @@ -278,9 +294,9 @@ #define EnsureGC(gc,win) (gc || miDCMakeGC(&gc, win)) static GCPtr -miDCMakeGC(ppGC, pWin) - GCPtr *ppGC; - WindowPtr pWin; +miDCMakeGC( + GCPtr *ppGC, + WindowPtr pWin) { GCPtr pGC; int status; Index: xc/programs/Xserver/mi/mieq.c diff -u xc/programs/Xserver/mi/mieq.c:1.1.1.4.2.1 xc/programs/Xserver/mi/mieq.c:1.3 --- xc/programs/Xserver/mi/mieq.c:1.1.1.4.2.1 Fri May 25 14:50:12 2001 +++ xc/programs/Xserver/mi/mieq.c Fri Dec 14 15:00:22 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: mieq.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ + * $Xorg: mieq.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,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 $ */ +/* $XFree86: xc/programs/Xserver/mi/mieq.c,v 1.3 2001/12/14 20:00:22 dawes Exp $ */ /* * mieq.c Index: xc/programs/Xserver/mi/miexpose.c diff -u xc/programs/Xserver/mi/miexpose.c:3.7 xc/programs/Xserver/mi/miexpose.c:3.9 --- xc/programs/Xserver/mi/miexpose.c:3.7 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/miexpose.c Fri Dec 14 15:00:22 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.7 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.9 2001/12/14 20:00:22 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ ******************************************************************/ -/* $Xorg: miexpose.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: miexpose.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ #include "X.h" #define NEED_EVENTS @@ -63,8 +67,6 @@ #include "globals.h" -extern WindowPtr *WindowTable; - #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" @@ -107,7 +109,7 @@ int dstx, dsty; unsigned long plane; { - register ScreenPtr pscr = pGC->pScreen; + register ScreenPtr pscr; RegionPtr prgnSrcClip; /* drawable-relative source clip */ RegionRec rgnSrcRec; RegionPtr prgnDstClip; /* drawable-relative dest clip */ @@ -124,6 +126,8 @@ BoxRec expBox; Bool extents; + /* This prevents warning about pscr not being used. */ + pGC->pScreen = pscr = pGC->pScreen; /* avoid work if we can */ if (!pGC->graphicsExposures && @@ -425,7 +429,7 @@ if(!noPanoramiXExtension) { int scrnum = pWin->drawable.pScreen->myNum; int x = 0, y = 0; - XID realWin; + XID realWin = 0; if(!pWin->parent) { x = panoramiXdataPtr[scrnum].x; @@ -579,9 +583,9 @@ /*ARGSUSED*/ static int -tossGC (value, id) -pointer value; -XID id; +tossGC ( + pointer value, + XID id) { GCPtr pGC = (GCPtr)value; screenContext[pGC->pScreen->myNum] = (GCPtr)NULL; @@ -589,6 +593,8 @@ numGCs--; if (!numGCs) ResType = 0; + + return 0; } Index: xc/programs/Xserver/mi/mifillarc.c diff -u xc/programs/Xserver/mi/mifillarc.c:3.5 xc/programs/Xserver/mi/mifillarc.c:3.7 --- xc/programs/Xserver/mi/mifillarc.c:3.5 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/mifillarc.c Fri Dec 14 15:00:22 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mifillarc.c,v 3.5 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mifillarc.c,v 3.7 2001/12/14 20:00:22 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ ********************************************************/ -/* $Xorg: mifillarc.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: mifillarc.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ #include <math.h> #include "X.h" @@ -134,11 +138,12 @@ } static void -miGetArcEdge(arc, edge, k, top, left) - register xArc *arc; - register miSliceEdgePtr edge; - int k; - Bool top, left; +miGetArcEdge( + register xArc *arc, + register miSliceEdgePtr edge, + int k, + Bool top, + Bool left ) { register int xady, y; @@ -263,11 +268,12 @@ } static void -miGetPieEdge(arc, angle, edge, top, left) - register xArc *arc; - register int angle; - register miSliceEdgePtr edge; - Bool top, left; +miGetPieEdge( + register xArc *arc, + register int angle, + register miSliceEdgePtr edge, + Bool top, + Bool left ) { register int k; int dx, dy; @@ -537,10 +543,10 @@ } static void -miFillEllipseI(pDraw, pGC, arc) - DrawablePtr pDraw; - GCPtr pGC; - xArc *arc; +miFillEllipseI( + DrawablePtr pDraw, + GCPtr pGC, + xArc *arc ) { register int x, y, e; int yk, xk, ym, xm, dx, dy, xorg, yorg; @@ -580,10 +586,10 @@ } static void -miFillEllipseD(pDraw, pGC, arc) - DrawablePtr pDraw; - GCPtr pGC; - xArc *arc; +miFillEllipseD( + DrawablePtr pDraw, + GCPtr pGC, + xArc *arc ) { register int x, y; int xorg, yorg, dx, dy, slw; @@ -645,10 +651,10 @@ } static void -miFillArcSliceI(pDraw, pGC, arc) - DrawablePtr pDraw; - GCPtr pGC; - xArc *arc; +miFillArcSliceI( + DrawablePtr pDraw, + GCPtr pGC, + xArc *arc ) { int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; register int x, y, e; @@ -708,10 +714,10 @@ } static void -miFillArcSliceD(pDraw, pGC, arc) - DrawablePtr pDraw; - GCPtr pGC; - xArc *arc; +miFillArcSliceD( + DrawablePtr pDraw, + GCPtr pGC, + xArc *arc ) { register int x, y; int dx, dy, xorg, yorg, slw; Index: xc/programs/Xserver/mi/mifillarc.h diff -u xc/programs/Xserver/mi/mifillarc.h:3.4 xc/programs/Xserver/mi/mifillarc.h:3.7 --- xc/programs/Xserver/mi/mifillarc.h:3.4 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/mifillarc.h Fri Dec 14 15:00:22 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.4 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.7 2001/12/14 20:00:22 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,8 +25,11 @@ ********************************************************/ -/* $Xorg: mifillarc.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: mifillarc.h,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ +#ifndef __MIFILLARC_H__ +#define __MIFILLARC_H__ + #define FULLCIRCLE (360 * 64) typedef struct _miFillArc { @@ -172,34 +179,25 @@ ((slw > 1) || (ine != inxk))) extern int miFreeArcCache( -#if NeedFunctionPrototypes pointer /*data*/, XID /*id*/ -#endif ); extern struct finalSpan *realAllocSpan( -#if NeedFunctionPrototypes void -#endif ); extern void miFillArcSetup( -#if NeedFunctionPrototypes xArc * /*arc*/, miFillArcRec * /*info*/ -#endif ); extern void miFillArcDSetup( -#if NeedFunctionPrototypes xArc * /*arc*/, miFillArcDRec * /*info*/ -#endif ); extern void miEllipseAngleToSlope( -#if NeedFunctionPrototypes int /*angle*/, int /*width*/, int /*height*/, @@ -207,14 +205,12 @@ int * /*dyp*/, double * /*d_dxp*/, double * /*d_dyp*/ -#endif ); extern void miFillArcSliceSetup( -#if NeedFunctionPrototypes xArc * /*arc*/, miArcSliceRec * /*slice*/, GCPtr /*pGC*/ -#endif ); +#endif /* __MIFILLARC_H__ */ Index: xc/programs/Xserver/mi/mifillrct.c diff -u xc/programs/Xserver/mi/mifillrct.c:1.1.1.3 xc/programs/Xserver/mi/mifillrct.c:1.3 --- xc/programs/Xserver/mi/mifillrct.c:1.1.1.3 Tue Jan 16 17:44:40 2001 +++ xc/programs/Xserver/mi/mifillrct.c Fri Dec 14 15:00:22 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mifillrct.c,v 1.3 2001/12/14 20:00:22 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,14 +45,14 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mifillrct.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: mifillrct.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ #include "X.h" #include "Xprotostr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" - +#include "mi.h" #include "misc.h" /* mi rectangles Index: xc/programs/Xserver/mi/mifpoly.h diff -u xc/programs/Xserver/mi/mifpoly.h:1.1.1.3 xc/programs/Xserver/mi/mifpoly.h:1.4 --- xc/programs/Xserver/mi/mifpoly.h:1.1.1.3 Tue Jan 16 17:44:41 2001 +++ xc/programs/Xserver/mi/mifpoly.h Fri Dec 14 15:00:22 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mifpoly.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ +/* $Xorg: mifpoly.h,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,11 @@ SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/mi/mifpoly.h,v 1.4 2001/12/14 20:00:22 dawes Exp $ */ +#ifndef __MIFPOLY_H__ +#define __MIFPOLY_H__ + #define EPSILON 0.000001 #define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON) #define UNEQUAL(a,b) (Fabs((a) - (b)) > EPSILON) @@ -64,8 +72,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; @@ -91,7 +98,6 @@ /* mifpolycon.c */ extern void miFillSppPoly( -#if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, @@ -100,5 +106,6 @@ int /*yTrans*/, double /*xFtrans*/, double /*yFtrans*/ -#endif ); + +#endif /* __MIFPOLY_H__ */ Index: xc/programs/Xserver/mi/mifpolycon.c diff -u xc/programs/Xserver/mi/mifpolycon.c:1.1.1.3 xc/programs/Xserver/mi/mifpolycon.c:1.3 --- xc/programs/Xserver/mi/mifpolycon.c:1.1.1.3 Tue Jan 16 17:44:41 2001 +++ xc/programs/Xserver/mi/mifpolycon.c Fri Dec 14 15:00:23 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mifpolycon.c,v 1.3 2001/12/14 20:00:23 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mifpolycon.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mifpolycon.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ #include <math.h> #include "X.h" #include "gcstruct.h" @@ -48,7 +53,8 @@ #include "pixmapstr.h" #include "mifpoly.h" -static int GetFPolyYBounds(); +static int GetFPolyYBounds(register SppPointPtr pts, int n, double yFtrans, + int *by, int *ty); #ifdef ICEILTEMPDECL ICEILTEMPDECL @@ -80,9 +86,9 @@ meet the polygon exactly. */ { - double xl, xr, /* x vals of left and right edges */ - ml, /* left edge slope */ - mr, /* right edge slope */ + double xl = 0.0, xr = 0.0, /* x vals of left and right edges */ + ml = 0.0, /* left edge slope */ + mr = 0.0, /* right edge slope */ dy, /* delta y */ i; /* loop counter */ int y, /* current scanline */ @@ -157,8 +163,8 @@ /* add a right edge if we need to */ if ((y > ptsIn[nextright].y + yFtrans) || - ISEQUAL(y, ptsIn[nextright].y + yFtrans) - && Marked[nextright] != 1) + (ISEQUAL(y, ptsIn[nextright].y + yFtrans) + && Marked[nextright] != 1)) { Marked[nextright]++; right = nextright--; @@ -242,11 +248,12 @@ * smallest and largest y */ static int -GetFPolyYBounds(pts, n, yFtrans, by, ty) - register SppPointPtr pts; - int n; - double yFtrans; - int *by, *ty; +GetFPolyYBounds( + register SppPointPtr pts, + int n, + double yFtrans, + int *by, + int *ty) { register SppPointPtr ptMin; double ymin, ymax; Index: xc/programs/Xserver/mi/migc.c diff -u xc/programs/Xserver/mi/migc.c:1.7 xc/programs/Xserver/mi/migc.c:1.9 --- xc/programs/Xserver/mi/migc.c:1.7 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/migc.c Fri Dec 14 15:00:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: migc.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: migc.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ */ -/* $XFree86: xc/programs/Xserver/mi/migc.c,v 1.7 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/migc.c,v 1.9 2001/12/14 20:00:23 dawes Exp $ */ #include "scrnintstr.h" #include "gcstruct.h" @@ -60,7 +64,6 @@ GCOpsPtr prototype; { GCOpsPtr ret; - extern Bool Must_have_memory; /* XXX */ Must_have_memory = TRUE; ret = (GCOpsPtr) xalloc(sizeof(GCOps)); @@ -173,7 +176,10 @@ GCPtr pGC; DrawablePtr pDrawable; { - ScreenPtr pScreen = pGC->pScreen; + ScreenPtr pScreen; + + /* This prevents warnings about pScreen not being used. */ + pGC->pScreen = pScreen = pGC->pScreen; if (pDrawable->type == DRAWABLE_WINDOW) { Index: xc/programs/Xserver/mi/migc.h diff -u xc/programs/Xserver/mi/migc.h:1.6 xc/programs/Xserver/mi/migc.h:1.8 --- xc/programs/Xserver/mi/migc.h:1.6 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/migc.h Fri Dec 14 15:00:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: migc.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: migc.h,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,66 +27,48 @@ */ -/* $XFree86: xc/programs/Xserver/mi/migc.h,v 1.6 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/migc.h,v 1.8 2001/12/14 20:00:23 dawes Exp $ */ extern void miChangeGC( -#if NeedFunctionPrototypes GCPtr /*pGC*/, unsigned long /*mask*/ -#endif ); extern void miDestroyGC( -#if NeedFunctionPrototypes GCPtr /*pGC*/ -#endif ); extern GCOpsPtr miCreateGCOps( -#if NeedFunctionPrototypes GCOpsPtr /*prototype*/ -#endif ); extern void miDestroyGCOps( -#if NeedFunctionPrototypes GCOpsPtr /*ops*/ -#endif ); extern void miDestroyClip( -#if NeedFunctionPrototypes GCPtr /*pGC*/ -#endif ); extern void miChangeClip( -#if NeedFunctionPrototypes GCPtr /*pGC*/, int /*type*/, pointer /*pvalue*/, int /*nrects*/ -#endif ); extern void miCopyClip( -#if NeedFunctionPrototypes GCPtr /*pgcDst*/, GCPtr /*pgcSrc*/ -#endif ); extern void miCopyGC( -#if NeedFunctionPrototypes GCPtr /*pGCSrc*/, unsigned long /*changes*/, GCPtr /*pGCDst*/ -#endif ); extern void miComputeCompositeClip( -#if NeedFunctionPrototypes GCPtr /*pGC*/, DrawablePtr /*pDrawable*/ -#endif ); Index: xc/programs/Xserver/mi/miglblt.c diff -u xc/programs/Xserver/mi/miglblt.c:1.4 xc/programs/Xserver/mi/miglblt.c:1.6 --- xc/programs/Xserver/mi/miglblt.c:1.4 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/miglblt.c Fri Dec 14 15:00:23 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/miglblt.c,v 1.4 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miglblt.c,v 1.6 2001/12/14 20:00:23 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ ******************************************************************/ -/* $Xorg: miglblt.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: miglblt.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ #include "X.h" #include "Xmd.h" @@ -55,6 +59,7 @@ #include "scrnintstr.h" #include "pixmap.h" #include "servermd.h" +#include "mi.h" /* machine-independent glyph blt. @@ -78,10 +83,10 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; - int x, y; + int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ - unsigned char *pglyphBase; /* start of array of glyphs */ + pointer pglyphBase; /* start of array of glyphs */ { int width, height; PixmapPtr pPixmap; @@ -191,10 +196,10 @@ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; - int x, y; + int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ - unsigned char *pglyphBase; /* start of array of glyphs */ + pointer pglyphBase; /* start of array of glyphs */ { ExtentInfoRec info; /* used by QueryGlyphExtents() */ XID gcvals[3]; @@ -234,7 +239,7 @@ DoChangeGC(pGC, GCForeground, gcvals, 0); ValidateGC(pDrawable, pGC); (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, - (char *)pglyphBase); + pglyphBase); /* put all the toys away when done playing */ gcvals[0] = oldAlu; Index: xc/programs/Xserver/mi/miinitext.c diff -u xc/programs/Xserver/mi/miinitext.c:3.57 xc/programs/Xserver/mi/miinitext.c:3.63 --- xc/programs/Xserver/mi/miinitext.c:3.57 Thu May 10 06:17:39 2001 +++ xc/programs/Xserver/mi/miinitext.c Fri Dec 14 15:00:23 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.57 2001/05/10 10:17:39 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.63 2001/12/14 20:00:23 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: miinitext.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: miinitext.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ #include "misc.h" #include "extension.h" @@ -66,17 +70,13 @@ #endif #ifndef XFree86LOADER -#if NeedFunctionPrototypes #define INITARGS void -#else -#define INITARGS /*nothing*/ -#endif typedef void (*InitExtension)(INITARGS); #else /* XFree86Loader */ #include "loaderProcs.h" #endif -#include "Xlib.h" +#include <X11/Xlib.h> #ifdef MITSHM #include "shmstr.h" #endif @@ -219,6 +219,9 @@ #ifdef RENDER extern void RenderExtensionInit(INITARGS); #endif +#ifdef RANDR +extern void RRExtensionInit(INITARGS); +#endif #ifndef XFree86LOADER @@ -331,9 +334,7 @@ #if defined(XFreeXDGA) XFree86DGAExtensionInit(); #endif -#endif #ifdef XF86DRI -#ifndef XPRINT /* we don't want Glx in the Xprint server */ XFree86DRIExtensionInit(); #endif #endif @@ -350,6 +351,9 @@ #ifdef RENDER RenderExtensionInit(); #endif +#ifdef RANDR + RRExtensionInit(); +#endif } void @@ -416,6 +420,7 @@ { NULL, "Adobe-DPS-Extension", NULL, NULL }, { NULL, "FontCache", NULL, NULL }, { NULL, "RENDER", NULL, NULL }, + { NULL, "RANDR", NULL, NULL }, { NULL, NULL, NULL, NULL } }; #endif @@ -440,9 +445,6 @@ #ifdef XIDLE { XIdleExtensionInit, "XIDLE", NULL, NULL, NULL }, #endif -#ifdef XTRAP - { DEC_XTRAPInit, "XTRAP", &noTestExtensions, NULL, NULL }, -#endif #ifdef XKB { XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL }, #endif @@ -466,6 +468,9 @@ #endif #ifdef RENDER { RenderExtensionInit, "RENDER", NULL, NULL, NULL }, +#endif +#ifdef RANDR + { RRExtensionInit, "RANDR", NULL, NULL, NULL }, #endif { NULL, NULL, NULL, NULL, NULL } }; Index: xc/programs/Xserver/mi/miline.h diff -u xc/programs/Xserver/mi/miline.h:1.5 xc/programs/Xserver/mi/miline.h:1.7 --- xc/programs/Xserver/mi/miline.h:1.5 Wed Jan 17 17:37:06 2001 +++ xc/programs/Xserver/mi/miline.h Fri Dec 14 15:00:24 2001 @@ -1,10 +1,14 @@ -/* $Xorg: miline.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: miline.h,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miline.h,v 1.5 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miline.h,v 1.7 2001/12/14 20:00:24 dawes Exp $ */ #ifndef MILINE_H @@ -75,10 +79,8 @@ */ extern void miSetZeroLineBias( -#if NeedFunctionPrototypes ScreenPtr /* pScreen */, unsigned int /* bias */ -#endif ); /* @@ -151,7 +153,6 @@ extern int miZeroLineScreenIndex; extern int miZeroClipLine( -#if NeedFunctionPrototypes int /*xmin*/, int /*ymin*/, int /*xmax*/, @@ -168,7 +169,6 @@ unsigned int /*bias*/, int /*oc1*/, int /*oc2*/ -#endif ); #endif /* MILINE_H */ Index: xc/programs/Xserver/mi/mioverlay.c diff -u xc/programs/Xserver/mi/mioverlay.c:3.10 xc/programs/Xserver/mi/mioverlay.c:3.12 --- xc/programs/Xserver/mi/mioverlay.c:3.10 Sat Apr 14 17:15:26 2001 +++ xc/programs/Xserver/mi/mioverlay.c Sat Nov 10 16:12:31 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mioverlay.c,v 3.10 2001/04/14 21:15:26 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mioverlay.c,v 3.12 2001/11/10 21:12:31 mvojkovi Exp $ */ #include "X.h" #include "scrnintstr.h" @@ -75,6 +75,8 @@ static void miOverlayWindowExposures(WindowPtr, RegionPtr, RegionPtr); static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int, unsigned int, WindowPtr); +static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool); + #ifdef SHAPE static void miOverlaySetShape(WindowPtr); #endif @@ -151,6 +153,7 @@ pScreen->WindowExposures = miOverlayWindowExposures; pScreen->ResizeWindow = miOverlayResizeWindow; pScreen->MarkWindow = miOverlayMarkWindow; + pScreen->ClearToBackground = miOverlayClearToBackground; #ifdef SHAPE pScreen->SetShape = miOverlaySetShape; #endif @@ -840,7 +843,7 @@ miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); WindowPtr pChild; ValidatePtr val; - void (* WindowExposures)(); + void (* WindowExposures)(WindowPtr, RegionPtr, RegionPtr); WindowExposures = pWin->drawable.pScreen->WindowExposures; if(pPriv->underlayMarked) { @@ -1097,10 +1100,13 @@ WindowPtr pWin, pointer value ){ - register ScreenPtr pScreen = pWin->drawable.pScreen; + register ScreenPtr pScreen; miOverlayTwoRegions *pValid = (miOverlayTwoRegions*)value; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); + /* This prevents warning about pScreen not being used. */ + pWin->drawable.pScreen = pScreen = pWin->drawable.pScreen; + if (pWin->valdata) { /* * compute exposed regions of this window @@ -1147,7 +1153,7 @@ int bw = wBorderWidth (pWin); short dw, dh; DDXPointRec oldpt; - RegionPtr oldRegion, oldRegion2; + RegionPtr oldRegion = NULL, oldRegion2 = NULL; WindowPtr pFirstChange; register WindowPtr pChild; RegionPtr gravitate[StaticGravity + 1]; @@ -1155,9 +1161,9 @@ register unsigned g; int nx, ny; /* destination x,y */ int newx, newy; /* new inner window position */ - RegionPtr pRegion; + RegionPtr pRegion = NULL; RegionPtr destClip, destClip2; - RegionPtr oldWinClip, oldWinClip2; + RegionPtr oldWinClip = NULL, oldWinClip2 = NULL; RegionPtr borderVisible = NullRegion; RegionPtr borderVisible2 = NullRegion; RegionPtr bsExposed = NullRegion; /* backing store exposures */ @@ -1565,7 +1571,7 @@ { Bool WasViewable = (Bool)(pWin->viewable); ScreenPtr pScreen = pWin->drawable.pScreen; - RegionPtr pOldClip, bsExposed; + RegionPtr pOldClip = NULL, bsExposed; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif @@ -1741,6 +1747,66 @@ REGION_BREAK(pScreen, &pTree->clipList); } + +static void +miOverlayClearToBackground( + WindowPtr pWin, + int x, int y, + int w, int h, + Bool generateExposures +) +{ + miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); + BoxRec box; + RegionRec reg; + RegionPtr pBSReg = NullRegion; + ScreenPtr pScreen = pWin->drawable.pScreen; + RegionPtr clipList; + BoxPtr extents; + int x1, y1, x2, y2; + + x1 = pWin->drawable.x + x; + y1 = pWin->drawable.y + y; + if (w) + x2 = x1 + (int) w; + else + x2 = x1 + (int) pWin->drawable.width - (int) x; + if (h) + y2 = y1 + h; + else + y2 = y1 + (int) pWin->drawable.height - (int) y; + + clipList = (pTree) ? &pTree->clipList : &pWin->clipList; + + extents = REGION_EXTENTS(pScreen, clipList); + + if (x1 < extents->x1) x1 = extents->x1; + if (x2 > extents->x2) x2 = extents->x2; + if (y1 < extents->y1) y1 = extents->y1; + if (y2 > extents->y2) y2 = extents->y2; + + if (x2 <= x1 || y2 <= y1) + x2 = x1 = y2 = y1 = 0; + + box.x1 = x1; box.x2 = x2; + box.y1 = y1; box.y2 = y2; + + REGION_INIT(pScreen, ®, &box, 1); + if (pWin->backStorage) { + pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h, + generateExposures); + } + + REGION_INTERSECT(pScreen, ®, ®, clipList); + if (generateExposures) + (*pScreen->WindowExposures)(pWin, ®, pBSReg); + else if (pWin->backgroundState != None) + (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); + REGION_UNINIT(pScreen, ®); + if (pBSReg) + REGION_DESTROY(pScreen, pBSReg); +} + /****************************************************************/ Index: xc/programs/Xserver/mi/mipointer.c diff -u xc/programs/Xserver/mi/mipointer.c:3.7 xc/programs/Xserver/mi/mipointer.c:3.10 --- xc/programs/Xserver/mi/mipointer.c:3.7 Thu Apr 19 10:14:07 2001 +++ xc/programs/Xserver/mi/mipointer.c Fri Dec 14 15:00:24 2001 @@ -2,13 +2,17 @@ * mipointer.c */ -/* $Xorg: mipointer.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipointer.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -24,7 +28,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.7 2001/04/19 14:14:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipointer.c,v 3.10 2001/12/14 20:00:24 dawes Exp $ */ # define NEED_EVENTS # include "X.h" @@ -51,16 +55,18 @@ static miPointerRec miPointer; -static Bool miPointerRealizeCursor (), miPointerUnrealizeCursor (); -static Bool miPointerDisplayCursor (); -static void miPointerConstrainCursor (), miPointerPointerNonInterestBox(); -static void miPointerCursorLimits (); -static Bool miPointerSetCursorPosition (); +static Bool miPointerRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +static Bool miPointerUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +static Bool miPointerDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor); +static void miPointerConstrainCursor(ScreenPtr pScreen, BoxPtr pBox); +static void miPointerPointerNonInterestBox(ScreenPtr pScreen, BoxPtr pBox); +static void miPointerCursorLimits(ScreenPtr pScreen, CursorPtr pCursor, + BoxPtr pHotBox, BoxPtr pTopLeftBox); +static Bool miPointerSetCursorPosition(ScreenPtr pScreen, int x, int y, + Bool generateEvent); +static Bool miPointerCloseScreen(int index, ScreenPtr pScreen); +static void miPointerMove(ScreenPtr pScreen, int x, int y, unsigned long time); -static Bool miPointerCloseScreen(); - -static void miPointerMove (); - Bool miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) ScreenPtr pScreen; @@ -168,8 +174,6 @@ ScreenPtr pScreen; CursorPtr pCursor; { - SetupScreen(pScreen); - miPointer.pCursor = pCursor; miPointer.pScreen = pScreen; miPointerUpdate (); Index: xc/programs/Xserver/mi/mipointer.h diff -u xc/programs/Xserver/mi/mipointer.h:3.7 xc/programs/Xserver/mi/mipointer.h:3.9 --- xc/programs/Xserver/mi/mipointer.h:3.7 Sun Mar 25 00:32:15 2001 +++ xc/programs/Xserver/mi/mipointer.h Fri Dec 14 15:00:24 2001 @@ -3,13 +3,17 @@ * */ -/* $Xorg: mipointer.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipointer.h,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -25,7 +29,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.h,v 3.7 2001/03/25 05:32:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipointer.h,v 3.9 2001/12/14 20:00:24 dawes Exp $ */ #ifndef MIPOINTER_H #define MIPOINTER_H @@ -35,166 +39,122 @@ typedef struct _miPointerSpriteFuncRec { Bool (*RealizeCursor)( -#if NeedFunctionPrototypes ScreenPtr /* pScr */, CursorPtr /* pCurs */ -#endif ); Bool (*UnrealizeCursor)( -#if NeedFunctionPrototypes ScreenPtr /* pScr */, CursorPtr /* pCurs */ -#endif ); void (*SetCursor)( -#if NeedFunctionPrototypes ScreenPtr /* pScr */, CursorPtr /* pCurs */, int /* x */, int /* y */ -#endif ); void (*MoveCursor)( -#if NeedFunctionPrototypes ScreenPtr /* pScr */, int /* x */, int /* y */ -#endif ); } miPointerSpriteFuncRec, *miPointerSpriteFuncPtr; typedef struct _miPointerScreenFuncRec { Bool (*CursorOffScreen)( -#if NeedFunctionPrototypes ScreenPtr* /* ppScr */, int* /* px */, int* /* py */ -#endif ); void (*CrossScreen)( -#if NeedFunctionPrototypes ScreenPtr /* pScr */, int /* entering */ -#endif ); void (*WarpCursor)( -#if NeedFunctionPrototypes ScreenPtr /* pScr */, int /* x */, int /* y */ -#endif ); void (*EnqueueEvent)( -#if NeedFunctionPrototypes xEventPtr /* event */ -#endif ); void (*NewEventScreen)( -#if NeedFunctionPrototypes ScreenPtr /* pScr */, Bool /* fromDIX */ -#endif ); } miPointerScreenFuncRec, *miPointerScreenFuncPtr; extern Bool miDCInitialize( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, miPointerScreenFuncPtr /*screenFuncs*/ -#endif ); extern Bool miPointerInitialize( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, miPointerSpriteFuncPtr /*spriteFuncs*/, miPointerScreenFuncPtr /*screenFuncs*/, Bool /*waitForUpdate*/ -#endif ); extern void miPointerWarpCursor( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/ -#endif ); extern int miPointerGetMotionBufferSize( -#if NeedFunctionPrototypes void -#endif ); extern int miPointerGetMotionEvents( -#if NeedFunctionPrototypes DeviceIntPtr /*pPtr*/, xTimecoord * /*coords*/, unsigned long /*start*/, unsigned long /*stop*/, ScreenPtr /*pScreen*/ -#endif ); extern void miPointerUpdate( -#if NeedFunctionPrototypes void -#endif ); extern void miPointerDeltaCursor( -#if NeedFunctionPrototypes int /*dx*/, int /*dy*/, unsigned long /*time*/ -#endif ); extern void miPointerAbsoluteCursor( -#if NeedFunctionPrototypes int /*x*/, int /*y*/, unsigned long /*time*/ -#endif ); extern void miPointerPosition( -#if NeedFunctionPrototypes int * /*x*/, int * /*y*/ -#endif ); #undef miRegisterPointerDevice extern void miRegisterPointerDevice( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, DevicePtr /*pDevice*/ -#endif ); extern void miPointerSetNewScreen( -#if NeedFunctionPrototypes int, /*screen_no*/ int, /*x*/ int /*y*/ -#endif ); extern ScreenPtr miPointerCurrentScreen( -#if NeedFunctionPrototypes void -#endif ); #define miRegisterPointerDevice(pScreen,pDevice) \ _miRegisterPointerDevice(pScreen,pDevice) extern void _miRegisterPointerDevice( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, DeviceIntPtr /*pDevice*/ -#endif ); extern int miPointerScreenIndex; Index: xc/programs/Xserver/mi/mipointrst.h diff -u xc/programs/Xserver/mi/mipointrst.h:1.3 xc/programs/Xserver/mi/mipointrst.h:1.4 --- xc/programs/Xserver/mi/mipointrst.h:1.3 Thu Apr 19 10:14:07 2001 +++ xc/programs/Xserver/mi/mipointrst.h Fri Dec 14 15:00:25 2001 @@ -3,13 +3,17 @@ * */ -/* $Xorg: mipointrst.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipointrst.h,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -25,7 +29,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/mipointrst.h,v 1.3 2001/04/19 14:14:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipointrst.h,v 1.4 2001/12/14 20:00:25 dawes Exp $ */ #include "mipointer.h" #include "scrnintstr.h" Index: xc/programs/Xserver/mi/mipoly.c diff -u xc/programs/Xserver/mi/mipoly.c:1.1.1.3 xc/programs/Xserver/mi/mipoly.c:1.2 --- xc/programs/Xserver/mi/mipoly.c:1.1.1.3 Tue Jan 16 17:44:43 2001 +++ xc/programs/Xserver/mi/mipoly.c Fri Dec 14 15:00:25 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mipoly.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipoly.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* * mipoly.c * Index: xc/programs/Xserver/mi/mipoly.h diff -u xc/programs/Xserver/mi/mipoly.h:1.1.1.3 xc/programs/Xserver/mi/mipoly.h:1.3 --- xc/programs/Xserver/mi/mipoly.h:1.1.1.3 Tue Jan 16 17:44:43 2001 +++ xc/programs/Xserver/mi/mipoly.h Fri Dec 14 15:00:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mipoly.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipoly.h,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,6 +26,7 @@ from The Open Group. */ +/* $XFree86: xc/programs/Xserver/mi/mipoly.h,v 1.3 2001/12/14 20:00:25 dawes Exp $ */ /* @@ -178,47 +183,35 @@ /* mipolyutil.c */ extern Bool miInsertEdgeInET( -#if NeedFunctionPrototypes EdgeTable * /*ET*/, EdgeTableEntry * /*ETE*/, int /*scanline*/, ScanLineListBlock ** /*SLLBlock*/, int * /*iSLLBlock*/ -#endif ); extern Bool miCreateETandAET( -#if NeedFunctionPrototypes int /*count*/, DDXPointPtr /*pts*/, EdgeTable * /*ET*/, EdgeTableEntry * /*AET*/, EdgeTableEntry * /*pETEs*/, ScanLineListBlock * /*pSLLBlock*/ -#endif ); extern void miloadAET( -#if NeedFunctionPrototypes EdgeTableEntry * /*AET*/, EdgeTableEntry * /*ETEs*/ -#endif ); extern void micomputeWAET( -#if NeedFunctionPrototypes EdgeTableEntry * /*AET*/ -#endif ); extern int miInsertionSort( -#if NeedFunctionPrototypes EdgeTableEntry * /*AET*/ -#endif ); extern void miFreeStorage( -#if NeedFunctionPrototypes ScanLineListBlock * /*pSLLBlock*/ -#endif ); Index: xc/programs/Xserver/mi/mipolycon.c diff -u xc/programs/Xserver/mi/mipolycon.c:1.1.1.3 xc/programs/Xserver/mi/mipolycon.c:1.4 --- xc/programs/Xserver/mi/mipolycon.c:1.1.1.3 Tue Jan 16 17:44:44 2001 +++ xc/programs/Xserver/mi/mipolycon.c Fri Dec 14 15:00:25 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mipolycon.c,v 1.4 2001/12/14 20:00:25 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,12 +45,14 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mipolycon.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipolycon.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ + #include "gcstruct.h" #include "pixmap.h" +#include "mi.h" #include "miscanfill.h" -static int getPolyYBounds(); +static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty); /* * convexpoly.c @@ -69,21 +76,21 @@ int count; /* number of points */ DDXPointPtr ptsIn; /* the points */ { - register int xl, xr; /* x vals of left and right edges */ - register int dl, dr; /* decision variables */ - register int ml, m1l; /* left edge slope and slope+1 */ - int mr, m1r; /* right edge slope and slope+1 */ - int incr1l, incr2l; /* left edge error increments */ - int incr1r, incr2r; /* right edge error increments */ - int dy; /* delta y */ - int y; /* current scanline */ - int left, right; /* indices to first endpoints */ - int i; /* loop counter */ - int nextleft, nextright; /* indices to second endpoints */ + register int xl = 0, xr = 0; /* x vals of left and right edges */ + register int dl = 0, dr = 0; /* decision variables */ + register int ml = 0, m1l = 0;/* left edge slope and slope+1 */ + int mr = 0, m1r = 0; /* right edge slope and slope+1 */ + int incr1l = 0, incr2l = 0; /* left edge error increments */ + int incr1r = 0, incr2r = 0; /* right edge error increments */ + int dy; /* delta y */ + int y; /* current scanline */ + int left, right; /* indices to first endpoints */ + int i; /* loop counter */ + int nextleft, nextright; /* indices to second endpoints */ DDXPointPtr ptsOut, FirstPoint; /* output buffer */ - int *width, *FirstWidth; /* output buffer */ - int imin; /* index of smallest vertex (in y) */ - int ymin; /* y-extents of polygon */ + int *width, *FirstWidth; /* output buffer */ + int imin; /* index of smallest vertex (in y) */ + int ymin; /* y-extents of polygon */ int ymax; /* @@ -209,12 +216,8 @@ /* * Find the index of the point with the smallest y. */ -static -int -getPolyYBounds(pts, n, by, ty) - DDXPointPtr pts; - int n; - int *by, *ty; +static int +getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty) { register DDXPointPtr ptMin; int ymin, ymax; Index: xc/programs/Xserver/mi/mipolygen.c diff -u xc/programs/Xserver/mi/mipolygen.c:1.1.1.3 xc/programs/Xserver/mi/mipolygen.c:1.3 --- xc/programs/Xserver/mi/mipolygen.c:1.1.1.3 Tue Jan 16 17:44:44 2001 +++ xc/programs/Xserver/mi/mipolygen.c Fri Dec 14 15:00:25 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mipolygen.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,12 +45,13 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mipolygen.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipolygen.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ #include "X.h" #include "gcstruct.h" #include "miscanfill.h" #include "mipoly.h" #include "pixmap.h" +#include "mi.h" /* * Index: xc/programs/Xserver/mi/mipolypnt.c diff -u xc/programs/Xserver/mi/mipolypnt.c:1.1.1.3 xc/programs/Xserver/mi/mipolypnt.c:1.3 --- xc/programs/Xserver/mi/mipolypnt.c:1.1.1.3 Tue Jan 16 17:44:44 2001 +++ xc/programs/Xserver/mi/mipolypnt.c Fri Dec 14 15:00:25 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mipolypnt.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,12 +45,13 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mipolypnt.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipolypnt.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ #include "X.h" #include "Xprotostr.h" #include "pixmapstr.h" #include "gcstruct.h" #include "windowstr.h" +#include "mi.h" void miPolyPoint(pDrawable, pGC, mode, npt, pptInit) Index: xc/programs/Xserver/mi/mipolyrect.c diff -u xc/programs/Xserver/mi/mipolyrect.c:1.1.1.3 xc/programs/Xserver/mi/mipolyrect.c:1.3 --- xc/programs/Xserver/mi/mipolyrect.c:1.1.1.3 Tue Jan 16 17:44:44 2001 +++ xc/programs/Xserver/mi/mipolyrect.c Fri Dec 14 15:00:25 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mipolyrect.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,12 +45,13 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mipolyrect.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipolyrect.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmap.h" +#include "mi.h" void miPolyRectangle(pDraw, pGC, nrects, pRects) Index: xc/programs/Xserver/mi/mipolyseg.c diff -u xc/programs/Xserver/mi/mipolyseg.c:1.1.1.3 xc/programs/Xserver/mi/mipolyseg.c:1.3 --- xc/programs/Xserver/mi/mipolyseg.c:1.1.1.3 Tue Jan 16 17:44:44 2001 +++ xc/programs/Xserver/mi/mipolyseg.c Fri Dec 14 15:00:26 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mipolyseg.c,v 1.3 2001/12/14 20:00:26 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,12 +45,13 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mipolyseg.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipolyseg.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmap.h" +#include "mi.h" /***************************************************************** * miPolySegment Index: xc/programs/Xserver/mi/mipolytext.c diff -u xc/programs/Xserver/mi/mipolytext.c:1.1.1.3 xc/programs/Xserver/mi/mipolytext.c:1.3 --- xc/programs/Xserver/mi/mipolytext.c:1.1.1.3 Tue Jan 16 17:44:45 2001 +++ xc/programs/Xserver/mi/mipolytext.c Fri Dec 14 15:00:26 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mipolytext.c,v 1.3 2001/12/14 20:00:26 dawes Exp $ */ /******************************************************************* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +45,7 @@ SOFTWARE. ************************************************************************/ -/* $Xorg: mipolytext.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipolytext.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* * mipolytext.c - text routines * @@ -57,6 +62,7 @@ #include "gcstruct.h" #include "fontstruct.h" #include "dixfontstr.h" +#include "mi.h" int miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding) Index: xc/programs/Xserver/mi/mipolyutil.c diff -u xc/programs/Xserver/mi/mipolyutil.c:1.8 xc/programs/Xserver/mi/mipolyutil.c:1.9 --- xc/programs/Xserver/mi/mipolyutil.c:1.8 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/mipolyutil.c Fri Dec 14 15:00:26 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mipolyutil.c,v 1.8 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipolyutil.c,v 1.9 2001/12/14 20:00:26 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mipolyutil.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipolyutil.c,v 1.4 2001/02/09 02:05:21 xorgcvs 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.11 xc/programs/Xserver/mi/mipushpxl.c:3.12 --- xc/programs/Xserver/mi/mipushpxl.c:3.11 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/mipushpxl.c Fri Dec 14 15:00:26 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mipushpxl.c,v 3.11 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipushpxl.c,v 3.12 2001/12/14 20:00:26 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mipushpxl.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: mipushpxl.c,v 1.4 2001/02/09 02:05:21 xorgcvs 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.6 xc/programs/Xserver/mi/miregion.c:1.8 --- xc/programs/Xserver/mi/miregion.c:1.6 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/miregion.c Fri Dec 14 15:00:26 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/miregion.c,v 1.6 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miregion.c,v 1.8 2001/12/14 20:00:26 dawes Exp $ */ /*********************************************************** Copyright 1987, 1988, 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: miregion.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ +/* $Xorg: miregion.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* The panoramix components contained the following notice */ /**************************************************************** @@ -70,6 +74,8 @@ #include "regionstr.h" #include "Xprotostr.h" #include "gc.h" +#include "mi.h" +#include "mispans.h" #if defined (__GNUC__) && !defined (NO_INLINES) #define INLINE __inline @@ -399,9 +405,9 @@ } Bool -miRectAlloc(pRgn, n) - register RegionPtr pRgn; - int n; +miRectAlloc( + register RegionPtr pRgn, + int n) { RegDataPtr data; @@ -493,10 +499,10 @@ *----------------------------------------------------------------------- */ INLINE static int -miCoalesce (pReg, prevStart, curStart) - register RegionPtr pReg; /* Region to coalesce */ - int prevStart; /* Index of start of previous band */ - int curStart; /* Index of start of current band */ +miCoalesce ( + register RegionPtr pReg, /* Region to coalesce */ + int prevStart, /* Index of start of previous band */ + int curStart) /* Index of start of current band */ { register BoxPtr pPrevBox; /* Current box in previous band */ register BoxPtr pCurBox; /* Current box in current band */ @@ -577,12 +583,12 @@ */ INLINE static Bool -miAppendNonO (pReg, r, rEnd, y1, y2) - register RegionPtr pReg; - register BoxPtr r; - BoxPtr rEnd; - register int y1; - register int y2; +miAppendNonO ( + register RegionPtr pReg, + register BoxPtr r, + BoxPtr rEnd, + register int y1, + register int y2) { register BoxPtr pNextRect; register int newRects; @@ -617,7 +623,7 @@ #define AppendRegions(newReg, r, rEnd) \ { \ int newRects; \ - if (newRects = rEnd - r) { \ + if ((newRects = rEnd - r)) { \ RECTALLOC(newReg, newRects); \ memmove((char *)REGION_TOP(newReg),(char *)r, \ newRects * sizeof(BoxRec)); \ @@ -653,18 +659,29 @@ * *----------------------------------------------------------------------- */ + +typedef Bool (*OverlapProcPtr)( + RegionPtr pReg, + BoxPtr r1, + BoxPtr r1End, + BoxPtr r2, + BoxPtr r2End, + short y1, + short y2, + Bool *pOverlap); + static Bool -miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap) - RegionPtr newReg; /* Place to store result */ - RegionPtr reg1; /* First region in operation */ - RegionPtr reg2; /* 2d region in operation */ - Bool (*overlapFunc)(); /* Function to call for over- +miRegionOp( + RegionPtr newReg, /* Place to store result */ + RegionPtr reg1, /* First region in operation */ + RegionPtr reg2, /* 2d region in operation */ + OverlapProcPtr overlapFunc, /* Function to call for over- * lapping bands */ - Bool appendNon1; /* Append non-overlapping bands */ + Bool appendNon1, /* Append non-overlapping bands */ /* in region 1 ? */ - Bool appendNon2; /* Append non-overlapping bands */ + Bool appendNon2, /* Append non-overlapping bands */ /* in region 2 ? */ - Bool *pOverlap; + Bool *pOverlap) { register BoxPtr r1; /* Pointer into first region */ register BoxPtr r2; /* Pointer into 2d region */ @@ -948,15 +965,15 @@ */ /*ARGSUSED*/ static Bool -miIntersectO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) - register RegionPtr pReg; - register BoxPtr r1; - BoxPtr r1End; - register BoxPtr r2; - BoxPtr r2End; - short y1; - short y2; - Bool *pOverlap; +miIntersectO ( + register RegionPtr pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2, + Bool *pOverlap) { register int x1; register int x2; @@ -1091,15 +1108,15 @@ *----------------------------------------------------------------------- */ static Bool -miUnionO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) - register RegionPtr pReg; - register BoxPtr r1; - BoxPtr r1End; - register BoxPtr r2; - BoxPtr r2End; - short y1; - short y2; - Bool *pOverlap; +miUnionO ( + register RegionPtr pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2, + Bool *pOverlap) { register BoxPtr pNextRect; register int x1; /* left and right side of current union */ @@ -1345,9 +1362,9 @@ } static void -QuickSortRects(rects, numRects) - register BoxRec rects[]; - register int numRects; +QuickSortRects( + register BoxRec rects[], + register int numRects) { register int y1; register int x1; @@ -1728,15 +1745,15 @@ */ /*ARGSUSED*/ static Bool -miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) - register RegionPtr pReg; - register BoxPtr r1; - BoxPtr r1End; - register BoxPtr r2; - BoxPtr r2End; - register int y1; - int y2; - Bool *pOverlap; +miSubtractO ( + register RegionPtr pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + register short y1, + short y2, + Bool *pOverlap) { register BoxPtr pNextRect; register int x1; @@ -2158,9 +2175,9 @@ } Bool -miRegionDataCopy(dst, src) - register RegionPtr dst; - register RegionPtr src; +miRegionDataCopy( + register RegionPtr dst, + register RegionPtr src) { good(dst); good(src); @@ -2242,8 +2259,7 @@ } Bool -miRegionBroken(pReg) - RegionPtr pReg; +miRegionBroken(RegionPtr pReg) { good(pReg); return (REGION_NAR(pReg)); @@ -2282,10 +2298,10 @@ so forget it. */ -static void QuickSortSpans(spans, widths, numSpans) - register DDXPointRec spans[]; - register int widths[]; - register int numSpans; +static void QuickSortSpans( + register DDXPointRec spans[], + register int widths[], + register int numSpans) { register int y; register int i, j, m; @@ -2387,14 +2403,14 @@ */ int -miClipSpans(prgnDst, ppt, pwidth, nspans, pptNew, pwidthNew, fSorted) - RegionPtr prgnDst; - register DDXPointPtr ppt; - register int *pwidth; - int nspans; - register DDXPointPtr pptNew; - int *pwidthNew; - int fSorted; +miClipSpans( + RegionPtr prgnDst, + register DDXPointPtr ppt, + register int *pwidth, + int nspans, + register DDXPointPtr pptNew, + int *pwidthNew, + int fSorted) { register DDXPointPtr pptLast; int *pwidthNewStart; /* the vengeance of Xerox! */ @@ -2440,7 +2456,7 @@ } /* end for */ } - else if (numRects = prgnDst->data->numRects) + else if ((numRects = prgnDst->data->numRects)) { /* Have to clip against many boxes */ BoxPtr pboxBandStart, pboxBandEnd; Index: xc/programs/Xserver/mi/miscanfill.h diff -u xc/programs/Xserver/mi/miscanfill.h:1.1.1.3 xc/programs/Xserver/mi/miscanfill.h:1.2 --- xc/programs/Xserver/mi/miscanfill.h:1.1.1.3 Tue Jan 16 17:44:46 2001 +++ xc/programs/Xserver/mi/miscanfill.h Fri Dec 14 15:00:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: miscanfill.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: miscanfill.h,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/mi/miscrinit.c diff -u xc/programs/Xserver/mi/miscrinit.c:3.13 xc/programs/Xserver/mi/miscrinit.c:3.15 --- xc/programs/Xserver/mi/miscrinit.c:3.13 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/miscrinit.c Fri Dec 14 15:00:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: miscrinit.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: miscrinit.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miscrinit.c,v 3.13 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miscrinit.c,v 3.15 2001/12/14 20:00:26 dawes Exp $ */ #include "X.h" #include "servermd.h" @@ -32,6 +36,10 @@ #include "pixmapstr.h" #include "dix.h" #include "miline.h" +#ifdef MITSHM +#define _XSHM_SERVER_ +#include "XShm.h" +#endif /* We use this structure to propogate some information from miScreenInit to * miCreateScreenResources. miScreenInit allocates the structure, fills it Index: xc/programs/Xserver/mi/mispans.c diff -u xc/programs/Xserver/mi/mispans.c:3.2 xc/programs/Xserver/mi/mispans.c:3.4 --- xc/programs/Xserver/mi/mispans.c:3.2 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/mispans.c Fri Dec 14 15:00:26 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mispans.c,v 3.2 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mispans.c,v 3.4 2001/12/14 20:00:26 dawes Exp $ */ /*********************************************************** Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ ******************************************************************/ -/* $Xorg: mispans.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: mispans.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ #include "misc.h" #include "pixmapstr.h" @@ -219,10 +223,10 @@ if (spanGroup->group != NULL) xfree(spanGroup->group); } -static void QuickSortSpansX(points, widths, numSpans) - register DDXPointRec points[]; - register int widths[]; - register int numSpans; +static void QuickSortSpansX( + register DDXPointRec points[], + register int widths[], + register int numSpans ) { register int x; register int i, j, m; @@ -306,10 +310,10 @@ } /* QuickSortSpans */ -static int UniquifySpansX(spans, newPoints, newWidths) - Spans *spans; - register DDXPointRec *newPoints; - register int *newWidths; +static int UniquifySpansX( + Spans *spans, + register DDXPointRec *newPoints, + register int *newWidths ) { register int newx1, newx2, oldpt, i, y; register DDXPointRec *oldPoints; Index: xc/programs/Xserver/mi/mispans.h diff -u xc/programs/Xserver/mi/mispans.h:1.1.1.3 xc/programs/Xserver/mi/mispans.h:1.3 --- xc/programs/Xserver/mi/mispans.h:1.1.1.3 Tue Jan 16 17:44:47 2001 +++ xc/programs/Xserver/mi/mispans.h Fri Dec 14 15:00:26 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mispans.h,v 1.3 2001/12/14 20:00:26 dawes Exp $ */ /*********************************************************** Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +46,7 @@ ******************************************************************/ -/* $Xorg: mispans.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: mispans.h,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */ typedef struct { int count; /* number of spans */ @@ -58,60 +63,45 @@ /* Initialize SpanGroup. MUST BE DONE before use. */ extern void miInitSpanGroup( -#if NeedFunctionPrototypes SpanGroup * /*spanGroup*/ -#endif ); /* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */ extern void miAppendSpans( -#if NeedFunctionPrototypes SpanGroup * /*spanGroup*/, SpanGroup * /*otherGroup*/, Spans * /*spans*/ -#endif ); /* Paint a span group, possibly with some overlap */ extern void miFillSpanGroup( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, SpanGroup * /*spanGroup*/ -#endif ); /* Paint a span group, insuring that each pixel is painted at most once */ extern void miFillUniqueSpanGroup( -#if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, SpanGroup * /*spanGroup*/ -#endif ); /* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */ extern void miFreeSpanGroup( -#if NeedFunctionPrototypes SpanGroup * /*spanGroup*/ -#endif ); extern void miSubtractSpans( -#if NeedFunctionPrototypes SpanGroup * /*spanGroup*/, Spans * /*sub*/ -#endif ); extern void miDisposeSpanGroup( -#if NeedFunctionPrototypes SpanGroup * /*spanGroup*/ -#endif ); extern int miClipSpans( -#if NeedFunctionPrototypes RegionPtr /*prgnDst*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, @@ -119,7 +109,6 @@ DDXPointPtr /*pptNew*/, int * /*pwidthNew*/, int /*fSorted*/ -#endif ); /* Rops which must use span groups */ Index: xc/programs/Xserver/mi/misprite.c diff -u xc/programs/Xserver/mi/misprite.c:3.6 xc/programs/Xserver/mi/misprite.c:3.10 --- xc/programs/Xserver/mi/misprite.c:3.6 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/misprite.c Fri Dec 14 15:00:26 2001 @@ -4,13 +4,17 @@ * machine independent software sprite routines */ -/* $Xorg: misprite.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: misprite.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -26,7 +30,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.6 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/misprite.c,v 3.10 2001/12/14 20:00:26 dawes Exp $ */ # include "X.h" # include "Xproto.h" @@ -55,19 +59,32 @@ static int miSpriteScreenIndex; static unsigned long miSpriteGeneration = 0; -static Bool miSpriteCloseScreen(); -static void miSpriteGetImage(); -static void miSpriteGetSpans(); -static void miSpriteSourceValidate(); -static Bool miSpriteCreateGC(); -static void miSpriteBlockHandler(); -static void miSpriteInstallColormap(); -static void miSpriteStoreColors(); - -static void miSpritePaintWindowBackground(); -static void miSpritePaintWindowBorder(); -static void miSpriteCopyWindow(); -static void miSpriteClearToBackground(); +static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen); +static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, + int w, int h, unsigned int format, + unsigned long planemask, char *pdstLine); +static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax, + DDXPointPtr ppt, int *pwidth, int nspans, + char *pdstStart); +static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, + int width, int height); +static Bool miSpriteCreateGC(GCPtr pGC); +static void miSpriteBlockHandler(int i, pointer blockData, + pointer pTimeout, + pointer pReadMask); +static void miSpriteInstallColormap(ColormapPtr pMap); +static void miSpriteStoreColors(ColormapPtr pMap, int ndef, + xColorItem *pdef); + +static void miSpritePaintWindowBackground(WindowPtr pWin, + RegionPtr pRegion, int what); +static void miSpritePaintWindowBorder(WindowPtr pWin, + RegionPtr pRegion, int what); +static void miSpriteCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, + RegionPtr pRegion); +static void miSpriteClearToBackground(WindowPtr pWin, int x, int y, + int w, int h, + Bool generateExposures); #ifdef RENDER static void miSpriteComposite(CARD8 op, @@ -94,9 +111,11 @@ GlyphPtr *glyphs); #endif -static void miSpriteSaveDoomedAreas(); -static RegionPtr miSpriteRestoreAreas(); -static void miSpriteComputeSaved(); +static void miSpriteSaveDoomedAreas(WindowPtr pWin, + RegionPtr pObscured, int dx, + int dy); +static RegionPtr miSpriteRestoreAreas(WindowPtr pWin, RegionPtr pRgnExposed); +static void miSpriteComputeSaved(ScreenPtr pScreen); #define SCREEN_PROLOGUE(pScreen, field)\ ((pScreen)->field = \ @@ -111,10 +130,14 @@ static int miSpriteGCIndex; -static void miSpriteValidateGC (), miSpriteCopyGC (); -static void miSpriteDestroyGC(), miSpriteChangeGC(); -static void miSpriteChangeClip(), miSpriteDestroyClip(); -static void miSpriteCopyClip(); +static void miSpriteValidateGC(GCPtr pGC, unsigned long stateChanges, + DrawablePtr pDrawable); +static void miSpriteCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); +static void miSpriteDestroyGC(GCPtr pGC); +static void miSpriteChangeGC(GCPtr pGC, unsigned long mask); +static void miSpriteChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); +static void miSpriteDestroyClip(GCPtr pGC); +static void miSpriteCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static GCFuncs miSpriteGCFuncs = { miSpriteValidateGC, @@ -146,19 +169,62 @@ * GC op wrappers */ -static void miSpriteFillSpans(), miSpriteSetSpans(); -static void miSpritePutImage(); -static RegionPtr miSpriteCopyArea(), miSpriteCopyPlane(); -static void miSpritePolyPoint(), miSpritePolylines(); -static void miSpritePolySegment(), miSpritePolyRectangle(); -static void miSpritePolyArc(), miSpriteFillPolygon(); -static void miSpritePolyFillRect(), miSpritePolyFillArc(); -static int miSpritePolyText8(), miSpritePolyText16(); -static void miSpriteImageText8(), miSpriteImageText16(); -static void miSpriteImageGlyphBlt(), miSpritePolyGlyphBlt(); -static void miSpritePushPixels(); +static void miSpriteFillSpans(DrawablePtr pDrawable, GCPtr pGC, + int nInit, DDXPointPtr pptInit, + int *pwidthInit, int fSorted); +static void miSpriteSetSpans(DrawablePtr pDrawable, GCPtr pGC, + char *psrc, DDXPointPtr ppt, int *pwidth, + int nspans, int fSorted); +static void miSpritePutImage(DrawablePtr pDrawable, GCPtr pGC, + int depth, int x, int y, int w, int h, + int leftPad, int format, char *pBits); +static RegionPtr miSpriteCopyArea(DrawablePtr pSrc, DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, + int h, int dstx, int dsty); +static RegionPtr miSpriteCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, + int h, int dstx, int dsty, + unsigned long plane); +static void miSpritePolyPoint(DrawablePtr pDrawable, GCPtr pGC, + int mode, int npt, xPoint *pptInit); +static void miSpritePolylines(DrawablePtr pDrawable, GCPtr pGC, + int mode, int npt, DDXPointPtr pptInit); +static void miSpritePolySegment(DrawablePtr pDrawable, GCPtr pGC, + int nseg, xSegment *pSegs); +static void miSpritePolyRectangle(DrawablePtr pDrawable, GCPtr pGC, + int nrects, xRectangle *pRects); +static void miSpritePolyArc(DrawablePtr pDrawable, GCPtr pGC, + int narcs, xArc *parcs); +static void miSpriteFillPolygon(DrawablePtr pDrawable, GCPtr pGC, + int shape, int mode, int count, + DDXPointPtr pPts); +static void miSpritePolyFillRect(DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit); +static void miSpritePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, + int narcs, xArc *parcs); +static int miSpritePolyText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars); +static int miSpritePolyText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, + unsigned short *chars); +static void miSpriteImageText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars); +static void miSpriteImageText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, + unsigned short *chars); +static void miSpriteImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase); +static void miSpritePolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase); +static void miSpritePushPixels(GCPtr pGC, PixmapPtr pBitMap, + DrawablePtr pDst, int w, int h, + int x, int y); #ifdef NEED_LINEHELPER -static void miSpriteLineHelper(); +static void miSpriteLineHelper(void); #endif static GCOps miSpriteGCOps = { @@ -225,8 +291,11 @@ * pointer-sprite method table */ -static Bool miSpriteRealizeCursor (), miSpriteUnrealizeCursor (); -static void miSpriteSetCursor (), miSpriteMoveCursor (); +static Bool miSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +static Bool miSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +static void miSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCursor, + int x, int y); +static void miSpriteMoveCursor(ScreenPtr pScreen, int x, int y); miPointerSpriteFuncRec miSpritePointerFuncs = { miSpriteRealizeCursor, @@ -239,7 +308,8 @@ * other misc functions */ -static void miSpriteRemoveCursor (), miSpriteRestoreCursor(); +static void miSpriteRemoveCursor(ScreenPtr pScreen); +static void miSpriteRestoreCursor(ScreenPtr pScreen); /* * miSpriteInitialize -- called from device-dependent screen @@ -524,7 +594,7 @@ miSpriteBlockHandler (i, blockData, pTimeout, pReadmask) int i; pointer blockData; - OSTimePtr pTimeout; + pointer pTimeout; pointer pReadmask; { ScreenPtr pScreen = screenInfo.screens[i]; @@ -594,7 +664,7 @@ { /* Direct color - match on any of the subfields */ -#define MaskMatch(a,b,mask) ((a) & (pVisual->mask) == (b) & (pVisual->mask)) +#define MaskMatch(a,b,mask) (((a) & (pVisual->mask)) == ((b) & (pVisual->mask))) #define UpdateDAC(plane,dac,mask) {\ if (MaskMatch (pPriv->colors[plane].pixel,pdef[i].pixel,mask)) {\ @@ -643,8 +713,7 @@ } static void -miSpriteFindColors (pScreen) - ScreenPtr pScreen; +miSpriteFindColors (ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; @@ -849,8 +918,8 @@ static void miSpriteClearToBackground (pWin, x, y, w, h, generateExposures) WindowPtr pWin; - short x,y; - unsigned short w,h; + int x,y; + int w,h; Bool generateExposures; { ScreenPtr pScreen; @@ -887,7 +956,7 @@ static void miSpriteValidateGC (pGC, changes, pDrawable) GCPtr pGC; - Mask changes; + unsigned long changes; DrawablePtr pDrawable; { GC_FUNC_PROLOGUE (pGC); @@ -1568,15 +1637,16 @@ */ static Bool -miSpriteTextOverlap (pDraw, font, x, y, n, charinfo, imageblt, w, cursorBox) - DrawablePtr pDraw; - FontPtr font; - int x, y; - unsigned int n; - CharInfoPtr *charinfo; - Bool imageblt; - unsigned int w; - BoxPtr cursorBox; +miSpriteTextOverlap ( + DrawablePtr pDraw, + FontPtr font, + int x, + int y, + unsigned int n, + CharInfoPtr *charinfo, + Bool imageblt, + unsigned int w, + BoxPtr cursorBox) { ExtentInfoRec extents; @@ -1650,23 +1720,22 @@ #define TT_IMAGE16 3 static int -miSpriteText (pDraw, pGC, x, y, count, chars, fontEncoding, textType, cursorBox) - DrawablePtr pDraw; - GCPtr pGC; +miSpriteText ( + DrawablePtr pDraw, + GCPtr pGC, int x, - y; - unsigned long count; - char *chars; - FontEncoding fontEncoding; - Bool textType; - BoxPtr cursorBox; + int y, + unsigned long count, + char *chars, + FontEncoding fontEncoding, + Bool textType, + BoxPtr cursorBox) { CharInfoPtr *charinfo; register CharInfoPtr *info; unsigned long i; unsigned int n; int w; - void (*drawFunc)(); Bool imageblt; @@ -1697,27 +1766,33 @@ switch (textType) { case TT_POLY8: - drawFunc = (void (*)())pGC->ops->PolyText8; + (*pGC->ops->PolyText8)(pDraw, pGC, x, y, (int)count, chars); break; case TT_IMAGE8: - drawFunc = pGC->ops->ImageText8; + (*pGC->ops->ImageText8)(pDraw, pGC, x, y, (int)count, chars); break; case TT_POLY16: - drawFunc = (void (*)())pGC->ops->PolyText16; + (*pGC->ops->PolyText16)(pDraw, pGC, x, y, (int)count, + (unsigned short *)chars); break; case TT_IMAGE16: - drawFunc = pGC->ops->ImageText16; + (*pGC->ops->ImageText16)(pDraw, pGC, x, y, (int)count, + (unsigned short *)chars); break; } - (*drawFunc) (pDraw, pGC, x, y, (int) count, chars); #else /* don't AVOID_GLYPHBLT */ /* * On the other hand, if the device does use GlyphBlt ultimately to do text, we * don't want to slow it down by invoking the text functions and having them call * GetGlyphs all over again, so we go directly to the GlyphBlt functions here. */ - drawFunc = imageblt ? pGC->ops->ImageGlyphBlt : pGC->ops->PolyGlyphBlt; - (*drawFunc) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); + if (imageblt) { + (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, + FONTGLYPHS(pGC->font)); + } else { + (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, n, charinfo, + FONTGLYPHS(pGC->font)); + } #endif /* AVOID_GLYPHBLT */ } DEALLOCATE_LOCAL(charinfo); Index: xc/programs/Xserver/mi/misprite.h diff -u xc/programs/Xserver/mi/misprite.h:1.1.1.3 xc/programs/Xserver/mi/misprite.h:1.3 --- xc/programs/Xserver/mi/misprite.h:1.1.1.3 Tue Jan 16 17:44:48 2001 +++ xc/programs/Xserver/mi/misprite.h Fri Dec 14 15:00:27 2001 @@ -6,13 +6,17 @@ * mi versions of these routines exist. */ -/* $Xorg: misprite.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: misprite.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -28,50 +32,40 @@ 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.h,v 1.3 2001/12/14 20:00:27 dawes Exp $ */ typedef struct { Bool (*RealizeCursor)( -#if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ -#endif ); Bool (*UnrealizeCursor)( -#if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ -#endif ); Bool (*PutUpCursor)( -#if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, int /*x*/, int /*y*/, unsigned long /*source*/, unsigned long /*mask*/ -#endif ); Bool (*SaveUnderCursor)( -#if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ -#endif ); Bool (*RestoreUnderCursor)( -#if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ -#endif ); Bool (*MoveCursor)( -#if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, int /*x*/, @@ -82,10 +76,8 @@ int /*dy*/, unsigned long /*source*/, unsigned long /*mask*/ -#endif ); Bool (*ChangeSave)( -#if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, @@ -93,15 +85,12 @@ int /*h*/, int /*dx*/, int /*dy*/ -#endif ); } miSpriteCursorFuncRec, *miSpriteCursorFuncPtr; extern Bool miSpriteInitialize( -#if NeedFunctionPrototypes ScreenPtr /*pScreen*/, miSpriteCursorFuncPtr /*cursorFuncs*/, miPointerScreenFuncPtr /*screenFuncs*/ -#endif ); Index: xc/programs/Xserver/mi/mispritest.h diff -u xc/programs/Xserver/mi/mispritest.h:1.4 xc/programs/Xserver/mi/mispritest.h:1.5 --- xc/programs/Xserver/mi/mispritest.h:1.4 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/mispritest.h Fri Dec 14 15:00:27 2001 @@ -4,13 +4,17 @@ * mi sprite structures */ -/* $Xorg: mispritest.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: mispritest.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -26,7 +30,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.4 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mispritest.h,v 1.5 2001/12/14 20:00:27 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.3 xc/programs/Xserver/mi/mistruct.h:1.2 --- xc/programs/Xserver/mi/mistruct.h:1.1.1.3 Tue Jan 16 17:44:48 2001 +++ xc/programs/Xserver/mi/mistruct.h Fri Dec 14 15:00:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mistruct.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: mistruct.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/mi/mivalidate.h diff -u xc/programs/Xserver/mi/mivalidate.h:1.1.1.3 xc/programs/Xserver/mi/mivalidate.h:1.2 --- xc/programs/Xserver/mi/mivalidate.h:1.1.1.3 Tue Jan 16 17:44:48 2001 +++ xc/programs/Xserver/mi/mivalidate.h Fri Dec 14 15:00:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mivalidate.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: mivalidate.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/mi/mivaltree.c diff -u xc/programs/Xserver/mi/mivaltree.c:1.7 xc/programs/Xserver/mi/mivaltree.c:1.9 --- xc/programs/Xserver/mi/mivaltree.c:1.7 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/mivaltree.c Fri Dec 14 15:00:27 2001 @@ -1,4 +1,4 @@ -/* $Xorg: mivaltree.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: mivaltree.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /* * mivaltree.c -- * Functions for recalculating window clip lists. Main function @@ -7,7 +7,11 @@ Copyright 1987, 1988, 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -69,7 +73,7 @@ * * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/mi/mivaltree.c,v 1.7 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mivaltree.c,v 1.9 2001/12/14 20:00:27 dawes Exp $ */ /* * Aug '86: Susan Angebranndt -- original code @@ -177,12 +181,12 @@ *----------------------------------------------------------------------- */ static void -miComputeClips (pParent, pScreen, universe, kind, exposed) - register WindowPtr pParent; - register ScreenPtr pScreen; - register RegionPtr universe; - VTKind kind; - RegionPtr exposed; /* for intermediate calculations */ +miComputeClips ( + register WindowPtr pParent, + register ScreenPtr pScreen, + register RegionPtr universe, + VTKind kind, + RegionPtr exposed ) /* for intermediate calculations */ { int dx, dy; @@ -500,8 +504,8 @@ } static void -miTreeObscured(pParent) - register WindowPtr pParent; +miTreeObscured( + register WindowPtr pParent ) { register WindowPtr pChild; register int oldVis; Index: xc/programs/Xserver/mi/miwideline.c diff -u xc/programs/Xserver/mi/miwideline.c:1.8 xc/programs/Xserver/mi/miwideline.c:1.12 --- xc/programs/Xserver/mi/miwideline.c:1.8 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/miwideline.c Fri Dec 14 15:00:28 2001 @@ -1,9 +1,13 @@ -/* $Xorg: miwideline.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: miwideline.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miwideline.c,v 1.8 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miwideline.c,v 1.12 2001/12/14 20:00:28 dawes Exp $ */ /* Author: Keith Packard, MIT X Consortium */ @@ -50,8 +54,13 @@ ICEILTEMPDECL #endif -static void miLineArc(); +static void miLineArc(DrawablePtr pDraw, register GCPtr pGC, + unsigned long pixel, SpanDataPtr spanData, + register LineFacePtr leftFace, + register LineFacePtr rightFace, + double xorg, double yorg, Bool isInt); + /* * spans-based polygon filler */ @@ -82,9 +91,9 @@ int left_height = 0, right_height = 0; register DDXPointPtr ppt; - DDXPointPtr pptInit; + DDXPointPtr pptInit = NULL; register int *pwidth; - int *pwidthInit; + int *pwidthInit = NULL; XID oldPixel; int xorg; Spans spanRec; @@ -181,12 +190,15 @@ } static void -miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, w, h) - DrawablePtr pDrawable; - GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - int x, y, w, h; +miFillRectPolyHelper ( + DrawablePtr pDrawable, + GCPtr pGC, + unsigned long pixel, + SpanDataPtr spanData, + int x, + int y, + int w, + int h) { register DDXPointPtr ppt; register int *pwidth; @@ -415,12 +427,13 @@ } static void -miLineOnePoint (pDrawable, pGC, pixel, spanData, x, y) - DrawablePtr pDrawable; - GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - int x, y; +miLineOnePoint ( + DrawablePtr pDrawable, + GCPtr pGC, + unsigned long pixel, + SpanDataPtr spanData, + int x, + int y) { DDXPointRec pt; int wid; @@ -449,14 +462,15 @@ } static void -miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight) - DrawablePtr pDrawable; - GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - register LineFacePtr pLeft, pRight; +miLineJoin ( + DrawablePtr pDrawable, + GCPtr pGC, + unsigned long pixel, + SpanDataPtr spanData, + register LineFacePtr pLeft, + register LineFacePtr pRight) { - double mx, my; + double mx = 0, my = 0; double denom = 0.0; PolyVertexRec vertices[4]; PolySlopeRec slopes[4]; @@ -469,8 +483,10 @@ int lw = pGC->lineWidth; if (lw == 1 && !spanData) { - /* Lines going in the same direction have no join */ - if (pLeft->dx >= 0 == pRight->dx <= 0) + /* See if one of the lines will draw the joining pixel */ + if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0)) + return; + if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0)) return; if (joinStyle != JoinRound) { denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy; @@ -596,12 +612,13 @@ } static int -miLineArcI (pDraw, pGC, xorg, yorg, points, widths) - DrawablePtr pDraw; - GCPtr pGC; - int xorg, yorg; - DDXPointPtr points; - int *widths; +miLineArcI ( + DrawablePtr pDraw, + GCPtr pGC, + int xorg, + int yorg, + DDXPointPtr points, + int *widths) { register DDXPointPtr tpts, bpts; register int *twids, *bwids; @@ -682,16 +699,19 @@ } static int -miLineArcD (pDraw, pGC, xorg, yorg, points, widths, - edge1, edgey1, edgeleft1, edge2, edgey2, edgeleft2) - DrawablePtr pDraw; - GCPtr pGC; - double xorg, yorg; - DDXPointPtr points; - int *widths; - PolyEdgePtr edge1, edge2; - int edgey1, edgey2; - Bool edgeleft1, edgeleft2; +miLineArcD ( + DrawablePtr pDraw, + GCPtr pGC, + double xorg, + double yorg, + DDXPointPtr points, + int *widths, + PolyEdgePtr edge1, + int edgey1, + Bool edgeleft1, + PolyEdgePtr edge2, + int edgey2, + Bool edgeleft2) { register DDXPointPtr pts; register int *wids; @@ -870,7 +890,7 @@ ya = 0.0; xa = 0.0; } - if (dy < 0 || dy == 0 && dx > 0) + if (dy < 0 || (dy == 0 && dx > 0)) { dx = -dx; dy = -dy; @@ -943,7 +963,7 @@ if (!isInt) k = face->k; left = 1; - if (dy < 0 || dy == 0 && dx > 0) + if (dy < 0 || (dy == 0 && dx > 0)) { dx = -dx; dy = -dy; @@ -974,14 +994,16 @@ } static void -miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt) - DrawablePtr pDraw; - register GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - register LineFacePtr leftFace, rightFace; - double xorg, yorg; - Bool isInt; +miLineArc ( + DrawablePtr pDraw, + register GCPtr pGC, + unsigned long pixel, + SpanDataPtr spanData, + register LineFacePtr leftFace, + register LineFacePtr rightFace, + double xorg, + double yorg, + Bool isInt) { DDXPointPtr points; int *widths; @@ -1007,8 +1029,8 @@ edgeleft1 = FALSE; edgeleft2 = FALSE; if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) && - (pGC->capStyle == CapRound && pGC->joinStyle != JoinRound || - pGC->joinStyle == JoinRound && pGC->capStyle == CapButt)) + ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) || + (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) { if (isInt) { @@ -1254,15 +1276,19 @@ } static void -miWideSegment (pDrawable, pGC, pixel, spanData, - x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace) - DrawablePtr pDrawable; - GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - register int x1, y1, x2, y2; - Bool projectLeft, projectRight; - register LineFacePtr leftFace, rightFace; +miWideSegment ( + DrawablePtr pDrawable, + GCPtr pGC, + unsigned long pixel, + SpanDataPtr spanData, + register int x1, + register int y1, + register int x2, + register int y2, + Bool projectLeft, + Bool projectRight, + register LineFacePtr leftFace, + register LineFacePtr rightFace) { double l, L, r; double xa, ya; @@ -1281,7 +1307,7 @@ int lw = pGC->lineWidth; /* draw top-to-bottom always */ - if (y2 < y1 || y2 == y1 && x2 < x1) + if (y2 < y1 || (y2 == y1 && x2 < x1)) { x = x1; x1 = x2; @@ -1477,7 +1503,7 @@ SpanDataPtr spanData; int npt; { - if (npt < 3 && pGC->capStyle != CapRound || miSpansEasyRop(pGC->alu)) + if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu)) return (SpanDataPtr) NULL; if (pGC->lineStyle == LineDoubleDash) miInitSpanGroup (&spanData->bgGroup); @@ -1656,15 +1682,20 @@ #define V_LEFT 3 static void -miWideDashSegment (pDrawable, pGC, spanData, pDashOffset, pDashIndex, - x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace) - DrawablePtr pDrawable; - register GCPtr pGC; - int *pDashOffset, *pDashIndex; - SpanDataPtr spanData; - int x1, y1, x2, y2; - Bool projectLeft, projectRight; - LineFacePtr leftFace, rightFace; +miWideDashSegment ( + DrawablePtr pDrawable, + register GCPtr pGC, + SpanDataPtr spanData, + int *pDashOffset, + int *pDashIndex, + int x1, + int y1, + int x2, + int y2, + Bool projectLeft, + Bool projectRight, + LineFacePtr leftFace, + LineFacePtr rightFace) { int dashIndex, dashRemain; unsigned char *pDash; Index: xc/programs/Xserver/mi/miwideline.h diff -u xc/programs/Xserver/mi/miwideline.h:1.9 xc/programs/Xserver/mi/miwideline.h:1.12 --- xc/programs/Xserver/mi/miwideline.h:1.9 Thu Apr 5 13:42:35 2001 +++ xc/programs/Xserver/mi/miwideline.h Fri Dec 14 15:00:28 2001 @@ -1,9 +1,13 @@ -/* $Xorg: miwideline.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: miwideline.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,11 +26,12 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.9 2001/04/05 17:42:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.12 2001/12/14 20:00:28 dawes Exp $ */ /* Author: Keith Packard, MIT X Consortium */ #include "mispans.h" +#include "mifpoly.h" /* for ICEIL */ /* * interface data to span-merging polygon filler @@ -150,23 +155,7 @@ } \ } -#ifdef NOINLINEICEIL -#define ICEIL(x) ((int)ceil(x)) -#else -#ifdef __GNUC__ -static __inline int ICEIL(double x) -{ - int _cTmp = x; - return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1; -} -#else -#define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1) -#define ICEILTEMPDECL static int _cTmp; -#endif -#endif - extern void miFillPolyHelper( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, unsigned long /*pixel*/, @@ -177,18 +166,14 @@ PolyEdgePtr /*right*/, int /*left_count*/, int /*right_count*/ -#endif ); extern int miRoundJoinFace( -#if NeedFunctionPrototypes LineFacePtr /*face*/, PolyEdgePtr /*edge*/, Bool * /*leftEdge*/ -#endif ); extern void miRoundJoinClip( -#if NeedFunctionPrototypes LineFacePtr /*pLeft*/, LineFacePtr /*pRight*/, PolyEdgePtr /*edge1*/, @@ -197,20 +182,16 @@ int * /*y2*/, Bool * /*left1*/, Bool * /*left2*/ -#endif ); extern int miRoundCapClip( -#if NeedFunctionPrototypes LineFacePtr /*face*/, Bool /*isInt*/, PolyEdgePtr /*edge*/, Bool * /*leftEdge*/ -#endif ); extern void miLineProjectingCap( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, unsigned long /*pixel*/, @@ -220,23 +201,18 @@ double /*xorg*/, double /*yorg*/, Bool /*isInt*/ -#endif ); extern SpanDataPtr miSetupSpanData( -#if NeedFunctionPrototypes GCPtr /*pGC*/, SpanDataPtr /*spanData*/, int /*npt*/ -#endif ); extern void miCleanupSpanData( -#if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, SpanDataPtr /*spanData*/ -#endif ); extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy, Index: xc/programs/Xserver/mi/miwindow.c diff -u xc/programs/Xserver/mi/miwindow.c:1.4 xc/programs/Xserver/mi/miwindow.c:1.7 --- xc/programs/Xserver/mi/miwindow.c:1.4 Wed Jan 17 17:37:07 2001 +++ xc/programs/Xserver/mi/miwindow.c Fri Dec 14 15:00:28 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.4 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.7 2001/12/14 20:00:28 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: miwindow.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: miwindow.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ #include "X.h" #include "miscstruct.h" #include "region.h" @@ -153,10 +157,10 @@ *----------------------------------------------------------------------- */ static Bool -miCheckSubSaveUnder(pParent, pFirst, pRegion) - register WindowPtr pParent; /* Parent to check */ - WindowPtr pFirst; /* first reconfigured window */ - RegionPtr pRegion; /* Initial area obscured by saveUnder */ +miCheckSubSaveUnder( + register WindowPtr pParent, /* Parent to check */ + WindowPtr pFirst, /* first reconfigured window */ + RegionPtr pRegion) /* Initial area obscured by saveUnder */ { register WindowPtr pChild; /* Current child */ register ScreenPtr pScreen; /* Screen to use */ @@ -359,9 +363,11 @@ register BoxPtr box; register WindowPtr pChild, pLast; Bool anyMarked = FALSE; - void (* MarkWindow)() = pWin->drawable.pScreen->MarkWindow; - ScreenPtr pScreen = pWin->drawable.pScreen; + MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow; + ScreenPtr pScreen; + pScreen = pWin->drawable.pScreen; + /* single layered systems are easy */ if (ppLayerWin) *ppLayerWin = pWin; @@ -443,9 +449,11 @@ { register WindowPtr pChild; register ValidatePtr val; - ScreenPtr pScreen = pWin->drawable.pScreen; - void (* WindowExposures)(); + ScreenPtr pScreen; + WindowExposuresProcPtr WindowExposures; + pScreen = pWin->drawable.pScreen; + pChild = pWin; WindowExposures = pChild->drawable.pScreen->WindowExposures; while (1) @@ -485,9 +493,9 @@ WindowPtr pParent; Bool WasViewable = (Bool)(pWin->viewable); short bw; - RegionPtr oldRegion; + RegionPtr oldRegion = NULL; DDXPointRec oldpt; - Bool anyMarked; + Bool anyMarked = FALSE; register ScreenPtr pScreen; WindowPtr windowToValidate; #ifdef DO_SAVE_UNDERS @@ -565,9 +573,9 @@ */ static int -miRecomputeExposures (pWin, value) - register WindowPtr pWin; - pointer value; /* must conform to VisitWindowProcPtr */ +miRecomputeExposures ( + register WindowPtr pWin, + pointer value) /* must conform to VisitWindowProcPtr */ { register ScreenPtr pScreen; RegionPtr pValid = (RegionPtr)value; @@ -608,8 +616,8 @@ int bw = wBorderWidth (pWin); short dw, dh; DDXPointRec oldpt; - RegionPtr oldRegion; - Bool anyMarked; + RegionPtr oldRegion = NULL; + Bool anyMarked = FALSE; register ScreenPtr pScreen; WindowPtr pFirstChange; register WindowPtr pChild; @@ -617,9 +625,9 @@ register unsigned g; int nx, ny; /* destination x,y */ int newx, newy; /* new inner window position */ - RegionPtr pRegion; + RegionPtr pRegion = NULL; RegionPtr destClip; /* portions of destination already written */ - RegionPtr oldWinClip; /* old clip list for window */ + RegionPtr oldWinClip = NULL; /* old clip list for window */ RegionPtr borderVisible = NullRegion; /* visible area of the border */ RegionPtr bsExposed = NullRegion; /* backing store exposures */ Bool shrunk = FALSE; /* shrunk in an inner dimension */ @@ -969,9 +977,8 @@ { Bool WasViewable = (Bool)(pWin->viewable); register ScreenPtr pScreen = pWin->drawable.pScreen; - Bool anyMarked; - WindowPtr pParent = pWin->parent; - RegionPtr pOldClip, bsExposed; + Bool anyMarked = FALSE; + RegionPtr pOldClip = NULL, bsExposed; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif @@ -1071,7 +1078,7 @@ { WindowPtr pParent; int oldwidth; - Bool anyMarked; + Bool anyMarked = FALSE; register ScreenPtr pScreen; Bool WasViewable = (Bool)(pWin->viewable); Bool HadBorder; @@ -1153,8 +1160,10 @@ void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth) { - ScreenPtr pScreen = pWin->drawable.pScreen; + ScreenPtr pScreen; WindowPtr pChild; + + pScreen = pWin->drawable.pScreen; for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { Index: xc/programs/Xserver/mi/mizerarc.c diff -u xc/programs/Xserver/mi/mizerarc.c:1.4 xc/programs/Xserver/mi/mizerarc.c:1.6 --- xc/programs/Xserver/mi/mizerarc.c:1.4 Wed Jan 17 17:37:08 2001 +++ xc/programs/Xserver/mi/mizerarc.c Fri Dec 14 15:00:28 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mizerarc.c,v 1.4 2001/01/17 22:37:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mizerarc.c,v 1.6 2001/12/14 20:00:28 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ ********************************************************/ -/* $Xorg: mizerarc.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: mizerarc.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" @@ -499,12 +503,14 @@ } static void -miZeroArcDashPts(pGC, arc, dinfo, points, maxPts, evenPts, oddPts) - GCPtr pGC; - xArc *arc; - DashInfo *dinfo; - int maxPts; - register DDXPointPtr points, *evenPts, *oddPts; +miZeroArcDashPts( + GCPtr pGC, + xArc *arc, + DashInfo *dinfo, + register DDXPointPtr points, + int maxPts, + register DDXPointPtr *evenPts, + register DDXPointPtr *oddPts ) { miZeroArcRec info; register int x, y, a, b, d, mask; @@ -707,14 +713,14 @@ xArc *parcs; { int maxPts = 0; - register int n, maxw; + register int n, maxw = 0; register xArc *arc; register int i; DDXPointPtr points, pts, oddPts; register DDXPointPtr pt; int numPts; Bool dospans; - int *widths; + int *widths = NULL; XID fgPixel = pGC->fgPixel; DashInfo dinfo; Index: xc/programs/Xserver/mi/mizerarc.h diff -u xc/programs/Xserver/mi/mizerarc.h:1.1.1.3 xc/programs/Xserver/mi/mizerarc.h:1.3 --- xc/programs/Xserver/mi/mizerarc.h:1.1.1.3 Tue Jan 16 17:44:52 2001 +++ xc/programs/Xserver/mi/mizerarc.h Fri Dec 14 15:00:28 2001 @@ -1,8 +1,13 @@ +/* $XFree86: xc/programs/Xserver/mi/mizerarc.h,v 1.3 2001/12/14 20:00:28 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -20,7 +25,7 @@ ********************************************************/ -/* $Xorg: mizerarc.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ +/* $Xorg: mizerarc.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ typedef struct { int x; @@ -117,17 +122,13 @@ /* mizerarc.c */ extern Bool miZeroArcSetup( -#if NeedFunctionPrototypes xArc * /*arc*/, miZeroArcRec * /*info*/, Bool /*ok360*/ -#endif ); extern DDXPointPtr miZeroArcPts( -#if NeedFunctionPrototypes xArc * /*arc*/, DDXPointPtr /*pts*/ -#endif ); Index: xc/programs/Xserver/mi/mizerclip.c diff -u xc/programs/Xserver/mi/mizerclip.c:1.1 xc/programs/Xserver/mi/mizerclip.c:1.3 --- xc/programs/Xserver/mi/mizerclip.c:1.1 Wed Oct 13 18:33:13 1999 +++ xc/programs/Xserver/mi/mizerclip.c Fri Dec 14 15:00:29 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mizerclip.c,v 1.1 1999/10/13 22:33:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mizerclip.c,v 1.3 2001/12/14 20:00:29 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -412,13 +416,13 @@ { int swapped = 0; int clipDone = 0; - CARD32 utmp; + CARD32 utmp = 0; int clip1, clip2; int x1, y1, x2, y2; int x1_orig, y1_orig, x2_orig, y2_orig; int xmajor; - int negslope, anchorval; - unsigned int eqn; + int negslope = 0, anchorval = 0; + unsigned int eqn = 0; x1 = x1_orig = *new_x1; y1 = y1_orig = *new_y1; Index: xc/programs/Xserver/mi/mizerline.c diff -u xc/programs/Xserver/mi/mizerline.c:3.5 xc/programs/Xserver/mi/mizerline.c:3.7 --- xc/programs/Xserver/mi/mizerline.c:3.5 Wed Jan 17 17:37:08 2001 +++ xc/programs/Xserver/mi/mizerline.c Fri Dec 14 15:00:29 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/mi/mizerline.c,v 3.5 2001/01/17 22:37:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mizerline.c,v 3.7 2001/12/14 20:00:29 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: mizerline.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ +/* $Xorg: mizerline.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ #include "X.h" #include "misc.h" @@ -99,13 +103,13 @@ int npt; /* number of points */ DDXPointPtr pptInit; { - int Nspans, current_y; + int Nspans, current_y = 0; DDXPointPtr ppt; DDXPointPtr pspanInit, spans; int *pwidthInit, *widths, list_len; int xleft, ytop, xright, ybottom; int new_x1, new_y1, new_x2, new_y2; - int x, y, x1, y1, x2, y2, xstart, ystart; + int x = 0, y = 0, x1, y1, x2, y2, xstart, ystart; int oc1, oc2; int result; int pt1_clipped, pt2_clipped = 0; Index: xc/programs/Xserver/miext/layer/Imakefile diff -u /dev/null xc/programs/Xserver/miext/layer/Imakefile:1.1 --- /dev/null Fri Jan 18 15:26:50 2002 +++ xc/programs/Xserver/miext/layer/Imakefile Tue May 29 00:54:13 2001 @@ -0,0 +1,44 @@ +XCOMM $XFree86: xc/programs/Xserver/miext/layer/Imakefile,v 1.1 2001/05/29 04:54:13 keithp Exp $ +XCOMM +XCOMM + +#define IHaveModules +#include <Server.tmpl> + +#ifdef XFree86Version +#if DoLoadableServer +XFMODSRC = shmodule.c +XFMODOBJ = shmodule.o +#endif +#endif + +SRCS = layergc.c \ + layerinit.c \ + layerpict.c \ + layerwin.c + +OBJS = layergc.o \ + layerinit.o \ + layerpict.o \ + layerwin.o + + INCLUDES = -I. -I../shadow -I../../mi -I../../fb -I../../include -I$(XINCLUDESRC) \ + -I$(FONTINCSRC) -I$(XF86SRC)/common $(EXTRAINCLUDES) \ + -I../../render -I$(EXTINCSRC) + LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ + ../../mi/llib-lmi.ln + +NormalLibraryObjectRule() +LibraryModuleTarget(layer,$(OBJS)) +LintLibraryTarget(layer,$(SRCS)) + +NormalLintTarget($(SRCS)) + +InstallLibraryModule(layer,$(MODULEDIR),.) + +#ifndef OS2Architecture +DependTarget() +#endif + +InstallDriverSDKLibraryModule(layer,$(DRIVERSDKMODULEDIR),.) +InstallDriverSDKNonExecFile(layer.h,$(DRIVERSDKINCLUDEDIR)) Index: xc/programs/Xserver/miext/layer/layer.h diff -u /dev/null xc/programs/Xserver/miext/layer/layer.h:1.4 --- /dev/null Fri Jan 18 15:26:50 2002 +++ xc/programs/Xserver/miext/layer/layer.h Tue Jul 31 20:44:58 2001 @@ -0,0 +1,145 @@ +/* + * $XFree86: xc/programs/Xserver/miext/layer/layer.h,v 1.4 2001/08/01 00:44:58 tsi Exp $ + * + * Copyright © 2001 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. + */ + +#ifndef _LAYER_H_ +#define _LAYER_H_ + +#include <shadow.h> + +#define LAYER_FB 0 +#define LAYER_SHADOW 1 + +typedef struct _LayerKind *LayerKindPtr; +typedef struct _LayerWin *LayerWinPtr; +typedef struct _LayerList *LayerListPtr; +typedef struct _LayerGC *LayerGCPtr; +typedef struct _Layer *LayerPtr; +typedef struct _LayerScreen *LayerScreenPtr; + +/* + * We'll try to work without a list of windows in each layer + * for now, this will make computing bounding boxes for each + * layer rather expensive, so that may need to change at some point. + */ + +#define LAYER_SCREEN_PIXMAP ((PixmapPtr) 1) + +typedef struct _Layer { + LayerPtr pNext; /* a list of all layers for this screen */ + LayerKindPtr pKind; /* characteristics of this layer */ + int refcnt; /* reference count, layer is freed when zero */ + int windows; /* number of windows, free pixmap when zero */ + int depth; /* window depth in this layer */ + PixmapPtr pPixmap; /* pixmap for this layer (may be frame buffer) */ + Bool freePixmap; /* whether to free this pixmap when done */ + RegionRec region; /* valid set of pPixmap for drawing */ + ShadowUpdateProc update; /* for shadow layers, update/window/closure values */ + ShadowWindowProc window; + int rotate; + void *closure; +} LayerRec; + +/* + * Call this before wrapping stuff for acceleration, it + * gives layer pointers to the raw frame buffer functions + */ + +Bool +LayerStartInit (ScreenPtr pScreen); + +/* + * Initialize wrappers for each acceleration type and + * call this function, it will move the needed functions + * into a new LayerKind and replace them with the generic + * functions. + */ + +int +LayerNewKind (ScreenPtr pScreen); + +/* + * Finally, call this function and layer + * will wrap the screen functions and prepare for execution + */ + +Bool +LayerFinishInit (ScreenPtr pScreen); + +/* + * At any point after LayerStartInit, a new layer can be created. + */ +LayerPtr +LayerCreate (ScreenPtr pScreen, + int kind, + int depth, + PixmapPtr pPixmap, + ShadowUpdateProc update, + ShadowWindowProc window, + int rotate, + void *closure); + +/* + * Create a layer pixmap + */ +Bool +LayerCreatePixmap (ScreenPtr pScreen, LayerPtr pLayer); + +/* + * Change a layer pixmap + */ +void +LayerSetPixmap (ScreenPtr pScreen, LayerPtr pLayer, PixmapPtr pPixmap); + +/* + * Destroy a layer pixmap + */ +void +LayerDestroyPixmap (ScreenPtr pScreen, LayerPtr pLayer); + +/* + * Change a layer kind + */ +void +LayerSetKind (ScreenPtr pScreen, LayerPtr pLayer, int kind); + +/* + * Destroy a layer. The layer must not contain any windows. + */ +void +LayerDestroy (ScreenPtr pScreen, LayerPtr layer); + +/* + * Add a window to a layer + */ +Bool +LayerWindowAdd (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin); + +/* + * Remove a window from a layer + */ + +void +LayerWindowRemove (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin); + +#endif /* _LAYER_H_ */ Index: xc/programs/Xserver/miext/layer/layergc.c diff -u /dev/null xc/programs/Xserver/miext/layer/layergc.c:1.5 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/layer/layergc.c Sat Oct 27 23:34:15 2001 @@ -0,0 +1,190 @@ +/* + * $XFree86: xc/programs/Xserver/miext/layer/layergc.c,v 1.5 2001/10/28 03:34:15 tsi Exp $ + * + * Copyright © 2001 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 "layerstr.h" + +GCFuncs layerGCFuncs = { + layerValidateGC, layerChangeGC, layerCopyGC, layerDestroyGC, + layerChangeClip, layerDestroyClip, layerCopyClip +}; + +#if 0 +/* + * XXX dont need this until this supports + * separate clipping and multiple layers + */ +GCOps layerGCOps = { + layerFillSpans, layerSetSpans, + layerPutImage, layerCopyArea, + layerCopyPlane, layerPolyPoint, + layerPolylines, layerPolySegment, + layerPolyRectangle, layerPolyArc, + layerFillPolygon, layerPolyFillRect, + layerPolyFillArc, layerPolyText8, + layerPolyText16, layerImageText8, + layerImageText16, layerImageGlyphBlt, + layerPolyGlyphBlt, layerPushPixels, +#ifdef NEED_LINEHELPER + NULL, +#endif + {NULL} /* devPrivate */ +}; +#endif + +Bool +layerCreateGC (GCPtr pGC) +{ + Bool ret = TRUE; + LayerKindPtr pLayKind; + ScreenPtr pScreen = pGC->pScreen; + layerScrPriv(pScreen); + layerGCPriv(pGC); + + /* + * XXX assume the first layer can handle all GCs + */ + pLayKind = &pLayScr->kinds[0]; + if (pLayScr->pLayers) + pLayKind = pLayScr->pLayers->pKind; + pLayGC->pKind = pLayKind; + LayerUnwrap (pScreen,pLayGC->pKind,CreateGC); + + if (!(*pScreen->CreateGC) (pGC)) + ret = FALSE; + LayerWrap (pScreen,pLayKind,CreateGC,layerCreateGC); + + LayerWrap (pGC,pLayGC,funcs,&layerGCFuncs); + + return ret; +} + +void +layerValidateGC(GCPtr pGC, + unsigned long changes, + DrawablePtr pDraw) +{ + layerGCPriv(pGC); + LayerKindPtr pKind; + + if (pDraw->type == DRAWABLE_WINDOW) + { + layerWinPriv ((WindowPtr) pDraw); + pKind = layerWinLayer (pLayWin)->pKind; + } + else + { + /* XXX assume the first layer can handle all pixmaps */ + layerScrPriv (pDraw->pScreen); + pKind = &pLayScr->kinds[0]; + if (pLayScr->pLayers) + pKind = pLayScr->pLayers->pKind; + } + + LayerUnwrap (pGC,pLayGC,funcs); + if (pKind != pLayGC->pKind) + { + /* + * Clean up the previous user + */ + CreateGCProcPtr CreateGC; + (*pGC->funcs->DestroyGC) (pGC); + + pGC->serialNumber = GC_CHANGE_SERIAL_BIT; + + pLayGC->pKind = pKind; + + /* + * Temporarily unwrap Create GC and let + * the new code setup the GC + */ + CreateGC = pGC->pScreen->CreateGC; + LayerUnwrap (pGC->pScreen, pLayGC->pKind, CreateGC); + (*pGC->pScreen->CreateGC) (pGC); + LayerWrap (pGC->pScreen, pLayGC->pKind, CreateGC, CreateGC); + } + + (*pGC->funcs->ValidateGC) (pGC, changes, pDraw); + LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); +} + +void +layerDestroyGC(GCPtr pGC) +{ + layerGCPriv(pGC); + LayerUnwrap (pGC,pLayGC,funcs); + (*pGC->funcs->DestroyGC)(pGC); + LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); +} + +void +layerChangeGC (GCPtr pGC, + unsigned long mask) +{ + layerGCPriv(pGC); + LayerUnwrap (pGC,pLayGC,funcs); + (*pGC->funcs->ChangeGC) (pGC, mask); + LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); +} + +void +layerCopyGC (GCPtr pGCSrc, + unsigned long mask, + GCPtr pGCDst) +{ + layerGCPriv(pGCDst); + LayerUnwrap (pGCDst,pLayGC,funcs); + (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); + LayerWrap(pGCDst,pLayGC,funcs,&layerGCFuncs); +} + +void +layerChangeClip (GCPtr pGC, + int type, + pointer pvalue, + int nrects) +{ + layerGCPriv(pGC); + LayerUnwrap (pGC,pLayGC,funcs); + (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); + LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); +} + +void +layerCopyClip(GCPtr pGCDst, GCPtr pGCSrc) +{ + layerGCPriv(pGCDst); + LayerUnwrap (pGCDst,pLayGC,funcs); + (*pGCDst->funcs->CopyClip) (pGCDst, pGCSrc); + LayerWrap(pGCDst,pLayGC,funcs,&layerGCFuncs); +} + +void +layerDestroyClip(GCPtr pGC) +{ + layerGCPriv(pGC); + LayerUnwrap (pGC,pLayGC,funcs); + (*pGC->funcs->DestroyClip) (pGC); + LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); +} + Index: xc/programs/Xserver/miext/layer/layerinit.c diff -u /dev/null xc/programs/Xserver/miext/layer/layerinit.c:1.4 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/layer/layerinit.c Sat Oct 27 23:34:16 2001 @@ -0,0 +1,350 @@ +/* + * $XFree86: xc/programs/Xserver/miext/layer/layerinit.c,v 1.4 2001/10/28 03:34:16 tsi Exp $ + * + * Copyright © 2001 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 "layerstr.h" + +int layerScrPrivateIndex; +int layerGCPrivateIndex; +int layerWinPrivateIndex; +int layerGeneration; + +/* + * Call this before wrapping stuff for acceleration, it + * gives layer pointers to the raw frame buffer functions + */ + +extern const GCFuncs fbGCFuncs; +extern GCFuncs shadowGCFuncs; + +Bool +LayerStartInit (ScreenPtr pScreen) +{ + LayerScreenPtr pScrPriv; + + if (layerGeneration != serverGeneration) + { + layerScrPrivateIndex = AllocateScreenPrivateIndex (); + if (layerScrPrivateIndex == -1) + return FALSE; + layerGCPrivateIndex = AllocateGCPrivateIndex (); + if (layerGCPrivateIndex == -1) + return FALSE; + layerWinPrivateIndex = AllocateWindowPrivateIndex (); + if (layerWinPrivateIndex == -1) + return FALSE; + layerGeneration = serverGeneration; + } + if (!AllocateGCPrivate (pScreen, layerGCPrivateIndex, sizeof (LayerGCRec))) + return FALSE; + if (!AllocateWindowPrivate (pScreen, layerWinPrivateIndex, sizeof (LayerWinRec))) + return FALSE; + pScrPriv = (LayerScreenPtr) xalloc (sizeof (LayerScreenRec)); + if (!pScrPriv) + return FALSE; + pScrPriv->nkinds = 0; + pScrPriv->kinds = 0; + pScrPriv->pLayers = 0; + pScreen->devPrivates[layerScrPrivateIndex].ptr = (pointer) pScrPriv; + /* + * Add fb kind -- always 0 + */ + if (LayerNewKind (pScreen) < 0) + { + pScreen->devPrivates[layerScrPrivateIndex].ptr = 0; + xfree (pScrPriv); + return FALSE; + } + /* + * Add shadow kind -- always 1 + */ + if (!shadowSetup (pScreen)) + return FALSE; + if (LayerNewKind (pScreen) < 0) + { + pScreen->devPrivates[layerScrPrivateIndex].ptr = 0; + xfree (pScrPriv->kinds); + xfree (pScrPriv); + return FALSE; + } + return TRUE; +} + +/* + * Initialize wrappers for each acceleration type and + * call this function, it will move the needed functions + * into a new LayerKind and replace them with the generic + * functions. + */ + +int +LayerNewKind (ScreenPtr pScreen) +{ + layerScrPriv(pScreen); + LayerKindPtr pLayKind, pLayKinds; +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreen (pScreen); +#endif + LayerPtr pLayer; + + /* + * Allocate a new kind structure + */ + if (pLayScr->kinds) + pLayKinds = (LayerKindPtr) xrealloc ((pointer) pLayScr->kinds, + (pLayScr->nkinds + 1) * sizeof (LayerKindRec)); + else + pLayKinds = (LayerKindPtr) xalloc (sizeof (LayerKindRec)); + if (!pLayKinds) + return -1; + + /* + * Fix up existing layers to point at the new kind + */ + for (pLayer = pLayScr->pLayers; pLayer; pLayer = pLayer->pNext) + { + int kind = pLayer->pKind - pLayScr->kinds; + + pLayer->pKind = &pLayKinds[kind]; + } + + pLayScr->kinds = pLayKinds; + pLayKind = &pLayScr->kinds[pLayScr->nkinds]; + pLayKind->kind = pLayScr->nkinds; + + /* + * Extract wrapped functions from screen and stick in kind + */ + pLayKind->CloseScreen = pScreen->CloseScreen; + + pLayKind->CreateWindow = pScreen->CreateWindow; + pLayKind->DestroyWindow = pScreen->DestroyWindow; + pLayKind->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; + pLayKind->PaintWindowBackground = pScreen->PaintWindowBackground; + pLayKind->PaintWindowBorder = pScreen->PaintWindowBorder; + pLayKind->CopyWindow = pScreen->CopyWindow; + + pLayKind->CreateGC = pScreen->CreateGC; + +#ifdef RENDER + if (ps) + { + pLayKind->Composite = ps->Composite; + pLayKind->Glyphs = ps->Glyphs; + pLayKind->CompositeRects = ps->CompositeRects; + } +#endif + /* + * If not underlying frame buffer kind, + * replace screen functions with those + */ + if (pLayKind->kind != 0) + { + pScreen->CloseScreen = pLayKinds->CloseScreen; + + pScreen->CreateWindow = pLayKinds->CreateWindow; + pScreen->DestroyWindow = pLayKinds->DestroyWindow; + pScreen->ChangeWindowAttributes = pLayKinds->ChangeWindowAttributes; + pScreen->PaintWindowBackground = pLayKinds->PaintWindowBackground; + pScreen->PaintWindowBorder = pLayKinds->PaintWindowBorder; + pScreen->CopyWindow = pLayKinds->CopyWindow; + + pScreen->CreateGC = pLayKinds->CreateGC; + +#ifdef RENDER + if (ps) + { + ps->Composite = pLayKinds->Composite; + ps->Glyphs = pLayKinds->Glyphs; + ps->CompositeRects = pLayKinds->CompositeRects; + } +#endif + } + + pLayScr->nkinds++; + return pLayKind->kind; +} + +/* + * Finally, call this function and layer + * will wrap the screen functions and prepare for execution + */ + +Bool +LayerFinishInit (ScreenPtr pScreen) +{ +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreen (pScreen); +#endif + + pScreen->CloseScreen = layerCloseScreen; + + pScreen->CreateWindow = layerCreateWindow; + pScreen->DestroyWindow = layerDestroyWindow; + pScreen->ChangeWindowAttributes = layerChangeWindowAttributes; + pScreen->PaintWindowBackground = layerPaintWindowBackground; + pScreen->PaintWindowBorder = layerPaintWindowBorder; + pScreen->CopyWindow = layerCopyWindow; + + pScreen->CreateGC = layerCreateGC; + +#ifdef RENDER + if (ps) + { + ps->Composite = layerComposite; + ps->Glyphs = layerGlyphs; + ps->CompositeRects = layerCompositeRects; + } +#endif + + return TRUE; +} + +/* + * At any point after LayerStartInit, a new layer can be created. + */ +LayerPtr +LayerCreate (ScreenPtr pScreen, + int kind, + int depth, + PixmapPtr pPixmap, + ShadowUpdateProc update, + ShadowWindowProc window, + int rotate, + void *closure) +{ + layerScrPriv(pScreen); + LayerPtr pLay, *pPrev; + LayerKindPtr pLayKind; + + if (kind < 0 || pLayScr->nkinds <= kind) + return 0; + pLayKind = &pLayScr->kinds[kind]; + pLay = (LayerPtr) xalloc (sizeof (LayerRec)); + if (!pLay) + return 0; + /* + * Initialize the layer + */ + pLay->pNext = 0; + pLay->pKind = pLayKind; + pLay->refcnt = 1; + pLay->windows = 0; + pLay->depth = depth; + pLay->pPixmap = pPixmap; + pLay->update = update; + pLay->window = window; + pLay->rotate = rotate; + pLay->closure = closure; + if (pPixmap == LAYER_SCREEN_PIXMAP) + pLay->freePixmap = FALSE; + else + { + pLay->freePixmap = TRUE; + if (pPixmap) + pPixmap->refcnt++; + } + REGION_INIT (pScreen, &pLay->region, NullBox, 0); + /* + * Hook the layer at the end of the list + */ + for (pPrev = &pLayScr->pLayers; *pPrev; pPrev = &(*pPrev)->pNext) + ; + *pPrev = pLay; + return pLay; +} + +/* + * Change a layer pixmap + */ +void +LayerSetPixmap (ScreenPtr pScreen, LayerPtr pLayer, PixmapPtr pPixmap) +{ + LayerDestroyPixmap (pScreen, pLayer); + pLayer->pPixmap = pPixmap; + if (pPixmap == LAYER_SCREEN_PIXMAP) + pLayer->freePixmap = FALSE; + else + { + if (pPixmap) + pPixmap->refcnt++; + pLayer->freePixmap = TRUE; + } +} + +/* + * Destroy a layer. The layer must not contain any windows. + */ +void +LayerDestroy (ScreenPtr pScreen, LayerPtr pLay) +{ + layerScrPriv(pScreen); + LayerPtr *pPrev; + + --pLay->refcnt; + if (pLay->refcnt > 0) + return; + /* + * Unhook the layer from the list + */ + for (pPrev = &pLayScr->pLayers; *pPrev; pPrev = &(*pPrev)->pNext) + if (*pPrev == pLay) + { + *pPrev = pLay->pNext; + break; + } + /* + * Free associated storage + */ + LayerDestroyPixmap (pScreen, pLay); + REGION_UNINIT (pScreen, &pLay->region); + xfree (pLay); +} + +/* + * CloseScreen wrapper + */ +Bool +layerCloseScreen (int index, ScreenPtr pScreen) +{ + layerScrPriv(pScreen); + int kind; + + /* XXX this is a mess -- fbCloseScreen can only be called once, + * and yet the intervening layers need to be called as well. + */ + kind = pLayScr->nkinds - 1; + pScreen->CloseScreen = pLayScr->kinds[kind].CloseScreen; + (*pScreen->CloseScreen) (index, pScreen); + + /* + * make sure the shadow layer is cleaned up as well + */ + if (kind != LAYER_SHADOW) + xfree (shadowGetScrPriv (pScreen)); + + xfree (pLayScr->kinds); + xfree (pLayScr); + pScreen->devPrivates[layerScrPrivateIndex].ptr = 0; + return TRUE; +} Index: xc/programs/Xserver/miext/layer/layerpict.c diff -u /dev/null xc/programs/Xserver/miext/layer/layerpict.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/layer/layerpict.c Tue May 29 00:54:13 2001 @@ -0,0 +1,145 @@ +/* + * $XFree86: xc/programs/Xserver/miext/layer/layerpict.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2001 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 "layerstr.h" + +void +layerComposite (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + LayerPtr pLayer; + LayerWinLoopRec loop; + DrawablePtr pDstDrawable = pDst->pDrawable; + ScreenPtr pScreen = pDstDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen (pScreen); + + if (pDstDrawable->type == DRAWABLE_WINDOW) + { + WindowPtr pWin = (WindowPtr) pDstDrawable; + for (pLayer = LayerWindowFirst (pWin, &loop); + pLayer; + pLayer = LayerWindowNext (pWin, &loop)) + { + LayerUnwrap (ps, pLayer->pKind, Composite); + (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + LayerWrap (ps, pLayer->pKind, Composite, layerComposite); + } + LayerWindowDone (pWin, &loop); + } + else + { + layerScrPriv (pScreen); + LayerUnwrap (ps, &pLayScr->kinds[LAYER_FB], Composite); + (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + LayerWrap (ps, &pLayScr->kinds[LAYER_FB], Composite, layerComposite); + } +} + +void +layerGlyphs (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int nlist, + GlyphListPtr list, + GlyphPtr *glyphs) +{ + LayerPtr pLayer; + LayerWinLoopRec loop; + DrawablePtr pDstDrawable = pDst->pDrawable; + ScreenPtr pScreen = pDstDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen (pScreen); + + if (pDstDrawable->type == DRAWABLE_WINDOW) + { + WindowPtr pWin = (WindowPtr) pDstDrawable; + for (pLayer = LayerWindowFirst (pWin, &loop); + pLayer; + pLayer = LayerWindowNext (pWin, &loop)) + { + LayerUnwrap (ps, pLayer->pKind, Glyphs); + (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, + nlist, list, glyphs); + LayerWrap (ps, pLayer->pKind, Glyphs, layerGlyphs); + } + LayerWindowDone (pWin, &loop); + } + else + { + layerScrPriv (pScreen); + LayerUnwrap (ps, &pLayScr->kinds[LAYER_FB], Glyphs); + (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, + nlist, list, glyphs); + LayerWrap (ps, &pLayScr->kinds[LAYER_FB], Glyphs, layerGlyphs); + } +} + +void +layerCompositeRects (CARD8 op, + PicturePtr pDst, + xRenderColor *color, + int nRect, + xRectangle *rects) +{ + LayerPtr pLayer; + LayerWinLoopRec loop; + DrawablePtr pDstDrawable = pDst->pDrawable; + ScreenPtr pScreen = pDstDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen (pScreen); + + if (pDstDrawable->type == DRAWABLE_WINDOW) + { + WindowPtr pWin = (WindowPtr) pDstDrawable; + for (pLayer = LayerWindowFirst (pWin, &loop); + pLayer; + pLayer = LayerWindowNext (pWin, &loop)) + { + LayerUnwrap (ps, pLayer->pKind, CompositeRects); + (*ps->CompositeRects) (op, pDst, color, nRect, rects); + LayerWrap (ps, pLayer->pKind, CompositeRects, layerCompositeRects); + } + LayerWindowDone (pWin, &loop); + } + else + { + layerScrPriv (pScreen); + LayerUnwrap (ps, &pLayScr->kinds[LAYER_FB], CompositeRects); + (*ps->CompositeRects) (op, pDst, color, nRect, rects); + LayerWrap (ps, &pLayScr->kinds[LAYER_FB], CompositeRects, layerCompositeRects); + } +} Index: xc/programs/Xserver/miext/layer/layerstr.h diff -u /dev/null xc/programs/Xserver/miext/layer/layerstr.h:1.2 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/layer/layerstr.h Mon Jun 4 05:45:41 2001 @@ -0,0 +1,411 @@ +/* + * $XFree86: xc/programs/Xserver/miext/layer/layerstr.h,v 1.2 2001/06/04 09:45:41 keithp Exp $ + * + * Copyright © 2001 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. + */ + +#ifndef _LAYERSTR_H_ +#define _LAYERSTR_H_ + +#include "X.h" +#include "scrnintstr.h" +#include "windowstr.h" +#include "font.h" +#include "dixfontstr.h" +#include "fontstruct.h" +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "layer.h" +#ifdef RENDER +#include "picturestr.h" +#endif + +extern int layerScrPrivateIndex; +extern int layerGCPrivateIndex; +extern int layerWinPrivateIndex; + +/* + * One of these for each possible set of underlying + * rendering code. The first kind always points at the + * underlying frame buffer code and is created in LayerStartInit + * so that LayerNewKind can unwrap the screen and prepare it + * for another wrapping sequence. + * + * The set of functions wrapped here must be at least the union + * of all functions wrapped by any rendering layer in use; they're + * easy to add, so don't be shy + */ + +typedef struct _LayerKind { + int kind; /* kind index */ + + CloseScreenProcPtr CloseScreen; + + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; + ChangeWindowAttributesProcPtr ChangeWindowAttributes; + PaintWindowBackgroundProcPtr PaintWindowBackground; + PaintWindowBorderProcPtr PaintWindowBorder; + CopyWindowProcPtr CopyWindow; + + CreateGCProcPtr CreateGC; + + CompositeProcPtr Composite; + GlyphsProcPtr Glyphs; + CompositeRectsProcPtr CompositeRects; + +} LayerKindRec; + +#define LayerWrap(orig,lay,member,func) \ + (((lay)->member = (orig)->member),\ + ((orig)->member = (func))) +#define LayerUnwrap(orig,lay,member) \ + ((orig)->member = (lay)->member) + +/* + * This is the window private structure allocated for + * all windows. There are two possible alternatives here, + * either the window belongs to a single layer and uses its + * internal clip/borderClip lists or the window belongs to one + * or more layers and uses a separate clip/borderclip for each + * layer. When this is integrated into the core window struct, + * the LayerWinKind can become a single bit saving 8 bytes per + * window. + */ + +typedef struct _LayerWin { + Bool isList; + union { + LayerPtr pLayer; + LayerListPtr pLayList; + } u; +} LayerWinRec; + +typedef struct _LayerList { + LayerListPtr pNext; /* list of layers for this window */ + LayerPtr pLayer; /* the layer */ + Bool inheritClip; /* use the window clipList/borderClip */ + RegionRec clipList; /* per-layer clip/border clip lists */ + RegionRec borderClip; +} LayerListRec; + +#define layerGetWinPriv(pWin) ((LayerWinPtr) (pWin)->devPrivates[layerWinPrivateIndex].ptr) +#define layerWinPriv(pWin) LayerWinPtr pLayWin = layerGetWinPriv(pWin) + +#define layerWinLayer(pLayWin) ((pLayWin)->isList ? (pLayWin)->u.pLayList->pLayer : (pLayWin)->u.pLayer) + +typedef struct _LayerWinLoop { + LayerWinPtr pLayWin; + LayerListPtr pLayList; + PixmapPtr pPixmap; /* original window pixmap */ + RegionRec clipList; /* saved original clipList contents */ + RegionRec borderClip; /* saved original borderClip contents */ +} LayerWinLoopRec, *LayerWinLoopPtr; + +#define layerWinFirstLayer(pLayWin,pLayList) ((pLayWin)->isList ? ((pLayList) = (pLayWin)->u.pLayList)->pLayer : pLayWin->u.pLayer) +#define layerWinNextLayer(pLayWin,pLayList) ((pLayWin)->isList ? ((pLayList) = (pLayList)->pNext)->pLayer : 0) + +LayerPtr +LayerWindowFirst (WindowPtr pWin, LayerWinLoopPtr pLoop); + +LayerPtr +LayerWindowNext (WindowPtr pWin, LayerWinLoopPtr pLoop); + +void +LayerWindowDone (WindowPtr pWin, LayerWinLoopPtr pLoop); + + +/* + * This is the GC private structure allocated for all GCs. + * XXX this is really messed up; I'm not sure how to fix it yet + */ + +typedef struct _LayerGC { + GCFuncs *funcs; + LayerKindPtr pKind; +} LayerGCRec; + +#define layerGetGCPriv(pGC) ((LayerGCPtr) (pGC)->devPrivates[layerGCPrivateIndex].ptr) +#define layerGCPriv(pGC) LayerGCPtr pLayGC = layerGetGCPriv(pGC) + +/* + * This is the screen private, it contains + * the layer kinds and the layers themselves + */ +typedef struct _LayerScreen { + int nkinds; /* number of elements in kinds array */ + LayerKindPtr kinds; /* created kinds; reallocated when new ones added */ + LayerPtr pLayers; /* list of layers for this screen */ +} LayerScreenRec; + +#define layerGetScrPriv(pScreen) ((LayerScreenPtr) (pScreen)->devPrivates[layerScrPrivateIndex].ptr) +#define layerScrPriv(pScreen) LayerScreenPtr pLayScr = layerGetScrPriv(pScreen) + +Bool +layerCloseScreen (int index, ScreenPtr pScreen); + +Bool +layerCreateWindow (WindowPtr pWin); + +Bool +layerDestroyWindow (WindowPtr pWin); + +Bool +layerChangeWindowAttributes (WindowPtr pWin, unsigned long mask); + +void +layerPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what); + +void +layerPaintWindowBorder (WindowPtr pWin, RegionPtr pRegion, int what); + +void +layerCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); + +Bool +layerCreateGC (GCPtr pGC); + +void +layerComposite (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 +layerGlyphs (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int nlist, + GlyphListPtr list, + GlyphPtr *glyphs); + +void +layerCompositeRects (CARD8 op, + PicturePtr pDst, + xRenderColor *color, + int nRect, + xRectangle *rects); + +void layerValidateGC(GCPtr, unsigned long, DrawablePtr); +void layerChangeGC(GCPtr, unsigned long); +void layerCopyGC(GCPtr, unsigned long, GCPtr); +void layerDestroyGC(GCPtr); +void layerChangeClip(GCPtr, int, pointer, int); +void layerDestroyClip(GCPtr); +void layerCopyClip(GCPtr, GCPtr); + +void +layerFillSpans(DrawablePtr pDraw, + GC *pGC, + int nInit, + DDXPointPtr pptInit, + int *pwidthInit, + int fSorted); + +void +layerSetSpans(DrawablePtr pDraw, + GCPtr pGC, + char *pcharsrc, + DDXPointPtr pptInit, + int *pwidthInit, + int nspans, + int fSorted); + +void +layerPutImage( + DrawablePtr pDraw, + GCPtr pGC, + int depth, + int x, int y, int w, int h, + int leftPad, + int format, + char *pImage +); + +RegionPtr +layerCopyArea( + DrawablePtr pSrc, + DrawablePtr pDst, + GC *pGC, + int srcx, int srcy, + int width, int height, + int dstx, int dsty +); + +RegionPtr +layerCopyPlane( + DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + int srcx, int srcy, + int width, int height, + int dstx, int dsty, + unsigned long bitPlane +); + +void +layerPolyPoint( + DrawablePtr pDraw, + GCPtr pGC, + int mode, + int npt, + xPoint *pptInit +); +void +layerPolylines( + DrawablePtr pDraw, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr pptInit +); + +void +layerPolySegment( + DrawablePtr pDraw, + GCPtr pGC, + int nseg, + xSegment *pSeg +); + +void +layerPolyRectangle( + DrawablePtr pDraw, + GCPtr pGC, + int nRects, + xRectangle *pRects +); + +void +layerPolyArc( + DrawablePtr pDraw, + GCPtr pGC, + int narcs, + xArc *parcs +); + +void +layerFillPolygon( + DrawablePtr pDraw, + GCPtr pGC, + int shape, + int mode, + int count, + DDXPointPtr pptInit +); + +void +layerPolyFillRect( + DrawablePtr pDraw, + GCPtr pGC, + int nRectsInit, + xRectangle *pRectsInit +); + +void +layerPolyFillArc( + DrawablePtr pDraw, + GCPtr pGC, + int narcs, + xArc *parcs +); + +int +layerPolyText8( + DrawablePtr pDraw, + GCPtr pGC, + int x, + int y, + int count, + char *chars +); + +int +layerPolyText16( + DrawablePtr pDraw, + GCPtr pGC, + int x, + int y, + int count, + unsigned short *chars +); + +void +layerImageText8( + DrawablePtr pDraw, + GCPtr pGC, + int x, + int y, + int count, + char *chars +); + +void +layerImageText16( + DrawablePtr pDraw, + GCPtr pGC, + int x, + int y, + int count, + unsigned short *chars +); + +void +layerImageGlyphBlt( + DrawablePtr pDraw, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase +); + +void +layerPolyGlyphBlt( + DrawablePtr pDraw, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase +); + +void +layerPushPixels( + GCPtr pGC, + PixmapPtr pBitMap, + DrawablePtr pDraw, + int dx, int dy, int xOrg, int yOrg +); + +#endif /* _LAYERSTR_H_ */ Index: xc/programs/Xserver/miext/layer/layerwin.c diff -u /dev/null xc/programs/Xserver/miext/layer/layerwin.c:1.5 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/layer/layerwin.c Sat Oct 27 23:34:16 2001 @@ -0,0 +1,437 @@ +/* + * $XFree86: xc/programs/Xserver/miext/layer/layerwin.c,v 1.5 2001/10/28 03:34:16 tsi Exp $ + * + * Copyright © 2001 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 "layerstr.h" + +static LayerListPtr +NewLayerList (ScreenPtr pScreen, LayerPtr pLayer) +{ + LayerListPtr pLayList; + + pLayList = (LayerListPtr) xalloc (sizeof (LayerListRec)); + if (!pLayList) + return 0; + pLayList->pNext = 0; + pLayList->pLayer = pLayer; + pLayList->inheritClip = TRUE; + REGION_INIT (pScreen, &pLayList->clipList, NullBox, 0); + REGION_INIT (pScreen, &pLayList->borderClip, NullBox, 0); + return pLayList; +} + +static void +FreeLayerList (ScreenPtr pScreen, LayerListPtr pLayList) +{ + REGION_UNINIT (&pScreen, &pLayList->clipList); + REGION_UNINIT (&pScreen, &pLayList->borderClip); + xfree (pLayList); +} + +/* + * Create pixmap for a layer + */ + +Bool +LayerCreatePixmap (ScreenPtr pScreen, LayerPtr pLayer) +{ + /* XXX create full-screen sized layers all around */ + pLayer->pPixmap = (*pScreen->CreatePixmap) (pScreen, pScreen->width, + pScreen->height, pLayer->depth); + if (!pLayer->pPixmap) + return FALSE; + if (pLayer->pKind->kind == LAYER_SHADOW) + { + if (!shadowAdd (pScreen, pLayer->pPixmap, pLayer->update, + pLayer->window, pLayer->rotate, pLayer->closure)) + return FALSE; + } + return TRUE; +} + +/* + * Destroy pixmap for a layer + */ + +void +LayerDestroyPixmap (ScreenPtr pScreen, LayerPtr pLayer) +{ + if (pLayer->pPixmap) + { + if (pLayer->pKind->kind == LAYER_SHADOW) + shadowRemove (pScreen, pLayer->pPixmap); + if (pLayer->freePixmap) + (*pScreen->DestroyPixmap) (pLayer->pPixmap); + } + pLayer->pPixmap = 0; +} + +/* + * Add a window to a layer + */ +Bool +LayerWindowAdd (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin) +{ + layerWinPriv(pWin); + + if (pLayer->pPixmap == LAYER_SCREEN_PIXMAP) + pLayer->pPixmap = (*pScreen->GetScreenPixmap) (pScreen); + else if (!pLayer->pPixmap && !LayerCreatePixmap (pScreen, pLayer)) + return FALSE; + /* + * Add a new layer list if needed + */ + if (pLayWin->isList || pLayWin->u.pLayer) + { + LayerListPtr pPrev; + LayerListPtr pLayList; + + if (!pLayWin->isList) + { + pPrev = NewLayerList (pScreen, pLayWin->u.pLayer); + if (!pPrev) + return FALSE; + } + else + { + for (pPrev = pLayWin->u.pLayList; pPrev->pNext; pPrev = pPrev->pNext) + ; + } + pLayList = NewLayerList (pScreen, pLayer); + if (!pLayList) + { + if (!pLayWin->isList) + FreeLayerList (pScreen, pPrev); + return FALSE; + } + pPrev->pNext = pLayList; + if (!pLayWin->isList) + { + pLayWin->isList = TRUE; + pLayWin->u.pLayList = pPrev; + } + } + else + pLayWin->u.pLayer = pLayer; + /* + * XXX only one layer supported for drawing, last one wins + */ + (*pScreen->SetWindowPixmap) (pWin, pLayer->pPixmap); + pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pLayer->refcnt++; + pLayer->windows++; + return TRUE; +} + +/* + * Remove a window from a layer + */ + +void +LayerWindowRemove (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin) +{ + layerWinPriv(pWin); + + if (pLayWin->isList) + { + LayerListPtr *pPrev; + LayerListPtr pLayList; + + for (pPrev = &pLayWin->u.pLayList; (pLayList = *pPrev); pPrev = &pLayList->pNext) + { + if (pLayList->pLayer == pLayer) + { + *pPrev = pLayList->pNext; + FreeLayerList (pScreen, pLayList); + --pLayer->windows; + if (pLayer->windows <= 0) + LayerDestroyPixmap (pScreen, pLayer); + LayerDestroy (pScreen, pLayer); + break; + } + } + pLayList = pLayWin->u.pLayList; + if (!pLayList) + { + /* + * List is empty, set isList back to false + */ + pLayWin->isList = FALSE; + pLayWin->u.pLayer = 0; + } + else if (!pLayList->pNext && pLayList->inheritClip) + { + /* + * List contains a single element using the + * window clip, free the list structure and + * host the layer back to the window private + */ + pLayer = pLayList->pLayer; + FreeLayerList (pScreen, pLayList); + pLayWin->isList = FALSE; + pLayWin->u.pLayer = pLayer; + } + } + else + { + if (pLayWin->u.pLayer == pLayer) + { + --pLayer->windows; + if (pLayer->windows <= 0) + LayerDestroyPixmap (pScreen, pLayer); + LayerDestroy (pScreen, pLayer); + pLayWin->u.pLayer = 0; + } + } + pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; +} + +/* + * Looping primitives for window layering. Usage: + * + * for (pLayer = LayerWindowFirst (pWin, &loop); + * pLayer; + * pLayer = LayerWindowNext (&loop)) + * { + * ... + * } + * LayerWindowDone (pWin, &loop); + */ + +LayerPtr +LayerWindowFirst (WindowPtr pWin, LayerWinLoopPtr pLoop) +{ + layerWinPriv (pWin); + + pLoop->pLayWin = pLayWin; + if (!pLayWin->isList) + return pLayWin->u.pLayer; + + /* + * Preserve original state + */ + pLoop->clipList = pWin->clipList; + pLoop->borderClip = pWin->borderClip; + pLoop->pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin); + + /* + * Set initial list element + */ + pLoop->pLayList = pLayWin->u.pLayList; + + /* + * Return first layer + */ + return LayerWindowNext (pWin, pLoop); +} + +LayerPtr +LayerWindowNext (WindowPtr pWin, LayerWinLoopPtr pLoop) +{ + LayerPtr pLayer; + LayerWinPtr pLayWin = pLoop->pLayWin; + LayerListPtr pLayList; + + if (!pLayWin->isList) + return 0; + + pLayList = pLoop->pLayList; + pLayer = pLayList->pLayer; + /* + * Configure window for this layer + */ + (*pWin->drawable.pScreen->SetWindowPixmap) (pWin, pLayer->pPixmap); + if (!pLayList->inheritClip) + { + pWin->clipList = pLayList->clipList; + pWin->borderClip = pLayList->borderClip; + } + /* + * Step to next layer list + */ + pLoop->pLayList = pLayList->pNext; + /* + * Return layer + */ + return pLayer; +} + +void +LayerWindowDone (WindowPtr pWin, LayerWinLoopPtr pLoop) +{ + LayerWinPtr pLayWin = pLoop->pLayWin; + + if (!pLayWin->isList) + return; + /* + * clean up after the loop + */ + pWin->clipList = pLoop->clipList; + pWin->borderClip = pLoop->clipList; + (*pWin->drawable.pScreen->SetWindowPixmap) (pWin, pLoop->pPixmap); +} + +Bool +layerCreateWindow (WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + layerWinPriv(pWin); + layerScrPriv(pScreen); + LayerPtr pLayer; + Bool ret; + + pLayWin->isList = FALSE; + pLayWin->u.pLayer = 0; + + /* + * input only windows don't live in any layer + */ + if (pWin->drawable.type == UNDRAWABLE_WINDOW) + return TRUE; + /* + * Use a reasonable default layer -- the first + * layer matching the windows depth. Subsystems needing + * alternative layering semantics can override this by + * replacing this function. Perhaps a new screen function + * could be used to select the correct initial window + * layer instead. + */ + for (pLayer = pLayScr->pLayers; pLayer; pLayer = pLayer->pNext) + if (pLayer->depth == pWin->drawable.depth) + break; + ret = TRUE; + if (pLayer) + { + pScreen->CreateWindow = pLayer->pKind->CreateWindow; + ret = (*pScreen->CreateWindow) (pWin); + pLayer->pKind->CreateWindow = pScreen->CreateWindow; + pScreen->CreateWindow = layerCreateWindow; + LayerWindowAdd (pScreen, pLayer, pWin); + } + return ret; +} + +Bool +layerDestroyWindow (WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + layerWinPriv(pWin); + LayerPtr pLayer; + Bool ret = TRUE; + + while ((pLayer = layerWinLayer (pLayWin))) + { + LayerUnwrap (pScreen, pLayer->pKind, DestroyWindow); + ret = (*pScreen->DestroyWindow) (pWin); + LayerWrap (pScreen, pLayer->pKind, DestroyWindow, layerDestroyWindow); + LayerWindowRemove (pWin->drawable.pScreen, pLayer, pWin); + } + return ret; +} + +Bool +layerChangeWindowAttributes (WindowPtr pWin, unsigned long mask) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + LayerPtr pLay; + LayerWinLoopRec loop; + Bool ret = TRUE; + + for (pLay = LayerWindowFirst (pWin, &loop); + pLay; + pLay = LayerWindowNext (pWin, &loop)) + { + LayerUnwrap(pScreen,pLay->pKind,ChangeWindowAttributes); + if (!(*pScreen->ChangeWindowAttributes) (pWin, mask)) + ret = FALSE; + LayerWrap(pScreen,pLay->pKind,ChangeWindowAttributes,layerChangeWindowAttributes); + } + LayerWindowDone (pWin, &loop); + return ret; +} + +void +layerPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + LayerPtr pLay; + LayerWinLoopRec loop; + + for (pLay = LayerWindowFirst (pWin, &loop); + pLay; + pLay = LayerWindowNext (pWin, &loop)) + { + LayerUnwrap(pScreen,pLay->pKind,PaintWindowBackground); + (*pScreen->PaintWindowBackground) (pWin, pRegion, what); + LayerWrap(pScreen,pLay->pKind,PaintWindowBackground,layerPaintWindowBackground); + } + LayerWindowDone (pWin, &loop); +} + +void +layerPaintWindowBorder (WindowPtr pWin, RegionPtr pRegion, int what) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + LayerPtr pLay; + LayerWinLoopRec loop; + + for (pLay = LayerWindowFirst (pWin, &loop); + pLay; + pLay = LayerWindowNext (pWin, &loop)) + { + LayerUnwrap(pScreen,pLay->pKind,PaintWindowBorder); + (*pScreen->PaintWindowBorder) (pWin, pRegion, what); + LayerWrap(pScreen,pLay->pKind,PaintWindowBorder,layerPaintWindowBorder); + } + LayerWindowDone (pWin, &loop); +} + +void +layerCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + LayerPtr pLay; + LayerWinLoopRec loop; + int dx = 0, dy = 0; + + for (pLay = LayerWindowFirst (pWin, &loop); + pLay; + pLay = LayerWindowNext (pWin, &loop)) + { + LayerUnwrap(pScreen,pLay->pKind,CopyWindow); + /* + * Undo the translation done within the last CopyWindow proc (sigh) + */ + if (dx || dy) + REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, dx, dy); + (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); + LayerWrap(pScreen,pLay->pKind,CopyWindow,layerCopyWindow); + /* + * Save offset to undo translation next time around + */ + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + } + LayerWindowDone (pWin, &loop); +} + Index: xc/programs/Xserver/miext/shadow/Imakefile diff -u xc/programs/Xserver/miext/shadow/Imakefile:1.4 xc/programs/Xserver/miext/shadow/Imakefile:1.6 --- xc/programs/Xserver/miext/shadow/Imakefile:1.4 Sun Jan 21 16:19:39 2001 +++ xc/programs/Xserver/miext/shadow/Imakefile Fri Jul 20 15:25:02 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/miext/shadow/Imakefile,v 1.4 2001/01/21 21:19:39 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/miext/shadow/Imakefile,v 1.6 2001/07/20 19:25:02 keithp Exp $ XCOMM XCOMM @@ -18,9 +18,16 @@ shplanar.c \ shplanar8.c \ shpacked.c \ - shrot8pack.c \ - shrot16pack.c \ - shrot32pack.c + shrotate.c \ + shrot8pack_90.c \ + shrot8pack_180.c \ + shrot8pack_270.c \ + shrot16pack_90.c \ + shrot16pack_180.c \ + shrot16pack_270.c \ + shrot32pack_90.c \ + shrot32pack_180.c \ + shrot32pack_270.c OBJS = $(XFMODOBJ) \ shadow.o \ @@ -28,9 +35,16 @@ shplanar.o \ shplanar8.o \ shpacked.o \ - shrot8pack.o \ - shrot16pack.o \ - shrot32pack.o + shrotate.o \ + shrot8pack_90.o \ + shrot8pack_180.o \ + shrot8pack_270.o \ + shrot16pack_90.o \ + shrot16pack_180.o \ + shrot16pack_270.o \ + shrot32pack_90.o \ + shrot32pack_180.o \ + shrot32pack_270.o INCLUDES = -I. -I../../mi -I../../fb -I../../include -I$(XINCLUDESRC) \ -I$(FONTINCSRC) -I$(XF86SRC)/common $(EXTRAINCLUDES) \ Index: xc/programs/Xserver/miext/shadow/shadow.c diff -u xc/programs/Xserver/miext/shadow/shadow.c:1.5 xc/programs/Xserver/miext/shadow/shadow.c:1.10 --- xc/programs/Xserver/miext/shadow/shadow.c:1.5 Sun Jan 21 16:19:39 2001 +++ xc/programs/Xserver/miext/shadow/shadow.c Sat Oct 27 23:34:16 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shadow.c,v 1.5 2001/01/21 21:19:39 tsi Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shadow.c,v 1.10 2001/10/28 03:34:16 tsi Exp $ * * Copyright © 2000 Keith Packard * @@ -60,14 +60,17 @@ shadowRedisplay (ScreenPtr pScreen) { shadowScrPriv(pScreen); - PixmapPtr pShadow = (PixmapPtr) pScreen->devPrivate; - - if (REGION_NOTEMPTY (pScreen, &pScrPriv->damage)) + shadowBufPtr pBuf; + + for (pBuf = pScrPriv->pBuf; pBuf; pBuf = pBuf->pNext) { - REGION_INTERSECT (pScreen, &pScrPriv->damage, &pScrPriv->damage, - &WindowTable[pScreen->myNum]->borderSize); - (*pScrPriv->update) (pScreen, pShadow, &pScrPriv->damage); - REGION_EMPTY (pScreen, &pScrPriv->damage); + if (REGION_NOTEMPTY (pScreen, &pBuf->damage)) + { + REGION_INTERSECT (pScreen, &pBuf->damage, &pBuf->damage, + &WindowTable[pScreen->myNum]->borderSize); + (*pBuf->update) (pScreen, pBuf); + REGION_EMPTY (pScreen, &pBuf->damage); + } } } @@ -89,13 +92,14 @@ static void shadowDamageRegion (WindowPtr pWindow, RegionPtr pRegion) { - ScreenPtr pScreen = pWindow->drawable.pScreen; - shadowScrPriv (pScreen); + shadowBufPtr pBuf = shadowFindBuf (pWindow); - REGION_UNION (pScreen, &pScrPriv->damage, &pScrPriv->damage, pRegion); -#undef ALWAYS_DISPLAY + if (!pBuf) + abort (); + + REGION_UNION (pWindow->drawable.pScreen, &pBuf->damage, &pBuf->damage, pRegion); #ifdef ALWAYS_DISPLAY - shadowRedisplay (pScreen); + shadowRedisplay (pWindow->drawable.pScreen); #endif } @@ -156,6 +160,26 @@ return ret; } +void +shadowWrapGC (GCPtr pGC) +{ + shadowGCPriv(pGC); + + pGCPriv->ops = NULL; + pGCPriv->funcs = pGC->funcs; + pGC->funcs = &shadowGCFuncs; +} + +void +shadowUnwrapGC (GCPtr pGC) +{ + shadowGCPriv(pGC); + + pGC->funcs = pGCPriv->funcs; + if (pGCPriv->ops) + pGC->ops = pGCPriv->ops; +} + #define SHADOW_GC_OP_PROLOGUE(pGC,pDraw) \ shadowGCPriv(pGC); \ GCFuncs *oldFuncs = pGC->funcs; \ @@ -1324,11 +1348,11 @@ } Bool -shadowInit (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window) +shadowSetup (ScreenPtr pScreen) { shadowScrPrivPtr pScrPriv; #ifdef RENDER - PictureScreenPtr ps = GetPictureScreen(pScreen); + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif if (shadowGeneration != serverGeneration) @@ -1346,9 +1370,7 @@ pScrPriv = (shadowScrPrivPtr) xalloc (sizeof (shadowScrPrivRec)); if (!pScrPriv) return FALSE; - REGION_INIT (pScreen, &pScrPriv->damage, NullBox, 0); - pScrPriv->update = update; - pScrPriv->window = window; + if (!RegisterBlockAndWakeupHandlers (shadowBlockHandler, shadowWakeupHandler, (pointer) pScreen)) @@ -1361,10 +1383,95 @@ wrap (pScrPriv, pScreen, CloseScreen, shadowCloseScreen); wrap (pScrPriv, pScreen, GetImage, shadowGetImage); #ifdef RENDER - wrap (pScrPriv, ps, Glyphs, shadowGlyphs); - wrap (pScrPriv, ps, Composite, shadowComposite); + if (ps) { + wrap (pScrPriv, ps, Glyphs, shadowGlyphs); + wrap (pScrPriv, ps, Composite, shadowComposite); + } #endif + pScrPriv->pBuf = 0; pScreen->devPrivates[shadowScrPrivateIndex].ptr = (pointer) pScrPriv; + return TRUE; +} + +Bool +shadowAdd (ScreenPtr pScreen, + PixmapPtr pPixmap, + ShadowUpdateProc update, + ShadowWindowProc window, + int rotate, + void *closure) +{ + shadowScrPriv(pScreen); + shadowBufPtr pBuf; + + pBuf = (shadowBufPtr) xalloc (sizeof (shadowBufRec)); + if (!pBuf) + return FALSE; + pBuf->pPixmap = pPixmap; + pBuf->update = update; + pBuf->window = window; + REGION_INIT (pScreen, &pBuf->damage, NullBox, 0); + pBuf->pNext = pScrPriv->pBuf; + pBuf->rotate = rotate; + pBuf->closure = 0; + pScrPriv->pBuf = pBuf; + return TRUE; +} + +void +shadowRemove (ScreenPtr pScreen, PixmapPtr pPixmap) +{ + shadowScrPriv(pScreen); + shadowBufPtr pBuf, *pPrev; + + for (pPrev = &pScrPriv->pBuf; (pBuf = *pPrev); pPrev = &pBuf->pNext) + if (pBuf->pPixmap == pPixmap) + { + REGION_UNINIT (pScreen, &pBuf->damage); + *pPrev = pBuf->pNext; + xfree (pBuf); + break; + } +} + +shadowBufPtr +shadowFindBuf (WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + shadowScrPriv(pScreen); + shadowBufPtr pBuf, *pPrev; + PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWindow); + + for (pPrev = &pScrPriv->pBuf; (pBuf = *pPrev); pPrev = &pBuf->pNext) + { + if (!pBuf->pPixmap) + pBuf->pPixmap = (*pScreen->GetScreenPixmap) (pScreen); + if (pBuf->pPixmap == pPixmap) + { + /* + * Reorder so this one is first next time + */ + if (pPrev != &pScrPriv->pBuf) + { + *pPrev = pBuf->pNext; + pBuf->pNext = pScrPriv->pBuf; + pScrPriv->pBuf = pBuf; + } + return pBuf; + } + } + return 0; +} + +Bool +shadowInit (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window) +{ + if (!shadowSetup (pScreen)) + return FALSE; + + if (!shadowAdd (pScreen, 0, update, window, 0, 0)) + return FALSE; + return TRUE; } Index: xc/programs/Xserver/miext/shadow/shadow.h diff -u xc/programs/Xserver/miext/shadow/shadow.h:1.3 xc/programs/Xserver/miext/shadow/shadow.h:1.5 --- xc/programs/Xserver/miext/shadow/shadow.h:1.3 Tue Sep 12 15:40:13 2000 +++ xc/programs/Xserver/miext/shadow/shadow.h Fri Jul 20 15:25:02 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shadow.h,v 1.3 2000/09/12 19:40:13 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shadow.h,v 1.5 2001/07/20 19:25:02 keithp Exp $ * * Copyright © 2000 Keith Packard * @@ -29,9 +29,10 @@ #include "picturestr.h" #endif +typedef struct _shadowBuf *shadowBufPtr; + typedef void (*ShadowUpdateProc) (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); + shadowBufPtr pBuf); #define SHADOW_WINDOW_RELOCATE 1 #define SHADOW_WINDOW_READ 2 @@ -41,7 +42,18 @@ CARD32 row, CARD32 offset, int mode, - CARD32 *size); + CARD32 *size, + void *closure); + +typedef struct _shadowBuf { + shadowBufPtr pNext; + ShadowUpdateProc update; + ShadowWindowProc window; + RegionRec damage; + PixmapPtr pPixmap; + void *closure; + int rotate; +} shadowBufRec; typedef struct _shadowScrPriv { PaintWindowBackgroundProcPtr PaintWindowBackground; @@ -54,9 +66,7 @@ CompositeProcPtr Composite; GlyphsProcPtr Glyphs; #endif - ShadowUpdateProc update; - ShadowWindowProc window; - RegionRec damage; + shadowBufPtr pBuf; } shadowScrPrivRec, *shadowScrPrivPtr; extern int shadowScrPrivateIndex; @@ -65,39 +75,84 @@ #define shadowScrPriv(pScr) shadowScrPrivPtr pScrPriv = shadowGetScrPriv(pScr) Bool +shadowSetup (ScreenPtr pScreen); + +Bool +shadowAdd (ScreenPtr pScreen, + PixmapPtr pPixmap, + ShadowUpdateProc update, + ShadowWindowProc window, + int rotate, + void *closure); + +void +shadowRemove (ScreenPtr pScreen, PixmapPtr pPixmap); + +shadowBufPtr +shadowFindBuf (WindowPtr pWindow); + +Bool shadowInit (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window); void * shadowAlloc (int width, int height, int bpp); +void +shadowUpdatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf); + +void +shadowUpdatePlanar4 (ScreenPtr pScreen, + shadowBufPtr pBuf); + +void +shadowUpdatePlanar4x8 (ScreenPtr pScreen, + shadowBufPtr pBuf); + void -shadowUpdatePacked (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +shadowUpdateRotatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf); void -shadowUpdatePlanar4 (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +shadowUpdateRotate8_90 (ScreenPtr pScreen, + shadowBufPtr pBuf); void -shadowUpdatePlanar4x8 (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +shadowUpdateRotate16_90 (ScreenPtr pScreen, + shadowBufPtr pBuf); void -shadowUpdateRotate8 (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +shadowUpdateRotate32_90 (ScreenPtr pScreen, + shadowBufPtr pBuf); void -shadowUpdateRotate16 (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +shadowUpdateRotate8_180 (ScreenPtr pScreen, + shadowBufPtr pBuf); void -shadowUpdateRotate32 (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +shadowUpdateRotate16_180 (ScreenPtr pScreen, + shadowBufPtr pBuf); +void +shadowUpdateRotate32_180 (ScreenPtr pScreen, + shadowBufPtr pBuf); + +void +shadowUpdateRotate8_270 (ScreenPtr pScreen, + shadowBufPtr pBuf); + +void +shadowUpdateRotate16_270 (ScreenPtr pScreen, + shadowBufPtr pBuf); + +void +shadowUpdateRotate32_270 (ScreenPtr pScreen, + shadowBufPtr pBuf); + +void +shadowWrapGC (GCPtr pGC); + +void +shadowUnwrapGC (GCPtr pGC); + #endif /* _SHADOW_H_ */ Index: xc/programs/Xserver/miext/shadow/shpacked.c diff -u xc/programs/Xserver/miext/shadow/shpacked.c:1.3 xc/programs/Xserver/miext/shadow/shpacked.c:1.5 --- xc/programs/Xserver/miext/shadow/shpacked.c:1.3 Mon Sep 18 23:33:33 2000 +++ xc/programs/Xserver/miext/shadow/shpacked.c Sat Oct 27 23:34:16 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shpacked.c,v 1.3 2000/09/19 03:33:33 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shpacked.c,v 1.5 2001/10/28 03:34:16 tsi Exp $ * * Copyright © 2000 Keith Packard * @@ -36,25 +36,24 @@ #include "fb.h" void -shadowUpdatePacked (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) +shadowUpdatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf) { - shadowScrPriv(pScreen); + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; int nbox = REGION_NUM_RECTS (damage); BoxPtr pbox = REGION_RECTS (damage); FbBits *shaBase, *shaLine, *sha; - FbBits s; FbStride shaStride; int scrBase, scrLine, scr; int shaBpp; + int shaXoff, shaYoff; /* XXX assumed to be zero */ int x, y, w, h, width; int i; - FbBits *winBase, *winLine, *win; + FbBits *winBase = NULL, *win; CARD32 winSize; - int plane; - fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp); + fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); while (nbox--) { x = pbox->x1 * shaBpp; @@ -80,11 +79,12 @@ i = scrBase + winSize - scr; if (i <= 0 || scr < scrBase) { - winBase = (FbBits *) (*pScrPriv->window) (pScreen, - y, - scr * sizeof (FbBits), - SHADOW_WINDOW_WRITE, - &winSize); + winBase = (FbBits *) (*pBuf->window) (pScreen, + y, + scr * sizeof (FbBits), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); if(!winBase) return; scrBase = scr; Index: xc/programs/Xserver/miext/shadow/shplanar.c diff -u xc/programs/Xserver/miext/shadow/shplanar.c:1.2 xc/programs/Xserver/miext/shadow/shplanar.c:1.4 --- xc/programs/Xserver/miext/shadow/shplanar.c:1.2 Mon Sep 18 23:33:33 2000 +++ xc/programs/Xserver/miext/shadow/shplanar.c Sat Oct 27 23:34:16 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shplanar.c,v 1.2 2000/09/19 03:33:33 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shplanar.c,v 1.4 2001/10/28 03:34:16 tsi Exp $ * * Copyright © 2000 Keith Packard * @@ -82,30 +82,31 @@ #endif void -shadowUpdatePlanar4 (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) +shadowUpdatePlanar4 (ScreenPtr pScreen, + shadowBufPtr pBuf) { - shadowScrPriv(pScreen); + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; int nbox = REGION_NUM_RECTS (damage); BoxPtr pbox = REGION_RECTS (damage); CARD32 *shaBase, *shaLine, *sha; FbStride shaStride; int scrBase, scrLine, scr; int shaBpp; + int shaXoff, shaYoff; /* XXX assumed to be zero */ int x, y, w, h, width; int i; - CARD32 *winBase, *winLine, *win; + CARD32 *winBase = NULL, *win; CARD32 winSize; int plane; CARD32 m,m5,m6; CARD8 s1, s2, s3, s4; - fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp); + fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); while (nbox--) { - x = pbox->x1 * shaBpp; - y = pbox->y1; + x = (pbox->x1) * shaBpp; + y = (pbox->y1); w = (pbox->x2 - pbox->x1) * shaBpp; h = pbox->y2 - pbox->y1; @@ -129,11 +130,12 @@ i = scrBase + winSize - scr; if (i <= 0 || scr < scrBase) { - winBase = (CARD32 *) (*pScrPriv->window) (pScreen, - y, - (scr << 4) | (plane), - SHADOW_WINDOW_WRITE, - &winSize); + winBase = (CARD32 *) (*pBuf->window) (pScreen, + y, + (scr << 4) | (plane), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); if(!winBase) return; winSize >>= 2; Index: xc/programs/Xserver/miext/shadow/shplanar8.c diff -u xc/programs/Xserver/miext/shadow/shplanar8.c:1.2 xc/programs/Xserver/miext/shadow/shplanar8.c:1.4 --- xc/programs/Xserver/miext/shadow/shplanar8.c:1.2 Mon Sep 18 23:33:33 2000 +++ xc/programs/Xserver/miext/shadow/shplanar8.c Sat Oct 27 23:34:16 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shplanar8.c,v 1.2 2000/09/19 03:33:33 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shplanar8.c,v 1.4 2001/10/28 03:34:16 tsi Exp $ * * Copyright © 2000 Keith Packard * @@ -64,6 +64,7 @@ #if 0 #define GetBits(p,o,d) { \ + CARD32 m1,m2,m3,m4,m5,m6,m7,m8; \ m1 = sha[o] << (7 - (p)); \ m2 = sha[(o)+1] << (3 - (p)); \ m3 = m1 & 0x80808080; \ @@ -76,6 +77,7 @@ } #else #define GetBits(p,o,d) { \ + CARD32 m5,m7; \ m5 = ((sha[o] << (7 - (p))) & 0x80808080) | ((sha[(o)+1] << (3 - (p))) & 0x08080808); \ m7 = m5 | (m5 >> 9); \ d = m7 | (m7 >> 18); \ @@ -84,26 +86,25 @@ void shadowUpdatePlanar4x8 (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) + shadowBufPtr pBuf) { - shadowScrPriv(pScreen); + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; int nbox = REGION_NUM_RECTS (damage); BoxPtr pbox = REGION_RECTS (damage); CARD32 *shaBase, *shaLine, *sha; CARD8 s1, s2, s3, s4; - CARD32 m; FbStride shaStride; int scrBase, scrLine, scr; int shaBpp; + int shaXoff, shaYoff; /* XXX assumed to be zero */ int x, y, w, h, width; int i; - CARD32 *winBase, *winLine, *win; + CARD32 *winBase = NULL, *win; CARD32 winSize; int plane; - CARD32 m1,m2,m3,m4,m5,m6,m7,m8; - fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp); + fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); while (nbox--) { x = pbox->x1 * shaBpp; @@ -131,13 +132,14 @@ i = scrBase + winSize - scr; if (i <= 0 || scr < scrBase) { - winBase = (CARD32 *) (*pScrPriv->window) (pScreen, - y, - (scr << 4) | (plane), - SHADOW_WINDOW_WRITE, - &winSize); + winBase = (CARD32 *) (*pBuf->window) (pScreen, + y, + (scr << 4) | (plane), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); if(!winBase) - return; + return; winSize >>= 2; scrBase = scr; i = winSize; Index: xc/programs/Xserver/miext/shadow/shrot16pack_180.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot16pack_180.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot16pack_180.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot16pack_180.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate16_180 +#define Data CARD16 +#define ROTATE 180 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrot16pack_270.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot16pack_270.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot16pack_270.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot16pack_270.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate16_270 +#define Data CARD16 +#define ROTATE 270 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrot16pack_90.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot16pack_90.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot16pack_90.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot16pack_90.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate16_90 +#define Data CARD16 +#define ROTATE 90 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrot32pack_180.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot32pack_180.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot32pack_180.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot32pack_180.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate32_180 +#define Data CARD32 +#define ROTATE 180 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrot32pack_270.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot32pack_270.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot32pack_270.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot32pack_270.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate32_270 +#define Data CARD32 +#define ROTATE 270 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrot32pack_90.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot32pack_90.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot32pack_90.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot32pack_90.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate32_90 +#define Data CARD32 +#define ROTATE 90 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrot8pack_180.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot8pack_180.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot8pack_180.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot8pack_180.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate8_180 +#define Data CARD8 +#define ROTATE 180 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrot8pack_270.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot8pack_270.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot8pack_270.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot8pack_270.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate8_270 +#define Data CARD8 +#define ROTATE 270 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrot8pack_90.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrot8pack_90.c:1.1 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrot8pack_90.c Tue May 29 00:54:13 2001 @@ -0,0 +1,29 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrot8pack_90.c,v 1.1 2001/05/29 04:54:13 keithp Exp $ + * + * Copyright © 2000 Keith Packard + * + * 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. + */ + +#define FUNC shadowUpdateRotate8_90 +#define Data CARD8 +#define ROTATE 90 + +#include "shrotpack.h" Index: xc/programs/Xserver/miext/shadow/shrotate.c diff -u /dev/null xc/programs/Xserver/miext/shadow/shrotate.c:1.3 --- /dev/null Fri Jan 18 15:26:51 2002 +++ xc/programs/Xserver/miext/shadow/shrotate.c Sat Jul 21 00:13:26 2001 @@ -0,0 +1,243 @@ +/* + * $XFree86: xc/programs/Xserver/miext/shadow/shrotate.c,v 1.3 2001/07/21 04:13:26 keithp Exp $ + * + * Copyright © 2001 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 "X.h" +#include "scrnintstr.h" +#include "windowstr.h" +#include "font.h" +#include "dixfontstr.h" +#include "fontstruct.h" +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "shadow.h" +#include "fb.h" + +void +shadowUpdateRotatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = REGION_NUM_RECTS (damage); + BoxPtr pbox = REGION_RECTS (damage); + FbBits *shaBits; + FbStride shaStride; + int shaBpp; + int shaXoff, shaYoff; + int box_x1, box_x2, box_y1, box_y2; + int sha_x1, sha_y1; + int scr_x1, scr_x2, scr_y1, scr_y2, scr_w, scr_h; + int scr_x, scr_y; + int w; + int pixelsPerBits; + int pixelsMask; + FbStride shaStepOverY, shaStepDownY, shaStepOverX, shaStepDownX; + FbBits *shaLine, *sha; + int shaHeight = pShadow->drawable.height; + int shaWidth = pShadow->drawable.width; + FbBits shaMask; + int shaFirstShift, shaShift; + + fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); + pixelsPerBits = (sizeof (FbBits) * 8) / shaBpp; + pixelsMask = ~(pixelsPerBits - 1); + shaMask = FbBitsMask (FB_UNIT-shaBpp, shaBpp); + /* + * Compute rotation related constants to walk the shadow + */ + switch (pBuf->rotate) { + case 0: + default: + shaStepOverX = shaBpp; + shaStepDownX = 0; + shaStepOverY = 0; + shaStepDownY = shaStride; + break; + case 90: + shaStepOverX = 0; + shaStepDownX = -shaBpp; + shaStepOverY = shaStride; + shaStepDownY = 0; + break; + case 180: + shaStepOverX = -shaBpp; + shaStepDownX = 0; + shaStepOverY = 0; + shaStepDownY = -shaStride; + break; + case 270: + shaStepOverX = 0; + shaStepDownX = shaBpp; + shaStepOverY = -shaStride; + shaStepDownY = 0; + break; + } + while (nbox--) + { + box_x1 = pbox->x1; + box_y1 = pbox->y1; + box_x2 = pbox->x2; + box_y2 = pbox->y2; + pbox++; + + /* + * Compute screen and shadow locations for this box + */ + switch (pBuf->rotate) { + case 0: + default: + scr_x1 = box_x1 & pixelsMask; + scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask; + scr_y1 = box_y1; + scr_y2 = box_y2; + + sha_x1 = box_x1; + sha_y1 = box_y1; + break; + case 90: + scr_x1 = box_y1 & pixelsMask; + scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask; + scr_y1 = (shaWidth - box_x2); + scr_y2 = (shaWidth - box_x1); + + sha_x1 = box_x2 - 1; + sha_y1 = scr_x1; + break; + case 180: + scr_x1 = (shaWidth - box_x2) & pixelsMask; + scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask; + scr_y1 = shaHeight - box_y2; + scr_y2 = shaHeight - box_y1; + + sha_x1 = (shaWidth - scr_x1 - 1); + sha_y1 = box_y2 - 1; + break; + case 270: + scr_x1 = (shaHeight - box_y2) & pixelsMask; + scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask; + scr_y1 = box_x1; + scr_y2 = box_x2; + + sha_x1 = box_x1; + sha_y1 = (shaHeight - scr_x1 - 1); + break; + } + scr_w = ((scr_x2 - scr_x1) * shaBpp) >> FB_SHIFT; + scr_h = scr_y2 - scr_y1; + scr_y = scr_y1; + + /* shift amount for first pixel on screen */ + shaFirstShift = FB_UNIT - ((sha_x1 * shaBpp) & FB_MASK) - shaBpp; + + /* pointer to shadow data first placed on screen */ + shaLine = (shaBits + + sha_y1 * shaStride + + ((sha_x1 * shaBpp) >> FB_SHIFT)); + + /* + * Copy the bits, always write across the physical frame buffer + * to take advantage of write combining. + */ + while (scr_h--) + { + int p; + FbBits bits; + FbBits *win; + int i; + CARD32 winSize; + + sha = shaLine; + shaShift = shaFirstShift; + w = scr_w; + scr_x = scr_x1 * shaBpp >> FB_SHIFT; + + while (w) + { + /* + * Map some of this line + */ + win = (FbBits *) (*pBuf->window) (pScreen, + scr_y, + scr_x << 2, + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + i = (winSize >> 2); + if (i > w) + i = w; + w -= i; + scr_x += i; + /* + * Copy the portion of the line mapped + */ + while (i--) + { + bits = 0; + p = pixelsPerBits; + /* + * Build one word of output from multiple inputs + * + * Note that for 90/270 rotations, this will walk + * down the shadow hitting each scanline once. + * This is probably not very efficient. + */ + while (p--) + { + bits = FbScrLeft(bits, shaBpp); + bits |= FbScrRight (*sha, shaShift) & shaMask; + + shaShift -= shaStepOverX; + if (shaShift >= FB_UNIT) + { + shaShift -= FB_UNIT; + sha--; + } + else if (shaShift < 0) + { + shaShift += FB_UNIT; + sha++; + } + sha += shaStepOverY; + } + *win++ = bits; + } + } + scr_y++; + shaFirstShift -= shaStepDownX; + if (shaFirstShift >= FB_UNIT) + { + shaFirstShift -= FB_UNIT; + shaLine--; + } + else if (shaFirstShift < 0) + { + shaFirstShift += FB_UNIT; + shaLine++; + } + shaLine += shaStepDownY; + } + } +} Index: xc/programs/Xserver/miext/shadow/shrotpack.h diff -u xc/programs/Xserver/miext/shadow/shrotpack.h:1.2 xc/programs/Xserver/miext/shadow/shrotpack.h:1.4 --- xc/programs/Xserver/miext/shadow/shrotpack.h:1.2 Wed Sep 13 19:20:13 2000 +++ xc/programs/Xserver/miext/shadow/shrotpack.h Sat Oct 27 23:34:16 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shrotpack.h,v 1.2 2000/09/13 23:20:13 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shrotpack.h,v 1.4 2001/10/28 03:34:16 tsi Exp $ * * Copyright © 2000 Keith Packard * @@ -22,6 +22,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ +/* + * Thanks to Daniel Chemko <dchemko@intrinsyc.com> for making the 90 and 180 + * orientations work. + */ + #include "X.h" #include "scrnintstr.h" #include "windowstr.h" @@ -35,52 +40,60 @@ #include "shadow.h" #include "fb.h" -#define NONE 0 -#define CLOCKWISE 1 -#define COUNTERCLOCKWISE 2 -#define UPSIDEDOWN 3 +#define DANDEBUG 0 -#define ROTATE CLOCKWISE +#if ROTATE == 270 -#if ROTATE == CLOCKWISE -#define FIRSTSHA(x,y,w,h) (((y) + (h) - 1) * shaStride + (x)) #define SCRLEFT(x,y,w,h) (pScreen->height - ((y) + (h))) +#define SCRY(x,y,w,h) (x) #define SCRWIDTH(x,y,w,h) (h) +#define FIRSTSHA(x,y,w,h) (((y) + (h) - 1) * shaStride + (x)) #define STEPDOWN(x,y,w,h) ((w)--) -#define SCRY(x,y,w,h) (x) -#define SHASTEPX(stride) -(stride) -#define SHASTEPY(stride) 1 #define NEXTY(x,y,w,h) ((x)++) -#endif +#define SHASTEPX(stride) -(stride) +#define SHASTEPY(stride) (1) -#if ROTATE == COUNTERCLOCKWISE -#define FIRSTSHA(x,y,w,h) ((y) * shaStride + (x)) +#elif ROTATE == 90 + #define SCRLEFT(x,y,w,h) (y) +#define SCRY(x,y,w,h) (pScreen->width - ((x) + (w)) - 1) #define SCRWIDTH(x,y,w,h) (h) +#define FIRSTSHA(x,y,w,h) ((y) * shaStride + (x + w - 1)) #define STEPDOWN(x,y,w,h) ((w)--) -#define SCRY(x,y,w,h) (pScreen->width - (x) - 1) +#define NEXTY(x,y,w,h) ((void)(x)) #define SHASTEPX(stride) (stride) -#define SHASTEPY(stride) -1 -#define NEXTY(x,y,w,h) ((x)--) -#endif +#define SHASTEPY(stride) (-1) + +#elif ROTATE == 180 -#if ROTATE == UPSIDEDOWN -#define FIRSTSHA(x,y,w,h) (((y) + (h) - 1) * shaStride + (x) + (w) - 1) #define SCRLEFT(x,y,w,h) (pScreen->width - ((x) + (w))) +#define SCRY(x,y,w,h) (pScreen->height - ((y) + (h)) - 1) #define SCRWIDTH(x,y,w,h) (w) +#define FIRSTSHA(x,y,w,h) ((y + h - 1) * shaStride + (x + w - 1)) #define STEPDOWN(x,y,w,h) ((h)--) -#define SCRY(x,y,w,h) (pScreen->height - (y) - 1) +#define NEXTY(x,y,w,h) ((void)(y)) #define SHASTEPX(stride) (-1) #define SHASTEPY(stride) -(stride) -#define NEXTY(x,y,w,h) ((y)--) + +#else + +#define SCRLEFT(x,y,w,h) (x) +#define SCRY(x,y,w,h) (y) +#define SCRWIDTH(x,y,w,h) (w) +#define FIRSTSHA(x,y,w,h) ((y) * shaStride + (x)) +#define STEPDOWN(x,y,w,h) ((h)--) +#define NEXTY(x,y,w,h) ((y)++) +#define SHASTEPX(stride) (1) +#define SHASTEPY(stride) (stride) + #endif void -FUNC (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) +FUNC (ScreenPtr pScreen, + shadowBufPtr pBuf) { - shadowScrPriv(pScreen); + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; int nbox = REGION_NUM_RECTS (damage); BoxPtr pbox = REGION_RECTS (damage); FbBits *shaBits; @@ -88,63 +101,82 @@ FbStride shaStride; int scrBase, scrLine, scr; int shaBpp; + int shaXoff, shaYoff; /* XXX assumed to be zero */ int x, y, w, h, width; int i; - Data *winBase, *winLine, *win; + Data *winBase = NULL, *win; CARD32 winSize; - int plane; - fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp); + fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); shaBase = (Data *) shaBits; shaStride = shaStride * sizeof (FbBits) / sizeof (Data); +#if (DANDEBUG > 1) + ErrorF ("-> Entering Shadow Update:\r\n |- Origins: pShadow=%x, pScreen=%x, damage=%x\r\n |- Metrics: shaStride=%d, shaBase=%x, shaBpp=%d\r\n | \n", pShadow, pScreen, damage, shaStride, shaBase, shaBpp); +#endif while (nbox--) { - x = pbox->x1; - y = pbox->y1; - w = (pbox->x2 - pbox->x1); - h = pbox->y2 - pbox->y1; - - - scrLine = SCRLEFT(x,y,w,h); - shaLine = shaBase + FIRSTSHA(x,y,w,h); - - while (STEPDOWN(x,y,w,h)) - { - winSize = 0; - scrBase = 0; - width = SCRWIDTH(x,y,w,h); - scr = scrLine; - sha = shaLine; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (Data *) (*pScrPriv->window) (pScreen, - SCRY(x,y,w,h), - scr * sizeof (Data), - SHADOW_WINDOW_WRITE, - &winSize); - if(!winBase) - return; - scrBase = scr; - winSize /= sizeof (Data); - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; - while (i--) - { - *win++ = *sha; - sha += SHASTEPX(shaStride); - } - } - shaLine += SHASTEPY(shaStride); - NEXTY(x,y,w,h); - } - pbox++; - } + x = pbox->x1; + y = pbox->y1; + w = (pbox->x2 - pbox->x1); + h = pbox->y2 - pbox->y1; + +#if (DANDEBUG > 2) + ErrorF (" |-> Redrawing box - Metrics: X=%d, Y=%d, Width=%d, Height=%d\n", x, y, w, h); +#endif + scrLine = SCRLEFT(x,y,w,h); + shaLine = shaBase + FIRSTSHA(x,y,w,h); + + while (STEPDOWN(x,y,w,h)) + { + winSize = 0; + scrBase = 0; + width = SCRWIDTH(x,y,w,h); + scr = scrLine; + sha = shaLine; +#if (DANDEBUG > 3) + ErrorF (" | |-> StepDown - Metrics: width=%d, scr=%x, sha=%x\n", width, scr, sha); +#endif + while (width) + { + /* how much remains in this window */ + i = scrBase + winSize - scr; + if (i <= 0 || scr < scrBase) + { + winBase = (Data *) (*pBuf->window) (pScreen, + SCRY(x,y,w,h), + scr * sizeof (Data), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if(!winBase) + return; + scrBase = scr; + winSize /= sizeof (Data); + i = winSize; +#if(DANDEBUG > 4) + ErrorF (" | | |-> Starting New Line - Metrics: winBase=%x, scrBase=%x, winSize=%d\r\n | | | Xstride=%d, Ystride=%d, w=%d h=%d\n", winBase, scrBase, winSize, SHASTEPX(shaStride), SHASTEPY(shaStride), w, h); +#endif + } + win = winBase + (scr - scrBase); + if (i > width) + i = width; + width -= i; + scr += i; +#if(DANDEBUG > 5) + ErrorF (" | | |-> Writing Line - Metrics: win=%x, sha=%x\n", win, sha); +#endif + while (i--) + { +#if(DANDEBUG > 6) + ErrorF (" | | |-> Writing Pixel - Metrics: win=%x, sha=%d, remaining=%d\n", win, sha, i); +#endif + *win++ = *sha; + sha += SHASTEPX(shaStride); + } /* i */ + } /* width */ + shaLine += SHASTEPY(shaStride); + NEXTY(x,y,w,h); + } /* STEPDOWN */ + pbox++; + } /* nbox */ } Index: xc/programs/Xserver/os/Imakefile diff -u xc/programs/Xserver/os/Imakefile:3.31 xc/programs/Xserver/os/Imakefile:3.34 --- xc/programs/Xserver/os/Imakefile:3.31 Mon Apr 23 12:17:12 2001 +++ xc/programs/Xserver/os/Imakefile Sat Oct 27 23:34:16 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.31 2001/04/23 16:17:12 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.34 2001/10/28 03:34:16 tsi Exp $ #include <Server.tmpl> @@ -16,11 +16,6 @@ #define OtherObjects hpsocket.o #endif -#ifdef AmoebaArchitecture -#define OtherSources iopreader.c -#define OtherObjects iopreader.o -#endif - /* * do not modify the following two definitions */ @@ -114,9 +109,14 @@ #if HasPam && HasPamMisc PAM_DEFINES = -DUSE_PAM #endif - DEFINES = -DXSERV_t -DTRANS_SERVER $(CONNECTION_FLAGS) $(MEM_DEFINES) $(XDMAUTHDEFS) $(RPCDEFS) $(SIGNAL_DEFINES) $(OS_DEFINES) $(KRB5_DEFINES) $(RGB_DEFINES) - INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(TOP)/lib/Xau -I../lbx Krb5Includes - DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) $(TRANS_INCLUDES) $(CONNECTION_FLAGS) DependDefines + 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$(SERVERSRC)/Xext -I$(FONTINCSRC) \ + -I$(TOP)/lib/Xau -I../lbx Krb5Includes + DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) \ + $(TRANS_INCLUDES) $(CONNECTION_FLAGS) DependDefines LINTLIBS = ../dix/llib-ldix.ln #ifdef NEED_ALLOCA_FROM_LIBPW Index: xc/programs/Xserver/os/WaitFor.c diff -u xc/programs/Xserver/os/WaitFor.c:3.30 xc/programs/Xserver/os/WaitFor.c:3.37 --- xc/programs/Xserver/os/WaitFor.c:3.30 Fri Apr 27 08:51:07 2001 +++ xc/programs/Xserver/os/WaitFor.c Fri Dec 14 15:00:33 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.30 2001/04/27 12:51:07 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.37 2001/12/14 20:00:33 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ ******************************************************************/ -/* $Xorg: WaitFor.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ +/* $Xorg: WaitFor.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */ /***************************************************************** * OS Dependent input routines: @@ -56,20 +60,11 @@ #include <X11/Xwinsock.h> #endif #include "Xos.h" /* for strings, fcntl, time */ - #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - #include <stdio.h> #include "X.h" #include "misc.h" -#ifdef MINIX -#include <sys/nbio.h> -#define select(n,r,w,x,t) nbio_select(n,r,w,x,t) -#endif #ifdef __EMX__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif @@ -77,6 +72,9 @@ #include <X11/Xpoll.h> #include "dixstruct.h" #include "opaque.h" +#ifdef DPMSExtension +#include "dpmsproc.h" +#endif /* modifications by raphael */ int @@ -97,7 +95,6 @@ #ifdef DPMSExtension #define DPMS_SERVER #include "dpms.h" -extern void DPMSSet(); #endif #ifdef XTESTEXT1 @@ -114,7 +111,7 @@ pointer arg; }; -static void DoTimer(); +static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); static OsTimerPtr timers; /***************** @@ -136,17 +133,15 @@ static INT32 timeTilFrob = 0; /* while screen saving */ -#if !defined(AMOEBA) - int WaitForSomething(pClientsReady) int *pClientsReady; { int i; struct timeval waittime, *wt; - INT32 timeout; + INT32 timeout = 0; #ifdef DPMSExtension - INT32 standbyTimeout, suspendTimeout, offTimeout; + INT32 standbyTimeout = 0, suspendTimeout = 0, offTimeout = 0; #endif fd_set clientsReadable; fd_set clientsWritable; @@ -154,10 +149,9 @@ int selecterr; int nready; fd_set devicesReadable; - CARD32 now; + CARD32 now = 0; #ifdef SMART_SCHEDULE Bool someReady = FALSE; - extern Bool SmartScheduleIdle; #endif FD_ZERO(&clientsReadable); @@ -204,7 +198,7 @@ wt = NULL; if (timers) { - while (timers && timers->expires <= now) + while (timers && (int) (timers->expires - now) <= 0) DoTimer(timers, now, &timers); if (timers) { @@ -286,7 +280,7 @@ timeout = offTimeout; } #endif - if (timeout > 0 && (!wt || timeout < (timers->expires - now))) + if (timeout > 0 && (!wt || timeout < (int) (timers->expires - now))) { waittime.tv_sec = timeout / MILLI_PER_SECOND; waittime.tv_usec = (timeout % MILLI_PER_SECOND) * @@ -365,10 +359,6 @@ #ifdef SMART_SCHEDULE if (i >= 0) { - extern unsigned long SmartScheduleIdleCount; - extern Bool SmartScheduleTimerStopped; - extern Bool SmartScheduleStartTimer(void); - SmartScheduleIdle = FALSE; SmartScheduleIdleCount = 0; if (SmartScheduleTimerStopped) @@ -412,7 +402,7 @@ if (timers) { now = GetTimeInMillis(); - while (timers && timers->expires <= now) + while (timers && (int) (timers->expires - now) <= 0) DoTimer(timers, now, &timers); } if (*checkForInput[0] != *checkForInput[1]) @@ -455,7 +445,7 @@ #ifndef WIN32 for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++) { - int highest_priority; + int highest_priority = 0; while (clientsReadable.fds_bits[i]) { @@ -465,7 +455,7 @@ client_index = /* raphael: modified */ ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))]; #else - int highest_priority; + int highest_priority = 0; fd_set savedClientsReadable; XFD_COPYSET(&clientsReadable, &savedClientsReadable); for (i = 0; i < XFD_SETCOUNT(&savedClientsReadable); i++) @@ -533,173 +523,9 @@ } #endif -#else /* AMOEBA */ - -#define dbprintf(list) /* printf list */ - -int -WaitForSomething(pClientsReady) - int *pClientsReady; -{ - register int i, wt, nt; - struct timeval *wtp; - HWEventQueueType alwaysCheckForInput[2]; - int nready; - int timeout; - unsigned long now; - - WakeupInitWaiters(); - - /* Be sure to check for input on every sweep in the dispatcher. - * This routine should be in InitInput, but since this is more - * or less a device dependent routine, and the semantics of it - * are device independent I decided to put it here. - */ - alwaysCheckForInput[0] = 0; - alwaysCheckForInput[1] = 1; - SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]); - - while (1) { - /* deal with any blocked jobs */ - if (workQueue) - ProcessWorkQueue(); - - if (ANYSET(ClientsWithInput)) { - FdSet clientsReadable; - int highest_priority; - - COPYBITS(ClientsWithInput, clientsReadable); - dbprintf(("WaitFor: ")); - nready = 0; - for (i=0; i < mskcnt; i++) { - while (clientsReadable[i]) { - int client_priority, curclient, client_index; - - curclient = ffs (clientsReadable[i]) - 1; - client_index = ConnectionTranslation[curclient + (i * (sizeof(fd_mask)*8))]; - dbprintf(("%d has input\n", curclient)); -#ifdef XSYNC - client_priority = clients[client_index]->priority; - if (nready == 0 || client_priority > highest_priority) - { - pClientsReady[0] = client_index; - highest_priority = client_priority; - nready = 1; - } - else if (client_priority == highest_priority) -#endif - { - pClientsReady[nready++] = client_index; - } - clientsReadable[i] &= ~(((FdMask)1L) << curclient); - } - } - break; - } - - wt = -1; - now = GetTimeInMillis(); - if (timers) - { - while (timers && timers->expires <= now) - DoTimer(timers, now, &timers); - if (timers) - { - timeout = timers->expires - now; - wt = timeout; - } - } - if (ScreenSaverTime) { - timeout = ScreenSaverTime - TimeSinceLastInputEvent(); - if (timeout <= 0) { /* may be forced by AutoResetServer() */ - long timeSinceSave; - timeSinceSave = -timeout; - if ((timeSinceSave >= timeTilFrob) && (timeTilFrob >= 0)) { - SaveScreens(SCREEN_SAVER_ON, ScreenSaverActive); - if (ScreenSaverInterval) - /* round up to the next ScreenSaverInterval */ - timeTilFrob = ScreenSaverInterval * - ((timeSinceSave + ScreenSaverInterval) / - ScreenSaverInterval); - else - timeTilFrob = -1; - } - timeout = timeTilFrob - timeSinceSave; - } else { - if (timeout > ScreenSaverTime) - timeout = ScreenSaverTime; - timeTilFrob = 0; - } - - if (wt < 0 || (timeTilFrob >= 0 && wt > timeout)) { - wt = timeout; - } - } - - /* Check for new clients. We do this here and not in the listener - * threads because we cannot be sure that dix is re-entrant, and - * we need to call some dix routines during startup. - */ - if (nNewConns) { - QueueWorkProc(EstablishNewConnections, NULL, - (pointer) 0); - } - - /* Call device dependent block handlers, which may want to - * specify a different timeout (e.g. used for key auto-repeat). - */ - wtp = (struct timeval *) NULL; - BlockHandler((pointer)&wtp, (pointer)NULL); - if (wtp) wt = (wtp->tv_sec * 1000) + (wtp->tv_usec / 1000); - - if (NewOutputPending) - FlushAllOutput(); - - /* TODO: XTESTEXT1 */ - - nready = AmFindReadyClients(pClientsReady, AllSockets); - - /* If we found some work, or the iop server has us informed about - * new device events, we return. - */ - if (nready || AmoebaEventsAvailable()) - break; - - if (dispatchException) - return 0; - - /* Nothing interesting is available. Go to sleep with a timeout. - * The other threads will wake us when needed. - */ - i = SleepMainThread(wt); - - /* Wake up any of the sleeping handlers */ - WakeupHandler((unsigned long)0, (pointer)NULL); - - /* TODO: XTESTEXT1 */ - - if (dispatchException) - return 0; - - if (i == -1) { - /* An error or timeout occurred */ - return 0; - } - } - - dbprintf(("WaitForSomething: %d clients ready\n", nready)); - return nready; -} - -#endif /* AMOEBA */ - - static void -DoTimer(timer, now, prev) - register OsTimerPtr timer; - CARD32 now; - OsTimerPtr *prev; +DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev) { CARD32 newTime; @@ -755,7 +581,7 @@ return timer; } for (prev = &timers; - *prev && millis > (*prev)->expires; + *prev && (int) ((*prev)->expires - millis) <= 0; prev = &(*prev)->next) ; timer->next = *prev; @@ -768,7 +594,6 @@ register OsTimerPtr timer; { register OsTimerPtr *prev; - register CARD32 newTime; for (prev = &timers; *prev; prev = &(*prev)->next) { @@ -815,7 +640,7 @@ { register CARD32 now = GetTimeInMillis(); - while (timers && timers->expires <= now) + while (timers && (int) (timers->expires - now) <= 0) DoTimer(timers, now, &timers); } @@ -824,7 +649,7 @@ { OsTimerPtr timer; - while (timer = timers) + while ((timer = timers)) { timers = timer->next; xfree(timer); Index: xc/programs/Xserver/os/access.c diff -u xc/programs/Xserver/os/access.c:3.32 xc/programs/Xserver/os/access.c:3.39 --- xc/programs/Xserver/os/access.c:3.32 Wed Jan 17 17:37:10 2001 +++ xc/programs/Xserver/os/access.c Mon Jan 7 15:38:29 2002 @@ -1,9 +1,13 @@ -/* $Xorg: access.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ +/* $Xorg: access.c,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/access.c,v 3.32 2001/01/17 22:37:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/access.c,v 3.39 2002/01/07 20:38:29 dawes Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> @@ -57,36 +61,12 @@ #include <errno.h> #include <sys/types.h> #ifndef WIN32 -#if !defined(AMOEBA) && !defined(MINIX) -#ifdef ESIX -#include <lan/socket.h> -#else #ifndef Lynx #include <sys/socket.h> #else #include <socket.h> #endif -#endif #include <sys/ioctl.h> -#else -#ifdef AMOEBA -#define port am_port_t -#include <amoeba.h> -#include <cmdreg.h> -#include <stdcom.h> -#include <stderr.h> -#include <ampolicy.h> -#include <server/ip/hton.h> -#include <server/ip/types.h> -#include <server/ip/tcpip.h> -#include <server/ip/tcp_io.h> -#include <server/ip/gen/in.h> -#include <server/ip/gen/tcp.h> -#include <server/ip/gen/tcp_io.h> -#include <server/ip/gen/socket.h> -#undef port -#endif -#endif /* AMOEBA || MINIX */ #include <ctype.h> #if defined(TCPCONN) || defined(STREAMSCONN) || defined(ISC) || defined(SCO) @@ -112,14 +92,13 @@ #endif -#if !defined(AMOEBA) -#if defined(hpux) || defined(__QNXNTO__) +#if defined(hpux) || defined(QNX4) # include <sys/utsname.h> # ifdef HAS_IFREQ # include <net/if.h> # endif #else -#if defined(SVR4) || (defined(SYSV) && defined(i386)) || defined(MINIX) || defined(__GNU__) +#if defined(SVR4) || (defined(SYSV) && defined(i386)) || defined(__GNU__) # include <sys/utsname.h> #endif #if defined(SYSV) && defined(i386) @@ -129,20 +108,13 @@ # include <sys/sioctl.h> # endif /* ISC */ #endif -#ifdef ESIX -# include <lan/if.h> -#else #ifdef __GNU__ #undef SIOCGIFCONF #include <netdb.h> #else /*!__GNU__*/ -#ifndef MINIX # include <net/if.h> -#endif #endif /*__GNU__ */ -#endif #endif /* hpux */ -#endif /* !AMOEBA */ #ifdef SVR4 #ifndef SCO @@ -151,22 +123,7 @@ #include <sys/stropts.h> #endif -#ifdef ESIX -#include <lan/netdb.h> -#else -#if !defined(AMOEBA) && !defined(MINIX) #include <netdb.h> -#else -#ifdef AMOEBA -#include <server/ip/gen/netdb.h> -#endif -#ifdef MINIX -#include <net/hton.h> -#include <net/gen/netdb.h> -#define INADDR_BROADCAST 0xFFFFFFFF -#endif -#endif /* AMOEBA || MINIX */ -#endif /* ESIX */ #ifdef CSRG_BASED #include <sys/param.h> @@ -198,6 +155,9 @@ #endif #endif +#define X_INCLUDE_NETDB_H +#include <X11/Xos_r.h> + #include "dixstruct.h" #include "osdep.h" @@ -494,7 +454,7 @@ #else /* WINTCP */ -#if !defined(SIOCGIFCONF) || (defined (hpux) && ! defined (HAS_IFREQ)) || defined(__QNXNTO__) +#if !defined(SIOCGIFCONF) || (defined (hpux) && ! defined (HAS_IFREQ)) || defined(QNX4) void DefineSelf (int fd) { @@ -517,14 +477,26 @@ struct sockaddr_in *inetaddr; struct sockaddr_in broad_addr; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif /* Why not use gethostname()? Well, at least on my system, I've had to * make an ugly kernel patch to get a name longer than 8 characters, and * uname() lets me access to the whole string (it smashes release, you * see), whereas gethostname() kindly truncates it for me. */ +#ifndef QNX4 uname(&name); - hp = gethostbyname (name.nodename); +#else + /* QNX4's uname returns node number in name.nodename, not the hostname + have to overwrite it */ + char hname[1024]; + gethostname(hname, 1024); + name.nodename = hname; +#endif + + hp = _XGethostbyname(name.nodename, hparams); if (hp != NULL) { saddr.sa.sa_family = hp->h_addrtype; @@ -817,7 +789,6 @@ FILE *fd; char *ptr; int i, hostlen; -#ifndef AMOEBA union { struct sockaddr sa; #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN) @@ -827,7 +798,6 @@ struct sockaddr_dn dn; #endif } saddr; -#endif /* AMOEBA */ #ifdef DNETCONN struct nodeent *np; struct dn_naddr dnaddr, *dnaddrp, *dnet_addr(); @@ -959,10 +929,14 @@ #endif /* SECURE_RPC */ #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN) { +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif + /* host name */ - if ((family == FamilyInternet - && ((hp = gethostbyname (hostname)) != 0)) - || ((hp = gethostbyname (hostname)) != 0)) + if ((family == FamilyInternet && + ((hp = _XGethostbyname(hostname, hparams)) != 0)) || + ((hp = _XGethostbyname(hostname, hparams)) != 0)) { saddr.sa.sa_family = hp->h_addrtype; len = sizeof(saddr.sa); @@ -1257,11 +1231,7 @@ { #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN) || defined(MNX_TCPCONN) case FamilyInternet: -#if !defined(AMOEBA) if (length == sizeof (struct in_addr)) -#else - if (length == sizeof(ipaddr_t)) -#endif len = length; else len = -1; @@ -1293,11 +1263,7 @@ int InvalidHost ( -#ifndef AMOEBA_ORIG register struct sockaddr *saddr, -#else - register ipaddr_t *saddr, -#endif int len) { int family; @@ -1340,15 +1306,10 @@ static int ConvertAddr ( -#ifndef AMOEBA_ORIG register struct sockaddr *saddr, -#else - register ipaddr_t *saddr, -#endif int *len, pointer *addr) { -#ifndef AMOEBA if (*len == 0) return (FamilyLocal); switch (saddr->sa_family) @@ -1383,12 +1344,6 @@ default: return -1; } -#else /* AMOEBA */ - if (*len == 0) return -1; - *len = sizeof (ipaddr_t); - *addr = (pointer) saddr; - return FamilyInternet; -#endif /* AMOEBA */ } int Index: xc/programs/Xserver/os/auth.c diff -u xc/programs/Xserver/os/auth.c:1.6 xc/programs/Xserver/os/auth.c:1.10 --- xc/programs/Xserver/os/auth.c:1.6 Wed Jan 17 17:37:10 2001 +++ xc/programs/Xserver/os/auth.c Fri Dec 14 15:00:33 2001 @@ -1,9 +1,13 @@ -/* $Xorg: auth.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ +/* $Xorg: auth.c,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.6 2001/01/17 22:37:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.10 2001/12/14 20:00:33 dawes Exp $ */ /* * authorization hooks for the server @@ -32,8 +36,8 @@ #ifdef K5AUTH # include <krb5/krb5.h> #endif -# include "X.h" -# include "Xauth.h" +# include <X11/X.h> +# include <X11/Xauth.h> # include "misc.h" # include "osdep.h" # include "dixstruct.h" @@ -204,8 +208,10 @@ if (!authorization_file || stat(authorization_file, &buf)) { - lastmod = 0; - ShouldLoadAuth = TRUE; /* stat lost, so force reload */ + if (lastmod != 0) { + lastmod = 0; + ShouldLoadAuth = TRUE; /* stat lost, so force reload */ + } } else if (buf.st_mtime > lastmod) { @@ -219,14 +225,16 @@ else EnableLocalHost (); } - if (name_length) + if (name_length) { for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0) { return (*protocols[i].Check) (data_length, data, client, reason); } + *reason = "Protocol not supported by server\n"; } + } else *reason = "No protocol specified\n"; return (XID) ~0L; } Index: xc/programs/Xserver/os/connection.c diff -u xc/programs/Xserver/os/connection.c:3.46 xc/programs/Xserver/os/connection.c:3.55 --- xc/programs/Xserver/os/connection.c:3.46 Fri Apr 27 08:51:07 2001 +++ xc/programs/Xserver/os/connection.c Fri Dec 14 15:00:33 2001 @@ -1,9 +1,13 @@ -/* $Xorg: connection.c,v 1.5 2000/08/17 19:53:40 cpqbld Exp $ */ +/* $Xorg: connection.c,v 1.6 2001/02/09 02:05:23 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.46 2001/04/27 12:51:07 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.55 2001/12/14 20:00:33 dawes Exp $ */ /***************************************************************** * Stuff to create connections --- OS dependent * @@ -66,15 +70,11 @@ #include "Xproto.h" #include <X11/Xtrans.h> #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - #include <signal.h> #include <stdio.h> #ifndef WIN32 -#if defined(MINIX) || defined(Lynx) +#if defined(Lynx) #include <socket.h> #else #include <sys/socket.h> @@ -101,12 +101,6 @@ #include <sys/ioctl.h> #endif -#ifdef MINIX -#include <sys/nbio.h> - -#define select(n,r,w,x,t) nbio_select(n,r,w,x,t) -#endif - #ifdef __EMX__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) extern __const__ int _nfiles; @@ -137,7 +131,7 @@ #include <server/ip/gen/inet.h> #endif -#if !defined(AMOEBA) && !defined(_MINIX) && !defined(__EMX__) +#if !defined(__EMX__) #ifndef Lynx #include <sys/uio.h> #else @@ -173,7 +167,6 @@ #include <netdnet/dn.h> #endif /* DNETCONN */ -extern char *display; /* The display number */ int lastfdesc; /* maximum file descriptor */ fd_set WellKnownConnections; /* Listener mask */ @@ -217,8 +210,6 @@ int *ListenTransFds = NULL; int ListenTransCount; -extern int auditTrailLevel; - static void ErrorConnMax( #if NeedFunctionPrototypes XtransConnInfo /* trans_conn */ @@ -240,7 +231,6 @@ #ifdef LBX extern int LbxFlushClient(); -extern void LbxCloseClient(); #endif /* LBX */ static XtransConnInfo @@ -258,10 +248,6 @@ return (NULL); } -#ifdef XDMCP -void XdmcpOpenDisplay(), XdmcpInit(), XdmcpReset(), XdmcpCloseDisplay(); -#endif - /* Set MaxClients and lastfdesc, and allocate ConnectionTranslation */ void @@ -269,6 +255,8 @@ { lastfdesc = -1; +#ifndef __CYGWIN__ + #ifndef __EMX__ #if !defined(XNO_SYSCONF) && defined(_SC_OPEN_MAX) @@ -289,6 +277,8 @@ lastfdesc = _nfiles - 1; #endif +#endif /* __CYGWIN__ */ + /* This is the fallback */ if (lastfdesc < 0) lastfdesc = MAXSOCKS; @@ -324,7 +314,7 @@ void CreateWellKnownSockets() { - int request, i; + int i; int partial; char port[20]; @@ -406,7 +396,7 @@ RunFromSmartParent = TRUE; ParentProcess = getppid (); if (RunFromSmartParent) { - if (ParentProcess > 0) { + if (ParentProcess > 1) { kill (ParentProcess, SIGUSR1); } } @@ -464,7 +454,7 @@ */ #if !defined(WIN32) if (RunFromSmartParent) { - if (ParentProcess > 0) { + if (ParentProcess > 1) { kill (ParentProcess, SIGUSR1); } } @@ -592,7 +582,7 @@ char *reason = NULL; XtransConnInfo trans_conn; int restore_trans_conn = 0; - ClientPtr lbxpc; + ClientPtr lbxpc = NULL; priv = (OsCommPtr)client->osPrivate; trans_conn = priv->trans_conn; @@ -871,7 +861,6 @@ register OsCommPtr oc; fd_set tmask; -#ifndef AMOEBA XFD_ANDSET (&tmask, (fd_set*)closure, &WellKnownConnections); XFD_COPYSET(&tmask, &readyconnections); if (!XFD_ANYSET(&readyconnections)) @@ -880,21 +869,15 @@ /* kill off stragglers */ for (i=1; i<currentMaxClients; i++) { - if (client = clients[i]) + if ((client = clients[i])) { oc = (OsCommPtr)(client->osPrivate); - if (oc && (oc->conn_time != 0) && - (connect_time - oc->conn_time) >= TimeOutValue || - client->noClientException != Success && !client->clientGone) + if ((oc && (oc->conn_time != 0) && + (connect_time - oc->conn_time) >= TimeOutValue) || + (client->noClientException != Success && !client->clientGone)) CloseDownClient(client); } } -#else /* AMOEBA */ - /* EstablishNewConnections is only called when there is one new - * connection waiting on the first transport. - */ - readyconnections = 1; -#endif /* AMOEBA */ #ifndef WIN32 for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) { @@ -966,7 +949,6 @@ struct iovec iov[3]; char byteOrder = 0; int whichbyte = 1; -#ifndef AMOEBA struct timeval waittime; fd_set mask; @@ -977,7 +959,6 @@ FD_ZERO(&mask); FD_SET(fd, &mask); (void)Select(fd + 1, &mask, NULL, NULL, &waittime); -#endif /* try to read the byte-order of the connection */ (void)_XSERVTransRead(trans_conn, &byteOrder, 1); if ((byteOrder == 'l') || (byteOrder == 'B')) @@ -1028,11 +1009,11 @@ _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); } -#ifdef LBX - ConnectionTranslation[connection] = 0; -#else +#ifndef LBX FreeOsBuffers(oc); + xfree(oc); #endif + ConnectionTranslation[connection] = 0; FD_CLR(connection, &AllSockets); FD_CLR(connection, &AllClients); FD_CLR(connection, &ClientsWithInput); @@ -1047,9 +1028,6 @@ if (!XFD_ANYSET(&ClientsWriteBlocked)) AnyClientsWriteBlocked = FALSE; FD_CLR(connection, &OutputPending); -#ifndef LBX - xfree(oc); -#endif } /***************** @@ -1076,7 +1054,6 @@ fd_set savedAllClients; #endif -#ifndef AMOEBA notime.tv_sec = 0; notime.tv_usec = 0; @@ -1108,7 +1085,6 @@ CloseDownClient(clients[ConnectionTranslation[curclient]]); } #endif -#endif } @@ -1140,7 +1116,7 @@ AuditF("client %d disconnected\n", client->index); } - +void AddEnabledDevice(fd) int fd; { @@ -1150,7 +1126,7 @@ FD_SET(fd, &SavedAllSockets); } - +void RemoveEnabledDevice(fd) int fd; { @@ -1170,6 +1146,7 @@ * This routine is "undone" by ListenToAllClients() *****************/ +void OnlyListenToOneClient(client) ClientPtr client; { @@ -1202,6 +1179,7 @@ * Undoes OnlyListentToOneClient() ****************/ +void ListenToAllClients() { if (GrabInProgress) @@ -1219,6 +1197,7 @@ * Must have cooresponding call to AttendClient. ****************/ +void IgnoreClient (client) ClientPtr client; { @@ -1263,6 +1242,7 @@ * Adds one client back into the input masks. ****************/ +void AttendClient (client) ClientPtr client; { @@ -1296,6 +1276,7 @@ /* make client impervious to grabs; assume only executing client calls this */ +void MakeClientGrabImpervious(client) ClientPtr client; { @@ -1315,6 +1296,7 @@ /* make client pervious to grabs; assume only executing client calls this */ +void MakeClientGrabPervious(client) ClientPtr client; { Index: xc/programs/Xserver/os/decompress.c diff -u xc/programs/Xserver/os/decompress.c:1.4 xc/programs/Xserver/os/decompress.c:1.7 --- xc/programs/Xserver/os/decompress.c:1.4 Wed Jan 17 17:37:10 2001 +++ xc/programs/Xserver/os/decompress.c Fri Dec 14 15:00:34 2001 @@ -1,9 +1,13 @@ -/* $Xorg: decompress.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ +/* $Xorg: decompress.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/decompress.c,v 1.4 2001/01/17 22:37:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/decompress.c,v 1.7 2001/12/14 20:00:34 dawes Exp $ */ /* * decompress - cat a compressed file @@ -190,6 +194,7 @@ #define getdcchar(file) ((file)->stackp > (file)->de_stack ? (*--((file)->stackp)) : _filldcbuf (file)) +int _filldcbuf (file) CompressedFile *file; { @@ -337,6 +342,7 @@ return code; } +int CompressedFontFileRead (buf, itemsize, nitems, fid) char *buf; unsigned itemsize; @@ -359,11 +365,12 @@ return nitems - nbytes / itemsize; } +int CompressedFontFileSkip (bytes, fid) unsigned bytes; FID fid; { - int c; + int c = 0; while (bytes-- && ((c = getdcchar((CompressedFile *)fid)) != EOF)) ; Index: xc/programs/Xserver/os/hpsocket.c diff -u xc/programs/Xserver/os/hpsocket.c:1.1.1.3 xc/programs/Xserver/os/hpsocket.c:1.2 --- xc/programs/Xserver/os/hpsocket.c:1.1.1.3 Tue Jan 16 17:44:55 2001 +++ xc/programs/Xserver/os/hpsocket.c Fri Dec 14 15:00:34 2001 @@ -1,9 +1,13 @@ -/* $Xorg: hpsocket.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ +/* $Xorg: hpsocket.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/os/io.c diff -u xc/programs/Xserver/os/io.c:3.26 xc/programs/Xserver/os/io.c:3.32 --- xc/programs/Xserver/os/io.c:3.26 Fri Apr 27 08:51:07 2001 +++ xc/programs/Xserver/os/io.c Fri Dec 14 15:00:34 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: io.c,v 1.4 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: io.c,v 1.6 2001/02/09 02:05:23 xorgcvs Exp $ */ /***************************************************************** * i/o functions * @@ -48,19 +52,16 @@ * InsertFakeRequest, ResetCurrentRequest * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/os/io.c,v 3.26 2001/04/27 12:51:07 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/os/io.c,v 3.32 2001/12/14 20:00:34 dawes Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> #endif #include <stdio.h> #include <X11/Xtrans.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #include "Xmd.h" #include <errno.h> -#if !defined(AMOEBA) && !defined(MINIX) && !defined(__EMX__) && !defined(WIN32) +#if !defined(__EMX__) && !defined(WIN32) #ifndef Lynx #include <sys/uio.h> #else @@ -251,7 +252,7 @@ if (!oci) { - if (oci = FreeInputs) + if ((oci = FreeInputs)) { FreeInputs = oci->next; } @@ -543,7 +544,7 @@ } if (!oci) { - if (oci = FreeInputs) + if ((oci = FreeInputs)) FreeInputs = oci->next; else if (!(oci = AllocateInputBuffer())) return FALSE; @@ -588,6 +589,7 @@ * **********************/ +void ResetCurrentRequest(client) ClientPtr client; { @@ -597,7 +599,6 @@ register xReq *request; int gotnow, needed; #ifdef LBX - Bool part; LbxClientPtr lbxClient = LbxClient(client); if (lbxClient) { @@ -916,7 +917,7 @@ if (!oco) { - if (oco = FreeOutputs) + if ((oco = FreeOutputs)) { FreeOutputs = oco->next; } @@ -969,8 +970,10 @@ if (oco->count + count + padBytes > oco->size) { FD_CLR(oc->fd, &OutputPending); - CriticalOutputPending = FALSE; - NewOutputPending = FALSE; + if(!XFD_ANYSET(&OutputPending)) { + CriticalOutputPending = FALSE; + NewOutputPending = FALSE; + } return FlushClient(who, oc, buf, count); } @@ -1232,7 +1235,7 @@ if (AvailableInput == oc) AvailableInput = (OsCommPtr)NULL; - if (oci = oc->input) + if ((oci = oc->input)) { if (FreeInputs) { @@ -1248,7 +1251,7 @@ oci->lenLastReq = 0; } } - if (oco = oc->output) + if ((oco = oc->output)) { if (FreeOutputs) { @@ -1263,7 +1266,7 @@ } } #ifdef LBX - if (oci = oc->largereq) { + if ((oci = oc->largereq)) { xfree(oci->buffer); xfree(oci); } @@ -1276,13 +1279,13 @@ register ConnectionInputPtr oci; register ConnectionOutputPtr oco; - while (oci = FreeInputs) + while ((oci = FreeInputs)) { FreeInputs = oci->next; xfree(oci->buffer); xfree(oci); } - while (oco = FreeOutputs) + while ((oco = FreeOutputs)) { FreeOutputs = oco->next; xfree(oco->buf); Index: xc/programs/Xserver/os/iopreader.c diff -u xc/programs/Xserver/os/iopreader.c:1.1.1.2 xc/programs/Xserver/os/iopreader.c:removed --- xc/programs/Xserver/os/iopreader.c:1.1.1.2 Tue Jan 16 17:44:56 2001 +++ xc/programs/Xserver/os/iopreader.c Fri Jan 18 15:26:52 2002 @@ -1,179 +0,0 @@ -/* $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. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * and the Vrije Universiteit make no representations about - * the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - */ - -#ifdef AMOEBA -/* - * iopreader.c - * - */ -#define port am_port_t -#include <amoeba.h> -#include <ampolicy.h> -#include <cmdreg.h> -#include <stdcom.h> -#include <stderr.h> -#include <server/iop/iop.h> -#undef port - -#include "osdep.h" - -#define DEVREADER_STACK 8000 -#define MAXEVENTQUEUE 32 - -capability iopcap; - -static mutex lock; -static semaphore empty, filled; - -static IOPEvent event_queue[MAXEVENTQUEUE]; -static int event_qin, event_qout; - -void IOPCleanUp(); -static void IOPServerReader(); - -/* - * Initialize the IOP server - */ -void -InitializeIOPServerReader() -{ - capability hostcap; - errstat err; - - /* - * Initialize event queue - */ - event_qin = event_qout = 0; - sema_init(&empty, MAXEVENTQUEUE); - sema_init(&filled, 0); - mu_init(&lock); - - /* - * Get IOP capability, and enable the server - */ - if (XServerHostName == NULL) - FatalError("No hostname, no screen\n"); - - if ((err = host_lookup(XServerHostName, &hostcap)) != STD_OK || - (err = dir_lookup(&hostcap, DEF_IOPSVRNAME, &iopcap)) != STD_OK) - { - FatalError("Cannot find IOP server for %s: %s\n", - XServerHostName, err_why(err)); - } - - /* - * Enable IOP server - */ - if ((err = iop_enable(&iopcap)) != STD_OK) - FatalError("iop_enable failed (%s)\n", err_why(err)); - - /* - * Start IOP reader thread - */ - atexit(IOPCleanUp); - if (thread_newthread(IOPServerReader, DEVREADER_STACK, 0, 0) <= 0) - FatalError("Cannot start IOP reader thread\n"); -} - -/* - * IOP clean up, actuall disable the IOP server. Its the IOP's own choice - * what do do (perhaps restore the screen?). - */ -void -IOPCleanUp() -{ - errstat err; - - if ((err = iop_disable(&iopcap)) != STD_OK) - ErrorF("iop_disable failed (%s)\n", err_why(err)); -} - -/* - * This threads polls the IOP server for events. Once an event (or a - * number of events) are read, they are queued up using a traditional - * producer/consumer approach. - */ -static void -IOPServerReader() -{ - IOPEvent queue[MAXEVENTQUEUE-1]; - int nevents, i; - errstat err; - - WaitForInitialization(); - -#ifdef XDEBUG - if (amDebug) ErrorF("IOPServerReader() running ...\n"); -#endif - - for (;;) { - do { - nevents = MAXEVENTQUEUE - 1; - err = iop_getevents(&iopcap, queue, &nevents); - if (err != STD_OK) { - if (err != RPC_FAILURE) { - ErrorF("iop_getevents failed (%s)\n", err_why(err)); - } - nevents = 0; - } - } while (nevents <= 0); - - /* store event(s) in the global event queue */ - sema_mdown(&empty, nevents); - mu_lock(&lock); - for (i = 0; i < nevents; i++) { - event_queue[event_qin] = queue[i]; - event_qin = (event_qin + 1) % MAXEVENTQUEUE; - } - mu_unlock(&lock); - sema_mup(&filled, nevents); - WakeUpMainThread(); - } -} - -/* - * Return the number of IOP events waiting - */ -int -AmoebaEventsAvailable() -{ - return sema_level(&filled); -} - -/* - * Get the IOP events from the queue. ``size'' is the maximum the - * requestor cares to handle, the actual size read is returned as - * result. - */ -int -AmoebaGetEvents(queue, size) - IOPEvent *queue; - int size; -{ - int nevents, i; - - if (sema_level(&filled) <= 0) return 0; - if ((nevents = sema_level(&filled)) > size) - nevents = size; - sema_mdown(&filled, nevents); - mu_lock(&lock); - for (i = 0; i < nevents; i++) { - queue[i] = event_queue[event_qout]; - event_qout = (event_qout + 1) % MAXEVENTQUEUE; - } - mu_unlock(&lock); - sema_mup(&empty, nevents); - return nevents; -} -#endif /* AMOEBA */ Index: xc/programs/Xserver/os/k5auth.c diff -u xc/programs/Xserver/os/k5auth.c:3.4 xc/programs/Xserver/os/k5auth.c:3.5 --- xc/programs/Xserver/os/k5auth.c:3.4 Wed Jan 17 17:37:10 2001 +++ xc/programs/Xserver/os/k5auth.c Fri Dec 14 15:00:34 2001 @@ -1,9 +1,13 @@ -/* $Xorg: k5auth.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: k5auth.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/k5auth.c,v 3.4 2001/01/17 22:37:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/k5auth.c,v 3.5 2001/12/14 20:00:34 dawes Exp $ */ /* * Kerberos V5 authentication scheme Index: xc/programs/Xserver/os/lbxio.c diff -u xc/programs/Xserver/os/lbxio.c:3.12 xc/programs/Xserver/os/lbxio.c:3.16 --- xc/programs/Xserver/os/lbxio.c:3.12 Wed Jan 17 17:37:10 2001 +++ xc/programs/Xserver/os/lbxio.c Fri Dec 14 15:00:34 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.12 2001/01/17 22:37:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.16 2001/12/14 20:00:34 dawes Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,13 +47,10 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: lbxio.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: lbxio.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ #include <stdio.h> #include <X11/Xtrans.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #include "Xmd.h" #include <errno.h> #ifndef Lynx @@ -158,7 +159,7 @@ if (!oci) { - if (oci = FreeInputs) + if ((oci = FreeInputs)) FreeInputs = oci->next; else if (!(oci = AllocateInputBuffer())) return FALSE; @@ -280,7 +281,7 @@ int n; if (!noco || (noco->size - noco->count) < sz_xLbxSwitchEvent) { - if (noco = FreeOutputs) + if ((noco = FreeOutputs)) FreeOutputs = noco->next; else noco = AllocateOutputBuffer(); @@ -326,7 +327,7 @@ ConnectionOutputPtr oco; int len; - if (oco = oc->output) { + if ((oco = oc->output)) { oc->output = NULL; if (!LbxAppendOutput(oc->proxy, client, oco)) return -1; @@ -379,7 +380,7 @@ if (!lbxClient) continue; coc = (OsCommPtr)lbxClient->client->osPrivate; - if (oco = coc->output) { + if ((oco = coc->output)) { coc->output = NULL; LbxAppendOutput(proxy, lbxClient->client, oco); } @@ -396,7 +397,7 @@ LbxProxyPtr proxy; ConnectionOutputPtr oco; int n; - XtransConnInfo trans_conn; + XtransConnInfo trans_conn = NULL; if (extraBuf) return LbxClientOutput(who, oc, extraBuf, extraCount, FALSE); @@ -406,7 +407,7 @@ LbxForceOutput(proxy); if (!proxy->compHandle) trans_conn = ((OsCommPtr)LbxProxyClient(proxy)->osPrivate)->trans_conn; - while (oco = proxy->ofirst) { + while ((oco = proxy->ofirst)) { /* XXX bundle up into writev someday */ if (proxy->compHandle) { if (oco->nocompress) @@ -466,12 +467,13 @@ return LbxClientOutput(who, (OsCommPtr)who->osPrivate, buf, count, TRUE); } +void LbxFreeOsBuffers(proxy) LbxProxyPtr proxy; { ConnectionOutputPtr oco; - while (oco = proxy->ofirst) { + while ((oco = proxy->ofirst)) { proxy->ofirst = oco->next; xfree(oco->buf); xfree(oco); @@ -487,7 +489,7 @@ register ConnectionInputPtr oci; if (!(oci = oc->largereq)) { - if (oci = FreeInputs) + if ((oci = FreeInputs)) FreeInputs = oci->next; else { oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput)); Index: xc/programs/Xserver/os/mitauth.c diff -u xc/programs/Xserver/os/mitauth.c:1.4 xc/programs/Xserver/os/mitauth.c:1.5 --- xc/programs/Xserver/os/mitauth.c:1.4 Wed Jan 17 17:37:11 2001 +++ xc/programs/Xserver/os/mitauth.c Fri Dec 14 15:00:34 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mitauth.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: mitauth.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/mitauth.c,v 1.4 2001/01/17 22:37:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/mitauth.c,v 1.5 2001/12/14 20:00:34 dawes Exp $ */ /* * MIT-MAGIC-COOKIE-1 authorization scheme Index: xc/programs/Xserver/os/oscolor.c diff -u xc/programs/Xserver/os/oscolor.c:3.5 xc/programs/Xserver/os/oscolor.c:3.7 --- xc/programs/Xserver/os/oscolor.c:3.5 Wed Jan 17 17:37:11 2001 +++ xc/programs/Xserver/os/oscolor.c Fri Dec 14 15:00:35 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.5 2001/01/17 22:37:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.7 2001/12/14 20:00:35 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: oscolor.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: oscolor.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ #ifndef USE_RGB_TXT @@ -172,7 +176,7 @@ Bool create; { unsigned int h = 0, g; - dbEntryPtr entry, *prev; + dbEntryPtr entry, *prev = NULL; char *str = name; if (!(name = (char*)ALLOCATE_LOCAL(len +1))) return NULL; @@ -186,7 +190,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; @@ -251,7 +255,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; @@ -286,7 +290,7 @@ { dbEntryPtr entry; - if (entry = lookup(name, len, FALSE)) + if ((entry = lookup(name, len, FALSE))) { *pred = entry->red; *pgreen = entry->green; Index: xc/programs/Xserver/os/osdep.h diff -u xc/programs/Xserver/os/osdep.h:3.11 xc/programs/Xserver/os/osdep.h:3.16 --- xc/programs/Xserver/os/osdep.h:3.11 Wed Jan 17 17:37:11 2001 +++ xc/programs/Xserver/os/osdep.h Fri Dec 14 15:00:35 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.11 2001/01/17 22:37:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.16 2001/12/14 20:00:35 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,27 +45,11 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: osdep.h,v 1.4 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: osdep.h,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */ #ifndef _OSDEP_H_ #define _OSDEP_H_ 1 -#ifdef AMOEBA -#include <stddef.h> -#define port am_port_t -#include <amoeba.h> -#include <stdio.h> -#include <assert.h> -#include <semaphore.h> -#include <circbuf.h> -#include <exception.h> -#include <vc.h> -#include <fault.h> -#include <module/signals.h> -#include <server/x11/Xamoeba.h> -#undef port -#endif - #define BOTIMEOUT 200 /* in milliseconds */ #define BUFSIZE 4096 #define BUFWATERMARK 8192 @@ -130,22 +118,8 @@ #if !defined(hpux) && !defined(SVR4) && !defined(SYSV) #define HAS_GETDTABLESIZE #endif - -#ifndef NULL -#define NULL 0 -#endif -#ifdef AMOEBA -#include "X.h" -#include "misc.h" - -#define FamilyAmoeba 33 - -extern char *XServerHostName; /* X server host name */ -extern char *XTcpServerName; /* TCP/IP server name */ -extern int maxClient; /* Highest client# */ -extern int nNewConns; /* # of new clients */ -#endif /* AMOEBA */ +#include <stddef.h> typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); @@ -186,6 +160,9 @@ struct _osComm; +#define AuthInitArgs void +typedef void (*AuthInitFunc) (AuthInitArgs); + #define AuthAddCArgs unsigned short data_length, char *data, XID id typedef int (*AuthAddCFunc) (AuthAddCArgs); @@ -308,6 +285,7 @@ /* in rpcauth.c */ #ifdef SECURE_RPC +extern void SecureRPCInit (AuthInitArgs); extern XID SecureRPCCheck (AuthCheckArgs); extern XID SecureRPCToID (AuthToIDArgs); extern int SecureRPCAdd (AuthAddCArgs); @@ -355,8 +333,7 @@ extern int XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type); extern int XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data); -#if 0 +struct sockaddr_in; extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr); -#endif #endif /* _OSDEP_H_ */ Index: xc/programs/Xserver/os/osinit.c diff -u xc/programs/Xserver/os/osinit.c:3.22 xc/programs/Xserver/os/osinit.c:3.25 --- xc/programs/Xserver/os/osinit.c:3.22 Fri May 11 04:16:55 2001 +++ xc/programs/Xserver/os/osinit.c Fri Dec 14 15:00:35 2001 @@ -1,9 +1,13 @@ -/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.22 2001/05/11 08:16:55 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.25 2001/12/14 20:00:35 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $Xorg: osinit.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: osinit.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ #include <stdio.h> #include "X.h" @@ -61,11 +65,11 @@ #endif #endif -#if defined(Lynx) +#if defined(Lynx) || defined(SCO) || defined(SCO325) #include <sys/wait.h> #endif -#if !defined(SYSV) && !defined(AMOEBA) && !defined(_MINIX) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4) +#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4) #include <sys/resource.h> #endif @@ -93,7 +97,6 @@ void OsInit() { -#ifndef AMOEBA static Bool been_here = FALSE; static char* admpath = ADMPATH; static char* devnull = "/dev/null"; @@ -107,7 +110,7 @@ #ifdef XFree86LOADER xf86WrapperInit(); #endif -#if !defined(MINIX) && !defined(SCO) +#if !defined(SCO) fclose(stdin); fclose(stdout); #endif @@ -135,7 +138,7 @@ dup2 (fileno (err), 2); fclose (err); } -#if defined(SYSV) || defined(SVR4) || defined(MINIX) || defined(__EMX__) || defined(WIN32) || defined(__CYGWIN__) +#if defined(SYSV) || defined(SVR4) || defined(__EMX__) || defined(WIN32) || defined(__CYGWIN__) { static char buf[BUFSIZ]; setvbuf (stderr, buf, _IOLBF, BUFSIZ); @@ -209,7 +212,6 @@ #endif been_here = TRUE; } -#endif /* AMOEBA */ TimerInit(); #ifdef DDXOSINIT OsVendorInit(); Index: xc/programs/Xserver/os/rpcauth.c diff -u xc/programs/Xserver/os/rpcauth.c:3.4 xc/programs/Xserver/os/rpcauth.c:3.7 --- xc/programs/Xserver/os/rpcauth.c:3.4 Tue Jan 30 17:06:21 2001 +++ xc/programs/Xserver/os/rpcauth.c Fri Dec 14 15:00:35 2001 @@ -1,9 +1,13 @@ -/* $Xorg: rpcauth.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: rpcauth.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ /* Copyright 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/rpcauth.c,v 3.4 2001/01/30 22:06:21 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/os/rpcauth.c,v 3.7 2001/12/14 20:00:35 dawes Exp $ */ /* * SUN-DES-1 authentication mechanism @@ -40,6 +44,11 @@ #include <rpc/rpc.h> +#ifdef sun +/* <rpc/auth.h> only includes this if _KERNEL is #defined... */ +extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *); +#endif + #if defined(DGUX) #include <time.h> #include <rpc/auth_des.h> @@ -153,8 +162,8 @@ return (XID) ~0L; } - -SecureRPCInit () +void +SecureRPCInit (void) { if (rpc_id == ~0L) AddAuthorization (9, "SUN-DES-1", 0, (char *) 0); @@ -169,12 +178,14 @@ if (data_length) AddHost ((pointer) 0, FamilyNetname, data_length, data); rpc_id = id; + return 1; } int -SecureRPCReset () +SecureRPCReset (void) { rpc_id = (XID) ~0L; + return 1; } XID @@ -185,6 +196,7 @@ return rpc_id; } +int SecureRPCFromID (id, data_lenp, datap) XID id; unsigned short *data_lenp; @@ -193,6 +205,7 @@ return 0; } +int SecureRPCRemove (data_length, data) unsigned short data_length; char *data; Index: xc/programs/Xserver/os/secauth.c diff -u xc/programs/Xserver/os/secauth.c:1.9 xc/programs/Xserver/os/secauth.c:1.11 --- xc/programs/Xserver/os/secauth.c:1.9 Wed Jan 17 17:37:12 2001 +++ xc/programs/Xserver/os/secauth.c Fri Dec 14 15:00:35 2001 @@ -1,8 +1,12 @@ -/* $Xorg: secauth.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: secauth.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -20,12 +24,13 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/secauth.c,v 1.9 2001/01/17 22:37:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/secauth.c,v 1.11 2001/12/14 20:00:35 dawes Exp $ */ #include "X.h" #include "os.h" #include "osdep.h" #include "dixstruct.h" +#include "swaprep.h" #ifdef XCSECURITY #define _SECURITY_SERVER Index: xc/programs/Xserver/os/utils.c diff -u xc/programs/Xserver/os/utils.c:3.69 xc/programs/Xserver/os/utils.c:3.81 --- xc/programs/Xserver/os/utils.c:3.69 Fri May 4 15:05:52 2001 +++ xc/programs/Xserver/os/utils.c Wed Jan 16 15:39:51 2002 @@ -1,9 +1,13 @@ -/* $Xorg: utils.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ +/* $Xorg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -45,7 +49,8 @@ OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.69 2001/05/04 19:05:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.81 2002/01/16 20:39:51 dawes Exp $ */ + #ifdef __CYGWIN__ #include <stdlib.h> #include <signal.h> @@ -59,6 +64,8 @@ #include "misc.h" #include "X.h" #include "input.h" +#include "dixfont.h" +#include "osdep.h" #ifdef X_POSIX_C_SOURCE #define _POSIX_C_SOURCE X_POSIX_C_SOURCE #include <signal.h> @@ -73,39 +80,20 @@ #endif #endif #include <sys/wait.h> -#if !defined(SYSV) && !defined(AMOEBA) && !defined(_MINIX) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4) +#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4) #include <sys/resource.h> #endif #include <time.h> #include <sys/stat.h> #include <ctype.h> /* for isspace */ -#if NeedVarargsPrototypes #include <stdarg.h> -#endif #if defined(DGUX) #include <sys/resource.h> #include <netdb.h> #endif -#ifdef AMOEBA -#include "osdep.h" -#include <amoeba.h> -#include <module/mutex.h> - -static mutex print_lock; -#endif - -#if defined(__STDC__) || defined(AMOEBA) -/* DHD: SVR4.0 has a prototype for abs() in stdlib.h */ -/* DHD: might be better to move this include higher up? */ -#ifdef abs -#undef abs -#endif -#ifndef NOSTDHDRS #include <stdlib.h> /* for malloc() */ -#endif -#endif #if defined(TCPCONN) || defined(STREAMSCONN) # ifndef WIN32 @@ -119,8 +107,18 @@ #include "dixstruct.h" #endif +#ifdef XKB +#include "XKBsrv.h" +#endif +#ifdef XCSECURITY +#define _SECURITY_SERVER +#include "security.h" +#endif + +#define X_INCLUDE_NETDB_H +#include <X11/Xos_r.h> + #include <errno.h> -extern int errno; Bool CoreDump; Bool noTestExtensions; @@ -155,10 +153,8 @@ #ifdef MEMBUG #define MEM_FAIL_SCALE 100000 long Memory_fail = 0; -#ifndef X_NOT_STDC_ENV #include <stdlib.h> /* for random() */ #endif -#endif #ifdef sgi int userdefinedfontpath = 0; @@ -209,10 +205,6 @@ #include <sys/param.h> #endif -#ifdef _MINIX -#include <limits.h> /* For PATH_MAX */ -#endif - #ifdef __EMX__ #define link rename #endif @@ -245,7 +237,6 @@ void LockServer() { -#ifndef AMOEBA char tmp[PATH_MAX], pid_str[12]; int lfd, i, haslock, l_pid, t; char *tmppath = NULL; @@ -300,7 +291,7 @@ } if (lfd < 0) FatalError("Could not create lock file in %s\n", tmp); - (void) sprintf(pid_str, "%10d\n", getpid()); + (void) sprintf(pid_str, "%10ld\n", (long)getpid()); (void) write(lfd, pid_str, 11); #ifndef __EMX__ #ifndef USE_CHMOD @@ -374,7 +365,6 @@ if (!haslock) FatalError("Could not create server lock file: %s\n", LockFile); StillLocking = FALSE; -#endif /* !AMOEBA */ } /* @@ -384,7 +374,6 @@ void UnlockServer() { -#ifndef AMOEBA if (nolock) return; if (!StillLocking){ @@ -394,8 +383,6 @@ #endif /* __EMX__ */ (void) unlink(LockFile); } -#endif - } #endif /* SERVER_LOCK */ @@ -406,6 +393,8 @@ AutoResetServer (sig) int sig; { + int olderrno = errno; + dispatchException |= DE_RESET; isItTimeToYield = TRUE; #ifdef GPROF @@ -414,10 +403,8 @@ #endif #if defined(SYSV) && defined(X_NOT_POSIX) OsSignal (SIGHUP, AutoResetServer); -#endif -#ifdef AMOEBA - WakeUpMainThread(); #endif + errno = olderrno; } /* Force connections to close and then exit on SIGTERM, SIGINT */ @@ -427,15 +414,15 @@ GiveUp(sig) int sig; { + int olderrno = errno; + dispatchException |= DE_TERMINATE; isItTimeToYield = TRUE; #if defined(SYSV) && defined(X_NOT_POSIX) if (sig) OsSignal(sig, SIG_IGN); #endif -#ifdef AMOEBA - WakeUpMainThread(); -#endif + errno = olderrno; } #if __GNUC__ @@ -448,9 +435,6 @@ OsCleanup(); AbortDDX(); fflush(stderr); -#ifdef AMOEBA - IOPCleanUp(); -#endif if (CoreDump) abort(); exit (1); @@ -460,27 +444,17 @@ Error(str) char *str; { -#ifdef AMOEBA - mu_lock(&print_lock); -#endif perror(str); -#ifdef AMOEBA - mu_unlock(&print_lock); -#endif } #ifndef DDXTIME CARD32 GetTimeInMillis() { -#ifndef AMOEBA struct timeval tp; X_GETTIMEOFDAY(&tp); return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); -#else - return sys_milli(); -#endif } #endif @@ -513,11 +487,7 @@ void UseMsg() { #if !defined(AIXrt) && !defined(AIX386) -#ifndef AMOEBA ErrorF("use: X [:<display>] [option]\n"); -#else - ErrorF("use: X [[<host>]:<display>] [option]\n"); -#endif ErrorF("-a # mouse acceleration (pixels)\n"); ErrorF("-ac disable access control restrictions\n"); #ifdef MEMBUG @@ -576,9 +546,6 @@ #endif ErrorF("-su disable any save under support\n"); ErrorF("-t # mouse threshold (pixels)\n"); -#ifdef AMOEBA - ErrorF("-tcp capability specify TCP/IP server capability\n"); -#endif ErrorF("-terminate terminate at server reset\n"); ErrorF("-to # connection time out\n"); ErrorF("-tst disable testing extensions\n"); @@ -632,10 +599,6 @@ { int i, skip; -#ifdef AMOEBA - mu_init(&print_lock); -#endif - defaultKeyboardControl.autoRepeat = TRUE; #ifdef PART_NET @@ -660,27 +623,6 @@ exit(1); } } -#ifdef AMOEBA - else if (strchr(argv[i], ':') != NULL) { - char *p; - - XServerHostName = argv[i]; - if ((p = strchr(argv[i], ':')) != NULL) { - *p++ = '\0'; - display = p; - if( ! VerifyDisplayName( display ) ) { - ErrorF("Bad display name: %s\n", display); - UseMsg(); - exit(1); - } - } - } else if (strcmp( argv[i], "-tcp") == 0) { - if (++i < argc) - XTcpServerName = argv[i]; - else - UseMsg(); - } -#endif /* AMOEBA */ else if ( strcmp( argv[i], "-a") == 0) { if(++i < argc) @@ -1163,9 +1105,12 @@ char hname[1024], *hnameptr; struct hostent *host; int len; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif gethostname(hname, 1024); - host = gethostbyname(hname); + host = _XGethostbyname(hname, hparams); if (host == NULL) hnameptr = hname; else @@ -1208,9 +1153,6 @@ Xalloc (amount) unsigned long amount; { -#if !defined(__STDC__) && !defined(AMOEBA) - char *malloc(); -#endif register pointer ptr; if ((long)amount <= 0) { @@ -1240,9 +1182,6 @@ XNFalloc (amount) unsigned long amount; { -#if !defined(__STDC__) && !defined(AMOEBA) - char *malloc(); -#endif register pointer ptr; if ((long)amount <= 0) @@ -1302,11 +1241,6 @@ register pointer ptr; unsigned long amount; { -#if !defined(__STDC__) && !defined(AMOEBA) - char *malloc(); - char *realloc(); -#endif - #ifdef MEMBUG if (!Must_have_memory && Memory_fail && ((random() % MEM_FAIL_SCALE) < Memory_fail)) @@ -1408,13 +1342,9 @@ void AuditPrefix(f) - char *f; + const char *f; { -#ifdef X_NOT_STDC_ENV - long tm; -#else time_t tm; -#endif char *autime, *s; if (*f != ' ') { @@ -1430,46 +1360,22 @@ } } -/*VARARGS1*/ void -AuditF( -#if NeedVarargsPrototypes - const char * f, ...) -#else - f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ - char *f; - char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; -#endif +AuditF(const char * f, ...) { -#if NeedVarargsPrototypes va_list args; -#endif AuditPrefix(f); -#if NeedVarargsPrototypes va_start(args, f); VErrorF(f, args); va_end(args); -#else - ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); -#endif } -/*VARARGS1*/ void -FatalError( -#if NeedVarargsPrototypes - const char *f, ...) -#else -f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ - const char *f; - char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; -#endif +FatalError(const char *f, ...) { -#if NeedVarargsPrototypes va_list args; -#endif static Bool beenhere = FALSE; if (beenhere) @@ -1477,13 +1383,9 @@ else ErrorF("\nFatal server error:\n"); -#if NeedVarargsPrototypes va_start(args, f); VErrorF(f, args); va_end(args); -#else - ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); -#endif ErrorF("\n"); #ifdef DDXOSFATALERROR if (!beenhere) @@ -1500,7 +1402,6 @@ /*NOTREACHED*/ } -#if NeedVarargsPrototypes void VErrorF(f, args) const char *f; @@ -1532,38 +1433,14 @@ AbortServer(); /*NOTREACHED*/ } -#endif /* NeedVarargsPrototypes */ -/*VARARGS1*/ void -ErrorF( -#if NeedVarargsPrototypes - const char * f, ...) -#else - f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ - char *f; - char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; -#endif +ErrorF(const char * f, ...) { -#if NeedVarargsPrototypes va_list args; va_start(args, f); VErrorF(f, args); va_end(args); -#else -#ifdef AIXV3 - if (SyncOn) - sync(); -#else /* not AIXV3 */ -#ifdef AMOEBA - mu_lock(&print_lock); -#endif - fprintf( stderr, f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); -#ifdef AMOEBA - mu_unlock(&print_lock); -#endif -#endif /* AIXV3 */ -#endif } #ifdef SMART_SCHEDULE @@ -1616,11 +1493,14 @@ void SmartScheduleTimer (int sig) { + int olderrno = errno; + SmartScheduleTime += SmartScheduleInterval; if (SmartScheduleIdle) { SmartScheduleStopTimer (); } + errno = olderrno; } #endif @@ -1629,7 +1509,6 @@ { #ifdef SMART_SCHEDULE_POSSIBLE struct sigaction act; - struct itimerval timer; if (SmartScheduleDisable) return TRUE; @@ -1717,6 +1596,9 @@ * all privs before running a command. * * This is based on the code in FreeBSD 2.2 libc. + * + * XXX It'd be good to redirect stderr so that it ends up in the log file + * as well. As it is now, xkbcomp messages don't end up in the log file. */ int @@ -1898,6 +1780,17 @@ #define REMOVE_LONG_ENV 1 #endif +/* + * Disallow stdout or stderr as pipes? It's possible to block the X server + * when piping stdout+stderr to a pipe. + * + * Don't enable this because it looks like it's going to cause problems. + */ +#ifndef NO_OUTPUT_PIPES +#define NO_OUTPUT_PIPES 0 +#endif + + /* Check args and env only if running setuid (euid == 0 && euid != uid) ? */ #ifndef CHECK_EUID #define CHECK_EUID 1 @@ -1928,6 +1821,7 @@ ArgTooLong, UnprintableArg, EnvTooLong, + OutputIsPipe, InternalError }; @@ -2032,6 +1926,16 @@ } } } +#if NO_OUTPUT_PIPES + if (!bad) { + struct stat buf; + + if (fstat(fileno(stdout), &buf) == 0 && S_ISFIFO(buf.st_mode)) + bad = OutputIsPipe; + if (fstat(fileno(stderr), &buf) == 0 && S_ISFIFO(buf.st_mode)) + bad = OutputIsPipe; + } +#endif } switch (bad) { case NotBad: @@ -2052,6 +1956,9 @@ case EnvTooLong: ErrorF("Environment variable `%s' is too long\n", e); ErrorF(ENVMSG); + break; + case OutputIsPipe: + ErrorF("Stdout and/or stderr is a pipe\n"); break; case InternalError: ErrorF("Internal Error\n"); Index: xc/programs/Xserver/os/xalloc.c diff -u xc/programs/Xserver/os/xalloc.c:3.28 xc/programs/Xserver/os/xalloc.c:3.32 --- xc/programs/Xserver/os/xalloc.c:3.28 Tue Nov 14 13:20:38 2000 +++ xc/programs/Xserver/os/xalloc.c Wed Oct 10 15:06:37 2001 @@ -25,22 +25,14 @@ Pascal Haible. */ -/* $XFree86: xc/programs/Xserver/os/xalloc.c,v 3.28 2000/11/14 18:20:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/xalloc.c,v 3.32 2001/10/10 19:06:37 herrb Exp $ */ /* Only used if INTERNAL_MALLOC is defined * - otherwise xalloc() in utils.c is used */ #ifdef INTERNAL_MALLOC -#if defined(__STDC__) || defined(AMOEBA) -#ifndef NOSTDHDRS #include <stdlib.h> /* for malloc() etc. */ -#endif -#else -extern char *malloc(); -extern char *calloc(); -extern char *realloc(); -#endif #include "Xos.h" #include "misc.h" @@ -187,7 +179,9 @@ #endif #if defined(__alpha__) || defined(__alpha) || \ - defined(__ia64__) || defined(ia64) + defined(__ia64__) || defined(ia64) || \ + defined(__sparc64__) || \ + defined(__s390x__) #define MAGIC 0x1404196414071968 #define MAGIC_FREE 0x1506196615061966 #define MAGIC2 0x2515207525182079 @@ -298,9 +292,6 @@ #ifdef MMAP_DEV_ZERO static int devzerofd = -1; #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #endif /* @@ -342,7 +333,8 @@ defined(__mips__) || \ defined(__powerpc__) || \ defined(__arm32__) || \ - defined(__ia64__) || defined(ia64) + defined(__ia64__) || defined(ia64) || \ + defined(__s390x__) || defined(__s390__) amount = (amount + (sizeof(long)-1)) & ~(sizeof(long)-1); #endif Index: xc/programs/Xserver/os/xdmauth.c diff -u xc/programs/Xserver/os/xdmauth.c:1.4 xc/programs/Xserver/os/xdmauth.c:1.6 --- xc/programs/Xserver/os/xdmauth.c:1.4 Wed Jan 17 17:37:13 2001 +++ xc/programs/Xserver/os/xdmauth.c Fri Dec 14 15:00:35 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xdmauth.c,v 1.3 2000/08/17 19:53:42 cpqbld Exp $ */ +/* $Xorg: xdmauth.c,v 1.4 2001/02/09 02:05:24 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,6 +26,7 @@ from The Open Group. */ +/* $XFree86: xc/programs/Xserver/os/xdmauth.c,v 1.6 2001/12/14 20:00:35 dawes Exp $ */ /* * XDM-AUTHENTICATION-1 (XDMCP authentication) and @@ -411,7 +416,7 @@ } int -XdmResetCookie () +XdmResetCookie (void) { XdmAuthorizationPtr auth, next_auth; XdmClientAuthPtr client, next_client; Index: xc/programs/Xserver/os/xdmcp.c diff -u xc/programs/Xserver/os/xdmcp.c:3.15 xc/programs/Xserver/os/xdmcp.c:3.20 --- xc/programs/Xserver/os/xdmcp.c:3.15 Tue May 1 03:53:47 2001 +++ xc/programs/Xserver/os/xdmcp.c Mon Nov 19 15:44:18 2001 @@ -1,4 +1,4 @@ -/* $Xorg: xdmcp.c,v 1.3 2000/08/17 19:53:42 cpqbld Exp $ */ +/* $Xorg: xdmcp.c,v 1.4 2001/01/31 13:37:19 pookie Exp $ */ /* * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. * @@ -13,7 +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 $ */ +/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.20 2001/11/19 20:44:18 tsi Exp $ */ #ifdef WIN32 /* avoid conflicting definitions */ @@ -31,7 +31,7 @@ #include "Xos.h" -#if !defined(MINIX) && !defined(WIN32) +#if !defined(WIN32) #ifndef Lynx #include <sys/param.h> #include <sys/socket.h> @@ -40,17 +40,8 @@ #endif #include <netinet/in.h> #include <netdb.h> -#else -#if defined(MINIX) -#include <net/hton.h> -#include <net/netlib.h> -#include <net/gen/netdb.h> -#include <net/gen/udp.h> -#include <net/gen/udp_io.h> -#include <sys/nbio.h> -#include <sys/ioctl.h> -#endif #endif + #include <stdio.h> #include "X.h" #include "Xmd.h" @@ -74,11 +65,11 @@ #ifdef XDMCP #undef REQUEST -#include "Xdmcp.h" +#include <X11/Xdmcp.h> + +#define X_INCLUDE_NETDB_H +#include <X11/Xos_r.h> -extern char *display; -extern fd_set EnabledDevices; -extern fd_set AllClients; extern char *defaultDisplayClass; static int xdmcpSocket, sessionSocket; @@ -257,15 +248,6 @@ #endif ); -#ifdef MINIX -static void read_cb( -#if NeedFunctionPrototypes - nbio_ref_t /*ref*/, - int /*res*/, - int /*err*/ -#endif -); -#endif static short xdm_udp_port = XDM_UDP_PORT; static Bool OneSession = FALSE; @@ -1021,51 +1003,9 @@ freenetconfigent(nconf); #else -#ifndef _MINIX int soopts = 1; if ((xdmcpSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) -#else /* MINIX */ - char *udp_device; - int r, s_errno; - nwio_udpopt_t udpopt; - nbio_ref_t ref; - - udp_device= getenv("UDP_DEVICE"); - if (udp_device == NULL) - udp_device= UDP_DEVICE; - xdmcpSocket= open(udp_device, O_RDWR); - if (xdmcpSocket != -1) - { - udpopt.nwuo_flags= NWUO_COPY | NWUO_LP_SEL | NWUO_EN_LOC | - NWUO_DI_BROAD | NWUO_RP_ANY | NWUO_RA_ANY | NWUO_RWDATALL | - NWUO_DI_IPOPT; - r= ioctl(xdmcpSocket, NWIOSUDPOPT, &udpopt); - if (r == -1) - { - s_errno= errno; - close(xdmcpSocket); - xdmcpSocket= -1; - errno= s_errno; - } - ioctl(xdmcpSocket, NWIOGUDPOPT, &udpopt); - ErrorF("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", - udpopt.nwuo_flags, - udpopt.nwuo_locport, - udpopt.nwuo_remport, - udpopt.nwuo_locaddr, - udpopt.nwuo_remaddr); - } - if (xdmcpSocket != -1) - { - fcntl(xdmcpSocket, F_SETFD, fcntl(xdmcpSocket, F_GETFD) | - FD_ASYNCHIO); - nbio_register(xdmcpSocket); - ref.ref_int= xdmcpSocket; - nbio_setcallback(xdmcpSocket, ASIO_READ, read_cb, ref); - } - if (xdmcpSocket == -1) -#endif /* !MINIX */ XdmcpWarning("UDP socket creation failed"); #ifdef SO_BROADCAST else if (setsockopt(xdmcpSocket, SOL_SOCKET, SO_BROADCAST, (char *)&soopts, @@ -1423,22 +1363,21 @@ int i) { struct hostent *hep; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif if (i == argc) { ErrorF("Xserver: missing host name in command line\n"); exit(1); } - if (!(hep = gethostbyname(argv[i]))) + if (!(hep = _XGethostbyname(argv[i], hparams))) { ErrorF("Xserver: unknown host: %s\n", argv[i]); exit(1); } -#ifndef _MINIX if (hep->h_length == sizeof (struct in_addr)) -#else - if (hep->h_length == sizeof (ipaddr_t)) -#endif { memmove(&ManagerAddress.sin_addr, hep->h_addr, hep->h_length); #ifdef BSD44SOCKETS @@ -1461,22 +1400,21 @@ int i) { struct hostent *hep; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif if (i == argc) { ErrorF("Xserver: missing -from host name in command line\n"); exit(1); } - if (!(hep = gethostbyname(argv[i]))) + if (!(hep = _XGethostbyname(argv[i], hparams))) { ErrorF("Xserver: unknown host: %s\n", argv[i]); exit(1); } -#ifndef _MINIX if (hep->h_length == sizeof (struct in_addr)) -#else - if (hep->h_length == sizeof (ipaddr_t)) -#endif { memset(&FromAddress, 0, sizeof(FromAddress)); memmove(&FromAddress.sin_addr, hep->h_addr, hep->h_length); @@ -1493,65 +1431,6 @@ } xdm_from = argv[i]; } - -#ifdef MINIX -static char read_buffer[XDM_MAX_MSGLEN+sizeof(udp_io_hdr_t)]; -static int read_inprogress; -static int read_size; - -int -XdmcpFill ( -int fd, -XdmcpBufferPtr buffer, -XdmcpNetaddr from, /* return */ -int *fromlen) /* return */ -{ - int r; - - if (read_inprogress) - return 0; - - if (read_size != 0) - { - r= read_size; - read_size= 0; - return MNX_XdmcpFill(fd, buffer, from, fromlen, read_buffer, - r); - } - - r= read(fd, read_buffer, sizeof(read_buffer)); - if (r > 0) - { - return MNX_XdmcpFill(fd, buffer, from, fromlen, read_buffer, - r); - } - else if (r == -1 && errno == EINPROGRESS) - { - read_inprogress= 1; - nbio_inprogress(fd, ASIO_READ, 1 /* read */, 0 /* write */, - 0 /* except */); - return 0; - } - else - FatalError("XdmcpFill: read failed: %s\n", - r == 0 ? "EOF" : strerror(errno)); - return 0; -} - -static void read_cb(ref, res, err) -nbio_ref_t ref; -int res; -int err; -{ - if (res <= 0) - { - FatalError("xdmcp'read_cb: read failed: %s\n", - res == 0 ? "EOF" : strerror(err)); - } - read_inprogress= 0; - read_size= res; -} -#endif #else static int xdmcp_non_empty; /* avoid complaint by ranlib */ Index: xc/programs/Xserver/randr/Imakefile diff -u /dev/null xc/programs/Xserver/randr/Imakefile:1.1 --- /dev/null Fri Jan 18 15:26:52 2002 +++ xc/programs/Xserver/randr/Imakefile Tue May 22 23:29:44 2001 @@ -0,0 +1,18 @@ +XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $ +#include <Server.tmpl> + + SRCS = randr.c mirandr.c + + OBJS = randr.o mirandr.o + + INCLUDES = -I../include -I../mi -I../../../include/fonts \ + -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + -I$(FONTINCSRC) + LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln + +NormalLibraryTarget(randr,$(OBJS)) +NormalLibraryObjectRule() +LintLibraryTarget(randr,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() Index: xc/programs/Xserver/randr/mirandr.c diff -u /dev/null xc/programs/Xserver/randr/mirandr.c:1.5 --- /dev/null Fri Jan 18 15:26:52 2002 +++ xc/programs/Xserver/randr/mirandr.c Mon Jun 4 05:45:40 2001 @@ -0,0 +1,125 @@ +/* + * $XFree86: xc/programs/Xserver/randr/mirandr.c,v 1.5 2001/06/04 09:45:40 keithp Exp $ + * + * Copyright © 2001 Compaq Computer 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 name of Compaq not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Compaq makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * COMPAQ 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. + * + * Author: Jim Gettys, Compaq Computer Corporation + */ + +#include "scrnintstr.h" +#include "mi.h" +#include "randr.h" +#include "randrstr.h" +#include <stdio.h> + +/* + * This function assumes that only a single depth can be + * displayed at a time, but that all visuals of that depth + * can be displayed simultaneously. It further assumes that + * only a single size is available. Hardware providing + * additional capabilties should use different code. + */ + +Bool +miRRGetInfo (ScreenPtr pScreen, Rotation *rotations) +{ + int i; + Bool setConfig = FALSE; + + *rotations = RR_Rotate_0; + for (i = 0; i < pScreen->numDepths; i++) + { + if (pScreen->allowedDepths[i].numVids) + { + RRVisualGroupPtr pVisualGroup; + + pVisualGroup = RRCreateVisualGroup (pScreen); + if (pVisualGroup) + { + RRGroupOfVisualGroupPtr pGroupOfVisualGroup; + RRScreenSizePtr pSize; + + if (!RRAddDepthToVisualGroup (pScreen, + pVisualGroup, + &pScreen->allowedDepths[i])) + { + RRDestroyVisualGroup (pScreen, pVisualGroup); + return FALSE; + } + pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup); + if (!pVisualGroup) + return FALSE; + + pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen); + + if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen, + pGroupOfVisualGroup, + pVisualGroup)) + { + RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); + /* pVisualGroup left until screen closed */ + return FALSE; + } + + pSize = RRRegisterSize (pScreen, + pScreen->width, + pScreen->height, + pScreen->mmWidth, + pScreen->mmHeight, + pGroupOfVisualGroup); + if (!pSize) + return FALSE; + if (!setConfig) + { + RRSetCurrentConfig (pScreen, RR_Rotate_0, pSize, pVisualGroup); + setConfig = TRUE; + } + } + } + } +} + +/* + * Any hardware that can actually change anything will need something + * different here + */ +Bool +miRRSetConfig (ScreenPtr pScreen, + Rotation rotation, + RRScreenSizePtr pSize, + RRVisualGroupPtr pVisualGroup) +{ + return TRUE; +} + + +Bool +miRandRInit (ScreenPtr pScreen) +{ + rrScrPrivPtr rp; + + if (!RRScreenInit (pScreen)) + return FALSE; + rp = rrGetScrPriv(pScreen); + rp->rrGetInfo = miRRGetInfo; + rp->rrSetConfig = miRRSetConfig; + return TRUE; +} Index: xc/programs/Xserver/randr/randr.c diff -u /dev/null xc/programs/Xserver/randr/randr.c:1.12 --- /dev/null Fri Jan 18 15:26:52 2002 +++ xc/programs/Xserver/randr/randr.c Fri Jul 20 15:30:11 2001 @@ -0,0 +1,1405 @@ +/* + * $XFree86: xc/programs/Xserver/randr/randr.c,v 1.12 2001/07/20 19:30:11 keithp Exp $ + * + * Copyright © 2000 Compaq Computer Corporation, 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 Compaq not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Compaq makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ + * 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. + * + * Author: Jim Gettys, Compaq Computer Corporation, Inc. + */ + +#define NEED_REPLIES +#define NEED_EVENTS +#include "X.h" +#include "Xproto.h" +#include "misc.h" +#include "os.h" +#include "dixstruct.h" +#include "resource.h" +#include "scrnintstr.h" +#include "windowstr.h" +#include "pixmapstr.h" +#include "extnsionst.h" +#include "servermd.h" +#include "randr.h" +#include "randrproto.h" +#include "randrstr.h" +#include "Xfuncproto.h" +#ifdef EXTMODULE +#include "xf86_ansic.h" +#endif + +#define RR_VALIDATE +int RRGeneration; +int RRNScreens; + +static int ProcRRQueryVersion (ClientPtr pClient); +static int ProcRRDispatch (ClientPtr pClient); +static int SProcRRDispatch (ClientPtr pClient); +static int SProcRRQueryVersion (ClientPtr pClient); + +#define wrap(priv,real,mem,func) {\ + priv->mem = real->mem; \ + real->mem = func; \ +} + +#define unwrap(priv,real,mem) {\ + real->mem = priv->mem; \ +} + +static CARD8 RRReqCode; +static int RRErrBase; +static int RREventBase; +static RESTYPE ClientType, EventType; /* resource types for event masks */ + +/* + * each window has a list of clients requesting + * RRNotify events. Each client has a resource + * for each window it selects RRNotify input for, + * this resource is used to delete the RRNotifyRec + * entry from the per-window queue. + */ + +typedef struct _RREvent *RREventPtr; + +typedef struct _RREvent { + RREventPtr next; + ClientPtr client; + WindowPtr window; + XID clientResource; +} RREventRec; + +int rrPrivIndex = -1; + +static void +RRResetProc (ExtensionEntry *extEntry) +{ +} + + +static Bool +RRCloseScreen (int i, ScreenPtr pScreen) +{ + rrScrPriv(pScreen); + + unwrap (pScrPriv, pScreen, CloseScreen); + if (pScrPriv->pSizes) + xfree (pScrPriv->pSizes); + if (pScrPriv->pGroupsOfVisualGroups) + xfree (pScrPriv->pGroupsOfVisualGroups); + if (pScrPriv->pVisualGroups) + xfree (pScrPriv->pVisualGroups); + xfree (pScrPriv); + RRNScreens -= 1; /* ok, one fewer screen with RandR running */ + return (*pScreen->CloseScreen) (i, pScreen); +} + +static void +SRRScreenChangeNotifyEvent(from, to) + xRRScreenChangeNotifyEvent *from, *to; +{ + to->type = from->type; + to->rotation = from->rotation; + cpswaps(from->sequenceNumber, to->sequenceNumber); + cpswapl(from->timestamp, to->timestamp); + cpswapl(from->configTimestamp, to->configTimestamp); + cpswapl(from->root, to->root); + cpswapl(from->window, to->window); + cpswaps(from->sizeID, to->sizeID); + cpswaps(from->visualGroupID, to->visualGroupID); + cpswaps(from->widthInPixels, to->widthInPixels); + cpswaps(from->heightInPixels, to->heightInPixels); + cpswaps(from->widthInMillimeters, to->widthInMillimeters); + cpswaps(from->heightInMillimeters, to->heightInMillimeters); +} + +Bool RRScreenInit(ScreenPtr pScreen) +{ + rrScrPrivPtr pScrPriv; + + if (RRGeneration != serverGeneration) + { + if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0) + return FALSE; + RRGeneration = serverGeneration; + } + + pScrPriv = (rrScrPrivPtr) xalloc (sizeof (rrScrPrivRec)); + if (!pScrPriv) + return FALSE; + + SetRRScreen(pScreen, pScrPriv); + + /* + * Calling function best set these function vectors + */ + pScrPriv->rrSetConfig = 0; + pScrPriv->rrGetInfo = 0; + /* + * This value doesn't really matter -- any client must call + * GetScreenInfo before reading it which will automatically update + * the time + */ + pScrPriv->lastSetTime = currentTime; + pScrPriv->lastConfigTime = currentTime; + + wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen); + + pScrPriv->rotations = RR_Rotate_0; + pScrPriv->swaps = 0; + pScrPriv->nVisualGroups = 0; + pScrPriv->nVisualGroupsInUse = 0; + pScrPriv->pVisualGroups = 0; + + pScrPriv->nGroupsOfVisualGroups = 0; + pScrPriv->nGroupsOfVisualGroupsInUse = 0; + pScrPriv->pGroupsOfVisualGroups = 0; + + pScrPriv->nSizes = 0; + pScrPriv->nSizesInUse = 0; + pScrPriv->pSizes = 0; + + pScrPriv->rotation = RR_Rotate_0; + pScrPriv->pSize = 0; + pScrPriv->pVisualGroup = 0; + + RRNScreens += 1; /* keep count of screens that implement randr */ + return TRUE; +} + +/*ARGSUSED*/ +static int +RRFreeClient (pointer data, XID id) +{ + RREventPtr pRREvent; + WindowPtr pWin; + RREventPtr *pHead, pCur, pPrev; + + pRREvent = (RREventPtr) data; + pWin = pRREvent->window; + pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, EventType); + if (pHead) { + pPrev = 0; + for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next) + pPrev = pCur; + if (pCur) + { + if (pPrev) + pPrev->next = pRREvent->next; + else + *pHead = pRREvent->next; + } + } + xfree ((pointer) pRREvent); + return 1; +} + +/*ARGSUSED*/ +static int +RRFreeEvents (pointer data, XID id) +{ + RREventPtr *pHead, pCur, pNext; + + pHead = (RREventPtr *) data; + for (pCur = *pHead; pCur; pCur = pNext) { + pNext = pCur->next; + FreeResource (pCur->clientResource, ClientType); + xfree ((pointer) pCur); + } + xfree ((pointer) pHead); + return 1; +} + +void +RRExtensionInit (void) +{ + ExtensionEntry *extEntry; + + if (RRNScreens == 0) return; + + ClientType = CreateNewResourceType(RRFreeClient); + if (!ClientType) + return; + EventType = CreateNewResourceType(RRFreeEvents); + if (!EventType) + return; + extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors, + ProcRRDispatch, SProcRRDispatch, + RRResetProc, StandardMinorOpcode); + if (!extEntry) + return; + RRReqCode = (CARD8) extEntry->base; + RRErrBase = extEntry->errorBase; + RREventBase = extEntry->eventBase; + EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr) + SRRScreenChangeNotifyEvent; + + return; +} + +static int +TellChanged (WindowPtr pWin, pointer value) +{ + RREventPtr *pHead, pRREvent; + ClientPtr client; + xRRScreenChangeNotifyEvent se; + ScreenPtr pScreen = pWin->drawable.pScreen; + rrScrPriv(pScreen); + RRScreenSizePtr pSize = pScrPriv->pSize; + WindowPtr pRoot = WindowTable[pScreen->myNum]; + + pHead = (RREventPtr *) LookupIDByType (pWin->drawable.id, EventType); + if (!pHead) + return WT_WALKCHILDREN; + + se.type = RRScreenChangeNotify + RREventBase; + se.rotation = (CARD8) pScrPriv->rotation; + se.timestamp = pScrPriv->lastSetTime.milliseconds; + se.configTimestamp = pScrPriv->lastConfigTime.milliseconds; + se.root = pRoot->drawable.id; + se.window = pWin->drawable.id; + if (pSize) + { + se.sizeID = pSize->id; + se.visualGroupID = pScrPriv->pVisualGroup->id; + se.widthInPixels = pSize->width; + se.heightInPixels = pSize->height; + se.widthInMillimeters = pSize->mmWidth; + se.heightInMillimeters = pSize->mmHeight; + } + else + { + /* + * This "shouldn't happen", but a broken DDX can + * forget to set the current configuration on GetInfo + */ + se.sizeID = 0xffff; + se.visualGroupID = 0xffff; + se.widthInPixels = 0; + se.heightInPixels = 0; + se.widthInMillimeters = 0; + se.heightInMillimeters = 0; + } + + for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) + { + client = pRREvent->client; + if (client == serverClient || client->clientGone) + continue; + se.sequenceNumber = client->sequence; + WriteEventsToClient (client, 1, (xEvent *) &se); + } + return WT_WALKCHILDREN; +} + +static Bool +RRGetInfo (ScreenPtr pScreen) +{ + rrScrPriv (pScreen); + int i, j; + Bool changed; + Rotation rotations; + + for (i = 0; i < pScrPriv->nVisualGroups; i++) + { + pScrPriv->pVisualGroups[i].oldReferenced = pScrPriv->pVisualGroups[i].referenced; + pScrPriv->pVisualGroups[i].referenced = FALSE; + } + for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) + { + pScrPriv->pGroupsOfVisualGroups[i].oldReferenced = pScrPriv->pGroupsOfVisualGroups[i].referenced; + pScrPriv->pGroupsOfVisualGroups[i].referenced = FALSE; + } + for (i = 0; i < pScrPriv->nSizes; i++) + { + pScrPriv->pSizes[i].oldReferenced = pScrPriv->pSizes[i].referenced; + pScrPriv->pSizes[i].referenced = FALSE; + } + if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations)) + return FALSE; + + changed = FALSE; + + /* + * Check whether anything changed and simultaneously generate + * the protocol id values for the objects + */ + if (rotations != pScrPriv->rotations) + { + pScrPriv->rotations = rotations; + changed = TRUE; + } + + j = 0; + for (i = 0; i < pScrPriv->nVisualGroups; i++) + { + if (pScrPriv->pVisualGroups[i].oldReferenced != pScrPriv->pVisualGroups[i].referenced) + changed = TRUE; + if (pScrPriv->pVisualGroups[i].referenced) + pScrPriv->pVisualGroups[i].id = j++; + } + pScrPriv->nVisualGroupsInUse = j; + j = 0; + for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) + { + if (pScrPriv->pGroupsOfVisualGroups[i].oldReferenced != pScrPriv->pGroupsOfVisualGroups[i].referenced) + changed = TRUE; + if (pScrPriv->pGroupsOfVisualGroups[i].referenced) + pScrPriv->pGroupsOfVisualGroups[i].id = j++; + } + pScrPriv->nGroupsOfVisualGroupsInUse = j; + j = 0; + for (i = 0; i < pScrPriv->nSizes; i++) + { + if (pScrPriv->pSizes[i].oldReferenced != pScrPriv->pSizes[i].referenced) + changed = TRUE; + if (pScrPriv->pSizes[i].referenced) + pScrPriv->pSizes[i].id = j++; + } + pScrPriv->nSizesInUse = j; + if (changed) + { + UpdateCurrentTime (); + pScrPriv->lastConfigTime = currentTime; + WalkTree (pScreen, TellChanged, (pointer) pScreen); + } + return TRUE; +} + +static void +RRSendConfigNotify (ScreenPtr pScreen) +{ + WindowPtr pWin = WindowTable[pScreen->myNum]; + xEvent event; + + event.u.u.type = ConfigureNotify; + event.u.configureNotify.window = pWin->drawable.id; + event.u.configureNotify.aboveSibling = None; + event.u.configureNotify.x = 0; + event.u.configureNotify.y = 0; + + /* XXX xinerama stuff ? */ + + event.u.configureNotify.width = pWin->drawable.width; + event.u.configureNotify.height = pWin->drawable.height; + event.u.configureNotify.borderWidth = wBorderWidth (pWin); + event.u.configureNotify.override = pWin->overrideRedirect; + DeliverEvents(pWin, &event, 1, NullWindow); +} + +static int +ProcRRQueryVersion (ClientPtr client) +{ + xRRQueryVersionReply rep; + register int n; + REQUEST(xRRQueryVersionReq); + + REQUEST_SIZE_MATCH(xRRQueryVersionReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.majorVersion = RANDR_MAJOR; + rep.minorVersion = RANDR_MINOR; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.majorVersion, n); + swapl(&rep.minorVersion, n); + } + WriteToClient(client, sizeof(xRRQueryVersionReply), (char *)&rep); + return (client->noClientException); +} + +static Bool +RRVisualGroupContains (RRVisualGroupPtr pVisualGroup, + VisualID visual) +{ + int i; + + for (i = 0; i < pVisualGroup->nvisuals; i++) + if (pVisualGroup->visuals[i]->vid == visual) + return TRUE; + return FALSE; +} + +static CARD16 +RRNumMatchingVisualGroups (ScreenPtr pScreen, + VisualID visual) +{ + rrScrPriv(pScreen); + int i; + CARD16 n = 0; + RRVisualGroupPtr pVisualGroup; + + for (i = 0; i < pScrPriv->nVisualGroups; i++) + { + pVisualGroup = &pScrPriv->pVisualGroups[i]; + if (pVisualGroup->referenced && RRVisualGroupContains (pVisualGroup, visual)) + n++; + } + return n; +} + +static void +RRGetMatchingVisualGroups (ScreenPtr pScreen, + VisualID visual, + VisualGroupID *pVisualGroupIDs) +{ + rrScrPriv(pScreen); + int i; + CARD16 n = 0; + RRVisualGroupPtr pVisualGroup; + + for (i = 0; i < pScrPriv->nVisualGroups; i++) + { + pVisualGroup = &pScrPriv->pVisualGroups[i]; + if (pVisualGroup->referenced && RRVisualGroupContains (pVisualGroup, visual)) + *pVisualGroupIDs++ = pVisualGroup->id; + } +} + +extern char *ConnectionInfo; + +static int padlength[4] = {0, 3, 2, 1}; + +static void +RREditConnectionInfo (ScreenPtr pScreen) +{ + xConnSetup *connSetup; + char *vendor; + xPixmapFormat *formats; + xWindowRoot *root; + xDepth *depth; + xVisualType *visual; + int screen = 0; + int d; + + connSetup = (xConnSetup *) ConnectionInfo; + vendor = (char *) connSetup + sizeof (xConnSetup); + formats = (xPixmapFormat *) ((char *) vendor + + connSetup->nbytesVendor + + padlength[connSetup->nbytesVendor & 3]); + root = (xWindowRoot *) ((char *) formats + + sizeof (xPixmapFormat) * screenInfo.numPixmapFormats); + while (screen != pScreen->myNum) + { + depth = (xDepth *) ((char *) root + + sizeof (xWindowRoot)); + for (d = 0; d < root->nDepths; d++) + { + visual = (xVisualType *) ((char *) depth + + sizeof (xDepth)); + depth = (xDepth *) ((char *) visual + + depth->nVisuals * sizeof (xVisualType)); + } + root = (xWindowRoot *) ((char *) depth); + screen++; + } + root->pixWidth = pScreen->width; + root->pixHeight = pScreen->height; + root->mmWidth = pScreen->mmWidth; + root->mmHeight = pScreen->mmHeight; +} + +static int +ProcRRGetScreenInfo (ClientPtr client) +{ + REQUEST(xRRGetScreenInfoReq); + xRRGetScreenInfoReply rep; + WindowPtr pWin; + int n; + ScreenPtr pScreen; + rrScrPrivPtr pScrPriv; + CARD8 *extra; + int extraLen; + + REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); + pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, + SecurityReadAccess); + + if (!pWin) + return BadWindow; + + pScreen = pWin->drawable.pScreen; + pScrPriv = rrGetScrPriv(pScreen); + if (!pScrPriv) + { + rep.type = X_Reply; + rep.setOfRotations = RR_Rotate_0;; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; + rep.timestamp = currentTime.milliseconds; + rep.configTimestamp = currentTime.milliseconds; + rep.nVisualGroups = 0; + rep.nGroupsOfVisualGroups = 0; + rep.nSizes = 0; + rep.sizeID = 0; + rep.visualGroupID = 0; + rep.rotation = RR_Rotate_0; + extra = 0; + extraLen = 0; + } + else + { + int i, j; + int nGroupsOfVisualGroupsElements; + RRGroupOfVisualGroupPtr pGroupsOfVisualGroups; + int nVisualGroupElements; + RRVisualGroupPtr pVisualGroup; + xScreenSizes *size; + CARD16 *data16; + CARD32 *data32; + + RRGetInfo (pScreen); + + rep.type = X_Reply; + rep.setOfRotations = pScrPriv->rotations; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; + rep.timestamp = pScrPriv->lastSetTime.milliseconds; + rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds; + + rep.nVisualGroups = pScrPriv->nVisualGroupsInUse; + rep.rotation = pScrPriv->rotation; + rep.nSizes = pScrPriv->nSizesInUse; + rep.nGroupsOfVisualGroups = pScrPriv->nGroupsOfVisualGroupsInUse; + if (pScrPriv->pSize) + rep.sizeID = pScrPriv->pSize->id; + else + return BadImplementation; + if (pScrPriv->pVisualGroup) + rep.visualGroupID = pScrPriv->pVisualGroup->id; + else + return BadImplementation; + /* + * Count up the total number of spaces needed to transmit + * the groups of visual groups + */ + nGroupsOfVisualGroupsElements = 0; + for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) + { + pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[i]; + if (pGroupsOfVisualGroups->referenced) + nGroupsOfVisualGroupsElements += pGroupsOfVisualGroups->ngroups + 1; + } + /* + * Count up the total number of spaces needed to transmit + * the visual groups + */ + nVisualGroupElements = 0; + for (i = 0; i < pScrPriv->nVisualGroups; i++) + { + pVisualGroup = &pScrPriv->pVisualGroups[i]; + if (pVisualGroup->referenced) + nVisualGroupElements += pVisualGroup->nvisuals + 1; + } + /* + * Allocate space for the extra information + */ + extraLen = (rep.nSizes * sizeof (xScreenSizes) + + nVisualGroupElements * sizeof (CARD32) + + nGroupsOfVisualGroupsElements * sizeof (CARD16)); + extra = (CARD8 *) xalloc (extraLen); + if (!extra) + return BadAlloc; + /* + * First comes the size information + */ + size = (xScreenSizes *) extra; + for (i = 0; i < pScrPriv->nSizes; i++) + { + if (pScrPriv->pSizes[i].referenced) + { + size->widthInPixels = pScrPriv->pSizes[i].width; + size->heightInPixels = pScrPriv->pSizes[i].height; + size->widthInMillimeters = pScrPriv->pSizes[i].mmWidth; + size->heightInMillimeters = pScrPriv->pSizes[i].mmHeight; + size->visualGroup = pScrPriv->pGroupsOfVisualGroups[pScrPriv->pSizes[i].groupOfVisualGroups].id; + if (client->swapped) + { + swaps (&size->widthInPixels, n); + swaps (&size->heightInPixels, n); + swaps (&size->widthInMillimeters, n); + swaps (&size->heightInMillimeters, n); + swaps (&size->visualGroup, n); + } + size++; + } + } + data32 = (CARD32 *) size; + /* + * Next comes the visual groups + */ + for (i = 0; i < pScrPriv->nVisualGroups; i++) + { + pVisualGroup = &pScrPriv->pVisualGroups[i]; + if (pVisualGroup->referenced) + { + *data32++ = pVisualGroup->nvisuals; + for (j = 0; j < pVisualGroup->nvisuals; j++) + *data32++ = pVisualGroup->visuals[j]->vid; + } + } + if (client->swapped) + SwapLongs (data32 - nVisualGroupElements, nVisualGroupElements); + /* + * Next comes the groups of visual groups + */ + data16 = (CARD16 *) data32; + for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) + { + pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[i]; + if (pGroupsOfVisualGroups->referenced) + { + *data16++ = (CARD16) pGroupsOfVisualGroups->ngroups; + for (j = 0; j < pGroupsOfVisualGroups->ngroups; j++) + { + pVisualGroup = &pScrPriv->pVisualGroups[pGroupsOfVisualGroups->groups[j]]; + *data16++ = (CARD16) pVisualGroup->id; + } + } + } + + if (client->swapped) + SwapShorts ((CARD16 *) data32, data16 - (CARD16 *) data32); + + if ((CARD8 *) data16 - (CARD8 *) extra != extraLen) + FatalError ("RRGetScreenInfo bad extra len %d != %d\n", + (CARD8 *) data16 - (CARD8 *) extra, extraLen); + rep.length = extraLen >> 2; + } + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.timestamp, n); + swaps(&rep.rotation, n); + swaps(&rep.nSizes, n); + swaps(&rep.nVisualGroups, n); + swaps(&rep.sizeID, n); + swaps(&rep.visualGroupID, n); + } + WriteToClient(client, sizeof(xRRGetScreenInfoReply), (char *)&rep); + if (extraLen) + { + WriteToClient (client, extraLen, extra); + xfree (extra); + } + return (client->noClientException); +} + +static int +ProcRRSetScreenConfig (ClientPtr client) +{ + REQUEST(xRRSetScreenConfigReq); + xRRSetScreenConfigReply rep; + DrawablePtr pDraw; + int n; + ScreenPtr pScreen; + rrScrPrivPtr pScrPriv; + TimeStamp configTime; + TimeStamp time; + RRScreenSizePtr pSize; + RRVisualGroupPtr pVisualGroup; + RRGroupOfVisualGroupPtr pGroupsOfVisualGroups; + int i; + Rotation rotation; + short oldWidth, oldHeight; + + UpdateCurrentTime (); + + REQUEST_SIZE_MATCH(xRRSetScreenConfigReq); + SECURITY_VERIFY_DRAWABLE(pDraw, stuff->drawable, client, + SecurityWriteAccess); + + pScreen = pDraw->pScreen; + + pScrPriv= rrGetScrPriv(pScreen); + + time = ClientTimeToServerTime(stuff->timestamp); + configTime = ClientTimeToServerTime(stuff->configTimestamp); + + oldWidth = pScreen->width; + oldHeight = pScreen->height; + + if (!pScrPriv) + { + time = currentTime; + rep.status = RRSetConfigFailed; + goto sendReply; + } + if (!RRGetInfo (pScreen)) + return BadAlloc; + + /* + * if the client's config timestamp is not the same as the last config + * timestamp, then the config information isn't up-to-date and + * can't even be validated + */ + if (CompareTimeStamps (configTime, pScrPriv->lastConfigTime) != 0) + { + rep.status = RRSetConfigInvalidConfigTime; + goto sendReply; + } + + /* + * Search for the requested size + */ + for (i = 0; i < pScrPriv->nSizes; i++) + { + pSize = &pScrPriv->pSizes[i]; + if (pSize->referenced && pSize->id == stuff->sizeID) + break; + } + if (i == pScrPriv->nSizes) + { + /* + * Invalid size ID + */ + client->errorValue = stuff->sizeID; + return BadValue; + } + + /* + * Search for the requested visual group + */ + for (i = 0; i < pScrPriv->nVisualGroups; i++) + { + pVisualGroup = &pScrPriv->pVisualGroups[i]; + if (pVisualGroup->referenced && pVisualGroup->id == stuff->visualGroupID) + break; + } + if (i == pScrPriv->nVisualGroups) + { + /* + * Invalid group ID + */ + client->errorValue = stuff->visualGroupID; + return BadValue; + } + + /* + * Make sure visualgroup is supported by size + */ + pGroupsOfVisualGroups = &pScrPriv->pGroupsOfVisualGroups[pSize->groupOfVisualGroups]; + for (i = 0; i < pGroupsOfVisualGroups->ngroups; i++) + { + if (pGroupsOfVisualGroups->groups[i] == pVisualGroup - pScrPriv->pVisualGroups) + break; + } + if (i == pGroupsOfVisualGroups->ngroups) + { + /* + * requested group not supported by requested size + */ + return BadMatch; + } + + /* + * Validate requested rotation + */ + rotation = (Rotation) stuff->rotation; + switch (rotation) { + case RR_Rotate_0: + case RR_Rotate_90: + case RR_Rotate_180: + case RR_Rotate_270: + break; + default: + /* + * Invalid rotation + */ + client->errorValue = stuff->rotation; + return BadValue; + } + if (!(pScrPriv->rotations & rotation)) + { + /* + * requested rotation not supported by screen + */ + return BadMatch; + } + + /* + * Make sure the requested set-time is not older than + * the last set-time + */ + if (CompareTimeStamps (time, pScrPriv->lastSetTime) < 0) + { + rep.status = RRSetConfigInvalidTime; + goto sendReply; + } + + /* + * call out to ddx routine to effect the change + */ + if (!(*pScrPriv->rrSetConfig) (pScreen, rotation, + pSize, pVisualGroup)) + { + /* + * unknown DDX failure, report to client + */ + rep.status = RRSetConfigFailed; + goto sendReply; + } + + /* + * set current extension configuration pointers + */ + RRSetCurrentConfig (pScreen, rotation, pSize, pVisualGroup); + + /* + * Deliver ScreenChangeNotify events whenever + * the configuration is updated + */ + WalkTree (pScreen, TellChanged, (pointer) pScreen); + + /* + * Deliver ConfigureNotify events when root changes + * pixel size + */ + if (oldWidth != pScreen->width || oldHeight != pScreen->height) + RRSendConfigNotify (pScreen); + RREditConnectionInfo (pScreen); + + /* + * Fix pointer bounds and location + */ + ScreenRestructured (pScreen); + pScrPriv->lastSetTime = time; + + /* + * Report Success + */ + rep.status = RRSetConfigSuccess; + +sendReply: + + rep.type = X_Reply; + /* rep.status has already been filled in */ + rep.length = 0; + rep.sequenceNumber = client->sequence; + + rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; + rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds; + rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id; + + if (client->swapped) + { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.newTimestamp, n); + swapl(&rep.newConfigTimestamp, n); + swapl(&rep.root, n); + } + WriteToClient(client, sizeof(xRRSetScreenConfigReply), (char *)&rep); + + return (client->noClientException); +} + +static int +ProcRRScreenChangeSelectInput (ClientPtr client) +{ + REQUEST(xRRScreenChangeSelectInputReq); + WindowPtr pWin; + RREventPtr pRREvent, pNewRREvent, *pHead; + XID clientResource; + + REQUEST_SIZE_MATCH(xRRScreenChangeSelectInputReq); + pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess); + if (!pWin) + return BadWindow; + pHead = (RREventPtr *)SecurityLookupIDByType(client, + pWin->drawable.id, EventType, SecurityWriteAccess); + switch (stuff->enable) { + case xTrue: + if (pHead) { + + /* check for existing entry. */ + for (pRREvent = *pHead; + pRREvent; + pRREvent = pRREvent->next) + { + if (pRREvent->client == client) + return Success; + } + } + + /* build the entry */ + pNewRREvent = (RREventPtr) + xalloc (sizeof (RREventRec)); + if (!pNewRREvent) + return BadAlloc; + pNewRREvent->next = 0; + pNewRREvent->client = client; + pNewRREvent->window = pWin; + /* + * add a resource that will be deleted when + * the client goes away + */ + clientResource = FakeClientID (client->index); + pNewRREvent->clientResource = clientResource; + if (!AddResource (clientResource, ClientType, (pointer)pNewRREvent)) + return BadAlloc; + /* + * create a resource to contain a pointer to the list + * of clients selecting input. This must be indirect as + * the list may be arbitrarily rearranged which cannot be + * done through the resource database. + */ + if (!pHead) + { + pHead = (RREventPtr *) xalloc (sizeof (RREventPtr)); + if (!pHead || + !AddResource (pWin->drawable.id, EventType, (pointer)pHead)) + { + FreeResource (clientResource, RT_NONE); + return BadAlloc; + } + *pHead = 0; + } + pNewRREvent->next = *pHead; + *pHead = pNewRREvent; + break; + case xFalse: + /* delete the interest */ + if (pHead) { + pNewRREvent = 0; + for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { + if (pRREvent->client == client) + break; + pNewRREvent = pRREvent; + } + if (pRREvent) { + FreeResource (pRREvent->clientResource, ClientType); + if (pNewRREvent) + pNewRREvent->next = pRREvent->next; + else + *pHead = pRREvent->next; + xfree (pRREvent); + } + } + break; + default: + client->errorValue = stuff->enable; + return BadValue; + } + return Success; +} + +static int +ProcRRDispatch (ClientPtr client) +{ + REQUEST(xReq); + switch (stuff->data) + { + case X_RRQueryVersion: + return ProcRRQueryVersion(client); + case X_RRGetScreenInfo: + return ProcRRGetScreenInfo(client); + case X_RRSetScreenConfig: + return ProcRRSetScreenConfig(client); + case X_RRScreenChangeSelectInput: + return ProcRRScreenChangeSelectInput(client); + default: + return BadRequest; + } +} + +static int +SProcRRQueryVersion (ClientPtr client) +{ + register int n; + REQUEST(xRRQueryVersionReq); + + swaps(&stuff->length, n); + swapl(&stuff->majorVersion, n); + swapl(&stuff->minorVersion, n); + return ProcRRQueryVersion(client); +} + +static int +SProcRRGetScreenInfo (ClientPtr client) +{ + register int n; + REQUEST(xRRGetScreenInfoReq); + + swaps(&stuff->length, n); + swapl(&stuff->window, n); + return ProcRRGetScreenInfo(client); +} + +static int +SProcRRSetScreenConfig (ClientPtr client) +{ + register int n; + REQUEST(xRRSetScreenConfigReq); + + swaps(&stuff->length, n); + swapl(&stuff->drawable, n); + swapl(&stuff->timestamp, n); + swaps(&stuff->sizeID, n); + swaps(&stuff->visualGroupID, n); + swaps(&stuff->rotation, n); + return ProcRRSetScreenConfig(client); +} + +static int +SProcRRScreenChangeSelectInput (ClientPtr client) +{ + register int n; + REQUEST(xRRScreenChangeSelectInputReq); + + swaps(&stuff->length, n); + swapl(&stuff->window, n); + return ProcRRScreenChangeSelectInput(client); +} + +static int +SProcRRDispatch (ClientPtr client) +{ + REQUEST(xReq); + switch (stuff->data) + { + case X_RRQueryVersion: + return SProcRRQueryVersion(client); + case X_RRGetScreenInfo: + return SProcRRGetScreenInfo(client); + case X_RRSetScreenConfig: + return SProcRRSetScreenConfig(client); + case X_RRScreenChangeSelectInput: + return SProcRRScreenChangeSelectInput(client); + default: + return BadRequest; + } +} + +/* + * Utility functions for creating the group of possible + * configurations + */ + +RRVisualGroupPtr +RRCreateVisualGroup (ScreenPtr pScreen) +{ + RRVisualGroupPtr pVisualGroup; + + pVisualGroup = (RRVisualGroupPtr) xalloc (sizeof (RRVisualGroup)); + pVisualGroup->nvisuals = 0; + pVisualGroup->visuals = 0; + pVisualGroup->referenced = TRUE; + pVisualGroup->oldReferenced = FALSE; + return pVisualGroup; +} + +void +RRDestroyVisualGroup (ScreenPtr pScreen, + RRVisualGroupPtr pVisualGroup) +{ +#ifdef RR_VALIDATE + int i; + rrScrPriv(pScreen); + + for (i = 0; i < pScrPriv->nVisualGroups; i++) + if (pVisualGroup == &pScrPriv->pVisualGroups[i]) + FatalError ("Freeing registered visual group"); +#endif + xfree (pVisualGroup->visuals); + xfree (pVisualGroup); +} + +Bool +RRAddVisualToVisualGroup (ScreenPtr pScreen, + RRVisualGroupPtr pVisualGroup, + VisualPtr pVisual) +{ + VisualPtr *new; + + new = xrealloc (pVisualGroup->visuals, + (pVisualGroup->nvisuals + 1) * sizeof (VisualPtr)); + if (!new) + return FALSE; + (pVisualGroup->visuals = new)[pVisualGroup->nvisuals++] = pVisual; + return TRUE; +} + +Bool +RRAddDepthToVisualGroup (ScreenPtr pScreen, + RRVisualGroupPtr pVisualGroup, + DepthPtr pDepth) +{ + int i; + int v; + + for (i = 0; i < pDepth->numVids; i++) + for (v = 0; v < pScreen->numVisuals; v++) + if (pScreen->visuals[v].vid == pDepth->vids[i]) + if (!RRAddVisualToVisualGroup (pScreen, pVisualGroup, + &pScreen->visuals[v])) + return FALSE; + return TRUE; +} + +/* + * Return true if a and b reference the same group of visuals + */ + +static Bool +RRVisualGroupMatches (RRVisualGroupPtr a, + RRVisualGroupPtr b) +{ + int ai, bi; + + if (a->nvisuals != b->nvisuals) + return FALSE; + for (ai = 0; ai < a->nvisuals; ai++) + { + for (bi = 0; bi < b->nvisuals; bi++) + if (a->visuals[ai] == b->visuals[bi]) + break; + if (bi == b->nvisuals) + return FALSE; + } + return TRUE; +} + +RRVisualGroupPtr +RRRegisterVisualGroup (ScreenPtr pScreen, + RRVisualGroupPtr pVisualGroup) +{ + rrScrPriv (pScreen); + int i; + RRVisualGroupPtr pNew; + + if (!pScrPriv) + { + RRDestroyVisualGroup (pScreen, pVisualGroup); + return 0; + } + for (i = 0; i < pScrPriv->nVisualGroups; i++) + if (RRVisualGroupMatches (pVisualGroup, + &pScrPriv->pVisualGroups[i])) + { + RRDestroyVisualGroup (pScreen, pVisualGroup); + pScrPriv->pVisualGroups[i].referenced = TRUE; + return &pScrPriv->pVisualGroups[i]; + } + pNew = xrealloc (pScrPriv->pVisualGroups, + (pScrPriv->nVisualGroups + 1) * sizeof (RRVisualGroup)); + if (!pNew) + { + RRDestroyVisualGroup (pScreen, pVisualGroup); + return 0; + } + pNew[pScrPriv->nVisualGroups++] = *pVisualGroup; + xfree (pVisualGroup); + pScrPriv->pVisualGroups = pNew; + return &pNew[pScrPriv->nVisualGroups-1]; +} + +RRGroupOfVisualGroupPtr +RRCreateGroupOfVisualGroup (ScreenPtr pScreen) +{ + RRGroupOfVisualGroupPtr pGroupOfVisualGroup; + + pGroupOfVisualGroup = (RRGroupOfVisualGroupPtr) xalloc (sizeof (RRGroupOfVisualGroup)); + pGroupOfVisualGroup->ngroups = 0; + pGroupOfVisualGroup->groups = 0; + pGroupOfVisualGroup->referenced = TRUE; + pGroupOfVisualGroup->oldReferenced = FALSE; + return pGroupOfVisualGroup; +} + +void +RRDestroyGroupOfVisualGroup (ScreenPtr pScreen, + RRGroupOfVisualGroupPtr pGroupOfVisualGroup) +{ +#ifdef RR_VALIDATE + int i; + rrScrPriv(pScreen); + + for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) + if (pGroupOfVisualGroup == &pScrPriv->pGroupsOfVisualGroups[i]) + FatalError ("Freeing registered visual group"); +#endif + xfree (pGroupOfVisualGroup->groups); + xfree (pGroupOfVisualGroup); +} + +Bool +RRAddVisualGroupToGroupOfVisualGroup (ScreenPtr pScreen, + RRGroupOfVisualGroupPtr pGroupOfVisualGroup, + RRVisualGroupPtr pVisualGroup) +{ + rrScrPriv(pScreen); + int *new; + +#ifdef RR_VALIDATE + int i; + for (i = 0; i < pScrPriv->nVisualGroups; i++) + if (pVisualGroup == &pScrPriv->pVisualGroups[i]) + break; + + if (i == pScrPriv->nVisualGroups) + FatalError ("Adding unregistered visual group"); +#endif + new = (int*) xrealloc (pGroupOfVisualGroup->groups, + (pGroupOfVisualGroup->ngroups + 1) * sizeof (int *)); + if (!new) + return FALSE; + (pGroupOfVisualGroup->groups = new)[pGroupOfVisualGroup->ngroups++] = pVisualGroup - pScrPriv->pVisualGroups; + return TRUE; +} + +/* + * Return true if a and b reference the same group of groups + */ + +static Bool +RRGroupOfVisualGroupMatches (RRGroupOfVisualGroupPtr a, + RRGroupOfVisualGroupPtr b) +{ + int ai, bi; + + if (a->ngroups != b->ngroups) + return FALSE; + for (ai = 0; ai < a->ngroups; ai++) + { + for (bi = 0; bi < b->ngroups; bi++) + if (a->groups[ai] == b->groups[bi]) + break; + if (bi == b->ngroups) + return FALSE; + } + return TRUE; +} + +RRGroupOfVisualGroupPtr +RRRegisterGroupOfVisualGroup (ScreenPtr pScreen, + RRGroupOfVisualGroupPtr pGroupOfVisualGroup) +{ + rrScrPriv (pScreen); + int i; + RRGroupOfVisualGroupPtr pNew; + + if (!pScrPriv) + { + RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); + return 0; + } + for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) + if (RRGroupOfVisualGroupMatches (pGroupOfVisualGroup, + &pScrPriv->pGroupsOfVisualGroups[i])) + { + RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); + pScrPriv->pGroupsOfVisualGroups[i].referenced = TRUE; + return &pScrPriv->pGroupsOfVisualGroups[i]; + } + pNew = xrealloc (pScrPriv->pGroupsOfVisualGroups, + (pScrPriv->nGroupsOfVisualGroups + 1) * sizeof (RRGroupOfVisualGroup)); + if (!pNew) + { + RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); + return 0; + } + pNew[pScrPriv->nGroupsOfVisualGroups++] = *pGroupOfVisualGroup; + xfree (pGroupOfVisualGroup); + pScrPriv->pGroupsOfVisualGroups = pNew; + return &pNew[pScrPriv->nGroupsOfVisualGroups-1]; +} + +static Bool +RRScreenSizeMatches (RRScreenSizePtr a, + RRScreenSizePtr b) +{ + if (a->width != b->width) + return FALSE; + if (a->height != b->height) + return FALSE; + if (a->mmWidth != b->mmWidth) + return FALSE; + if (a->mmHeight != b->mmHeight) + return FALSE; + if (a->groupOfVisualGroups != b->groupOfVisualGroups) + return FALSE; + return TRUE; +} + +RRScreenSizePtr +RRRegisterSize (ScreenPtr pScreen, + short width, + short height, + short mmWidth, + short mmHeight, + RRGroupOfVisualGroup *pGroupsOfVisualGroups) +{ + rrScrPriv (pScreen); + int i; + RRScreenSize tmp; + RRScreenSizePtr pNew; + + if (!pScrPriv) + return 0; + +#ifdef RR_VALIDATE + for (i = 0; i < pScrPriv->nGroupsOfVisualGroups; i++) + if (pGroupsOfVisualGroups == &pScrPriv->pGroupsOfVisualGroups[i]) + break; + + if (i == pScrPriv->nGroupsOfVisualGroups) + FatalError ("Adding unregistered group of visual groups"); +#endif + + tmp.width = width; + tmp.height= height; + tmp.mmWidth = mmWidth; + tmp.mmHeight = mmHeight; + tmp.groupOfVisualGroups = pGroupsOfVisualGroups - pScrPriv->pGroupsOfVisualGroups; + tmp.referenced = TRUE; + tmp.oldReferenced = FALSE; + for (i = 0; i < pScrPriv->nSizes; i++) + if (RRScreenSizeMatches (&tmp, &pScrPriv->pSizes[i])) + { + pScrPriv->pSizes[i].referenced = TRUE; + return &pScrPriv->pSizes[i]; + } + pNew = xrealloc (pScrPriv->pSizes, + (pScrPriv->nSizes + 1) * sizeof (RRScreenSize)); + if (!pNew) + return 0; + pNew[pScrPriv->nSizes++] = tmp; + pScrPriv->pSizes = pNew; + return &pNew[pScrPriv->nSizes-1]; +} + +void +RRSetCurrentConfig (ScreenPtr pScreen, + Rotation rotation, + RRScreenSizePtr pSize, + RRVisualGroupPtr pVisualGroup) +{ + rrScrPriv (pScreen); + + if (!pScrPriv) + return; + + pScrPriv->rotation = rotation; + pScrPriv->pSize = pSize; + pScrPriv->pVisualGroup = pVisualGroup; +} Index: xc/programs/Xserver/randr/randrstr.h diff -u /dev/null xc/programs/Xserver/randr/randrstr.h:1.4 --- /dev/null Fri Jan 18 15:26:52 2002 +++ xc/programs/Xserver/randr/randrstr.h Sun Jun 3 17:52:44 2001 @@ -0,0 +1,181 @@ +/* + * $XFree86: xc/programs/Xserver/randr/randrstr.h,v 1.4 2001/06/03 21:52:44 keithp Exp $ + * + * Copyright © 2000 Compaq Computer 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 name of Compaq not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Compaq makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL COMPAQ 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 _RANDRSTR_H_ +#define _RANDRSTR_H_ + +#include "randr.h" + +typedef struct _rrVisualGroup { + int id; + int nvisuals; + VisualPtr *visuals; + Bool referenced; + Bool oldReferenced; +} RRVisualGroup, *RRVisualGroupPtr; + +typedef struct _rrGroupOfVisualGroup { + int id; + int ngroups; + int *groups; + Bool referenced; + Bool oldReferenced; +} RRGroupOfVisualGroup, *RRGroupOfVisualGroupPtr; + +typedef struct _rrScreenSize { + int id; + short width, height; + short mmWidth, mmHeight; + int groupOfVisualGroups; + Bool referenced; + Bool oldReferenced; +} RRScreenSize, *RRScreenSizePtr; + +typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen, + Rotation rotation, + RRScreenSizePtr pSize, + RRVisualGroupPtr pVisualGroup); + +typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations); +typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen); + +typedef struct _rrScrPriv { + RRSetConfigProcPtr rrSetConfig; + RRGetInfoProcPtr rrGetInfo; + + TimeStamp lastSetTime; /* last changed by client */ + TimeStamp lastConfigTime; /* possible configs changed */ + RRCloseScreenProcPtr CloseScreen; + + /* + * Configuration information + */ + Rotation rotations; + int swaps; + + int nVisualGroups; + int nVisualGroupsInUse; + RRVisualGroupPtr pVisualGroups; + int nGroupsOfVisualGroups; + int nGroupsOfVisualGroupsInUse; + RRGroupOfVisualGroupPtr pGroupsOfVisualGroups; + int nSizes; + int nSizesInUse; + RRScreenSizePtr pSizes; + + /* + * Current state + */ + Rotation rotation; + RRScreenSizePtr pSize; + RRVisualGroupPtr pVisualGroup; + +} rrScrPrivRec, *rrScrPrivPtr; + +extern int rrPrivIndex; + +#define rrGetScrPriv(pScr) ((rrScrPrivPtr) (pScr)->devPrivates[rrPrivIndex].ptr) +#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr) +#define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (pointer) (p)) + +/* + * First, create the visual groups and register them with the screen + */ +RRVisualGroupPtr +RRCreateVisualGroup (ScreenPtr pScreen); + +void +RRDestroyVisualGroup (ScreenPtr pScreen, + RRVisualGroupPtr pVisualGroup); + +Bool +RRAddVisualToVisualGroup (ScreenPtr pScreen, + RRVisualGroupPtr pVisualGroup, + VisualPtr pVisual); + +Bool +RRAddDepthToVisualGroup (ScreenPtr pScreen, + RRVisualGroupPtr pVisualGroup, + DepthPtr pDepth); + +RRVisualGroupPtr +RRRegisterVisualGroup (ScreenPtr pScreen, + RRVisualGroupPtr pVisualGroup); + +/* + * Next, create the group of visual groups and register that with the screen + */ +RRGroupOfVisualGroupPtr +RRCreateGroupOfVisualGroup (ScreenPtr pScreen); + +void +RRDestroyGroupOfVisualGroup (ScreenPtr pScreen, + RRGroupOfVisualGroupPtr pGroupOfVisualGroup); + +Bool +RRAddVisualGroupToGroupOfVisualGroup (ScreenPtr pScreen, + RRGroupOfVisualGroupPtr pGroupOfVisualGroup, + RRVisualGroupPtr pVisualGroup); + + +RRGroupOfVisualGroupPtr +RRRegisterGroupOfVisualGroup (ScreenPtr pScreen, + RRGroupOfVisualGroupPtr pGroupOfVisualGroup); + + +/* + * Then, register the specific size with the screen + */ + +RRScreenSizePtr +RRRegisterSize (ScreenPtr pScreen, + short width, + short height, + short mmWidth, + short mmHeight, + RRGroupOfVisualGroup *visualgroups); + +/* + * Finally, set the current configuration of the screen + */ + +void +RRSetCurrentConfig (ScreenPtr pScreen, + Rotation rotation, + RRScreenSizePtr pSize, + RRVisualGroupPtr pVisualGroup); + +Bool +miRandRInit (ScreenPtr pScreen); + +Bool +miRRSetConfig (ScreenPtr pScreen, + Rotation rotation, + RRScreenSizePtr size, + RRVisualGroupPtr pVisualGroup); + +Bool +miRRGetScreenInfo (ScreenPtr pScreen); + +#endif /* _RANDRSTR_H_ */ Index: xc/programs/Xserver/record/Imakefile diff -u xc/programs/Xserver/record/Imakefile:1.11 xc/programs/Xserver/record/Imakefile:1.12 --- xc/programs/Xserver/record/Imakefile:1.11 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/record/Imakefile Fri Nov 2 18:29:34 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/record/Imakefile,v 1.11 2001/01/17 22:37:14 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/record/Imakefile,v 1.12 2001/11/02 23:29:34 dawes Exp $ #if DoLoadableServer #define IHaveSubdirs @@ -14,8 +14,8 @@ #if DoLoadableServer SUBDIRS = module #endif - SRCS = record.c set.c $(MSRCS) - OBJS = record.o set.o $(MOBJS) + SRCS = record.c set.c + OBJS = record.o set.o INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) LINTLIBS = ../dix/llib-ldix.ln DEFINES = -DNDEBUG Index: xc/programs/Xserver/record/record.c diff -u xc/programs/Xserver/record/record.c:1.7 xc/programs/Xserver/record/record.c:1.9 --- xc/programs/Xserver/record/record.c:1.7 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/record/record.c Fri Dec 14 15:00:37 2001 @@ -1,10 +1,14 @@ -/* $Xorg: record.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ +/* $Xorg: record.c,v 1.4 2001/02/09 02:05:27 xorgcvs Exp $ */ /* Copyright 1995, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -28,7 +32,7 @@ and Jim Haggerty of Metheus. */ -/* $XFree86: xc/programs/Xserver/record/record.c,v 1.7 2001/01/17 22:37:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/record/record.c,v 1.9 2001/12/14 20:00:37 dawes Exp $ */ #define NEED_EVENTS #include "dixstruct.h" @@ -288,7 +292,7 @@ int numElemHeaders = 0; Bool recordingClientSwapped = pContext->pRecordingClient->swapped; int n; - CARD32 serverTime; + CARD32 serverTime = 0; Bool gotServerTime = FALSE; int replylen; @@ -981,8 +985,8 @@ (pointer)pClientPriv; pClient->requestVector = pClientPriv->recordVector; } - while (pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet, - pIter, &interval)) + while ((pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet, + pIter, &interval))) { unsigned int j; for (j = interval.first; j <= interval.last; j++) @@ -1080,9 +1084,9 @@ RecordSetInterval interval; otherRCAPwantsProcVector = TRUE; - while (pIter = RecordIterateSet( + while ((pIter = RecordIterateSet( pOtherRCAP->pRequestMajorOpSet, - pIter, &interval)) + pIter, &interval))) { unsigned int j; for (j = interval.first; j <= interval.last; j++) @@ -1243,7 +1247,7 @@ RecordClientsAndProtocolPtr pRCAP; int position; - if (pRCAP = RecordFindClientOnContext(pContext, clientspec, &position)) + if ((pRCAP = RecordFindClientOnContext(pContext, clientspec, &position))) RecordDeleteClientFromRCAP(pRCAP, position); } /* RecordDeleteClientFromContext */ @@ -1698,8 +1702,8 @@ int maxSets; int nExtReqSets = 0; int nExtRepSets = 0; - int extReqSetsOffset; - int extRepSetsOffset; + int extReqSetsOffset = 0; + int extRepSetsOffset = 0; SetInfoPtr pExtReqSets, pExtRepSets; int clientListOffset; XID *pCanonClients; @@ -1966,7 +1970,7 @@ ProcRecordQueryVersion(client) ClientPtr client; { - REQUEST(xRecordQueryVersionReq); + /* REQUEST(xRecordQueryVersionReq); */ xRecordQueryVersionReply rep; int n; @@ -2188,7 +2192,7 @@ return Success; nRanges = pStartIndex ? *pStartIndex : 0; - while (pIter = RecordIterateSet(pSet, pIter, &interval)) + while ((pIter = RecordIterateSet(pSet, pIter, &interval))) { if (interval.first > imax) break; if (interval.last > imax) interval.last = imax; @@ -2604,7 +2608,7 @@ * As a result, the RCAPs will be freed. */ - while (pRCAP = pContext->pListOfRCAP) + while ((pRCAP = pContext->pListOfRCAP)) { int numClients = pRCAP->numClients; /* when the last client is deleted, the RCAP will go away. */ @@ -2928,8 +2932,8 @@ RecordClientsAndProtocolPtr pRCAP; RecordContextPtr pContext = ppAllContexts[i]; - if (pRCAP = RecordFindClientOnContext(pContext, - XRecordFutureClients, NULL)) + if ((pRCAP = RecordFindClientOnContext(pContext, + XRecordFutureClients, NULL))) { RecordAddClientToRCAP(pRCAP, pClient->clientAsMask); if (pContext->pRecordingClient && pRCAP->clientStarted) @@ -2948,8 +2952,8 @@ if (pContext->pRecordingClient == pClient) RecordDisableContext(pContext); - if (pRCAP = RecordFindClientOnContext(pContext, - pClient->clientAsMask, &pos)) + if ((pRCAP = RecordFindClientOnContext(pContext, + pClient->clientAsMask, &pos))) { if (pContext->pRecordingClient && pRCAP->clientDied) RecordAProtocolElement(pContext, pClient, @@ -2959,6 +2963,8 @@ } break; + default: + break; } /* end switch on client state */ } /* RecordAClientStateChange */ Index: xc/programs/Xserver/record/set.c diff -u xc/programs/Xserver/record/set.c:1.6 xc/programs/Xserver/record/set.c:1.7 --- xc/programs/Xserver/record/set.c:1.6 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/record/set.c Fri Dec 14 15:00:37 2001 @@ -1,10 +1,14 @@ -/* $Xorg: set.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ +/* $Xorg: set.c,v 1.4 2001/02/09 02:05:27 xorgcvs Exp $ */ /* Copyright 1995, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/record/set.c,v 1.6 2001/01/17 22:37:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/record/set.c,v 1.7 2001/12/14 20:00:37 dawes Exp $ */ /* Index: xc/programs/Xserver/record/set.h diff -u xc/programs/Xserver/record/set.h:1.1.1.3 xc/programs/Xserver/record/set.h:1.2 --- xc/programs/Xserver/record/set.h:1.1.1.3 Tue Jan 16 17:45:18 2001 +++ xc/programs/Xserver/record/set.h Fri Dec 14 15:00:37 2001 @@ -1,10 +1,14 @@ -/* $Xorg: set.h,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ +/* $Xorg: set.h,v 1.4 2001/02/09 02:05:27 xorgcvs Exp $ */ /* Copyright 1995, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/Xserver/render/Imakefile diff -u xc/programs/Xserver/render/Imakefile:1.6 xc/programs/Xserver/render/Imakefile:1.7 --- xc/programs/Xserver/render/Imakefile:1.6 Sun Jan 21 16:19:39 2001 +++ xc/programs/Xserver/render/Imakefile Wed Jul 18 06:15:02 2001 @@ -1,8 +1,9 @@ -XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.6 2001/01/21 21:19:39 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.7 2001/07/18 10:15:02 keithp Exp $ #include <Server.tmpl> SRCS = glyph.c \ miglyph.c \ + miindex.c \ mipict.c \ mirect.c \ picture.c \ @@ -10,6 +11,7 @@ OBJS = glyph.o \ miglyph.o \ + miindex.o \ mipict.o \ mirect.o \ picture.o \ Index: xc/programs/Xserver/render/glyph.c diff -u xc/programs/Xserver/render/glyph.c:1.5 xc/programs/Xserver/render/glyph.c:1.6 --- xc/programs/Xserver/render/glyph.c:1.5 Tue Jan 30 02:01:22 2001 +++ xc/programs/Xserver/render/glyph.c Sat Oct 27 23:34:19 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/glyph.c,v 1.5 2001/01/30 07:01:22 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/glyph.c,v 1.6 2001/10/28 03:34:19 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -44,32 +44,32 @@ * p and p-2 are both prime. These tables are sized to have an extra 10% * free to avoid exponential performance degradation as the hash table fills */ -GlyphHashSetRec glyphHashSets[] = { - 32, 43, 41, - 64, 73, 71, - 128, 151, 149, - 256, 283, 281, - 512, 571, 569, - 1024, 1153, 1151, - 2048, 2269, 2267, - 4096, 4519, 4517, - 8192, 9013, 9011, - 16384, 18043, 18041, - 32768, 36109, 36107, - 65536, 72091, 72089, - 131072, 144409, 144407, - 262144, 288361, 288359, - 524288, 576883, 576881, - 1048576, 1153459, 1153457, - 2097152, 2307163, 2307161, - 4194304, 4613893, 4613891, - 8388608, 9227641, 9227639, - 16777216, 18455029, 18455027, - 33554432, 36911011, 36911009, - 67108864, 73819861, 73819859, - 134217728, 147639589, 147639587, - 268435456, 295279081, 295279079, - 536870912, 590559793, 590559791, +static GlyphHashSetRec glyphHashSets[] = { + { 32, 43, 41 }, + { 64, 73, 71 }, + { 128, 151, 149 }, + { 256, 283, 281 }, + { 512, 571, 569 }, + { 1024, 1153, 1151 }, + { 2048, 2269, 2267 }, + { 4096, 4519, 4517 }, + { 8192, 9013, 9011 }, + { 16384, 18043, 18041 }, + { 32768, 36109, 36107 }, + { 65536, 72091, 72089 }, + { 131072, 144409, 144407 }, + { 262144, 288361, 288359 }, + { 524288, 576883, 576881 }, + { 1048576, 1153459, 1153457 }, + { 2097152, 2307163, 2307161 }, + { 4194304, 4613893, 4613891 }, + { 8388608, 9227641, 9227639 }, + { 16777216, 18455029, 18455027 }, + { 33554432, 36911011, 36911009 }, + { 67108864, 73819861, 73819859 }, + { 134217728, 147639589, 147639587 }, + { 268435456, 295279081, 295279079 }, + { 536870912, 590559793, 590559791 } }; #define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0])) Index: xc/programs/Xserver/render/miindex.c diff -u /dev/null xc/programs/Xserver/render/miindex.c:1.4 --- /dev/null Fri Jan 18 15:26:53 2002 +++ xc/programs/Xserver/render/miindex.c Tue Jul 31 17:06:56 2001 @@ -0,0 +1,252 @@ +/* + * $XFree86: xc/programs/Xserver/render/miindex.c,v 1.4 2001/07/31 21:06:56 alanh Exp $ + * + * Copyright © 2001 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. + */ + +#ifndef _MIINDEX_H_ +#define _MIINDEX_H_ + +#include "scrnintstr.h" +#include "gcstruct.h" +#include "pixmapstr.h" +#include "windowstr.h" +#include "mi.h" +#include "picturestr.h" +#include "mipict.h" +#include "colormapst.h" + +Bool +miBuildRenderColormap (ColormapPtr pColormap, + int num, + Pixel *first, + Pixel *last) +{ + int cube, ramp; + int r, g, b; + unsigned short red, green, blue; + Pixel pix; + + cube = 0; + if ((pColormap->pVisual->class | DynamicClass) == PseudoColor) + { + for (cube = 0; cube * cube * cube < num; cube++) + ; + cube--; + } + if (cube == 1) + cube = 0; + ramp = num - (cube * cube * cube); + *first = MI_MAX_INDEXED; + *last = 0; + for (r = 0; r < cube; r++) + for (g = 0; g < cube; g++) + for (b = 0; b < cube; b++) + { + red = r * 65535 / (cube - 1); + green = g * 65535 / (cube - 1); + blue = b * 65535 / (cube - 1); + if (AllocColor (pColormap, &red, &green, &blue, &pix, 0) != Success) + return FALSE; + if (pix < *first) + *first = pix; + if (pix > *last) + *last = pix; + } + for (g = 0; g < ramp; g++) + { + red = + green = + blue = g * 65535 / (ramp - 1); + if (AllocColor (pColormap, &red, &green, &blue, &pix, 0) != Success) + return FALSE; + if (pix < *first) + *first = pix; + if (pix > *last) + *last = pix; + } + + return TRUE; +} + +/* 0 <= red, green, blue < 32 */ +static Pixel +FindBestColor (miIndexedPtr pIndexed, int first, int num, + int red, int green, int blue) +{ + Pixel best = first; + int bestDist = 1 << 30; + int dist; + int dr, dg, db; + while (num--) + { + CARD32 v = pIndexed->rgba[first]; + + dr = ((v >> 19) & 0x1f); + dg = ((v >> 11) & 0x1f); + db = ((v >> 3) & 0x1f); + dr = dr - red; + dg = dg - green; + db = db - blue; + dist = dr * dr + dg * dg + db * db; + if (dist < bestDist) + { + bestDist = dist; + best = first; + } + first++; + } + return best; +} + +/* 0 <= gray < 32768 */ +static Pixel +FindBestGray (miIndexedPtr pIndexed, int first, int num, int gray) +{ + Pixel best = first; + int bestDist = 1 << 30; + int dist; + int dr; + int r; + + while (num--) + { + CARD32 v = pIndexed->rgba[first]; + + r = v & 0xff; + r = r | (r << 8); + dr = gray - (r >> 1); + dist = dr * dr; + if (dist < bestDist) + { + bestDist = dist; + best = first; + } + first++; + } + return best; +} + +Bool +miInitIndexed (ScreenPtr pScreen, + PictFormatPtr pFormat) +{ + miIndexedPtr pIndexed; + int num; + Pixel first, last; + Pixel pix[MI_MAX_INDEXED]; + xrgb rgb[MI_MAX_INDEXED]; + Pixel p, r, g, b; + + if (pFormat->pVisual->ColormapEntries > MI_MAX_INDEXED) + return FALSE; + pIndexed = xalloc (sizeof (miIndexedRec)); + if (!pIndexed) + return FALSE; + num = pFormat->pVisual->ColormapEntries; + first = 0; + last = num - 1; + if (pFormat->pVisual->class & DynamicClass) + { + if (pFormat->pVisual->vid == pScreen->rootVisual) + { + if (num > 100) + num = num - 10; + else + num = num / 2; + } + if (!miBuildRenderColormap (pFormat->pColormap, num, &first, &last)) + { + xfree (pIndexed); + return FALSE; + } + } + /* + * Build mapping from pixel value to ARGB + */ + for (p = 0; p < pFormat->pVisual->ColormapEntries; p++) + pix[p] = p; + QueryColors (pFormat->pColormap, pFormat->pVisual->ColormapEntries, + pix, rgb); + for (p = 0; p < pFormat->pVisual->ColormapEntries; p++) + pIndexed->rgba[p] = (0xff000000 | + ((rgb[p].red & 0xff00) << 8) | + ((rgb[p].green & 0xff00) ) | + ((rgb[p].blue & 0xff00) >> 8)); + /* + * Build mapping from RGB to pixel value. This could probably be + * done a bit quicker... + */ + switch (pFormat->pVisual->class | DynamicClass) { + case GrayScale: + pIndexed->color = FALSE; + for (r = 0; r < 32768; r++) + pIndexed->ent[r] = FindBestGray (pIndexed, first, last-first+1, r); + break; + case PseudoColor: + pIndexed->color = TRUE; + p = 0; + for (r = 0; r < 32; r++) + for (g = 0; g < 32; g++) + for (b = 0; b < 32; b++) + { + pIndexed->ent[p] = FindBestColor (pIndexed, first, last-first+1, r, g, b); + p++; + } + break; + } + pFormat->indexed = pIndexed; + return TRUE; +} + +void +miCloseIndexed (ScreenPtr pScreen, + PictFormatPtr pFormat) +{ + if (pFormat->indexed) + { + xfree (pFormat->indexed); + pFormat->indexed = 0; + } +} + +void +miUpdateIndexed (ScreenPtr pScreen, + PictFormatPtr pFormat, + int ndef, + xColorItem *pdef) +{ + miIndexedPtr pIndexed = pFormat->indexed; + + if (pIndexed) + { + while (ndef--) + { + pIndexed->rgba[pdef->pixel] = (0xff000000 | + ((pdef->red & 0xff00) << 8) | + ((pdef->green & 0xff00) ) | + ((pdef->blue & 0xff00) >> 8)); + pdef++; + } + } +} + +#endif /* _MIINDEX_H_ */ Index: xc/programs/Xserver/render/mipict.c diff -u xc/programs/Xserver/render/mipict.c:1.6.2.1 xc/programs/Xserver/render/mipict.c:1.10 --- xc/programs/Xserver/render/mipict.c:1.6.2.1 Thu May 31 21:06:35 2001 +++ xc/programs/Xserver/render/mipict.c Thu Jul 19 00:42:10 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/mipict.c,v 1.6.2.1 2001/06/01 01:06:35 dawes Exp $ + * $XFree86: xc/programs/Xserver/render/mipict.c,v 1.10 2001/07/19 04:42:10 keithp Exp $ * * Copyright © 1999 Keith Packard * @@ -329,7 +329,6 @@ CARD16 width, CARD16 height) { - RegionPtr pDstClip = pDst->pCompositeClip; int v; pRegion->extents.x1 = xDst; @@ -345,6 +344,16 @@ REGION_UNINIT (pScreen, pRegion); return FALSE; } + if (pSrc->alphaMap) + { + if (!miClipPictureSrc (pRegion, pSrc->alphaMap, + xDst - (xSrc + pSrc->alphaOrigin.x), + yDst - (ySrc + pSrc->alphaOrigin.y))) + { + REGION_UNINIT (pScreen, pRegion); + return FALSE; + } + } /* clip against mask */ if (pMask) { @@ -353,12 +362,32 @@ REGION_UNINIT (pScreen, pRegion); return FALSE; } + if (pMask->alphaMap) + { + if (!miClipPictureSrc (pRegion, pMask->alphaMap, + xDst - (xMask + pMask->alphaOrigin.x), + yDst - (yMask + pMask->alphaOrigin.y))) + { + REGION_UNINIT (pScreen, pRegion); + return FALSE; + } + } } - if (!miClipPictureReg (pRegion, pDstClip, 0, 0)) + if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0)) { REGION_UNINIT (pScreen, pRegion); return FALSE; } + if (pDst->alphaMap) + { + if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip, + -pDst->alphaOrigin.x, + -pDst->alphaOrigin.y)) + { + REGION_UNINIT (pScreen, pRegion); + return FALSE; + } + } return TRUE; } @@ -367,8 +396,9 @@ xRenderColor *color, CARD32 *pixel) { - CARD32 r, g, b, a; - + CARD32 r, g, b, a; + miIndexedPtr pIndexed; + switch (format->type) { case PictTypeDirect: r = color->red >> (16 - Ones (format->direct.redMask)); @@ -382,7 +412,21 @@ *pixel = r|g|b|a; break; case PictTypeIndexed: - *pixel = 0; + pIndexed = (miIndexedPtr) (format->indexed); + if (pIndexed->color) + { + r = color->red >> 11; + g = color->green >> 11; + b = color->blue >> 11; + *pixel = miIndexToEnt15 (pIndexed, (r << 10) | (g << 5) | b); + } + else + { + r = color->red >> 8; + g = color->green >> 8; + b = color->blue >> 8; + *pixel = miIndexToEntY24 (pIndexed, (r << 16) | (g << 8) | b); + } break; } } @@ -403,7 +447,8 @@ CARD32 pixel, xRenderColor *color) { - CARD32 r, g, b, a; + CARD32 r, g, b, a; + miIndexedPtr pIndexed; switch (format->type) { case PictTypeDirect: @@ -417,10 +462,15 @@ color->alpha = miFillColor (r, Ones (format->direct.alphaMask)); break; case PictTypeIndexed: - color->red = 0; - color->green = 0; - color->blue = 0; - color->alpha = 0; + pIndexed = (miIndexedPtr) (format->indexed); + pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED-1)]; + r = (pixel >> 16) & 0xff; + g = (pixel >> 8) & 0xff; + b = (pixel ) & 0xff; + color->red = miFillColor (r, 8); + color->green = miFillColor (g, 8); + color->blue = miFillColor (b, 8); + color->alpha = 0xffff; break; } } @@ -439,5 +489,8 @@ ps->DestroyPictureClip = miDestroyPictureClip; ps->ChangePicture = miChangePicture; ps->ValidatePicture = miValidatePicture; + ps->InitIndexed = miInitIndexed; + ps->CloseIndexed = miCloseIndexed; + ps->UpdateIndexed = miUpdateIndexed; return TRUE; } Index: xc/programs/Xserver/render/mipict.h diff -u xc/programs/Xserver/render/mipict.h:1.5 xc/programs/Xserver/render/mipict.h:1.8 --- xc/programs/Xserver/render/mipict.h:1.5 Sun Jan 21 16:19:39 2001 +++ xc/programs/Xserver/render/mipict.h Thu Jul 19 00:42:10 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/mipict.h,v 1.5 2001/01/21 21:19:39 tsi Exp $ + * $XFree86: xc/programs/Xserver/render/mipict.h,v 1.8 2001/07/19 04:42:10 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -28,6 +28,41 @@ #include "picturestr.h" +#define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */ + +#if MI_MAX_INDEXED <= 256 +typedef CARD8 miIndexType; +#endif + +typedef struct _miIndexed { + Bool color; + CARD32 rgba[MI_MAX_INDEXED]; + miIndexType ent[32768]; +} miIndexedRec, *miIndexedPtr; + +#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \ + (((s) >> 6) & 0x03e0) | \ + (((s) >> 9) & 0x7c00)) +#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15]) +#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24)) + +/* + * Standard NTSC luminance conversions: + * + * y = r * 0.299 + g * 0.587 + b * 0.114 + * + * Approximate this for a bit more speed: + * + * y = (r * 153 + g * 301 + b * 58) / 512 + * + * This gives 17 bits of luminance; to get 15 bits, lop the low two + */ + +#define miCvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \ + (((s) >> 8) & 0xff) * 301 + \ + (((s) ) & 0xff) * 58) >> 2) +#define miIndexToEntY24(mif,rgb24) ((mif)->ent[miCvtR8G8B8toY15(rgb24)]) + int miCreatePicture (PicturePtr pPicture); @@ -110,5 +145,19 @@ xRenderColor *color, int nRect, xRectangle *rects); + +Bool +miInitIndexed (ScreenPtr pScreen, + PictFormatPtr pFormat); + +void +miCloseIndexed (ScreenPtr pScreen, + PictFormatPtr pFormat); + +void +miUpdateIndexed (ScreenPtr pScreen, + PictFormatPtr pFormat, + int ndef, + xColorItem *pdef); #endif /* _MIPICT_H_ */ Index: xc/programs/Xserver/render/mirect.c diff -u xc/programs/Xserver/render/mirect.c:1.3 xc/programs/Xserver/render/mirect.c:1.4 --- xc/programs/Xserver/render/mirect.c:1.3 Fri Dec 8 02:52:05 2000 +++ xc/programs/Xserver/render/mirect.c Fri Jun 8 15:36:34 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/mirect.c,v 1.3 2000/12/08 07:52:05 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/mirect.c,v 1.4 2001/06/08 19:36:34 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -30,6 +30,66 @@ #include "picturestr.h" #include "mipict.h" +static void +miColorRects (PicturePtr pDst, + PicturePtr pClipPict, + xRenderColor *color, + int nRect, + xRectangle *rects, + int xoff, + int yoff) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + CARD32 pixel; + GCPtr pGC; + CARD32 tmpval[4]; + RegionPtr pClip; + unsigned long mask; + + miRenderColorToPixel (pDst->pFormat, color, &pixel); + + pGC = GetScratchGC (pDst->pDrawable->depth, pScreen); + if (!pGC) + return; + tmpval[0] = GXcopy; + tmpval[1] = pixel; + mask = GCFunction | GCForeground; + if (pClipPict->clientClipType == CT_REGION) + { + tmpval[2] = pDst->clipOrigin.x - xoff; + tmpval[3] = pDst->clipOrigin.y - yoff; + mask |= CPClipXOrigin|CPClipYOrigin; + + pClip = REGION_CREATE (pScreen, NULL, 1); + REGION_COPY (pScreen, pClip, + (RegionPtr) pClipPict->clientClip); + (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); + } + + ChangeGC (pGC, mask, tmpval); + ValidateGC (pDst->pDrawable, pGC); + if (xoff || yoff) + { + int i; + for (i = 0; i < nRect; i++) + { + rects[i].x -= xoff; + rects[i].y -= yoff; + } + } + (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects); + if (xoff || yoff) + { + int i; + for (i = 0; i < nRect; i++) + { + rects[i].x += xoff; + rects[i].y += yoff; + } + } + FreeScratchGC (pGC); +} + void miCompositeRects (CARD8 op, PicturePtr pDst, @@ -38,12 +98,6 @@ xRectangle *rects) { ScreenPtr pScreen = pDst->pDrawable->pScreen; - CARD32 pixel; - GCPtr pGC; - CARD32 tmpval[4]; - unsigned long mask; - int error; - RegionPtr pClip; if (color->alpha == 0xffff) { @@ -55,30 +109,12 @@ if (op == PictOpSrc || op == PictOpClear) { - miRenderColorToPixel (pDst->pFormat, color, &pixel); - - pGC = GetScratchGC (pDst->pDrawable->depth, pScreen); - if (!pGC) - return; - tmpval[0] = GXcopy; - tmpval[1] = pixel; - mask = GCFunction | GCForeground; - if (pDst->clientClipType == CT_REGION) - { - tmpval[2] = pDst->clipOrigin.x; - tmpval[3] = pDst->clipOrigin.y; - mask |= CPClipXOrigin|CPClipYOrigin; - - pClip = REGION_CREATE (pScreen, NULL, 1); - REGION_COPY (pScreen, pClip, - (RegionPtr) pDst->clientClip); - (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); - } - - ChangeGC (pGC, mask, tmpval); - ValidateGC (pDst->pDrawable, pGC); - (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects); - FreeScratchGC (pGC); + miColorRects (pDst, pDst, color, nRect, rects, 0, 0); + if (pDst->alphaMap) + miColorRects (pDst->alphaMap, pDst, + color, nRect, rects, + pDst->alphaOrigin.x, + pDst->alphaOrigin.y); } else { @@ -86,6 +122,10 @@ PixmapPtr pPixmap; PicturePtr pSrc; xRectangle one; + int error; + Pixel pixel; + GCPtr pGC; + CARD32 tmpval[2]; rgbaFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); if (!rgbaFormat) Index: xc/programs/Xserver/render/picture.c diff -u xc/programs/Xserver/render/picture.c:1.12 xc/programs/Xserver/render/picture.c:1.20 --- xc/programs/Xserver/render/picture.c:1.12 Thu Dec 7 18:54:04 2000 +++ xc/programs/Xserver/render/picture.c Wed Dec 12 23:35:41 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.c,v 1.12 2000/12/07 23:54:04 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/picture.c,v 1.20 2001/12/13 04:35:41 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -71,122 +71,344 @@ { PictureScreenPtr ps = GetPictureScreen(pScreen); Bool ret; + int n; pScreen->CloseScreen = ps->CloseScreen; ret = (*pScreen->CloseScreen) (index, pScreen); + for (n = 0; n < ps->nformats; n++) + if (ps->formats[n].type == PictTypeIndexed) + (*ps->CloseIndexed) (pScreen, &ps->formats[n]); SetPictureScreen(pScreen, 0); xfree (ps->formats); xfree (ps); return ret; } +void +PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef) +{ + ScreenPtr pScreen = pColormap->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + + pScreen->StoreColors = ps->StoreColors; + (*pScreen->StoreColors) (pColormap, ndef, pdef); + ps->StoreColors = pScreen->StoreColors; + pScreen->StoreColors = PictureStoreColors; + + if (pColormap->class == PseudoColor || pColormap->class == GrayScale) + { + PictFormatPtr format = ps->formats; + int nformats = ps->nformats; + + while (nformats--) + { + if (format->pColormap == pColormap) + { + (*ps->UpdateIndexed) (pScreen, format, ndef, pdef); + break; + } + format++; + } + } +} + +static int +visualDepth (ScreenPtr pScreen, VisualPtr pVisual) +{ + int d, v; + DepthPtr pDepth; + + for (d = 0; d < pScreen->numDepths; d++) + { + pDepth = &pScreen->allowedDepths[d]; + for (v = 0; v < pDepth->numVids; v++) + if (pDepth->vids[v] == pVisual->vid) + return pDepth->depth; + } + return 0; +} + +typedef struct _formatInit { + CARD32 format; + CARD8 depth; +} FormatInitRec, *FormatInitPtr; + +static int +addFormat (FormatInitRec formats[256], + int nformat, + CARD32 format, + CARD8 depth) +{ + int n; + + for (n = 0; n < nformat; n++) + if (formats[n].format == format && formats[n].depth == depth) + return nformat; + formats[nformat].format = format; + formats[nformat].depth = depth; + return ++nformat; +} + +#define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n))-1)) + PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) { - int nformats; + int nformats, f; PictFormatPtr pFormats; - int i; + FormatInitRec formats[1024]; + CARD32 format; + CARD8 depth; + VisualPtr pVisual; + int v; + int bpp; + int type; + int r, g, b; + int d; + DepthPtr pDepth; + + nformats = 0; + /* formats required by protocol */ + formats[nformats].format = PICT_a1; + formats[nformats].depth = 1; + nformats++; + formats[nformats].format = PICT_a8; + formats[nformats].depth = 8; + nformats++; + formats[nformats].format = PICT_a4; + formats[nformats].depth = 4; + nformats++; + formats[nformats].format = PICT_a8r8g8b8; + formats[nformats].depth = 32; + nformats++; + formats[nformats].format = PICT_x8r8g8b8; + formats[nformats].depth = 32; + nformats++; + + /* now look through the depths and visuals adding other formats */ + for (v = 0; v < pScreen->numVisuals; v++) + { + pVisual = &pScreen->visuals[v]; + depth = visualDepth (pScreen, pVisual); + if (!depth) + continue; + bpp = BitsPerPixel (depth); + switch (pVisual->class) { + case DirectColor: + case TrueColor: + r = Ones (pVisual->redMask); + g = Ones (pVisual->greenMask); + b = Ones (pVisual->blueMask); + type = PICT_TYPE_OTHER; + /* + * Current rendering code supports only two direct formats, + * fields must be packed together at the bottom of the pixel + * and must be either RGB or BGR + */ + if (pVisual->offsetBlue == 0 && + pVisual->offsetGreen == b && + pVisual->offsetRed == b + g) + { + type = PICT_TYPE_ARGB; + } + else if (pVisual->offsetRed == 0 && + pVisual->offsetGreen == r && + pVisual->offsetBlue == r + g) + { + type = PICT_TYPE_ABGR; + } + if (type != PICT_TYPE_OTHER) + { + format = PICT_FORMAT(bpp, type, 0, r, g, b); + nformats = addFormat (formats, nformats, format, depth); + } + break; + case StaticColor: + case PseudoColor: + format = PICT_FORMAT (bpp, PICT_TYPE_COLOR, v, 0, 0, 0); + nformats = addFormat (formats, nformats, format, depth); + break; + case StaticGray: + case GrayScale: + format = PICT_FORMAT (bpp, PICT_TYPE_GRAY, v, 0, 0, 0); + nformats = addFormat (formats, nformats, format, depth); + break; + } + } + /* + * Walk supported depths and add useful Direct formats + */ + for (d = 0; d < pScreen->numDepths; d++) + { + pDepth = &pScreen->allowedDepths[d]; + bpp = BitsPerPixel (pDepth->depth); + format = 0; + switch (bpp) { + case 16: + /* depth 15 formats */ + if (pDepth->depth >= 15) + { + nformats = addFormat (formats, nformats, + PICT_x1r5g5b5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_x1b5g5r5, pDepth->depth); + } + /* depth 16 formats */ + if (pDepth->depth >= 16) + { + nformats = addFormat (formats, nformats, + PICT_a1r5g5b5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_a1b5g5r5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_r5g6b5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_b5g6r5, pDepth->depth); + } + break; + case 24: + if (pDepth->depth >= 24) + { + nformats = addFormat (formats, nformats, + PICT_r8g8b8, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_b8g8r8, pDepth->depth); + } + break; + case 32: + if (pDepth->depth >= 24) + { + nformats = addFormat (formats, nformats, + PICT_x8r8g8b8, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_x8b8g8r8, pDepth->depth); + } + break; + } + } + - nformats = 7; pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec)); if (!pFormats) return 0; - i = 0; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 32; - pFormats[i].direct.red = 16; - pFormats[i].direct.redMask = 0xff; - pFormats[i].direct.green = 8; - pFormats[i].direct.greenMask = 0xff; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0xff; - pFormats[i].direct.alpha = 24; - pFormats[i].direct.alphaMask = 0xff; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 8; - pFormats[i].direct.red = 0; - pFormats[i].direct.redMask = 0; - pFormats[i].direct.green = 0; - pFormats[i].direct.greenMask = 0; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0xff; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 24; - pFormats[i].direct.red = 16; - pFormats[i].direct.redMask = 0xff; - pFormats[i].direct.green = 8; - pFormats[i].direct.greenMask = 0xff; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0xff; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0x0; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 16; - pFormats[i].direct.red = 11; - pFormats[i].direct.redMask = 0x1f; - pFormats[i].direct.green = 5; - pFormats[i].direct.greenMask = 0x3f; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0x1f; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0x0; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 15; - pFormats[i].direct.red = 10; - pFormats[i].direct.redMask = 0x1f; - pFormats[i].direct.green = 5; - pFormats[i].direct.greenMask = 0x1f; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0x1f; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0x0; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 16; - pFormats[i].direct.red = 10; - pFormats[i].direct.redMask = 0x1f; - pFormats[i].direct.green = 5; - pFormats[i].direct.greenMask = 0x1f; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0x1f; - pFormats[i].direct.alpha = 15; - pFormats[i].direct.alphaMask = 0x1; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 1; - pFormats[i].direct.red = 0; - pFormats[i].direct.redMask = 0; - pFormats[i].direct.green = 0; - pFormats[i].direct.greenMask = 0; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0x1; - pFormats[i].pColormap = 0; - i++; - *nformatp = i; + memset (pFormats, '\0', nformats * sizeof (PictFormatRec)); + for (f = 0; f < nformats; f++) + { + pFormats[f].id = FakeClientID (0); + pFormats[f].depth = formats[f].depth; + format = formats[f].format; + pFormats[f].format = format; + switch (PICT_FORMAT_TYPE(format)) { + case PICT_TYPE_ARGB: + pFormats[f].type = PictTypeDirect; + + pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); + if (pFormats[f].direct.alphaMask) + pFormats[f].direct.alpha = (PICT_FORMAT_R(format) + + PICT_FORMAT_G(format) + + PICT_FORMAT_B(format)); + + pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); + pFormats[f].direct.red = (PICT_FORMAT_G(format) + + PICT_FORMAT_B(format)); + + pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); + pFormats[f].direct.green = PICT_FORMAT_B(format); + + pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); + pFormats[f].direct.blue = 0; + break; + + case PICT_TYPE_ABGR: + pFormats[f].type = PictTypeDirect; + + pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); + if (pFormats[f].direct.alphaMask) + pFormats[f].direct.alpha = (PICT_FORMAT_B(format) + + PICT_FORMAT_G(format) + + PICT_FORMAT_R(format)); + + pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); + pFormats[f].direct.blue = (PICT_FORMAT_G(format) + + PICT_FORMAT_R(format)); + + pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); + pFormats[f].direct.green = PICT_FORMAT_R(format); + + pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); + pFormats[f].direct.red = 0; + break; + + case PICT_TYPE_A: + pFormats[f].type = PictTypeDirect; + + pFormats[f].direct.alpha = 0; + pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); + + /* remaining fields already set to zero */ + break; + + case PICT_TYPE_COLOR: + case PICT_TYPE_GRAY: + pFormats[f].type = PictTypeIndexed; + pFormats[f].format = PICT_FORMAT(PICT_FORMAT_BPP(format), + PICT_FORMAT_TYPE(format), + 0, 0, 0, 0); + pFormats[f].pVisual = &pScreen->visuals[PICT_FORMAT_A(format)]; + break; + } + } + *nformatp = nformats; return pFormats; } +Bool +PictureInitIndexedFormats (ScreenPtr pScreen) +{ + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); + PictFormatPtr format; + int nformat; + + if (!ps) + return FALSE; + format = ps->formats; + nformat = ps->nformats; + while (nformat--) + { + if (format->type == PictTypeIndexed && !format->pColormap) + { + if (format->pVisual->vid == pScreen->rootVisual) + format->pColormap = (ColormapPtr) LookupIDByType(pScreen->defColormap, + RT_COLORMAP); + else + { + if (CreateColormap (FakeClientID (0), pScreen, + format->pVisual, + &format->pColormap, AllocNone, + 0) != Success) + { + return FALSE; + } + } + if (!(*ps->InitIndexed) (pScreen, format)) + return FALSE; + } + format++; + } + return TRUE; +} + +Bool +PictureFinishInit (void) +{ + int s; + + for (s = 0; s < screenInfo.numScreens; s++) + if (!PictureInitIndexedFormats (screenInfo.screens[s])) + return FALSE; + return TRUE; +} + PictFormatPtr PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual) { @@ -219,7 +441,7 @@ { if (type == PictTypeIndexed) { - if (format->pColormap && format->pColormap->pVisual == pVisual) + if (format->pVisual == pVisual) return format; } else @@ -302,7 +524,10 @@ } if (formats[n].type == PictTypeIndexed) { - type = PICT_TYPE_INDEX; + if ((formats[n].pVisual->class | DynamicClass) == PseudoColor) + type = PICT_TYPE_COLOR; + else + type = PICT_TYPE_GRAY; a = r = g = b = 0; } else @@ -347,8 +572,10 @@ ps->CloseScreen = pScreen->CloseScreen; ps->DestroyWindow = pScreen->DestroyWindow; + ps->StoreColors = pScreen->StoreColors; pScreen->DestroyWindow = PictureDestroyWindow; pScreen->CloseScreen = PictureCloseScreen; + pScreen->StoreColors = PictureStoreColors; return TRUE; } @@ -364,6 +591,7 @@ pPicture->polyMode = PolyModePrecise; pPicture->freeCompClip = FALSE; pPicture->clientClipType = CT_NONE; + pPicture->componentAlpha = FALSE; pPicture->alphaMap = 0; pPicture->alphaOrigin.x = 0; @@ -715,8 +943,8 @@ return result; } -void -ValidatePicture(PicturePtr pPicture) +static void +ValidateOnePicture (PicturePtr pPicture) { if (pPicture->serialNumber != pPicture->pDrawable->serialNumber) { @@ -726,6 +954,14 @@ pPicture->stateChanges = 0; pPicture->serialNumber = pPicture->pDrawable->serialNumber; } +} + +void +ValidatePicture(PicturePtr pPicture) +{ + ValidateOnePicture (pPicture); + if (pPicture->alphaMap) + ValidateOnePicture (pPicture->alphaMap); } int Index: xc/programs/Xserver/render/picture.h diff -u xc/programs/Xserver/render/picture.h:1.5 xc/programs/Xserver/render/picture.h:1.7 --- xc/programs/Xserver/render/picture.h:1.5 Mon Nov 20 23:11:42 2000 +++ xc/programs/Xserver/render/picture.h Fri Aug 10 18:25:59 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.h,v 1.5 2000/11/21 04:11:42 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/picture.h,v 1.7 2001/08/10 22:25:59 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -50,11 +50,12 @@ #define PICT_FORMAT_B(f) (((f) ) & 0x0f) #define PICT_FORMAT_RGB(f) (((f) ) & 0xfff) -#define PICT_OTHER 0 +#define PICT_TYPE_OTHER 0 #define PICT_TYPE_A 1 #define PICT_TYPE_ARGB 2 #define PICT_TYPE_ABGR 3 -#define PICT_TYPE_INDEX 4 +#define PICT_TYPE_COLOR 4 +#define PICT_TYPE_GRAY 5 #define PICT_FORMAT_COLOR(f) (PICT_FORMAT_TYPE(f) & 2) @@ -84,6 +85,9 @@ #define PICT_a2r2g2b2 PICT_FORMAT(8,PICT_TYPE_ARGB,2,2,2,2) #define PICT_a2b2g2r2 PICT_FORMAT(8,PICT_TYPE_ABGR,2,2,2,2) +#define PICT_c8 PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0) +#define PICT_g8 PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0) + /* 4bpp formats */ #define PICT_a4 PICT_FORMAT(4,PICT_TYPE_A,4,0,0,0) #define PICT_r1g2b1 PICT_FORMAT(4,PICT_TYPE_ARGB,0,1,2,1) @@ -91,8 +95,13 @@ #define PICT_a1r1g1b1 PICT_FORMAT(4,PICT_TYPE_ARGB,1,1,1,1) #define PICT_a1b1g1r1 PICT_FORMAT(4,PICT_TYPE_ABGR,1,1,1,1) +#define PICT_c4 PICT_FORMAT(4,PICT_TYPE_COLOR,0,0,0,0) +#define PICT_g4 PICT_FORMAT(4,PICT_TYPE_GRAY,0,0,0,0) + /* 1bpp formats */ #define PICT_a1 PICT_FORMAT(1,PICT_TYPE_A,1,0,0,0) + +#define PICT_g1 PICT_FORMAT(1,PICT_TYPE_GRAY,0,0,0,0) #define FixedToInt(f) (int) ((f) >> 8) #define IntToFixed(i) ((Fixed) (i) << 8) Index: xc/programs/Xserver/render/picturestr.h diff -u xc/programs/Xserver/render/picturestr.h:1.13 xc/programs/Xserver/render/picturestr.h:1.16 --- xc/programs/Xserver/render/picturestr.h:1.13 Thu Apr 5 13:42:35 2001 +++ xc/programs/Xserver/render/picturestr.h Tue Jul 31 20:45:00 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.13 2001/04/05 17:42:35 dawes Exp $ + * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.16 2001/08/01 00:45:00 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -43,6 +43,8 @@ unsigned char type; unsigned char depth; DirectFormatRec direct; + void *indexed; /* opaque indexed conversion data */ + VisualPtr pVisual; /* for indexed formats */ ColormapPtr pColormap; } PictFormatRec; @@ -121,6 +123,17 @@ int nRect, xRectangle *rects); +typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen, + PictFormatPtr pFormat); + +typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen, + PictFormatPtr pFormat); + +typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen, + PictFormatPtr pFormat, + int ndef, + xColorItem *pdef); + typedef struct _PictureScreen { int totalPictureSize; unsigned int *PicturePrivateSizes; @@ -145,6 +158,12 @@ DestroyWindowProcPtr DestroyWindow; CloseScreenProcPtr CloseScreen; + StoreColorsProcPtr StoreColors; + + InitIndexedProcPtr InitIndexed; + CloseIndexedProcPtr CloseIndexed; + UpdateIndexedProcPtr UpdateIndexed; + } PictureScreenRec, *PictureScreenPtr; extern int PictureScreenPrivateIndex; @@ -192,6 +211,9 @@ Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); + +Bool +PictureFinishInit (void); void SetPictureToDefaults (PicturePtr pPicture); Index: xc/programs/Xserver/render/render.c diff -u xc/programs/Xserver/render/render.c:1.10 xc/programs/Xserver/render/render.c:1.13 --- xc/programs/Xserver/render/render.c:1.10 Wed Mar 7 22:48:44 2001 +++ xc/programs/Xserver/render/render.c Wed Dec 12 23:35:41 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/render.c,v 1.10 2001/03/08 03:48:44 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/render.c,v 1.13 2001/12/13 04:35:41 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -177,6 +177,8 @@ if (!PictureType) return; + if (!PictureFinishInit ()) + return; extEntry = AddExtension (RENDER_NAME, 0, RenderNumberErrors, ProcRenderDispatch, SProcRenderDispatch, RenderResetProc, StandardMinorOpcode); @@ -543,13 +545,25 @@ return(client->noClientException); } +static Bool +PictOpValid (CARD8 op) +{ + if (/*PictOpMinimum <= op && */ op <= PictOpMaximum) + return TRUE; + if (PictOpDisjointMinimum <= op && op <= PictOpDisjointMaximum) + return TRUE; + if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum) + return TRUE; + return FALSE; +} + static int ProcRenderComposite (ClientPtr client) { PicturePtr pSrc, pMask, pDst; REQUEST(xRenderCompositeReq); - if (stuff->op > PictOpMaximum) + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; @@ -869,6 +883,11 @@ case X_RenderCompositeGlyphs32: size = 4; break; } + if (!PictOpValid (stuff->op)) + { + client->errorValue = stuff->op; + return BadValue; + } VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, @@ -1030,7 +1049,7 @@ int things; REQUEST(xRenderFillRectanglesReq); - if (stuff->op > PictOpMaximum) + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; Index: xc/programs/Xserver/xkb/Imakefile diff -u xc/programs/Xserver/xkb/Imakefile:3.16 xc/programs/Xserver/xkb/Imakefile:3.17 --- xc/programs/Xserver/xkb/Imakefile:3.16 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/xkb/Imakefile Mon Aug 27 13:41:01 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/xkb/Imakefile,v 3.16 2001/01/17 22:37:14 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/xkb/Imakefile,v 3.17 2001/08/27 17:41:01 dawes Exp $ #define SGIHyperOpt #include <Server.tmpl> @@ -72,7 +72,7 @@ LinkSourceFile(XKBAlloc.c,$(XLIBSRC)) LinkSourceFile(XKBGAlloc.c,$(XLIBSRC)) -#if UseConfDirForXkb +#if UseConfDirForXkb && BuildLibraries LinkConfDirectory(xkb,.,xkb,.) #endif Index: xc/programs/Xserver/xkb/ddxConfig.c diff -u xc/programs/Xserver/xkb/ddxConfig.c:3.4 xc/programs/Xserver/xkb/ddxConfig.c:3.5 --- xc/programs/Xserver/xkb/ddxConfig.c:3.4 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/xkb/ddxConfig.c Thu Aug 23 10:33:25 2001 @@ -24,7 +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 $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxConfig.c,v 3.5 2001/08/23 14:33:25 alanh Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -107,7 +107,6 @@ char * dName; FILE * file; XkbConfigRtrnPtr rtrn; -extern char * display; #if defined(MetroLink) if (dev && dev->name) Index: xc/programs/Xserver/xkb/ddxDevBtn.c diff -u xc/programs/Xserver/xkb/ddxDevBtn.c:3.1 xc/programs/Xserver/xkb/ddxDevBtn.c:3.3 --- xc/programs/Xserver/xkb/ddxDevBtn.c:3.1 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/xkb/ddxDevBtn.c Thu Aug 23 17:49:51 2001 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/ddxDevBtn.c,v 3.3 2001/08/23 21:49:51 tsi Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -37,7 +38,7 @@ #include "XI.h" #include "XIproto.h" -extern int DeviceButtonPress,DeviceButtonRelease,DeviceValuator; +extern int DeviceValuator; void #if NeedFunctionPrototypes Index: xc/programs/Xserver/xkb/ddxList.c diff -u xc/programs/Xserver/xkb/ddxList.c:3.6 xc/programs/Xserver/xkb/ddxList.c:3.7 --- xc/programs/Xserver/xkb/ddxList.c:3.6 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/xkb/ddxList.c Sat Oct 27 23:34:19 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/ddxList.c,v 3.6 2001/01/17 22:37:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxList.c,v 3.7 2001/10/28 03:34:19 tsi Exp $ */ #include <stdio.h> #include <ctype.h> @@ -174,13 +174,13 @@ +(xkbDebugFlags>9?2:1)+strlen(file)+31 > PATH_MAX) return BadImplementation; #ifndef WIN32 - sprintf(buf,"%s/xkbcomp -R%s/%s -w %d -l -vlfhpR '%s'", - XkbBaseDirectory,XkbBaseDirectory,componentDirs[what], + sprintf(buf,"%s/xkbcomp -R%s/%s -w %ld -l -vlfhpR '%s'", + XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],(long) ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), file); #else - sprintf(buf,"%s/xkbcomp -R%s/%s -w %d -l -vlfhpR '%s' %s", - XkbBaseDirectory,XkbBaseDirectory,componentDirs[what], + sprintf(buf,"%s/xkbcomp -R%s/%s -w %ld -l -vlfhpR '%s' %s", + XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],(long) ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), file, tmpname); #endif @@ -199,13 +199,13 @@ +(xkbDebugFlags>9?2:1)+strlen(file)+29 > PATH_MAX) return BadImplementation; #ifndef WIN32 - sprintf(buf,"xkbcomp -R%s -w %d -l -vlfhpR '%s'", - componentDirs[what], + sprintf(buf,"xkbcomp -R%s -w %ld -l -vlfhpR '%s'", + componentDirs[what],(long) ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), file); #else - sprintf(buf,"xkbcomp -R%s -w %d -l -vlfhpR '%s' %s", - componentDirs[what], + sprintf(buf,"xkbcomp -R%s -w %ld -l -vlfhpR '%s' %s", + componentDirs[what],(long) ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), file, tmpname); #endif Index: xc/programs/Xserver/xkb/ddxLoad.c diff -u xc/programs/Xserver/xkb/ddxLoad.c:3.27 xc/programs/Xserver/xkb/ddxLoad.c:3.28 --- xc/programs/Xserver/xkb/ddxLoad.c:3.27 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/xkb/ddxLoad.c Thu Aug 23 10:33:25 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.27 2001/01/17 22:37:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.28 2001/08/23 14:33:25 alanh Exp $ */ #include <stdio.h> #include <ctype.h> @@ -229,7 +229,6 @@ int i; #endif if ((names->keymap==NULL)||(names->keymap[0]=='\0')) { - extern char *display; sprintf(keymap,"server-%s",display); } else { Index: xc/programs/Xserver/xkb/xkb.c diff -u xc/programs/Xserver/xkb/xkb.c:3.14 xc/programs/Xserver/xkb/xkb.c:3.15 --- xc/programs/Xserver/xkb/xkb.c:3.14 Wed Jan 17 17:37:14 2001 +++ xc/programs/Xserver/xkb/xkb.c Thu Aug 23 10:33:25 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkb.c,v 3.14 2001/01/17 22:37:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkb.c,v 3.15 2001/08/23 14:33:25 alanh Exp $ */ #include <stdio.h> #include "X.h" @@ -232,7 +232,7 @@ client->mapNotifyMask&= ~stuff->affectMap; client->mapNotifyMask|= (stuff->affectMap&stuff->map); } - if (stuff->affectWhich&(~XkbMapNotifyMask)==0) + if ((stuff->affectWhich&(~XkbMapNotifyMask))==0) return client->noClientException; masks = XkbFindClientResource((DevicePtr)dev,client); @@ -1947,7 +1947,7 @@ register unsigned i; unsigned first,last; - if ((req->present&XkbKeyBehaviorsMask==0)||(req->nKeyBehaviors<1)) { + if (((req->present&XkbKeyBehaviorsMask)==0)||(req->nKeyBehaviors<1)) { req->present&= ~XkbKeyBehaviorsMask; req->nKeyBehaviors= 0; return 1; @@ -3324,9 +3324,9 @@ { DeviceIntPtr dev; xkbGetNamedIndicatorReply rep; - register int i; + register int i = 0; XkbSrvLedInfoPtr sli; - XkbIndicatorMapPtr map; + XkbIndicatorMapPtr map = NULL; Bool supported; REQUEST(xkbGetNamedIndicatorReq); @@ -3437,7 +3437,7 @@ DeviceIntPtr dev,kbd; XkbIndicatorMapPtr map; XkbSrvLedInfoPtr sli; - register int led; + register int led = 0; unsigned extDevReason; unsigned statec,namec,mapc; XkbEventCauseRec cause; @@ -6915,9 +6915,9 @@ { ExtensionEntry *extEntry; - if (extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors, + if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors, ProcXkbDispatch, SProcXkbDispatch, - XkbResetProc, StandardMinorOpcode)) { + XkbResetProc, StandardMinorOpcode))) { XkbReqCode = (unsigned char)extEntry->base; XkbEventBase = (unsigned char)extEntry->eventBase; XkbErrorBase = (unsigned char)extEntry->errorBase; Index: xc/programs/Xserver/xkb/xkbAccessX.c diff -u xc/programs/Xserver/xkb/xkbAccessX.c:1.7 xc/programs/Xserver/xkb/xkbAccessX.c:1.9 --- xc/programs/Xserver/xkb/xkbAccessX.c:1.7 Mon Feb 12 13:26:00 2001 +++ xc/programs/Xserver/xkb/xkbAccessX.c Thu Aug 23 10:33:25 2001 @@ -1,4 +1,4 @@ -/* $Xorg: xkbAccessX.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ +/* $Xorg: xkbAccessX.c,v 1.4 2001/02/05 18:50:20 coskrey 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.7 2001/02/12 18:26:00 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbAccessX.c,v 1.9 2001/08/23 14:33:25 alanh Exp $ */ #include <stdio.h> #include <math.h> @@ -143,9 +143,6 @@ #endif { xEvent xE; -#ifdef XINPUT -extern int DeviceKeyPress; -#endif xE.u.u.type = type; xE.u.u.detail = keyCode; @@ -586,6 +583,11 @@ */ if (ctrls->enabled_ctrls & XkbSlowKeysMask) { xkbAccessXNotify ev; + /* If key was already pressed, ignore subsequent press events + * from the server's autorepeat + */ + if(xkbi->slowKey == key) + return TRUE; ev.detail= XkbAXN_SKPress; ev.keycode= key; ev.slowKeysDelay= ctrls->slow_keys_delay; Index: xc/programs/Xserver/xkb/xkbActions.c diff -u xc/programs/Xserver/xkb/xkbActions.c:3.6 xc/programs/Xserver/xkb/xkbActions.c:3.7 --- xc/programs/Xserver/xkb/xkbActions.c:3.6 Mon Feb 12 13:26:00 2001 +++ xc/programs/Xserver/xkb/xkbActions.c Thu Aug 23 10:33:25 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbActions.c,v 3.6 2001/02/12 18:26:00 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbActions.c,v 3.7 2001/08/23 14:33:25 alanh Exp $ */ #include <stdio.h> #include <math.h> @@ -922,9 +922,9 @@ { unsigned realMods; xEvent ev; -int x,y,kc; +int x,y; XkbStateRec old; -unsigned mods,mask,oldCoreState,oldCorePrevState; +unsigned mods,mask,oldCoreState = 0,oldCorePrevState = 0; if ((filter->keycode!=0)&&(filter->keycode!=keycode)) return 1; Index: xc/programs/Xserver/xkb/xkbDflts.h diff -u xc/programs/Xserver/xkb/xkbDflts.h:1.1.1.4 xc/programs/Xserver/xkb/xkbDflts.h:1.2 --- xc/programs/Xserver/xkb/xkbDflts.h:1.1.1.4 Tue Jan 16 17:45:07 2001 +++ xc/programs/Xserver/xkb/xkbDflts.h Sat Oct 27 23:34:20 2001 @@ -1,4 +1,5 @@ /* $Xorg: xkbDflts.h,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbDflts.h,v 1.2 2001/10/28 03:34:20 tsi Exp $ */ /* This file generated automatically by xkbcomp */ /* DO NOT EDIT */ #ifndef DEFAULT_H @@ -176,279 +177,279 @@ { XK_ISO_Level2_Latch, 0x0000, XkbSI_LevelOneOnly|XkbSI_Exactly, ShiftMask, 255, - { XkbSA_LatchMods, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LatchMods, { 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Eisu_Shift, 0x0000, XkbSI_Exactly, LockMask, 255, - { XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Eisu_toggle, 0x0000, XkbSI_Exactly, LockMask, 255, - { XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Kana_Shift, 0x0000, XkbSI_Exactly, LockMask, 255, - { XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Kana_Lock, 0x0000, XkbSI_Exactly, LockMask, 255, - { XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Shift_Lock, 0x0000, XkbSI_AnyOf, ShiftMask|LockMask, 255, - { XkbSA_LockMods, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockMods, { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Num_Lock, 0x0000, XkbSI_AnyOf, 0xff, 0, - { XkbSA_LockMods, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } }, + { XkbSA_LockMods, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } }, { XK_Alt_L, 0x0000, XkbSI_AnyOf, 0xff, 1, - { XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Alt_R, 0x0000, XkbSI_AnyOf, 0xff, 1, - { XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Scroll_Lock, 0x0000, XkbSI_AnyOf, 0xff, 4, - { XkbSA_LockMods, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockMods, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Lock, 0x0000, XkbSI_AnyOf, 0xff, 255, - { XkbSA_ISOLock, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_ISOLock, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Level3_Shift, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff, 2, - { XkbSA_SetMods, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } }, + { XkbSA_SetMods, { 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } } }, { XK_ISO_Level3_Latch, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff, 2, - { XkbSA_LatchMods, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } }, + { XkbSA_LatchMods, { 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } } }, { XK_Mode_switch, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff, 3, - { XkbSA_SetGroup, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetGroup, { 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_1, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_End, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_2, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_Down, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_3, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_Next, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_4, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Left, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_6, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Right, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_7, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_Home, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_8, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_Up, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_9, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_Prior, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00 } }, + { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_5, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Begin, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_F1, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_SetPtrDflt, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Divide, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_SetPtrDflt, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_F2, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_SetPtrDflt, 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Multiply, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_SetPtrDflt, 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_F3, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_SetPtrDflt, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Subtract, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_SetPtrDflt, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Separator, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Add, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_0, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockPtrBtn, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockPtrBtn, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Insert, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockPtrBtn, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockPtrBtn, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Decimal, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockPtrBtn, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockPtrBtn, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Delete, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockPtrBtn, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockPtrBtn, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Button_Dflt, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Button1, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Button2, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Button3, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DblClick_Dflt, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DblClick1, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DblClick2, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DblClick3, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_PtrBtn, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_PtrBtn, { 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Drag_Dflt, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockPtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Drag1, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockPtrBtn, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Drag2, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockPtrBtn, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Drag3, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockPtrBtn, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_EnableKeys, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 } }, + { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 } } }, { XK_Pointer_Accelerate, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 } }, + { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 } } }, { XK_Pointer_DfltBtnNext, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_SetPtrDflt, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetPtrDflt, { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DfltBtnPrev, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_SetPtrDflt, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_SetPtrDflt, { 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 } } }, { XK_AccessX_Enable, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } }, + { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } } }, { XK_Terminate_Server, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_Terminate, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_Terminate, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Group_Latch, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff, 3, - { XkbSA_LatchGroup, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LatchGroup, { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Next_Group, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff, 3, - { XkbSA_LockGroup, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockGroup, { 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Prev_Group, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff, 3, - { XkbSA_LockGroup, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockGroup, { 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_First_Group, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockGroup, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockGroup, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Last_Group, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, - { XkbSA_LockGroup, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockGroup, { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { NoSymbol, 0x0000, XkbSI_Exactly, LockMask, 255, - { XkbSA_LockMods, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } }, + { XkbSA_LockMods, { 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { NoSymbol, 0x0000, XkbSI_AnyOf, 0xff, 255, - { XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } + { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } } }; #define num_dfltSI (sizeof(dfltSI)/sizeof(XkbSymInterpretRec)) @@ -466,38 +467,38 @@ static XkbIndicatorRec indicators= { 0x0, { - { 0x80, 0, 0x00, XkbIM_UseEffective, LockMask, LockMask, 0, 0 }, - { 0x80, 0, 0x00, XkbIM_UseEffective, 0, 0, vmod_NumLockMask, 0 }, - { 0x80, 0, 0x00, XkbIM_UseLocked, ShiftMask, ShiftMask, 0, 0 }, - { 0x80, 0, 0x00, 0, 0, 0, 0, XkbMouseKeysMask }, - { 0x80, 0, 0x00, XkbIM_UseLocked, 0, 0, vmod_ScrollLockMask, 0 }, - { 0x80, XkbIM_UseEffective, 0xfe, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }, - { 0x00, 0, 0x00, 0, 0, 0, 0, 0 } + { 0x80, 0, 0x00, XkbIM_UseEffective, { LockMask, LockMask, 0 }, 0 }, + { 0x80, 0, 0x00, XkbIM_UseEffective, { 0, 0, vmod_NumLockMask }, 0 }, + { 0x80, 0, 0x00, XkbIM_UseLocked, { ShiftMask, ShiftMask, 0 }, 0 }, + { 0x80, 0, 0x00, 0, { 0, 0, 0 }, XkbMouseKeysMask }, + { 0x80, 0, 0x00, XkbIM_UseLocked, { 0, 0, vmod_ScrollLockMask }, 0 }, + { 0x80, XkbIM_UseEffective, 0xfe, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, + { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 } } }; static void Index: xc/programs/Xserver/xkb/xkbEvents.c diff -u xc/programs/Xserver/xkb/xkbEvents.c:3.8 xc/programs/Xserver/xkb/xkbEvents.c:3.10 --- xc/programs/Xserver/xkb/xkbEvents.c:3.8 Tue Feb 20 11:43:14 2001 +++ xc/programs/Xserver/xkb/xkbEvents.c Sat Oct 27 23:34:20 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbEvents.c,v 3.8 2001/02/20 16:43:14 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbEvents.c,v 3.10 2001/10/28 03:34:20 tsi Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -36,8 +36,6 @@ #include "windowstr.h" #include "XKBsrv.h" -extern int (*InitialVector[3])(); - /***====================================================================***/ void @@ -52,7 +50,6 @@ register int i; Time time; CARD16 changed; -XkbChangesRec changes; pNKN->type = XkbEventCode + XkbEventBase; pNKN->xkbType = XkbNewKeyboardNotify; @@ -182,7 +179,7 @@ { int i; XkbSrvInfoPtr xkbi; -unsigned time,initialized; +unsigned time = 0,initialized; CARD16 changed; xkbi = kbd->key->xkbInfo; @@ -313,10 +310,10 @@ #endif { int initialized; -CARD32 changedControls,enabledControls,enabledChanges; +CARD32 changedControls, enabledControls, enabledChanges = 0; XkbSrvInfoPtr xkbi; XkbInterestPtr interest; -Time time; +Time time = 0; interest = kbd->xkb_interest; if (!interest) @@ -372,7 +369,7 @@ { int initialized; XkbInterestPtr interest; -Time time; +Time time = 0; CARD32 state,changed; interest = kbd->xkb_interest; @@ -446,8 +443,8 @@ XkbInterestPtr interest; CARD8 id; CARD16 pitch,duration; -Time time; -XID winID; +Time time = 0; +XID winID = 0; xkbi = kbd->key->xkbInfo; @@ -524,7 +521,7 @@ { int initialized; XkbInterestPtr interest; -Time time; +Time time = 0; CARD16 sk_delay,db_delay; interest = kbd->xkb_interest; @@ -575,7 +572,7 @@ { int initialized; XkbInterestPtr interest; -Time time; +Time time = 0; CARD16 changed,changedVirtualMods; CARD32 changedIndicators; @@ -630,8 +627,8 @@ { int initialized; XkbInterestPtr interest; -Time time; -CARD16 firstSI,nSI,nTotalSI; +Time time = 0; +CARD16 firstSI = 0, nSI = 0, nTotalSI = 0; interest = kbd->xkb_interest; if (!interest) @@ -685,7 +682,7 @@ int initialized; XkbSrvInfoPtr xkbi; XkbInterestPtr interest; -Time time; +Time time = 0; xkbi = kbd->key->xkbInfo; interest = kbd->xkb_interest; @@ -736,9 +733,9 @@ { int initialized; XkbInterestPtr interest; -Time time; -CARD32 defined,state; -CARD16 reason,supported; +Time time = 0; +CARD32 defined, state; +CARD16 reason, supported = 0; interest = dev->xkb_interest; if (!interest) @@ -1140,7 +1137,7 @@ XkbInterestPtr interest; Bool found; unsigned long autoCtrls,autoValues; -ClientPtr client; +ClientPtr client = NULL; found= False; autoCtrls= autoValues= 0; @@ -1176,6 +1173,3 @@ } return found; } - - - Index: xc/programs/Xserver/xkb/xkbInit.c diff -u xc/programs/Xserver/xkb/xkbInit.c:3.18 xc/programs/Xserver/xkb/xkbInit.c:3.21 --- xc/programs/Xserver/xkb/xkbInit.c:3.18 Wed Jan 17 17:37:15 2001 +++ xc/programs/Xserver/xkb/xkbInit.c Sat Oct 27 23:34:20 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbInit.c,v 3.18 2001/01/17 22:37:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbInit.c,v 3.21 2001/10/28 03:34:20 tsi Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -37,6 +37,7 @@ #include <X11/Xatom.h> #include "misc.h" #include "inputstr.h" +#include "opaque.h" #include "property.h" #define XKBSRV_NEED_FILE_FUNCS #include "XKBsrv.h" @@ -167,7 +168,6 @@ #endif { int len,out; -extern WindowPtr * WindowTable; Atom name; char * pval; @@ -303,6 +303,9 @@ #include "xkbDflts.h" +/* A dummy to keep the compiler quiet */ +pointer xkbBogus = &indicators; + static Bool #if NeedFunctionPrototypes XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file) @@ -1022,7 +1025,6 @@ ErrorF("-ar1 set XKB autorepeat delay\n"); ErrorF("-ar2 set XKB autorepeat interval\n"); ErrorF("-noloadxkb don't load XKB keymap description\n"); - ErrorF("-xkbcomp default keymap compiler\n"); ErrorF("-xkbdb file that contains default XKB keymaps\n"); ErrorF("-xkbmap XKB keyboard description to load on startup\n"); } Index: xc/programs/Xserver/xkb/xkbLEDs.c diff -u xc/programs/Xserver/xkb/xkbLEDs.c:3.2 xc/programs/Xserver/xkb/xkbLEDs.c:3.6 --- xc/programs/Xserver/xkb/xkbLEDs.c:3.2 Wed Jan 17 17:37:15 2001 +++ xc/programs/Xserver/xkb/xkbLEDs.c Fri Nov 23 14:21:36 2001 @@ -1,4 +1,4 @@ -/* $Xorg: xkbLEDs.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ +/* $Xorg: xkbLEDs.c,v 1.4 2001/05/10 19:54:01 steve Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/xkbLEDs.c,v 3.6 2001/11/23 19:21:36 dawes Exp $ */ #include <stdio.h> #include <ctype.h> @@ -37,8 +38,6 @@ #include "XI.h" #include "XKBsrv.h" -extern InputInfo inputInfo; - /***====================================================================***/ /* @@ -240,11 +239,10 @@ XkbUpdateLedAutoState(dev,sli,side_affected,&ed,&changes,cause); affect|= side_affected; } - XkbSendNotification(dev,&changes,cause); - if (ed.reason) - XkbSendExtensionDeviceNotify(dev,cause->client,&ed); if (changes.state_changes || changes.ctrls.enabled_ctrls_changes) XkbUpdateAllDeviceIndicators(NULL,cause); + + XkbFlushLedEvents(dev,dev,sli,&ed,&changes,cause); return; } @@ -701,6 +699,14 @@ XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState); XkbSendNotification(kbd,changes,cause); bzero((char *)changes,sizeof(XkbChangesRec)); + + if (XkbAX_NeedFeedback(kbd->key->xkbInfo->desc->ctrls, XkbAX_IndicatorFBMask)) { + if (sli->effectiveState) + /* it appears that the which parameter is not used */ + XkbDDXAccessXBeep(dev, _BEEP_LED_ON, XkbAccessXFeedbackMask); + else + XkbDDXAccessXBeep(dev, _BEEP_LED_OFF, XkbAccessXFeedbackMask); + } } if (ed && (ed->reason)) { if ((dev!=kbd)&&(ed->reason&XkbXI_IndicatorStateMask)) Index: xc/programs/Xserver/xkb/xkbSwap.c diff -u xc/programs/Xserver/xkb/xkbSwap.c:3.1 xc/programs/Xserver/xkb/xkbSwap.c:3.2 --- xc/programs/Xserver/xkb/xkbSwap.c:3.1 Wed Jan 17 17:37:15 2001 +++ xc/programs/Xserver/xkb/xkbSwap.c Thu Aug 23 10:33:26 2001 @@ -24,7 +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 $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbSwap.c,v 3.2 2001/08/23 14:33:26 alanh Exp $ */ #include "stdio.h" #include "X.h" @@ -112,7 +112,7 @@ swaps(&stuff->selectAll,n); swaps(&stuff->affectMap,n); swaps(&stuff->map,n); - if (stuff->affectWhich&(~XkbMapNotifyMask)!=0) { + if ((stuff->affectWhich&(~XkbMapNotifyMask))!=0) { union { BOOL *b; CARD8 *c8; Index: xc/programs/Xserver/xkb/xkbUtils.c diff -u xc/programs/Xserver/xkb/xkbUtils.c:3.12 xc/programs/Xserver/xkb/xkbUtils.c:3.13 --- xc/programs/Xserver/xkb/xkbUtils.c:3.12 Wed Jan 17 17:37:15 2001 +++ xc/programs/Xserver/xkb/xkbUtils.c Thu Aug 23 10:33:26 2001 @@ -24,7 +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 $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbUtils.c,v 3.13 2001/08/23 14:33:26 alanh Exp $ */ #include <stdio.h> #include <ctype.h> @@ -363,7 +363,7 @@ XkbApplyCompatMapToKey(xkb,key,changes); } - if (changes->map.changed&XkbVirtualModMapMask|XkbModifierMapMask) { + if (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask)) { unsigned char newVMods[XkbNumVirtualMods]; register unsigned bit,i; unsigned present; @@ -862,7 +862,7 @@ state->lookup_mods= state->mods&(~ctrls->internal.mask); state->grab_mods= state->lookup_mods&(~ctrls->ignore_lock.mask); state->grab_mods|= - (state->base_mods|state->latched_mods&ctrls->ignore_lock.mask); + ((state->base_mods|state->latched_mods)&ctrls->ignore_lock.mask); grp= state->locked_group; Index: xc/programs/appres/appres.c diff -u xc/programs/appres/appres.c:1.3 xc/programs/appres/appres.c:1.4 --- xc/programs/appres/appres.c:1.3 Wed Jan 17 18:44:49 2001 +++ xc/programs/appres/appres.c Fri Dec 14 15:00:38 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: appres.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ + * $Xorg: appres.c,v 1.4 2001/02/09 02:05:27 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/appres/appres.c,v 1.3 2001/01/17 23:44:49 dawes Exp $ */ +/* $XFree86: xc/programs/appres/appres.c,v 1.4 2001/12/14 20:00:38 dawes Exp $ */ #include <X11/Intrinsic.h> #include <stdio.h> Index: xc/programs/appres/appres.man diff -u xc/programs/appres/appres.man:1.7 xc/programs/appres/appres.man:1.8 --- xc/programs/appres/appres.man:1.7 Sat Jan 27 13:21:00 2001 +++ xc/programs/appres/appres.man Fri Dec 14 15:00:38 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: appres.man,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ +.\" $Xorg: appres.man,v 1.4 2001/02/09 02:05:27 xorgcvs Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/appres/appres.man,v 1.7 2001/01/27 18:21:00 dawes Exp $ +.\" $XFree86: xc/programs/appres/appres.man,v 1.8 2001/12/14 20:00:38 dawes Exp $ .\" .TH APPRES 1 __xorgversion__ .SH NAME Index: xc/programs/bdftopcf/Imakefile diff -u xc/programs/bdftopcf/Imakefile:3.9 xc/programs/bdftopcf/Imakefile:3.10 --- xc/programs/bdftopcf/Imakefile:3.9 Wed Jan 17 18:44:49 2001 +++ xc/programs/bdftopcf/Imakefile Tue Jul 31 20:45:00 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/bdftopcf/Imakefile,v 3.9 2001/01/17 23:44:49 dawes Exp $ +XCOMM $XFree86: xc/programs/bdftopcf/Imakefile,v 3.10 2001/08/01 00:45:00 tsi Exp $ #if GzipFontCompression ZLIB = GzipLibrary @@ -11,7 +11,7 @@ LOCAL_LIBRARIES = $(FONTLIB) SYS_LIBRARIES = $(ZLIB) MathLibrary DEPLIBS = $(DEPFONTLIB) -INCLUDES = -I$(FONTINCSRC) -I$(FONTLIBSRC)/include +INCLUDES = -I$(FONTINCSRC) -I$(FONTLIBSRC)/include -I$(FONTLIBSRC)/bitmap SRCS = bdftopcf.c OBJS = bdftopcf.o Index: xc/programs/bdftopcf/bdftopcf.c diff -u xc/programs/bdftopcf/bdftopcf.c:1.3 xc/programs/bdftopcf/bdftopcf.c:1.5 --- xc/programs/bdftopcf/bdftopcf.c:1.3 Wed Jan 17 18:44:49 2001 +++ xc/programs/bdftopcf/bdftopcf.c Fri Dec 14 15:00:39 2001 @@ -1,9 +1,13 @@ -/* $Xorg: bdftopcf.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: bdftopcf.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1991, 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,13 +27,16 @@ */ -/* $XFree86: xc/programs/bdftopcf/bdftopcf.c,v 1.3 2001/01/17 23:44:49 dawes Exp $ */ +/* $XFree86: xc/programs/bdftopcf/bdftopcf.c,v 1.5 2001/12/14 20:00:39 dawes Exp $ */ #include <X11/X.h> #include <X11/Xproto.h> #include "fontmisc.h" #include "fontstruct.h" #include "fntfilio.h" +#include "fntfil.h" +#include "bdfint.h" +#include "pcf.h" #include <stdio.h> #include <X11/Xos.h> Index: xc/programs/bdftopcf/bdftopcf.man diff -u xc/programs/bdftopcf/bdftopcf.man:1.7 xc/programs/bdftopcf/bdftopcf.man:1.8 --- xc/programs/bdftopcf/bdftopcf.man:1.7 Sat Jan 27 13:21:00 2001 +++ xc/programs/bdftopcf/bdftopcf.man Fri Dec 14 15:00:39 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: bdftopcf.man,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ +.\" $Xorg: bdftopcf.man,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/bdftopcf/bdftopcf.man,v 1.7 2001/01/27 18:21:00 dawes Exp $ +.\" $XFree86: xc/programs/bdftopcf/bdftopcf.man,v 1.8 2001/12/14 20:00:39 dawes Exp $ .\" .TH BDFTOPCF 1 __xorgversion__ .SH NAME Index: xc/programs/beforelight/b4light.c diff -u xc/programs/beforelight/b4light.c:3.4 xc/programs/beforelight/b4light.c:3.5 --- xc/programs/beforelight/b4light.c:3.4 Mon Feb 1 06:56:04 1999 +++ xc/programs/beforelight/b4light.c Wed Jul 25 11:05:12 2001 @@ -26,7 +26,7 @@ * * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/beforelight/b4light.c,v 3.4 1999/02/01 11:56:04 dawes Exp $ */ +/* $XFree86: xc/programs/beforelight/b4light.c,v 3.5 2001/07/25 15:05:12 dawes Exp $ */ #include <X11/Xatom.h> #include <X11/Intrinsic.h> @@ -291,7 +291,7 @@ Atom kill_type; int i; -#if !defined(X_NOT_POSIX) || ((__STDC__) && !defined(X_NOT_STDC_ENV)) +#if !defined(X_NOT_POSIX) srand((int)time((time_t *)NULL)); #else srand((int)time((int *)NULL)); Index: xc/programs/bitmap/BitEdit.c diff -u xc/programs/bitmap/BitEdit.c:1.4 xc/programs/bitmap/BitEdit.c:1.6 --- xc/programs/bitmap/BitEdit.c:1.4 Wed Jan 17 18:44:50 2001 +++ xc/programs/bitmap/BitEdit.c Wed Dec 26 16:39:34 2001 @@ -1,9 +1,13 @@ -/* $Xorg: BitEdit.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: BitEdit.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/BitEdit.c,v 1.4 2001/01/17 23:44:50 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/BitEdit.c,v 1.6 2001/12/26 21:39:34 paulo Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -44,6 +48,7 @@ #include <X11/Xaw/SimpleMenu.h> #include <X11/Xaw/SmeLine.h> #include <X11/Xaw/SmeBSB.h> +#include <X11/Xmu/SysUtil.h> #include "Bitmap.h" #include <X11/bitmaps/xlogo16> @@ -796,7 +801,7 @@ case Yes: if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't write file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryLoadSave; @@ -812,7 +817,7 @@ if (PopupDialog(input_dialog, "Load file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWReadFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't read file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't read file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryLoad; @@ -832,7 +837,7 @@ if (PopupDialog(input_dialog, "Insert file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWStoreFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't read file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't read file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryInsert; @@ -849,7 +854,7 @@ if (!strcmp(filename, "")) DoSaveAs(); else if (BWWriteFile(bitmap_widget, NULL, NULL) != BitmapSuccess) { - sprintf(message, "Can't write file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) DoSaveAs(); @@ -866,7 +871,7 @@ if (PopupDialog(input_dialog, "Save file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't write file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetrySave; @@ -892,7 +897,7 @@ FixStatus(); } else { - sprintf(message, "Wrong format: %s", format); + XmuSnprintf(message, sizeof(message), "Wrong format: %s", format); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryResize; @@ -915,7 +920,7 @@ FixStatus(); } else { - sprintf(message, "Wrong format: %s", format); + XmuSnprintf(message, sizeof(message), "Wrong format: %s", format); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryRescale; @@ -957,7 +962,7 @@ case Yes: if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't write file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryQuit; Index: xc/programs/bitmap/Bitmap.c diff -u xc/programs/bitmap/Bitmap.c:1.3 xc/programs/bitmap/Bitmap.c:1.5 --- xc/programs/bitmap/Bitmap.c:1.3 Wed Jan 17 18:44:50 2001 +++ xc/programs/bitmap/Bitmap.c Wed Dec 26 16:39:34 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Bitmap.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: Bitmap.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Bitmap.c,v 1.3 2001/01/17 23:44:50 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Bitmap.c,v 1.5 2001/12/26 21:39:34 paulo Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -33,6 +37,7 @@ #include <X11/Xaw/XawInit.h> #include <X11/Xmu/CharSet.h> #include <X11/Xmu/Drawing.h> +#include <X11/Xmu/SysUtil.h> #include <X11/Xatom.h> #include <X11/Xfuncs.h> #include <X11/Xos.h> @@ -1023,7 +1028,7 @@ { BitmapWidget BW = (BitmapWidget) w; - sprintf(BW->bitmap.status, + XmuSnprintf(BW->bitmap.status, sizeof(BW->bitmap.status), "Filename: %s Basename: %s Size: %dx%d", (strcmp(BW->bitmap.filename, "") ? BW->bitmap.filename : "<none>"), (strcmp(BW->bitmap.basename, "") ? BW->bitmap.basename : "<none>"), Index: xc/programs/bitmap/Bitmap.h diff -u xc/programs/bitmap/Bitmap.h:1.3 xc/programs/bitmap/Bitmap.h:1.5 --- xc/programs/bitmap/Bitmap.h:1.3 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/Bitmap.h Fri Dec 14 15:00:40 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Bitmap.h,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: Bitmap.h,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Bitmap.h,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Bitmap.h,v 1.5 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -68,7 +72,7 @@ dashed Dashed Boolean True dashes Dashes Bitmap XtUnspecifiedPixmap stippled Stippled Boolean True - stipple Sripple Bitmap XtUnspecifiedPixmap + stipple Stipple Bitmap XtUnspecifiedPixmap proportional Proportional Boolean True axes Axes Boolean True button1Function Button1Function ButtonFunction Set Index: xc/programs/bitmap/BitmapP.h diff -u xc/programs/bitmap/BitmapP.h:1.3 xc/programs/bitmap/BitmapP.h:1.4 --- xc/programs/bitmap/BitmapP.h:1.3 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/BitmapP.h Fri Dec 14 15:00:40 2001 @@ -1,9 +1,13 @@ -/* $Xorg: BitmapP.h,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: BitmapP.h,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/BitmapP.h,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/BitmapP.h,v 1.4 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/CutPaste.c diff -u xc/programs/bitmap/CutPaste.c:1.3 xc/programs/bitmap/CutPaste.c:1.4 --- xc/programs/bitmap/CutPaste.c:1.3 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/CutPaste.c Fri Dec 14 15:00:40 2001 @@ -1,9 +1,13 @@ -/* $Xorg: CutPaste.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: CutPaste.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/CutPaste.c,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/CutPaste.c,v 1.4 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Dialog.c diff -u xc/programs/bitmap/Dialog.c:1.3 xc/programs/bitmap/Dialog.c:1.4 --- xc/programs/bitmap/Dialog.c:1.3 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/Dialog.c Fri Dec 14 15:00:40 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Dialog.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: Dialog.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Dialog.c,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Dialog.c,v 1.4 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Dialog.h diff -u xc/programs/bitmap/Dialog.h:1.3 xc/programs/bitmap/Dialog.h:1.4 --- xc/programs/bitmap/Dialog.h:1.3 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/Dialog.h Fri Dec 14 15:00:40 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Dialog.h,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: Dialog.h,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Dialog.h,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Dialog.h,v 1.4 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Graphics.c diff -u xc/programs/bitmap/Graphics.c:1.5 xc/programs/bitmap/Graphics.c:1.6 --- xc/programs/bitmap/Graphics.c:1.5 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/Graphics.c Fri Dec 14 15:00:40 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Graphics.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ +/* $Xorg: Graphics.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Graphics.c,v 1.5 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Graphics.c,v 1.6 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Handlers.c diff -u xc/programs/bitmap/Handlers.c:1.3 xc/programs/bitmap/Handlers.c:1.4 --- xc/programs/bitmap/Handlers.c:1.3 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/Handlers.c Fri Dec 14 15:00:41 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Handlers.c,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ +/* $Xorg: Handlers.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Handlers.c,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Handlers.c,v 1.4 2001/12/14 20:00:41 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/ReqMach.c diff -u xc/programs/bitmap/ReqMach.c:1.3 xc/programs/bitmap/ReqMach.c:1.4 --- xc/programs/bitmap/ReqMach.c:1.3 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/ReqMach.c Fri Dec 14 15:00:41 2001 @@ -1,9 +1,13 @@ -/* $Xorg: ReqMach.c,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ +/* $Xorg: ReqMach.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/ReqMach.c,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/ReqMach.c,v 1.4 2001/12/14 20:00:41 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Requests.h diff -u xc/programs/bitmap/Requests.h:1.4 xc/programs/bitmap/Requests.h:1.5 --- xc/programs/bitmap/Requests.h:1.4 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/Requests.h Fri Dec 14 15:00:41 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Requests.h,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ +/* $Xorg: Requests.h,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Requests.h,v 1.4 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Requests.h,v 1.5 2001/12/14 20:00:41 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/atobm.c diff -u xc/programs/bitmap/atobm.c:3.3 xc/programs/bitmap/atobm.c:3.5 --- xc/programs/bitmap/atobm.c:3.3 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/atobm.c Fri Dec 14 15:00:41 2001 @@ -1,9 +1,13 @@ -/* $Xorg: atobm.c,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ +/* $Xorg: atobm.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1988, 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/atobm.c,v 3.3 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/atobm.c,v 3.5 2001/12/14 20:00:41 dawes Exp $ */ /* * atobm - ascii to bitmap filter @@ -32,12 +36,7 @@ #include <stdio.h> #include <ctype.h> #include <X11/Xos.h> - -#ifdef X_NOT_STDC_ENV -extern char *malloc(), *calloc(); -#else #include <stdlib.h> -#endif char *ProgramName; Index: xc/programs/bitmap/bitmap.man diff -u xc/programs/bitmap/bitmap.man:1.6 xc/programs/bitmap/bitmap.man:1.7 --- xc/programs/bitmap/bitmap.man:1.6 Sat Jan 27 13:21:01 2001 +++ xc/programs/bitmap/bitmap.man Fri Dec 14 15:00:41 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: bitmap.man,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ +.\" $Xorg: bitmap.man,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ .\" Copyright 1993, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/bitmap/bitmap.man,v 1.6 2001/01/27 18:21:01 dawes Exp $ +.\" $XFree86: xc/programs/bitmap/bitmap.man,v 1.7 2001/12/14 20:00:41 dawes Exp $ .\" .TH BITMAP 1 __xorgversion__ .SH NAME Index: xc/programs/bitmap/bmtoa.c diff -u xc/programs/bitmap/bmtoa.c:3.5 xc/programs/bitmap/bmtoa.c:3.7 --- xc/programs/bitmap/bmtoa.c:3.5 Wed Jan 17 18:44:51 2001 +++ xc/programs/bitmap/bmtoa.c Fri Dec 14 15:00:41 2001 @@ -1,9 +1,13 @@ -/* $Xorg: bmtoa.c,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ +/* $Xorg: bmtoa.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */ /* Copyright 1988, 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/bmtoa.c,v 3.5 2001/01/17 23:44:51 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/bmtoa.c,v 3.7 2001/12/14 20:00:41 dawes Exp $ */ /* * bmtoa - bitmap to ascii filter @@ -36,16 +40,10 @@ #include <X11/Xmu/Drawing.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> #include <unistd.h> -#else -#include <stdlib.h> -#endif #ifndef HAS_MKSTEMP extern char *mktemp(); -#else -#include <unistd.h> #endif char *ProgramName; Index: xc/programs/dpsexec/dpsexec.c diff -u xc/programs/dpsexec/dpsexec.c:1.4 xc/programs/dpsexec/dpsexec.c:1.6 --- xc/programs/dpsexec/dpsexec.c:1.4 Sun Apr 1 10:00:16 2001 +++ xc/programs/dpsexec/dpsexec.c Mon Jan 7 15:38:29 2002 @@ -34,7 +34,7 @@ * * Author: Adobe Systems Incorporated */ -/* $XFree86: xc/programs/dpsexec/dpsexec.c,v 1.4 2001/04/01 14:00:16 tsi Exp $ */ +/* $XFree86: xc/programs/dpsexec/dpsexec.c,v 1.6 2002/01/07 20:38:29 dawes Exp $ */ #include <errno.h> #include <stdlib.h> @@ -48,6 +48,10 @@ #include <DPS/XDPSlib.h> #include <DPS/dpsXclient.h> +#ifdef __QNX__ +#include <sys/select.h> +#endif + #define W_HEIGHT 512 #define W_WIDTH 512 @@ -81,12 +85,9 @@ 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; Index: xc/programs/editres/actions.c diff -u xc/programs/editres/actions.c:1.5 xc/programs/editres/actions.c:1.6 --- xc/programs/editres/actions.c:1.5 Sun Apr 1 10:00:17 2001 +++ xc/programs/editres/actions.c Fri Dec 14 15:00:42 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: actions.c,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ + * $Xorg: actions.c,v 1.4 2001/02/09 02:05:29 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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/actions.c,v 1.5 2001/04/01 14:00:17 tsi Exp $ */ +/* $XFree86: xc/programs/editres/actions.c,v 1.6 2001/12/14 20:00:42 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/editres/comm.c diff -u xc/programs/editres/comm.c:1.4 xc/programs/editres/comm.c:1.5 --- xc/programs/editres/comm.c:1.4 Wed Jan 17 18:44:52 2001 +++ xc/programs/editres/comm.c Fri Dec 14 15:00:42 2001 @@ -1,9 +1,13 @@ -/* $Xorg: comm.c,v 1.4 2000/08/17 19:53:51 cpqbld Exp $ */ +/* $Xorg: comm.c,v 1.5 2001/02/09 02:05:29 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/editres/comm.c,v 1.4 2001/01/17 23:44:52 dawes Exp $ */ +/* $XFree86: xc/programs/editres/comm.c,v 1.5 2001/12/14 20:00:42 dawes Exp $ */ /* Index: xc/programs/editres/editres.c diff -u xc/programs/editres/editres.c:1.6 xc/programs/editres/editres.c:1.7 --- xc/programs/editres/editres.c:1.6 Sun Apr 1 10:00:17 2001 +++ xc/programs/editres/editres.c Fri Dec 14 15:00:42 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: editres.c,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ + * $Xorg: editres.c,v 1.4 2001/02/09 02:05:29 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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/editres.c,v 1.6 2001/04/01 14:00:17 tsi Exp $ */ +/* $XFree86: xc/programs/editres/editres.c,v 1.7 2001/12/14 20:00:42 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/editres/editres.man diff -u xc/programs/editres/editres.man:1.7 xc/programs/editres/editres.man:1.8 --- xc/programs/editres/editres.man:1.7 Sat Jan 27 13:21:01 2001 +++ xc/programs/editres/editres.man Fri Dec 14 15:00:42 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: editres.man,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ +.\" $Xorg: editres.man,v 1.4 2001/02/09 02:05:29 xorgcvs Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/editres/editres.man,v 1.7 2001/01/27 18:21:01 dawes Exp $ +.\" $XFree86: xc/programs/editres/editres.man,v 1.8 2001/12/14 20:00:42 dawes Exp $ .\" .TH EDITRES 1 __xorgversion__ .SH NAME Index: xc/programs/editres/editresP.h diff -u xc/programs/editres/editresP.h:1.5 xc/programs/editres/editresP.h:1.7 --- xc/programs/editres/editresP.h:1.5 Wed Jan 17 18:44:52 2001 +++ xc/programs/editres/editresP.h Fri Dec 14 15:00:42 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: editresP.h,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ + * $Xorg: editresP.h,v 1.4 2001/02/09 02:05:29 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * * Author: Chris D. Peterson, MIT X Consortium */ -/* $XFree86: xc/programs/editres/editresP.h,v 1.5 2001/01/17 23:44:52 dawes Exp $ */ +/* $XFree86: xc/programs/editres/editresP.h,v 1.7 2001/12/14 20:00:42 dawes Exp $ */ #include <X11/Xmu/EditresP.h> #include <X11/Xresource.h> @@ -53,9 +57,6 @@ #define ANY_RADIO_DATA ("the any widget") #define RESOURCE_BOX ("resourceBox") -#ifdef X_NOT_STDC_ENV -extern void exit(); -#endif /* * Retrieving ResType and Boolean is the same as retrieving a Card8 except Index: xc/programs/editres/geometry.c diff -u xc/programs/editres/geometry.c:1.4 xc/programs/editres/geometry.c:1.5 --- xc/programs/editres/geometry.c:1.4 Wed Jan 17 18:44:52 2001 +++ xc/programs/editres/geometry.c Fri Dec 14 15:00:43 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: geometry.c,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ + * $Xorg: geometry.c,v 1.4 2001/02/09 02:05:29 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ * * Author: Chris D. Peterson, MIT X Consortium */ -/* $XFree86: xc/programs/editres/geometry.c,v 1.4 2001/01/17 23:44:52 dawes Exp $ */ +/* $XFree86: xc/programs/editres/geometry.c,v 1.5 2001/12/14 20:00:43 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> Index: xc/programs/editres/handler.c diff -u xc/programs/editres/handler.c:1.6 xc/programs/editres/handler.c:1.7 --- xc/programs/editres/handler.c:1.6 Sun Apr 1 10:00:17 2001 +++ xc/programs/editres/handler.c Fri Dec 14 15:00:43 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: handler.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ + * $Xorg: handler.c,v 1.4 2001/02/09 02:05:29 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/editres/handler.c,v 1.6 2001/04/01 14:00:17 tsi Exp $ */ +/* $XFree86: xc/programs/editres/handler.c,v 1.7 2001/12/14 20:00:43 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> Index: xc/programs/editres/setvalues.c diff -u xc/programs/editres/setvalues.c:1.4 xc/programs/editres/setvalues.c:1.5 --- xc/programs/editres/setvalues.c:1.4 Wed Jan 17 18:44:52 2001 +++ xc/programs/editres/setvalues.c Fri Dec 14 15:00:43 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: setvalues.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ + * $Xorg: setvalues.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ * * Author: Chris D. Peterson, MIT X Consortium */ -/* $XFree86: xc/programs/editres/setvalues.c,v 1.4 2001/01/17 23:44:52 dawes Exp $ */ +/* $XFree86: xc/programs/editres/setvalues.c,v 1.5 2001/12/14 20:00:43 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> Index: xc/programs/editres/svpopup.c diff -u xc/programs/editres/svpopup.c:1.5 xc/programs/editres/svpopup.c:1.6 --- xc/programs/editres/svpopup.c:1.5 Wed Jan 17 18:44:52 2001 +++ xc/programs/editres/svpopup.c Fri Dec 14 15:00:43 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: svpopup.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ + * $Xorg: svpopup.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ * * Author: Chris D. Peterson, MIT X Consortium */ -/* $XFree86: xc/programs/editres/svpopup.c,v 1.5 2001/01/17 23:44:52 dawes Exp $ */ +/* $XFree86: xc/programs/editres/svpopup.c,v 1.6 2001/12/14 20:00:43 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.5 xc/programs/editres/utils.c:1.6 --- xc/programs/editres/utils.c:1.5 Sun Apr 1 10:00:17 2001 +++ xc/programs/editres/utils.c Fri Dec 14 15:00:43 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: utils.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ + * $Xorg: utils.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.5 2001/04/01 14:00:17 tsi Exp $ */ +/* $XFree86: xc/programs/editres/utils.c,v 1.6 2001/12/14 20:00:43 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/Xutil.h> Index: xc/programs/editres/widgets.c diff -u xc/programs/editres/widgets.c:1.5 xc/programs/editres/widgets.c:1.6 --- xc/programs/editres/widgets.c:1.5 Wed Jan 17 18:44:52 2001 +++ xc/programs/editres/widgets.c Fri Dec 14 15:00:43 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: widgets.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ + * $Xorg: widgets.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.5 2001/01/17 23:44:52 dawes Exp $ */ +/* $XFree86: xc/programs/editres/widgets.c,v 1.6 2001/12/14 20:00:43 dawes Exp $ */ /* * Code for creating all widgets used by EditRes. Index: xc/programs/editres/wtree.c diff -u xc/programs/editres/wtree.c:1.4 xc/programs/editres/wtree.c:1.5 --- xc/programs/editres/wtree.c:1.4 Wed Jan 17 18:44:53 2001 +++ xc/programs/editres/wtree.c Fri Dec 14 15:00:44 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: wtree.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ + * $Xorg: wtree.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:44:53 dawes Exp $ */ +/* $XFree86: xc/programs/editres/wtree.c,v 1.5 2001/12/14 20:00:44 dawes Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> Index: xc/programs/fslsfonts/Imakefile diff -u xc/programs/fslsfonts/Imakefile:1.1.1.3 xc/programs/fslsfonts/Imakefile:1.3 --- xc/programs/fslsfonts/Imakefile:1.1.1.3 Tue Jan 16 17:45:42 2001 +++ xc/programs/fslsfonts/Imakefile Tue Aug 28 12:48:09 2001 @@ -1,9 +1,13 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/fslsfonts/Imakefile,v 1.3 2001/08/28 16:48:09 tsi Exp $ + LOCAL_LIBRARIES = $(FSLIB) DEPLIBS = $(DEPFSLIB) SRCS = fslsfonts.c OBJS = fslsfonts.o -INCLUDES = -I$(XBUILDINCDIR)/fonts -I$(FONTINCSRC) ComplexProgramTarget(fslsfonts) Index: xc/programs/fslsfonts/fslsfonts.c diff -u xc/programs/fslsfonts/fslsfonts.c:3.5 xc/programs/fslsfonts/fslsfonts.c:3.8 --- xc/programs/fslsfonts/fslsfonts.c:3.5 Wed Jan 17 18:44:53 2001 +++ xc/programs/fslsfonts/fslsfonts.c Fri Dec 14 15:00:45 2001 @@ -1,9 +1,13 @@ -/* $Xorg: fslsfonts.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ */ +/* $Xorg: fslsfonts.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,14 +43,12 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fslsfonts/fslsfonts.c,v 3.5 2001/01/17 23:44:53 dawes Exp $ */ +/* $XFree86: xc/programs/fslsfonts/fslsfonts.c,v 3.8 2001/12/14 20:00:45 dawes Exp $ */ -#include "FSlib.h" +#include <X11/fonts/FSlib.h> #include <stdio.h> #include <X11/Xos.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #ifndef N_START #define N_START 1000 /* Maximum # of fonts to start with */ Index: xc/programs/fslsfonts/fslsfonts.man diff -u xc/programs/fslsfonts/fslsfonts.man:1.6 xc/programs/fslsfonts/fslsfonts.man:1.7 --- xc/programs/fslsfonts/fslsfonts.man:1.6 Sat Jan 27 13:21:01 2001 +++ xc/programs/fslsfonts/fslsfonts.man Fri Dec 14 15:00:45 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: fslsfonts.man,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ +.\" $Xorg: fslsfonts.man,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ .\" Copyright 1991, Network Computing Devices, Inc .\" Copyright 1993, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/fslsfonts/fslsfonts.man,v 1.6 2001/01/27 18:21:01 dawes Exp $ +.\" $XFree86: xc/programs/fslsfonts/fslsfonts.man,v 1.7 2001/12/14 20:00:45 dawes Exp $ .\" .TH FSLSFONTS 1 __xorgversion__ .SH NAME Index: xc/programs/fstobdf/Imakefile diff -u xc/programs/fstobdf/Imakefile:1.1.1.3 xc/programs/fstobdf/Imakefile:1.3 --- xc/programs/fstobdf/Imakefile:1.1.1.3 Tue Jan 16 17:45:46 2001 +++ xc/programs/fstobdf/Imakefile Tue Aug 28 12:48:09 2001 @@ -1,7 +1,11 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/fstobdf/Imakefile,v 1.3 2001/08/28 16:48:09 tsi Exp $ + LOCAL_LIBRARIES = $(FSLIB) $(XLIB) DEPLIBS = $(DEPFSLIB) $(DEPXLIB) -INCLUDES = -I$(XBUILDINCDIR)/fonts -I$(FONTINCSRC) SRCS = chars.c fstobdf.c header.c props.c OBJS = chars.o fstobdf.o header.o props.o Index: xc/programs/fstobdf/chars.c diff -u xc/programs/fstobdf/chars.c:3.7 xc/programs/fstobdf/chars.c:3.8 --- xc/programs/fstobdf/chars.c:3.7 Sat Mar 3 19:16:31 2001 +++ xc/programs/fstobdf/chars.c Fri Dec 14 15:00:45 2001 @@ -1,9 +1,13 @@ -/* $Xorg: chars.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ */ +/* $Xorg: chars.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,7 +43,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fstobdf/chars.c,v 3.7 2001/03/04 00:16:31 tsi Exp $ */ +/* $XFree86: xc/programs/fstobdf/chars.c,v 3.8 2001/12/14 20:00:45 dawes Exp $ */ /* Morten Storgaard Nielsen: chars.c,v 3.2-1 2000/01/30 14:11:19 kat Exp */ Index: xc/programs/fstobdf/fstobdf.c diff -u xc/programs/fstobdf/fstobdf.c:1.5 xc/programs/fstobdf/fstobdf.c:1.6 --- xc/programs/fstobdf/fstobdf.c:1.5 Sun Apr 1 10:00:18 2001 +++ xc/programs/fstobdf/fstobdf.c Fri Dec 14 15:00:46 2001 @@ -1,9 +1,13 @@ -/* $Xorg: fstobdf.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ */ +/* $Xorg: fstobdf.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,7 +43,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fstobdf/fstobdf.c,v 1.5 2001/04/01 14:00:18 tsi Exp $ */ +/* $XFree86: xc/programs/fstobdf/fstobdf.c,v 1.6 2001/12/14 20:00:46 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/fstobdf/fstobdf.h diff -u xc/programs/fstobdf/fstobdf.h:1.1 xc/programs/fstobdf/fstobdf.h:1.2 --- xc/programs/fstobdf/fstobdf.h:1.1 Sat Feb 20 09:55:51 1999 +++ xc/programs/fstobdf/fstobdf.h Mon Aug 27 13:41:01 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/fstobdf/fstobdf.h,v 1.1 1999/02/20 14:55:51 hohndel Exp $ */ +/* $XFree86: xc/programs/fstobdf/fstobdf.h,v 1.2 2001/08/27 17:41:01 dawes Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -25,7 +25,7 @@ * XFree86 Project. */ -#include "FSlib.h" +#include <X11/fonts/FSlib.h> extern Bool EmitHeader ( FILE *outFile, FSXFontInfoHeader *fontHeader, FSPropInfo *propInfo, FSPropOffset *propOffsets, Index: xc/programs/fstobdf/fstobdf.man diff -u xc/programs/fstobdf/fstobdf.man:1.6 xc/programs/fstobdf/fstobdf.man:1.7 --- xc/programs/fstobdf/fstobdf.man:1.6 Sat Jan 27 13:21:02 2001 +++ xc/programs/fstobdf/fstobdf.man Fri Dec 14 15:00:46 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: fstobdf.man,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ +.\" $Xorg: fstobdf.man,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ .\" Copyright 1990, Network Computing Devices .\" Copyright 1990, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/fstobdf/fstobdf.man,v 1.6 2001/01/27 18:21:02 dawes Exp $ +.\" $XFree86: xc/programs/fstobdf/fstobdf.man,v 1.7 2001/12/14 20:00:46 dawes Exp $ .\" .TH FSTOBDF 1 __xorgversion__ .SH NAME Index: xc/programs/fstobdf/header.c diff -u xc/programs/fstobdf/header.c:3.5 xc/programs/fstobdf/header.c:3.7 --- xc/programs/fstobdf/header.c:3.5 Wed Jan 17 18:44:54 2001 +++ xc/programs/fstobdf/header.c Fri Dec 14 15:00:46 2001 @@ -1,9 +1,13 @@ -/* $Xorg: header.c,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ */ +/* $Xorg: header.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,14 +43,12 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fstobdf/header.c,v 3.5 2001/01/17 23:44:54 dawes Exp $ */ +/* $XFree86: xc/programs/fstobdf/header.c,v 3.7 2001/12/14 20:00:46 dawes Exp $ */ #include <stdio.h> #include <X11/Xosdefs.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> #include <string.h> -#endif #include "fstobdf.h" unsigned long pointSize; Index: xc/programs/fstobdf/props.c diff -u xc/programs/fstobdf/props.c:1.5 xc/programs/fstobdf/props.c:1.6 --- xc/programs/fstobdf/props.c:1.5 Wed Jan 17 18:44:54 2001 +++ xc/programs/fstobdf/props.c Fri Dec 14 15:00:46 2001 @@ -1,9 +1,13 @@ -/* $Xorg: props.c,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ */ +/* $Xorg: props.c,v 1.4 2001/02/09 02:05:30 xorgcvs Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,7 +43,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fstobdf/props.c,v 1.5 2001/01/17 23:44:54 dawes Exp $ */ +/* $XFree86: xc/programs/fstobdf/props.c,v 1.6 2001/12/14 20:00:46 dawes Exp $ */ #include <stdio.h> #include <string.h> Index: xc/programs/glxgears/glxgears.c diff -u xc/programs/glxgears/glxgears.c:1.2 xc/programs/glxgears/glxgears.c:1.3 --- xc/programs/glxgears/glxgears.c:1.2 Tue Apr 3 11:56:26 2001 +++ xc/programs/glxgears/glxgears.c Sat Nov 3 12:29:20 2001 @@ -18,7 +18,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/glxgears/glxgears.c,v 1.2 2001/04/03 15:56:26 dawes Exp $ */ +/* $XFree86: xc/programs/glxgears/glxgears.c,v 1.3 2001/11/03 17:29:20 dawes Exp $ */ /* * This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT) @@ -478,6 +478,7 @@ make_window(dpy, "glxgears", 0, 0, 300, 300, &win, &ctx); XMapWindow(dpy, win); glXMakeCurrent(dpy, win, ctx); + reshape(300, 300); if (printInfo) { printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); Index: xc/programs/glxinfo/glxinfo.c diff -u xc/programs/glxinfo/glxinfo.c:1.6 xc/programs/glxinfo/glxinfo.c:1.7 --- xc/programs/glxinfo/glxinfo.c:1.6 Mon Apr 2 18:13:18 2001 +++ xc/programs/glxinfo/glxinfo.c Fri Aug 17 09:27:57 2001 @@ -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.6 2001/04/02 22:13:18 dawes Exp $ */ +/* $XFree86: xc/programs/glxinfo/glxinfo.c,v 1.7 2001/08/17 13:27:57 dawes Exp $ */ /* * This program is a work-alike of the IRIX glxinfo program. @@ -642,6 +642,11 @@ } else if (strcmp(argv[i], "-b") == 0) { findBest = GL_TRUE; + } + else { + fprintf(stderr, "Usage: %s [-t] [-v] [-b] [-display <display>]\n", + argv[0]); + return -1; } } Index: xc/programs/glxinfo/glxinfo.man diff -u xc/programs/glxinfo/glxinfo.man:1.4 xc/programs/glxinfo/glxinfo.man:1.5 --- xc/programs/glxinfo/glxinfo.man:1.4 Mon Apr 2 17:22:05 2001 +++ xc/programs/glxinfo/glxinfo.man Fri Dec 14 15:00:47 2001 @@ -1,7 +1,11 @@ .\" $TOG: xdpyinfo.man /main/22 1998/02/09 13:57:10 kaleb $ .\" Copyright 1988, 1989, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/glxinfo/glxinfo.man,v 1.4 2001/04/02 21:22:05 dawes Exp $ +.\" $XFree86: xc/programs/glxinfo/glxinfo.man,v 1.5 2001/12/14 20:00:47 dawes Exp $ .\" .TH GLXINFO 1 __vendorversion__ .SH NAME Index: xc/programs/iceauth/iceauth.c diff -u xc/programs/iceauth/iceauth.c:1.4 xc/programs/iceauth/iceauth.c:1.5 --- xc/programs/iceauth/iceauth.c:1.4 Wed Jan 17 18:44:54 2001 +++ xc/programs/iceauth/iceauth.c Fri Dec 14 15:00:48 2001 @@ -1,12 +1,16 @@ /* - * $Xorg: iceauth.c,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ + * $Xorg: iceauth.c,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ * * xauth - manipulate authorization file * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -25,7 +29,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.4 2001/01/17 23:44:54 dawes Exp $ */ +/* $XFree86: xc/programs/iceauth/iceauth.c,v 1.5 2001/12/14 20:00:48 dawes Exp $ */ #include "iceauth.h" Index: xc/programs/iceauth/iceauth.h diff -u xc/programs/iceauth/iceauth.h:3.3 xc/programs/iceauth/iceauth.h:3.5 --- xc/programs/iceauth/iceauth.h:3.3 Wed Jan 17 18:44:54 2001 +++ xc/programs/iceauth/iceauth.h Fri Dec 14 15:00:48 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: iceauth.h,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ + * $Xorg: iceauth.h,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/iceauth/iceauth.h,v 3.3 2001/01/17 23:44:54 dawes Exp $ */ +/* $XFree86: xc/programs/iceauth/iceauth.h,v 3.5 2001/12/14 20:00:48 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> @@ -39,11 +43,7 @@ extern char *ProgramName; -#ifdef X_NOT_STDC_ENV -extern char *malloc(), *realloc(); -#else #include <stdlib.h> -#endif extern int auth_initialize ( char *authfilename ); extern int auth_finalize ( void ); Index: xc/programs/iceauth/iceauth.man diff -u xc/programs/iceauth/iceauth.man:3.6 xc/programs/iceauth/iceauth.man:3.7 --- xc/programs/iceauth/iceauth.man:3.6 Sat Jan 27 13:21:03 2001 +++ xc/programs/iceauth/iceauth.man Fri Dec 14 15:00:48 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: iceauth.man,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ +.\" $Xorg: iceauth.man,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ .\" Copyright 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" dealing in this Software without prior written authorization from the .\" The Open Group. .\" -.\" $XFree86: xc/programs/iceauth/iceauth.man,v 3.6 2001/01/27 18:21:03 dawes Exp $ +.\" $XFree86: xc/programs/iceauth/iceauth.man,v 3.7 2001/12/14 20:00:48 dawes Exp $ .\" .TH ICEAUTH 1 __xorgversion__ .SH NAME Index: xc/programs/iceauth/process.c diff -u xc/programs/iceauth/process.c:3.3 xc/programs/iceauth/process.c:3.7 --- xc/programs/iceauth/process.c:3.3 Wed Jan 17 18:44:54 2001 +++ xc/programs/iceauth/process.c Fri Dec 14 15:00:49 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: process.c,v 1.4 2000/08/17 19:53:53 cpqbld Exp $ + * $Xorg: process.c,v 1.5 2001/02/09 02:05:31 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -24,17 +28,13 @@ * Modified into "iceauth" : Ralph Mor, X Consortium */ -/* $XFree86: xc/programs/iceauth/process.c,v 3.3 2001/01/17 23:44:54 dawes Exp $ */ +/* $XFree86: xc/programs/iceauth/process.c,v 3.7 2001/12/14 20:00:49 dawes Exp $ */ #include "iceauth.h" #include <ctype.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - #include <signal.h> #define SECURERPC "SUN-DES-1" @@ -498,12 +498,15 @@ #define _signal_t void #endif +/* poor man's puts(), for under signal handlers */ +#define WRITES(fd, S) (void)write((fd), (S), strlen((S))) + /* ARGSUSED */ static _signal_t die (sig) int sig; { dieing = True; - exit (auth_finalize ()); + _exit (auth_finalize ()); /* NOTREACHED */ #ifdef SIGNALRETURNSINT return -1; /* for picky compilers */ @@ -516,7 +519,15 @@ #ifdef SYSV if (sig > 0) signal (sig, die); /* re-establish signal handler */ #endif - if (verbose && iceauth_modified) printf ("\r\n"); + /* + * fileno() might not be reentrant, avoid it if possible, and use + * stderr instead of stdout + */ +#ifdef STDERR_FILENO + if (verbose && iceauth_modified) WRITES(STDERR_FILENO, "\r\n"); +#else + if (verbose && iceauth_modified) WRITES(fileno(stderr), "\r\n"); +#endif die (sig); /* NOTREACHED */ #ifdef SIGNALRETURNSINT @@ -672,8 +683,20 @@ if (iceauth_modified) { if (dieing) { if (verbose) { - printf ("Aborting changes to authority file %s\n", - iceauth_filename); + /* + * 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, iceauth_filename); + WRITES(STDERR_FILENO, "\n"); +#else + WRITES(fileno(stderr), "\nAborting changes to authority file "); + WRITES(fileno(stderr), iceauth_filename); + WRITES(fileno(stderr), "\n"); +#endif } } else if (!iceauth_allowed) { fprintf (stderr, Index: xc/programs/ico/ico.c diff -u xc/programs/ico/ico.c:1.3 xc/programs/ico/ico.c:1.5 --- xc/programs/ico/ico.c:1.3 Fri Feb 18 07:20:14 2000 +++ xc/programs/ico/ico.c Wed Aug 29 07:09:44 2001 @@ -46,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/ico/ico.c,v 1.3 2000/02/18 12:20:14 tsi Exp $ */ +/* $XFree86: xc/programs/ico/ico.c,v 1.5 2001/08/29 11:09:44 alanh Exp $ */ /****************************************************************************** * Description @@ -72,6 +72,7 @@ * support for ICCCM delete window message * better thread support - mutex and condition to control termination */ +#include <math.h> #include <X11/Xlib.h> #include <X11/Xatom.h> #include <X11/Xutil.h> @@ -247,7 +248,6 @@ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) void icoFatal () __attribute__((__noreturn__)); #endif -/* VARARGS1 */ void icoFatal(fmt,a0) const char *fmt; @@ -372,7 +372,6 @@ Transform3D m; { double s, c; - double sin(), cos(); IdentMat(m); @@ -1187,7 +1186,6 @@ const char **argv; { const char *display = NULL; - extern int _Xdebug; #ifdef MULTIBUFFER int mbevbase, mberrbase; #endif Index: xc/programs/lbxproxy/lbxproxy.man diff -u xc/programs/lbxproxy/lbxproxy.man:1.7 xc/programs/lbxproxy/lbxproxy.man:1.8 --- xc/programs/lbxproxy/lbxproxy.man:1.7 Sat Jan 27 13:21:03 2001 +++ xc/programs/lbxproxy/lbxproxy.man Fri Dec 14 15:00:49 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: lbxproxy.man,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ +.\" $Xorg: lbxproxy.man,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ .\" Copyright 1996, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" from The Open Group. .\" .\" -.\" $XFree86: xc/programs/lbxproxy/lbxproxy.man,v 1.7 2001/01/27 18:21:03 dawes Exp $ +.\" $XFree86: xc/programs/lbxproxy/lbxproxy.man,v 1.8 2001/12/14 20:00:49 dawes Exp $ .\" .TH LBXPROXY 1 __xorgversion__ .SH NAME Index: xc/programs/lbxproxy/di/atomcache.c diff -u xc/programs/lbxproxy/di/atomcache.c:1.4 xc/programs/lbxproxy/di/atomcache.c:1.6 --- xc/programs/lbxproxy/di/atomcache.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/atomcache.c Fri Dec 14 15:00:50 2001 @@ -1,9 +1,13 @@ -/* $Xorg: atomcache.c,v 1.3 2000/08/17 19:53:54 cpqbld Exp $ */ +/* $Xorg: atomcache.c,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,6 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/atomcache.c,v 1.6 2001/12/14 20:00:50 dawes Exp $ */ /* * atom cache for LBX @@ -158,7 +163,7 @@ { AtomListPtr a; int hash; - int h; + int h = 0; int r; hash = Hash(string, len); Index: xc/programs/lbxproxy/di/cache.c diff -u xc/programs/lbxproxy/di/cache.c:1.4 xc/programs/lbxproxy/di/cache.c:1.6 --- xc/programs/lbxproxy/di/cache.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/cache.c Fri Dec 14 15:00:50 2001 @@ -1,8 +1,12 @@ -/* $Xorg: cache.c,v 1.4 2000/08/17 19:53:54 cpqbld Exp $ */ +/* $Xorg: cache.c,v 1.5 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,6 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/cache.c,v 1.6 2001/12/14 20:00:50 dawes Exp $ */ #include "misc.h" #include "util.h" #include "cache.h" @@ -221,7 +226,7 @@ CachePtr cache; unsigned long needed; { - CacheEntryPtr cp, *prev, oldest, *oldprev; + CacheEntryPtr cp, *prev, oldest, *oldprev = NULL; int i; while ((cache->cursize + needed) > cache->maxsize) { Index: xc/programs/lbxproxy/di/cmap.c diff -u xc/programs/lbxproxy/di/cmap.c:1.4 xc/programs/lbxproxy/di/cmap.c:1.6 --- xc/programs/lbxproxy/di/cmap.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/cmap.c Fri Dec 14 15:00:50 2001 @@ -1,9 +1,13 @@ -/* $Xorg: cmap.c,v 1.4 2000/08/17 19:53:54 cpqbld Exp $ */ +/* $Xorg: cmap.c,v 1.5 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,6 +48,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/cmap.c,v 1.6 2001/12/14 20:00:50 dawes Exp $ */ #include <stdio.h> #include "assert.h" @@ -221,8 +226,9 @@ BigNumLower lower; } BigNumRec, *BigNumPtr; -#define BigNumGreater(x,y) ((x)->upper > (y)->upper ||\ - (x)->upper == (y)->upper && (x)->lower > (y)->lower) +#define BigNumGreater(x,y) (((x)->upper > (y)->upper) ||\ + (((x)->upper == (y)->upper) &&\ + ((x)->lower > (y)->lower))) #define UnsignedToBigNum(u,r) (((r)->upper = UPPERPART(u)), \ ((r)->lower = LOWERPART(u))) Index: xc/programs/lbxproxy/di/cmaputil.c diff -u xc/programs/lbxproxy/di/cmaputil.c:1.7 xc/programs/lbxproxy/di/cmaputil.c:1.10 --- xc/programs/lbxproxy/di/cmaputil.c:1.7 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/cmaputil.c Fri Dec 14 15:00:50 2001 @@ -1,9 +1,13 @@ -/* $Xorg: cmaputil.c,v 1.4 2000/08/17 19:53:54 cpqbld Exp $ */ +/* $Xorg: cmaputil.c,v 1.5 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,7 +48,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/cmaputil.c,v 1.7 2001/01/17 23:44:55 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/cmaputil.c,v 1.10 2001/12/14 20:00:50 dawes Exp $ */ #include <stdio.h> #include "misc.h" @@ -131,7 +135,7 @@ * beware of too-small buffers */ -void +static void CopyISOLatin1Lowered(dest, source, length) register unsigned char *dest, *source; int length; @@ -188,7 +192,7 @@ Bool create; { unsigned int h = 0, g; - dbEntryPtr entry, *prev; + dbEntryPtr entry, *prev = NULL; char *str = name; if (!(name = (char*)ALLOCATE_LOCAL(len +1))) return NULL; Index: xc/programs/lbxproxy/di/dispatch.c diff -u xc/programs/lbxproxy/di/dispatch.c:1.5 xc/programs/lbxproxy/di/dispatch.c:1.6 --- xc/programs/lbxproxy/di/dispatch.c:1.5 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/dispatch.c Sat Oct 27 23:34:22 2001 @@ -21,6 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/dispatch.c,v 1.6 2001/10/28 03:34:22 tsi Exp $ */ #include <stdio.h> #include "assert.h" @@ -68,7 +69,7 @@ Dispatch () { register int *clientReady; /* array of request ready clients */ - register int result; + register int result = 0; register ClientPtr client; register int nready; Index: xc/programs/lbxproxy/di/extensions.c diff -u xc/programs/lbxproxy/di/extensions.c:1.4 xc/programs/lbxproxy/di/extensions.c:1.5 --- xc/programs/lbxproxy/di/extensions.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/extensions.c Fri Dec 14 15:00:51 2001 @@ -1,9 +1,13 @@ -/* $Xorg: extensions.c,v 1.4 2000/08/17 19:53:55 cpqbld Exp $ */ +/* $Xorg: extensions.c,v 1.5 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/di/gfx.c diff -u xc/programs/lbxproxy/di/gfx.c:1.4 xc/programs/lbxproxy/di/gfx.c:1.6 --- xc/programs/lbxproxy/di/gfx.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/gfx.c Fri Dec 14 15:00:51 2001 @@ -1,9 +1,13 @@ -/* $Xorg: gfx.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ +/* $Xorg: gfx.c,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,6 +46,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/gfx.c,v 1.6 2001/12/14 20:00:51 dawes Exp $ */ + /* * graphics acceleration */ @@ -876,15 +882,15 @@ char *out; int len, reqlen, - method, + method = 0, compBytes, status; #ifdef LBX_STATS float percentCompression; char *methodName; #endif - LbxBitmapCompMethod *bcompMethod; - LbxPixmapCompMethod *pcompMethod; + LbxBitmapCompMethod *bcompMethod = NULL; + LbxPixmapCompMethod *pcompMethod = NULL; GFX_CACHE_DECLARE; status = LBX_IMAGE_COMPRESS_SUCCESS; Index: xc/programs/lbxproxy/di/globals.c diff -u xc/programs/lbxproxy/di/globals.c:1.4 xc/programs/lbxproxy/di/globals.c:1.5 --- xc/programs/lbxproxy/di/globals.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/globals.c Fri Dec 14 15:00:51 2001 @@ -1,9 +1,13 @@ -/* $Xorg: globals.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ +/* $Xorg: globals.c,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/di/init.c diff -u xc/programs/lbxproxy/di/init.c:1.4 xc/programs/lbxproxy/di/init.c:1.6 --- xc/programs/lbxproxy/di/init.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/init.c Fri Dec 14 15:00:51 2001 @@ -1,9 +1,13 @@ -/* $Xorg: init.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ +/* $Xorg: init.c,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,6 +45,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/init.c,v 1.6 2001/12/14 20:00:51 dawes Exp $ */ /* * This file is used for anything that needs to dip into Xlib structures @@ -56,6 +61,7 @@ #include <X11/Xlibint.h> #include <X11/Xutil.h> #include <stdio.h> +#include "XLbx.h" /* Hook up to an X server and set up a multiplexing LBX encoded connection */ struct _XDisplay* Index: xc/programs/lbxproxy/di/lbxfuncs.c diff -u xc/programs/lbxproxy/di/lbxfuncs.c:1.4 xc/programs/lbxproxy/di/lbxfuncs.c:1.5 --- xc/programs/lbxproxy/di/lbxfuncs.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/lbxfuncs.c Sat Oct 27 23:34:22 2001 @@ -22,6 +22,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/lbxfuncs.c,v 1.5 2001/10/28 03:34:22 tsi Exp $ */ /* * top level LBX request & reply handling @@ -243,7 +244,8 @@ td = TagGetTag(client->server, client->server->global_cache, rep->tag); if (!td) { - fprintf(stderr, "no data for setup tag 0x%x\n", rep->tag); + fprintf(stderr, "no data for setup tag 0x%lx\n", + (long)rep->tag); send_setup_reply(client, FALSE, 0, 0, "bad tag data from server", 0); if (client->swapped) DEALLOCATE_LOCAL(data); @@ -330,6 +332,8 @@ return ProcStandardRequest(client); } + + return 0; /* ?!?!? */ } static Bool @@ -566,7 +570,7 @@ tag_data = TagGetData(client->server, client->server->global_cache, tag); if (!tag_data) { - fprintf(stderr, "no data for mod map tag 0x%x\n", tag); + fprintf(stderr, "no data for mod map tag 0x%lx\n", (long)tag); WriteError(client, X_GetModifierMapping, 0, 0, BadAlloc); return TRUE; } @@ -666,7 +670,7 @@ tag_data = TagGetData(client->server, client->server->global_cache, tag); if (!tag_data) { - fprintf(stderr, "no data for key map tag 0x%x\n", tag); + fprintf(stderr, "no data for key map tag 0x%lx\n", (long)tag); WriteError(client, X_GetKeyboardMapping, 0, 0, BadAlloc); return TRUE; } @@ -892,7 +896,7 @@ } else { td = TagGetTag(client->server, client->server->global_cache, tag); if (!td) { - fprintf(stderr, "no data for font tag 0x%x\n", tag); + fprintf(stderr, "no data for font tag 0x%lx\n", (long)tag); WriteError(client, X_QueryFont, 0, 0, BadAlloc); return TRUE; } @@ -1089,7 +1093,7 @@ ProcLBXGetGeometry(client) ClientPtr client; { - REQUEST(xResourceReq); + /* REQUEST(xResourceReq); */ xGetGeometryReply reply; ReplyStuffPtr nr; char n; Index: xc/programs/lbxproxy/di/lbxutil.c diff -u xc/programs/lbxproxy/di/lbxutil.c:1.4 xc/programs/lbxproxy/di/lbxutil.c:1.5 --- xc/programs/lbxproxy/di/lbxutil.c:1.4 Wed Jan 17 18:44:55 2001 +++ xc/programs/lbxproxy/di/lbxutil.c Sat Oct 27 23:34:22 2001 @@ -21,6 +21,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/lbxutil.c,v 1.5 2001/10/28 03:34:22 tsi Exp $ */ + /* * utility routines for LBX requests */ @@ -285,8 +287,8 @@ break; default: fprintf(stderr, - "unknown type in InvalidateTag request: tag 0x%x type %d\n", - tag, tagtype); + "unknown type in InvalidateTag request: tag 0x%lx type %d\n", + (long)tag, tagtype); return; } TagFreeData(server, tag_cache, tag, TRUE); @@ -309,8 +311,8 @@ tdata = ptdp->data; len = ptdp->length; } else { - fprintf(stderr, "invalid SendTagData request: tag 0x%x type %d\n", - tag, tagtype); + fprintf(stderr, "invalid SendTagData request: tag 0x%lx type %d\n", + (long)tag, tagtype); len = 0; tdata = NULL; } @@ -330,22 +332,22 @@ DumpCompressionStats() { if (raw_stream_out && stream_out_plain) { - fprintf(stderr, "Requests: normal = %d, reencoded = %d", - raw_stream_out, stream_out_plain); + fprintf(stderr, "Requests: normal = %ld, reencoded = %ld", + (long)raw_stream_out, (long)stream_out_plain); stream_out_compressed += stream_out_uncompressed; if (stream_out_compressed) - fprintf(stderr, ", compressed = %d", stream_out_compressed); + fprintf(stderr, ", compressed = %ld", (long)stream_out_compressed); else stream_out_compressed = stream_out_plain; fprintf(stderr, "\n %.2f:1 overall reduction ratio\n", (float)raw_stream_out / (float)stream_out_compressed); } if (raw_stream_in && stream_in_plain) { - fprintf(stderr, "Responses: normal = %d, reencoded = %d", - raw_stream_in, stream_in_plain); + fprintf(stderr, "Responses: normal = %ld, reencoded = %ld", + (long)raw_stream_in, (long)stream_in_plain); stream_in_compressed += stream_in_uncompressed; if (stream_in_compressed) - fprintf(stderr, ", compressed = %d", stream_in_compressed); + fprintf(stderr, ", compressed = %ld", (long)stream_in_compressed); else stream_in_compressed = stream_in_plain; fprintf(stderr, "\n %.2f:1 overall reduction ratio\n", Index: xc/programs/lbxproxy/di/main.c diff -u xc/programs/lbxproxy/di/main.c:1.8 xc/programs/lbxproxy/di/main.c:1.9 --- xc/programs/lbxproxy/di/main.c:1.8 Sun Jan 21 16:19:39 2001 +++ xc/programs/lbxproxy/di/main.c Fri Dec 14 15:00:51 2001 @@ -1,9 +1,13 @@ -/* $Xorg: main.c,v 1.4 2000/08/17 19:53:55 cpqbld Exp $ */ +/* $Xorg: main.c,v 1.5 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/main.c,v 1.8 2001/01/21 21:19:39 tsi Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/main.c,v 1.9 2001/12/14 20:00:51 dawes Exp $ */ #include <stdlib.h> #include "lbx.h" Index: xc/programs/lbxproxy/di/options.c diff -u xc/programs/lbxproxy/di/options.c:1.6 xc/programs/lbxproxy/di/options.c:1.7 --- xc/programs/lbxproxy/di/options.c:1.6 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/options.c Fri Dec 14 15:00:51 2001 @@ -1,9 +1,13 @@ -/* $Xorg: options.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ +/* $Xorg: options.c,v 1.4 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/options.c,v 1.6 2001/01/17 23:44:56 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/options.c,v 1.7 2001/12/14 20:00:51 dawes Exp $ */ #include <stdio.h> #include "X.h" Index: xc/programs/lbxproxy/di/pm.c diff -u xc/programs/lbxproxy/di/pm.c:1.5 xc/programs/lbxproxy/di/pm.c:1.8 --- xc/programs/lbxproxy/di/pm.c:1.5 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/pm.c Fri Dec 14 15:00:52 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pm.c,v 1.4 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: pm.c,v 1.5 2001/02/09 02:05:31 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,9 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/lbxproxy/di/pm.c,v 1.8 2001/12/14 20:00:52 dawes Exp $ */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> @@ -29,6 +35,7 @@ #include <netinet/in.h> #include <netdb.h> #include <X11/Xmd.h> +#include <X11/Xlib.h> #include <X11/ICE/ICElib.h> #include <X11/ICE/ICEmsg.h> #include <X11/ICE/ICEproto.h> @@ -403,12 +410,8 @@ * Connect to this server and send a GetProxyAddrReply msg. */ if (!ConnectToServer (display_name)) { - char msg [100]; - - (void) sprintf (msg, - "could not connect to '%s'", - display_name); - FatalError(msg); + FatalError ("could not connect to '%s'", + display_name); } } else Index: xc/programs/lbxproxy/di/props.c diff -u xc/programs/lbxproxy/di/props.c:1.4 xc/programs/lbxproxy/di/props.c:1.6 --- xc/programs/lbxproxy/di/props.c:1.4 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/props.c Fri Dec 14 15:00:52 2001 @@ -1,9 +1,13 @@ -/* $Xorg: props.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: props.c,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,6 +46,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/di/props.c,v 1.6 2001/12/14 20:00:52 dawes Exp $ */ + /* * property handling */ @@ -328,7 +334,7 @@ client->server->prop_cache, tag); if (!ptdp) { - fprintf(stderr, "no data for property tag 0x%x\n", tag); + fprintf(stderr, "no data for property tag 0x%lx\n", (long)tag); WriteError(client, X_GetProperty, 0, 0, BadAlloc); return TRUE; } Index: xc/programs/lbxproxy/di/resource.c diff -u xc/programs/lbxproxy/di/resource.c:1.4 xc/programs/lbxproxy/di/resource.c:1.5 --- xc/programs/lbxproxy/di/resource.c:1.4 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/resource.c Fri Dec 14 15:00:52 2001 @@ -3,7 +3,11 @@ Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/di/swaprep.c diff -u xc/programs/lbxproxy/di/swaprep.c:1.4 xc/programs/lbxproxy/di/swaprep.c:1.5 --- xc/programs/lbxproxy/di/swaprep.c:1.4 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/swaprep.c Fri Dec 14 15:00:52 2001 @@ -1,9 +1,13 @@ -/* $Xorg: swaprep.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: swaprep.c,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/di/swapreq.c diff -u xc/programs/lbxproxy/di/swapreq.c:1.4 xc/programs/lbxproxy/di/swapreq.c:1.5 --- xc/programs/lbxproxy/di/swapreq.c:1.4 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/swapreq.c Fri Dec 14 15:00:53 2001 @@ -1,9 +1,13 @@ -/* $Xorg: swapreq.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: swapreq.c,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/di/tags.c diff -u xc/programs/lbxproxy/di/tags.c:1.4 xc/programs/lbxproxy/di/tags.c:1.5 --- xc/programs/lbxproxy/di/tags.c:1.4 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/tags.c Fri Dec 14 15:00:53 2001 @@ -1,9 +1,13 @@ -/* $Xorg: tags.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: tags.c,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/di/unsquish.c diff -u xc/programs/lbxproxy/di/unsquish.c:1.4 xc/programs/lbxproxy/di/unsquish.c:1.5 --- xc/programs/lbxproxy/di/unsquish.c:1.4 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/unsquish.c Fri Dec 14 15:00:53 2001 @@ -1,9 +1,13 @@ -/* $Xorg: unsquish.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: unsquish.c,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/di/utils.c diff -u xc/programs/lbxproxy/di/utils.c:1.10 xc/programs/lbxproxy/di/utils.c:1.13 --- xc/programs/lbxproxy/di/utils.c:1.10 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/utils.c Fri Dec 14 15:00:53 2001 @@ -1,9 +1,13 @@ -/* $Xorg: utils.c,v 1.4 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: utils.c,v 1.5 2001/02/09 02:05:32 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/di/utils.c,v 1.10 2001/01/17 23:44:56 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/utils.c,v 1.13 2001/12/14 20:00:53 dawes Exp $ */ #include "lbx.h" #include <stdio.h> @@ -63,14 +67,9 @@ #include <sys/resource.h> #endif -/* lifted from Xt/VarargsI.h */ -#if NeedVarargsPrototypes #include <stdarg.h> -#endif -#if NeedVarargsPrototypes -static void VErrorF(char*, va_list); -#endif +static void VErrorF(const char*, va_list); #ifdef SIGNALRETURNSINT #define SIGVAL int @@ -83,12 +82,7 @@ #include "atomcache.h" #include "proxyopts.h" -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern char *malloc(); -extern char *realloc(); -#endif /* * External declarations not in header files @@ -198,7 +192,7 @@ isItTimeToYield = TRUE; #ifdef GPROF chdir ("/tmp"); - exit (0); + _exit (0); #endif #ifdef SYSV signal (SIGHUP, AutoResetServer); @@ -642,27 +636,13 @@ #endif } -/*VARARGS1*/ void -AuditF( -#if NeedVarargsPrototypes - char * f, ...) -#else - f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ - char *f; - char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; -#endif +AuditF(const char * f, ...) { #ifdef notyet /* ever ? */ -#ifdef X_NOT_STDC_ENV - long tm; -#else time_t tm; -#endif char *autime, *s; -#if NeedVarargsPrototypes va_list args; -#endif if (*f != ' ') { @@ -676,72 +656,38 @@ s = argvGlobal[0]; ErrorF("AUDIT: %s: %d %s: ", autime, getpid(), s); } -#if NeedVarargsPrototypes va_start(args, f); VErrorF(f, args); va_end(args); -#else - ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); -#endif #endif } -/*VARARGS1*/ void -FatalError( -#if NeedVarargsPrototypes - char *f, ...) -#else -f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ - char *f; - char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; -#endif +FatalError(const char *f, ...) { -#if NeedVarargsPrototypes va_list args; -#endif ErrorF("\nFatal lbxproxy error: "); -#if NeedVarargsPrototypes va_start(args, f); VErrorF(f, args); va_end(args); -#else - ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); -#endif ErrorF("\n"); AbortServer(); /*NOTREACHED*/ } -#if NeedVarargsPrototypes static void -VErrorF(f, args) - char *f; - va_list args; +VErrorF(const char *f, va_list args) { vfprintf(stderr, f, args); } -#endif -/*VARARGS1*/ void -ErrorF( -#if NeedVarargsPrototypes - char * f, ...) -#else - f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ - char *f; - char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; -#endif +ErrorF(const char * f, ...) { -#if NeedVarargsPrototypes va_list args; va_start(args, f); VErrorF(f, args); va_end(args); -#else - fprintf( stderr, f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); -#endif } char * Index: xc/programs/lbxproxy/di/wire.c diff -u xc/programs/lbxproxy/di/wire.c:1.10 xc/programs/lbxproxy/di/wire.c:1.12 --- xc/programs/lbxproxy/di/wire.c:1.10 Wed Jan 17 18:44:56 2001 +++ xc/programs/lbxproxy/di/wire.c Fri Dec 14 15:00:53 2001 @@ -1,9 +1,13 @@ -/* $Xorg: wire.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: wire.c,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,11 +45,14 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/wire.c,v 1.10 2001/01/17 23:44:56 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/wire.c,v 1.12 2001/12/14 20:00:53 dawes Exp $ */ #include "lbx.h" #include <stdio.h> +#include <stdlib.h> #include "wire.h" +#include "tags.h" +#include "colormap.h" #include "init.h" #ifndef Lynx #include <sys/uio.h> @@ -408,10 +415,21 @@ } void +#ifdef NeedFunctionPrototypes +SendAllocColor( + ClientPtr client, + XID cmap, + CARD32 pixel, + CARD16 red, + CARD16 green, + CARD16 blue) +#else SendAllocColor(client, cmap, pixel, red, green, blue) ClientPtr client; XID cmap; + CARD32 pixel; CARD16 red, green, blue; +#endif { xLbxAllocColorReq req; @@ -953,7 +971,7 @@ start, end); #endif if (pmap && pmap->grab_status == CMAP_GRABBED) - GotServerFreeCellsEvent (pmap, start, end, 1); + GotServerFreeCellsEvent (pmap, start, end); break; } } Index: xc/programs/lbxproxy/di/zeropad.c diff -u xc/programs/lbxproxy/di/zeropad.c:1.1.1.3 xc/programs/lbxproxy/di/zeropad.c:1.2 --- xc/programs/lbxproxy/di/zeropad.c:1.1.1.3 Tue Jan 16 17:46:29 2001 +++ xc/programs/lbxproxy/di/zeropad.c Fri Dec 14 15:00:53 2001 @@ -1,10 +1,14 @@ -/* $Xorg: zeropad.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ +/* $Xorg: zeropad.c,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/atomcache.h diff -u xc/programs/lbxproxy/include/atomcache.h:1.4 xc/programs/lbxproxy/include/atomcache.h:1.5 --- xc/programs/lbxproxy/include/atomcache.h:1.4 Wed Jan 17 18:44:57 2001 +++ xc/programs/lbxproxy/include/atomcache.h Fri Dec 14 15:00:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: atomcache.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ +/* $Xorg: atomcache.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/cache.h diff -u xc/programs/lbxproxy/include/cache.h:1.5 xc/programs/lbxproxy/include/cache.h:1.6 --- xc/programs/lbxproxy/include/cache.h:1.5 Wed Jan 17 18:44:57 2001 +++ xc/programs/lbxproxy/include/cache.h Fri Dec 14 15:00:55 2001 @@ -1,8 +1,12 @@ -/* $Xorg: cache.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ +/* $Xorg: cache.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/colormap.h diff -u xc/programs/lbxproxy/include/colormap.h:1.4 xc/programs/lbxproxy/include/colormap.h:1.6 --- xc/programs/lbxproxy/include/colormap.h:1.4 Wed Jan 17 18:44:57 2001 +++ xc/programs/lbxproxy/include/colormap.h Fri Dec 14 15:00:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: colormap.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ +/* $Xorg: colormap.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,6 +46,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/include/colormap.h,v 1.6 2001/12/14 20:00:55 dawes Exp $ */ #ifndef COLORMAP_H_ #define COLORMAP_H_ @@ -177,6 +182,47 @@ #endif ); +extern void ReleaseCmap( +#if NeedFunctionPrototypes + ClientPtr /* client */, + ColormapPtr /* pmap */ +#endif +); + +extern int CreateColormap( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Colormap /*cmap*/, + VisualID /*visual*/ +#endif +); + +extern int FreeColormap( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Colormap /*cmap*/ +#endif +); + +extern int CreateVisual( +#if NeedFunctionPrototypes + int /*depth*/, + xVisualType * /*vis*/ +#endif +); + +extern LbxVisualPtr GetVisual( +#if NeedFunctionPrototypes + VisualID /*vid*/ +#endif +); + +extern Bool InitColors( +#if NeedFunctionPrototypes + void +#endif +); + extern RGBEntryPtr FindColorName( #if NeedFunctionPrototypes XServerPtr /*server*/, @@ -195,16 +241,17 @@ #endif ); -extern int CreateVisual( +extern void FreeColors( #if NeedFunctionPrototypes - int /*depth*/, - xVisualType * /*vis*/ + void #endif ); -extern LbxVisualPtr GetVisual( +extern int DestroyColormap( #if NeedFunctionPrototypes - VisualID /*vid*/ + ClientPtr /*client*/, + pointer /*pmap*/, + XID /*id*/ #endif ); @@ -219,26 +266,6 @@ #endif ); -extern int StorePixel( -#if NeedFunctionPrototypes - ClientPtr /*client*/, - ColormapPtr /*pmap*/, - CARD32 /*red*/, - CARD32 /*green*/, - CARD32 /*blue*/, - Pixel /*pixel*/, - Bool /*from_server*/ -#endif -); - -extern int FreeClientPixels( -#if NeedFunctionPrototypes - ClientPtr /*client*/, - pointer /*pcr*/, - XID /*id*/ -#endif -); - extern int IncrementPixel( #if NeedFunctionPrototypes ClientPtr /*pclient*/, @@ -256,50 +283,48 @@ #endif ); -extern int FreePixels( +extern int StorePixel( #if NeedFunctionPrototypes ClientPtr /*client*/, ColormapPtr /*pmap*/, - int /*num*/, - Pixel * /*pixels*/, - Pixel /*mask*/ + CARD32 /*red*/, + CARD32 /*green*/, + CARD32 /*blue*/, + Pixel /*pixel*/, + Bool /*from_server*/ #endif ); -extern int CreateColormap( +extern void GotServerFreeCellsEvent( #if NeedFunctionPrototypes - ClientPtr /*client*/, - Colormap /*cmap*/, - VisualID /*visual*/ + ColormapPtr /* pmap */, + Pixel /* pixel_start */, + Pixel /* pixel_end */ #endif ); -extern int DestroyColormap( +extern void FreeAllClientPixels( #if NeedFunctionPrototypes - ClientPtr /*client*/, - pointer /*pmap*/, - XID /*id*/ + ColormapPtr /* pmap */, + int /* client */ #endif ); -extern int FreeColormap( +extern int FreeClientPixels( #if NeedFunctionPrototypes ClientPtr /*client*/, - Colormap /*cmap*/ + pointer /*pcr*/, + XID /*id*/ #endif ); -extern int CopyAndFreeColormap( +extern int FreePixels( #if NeedFunctionPrototypes ClientPtr /*client*/, - Colormap /*new*/, - Colormap /*old*/ -#endif -); - -extern void FreeColors( -#if NeedFunctionPrototypes - void + ColormapPtr /*pmap*/, + int /*num*/, + Pixel * /*pixels*/, + Pixel /*mask*/ #endif ); Index: xc/programs/lbxproxy/include/init.h diff -u xc/programs/lbxproxy/include/init.h:1.1.1.3 xc/programs/lbxproxy/include/init.h:1.2 --- xc/programs/lbxproxy/include/init.h:1.1.1.3 Tue Jan 16 17:46:31 2001 +++ xc/programs/lbxproxy/include/init.h Fri Dec 14 15:00:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: init.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ +/* $Xorg: init.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/lbx.h diff -u xc/programs/lbxproxy/include/lbx.h:1.4 xc/programs/lbxproxy/include/lbx.h:1.6 --- xc/programs/lbxproxy/include/lbx.h:1.4 Wed Jan 17 18:44:57 2001 +++ xc/programs/lbxproxy/include/lbx.h Fri Dec 14 15:00:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbx.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ +/* $Xorg: lbx.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,13 +45,13 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/include/lbx.h,v 1.6 2001/12/14 20:00:55 dawes Exp $ */ #ifndef _LBX_H_ #define _LBX_H_ #include "misc.h" #include "os.h" #include "util.h" -#define _XLBX_SERVER_ #include "lbxstr.h" /* we keep the ifdefs in the code as a guide to what's going on */ Index: xc/programs/lbxproxy/include/lbxext.h diff -u xc/programs/lbxproxy/include/lbxext.h:1.1.1.3 xc/programs/lbxproxy/include/lbxext.h:1.2 --- xc/programs/lbxproxy/include/lbxext.h:1.1.1.3 Tue Jan 16 17:46:32 2001 +++ xc/programs/lbxproxy/include/lbxext.h Fri Dec 14 15:00:55 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lbxext.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ +/* $Xorg: lbxext.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/misc.h diff -u xc/programs/lbxproxy/include/misc.h:1.4 xc/programs/lbxproxy/include/misc.h:1.7 --- xc/programs/lbxproxy/include/misc.h:1.4 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/misc.h Fri Dec 14 15:00:55 2001 @@ -1,10 +1,14 @@ -/* $Xorg: misc.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ +/* $Xorg: misc.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1995, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,13 +27,13 @@ from The Open Group. */ +/* $XFree86: xc/programs/lbxproxy/include/misc.h,v 1.7 2001/12/14 20:00:55 dawes Exp $ */ #ifndef MISC_H #define MISC_H 1 #define NEED_EVENTS #define NEED_REPLIES -#define _XLBX_SERVER_ #include <X11/X.h> #include <X11/Xproto.h> #include <X11/Xmd.h> @@ -39,21 +43,15 @@ #include "Xalloca.h" #include "Xfuncs.h" #include "Xfuncproto.h" +#include "lbxstr.h" -typedef void *pointer; -#ifndef _BOOL_ALREADY_DEFINED_ -typedef int Bool; -#endif #ifndef TRUE #define FALSE 0 #define TRUE 1 #endif -typedef struct _Client *ClientPtr; typedef struct _XServer *XServerPtr; -#ifndef NULL -#define NULL 0 -#endif +#include <stddef.h> #define DE_RESET 1 #define DE_TERMINATE 2 #define MILLI_PER_SECOND (1000) Index: xc/programs/lbxproxy/include/os.h diff -u xc/programs/lbxproxy/include/os.h:1.5 xc/programs/lbxproxy/include/os.h:1.7 --- xc/programs/lbxproxy/include/os.h:1.5 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/os.h Fri Dec 14 15:00:55 2001 @@ -1,10 +1,14 @@ -/* $Xorg: os.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ +/* $Xorg: os.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1995, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,6 +27,8 @@ from The Open Group. */ +/* $XFree86: xc/programs/lbxproxy/include/os.h,v 1.7 2001/12/14 20:00:55 dawes Exp $ */ + #ifndef OS_H #define OS_H @@ -51,9 +57,21 @@ extern Bool AnyClientsWriteBlocked; extern int GrabInProgress; +extern void InitConnectionLimits( +#if NeedFunctionPrototypes + void +#endif +); + extern void CreateServerSockets( #if NeedFunctionPrototypes int * /*listen_fds[]*/ +#endif +); + +extern void CloseServerSockets( +#if NeedFunctionPrototypes + void #endif ); Index: xc/programs/lbxproxy/include/pm.h diff -u xc/programs/lbxproxy/include/pm.h:1.3 xc/programs/lbxproxy/include/pm.h:1.4 --- xc/programs/lbxproxy/include/pm.h:1.3 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/pm.h Fri Dec 14 15:00:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pm.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: pm.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/pmP.h diff -u xc/programs/lbxproxy/include/pmP.h:1.3 xc/programs/lbxproxy/include/pmP.h:1.4 --- xc/programs/lbxproxy/include/pmP.h:1.3 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/pmP.h Fri Dec 14 15:00:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pmP.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: pmP.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/proxyopts.h diff -u xc/programs/lbxproxy/include/proxyopts.h:1.4 xc/programs/lbxproxy/include/proxyopts.h:1.5 --- xc/programs/lbxproxy/include/proxyopts.h:1.4 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/proxyopts.h Fri Dec 14 15:00:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: proxyopts.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: proxyopts.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/reqtype.h diff -u xc/programs/lbxproxy/include/reqtype.h:1.4 xc/programs/lbxproxy/include/reqtype.h:1.5 --- xc/programs/lbxproxy/include/reqtype.h:1.4 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/reqtype.h Fri Dec 14 15:00:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: reqtype.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: reqtype.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/resource.h diff -u xc/programs/lbxproxy/include/resource.h:1.4 xc/programs/lbxproxy/include/resource.h:1.5 --- xc/programs/lbxproxy/include/resource.h:1.4 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/resource.h Fri Dec 14 15:00:56 2001 @@ -1,10 +1,14 @@ -/* $Xorg: resource.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: resource.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1995, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/swap.h diff -u xc/programs/lbxproxy/include/swap.h:1.1.1.2 xc/programs/lbxproxy/include/swap.h:1.2 --- xc/programs/lbxproxy/include/swap.h:1.1.1.2 Tue Jan 16 17:46:34 2001 +++ xc/programs/lbxproxy/include/swap.h Tue Jul 31 20:45:01 2001 @@ -22,6 +22,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/include/swap.h,v 1.2 2001/08/01 00:45:01 tsi Exp $ */ #ifndef _SWAP_H_ #define _SWAP_H_ @@ -47,9 +48,10 @@ #endif ); -extern void SwapConnectionInfo( +extern void WriteSConnSetupPrefix( #if NeedFunctionPrototypes - xConnSetup * /*pConnSetup*/ + ClientPtr /* pClient */, + xConnSetupPrefix * /* pcsp */ #endif ); @@ -209,15 +211,15 @@ #endif ); -extern void SwapPutImage( +extern void SwapGetImage( #if NeedFunctionPrototypes - xLbxPutImageReq * /*r*/ + xLbxGetImageReq * /*r*/ #endif ); -extern void SwapGetImage( +extern void SwapInternAtoms( #if NeedFunctionPrototypes - xLbxGetImageReq * /*r*/ + xLbxInternAtomsReq * /* r */ #endif ); @@ -244,10 +246,22 @@ xLbxConnSetupPrefix * /*csp*/ #endif ); + +extern void SwapAllocColor( +#if NeedFunctionPrototypes + xLbxAllocColorReq * /* r */ +#endif +); + +extern void SwapGrabCmap( +#if NeedFunctionPrototypes + xLbxGrabCmapReq * /* r */ +#endif +); -extern void SwapConnSetupPrefix( +extern void SwapReleaseCmap( #if NeedFunctionPrototypes - xConnSetupPrefix * /*csp*/ + xLbxReleaseCmapReq * /* r */ #endif ); Index: xc/programs/lbxproxy/include/tags.h diff -u xc/programs/lbxproxy/include/tags.h:1.4 xc/programs/lbxproxy/include/tags.h:1.5 --- xc/programs/lbxproxy/include/tags.h:1.4 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/tags.h Fri Dec 14 15:00:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: tags.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: tags.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/lbxproxy/include/util.h diff -u xc/programs/lbxproxy/include/util.h:1.4 xc/programs/lbxproxy/include/util.h:1.7 --- xc/programs/lbxproxy/include/util.h:1.4 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/util.h Fri Dec 14 15:00:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: util.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: util.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,6 +46,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/include/util.h,v 1.7 2001/12/14 20:00:56 dawes Exp $ */ + #ifndef _UTIL_H_ #define _UTIL_H_ @@ -146,21 +152,21 @@ extern void AuditF( #if NeedVarargsPrototypes - char * /*f*/, + const char * /*f*/, ... #endif ); extern void FatalError( #if NeedVarargsPrototypes - char * /*f*/, + const char * /*f*/, ... #endif ); extern void ErrorF( #if NeedVarargsPrototypes - char * /*f*/, + const char * /*f*/, ... #endif ); Index: xc/programs/lbxproxy/include/wire.h diff -u xc/programs/lbxproxy/include/wire.h:1.5 xc/programs/lbxproxy/include/wire.h:1.7 --- xc/programs/lbxproxy/include/wire.h:1.5 Wed Jan 17 18:44:58 2001 +++ xc/programs/lbxproxy/include/wire.h Fri Dec 14 15:00:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: wire.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: wire.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ /* Copyright 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,6 +45,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/programs/lbxproxy/include/wire.h,v 1.7 2001/12/14 20:00:56 dawes Exp $ */ #ifdef DEBUG /* Need this here because lbx.h undef's DEBUG */ extern int lbxDebug; @@ -259,24 +264,24 @@ #endif ); -extern void WriteToServer( +extern void _write_to_server( #if NeedFunctionPrototypes ClientPtr /*client*/, + Bool /*compressed*/, int /*len*/, - char * /*buf*/, - Bool /*startOfRequest*/, - Bool /*checkLargeRequest*/ + char* /*buf*/, + Bool /*checkLarge*/, + Bool /*startOfRequest*/ #endif ); -extern void _write_to_server( +extern void WriteToServer( #if NeedFunctionPrototypes ClientPtr /*client*/, - Bool /*compressed*/, int /*len*/, - char* /*buf*/, - Bool /*checkLarge*/, - Bool /*startOfRequest*/ + char * /*buf*/, + Bool /*startOfRequest*/, + Bool /*checkLargeRequest*/ #endif ); @@ -321,6 +326,17 @@ ClientPtr /*client*/, XID /*cmap*/, unsigned long /*pixel*/ +#endif +); + +extern void SendAllocColor( +#if NeedFunctionPrototypes + ClientPtr /* pClient */, + XID /* cmap */, + CARD32 /* pixel */, + CARD16 /* red */, + CARD16 /* green */, + CARD16 /* blue */ #endif ); Index: xc/programs/lbxproxy/os/WaitFor.c diff -u xc/programs/lbxproxy/os/WaitFor.c:1.6 xc/programs/lbxproxy/os/WaitFor.c:1.9 --- xc/programs/lbxproxy/os/WaitFor.c:1.6 Wed Jan 17 18:44:59 2001 +++ xc/programs/lbxproxy/os/WaitFor.c Fri Dec 14 15:00:57 2001 @@ -1,9 +1,13 @@ -/* $Xorg: WaitFor.c,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: WaitFor.c,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/WaitFor.c,v 1.6 2001/01/17 23:44:59 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/WaitFor.c,v 1.9 2001/12/14 20:00:57 dawes Exp $ */ /***************************************************************** * OS Dependent input routines: @@ -54,10 +58,6 @@ #include "Xos.h" /* for strings, fcntl, time */ #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - #include <stdio.h> #include "misc.h" #include "util.h" @@ -150,7 +150,7 @@ if (dispatchException) return 0; FD_ZERO(&clientsWritable); - if (i < 0) + if (i < 0) { if (selecterr == EBADF) /* Some client disconnected */ { CheckConnections (); @@ -160,6 +160,7 @@ else if (selecterr != EINTR) ErrorF("WaitForSomething(): select: errno=%d\n", selecterr); + } } else { Index: xc/programs/lbxproxy/os/connection.c diff -u xc/programs/lbxproxy/os/connection.c:1.14 xc/programs/lbxproxy/os/connection.c:1.16 --- xc/programs/lbxproxy/os/connection.c:1.14 Wed Jan 17 18:44:59 2001 +++ xc/programs/lbxproxy/os/connection.c Fri Dec 14 15:00:57 2001 @@ -1,9 +1,13 @@ -/* $Xorg: connection.c,v 1.4 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: connection.c,v 1.5 2001/02/09 02:05:33 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -56,7 +60,7 @@ * socket ids aren't small nums (0 - 2^8) * *****************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/connection.c,v 1.14 2001/01/17 23:44:59 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/connection.c,v 1.16 2001/12/14 20:00:57 dawes Exp $ */ #include "misc.h" #include <X11/Xtrans.h> @@ -64,10 +68,6 @@ #include <stdio.h> #include <stdlib.h> /* atoi */ #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - #include <signal.h> #include <setjmp.h> Index: xc/programs/lbxproxy/os/io.c diff -u xc/programs/lbxproxy/os/io.c:1.7 xc/programs/lbxproxy/os/io.c:1.10 --- xc/programs/lbxproxy/os/io.c:1.7 Wed Jan 17 18:44:59 2001 +++ xc/programs/lbxproxy/os/io.c Fri Dec 14 15:00:58 2001 @@ -1,9 +1,13 @@ -/* $Xorg: io.c,v 1.5 2000/08/17 19:53:58 cpqbld Exp $ */ +/* $Xorg: io.c,v 1.6 2001/02/09 02:05:33 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/io.c,v 1.7 2001/01/17 23:44:59 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/io.c,v 1.10 2001/12/14 20:00:58 dawes Exp $ */ /***************************************************************** * i/o functions * @@ -53,9 +57,6 @@ #include <stdio.h> #include <X11/Xtrans.h> #include "Xos.h" -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #include "misc.h" #include <errno.h> #include <sys/param.h> @@ -881,7 +882,7 @@ } if (oc->output) { if (extraCount) { - int len = obuf->count + (extraCount + 3) & ~3; + int len = (obuf->count + extraCount + 3) & ~3; if (ExpandOutputBuffer(obuf, len) < 0) { if (oc->trans_conn) { _LBXPROXYTransDisconnect(oc->trans_conn); Index: xc/programs/lbxproxy/os/osdep.h diff -u xc/programs/lbxproxy/os/osdep.h:1.8 xc/programs/lbxproxy/os/osdep.h:1.10 --- xc/programs/lbxproxy/os/osdep.h:1.8 Wed Jan 17 18:44:59 2001 +++ xc/programs/lbxproxy/os/osdep.h Fri Dec 14 15:00:58 2001 @@ -1,9 +1,13 @@ -/* $Xorg: osdep.h,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ +/* $Xorg: osdep.h,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -41,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/osdep.h,v 1.8 2001/01/17 23:44:59 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/osdep.h,v 1.10 2001/12/14 20:00:58 dawes Exp $ */ #define BOTIMEOUT 200 /* in milliseconds */ #define BUFSIZE 4096 @@ -101,9 +105,7 @@ #define HAS_GETDTABLESIZE #endif -#ifndef NULL -#define NULL 0 -#endif +#include <stddef.h> typedef struct _connectionInput { struct _connectionInput *next; Index: xc/programs/lbxproxy/os/osinit.c diff -u xc/programs/lbxproxy/os/osinit.c:1.4 xc/programs/lbxproxy/os/osinit.c:1.5 --- xc/programs/lbxproxy/os/osinit.c:1.4 Wed Jan 17 18:44:59 2001 +++ xc/programs/lbxproxy/os/osinit.c Fri Dec 14 15:00:58 2001 @@ -1,9 +1,13 @@ -/* $Xorg: osinit.c,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ +/* $Xorg: osinit.c,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/luit/Imakefile diff -u /dev/null xc/programs/luit/Imakefile:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/Imakefile Thu Nov 1 22:06:43 2001 @@ -0,0 +1,19 @@ +XCOMM $XFree86: xc/programs/luit/Imakefile,v 1.1 2001/11/02 03:06:43 dawes Exp $ + +#ifndef LocaleAliasFile +#define LocaleAliasFile \ + $(XLOCALEDIR)/locale.alias +#endif + +LOCAL_LIBRARIES = $(XFONTENCLIB) +DEPLIBS = $(DEPXFONTENCLIB) + +SYS_LIBRARIES = MathLibrary GzipLibrary + +SRCS = luit.c iso2022.c charset.c parser.c sys.c + +OBJS = luit.o iso2022.o charset.o parser.o sys.o + +DEFINES = -DLOCALE_ALIAS_FILE=\"LocaleAliasFile\" + +ComplexProgramTarget(luit) Index: xc/programs/luit/charset.c diff -u /dev/null xc/programs/luit/charset.c:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/charset.c Thu Nov 1 22:06:43 2001 @@ -0,0 +1,398 @@ +/* +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. +*/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <X11/fonts/fontenc.h> +#include "charset.h" +#include "parser.h" + +#ifndef NULL +#define NULL 0 +#endif + +static unsigned int +IdentityRecode(unsigned int n, CharsetPtr self) +{ + return n; +} + +static int +IdentityReverse(unsigned int n, CharsetPtr self) +{ +#define IS_GL(n) ((n) >= 0x20 && (n) < 0x80) + switch(self->type) { + case T_94: + case T_96: + if (IS_GL(n)) return n; else return -1; + case T_128: + if (n < 0x80) return n; else return -1; + case T_9494: + case T_9696: + if(IS_GL(n>>8) && IS_GL(n&0xFF)) + return n; + else + return -1; + case T_94192: + if(IS_GL(n>>8) && IS_GL(n&0x7F)) + return n; + else + return -1; + default: + abort(); + } +#undef IS_GL +} + +static int +NullReverse(unsigned int n, CharsetPtr self) +{ + return -1; +} + +CharsetRec Unknown94Charset = +{ "Unknown (94)", T_94, 0, IdentityRecode, NullReverse, 0, 0}; +CharsetRec Unknown96Charset = +{ "Unknown (96)", T_96, 0, IdentityRecode, NullReverse, 0, 0}; +CharsetRec Unknown9494Charset = +{ "Unknown (94x94)", T_9494, 0, IdentityRecode, NullReverse, 0, 0}; +CharsetRec Unknown9696Charset = +{ "Unknown (96x96)", T_9696, 0, IdentityRecode, NullReverse, 0, 0}; + +typedef struct _FontencCharset { + char *name; + int type; + unsigned char final; + char *xlfd; + int shift; + FontMapPtr mapping; + FontMapReversePtr reverse; +} FontencCharsetRec, *FontencCharsetPtr; + +FontencCharsetRec fontencCharsets[] = { + {"ISO 646 (1973)", T_94, '@', "iso646.1973-0", 0x00, 0, 0}, + {"ASCII", T_94, 'B', "iso8859-1", 0x00, 0, 0}, + {"JIS X 0201:GL", T_94, 'J', "jisx0201.1976-0", 0x00, 0, 0}, + {"JIS X 0201:GR", T_94, 'I', "jisx0201.1976-0", 0x80, 0, 0}, + {"DEC Special", T_94, '0', "dec-special", 0x00, 0, 0}, + {"DEC Technical", T_94, '>', "dec-dectech", 0x00, 0, 0}, + + {"ISO 8859-1", T_96, 'A', "iso8859-1", 0x80, 0, 0}, + {"ISO 8859-2", T_96, 'B', "iso8859-2", 0x80, 0, 0}, + {"ISO 8859-3", T_96, 'C', "iso8859-3", 0x80, 0, 0}, + {"ISO 8859-4", T_96, 'D', "iso8859-4", 0x80, 0, 0}, + {"ISO 8859-5", T_96, 'L', "iso8859-5", 0x80, 0, 0}, + {"ISO 8859-6", T_96, 'G', "iso8859-6", 0x80, 0, 0}, + {"ISO 8859-7", T_96, 'F', "iso8859-7", 0x80, 0, 0}, + {"ISO 8859-8", T_96, 'H', "iso8859-8", 0x80, 0, 0}, + {"ISO 8859-9", T_96, 'M', "iso8859-9", 0x80, 0, 0}, + {"ISO 8859-15", T_96, 'b', "iso8859-15", 0x80, 0, 0}, + {"KOI8-E", T_96, '@', "koi8-e", 0x80, 0, 0}, + + {"GB 2312", T_9494, 'A', "gb2312.1980-0", 0x0000, 0, 0}, + {"JIS X 0208", T_9494, 'B', "jisx0208.1990-0", 0x0000, 0, 0}, + {"KSC 5601", T_9494, 'C', "ksc5601.1987-0", 0x0000, 0, 0}, + {"JIS X 0212", T_9494, 'D', "jisx0212.1990-0", 0x0000, 0, 0}, + + {"GB 2312", T_9696, 'A', "gb2312.1980-0", 0x0000, 0, 0}, + {"JIS X 0208", T_9696, 'B', "jisx0208.1990-0", 0x0000, 0, 0}, + {"KSC 5601", T_9696, 'C', "ksc5601.1987-0", 0x0000, 0, 0}, + {"JIS X 0212", T_9696, 'D', "jisx0212.1990-0", 0x0000, 0, 0}, + + {"KOI8-R", T_128, 0, "koi8-r", 0x80, 0, 0}, + {"KOI8-U", T_128, 0, "koi8-u", 0x80, 0, 0}, + {"KOI8-RU", T_128, 0, "koi8-ru", 0x80, 0, 0}, + {"CP 1252", T_128, 0, "microsoft-cp1252", 0x80, 0, 0}, + {"CP 1251", T_128, 0, "microsoft-cp1251", 0x80, 0, 0}, + {"CP 1250", T_128, 0, "microsoft-cp1250", 0x80, 0, 0}, + + {"Big 5", T_94192, 0, "big5.eten-0", 0x8000, 0, 0}, + {0, 0, 0, 0, 0, 0, 0} +}; + + + +static int +compare(char *s, char *t) +{ + while(*s || *t) { + if(*s && (isspace(*s) || *s == '-' || *s == '_')) + s++; + else if(*t && (isspace(*t) || *t == '-' || *t == '_')) + t++; + else if(*s && *t && tolower(*s) == tolower(*t)) { + s++; + t++; + } else + return 1; + } + return 0; +} + +static unsigned int +FontencCharsetRecode(unsigned int n, CharsetPtr self) +{ + FontencCharsetPtr fc = (FontencCharsetPtr)(self->data); + + return FontEncRecode(n + fc->shift, fc->mapping); +} + +static int +FontencCharsetReverse(unsigned int i, CharsetPtr self) +{ + FontencCharsetPtr fc = (FontencCharsetPtr)(self->data); + int n; + + n = fc->reverse->reverse(i, fc->reverse->data); + if(n == 0 || n < fc->shift) + return -1; + else + n -= fc->shift; + +#define IS_GL(n) ((n) >= 0x20 && (n) < 0x80) + switch(self->type) { + case T_94: case T_96: + if (IS_GL(n)) return n; else return -1; + break; + case T_128: + if (n < 0x80) return n; else return -1; + case T_9494: case T_9696: + if(IS_GL(n>>8) && IS_GL(n&0xFF)) + return n; + else + return -1; + break; + case T_94192: + if(IS_GL(n>>8) && IS_GL(n&0x7F)) + return n; + else + return -1; + break; + default: + abort(); + } +#undef IS_GL +} + + +static CharsetPtr cachedCharsets = NULL; + +static CharsetPtr +getCachedCharset(unsigned char final, int type, char *name) +{ + CharsetPtr c; + for(c = cachedCharsets; c; c = c->next) { + if(((c->type == type && c->final == final) || + (name && !compare(c->name, name))) && + (c->type != T_FAILED)) + return c; + } + return NULL; +} + +static void +cacheCharset(CharsetPtr c) { + c->next = cachedCharsets; + cachedCharsets = c; +} + +static CharsetPtr +getFontencCharset(unsigned char final, int type, char *name) +{ + FontencCharsetPtr fc; + CharsetPtr c; + FontMapPtr mapping; + FontMapReversePtr reverse; + + fc = fontencCharsets; + while(fc->name) { + if(((fc->type == type && fc->final == final) || + (name && !compare(fc->name, name))) && + (fc->type != T_FAILED)) + break; + fc++; + } + + if(!fc->name) + return NULL; + + c = malloc(sizeof(CharsetRec)); + if(c == NULL) + return NULL; + + mapping = FontEncMapFind(fc->xlfd, FONT_ENCODING_UNICODE, -1, -1, NULL); + if(!mapping) { + fc->type = T_FAILED; + return NULL; + } + + reverse = FontMapReverse(mapping); + if(!reverse) { + fc->type = T_FAILED; + return NULL; + } + + fc->mapping = mapping; + fc->reverse = reverse; + + c->name = fc->name; + c->type = fc->type; + c->final = fc->final; + c->recode = FontencCharsetRecode; + c->reverse = FontencCharsetReverse; + c->data = fc; + + cacheCharset(c); + return c; +} + +CharsetPtr +getUnknownCharset(type) +{ + switch(type) { + case T_94: return &Unknown94Charset; + case T_96: return &Unknown96Charset; + case T_9494: return &Unknown9494Charset; + case T_9696: return &Unknown9696Charset; + default: return &Unknown94Charset; + } +} + +CharsetPtr +getCharset(unsigned char final, int type) +{ + CharsetPtr c; + + c = getCachedCharset(final, type, NULL); + if(c) + return c; + + c = getFontencCharset(final, type, NULL); + if(c) + return c; + + return getUnknownCharset(type); +} + +CharsetPtr +getCharsetByName(char *name) +{ + CharsetPtr c; + + if(name == NULL) + return getUnknownCharset(T_94); + + c = getCachedCharset(0, 0, name); + if(c) + return c; + + c = getFontencCharset(0, 0, name); + if(c) + return c; + + return getUnknownCharset(T_94); +} + +LocaleCharsetRec localeCharsets[] = { + { "C", 0, 2, "ASCII", NULL, "ISO 8859-1", NULL}, + { "ISO8859-1", 0, 2, "ASCII", NULL, "ISO 8859-1", NULL}, + { "ISO8859-2", 0, 2, "ASCII", NULL, "ISO 8859-2", NULL}, + { "ISO8859-3", 0, 2, "ASCII", NULL, "ISO 8859-3", NULL}, + { "ISO8859-4", 0, 2, "ASCII", NULL, "ISO 8859-4", NULL}, + { "ISO8859-5", 0, 2, "ASCII", NULL, "ISO 8859-5", NULL}, + { "ISO8859-6", 0, 2, "ASCII", NULL, "ISO 8859-6", NULL}, + { "ISO8859-7", 0, 2, "ASCII", NULL, "ISO 8859-7", NULL}, + { "ISO8859-8", 0, 2, "ASCII", NULL, "ISO 8859-8", NULL}, + { "ISO8859-9", 0, 2, "ASCII", NULL, "ISO 8859-9", NULL}, + { "ISO8859-15", 0, 2, "ASCII", NULL, "ISO 8859-15", NULL}, + { "KOI8-R", 0, 2, "ASCII", NULL, "KOI8-R", NULL}, + { "CP1251", 0, 2, "ASCII", NULL, "CP 1251", NULL}, + { "eucCN", 0, 1, "ASCII", "GB 2312", NULL, NULL}, + { "GB2312", 0, 1, "ASCII", "GB 2312", NULL, NULL}, + { "eucJP", 0, 1, "ASCII", "JIS X 0208", "JIS X 0201:GR", "JIS X 0212"}, + { "eucKR", 0, 1, "ASCII", "KSC 5601", NULL, NULL}, + { "eucCN", 0, 1, "ASCII", "GB 2312", NULL, NULL}, + { "Big5", 0, 1, "ASCII", "Big 5", NULL, NULL}, + { 0, 0, 0, 0, 0, 0, 0} +}; + +void +reportCharsets() +{ + LocaleCharsetPtr p; + FontencCharsetPtr q; + printf("Known locale encodings:\n\n"); + for(p = localeCharsets; p->name; p++) { + printf(" %s: GL -> G%d, GR -> G%d", p->name, p->gl, p->gr); + if(p->g0) printf(", G0: %s", p->g0); + if(p->g1) printf(", G1: %s", p->g1); + if(p->g2) printf(", G2: %s", p->g2); + if(p->g3) printf(", G3: %s", p->g3); + printf("\n"); + } + + printf("\n\nKnown charsets (not all may be available):\n\n"); + for(q = fontencCharsets; q->name; q++) + printf(" %s%s\n", + q->name, q->final?" (ISO 2022)":""); +} + +int +getLocaleState(char *locale, + int *gl_return, int *gr_return, + CharsetPtr *g0_return, CharsetPtr *g1_return, + CharsetPtr *g2_return, CharsetPtr *g3_return) +{ + char *resolved, *charset; + LocaleCharsetPtr p; + resolved = resolveLocale(locale); + if(!resolved) + return -1; + + charset = strrchr(resolved, '.'); + if(charset) + charset++; + else + charset = resolved; + + for(p = localeCharsets; p->name; p++) { + if(!strcmp(p->name, charset)) + break; + } + + if(p->name == NULL) { + free(resolved); + return -1; + } + + *gl_return = p->gl; + *gr_return = p->gr; + *g0_return = getCharsetByName(p->g0); + *g1_return = getCharsetByName(p->g1); + *g2_return = getCharsetByName(p->g2); + *g3_return = getCharsetByName(p->g3); + + return 0; +} + Index: xc/programs/luit/charset.h diff -u /dev/null xc/programs/luit/charset.h:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/charset.h Thu Nov 1 22:06:43 2001 @@ -0,0 +1,63 @@ +/* +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. +*/ + +#define T_FAILED 0 +#define T_94 1 +#define T_96 2 +#define T_128 3 +#define T_9494 4 +#define T_9696 5 +/* Big 5 */ +#define T_94192 6 + +/* True for charsets that pass control chars unchanged, at least in + the first byte */ +#define CHARSET_REGULAR(c) ((c)->type != T_128) + +typedef struct _Charset { + char *name; + int type; + unsigned char final; + unsigned int (*recode)(unsigned int, struct _Charset *self); + int (*reverse)(unsigned int, struct _Charset *self); + void *data; + struct _Charset *next; +} CharsetRec, *CharsetPtr; + +typedef struct _LocaleCharset { + char *name; + int gl; + int gr; + char *g0; + char *g1; + char *g2; + char *g3; +} LocaleCharsetRec, *LocaleCharsetPtr; + +CharsetPtr getUnknownCharset(int); +CharsetPtr getCharset(unsigned char, int); +CharsetPtr getCharsetByName(char*); +void reportCharsets(void); +int getLocaleState(char *locale, + int *gl_return, int *gr_return, + CharsetPtr *g0_return, CharsetPtr *g1_return, + CharsetPtr *g2_return, CharsetPtr *g3_return); Index: xc/programs/luit/iso2022.c diff -u /dev/null xc/programs/luit/iso2022.c:1.3 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/iso2022.c Wed Dec 19 16:29:02 2001 @@ -0,0 +1,850 @@ +/* +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/luit/iso2022.c,v 1.3 2001/12/19 21:29:02 dawes Exp $ */ + +#include <stdlib.h> +#include <stdio.h> +#include <assert.h> +#include <stdarg.h> +#include <sys/types.h> +#include <unistd.h> +#include <errno.h> + +#include "luit.h" +#include "charset.h" +#include "iso2022.h" +#include "sys.h" + +#define BUFFERED_INPUT_SIZE 4 +unsigned char buffered_input[BUFFERED_INPUT_SIZE]; +int buffered_input_count = 0; + +static void +FatalError(char *f, ...) +{ + va_list args; + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + exit(1); +} + +static void +ErrorF(char *f, ...) +{ + va_list args; + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); +} + +#define OUTBUF_FREE(is, count) ((is)->outbuf_count + (count) <= BUFFER_SIZE) +#define OUTBUF_MAKE_FREE(is, fd, count) \ + if(!OUTBUF_FREE((is), (count))) outbuf_flush((is), (fd)) + + +static void +outbuf_flush(Iso2022Ptr is, int fd) +{ + int rc; + int i = 0; + + if(olog >= 0) + write(olog, is->outbuf, is->outbuf_count); + + while(i < is->outbuf_count) { + rc = write(fd, is->outbuf + i, is->outbuf_count - i); + if(rc > 0) { + i += rc; + } else { + if(rc < 0 && errno == EINTR) + continue; + else if((rc == 0) || ((rc < 0) && (errno == EAGAIN))) { + waitForOutput(fd); + continue; + } else + break; + } + } + is->outbuf_count = 0; +} + +static void +outbufOne(Iso2022Ptr is, int fd, unsigned c) +{ + OUTBUF_MAKE_FREE(is, fd, 1); + is->outbuf[is->outbuf_count++] = c; +} + +/* Discards null codepoints */ +static void +outbufUTF8(Iso2022Ptr is, int fd, unsigned c) +{ + if(c == 0) + return; + + if(c <= 0x7F) { + OUTBUF_MAKE_FREE(is, fd, 1); + is->outbuf[is->outbuf_count++] = c; + } else if(c <= 0x7FF) { + OUTBUF_MAKE_FREE(is, fd, 2); + is->outbuf[is->outbuf_count++] = 0xC0 | ((c >> 6) & 0x1F); + is->outbuf[is->outbuf_count++] = 0x80 | (c & 0x3F); + } else { + OUTBUF_MAKE_FREE(is, fd, 3); + is->outbuf[is->outbuf_count++] = 0xE0 | ((c >> 12) & 0x0F); + is->outbuf[is->outbuf_count++] = 0x80 | ((c >> 6) & 0x3F); + is->outbuf[is->outbuf_count++] = 0x80 | (c & 0x3F); + } +} + +static void +buffer(Iso2022Ptr is, char c) +{ + if(is->buffered == NULL) { + is->buffered = malloc(10); + if(is->buffered == NULL) + FatalError("Couldn't allocate buffered.\n"); + is->buffered_len = 10; + } + + if(is->buffered_count >= is->buffered_len) { + is->buffered = realloc(is->buffered, 2 * is->buffered_len + 1); + if(is->buffered == NULL) { + FatalError("Couldn't grow buffered.\n"); + } + is->buffered_len = 2 * is->buffered_len + 1; + } + + is->buffered[is->buffered_count++] = c; +} + +static void +outbuf_buffered_carefully(Iso2022Ptr is, int fd) +{ + /* This should never happen in practice */ + int i = 0; + + while(i < is->buffered_count) { + OUTBUF_MAKE_FREE(is, fd, 1); + is->outbuf[is->outbuf_count++] = is->buffered[i++]; + } + is->buffered_count = 0; +} + +static void +outbuf_buffered(Iso2022Ptr is, int fd) +{ + if(is->buffered_count > BUFFER_SIZE) + outbuf_buffered_carefully(is, fd); + + OUTBUF_MAKE_FREE(is, fd, is->buffered_count); + memcpy(is->outbuf + is->outbuf_count, is->buffered, is->buffered_count); + is->outbuf_count += is->buffered_count; + is->buffered_count = 0; +} + +static void +discard_buffered(Iso2022Ptr is) +{ + is->buffered_count = 0; +} + +Iso2022Ptr +allocIso2022(void) +{ + Iso2022Ptr is; + is = malloc(sizeof(Iso2022Rec)); + if(!is) + return NULL; + is->glp = is->grp = NULL; + G0(is) = G1(is) = G2(is) = G3(is) = NULL; + + is->parserState = P_NORMAL; + is->shiftState = S_NORMAL; + + is->inputFlags = IF_EIGHTBIT | IF_SS; + is->outputFlags = OF_SS | OF_LS | OF_SELECT; + + is->buffered = NULL; + is->buffered_len = 0; + is->buffered_count = 0; + + is->buffered_ku = -1; + + is->outbuf = malloc(BUFFER_SIZE); + if(!is->outbuf) { + free(is); + return NULL; + } + + return is; +} + +void +destroyIso2022(Iso2022Ptr is) +{ + if(is->buffered) + free(is->buffered); + if(is->outbuf) + free(is->outbuf); + free(is); +} + +static int +identifyCharset(Iso2022Ptr i, CharsetPtr *p) +{ + if(p == &G0(i)) + return 0; + else if(p == &G1(i)) + return 1; + else if(p == &G2(i)) + return 2; + else if(p == &G3(i)) + return 3; + else + abort(); +} + +void +reportIso2022(Iso2022Ptr i) +{ + fprintf(stderr, "G0 is %s, ", G0(i)->name); + fprintf(stderr, "G1 is %s, ", G1(i)->name); + fprintf(stderr, "G2 is %s, ", G2(i)->name); + fprintf(stderr, "G3 is %s.\n", G3(i)->name); + fprintf(stderr, "GL is G%d, ", identifyCharset(i, i->glp)); + fprintf(stderr, "GR is G%d.\n", identifyCharset(i, i->grp)); +} + +int +initIso2022(char *locale, Iso2022Ptr i) +{ + int gl = 0, gr = 2; + CharsetPtr g0 = NULL, g1 = NULL, g2 = NULL, g3 = NULL; + int rc; + + rc = getLocaleState(locale, &gl, &gr, &g0, &g1, &g2, &g3); + if(rc < 0) + ErrorF("Warning: couldn't find charset data for locale %s; " + "using ISO 8859-1.\n", locale); + + if(g0) + G0(i) = g0; + else + G0(i) = getCharsetByName("ASCII"); + + if(g1) + G1(i) = g1; + else + G1(i) = getUnknownCharset(T_94); + + if(g2) + G2(i) = g2; + else + G2(i) = getCharsetByName("ISO 8859-1"); + + if(g3) + G3(i) = g3; + else + G3(i) = getUnknownCharset(T_94); + + i->glp = &i->g[gl]; + i->grp = &i->g[gr]; + return 0; +} + +int +mergeIso2022(Iso2022Ptr d, Iso2022Ptr s) +{ + if(G0(d) == NULL) + G0(d) = G0(s); + if(G1(d) == NULL) + G1(d) = G1(s); + if(G2(d) == NULL) + G2(d) = G2(s); + if(G3(d) == NULL) + G3(d) = G3(s); + if(d->glp == NULL) + d->glp = &(d->g[identifyCharset(s, s->glp)]); + if(d->grp == NULL) + d->grp = &(d->g[identifyCharset(s, s->grp)]); + return 0; +} + +int +utf8Count(unsigned char c) +{ + /* All return values must be less than BUFFERED_INPUT_SIZE */ + if((c & 0x80) == 0) + return 1; + else if((c & 0x40) == 0) + return 1; /* incorrect UTF-8 */ + else if((c & 0x60) == 0x40) + return 2; + else if((c & 0x70) == 0x60) + return 3; + else if((c & 0x78) == 0x70) + return 4; + else + return 1; +} + +static int +fromUtf8(unsigned char *b) +{ + if((b[0] & 0x80) == 0) + return b[0]; + else if((b[0] & 0x40) == 0) + return -1; /* incorrect UTF-8 */ + else if((b[0] & 0x60) == 0x40) + return ((b[0] & 0x1F) << 6) | (b[1] & 0x3F); + else if((b[0] & 0x70) == 0x60) + return ((b[0] & 0x0F) << 12) + | ((b[1] & 0x3F) << 6) + | (b[2] & 0x3F); + else if((b[0] & 0x78) == 0x70) + return ((b[0] & 0x03) << 18) + | ((b[1] & 0x3F) << 12) + | ((b[2] & 0x3F) << 6) + | ((b[3] & 0x3F)); + else + return -1; +} + +void +copyIn(Iso2022Ptr is, int fd, unsigned char *buf, int count) +{ + unsigned char *c; + int codepoint, rem; + + c = buf; + rem = count; + +#define NEXT do {c++; rem--;} while(0) + + while(rem) { + codepoint = -1; + if(is->parserState == P_ESC) { + assert(buffered_input_count == 0); + codepoint = *c; + NEXT; + if(*c == CSI_7) + is->parserState = P_CSI; + else if(IS_FINAL_ESC(codepoint)) + is->parserState = P_NORMAL; + } else if(is->parserState == P_CSI) { + assert(buffered_input_count == 0); + codepoint = *c; + NEXT; + if(IS_FINAL_CSI(codepoint)) + is->parserState = P_NORMAL; + } else if(!(*c & 0x80)) { + if(buffered_input_count > 0) { + buffered_input_count = 0; + continue; + } else { + codepoint = *c; + NEXT; + if(codepoint == ESC) + is->parserState = P_ESC; + } + } else if((*c & 0x40)) { + if(buffered_input_count > 0) { + buffered_input_count = 0; + continue; + } else { + buffered_input[buffered_input_count] = *c; + buffered_input_count++; + NEXT; + } + } else { + if(buffered_input_count <= 0) { + buffered_input_count = 0; + NEXT; + continue; + } else { + buffered_input[buffered_input_count] = *c; + buffered_input_count++; + NEXT; + if(buffered_input_count >= utf8Count(buffered_input[0])) { + codepoint = fromUtf8(buffered_input); + buffered_input_count = 0; + if(codepoint == CSI) + is->parserState = P_CSI; + } + } + } +#undef NEXT + + if(codepoint >= 0) { + int i; + unsigned char obuf[4]; +#define WRITE_1(i) do {obuf[0]=(i); write(fd, obuf, 1);} while(0) +#define WRITE_2(i) do \ + {obuf[0]=((i)>>8)&0xFF; obuf[1]=(i)&0xFF; write(fd, obuf, 2);} \ + while(0) +#define WRITE_1_P_8bit(p, i) \ + {obuf[0]=(p); obuf[1]=(i); write(fd, obuf, 2);} +#define WRITE_1_P_7bit(p, i) \ + {obuf[0]=ESC; obuf[1]=(p)-0x40; obuf[2]=(i); write(fd, obuf, 3);} +#define WRITE_1_P(p,i) do \ + {if(is->inputFlags & IF_EIGHTBIT) \ + WRITE_1_P_8bit(p,i) else \ + WRITE_1_P_7bit(p,i) } \ + while(0) +#define WRITE_2_P_8bit(p, i) \ + {obuf[0]=(p); obuf[1]=((i)>>8)&0xFF; obuf[2]=(i)&0xFF; write(fd, obuf, 3);} +#define WRITE_2_P_7bit(p, i) \ + {obuf[0]=ESC; obuf[1]=(p)-0x40; obuf[2]=((i)>>8)&0xFF; obuf[3]=(i)&0xFF; \ + write(fd, obuf, 4);} +#define WRITE_2_P(p,i) do \ + {if(is->inputFlags & IF_EIGHTBIT) \ + WRITE_2_P_8bit(p,i) else \ + WRITE_2_P_7bit(p,i)} \ + while(0) +#define WRITE_1_P_S(p,i,s) do \ + {obuf[0]=(p); obuf[1]=(i)&0xFF; obuf[2]=(s); write(fd, obuf, 3);} \ + while(0) +#define WRITE_2_P_S(p,i,s) do \ + {obuf[0]=(p); obuf[1]=(((i)>>8)&0xFF); obuf[2]=(i)&0xFF; obuf[3]=(s); \ + write(fd, obuf, 4);} \ + while(0) + + if(codepoint < 0x20 || + (CHARSET_REGULAR(GR(is)) && + (codepoint >= 0x80 && codepoint < 0xA0))) { + WRITE_1(codepoint); + continue; + } + i = (GL(is)->reverse)(codepoint, GL(is)); + if(i >= 0) { + switch(GL(is)->type) { + case T_94: case T_96: case T_128: + if(i >= 0x20) + WRITE_1(i); + break; + case T_9494: case T_9696: case T_94192: + if(i >= 0x2020) + WRITE_2(i); + break; + default: + abort(); + } + continue; + } + if(is->inputFlags & IF_EIGHTBIT) { + i = GR(is)->reverse(codepoint, GR(is)); + if(i >= 0) { + switch(GR(is)->type) { + case T_94: case T_96: case T_128: + /* we allow C1 characters if T_128 in GR */ + WRITE_1(i | 0x80); + break; + case T_9494: case T_9696: + WRITE_2(i | 0x8080); + break; + case T_94192: + WRITE_2(i | 0x8000); + break; + default: + abort(); + } + continue; + } + } + if(is->inputFlags & IF_SS) { + i = G2(is)->reverse(codepoint, G2(is)); + if(i >= 0) { + switch(GR(is)->type) { + case T_94: case T_96: case T_128: + if(i >= 0x20) + WRITE_1_P(SS2, i); + break; + case T_9494: case T_9696: case T_94192: + if(i >= 0x2020) + WRITE_2_P(SS2, i); + break; + default: + abort(); + } + continue; + } + } + if(is->inputFlags & IF_SS) { + i = G3(is)->reverse(codepoint, G3(is)); + if(i > 0) { + switch(GR(is)->type) { + case T_94: case T_96: case T_128: + if(i >= 0x20) + WRITE_1_P(SS3, i); + break; + case T_9494: case T_9696: case T_94192: + if(i >= 0x2020) + WRITE_2_P(SS3, i); + break; + default: + abort(); + } + continue; + } + } + if(is->inputFlags & IF_LS) { + i = GR(is)->reverse(codepoint, GR(is)); + if(i >= 0) { + switch(GR(is)->type) { + case T_94: case T_96: case T_128: + WRITE_1_P_S(LS1, i, LS0); + break; + case T_9494: case T_9696: + WRITE_2_P_S(LS1, i, LS0); + break; + case T_94192: + WRITE_2_P_S(LS1, i, LS0); + break; + default: + abort(); + } + continue; + } + } +#undef WRITE_1 +#undef WRITE_2 +#undef WRITE_1_P +#undef WRITE_1_P_7bit +#undef WRITE_1_P_8bit +#undef WRITE_2_P +#undef WRITE_2_P_7bit +#undef WRITE_2_P_8bit + } + } +} + +void +copyOut(Iso2022Ptr is, int fd, unsigned char *buf, int count) +{ + unsigned char *s = buf; + + if(ilog >= 0) + write(ilog, buf, count); + + while(s < buf + count) { + switch(is->parserState) { + case P_NORMAL: + resynch: + if(is->buffered_ku < 0) { + if(*s == ESC) { + buffer(is, *s++); + is->parserState = P_ESC; + } else if(*s == CSI && CHARSET_REGULAR(GR(is))) { + buffer(is, *s++); + is->parserState = P_CSI; + } else if((*s == SS2 || *s == SS3 || *s == LS0 || *s == LS1) && + CHARSET_REGULAR(GR(is))) { + buffer(is, *s++); + terminate(is, fd); + is->parserState = P_NORMAL; + } else if (*s <= 0x20 && is->shiftState == S_NORMAL) { + /* Pass through C0 when GL is not regular */ + outbufOne(is, fd, *s); + s++; + } else { + CharsetPtr charset; + unsigned char code; + if(*s <= 0x7F) { + switch(is->shiftState) { + case S_NORMAL: charset = GL(is); break; + case S_SS2: charset = G2(is); break; + case S_SS3: charset = G3(is); break; + default: abort(); + } + code = *s; + } else { + charset = GR(is); + code = *s - 0x80; + } + + switch(charset->type) { + case T_94: + if(code >= 0x21 && code <= 0x7E) + outbufUTF8(is, fd, charset->recode(code, charset)); + else + outbufUTF8(is, fd, *s); + s++; + is->shiftState = S_NORMAL; + break; + case T_96: + if(code >= 0x20) + outbufUTF8(is, fd, charset->recode(code, charset)); + else + outbufUTF8(is, fd, *s); + is->shiftState = S_NORMAL; + s++; + break; + case T_128: + outbufUTF8(is, fd, charset->recode(code, charset)); + is->shiftState = S_NORMAL; + s++; + break; + default: + /* First byte of a multibyte sequence */ + is->buffered_ku = *s; + s++; + } + } + } else { /* buffered_ku */ + CharsetPtr charset; + unsigned char ku_code; + int code; + if(is->buffered_ku <= 0x7F) { + switch(is->shiftState) { + case S_NORMAL: charset = GL(is); break; + case S_SS2: charset = G2(is); break; + case S_SS3: charset = G3(is); break; + default: abort(); + } + ku_code = is->buffered_ku; + if(*s < 0x80) + code = *s; + else + code = -1; + } else { + charset = GR(is); + ku_code = is->buffered_ku - 0x80; + if(*s >= 0x80) + code = *s - 0x80; + else + code = -1; + } + switch(charset->type) { + case T_94: + case T_96: + case T_128: + abort(); + break; + case T_9494: + if(code >= 0x21 && code <= 0x7E) { + outbufUTF8(is, fd, + charset->recode(ku_code << 8 | code, + charset)); + is->buffered_ku = -1; + is->shiftState = S_NORMAL; + } else { + is->buffered_ku = -1; + is->shiftState = S_NORMAL; + goto resynch; + } + s++; + break; + case T_9696: + if(code >= 0x20) { + outbufUTF8(is, fd, + charset->recode(ku_code << 8 | code, + charset)); + is->buffered_ku = -1; + is->shiftState = S_NORMAL; + } else { + is->buffered_ku = -1; + is->shiftState = S_NORMAL; + goto resynch; + } + s++; + break; + case T_94192: + /* Use *s, not code */ + if(((*s >= 0x21) && (*s <= 0x7E)) || + ((*s >= 0xA1) && (*s <= 0xFE))) { + outbufUTF8(is, fd, + charset->recode(ku_code << 8 | *s, + charset)); + is->buffered_ku = -1; + is->shiftState = S_NORMAL; + } else { + is->buffered_ku = -1; + is->shiftState = S_NORMAL; + goto resynch; + } + s++; + break; + default: + abort(); + } + } + break; + case P_ESC: + assert(is->buffered_ku == -1); + if(*s == CSI_7) { + buffer(is, *s++); + is->parserState = P_CSI; + } else if(IS_FINAL_ESC(*s)) { + buffer(is, *s++); + terminate(is, fd); + is->parserState = P_NORMAL; + } else { + buffer(is, *s++); + } + break; + case P_CSI: + if(IS_FINAL_CSI(*s)) { + buffer(is, *s++); + terminate(is, fd); + is->parserState = P_NORMAL; + } else { + buffer(is, *s++); + } + break; + default: + abort(); + } + } + outbuf_flush(is, fd); +} + +void terminate(Iso2022Ptr is, int fd) +{ + if(is->outputFlags & OF_PASSTHRU) { + outbuf_buffered(is, fd); + return; + } + + switch(is->buffered[0]) { + case SS2: + if(is->outputFlags & OF_SS) + is->shiftState = S_SS2; + discard_buffered(is); + return; + case SS3: + if(is->outputFlags & OF_SS) + is->shiftState = S_SS3; + discard_buffered(is); + return; + case LS0: + if(is->outputFlags & OF_LS) + is->glp = &G0(is); + discard_buffered(is); + return; + case LS1: + if(is->outputFlags & OF_LS) + is->glp = &G1(is); + discard_buffered(is); + return; + case ESC: + assert(is->buffered_count >= 2); + switch(is->buffered[1]) { + case SS2_7: + if(is->outputFlags & OF_SS) + is->shiftState = S_SS2; + discard_buffered(is); + return; + case SS3_7: + if(is->outputFlags & OF_SS) + is->shiftState = S_SS3; + discard_buffered(is); + return; + case LS2_7: + if(is->outputFlags & OF_SS) + is->glp = &G2(is); + discard_buffered(is); + return; + case LS3_7: + if(is->outputFlags & OF_LS) + is->glp = &G3(is); + discard_buffered(is); + return; + case LS1R_7: + if(is->outputFlags & OF_LS) + is->grp = &G1(is); + discard_buffered(is); + return; + case LS2R_7: + if(is->outputFlags & OF_LS) + is->grp = &G2(is); + discard_buffered(is); + return; + case LS3R_7: + if(is->outputFlags & OF_LS) + is->grp = &G3(is); + discard_buffered(is); + return; + default: + terminateEsc(is, fd, is->buffered + 1, is->buffered_count - 1); + } + return; + default: + outbuf_buffered(is, fd); + } +} + +void +terminateEsc(Iso2022Ptr is, int fd, unsigned char *s_start, int count) +{ + CharsetPtr charset; + + /* ISO 2022 doesn't allow 2C, but Emacs/MULE uses it in 7-bit + mode */ + + if((s_start[0] == 0x28 || s_start[0] == 0x29 || + s_start[0] == 0x2A || s_start[0] == 0x2B || + s_start[0] == 0x2C || s_start[0] == 0x2D || + s_start[0] == 0x2E || s_start[0] == 0x2F) && + count >= 2) { + if(is->outputFlags & OF_SELECT) { + if(s_start[0] <= 0x2B) + charset = getCharset(s_start[1], T_94); + else + charset = getCharset(s_start[1], T_96); + switch(s_start[0]) { + case 0x28: case 0x2C: G0(is) = charset; break; + case 0x29: case 0x2D: G1(is) = charset; break; + case 0x2A: case 0x2E: G2(is) = charset; break; + case 0x2B: case 0x2F: G3(is) = charset; break; + } + } + discard_buffered(is); + } else if(s_start[0] == 0x24 && count == 2) { + if(is->outputFlags & OF_SELECT) { + charset = getCharset(s_start[1], T_9494); + G0(is) = charset; + } + discard_buffered(is); + } else if(s_start[0] == 0x24 && count >=2 && + (s_start[1] == 0x28 || s_start[1] == 0x29 || + s_start[1] == 0x2A || s_start[1] == 0x2B || + s_start[1] == 0x2D || s_start[1] == 0x2E || + s_start[1] == 0x2F) && + count >= 3) { + if(is->outputFlags & OF_SELECT) { + if(s_start[1] <= 0x2B) + charset = getCharset(s_start[2], T_9494); + else + charset = getCharset(s_start[2], T_9696); + switch(s_start[1]) { + case 0x28: G0(is) = charset; break; + case 0x29: case 0x2D: G1(is) = charset; break; + case 0x2A: case 0x2E: G2(is) = charset; break; + case 0x2B: case 0x2F: G3(is) = charset; break; + } + } + discard_buffered(is); + } else + outbuf_buffered(is, fd); +} Index: xc/programs/luit/iso2022.h diff -u /dev/null xc/programs/luit/iso2022.h:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/iso2022.h Thu Nov 1 22:06:43 2001 @@ -0,0 +1,90 @@ +/* +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. +*/ + +#define ESC 0x1B +#define CSI 0x9B +#define CSI_7 '[' +#define SS2 0x8E +#define SS2_7 0x4E +#define SS3 0x8F +#define SS3_7 0x4F +#define LS0 0x0F +#define LS1 0x0E +#define LS2_7 0x6E +#define LS3_7 0x6F +#define LS1R_7 0x7E +#define LS2R_7 0x7D +#define LS3R_7 0x7C + +#define IS_FINAL_ESC(x) (((x) & 0xF0 ) != 0x20) +#define IS_FINAL_CSI(x) (((x) & 0xF0 ) != 0x20 && (((x) & 0xF0 ) != 0x30)) + +#define P_NORMAL 0 +#define P_ESC 1 +#define P_CSI 2 + +#define S_NORMAL 0 +#define S_SS2 1 +#define S_SS3 2 + +#define IF_SS 1 +#define IF_LS 2 +#define IF_EIGHTBIT 4 + +#define OF_SS 1 +#define OF_LS 2 +#define OF_SELECT 4 +#define OF_PASSTHRU 8 + +typedef struct _Iso2022 { + CharsetPtr *glp, *grp; + CharsetPtr g[4]; + int parserState; + int shiftState; + int inputFlags; + int outputFlags; + unsigned char *buffered; + int buffered_len; + int buffered_count; + int buffered_ku; + unsigned char *outbuf; + int outbuf_count; +} Iso2022Rec, *Iso2022Ptr; + +#define GL(i) (*(i)->glp) +#define GR(i) (*(i)->grp) +#define G0(i) ((i)->g[0]) +#define G1(i) ((i)->g[1]) +#define G2(i) ((i)->g[2]) +#define G3(i) ((i)->g[3]) + +#define BUFFER_SIZE 512 + +Iso2022Ptr allocIso2022(void); +void destroyIso2022(Iso2022Ptr); +int initIso2022(char *locale, Iso2022Ptr); +int mergeIso2022(Iso2022Ptr, Iso2022Ptr); +void reportIso2022(Iso2022Ptr); +void terminate(Iso2022Ptr, int); +void terminateEsc(Iso2022Ptr, int, unsigned char*, int); +void copyIn(Iso2022Ptr, int, unsigned char*, int); +void copyOut(Iso2022Ptr, int, unsigned char*, int); Index: xc/programs/luit/locale.c diff -u /dev/null xc/programs/luit/locale.c:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/locale.c Thu Nov 1 22:06:43 2001 @@ -0,0 +1,5 @@ +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +#include "locale.h" Index: xc/programs/luit/luit.c diff -u /dev/null xc/programs/luit/luit.c:1.4 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/luit.c Wed Jan 9 11:14:19 2002 @@ -0,0 +1,572 @@ +/* +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/luit/luit.c,v 1.4 2002/01/09 16:14:19 dawes Exp $ */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <locale.h> +#include <sys/types.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> +#include <assert.h> +#include <stdarg.h> +#include <sys/ioctl.h> +#include <signal.h> + +#ifdef SVR4 +#include <stropts.h> +#endif + +#include "luit.h" +#include "sys.h" +#include "charset.h" +#include "iso2022.h" + +static Iso2022Ptr inputState = NULL, outputState = NULL; + +static char *child_argv0 = NULL; +static char *locale_name = NULL; +int ilog = -1; +int olog = -1; +int verbose = 0; +int converter = 0; + +volatile int sigwinch_queued = 0; +volatile int sigchld_queued = 0; + +static int convert(int, int); +static int condom(int, char**); + +static void +ErrorF(char *f, ...) +{ + va_list args; + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); +} + +static void +FatalError(char *f, ...) +{ + va_list args; + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + exit(1); +} + + +static void +help(void) +{ + fprintf(stderr, + "luit\n" + " [ -h ] [ -list ] [ -v ] [ -argv0 name ]\n" + " [ -gl gn ] [-gr gk] " + "[ -g0 set ] [ -g1 set ] " + "[ -g2 set ] [ -g3 set ]\n" + " [ +oss ] [ +ols ] [ +osl ] [ +ot ]\n" + " [ -kgl gn ] [-kgr gk] " + "[ -kg0 set ] [ -kg1 set ] " + "[ -kg2 set ] [ -kg3 set ]\n" + " [ -k7 ] [ +kss ] [ -kls ]\n" + " [ -c ] [ -ilog filename ] [ -olog filename ] [ -- ]\n" + " [ program [ args ] ]\n"); + +} + + +int +parseOptions(int argc, char **argv) +{ + int i = 1; + while(i < argc) { + if(argv[i][0] != '-' && argv[i][0] != '+') { + break; + } else if(!strcmp(argv[i], "--")) { + i++; + break; + } else if(!strcmp(argv[i], "-v")) { + verbose++; + i++; + } else if(!strcmp(argv[i], "-h")) { + help(); + exit(0); + } else if(!strcmp(argv[i], "-list")) { + reportCharsets(); + exit(0); + } else if(!strcmp(argv[i], "+oss")) { + outputState->outputFlags &= ~OF_SS; + i++; + } else if(!strcmp(argv[i], "+ols")) { + outputState->outputFlags &= ~OF_LS; + i++; + } else if(!strcmp(argv[i], "+osl")) { + outputState->outputFlags &= ~OF_SELECT; + i++; + } else if(!strcmp(argv[i], "+ot")) { + outputState->outputFlags = OF_PASSTHRU; + i++; + } else if(!strcmp(argv[i], "-k7")) { + inputState->inputFlags &= ~IF_EIGHTBIT; + i++; + } else if(!strcmp(argv[i], "+kss")) { + inputState->inputFlags &= ~IF_SS; + i++; + } else if(!strcmp(argv[i], "-kls")) { + inputState->inputFlags |= IF_LS; + i++; + } else if(!strcmp(argv[i], "-g0")) { + if(i + 1 >= argc) + FatalError("-g0 requires an argument\n"); + G0(outputState) = getCharsetByName(argv[i + 1]); + i += 2; + } else if(!strcmp(argv[i], "-g1")) { + if(i + 1 >= argc) + FatalError("-g1 requires an argument\n"); + G1(outputState) = getCharsetByName(argv[i + 1]); + i += 2; + } else if(!strcmp(argv[i], "-g2")) { + if(i + 1 >= argc) + FatalError("-g2 requires an argument\n"); + G2(outputState) = getCharsetByName(argv[i + 1]); + i += 2; + } else if(!strcmp(argv[i], "-g3")) { + if(i + 1 >= argc) + FatalError("-g3 requires an argument\n"); + G3(outputState) = getCharsetByName(argv[i + 1]); + + i += 2; + } else if(!strcmp(argv[i], "-gl")) { + int j; + if(i + 1 >= argc) + FatalError("-gl requires an argument\n"); + if(strlen(argv[i + 1]) != 2 || + argv[i + 1][0] != 'g') + j = -1; + else + j = argv[i + 1][1] - '0'; + if(j < 0 || j > 3) + FatalError("The argument of -gl " + "should be one of g0 through g3,\n" + "not %s\n", argv[i + 1]); + else + outputState->glp = &outputState->g[j]; + i += 2; + } else if(!strcmp(argv[i], "-gr")) { + int j; + if(i + 1 >= argc) + FatalError("-gr requires an argument\n"); + if(strlen(argv[i + 1]) != 2 || + argv[i + 1][0] != 'g') + j = -1; + else + j = argv[i + 1][1] - '0'; + if(j < 0 || j > 3) + FatalError("The argument of -gl " + "should be one of g0 through g3,\n" + "not %s\n", argv[i + 1]); + else + outputState->grp = &outputState->g[j]; + i += 2; + } else if(!strcmp(argv[i], "-kg0")) { + if(i + 1 >= argc) + FatalError("-kg0 requires an argument\n"); + G0(inputState) = getCharsetByName(argv[i + 1]); + i += 2; + } else if(!strcmp(argv[i], "-kg1")) { + if(i + 1 >= argc) + FatalError("-kg1 requires an argument\n"); + G1(inputState) = getCharsetByName(argv[i + 1]); + i += 2; + } else if(!strcmp(argv[i], "-kg2")) { + if(i + 1 >= argc) + FatalError("-kg2 requires an argument\n"); + G2(inputState) = getCharsetByName(argv[i + 1]); + i += 2; + } else if(!strcmp(argv[i], "-kg3")) { + if(i + 1 >= argc) + FatalError("-kg3 requires an argument\n"); + G3(inputState) = getCharsetByName(argv[i + 1]); + + i += 2; + } else if(!strcmp(argv[i], "-kgl")) { + int j; + if(i + 1 >= argc) + FatalError("-kgl requires an argument\n"); + if(strlen(argv[i + 1]) != 2 || + argv[i + 1][0] != 'g') + j = -1; + else + j = argv[i + 1][1] - '0'; + if(j < 0 || j > 3) + FatalError("The argument of -kgl " + "should be one of g0 through g3,\n" + "not %s\n", argv[i + 1]); + else + inputState->glp = &inputState->g[j]; + i += 2; + } else if(!strcmp(argv[i], "-kgr")) { + int j; + if(i + 1 >= argc) + FatalError("-kgl requires an argument\n"); + if(strlen(argv[i + 1]) != 2 || + argv[i + 1][0] != 'g') + j = -1; + else + j = argv[i + 1][1] - '0'; + if(j < 0 || j > 3) + FatalError("The argument of -kgl " + "should be one of g0 through g3,\n" + "not %s\n", argv[i + 1]); + else + inputState->grp = &inputState->g[j]; + i += 2; + } else if(!strcmp(argv[i], "-argv0")) { + if(i + 1 >= argc) + FatalError("-argv0 requires an argument\n"); + child_argv0 = argv[i + 1]; + i += 2; + } else if(!strcmp(argv[i], "-c")) { + converter = 1; + i++; + } else if(!strcmp(argv[i], "-ilog")) { + if(i + 1 >= argc) + FatalError("-ilog requires an argument\n"); + ilog = open(argv[i + 1], O_WRONLY | O_CREAT | O_TRUNC, 0777); + if(ilog < 0) { + perror("Couldn't open input log"); + exit(1); + } + i += 2; + } else if(!strcmp(argv[i], "-olog")) { + if(i + 1 >= argc) + FatalError("-olog requires an argument\n"); + olog = open(argv[i + 1], O_WRONLY | O_CREAT | O_TRUNC, 0777); + if(olog < 0) { + perror("Couldn't open output log"); + exit(1); + } + i += 2; + } else { + FatalError("Unknown option %s\n", argv[i]); + } + } + return i; +} + +int +parseArgs(int argc, char **argv, char *argv0, + char **path_return, char ***argv_return) +{ + char *path = NULL; + char **child_argv = NULL; + + if(argc <= 0) { + char *shell; + shell = getenv("SHELL"); + if(shell) { + path = malloc(strlen(shell) + 1); + if(!path) + goto bail; + strcpy(path, shell); + } else { + path = malloc(strlen("/bin/sh") + 1); + if(!path) + goto bail; + strcpy(path, "/bin/sh"); + } + child_argv = malloc(2 * sizeof(char*)); + if(!child_argv) + goto bail; + if(argv0) + child_argv[0] = argv0; + else + child_argv[0] = my_basename(path); + child_argv[1] = NULL; + } else { + path = malloc(strlen(argv[0]) + 1); + if(!path) + goto bail; + strcpy(path, argv[0]); + child_argv = malloc((argc + 1) * sizeof(char*)); + if(!child_argv) { + goto bail; + } + if(child_argv0) + child_argv[0] = argv0; + else + child_argv[0] = my_basename(argv[0]); + memcpy(child_argv + 1, argv + 1, (argc - 1) * sizeof(char*)); + child_argv[argc] = NULL; + } + + *path_return = path; + *argv_return = child_argv; + return 0; + + bail: + if(path) + free(path); + if(argv) + free(argv); + return -1; +} + + +int +main(int argc, char **argv) +{ + int rc; + int i; + char *l; + + l = setlocale(LC_ALL, ""); + if(!l) + ErrorF("Warning: couldn't set locale.\n"); + + inputState = allocIso2022(); + if(!inputState) + FatalError("Couldn't create input state\n"); + + outputState = allocIso2022(); + if(!outputState) + FatalError("Couldn't create output state\n"); + + if(l) { + locale_name = setlocale(LC_CTYPE, NULL); + } else { + locale_name = getenv("LC_ALL"); + if(locale_name == NULL) + locale_name = getenv("LC_CTYPE"); + } + + if(locale_name == NULL) { + ErrorF("Couln't get locale name -- using C"); + locale_name = "C"; + } + + rc = initIso2022(locale_name, outputState); + if(rc < 0) + FatalError("Couldn't init output state\n"); + + i = parseOptions(argc, argv); + if(i < 0) + FatalError("Couldn't parse options\n"); + + rc = mergeIso2022(inputState, outputState); + if(rc < 0) + FatalError("Couldn't init input state\n"); + + if(converter) + return convert(0, 1); + else + return condom(argc - i, argv + 1); +} + +static int +convert(ifd, ofd) +{ + int rc, i; + unsigned char buf[BUFFER_SIZE]; + + rc = droppriv(); + if(rc < 0) { + perror("Couldn't drop priviledges"); + exit(1); + } + + while(1) { + i = read(ifd, buf, BUFFER_SIZE); + if(i <= 0) { + if(i < 0) { + perror("Read error"); + exit(1); + } + break; + } + copyOut(outputState, ofd, buf, i); + } + return 0; +} + + +static int +condom(int argc, char **argv) +{ + int pty; + int pid; + char *line; + char *path; + char **child_argv; + int rc; + + rc = parseArgs(argc, argv, child_argv0, + &path, &child_argv); + if(rc < 0) + FatalError("Couldn't parse arguments\n"); + + rc = allocatePty(&pty, &line); + if(rc < 0) { + perror("Couldn't allocate pty"); + exit(1); + } + + rc = droppriv(); + if(rc < 0) { + perror("Couldn't drop priviledges"); + exit(1); + } + + pid = fork(); + if(pid < 0) { + perror("Couldn't fork"); + exit(1); + } + + if(pid == 0) { + close(pty); + child(line, path, child_argv); + } else { + free(child_argv); + free(path); + free(line); + parent(pid, pty); + } + + return 0; +} + +void +child(char *line, char *path, char **argv) +{ + int tty; + int pgrp; + + close(0); + close(1); + close(2); + pgrp = setsid(); + if(pgrp < 0) { + kill(getppid(), SIGABRT); + exit(1); + } + + tty = openTty(line); + if(tty < 0) { + kill(getppid(), SIGABRT); + exit(1); + } + + if(tty != 0) + dup2(tty, 0); + if(tty != 1) + dup2(tty, 1); + if(tty != 2) + dup2(tty, 2); + + if(tty > 2) + close(tty); + + execvp(path, argv); + perror("Couldn't exec"); + exit(1); +} + +static void +sigwinchHandler(int sig) { + sigwinch_queued = 1; +} + +static void +sigchldHandler(int sig) +{ + sigchld_queued = 1; +} + +void +parent(int pid, int pty) +{ + unsigned char buf[BUFFER_SIZE]; + int i; + int val; + int rc; + + if(verbose) { + reportIso2022(outputState); + } + +#ifdef SIGWINCH + installHandler(SIGWINCH, sigwinchHandler); +#endif + installHandler(SIGCHLD, sigchldHandler); + + rc = setRawTermios(); + if(rc < 0) + FatalError("Couldn't set terminal to raw\n"); + + val = fcntl(0, F_GETFL, 0); + if(val >= 0) { + fcntl(0, F_SETFL, val | O_NONBLOCK); + } + val = fcntl(pty, F_GETFL, 0); + if(val >= 0) { + fcntl(pty, F_SETFL, val | O_NONBLOCK); + } + + setWindowSize(0, pty); + + for(;;) { + rc = waitForInput(0, pty); + + if(sigwinch_queued) { + sigwinch_queued = 0; + setWindowSize(0, pty); + } + + if(sigchld_queued) { + /* quitting now would be a race condition */ + } + + if(rc > 0) { + if(rc & 2) { + i = read(pty, buf, BUFFER_SIZE); + if((i == 0) || ((i < 0) && (errno != EAGAIN))) + break; + if(i > 0) + copyOut(outputState, 0, buf, i); + } + if(rc & 1) { + i = read(0, buf, BUFFER_SIZE); + if((i == 0) || ((i < 0) && (errno != EAGAIN))) + break; + if(i > 0) + copyIn(inputState, pty, buf, i); + } + } + } + + restoreTermios(); +} Index: xc/programs/luit/luit.h diff -u /dev/null xc/programs/luit/luit.h:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/luit.h Thu Nov 1 22:06:43 2001 @@ -0,0 +1,31 @@ +/* +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. +*/ + +extern int iso2022; +extern int verbose; +extern int sevenbit; +extern int ilog; +extern int olog; + +void child(char*, char*, char**); +void parent(int, int); + Index: xc/programs/luit/luit.man diff -u /dev/null xc/programs/luit/luit.man:1.2 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/luit.man Wed Dec 19 16:29:02 2001 @@ -0,0 +1,202 @@ +.TH LUIT 1 __vendorversion__ +.SH NAME +luit \- Locale and ISO\ 2022 support for Unicode terminals + +.SH SYNOPSIS +.B luit +[ +.I options +] [ +.B \-\- +] [ +.I program +[ +.I args +] ] + +.SH DESCRIPTION + +.B Luit +is a filter that can be run between an arbitrary application and a +UTF-8 terminal emulator. It will convert application output from the +locale's encoding into UTF-8, and convert terminal input from UTF-8 +into the locale's encoding. + +An application may also request switching to a different output +encoding using ISO\ 2022 and ISO\ 6429 escape sequences. Use of this +feature is discouraged: multilingual applications should be modified +to directly generate UTF-8 instead. + +.SH OPTIONS + +.TP +.B \-h +Display some summary help and quit. +.TP +.B \-list +List the supported charsets and quit. +.TP +.B \-v +Be verbose. +.TP +.B \-c +Function as a simple converter from standard input to standard output. +.TP +.BI \-argv0 " name" +Set the child's name (as passed in argv[0]). +.TP +.B +oss +Disable interpretation of single shifts in application output. +.TP +.B +ols +Disable interpretation of locking shifts in application output. +.TP +.B +osl +Disable interpretation of character set selection sequences in +application output. +.TP +.B +ot +Disable interpretation of all sequences and pass all sequences in +application output to the terminal unchanged. This may lead to +interesting results. +.TP +.B \-k7 +Generate seven-bit characters for keyboard input. +.TP +.B \+kss +Disable generation of single-shifts for keyboard input. +.TP +.B \-kls +Generate locking shifts (SO/SI) for keyboard input. +.TP +.BI \-gl " gn" +Set the initial assignment of GL. The argument should be one of +.BR g0 , +.BR g1 , +.B g2 +or +.BR g3 . +The default depends on the locale, but is usually +.BR g0 . +.TP +.BI \-gr " gk" +Set the initial assignment of GR. The default depends on the locale, +and is usually +.B g2 +except for EUC locales, where it is +.BR g1 . +.TP +.BI \-g0 " charset" +Set the charset initially selected in G0. The default depends on +the locale, but is usually +.BR ASCII . +.TP +.BI \-g1 " charset" +Set the charset initially selected in G1. The default depends on the +locale. +.TP +.BI \-g2 " charset" +Set the charset initially selected in G2. The default depends on the +locale. +.TP +.BI \-g3 " charset" +Set the charset initially selected in G3. The default depends on the +locale. +.TP +.BI \-ilog " filename" +Log into +.I filename +all the bytes received from the child. +.TP +.BI \-olog " filename" +Log into +.I filename +all the bytes sent to the terminal emulator. +.TP +.B \-\- +End of options. + +.SH EXAMPLES + +The most typical use of +.B luit +is to adapt an instance of +.B XTerm +in UTF-8 mode to the locale's encoding. For most locales, this +doesn't require using any flags: +.IP +$ xterm \-u8 \-e luit +.PP + +.B Luit +may also be used with applications that hard-wire an encoding that is +different from the one normally used on the system. In order to use +such applications, you will need to directly manipulate +.BR luit 's +ISO\ 2022 state: +.IP +$ xterm \-u8 \-e luit \-g2 'CP 1252' +.PP +The +.B \-v +flag may be used in order to examine +.BR luit 's +initial state. + +Future versions of +.B XTerm +will automatically invoke +.B luit +when necessary. + +.SH FILES + +.TP +.B __projectroot__/lib/X11/fonts/encodings/encodings.dir +The system-wide encodings directory. + +.TP +.B __projectroot__/lib/X11/locale/locale.alias +The file mapping locales to locale encodings. + +.SH SECURITY + +On systems with SVR4 (``Unix-98'') ptys (Linux version 2.2 and later, +SVR4), +.B luit +should be run as the invoking user. + +On systems without SVR4 (``Unix-98'') ptys (notably BSD variants), +running +.B luit +as an ordinary user will leave the tty world-writable; this is a +security hole, and luit will generate a warning (but still accept to +run). A possible solution is to make +.B luit +suid root; +.B luit +should drop privileges sufficiently early to make this safe. However, +the startup code has not been exhaustively audited, and the author +takes no responsibility for any resulting security issues. + +.B Luit +will refuse to run if it is installed setuid and the underlying system +does not have POSIX saved ids. + +.SH BUGS +None of this complexity should be necessary. Stateless UTF-8 +throughout the system is the way to go. + +Charsets with a non-trivial intermediary byte are not yet supported. + +Selecting alternate sets of control characters is not supported and +will never be. + +.SH SEE ALSO +xterm(1), unicode(7), utf-8(7), charsets(7). +.I Character Code Structure and Extension Techniques (ISO\ 2022, ECMA-35). +.I Control Functions for Coded Character Sets (ISO\ 6429, ECMA-48). + +.SH AUTHOR +Luit was written by Juliusz Chroboczek <jch@xfree86.org> for the +XFree86 project. Index: xc/programs/luit/parser.c diff -u /dev/null xc/programs/luit/parser.c:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/parser.c Thu Nov 1 22:06:43 2001 @@ -0,0 +1,209 @@ +/* +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. +*/ + +#include <stdlib.h> +#include <stdio.h> + +#include "parser.h" + +static char keyword[MAX_KEYWORD_LENGTH]; + +static void +skipEndOfLine(FILE *f, int c) +{ + if(c == 0) + c = getc(f); + + for(;;) + if(c <= 0 || c == '\n') + return; + else + c = getc(f); +} + +static int +drainWhitespace(FILE *f, int c) +{ + if(c == 0) + c = getc(f); + + while (c == '#' || c == ' ' || c == '\t') { + if(c <= 0) + return 0; + if(c == '#') { + skipEndOfLine(f, c); + return '\n'; + } + c = getc(f); + } + + return c; +} + +static int +getString(FILE *f, int string_end, int *c_return) +{ + int i = 0; + int c; + + c = getc(f); + while(c > 0) { + if(c == string_end) + break; + if(c == '\\') { + c = getc(f); + if(c == '\n') + continue; + } + keyword[i++] = c; + if(i >= MAX_KEYWORD_LENGTH) + return TOK_ERROR; + c = getc(f); + } + + if(c <= 0) + return TOK_ERROR; + keyword[i] = '\0'; + *c_return = c; + return TOK_KEYWORD; +} + +static int +getToken(FILE *f, int c, int parse_assignments, int *c_return) +{ + int i; + c = drainWhitespace(f, c); + + if(c < 0) + return TOK_EOF; + if(c == '\n') { + *c_return = 0; + return TOK_EOL; + } + + if(parse_assignments && c == '=') { + *c_return = 0; + return TOK_EQUALS; + } + + if(c == '\'' || c == '"') + return getString(f, c, c_return); + + i = 0; + while(c > 0 && c != ' ' && c != '\t' && c != '\n') { + if(c == '\\') { + c = getc(f); + if(c == '\n') + continue; + } + keyword[i++] = c; + if(i >= MAX_KEYWORD_LENGTH) + return TOK_ERROR; + c = getc(f); + if(parse_assignments && c == '=') + break; + } + + *c_return = c<0?0:c; + keyword[i] = '\0'; + return TOK_KEYWORD; +} + + +/* Can parse both the old and new formats for locale.alias */ +static int +parseTwoTokenLine(FILE *f, char *first, char *second) +{ + int c = 0; + int tok; + + again: + + tok = getToken(f, c, 0, &c); + if(tok == TOK_EOF) + return -1; + else if(tok == TOK_EOL) + goto again; + else if(tok == TOK_KEYWORD) { + int len = strlen(keyword); + if(keyword[len - 1] == ':') + keyword[len - 1] = '\0'; + strcpy(first, keyword); + } else + return -2; + + tok = getToken(f, c, 0, &c); + if(tok == TOK_KEYWORD) { + strcpy(second, keyword); + } else + return -2; + + tok = getToken(f, c, 0, &c); + if(tok != TOK_EOL) + return -2; + + return 0; +} + +char * +resolveLocale(char *locale) +{ + FILE *f; + char first[MAX_KEYWORD_LENGTH], second[MAX_KEYWORD_LENGTH]; + char *resolved = NULL; + int rc; + + f = fopen(LOCALE_ALIAS_FILE, "r"); + if(f == NULL) + goto bail; + + do { + rc = parseTwoTokenLine(f, first, second); + if(rc < -1) + goto bail; + if(!strcmp(first, locale)) { + resolved = malloc(strlen(second) + 1); + if(resolved == NULL) + goto bail; + strcpy(resolved, second); + break; + } + } while(rc >= 0); + + if(resolved == NULL) { + resolved = malloc(strlen(locale) + 1); + if(resolved == NULL) + goto bail; + strcpy(resolved, locale); + } + + fclose(f); + + return resolved; + + bail: + if(f != NULL) + fclose(f); + if(resolved != NULL) + free(resolved); + return NULL; +} Index: xc/programs/luit/parser.h diff -u /dev/null xc/programs/luit/parser.h:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/parser.h Thu Nov 1 22:06:43 2001 @@ -0,0 +1,35 @@ +/* +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. +*/ + +#ifndef LOCALE_ALIAS_FILE +#define LOCALE_ALIAS_FILE "/usr/X11R6/lib/X11/locale/locale.alias" +#endif + +#define MAX_KEYWORD_LENGTH 1024 + +#define TOK_ERROR (-2) +#define TOK_EOF (-1) +#define TOK_EOL 0 +#define TOK_EQUALS 1 +#define TOK_KEYWORD 2 + +char *resolveLocale(char *locale); Index: xc/programs/luit/sys.c diff -u /dev/null xc/programs/luit/sys.c:1.7 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/sys.c Mon Jan 7 15:38:30 2002 @@ -0,0 +1,457 @@ +/* +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/luit/sys.c,v 1.7 2002/01/07 20:38:30 dawes Exp $ */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <termios.h> +#include <signal.h> +#include <errno.h> + +#ifdef SVR4 +#define HAVE_POLL +#endif + +#ifndef HAVE_POLL +#ifndef _MINIX +#define HAVE_SELECT +#endif +#endif + +#ifdef HAVE_POLL +#include <sys/poll.h> +#undef HAVE_SELECT +#endif + +#ifdef __QNX__ +#include <sys/select.h> +#endif + + +#if (defined(__GLIBC__) && \ + (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1))) || \ + defined(SVR4) +#define HAVE_GRANTPT +#endif + +#ifdef __GLIBC__ +#include <pty.h> +#endif + +#ifdef SVR4 +#include <stropts.h> +#endif + +#include "sys.h" + +static int saved_tio_valid = 0; +static struct termios saved_tio; + + +#ifdef HAVE_POLL +int +waitForOutput(int fd) +{ + struct pollfd pfd[1]; + int rc; + + pfd[0].fd = fd; + pfd[0].events = POLLOUT; + pfd[0].revents = 0; + + rc = poll(pfd, 1, -1); + if(rc < 0) + return -1; + + if(pfd[0].revents & POLLOUT) + return 1; + + return 0; +} + +int +waitForInput(int fd1, int fd2) +{ + struct pollfd pfd[2]; + int ret, rc; + + pfd[0].fd = fd1; + pfd[1].fd = fd2; + pfd[0].events = pfd[1].events = POLLIN; + pfd[0].revents = pfd[1].revents = 0; + + rc = poll(pfd, 2, -1); + if(rc < 0) + return -1; + + ret = 0; + if(pfd[0].revents & POLLIN) + ret |= 1; + if(pfd[1].revents & POLLIN) + ret |= 2; + return ret; +} +#endif + +#ifdef HAVE_SELECT +int +waitForOutput(int fd) +{ + fd_set fds; + int rc; + + FD_ZERO(&fds); + FD_SET(fd, &fds); + rc = select(FD_SETSIZE, NULL, &fds, NULL, NULL); + if(rc < 0) + return -1; + + if(FD_ISSET(fd, &fds)) + return 1; + + return 0; +} + +int +waitForInput(int fd1, int fd2) +{ + fd_set fds; + int ret, rc; + + FD_ZERO(&fds); + FD_SET(fd1, &fds); + FD_SET(fd2, &fds); + rc = select(FD_SETSIZE, &fds, NULL, NULL, NULL); + if(rc < 0) + return -1; + + ret = 0; + if(FD_ISSET(fd1, &fds)) + ret |= 1; + if(FD_ISSET(fd2, &fds)) + ret |= 2; + return ret; +} +#endif + +#ifndef HAVE_POLL +#ifndef HAVE_SELECT +/* Busy looping implementation */ +int +waitForOutput(int fd) +{ + return 1; +} + +int +waitForInput(int fd1, int fd2) +{ + return 1|2; +} +#endif +#endif + + +int +setWindowSize(int sfd, int dfd) +{ +#ifdef TIOCGWINSZ + int rc; + struct winsize ws; + rc = ioctl(sfd, TIOCGWINSZ, (char*)&ws); + if(rc < 0) + return -1; + rc = ioctl(dfd, TIOCSWINSZ, (char*)&ws); + if(rc < 0) + return -1; +#endif + return 0; +} + +int +installHandler(int signum, void (*handler)(int)) +{ + struct sigaction sa; + sigset_t ss; + int rc; + + sigemptyset(&ss); + + sa.sa_handler = handler; + sa.sa_mask = ss; + sa.sa_flags = 0; + rc = sigaction(signum, &sa, NULL); + return rc; +} + +int +saveTermios(void) +{ + int rc; + rc = tcgetattr(0, &saved_tio); + if(rc >= 0) + saved_tio_valid = 1; + return rc; +} + +int +restoreTermios(void) +{ + if(!saved_tio_valid) + return -1; + return tcsetattr(0, TCSAFLUSH, &saved_tio); +} + +int +setRawTermios(void) +{ + struct termios tio; + int rc; + + if(!saved_tio_valid) + saveTermios(); + rc = tcgetattr(0, &tio); + if(rc < 0) + return rc; + tio.c_lflag &= ~(ECHO|ICANON|ISIG); + tio.c_iflag &= ~(ICRNL|IXOFF|IXON|ISTRIP); +#ifdef ONLCR + tio.c_oflag &= ~ONLCR; +#endif +#ifdef OCRNL + tio.c_oflag &= ~OCRNL; +#endif +#ifdef ONOCR + tio.c_oflag &= ~ONOCR; +#endif + +#ifdef VMIN + tio.c_cc[VMIN] = 0; + tio.c_cc[VTIME] = 0; +#endif + rc = tcsetattr(0, TCSAFLUSH, &tio); + if(rc < 0) + return rc; + return 0; +} + + +char * +my_basename(char *path) +{ + char *p; + + p = strrchr(path, '/'); + if(!p) + p = path; + else + p++; + return p; +} + +static int +fix_pty_perms(char *line) +{ + int rc; + struct stat s; + int uid = getuid(), gid = getgid(); + + rc = stat(line, &s); + if(rc < 0) + return -1; + if(s.st_uid != uid || s.st_gid != gid) { + rc = chown(line, getuid(), getgid()); + if(rc < 0) { + fprintf(stderr, + "Warning: could not change ownership of tty -- " + "pty is insecure!\n"); + return 0; + } + } + if((s.st_mode & 0777) != (S_IRUSR | S_IWUSR | S_IWGRP)) { + rc = chmod(line, S_IRUSR | S_IWUSR | S_IWGRP); + if (rc < 0) { + fprintf(stderr, + "Warning: could not change permissions of tty -- " + "pty is insecure!\n"); + return 0; + } + } + return 1; +} + +int +allocatePty(int *pty_return, char **line_return) +{ + char name[12], *line = NULL; + int pty = -1; + char *name1 = "pqrstuvwxyzPQRST", *name2 = "0123456789abcdef"; + char *p1, *p2; + +#ifdef HAVE_GRANTPT + char *temp_line; + int rc; + + pty = open("/dev/ptmx", O_RDWR); + if(pty < 0) + goto bsd; + + rc = grantpt(pty); + if(rc < 0) { + close(pty); + goto bsd; + } + + rc = unlockpt(pty); + if(rc < 0) { + close(pty); + goto bsd; + } + + temp_line = ptsname(pty); + if(!temp_line) { + close(pty); + goto bsd; + } + line = malloc(strlen(temp_line) + 1); + if(!line) { + close(pty); + return -1; + } + strcpy(line, temp_line); + + fix_pty_perms(line); + + *pty_return = pty; + *line_return = line; + return 0; + + bsd: +#endif /* HAVE_GRANTPT */ + + strcpy(name, "/dev/pty??"); + for(p1 = name1; *p1; p1++) { + name[8] = *p1; + for(p2 = name2; *p2; p2++) { + name[9] = *p2; + pty = open(name, O_RDWR); + if(pty >= 0) + goto found; + if(errno == ENOENT) + goto bail; + else + continue; + } + } + + goto bail; + + found: + line = malloc(strlen(name)); + strcpy(line, name); + line[5] = 't'; + fix_pty_perms(line); + *pty_return = pty; + *line_return = line; + return 0; + + bail: + if(pty >= 0) + close(pty); + if(line) + free(line); + return -1; +} + +int +openTty(char *line) +{ + int rc; + int tty = -1; + + tty = open(line, O_RDWR | O_NOCTTY); + + if(tty < 0) + goto bail; + +#ifdef TIOCSCTTY + rc = ioctl(tty, TIOCSCTTY, (char *)0); + if(rc < 0) { + goto bail; + } +#endif + +#ifdef SVR4 + rc = ioctl(tty, I_PUSH, "ptem"); + if(rc < 0) + goto bail; + + rc = ioctl(tty, I_PUSH, "ldterm"); + if(rc < 0) + goto bail; + + rc = ioctl(tty, I_PUSH, "ttcompat"); + if(rc < 0) + goto bail; +#endif + + return tty; + + bail: + if(tty >= 0) + close(tty); + return -1; +} + +#ifdef _POSIX_SAVED_IDS +int +droppriv() +{ + int rc; + rc = setuid(getuid()); + if(rc < 0) + return rc; + return setgid(getgid()); +} +#else +int +droppriv() +{ + int uid = getuid(); + int euid = geteuid(); + int gid = getgid(); + int egid = getegid(); + + if(uid != euid || gid != egid) { + errno = ENOSYS; + return -1; + } + return 0; +} +#endif Index: xc/programs/luit/sys.h diff -u /dev/null xc/programs/luit/sys.h:1.1 --- /dev/null Fri Jan 18 15:27:01 2002 +++ xc/programs/luit/sys.h Thu Nov 1 22:06:43 2001 @@ -0,0 +1,33 @@ +/* +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. +*/ + +int waitForOutput(int fd); +int waitForInput(int fd1, int fd2); +int setWindowSize(int sfd, int dfd); +int installHandler(int signum, void (*handler)(int)); +int saveTermios(void); +int restoreTermios(void); +int setRawTermios(void); +char *my_basename(char *path); +int allocatePty(int *pty_return, char **line_return); +int openTty(char *line); +int droppriv(void); Index: xc/programs/makepsres/makepsres.c diff -u xc/programs/makepsres/makepsres.c:1.4 xc/programs/makepsres/makepsres.c:1.5 --- xc/programs/makepsres/makepsres.c:1.4 Wed Apr 5 14:14:03 2000 +++ xc/programs/makepsres/makepsres.c Tue Jul 31 20:45:01 2001 @@ -35,7 +35,7 @@ * * Author: Adobe Systems Incorporated */ -/* $XFree86: xc/programs/makepsres/makepsres.c,v 1.4 2000/04/05 18:14:03 dawes Exp $ */ +/* $XFree86: xc/programs/makepsres/makepsres.c,v 1.5 2001/08/01 00:45:01 tsi Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -2237,7 +2237,7 @@ } } - +int main (argc, argv) int argc; char *argv[]; Index: xc/programs/mkcfm/mkcfm.c diff -u xc/programs/mkcfm/mkcfm.c:1.10 xc/programs/mkcfm/mkcfm.c:1.11 --- xc/programs/mkcfm/mkcfm.c:1.10 Tue Nov 14 12:33:01 2000 +++ xc/programs/mkcfm/mkcfm.c Mon Aug 13 17:46:51 2001 @@ -16,7 +16,7 @@ * The Original Software is CID font code that was developed by Silicon * Graphics, Inc. */ -/* $XFree86: xc/programs/mkcfm/mkcfm.c,v 1.10 2000/11/14 17:33:01 dawes Exp $ */ +/* $XFree86: xc/programs/mkcfm/mkcfm.c,v 1.11 2001/08/13 21:46:51 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -239,21 +239,20 @@ ErrorF(const char *f, ...) { ; } char * -font_encoding_from_xlfd(const char *name, int n ) { return NULL; } +FontEncFromXLFD(const char *name, int n ) { return NULL; } -struct font_encoding * -font_encoding_find(const char *c1, const char *c2) { return NULL; } +FontMapPtr +FontEncMapFind(const char *c1, int n1, int n2, int n3, const char *c2) +{ return NULL; } char * unicodetoPSname(unsigned short code) { return NULL; } unsigned -font_encoding_recode(unsigned i, struct font_encoding *fe, - struct font_encoding_mapping *m) { return 0; } +FontEncRecode(unsigned i, FontMapPtr m) { return 0; } char * -font_encoding_name(unsigned i, struct font_encoding *fe, - struct font_encoding_mapping *m) { return NULL; } +FontEncName(unsigned i, FontMapPtr m) { return NULL; } FontPtr CreateFontRec (void) @@ -271,3 +270,4 @@ { xfree(pFont); } + Index: xc/programs/mkfontdir/mkfontdir.c diff -u xc/programs/mkfontdir/mkfontdir.c:3.12 xc/programs/mkfontdir/mkfontdir.c:3.17 --- xc/programs/mkfontdir/mkfontdir.c:3.12 Wed Jan 17 18:45:00 2001 +++ xc/programs/mkfontdir/mkfontdir.c Mon Nov 26 14:33:48 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/mkfontdir/mkfontdir.c,v 3.12 2001/01/17 23:45:00 dawes Exp $ */ +/* $XFree86: xc/programs/mkfontdir/mkfontdir.c,v 3.17 2001/11/26 19:33:48 dawes Exp $ */ /*********************************************************** Copyright (c) 1988 X Consortium @@ -55,9 +55,7 @@ #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <stdio.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE @@ -115,14 +113,13 @@ #include "bitmap.h" #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #define XK_LATIN1 #include <X11/keysymdef.h> +Bool processFonts = TRUE; + char *progName; char *prefix = ""; Bool relative = FALSE; @@ -156,8 +153,9 @@ #define ENCODING_HASH_SIZE 256 -static Bool WriteFontTable ( char *dirName, FontTablePtr table, - EncodingBucketPtr *encodings, int count); +static Bool WriteFontTable ( char *dirName, FontTablePtr table); +static Bool WriteEncodingsTable(char *dirName, EncodingBucketPtr *encodings, + int count); static char * NameForAtomOrNone ( Atom a ); static Bool GetFontName ( char *file_name, char *font_name ); static char * FontNameExists ( FontTablePtr table, char *font_name ); @@ -172,21 +170,17 @@ int LoadScalable ( char *dirName, FontTablePtr table ); static Bool DoDirectory(char *dirName, EncodingBucketPtr *encodings, int count); -int GetDefaultPointSize ( void ); void ErrorF ( void ); static Bool WriteFontTable( char *dirName, - FontTablePtr table, - EncodingBucketPtr *encodings, - int count) + FontTablePtr table) { - int i; FILE *file; char full_name[PATH_MAX]; FontEntryPtr entry; - EncodingBucketPtr encoding; + int i; sprintf (full_name, "%s/%s", dirName, FontDirFile); @@ -210,21 +204,30 @@ fprintf (file, "%s %s\n", entry->u.bitmap.fileName, entry->name.name); } fclose (file); + + return TRUE; +} - /* Write out encodings directory */ +static Bool +WriteEncodingsTable(char *dirName, EncodingBucketPtr *encodings, int count) +{ + char full_name[PATH_MAX]; + FILE *file; + int i; + EncodingBucketPtr encoding; sprintf (full_name, "%s/%s", dirName, "encodings.dir"); if (unlink(full_name) < 0 && errno != ENOENT) { fprintf(stderr, "%s: warning: cannot unlink %s\n", progName, full_name); - return TRUE; /* non fatal error */ + return FALSE; } if(!count) return TRUE; file = fopen (full_name, "w"); if (!file) { fprintf (stderr, "%s: can't create directory %s\n", progName, full_name); - return TRUE; + return FALSE; } fprintf(file, "%d\n", count); for(i=0; i<ENCODING_HASH_SIZE; i++) @@ -462,6 +465,9 @@ char file_name[MAXFONTFILENAMELEN]; char font_name[MAXFONTNAMELEN]; char dir_file[MAXFONTFILENAMELEN]; + /* "+2" is for the space and the final null */ + char dir_line[sizeof(file_name)+sizeof(font_name)+2]; + char dir_format[20]; FILE *file; int count; int i; @@ -477,7 +483,10 @@ fclose(file); return BadFontPath; } - while ((count = fscanf(file, "%s %[^\n]\n", file_name, font_name)) != EOF) { + (void) sprintf(dir_format, "%%%ds %%%d[^\n]\n", + sizeof(file_name)-1, sizeof(font_name)-1); + while (fgets(dir_line, sizeof(dir_line), file) != NULL) { + count = sscanf(dir_line, dir_format, file_name, font_name); if (count != 2) { fclose(file); fprintf (stderr, "%s: bad format for %s file\n", @@ -608,7 +617,7 @@ continue; } strcpy(fullname+len, FileName(file)); - names=identifyEncodingFile(fullname); + names=FontEncIdentify(fullname); if(names) { if((filename=New(char, strlen(fullname)+1))==NULL) { fprintf(stderr, "%s: warning: out of memory.\n", progName); @@ -635,22 +644,27 @@ FontTableRec table; Bool status; - if (!FontFileInitTable (&table, 100)) - return FALSE; - if (!LoadDirectory (dirName, &table)) - { - FontFileFreeTable (&table); - return FALSE; - } - if (!LoadScalable (dirName, &table)) - { - FontFileFreeTable (&table); - return FALSE; - } status = TRUE; - if (table.used >= 0) - status = WriteFontTable (dirName, &table, encodings, count); - FontFileFreeTable (&table); + + if(processFonts) { + if (!FontFileInitTable (&table, 100)) + return FALSE; + if (!LoadDirectory (dirName, &table)) + { + FontFileFreeTable (&table); + return FALSE; + } + if (!LoadScalable (dirName, &table)) + { + FontFileFreeTable (&table); + return FALSE; + } + if (table.used >= 0) + status = WriteFontTable (dirName, &table); + FontFileFreeTable (&table); + } + if (status) + WriteEncodingsTable(dirName, encodings, count); return status; } @@ -730,6 +744,13 @@ prefix=argv[argn]; } else prefix=argv[argn]+2; + } else if(argv[argn][1]=='n') { + if(argv[argn][2] == '\0') { + processFonts = FALSE; + } else { + fprintf(stderr, "%s: unknown option `%s'\n", progName, argv[argn]); + continue; + } } else if(argv[argn][1]=='r') { if(argv[argn][2]=='\0') relative=TRUE; Index: xc/programs/mkfontdir/mkfontdir.man diff -u xc/programs/mkfontdir/mkfontdir.man:1.12 xc/programs/mkfontdir/mkfontdir.man:1.15 --- xc/programs/mkfontdir/mkfontdir.man:1.12 Sat Jan 27 13:21:04 2001 +++ xc/programs/mkfontdir/mkfontdir.man Fri Dec 14 15:00:59 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: mkfontdir.man,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ +.\" $Xorg: mkfontdir.man,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,13 +23,14 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/mkfontdir/mkfontdir.man,v 1.12 2001/01/27 18:21:04 dawes Exp $ +.\" $XFree86: xc/programs/mkfontdir/mkfontdir.man,v 1.15 2001/12/14 20:00:59 dawes Exp $ .\" .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 +mkfontdir \- create an index of X font files in a directory .SH SYNOPSIS .B "mkfontdir" +.RB [ \-n ] .RB [ \-x .IR suffix ] .RB [ \-r ] @@ -119,6 +124,10 @@ encodings found in earlier directories override those in later ones; encoding files in the same directory are discriminated by preferring compressed versions. +.TP +.B \-n +do not scan for fonts, do not write font directory files. This option +is useful when generating encoding directories only. .TP .B \-p Specify a prefix that is prepended to the encoding file path names Index: xc/programs/oclock/Clock.c diff -u xc/programs/oclock/Clock.c:1.5 xc/programs/oclock/Clock.c:1.7 --- xc/programs/oclock/Clock.c:1.5 Sun Apr 1 10:00:18 2001 +++ xc/programs/oclock/Clock.c Fri Dec 14 15:01:00 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: Clock.c,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ + * $Xorg: Clock.c,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.5 2001/04/01 14:00:18 tsi Exp $ */ +/* $XFree86: xc/programs/oclock/Clock.c,v 1.7 2001/12/14 20:01:00 dawes Exp $ */ /* * Clock.c @@ -37,14 +41,8 @@ #include <math.h> #include <X11/extensions/shape.h> -#ifdef X_NOT_STDC_ENV -extern struct tm *localtime(); -#define Time_t long -extern Time_t time(); -#else #include <time.h> #define Time_t time_t -#endif #define offset(field) XtOffsetOf(ClockRec, clock.field) #define goffset(field) XtOffsetOf(WidgetRec, core.field) Index: xc/programs/oclock/Clock.h diff -u xc/programs/oclock/Clock.h:1.4 xc/programs/oclock/Clock.h:1.5 --- xc/programs/oclock/Clock.h:1.4 Wed Jan 17 18:45:01 2001 +++ xc/programs/oclock/Clock.h Fri Dec 14 15:01:00 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Clock.h,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ +/* $Xorg: Clock.h,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/oclock/Clock.h,v 1.4 2001/01/17 23:45:01 dawes Exp $ */ +/* $XFree86: xc/programs/oclock/Clock.h,v 1.5 2001/12/14 20:01:00 dawes Exp $ */ #ifndef _XtClock_h #define _XtClock_h Index: xc/programs/oclock/ClockP.h diff -u xc/programs/oclock/ClockP.h:1.4 xc/programs/oclock/ClockP.h:1.5 --- xc/programs/oclock/ClockP.h:1.4 Wed Jan 17 18:45:01 2001 +++ xc/programs/oclock/ClockP.h Fri Dec 14 15:01:00 2001 @@ -1,9 +1,13 @@ -/* $Xorg: ClockP.h,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ +/* $Xorg: ClockP.h,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/oclock/ClockP.h,v 1.4 2001/01/17 23:45:01 dawes Exp $ */ +/* $XFree86: xc/programs/oclock/ClockP.h,v 1.5 2001/12/14 20:01:00 dawes Exp $ */ #ifndef _ClockP_h Index: xc/programs/oclock/oclock.c diff -u xc/programs/oclock/oclock.c:1.6 xc/programs/oclock/oclock.c:1.7 --- xc/programs/oclock/oclock.c:1.6 Sun Apr 1 10:00:18 2001 +++ xc/programs/oclock/oclock.c Fri Dec 14 15:01:00 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: oclock.c,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ + * $Xorg: oclock.c,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.6 2001/04/01 14:00:18 tsi Exp $ */ +/* $XFree86: xc/programs/oclock/oclock.c,v 1.7 2001/12/14 20:01:00 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/Xatom.h> Index: xc/programs/oclock/oclock.man diff -u xc/programs/oclock/oclock.man:1.7 xc/programs/oclock/oclock.man:1.8 --- xc/programs/oclock/oclock.man:1.7 Sat Jan 27 13:21:04 2001 +++ xc/programs/oclock/oclock.man Fri Dec 14 15:01:00 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: oclock.man,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ +.\" $Xorg: oclock.man,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ .\" Copyright 1989, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/oclock/oclock.man,v 1.7 2001/01/27 18:21:04 dawes Exp $ +.\" $XFree86: xc/programs/oclock/oclock.man,v 1.8 2001/12/14 20:01:00 dawes Exp $ .\" .TH OCLOCK 1 __xorgversion__ .SH NAME Index: xc/programs/oclock/transform.c diff -u xc/programs/oclock/transform.c:3.3 xc/programs/oclock/transform.c:3.5 --- xc/programs/oclock/transform.c:3.3 Wed Jan 17 18:45:01 2001 +++ xc/programs/oclock/transform.c Fri Dec 14 15:01:00 2001 @@ -1,9 +1,13 @@ -/* $Xorg: transform.c,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ +/* $Xorg: transform.c,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,21 +26,16 @@ from The Open Group. */ -/* $XFree86: xc/programs/oclock/transform.c,v 3.3 2001/01/17 23:45:01 dawes Exp $ */ +/* $XFree86: xc/programs/oclock/transform.c,v 3.5 2001/12/14 20:01:00 dawes Exp $ */ /* * transformed coordinate system objects for X */ -# include <X11/Xlib.h> -# include "transform.h" - -#ifndef X_NOT_STDC_ENV +#include <X11/Xlib.h> +#include "transform.h" #include <stdlib.h> -#else -char *malloc(); -#endif static XPoint * TranslatePoints(TPoint *points, int n_points, Index: xc/programs/oclock/transform.h diff -u xc/programs/oclock/transform.h:1.4 xc/programs/oclock/transform.h:1.5 --- xc/programs/oclock/transform.h:1.4 Wed Jan 17 18:45:01 2001 +++ xc/programs/oclock/transform.h Fri Dec 14 15:01:00 2001 @@ -1,9 +1,13 @@ -/* $Xorg: transform.h,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ +/* $Xorg: transform.h,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/oclock/transform.h,v 1.4 2001/01/17 23:45:01 dawes Exp $ */ +/* $XFree86: xc/programs/oclock/transform.h,v 1.5 2001/12/14 20:01:00 dawes Exp $ */ /* Index: xc/programs/proxymngr/Imakefile diff -u xc/programs/proxymngr/Imakefile:1.8 xc/programs/proxymngr/Imakefile:1.11 --- xc/programs/proxymngr/Imakefile:1.8 Wed Jan 17 18:45:02 2001 +++ xc/programs/proxymngr/Imakefile Mon Oct 8 12:36:49 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/proxymngr/Imakefile,v 1.8 2001/01/17 23:45:02 dawes Exp $ +XCOMM $XFree86: xc/programs/proxymngr/Imakefile,v 1.11 2001/10/08 16:36:49 alanh Exp $ DEFINES = StrcasecmpDefines @@ -16,9 +16,7 @@ OBJS1 = main.o pmdb.o config.o - PROGS1 = ProgramTargetName(proxymngr) - - PROGRAMS = $(PROGS1) + PROGRAMS = proxymngr LBXPROXY = $(BINDIR)/lbxproxy Index: xc/programs/proxymngr/PM.h diff -u xc/programs/proxymngr/PM.h:1.1.1.3 xc/programs/proxymngr/PM.h:1.2 --- xc/programs/proxymngr/PM.h:1.1.1.3 Tue Jan 16 17:46:43 2001 +++ xc/programs/proxymngr/PM.h Fri Dec 14 15:01:01 2001 @@ -1,9 +1,13 @@ -/* $Xorg: PM.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: PM.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/proxymngr/PMproto.h diff -u xc/programs/proxymngr/PMproto.h:1.1.1.3 xc/programs/proxymngr/PMproto.h:1.2 --- xc/programs/proxymngr/PMproto.h:1.1.1.3 Tue Jan 16 17:46:43 2001 +++ xc/programs/proxymngr/PMproto.h Fri Dec 14 15:01:01 2001 @@ -1,9 +1,13 @@ -/* $Xorg: PMproto.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: PMproto.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/proxymngr/config.c diff -u xc/programs/proxymngr/config.c:1.6 xc/programs/proxymngr/config.c:1.7 --- xc/programs/proxymngr/config.c:1.6 Wed Jan 17 18:45:02 2001 +++ xc/programs/proxymngr/config.c Fri Dec 14 15:01:01 2001 @@ -1,9 +1,13 @@ -/* $Xorg: config.c,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: config.c,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/proxymngr/config.c,v 1.6 2001/01/17 23:45:02 dawes Exp $ */ +/* $XFree86: xc/programs/proxymngr/config.c,v 1.7 2001/12/14 20:01:01 dawes Exp $ */ #include <stdlib.h> Index: xc/programs/proxymngr/config.h diff -u xc/programs/proxymngr/config.h:1.1.1.3 xc/programs/proxymngr/config.h:1.2 --- xc/programs/proxymngr/config.h:1.1.1.3 Tue Jan 16 17:46:43 2001 +++ xc/programs/proxymngr/config.h Fri Dec 14 15:01:01 2001 @@ -1,9 +1,13 @@ -/* $Xorg: config.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: config.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/proxymngr/main.c diff -u xc/programs/proxymngr/main.c:1.5 xc/programs/proxymngr/main.c:1.7 --- xc/programs/proxymngr/main.c:1.5 Wed Jan 17 18:45:02 2001 +++ xc/programs/proxymngr/main.c Wed Dec 19 16:37:35 2001 @@ -1,9 +1,13 @@ -/* $Xorg: main.c,v 1.4 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: main.c,v 1.6 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/proxymngr/main.c,v 1.5 2001/01/17 23:45:02 dawes Exp $ */ +/* $XFree86: xc/programs/proxymngr/main.c,v 1.7 2001/12/19 21:37:35 dawes Exp $ */ #include <stdlib.h> #include "pmint.h" @@ -59,7 +63,7 @@ PMSetupProcessMessages}}; char *PM_VENDOR_STRING = "The X.Org Group"; -char *PM_VENDOR_RELEASE = "Release 6.5.1"; +char *PM_VENDOR_RELEASE = "Release 6.6"; int verbose = 0; Index: xc/programs/proxymngr/pmdb.c diff -u xc/programs/proxymngr/pmdb.c:1.5 xc/programs/proxymngr/pmdb.c:1.7 --- xc/programs/proxymngr/pmdb.c:1.5 Wed Jan 17 18:45:02 2001 +++ xc/programs/proxymngr/pmdb.c Fri Dec 14 15:01:02 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pmdb.c,v 1.4 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: pmdb.c,v 1.5 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,13 +25,14 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/proxymngr/pmdb.c,v 1.5 2001/01/17 23:45:02 dawes Exp $ */ +/* $XFree86: xc/programs/proxymngr/pmdb.c,v 1.7 2001/12/14 20:01:02 dawes Exp $ */ #include "pmint.h" #include "pmdb.h" #include "config.h" #include <assert.h> #include <stdio.h> +#include <stdlib.h> #include <signal.h> #if defined(X_NOT_POSIX) && defined(SIGNALRETURNSINT) Index: xc/programs/proxymngr/pmdb.h diff -u xc/programs/proxymngr/pmdb.h:1.1.1.3 xc/programs/proxymngr/pmdb.h:1.2 --- xc/programs/proxymngr/pmdb.h:1.1.1.3 Tue Jan 16 17:46:45 2001 +++ xc/programs/proxymngr/pmdb.h Fri Dec 14 15:01:02 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pmdb.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: pmdb.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/proxymngr/pmint.h diff -u xc/programs/proxymngr/pmint.h:1.4 xc/programs/proxymngr/pmint.h:1.5 --- xc/programs/proxymngr/pmint.h:1.4 Wed Jan 17 18:45:02 2001 +++ xc/programs/proxymngr/pmint.h Fri Dec 14 15:01:02 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pmint.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: pmint.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/proxymngr/pmint.h,v 1.4 2001/01/17 23:45:02 dawes Exp $ */ +/* $XFree86: xc/programs/proxymngr/pmint.h,v 1.5 2001/12/14 20:01:02 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> Index: xc/programs/proxymngr/proxymngr.man diff -u xc/programs/proxymngr/proxymngr.man:1.6 xc/programs/proxymngr/proxymngr.man:1.7 --- xc/programs/proxymngr/proxymngr.man:1.6 Sat Jan 27 13:21:04 2001 +++ xc/programs/proxymngr/proxymngr.man Fri Dec 14 15:01:02 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: proxymngr.man,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ +.\" $Xorg: proxymngr.man,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ .\" Copyright 1996, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" from The Open Group. .\" .\" -.\" $XFree86: xc/programs/proxymngr/proxymngr.man,v 1.6 2001/01/27 18:21:04 dawes Exp $ +.\" $XFree86: xc/programs/proxymngr/proxymngr.man,v 1.7 2001/12/14 20:01:02 dawes Exp $ .\" .TH PROXYMNGR 1 __xorgversion__ .SH NAME Index: xc/programs/rgb/rgb.c diff -u xc/programs/rgb/rgb.c:3.5 xc/programs/rgb/rgb.c:3.8 --- xc/programs/rgb/rgb.c:3.5 Wed Jan 17 18:45:03 2001 +++ xc/programs/rgb/rgb.c Fri Dec 14 15:01:03 2001 @@ -1,9 +1,13 @@ -/* $Xorg: rgb.c,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ +/* $Xorg: rgb.c,v 1.4 2001/02/09 02:05:35 xorgcvs Exp $ */ /* Copyright 1985, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/rgb/rgb.c,v 3.5 2001/01/17 23:45:03 dawes Exp $ */ +/* $XFree86: xc/programs/rgb/rgb.c,v 3.8 2001/12/14 20:01:03 dawes Exp $ */ /* reads from standard input lines of the form: @@ -52,10 +56,6 @@ #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - char *ProgramName; char *SysError () @@ -64,6 +64,7 @@ return s ? s : "?"; } +int main(argc, argv) int argc; char **argv; Index: xc/programs/rgb/showrgb.c diff -u xc/programs/rgb/showrgb.c:3.6 xc/programs/rgb/showrgb.c:3.8 --- xc/programs/rgb/showrgb.c:3.6 Wed Jan 17 18:45:03 2001 +++ xc/programs/rgb/showrgb.c Fri Dec 14 15:01:04 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: showrgb.c,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ + * $Xorg: showrgb.c,v 1.4 2001/02/09 02:05:35 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/rgb/showrgb.c,v 3.6 2001/01/17 23:45:03 dawes Exp $ */ +/* $XFree86: xc/programs/rgb/showrgb.c,v 3.8 2001/12/14 20:01:04 dawes Exp $ */ #ifndef USE_RGB_TXT #ifdef NDBM @@ -43,9 +47,7 @@ #undef NULL #include <stdio.h> #include <X11/Xos.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include "rgb.h" /* off in server/include/ */ #include "site.h" #include <X11/Xfuncs.h> Index: xc/programs/rgb/showrgb.man diff -u xc/programs/rgb/showrgb.man:1.6 xc/programs/rgb/showrgb.man:1.7 --- xc/programs/rgb/showrgb.man:1.6 Sat Jan 27 13:21:05 2001 +++ xc/programs/rgb/showrgb.man Fri Dec 14 15:01:04 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: showrgb.man,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ +.\" $Xorg: showrgb.man,v 1.4 2001/02/09 02:05:35 xorgcvs Exp $ .\" Copyright 1993, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/rgb/showrgb.man,v 1.6 2001/01/27 18:21:05 dawes Exp $ +.\" $XFree86: xc/programs/rgb/showrgb.man,v 1.7 2001/12/14 20:01:04 dawes Exp $ .\" .TH SHOWRGB 1 __xorgversion__ .SH NAME Index: xc/programs/rstart/auth.c diff -u xc/programs/rstart/auth.c:1.4 xc/programs/rstart/auth.c:1.5 --- xc/programs/rstart/auth.c:1.4 Wed Jan 17 18:45:03 2001 +++ xc/programs/rstart/auth.c Wed Jul 25 11:05:15 2001 @@ -23,16 +23,12 @@ /* 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.4 2001/01/17 23:45:03 dawes Exp $ */ +/* $XFree86: xc/programs/rstart/auth.c,v 1.5 2001/07/25 15:05:15 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> #include <errno.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern int errno; -#endif #include <ctype.h> #include <sys/types.h> #include <sys/wait.h> Index: xc/programs/rstart/client.cpp diff -u xc/programs/rstart/client.cpp:1.1.1.2 xc/programs/rstart/client.cpp:1.2 --- xc/programs/rstart/client.cpp:1.1.1.2 Tue Jan 16 17:46:49 2001 +++ xc/programs/rstart/client.cpp Mon Dec 17 23:24:00 2001 @@ -1,5 +1,5 @@ XCOMM! /bin/sh -XCOMM $Xorg: client.cpp,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ +XCOMM $Xorg: client.cpp,v 1.4 2000/12/20 16:41:43 pookie Exp $ XCOMM XCOMM Copyright (c) 1993 Quarterdeck Office Systems @@ -24,6 +24,28 @@ 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. +usage() { + if [ -n "$1" ] + then + echo "`basename $0`: $1" + fi + + echo "" + echo "Usage: `basename $0` [options] hostname command args ..." + echo "" + echo "where options include:" + echo " -c context run command in the specified context" + echo " -g interpret command as a generic command" + echo " -l username run command as the specified user" + echo " -v enable verbose output" + exit 1 +} + +if [ $# -eq 0 ] +then + usage +fi + context=X verbose=DETACH name= @@ -33,6 +55,11 @@ do case $1 in -c) + if [ $# -lt 2 ] + then + usage "-c option requires an argument" + fi + context=$2 shift; shift ;; @@ -41,6 +68,11 @@ shift ;; -l) + if [ $# -lt 2 ] + then + usage "-l option requires an argument" + fi + name="-l $2" shift; shift ;; @@ -49,6 +81,11 @@ shift ;; *) + if [ $# -eq 0 ] + then + usage "missing host name" + fi + host=$1 shift break @@ -56,6 +93,11 @@ esac done +if [ $# -eq 0 ] +then + usage "missing command" +fi + case $verbose in DETACH) exec > /dev/null @@ -63,7 +105,7 @@ esac case "$DISPLAY" in -:*) disp="`hostname`$DISPLAY" +:*) disp="`uname -n`$DISPLAY" echo expanded $DISPLAY to $disp ;; *) disp="$DISPLAY" Index: xc/programs/rstart/server.c diff -u xc/programs/rstart/server.c:1.4 xc/programs/rstart/server.c:1.5 --- xc/programs/rstart/server.c:1.4 Wed Jan 17 18:45:03 2001 +++ xc/programs/rstart/server.c Wed Jul 25 11:05:15 2001 @@ -23,20 +23,14 @@ /* 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.4 2001/01/17 23:45:03 dawes Exp $ */ +/* $XFree86: xc/programs/rstart/server.c,v 1.5 2001/07/25 15:05:15 dawes Exp $ */ /* Extended rsh "helper" program */ #include <stdio.h> #include <ctype.h> #include <X11/Xos.h> #include <errno.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern int errno; -extern void *malloc(); -extern char *getenv(); -#endif #include <sys/stat.h> #ifdef ODT1_DISPLAY_HACK Index: xc/programs/scripts/xon.man diff -u xc/programs/scripts/xon.man:1.6 xc/programs/scripts/xon.man:1.7 --- xc/programs/scripts/xon.man:1.6 Sat Jan 27 13:21:05 2001 +++ xc/programs/scripts/xon.man Fri Dec 14 15:01:04 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xon.man,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ +.\" $Xorg: xon.man,v 1.4 2001/02/09 02:05:35 xorgcvs Exp $ .\" Copyright 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" dealing in this Software without prior written authorization from the .\" The Open Group. .\" -.\" $XFree86: xc/programs/scripts/xon.man,v 1.6 2001/01/27 18:21:05 dawes Exp $ +.\" $XFree86: xc/programs/scripts/xon.man,v 1.7 2001/12/14 20:01:04 dawes Exp $ .\" .TH XON 1 __xorgversion__ .SH NAME Index: xc/programs/scripts/xon.sh diff -u xc/programs/scripts/xon.sh:1.3 xc/programs/scripts/xon.sh:1.5 --- xc/programs/scripts/xon.sh:1.3 Wed Jan 17 18:45:04 2001 +++ xc/programs/scripts/xon.sh Mon Jan 7 17:00:32 2002 @@ -1,14 +1,31 @@ #!/bin/sh -# $Xorg: xon.sh,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ +# $Xorg: xon.sh,v 1.4 2000/12/20 16:50:07 pookie Exp $ # start up xterm (or any other X command) on the specified host # Usage: xon host [arguments] [command] -case $# in -0) - echo "Usage: $0 <hostname> [-user user] [-name window-name] [-debug]" - echo "[-screen screen-number] [command ...]" - exit 1 - ;; -esac + +usage() { + if [ -n "$1" ] + then + echo "`basename $0`: $1" + fi + echo "" + echo "Usage: `basename $0` hostname [options] [command ...]" + echo "" + echo "where options include:" + echo " -access add remote host to local host access list" + echo " -debug enable error messages from remote execution" + echo " -name name set alternate application name and window title" + echo " -nols do not pass -ls option to remote xterm" + echo " -screen screen change remote screen number to specified screen" + echo " -user user run remote command as the specified user" + exit 1 +} + +if [ $# -eq 0 ] +then + usage +fi + target=$1 shift label=$target @@ -33,7 +50,7 @@ fullname=`hostname -f` ;; *) - fullname=`hostname` + fullname=`uname -n` ;; esac hostname=`echo $fullname | sed 's/\..*$//'` @@ -64,6 +81,12 @@ case $1 in -user) shift + + if [ $# -eq 0 ] + then + usage "-user option requires an argument" + fi + username="-l $1" label="$target $1" rcmd="$rsh $target $username -n" @@ -87,6 +110,12 @@ ;; -name) shift + + if [ $# -eq 0 ] + then + usage "-name option requires an argument" + fi + label="$1" resource="$1" shift @@ -101,6 +130,12 @@ ;; -screen) shift + + if [ $# -eq 0 ] + then + usage "-screen option requires an argument" + fi + DISPLAY=`echo $DISPLAY | sed 's/:\\([0-9][0-9]*\\)\\.[0-9]/:\1/'`.$1 shift ;; @@ -123,7 +158,7 @@ sess_mangr="SESSION_MANAGER=$SESSION_MANAGER " ;; esac -vars="$xpath$xauth$sess_mangr"DISPLAY="$DISPLAY" +vars='PATH=$PATH:/usr/X11R6/bin '"$xpath$xauth$sess_mangr"DISPLAY="$DISPLAY" case $# in 0) $rcmd 'sh -c '"'$vars"' xterm '$ls' -name "'"$resource"'" -T "'"$label"'" -n "'"$label"'" '"$redirect'" Index: xc/programs/setxkbmap/setxkbmap.c diff -u xc/programs/setxkbmap/setxkbmap.c:3.5 xc/programs/setxkbmap/setxkbmap.c:3.6 --- xc/programs/setxkbmap/setxkbmap.c:3.5 Tue May 8 18:05:17 2001 +++ xc/programs/setxkbmap/setxkbmap.c Fri Aug 17 11:39:50 2001 @@ -23,7 +23,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/setxkbmap/setxkbmap.c,v 3.5 2001/05/08 22:05:17 paulo Exp $ */ +/* $XFree86: xc/programs/setxkbmap/setxkbmap.c,v 3.6 2001/08/17 15:39:50 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -392,10 +392,10 @@ else if (streq(argv[i],"-model")) ok= setOptString(&i,argc,argv,MODEL_NDX,FROM_CMD_LINE); else if (streq(argv[i],"-option")) { - if ((i>=argc-1)||(argv[i+1][0]=='\0')||(argv[i+1][0]=='-')) { + 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') + if (i<argc-1 && argv[i+1][0]=='\0') i++; } else { Index: xc/programs/showfont/Imakefile diff -u xc/programs/showfont/Imakefile:1.2 xc/programs/showfont/Imakefile:1.3 --- xc/programs/showfont/Imakefile:1.2 Mon Feb 14 15:24:46 2000 +++ xc/programs/showfont/Imakefile Mon Aug 27 13:41:01 2001 @@ -1,10 +1,9 @@ XCOMM $XConsortium: Imakefile,v 1.8 94/06/09 17:23:09 gildea Exp $ -XCOMM $XFree86: xc/programs/showfont/Imakefile,v 1.2 2000/02/14 20:24:46 dawes Exp $ +XCOMM $XFree86: xc/programs/showfont/Imakefile,v 1.3 2001/08/27 17:41:01 dawes Exp $ LOCAL_LIBRARIES = $(FSLIB) DEPLIBS = $(DEPFSLIB) SRCS = showfont.c OBJS = showfont.o -INCLUDES = $(TOP_INCLUDES)/X11/fonts ComplexProgramTarget(showfont) Index: xc/programs/showfont/showfont.c diff -u xc/programs/showfont/showfont.c:1.3 xc/programs/showfont/showfont.c:1.4 --- xc/programs/showfont/showfont.c:1.3 Fri Feb 18 07:20:17 2000 +++ xc/programs/showfont/showfont.c Mon Aug 27 13:41:01 2001 @@ -1,5 +1,4 @@ /* $XConsortium: showfont.c,v 1.13 94/04/17 20:44:07 gildea Exp $ */ -/* $XFree86: xc/programs/showfont/showfont.c,v 1.3 2000/02/18 12:20:17 tsi Exp $ */ /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation and the @@ -50,11 +49,13 @@ from the X Consortium. */ +/* $XFree86: xc/programs/showfont/showfont.c,v 1.4 2001/08/27 17:41:01 dawes Exp $ */ + #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> -#include "FSlib.h" +#include <X11/fonts/FSlib.h> /* * the equivalent of showsnf @@ -84,7 +85,7 @@ int bitmap_format; static FSBitmapFormat -make_format() +make_format(void) { FSBitmapFormat format; @@ -148,21 +149,20 @@ return format; } -void -show_char_info(ci) - FSXCharInfo *ci; +static void +show_char_info(FSXCharInfo *ci) { printf("Left: %-3d Right: %-3d Ascent: %-3d Descent: %-3d Width: %d\n", ci->left, ci->right, ci->ascent, ci->descent, ci->width); } -void -show_glyphs(fid, hdr, show_all, first, last) - Font fid; - FSXFontInfoHeader *hdr; - Bool show_all; +static void +show_glyphs( + Font fid, + FSXFontInfoHeader *hdr, + Bool show_all, FSChar2b first, - last; + FSChar2b last) { FSXCharInfo *extents; int err, @@ -271,11 +271,11 @@ } } -void -show_props(pi, po, pd) - FSPropInfo *pi; - FSPropOffset *po; - unsigned char *pd; +static void +show_props( + FSPropInfo *pi, + FSPropOffset *po, + unsigned char *pd) { int i; char buf[512]; @@ -305,12 +305,12 @@ } } -void -show_info(fid, hdr, first, last) - Font fid; - FSXFontInfoHeader *hdr; +static void +show_info( + Font fid, + FSXFontInfoHeader *hdr, FSChar2b *first, - *last; + FSChar2b *last) { FSPropInfo pi; FSPropOffset *po; @@ -342,16 +342,14 @@ } static void -usage() +usage(void) { printf("%s: [-server servername] [-extents_only] [-noprops] [-lsb] [-msb] [-LSB] [-MSB] [-unit #] [-pad #] [-bitmap_pad value] [-start first_char] [-end last_char] -fn fontname\n", ProgramName); exit(0); } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char *servername = "localhost:7100"; /* -server: font server name */ char *fontname = NULL; /* -fn: font name */ Index: xc/programs/smproxy/save.c diff -u xc/programs/smproxy/save.c:1.7 xc/programs/smproxy/save.c:1.8 --- xc/programs/smproxy/save.c:1.7 Wed Jan 17 18:45:04 2001 +++ xc/programs/smproxy/save.c Fri Dec 14 15:01:05 2001 @@ -1,9 +1,13 @@ -/* $Xorg: save.c,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ */ +/* $Xorg: save.c,v 1.4 2001/02/09 02:05:35 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/smproxy/save.c,v 1.7 2001/01/17 23:45:04 dawes Exp $ */ +/* $XFree86: xc/programs/smproxy/save.c,v 1.8 2001/12/14 20:01:05 dawes Exp $ */ #include "smproxy.h" #ifdef HAS_MKSTEMP Index: xc/programs/smproxy/smproxy.c diff -u xc/programs/smproxy/smproxy.c:3.6 xc/programs/smproxy/smproxy.c:3.9 --- xc/programs/smproxy/smproxy.c:3.6 Wed Jan 17 18:45:05 2001 +++ xc/programs/smproxy/smproxy.c Fri Dec 14 15:01:05 2001 @@ -1,9 +1,13 @@ -/* $Xorg: smproxy.c,v 1.5 2000/08/17 19:54:05 cpqbld Exp $ */ +/* $Xorg: smproxy.c,v 1.6 2001/02/09 02:05:35 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/smproxy/smproxy.c,v 3.6 2001/01/17 23:45:05 dawes Exp $ */ +/* $XFree86: xc/programs/smproxy/smproxy.c,v 3.9 2001/12/14 20:01:05 dawes Exp $ */ #include "smproxy.h" #include <unistd.h> @@ -269,7 +273,7 @@ prop1val.value = (SmPointer) winInfo->wm_command[0]; prop1val.length = strlen (winInfo->wm_command[0]); - sprintf (userId, "%d", getuid()); + sprintf (userId, "%ld", (long)getuid()); prop2.name = SmUserID; prop2.type = SmARRAY8; prop2.num_vals = 1; @@ -572,6 +576,7 @@ +int MyErrorHandler (display, event) Display *display; @@ -977,7 +982,7 @@ prop1val.value = Argv[0]; prop1val.length = strlen (Argv[0]); - sprintf (userId, "%d", getuid()); + sprintf (userId, "%ld", (long)getuid()); prop2.name = SmUserID; prop2.type = SmARRAY8; prop2.num_vals = 1; Index: xc/programs/smproxy/smproxy.h diff -u xc/programs/smproxy/smproxy.h:1.4 xc/programs/smproxy/smproxy.h:1.6 --- xc/programs/smproxy/smproxy.h:1.4 Wed Jan 17 18:45:05 2001 +++ xc/programs/smproxy/smproxy.h Fri Dec 14 15:01:05 2001 @@ -1,9 +1,13 @@ -/* $Xorg: smproxy.h,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ */ +/* $Xorg: smproxy.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/smproxy/smproxy.h,v 1.4 2001/01/17 23:45:05 dawes Exp $ */ +/* $XFree86: xc/programs/smproxy/smproxy.h,v 1.6 2001/12/14 20:01:05 dawes Exp $ */ #include <X11/Xosdefs.h> #include <X11/Xfuncs.h> @@ -39,13 +43,7 @@ #else #include <stdio.h> #endif - -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern char *malloc(), *calloc(), *realloc(), *getenv(); -extern void free(); -#endif #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE Index: xc/programs/smproxy/smproxy.man diff -u xc/programs/smproxy/smproxy.man:1.6 xc/programs/smproxy/smproxy.man:1.7 --- xc/programs/smproxy/smproxy.man:1.6 Sat Jan 27 13:21:06 2001 +++ xc/programs/smproxy/smproxy.man Fri Dec 14 15:01:05 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: smproxy.man,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ +.\" $Xorg: smproxy.man,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ .\" Copyright 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/smproxy/smproxy.man,v 1.6 2001/01/27 18:21:06 dawes Exp $ +.\" $XFree86: xc/programs/smproxy/smproxy.man,v 1.7 2001/12/14 20:01:05 dawes Exp $ .\" .TH XSM 1 __xorgversion__ .SH NAME Index: xc/programs/texteroids/texteroids.c diff -u xc/programs/texteroids/texteroids.c:1.4 xc/programs/texteroids/texteroids.c:1.5 --- xc/programs/texteroids/texteroids.c:1.4 Sun Apr 1 10:00:18 2001 +++ xc/programs/texteroids/texteroids.c Tue Jul 31 20:45:02 2001 @@ -34,7 +34,7 @@ * * Author: Adobe Systems Incorporated */ -/* $XFree86: xc/programs/texteroids/texteroids.c,v 1.4 2001/04/01 14:00:18 tsi Exp $ */ +/* $XFree86: xc/programs/texteroids/texteroids.c,v 1.5 2001/08/01 00:45:02 tsi Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -45,8 +45,15 @@ #include <stdlib.h> #include "twraps.h" -int CheckForAHit(), ExplodeString(); -void PrepareSubject(), DrawSubject(), UpdatePosition(); +static int CheckForAHit(int angle); +static int ExplodeString(String str, int angle, int n); +static void PrepareSubject(int i, String str, float initx, float inity, + float llx, float lly, float urx, float ury); +static void DrawSubject(int i, int angle); +static void UpdatePosition(int i, int angle); +static void PrepareExplodedArrays(char *str, int n); +static void SyncAndCheck(int angle); +static void CreateRegionForClipping(Region reg, int angle); #undef PI #define PI 3.14159 @@ -367,8 +374,10 @@ float *llx, *lly, *urx, *ury, *altwidths; +static void PrepareExplodedArrays(str, n) char *str; + int n; { char *altstr = (char *) XtNewString(str); int i, texti; @@ -391,7 +400,8 @@ XtFree(altstr); } -int ExplodeString(str, angle, n) +static int +ExplodeString(str, angle, n) String str; int angle, n; { @@ -453,11 +463,13 @@ return num; } -void PrepareSubject(i, str, initx, inity, llx, lly, urx, ury) - int i; - String str; - float initx, inity; - float llx, lly, urx, ury; +static void +PrepareSubject( + int i, + String str, + float initx, float inity, + float llx, float lly, float urx, float ury +) { subject[i] = str; centerx[i] = initx; @@ -482,7 +494,8 @@ changing[i] = changing[0]; } -void DrawSubject(i, angle) +static void +DrawSubject(i, angle) int i, angle; { if (!live[i]) return; @@ -492,6 +505,7 @@ Region empty = NULL; +static void SyncAndCheck(angle) int angle; { @@ -553,7 +567,8 @@ } } -void UpdatePosition(i, angle) +static void +UpdatePosition(i, angle) int i, angle; { float incr; @@ -638,7 +653,8 @@ } } -int CheckForAHit(angle) +static int +CheckForAHit(angle) int angle; { int i; @@ -666,6 +682,7 @@ return -1; } +static void CreateRegionForClipping(reg, angle) Region reg; int angle; Index: xc/programs/twm/add_window.c diff -u xc/programs/twm/add_window.c:1.8 xc/programs/twm/add_window.c:1.10 --- xc/programs/twm/add_window.c:1.8 Wed Jan 17 18:45:05 2001 +++ xc/programs/twm/add_window.c Fri Dec 14 15:01:06 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/twm/add_window.c,v 1.8 2001/01/17 23:45:05 dawes Exp $ */ +/* $XFree86: xc/programs/twm/add_window.c,v 1.10 2001/12/14 20:01:06 dawes Exp $ */ /*****************************************************************************/ /* Copyright 1989,1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -49,7 +53,7 @@ /********************************************************************** * - * $Xorg: add_window.c,v 1.4 2000/08/17 19:54:05 cpqbld Exp $ + * $Xorg: add_window.c,v 1.5 2001/02/09 02:05:36 xorgcvs Exp $ * * Add a new window, put the titlbar and other stuff around * the window @@ -198,7 +202,8 @@ XGetWindowAttributes(dpy, tmp_win->w, &tmp_win->attr); - I18N_FetchName(dpy, tmp_win->w, &name); + if (!I18N_FetchName(dpy, tmp_win->w, &name)) + name = NULL; tmp_win->class = NoClass; XGetClassHint(dpy, tmp_win->w, &tmp_win->class); FetchWmProtocols (tmp_win); Index: xc/programs/twm/add_window.h diff -u xc/programs/twm/add_window.h:1.4 xc/programs/twm/add_window.h:1.6 --- xc/programs/twm/add_window.h:1.4 Wed Jan 17 18:45:05 2001 +++ xc/programs/twm/add_window.h Fri Dec 14 15:01:06 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.4 2001/01/17 23:45:05 dawes Exp $ */ +/* $XFree86: xc/programs/twm/add_window.h,v 1.6 2001/12/14 20:01:06 dawes Exp $ */ /********************************************************************** * - * $Xorg: add_window.h,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ + * $Xorg: add_window.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * AddWindow include file * @@ -66,8 +70,6 @@ extern void AddDefaultBindings ( void ); extern TwmWindow * AddWindow ( Window w, int iconm, IconMgr *iconp ); -extern void ComputeTitleLocation ( TwmWindow *tmp ); -extern void ComputeWindowTitleOffsets ( TwmWindow *tmp_win, int width, Bool squeeze ); extern ColormapWindow * CreateColormapWindow ( Window w, Bool creating_parent, Bool property_window ); extern TwmColormap * CreateTwmColormap ( Colormap c ); extern void FetchWmColormapWindows ( TwmWindow *tmp ); Index: xc/programs/twm/cursor.c diff -u xc/programs/twm/cursor.c:1.4 xc/programs/twm/cursor.c:1.5 --- xc/programs/twm/cursor.c:1.4 Wed Jan 17 18:45:05 2001 +++ xc/programs/twm/cursor.c Fri Dec 14 15:01:06 2001 @@ -2,7 +2,11 @@ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -18,11 +22,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.4 2001/01/17 23:45:05 dawes Exp $ */ +/* $XFree86: xc/programs/twm/cursor.c,v 1.5 2001/12/14 20:01:06 dawes Exp $ */ /*********************************************************************** * - * $Xorg: cursor.c,v 1.4 2000/08/17 19:54:05 cpqbld Exp $ + * $Xorg: cursor.c,v 1.5 2001/02/09 02:05:36 xorgcvs Exp $ * * cursor creation code * Index: xc/programs/twm/events.c diff -u xc/programs/twm/events.c:1.9 xc/programs/twm/events.c:1.12 --- xc/programs/twm/events.c:1.9 Mon Jan 22 16:32:37 2001 +++ xc/programs/twm/events.c Fri Dec 14 15:01:06 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/twm/events.c,v 1.9 2001/01/22 21:32:37 dawes Exp $ */ +/* $XFree86: xc/programs/twm/events.c,v 1.12 2001/12/14 20:01:06 dawes Exp $ */ /*****************************************************************************/ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -49,7 +53,7 @@ /*********************************************************************** * - * $Xorg: events.c,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ + * $Xorg: events.c,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * twm event handling * @@ -72,9 +76,6 @@ #include "icons.h" #include "version.h" -extern int iconifybox_width, iconifybox_height; -extern unsigned int mods_used; -extern int menuFromFrameOrWindowOrTitlebar; #define MAX_X_EVENT 256 event_proc EventHandler[MAX_X_EVENT]; /* event handler jump table */ @@ -100,10 +101,6 @@ int CurrentDragX; int CurrentDragY; -/* Vars to tell if the resize has moved. */ -extern int ResizeOrigX; -extern int ResizeOrigY; - static int enter_flag; static int ColortableThrashing; static TwmWindow *enter_win, *raise_win; @@ -120,8 +117,6 @@ int Cancel = FALSE; -extern int ShapeEventBase, ShapeErrorBase; - void AutoRaiseWindow (tmp) TwmWindow *tmp; { @@ -355,7 +350,7 @@ void HandleEvents() { - while (TRUE) + while (!TimeToYield) { if (enter_flag && !QLength(dpy)) { if (enter_win && enter_win != raise_win) { @@ -374,6 +369,12 @@ else XtDispatchEvent (&Event); } + if (dpy) + { + Reborder (CurrentTime); + XCloseDisplay(dpy); + } + exit(0); } Index: xc/programs/twm/events.h diff -u xc/programs/twm/events.h:1.4 xc/programs/twm/events.h:1.6 --- xc/programs/twm/events.h:1.4 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/events.h Fri Dec 14 15:01:07 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.4 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/events.h,v 1.6 2001/12/14 20:01:07 dawes Exp $ */ /*********************************************************************** * - * $Xorg: events.h,v 1.3 2000/08/17 19:54:06 cpqbld Exp $ + * $Xorg: events.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * twm event handler include file * @@ -118,6 +122,12 @@ extern int ButtonPressed; extern int Cancel; +extern int Context; + extern XEvent Event; + +extern unsigned int mods_used; + +extern int MovedFromKeyPress; #endif /* _EVENTS_ */ Index: xc/programs/twm/gc.c diff -u xc/programs/twm/gc.c:1.5 xc/programs/twm/gc.c:1.6 --- xc/programs/twm/gc.c:1.5 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/gc.c Fri Dec 14 15:01:07 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.5 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/gc.c,v 1.6 2001/12/14 20:01:07 dawes Exp $ */ /********************************************************************** * - * $Xorg: gc.c,v 1.3 2000/08/17 19:54:06 cpqbld Exp $ + * $Xorg: gc.c,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * Open the fonts and create the GCs * Index: xc/programs/twm/gc.h diff -u xc/programs/twm/gc.h:1.4 xc/programs/twm/gc.h:1.5 --- xc/programs/twm/gc.h:1.4 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/gc.h Fri Dec 14 15:01:07 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.4 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/gc.h,v 1.5 2001/12/14 20:01:07 dawes Exp $ */ /********************************************************************** * - * $Xorg: gc.h,v 1.3 2000/08/17 19:54:06 cpqbld Exp $ + * $Xorg: gc.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * GC related externs * Index: xc/programs/twm/gram.y diff -u xc/programs/twm/gram.y:3.5 xc/programs/twm/gram.y:3.6 --- xc/programs/twm/gram.y:3.5 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/gram.y Fri Dec 14 15:01:07 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -48,7 +52,7 @@ /*********************************************************************** * - * $Xorg: gram.y,v 1.3 2000/08/17 19:54:06 cpqbld Exp $ + * $Xorg: gram.y,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * .twmrc command grammer * @@ -56,7 +60,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.5 2001/01/17 23:45:06 dawes Exp $ + * $XFree86: xc/programs/twm/gram.y,v 3.6 2001/12/14 20:01:07 dawes Exp $ * ***********************************************************************/ Index: xc/programs/twm/iconmgr.c diff -u xc/programs/twm/iconmgr.c:1.5 xc/programs/twm/iconmgr.c:1.6 --- xc/programs/twm/iconmgr.c:1.5 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/iconmgr.c Fri Dec 14 15:01:08 2001 @@ -2,7 +2,11 @@ * Copyright 1989,1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -18,18 +22,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.5 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/iconmgr.c,v 1.6 2001/12/14 20:01:08 dawes Exp $ */ /*********************************************************************** * - * $Xorg: iconmgr.c,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: iconmgr.c,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * Icon Manager routines * * 09-Mar-89 Tom LaStrange File Created * ***********************************************************************/ -/* $XFree86: xc/programs/twm/iconmgr.c,v 1.5 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/iconmgr.c,v 1.6 2001/12/14 20:01:08 dawes Exp $ */ #include <stdio.h> #include "twm.h" Index: xc/programs/twm/iconmgr.h diff -u xc/programs/twm/iconmgr.h:1.4 xc/programs/twm/iconmgr.h:1.6 --- xc/programs/twm/iconmgr.h:1.4 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/iconmgr.h Fri Dec 14 15:01:08 2001 @@ -2,7 +2,11 @@ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -18,11 +22,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.4 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/iconmgr.h,v 1.6 2001/12/14 20:01:08 dawes Exp $ */ /*********************************************************************** * - * $Xorg: iconmgr.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: iconmgr.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * Icon Manager includes * @@ -71,6 +75,7 @@ extern int iconmgr_textx; extern WList *DownIconManager; +extern int iconifybox_width, iconifybox_height; extern void ActiveIconManager ( WList *active ); extern WList *AddIconManager ( TwmWindow *tmp_win ); Index: xc/programs/twm/icons.c diff -u xc/programs/twm/icons.c:1.5 xc/programs/twm/icons.c:1.6 --- xc/programs/twm/icons.c:1.5 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/icons.c Fri Dec 14 15:01:08 2001 @@ -2,7 +2,11 @@ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -18,11 +22,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.5 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/icons.c,v 1.6 2001/12/14 20:01:08 dawes Exp $ */ /********************************************************************** * - * $Xorg: icons.c,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: icons.c,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * Icon releated routines * Index: xc/programs/twm/icons.h diff -u xc/programs/twm/icons.h:1.4 xc/programs/twm/icons.h:1.5 --- xc/programs/twm/icons.h:1.4 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/icons.h Fri Dec 14 15:01:08 2001 @@ -2,7 +2,11 @@ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -18,11 +22,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.4 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/icons.h,v 1.5 2001/12/14 20:01:08 dawes Exp $ */ /********************************************************************** * - * $Xorg: icons.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: icons.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * Icon releated definitions * Index: xc/programs/twm/lex.l diff -u xc/programs/twm/lex.l:3.12 xc/programs/twm/lex.l:3.14 --- xc/programs/twm/lex.l:3.12 Wed Jan 17 18:45:06 2001 +++ xc/programs/twm/lex.l Fri Dec 14 15:01:08 2001 @@ -4,7 +4,11 @@ Copyright 1989,1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -48,23 +52,21 @@ /*********************************************************************** * - * $Xorg: lex.l,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: lex.l,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * .twmrc lex file * * 12-Nov-87 Thomas E. LaStrange File created * ***********************************************************************/ -/* $XFree86: xc/programs/twm/lex.l,v 3.12 2001/01/17 23:45:06 dawes Exp $ */ +/* $XFree86: xc/programs/twm/lex.l,v 3.14 2001/12/14 20:01:08 dawes Exp $ */ /* #include <stdio.h> */ /* lex already includes stdio.h */ #include "twm.h" #include "gram.h" #include "list.h" #include "parse.h" -extern char *ProgramName; -extern int ParseError; #ifdef FLEX_SCANNER int yylineno; Index: xc/programs/twm/list.c diff -u xc/programs/twm/list.c:1.4 xc/programs/twm/list.c:1.5 --- xc/programs/twm/list.c:1.4 Wed Jan 17 18:45:07 2001 +++ xc/programs/twm/list.c Fri Dec 14 15:01:08 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.4 2001/01/17 23:45:07 dawes Exp $ */ +/* $XFree86: xc/programs/twm/list.c,v 1.5 2001/12/14 20:01:08 dawes Exp $ */ /********************************************************************** * - * $Xorg: list.c,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: list.c,v 1.4 2001/02/09 02:05:36 xorgcvs 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.4 xc/programs/twm/list.h:1.5 --- xc/programs/twm/list.h:1.4 Wed Jan 17 18:45:07 2001 +++ xc/programs/twm/list.h Fri Dec 14 15:01:08 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.4 2001/01/17 23:45:07 dawes Exp $ */ +/* $XFree86: xc/programs/twm/list.h,v 1.5 2001/12/14 20:01:08 dawes Exp $ */ /********************************************************************** * - * $Xorg: list.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: list.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ * * TWM list handling external definitions * Index: xc/programs/twm/menus.c diff -u xc/programs/twm/menus.c:1.9 xc/programs/twm/menus.c:1.12 --- xc/programs/twm/menus.c:1.9 Wed Jan 17 18:45:07 2001 +++ xc/programs/twm/menus.c Fri Dec 14 15:01:09 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/twm/menus.c,v 1.9 2001/01/17 23:45:07 dawes Exp $ */ +/* $XFree86: xc/programs/twm/menus.c,v 1.12 2001/12/14 20:01:09 dawes Exp $ */ /*****************************************************************************/ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -49,7 +53,7 @@ /*********************************************************************** * - * $Xorg: menus.c,v 1.5 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: menus.c,v 1.6 2001/02/09 02:05:36 xorgcvs Exp $ * * twm menu code * @@ -78,8 +82,6 @@ #include <X11/extensions/sync.h> #include <X11/SM/SMlib.h> -extern XEvent Event; - int RootFunction = 0; MenuRoot *ActiveMenu = NULL; /* the active menu */ MenuItem *ActiveItem = NULL; /* the active menu item */ @@ -108,13 +110,6 @@ } MenuOrigins[MAXMENUDEPTH]; static Cursor LastCursor; - -extern char *Action; -extern int Context; -extern TwmWindow *ButtonWindow, *Tmp_win; -extern XEvent Event, ButtonEvent; -extern char *InitFile; - static Bool belongs_to_twm_window ( TwmWindow *t, Window w ); static void Identify ( TwmWindow *t ); static void send_clientmessage ( Window w, Atom a, Time timestamp ); @@ -1236,11 +1231,6 @@ */ -extern int AddingX; -extern int AddingY; -extern int AddingW; -extern int AddingH; - void resizeFromCenter(w, tmp_win) Window w; @@ -1367,7 +1357,6 @@ return false; } -extern int MovedFromKeyPress; int ExecuteFunction(func, action, w, tmp_win, eventp, context, pulldown) @@ -2325,6 +2314,11 @@ (void)XSyncSetPriority(dpy, tmp_win->w, atoi(action)); } break; + case F_STARTWM: + execlp("/bin/sh", "sh", "-c", action, NULL); + fprintf (stderr, "%s: unable to start: %s\n", ProgramName, *Argv); + break; + } if (ButtonPressed == -1) XUngrabPointer(dpy, CurrentTime); Index: xc/programs/twm/menus.h diff -u xc/programs/twm/menus.h:1.4 xc/programs/twm/menus.h:1.6 --- xc/programs/twm/menus.h:1.4 Wed Jan 17 18:45:07 2001 +++ xc/programs/twm/menus.h Fri Dec 14 15:01:09 2001 @@ -3,7 +3,11 @@ Copyright 1989,1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.4 2001/01/17 23:45:07 dawes Exp $ */ +/* $XFree86: xc/programs/twm/menus.h,v 1.6 2001/12/14 20:01:09 dawes Exp $ */ /*********************************************************************** * - * $Xorg: menus.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: menus.h,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ * * twm menus include file * @@ -144,6 +148,9 @@ extern int ConstMoveXR; extern int ConstMoveYT; extern int ConstMoveYB; +extern int menuFromFrameOrWindowOrTitlebar; +extern int ResizeOrigX; +extern int ResizeOrigY; #define MAXMENUDEPTH 10 /* max number of nested menus */ extern int MenuDepth; @@ -185,7 +192,6 @@ extern void DeIconify ( TwmWindow *tmp_win ); extern void Iconify ( TwmWindow *tmp_win, int def_x, int def_y ); extern void SetMapStateProp ( TwmWindow *tmp_win, int state ); -extern Bool GetWMState ( Window w, int *statep, Window *iwp ); extern void WarpToScreen ( int n, int inc ); extern void BumpWindowColormap ( TwmWindow *tmp, int inc ); extern void HideIconManager ( void ); Index: xc/programs/twm/parse.c diff -u xc/programs/twm/parse.c:1.9 xc/programs/twm/parse.c:1.12 --- xc/programs/twm/parse.c:1.9 Mon Apr 23 16:31:08 2001 +++ xc/programs/twm/parse.c Fri Dec 14 15:01:09 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/twm/parse.c,v 1.9 2001/04/23 20:31:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/parse.c,v 1.12 2001/12/14 20:01:09 dawes Exp $ */ /*****************************************************************************/ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -49,7 +53,7 @@ /*********************************************************************** * - * $Xorg: parse.c,v 1.4 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: parse.c,v 1.5 2001/02/09 02:05:37 xorgcvs Exp $ * * parse the .twmrc file * @@ -88,15 +92,12 @@ static int ParseUsePPosition ( char *s ); extern int yylineno; -extern int mods; int ConstrainedMoveTime = 400; /* milliseconds, event times */ int (*twmInputFunc)(void); -extern char *defTwmrc[]; /* default bindings */ - /*********************************************************************** * * Procedure: @@ -492,6 +493,7 @@ { "f.showiconmgr", FKEYWORD, F_SHOWLIST }, { "f.sorticonmgr", FKEYWORD, F_SORTICONMGR }, { "f.source", FSKEYWORD, F_BEEP }, /* XXX - don't work */ + { "f.startwm", FSKEYWORD, F_STARTWM }, { "f.title", FKEYWORD, F_TITLE }, { "f.topzoom", FKEYWORD, F_TOPZOOM }, { "f.twmrc", FKEYWORD, F_RESTART }, Index: xc/programs/twm/parse.h diff -u xc/programs/twm/parse.h:1.8 xc/programs/twm/parse.h:1.11 --- xc/programs/twm/parse.h:1.8 Wed Jan 17 18:45:07 2001 +++ xc/programs/twm/parse.h Fri Dec 14 15:01:09 2001 @@ -1,10 +1,14 @@ -/* $XFree86: xc/programs/twm/parse.h,v 1.8 2001/01/17 23:45:07 dawes Exp $ */ +/* $XFree86: xc/programs/twm/parse.h,v 1.11 2001/12/14 20:01:09 dawes Exp $ */ /*****************************************************************************/ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -49,7 +53,7 @@ /********************************************************************** * - * $Xorg: parse.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: parse.h,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ * * .twmrc parsing externs * @@ -83,6 +87,8 @@ extern int (*twmInputFunc)(void); extern int ConstrainedMoveTime; +extern char *defTwmrc[]; +extern int mods; #define F_NOP 0 #define F_BEEP 1 @@ -144,6 +150,7 @@ #define F_WARPTOSCREEN 109 /* string */ #define F_COLORMAP 110 /* string */ #define F_PRIORITY 111 /* string */ +#define F_STARTWM 114 /* string */ #define D_NORTH 1 #define D_SOUTH 2 Index: xc/programs/twm/resize.c diff -u xc/programs/twm/resize.c:1.7 xc/programs/twm/resize.c:1.8 --- xc/programs/twm/resize.c:1.7 Wed Jan 17 18:45:07 2001 +++ xc/programs/twm/resize.c Fri Dec 14 15:01:09 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -48,7 +52,7 @@ /*********************************************************************** * - * $Xorg: resize.c,v 1.4 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: resize.c,v 1.5 2001/02/09 02:05:37 xorgcvs Exp $ * * window resizing borrowed from the "wm" window manager * @@ -56,7 +60,7 @@ * ***********************************************************************/ -/* $XFree86: xc/programs/twm/resize.c,v 1.7 2001/01/17 23:45:07 dawes Exp $ */ +/* $XFree86: xc/programs/twm/resize.c,v 1.8 2001/12/14 20:01:09 dawes Exp $ */ #include <stdio.h> #include "twm.h" Index: xc/programs/twm/resize.h diff -u xc/programs/twm/resize.h:1.4 xc/programs/twm/resize.h:1.5 --- xc/programs/twm/resize.h:1.4 Wed Jan 17 18:45:08 2001 +++ xc/programs/twm/resize.h Fri Dec 14 15:01:10 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.4 2001/01/17 23:45:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/resize.h,v 1.5 2001/12/14 20:01:10 dawes Exp $ */ /********************************************************************** * - * $Xorg: resize.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: resize.h,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ * * resize function externs * Index: xc/programs/twm/screen.h diff -u xc/programs/twm/screen.h:1.4 xc/programs/twm/screen.h:1.5 --- xc/programs/twm/screen.h:1.4 Wed Jan 17 18:45:08 2001 +++ xc/programs/twm/screen.h Fri Dec 14 15:01:10 2001 @@ -2,7 +2,11 @@ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,14 +25,14 @@ /*********************************************************************** * - * $Xorg: screen.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ + * $Xorg: screen.h,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ * * twm per-screen data include file * * 11-3-88 Dave Payne, Apple Computer File created * ***********************************************************************/ -/* $XFree86: xc/programs/twm/screen.h,v 1.4 2001/01/17 23:45:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/screen.h,v 1.5 2001/12/14 20:01:10 dawes Exp $ */ #ifndef _SCREEN_ #define _SCREEN_ Index: xc/programs/twm/session.c diff -u xc/programs/twm/session.c:3.6 xc/programs/twm/session.c:3.8 --- xc/programs/twm/session.c:3.6 Wed Jan 17 18:45:08 2001 +++ xc/programs/twm/session.c Fri Dec 14 15:01:10 2001 @@ -1,9 +1,13 @@ -/* $Xorg: session.c,v 1.4 2000/08/17 19:54:07 cpqbld Exp $ */ +/* $Xorg: session.c,v 1.5 2001/02/09 02:05:37 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/twm/session.c,v 3.6 2001/01/17 23:45:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/session.c,v 3.8 2001/12/14 20:01:10 dawes Exp $ */ #include <X11/Xos.h> @@ -796,7 +800,7 @@ prop1val.value = Argv[0]; prop1val.length = strlen (Argv[0]); - sprintf (userId, "%d", getuid()); + sprintf (userId, "%ld", (long)getuid()); prop2.name = SmUserID; prop2.type = SmARRAY8; prop2.num_vals = 1; Index: xc/programs/twm/twm.c diff -u xc/programs/twm/twm.c:3.7 xc/programs/twm/twm.c:3.12 --- xc/programs/twm/twm.c:3.7 Wed Jan 17 18:45:08 2001 +++ xc/programs/twm/twm.c Fri Dec 14 15:01:10 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -48,14 +52,14 @@ /*********************************************************************** * - * $Xorg: twm.c,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ + * $Xorg: twm.c,v 1.5 2001/02/09 02:05:37 xorgcvs 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.7 2001/01/17 23:45:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/twm.c,v 3.12 2001/12/14 20:01:10 dawes Exp $ */ #include <stdio.h> #include <signal.h> @@ -95,6 +99,7 @@ ScreenInfo *Scr = NULL; /* the cur and prev screens */ int PreviousScreen; /* last screen that we were on */ int FirstScreen; /* TRUE ==> first screen of display */ +volatile Bool TimeToYield = FALSE; /* TRUE ==> exit requested */ Bool PrintErrorMessages = False; /* controls error messages */ static int RedirectError; /* TRUE ==> another window manager running */ static int TwmErrorHandler ( Display *dpy, XErrorEvent *event ); /* for settting RedirectError */ @@ -240,6 +245,19 @@ #undef newhandler Home = getenv("HOME"); + if (Home != NULL) { + char *temp_p; + + /* + * Make a copy of Home because the string returned by getenv() can be + * overwritten by some POSIX.1 and ANSI-C implementations of getenv() + * when further calls to getenv() are made + */ + + temp_p = strdup(Home); + Home = temp_p; + } + if (Home == NULL) Home = "./"; @@ -258,32 +276,12 @@ exit (1); } -#ifdef MINIX - { int flags; - if ((flags= fcntl(ConnectionNumber(dpy), F_GETFD)) == -1) - { - fprintf (stderr, - "%s: unable to mark display connection as close-on-exec\n", - ProgramName); - exit (1); - } - if (fcntl(ConnectionNumber(dpy), F_SETFD, - flags | FD_CLOEXEC) == -1) - { - fprintf (stderr, - "%s: unable to mark display connection as close-on-exec\n", - ProgramName); - exit (1); - } - } -#else if (fcntl(ConnectionNumber(dpy), F_SETFD, 1) == -1) { fprintf (stderr, "%s: unable to mark display connection as close-on-exec\n", ProgramName); exit (1); } -#endif if (restore_filename) ReadWinConfigFile (restore_filename); @@ -877,12 +875,7 @@ SIGNAL_T Done(int sig) { - if (dpy) - { - Reborder (CurrentTime); - XCloseDisplay(dpy); - } - exit(0); + TimeToYield = True; SIGNAL_RETURN; } Index: xc/programs/twm/twm.h diff -u xc/programs/twm/twm.h:3.6 xc/programs/twm/twm.h:3.12 --- xc/programs/twm/twm.h:3.6 Wed Jan 17 18:45:08 2001 +++ xc/programs/twm/twm.h Fri Dec 14 15:01:10 2001 @@ -26,7 +26,11 @@ Portions Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -49,21 +53,18 @@ /*********************************************************************** * - * $Xorg: twm.h,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ + * $Xorg: twm.h,v 1.4 2001/02/09 02:05:37 xorgcvs 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.6 2001/01/17 23:45:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/twm.h,v 3.12 2001/12/14 20:01:10 dawes Exp $ */ #ifndef _TWM_ #define _TWM_ -#ifdef MINIX -#include <X11/Xos.h> -#endif #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> @@ -346,12 +347,7 @@ #define TBPM_QUESTION ":question" /* name of unknown titlebar pixmap */ #include <X11/Xosdefs.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern char *malloc(), *calloc(), *realloc(), *getenv(); -extern void free(); -#endif extern void InitVariables ( void ); extern void CreateFonts ( void ); extern void RestoreWithdrawnLocation ( TwmWindow *tmp ); @@ -403,6 +399,7 @@ extern Pixmap CreateMenuIcon ( int height, unsigned int *widthp, unsigned int *heightp ); extern Bool ErrorOccurred; +extern volatile Bool TimeToYield; extern XErrorEvent LastErrorEvent; #define ResetError() (ErrorOccurred = False) @@ -421,6 +418,9 @@ extern Atom TwmAtoms[]; extern Bool use_fontset; + +extern int ShapeEventBase; +extern int ShapeErrorBase; #define _XA_MIT_PRIORITY_COLORS TwmAtoms[0] #define _XA_WM_CHANGE_STATE TwmAtoms[1] Index: xc/programs/twm/twm.man diff -u xc/programs/twm/twm.man:1.7 xc/programs/twm/twm.man:1.9 --- xc/programs/twm/twm.man:1.7 Sat Jan 27 13:21:06 2001 +++ xc/programs/twm/twm.man Fri Dec 14 15:01:10 2001 @@ -1,9 +1,13 @@ -.\" $Xorg: twm.man,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ +.\" $Xorg: twm.man,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" Portions copyright 1988 Evans & Sutherland Computer Corporation. .\" Portions copyright 1989 Hewlett-Packard Company .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ .\" 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 $ +.\" $XFree86: xc/programs/twm/twm.man,v 1.9 2001/12/14 20:01:10 dawes Exp $ .\" .de EX \"Begin example .ne 5 @@ -1095,8 +1099,10 @@ rubber band until the invoking button is released. To abort a resize, press another button before releasing the first button. .IP "\fBf.restart\fP" 8 - This function kills and restarts \fItwm\fP. +.IP "\fBf.startwm\fP \fIstring\fP" 8 +This function kills \fItwm\fP and starts another window manager, as +specified by \fIstring\fP. .IP "\fBf.righticonmgr\fI" 8 This function is similar to \fBf.nexticonmgr\fP except that wrapping does not change rows. Index: xc/programs/twm/util.c diff -u xc/programs/twm/util.c:1.8 xc/programs/twm/util.c:1.10 --- xc/programs/twm/util.c:1.8 Thu Apr 26 17:09:47 2001 +++ xc/programs/twm/util.c Fri Dec 14 15:01:11 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.8 2001/04/26 21:09:47 dawes Exp $ */ +/* $XFree86: xc/programs/twm/util.c,v 1.10 2001/12/14 20:01:11 dawes Exp $ */ /*********************************************************************** * - * $Xorg: util.c,v 1.4 2000/08/17 19:54:08 cpqbld Exp $ + * $Xorg: util.c,v 1.5 2001/02/09 02:05:37 xorgcvs Exp $ * * utility routines for twm * @@ -788,11 +792,17 @@ XTextProperty text_prop; char **list; int num; - + status = XGetWMName(dpy, w, &text_prop); - if (!status || !text_prop.value || !text_prop.nitems) return 0; + if (!status || !text_prop.value || !text_prop.nitems) { + *winname = NULL; + return 0; + } status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); - if (status < Success || !num || !*list) return 0; + if (status < Success || !num || !*list) { + *winname = NULL; + return 0; + } XFree(text_prop.value); *winname = (char *)strdup(*list); XFreeStringList(list); Index: xc/programs/twm/util.h diff -u xc/programs/twm/util.h:1.6 xc/programs/twm/util.h:1.7 --- xc/programs/twm/util.h:1.6 Wed Jan 17 18:45:08 2001 +++ xc/programs/twm/util.h Fri Dec 14 15:01:11 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,12 +48,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.6 2001/01/17 23:45:08 dawes Exp $ */ +/* $XFree86: xc/programs/twm/util.h,v 1.7 2001/12/14 20:01:11 dawes Exp $ */ /*********************************************************************** * - * $Xorg: util.h,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ + * $Xorg: util.h,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ * * utility routines header file * Index: xc/programs/twm/version.c diff -u xc/programs/twm/version.c:1.1.1.5 xc/programs/twm/version.c:1.2 --- xc/programs/twm/version.c:1.1.1.5 Tue Jan 16 17:47:24 2001 +++ xc/programs/twm/version.c Fri Dec 14 15:01:11 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -45,6 +49,6 @@ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $Xorg: version.c,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ */ +/* $Xorg: version.c,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ */ char *Version = "The Open Group, R6.3"; Index: xc/programs/twm/version.h diff -u xc/programs/twm/version.h:1.1.1.3 xc/programs/twm/version.h:1.2 --- xc/programs/twm/version.h:1.1.1.3 Tue Jan 16 17:47:24 2001 +++ xc/programs/twm/version.h Fri Dec 14 15:01:11 2001 @@ -3,7 +3,11 @@ Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -47,7 +51,7 @@ /********************************************************************** * - * $Xorg: version.h,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ + * $Xorg: version.h,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ * * TWM version externs * Index: xc/programs/x11perf/do_blt.c diff -u xc/programs/x11perf/do_blt.c:1.8 xc/programs/x11perf/do_blt.c:1.9 --- xc/programs/x11perf/do_blt.c:1.8 Tue May 1 12:19:16 2001 +++ xc/programs/x11perf/do_blt.c Sat Nov 3 16:59:20 2001 @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_blt.c,v 1.8 2001/05/01 16:19:16 alanh Exp $ */ +/* $XFree86: xc/programs/x11perf/do_blt.c,v 1.9 2001/11/03 21:59:20 dawes Exp $ */ #include "x11perf.h" #include <stdio.h> @@ -372,8 +372,18 @@ int image_size; if(!InitGetImage(xp, p, reps))return False; - if (!XShmQueryExtension(xp->d)) - return False; + if (!XShmQueryExtension(xp->d)) { + /* + * Clean up here because cleanup function is not called if this + * function fails + */ + if (image) + XDestroyImage(image); + image = NULL; + free(segsa); + free(segsb); + return False; + } XClearWindow(xp->d, xp->w); shm_image = *image; image_size = image->bytes_per_line * image->height; @@ -382,12 +392,30 @@ shm_info.shmid = shmget(IPC_PRIVATE, image_size, IPC_CREAT|0777); if (shm_info.shmid < 0) { + /* + * Clean up here because cleanup function is not called if this + * function fails + */ + if (image) + XDestroyImage(image); + image = NULL; + free(segsa); + free(segsb); perror ("shmget"); return False; } shm_info.shmaddr = (char *) shmat(shm_info.shmid, 0, 0); if (shm_info.shmaddr == ((char *) -1)) { + /* + * Clean up here because cleanup function is not called if this + * function fails + */ + if (image) + XDestroyImage(image); + image = NULL; + free(segsa); + free(segsb); perror ("shmat"); shmctl (shm_info.shmid, IPC_RMID, 0); return False; @@ -400,6 +428,15 @@ XSync(xp->d,True); /* wait for error or ok */ XSetErrorHandler(origerrorhandler); if(haderror){ + /* + * Clean up here because cleanup function is not called if this + * function fails + */ + if (image) + XDestroyImage(image); + image = NULL; + free(segsa); + free(segsb); if(shmdt (shm_info.shmaddr)==-1) perror("shmdt:"); if(shmctl (shm_info.shmid, IPC_RMID, 0)==-1) Index: xc/programs/x11perf/do_complex.c diff -u xc/programs/x11perf/do_complex.c:1.7 xc/programs/x11perf/do_complex.c:1.8 --- xc/programs/x11perf/do_complex.c:1.7 Wed May 9 05:12:22 2001 +++ xc/programs/x11perf/do_complex.c Wed Jul 25 11:05:16 2001 @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_complex.c,v 1.7 2001/05/09 09:12:22 alanh Exp $ */ +/* $XFree86: xc/programs/x11perf/do_complex.c,v 1.8 2001/07/25 15:05:16 dawes Exp $ */ #include "x11perf.h" @@ -30,20 +30,12 @@ static XPoint *points; static GC pgc; -#ifndef X_NOT_STDC_ENV #include <math.h> #if defined(QNX4) || defined(__CYGWIN__) #define PI 3.14159265358979323846 #else #define PI M_PI #endif /* QNX4 */ -#else -extern double sin(); -extern double cos(); -extern double tan(); -extern double sqrt(); -#define PI 3.14159265357989 -#endif int InitComplexPoly(XParms xp, Parms p, int reps) Index: xc/programs/x11perf/do_simple.c diff -u xc/programs/x11perf/do_simple.c:1.5 xc/programs/x11perf/do_simple.c:1.6 --- xc/programs/x11perf/do_simple.c:1.5 Wed Jan 17 18:45:12 2001 +++ xc/programs/x11perf/do_simple.c Sat Nov 3 16:59:20 2001 @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_simple.c,v 1.5 2001/01/17 23:45:12 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/do_simple.c,v 1.6 2001/11/03 21:59:20 dawes Exp $ */ #ifndef VMS #include <X11/Xatom.h> @@ -106,5 +106,6 @@ False, AnyPropertyType, &actual_type, &actual_format, &actual_length, &bytes_remaining, &prop); CheckAbort (); + XFree(prop); } } Index: xc/programs/x11perf/x11pcomp.man diff -u xc/programs/x11perf/x11pcomp.man:1.7 xc/programs/x11perf/x11pcomp.man:1.8 --- xc/programs/x11perf/x11pcomp.man:1.7 Sat Jan 27 13:21:07 2001 +++ xc/programs/x11perf/x11pcomp.man Fri Dec 14 15:01:14 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: x11pcomp.man,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ +.\" $Xorg: x11pcomp.man,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/x11perf/x11pcomp.man,v 1.7 2001/01/27 18:21:07 dawes Exp $ +.\" $XFree86: xc/programs/x11perf/x11pcomp.man,v 1.8 2001/12/14 20:01:14 dawes Exp $ .\" .TH X11PERFCOMP 1 __xorgversion__ .SH NAME Index: xc/programs/x11perf/x11perf.c diff -u xc/programs/x11perf/x11perf.c:3.4 xc/programs/x11perf/x11perf.c:3.7 --- xc/programs/x11perf/x11perf.c:3.4 Wed Jan 17 18:45:12 2001 +++ xc/programs/x11perf/x11perf.c Tue Nov 6 11:11:38 2001 @@ -21,7 +21,7 @@ SOFTWARE. ****************************************************************************/ -/* $XFree86: xc/programs/x11perf/x11perf.c,v 3.4 2001/01/17 23:45:12 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/x11perf.c,v 3.7 2001/11/06 16:11:38 alanh Exp $ */ #include <stdio.h> #include <ctype.h> @@ -36,14 +36,9 @@ #include "x11perf.h" #include <X11/Xmu/SysUtil.h> -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -#else #include <time.h> #define Time_t time_t #include <stdlib.h> -#endif /* Only for working on ``fake'' servers, for hardware that doesn't exist */ static Bool drawToFakeServer = False; @@ -650,6 +645,7 @@ (*test->proc) (xp, &test->parms, reps); HardwareSync(xp); usecs = ElapsedTime(syncTime); + (*test->passCleanup) (xp, &test->parms); (*test->cleanup) (xp, &test->parms); DestroyClipWindows(xp, test->clips); CheckAbort (); @@ -746,6 +742,8 @@ { XFreeGC(xp->d, xp->fggc); XFreeGC(xp->d, xp->bggc); + XFreeGC(xp->d, xp->ddfggc); + XFreeGC(xp->d, xp->ddbggc); } static unsigned long @@ -819,6 +817,8 @@ for (j = 0; j != repeat; j++) { DisplayStatus(xp->d, "Testing", label, j+1); time = DoTest(xp, test, reps); + if (abortTest) + AbortTest (); totalTime += time; ReportTimes (time, reps * test->parms.objects, label, False); @@ -838,24 +838,8 @@ DestroyPerfGCs(xp); } /* ProcessTest */ -#ifndef X_NOT_STDC_ENV #define Strstr strstr -#else -static char * -Strstr(char *s1, char *s2) -{ - int n1, n2; - n1 = strlen(s1); - n2 = strlen(s2); - for ( ; n1 >= n2; s1++, n1--) { - if (!strncmp(s1, s2, n2)) - return s1; - } - return NULL; -} -#endif - #define LABELP(i) (test[i].label14 && (xparms.version >= VERSION1_4) \ ? test[i].label14 : test[i].label) @@ -1327,12 +1311,17 @@ } /* if doit */ } /* ForEachTest */ + XFreeGC(xparms.d, tgc); XDestroyWindow(xparms.d, xparms.w); - + XFree(vinfolist); + if (drawToFakeServer) + XFreePixmap(xparms.d, tileToQuery); /* Restore ScreenSaver to original state. */ XSetScreenSaver(xparms.d, ssTimeout, ssInterval, ssPreferBlanking, ssAllowExposures); XCloseDisplay(xparms.d); + free(saveargv); + free(doit); exit(0); } Index: xc/programs/x11perf/x11perf.h diff -u xc/programs/x11perf/x11perf.h:3.3 xc/programs/x11perf/x11perf.h:3.4 --- xc/programs/x11perf/x11perf.h:3.3 Wed Jan 17 18:45:13 2001 +++ xc/programs/x11perf/x11perf.h Wed Jul 25 11:05:16 2001 @@ -21,13 +21,11 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/x11perf.h,v 3.3 2001/01/17 23:45:13 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/x11perf.h,v 3.4 2001/07/25 15:05:16 dawes Exp $ */ #ifndef VMS #include <X11/Xlib.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include <X11/Xutil.h> #else #include <decw$include/Xlib.h> @@ -35,10 +33,8 @@ #endif #if defined(XlibSpecificationRelease) && XlibSpecificationRelease >= 5 #include <X11/Xfuncs.h> -#endif -#ifndef NULL -#define NULL 0 #endif +#include <stddef.h> #define POLY 1000 /* # (small) items in poly calls */ #define MAXROWS 40 /* Max rows of items in poly calls */ Index: xc/programs/x11perf/x11perf.man diff -u xc/programs/x11perf/x11perf.man:1.7 xc/programs/x11perf/x11perf.man:1.8 --- xc/programs/x11perf/x11perf.man:1.7 Sat Jan 27 13:21:07 2001 +++ xc/programs/x11perf/x11perf.man Fri Dec 14 15:01:14 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: x11perf.man,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ +.\" $Xorg: x11perf.man,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ .\" Copyright 1988, 1989 Digital Equipment Corporation. .\" Copyright 1989, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/x11perf/x11perf.man,v 1.7 2001/01/27 18:21:07 dawes Exp $ +.\" $XFree86: xc/programs/x11perf/x11perf.man,v 1.8 2001/12/14 20:01:14 dawes Exp $ .\" .TH X11PERF 1 __xorgversion__ .SH NAME Index: xc/programs/xauth/gethost.c diff -u xc/programs/xauth/gethost.c:3.13 xc/programs/xauth/gethost.c:3.16 --- xc/programs/xauth/gethost.c:3.13 Wed Jan 17 18:45:14 2001 +++ xc/programs/xauth/gethost.c Fri Dec 14 15:01:14 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: gethost.c,v 1.4 2000/08/17 19:54:11 cpqbld Exp $ + * $Xorg: gethost.c,v 1.5 2001/02/09 02:05:38 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xauth/gethost.c,v 3.13 2001/01/17 23:45:14 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/gethost.c,v 3.16 2001/12/14 20:01:14 dawes Exp $ */ /* sorry, streams support does not really work yet */ #if defined(STREAMSCONN) && defined(SVR4) @@ -45,7 +49,6 @@ #endif #ifndef WIN32 #ifndef STREAMSCONN -#ifndef MINIX #ifndef Lynx #include <sys/socket.h> #else @@ -61,24 +64,11 @@ #endif /* !sco */ #endif /* i386 */ #endif /* SYSV */ -#else /* MINIX */ -#include <net/gen/netdb.h> -#endif /* !MINIX */ #endif /* !STREAMSCONN */ #endif /* !WIN32 */ #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #include "xauth.h" -#ifdef MINIX -#ifdef MNX_TCPCONN -#define TCPCONN -#endif -#define EPROTOTYPE EGENERIC -#endif - #ifdef DNETCONN #include <netdnet/dn.h> #include <netdnet/dnetdb.h> @@ -117,9 +107,6 @@ Xauth *auth; { static struct hostent *hp = NULL; -#if !defined(WIN32) && defined(X_NOT_STDC_ENV) - char *inet_ntoa(); -#endif #ifdef DNETCONN struct nodeent *np; static char nodeaddr[4 + 2 * DN_MAXADDL]; Index: xc/programs/xauth/parsedpy.c diff -u xc/programs/xauth/parsedpy.c:3.4 xc/programs/xauth/parsedpy.c:3.6 --- xc/programs/xauth/parsedpy.c:3.4 Wed Jan 17 18:45:14 2001 +++ xc/programs/xauth/parsedpy.c Fri Dec 14 15:01:15 2001 @@ -1,12 +1,16 @@ /* - * $Xorg: parsedpy.c,v 1.3 2000/08/17 19:54:11 cpqbld Exp $ + * $Xorg: parsedpy.c,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ * * parse_displayname - utility routine for splitting up display name strings * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -25,7 +29,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xauth/parsedpy.c,v 3.4 2001/01/17 23:45:14 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/parsedpy.c,v 3.6 2001/12/14 20:01:15 dawes Exp $ */ #include <stdio.h> /* for NULL */ #include <ctype.h> /* for isascii() and isdigit() */ @@ -42,11 +46,7 @@ #define UNIX_CONNECTION_LENGTH 4 #endif -#ifdef X_NOT_STDC_ENV -extern char *malloc(); -#else #include <stdlib.h> -#endif #include "xauth.h" /* Index: xc/programs/xauth/process.c diff -u xc/programs/xauth/process.c:3.9 xc/programs/xauth/process.c:3.12 --- xc/programs/xauth/process.c:3.9 Mon Apr 23 16:31:09 2001 +++ xc/programs/xauth/process.c Fri Dec 14 15:01:15 2001 @@ -1,9 +1,13 @@ -/* $Xorg: process.c,v 1.5 2000/08/17 19:54:11 cpqbld Exp $ */ +/* $Xorg: process.c,v 1.6 2001/02/09 02:05:38 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xauth/process.c,v 3.9 2001/04/23 20:31:09 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/process.c,v 3.12 2001/12/14 20:01:15 dawes Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -31,9 +35,6 @@ #include "xauth.h" #include <ctype.h> #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #include <sys/stat.h> #include <signal.h> @@ -621,7 +622,7 @@ die(int sig) { dieing = True; - exit (auth_finalize ()); + _exit (auth_finalize ()); /* NOTREACHED */ #ifdef SIGNALRETURNSINT return -1; /* for picky compilers */ Index: xc/programs/xauth/xauth.c diff -u xc/programs/xauth/xauth.c:1.4 xc/programs/xauth/xauth.c:1.5 --- xc/programs/xauth/xauth.c:1.4 Wed Jan 17 18:45:16 2001 +++ xc/programs/xauth/xauth.c Fri Dec 14 15:01:15 2001 @@ -1,12 +1,16 @@ /* - * $Xorg: xauth.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ + * $Xorg: xauth.c,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ * * xauth - manipulate authorization file * * Copyright 1989,1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -24,7 +28,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xauth/xauth.c,v 1.4 2001/01/17 23:45:16 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/xauth.c,v 1.5 2001/12/14 20:01:15 dawes Exp $ */ #include "xauth.h" Index: xc/programs/xauth/xauth.h diff -u xc/programs/xauth/xauth.h:1.4 xc/programs/xauth/xauth.h:1.6 --- xc/programs/xauth/xauth.h:1.4 Wed Jan 17 18:45:16 2001 +++ xc/programs/xauth/xauth.h Fri Dec 14 15:01:15 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: xauth.h,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ + * $Xorg: xauth.h,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xauth/xauth.h,v 1.4 2001/01/17 23:45:16 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/xauth.h,v 1.6 2001/12/14 20:01:15 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> @@ -37,11 +41,7 @@ extern char *ProgramName; -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern char *malloc(), *realloc(); -#endif extern char *get_hostname ( Xauth *auth ); extern char *get_address_info ( int family, char *fulldpyname, int prefix, char *host, int *lenp ); Index: xc/programs/xauth/xauth.man diff -u xc/programs/xauth/xauth.man:1.6 xc/programs/xauth/xauth.man:1.7 --- xc/programs/xauth/xauth.man:1.6 Sat Jan 27 13:21:07 2001 +++ xc/programs/xauth/xauth.man Fri Dec 14 15:01:15 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xauth.man,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ +.\" $Xorg: xauth.man,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ .\" Copyright 1993, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xauth/xauth.man,v 1.6 2001/01/27 18:21:07 dawes Exp $ +.\" $XFree86: xc/programs/xauth/xauth.man,v 1.7 2001/12/14 20:01:15 dawes Exp $ .\" .TH XAUTH 1 __xorgversion__ .SH NAME Index: xc/programs/xbiff/Mailbox.c diff -u xc/programs/xbiff/Mailbox.c:1.3 xc/programs/xbiff/Mailbox.c:1.5 --- xc/programs/xbiff/Mailbox.c:1.3 Thu Apr 19 15:54:51 2001 +++ xc/programs/xbiff/Mailbox.c Sat Oct 27 23:34:25 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xbiff/Mailbox.c,v 1.3 2001/04/19 19:54:51 dawes Exp $ */ +/* $XFree86: xc/programs/xbiff/Mailbox.c,v 1.5 2001/10/28 03:34:25 tsi Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -52,6 +52,7 @@ #endif #include <sys/stat.h> /* for stat() ** needs types.h ***/ #include <stdio.h> /* for printing error messages */ +#include <unistd.h> #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE @@ -566,7 +567,7 @@ username = pw->pw_name; } #endif - if (mailpath = getenv("MAIL")) { + if ((mailpath = getenv("MAIL"))) { w->mailbox.filename = (String) XtMalloc (strlen (mailpath) + 1); strcpy (w->mailbox.filename, mailpath); } else { Index: xc/programs/xcalc/math.c diff -u xc/programs/xcalc/math.c:1.2 xc/programs/xcalc/math.c:1.5 --- xc/programs/xcalc/math.c:1.2 Thu Jun 15 16:50:03 2000 +++ xc/programs/xcalc/math.c Sat Oct 27 23:34:26 2001 @@ -1,5 +1,5 @@ /* $XConsortium: math.c,v 1.17 91/07/25 17:51:34 rws Exp $ - * $XFree86: xc/programs/xcalc/math.c,v 1.2 2000/06/15 20:50:03 dawes Exp $ + * $XFree86: xc/programs/xcalc/math.c,v 1.5 2001/10/28 03:34:26 tsi Exp $ * * math.c - mathematics functions for a hand calculator under X * @@ -68,7 +68,6 @@ #define True 1 #define False 0 -extern int errno; extern int rpn; extern char dispstr[]; extern void draw(); @@ -109,13 +108,27 @@ #define XCALC_MEMORY 10 static double mem[XCALC_MEMORY] = { 0.0 }; +static void DrawDisplay(void); +static void PushOp(int op); +static int PopOp(void); +static int isopempty(void); +#ifdef DEBUG +static void showstack(char *string); +#endif +static void PushNum(double num); +static double PopNum(void); +static void RollNum(int dir); +static void ClearStacks(void); +static int priority(int op); + /* * The following is to deal with the unfortunate assumption that if errno * is non-zero then an error has occurred. On some systems (e.g. Ultrix), * sscanf will call lower level routines that will set errno. */ -void parse_double (src, fmt, dp) +static void +parse_double (src, fmt, dp) char *src; char *fmt; double *dp; @@ -261,7 +274,8 @@ #endif } /*-------------------------------------------------------------------------*/ -DrawDisplay() +static void +DrawDisplay(void) { if ((int) strlen(dispstr) > 12) { /* strip out some decimal digits */ char tmp[32]; @@ -286,11 +300,12 @@ } /*-------------------------------------------------------------------------*/ +void numeric(keynum) int keynum; { char st[2]; - int cell; + int cell = 0; flagINV=0; @@ -368,7 +383,8 @@ lift_enabled = 0; } -bkspf() +void +bkspf(void) { lift_enabled = 0; @@ -394,7 +410,8 @@ DrawDisplay(); } -decf() +void +decf(void) { flagINV=0; if (clrdisp) { @@ -415,7 +432,8 @@ entered=1; } -eef() +void +eef(void) { flagINV=0; if (clrdisp) { @@ -432,7 +450,8 @@ entered=1; } -clearf() +void +clearf(void) { flagINV=0; if (CLR && !rpn) { /* clear all */ @@ -447,7 +466,8 @@ DrawDisplay(); } -negf() +void +negf(void) { flagINV=0; if (exponent) { /* neg the exponent */ @@ -474,10 +494,9 @@ } /* Two operand functions for infix calc */ -twoop(keynum) +void +twoop(int keynum) { - double PopNum(); - if (flagINV) { flagINV=0; DrawDisplay(); @@ -539,10 +558,9 @@ } /* Two operand functions for rpn calc */ -twof(keynum) +void +twof(int keynum) { - double PopNum(); - if (flagINV) { flagINV=0; DrawDisplay(); @@ -569,8 +587,8 @@ dnum = acc; } - -entrf() +void +entrf(void) { flagINV=0; if (!entered) @@ -587,10 +605,9 @@ lift_enabled = 0; } -equf() +void +equf(void) { - double PopNum(); - flagINV=0; if (!entered) return; @@ -631,7 +648,8 @@ DrawDisplay(); } -lparf() +void +lparf(void) { flagINV=0; PushOp(kLPAR); @@ -639,10 +657,9 @@ DrawDisplay(); } -rollf() +void +rollf(void) { - double PopNum(); - if (!entered) return; if (entered==1) @@ -656,10 +673,9 @@ DrawDisplay(); } -rparf() +void +rparf(void) { - double PopNum(); - flagINV=0; if (!entered) return; @@ -701,7 +717,8 @@ DrawDisplay(); } -drgf() +void +drgf(void) { if (flagINV) { if (entered==1) @@ -733,13 +750,15 @@ DrawDisplay(); } -invf() +void +invf(void) { flagINV = ~flagINV; DrawDisplay(); } -memf(keynum) +void +memf(int keynum) { memop = keynum; if (entered==1) @@ -749,7 +768,8 @@ lift_enabled = 0; } -oneop(keynum) +void +oneop(int keynum) { int i,j; double dtmp; @@ -813,7 +833,8 @@ DrawDisplay(); } -offf() +void +offf(void) { /* full reset */ int i; @@ -837,6 +858,7 @@ /*******/ +static void PushOp(op) int op; /*******/ @@ -846,7 +868,8 @@ } /*******/ -int PopOp() +static int +PopOp(void) /*******/ { if (opsp==0) { @@ -858,13 +881,15 @@ } /*******/ -int isopempty() +static int +isopempty(void) /*******/ { return( opsp ? 0 : 1 ); } #ifdef DEBUG +static void showstack(string) char *string; { @@ -874,6 +899,7 @@ #endif /*******/ +static void PushNum(num) double num; /*******/ @@ -892,7 +918,8 @@ } /*******/ -double PopNum() +static double +PopNum(void) /*******/ { if (rpn) { @@ -910,7 +937,8 @@ } /*******/ -RollNum(dir) +static void +RollNum(int dir) /*******/ { double tmp; @@ -932,7 +960,8 @@ /*******/ -ClearStacks() +static void +ClearStacks(void) /*******/ { if (rpn) @@ -942,7 +971,8 @@ /*******/ -int priority(op) +static int +priority(op) int op; /*******/ { @@ -958,7 +988,8 @@ /********/ -ResetCalc() +void +ResetCalc(void) /********/ { flagM=flagINV=flagPAREN=0; drgmode=DEG; Index: xc/programs/xcalc/xcalc.h diff -u xc/programs/xcalc/xcalc.h:1.1 xc/programs/xcalc/xcalc.h:1.2 --- xc/programs/xcalc/xcalc.h:1.1 Sat Feb 12 22:26:19 2000 +++ xc/programs/xcalc/xcalc.h Tue Jul 31 20:45:02 2001 @@ -28,6 +28,7 @@ from the X Consortium. */ +/* $XFree86: xc/programs/xcalc/xcalc.h,v 1.2 2001/08/01 00:45:02 tsi Exp $ */ /* * xcalc.h - symbolic constants for xcalc @@ -35,6 +36,9 @@ * Author: Donna Converse, MIT X Consortium */ +#ifndef _XCALC_H_ +#define _XCALC_H_ + #ifdef SIGNALRETURNSINT #define signal_t int #else @@ -95,3 +99,25 @@ #define XCalc_RADIAN 3 /* radian indicator */ #define XCalc_GRADAM 4 /* grad indicator */ #define XCalc_PAREN 5 /* parenthesis indicator */ + +extern void numeric(int keynum); +extern void bkspf(void); +extern void decf(void); +extern void eef(void); +extern void clearf(void); +extern void negf(void); +extern void twoop(int keynum); +extern void twof(int keynum); +extern void entrf(void); +extern void equf(void); +extern void lparf(void); +extern void rollf(void); +extern void rparf(void); +extern void drgf(void); +extern void invf(void); +extern void memf(int keynum); +extern void oneop(int keynum); +extern void offf(void); +extern void ResetCalc(void); + +#endif Index: xc/programs/xclipboard/xclipboard.c diff -u xc/programs/xclipboard/xclipboard.c:1.6 xc/programs/xclipboard/xclipboard.c:1.8 --- xc/programs/xclipboard/xclipboard.c:1.6 Wed Jan 17 18:45:17 2001 +++ xc/programs/xclipboard/xclipboard.c Fri Dec 14 15:01:16 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: xclipboard.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ + * $Xorg: xclipboard.c,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -24,7 +28,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.6 2001/01/17 23:45:17 dawes Exp $ */ +/* $XFree86: xc/programs/xclipboard/xclipboard.c,v 1.8 2001/12/14 20:01:16 dawes Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> @@ -49,11 +53,7 @@ #include <X11/extensions/XKBbells.h> #endif -#ifdef X_NOT_STDC_ENV -extern char *malloc (); -#else #include <stdlib.h> -#endif #define Command commandWidgetClass #define Label labelWidgetClass Index: xc/programs/xclipboard/xclipboard.man diff -u xc/programs/xclipboard/xclipboard.man:1.7 xc/programs/xclipboard/xclipboard.man:1.8 --- xc/programs/xclipboard/xclipboard.man:1.7 Sat Jan 27 13:21:08 2001 +++ xc/programs/xclipboard/xclipboard.man Fri Dec 14 15:01:16 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xclipboard.man,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ +.\" $Xorg: xclipboard.man,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xclipboard/xclipboard.man,v 1.7 2001/01/27 18:21:08 dawes Exp $ +.\" $XFree86: xc/programs/xclipboard/xclipboard.man,v 1.8 2001/12/14 20:01:16 dawes Exp $ .\" .TH XCLIPBOARD 1 __xorgversion__ .SH NAME Index: xc/programs/xclipboard/xcutsel.c diff -u xc/programs/xclipboard/xcutsel.c:1.7 xc/programs/xclipboard/xcutsel.c:1.8 --- xc/programs/xclipboard/xcutsel.c:1.7 Sun Apr 1 10:00:19 2001 +++ xc/programs/xclipboard/xcutsel.c Fri Dec 14 15:01:16 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: xcutsel.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ + * $Xorg: xcutsel.c,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * * * Author: Ralph Swick, DEC/Project Athena */ -/* $XFree86: xc/programs/xclipboard/xcutsel.c,v 1.7 2001/04/01 14:00:19 tsi Exp $ */ +/* $XFree86: xc/programs/xclipboard/xcutsel.c,v 1.8 2001/12/14 20:01:16 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/xclipboard/xcutsel.man diff -u xc/programs/xclipboard/xcutsel.man:1.7 xc/programs/xclipboard/xcutsel.man:1.8 --- xc/programs/xclipboard/xcutsel.man:1.7 Sat Jan 27 13:21:09 2001 +++ xc/programs/xclipboard/xcutsel.man Fri Dec 14 15:01:16 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xcutsel.man,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ +.\" $Xorg: xcutsel.man,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ .\" Copyright 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xclipboard/xcutsel.man,v 1.7 2001/01/27 18:21:09 dawes Exp $ +.\" $XFree86: xc/programs/xclipboard/xcutsel.man,v 1.8 2001/12/14 20:01:16 dawes Exp $ .\" .TH XCUTSEL 1 __xorgversion__ .SH NAME Index: xc/programs/xclock/Clock.c diff -u xc/programs/xclock/Clock.c:3.9 xc/programs/xclock/Clock.c:3.11 --- xc/programs/xclock/Clock.c:3.9 Wed Jan 17 18:45:18 2001 +++ xc/programs/xclock/Clock.c Fri Dec 14 15:01:16 2001 @@ -1,10 +1,14 @@ -/* $Xorg: Clock.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ */ +/* $Xorg: Clock.c,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/Clock.c,v 3.9 2001/01/17 23:45:18 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/Clock.c,v 3.11 2001/12/14 20:01:16 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/StringDefs.h> @@ -52,20 +56,8 @@ #include <stdio.h> #include <X11/Xos.h> -#if defined(__STDC__) && !defined(AIXV3) /* AIX is broken */ -#define Const const -#else -#define Const /**/ -#endif - -#ifdef X_NOT_STDC_ENV -extern struct tm *localtime(); -#define Time_t long -extern Time_t time (); -#else #include <time.h> #define Time_t time_t -#endif #ifdef XKB #include <X11/extensions/XKBbells.h> @@ -576,7 +568,7 @@ } } -static float Const Sines[] = { +static float const Sines[] = { .000000, .008727, .017452, .026177, .034899, .043619, .052336, .061049, .069756, .078459, .087156, .095846, .104528, .113203, .121869, .130526, .139173, .147809, .156434, .165048, .173648, .182236, .190809, .199368, @@ -591,7 +583,7 @@ .694658, .700909, .707107 }; -static float Const Cosines[] = { +static float const Cosines[] = { 1.00000, .999962, .999848, .999657, .999391, .999048, .998630, .998135, .997564, .996917, .996195, .995396, .994522, .993572, .992546, .991445, .990268, .989016, .987688, .986286, .984808, .983255, .981627, .979925, Index: xc/programs/xclock/Clock.h diff -u xc/programs/xclock/Clock.h:1.5 xc/programs/xclock/Clock.h:1.6 --- xc/programs/xclock/Clock.h:1.5 Wed Jan 17 18:45:18 2001 +++ xc/programs/xclock/Clock.h Fri Dec 14 15:01:17 2001 @@ -1,5 +1,5 @@ /* -* $Xorg: Clock.h,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ +* $Xorg: Clock.h,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ */ @@ -7,7 +7,11 @@ Copyright 1987, 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -45,7 +49,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/Clock.h,v 1.5 2001/01/17 23:45:18 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/Clock.h,v 1.6 2001/12/14 20:01:17 dawes Exp $ */ #ifndef _XawClock_h #define _XawClock_h Index: xc/programs/xclock/ClockP.h diff -u xc/programs/xclock/ClockP.h:1.5 xc/programs/xclock/ClockP.h:1.6 --- xc/programs/xclock/ClockP.h:1.5 Wed Jan 17 18:45:18 2001 +++ xc/programs/xclock/ClockP.h Fri Dec 14 15:01:17 2001 @@ -1,5 +1,5 @@ /* -* $Xorg: ClockP.h,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ +* $Xorg: ClockP.h,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ */ @@ -7,7 +7,11 @@ Copyright 1987, 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -45,7 +49,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/ClockP.h,v 1.5 2001/01/17 23:45:18 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/ClockP.h,v 1.6 2001/12/14 20:01:17 dawes Exp $ */ #ifndef _XawClockP_h #define _XawClockP_h Index: xc/programs/xclock/xclock.c diff -u xc/programs/xclock/xclock.c:1.7 xc/programs/xclock/xclock.c:1.9 --- xc/programs/xclock/xclock.c:1.7 Sun Apr 1 10:00:19 2001 +++ xc/programs/xclock/xclock.c Fri Dec 14 15:01:18 2001 @@ -1,4 +1,4 @@ -/* $Xorg: xclock.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ */ +/* $Xorg: xclock.c,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ */ /* * xclock -- Hacked from Tony Della Fera's much hacked clock program. @@ -7,7 +7,11 @@ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,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/xclock/xclock.c,v 1.7 2001/04/01 14:00:19 tsi Exp $ */ +/* $XFree86: xc/programs/xclock/xclock.c,v 1.9 2001/12/14 20:01:18 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -40,9 +44,6 @@ #include <X11/extensions/XKBbells.h> #endif -#ifdef X_NOT_STDC_ENV -extern void exit(); -#endif /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XtParseCommand is let loose. */ Index: xc/programs/xclock/xclock.man diff -u xc/programs/xclock/xclock.man:1.9 xc/programs/xclock/xclock.man:1.10 --- xc/programs/xclock/xclock.man:1.9 Sat Jan 27 13:21:09 2001 +++ xc/programs/xclock/xclock.man Fri Dec 14 15:01:18 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xclock.man,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ +.\" $Xorg: xclock.man,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xclock/xclock.man,v 1.9 2001/01/27 18:21:09 dawes Exp $ +.\" $XFree86: xc/programs/xclock/xclock.man,v 1.10 2001/12/14 20:01:18 dawes Exp $ .\" .TH XCLOCK 1 __xorgversion__ .SH NAME Index: xc/programs/xcmsdb/loadData.c diff -u xc/programs/xcmsdb/loadData.c:3.2 xc/programs/xcmsdb/loadData.c:3.3 --- xc/programs/xcmsdb/loadData.c:3.2 Wed Jan 17 18:45:19 2001 +++ xc/programs/xcmsdb/loadData.c Wed Jul 25 11:05:18 2001 @@ -31,7 +31,7 @@ * * */ -/* $XFree86: xc/programs/xcmsdb/loadData.c,v 3.2 2001/01/17 23:45:19 dawes Exp $ */ +/* $XFree86: xc/programs/xcmsdb/loadData.c,v 3.3 2001/07/25 15:05:18 dawes Exp $ */ /* * INCLUDES @@ -53,15 +53,7 @@ * files (external includes or internal includes). */ -#if defined(X_NOT_STDC_ENV) && !defined(__EMX__) -extern char *strtok(); -extern char *strchr(); -#endif -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -char *calloc(); -#endif /* * LOCAL TYPEDEFS @@ -658,7 +650,6 @@ /* With tableType 1 only store the intensity. */ pIRec++; } else { -#if __STDC__ /* Note ansi C can handle 0x preceeding hex number */ if (sscanf(ptoken, "%hi", &pIRec->value) != 1) { fprintf(stderr, @@ -666,17 +657,6 @@ linenum, ptoken); return (0); } -#else - if (*ptoken == '0' && - ((*(ptoken+1) == 'x') || (*(ptoken+1) == 'X') )) - ptoken += 2; - if (sscanf(ptoken, "%hx", &pIRec->value) != 1) { - fprintf(stderr, - "Line %d: invalid Intensity Profile value %s\n", - linenum, ptoken); - return (0); - } -#endif if ((ptoken = strtok(NULL, DATA_DELIMS)) == NULL) { fprintf(stderr, "Line %d: missing Intensity Profile value\n", Index: xc/programs/xcmsdb/xcmsdb.man diff -u xc/programs/xcmsdb/xcmsdb.man:1.6 xc/programs/xcmsdb/xcmsdb.man:1.7 --- xc/programs/xcmsdb/xcmsdb.man:1.6 Sat Jan 27 13:21:09 2001 +++ xc/programs/xcmsdb/xcmsdb.man Fri Dec 14 15:01:18 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: xcmsdb.man,v 1.3 2000/08/17 19:54:13 cpqbld Exp $ +.\" $Xorg: xcmsdb.man,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ .\" Copyright 1990, Tektronix Inc. .\" Copyright 1993, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" dealing in this Software without prior written authorization from the .\" The Open Group. .\" -.\" $XFree86: xc/programs/xcmsdb/xcmsdb.man,v 1.6 2001/01/27 18:21:09 dawes Exp $ +.\" $XFree86: xc/programs/xcmsdb/xcmsdb.man,v 1.7 2001/12/14 20:01:18 dawes Exp $ .\" .TH XCMSDB 1 __xorgversion__ .SH NAME Index: xc/programs/xconsole/xconsole.c diff -u xc/programs/xconsole/xconsole.c:3.25 xc/programs/xconsole/xconsole.c:3.29 --- xc/programs/xconsole/xconsole.c:3.25 Mon Apr 23 17:41:46 2001 +++ xc/programs/xconsole/xconsole.c Fri Dec 14 15:01:19 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: xconsole.c,v 1.4 2000/08/17 19:54:13 cpqbld Exp $ + * $Xorg: xconsole.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xconsole/xconsole.c,v 3.25 2001/04/23 21:41:46 dawes Exp $ */ +/* $XFree86: xc/programs/xconsole/xconsole.c,v 3.29 2001/12/14 20:01:19 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -57,18 +61,7 @@ #endif #include <X11/Shell.h> #include <ctype.h> - -#ifdef X_NOT_STDC_ENV -extern char *malloc (); -#else #include <stdlib.h> -#endif - -#ifdef MINIX -#define USE_FILE -#define FILE_NAME "/dev/log" -#define read(n,b,s) nbio_read(n,b,s) -#endif /* Fix ISC brain damage. When using gcc fdopen isn't declared in <stdio.h>. */ #if defined(ISC) && __STDC__ && !defined(ISC30) @@ -298,11 +291,6 @@ if (input) { -#ifdef MINIX - fcntl(fileno (input), F_SETFD, - fcntl(fileno (input), F_GETFD) | FD_ASYNCHIO); - nbio_register(fileno (input)); -#endif input_id = XtAddInput (fileno (input), (XtPointer) XtInputReadMask, inputReady, (XtPointer) text); } @@ -313,9 +301,6 @@ { if (input) { XtRemoveInput (input_id); -#ifdef MINIX - nbio_unregister(fileno (input)); -#endif fclose (input); } #ifdef USE_PTY @@ -329,7 +314,7 @@ { if (child_pid > 0) kill(child_pid, SIGTERM); - exit(0); + _exit(0); } #endif @@ -471,11 +456,6 @@ return; } -#ifdef MINIX - if (n == -1 && errno == EAGAIN) - return; - nbio_unregister(fileno (input)); -#endif fclose (input); XtRemoveInput (*id); Index: xc/programs/xconsole/xconsole.man diff -u xc/programs/xconsole/xconsole.man:1.7 xc/programs/xconsole/xconsole.man:1.8 --- xc/programs/xconsole/xconsole.man:1.7 Sat Jan 27 13:21:09 2001 +++ xc/programs/xconsole/xconsole.man Fri Dec 14 15:01:19 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xconsole.man,v 1.3 2000/08/17 19:54:13 cpqbld Exp $ +.\" $Xorg: xconsole.man,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ .\" Copyright 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" dealing in this Software without prior written authorization from the .\" The Open Group. .\" -.\" $XFree86: xc/programs/xconsole/xconsole.man,v 1.7 2001/01/27 18:21:09 dawes Exp $ +.\" $XFree86: xc/programs/xconsole/xconsole.man,v 1.8 2001/12/14 20:01:19 dawes Exp $ .\" .TH XCONSOLE 1 __xorgversion__ .SH NAME Index: xc/programs/xditview/Dvi.c diff -u xc/programs/xditview/Dvi.c:1.2 xc/programs/xditview/Dvi.c:1.4 --- xc/programs/xditview/Dvi.c:1.2 Sun Dec 3 00:20:53 2000 +++ xc/programs/xditview/Dvi.c Mon Aug 27 19:35:12 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xditview/Dvi.c,v 1.2 2000/12/03 05:20:53 keithp Exp $ */ +/* $XFree86: xc/programs/xditview/Dvi.c,v 1.4 2001/08/27 23:35:12 dawes Exp $ */ /* @@ -45,6 +45,8 @@ #include <X11/StringDefs.h> #include <X11/Xmu/Converters.h> #include <stdio.h> +#include <stdlib.h> +#include <unistd.h> #include <ctype.h> #include "DviP.h" @@ -124,12 +126,19 @@ #undef offset -static void ClassInitialize (); -static void Initialize(), Realize (), Destroy (), Redisplay (); -static Boolean SetValues (), SetValuesHook (); -static XtGeometryResult QueryGeometry (); -static void ShowDvi (); -static void CloseFile (), OpenFile (); +static void ClassInitialize(void); +static void Initialize(Widget, Widget, ArgList, Cardinal *); +static void Realize(Widget, XtValueMask *, XSetWindowAttributes *); +static void Destroy(Widget); +static void Redisplay(Widget, XEvent *, Region); +static Boolean SetValues(Widget, Widget, Widget, ArgList , Cardinal *); +static Boolean SetValuesHook(Widget, ArgList, Cardinal *); +static XtGeometryResult QueryGeometry(Widget, + XtWidgetGeometry *, XtWidgetGeometry *); +static void RequestDesiredSize(DviWidget); +static void ShowDvi(DviWidget); +static void CloseFile(DviWidget); +static void OpenFile(DviWidget); #define SuperClass ((SimpleWidgetClass)&simpleClassRec) @@ -178,7 +187,8 @@ WidgetClass dviWidgetClass = (WidgetClass) &dviClassRec; -static void ClassInitialize () +static void +ClassInitialize (void) { int len1 = strlen(default_font_map_1); int len2 = strlen(default_font_map_2); @@ -199,7 +209,8 @@ ****************************************************************/ /* ARGSUSED */ -static void Initialize(request, new, args, num_args) +static void +Initialize(request, new, args, num_args) Widget request, new; ArgList args; Cardinal *num_args; @@ -231,7 +242,7 @@ } static void -Realize (w, valueMask, attrs) +Realize(w, valueMask, attrs) Widget w; XtValueMask *valueMask; XSetWindowAttributes *attrs; @@ -298,7 +309,9 @@ Region region; { DviWidget dw = (DviWidget) w; +#ifndef USE_XFT XRectangle extents; +#endif #ifdef USE_XFT XClearArea (XtDisplay (dw), @@ -318,6 +331,7 @@ ShowDvi (dw); } +static void RequestDesiredSize (dw) DviWidget dw; { @@ -420,7 +434,8 @@ return FALSE; } -static void CloseFile (dw) +static void +CloseFile (dw) DviWidget dw; { if (dw->dvi.tmpFile) @@ -428,7 +443,8 @@ ForgetPagePositions (dw); } -static void OpenFile (dw) +static void +OpenFile (dw) DviWidget dw; { char tmpName[sizeof ("/tmp/dviXXXXXX")]; @@ -471,6 +487,7 @@ return ret; } +void SetDeviceResolution (dw, resolution) DviWidget dw; int resolution; Index: xc/programs/xditview/DviChar.c diff -u xc/programs/xditview/DviChar.c:1.1 xc/programs/xditview/DviChar.c:1.3 --- xc/programs/xditview/DviChar.c:1.1 Wed Feb 23 15:35:28 2000 +++ xc/programs/xditview/DviChar.c Tue Aug 28 12:48:09 2001 @@ -6,6 +6,7 @@ * Map DVI (ditrof output) character names to * font indexes and back */ +/* $XFree86: xc/programs/xditview/DviChar.c,v 1.3 2001/08/28 16:48:09 tsi Exp $ */ # include <X11/Intrinsic.h> # include "DviChar.h" @@ -20,9 +21,10 @@ static struct map_list *world; static int standard_maps_loaded = 0; -static void load_standard_maps (); -static int hash_name (); -static void dispose_hash(), compute_hash(); +static void load_standard_maps (void); +static int hash_name (char *name); +static void dispose_hash(DviCharNameMap *map); +static void compute_hash(DviCharNameMap *map); DviCharNameMap * DviFindMap (encoding) Index: xc/programs/xditview/DviChar.h diff -u xc/programs/xditview/DviChar.h:1.1 xc/programs/xditview/DviChar.h:1.2 --- xc/programs/xditview/DviChar.h:1.1 Wed Feb 23 15:35:28 2000 +++ xc/programs/xditview/DviChar.h Tue Jul 31 20:45:03 2001 @@ -9,7 +9,13 @@ * case insensitive, a dash seperating the * CharSetRegistry from the CharSetEncoding */ +/* $XFree86: xc/programs/xditview/DviChar.h,v 1.2 2001/08/01 00:45:03 tsi Exp $ */ +#ifndef _DVICHAR_H_ +#define _DVICHAR_H_ + +#include "Dvi.h" + # define DVI_MAX_SYNONYMS 10 # define DVI_MAP_SIZE 256 # define DVI_HASH_SIZE 256 @@ -29,13 +35,15 @@ DviCharNameHash *buckets[DVI_HASH_SIZE]; } DviCharNameMap; -extern DviCharNameMap *DviFindMap ( /* char *encoding */ ); -extern void DviRegisterMap ( /* DviCharNameMap *map */ ); +extern DviCharNameMap *DviFindMap (char *); +extern void DviRegisterMap (DviCharNameMap *); #ifdef NOTDEF -extern char *DviCharName ( /* DviCharNameMap *map, int index, int synonym */ ); +extern char *DviCharName (DviCharNameMap *, int, int); #else #define DviCharName(map,index,synonym) ((map)->dvi_names[index][synonym]) +#endif +extern int DviCharIndex (DviCharNameMap *, char *); +extern unsigned char *DviCharIsLigature (DviCharNameMap *, char *); +extern void ResetFonts (DviWidget); + #endif -extern int DviCharIndex ( /* DviCharNameMap *map, char *name */ ); -extern unsigned char *DviCharIsLigature ( /* DviCharNameMap *map, char *name */ ); -extern void ResetFonts ( /* DviWidget dw */ ); Index: xc/programs/xditview/DviP.h diff -u xc/programs/xditview/DviP.h:1.3 xc/programs/xditview/DviP.h:1.4 --- xc/programs/xditview/DviP.h:1.3 Mon Dec 4 16:01:01 2000 +++ xc/programs/xditview/DviP.h Tue Jul 31 20:45:03 2001 @@ -1,7 +1,7 @@ /* * $XConsortium: DviP.h,v 1.10 92/02/11 01:27:15 keith Exp $ */ -/* $XFree86: xc/programs/xditview/DviP.h,v 1.3 2000/12/04 21:01:01 dawes Exp $ */ +/* $XFree86: xc/programs/xditview/DviP.h,v 1.4 2001/08/01 00:45:03 tsi Exp $ */ /* * DviP.h - Private definitions for Dvi widget @@ -202,6 +202,8 @@ DviCharCache cache; } DviPart; +extern int DviGetAndPut(DviWidget, int *); + #define DviGetIn(dw,cp)\ (dw->dvi.tmpFile ? (\ DviGetAndPut (dw, cp) \ @@ -245,13 +247,46 @@ DviPart dvi; } DviRec; +/* draw.c */ +extern void HorizontalMove(DviWidget, int); +extern void HorizontalGoto(DviWidget, int); +extern void VerticalMove(DviWidget, int); +extern void VerticalGoto(DviWidget, int); +extern void FlushCharCache(DviWidget); +extern void SetGCForDraw(DviWidget); +extern void DrawLine(DviWidget, int, int); +extern void DrawCircle(DviWidget, int); +extern void DrawEllipse(DviWidget, int, int); +extern void DrawArc(DviWidget, int, int, int, int); +extern void DrawSpline(DviWidget, char *, int); + +/* font.c */ +extern void ParseFontMap(DviWidget); +extern void DestroyFontMap(DviFontMap *); +extern void SetFontPosition(DviWidget, int, char *, char *); #ifdef USE_XFT -extern XftFont *QueryFont (); +extern XftFont * QueryFont(DviWidget, int, int); #else -extern XFontStruct *QueryFont (); +extern XFontStruct * QueryFont(DviWidget, int, int); #endif +extern DviCharNameMap * QueryFontMap(DviWidget, int); -extern DviCharNameMap *QueryFontMap (); -#endif /* _XtDviP_h */ +/* lex.c */ +extern char * GetLine(DviWidget, char *, int); +extern char * GetWord(DviWidget, char *, int); +extern int GetNumber(DviWidget); + +/* page.c */ +extern void DestroyFileMap(DviFileMap *); +extern void ForgetPagePositions(DviWidget); +extern void RememberPagePosition(DviWidget, int); +extern long SearchPagePosition(DviWidget, int); +extern void FileSeek(DviWidget, long); +/* parse.c */ +extern int ParseInput(DviWidget); +/* Dvi.c */ +extern void SetDeviceResolution(DviWidget, int); + +#endif /* _XtDviP_h */ Index: xc/programs/xditview/XFontName.c diff -u xc/programs/xditview/XFontName.c:1.1 xc/programs/xditview/XFontName.c:1.3 --- xc/programs/xditview/XFontName.c:1.1 Wed Feb 23 15:35:29 2000 +++ xc/programs/xditview/XFontName.c Mon Aug 27 19:35:12 2001 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/xditview/XFontName.c,v 1.3 2001/08/27 23:35:12 dawes Exp $ */ /* * XFontName.c * @@ -10,12 +11,12 @@ #include <ctype.h> static char * -extractStringField (name, buffer, size, attrp, bit) - char *name; - char *buffer; - int size; - unsigned int *attrp; - unsigned int bit; +extractStringField ( + char *name, + char *buffer, + int size, + unsigned int *attrp, + unsigned int bit) { char *buf = buffer; @@ -36,11 +37,11 @@ } static char * -extractUnsignedField (name, result, attrp, bit) - char *name; - unsigned int *result; - unsigned int *attrp; - unsigned int bit; +extractUnsignedField ( + char *name, + unsigned int *result, + unsigned int *attrp, + unsigned int bit) { char buf[256]; char *c; @@ -109,10 +110,10 @@ } static char * -utoa (u, s, size) - unsigned int u; - char *s; - int size; +utoa ( + unsigned int u, + char *s, + int size) { char *t; @@ -192,10 +193,12 @@ return True; } +#if 0 Bool -XCompareFontName (name1, name2, fontNameAttributes) - XFontName *name1, *name2; - unsigned int fontNameAttributes; +XCompareFontName ( + XFontName *name1, + XFontName *name2, + unsigned int fontNameAttributes) { #define CompareString(field,bit) \ if (fontNameAttributes & bit) \ @@ -225,9 +228,11 @@ return True; } -XCopyFontName (name1, name2, fontNameAttributes) - XFontName *name1, *name2; - unsigned int fontNameAttributes; +Bool +XCopyFontName ( + XFontName *name1, + XFontName *name2, + unsigned int fontNameAttributes) { #define CopyString(field,bit) \ if (fontNameAttributes & bit) \ @@ -254,3 +259,4 @@ CopyString (CharSetEncoding, FontNameCharSetEncoding) return True; } +#endif Index: xc/programs/xditview/XFontName.h diff -u xc/programs/xditview/XFontName.h:1.1 xc/programs/xditview/XFontName.h:1.2 --- xc/programs/xditview/XFontName.h:1.1 Wed Feb 23 15:35:29 2000 +++ xc/programs/xditview/XFontName.h Tue Jul 31 20:45:03 2001 @@ -1,3 +1,8 @@ +/* $XFree86: xc/programs/xditview/XFontName.h,v 1.2 2001/08/01 00:45:03 tsi Exp $ */ + +#ifndef _XFONTNAME_H_ +#define _XFONTNAME_H_ + typedef struct _xFontName { char Registry[256]; char Foundry[256]; @@ -43,3 +48,8 @@ #define SpacingCharacterCell "C" typedef char XFontNameString[256]; + +extern Bool XParseFontName(XFontNameString, XFontName *, unsigned int *); +extern Bool XFormatFontName(XFontName *, unsigned int, XFontNameString); + +#endif Index: xc/programs/xditview/draw.c diff -u xc/programs/xditview/draw.c:1.2 xc/programs/xditview/draw.c:1.5 --- xc/programs/xditview/draw.c:1.2 Sun Dec 3 00:20:53 2000 +++ xc/programs/xditview/draw.c Mon Aug 27 19:35:12 2001 @@ -1,6 +1,6 @@ /* * $XConsortium: draw.c,v 1.8 94/04/17 20:43:35 gildea Exp $ - * $XFree86: xc/programs/xditview/draw.c,v 1.2 2000/12/03 05:20:53 keithp Exp $ + * $XFree86: xc/programs/xditview/draw.c,v 1.5 2001/08/27 23:35:12 dawes Exp $ * Copyright (c) 1991 X Consortium @@ -48,10 +48,7 @@ #include <ctype.h> #include <math.h> #include "DviP.h" - -#if !defined(X_NOT_STDC_ENV) || defined(SCO) #include <stdlib.h> -#endif #ifndef M_PI #define M_PI 3.14159265358979323846264338327950 @@ -74,9 +71,16 @@ + ((q->y - p->y)*(q->y - p->y))) /* length of pq */ Point *spline = (Point *)NULL; /* head of spline linked list */ -Point *MakePoint(); +static void ApproxSpline(int n); +static void DeletePoint(Point *p); +static void DrawSplineSegments(DviWidget dw); +static int GetSpline(char *s); +static void InsertPoint(Point *p, Point *q); +static void LineApprox(Point *p1, Point *p2, Point *p3); +static Point * MakePoint(double x, double y); +void HorizontalMove(dw, delta) DviWidget dw; int delta; @@ -84,6 +88,7 @@ dw->dvi.state->x += delta; } +void HorizontalGoto(dw, NewPosition) DviWidget dw; int NewPosition; @@ -91,6 +96,7 @@ dw->dvi.state->x = NewPosition; } +void VerticalMove(dw, delta) DviWidget dw; int delta; @@ -98,6 +104,7 @@ dw->dvi.state->y += delta; } +void VerticalGoto(dw, NewPosition) DviWidget dw; int NewPosition; @@ -106,6 +113,7 @@ } #ifdef USE_XFT +static void DrawText (DviWidget dw) { int i; @@ -126,6 +134,7 @@ } #endif +void FlushCharCache (dw) DviWidget dw; { @@ -153,13 +162,16 @@ dw->dvi.cache.start_y = dw->dvi.cache.y = yx; } -ClearPage (dw) - DviWidget dw; +#if 0 +void +ClearPage (DviWidget dw) { if (dw->dvi.display_enable) XClearWindow (XtDisplay (dw), XtWindow (dw)); } +#endif +void SetGCForDraw (dw) DviWidget dw; { @@ -177,6 +189,7 @@ } } +void DrawLine (dw, x, y) DviWidget dw; int x, y; @@ -189,6 +202,7 @@ dw->dvi.state->y += y; } +void DrawCircle (dw, diameter) DviWidget dw; int diameter; @@ -201,6 +215,7 @@ dw->dvi.state->x += diameter; } +void DrawEllipse (dw, a, b) DviWidget dw; int a, b; @@ -215,12 +230,13 @@ /* Convert angle in degrees to 64ths of a degree */ -ConvertAngle(theta) -int theta; +static int +ConvertAngle(int theta) { return(theta * 64); } +void DrawArc (dw, x0, y0, x1, y1) DviWidget dw; int x0, y0, x1, y1; @@ -294,8 +310,8 @@ /* copy next non-blank string from p to temp, update p */ -char *getstr(p, temp) -char *p, *temp; +static char * +getstr(char *p, char *temp) { while (*p == ' ' || *p == '\t' || *p == '\n') p++; @@ -313,6 +329,7 @@ /* Draw a spline by approximating with short lines. */ /*ARGSUSED*/ +void DrawSpline (dw, s, len) DviWidget dw; char *s; @@ -333,6 +350,7 @@ /* Parse string s to create a linked list of Point's with spline */ /* as its head. Return the number of coordinate pairs found. */ +static int GetSpline(s) char *s; { @@ -370,6 +388,7 @@ /* Approximate a spline by lines generated by iterations of the */ /* approximation algorithm from the original n points in the spline. */ +static void ApproxSpline(n) int n; { @@ -420,6 +439,7 @@ /* is the first for this curve). Repeat this ITERATIONS times. */ /*ARGSUSED*/ +static void LineApprox(p1, p2, p3) Point *p1, *p2, *p3; { @@ -442,6 +462,7 @@ /* spline curve. Rounding errors are taken into account so that */ /* the "curve" is continuous, and ends up where expected. */ +static void DrawSplineSegments(dw) DviWidget dw; { @@ -481,7 +502,8 @@ /* Malloc memory for a Point, and initialise the elements to x, y, NULL */ /* Return a pointer to the new Point. */ -Point *MakePoint(x, y) +static Point * +MakePoint(x, y) double x, y; { Point *p; @@ -497,6 +519,7 @@ /* Insert point q in linked list after point p. */ +static void InsertPoint(p, q) Point *p, *q; { @@ -509,6 +532,7 @@ /* Delete point p from the linked list. */ +static void DeletePoint(p) Point *p; { @@ -520,4 +544,3 @@ p->next = p->next->next; XtFree((char *)tmp); } - Index: xc/programs/xditview/font.c diff -u xc/programs/xditview/font.c:1.3 xc/programs/xditview/font.c:1.5 --- xc/programs/xditview/font.c:1.3 Mon Dec 4 16:01:01 2000 +++ xc/programs/xditview/font.c Mon Aug 27 19:35:12 2001 @@ -3,19 +3,19 @@ * * map dvi fonts to X fonts */ -/* $XFree86: xc/programs/xditview/font.c,v 1.3 2000/12/04 21:01:01 dawes Exp $ */ +/* $XFree86: xc/programs/xditview/font.c,v 1.5 2001/08/27 23:35:12 dawes Exp $ */ #include <X11/Xos.h> #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> #include <stdio.h> +#include <stdlib.h> #include <ctype.h> #include "DviP.h" #include "XFontName.h" static char * -savestr (s) - char *s; +savestr (char *s) { char *n; @@ -28,9 +28,7 @@ } static DviFontList * -LookupFontByPosition (dw, position) - DviWidget dw; - int position; +LookupFontByPosition (DviWidget dw, int position) { DviFontList *f; @@ -41,10 +39,7 @@ } static DviFontSizeList * -LookupFontSizeBySize (dw, f, size) - DviWidget dw; - DviFontList *f; - int size; +LookupFontSizeBySize (DviWidget dw, DviFontList *f, int size) { DviFontSizeList *fs, *best = 0; int bestdist; @@ -106,8 +101,7 @@ } static char * -SkipFontNameElement (n) - char *n; +SkipFontNameElement (char *n) { while (*n != '-') if (!*++n) @@ -118,9 +112,9 @@ # define SizePosition 8 # define EncodingPosition 13 -static -ConvertFontNameToSize (n) - char *n; +#ifndef USE_XFT +static int +ConvertFontNameToSize (char *n) { int i, size; @@ -132,10 +126,10 @@ size = atoi (n); return size/10; } +#endif static char * -ConvertFontNameToEncoding (n) - char *n; +ConvertFontNameToEncoding (char *n) { int i; for (i = 0; i < EncodingPosition; i++) { @@ -146,10 +140,8 @@ return n; } -static -DisposeFontSizes (dw, fs) - DviWidget dw; - DviFontSizeList *fs; +static void +DisposeFontSizes (DviWidget dw, DviFontSizeList *fs) { DviFontSizeList *next; @@ -171,8 +163,7 @@ } void -ResetFonts (dw) - DviWidget dw; +ResetFonts (DviWidget dw) { DviFontList *f; @@ -195,19 +186,19 @@ dw->dvi.cache.font_number = -1; } -DviFontSizeList * -InstallFontSizes (dw, x_name, scalablep) - DviWidget dw; - char *x_name; - Boolean *scalablep; +static DviFontSizeList * +InstallFontSizes (DviWidget dw, char *x_name, Boolean *scalablep) { +#ifndef USE_XFT char fontNameString[2048]; char **fonts; int i, count; int size; - DviFontSizeList *sizes, *new; + DviFontSizeList *new; XFontName fontName; unsigned int fontNameAttributes; +#endif + DviFontSizeList *sizes; sizes = 0; #ifdef USE_XFT @@ -249,11 +240,7 @@ } static DviFontList * -InstallFont (dw, position, dvi_name, x_name) - DviWidget dw; - int position; - char *dvi_name; - char *x_name; +InstallFont (DviWidget dw, int position, char *dvi_name, char *x_name) { DviFontList *f; char *encoding; @@ -298,9 +285,7 @@ } static char * -MapDviNameToXName (dw, dvi_name) - DviWidget dw; - char *dvi_name; +MapDviNameToXName (DviWidget dw, char *dvi_name) { DviFontMap *fm; @@ -331,6 +316,7 @@ } #endif +void ParseFontMap (dw) DviWidget dw; { @@ -366,6 +352,7 @@ dw->dvi.font_map = fm; } +void DestroyFontMap (font_map) DviFontMap *font_map; { @@ -382,6 +369,7 @@ } /*ARGSUSED*/ +void SetFontPosition (dw, position, dvi_name, extra) DviWidget dw; int position; Index: xc/programs/xditview/lex.c diff -u xc/programs/xditview/lex.c:1.3 xc/programs/xditview/lex.c:1.4 --- xc/programs/xditview/lex.c:1.3 Mon Dec 4 16:01:01 2000 +++ xc/programs/xditview/lex.c Tue Jul 31 20:45:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xditview/lex.c,v 1.3 2000/12/04 21:01:01 dawes Exp $ */ +/* $XFree86: xc/programs/xditview/lex.c,v 1.4 2001/08/01 00:45:03 tsi Exp $ */ #include <X11/Xos.h> #include <X11/IntrinsicP.h> @@ -7,6 +7,7 @@ #include <ctype.h> #include "DviP.h" +int DviGetAndPut(dw, cp) DviWidget dw; int *cp; @@ -32,9 +33,9 @@ { int i = 0, c; char *p = Buffer; - + Length--; /* Save room for final NULL */ - + while ((!p || i < Length) && DviGetC (dw, &c) != EOF && c != '\n') if (p) *p++ = c; @@ -44,10 +45,10 @@ #endif if (c == '\n') DviUngetC(dw, c); - if (p) + if (p) *p = '\0'; return (Buffer); -} +} char * GetWord(dw, Buffer, Length) @@ -57,7 +58,7 @@ { int i = 0, c; char *p = Buffer; - + Length--; /* Save room for final NULL */ while (DviGetC(dw, &c) != EOF && isspace(c)) ; @@ -71,8 +72,9 @@ if (p) *p = '\0'; return (Buffer); -} +} +int GetNumber(dw) DviWidget dw; { @@ -88,5 +90,3 @@ DviUngetC(dw, c); return (i); } - - Index: xc/programs/xditview/page.c diff -u xc/programs/xditview/page.c:1.1 xc/programs/xditview/page.c:1.4 --- xc/programs/xditview/page.c:1.1 Wed Feb 23 15:35:31 2000 +++ xc/programs/xditview/page.c Mon Aug 27 19:35:12 2001 @@ -1,4 +1,5 @@ /* $XConsortium: page.c,v 1.5 91/07/26 00:40:20 keith Exp $ */ +/* $XFree86: xc/programs/xditview/page.c,v 1.4 2001/08/27 23:35:12 dawes Exp $ */ /* * page.c @@ -13,14 +14,8 @@ #include <ctype.h> #include "DviP.h" -#ifdef X_NOT_STDC_ENV -extern long ftell(); -#endif - static DviFileMap * -MapPageNumberToFileMap (dw, number) - DviWidget dw; - int number; +MapPageNumberToFileMap (DviWidget dw, int number) { DviFileMap *m; @@ -30,6 +25,7 @@ return m; } +void DestroyFileMap (m) DviFileMap *m; { @@ -41,6 +37,7 @@ } } +void ForgetPagePositions (dw) DviWidget dw; { @@ -48,6 +45,7 @@ dw->dvi.file_map = 0; } +void RememberPagePosition(dw, number) DviWidget dw; int number; @@ -66,6 +64,7 @@ m->position = ftell (dw->dvi.file); } +long SearchPagePosition (dw, number) DviWidget dw; int number; @@ -77,6 +76,7 @@ return m->position; } +void FileSeek(dw, position) DviWidget dw; long position; Index: xc/programs/xditview/parse.c diff -u xc/programs/xditview/parse.c:1.3 xc/programs/xditview/parse.c:1.5 --- xc/programs/xditview/parse.c:1.3 Mon Dec 4 16:01:01 2000 +++ xc/programs/xditview/parse.c Mon Aug 27 19:35:12 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xditview/parse.c,v 1.3 2000/12/04 21:01:01 dawes Exp $ */ +/* $XFree86: xc/programs/xditview/parse.c,v 1.5 2001/08/27 23:35:12 dawes Exp $ */ /* * parse.c @@ -44,15 +44,16 @@ #include "DviP.h" static int StopSeen = 0; -static ParseDrawFunction(), ParseDeviceControl(); -static push_env(), pop_env(); +static void ParseDrawFunction(DviWidget dw, char *buf); +static void ParseDeviceControl(DviWidget dw); +static void PutCharacters(DviWidget dw, unsigned char *src, int len); +static void push_env(DviWidget dw); +static void pop_env(DviWidget dw); -extern char *GetWord(), *GetLine (); - #define HorizontalMove(dw, delta) ((dw)->dvi.state->x += (delta)) #ifdef USE_XFT -int +static int charWidth (DviWidget dw, XftFont *font, char c) { XGlyphInfo extents; @@ -70,8 +71,9 @@ ) #endif +int ParseInput(dw) - register DviWidget dw; + DviWidget dw; { int n, k; int c; @@ -141,7 +143,7 @@ } prevFont = -1; if (c == -1) { - for (i = 1; map = QueryFontMap (dw, i); i++) + for (i = 1; (map = QueryFontMap (dw, i)); i++) if (map->special) if ((c = DviCharIndex (map, Buffer)) != -1) { prevFont = dw->dvi.state->font_number; @@ -221,7 +223,8 @@ break; case 't': /* text */ GetLine(dw, Buffer, BUFSIZ); - PutCharacters (dw, Buffer, strlen (Buffer)); + PutCharacters (dw, (unsigned char *)Buffer, + strlen (Buffer)); dw->dvi.state->x = ToDevice (dw, dw->dvi.cache.x); break; case 'x': /* device control */ @@ -233,13 +236,13 @@ return dw->dvi.current_page; default: GetLine (dw, Buffer, BUFSIZ); - fprintf (stderr, "Unknown command %c%s\n", Buffer); + fprintf (stderr, "Unknown command %s\n", Buffer); break; } } } -static +static void push_env(dw) DviWidget dw; { @@ -260,7 +263,7 @@ dw->dvi.state = new; } -static +static void pop_env(dw) DviWidget dw; { @@ -271,9 +274,8 @@ XtFree ((char *) old); } -static -InitTypesetter (dw) - DviWidget dw; +static void +InitTypesetter (DviWidget dw) { while (dw->dvi.state) pop_env (dw); @@ -282,8 +284,8 @@ FlushCharCache (dw); } -SetFont (dw) - DviWidget dw; +static void +SetFont (DviWidget dw) { dw->dvi.cache.font_size = dw->dvi.state->font_size; dw->dvi.cache.font_number = dw->dvi.state->font_number; @@ -292,6 +294,7 @@ dw->dvi.cache.font_size); } +static void PutCharacters (dw, src, len) DviWidget dw; unsigned char *src; @@ -323,7 +326,7 @@ #endif if (!dw->dvi.display_enable) - return FALSE; + return; if (yx != dw->dvi.cache.y || dw->dvi.cache.char_index + len > DVI_CHAR_CACHE_SIZE) @@ -387,12 +390,10 @@ if (font) dw->dvi.cache.x += charWidth(dw,font,c); } - return TRUE; } - return FALSE; } -static +static void ParseDrawFunction(dw, buf) DviWidget dw; char *buf; @@ -436,7 +437,7 @@ extern int LastPage, CurrentPage; -static +static void ParseDeviceControl(dw) /* Parse the x commands */ DviWidget dw; { @@ -475,5 +476,4 @@ while (DviGetC(dw,&c) != '\n') /* skip rest of input line */ if (c == EOF) return; - return; } Index: xc/programs/xditview/xditview.c diff -u xc/programs/xditview/xditview.c:1.2 xc/programs/xditview/xditview.c:1.4 --- xc/programs/xditview/xditview.c:1.2 Thu May 11 14:14:41 2000 +++ xc/programs/xditview/xditview.c Mon Aug 27 19:35:12 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xditview/xditview.c,v 1.2 2000/05/11 18:14:41 tsi Exp $ */ +/* $XFree86: xc/programs/xditview/xditview.c,v 1.4 2001/08/27 23:35:12 dawes Exp $ */ /* * xditview -- * @@ -58,12 +58,8 @@ #include "xdit.bm" #include "xdit_mask.bm" #include <stdio.h> +#include <stdlib.h> -#ifndef sgi /* SGI declares popen() in stdio.h */ -extern FILE *popen(); -#endif -extern void exit(); - /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XtParseCommand is let loose. */ @@ -77,13 +73,14 @@ static char current_file_name[1024]; static FILE *current_file; +static void MakePrompt(Widget, char *, void (*)(char *), char *); + /* * Report the syntax for calling xditview. */ -static -Syntax(call) - char *call; +static void +Syntax(char *call) { (void) printf ("Usage: %s [-fg <color>] [-bg <color>]\n", call); (void) printf (" [-bd <color>] [-bw <pixels>] [-help]\n"); @@ -93,10 +90,10 @@ exit(1); } -static void NewResolution (); -static void NewFile (); -static void DisplayPageNumber (); -static void VisitFile (); +static void NewResolution (char *resString); +static void NewFile (char *name); +static void DisplayPageNumber (void); +static void VisitFile (char *name, Boolean resetPage); static Widget toplevel, paned, porthole, dvi; #ifdef NOTDEF static Widget form, panner; @@ -106,49 +103,60 @@ static Widget fileMenuButton, fileMenu; static Widget prevButton, pageNumber, nextButton; -static void NextPage(), PreviousPage(), SetResolution (); -static void OpenFile(), RevisitFile (), Quit(); +static void NextPage(Widget entry, XtPointer name, XtPointer data); +static void PreviousPage(Widget entry, XtPointer name, XtPointer data); +static void SetResolution(Widget entry, XtPointer name, XtPointer data); +static void OpenFile(Widget entry, XtPointer name, XtPointer data); +static void RevisitFile(Widget entry, XtPointer name, XtPointer data); +static void Quit(Widget entry, XtPointer closure, XtPointer data); struct menuEntry { char *name; - void (*function)(); + void (*function)(Widget entry, XtPointer name, XtPointer data); }; static struct menuEntry popupMenuEntries[] = { - "nextPage", NextPage, - "previousPage", PreviousPage, - "setResolution",SetResolution, - "openFile", OpenFile, - "revisitFile", RevisitFile, - "quit", Quit, + { "nextPage", NextPage }, + { "previousPage", PreviousPage }, + { "setResolution", SetResolution }, + { "openFile", OpenFile }, + { "revisitFile", RevisitFile }, + { "quit", Quit } }; static struct menuEntry fileMenuEntries[] = { - "openFile", OpenFile, - "revisitFile", RevisitFile, - "setResolution",SetResolution, - "quit", Quit, + { "openFile", OpenFile }, + { "revisitFile", RevisitFile }, + { "setResolution", SetResolution }, + { "quit", Quit } }; -static void NextPageAction(), PreviousPageAction(), SetResolutionAction(); -static void OpenFileAction(), RevisitFileAction (), QuitAction(); -static void AcceptAction(), CancelAction(); -static void UpdatePageNumber (), Noop (); +static void NextPageAction(Widget, XEvent *, String *, Cardinal *); +static void PreviousPageAction(Widget, XEvent *, String *, Cardinal *); +static void SetResolutionAction(Widget, XEvent *, String *, Cardinal *); +static void OpenFileAction(Widget, XEvent *, String *, Cardinal *); +static void RevisitFileAction(Widget, XEvent *, String *, Cardinal *); +static void QuitAction(Widget, XEvent *, String *, Cardinal *); +static void AcceptAction(Widget, XEvent *, String *, Cardinal *); +static void CancelAction(Widget, XEvent *, String *, Cardinal *); +static void UpdatePageNumber(Widget, XEvent *, String *, Cardinal *); +static void Noop(Widget, XEvent *, String *, Cardinal *); XtActionsRec xditview_actions[] = { - "NextPage", NextPageAction, - "PreviousPage", PreviousPageAction, - "SetResolution",SetResolutionAction, - "OpenFile", OpenFileAction, - "Quit", QuitAction, - "Accept", AcceptAction, - "Cancel", CancelAction, - "SetPageNumber",UpdatePageNumber, - "Noop", Noop, + { "NextPage", NextPageAction }, + { "PreviousPage", PreviousPageAction }, + { "SetResolution", SetResolutionAction }, + { "OpenFile", OpenFileAction }, + { "Quit", QuitAction }, + { "Accept", AcceptAction }, + { "Cancel", CancelAction }, + { "SetPageNumber", UpdatePageNumber }, + { "Noop", Noop } }; static Atom wm_delete_window; +#ifdef NOTDEF /* Function Name: PannerCallback * Description: called when the panner has moved. * Arguments: panner - the panner widget. @@ -158,10 +166,8 @@ */ /* ARGSUSED */ -void -PannerCallback(w, closure, report_ptr) -Widget w; -XtPointer closure, report_ptr; +static void +PannerCallback(Widget w, XtPointer closure, XtPointer report_ptr) { Arg args[2]; XawPannerReport *report = (XawPannerReport *) report_ptr; @@ -184,10 +190,8 @@ */ /* ARGSUSED */ -void -PortholeCallback(w, panner_ptr, report_ptr) -Widget w; -XtPointer panner_ptr, report_ptr; +static void +PortholeCallback(Widget w, XtPointer panner_ptr, XtPointer report_ptr) { Arg args[10]; Cardinal n = 0; @@ -204,11 +208,10 @@ } XtSetValues (panner, args, n); } +#endif int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char *file_name = 0; int i; @@ -337,7 +340,7 @@ } static void -SetPageNumber (number) +SetPageNumber (int number) { Arg arg[1]; @@ -347,7 +350,7 @@ } static void -UpdatePageNumber () +UpdatePageNumber (Widget w, XEvent *xev, String *s, Cardinal *c) { char *string; Arg arg[1]; @@ -372,9 +375,7 @@ } static void -VisitFile (name, resetPage) -char *name; -Boolean resetPage; +VisitFile (char *name, Boolean resetPage) { Arg arg[3]; char *n; @@ -431,8 +432,8 @@ static char fileBuf[1024]; static char resolutionBuf[1024]; -ResetMenuEntry (entry) - Widget entry; +static void +ResetMenuEntry (Widget entry) { Arg arg[1]; @@ -444,14 +445,14 @@ static void NextPage (entry, name, data) Widget entry; - caddr_t name, data; + XtPointer name, data; { - NextPageAction(); + NextPageAction(entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void -NextPageAction () +NextPageAction (Widget w, XEvent *xev, String *s, Cardinal *c) { Arg args[1]; int number; @@ -465,14 +466,14 @@ static void PreviousPage (entry, name, data) Widget entry; - caddr_t name, data; + XtPointer name, data; { - PreviousPageAction (); + PreviousPageAction (entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void -PreviousPageAction () +PreviousPageAction (Widget w, XEvent *xev, String *s, Cardinal *c) { Arg args[1]; int number; @@ -486,14 +487,14 @@ static void SetResolution (entry, name, data) Widget entry; - caddr_t name, data; + XtPointer name, data; { - SetResolutionAction (); + SetResolutionAction (entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void -SetResolutionAction () +SetResolutionAction (Widget w, XEvent *xev, String *s, Cardinal *c) { Arg args[1]; int cur; @@ -508,14 +509,14 @@ static void OpenFile (entry, name, data) Widget entry; - caddr_t name, data; + XtPointer name, data; { - OpenFileAction (); + OpenFileAction (entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void -OpenFileAction () +OpenFileAction (Widget w, XEvent *xev, String *s, Cardinal *c) { if (current_file_name[0]) strcpy (fileBuf, current_file_name); @@ -528,14 +529,14 @@ static void RevisitFile (entry, name, data) Widget entry; - caddr_t name, data; + XtPointer name, data; { - RevisitFileAction (); + RevisitFileAction (entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void -RevisitFileAction () +RevisitFileAction (Widget w, XEvent *xev, String *s, Cardinal *c) { if (current_file_name[0]) VisitFile (current_file_name, FALSE); @@ -545,19 +546,19 @@ static void Quit (entry, closure, data) Widget entry; - caddr_t closure, data; + XtPointer closure, data; { - QuitAction (); + QuitAction (entry, NULL, NULL, NULL); } static void -QuitAction () +QuitAction (Widget w, XEvent *xev, String *s, Cardinal *c) { exit (0); } Widget promptShell, promptDialog; -void (*promptfunction)(); +void (*promptfunction)(char *); /* ARGSUSED */ static @@ -588,14 +589,15 @@ } static -void Noop () +void Noop (Widget w, XEvent *xev, String *s, Cardinal *c) { } +static void MakePrompt(centerw, prompt, func, def) Widget centerw; char *prompt; -void (*func)(); +void (*func)(char *); char *def; { static Arg dialogArgs[] = { @@ -617,8 +619,8 @@ dialogArgs[1].value = (XtArgVal)def; promptDialog = XtCreateManagedWidget( "promptDialog", dialogWidgetClass, promptShell, dialogArgs, XtNumber (dialogArgs)); - XawDialogAddButton(promptDialog, "accept", NULL, (caddr_t) 0); - XawDialogAddButton(promptDialog, "cancel", NULL, (caddr_t) 0); + XawDialogAddButton(promptDialog, "accept", NULL, NULL); + XawDialogAddButton(promptDialog, "cancel", NULL, NULL); valueWidget = XtNameToWidget (promptDialog, "value"); if (valueWidget) { XtSetArg (valueArgs[0], XtNresizable, TRUE); Index: xc/programs/xdm/Imakefile diff -u xc/programs/xdm/Imakefile:3.43 xc/programs/xdm/Imakefile:3.45 --- xc/programs/xdm/Imakefile:3.43 Tue Mar 6 12:31:39 2001 +++ xc/programs/xdm/Imakefile Wed Aug 29 13:11:56 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xdm/Imakefile,v 3.43 2001/03/06 17:31:39 dawes Exp $ +XCOMM $XFree86: xc/programs/xdm/Imakefile,v 3.45 2001/08/29 17:11:56 alanh Exp $ #define IHaveSubdirs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' @@ -82,6 +82,10 @@ PAM_DEFINES = -DUSE_PAM #endif +#if HasBSDAuth +BSDAUTH_DEFINES = -DUSE_BSDAUTH +#endif + #if SystemV4 || HasShadowPasswd #if !LinuxShadowSuite PWD_DEFINES = -DUSESHADOW @@ -141,9 +145,14 @@ #if HasSetUserContext USER_CONTEXT_DEFINES = -DHAS_SETUSERCONTEXT +# XXX - only FreeBSD has this in libutil SYS_LIBRARIES1 = -lutil #endif +#if HasSetProcTitle +PROCTITLE_DEFINES = -DHAS_SETPROCTITLE +#endif + SYS_LIBRARIES = $(SYS_LIBRARIES1) $(SYS_LIBRARIES2) $(SYS_LIBRARIES3) XDMCONFIGDIR = XdmConfigurationSubdirectory @@ -174,8 +183,8 @@ SRCS3 = chooser.c OBJS3 = chooser.o DEPLIBS3 = XawClientDepLibs XkbClientDepLibs $(DEPXDMCPLIB) \ - $(DEPXINERAMALIB) - LIBS3 = XawClientLibs XkbClientLibs $(XDMCPLIB) $(XINERAMALIB) + $(XINDEPLIBS) + LIBS3 = XawClientLibs XkbClientLibs $(XDMCPLIB) $(XINLIBS) #endif SRCS4 = sessreg.c @@ -205,14 +214,14 @@ OSMINORVERSION = OSMinorVersion CONN_DEFINES = $(CONNECTION_FLAGS) DEFINES = -DBINDIR=\"$(BINDIR)\" -DXDMDIR=\"$(XDMDIR)\" \ - $(SIGNAL_DEFINES) $(CRYPT_DEFINES) \ + $(SIGNAL_DEFINES) $(CRYPT_DEFINES) $(BSDAUTH_DEFINES) \ $(XDMAUTH_DEFINES) $(RPC_DEFINES) $(KRB5_DEFINES) \ $(PWD_DEFINES) $(PAM_DEFINES) $(CONN_DEFINES) \ $(GREET_DEFINES) $(FRAGILE_DEFINES) $(RANDOM_DEFINES) \ -DOSMAJORVERSION=$(OSMAJORVERSION) \ -DOSMINORVERSION=$(OSMINORVERSION) \ $(XKB_CLIENT_DEFINES) $(USER_CONTEXT_DEFINES) \ - $(XPM_DEFINES) $(XINERAMA_DEFINES) + $(XPM_DEFINES) $(XINERAMA_DEFINES) $(PROCTITLE_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.6 xc/programs/xdm/access.c:3.8 --- xc/programs/xdm/access.c:3.6 Wed Jan 17 18:45:20 2001 +++ xc/programs/xdm/access.c Fri Dec 14 15:01:19 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: access.c,v 1.4 2000/08/17 19:54:14 cpqbld Exp $ + * $Xorg: access.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/access.c,v 3.6 2001/01/17 23:45:20 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/access.c,v 3.8 2001/12/14 20:01:19 dawes Exp $ */ /* * Access control for XDMCP - keep a database of allowable display addresses @@ -42,11 +46,7 @@ # include "dm_socket.h" -#ifndef MINIX # include <netdb.h> -#else /* MINIX */ -# include <net/gen/netdb.h> -#endif /* !MINIX */ #define ALIAS_CHARACTER '%' #define NEGATE_CHARACTER '!' Index: xc/programs/xdm/auth.c diff -u xc/programs/xdm/auth.c:3.21 xc/programs/xdm/auth.c:3.24 --- xc/programs/xdm/auth.c:3.21 Wed Jan 17 18:45:20 2001 +++ xc/programs/xdm/auth.c Fri Dec 14 15:01:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: auth.c,v 1.4 2000/08/17 19:54:14 cpqbld Exp $ */ +/* $Xorg: auth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/auth.c,v 3.21 2001/01/17 23:45:20 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/auth.c,v 3.24 2001/12/14 20:01:19 dawes Exp $ */ /* * xdm - display manager daemon @@ -42,13 +46,8 @@ #include "dm_error.h" #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif -#ifndef ESIX -# include <sys/ioctl.h> -#endif /* !ESIX */ +#include <sys/ioctl.h> #if defined(TCPCONN) || defined(STREAMSCONN) # include "dm_socket.h" @@ -69,9 +68,6 @@ # include <stropts.h> # include <sys/sioctl.h> # endif /* ISC */ -# ifdef ESIX -# include <lan/net_ioctl.h> -# endif /* ESIX */ #endif /* i386 */ #ifdef SVR4 @@ -89,12 +85,7 @@ #include <netdb.h> #undef SIOCGIFCONF #else /* __GNU__ */ -#ifndef MINIX #include <net/if.h> -#else -#include <net/netlib.h> -#include <net/gen/netdb.h> -#endif /* !MINIX */ #endif /* __GNU__ */ #if ((defined(SVR4) && !defined(sun)) || defined(ISC)) && defined(SIOCGIFCONF) @@ -1020,9 +1011,6 @@ writeLocalAuth (FILE *file, Xauth *auth, char *name) { int fd; -#ifdef MINIX - char *tcp_device; -#endif Debug ("writeLocalAuth: %s %.*s\n", name, auth->name_length, auth->name); setAuthNumber (auth, name); @@ -1034,14 +1022,7 @@ t_close (fd); #endif #ifdef TCPCONN -#ifdef MINIX - tcp_device= getenv("TCP_DEVICE"); - if (tcp_device == NULL) - tcp_device= TCP_DEVICE; - fd = open(tcp_device, O_RDWR); -#else fd = socket (AF_INET, SOCK_STREAM, 0); -#endif DefineSelf (fd, file, auth); close (fd); #endif Index: xc/programs/xdm/choose.c diff -u xc/programs/xdm/choose.c:3.11 xc/programs/xdm/choose.c:3.15 --- xc/programs/xdm/choose.c:3.11 Wed Jan 17 18:45:20 2001 +++ xc/programs/xdm/choose.c Fri Dec 14 15:01:20 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: choose.c,v 1.4 2000/08/17 19:54:14 cpqbld Exp $ + * $Xorg: choose.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/choose.c,v 3.11 2001/01/17 23:45:20 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/choose.c,v 3.15 2001/12/14 20:01:20 dawes Exp $ */ /* * choose.c @@ -40,7 +44,6 @@ #include "dm_socket.h" -#ifndef MINIX #ifndef X_NO_SYS_UN #ifndef Lynx #include <sys/un.h> @@ -48,13 +51,6 @@ #include <un.h> #endif #endif -#else /* MINIX */ -#include <sys/ioctl.h> -#include <net/netlib.h> -#include <net/gen/in.h> -#include <net/gen/tcp.h> -#include <net/gen/tcp_io.h> -#endif /* !MINIX */ #include <ctype.h> #include <errno.h> @@ -63,19 +59,8 @@ # include <tiuser.h> #endif -#ifdef X_NOT_STDC_ENV -extern int errno; -#define Time_t long -extern Time_t time (); -#else #include <time.h> #define Time_t time_t -#endif - -#ifdef MINIX -int listen_inprogress; -int listen_completed; -#endif static int FormatBytes ( @@ -407,12 +392,6 @@ struct t_call *call; int flags=0; #endif -#ifdef MINIX - nwio_tcpconf_t tcpconf; - nwio_tcpcl_t tcpcl; - char *tcp_device; - int new_fd, flags, r; -#endif /* MINIX */ Debug ("Process chooser socket\n"); len = sizeof (buf); @@ -457,83 +436,7 @@ return; } #else -#ifdef MINIX - if (listen_inprogress) abort(); - /* If the listen succeeded save the filedescriptor */ - if (listen_completed) - { - client_fd= dup(fd); - if (client_fd == -1) - { - LogError ("Dup failed: %s\n", strerror(errno)); - return; - } - } - else - client_fd= -1; - - /* Try to setup a new tcp device at the same filedescriptor as the old - * one. - */ - if (ioctl(fd, NWIOGTCPCONF, &tcpconf) == -1) - { - LogError ("NWIOGTCPCONF failed: %s\n", strerror(errno)); - return; - } - close(fd); - tcp_device= getenv("TCP_DEVICE"); - if (tcp_device == NULL) - tcp_device= TCP_DEVICE; - new_fd= open(tcp_device, O_RDWR); - if (new_fd == -1) - { - LogError ("open '%s' failed: %s\n", tcp_device, strerror(errno)); - return; - } - if (new_fd != fd) - { - dup2(new_fd, fd); - close(new_fd); - } - if ((flags= fcntl(fd, F_GETFD)) == -1) - { - LogError ("F_GETFD failed: %s\n", strerror(errno)); - return; - } - if (fcntl(fd, F_SETFD, flags | FD_ASYNCHIO) == -1) - { - LogError ("F_SETFD failed: %s\n", strerror(errno)); - return; - } - tcpconf.nwtc_flags= NWTC_EXCL | NWTC_LP_SET | NWTC_UNSET_RA | NWTC_UNSET_RP; - if (ioctl(fd, NWIOSTCPCONF, &tcpconf) == -1) - { - LogError ("NWIOSTCPCONF failed: %s\n", strerror(errno)); - return; - } - listen_inprogress= 0; - listen_completed= 0; - - tcpcl.nwtcl_flags= 0; - r= ioctl(fd, NWIOTCPLISTEN, &tcpcl); - if (r == -1 && errno == EINPROGRESS) - { - listen_inprogress= 1; - nbio_inprogress(fd, ASIO_IOCTL, 1 /* read */, 1 /* write */, - 0 /* except */); - } - else if (r == -1) - { - LogError ("NWIOTCPLISTEN failed: %s\n", strerror(errno)); - return; - } - else - listen_completed= 1; - if (client_fd == -1) - return; -#else /* !MINIX */ client_fd = accept (fd, (struct sockaddr *)buf, (void *)&len); -#endif /* MINIX */ if (client_fd == -1) { LogError ("Cannot accept chooser connection\n"); @@ -597,7 +500,11 @@ char **env; Debug ("RunChooser %s\n", d->name); +#ifndef HAS_SETPROCTITLE SetTitle (d->name, "chooser", (char *) 0); +#else + setproctitle("chooser %s", d->name); +#endif LoadXloginResources (d); args = parseArgs ((char **) 0, d->chooser); strcpy (buf, "-xdmaddress "); @@ -620,15 +527,3 @@ #endif /* XDMCP */ -#ifdef MINIX -void tcp_listen_cb(nbio_ref_t ref, int res, int err) -{ - if (!listen_inprogress) - abort(); - if (res == 0) - listen_completed= 1; - else - LogError("listen error: %s\n", strerror(err)); - listen_inprogress= 0; -} -#endif Index: xc/programs/xdm/chooser.c diff -u xc/programs/xdm/chooser.c:3.22 xc/programs/xdm/chooser.c:3.24 --- xc/programs/xdm/chooser.c:3.22 Tue Mar 6 12:31:39 2001 +++ xc/programs/xdm/chooser.c Fri Dec 14 15:01:20 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: chooser.c,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ + * $Xorg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/chooser.c,v 3.22 2001/03/06 17:31:39 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/chooser.c,v 3.24 2001/12/14 20:01:20 dawes Exp $ */ /* * Chooser - display a menu of names and let the user select one @@ -86,19 +90,7 @@ #include "dm_socket.h" -#ifndef MINIX #include <arpa/inet.h> -#else /* MINIX */ -#include <net/hton.h> -#include <net/netlib.h> -#include <net/gen/in.h> -#include <net/gen/netdb.h> -#include <net/gen/tcp.h> -#include <net/gen/tcp_io.h> -#include <net/gen/udp.h> -#include <net/gen/udp_io.h> -#include <sys/nbio.h> -#endif /* !MINIX */ #include <sys/ioctl.h> #ifdef STREAMSCONN @@ -138,23 +130,12 @@ # include <sync/queue.h> # include <sync/sema.h> #endif -#ifndef MINIX #ifndef __GNU__ # include <net/if.h> #endif /* __GNU__ */ -#endif #endif /* hpux */ -#ifndef MINIX #include <netdb.h> -#endif - -#ifdef MINIX -static char read_buffer[XDM_MAX_MSGLEN+sizeof(udp_io_hdr_t)]; -static int read_inprogress; -static int read_size; -static void read_cb(nbio_ref_t ref, int res, int err); -#endif static int FromHex (char *s, char *d, int len); @@ -485,42 +466,10 @@ int saveHostname = 0; struct sockaddr addr; int addrlen; -#ifdef MINIX - int r; -#endif -#ifdef MINIX - if (read_inprogress) abort(); - if (read_size == 0) - { - r= read(socketFD, read_buffer, sizeof(read_buffer)); - if (r == -1 && errno == EINPROGRESS) - { - read_inprogress= 1; - nbio_inprogress(socketFD, ASIO_READ, 1 /* read */, - 0 /* write */, 0 /* exception */); - } - else if (r <= 0) - { - fprintf(stderr, "chooser: read error: %s\n", r == 0 ? - "EOF" : strerror(errno)); - return; - } - } -#endif - addrlen = sizeof (addr); -#ifdef MINIX - if (!MNX_XdmcpFill (socketFD, &buffer, &addr, &addrlen, - read_buffer, read_size)) - { - return; - } - read_size= 0; -#else if (!XdmcpFill (socketFD, &buffer, (XdmcpNetaddr) &addr, &addrlen)) return; -#endif if (!XdmcpReadHeader (&buffer, &header)) return; if (header.version != XDM_PROTOCOL_VERSION) @@ -595,7 +544,7 @@ * addresses on the local host. */ -#if !defined(MINIX) && !defined(__GNU__) +#if !defined(__GNU__) /* Handle variable length ifreq in BNR2 and later */ #ifdef VARIABLE_IFREQ @@ -752,9 +701,7 @@ QUERY); } } - -#else /* MINIX */ - +#else /* __GNU__ */ static void RegisterHostname (char *name) { @@ -795,7 +742,7 @@ QUERY); } } -#endif /* !MINIX */ +#endif /* __GNU__ */ static ARRAYofARRAY8 AuthenticationNames; @@ -820,12 +767,6 @@ int soopts = 1; XdmcpHeader header; int i; -#ifdef MINIX - char *udp_device; - nwio_udpopt_t udpopt; - int flags; - nbio_ref_t ref; -#endif header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) BROADCAST_QUERY; @@ -877,37 +818,8 @@ freenetconfigent(nconf); } #else -#ifdef MINIX - udp_device= getenv("UDP_DEVICE"); - if (udp_device == NULL) - udp_device= UDP_DEVICE; - if ((socketFD = open(udp_device, O_RDWR)) == -1) - return 0; - udpopt.nwuo_flags= NWUO_SHARED | NWUO_LP_SEL | NWUO_EN_LOC | - NWUO_EN_BROAD | NWUO_RP_ANY | NWUO_RA_ANY | NWUO_RWDATALL | - NWUO_DI_IPOPT; - if (ioctl(socketFD, NWIOSUDPOPT, &udpopt) == -1) - { - close(socketFD); - return 0; - } - if ((flags= fcntl(socketFD, F_GETFD)) == -1) - { - close(socketFD); - return 0; - } - if (fcntl(socketFD, F_SETFD, flags | FD_ASYNCHIO) == -1) - { - close(socketFD); - return 0; - } - nbio_register(socketFD); - ref.ref_int= socketFD; - nbio_setcallback(socketFD, ASIO_READ, read_cb, ref); -#else /* !MINIX */ if ((socketFD = socket (AF_INET, SOCK_DGRAM, 0)) < 0) return 0; -#endif /* MINIX */ #endif #ifndef STREAMSCONN #ifdef SO_BROADCAST @@ -945,11 +857,6 @@ #if defined(STREAMSCONN) struct t_call call, rcv; #endif -#ifdef MINIX - char *tcp_device; - nwio_tcpconf_t tcpconf; - nwio_tcpcl_t tcpcl; -#endif xdm = (char *) app_resources.xdmAddress->data; family = (xdm[0] << 8) + xdm[1]; @@ -995,31 +902,6 @@ exit (REMANAGE_DISPLAY); } #else -#ifdef MINIX - tcp_device= getenv("TCP_DEVICE"); - if (tcp_device == NULL) - tcp_device= TCP_DEVICE; - if ((fd= open(tcp_device, O_RDWR)) == -1) - { - fprintf (stderr, "Cannot open '%s': %s\n", tcp_device, - strerror(errno)); - exit (REMANAGE_DISPLAY); - } - tcpconf.nwtc_flags= NWTC_EXCL | NWTC_LP_SEL | NWTC_SET_RA | NWTC_SET_RP; - tcpconf.nwtc_remport= in_addr.sin_port; - tcpconf.nwtc_remaddr= in_addr.sin_addr.s_addr; - if (ioctl(fd, NWIOSTCPCONF, &tcpconf) == -1) - { - fprintf (stderr, "NWIOSTCPCONF failed: %s\n", strerror(errno)); - exit (REMANAGE_DISPLAY); - } - tcpcl.nwtcl_flags= 0; - if (ioctl(fd, NWIOTCPCONN, &tcpcl) == -1) - { - fprintf (stderr, "NWIOTCPCONN failed: %s\n", strerror(errno)); - exit (REMANAGE_DISPLAY); - } -#else /* !MINIX */ if ((fd = socket (family, SOCK_STREAM, 0)) == -1) { fprintf (stderr, "Cannot create response socket\n"); @@ -1030,7 +912,6 @@ fprintf (stderr, "Cannot connect to xdm\n"); exit (REMANAGE_DISPLAY); } -#endif /* MINIX */ #endif buffer.data = (BYTE *) buf; buffer.size = sizeof (buf); @@ -1249,21 +1130,3 @@ toVal->size = sizeof (ARRAY8Ptr); } -#ifdef MINIX -static void read_cb(nbio_ref_t ref, int res, int err) -{ - if (!read_inprogress) - abort(); - if (res > 0) - { - read_size= res; - } - else - { - fprintf(stderr, "chooser: read error: %s\n", res == 0 ? - "EOF" : strerror(err)); - read_size= 0; - } - read_inprogress= 0; -} -#endif Index: xc/programs/xdm/daemon.c diff -u xc/programs/xdm/daemon.c:3.14 xc/programs/xdm/daemon.c:3.17 --- xc/programs/xdm/daemon.c:3.14 Thu Apr 26 16:26:30 2001 +++ xc/programs/xdm/daemon.c Fri Dec 14 15:01:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: daemon.c,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ */ +/* $Xorg: daemon.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/daemon.c,v 3.14 2001/04/26 20:26:30 alanh Exp $ */ +/* $XFree86: xc/programs/xdm/daemon.c,v 3.17 2001/12/14 20:01:21 dawes Exp $ */ /* * xdm - display manager daemon @@ -36,16 +40,13 @@ #else #include <sys/ioctl.h> #endif -#if defined(__osf__) || defined(linux) || defined(MINIX) || defined(__GNU__) || defined(__CYGWIN__) +#if defined(__osf__) || defined(linux) || defined(__GNU__) || defined(__CYGWIN__) #define setpgrp setpgid #endif #ifdef hpux #include <sys/ptyio.h> #endif #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #include <sys/types.h> #ifdef X_NOT_POSIX #define Pid_t int @@ -53,13 +54,8 @@ #define Pid_t pid_t #endif -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern void exit (int); -#endif - #include "dm.h" #include "dm_error.h" @@ -102,11 +98,9 @@ stat = 0; /* don't know how to set child's process group */ #else stat = setpgrp(child_id, child_id); -#ifndef MINIX if (stat != 0) LogError("setting process grp for daemon failed, errno = %d\n", errno); -#endif /* MINIX */ #endif #endif #endif /* !CSRG_BASED */ @@ -135,16 +129,6 @@ close (2); #ifndef __EMX__ -#ifdef MINIX -#if 0 - /* Use setsid() to get rid of our controlling tty, this requires an extra - * fork though. - */ - setsid(); - if (fork() > 0) - _exit(0); -#endif -#else /* !MINIX */ #if !((defined(SYSV) || defined(SVR4)) && defined(i386)) && !defined(__CYGWIN__) if ((i = open ("/dev/tty", O_RDWR)) >= 0) { /* did open succeed? */ #if defined(USG) && defined(TCCLRCTTY) @@ -161,7 +145,6 @@ (void) close (i); } #endif /* !((SYSV || SVR4) && i386) */ -#endif /* MINIX */ #endif /* !__EMX__ */ /* Index: xc/programs/xdm/dm.c diff -u xc/programs/xdm/dm.c:3.11 xc/programs/xdm/dm.c:3.19 --- xc/programs/xdm/dm.c:3.11 Wed Jan 17 18:45:20 2001 +++ xc/programs/xdm/dm.c Fri Dec 14 15:01:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: dm.c,v 1.4 2000/08/17 19:54:14 cpqbld Exp $ */ +/* $Xorg: dm.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.c,v 3.11 2001/01/17 23:45:20 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/dm.c,v 3.19 2001/12/14 20:01:21 dawes Exp $ */ /* * xdm - display manager daemon @@ -68,10 +72,6 @@ #endif #endif -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - #if defined(SVR4) && !defined(SCO) extern FILE *fdopen(); @@ -153,11 +153,7 @@ if (nofork_session == 0) { /* Clean up any old Authorization files */ -#ifndef MINIX sprintf(cmdbuf, "/bin/rm -f %s/authdir/authfiles/A*", authDir); -#else - sprintf(cmdbuf, "/usr/bin/rm -f %s/authdir/authfiles/A*", authDir); -#endif system(cmdbuf); } @@ -213,11 +209,14 @@ static SIGVAL RescanNotify (int n) { + int olderrno = errno; + Debug ("Caught SIGHUP\n"); Rescan = 1; #ifdef SIGNALS_RESET_WHEN_CAUGHT (void) Signal (SIGHUP, RescanNotify); #endif + errno = olderrno; } static void @@ -352,6 +351,8 @@ static SIGVAL StopAll (int n) { + int olderrno = errno; + if (parent_pid != getpid()) { /* @@ -364,6 +365,7 @@ Debug ("Child xdm caught SIGTERM before it remove that signal.\n"); (void) Signal (n, SIG_DFL); TerminateProcess (getpid(), SIGTERM); + errno = olderrno; return; } Debug ("Shutting down entire manager\n"); @@ -376,6 +378,7 @@ (void) Signal (SIGTERM, StopAll); (void) Signal (SIGINT, StopAll); #endif + errno = olderrno; } /* @@ -390,10 +393,13 @@ static SIGVAL ChildNotify (int n) { + int olderrno = errno; + ChildReady = 1; #ifdef ISC (void) Signal (SIGCHLD, ChildNotify); #endif + errno = olderrno; } #endif @@ -500,13 +506,30 @@ StopDisplay(d); else RestartDisplay (d, TRUE); + { + Time_t Time; + time(&Time); + Debug("time %i %i\n",Time,d->lastCrash); + if (d->lastCrash && + ((Time - d->lastCrash) < XDM_BROKEN_INTERVAL)) { + Debug("Server crash frequency too high:" + " removing display %s\n",d->name); + LogError("Server crash rate too high:" + " removing display %s\n",d->name); + RemoveDisplay (d); + } else + d->lastCrash = Time; + } break; case waitCompose (SIGTERM,0,0): - d->startTries = 0; - Debug ("Display exited on SIGTERM\n"); - if (d->displayType.origin == FromXDMCP || d->status == zombie) + Debug ("Display exited on SIGTERM, try %d of %d\n", + d->startTries, d->startAttempts); + if (d->displayType.origin == FromXDMCP || + d->status == zombie || + ++d->startTries >= d->startAttempts) { + LogError ("Display %s is being disabled\n", d->name); StopDisplay(d); - else + } else RestartDisplay (d, TRUE); break; case REMANAGE_DISPLAY: @@ -538,27 +561,13 @@ d->status = notRunning; break; case running: - Debug ("Server for display %s terminated unexpectedly, status %d\n", d->name, waitVal (status)); + Debug ("Server for display %s terminated unexpectedly, status %d %d\n", d->name, waitVal (status), status); LogError ("Server for display %s terminated unexpectedly: %d\n", d->name, waitVal (status)); if (d->pid != -1) { Debug ("Terminating session pid %d\n", d->pid); TerminateProcess (d->pid, SIGTERM); } - { - Time_t Time; - time(&Time); - Debug("time %i %i\n",Time,d->lastCrash); - if (d->lastCrash && - ((Time - d->lastCrash) < XDM_BROKEN_INTERVAL)) { - Debug("Server crash frequency too high:" - " removing display %s\n",d->name); - LogError("Server crash rate too high:" - " removing display %s\n",d->name); - RemoveDisplay (d); - } else - d->lastCrash = Time; - } break; case notRunning: Debug ("Server exited for notRunning session on display %s\n", d->name); @@ -745,16 +754,10 @@ for (fd = 0; fd <= max; fd++) if (FD_ISSET (fd, &CloseMask)) { -#ifdef MINIX - nbio_unregister(fd); -#endif close (fd); } FD_ZERO (&CloseMask); max = 0; -#ifdef MINIX - { extern int chooserFd; nbio_unregister(chooserFd); } -#endif } static int pidFd; @@ -815,7 +818,7 @@ #endif #endif } - fprintf (pidFilePtr, "%5d\n", getpid ()); + fprintf (pidFilePtr, "%5ld\n", (long)getpid ()); (void) fflush (pidFilePtr); RegisterCloseOnFork (pidFd); } @@ -847,6 +850,7 @@ } #endif +#ifndef HAS_SETPROCTITLE void SetTitle (char *name, ...) { #ifndef NOXDMTITLE @@ -876,3 +880,4 @@ va_end(args); #endif } +#endif Index: xc/programs/xdm/dm.h diff -u xc/programs/xdm/dm.h:3.23 xc/programs/xdm/dm.h:3.28 --- xc/programs/xdm/dm.h:3.23 Fri Feb 16 08:24:10 2001 +++ xc/programs/xdm/dm.h Mon Jan 14 17:49:45 2002 @@ -1,9 +1,13 @@ -/* $Xorg: dm.h,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ */ +/* $Xorg: dm.h,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.h,v 3.23 2001/02/16 13:24:10 eich Exp $ */ +/* $XFree86: xc/programs/xdm/dm.h,v 3.28 2002/01/14 22:49:45 herrb Exp $ */ /* * xdm - display manager daemon @@ -36,12 +40,6 @@ #ifndef _DM_H_ #define _DM_H_ 1 -#ifdef MINIX -#ifdef MNX_TCPCONN -#define TCPCONN -#endif -#endif /* MINIX */ - #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <X11/Xmd.h> @@ -54,23 +52,11 @@ #include <limits.h> #undef _POSIX_C_SOURCE #else -#if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) #include <setjmp.h> #include <limits.h> -#else -#define _POSIX_SOURCE -#include <setjmp.h> -#include <limits.h> -#undef _POSIX_SOURCE #endif -#endif -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -#else #include <time.h> #define Time_t time_t -#endif /* If XDMCP symbol defined, compile to run XDMCP protocol */ @@ -119,6 +105,16 @@ #include <security/pam_appl.h> #endif +#ifdef CSRG_BASED +#include <sys/param.h> +#ifdef HAS_SETUSERCONTEXT +#include <login_cap.h> +#include <pwd.h> +#ifdef USE_BSDAUTH +#include <bsd_auth.h> +#endif +#endif +#endif # define waitCompose(sig,core,code) ((sig) * 256 + (core) * 128 + (code)) # define waitVal(w) waitCompose(waitSig(w), waitCore(w), waitCode(w)) @@ -375,7 +371,9 @@ extern void CloseOnFork (void); extern void RegisterCloseOnFork (int fd); extern void StartDisplay (struct display *d); +#ifndef HAS_SETPROCTITLE extern void SetTitle (char *name, ...); +#endif /* in dpylist.c */ extern int AnyDisplaysLeft (void); @@ -477,11 +475,7 @@ # define CLOSE_ALWAYS 0 # define LEAVE_FOR_DISPLAY 1 -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -char *malloc(), *realloc(); -#endif #if defined(X_NOT_POSIX) && defined(SIGNALRETURNSINT) #define SIGVAL int @@ -506,11 +500,5 @@ typedef SIGVAL (*SIGFUNC)(int); SIGVAL (*Signal(int, SIGFUNC Handler))(int); - -#ifdef MINIX -#include <sys/nbio.h> -void udp_read_cb(nbio_ref_t ref, int res, int err); -void tcp_listen_cb(nbio_ref_t ref, int res, int err); -#endif #endif /* _DM_H_ */ Index: xc/programs/xdm/dm_socket.h diff -u xc/programs/xdm/dm_socket.h:1.1 xc/programs/xdm/dm_socket.h:1.2 --- xc/programs/xdm/dm_socket.h:1.1 Sat Oct 10 11:25:33 1998 +++ xc/programs/xdm/dm_socket.h Mon Jul 23 09:15:52 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xdm/dm_socket.h,v 1.1 1998/10/10 15:25:33 dawes Exp $ + * $XFree86: xc/programs/xdm/dm_socket.h,v 1.2 2001/07/23 13:15:52 dawes Exp $ */ /************************************************************ @@ -40,14 +40,12 @@ #include <X11/Xmd.h> #include <X11/Xdmcp.h> -#ifndef MINIX -# ifndef Lynx -# include <sys/socket.h> -# else -# include <socket.h> -# endif -# include <netinet/in.h> +#ifndef Lynx +# include <sys/socket.h> +#else +# include <socket.h> #endif +#include <netinet/in.h> /* ugly, but we need this after socket.h */ extern ARRAY8Ptr Accept (struct sockaddr *from, int fromlen, CARD16 displayNumber); Index: xc/programs/xdm/dpylist.c diff -u xc/programs/xdm/dpylist.c:1.4 xc/programs/xdm/dpylist.c:1.5 --- xc/programs/xdm/dpylist.c:1.4 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/dpylist.c Fri Dec 14 15:01:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: dpylist.c,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ */ +/* $Xorg: dpylist.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/dpylist.c,v 1.4 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/dpylist.c,v 1.5 2001/12/14 20:01:21 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/error.c diff -u xc/programs/xdm/error.c:1.3 xc/programs/xdm/error.c:1.5 --- xc/programs/xdm/error.c:1.3 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/error.c Fri Dec 14 15:01:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: error.c,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ */ +/* $Xorg: error.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/error.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/error.c,v 1.5 2001/12/14 20:01:21 dawes Exp $ */ /* * xdm - display manager daemon @@ -42,7 +46,7 @@ void LogInfo(char * fmt, ...) { - fprintf (stderr, "xdm info (pid %d): ", getpid()); + fprintf (stderr, "xdm info (pid %ld): ", (long)getpid()); { va_list args; va_start(args, fmt); @@ -55,7 +59,7 @@ void LogError ( char * fmt, ...) { - fprintf (stderr, "xdm error (pid %d): ", getpid()); + fprintf (stderr, "xdm error (pid %ld): ", (long)getpid()); { va_list args; va_start(args, fmt); @@ -67,7 +71,7 @@ void LogPanic (char * fmt, ...) { - fprintf (stderr, "xdm panic (pid %d): ", getpid()); + fprintf (stderr, "xdm panic (pid %ld): ", (long)getpid()); { va_list args; va_start(args, fmt); Index: xc/programs/xdm/file.c diff -u xc/programs/xdm/file.c:1.5 xc/programs/xdm/file.c:1.6 --- xc/programs/xdm/file.c:1.5 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/file.c Fri Dec 14 15:01:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: file.c,v 1.4 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: file.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/file.c,v 1.5 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/file.c,v 1.6 2001/12/14 20:01:21 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/genauth.c diff -u xc/programs/xdm/genauth.c:3.11 xc/programs/xdm/genauth.c:3.13 --- xc/programs/xdm/genauth.c:3.11 Sat Jan 20 09:11:55 2001 +++ xc/programs/xdm/genauth.c Fri Dec 14 15:01:22 2001 @@ -1,9 +1,13 @@ -/* $Xorg: genauth.c,v 1.4 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: genauth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/genauth.c,v 3.11 2001/01/20 14:11:55 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.13 2001/12/14 20:01:22 dawes Exp $ */ /* * xdm - display manager daemon @@ -38,14 +42,8 @@ #include <errno.h> -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -extern int errno; -#else #include <time.h> #define Time_t time_t -#endif static unsigned char key[8]; Index: xc/programs/xdm/greet.h diff -u xc/programs/xdm/greet.h:1.7 xc/programs/xdm/greet.h:1.8 --- xc/programs/xdm/greet.h:1.7 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/greet.h Fri Dec 14 15:01:22 2001 @@ -1,9 +1,13 @@ -/* $Xorg: greet.h,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: greet.h,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greet.h,v 1.7 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greet.h,v 1.8 2001/12/14 20:01:22 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.3 xc/programs/xdm/krb5auth.c:1.4 --- xc/programs/xdm/krb5auth.c:1.3 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/krb5auth.c Fri Dec 14 15:01:22 2001 @@ -1,9 +1,13 @@ -/* $Xorg: krb5auth.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: krb5auth.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/krb5auth.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/krb5auth.c,v 1.4 2001/12/14 20:01:22 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/mitauth.c diff -u xc/programs/xdm/mitauth.c:1.3 xc/programs/xdm/mitauth.c:1.4 --- xc/programs/xdm/mitauth.c:1.3 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/mitauth.c Fri Dec 14 15:01:22 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mitauth.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: mitauth.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/mitauth.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/mitauth.c,v 1.4 2001/12/14 20:01:22 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/netaddr.c diff -u xc/programs/xdm/netaddr.c:3.5 xc/programs/xdm/netaddr.c:3.6 --- xc/programs/xdm/netaddr.c:3.5 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/netaddr.c Fri Dec 14 15:01:22 2001 @@ -1,9 +1,13 @@ -/* $Xorg: netaddr.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: netaddr.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/netaddr.c,v 3.5 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/netaddr.c,v 3.6 2001/12/14 20:01:22 dawes Exp $ */ /* * xdm - X display manager Index: xc/programs/xdm/policy.c diff -u xc/programs/xdm/policy.c:3.5 xc/programs/xdm/policy.c:3.7 --- xc/programs/xdm/policy.c:3.5 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/policy.c Thu Dec 27 15:01:56 2001 @@ -1,9 +1,13 @@ -/* $Xorg: policy.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: policy.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -29,11 +33,13 @@ * * policy.c. Implement site-dependent policy for XDMCP connections */ -/* $XFree86: xc/programs/xdm/policy.c,v 3.5 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/policy.c,v 3.7 2001/12/27 20:01:56 dawes Exp $ */ # include "dm.h" # include "dm_auth.h" +#include <errno.h> + #ifdef XDMCP # include <X11/X.h> @@ -130,10 +136,16 @@ else { if (*willing) - { FILE *fd; - if ((fd = popen(willing, "r")) && fgets(statusBuf, 256, fd)) + { FILE *fd = NULL; + if ((fd = popen(willing, "r"))) { - statusBuf[strlen(statusBuf)-1] = 0; /* chop newline */ + char *s = NULL; + while(!(s = fgets(statusBuf, 256, fd)) && errno == EINTR) + ; + if(s) + statusBuf[strlen(statusBuf)-1] = 0; /* chop newline */ + else + sprintf (statusBuf, "Willing, but %s failed",willing); } else sprintf (statusBuf, "Willing, but %s failed",willing); Index: xc/programs/xdm/protodpy.c diff -u xc/programs/xdm/protodpy.c:1.3 xc/programs/xdm/protodpy.c:1.5 --- xc/programs/xdm/protodpy.c:1.3 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/protodpy.c Fri Dec 14 15:01:23 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: protodpy.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ + * $Xorg: protodpy.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ * * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/protodpy.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/protodpy.c,v 1.5 2001/12/14 20:01:23 dawes Exp $ */ /* * protodpy.c @@ -37,13 +41,8 @@ #ifdef XDMCP #include <sys/types.h> -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -#else #include <time.h> #define Time_t time_t -#endif static struct protoDisplay *protoDisplays; Index: xc/programs/xdm/reset.c diff -u xc/programs/xdm/reset.c:1.3 xc/programs/xdm/reset.c:1.4 --- xc/programs/xdm/reset.c:1.3 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/reset.c Fri Dec 14 15:01:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: reset.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: reset.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/reset.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/reset.c,v 1.4 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/resource.c diff -u xc/programs/xdm/resource.c:3.6 xc/programs/xdm/resource.c:3.7 --- xc/programs/xdm/resource.c:3.6 Wed Jan 17 18:45:21 2001 +++ xc/programs/xdm/resource.c Fri Dec 14 15:01:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: resource.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: resource.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/resource.c,v 3.6 2001/01/17 23:45:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/resource.c,v 3.7 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/rpcauth.c diff -u xc/programs/xdm/rpcauth.c:1.3 xc/programs/xdm/rpcauth.c:1.4 --- xc/programs/xdm/rpcauth.c:1.3 Wed Jan 17 18:45:22 2001 +++ xc/programs/xdm/rpcauth.c Fri Dec 14 15:01:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: rpcauth.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: rpcauth.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/rpcauth.c,v 1.3 2001/01/17 23:45:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/rpcauth.c,v 1.4 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/server.c diff -u xc/programs/xdm/server.c:3.9 xc/programs/xdm/server.c:3.13 --- xc/programs/xdm/server.c:3.9 Wed Jan 17 18:45:22 2001 +++ xc/programs/xdm/server.c Fri Dec 14 15:01:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: server.c,v 1.4 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: server.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/server.c,v 3.9 2001/01/17 23:45:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/server.c,v 3.13 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon @@ -42,19 +46,8 @@ # include <errno.h> # include <sys/socket.h> -#ifdef MINIX -#include <sys/ioctl.h> -#include <net/gen/in.h> -#include <net/gen/tcp.h> -#include <net/gen/tcp_io.h> -#endif - static int receivedUsr1; -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - static int serverPause (unsigned t, int serverPid); static Display *dpy; @@ -63,11 +56,14 @@ static SIGVAL CatchUsr1 (int n) { + int olderrno = errno; + #ifdef SIGNALS_RESET_WHEN_CAUGHT (void) Signal (SIGUSR1, CatchUsr1); #endif Debug ("display manager caught SIGUSR1\n"); ++receivedUsr1; + errno = olderrno; } char *_SysErrorMsg (int n) @@ -263,9 +259,6 @@ #ifdef STREAMSCONN struct netbuf netb; #endif -#ifdef MINIX - nwio_tcpconf_t tcpconf; -#endif if (d->peer) free ((char *) d->peer); @@ -276,25 +269,7 @@ len = 8; /* lucky for us, t_getname returns something that looks like a sockaddr */ #else -#ifdef MINIX - if (ioctl(fd, NWIOGTCPCONF, &tcpconf) == -1) - { - LogError("NWIOGTCPCONF failed: %s\n", strerror(errno)); - len= 0; - } - else - { - struct sockaddr_in *sinp; - - sinp= (struct sockaddr_in *)buf; - len= sizeof(*sinp); - sinp->sin_family= AF_INET; - sinp->sin_port= tcpconf.nwtc_remport; - sinp->sin_addr.s_addr= tcpconf.nwtc_remaddr; - } -#else getpeername (fd, (struct sockaddr *) buf, (void *)&len); -#endif #endif d->peerlen = 0; if (len) Index: xc/programs/xdm/session.c diff -u xc/programs/xdm/session.c:3.27.2.1 xc/programs/xdm/session.c:3.33 --- xc/programs/xdm/session.c:3.27.2.1 Fri May 25 14:50:13 2001 +++ xc/programs/xdm/session.c Fri Dec 14 15:01:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: session.c,v 1.7 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: session.c,v 1.8 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/session.c,v 3.27.2.1 2001/05/25 18:50:13 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/session.c,v 3.33 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon @@ -62,17 +66,9 @@ #endif #endif -#ifdef CSRG_BASED -#include <sys/param.h> -#ifdef HAS_SETUSERCONTEXT -#include <login_cap.h> -#include <pwd.h> -#endif -#endif - static int runAndWait (char **args, char **environ); -#if defined(CSRG_BASED) || defined(__osf__) || defined(__DARWIN__) +#if defined(CSRG_BASED) || defined(__osf__) || defined(__DARWIN__) || defined(__QNXNTO__) #include <sys/types.h> #include <grp.h> #else @@ -154,10 +150,6 @@ #endif }; -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - static Bool StartClient( struct verify_info *verify, struct display *d, @@ -204,12 +196,9 @@ AbortClient (int pid) { int sig = SIGTERM; -#ifdef __STDC__ volatile int i; -#else - int i; -#endif int retId; + for (i = 0; i < 4; i++) { if (killpg (pid, sig) == -1) { switch (errno) { @@ -286,7 +275,11 @@ Debug ("ManageSession %s\n", d->name); (void)XSetIOErrorHandler(IOErrorHandler); (void)XSetErrorHandler(ErrorHandler); +#ifndef HAS_SETPROCTITLE SetTitle(d->name, (char *) 0); +#else + setproctitle("%s", d->name); +#endif /* * Load system default Resources */ @@ -606,9 +599,6 @@ #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 Index: xc/programs/xdm/sessreg.c diff -u xc/programs/xdm/sessreg.c:3.16 xc/programs/xdm/sessreg.c:3.18 --- xc/programs/xdm/sessreg.c:3.16 Wed Jan 17 18:45:22 2001 +++ xc/programs/xdm/sessreg.c Fri Dec 14 15:01:24 2001 @@ -3,7 +3,11 @@ * * Copyright 1990, 1998 The Open Group * - * All Rights Reserved. + * 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. * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. @@ -26,7 +30,7 @@ * by Andreas Stolcke <stolcke@icsi.berkeley.edu> */ -/* $XFree86: xc/programs/xdm/sessreg.c,v 3.16 2001/01/17 23:45:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/sessreg.c,v 3.18 2001/12/14 20:01:24 dawes Exp $ */ /* * sessreg @@ -110,13 +114,8 @@ # endif #endif -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -#else #include <time.h> #define Time_t time_t -#endif #ifdef X_NOT_POSIX extern long lseek (); extern char *ttyname (); Index: xc/programs/xdm/sessreg.man diff -u xc/programs/xdm/sessreg.man:1.7 xc/programs/xdm/sessreg.man:1.8 --- xc/programs/xdm/sessreg.man:1.7 Mon Apr 23 16:31:09 2001 +++ xc/programs/xdm/sessreg.man Fri Dec 14 15:01:24 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: sessreg.man,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ +.\" $Xorg: sessreg.man,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ .\" Copyright 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdm/sessreg.man,v 1.7 2001/04/23 20:31:09 dawes Exp $ +.\" $XFree86: xc/programs/xdm/sessreg.man,v 1.8 2001/12/14 20:01:24 dawes Exp $ .\" .TH SESSREG 1 __xorgversion__ .SH NAME Index: xc/programs/xdm/socket.c diff -u xc/programs/xdm/socket.c:3.7 xc/programs/xdm/socket.c:3.10 --- xc/programs/xdm/socket.c:3.7 Wed Jan 17 18:45:22 2001 +++ xc/programs/xdm/socket.c Fri Dec 14 15:01:24 2001 @@ -1,9 +1,13 @@ -/* $Xorg: socket.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: socket.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/socket.c,v 3.7 2001/01/17 23:45:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/socket.c,v 3.10 2001/12/14 20:01:24 dawes Exp $ */ /* * xdm - display manager daemon @@ -40,7 +44,6 @@ #include <errno.h> #include "dm_socket.h" -#ifndef MINIX #ifndef X_NO_SYS_UN #ifndef Lynx #include <sys/un.h> @@ -49,22 +52,7 @@ #endif #endif #include <netdb.h> -#else /* MINIX */ -#include <net/hton.h> -#include <net/netlib.h> -#include <net/gen/in.h> -#include <net/gen/tcp.h> -#include <net/gen/tcp_io.h> -#include <net/gen/udp.h> -#include <net/gen/udp_io.h> -#include <sys/ioctl.h> -#include <sys/nbio.h> -#endif /* !MINIX */ -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - extern int xdmcpFd; extern int chooserFd; @@ -75,28 +63,13 @@ void CreateWellKnownSockets (void) { -#ifndef MINIX struct sockaddr_in sock_addr; -#else /* MINIX */ - char *tcp_device, *udp_device; - nwio_udpopt_t udpopt; - nwio_tcpconf_t tcpconf; - int flags; - nbio_ref_t ref; -#endif /* !MINIX */ char *name; if (request_port == 0) return; Debug ("creating socket %d\n", request_port); -#ifdef MINIX - udp_device= getenv("UDP_DEVICE"); - if (udp_device == NULL) - udp_device= UDP_DEVICE; - xdmcpFd = open(udp_device, O_RDWR); -#else xdmcpFd = socket (AF_INET, SOCK_DGRAM, 0); -#endif if (xdmcpFd == -1) { LogError ("XDMCP socket creation failed, errno %d\n", errno); return; @@ -104,36 +77,6 @@ name = localHostname (); registerHostname (name, strlen (name)); RegisterCloseOnFork (xdmcpFd); -#ifdef MINIX - udpopt.nwuo_flags= NWUO_SHARED | NWUO_LP_SET | NWUO_EN_LOC | - NWUO_EN_BROAD | NWUO_RP_ANY | NWUO_RA_ANY | NWUO_RWDATALL | - NWUO_DI_IPOPT; - udpopt.nwuo_locport= htons(request_port); - if (ioctl(xdmcpFd, NWIOSUDPOPT, &udpopt) == -1) - { - LogError ("error %d binding socket address %d\n", errno, request_port); - close (xdmcpFd); - xdmcpFd = -1; - return; - } - if ((flags= fcntl(xdmcpFd, F_GETFD)) == -1) - { - LogError ("F_GETFD failed: %s\n", strerror(errno)); - close (xdmcpFd); - xdmcpFd = -1; - return; - } - if (fcntl(xdmcpFd, F_SETFD, flags | FD_ASYNCHIO) == -1) - { - LogError ("F_SETFD failed: %s\n", strerror(errno)); - close (xdmcpFd); - xdmcpFd = -1; - return; - } - nbio_register(xdmcpFd); - ref.ref_int= xdmcpFd; - nbio_setcallback(xdmcpFd, ASIO_READ, udp_read_cb, ref); -#else /* zero out the entire structure; this avoids 4.4 incompatibilities */ bzero ((char *) &sock_addr, sizeof (sock_addr)); #ifdef BSD44SOCKETS @@ -149,55 +92,17 @@ xdmcpFd = -1; return; } -#endif WellKnownSocketsMax = xdmcpFd; FD_SET (xdmcpFd, &WellKnownSocketsMask); -#ifdef MINIX - tcp_device= getenv("TCP_DEVICE"); - if (tcp_device == NULL) - tcp_device= TCP_DEVICE; - chooserFd = open(tcp_device, O_RDWR); -#else chooserFd = socket (AF_INET, SOCK_STREAM, 0); -#endif Debug ("Created chooser socket %d\n", chooserFd); if (chooserFd == -1) { LogError ("chooser socket creation failed, errno %d\n", errno); return; } -#ifdef MINIX - tcpconf.nwtc_flags= NWTC_EXCL | NWTC_LP_SEL | NWTC_UNSET_RA | - NWTC_UNSET_RP; - if (ioctl(chooserFd, NWIOSTCPCONF, &tcpconf) == -1) - { - LogError("NWIOSTCPCONF failed: %s\n", strerror(errno)); - close(chooserFd); - chooserFd= -1; - return; - } - GetChooserAddr(NULL, NULL); - if ((flags= fcntl(chooserFd, F_GETFD)) == -1) - { - LogError ("F_GETFD failed: %s\n", strerror(errno)); - close (chooserFd); - chooserFd = -1; - return; - } - if (fcntl(chooserFd, F_SETFD, flags | FD_ASYNCHIO) == -1) - { - LogError ("F_SETFD failed: %s\n", strerror(errno)); - close (chooserFd); - chooserFd = -1; - return; - } - nbio_register(chooserFd); - ref.ref_int= chooserFd; - nbio_setcallback(chooserFd, ASIO_IOCTL, tcp_listen_cb, ref); -#else listen (chooserFd, 5); -#endif if (chooserFd > WellKnownSocketsMax) WellKnownSocketsMax = chooserFd; FD_SET (chooserFd, &WellKnownSocketsMask); @@ -208,7 +113,6 @@ char *addr, int *lenp) { -#ifndef MINIX struct sockaddr_in in_addr; int len; @@ -219,31 +123,6 @@ memmove( addr, (char *) &in_addr, len); *lenp = len; -#else /* MINIX */ - - static struct sockaddr_in in_addr; - static int first_time= 1; - int len; - nwio_tcpconf_t tcpconf; - - if (first_time) - { - first_time= 0; - if (ioctl(chooserFd, NWIOGTCPCONF, &tcpconf) == -1) - { - LogError("NWIOGTCPCONF failed: %s\n", strerror(errno)); - return -1; - } - in_addr.sin_family= AF_INET; - in_addr.sin_port= tcpconf.nwtc_locport; - in_addr.sin_addr.s_addr= tcpconf.nwtc_locaddr; - if (addr == NULL) - return 0; - } - len = sizeof in_addr; - memmove( addr, (char *) &in_addr, len); - *lenp = len; -#endif /* !MINIX */ return 0; } Index: xc/programs/xdm/streams.c diff -u xc/programs/xdm/streams.c:3.5 xc/programs/xdm/streams.c:3.6 --- xc/programs/xdm/streams.c:3.5 Wed Jan 17 18:45:22 2001 +++ xc/programs/xdm/streams.c Fri Dec 14 15:01:24 2001 @@ -1,9 +1,13 @@ -/* $Xorg: streams.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: streams.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/streams.c,v 3.5 2001/01/17 23:45:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/streams.c,v 3.6 2001/12/14 20:01:24 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/util.c diff -u xc/programs/xdm/util.c:3.17 xc/programs/xdm/util.c:3.19 --- xc/programs/xdm/util.c:3.17 Wed Feb 28 13:58:54 2001 +++ xc/programs/xdm/util.c Fri Dec 14 15:01:24 2001 @@ -1,9 +1,13 @@ -/* $Xorg: util.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ +/* $Xorg: util.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/util.c,v 3.17 2001/02/28 18:58:54 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/util.c,v 3.19 2001/12/14 20:01:24 dawes Exp $ */ /* * xdm - display manager daemon @@ -51,7 +55,7 @@ #undef _POSIX_SOURCE #endif #endif -#if defined(__osf__) || defined(linux) || defined(MINIX) || defined(__QNXNTO__) || defined(__GNU__) +#if defined(__osf__) || defined(linux) || defined(__QNXNTO__) || defined(__GNU__) #define setpgrp setpgid #endif @@ -245,15 +249,7 @@ #endif #else setpgrp (0, getpid ()); -#ifdef MINIX /* actually POSIX */ - { - sigset_t ss; - sigemptyset(&ss); - sigprocmask(SIG_SETMASK, &ss, NULL); - } -#else sigsetmask (0); -#endif #endif #endif #ifdef SIGCHLD Index: xc/programs/xdm/xdm.man diff -u xc/programs/xdm/xdm.man:3.20 xc/programs/xdm/xdm.man:3.21 --- xc/programs/xdm/xdm.man:3.20 Mon Apr 23 16:31:09 2001 +++ xc/programs/xdm/xdm.man Fri Dec 14 15:01:25 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xdm.man,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ +.\" $Xorg: xdm.man,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdm/xdm.man,v 3.20 2001/04/23 20:31:09 dawes Exp $ +.\" $XFree86: xc/programs/xdm/xdm.man,v 3.21 2001/12/14 20:01:25 dawes Exp $ .\" .TH XDM 1 __xorgversion__ .SH NAME Index: xc/programs/xdm/xdmauth.c diff -u xc/programs/xdm/xdmauth.c:1.4 xc/programs/xdm/xdmauth.c:1.5 --- xc/programs/xdm/xdmauth.c:1.4 Wed Jan 17 18:45:22 2001 +++ xc/programs/xdm/xdmauth.c Fri Dec 14 15:01:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xdmauth.c,v 1.3 2000/08/17 19:54:16 cpqbld Exp $ */ +/* $Xorg: xdmauth.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.4 2001/01/17 23:45:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.5 2001/12/14 20:01:25 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.14 xc/programs/xdm/xdmcp.c:3.19 --- xc/programs/xdm/xdmcp.c:3.14 Mon Feb 26 18:04:22 2001 +++ xc/programs/xdm/xdmcp.c Fri Dec 14 15:01:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xdmcp.c,v 1.3 2000/08/17 19:54:16 cpqbld Exp $ */ +/* $Xorg: xdmcp.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.14 2001/02/26 23:04:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.19 2001/12/14 20:01:25 dawes Exp $ */ /* * xdm - display manager daemon @@ -44,7 +48,6 @@ # include "dm_socket.h" -#ifndef MINIX #ifndef X_NO_SYS_UN #ifndef Lynx #include <sys/un.h> @@ -52,31 +55,17 @@ #include <un.h> #endif #endif +#if defined(__SVR4) && defined(__sun) + /* + * make sure we get the resolver's version of gethostbyname + * otherwise we may not get all the addresses! + */ +#define gethostbyname res_gethostbyname +#endif #include <netdb.h> -#else /* MINIX */ -#include <net/hton.h> -#include <net/gen/netdb.h> -#endif /* !MINIX */ - -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -#else + #include <time.h> #define Time_t time_t -#endif - -#ifdef MINIX -struct sockaddr_un -{ - u16_t sun_family; - char sun_path[62]; -}; -static char read_buffer[XDM_MAX_MSGLEN+sizeof(udp_io_hdr_t)]; -static int read_inprogress; -static int read_size; -#define select(n,r,w,x,t) nbio_select(n,r,w,x,t) -#endif #define getString(name,len) ((name = malloc (len + 1)) ? 1 : 0) @@ -296,45 +285,13 @@ XdmcpHeader header; struct sockaddr addr; int addrlen = sizeof addr; -#ifdef MINIX - int r; -#endif -#ifdef MINIX - if (read_inprogress) abort(); - if (read_size == 0) - { - r= read(xdmcpFd, read_buffer, sizeof(read_buffer)); - if (r == -1 && errno == EINPROGRESS) - { - read_inprogress= 1; - nbio_inprogress(xdmcpFd, ASIO_READ, 1 /* read */, - 0 /* write */, 0 /* exception */); - } - else if (r <= 0) - { - LogError("read error: %s\n", - r == 0 ? "EOF" : strerror(errno)); - return; - } - } -#endif - Debug ("ProcessRequestSocket\n"); bzero ((char *) &addr, sizeof (addr)); -#ifdef MINIX - if (!MNX_XdmcpFill (xdmcpFd, &buffer, &addr, &addrlen, - read_buffer, read_size)) - { - return; - } - read_size= 0; -#else if (!XdmcpFill (xdmcpFd, &buffer, (XdmcpNetaddr) &addr, &addrlen)) { Debug ("XdmcpFill failed\n"); return; } -#endif if (!XdmcpReadHeader (&buffer, &header)) { Debug ("XdmcpReadHeader failed\n"); return; @@ -380,17 +337,7 @@ Debug ("WaitForSomething\n"); if (AnyWellKnownSockets () && !ChildReady) { reads = WellKnownSocketsMask; -#ifdef MINIX__NOT - { - struct timeval tv; - tv.tv_sec= 5; - tv.tv_usec= 0; - nready = select (WellKnownSocketsMax + 1, &reads, 0, 0, &tv); - ChildReady= 1; - } -#else nready = select (WellKnownSocketsMax + 1, &reads, 0, 0, 0); -#endif Debug ("select returns %d. Rescan: %d ChildReady: %d\n", nready, Rescan, ChildReady); if (nready > 0) @@ -495,15 +442,7 @@ hostent = gethostbyaddr ((char *)data, connectionAddress->length, AF_INET); if (sourceAddress && hostent) { -#if defined(__SVR4) && defined(__sun) - /* - * make sure we get the resolver's version of gethostbyname - * otherwise we may not get all the addresses! - */ - hostent = (struct hostent *) res_gethostbyname(hostent->h_name); -#else hostent = gethostbyname(hostent->h_name); -#endif if (hostent) multiHomed = hostent->h_addr_list[1] != NULL; } @@ -653,7 +592,7 @@ memmove( un_addr.sun_path, clientAddress.data, clientAddress.length); un_addr.sun_path[clientAddress.length] = '\0'; client = (struct sockaddr *) &un_addr; -#if defined(BSD44SOCKETS) && !defined(Lynx) +#if defined(BSD44SOCKETS) && !defined(Lynx) && defined(UNIXCONN) un_addr.sun_len = strlen(un_addr.sun_path); clientlen = SUN_LEN(&un_addr); #else @@ -1342,21 +1281,3 @@ #endif /* XDMCP */ -#ifdef MINIX -void udp_read_cb(nbio_ref_t ref, int res, int err) -{ - if (!read_inprogress) - abort(); - if (res > 0) - { - read_size= res; - } - else - { - LogError("read error: %s\n", - res == 0 ? "EOF" : strerror(err)); - read_size= 0; - } - read_inprogress= 0; -} -#endif Index: xc/programs/xdm/xdmshell.c diff -u xc/programs/xdm/xdmshell.c:3.5 xc/programs/xdm/xdmshell.c:3.7 --- xc/programs/xdm/xdmshell.c:3.5 Wed Jan 17 18:45:23 2001 +++ xc/programs/xdm/xdmshell.c Fri Dec 14 15:01:26 2001 @@ -1,11 +1,15 @@ -/* $Xorg: xdmshell.c,v 1.3 2000/08/17 19:54:16 cpqbld Exp $ */ +/* $Xorg: xdmshell.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* * xdmshell - simple program for running xdm from login * * Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -32,14 +36,11 @@ * bring down X when you are finished. */ -/* $XFree86: xc/programs/xdm/xdmshell.c,v 3.5 2001/01/17 23:45:23 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmshell.c,v 3.7 2001/12/14 20:01:26 dawes Exp $ */ #include <stdio.h> #include "dm.h" #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #ifdef macII #define ON_CONSOLE_ONLY Index: xc/programs/xdm/config/Imakefile diff -u xc/programs/xdm/config/Imakefile:1.8 xc/programs/xdm/config/Imakefile:1.9 --- xc/programs/xdm/config/Imakefile:1.8 Wed Jan 17 18:45:24 2001 +++ xc/programs/xdm/config/Imakefile Sun Nov 25 07:49:19 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xdm/config/Imakefile,v 1.8 2001/01/17 23:45:24 dawes Exp $ +XCOMM $XFree86: xc/programs/xdm/config/Imakefile,v 1.9 2001/11/25 12:49:19 herrb Exp $ SERVERSTYPE = XdmServersType @@ -28,8 +28,14 @@ XDMPIDDIR = $(XDMDIR) #endif +#if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) +SU = "su -m" +#else +SU = su +#endif + CppFileTarget(Xservers.ws,Xserv.ws.cpp,-DBINDIR=$(BINDIR) -DDEFAULTVT=$(DEFAULTVT),NullParameter) -CppFileTarget(xdm-config,xdm-conf.cpp,-DXDMDIR=$(XDMDIR) -DXDMLOGDIR=$(XDMLOGDIR) -DXDMPIDDIR=$(XDMPIDDIR),NullParameter) +CppFileTarget(xdm-config,xdm-conf.cpp,-DXDMDIR=$(XDMDIR) -DXDMLOGDIR=$(XDMLOGDIR) -DXDMPIDDIR=$(XDMPIDDIR) -DSU=$(SU),NullParameter) CppFileTarget(Xresources,Xres.cpp,$(XPM_DEFINES),NullParameter) LinkFile(Xservers,Xservers.$(SERVERSTYPE)) Index: xc/programs/xdm/config/xdm-conf.cpp diff -u xc/programs/xdm/config/xdm-conf.cpp:1.7 xc/programs/xdm/config/xdm-conf.cpp:1.9 --- xc/programs/xdm/config/xdm-conf.cpp:1.7 Wed Jan 17 18:45:24 2001 +++ xc/programs/xdm/config/xdm-conf.cpp Sun Nov 25 07:49:19 2001 @@ -3,14 +3,14 @@ ! ! ! -! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.7 2001/01/17 23:45:24 dawes Exp $ +! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.9 2001/11/25 12:49:19 herrb Exp $ ! DisplayManager.errorLogFile: XDMLOGDIR/xdm-errors DisplayManager.pidFile: XDMPIDDIR/xdm-pid DisplayManager.keyFile: XDMDIR/xdm-keys DisplayManager.servers: XDMDIR/Xservers DisplayManager.accessFile: XDMDIR/Xaccess -DisplayManager.willing: su nobody -c XDMDIR/Xwilling +DisplayManager.willing: SU nobody -c XDMDIR/Xwilling ! All displays should use authorization, but we cannot be sure ! X terminals will be configured that way, so by default ! use authorization only for local displays :0, :1, etc. @@ -23,7 +23,7 @@ ! DisplayManager*resources: XDMDIR/Xresources DisplayManager*session: XDMDIR/Xsession -DisplayManager*authComplain: false +DisplayManager*authComplain: true #ifdef XPM ! this is a new line Caolan, 9312811@ul.ie DisplayManager*loginmoveInterval: 10 Index: xc/programs/xdm/greeter/Login.c diff -u xc/programs/xdm/greeter/Login.c:3.13 xc/programs/xdm/greeter/Login.c:3.15 --- xc/programs/xdm/greeter/Login.c:3.13 Tue Mar 6 12:31:39 2001 +++ xc/programs/xdm/greeter/Login.c Wed Jan 2 18:24:04 2002 @@ -1,9 +1,13 @@ -/* $Xorg: Login.c,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ +/* $Xorg: Login.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.13 2001/03/06 17:31:39 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.15 2002/01/02 23:24:04 dawes Exp $ */ /* * xdm - display manager daemon @@ -945,13 +949,10 @@ MoveToBegining(ctxw, event, params, num_params); return; default: - if (IsFunctionKey(keysym) || IsMiscFunctionKey(keysym) || - IsPrivateKeypadKey(keysym) || IsCursorKey(keysym) || - IsKeypadKey(keysym) || IsPFKey(keysym)) { - XBell(XtDisplay(ctxw), 60); + if (len == 0) { + if (!IsModifierKey(keysym)) /* it's not a modifier */ + XBell(XtDisplay(ctxw), 60); return; - } else if (len == 0 && IsModifierKey(keysym)) { - return; /* it's a modifier */ } else break; } Index: xc/programs/xdm/greeter/Login.h diff -u xc/programs/xdm/greeter/Login.h:3.5 xc/programs/xdm/greeter/Login.h:3.6 --- xc/programs/xdm/greeter/Login.h:3.5 Wed Jan 17 18:45:25 2001 +++ xc/programs/xdm/greeter/Login.h Fri Dec 14 15:01:28 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Login.h,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ +/* $Xorg: Login.h,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.5 2001/01/17 23:45:25 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.6 2001/12/14 20:01:28 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/greeter/LoginP.h diff -u xc/programs/xdm/greeter/LoginP.h:3.7 xc/programs/xdm/greeter/LoginP.h:3.8 --- xc/programs/xdm/greeter/LoginP.h:3.7 Wed Jan 17 18:45:25 2001 +++ xc/programs/xdm/greeter/LoginP.h Fri Dec 14 15:01:29 2001 @@ -1,9 +1,13 @@ -/* $Xorg: LoginP.h,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ +/* $Xorg: LoginP.h,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.7 2001/01/17 23:45:25 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.8 2001/12/14 20:01:29 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/greeter/greet.c diff -u xc/programs/xdm/greeter/greet.c:3.13 xc/programs/xdm/greeter/greet.c:3.15 --- xc/programs/xdm/greeter/greet.c:3.13 Fri May 11 05:03:07 2001 +++ xc/programs/xdm/greeter/greet.c Fri Dec 14 15:01:29 2001 @@ -1,9 +1,13 @@ -/* $Xorg: greet.c,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ +/* $Xorg: greet.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.13 2001/05/11 09:03:07 alanh Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.15 2001/12/14 20:01:29 dawes Exp $ */ /* * xdm - display manager daemon @@ -48,6 +52,11 @@ #ifdef __OpenBSD__ #include <syslog.h> +#endif + +#if defined(SECURE_RPC) && defined(sun) +/* Go figure, there's no getdomainname() prototype available */ +extern int getdomainname(char *name, size_t len); #endif #ifdef GREET_LIB Index: xc/programs/xdm/greeter/verify.c diff -u xc/programs/xdm/greeter/verify.c:3.13.2.1 xc/programs/xdm/greeter/verify.c:3.21 --- xc/programs/xdm/greeter/verify.c:3.13.2.1 Fri May 25 14:50:14 2001 +++ xc/programs/xdm/greeter/verify.c Fri Dec 14 15:01:29 2001 @@ -1,9 +1,13 @@ -/* $Xorg: verify.c,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ +/* $Xorg: verify.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.13.2.1 2001/05/25 18:50:14 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.21 2001/12/14 20:01:29 dawes Exp $ */ /* * xdm - display manager daemon @@ -43,18 +47,11 @@ # ifdef USESHADOW # include <shadow.h> # include <errno.h> -# ifdef X_NOT_STDC_ENV -extern int errno; -# endif # endif #endif # include "greet.h" -#ifdef X_NOT_STDC_ENV -char *getenv(); -#endif - #ifdef QNX4 extern char *crypt(const char *, const char *); #endif @@ -124,35 +121,42 @@ #endif struct pam_response **resp, void *appdata_ptr) { - int replies = 0; + int count = 0, replies = 0; struct pam_response *reply = NULL; + size_t size = sizeof(struct pam_response); - reply = malloc(sizeof(struct pam_response)); - if (!reply) return PAM_CONV_ERR; -#define COPY_STRING(s) (s) ? strdup(s) : NULL +#define GET_MEM \ + if (reply) realloc(reply, size); \ + else reply = (struct pam_response*)malloc(size); \ + if (!reply) return PAM_CONV_ERR; \ + size += sizeof(struct pam_response) +#define COPY_STRING(s) (s) ? strdup(s) : (char*)NULL - for (replies = 0; replies < num_msg; replies++) { - switch (msg[replies]->msg_style) { + for (count = 0; count < num_msg; count++) { + switch (msg[count]->msg_style) { + case PAM_PROMPT_ECHO_ON: + /* user name given to PAM already */ + return PAM_CONV_ERR; case PAM_PROMPT_ECHO_OFF: /* wants password */ + GET_MEM; reply[replies].resp_retcode = PAM_SUCCESS; reply[replies].resp = COPY_STRING(PAM_password); + /* PAM frees resp */ break; case PAM_TEXT_INFO: /* ignore the informational mesage */ break; - case PAM_PROMPT_ECHO_ON: - /* user name given to PAM already */ - /* fall through */ default: /* unknown or PAM_ERROR_MSG */ - free (reply); + if (reply) free (reply); return PAM_CONV_ERR; } } #undef COPY_STRING - *resp = reply; +#undef GET_MEM + if (reply) *resp = reply; return PAM_SUCCESS; } @@ -162,6 +166,115 @@ }; #endif /* USE_PAM */ +#ifdef USE_BSDAUTH +int +Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) +{ + struct passwd *p; + login_cap_t *lc; + auth_session_t *as; + char *style, *shell, *home, *s, **argv; + char path[MAXPATHLEN]; + int authok; + + /* User may have specified an authentication style. */ + if ((style = strchr(greet->name, ':')) != NULL) + *style++ = '\0'; + + Debug ("Verify %s, style %s ...\n", greet->name, + style ? style : "default"); + + p = getpwnam (greet->name); + endpwent(); + + if (!p || strlen (greet->name) == 0) { + Debug("getpwnam() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + + if ((lc = login_getclass(p->pw_class)) == NULL) { + Debug("login_getclass() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + if ((style = login_getstyle(lc, style, "xdm")) == NULL) { + Debug("login_getstyle() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + if ((as = auth_open()) == NULL) { + Debug("auth_open() failed.\n"); + login_close(lc); + bzero(greet->password, strlen(greet->password)); + return 0; + } + if (auth_setoption(as, "login", "yes") == -1) { + Debug("auth_setoption() failed.\n"); + login_close(lc); + bzero(greet->password, strlen(greet->password)); + return 0; + } + + /* Set up state for no challenge, just check a response. */ + auth_setstate(as, 0); + auth_setdata(as, "", 1); + auth_setdata(as, greet->password, strlen(greet->password) + 1); + + /* Build path of the auth script and call it */ + snprintf(path, sizeof(path), _PATH_AUTHPROG "%s", style); + auth_call(as, path, style, "-s", "response", greet->name, NULL); + authok = auth_getstate(as); + + if ((authok & AUTH_ALLOW) == 0) { + Debug("password verify failed\n"); + bzero(greet->password, strlen(greet->password)); + auth_close(as); + login_close(lc); + return 0; + } + /* Run the approval script */ + if (!auth_approval(as, lc, greet->name, "auth-xdm")) { + Debug("login not approved\n"); + bzero(greet->password, strlen(greet->password)); + auth_close(as); + login_close(lc); + return 0; + } + auth_close(as); + login_close(lc); + /* Check empty passwords against allowNullPasswd */ + if (!greet->allow_null_passwd && strlen(greet->password) == 0) { + Debug("empty password not allowed\n"); + return 0; + } + /* Only accept root logins if allowRootLogin resource is set */ + if (p->pw_uid == 0 && !greet->allow_root_login) { + Debug("root logins not allowed\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + + /* + * Shell must be in /etc/shells + */ + for (;;) { + s = getusershell(); + if (s == NULL) { + /* did not found the shell in /etc/shells + -> failure */ + Debug("shell not in /etc/shells\n"); + bzero(greet->password, strlen(greet->password)); + endusershell(); + return 0; + } + if (strcmp(s, p->pw_shell) == 0) { + /* found the shell in /etc/shells */ + endusershell(); + break; + } + } +#else /* !USE_BSDAUTH */ int Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) { @@ -172,16 +285,17 @@ #ifdef USESHADOW struct spwd *sp; #endif + char *user_pass = NULL; #endif #ifdef __OpenBSD__ char *s; struct timeval tp; #endif - char *user_pass = NULL; char *shell, *home; char **argv; Debug ("Verify %s ...\n", greet->name); +#ifndef USE_PAM p = getpwnam (greet->name); endpwent(); @@ -190,7 +304,6 @@ 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"); @@ -198,9 +311,9 @@ return 0; } #endif -#endif user_pass = p->pw_passwd; } +#endif #ifdef KERBEROS if(strcmp(greet->name, "root") != 0){ char name[ANAME_SZ]; @@ -265,7 +378,9 @@ return 0; } /* else: null passwd okay */ } +#ifdef KERBEROS done: +#endif #ifdef __OpenBSD__ /* * Only accept root logins if allowRootLogin resource is set @@ -318,10 +433,10 @@ #else /* USE_PAM */ #define PAM_BAIL \ - if (pam_error != PAM_SUCCESS) { pam_end(*pamhp, 0); return 0; } + if (pam_error != PAM_SUCCESS) goto pam_failed; PAM_password = greet->password; - pam_error = pam_start("xdm", p->pw_name, &PAM_conversation, pamhp); + pam_error = pam_start("xdm", greet->name, &PAM_conversation, pamhp); PAM_BAIL; pam_error = pam_set_item(*pamhp, PAM_TTY, d->name); PAM_BAIL; @@ -334,8 +449,24 @@ PAM_BAIL; pam_error = pam_setcred(*pamhp, 0); PAM_BAIL; + p = getpwnam (greet->name); + endpwent(); + + if (!p || strlen (greet->name) == 0) { + Debug ("getpwnam() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + + if (pam_error != PAM_SUCCESS) { + pam_failed: + pam_end(*pamhp, PAM_SUCCESS); + *pamhp = NULL; + return 0; + } #undef PAM_BAIL #endif /* USE_PAM */ +#endif /* USE_BSDAUTH */ Debug ("verify succeeded\n"); /* The password is passed to StartClient() for use by user-based Index: xc/programs/xdpyinfo/Imakefile diff -u xc/programs/xdpyinfo/Imakefile:3.13 xc/programs/xdpyinfo/Imakefile:3.15 --- xc/programs/xdpyinfo/Imakefile:3.13 Tue Apr 3 18:37:02 2001 +++ xc/programs/xdpyinfo/Imakefile Thu Dec 27 15:02:34 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xdpyinfo/Imakefile,v 3.13 2001/04/03 22:37:02 dawes Exp $ +XCOMM $XFree86: xc/programs/xdpyinfo/Imakefile,v 3.15 2001/12/27 20:02:34 dawes Exp $ #if HasShm @@ -40,6 +40,12 @@ XINPUTLIBS = $(XILIB) #endif +#if BuildRenderLibrary + XRENDERDEFINES = -DXRENDER + XRENDERDEPLIBS = $(DEPXRENDERLIB) + XRENDERLIBS = $(XRENDERLIB) +#endif + XF86DEFINES = $(VIDMODEDEFINES) $(DGADEFINES) $(XF86MISCDEFINES) DEPXF86LIBS = $(VIDMODEDEPLIBS) $(DGADEPLIBS) $(XF86MISCDEPLIBS) XF86LIBS = $(VIDMODELIBS) $(DGALIBS) $(XF86MISCLIBS) @@ -52,10 +58,16 @@ XKBDEFINES = -DXKB #endif +#if BuildXineramaLibrary + XINERAMADEFINES = -DPANORAMIX + XINERAMALIBS = $(XINERAMALIB) +#endif + OTHERDEFINES = $(SHMDEFINES) $(XKBDEFINES) $(XINPUTDEFINES) \ - $(MULTIBUFDEFINES) $(XIEDEFINES) - OTHERDEPLIBS = $(XINPUTDEPLIBS) $(XIEDEPLIBS) - OTHERLIBS = $(XINPUTLIBS) $(XIELIBS) + $(MULTIBUFDEFINES) $(XIEDEFINES) $(XRENDERDEFINES) \ + $(XINERAMADEFINES) + OTHERDEPLIBS = $(XINPUTDEPLIBS) $(XIEDEPLIBS) $(XRENDERDEPLIBS) + OTHERLIBS = $(XINPUTLIBS) $(XIELIBS) $(XRENDERLIBS) $(XINERAMALIBS) DEFINES = $(OTHERDEFINES) $(XF86DEFINES) DEPLIBS = $(DEPXTESTLIB) XkbClientDepLibs $(OTHERDEPLIBS) \ Index: xc/programs/xdpyinfo/xdpyinfo.c diff -u xc/programs/xdpyinfo/xdpyinfo.c:3.23 xc/programs/xdpyinfo/xdpyinfo.c:3.27 --- xc/programs/xdpyinfo/xdpyinfo.c:3.23 Tue Apr 3 18:37:02 2001 +++ xc/programs/xdpyinfo/xdpyinfo.c Wed Jan 16 15:30:19 2002 @@ -1,12 +1,16 @@ /* - * $Xorg: xdpyinfo.c,v 1.4 2000/08/17 19:54:18 cpqbld Exp $ + * $Xorg: xdpyinfo.c,v 1.5 2001/02/09 02:05:41 xorgcvs Exp $ * * xdpyinfo - print information about X display connecton * * Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -25,7 +29,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xdpyinfo/xdpyinfo.c,v 3.23 2001/04/03 22:37:02 dawes Exp $ */ +/* $XFree86: xc/programs/xdpyinfo/xdpyinfo.c,v 3.27 2002/01/16 20:30:19 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -63,6 +67,12 @@ #ifdef XINPUT #include <X11/extensions/XInput.h> #endif +#ifdef XRENDER +#include <X11/extensions/Xrender.h> +#endif +#ifdef PANORAMIX +#include <X11/extensions/Xinerama.h> +#endif #include <X11/Xos.h> #include <stdio.h> #include <stdlib.h> @@ -156,7 +166,7 @@ printf(".%d", vendrel % 10); } } else { - /* post-4.0.2 */ + /* post-4.0.x */ printf("%d.%d.%d", vendrel / 10000000, (vendrel / 100000) % 100, (vendrel / 1000) % 100); @@ -921,6 +931,119 @@ } #endif +#ifdef XRENDER +static int +print_xrender_info(Display *dpy, char *extname) +{ + int loop, num_extensions; + char **extensions; + XRenderPictFormat *pictform; + int count; + int major, minor; + int i, j; + XVisualInfo viproto; /* fill in for getting info */ + XVisualInfo *vip; /* retured info */ + int nvi; /* number of elements returned */ + int ndepths = 0, *depths = NULL; + + if (!XRenderQueryVersion (dpy, &major, &minor)) + return 0; + + print_standard_extension_info(dpy, extname, major, minor); + + extensions = XListExtensions(dpy, &num_extensions); + for (loop = 0; loop < num_extensions && + (strcmp(extensions[loop], extname) != 0); loop++); + XFreeExtensionList(extensions); + if (loop != num_extensions) { + printf (" Render formats :\n"); + for (count = 0; (pictform = XRenderFindFormat (dpy, 0, 0, count)); count++) + { + printf (" pict format:\n"); + printf ("\tformat id: 0x%lx\n", pictform->id); + printf ("\ttype: %s\n", + pictform->type == PictTypeIndexed ? "Indexed" : "Direct"); + printf ("\tdepth: %d\n", pictform->depth); + if (pictform->type == PictTypeDirect) { + printf("\talpha: %2d mask 0x%x\n", pictform->direct.alpha, pictform->direct.alphaMask); + printf("\tred: %2d mask 0x%x\n", pictform->direct.red, pictform->direct.redMask); + printf("\tgreen: %2d mask 0x%x\n", pictform->direct.green, pictform->direct.greenMask); + printf("\tblue: %2d mask 0x%x\n", pictform->direct.blue, pictform->direct.blueMask); + } + else + printf("\tcolormap 0x%lx\n", pictform->colormap); + } + printf (" Screen formats :\n"); + for (i = 0; i < ScreenCount (dpy); i++) { + nvi = 0; + viproto.screen = i; + vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); + printf (" Screen %d\n", i); + for (j = 0; j < nvi; j++) + { + printf (" visual format:\n"); + printf (" visual id: 0x%lx\n", vip[j].visualid); + pictform = XRenderFindVisualFormat (dpy, vip[j].visual); + if (pictform) + printf(" pict format id: 0x%lx\n", pictform->id); + else + printf(" pict format id: None\n"); + } + if (vip) XFree ((char *) vip); + depths = XListDepths (dpy, i, &ndepths); + if (!depths) ndepths = 0; + for (j = 0; j < ndepths; j++) + { + XRenderPictFormat templ; + + templ.depth = depths[j]; + printf (" depth formats:\n"); + printf (" depth %d\n", depths[j]); + for (count = 0; (pictform = XRenderFindFormat (dpy, PictFormatDepth, &templ, count)); count++) + printf(" pict format id: 0x%lx\n", pictform->id); + } + } + return 1; + } + else + return 0; +} +#endif /* XRENDER */ + + +#ifdef PANORAMIX + +static int +print_xinerama_info(Display *dpy, char *extname) +{ + int majorrev, minorrev; + + if (!XineramaQueryVersion (dpy, &majorrev, &minorrev)) + return 0; + + print_standard_extension_info(dpy, extname, majorrev, minorrev); + + if (!XineramaIsActive(dpy)) { + printf(" Xinerama is inactive.\n"); + } else { + int i, count = 0; + XineramaScreenInfo *xineramaScreens = XineramaQueryScreens(dpy, &count); + + for (i = 0; i < count; i++) { + XineramaScreenInfo *xs = &xineramaScreens[i]; + printf(" head #%d: %dx%d @ %d,%d\n", xs->screen_number, + xs->width, xs->height, xs->x_org, xs->y_org); + } + + XFree(xineramaScreens); + } + + return 1; +} + +#endif /* PANORAMIX */ + + /* utilities to manage the list of recognized extensions */ @@ -965,7 +1088,13 @@ {"DOUBLE-BUFFER", print_dbe_info, False}, {"RECORD", print_record_info, False}, #ifdef XINPUT - {INAME, print_xinput_info, False} + {INAME, print_xinput_info, False}, +#endif +#ifdef XRENDER + {RENDER_NAME, print_xrender_info, False}, +#endif +#ifdef PANORAMIX + {"XINERAMA", print_xinerama_info, False}, #endif /* add new extensions here */ /* wish list: PEX */ Index: xc/programs/xdpyinfo/xdpyinfo.man diff -u xc/programs/xdpyinfo/xdpyinfo.man:3.7 xc/programs/xdpyinfo/xdpyinfo.man:3.8 --- xc/programs/xdpyinfo/xdpyinfo.man:3.7 Sat Jan 27 13:21:11 2001 +++ xc/programs/xdpyinfo/xdpyinfo.man Fri Dec 14 15:01:30 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xdpyinfo.man,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ +.\" $Xorg: xdpyinfo.man,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ .\" Copyright 1988, 1989, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdpyinfo/xdpyinfo.man,v 3.7 2001/01/27 18:21:11 dawes Exp $ +.\" $XFree86: xc/programs/xdpyinfo/xdpyinfo.man,v 3.8 2001/12/14 20:01:30 dawes Exp $ .\" .TH XDPYINFO 1 __xorgversion__ .SH NAME Index: xc/programs/xedit/Imakefile diff -u xc/programs/xedit/Imakefile:1.13 xc/programs/xedit/Imakefile:1.17 --- xc/programs/xedit/Imakefile:1.13 Fri Feb 11 21:54:46 2000 +++ xc/programs/xedit/Imakefile Fri Jan 4 14:24:10 2002 @@ -1,7 +1,21 @@ XCOMM $XConsortium: Imakefile,v 1.17 93/08/17 20:49:32 rws Exp $ -XCOMM $XFree86: xc/programs/xedit/Imakefile,v 1.13 2000/02/12 02:54:46 dawes Exp $ - DEPLIBS = XawClientDepLibs -LOCAL_LIBRARIES = XawClientLibs +XCOMM $XFree86: xc/programs/xedit/Imakefile,v 1.17 2002/01/04 19:24:10 paulo Exp $ + +#include "lisp/lisp.cf" + +#if BuildSharedLispModules +CCOPTIONS = -fpic +DLLIB = DlLibrary +LOCAL_LDFLAGS = -Xlinker -E +#endif + +#define IHaveSubdirs +#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" + + SUBDIRS = lisp + + DEPLIBS = XawClientDepLibs $(SUBDIRS) +LOCAL_LIBRARIES = XawClientLibs -Llisp -llisp $(DLLIB) SYS_LIBRARIES = MathLibrary #if defined(LynxOSArchitecture) || defined(SVR3Architecture) || defined(LinuxArchitecture) RP_SRCS = realpath.c @@ -19,9 +33,14 @@ DEFINES = $(SIGNAL_DEFINES) $(SYS_DEFINES) SRCS = xedit.c commands.c util.c $(SYS_SRCS) ispell.c options.c \ - hook.c c-mode.c + hook.c c-mode.c lisp.c proto.c OBJS = xedit.o commands.o util.o $(SYS_OBJS) ispell.o options.o \ - hook.o c-mode.o + hook.o c-mode.o lisp.o proto.o + +#ifdef IHaveSubdirs +ForceSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif ComplexProgramTarget(xedit) InstallAppDefaults(Xedit) Index: xc/programs/xedit/Xedit.ad diff -u xc/programs/xedit/Xedit.ad:1.19 xc/programs/xedit/Xedit.ad:1.20 --- xc/programs/xedit/Xedit.ad:1.19 Mon Feb 5 17:38:04 2001 +++ xc/programs/xedit/Xedit.ad Fri Aug 31 11:00:11 2001 @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xedit/Xedit.ad,v 1.19 2001/02/05 22:38:04 paulo Exp $ +! $XFree86: xc/programs/xedit/Xedit.ad,v 1.20 2001/08/31 15:00:11 paulo Exp $ *geometry: 590x440 *input: TRUE @@ -37,7 +37,8 @@ Use Control-X,k to close file being edited.\n\ Use Control-X,o to switch to another splitted window.\n\ Use Control-X,u to undo. Control-G to switch between Undo and Redo.\n\ -Use Insert to toggle Overwrite mode. +Use Insert to toggle Overwrite mode.\n\ +Use Control-G to interrupt the lisp subprocess *formWindow*defaultDistance: 2 *formWindow.?.borderWidth: 0 @@ -166,6 +167,9 @@ <Ctrl>X,<Ctrl>F:find-file() *messageWindow.Translations: #override \ +<Ctrl>X,<Ctrl>C:quit()\n\ +<Ctrl>X,<Ctrl>S:save-file()\n\ +<Ctrl>X,<Ctrl>F:find-file()\n\ <Enter>: no-op()\n\ <Leave>: no-op()\n\ <Btn1Down>: set-keyboard-focus() select-start() @@ -181,6 +185,7 @@ <Btn1Down>: set-keyboard-focus() select-start() *editWindow.translations: #override \ +<Ctrl>X,<Ctrl>E:lisp-eval()\n\ <Ctrl>X,<Key>Tab:indent()\n\ <Ctrl>X,:<Key>0:delete-window(current)\n\ <Ctrl>X,:<Key>1:delete-window(other)\n\ @@ -206,6 +211,8 @@ <Ctrl>X,!l <Key>u:undo()\n\ <Ctrl>X,!@Num_Lock<Key>u:undo()\n\ <Ctrl>X,!<Key>u:undo()\n\ +<Ctrl>G: xedit-keyboard-reset()\n\ +<Ctrl>J: xedit-print-lisp-eval()\n\ <Key>Tab: insert-char()\n\ !l @Num_Lock<Key>b:insert-char()\n\ !l <Key>b: insert-char()\n\ Index: xc/programs/xedit/c-mode.c diff -u xc/programs/xedit/c-mode.c:1.5 xc/programs/xedit/c-mode.c:1.10 --- xc/programs/xedit/c-mode.c:1.5 Tue Jan 30 10:03:33 2001 +++ xc/programs/xedit/c-mode.c Sun Dec 2 10:02:31 2001 @@ -27,16 +27,14 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/c-mode.c,v 1.5 2001/01/30 15:03:33 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/c-mode.c,v 1.10 2001/12/02 15:02:31 paulo Exp $ */ #include "xedit.h" #include <X11/IntrinsicP.h> #include <X11/Xaw/TextSinkP.h> #include <X11/Xaw/TextSrcP.h> #include <X11/Xmu/Xmu.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> /* for bsearch() */ -#endif #include <ctype.h> #define C_Peek(parser) ((parser)->next) @@ -78,9 +76,6 @@ static int C_Parse4(C_Parser*); static void C_ParseCallback(Widget, XtPointer, XtPointer); -extern void _XawTextNeedsUpdating(TextWidget, XawTextPosition, XawTextPosition); - - /* * Initialization */ @@ -404,10 +399,10 @@ C_ParserEnt *ent, *nent; XawTextAnchor *kanc; XawTextEntity *kent; - XawTextPosition kfrom, kto; + XawTextPosition kfrom = 0, kto = 0; int delta = info->block->length - (info->right - info->left); - if (XawTextSourceAnchorAndEntity(w, position - MAX(1, ABS(delta)), + if (XawTextSourceAnchorAndEntity(w, position - 1, &kanc, &kent) == False) kent = NULL; else { @@ -743,7 +738,8 @@ C_Parse2(C_Parser *parser) { int ch = C_Parse3(parser); - Bool dot = False, E = False, U = False, L = False, sign = False, + int L = 0; + Bool dot = False, E = False, U = False, F = False, sign = False, octal = False, real = False, hexa = False, first = True, did_get = False; for (;;) { @@ -755,7 +751,7 @@ sign = True; break; case '.': - if (dot || E || L || U || hexa) + if (dot || E || L || U || F || hexa) return (C_Parse2Fail(parser)); if (first && !isdigit(C_Peek(parser))) return ('.'); @@ -770,14 +766,20 @@ E = real = True; break; case 'a': case 'A': case 'b': case 'B': case 'c': case 'C': - case 'd': case 'D': case 'f': case 'F': + case 'd': case 'D': if (dot || E || !hexa) return (C_Parse2Fail(parser)); break; case 'l': case 'L': - if (L) + if (L > 1) + return (C_Parse2Fail(parser)); + ++L; + break; + case 'f': case 'F': + if (F) return (C_Parse2Fail(parser)); - L = True; + if (!hexa) + F = real = True; break; case 'u': case 'U': if (U || real) Index: xc/programs/xedit/commands.c diff -u xc/programs/xedit/commands.c:1.22 xc/programs/xedit/commands.c:1.25 --- xc/programs/xedit/commands.c:1.22 Tue Sep 26 11:57:24 2000 +++ xc/programs/xedit/commands.c Wed Sep 5 13:43:25 2001 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xedit/commands.c,v 1.22 2000/09/26 15:57:24 tsi Exp $ */ +/* $XFree86: xc/programs/xedit/commands.c,v 1.25 2001/09/05 17:43:25 paulo Exp $ */ #include <X11/Xfuncs.h> #include <X11/Xos.h> @@ -43,7 +43,6 @@ void ResetSourceChanged(xedit_flist_item*); static void ResetDC(Widget, XtPointer, XtPointer); -void SourceChanged(Widget, XtPointer, XtPointer); static void AddDoubleClickCallback(Widget, Bool); static Bool ReallyDoLoad(char*, char*); @@ -126,8 +125,10 @@ break; } } - if(!source_changed) + if(!source_changed) { + XeditLispCleanUp(); exit(0); + } XeditPrintf("Unsaved changes. Save them, or Quit again.\n"); Feep(); @@ -341,6 +342,8 @@ XtNeditType, XawtextEdit, NULL, NULL); ResetSourceChanged(item); + XtAddCallback(scratch, XtNcallback, SourceChanged, + (XtPointer)item); item = AddTextSource(source, name, filename, EXISTS_BIT, file_access); Index: xc/programs/xedit/hook.c diff -u xc/programs/xedit/hook.c:1.3 xc/programs/xedit/hook.c:1.4 --- xc/programs/xedit/hook.c:1.3 Sun Jun 6 04:49:14 1999 +++ xc/programs/xedit/hook.c Wed Jul 25 11:05:20 2001 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/hook.c,v 1.3 1999/06/06 08:49:14 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/hook.c,v 1.4 2001/07/25 15:05:20 dawes Exp $ */ /* * This file is intended to be used to add all the necessary hooks to xedit @@ -38,9 +38,7 @@ */ #include "xedit.h" -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include <string.h> #include <ctype.h> Index: xc/programs/xedit/ispell.c diff -u xc/programs/xedit/ispell.c:1.15 xc/programs/xedit/ispell.c:1.17 --- xc/programs/xedit/ispell.c:1.15 Wed Feb 7 11:36:29 2001 +++ xc/programs/xedit/ispell.c Mon Dec 3 16:04:40 2001 @@ -27,16 +27,15 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/ispell.c,v 1.15 2001/02/07 16:36:29 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/ispell.c,v 1.17 2001/12/03 21:04:40 herrb Exp $ */ #include "xedit.h" -#ifndef X_NOT_STDC_ENV #include <stdlib.h> #include <unistd.h> -#endif #include <fcntl.h> #include <signal.h> #include <ctype.h> +#include <errno.h> #include <sys/types.h> #include <sys/wait.h> #include <X11/Xaw/Toggle.h> @@ -299,21 +298,33 @@ /* * Implementation */ +#ifdef STDERR_FILENO +# define WRITES(s) write(STDERR_FILENO, s, strlen(s)) +#else +# define WRITES(s) write(fileno(stderr), s, strlen(s)) +#endif + /*ARGSUSED*/ #ifndef SIGNALRETURNSINT static void timeout_signal(int unused) { - fprintf(stderr, "Warning: Timeout waiting ispell process to die.\n"); + int olderrno = errno; + + WRITES("Warning: Timeout waiting ispell process to die.\n"); kill(ispell.pid, SIGTERM); + errno = olderrno; } #else static int timeout_signal(int unused) { - fprintf(stderr, "Warning: Timeout waiting ispell process to die.\n"); - kill(ispell.pid, SIGTERM); + int olderrno = errno; + WRITES("Warning: Timeout waiting ispell process to die.\n"); + kill(ispell.pid, SIGTERM); + + errno = olderrno; return (0); } #endif Index: xc/programs/xedit/lisp.c diff -u /dev/null xc/programs/xedit/lisp.c:1.3 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp.c Tue Sep 11 02:42:54 2001 @@ -0,0 +1,396 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp.c,v 1.3 2001/09/11 06:42:54 paulo Exp $ */ + +#include "xedit.h" +#include "lisp/lisp.h" +#include <unistd.h> +#include <fcntl.h> +#include <ctype.h> +#include <errno.h> +#include <locale.h> +#include <signal.h> +#include <sys/wait.h> + +/* + * Prototypes + */ +static void XeditLispInitialize(void); +static void XeditRunLisp(void); +static void LispInputCallback(XtPointer, int*, XtInputId*); +static void LispErrorInputCallback(XtPointer, int*, XtInputId*); +static void XeditDoLispEval(Widget, XEvent*, String*, Cardinal*); +static int XeditCheckLispChild(void); + +/* + * Initialization + */ +static struct { + int pid; + int ifd[2]; + int ofd[2]; + int efd[2]; + XtInputId id; + XtInputId eid; + XtAppContext appcon; + Widget output; + Bool expect; + Bool running; +} lisp; + +extern XtAppContext appcon; +extern Widget scratch; + +/* + * Implementation + */ +void +XeditLispEval(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + lisp.output = messwidget; + XeditDoLispEval(w, event, params, num_params); +} + +void +XeditPrintLispEval(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + if (XawTextGetSource(textwindow) == scratch) { + lisp.output = textwindow; + XtCallActionProc(w, "newline", event, params, *num_params); + XeditDoLispEval(w, event, params, num_params); + } + else + XtCallActionProc(w, "newline-and-indent", event, params, *num_params); +} + +void +XeditKeyboardReset(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + (void)XeditCheckLispChild(); + if (lisp.running) { + kill(lisp.pid, SIGINT); + lisp.running = False; + + /* redisplay */ + XtUnmapWidget(XtParent(messwidget)); + XtMapWidget(XtParent(messwidget)); + } + XtCallActionProc(w, "keyboard-reset", event, params, *num_params); +} + +static void +XeditDoLispEval(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + Widget src; + XawTextBlock block; + XawTextPosition position, end; + XtInputMask mask; + int gotchars = 0; + + XeditLispInitialize(); + + if (XtClass(w) != asciiTextWidgetClass) { + Feep(); + return; + } + + /* get lisp expression */ + if ((position = XawTextGetInsertionPoint(w)) == 0) { + Feep(); + return; + } + end = position; + --position; + + src = XawTextGetSource(w); + while (position >= 0) { + (void)XawTextSourceRead(src, position, &block, 1); + if (!isspace(block.ptr[0])) { + ++gotchars; + break; + } + --gotchars; + --position; + } + + if (block.ptr[0] != ')') { + while (position >= 0) { + (void)XawTextSourceRead(src, position, &block, 1); + if (isspace(block.ptr[0]) || + block.ptr[0] == '(' || + block.ptr[0] == ')' || + block.ptr[0] == '\'') + break; + ++gotchars; + --position; + } + ++position; + if (position == end || gotchars <= 0) { + Feep(); + return; + } + if (block.ptr[0] == '\'' && position > 0) + --position; + } + else { + /* XXX note that embedded '(' and ')' will confuse this code */ + XawTextPosition last, tmp; + int level = 0; + char ptr[2]; + + last = position; + ptr[1] = '\0'; + block.ptr = ptr; + do { + block.ptr[0] = '('; + position = XawTextSourceSearch(src, last, XawsdLeft, &block); + if (position == XawTextSearchError) { + Feep(); + return; + } + block.ptr[0] = ')'; + tmp = position; + do { + tmp = XawTextSourceSearch(src, tmp, XawsdRight, &block); + if (tmp == XawTextSearchError) { + Feep(); + return; + } + if (tmp <= last) + ++level; + } while (++tmp <= last); + --level; + last = position; + } while (level); + /* check for quoted expression */ + if (position) { + (void)XawTextSourceRead(src, position - 1, &block, 1); + if (block.ptr[0] == '\'') + --position; + } + } + + while (position < end) { + (void)XawTextSourceRead(src, position, &block, end - position); + write(lisp.ofd[1], block.ptr, block.length); + position += block.length; + } + write(lisp.ofd[1], "\n", 1); + lisp.running = lisp.expect = True; + + /* block waiting for lisp process to finish, need to block or + * user won't know if it is stalled. + */ + while (lisp.running) { + mask = XtAppPending(lisp.appcon); + if (mask & XtIMAlternateInput) + XtAppProcessEvent(lisp.appcon, XtIMAlternateInput); + else if (mask & XtIMXEvent) { + /* only keyboard events allowed */ + XEvent key; + + XtAppNextEvent(lisp.appcon, &key); + if (key.type == KeyPress || + key.type == KeyRelease) { + /* XXX Ctrl<G> harcoded */ + if (key.xkey.state & ControlMask) { + char buffer[2]; + + XLookupString((XKeyEvent*)&key, &buffer[0], + sizeof(buffer), NULL, NULL); + if (*buffer == '\a') + XtDispatchEvent(&key); + } + } + } + if (XeditCheckLispChild()) + break; + } +} + +void +XeditLispCleanUp(void) +{ + if (lisp.pid) { + kill(lisp.pid, SIGTERM); + lisp.pid = 0; + } +} + +static void +XeditLispInitialize(void) +{ + if (lisp.pid) + return; + + pipe(lisp.ifd); + pipe(lisp.ofd); + pipe(lisp.efd); + + if ((lisp.pid = fork()) == 0) { + setlocale(LC_NUMERIC, "C"); + close(0); + close(1); + close(2); + dup2(lisp.ofd[0], 0); + dup2(lisp.ifd[1], 1); + dup2(lisp.efd[1], 2); + close(lisp.ifd[0]); + close(lisp.ifd[1]); + close(lisp.ofd[0]); + close(lisp.ofd[1]); + close(lisp.efd[0]); + close(lisp.efd[1]); + XeditRunLisp(); + exit(0); + } + else if (lisp.pid < 0) { + fprintf(stderr, "Cannot fork\n"); + exit(1); + } + + lisp.appcon = XtWidgetToApplicationContext(topwindow); + lisp.id = XtAppAddInput(lisp.appcon, lisp.ifd[0], + (XtPointer)XtInputReadMask, + LispInputCallback, NULL); + fcntl(lisp.ifd[0], F_SETFL, O_NONBLOCK); + lisp.eid = XtAppAddInput(lisp.appcon, lisp.efd[0], + (XtPointer)XtInputReadMask, + LispErrorInputCallback, NULL); + fcntl(lisp.efd[0], F_SETFL, O_NONBLOCK); +} + +static void +LispInputCallback(XtPointer closure, int *source, XtInputId *id) +{ + int len; + char str[8192]; + + len = read(lisp.ifd[0], str, sizeof(str) - 1); + if (len && len < PROTOMAXSIZE && *str == PROTOPREFFIX) { + char *res = NULL; + + str[len] = '\0'; + len = 0; + lisp.expect = 0; + + if (XeditProto(str + 1, &res) == False) { + if (res) + XeditPrintf(res); + } + else { + write(lisp.ofd[1], res, strlen(res)); + write(lisp.ofd[1], "\n", 1); + } + } + if (len > 0) { + if (lisp.output == messwidget) { + str[len] = '\0'; + XeditPrintf(str); + } + else { + XawTextBlock block; + XawTextPosition pos = XawTextGetInsertionPoint(lisp.output); + + block.firstPos = 0; + block.format = FMT8BIT; + block.length = len; + block.ptr = str; + XawTextReplace(lisp.output, pos, pos, &block); + pos += len; + XawTextSetInsertionPoint(lisp.output, pos); + } + lisp.expect = 0; + } + /* If anything was printed, than it is not busy anymore */ + lisp.running = 0; + XeditCheckLispChild(); +} + +static void +LispErrorInputCallback(XtPointer closure, int *source, XtInputId *id) +{ + int len; + char str[1024]; + + Feep(); + len = read(lisp.efd[0], str, sizeof(str) - 1); + if (len > 0) { + str[len] = '\0'; + XeditPrintf(str); + } + /* If anything was printed, than it is not busy anymore */ + lisp.running = 0; + XeditCheckLispChild(); +} + +static int +XeditCheckLispChild(void) +{ + int status; + + if (lisp.pid) { + waitpid(lisp.pid, &status, WNOHANG); + if (WIFEXITED(status) || errno == ECHILD) { + Feep(); + /* redisplay */ + XtUnmapWidget(XtParent(messwidget)); + XtMapWidget(XtParent(messwidget)); + + XeditPrintf("Warning: lisp child process exited.\n"); + lisp.pid = 0; + XtRemoveInput(lisp.id); + XtRemoveInput(lisp.eid); + close(lisp.ifd[0]); + close(lisp.ifd[1]); + close(lisp.ofd[0]); + close(lisp.ofd[1]); + close(lisp.efd[0]); + close(lisp.efd[1]); + lisp.running = lisp.expect = 0; + + return (1); + } + } + + return (0); +} + +static void +XeditRunLisp(void) +{ + LispMac *mac = LispBegin(0, NULL); + + LispSetPrompt(mac, NULL); + LispExecute(mac, "(require \"fun\")\n"); + LispMachine(mac); + + LispEnd(mac); +} Index: xc/programs/xedit/options.c diff -u xc/programs/xedit/options.c:1.8 xc/programs/xedit/options.c:1.11 --- xc/programs/xedit/options.c:1.8 Tue Sep 26 11:57:24 2000 +++ xc/programs/xedit/options.c Fri Aug 31 15:00:03 2001 @@ -27,12 +27,10 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/options.c,v 1.8 2000/09/26 15:57:24 tsi Exp $ */ +/* $XFree86: xc/programs/xedit/options.c,v 1.11 2001/08/31 19:00:03 paulo Exp $ */ #include <stdio.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include "xedit.h" #include <X11/Xaw/SmeBSB.h> @@ -69,8 +67,6 @@ extern void C_ModeStart(Widget); extern void C_ModeEnd(Widget); -extern void _XawTextBuildLineTable(TextWidget, XawTextPosition, _XtBoolean); - /* * Initialization */ @@ -361,16 +357,33 @@ Arg args[1]; Boolean auto_fill; XawTextScrollMode scroll; + xedit_flist_item *item = FindTextSource(XawTextGetSource(textwindow), NULL); + Bool foreach = False; switch ((long)client_data) { case WRAP_NEVER: XtSetArg(args[0], XtNwrap, XawtextWrapNever); + if (item) { + item->flags |= WRAP_BIT; + item->wrap = XawtextWrapNever; + foreach = True; + } break; case WRAP_LINE: XtSetArg(args[0], XtNwrap, XawtextWrapLine); + if (item) { + item->flags |= WRAP_BIT; + item->wrap = XawtextWrapLine; + foreach = True; + } break; case WRAP_WORD: XtSetArg(args[0], XtNwrap, XawtextWrapWord); + if (item) { + item->flags |= WRAP_BIT; + item->wrap = XawtextWrapWord; + foreach = True; + } break; case AUTO_FILL: XtSetArg(args[0], XtNautoFill, &auto_fill); @@ -403,7 +416,14 @@ break; } - XtSetValues(textwindow, args, 1); + if (foreach) { + int i; + + for (i = 0; i < 3; i++) + XtSetValues(texts[i], args, 1); + } + else + XtSetValues(textwindow, args, 1); } static void Index: xc/programs/xedit/proto.c diff -u /dev/null xc/programs/xedit/proto.c:1.4 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/proto.c Sat Oct 27 23:34:28 2001 @@ -0,0 +1,1051 @@ +/* $XFree86: xc/programs/xedit/proto.c,v 1.4 2001/10/28 03:34:28 tsi Exp $ */ + +#include "xedit.h" +#include <stdlib.h> +#include <ctype.h> + +#define BUFFERFMT "\"<#0x%lx-BUFFER>\"" + +/* + * Types + */ +typedef struct _XeditReqTrans XeditReqTrans; +typedef struct _XeditReqArgs XeditReqArgs; +typedef union _XeditReqArg XeditReqArg; +typedef struct _XeditReqInfo XeditReqInfo; +typedef Bool (*XeditReqFun)(XeditReqInfo*, XeditReqArgs*, char**); + +struct _XeditReqTrans { + char *req; + XeditReqFun fun; + char *args_desc; +}; + +union _XeditReqArg { + long integer; + char *string; + xedit_flist_item *item; +}; + +struct _XeditReqArgs { + XeditReqArg *args; + int num_args; +}; + +struct _XeditReqInfo { + Widget text; + Widget source; + Widget sink; +}; + +/* + * Prototypes + */ +static xedit_flist_item *StringToFlistItem(char*); +static Bool PointMin(XeditReqInfo*, XeditReqArgs*, char**); +static Bool PointMax(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetPoint(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetPoint(XeditReqInfo*, XeditReqArgs*, char**); +static Bool Insert(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetForeground(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetForeground(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetBackground(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetBackground(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetFont(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetFont(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetWrapMode(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetWrapMode(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetAutoFill(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetAutoFill(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetLeftColumn(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetLeftColumn(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetRightColumn(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetRightColumn(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetJustification(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetJustification(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetVertScrollbar(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetVertScrollbar(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetHorizScrollbar(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetHorizScrollbar(XeditReqInfo*, XeditReqArgs*, char**); +static Bool CreateBuffer(XeditReqInfo*, XeditReqArgs*, char**); +static Bool RemoveBuffer(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetCurrentBuffer(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetCurrentBuffer(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetOtherBuffer(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetOtherBuffer(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetBufferName(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetBufferName(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetBufferFileName(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetBufferFileName(XeditReqInfo*, XeditReqArgs*, char**); + +/* todo */ +#if 0 +static Bool GetForegroundPixmap(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetForegroundPixmap(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetBackgroundPixmap(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetBackgroundPixmap(XeditReqInfo*, XeditReqArgs*, char**); +static Bool GetFontSet(XeditReqInfo*, XeditReqArgs*, char**); +static Bool SetFontSet(XeditReqInfo*, XeditReqArgs*, char**); +#endif + +/* + * Initialization + */ +static XeditReqTrans trans[] = { +/* nil: means nothing, i.e. NULL + * (b)uffer buffer representation + * (i)nteger: number + * (s)tring: any text, enclosed in "'s + */ + + /* input = string: buffer-name + * output = string: buffer-identifier */ + {"create-buffer", CreateBuffer, "s"}, + + /* input = nil + * output = string: converter value, one of "true" and "false" */ + {"get-auto-fill", GetAutoFill}, + + /* input = nil + * output = string: background color */ + {"get-background", GetBackground}, + + /* input = string: buffer-identifier + * output = string: buffer-file-name */ + {"get-buffer-filename", GetBufferFileName, "b"}, + + /* input = string: buffer-identifier + * output = string: buffer-name */ + {"get-buffer-name", GetBufferName, "b"}, + + /* input = nil + * output = string: buffer-identifier */ + {"get-current-buffer", GetCurrentBuffer}, + + /* input = nil + * output = string: font name */ + {"get-font", GetFont}, + + /* input = nil + * output = string: foreground color */ + {"get-foreground", GetForeground}, + + /* input = nil + * output = string: one of "always" and "never" */ + {"get-horiz-scrollbar", GetHorizScrollbar}, + + /* input = nil + * output = string: one of "left", "right", "center" and "full" */ + {"get-justification", GetJustification}, + + /* input = nil + * output = integer: left colum, used only if AutoFill is true */ + {"get-left-column", GetLeftColumn}, + + /* input = nil + * output = string: buffer-identifier */ + {"get-other-buffer", GetOtherBuffer}, + + /* input = nil + * output = integer: current cursor position */ + {"get-point", GetPoint}, + + /* input = nil + * output = integer: right colum, used only if AutoFill is true */ + {"get-right-column", GetRightColumn}, + + /* input = nil + * output = string: one of "always" and "never" */ + {"get-vert-scrollbar", GetVertScrollbar}, + + /* input = nil + * output = string: converter value, one of "never", "line" and "word" */ + {"get-wrap-mode", GetWrapMode}, + + /* input = string: text to be inserted + * output = nil */ + {"insert", Insert, "s"}, + + /* input = nil + * output = integer: largest visible cursor position */ + {"point-max", PointMax}, + + /* input = nil + * output = integer: smallest visible cursor position */ + {"point-min", PointMin}, + + /* input = string: buffer-identifier + * output = nil + */ + {"remove-buffer", RemoveBuffer, "b"}, + + /* input = string: converter value, one of "true" and "false" + * output = nil */ + {"set-auto-fill", SetAutoFill, "s"}, + + /* input = string: background color + * output = nil */ + {"set-background", SetBackground, "s"}, + + /* input = string list: buffer-identifier and new buffer-name + * output = nil */ + {"set-buffer-name", SetBufferName, "bs"}, + + /* input = string list: buffer-identifier and new buffer-file-name + * output = nil */ + {"set-buffer-filename", SetBufferFileName, "bs"}, + + /* input = string: buffer-identifier + * output = nil */ + {"set-current-buffer", SetCurrentBuffer, "b"}, + + /* input = string: font name + * output = nil */ + {"set-font", SetFont, "s"}, + + /* input = string: foreground color + * output = nil */ + {"set-foreground", SetForeground, "s"}, + + /* input = string: one of "always" and "never" + * output = nil */ + {"set-horiz-scrollbar", SetHorizScrollbar, "s"}, + + /* input = string: one of "left", "right", "center" and "full" + * output = nil */ + {"set-justification", SetJustification, "s"}, + + /* input = integer: left colum, used only if AutoFill is true + * output = nil */ + {"set-left-column", SetLeftColumn, "i"}, + + /* input = string: buffer-identifier + * output = nil */ + {"set-other-buffer", SetOtherBuffer, "b"}, + + /* input = integer: cursor position + * output = nil */ + {"set-point", SetPoint, "i"}, + + /* input = integer: right colum, used only if AutoFill is true + * output = nil */ + {"set-right-column", SetRightColumn, "i"}, + + /* input = string: one of "always" and "never" + * output = nil */ + {"set-vert-scrollbar", SetVertScrollbar, "s"}, + + /* input = string: converter value, one of "never", "line" and "word" + * output = nil */ + {"set-wrap-mode", SetWrapMode, "s"}, +}; + +static char *TooFewArguments = "%s: too few arguments, near %s"; +static char *TooManyArguments = "%s: too many arguments, near %s"; +static char *ExpectingInteger = "%s: expecting integer, near %s"; +static char *ExpectingString = "%s: expecting string, near %s"; +static char *ErrorParsingString = "%s: error parsing string, near %s"; +static char *BadBuffer = "%s: bad buffer spec or buffer does not exist, %s"; +static char buffer[512]; + +/* + * Implementation + */ +static int +compar(_Xconst void *left, _Xconst void *right) +{ + return (strcmp((char*)left, ((XeditReqTrans*)right)->req)); +} + +Bool +XeditProto(char *input, char **result) +{ +#define FMT(s) fmt = s; goto proto_error + XeditReqTrans *req; + XeditReqArgs args; + XeditReqInfo info; + char fun[64], *ptr, *str, *desc, *fmt; + int i, len; + + *result = "NIL"; + + /* get function name */ + ptr = input; + while (*ptr && isspace(*ptr)) /* whitespaces */ + ++ptr; + str = ptr; + while (*ptr && !isspace(*ptr)) /* function name */ + ++ptr; + len = ptr - str; + if (len > sizeof(fun) - 1) + len = sizeof(fun) - 1; + strncpy(fun, str, len); + fun[len] = '\0'; + + /* skip whitespaces */ + while (*ptr && isspace(*ptr)) + ++ptr; + + req = bsearch(fun, trans, sizeof(trans) / sizeof(trans[0]), + sizeof(XeditReqTrans), compar); + + if (req) { + char *val; + Bool retval; + + /* parse arguments */ + args.args = NULL; + args.num_args = 0; + + desc = req->args_desc; + if (desc == NULL && *ptr) { + FMT(TooManyArguments); + } + + while (1) { + /* find next argument */ + while (*ptr && isspace(*ptr)) + ++ptr; + if (*ptr == '\0') + break; + str = ptr; + /* string argument */ + if (*desc == 's') { + unsigned char c; + + if (*ptr != '"') { + FMT(ExpectingString); + } + + val = NULL; + len = 0; + ++ptr; + while (*ptr && *ptr != '"') { + if (*ptr == '\0') { + FMT(ErrorParsingString); + } + if (*ptr == '\\') { + ++ptr; + switch (*ptr) { + case 'a': + c = '\a'; + break; + case 'f': + c = '\f'; + break; + case 'n': + c = '\n'; + break; + case 'r': + c = '\r'; + break; + case 'x': + c = 0; + for (i = 0; i < 2; i++) { + int dig = -1; + + if (isdigit(*ptr)) + dig = *ptr - '0'; + else if (*ptr >= 'a' && *ptr <= 'f') + dig = *ptr - 'a' + 10; + else if (*ptr >= 'A' && *ptr <= 'F') + dig = *ptr - 'A' + 10; + if (dig < 0) { + FMT(ErrorParsingString); + } + c = c * 16 + dig; + } + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + c = *ptr - '0'; + for (i = 0; i < 2; i++) { + ++ptr; + if (!isdigit(*ptr) || *ptr > '7') { + FMT(ErrorParsingString); + } + c = c * 8 + (*ptr - '0'); + } + break; + case '\0': + FMT(ErrorParsingString); + default: + c = *ptr; + break; + } + } + else + c = *ptr; + if ((len % 16) == 0) + val = XtRealloc(val, len + 16); + val[len++] = c; + ++ptr; + } + ++ptr; + val[len] = '\0'; + args.args = (XeditReqArg*) + XtRealloc((XtPointer)args.args, sizeof(XeditReqArg) * + (args.num_args + 1)); + args.args[args.num_args++].string = val; + } + else if (*desc == 'i') { + char *end; + double number; + + while (*ptr && !isspace(*ptr)) + ++ptr; + number = strtod(str, &end); + if (end != ptr || (long)number != number) { + FMT(ExpectingInteger); + } + args.args = (XeditReqArg*) + XtRealloc((XtPointer)args.args, sizeof(XeditReqArg) * + (args.num_args + 1)); + args.args[args.num_args++].integer = (long)number; + } + else if (*desc == 'b') { + xedit_flist_item *item; + + while (*ptr && !isspace(*ptr)) + ++ptr; + len = ptr - str; + strncpy(buffer, ptr, sizeof(buffer)); + buffer[len] = '\0'; + + item = StringToFlistItem(buffer); + if (item == NULL) { + FMT(BadBuffer); + } + args.args = (XeditReqArg*) + XtRealloc((XtPointer)args.args, sizeof(XeditReqArg) * + (args.num_args + 1)); + args.args[args.num_args++].item = item; + } + else if (*desc == '\0') { + FMT(TooManyArguments); + } + ++desc; + } + + if (desc && *desc) { + FMT(TooFewArguments); + } + + info.text = textwindow; + info.source = XawTextGetSource(textwindow); + info.sink = XawTextGetSink(textwindow); + retval = (req->fun)(&info, &args, result); + if (req->args_desc) { + for (ptr = req->args_desc, i = 0; *ptr; ptr++, i++) { + if (*ptr == 's') + XtFree(args.args[i].string); + } + XtFree((XtPointer)args.args); + } + + return (retval); + +proto_error: + XmuSnprintf(buffer, sizeof(buffer), fmt, fun, ptr); + XeditPrintf(buffer); + *result = input; + if (req->args_desc) { + for (ptr = req->args_desc, i = 0; *ptr; ptr++, i++) { + if (*ptr == 's') + XtFree(args.args[i].string); + } + XtFree((XtPointer)args.args); + } + return (False); + } + + XmuSnprintf(buffer, sizeof(buffer), "unknown request %s", fun); + XeditPrintf(buffer); + *result = input; + + return (False); +} + +static xedit_flist_item * +StringToFlistItem(char *string) +{ + int i; + xedit_flist_item *item; + + if (sscanf(string, BUFFERFMT, (long*)(&item)) != 1) + return (NULL); + + for (i = 0; i < flist.num_itens; i++) + if (flist.itens[i] == item) + return (item); + + return (NULL); +} + +/*ARGSUSED*/ +static Bool +PointMin(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XawTextPosition point = XawTextSourceScan(info->source, 0, + XawstAll, XawsdLeft, 1, True); + + XmuSnprintf(buffer, sizeof(buffer), "%ld", point); + *result = buffer; + + return (True); +} + +/*ARGSUSED*/ +static Bool +PointMax(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XawTextPosition point = XawTextSourceScan(info->source, 0, + XawstAll, XawsdRight, 1, True); + + XmuSnprintf(buffer, sizeof(buffer), "%ld", point); + *result = buffer; + + return (True); +} + +/*ARGSUSED*/ +static Bool +GetPoint(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XawTextPosition point = XawTextGetInsertionPoint(info->text); + + XmuSnprintf(buffer, sizeof(buffer), "%ld", point); + *result = buffer; + + return (True); +} + +static Bool +SetPoint(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XawTextPosition point = args->args[0].integer; + + XawTextSetInsertionPoint(info->text, point); + + return (True); +} + +static Bool +Insert(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XawTextPosition point = XawTextGetInsertionPoint(info->text); + XawTextBlock block; + + block.firstPos = 0; + block.format = FMT8BIT; + block.length = strlen(args->args[0].string); + block.ptr = args->args[0].string; + XawTextReplace(info->text, point, point, &block); + XawTextSetInsertionPoint(info->text, point + block.length); + + return (True); +} + +/*ARGSUSED*/ +static Bool +GetForeground(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + char *str; + Pixel pixel; + Arg arg[1]; + XrmValue from, to; + + from.size = sizeof(pixel); + from.addr = (XtPointer)&pixel; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNforeground, &pixel); + XtGetValues(info->sink, arg, 1); + XtConvertAndStore(info->sink, XtRPixel, &from, XtRString, &to); + str = to.addr; + XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); + *result = buffer; + + return (True); +} + +static Bool +SetForeground(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Arg arg[1]; + Pixel pixel; + XrmValue from, to; + + from.size = strlen(args->args[0].string) + 1; + from.addr = (XtPointer)args->args[0].string; + to.size = sizeof(pixel); + to.addr = (XtPointer)&pixel; + + XtConvertAndStore(info->sink, XtRString, &from, XtRPixel, &to); + XtSetArg(arg[0], XtNforeground, pixel); + XtSetValues(info->text, arg, 1); + + return (True); +} + +/*ARGSUSED*/ +static Bool +GetBackground(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + char *str; + Pixel pixel; + Arg arg[1]; + XrmValue from, to; + + from.size = sizeof(pixel); + from.addr = (XtPointer)&pixel; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNbackground, &pixel); + XtGetValues(info->sink, arg, 1); + XtConvertAndStore(info->text, XtRPixel, &from, XtRString, &to); + str = to.addr; + XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); + *result = buffer; + + return (True); +} + +static Bool +SetBackground(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Pixel pixel; + Arg arg[1]; + XrmValue from, to; + + from.size = strlen(args->args[0].string) + 1; + from.addr = (XtPointer)args->args[0].string; + to.size = sizeof(pixel); + to.addr = (XtPointer)&pixel; + + XtConvertAndStore(info->sink, XtRString, &from, XtRPixel, &to); + XtSetArg(arg[0], XtNbackground, pixel); + XtSetValues(info->text, arg, 1); + + return (True); +} + +/*ARGSUSED*/ +static Bool +GetFont(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + char *str; + XFontStruct *font; + Arg arg[1]; + XrmValue from, to; + + from.size = sizeof(font); + from.addr = (XtPointer)&font; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNfont, &font); + XtGetValues(info->sink, arg, 1); + XtConvertAndStore(info->text, XtRFontStruct, &from, XtRString, &to); + str = to.addr; + XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); + *result = buffer; + + return (True); +} + +static Bool +SetFont(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XFontStruct *font; + Arg arg[1]; + XrmValue from, to; + + from.size = strlen(args->args[0].string) + 1; + from.addr = (XtPointer)args->args[0].string; + to.size = sizeof(font); + to.addr = (XtPointer)&font; + + XtConvertAndStore(info->sink, XtRString, &from, XtRFontStruct, &to); + XtSetArg(arg[0], XtNfont, font); + XtSetValues(info->text, arg, 1); + + return (True); +} + +/*ARGSUSED*/ +static Bool +GetWrapMode(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + char *str; + XawTextWrapMode wrap; + Arg arg[1]; + XrmValue from, to; + + from.size = sizeof(wrap); + from.addr = (XtPointer)&wrap; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNwrap, &wrap); + XtGetValues(info->text, arg, 1); + XtConvertAndStore(info->text, XtRWrapMode, &from, XtRString, &to); + str = to.addr; + XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); + *result = buffer; + + return (True); +} + +static Bool +SetWrapMode(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XawTextWrapMode wrap; + Arg arg[1]; + XrmValue from, to; + + from.size = strlen(args->args[0].string) + 1; + from.addr = (XtPointer)args->args[0].string; + to.size = sizeof(wrap); + to.addr = (XtPointer)&wrap; + + XtConvertAndStore(info->text, XtRString, &from, XtRWrapMode, &to); + XtSetArg(arg[0], XtNwrap, wrap); + XtSetValues(info->text, arg, 1); + + return (True); +} + +/*ARGSUSED*/ +static Bool +GetAutoFill(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + char *str; + Boolean fill; + Arg arg[1]; + XrmValue from, to; + + from.size = sizeof(fill); + from.addr = (XtPointer)&fill; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNautoFill, &fill); + XtGetValues(info->text, arg, 1); + XtConvertAndStore(info->text, XtRBoolean, &from, XtRString, &to); + str = to.addr; + XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); + *result = buffer; + + return (True); +} + +static Bool +SetAutoFill(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Boolean fill; + Arg arg[1]; + XrmValue from, to; + + from.size = strlen(args->args[0].string) + 1; + from.addr = (XtPointer)args->args[0].string; + to.size = sizeof(fill); + to.addr = (XtPointer)&fill; + + XtConvertAndStore(info->text, XtRString, &from, XtRBoolean, &to); + XtSetArg(arg[0], XtNautoFill, fill); + XtSetValues(info->text, arg, 1); + + return (True); +} + +/*ARGSUSED*/ +static Bool +GetLeftColumn(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Arg arg[1]; + short left; + + XtSetArg(arg[0], XtNleftColumn, &left); + XtGetValues(info->text, arg, 1); + XmuSnprintf(buffer, sizeof(buffer), "%d", left); + *result = buffer; + + return (True); +} + +static Bool +SetLeftColumn(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Arg arg[1]; + int left; + + left = args->args[0].integer; + XtSetArg(arg[0], XtNleftColumn, left); + XtSetValues(info->text, arg, 1); + + return (True); +} + +/*ARGSUSED*/ +static Bool +GetRightColumn(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Arg arg[1]; + short right; + + XtSetArg(arg[0], XtNrightColumn, &right); + XtGetValues(info->text, arg, 1); + XmuSnprintf(buffer, sizeof(buffer), "%d", right); + *result = buffer; + + return (True); +} + +static Bool +SetRightColumn(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Arg arg[1]; + int right; + + right = args->args[0].integer; + XtSetArg(arg[0], XtNrightColumn, right); + XtSetValues(info->text, arg, 1); + + return (True); +} + +static Bool +GetJustification(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + char *str; + XawTextJustifyMode justify; + Arg arg[1]; + XrmValue from, to; + + from.size = sizeof(justify); + from.addr = (XtPointer)&justify; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNjustifyMode, &justify); + XtGetValues(info->text, arg, 1); + XtConvertAndStore(info->text, XtRJustifyMode, &from, XtRString, &to); + str = to.addr; + XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); + *result = buffer; + + return (True); +} + +static Bool +SetJustification(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XawTextJustifyMode justify; + Arg arg[1]; + XrmValue from, to; + + from.size = strlen(args->args[0].string) + 1; + from.addr = (XtPointer)args->args[0].string; + to.size = sizeof(justify); + to.addr = (XtPointer)&justify; + + XtConvertAndStore(info->text, XtRString, &from, XtRJustifyMode, &to); + XtSetArg(arg[0], XtNjustifyMode, justify); + XtVaSetValues(info->text, arg, 1); + + return (True); +} + +static Bool +GetVertScrollbar(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + char *str; + Arg arg[1]; + XawTextScrollMode scroll; + XrmValue from, to; + + from.size = sizeof(scroll); + from.addr = (XtPointer)&scroll; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNscrollVertical, &scroll); + XtGetValues(info->text, arg, 1); + XtConvertAndStore(info->text, XtRScrollMode, &from, XtRString, &to); + str = to.addr; + XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); + *result = buffer; + + return (True); +} + +static Bool +SetVertScrollbar(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Arg arg[1]; + XawTextScrollMode scroll; + XrmValue from, to; + + from.size = strlen(args->args[0].string) + 1; + from.addr = (XtPointer)args->args[0].string; + to.size = sizeof(scroll); + to.addr = (XtPointer)&scroll; + + XtConvertAndStore(info->text, XtRString, &from, XtRScrollMode, &to); + XtSetArg(arg[0], XtNscrollVertical, scroll); + XtSetValues(info->text, arg, 1); + + return (True); +} + +static Bool +GetHorizScrollbar(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + char *str; + Arg arg[1]; + XawTextScrollMode scroll; + XrmValue from, to; + + from.size = sizeof(scroll); + from.addr = (XtPointer)&scroll; + to.size = 0; + to.addr = NULL; + + XtSetArg(arg[0], XtNscrollHorizontal, &scroll); + XtGetValues(info->text, arg, 1); + XtConvertAndStore(info->text, XtRScrollMode, &from, XtRString, &to); + str = to.addr; + XmuSnprintf(buffer, sizeof(buffer), "\"%s\"", str); + *result = buffer; + + return (True); +} + +static Bool +SetHorizScrollbar(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Arg arg[1]; + XawTextScrollMode scroll; + XrmValue from, to; + + from.size = strlen(args->args[0].string) + 1; + from.addr = (XtPointer)args->args[0].string; + to.size = sizeof(scroll); + to.addr = (XtPointer)&scroll; + + XtConvertAndStore(info->text, XtRString, &from, XtRScrollMode, &to); + XtSetArg(arg[0], XtNscrollHorizontal, scroll); + XtSetValues(info->text, arg, 1); + + return (True); +} + +static Bool +CreateBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + Widget source; + xedit_flist_item *item; + + source = XtVaCreateWidget("textSource", international ? + multiSrcObjectClass : asciiSrcObjectClass, + topwindow, + XtNeditType, XawtextEdit, + NULL, NULL); + + item = AddTextSource(source, args->args[0].string, NULL, 0, 0); + XmuSnprintf(buffer, sizeof(buffer), BUFFERFMT, item); + *result = buffer; + + return (True); +} + +static Bool +RemoveBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + KillTextSource(args->args[0].item); + + return (True); +} + +static Bool +GetCurrentBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + xedit_flist_item *item = flist.current; + + if (item == NULL) + /* this is probably an error */ + return (True); + + XmuSnprintf(buffer, sizeof(buffer), BUFFERFMT, item); + *result = buffer; + + return (True); +} + +static Bool +SetCurrentBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + SwitchTextSource(args->args[0].item); + + return (True); +} + +static Bool +GetOtherBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + xedit_flist_item *item = flist.other; + + if (item == NULL) + /* this is not an error */ + return (True); + + XmuSnprintf(buffer, sizeof(buffer), BUFFERFMT, item); + *result = buffer; + return (True); +} + +static Bool +SetOtherBuffer(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + flist.other = args->args[0].item; + + return (True); +} + +static Bool +GetBufferName(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + *result = args->args[0].item->name; + + return (True); +} + +static Bool +SetBufferName(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XtFree(args->args[0].item->name); + args->args[0].item->name = XtNewString(args->args[0].string); + + return (True); +} + +static Bool +GetBufferFileName(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + *result = args->args[0].item->filename; + + return (True); +} + +/* this probably should not be allowed */ +static Bool +SetBufferFileName(XeditReqInfo *info, XeditReqArgs *args, char **result) +{ + XtFree(args->args[0].item->name); + args->args[0].item->filename = XtNewString(args->args[0].string); + + return (True); +} Index: xc/programs/xedit/util.c diff -u xc/programs/xedit/util.c:1.15 xc/programs/xedit/util.c:1.18 --- xc/programs/xedit/util.c:1.15 Wed Apr 5 14:14:04 2000 +++ xc/programs/xedit/util.c Tue Sep 11 02:42:54 2001 @@ -24,12 +24,10 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xedit/util.c,v 1.15 2000/04/05 18:14:04 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/util.c,v 1.18 2001/09/11 06:42:54 paulo Exp $ */ #include <stdio.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> /* for realpath() */ -#endif #include "xedit.h" #include <X11/Xfuncs.h> @@ -57,6 +55,7 @@ */ extern Widget scratch; extern Widget vpanes[2], labels[3], texts[3], forms[3]; +extern XawTextWrapMode wrapmodes[3]; /* * Implementation @@ -242,6 +241,10 @@ if (idx >= flist.num_itens) return (False); + flist.current = nitem; + if (item == flist.other) + flist.other = NULL; + if (nitem->file_access == READ_OK) XmuSnprintf(label_buf, sizeof(label_buf), "%s READ ONLY", nitem->name); @@ -321,13 +324,17 @@ void SwitchTextSource(xedit_flist_item *item) { - Arg args[3]; + Arg args[4]; Cardinal num_args; char label_buf[BUFSIZ]; xedit_flist_item *old_item = FindTextSource(XawTextGetSource(textwindow), NULL); int i; + if (old_item != item) + flist.other = old_item; + flist.current = item; + XawTextDisableRedisplay(textwindow); if (item->file_access == READ_OK) XmuSnprintf(label_buf, sizeof(label_buf), "%s READ ONLY", @@ -391,6 +398,11 @@ ++num_args; XtSetArg(args[num_args], XtNinsertPosition, item->insert_position); ++num_args; + if (item->flags & WRAP_BIT) + XtSetArg(args[num_args], XtNwrap, item->wrap); + else + XtSetArg(args[num_args], XtNwrap, wrapmodes[WindowIndex(textwindow)]); + ++num_args; XtSetValues(textwindow, args, num_args); UpdateTextProperties(); @@ -430,6 +442,14 @@ Arg args[1]; if (textwindow != w) { + xedit_flist_item *other, *current; + + other = FindTextSource(XawTextGetSource(textwindow), NULL); + current = FindTextSource(XawTextGetSource(w), NULL); + if (other != current) + flist.other = other; + if (current) + flist.current = current; XtSetArg(args[0], XtNdisplayCaret, False); XtSetValues(textwindow, args, 1); XtSetArg(args[0], XtNdisplayCaret, True); @@ -525,12 +545,13 @@ XtUnmanageChild(vpanes[1]); if ((!current && idx == 0) || (current && idx != 0)) { - Arg args[3]; + Arg args[4]; Cardinal num_args; String label_str; Pixmap label_pix; XawTextPosition d_pos, i_pos; Widget source; + xedit_flist_item *item; num_args = 0; XtSetArg(args[num_args], XtNlabel, &label_str); ++num_args; @@ -552,6 +573,13 @@ XtSetArg(args[num_args], XtNdisplayPosition, d_pos); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, i_pos); ++num_args; XtSetArg(args[num_args], XtNtextSource, source); ++num_args; + + item = FindTextSource(source, NULL); + if (item && (item->flags & WRAP_BIT)) + XtSetArg(args[num_args], XtNwrap, item->wrap); + else + XtSetArg(args[num_args], XtNwrap, + wrapmodes[WindowIndex(texts[current ? idx : uidx])]); XtSetValues(texts[0], args, num_args); UpdateTextProperties(); @@ -626,6 +654,7 @@ Pixmap label_pix; int idx = WindowIndex(w), dimension; Bool vert = True; + xedit_flist_item *item; if (num_params && *num_params == 1 && (*params[0] == 'h' || *params[0] == 'H')) @@ -746,6 +775,12 @@ XtSetArg(args[num_args], XtNtextSource, source); ++num_args; XtSetArg(args[num_args], XtNdisplayPosition, d_pos); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, i_pos); ++num_args; + item = FindTextSource(source, NULL); + if (item && (item->flags & WRAP_BIT)) + XtSetArg(args[num_args], XtNwrap, item->wrap); + else + XtSetArg(args[num_args], XtNwrap, wrapmodes[WindowIndex(ntext)]); + ++num_args; XtSetValues(ntext, args, num_args); UpdateTextProperties(); Index: xc/programs/xedit/xedit.c diff -u xc/programs/xedit/xedit.c:1.10 xc/programs/xedit/xedit.c:1.13 --- xc/programs/xedit/xedit.c:1.10 Sun Aug 15 09:00:56 1999 +++ xc/programs/xedit/xedit.c Tue Sep 11 02:42:54 2001 @@ -24,7 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xedit/xedit.c,v 1.10 1999/08/15 13:00:56 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/xedit.c,v 1.13 2001/09/11 06:42:54 paulo Exp $ */ #include <X11/IntrinsicP.h> #include "xedit.h" @@ -33,12 +33,7 @@ #include <sys/stat.h> #include <X11/CoreP.h> -#ifdef X_NOT_STDC_ENV -void srand(); -int rand(); -#else #include <stdlib.h> -#endif #define randomize() srand((unsigned)time((time_t*)NULL)) @@ -58,6 +53,9 @@ {"other-window", OtherWindow}, {"switch-source", SwitchSource}, {"ispell", IspellAction}, +{"lisp-eval", XeditLispEval}, +{"xedit-print-lisp-eval", XeditPrintLispEval}, +{"xedit-keyboard-reset",XeditKeyboardReset} }; #define DEF_HINT_INTERVAL 300 /* in seconds, 5 minutes */ @@ -71,6 +69,7 @@ Widget scratch, hpane, vpanes[2], labels[3], texts[3], forms[3], positions[3]; Widget options_popup, dirlabel, dirwindow; Boolean international; +XawTextWrapMode wrapmodes[3]; extern void ResetSourceChanged(xedit_flist_item*); @@ -263,8 +262,10 @@ XtConvertAndStore(flist.popup, XtRString, &from, XtRBitmap, &to); } - if (num_loaded == 0) + if (num_loaded == 0) { XtSetKeyboardFocus(topwindow, filenamewindow); + XtVaSetValues(textwindow, XtNwrap, XawtextWrapLine, NULL); + } else XtSetKeyboardFocus(topwindow, textwindow); @@ -382,12 +383,20 @@ item = AddTextSource(scratch, "*scratch*", "*scratch*", 0, WRITE_OK); + item->wrap = XawtextWrapLine; + item->flags |= WRAP_BIT; XtAddCallback(item->source, XtNcallback, SourceChanged, (XtPointer)item); ResetSourceChanged(item); + flist.current = item; for (num_args = 0; num_args < 3; num_args++) XtAddCallback(texts[num_args], XtNpositionCallback, PositionChanged, NULL); + + for (num_args = 0; num_args < 3; num_args++) { + XtSetArg(arglist[0], XtNwrap, &wrapmodes[num_args]); + XtGetValues(texts[num_args], arglist, 1); + } XtAddCallback(dirwindow, XtNcallback, DirWindowCB, NULL); } Index: xc/programs/xedit/xedit.h diff -u xc/programs/xedit/xedit.h:1.11 xc/programs/xedit/xedit.h:1.13 --- xc/programs/xedit/xedit.h:1.11 Sun Aug 15 09:00:57 1999 +++ xc/programs/xedit/xedit.h Tue Sep 11 02:42:54 2001 @@ -26,7 +26,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ -/* $XFree86: xc/programs/xedit/xedit.h,v 1.11 1999/08/15 13:00:57 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/xedit.h,v 1.13 2001/09/11 06:42:54 paulo Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> @@ -62,6 +62,7 @@ #define CHANGED_BIT 0x01 #define EXISTS_BIT 0x02 +#define WRAP_BIT 0x10 typedef struct _xedit_flist_item { Widget source, sme; String name; @@ -71,12 +72,14 @@ XawTextPosition display_position, insert_position; int mode; XawTextPropertyList *properties; + XawTextWrapMode wrap; } xedit_flist_item; extern struct _xedit_flist { Widget popup; Pixmap pixmap; xedit_flist_item **itens; + xedit_flist_item *current, *other; Cardinal num_itens; } flist; @@ -150,6 +153,17 @@ /* externs in hook.c */ Bool StartHooks(XtAppContext); + +/* externs in lisp.c */ +void XeditLispEval(Widget, XEvent*, String*, Cardinal*); +void XeditPrintLispEval(Widget, XEvent*, String*, Cardinal*); +void XeditKeyboardReset(Widget, XEvent*, String*, Cardinal*); +void XeditLispCleanUp(void); + +/* externs in proto.c */ +#define PROTOPREFFIX '\033' +#define PROTOMAXSIZE 1024 +Bool XeditProto(char*, char**); /* externs for system replacement functions */ #ifdef NEED_STRCASECMP Index: xc/programs/xedit/lisp/Imakefile diff -u /dev/null xc/programs/xedit/lisp/Imakefile:1.10 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/Imakefile Fri Jan 4 14:24:10 2002 @@ -0,0 +1,77 @@ +XCOMM $XFree86: xc/programs/xedit/lisp/Imakefile,v 1.10 2002/01/04 19:24:10 paulo Exp $ + +#include "lisp.cf" +#include "lisp.rules" + +#define DoNormalLib YES +#define DoSharedLib NO +#define DoExtraLib NO +#define DoDebugLib NO +#define DoProfileLib NO +#define LibName lisp +#define LibInstall NO +#define LibHeaders NO + +#if !HasSnprintf +SNPRINTF_DEFS = -DNEED_SNPRINTF +#endif + +#if !HasSnprintf + MISC_INCLUDES = -I$(LIBSRC)/misc +#endif + +#define IHaveSubdirs +#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" + +LIB = LibName +SAMP = lsp +SAMPSRC = lsp.c +SAMPOBJ = lsp.o + +SUBDIRS = modules + +SRCS =\ + core.c \ + debugger.c \ + format.c \ + helper.c \ + lisp.c \ + string.c \ + struct.c \ + require.c \ + time.c +OBJS =\ + core.o \ + debugger.o \ + format.o \ + helper.o \ + lisp.o \ + string.o \ + struct.o \ + require.o \ + time.o + +#include <Library.tmpl> + +AllTarget(ProgramTargetName($(SAMP))) + +#if BuildSharedLispModules +CCOPTIONS = -fpic +DLLIB = DlLibrary +LOCAL_LDFLAGS = -Xlinker -E +DEFINES = -DSHARED_MODULES -DLISPDIR='"$(LISPDIR)"' $(SNPRINTF_DEFS) +#else +DEFINES = -DLISPDIR='"$(LISPDIR)"' $(SNPRINTF_DEFS) +#endif + + INCLUDES = $(MISC_INCLUDES) +LOCAL_LIBRARIES = -L. -llisp -lm $(DLLIB) + +NormalProgramTarget($(SAMP),$(SAMPOBJ),,$(LOCAL_LIBRARIES),) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif Index: xc/programs/xedit/lisp/README diff -u /dev/null xc/programs/xedit/lisp/README:1.5 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/README Wed Oct 17 23:15:21 2001 @@ -0,0 +1,229 @@ +$XFree86: xc/programs/xedit/lisp/README,v 1.5 2001/10/18 03:15:21 paulo Exp $ + +LAST UPDATED: $Date: 2001/10/03 07:46:02 $ + + + SUMMARY + + This is a small lisp interpreter for xedit. In the current implementation, +it is just reading from stdin and writing to stdout/stderr. The code in xedit +just wraps these and read/write from a pipe to the lisp interpreter. This +is expected to change at some time, so that it should be possible to manage +the xedit text buffers from lisp code. + + It has a very simple method for loading shared modules, slightly based on +the XFree86 loader code, that is currently disabled by default. To enable it, +edit lisp.cf and change BuildSharedLispModules to YES. + + Assuming you have built it with BuildSharedLispModules enabled, you can build +a small test application can be built in this directory running "make lsp". +Two lisp programs are available in the test directory. To test the programs +run "./lsp hello.lsp" or "./lsp widgets.lsp". + + Currently, it should be used as an helper and/or a small calculator embeded +in xedit. For the future it should be possible to write entire interfaces +in the xedit text buffers. The code is expected to be very stable, and by +using it, xedit should not crash in any way (actually, it can't, as the +lisp is running in a separate process). The lisp process is started once the +first eval is called. + + + USAGE SUMMARY + + To evaluate lisp expressions, put the text cursor just after the +lisp expression and press: +C-x,C-e - will evaluate it, and print the result to the message window +C-j - will evaluate it, and print the result to the edit window, any + errors are printed to the message window. +C-g - will send an SIGINT to the lisp process, and that process will + stop whatever it was processing and jump to the toplevel, + to wait for more input. + +Note that C-j currently will only work in the *scratch* buffer. + + + IMPLEMENTATION SUMMARY + + The interpreter is expected to be a subset of Common Lisp, and is not +expected to invent any new features or interfaces, just become more and +more compatible with Common Lisp. The only non Common Lisp features, currently +is/are: + + o It has some Emacs Lisp functions, that should be removed and replaced with + the Common Lisp equivalent ones. + + + The currently implemented function names are in table.gperf. There are also +functions in modules/fun.lsp, that are inplicitly loaded by xedit and the +sample program lsp. + + + BUGS + + If (print) is called with a circular list as argument, the lisp interpreter +will crash. A code for circular list detection was written, but removed as +it was buggy. + The (gc) code was slightly changed to avoid circular lists, but the code +is not correct, so (gc) may need to be called several times to get deep enough +on some more complex data structures, and free it. But calling (gc) explicitly +is not required, as it will be called every time there are not enough available +cells. + + + WHY? + + I have used Emacs for a long time, and since I was working as volunteer to +make of Xaw a better user interface, xedit seemed to need some work. For at +least 3 years now, I don't use any other text editor than xedit, unless I +need for some reason to work on the text console (like when debugging the +xserver or xfs). + + The lisp code was mostly written for some years, but not incorporated in +xedit. Since the Lisp language is unlikely to change from day to night, it +can be safely incorporated in xedit. Contrarily to this is an html +viewer/editor to xedit I have been writing for some years. I wish I could add +it to Xaw/xedit soon, but unfortunately it is still unstable, and not +functional. + + + NOTE + + The lisp interpreter is mean't to be usable without xedit and without Xaw. +The xedit text buffer interface, when done will be just a module. + If you want to test the current implementation, subject to changes, as it +is only for testing, create a file named "xedit.lsp", with the contents: +-- +;; (provide "xedit") + +(defun point () + (format t "get-point~%") + (read) ;; current point +) + +(defun point-min () + (format t "point-min~%") + (read) ;; minimal point value +) + +(defun point-max () + (format t "point-max~%") + (read) ;; maximal point value +) + +(defun goto-char (point) + (format t "set-point ~D~%" point) + (read) ;; nil return value + point +) + +(defun insert (str) + (format t "insert ~S~%" str) + (read) ;; nil return value +) + +(defun get-background-color () + (format t "get-background~%") + (read) ;; current background color +) + +(defun set-background-color (color) + (format t "set-background ~S~%" color) + (read) ;; nil return value +) + +(defun get-font () + (format t "get-font~%") + (read) ;; current font +) + +(defun set-font (font) + (format t "set-font ~S~%" font) + (read) ;; nil return value +) + +(defun get-foreground-color () + (format t "get-foreground~%") + (read) ;; current foreground color +) + +(defun set-foreground-color (color) + (format t "set-foreground ~S~%" color) + (read) ;; nil return value +) + +(defun other-buffer () + (format t "get-other-buffer~%") + (read) ;; value of other buffer +) +-- +Note that it is printing a literal ESC. + After creating the file xedit.lsp, at the *scratch* buffer, type +(load "xedit.lsp") and press Ctrl+J. After that, you should be able to use +the defined functions. Try this: +(set-background-color "PeachPuff") +(set-foreground-color "Red3") +(goto-char (point-min)) + + + DEBUGGER + + There is a, currently, very simple debugger implement in the interpreter. +To use the debugger, run the lsp sample program as "./lsp -d", and optionally +pass a second parameter, for the file to be interpreted. Once the debugger +prompt is visible, type "help" for a summary of options. To leave the debugger +type "continue". + Note that the debugger is still very simple, it won't work from xedit, and +won't drop to the debugger on "fatal errors". It allows adding breakpoints to +functions and watchpoints to variables. Support for changing data and going to +the debugger on fatal errors should be added soon. + + + STRUCTURE IMPLEMENTATION OVERVIEW + + Assuming structure person is created as: + (defstruct person age first-name last-name) + The interpreter will gc protect the arguments in the list DEF defined as + (person age first-name last-name), and create the special atoms: + make-person with structure property DEF function STRUCT_CONSTRUCTOR + person-p with structure property DEF function STRUCT_CHECK + person-age with structure property DEF function 0 + person-first-name with structure property DEF function 1 + person-last-name with structure property DEF function 2 + When an accessor function is called, as in: + (person-age (make-person :age 30)) + The evaluator will internally translate the code to: + (xedit::struct-access 'person-age (xedit::make-struct 'make-person :age 30)) + The function xedit::struct-access will fetch the structure property +from the atom person-age to determine the offset, and also make sure it's +argument is of type person. The function xedit::make-struct only checks that +the structure property is set to the atom person, and that the age field is +a person field name. + It is possible to override the setf method for structures, but a suitable +one is constructed, for example: + (setf (person-first-name some-person) 'MARIA) + Internally, it will be evaluated as this definition where provided: + (defsetf person-first-name (struct) (value) + `(xedit::struct-store 'person-first-name ,struct ,value)) + And the code executed is: + (xedit::struct-store 'person-first-name some-person 'MARIA) + Type checking is also done with a single function, as the code: + (person-p some-person) + Is internally translated to: + (xedit::struct-type 'person-p some-person) + The current structure implementation, like almost everything in the +interpreter is very simple, and calling any of the xedit::* functions +explicitly is unsupported. + Structure redefinition is supported, but not encouraged, and you should +do it only when sure no instances of the previous definition exists, previous +access method functions are only removed if the new definition has a field +with the same name, and calling the new methods on old objects will generate +errors. + + + HELPING + + Send comments and code to me (paulo@XFree86.Org) or to the XFree86 +mailing/patch lists. + +-- +Paulo Index: xc/programs/xedit/lisp/core.c diff -u /dev/null xc/programs/xedit/lisp/core.c:1.17 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/core.c Sun Oct 28 09:18:49 2001 @@ -0,0 +1,2578 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/core.c,v 1.17 2001/10/28 14:18:49 tsi Exp $ */ + +#include "core.h" +#include "format.h" +#include "helper.h" +#include "private.h" + +/* + * Prototypes + */ +extern LispObj *LispRunSetf(LispMac*, LispObj*, LispObj*, LispObj*); + +/* + * Implementation + */ +LispObj * +Lisp_Mul(LispMac *mac, LispObj *list, char *fname) +{ + double result = 1.0; + + for (; list != NIL; list = CDR(list)) { + if (!NUMBER_P(CAR(list))) + LispDestroy(mac, ExpectingNumberAt, fname); + result *= NUMBER_VALUE(CAR(list)); + } + return (REAL(result)); +} + +LispObj * +Lisp_Plus(LispMac *mac, LispObj *list, char *fname) +{ + double result = 0.0; + + for (; list != NIL; list = CDR(list)) { + if (!NUMBER_P(CAR(list))) + LispDestroy(mac, ExpectingNumberAt, fname); + result += NUMBER_VALUE(CAR(list)); + } + return (REAL(result)); +} + +LispObj * +Lisp_Minus(LispMac *mac, LispObj *list, char *fname) +{ + double result; + + if (!NUMBER_P(CAR(list))) + LispDestroy(mac, ExpectingNumberAt, fname); + result = NUMBER_VALUE(CAR(list)); + list = CDR(list); + if (list == NIL) + return (REAL(-result)); + for (; list != NIL; list = CDR(list)) { + if (!NUMBER_P(CAR(list))) + LispDestroy(mac, ExpectingNumberAt, fname); + result -= NUMBER_VALUE(CAR(list)); + } + return (REAL(result)); +} + +LispObj * +Lisp_Div(LispMac *mac, LispObj *list, char *fname) +{ + double result; + + if (!NUMBER_P(CAR(list))) + LispDestroy(mac, ExpectingNumberAt, fname); + result = NUMBER_VALUE(CAR(list)); + list = CDR(list); + if (list == NIL) { + if (result == 0.0) + LispDestroy(mac, "divide by 0, at %s", fname); + return (REAL(1.0 / result)); + } + for (; list != NIL; list = CDR(list)) { + if (!NUMBER_P(CAR(list))) + LispDestroy(mac, ExpectingNumberAt, fname); + if (NUMBER_VALUE(CAR(list))) + LispDestroy(mac, "divide by 0, at %s", fname); + result /= NUMBER_VALUE(CAR(list)); + } + return (REAL(result)); +} + +LispObj * +Lisp_OnePlus(LispMac *mac, LispObj *list, char *fname) +{ + if (!NUMBER_P(CAR(list))) + LispDestroy(mac, ExpectingNumberAt, fname); + return (REAL(NUMBER_VALUE(CAR(list)) + 1.0)); +} + +LispObj * +Lisp_OneMinus(LispMac *mac, LispObj *list, char *fname) +{ + if (!NUMBER_P(CAR(list))) + LispDestroy(mac, ExpectingNumberAt, fname); + return (REAL(NUMBER_VALUE(CAR(list)) - 1.0)); +} + +LispObj * +Lisp_Less(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispBoolCond(mac, list, fname, LESS)); +} + +LispObj * +Lisp_LessEqual(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispBoolCond(mac, list, fname, LESS_EQUAL)); +} + +LispObj * +Lisp_Equal_(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispBoolCond(mac, list, fname, EQUAL)); +} + +LispObj * +Lisp_Greater(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispBoolCond(mac, list, fname, GREATER)); +} + +LispObj * +Lisp_GreaterEqual(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispBoolCond(mac, list, fname, GREATER_EQUAL)); +} + +LispObj * +Lisp_NotEqual(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispBoolCond(mac, list, fname, NOT_EQUAL)); +} + +LispObj * +Lisp_Aref(LispMac *mac, LispObj *list, char *fname) +{ + long c, count, idx, seq; + LispObj *ary = CAR(list), *dim = CDR(list), *obj; + + if (ary->type != LispArray_t) + LispDestroy(mac, "%s is not an array, at %s", + LispStrObj(mac, ary), fname); + + for (count = 0, list = dim, obj = ary->data.array.dim; list != NIL; + count++, list = CDR(list), obj = CDR(obj)) { + if (count >= ary->data.array.rank) + LispDestroy(mac, "too many subscripts %s, at %s", + LispStrObj(mac, dim), fname); + if (!INDEX_P(CAR(list)) || + NUMBER_VALUE(CAR(list)) >= NUMBER_VALUE(CAR(obj))) + LispDestroy(mac, "%s is out of range or a bad index, at %s", + LispStrObj(mac, CAR(list)), fname); + } + if (count < ary->data.array.rank) + LispDestroy(mac, "too few subscripts %s, at %s", + LispStrObj(mac, dim), fname); + + for (count = seq = 0, list = dim; list != NIL; list = CDR(list), seq++) { + for (idx = 0, obj = ary->data.array.dim; idx < seq; obj = CDR(obj), ++idx) + ; + for (c = 1, obj = CDR(obj); obj != NIL; obj = CDR(obj)) + c *= NUMBER_VALUE(CAR(obj)); + count += c * NUMBER_VALUE(CAR(list)); + } + + for (ary = ary->data.array.list; count > 0; ary = CDR(ary), count--) + ; + + return (CAR(ary)); +} + +LispObj * +Lisp_Assoc(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *cmp, *obj, *res = NIL; + + cmp = CAR(list); + list = CDR(list); + if (list == NIL) + return (NIL); + + for (list = CAR(list); list != NIL; list = CDR(list)) { + if (list->type != LispCons_t || (obj = CAR(list))->type != LispCons_t) + LispDestroy(mac, ExpectingListAt, fname); + else if (_LispEqual(mac, cmp, CAR(obj)) == T) { + res = obj; + break; + } + } + + return (res); +} + +LispObj * +Lisp_And(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res = T; + + for (; list != NIL; list = CDR(list)) { + if ((res = EVAL(CAR(list))) == NIL) + break; + } + return (res); +} + +LispObj * +Lisp_Append(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res, *obj, *cdr, *cons, *frm; + + if (list == NIL) + return (NIL); + else if (CDR(list) == NIL) + return (EVAL(CAR(list))); + + frm = FRM; + res = cdr = NIL; + + for (; list != NIL; list = CDR(list)) { + if ((obj = EVAL(CAR(list))) == NIL) + continue; + if (obj->type != LispCons_t) { + if (CDR(list) != NIL) + LispDestroy(mac, ExpectingListAt, fname); + } + GCProtect(); + if (res == NIL) { + if (obj->type != LispCons_t) { + /* is last argument, as previous check didn't fail */ + res = obj; + GCUProtect(); + break; + } + res = cdr = CONS(CAR(obj), CDR(obj)); + FRM = CONS(res, FRM); + } + else { + if (CDR(cdr)->type == LispCons_t) { + cons = CDR(cdr); + while (CDR(cons)->type == LispCons_t) { + CDR(cdr) = CONS(CAR(cons), CDR(cons)); + cons = CDR(cons); + cdr = CDR(cdr); + } + CDR(cdr) = CONS(CAR(CDR(cdr)), obj); + } + else + CDR(cdr) = obj; + cdr = CDR(cdr); + } + GCUProtect(); + } + FRM = frm; + + return (res); +} + +LispObj * +Lisp_Apply(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj, *eval, *cdr, *frm = FRM; + + eval = EVAL(CAR(list)); + if (!SYMBOL_P(eval) && eval->type != LispLambda_t) + LispDestroy(mac, "%s is not a valid function name, at %s", + LispStrObj(mac, eval), fname); + obj = NIL; + /* link eval to FRM to protect from GC */ + GCProtect(); + eval = cdr = CONS(eval, NIL); + FRM = CONS(eval, FRM); + GCUProtect(); + for (list = CDR(list); list != NIL; list = CDR(list)) { + obj = EVAL(CAR(list)); + if (CDR(list) != NIL) { + CDR(cdr) = CONS(obj, NIL); + cdr = CDR(cdr); + } + else + CDR(cdr) = obj; + } + if (obj != NIL && (obj->type != LispCons_t || CDR(obj)->type != LispCons_t)) + LispDestroy(mac, "last apply argument must be a list"); + /* Need to quote back to avoid double evaluation */ + while (obj != NIL) { + CAR(obj) = QUOTE(CAR(obj)); + obj = CDR(obj); + } + + frm = FRM; + + return (EVAL(eval)); +} + +LispObj * +Lisp_Atom(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res; + + if (list == NIL) + res = T; + else + switch (CAR(list)->type) { + case LispCons_t: + res = NIL; + break; + default: + res = T; + break; + } + return (res); +} + +LispObj * +Lisp_Block(LispMac *mac, LispObj *list, char *fname) +{ + int did_jump, *pdid_jump = &did_jump; + LispObj *res, **pres = &res; + LispBlock *block; + + if (CAR(list) != NIL && CAR(list) != T && !SYMBOL_P(CAR(list))) + LispDestroy(mac, "%s is not a symbol, at %s", + LispStrObj(mac, CAR(list)), fname); + + *pres = NIL; + *pdid_jump = 1; + block = LispBeginBlock(mac, CAR(list), LispBlockTag); + if (setjmp(block->jmp) == 0) { + *pres = Lisp_Progn(mac, CDR(list), fname); + *pdid_jump = 0; + } + LispEndBlock(mac, block); + if (*pdid_jump) + *pres = mac->block.block_ret; + + return (*pres); +} + +LispObj * +Lisp_Butlast(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res, *obj, *cdr; + int nlist; + + if ((obj = CAR(list))->type != LispCons_t) + LispDestroy(mac, "%s is not a list, at %s", + LispStrObj(mac, obj), fname); + cdr = NIL; + nlist = 0; + while (obj->type == LispCons_t) { + ++nlist; + obj = CDR(obj); + } + --nlist; + obj = CDR(list); + if (obj != NIL) { + obj = CAR(obj); + if (INDEX_P(obj)) { + int pos = NUMBER_VALUE(obj); + + if (pos == 0) { + res = CAR(list); + if (CDR(res)->type != LispCons_t) + /* CL compatible return value */ + return (CONS(CAR(res), NIL)); + return (res); + } + else { + if (pos > nlist) + return (NIL); + nlist -= pos - 1; + } + } + else + LispDestroy(mac, "%s is a invalid index, at %s", + LispStrObj(mac, obj), fname); + } + + GCProtect(); /* just disable GC, no EVAL's below */ + res = NIL; + list = CAR(list); + for (; nlist > 0; list = CDR(list), nlist--) { + obj = CAR(list); + if (res == NIL) + res = cdr = CONS(obj, NIL); + else { + CDR(cdr) = CONS(obj, NIL); + cdr = CDR(cdr); + } + } + GCUProtect(); + + return (res); +} + +LispObj * +Lisp_Car(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res = NIL; + + switch (CAR(list)->type) { + case LispNil_t: + return (NIL); + break; + case LispCons_t: + res = CAR(CAR(list)); + break; + default: + LispDestroy(mac, ExpectingListAt, fname); + /*NOTREACHED*/ + } + + return (res); +} + +LispObj * +Lisp_Case(LispMac *mac, LispObj *list, char *fname) +{ + static char *other = "OTHERWISE"; + LispObj *key, *res; + + res = NIL; + key = EVAL(CAR(list)); + + for (list = CDR(list); list != NIL; list = CDR(list)) { + if (CAR(list)->type != LispCons_t) + LispDestroy(mac, "expecting list, at %s", fname); + else if (CAR(CAR(list)) == T) { + if (CDR(list) != NIL) + LispDestroy(mac, "T must be the last clause, at %s", fname); + res = CDR(CAR(list)); + break; + } + else if (SYMBOL_P(CAR(CAR(list))) && + strcmp(other, STRPTR(CAR(CAR(list)))) == 0) { + if (CDR(list) != NIL) + LispDestroy(mac, "%s must be the last clause, at %s", + other, fname); + res = CDR(CAR(list)); + break; + } + else if (CAR(CAR(list))->type == LispCons_t) { + LispObj *keylist = CAR(CAR(list)); + + for (; keylist->type == LispCons_t; keylist = CDR(keylist)) + if (_LispEqual(mac, key, CAR(keylist)) == T) { + res = CDR(CAR(list)); + break; + } + if (keylist->type == LispCons_t) /* if found match */ + break; + } + else if (_LispEqual(mac, key, CAR(CAR(list))) == T) { + res = CDR(CAR(list)); + break; + } + } + + return (res->type == LispCons_t ? Lisp_Progn(mac, res, fname) : NIL); +} + +LispObj * +Lisp_Catch(LispMac *mac, LispObj *list, char *fname) +{ + int did_jump, *pdid_jump = &did_jump; + LispObj *res, **pres = &res; + LispBlock *block; + + *pres = NIL; + *pdid_jump = 1; + block = LispBeginBlock(mac, CAR(list), LispBlockCatch); + if (setjmp(block->jmp) == 0) { + *pres = Lisp_Progn(mac, CDR(list), fname); + *pdid_jump = 0; + } + LispEndBlock(mac, block); + if (*pdid_jump) + *pres = mac->block.block_ret; + + return (*pres); +} + +LispObj * +Lisp_Coerce(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *from, *to, *res = NIL; + LispType type = LispNil_t; + + from = CAR(list); + to = CAR(CDR(list)); + if (to == NIL) + LispDestroy(mac, "cannot convert %s to nil, at %s", + LispStrObj(mac, from), fname); + else if (to == T) + return (from); + else if (!SYMBOL_P(to)) + LispDestroy(mac, "bad argument %s, at %s", LispStrObj(mac, to), fname); + else { + if (strcmp(STRPTR(to), "ATOM") == 0 || strcmp(STRPTR(to), "SYMBOL") == 0) + type = LispAtom_t; + else if (strcmp(STRPTR(to), "REAL") == 0) + type = LispReal_t; + else if (strcmp(STRPTR(to), "CONS") == 0) + type = LispCons_t; + else if (strcmp(STRPTR(to), "STRING") == 0) + type = LispString_t; + else if (strcmp(STRPTR(to), "CHARACTER") == 0) + type = LispCharacter_t; + else if (strcmp(STRPTR(to), "OPAQUE") == 0) + type = LispOpaque_t; + else + LispDestroy(mac, "invalid type specification %s, at %s", + STRPTR(to), fname); + } + + if (from->type == LispOpaque_t) { + switch (type) { + case LispAtom_t: + res = ATOM(from->data.opaque.data); + break; + case LispString_t: + res = STRING(from->data.opaque.data); + break; + case LispCharacter_t: + res = CHAR((int)from->data.opaque.data); + break; + case LispReal_t: + res = REAL((double)((int)from->data.opaque.data)); + break; + case LispOpaque_t: + res = OPAQUE(from->data.opaque.data, 0); + break; + default: + LispDestroy(mac, "cannot convert %s to %s, at %s", + LispStrObj(mac, from), STRPTR(to), fname); + } + } + else if (from->type != type) { + if (type == LispString_t) + res = Lisp_String(mac, CONS(from, NIL), fname); + else if (type == LispCharacter_t) + res = Lisp_Character(mac, CONS(from, NIL), fname); + else + LispDestroy(mac, "cannot convert %s to %s, at %s", + LispStrObj(mac, from), STRPTR(to), fname); + } + else + res = from; + + return (res); +} + +LispObj * +Lisp_Cdr(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res = NIL; + + switch (CAR(list)->type) { + case LispNil_t: + return (NIL); + break; + case LispCons_t: + res = CDR(CAR(list)); + break; + default: + LispDestroy(mac, ExpectingListAt, fname); + /*NOTREACHED*/ + } + + return (res); +} + +LispObj * +Lisp_Cond(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *eval, *res = NIL; + + for (; list != NIL; list = CDR(list)) { + eval = CAR(list); + if (eval->type != LispCons_t) + LispDestroy(mac, "%s is a illegal clause for %s", + LispStrObj(mac, eval), fname); + res = EVAL(CAR(eval)); + if (res->type == LispNil_t) + continue; + for (eval = CDR(eval); eval != NIL; eval = CDR(eval)) + res = EVAL(CAR(eval)); + break; + } + + return (res); +} + +LispObj * +Lisp_Cons(LispMac *mac, LispObj *list, char *fname) +{ + return (CONS(CAR(list), CAR(CDR(list)))); +} + +LispObj * +Lisp_Decf(LispMac *mac, LispObj *list, char *fname) +{ + double dval; + LispObj *sym = CAR(list), *num = EVAL(sym), + *obj = CDR(list) == NIL ? NIL : CAR(CDR(list)), *val; + + if (!NUMBER_P(num)) + LispDestroy(mac, "expecting number, at %s", fname); + if (obj != NIL) { + obj = EVAL(obj); + if (!NUMBER_P(obj)) + LispDestroy(mac, "expecting number, at %s", fname); + } + + dval = NUMBER_VALUE(num) - (obj != NIL ? NUMBER_VALUE(obj) : 1.0); + val = REAL(dval); + + if (!SYMBOL_P(sym)) { + /* a bit more complicated, but still faster than + * (setf place (- place 1)) + * in most cases, could directly change num, but that would cause + * side effects, like: + * (setq n '(1)) => 1 + * (setq m (car n)) => 1 + * (decf (car n)) => 0 + * m => 0 + * this should not happen. + * + * incf uses the same logic + */ + LispObj *frm = FRM; + + obj = CONS(sym, CONS(val, NIL)); + FRM = CONS(obj, FRM); /* protect setf arguments */ + num = Lisp_Setf(mac, obj, fname); + frm = FRM; + } + else { + if (obj != NIL) + num = _LispSet(mac, sym, val, fname, 0); + else + num = _LispSet(mac, sym, val, fname, 0); + } + + return (num); +} + +LispObj * +Lisp_Defmacro(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispDefLambda(mac, list, LispMacro)); +} + +LispObj * +Lisp_Defun(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispDefLambda(mac, list, LispFunction)); +} + +LispObj * +Lisp_Defsetf(LispMac *mac, LispObj *list, char *fname) +{ + if (CDR(CDR(list)) == NIL) { + LispObj *nam, *val; + + nam = CAR(list); + list = CDR(list); + val = CAR(list); + if (!SYMBOL_P(nam) || !SYMBOL_P(val)) + LispDestroy(mac, "syntax error at %s %s", fname, + LispStrObj(mac, nam)); + + LispSetAtomSetfProperty(mac, nam->data.atom, val); + + return (nam); + } + + return (_LispDefLambda(mac, list, LispSetf)); +} + +LispObj * +Lisp_Do(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispDo(mac, list, fname, 0)); +} + +LispObj * +Lisp_DoP(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispDo(mac, list, fname, 1)); +} + +LispObj * +Lisp_DoList(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispDoListTimes(mac, list, fname, 0)); +} + +LispObj * +Lisp_DoTimes(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispDoListTimes(mac, list, fname, 1)); +} + +LispObj * +Lisp_Elt(LispMac *mac, LispObj *list, char *fname) +{ + int len, pos; + LispObj *seq = CAR(list), *opos = CAR(CDR(list)), *res; + + /* if not a sequence, Lisp_Length will see it */ + len = Lisp_Length(mac, list, fname)->data.real; + + if (!INDEX_P(opos) || NUMBER_VALUE(opos) >= len) + LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, opos), fname); + pos = NUMBER_VALUE(opos); + + if (STRING_P(seq)) + res = CHAR(*(unsigned char*)(STRPTR(seq) + pos)); + else { + if (seq->type == LispArray_t) + seq = seq->data.array.list; + + for (; pos > 0; pos--, seq = CDR(seq)) + ; + res = CAR(seq); + } + + return (res); +} + +LispObj * +Lisp_Equal(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispEqual(mac, CAR(list), CAR(CDR(list)))); +} + +LispObj * +Lisp_Error(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *str; + + str = Lisp_Format(mac, CONS(NIL, list), fname); + LispDestroy(mac, "%s", STRPTR(str)); + /*NOTREACHED*/ + + return (NIL); +} + +LispObj * +Lisp_Eval(LispMac *mac, LispObj *list, char *fname) +{ + return (EVAL(CAR(list))); +} + +LispObj * +Lisp_Evenp(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list); + + if (!INTEGER_P(obj)) + LispDestroy(mac, "expecting integer, at %s", fname); + + return ((int)NUMBER_VALUE(obj) % 2 ? NIL : T); +} + +LispObj * +Lisp_FMakunbound(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *atom; + + if (!SYMBOL_P(CAR(list))) + LispDestroy(mac, "%s is not a symbol, at %s", + LispStrObj(mac, CAR(list)), fname); + atom = CAR(list); + + if (atom->data.atom->property) { + if (atom->data.atom->property->function) + LispRemAtomFunctionProperty(mac, atom->data.atom); + else if (atom->data.atom->property->builtin) + /* not a smart move, just looses a fast function, + * and gains no extra memory... */ + LispRemAtomBuiltinProperty(mac, atom->data.atom); + } + + return (atom); +} + +LispObj * +Lisp_Funcall(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *fun = EVAL(CAR(list)); + + return (EVAL(CONS(fun, CDR(list)))); +} + +LispObj * +Lisp_Get(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *sym, *key, *res; + + if ((sym = CAR(list))->type != LispAtom_t) + LispDestroy(mac, "expecting symbol, at %s", fname); + list = CDR(list); + key = CAR(list); + + res = LispGetAtomProperty(mac, sym->data.atom, key); + + if (res != NIL) + res = CAR(res); + else { + list = CDR(list); + if (list == NIL) + res = NIL; + else + res = CAR(list); + } + + return (res); +} + +LispObj * +Lisp_Gc(LispMac *mac, LispObj *list, char *fname) +{ + LispGC(mac, NIL, NIL); + + return (list == NIL || CAR(list)->type == LispNil_t ? NIL : T); +} + +LispObj * +Lisp_Go(LispMac *mac, LispObj *list, char *fname) +{ + unsigned blevel = mac->block.block_level; + LispObj *tag = CAR(list); + + if (tag != NIL && tag != T && !SYMBOL_P(tag) && !NUMBER_P(tag)) + goto cannot_go; + + while (blevel) { + LispBlock *block = mac->block.block[--blevel]; + + if (block->type == LispBlockClosure) + /* if reached a function call */ + break; + if (block->type == LispBlockBody) { + mac->block.block_ret = tag; + LispBlockUnwind(mac); + longjmp(block->jmp, 1); + } + } + +cannot_go: + LispDestroy(mac, "cannot go to %s, at %s", LispStrObj(mac, tag), fname); + + /*NOTREACHED*/ + return (NIL); +} + +LispObj * +Lisp_Incf(LispMac *mac, LispObj *list, char *fname) +{ + double dval; + LispObj *sym = CAR(list), *num = EVAL(sym), + *obj = CDR(list) == NIL ? NIL : CAR(CDR(list)), *val; + + if (!NUMBER_P(num)) + LispDestroy(mac, "expecting number, at %s", fname); + if (obj != NIL) { + obj = EVAL(obj); + if (!NUMBER_P(obj)) + LispDestroy(mac, "expecting number, at %s", fname); + } + + dval = NUMBER_VALUE(num) + (obj != NIL ? NUMBER_VALUE(obj) : 1.0); + val = REAL(dval); + + if (!SYMBOL_P(sym)) { + LispObj *frm = FRM; + + obj = CONS(sym, CONS(val, NIL)); + FRM = CONS(obj, FRM); /* protect setf arguments */ + num = Lisp_Setf(mac, obj, fname); + frm = FRM; + } + else { + if (obj != NIL) + num = _LispSet(mac, sym, val, fname, 0); + else + num = _LispSet(mac, sym, val, fname, 0); + } + + return (num); +} + +LispObj * +Lisp_If(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *cond, *res; + + cond = EVAL(CAR(list)); + list = CDR(list); + if (cond != NIL) + res = EVAL(CAR(list)); + else { + if (CDR(list) == NIL) + res = NIL; + else + res = EVAL(CAR(CDR(list))); + } + + return (res); +} + +LispObj * +Lisp_Integerp(LispMac *mac, LispObj *list, char *fname) +{ + return (INTEGER_P(CAR(list)) ? T : NIL); +} + +LispObj * +Lisp_Lambda(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispDefLambda(mac, list, LispLambda)); +} + +LispObj * +Lisp_Last(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *seq, *obj; + int nseq, count; + + if ((seq = CAR(list)) == NIL) + return (seq); + else if (seq->type != LispCons_t) + LispDestroy(mac, ExpectingListAt, fname); + + if (CDR(list) != NIL) { + obj = CAR(CDR(list)); + if (!INDEX_P(obj)) + LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, obj), fname); + count = NUMBER_VALUE(obj); + } + else + count = 1; + + for (nseq = 0, obj = seq; obj->type == LispCons_t; nseq++, obj = CDR(obj)) + ; + + count = nseq - count; + + if (count > nseq) + return (NIL); + else if (count <= 0) + return (seq); + + for (; count > 0; count--, seq = CDR(seq)) + ; + + return (seq); +} + +LispObj * +Lisp_Length(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj; + int length = 0; + + obj = CAR(list); + switch (obj->type) { + case LispNil_t: + break; + case LispString_t: + length = strlen(STRPTR(obj)); + break; + case LispArray_t: + if (obj->data.array.rank != 1) + goto notseq; + obj = obj->data.array.list; + /*FALLTROUGH*/ + case LispCons_t: + while (obj->type == LispCons_t) { + ++length; + obj = CDR(obj); + } + break; + default: +notseq: + LispDestroy(mac, "%s is not a sequence, at %s", + LispStrObj(mac, obj), fname); + /*NOTREACHED*/ + } + + return (REAL(length)); +} + +LispObj * +Lisp_Let(LispMac *mac, LispObj *list, char *fname) +{ + return (LispEnvRun(mac, list, Lisp_Progn, fname, 0)); +} + +LispObj * +Lisp_LetP(LispMac *mac, LispObj *list, char *fname) +{ + return (LispEnvRun(mac, list, Lisp_Progn, fname, 1)); +} + +LispObj * +Lisp_List(LispMac *mac, LispObj *list, char *fname) +{ + return (list); +} + +LispObj * +Lisp_ListP(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res, *cdr, *obj; + + obj = EVAL(CAR(list)); + if (CDR(list) == NIL) + return (obj); + + GCProtect(); /* just disable GC, no EVAL's below */ + res = NIL; + cdr = obj; + for (list = CDR(list); list != NIL; list = CDR(list)) { + obj = EVAL(CAR(list)); + if (res == NIL) + res = cdr = CONS(cdr, obj); + else { + CDR(cdr) = CONS(CDR(cdr), obj); + cdr = CDR(cdr); + } + } + GCUProtect(); + + return (res); +} + +LispObj * +Lisp_Listp(LispMac *mac, LispObj *list, char *fname) +{ + switch (CAR(list)->type) { + case LispNil_t: + case LispCons_t: + return (T); + default: + return (NIL); + } + /*NOTREACHED*/ +} + +LispObj * +Lisp_Loop(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj, *res; + LispBlock *block; + + res = NIL; + block = LispBeginBlock(mac, NIL, LispBlockTag); + if (setjmp(block->jmp) == 0) { + for (;;) + for (obj = list; obj != NIL; obj = CDR(obj)) + (void)EVAL(CAR(obj)); + } + LispEndBlock(mac, block); + res = mac->block.block_ret; + + return (res); +} + +LispObj * +Lisp_Makearray(LispMac *mac, LispObj *list, char *fname) +{ + LispType type = LispNil_t; + long rank = 0, count = 1, zero, offset, c; + LispObj *ary = NIL, *dim = NIL, *init, *typ, *cont, *disp, *off, *obj; + + if (NUMBER_P(CAR(list))) { + if (!INDEX_P(CAR(list))) + LispDestroy(mac, "%s is a bad array dimension, at %s", + LispStrObj(mac, CAR(list)), fname); + else + dim = CONS(CAR(list), NIL); + rank = 1; + count = NUMBER_VALUE(CAR(list)); + } + else if (CAR(list)->type == LispCons_t) { + dim = CAR(list); + + for (obj = dim, rank = 0; obj != NIL; obj = CDR(obj), ++rank) { + if (obj->type != LispCons_t || !INDEX_P(CAR(obj))) + LispDestroy(mac, "%s is a bad array dimension, at %s", + LispStrObj(mac, dim), fname); + count *= NUMBER_VALUE(CAR(obj)); + } + } + + offset = -1; + LispGetKeys(mac, fname, + "INITIAL-ELEMENT:ELEMENT-TYPE:INITIAL-CONTENTS" + ":DISPLACED-TO:DISPLACED-INDEX-OFFSET", + CDR(list), &init, &typ, &cont, &disp, &off); + + /* check element-type */ + if (typ != NIL) { + if (typ == T) + type = LispTrue_t; + else if (!SYMBOL_P(typ)) + LispDestroy(mac, "unsupported element type %s, at %s", + LispStrObj(mac, typ), fname); + else { + if (strcmp(STRPTR(typ), "ATOM") == 0) + type = LispAtom_t; + else if (strcmp(STRPTR(typ), "REAL") == 0) + type = LispReal_t; + else if (strcmp(STRPTR(typ), "STRING") == 0) + type = LispString_t; + else if (strcmp(STRPTR(typ), "LIST") == 0) + type = LispCons_t; + else if (strcmp(STRPTR(typ), "OPAQUE") == 0) + type = LispOpaque_t; + else + LispDestroy(mac, "unsupported element type %s, at %s", + STRPTR(typ), fname); + } + } + + /* check initial-contents */ + if (cont != NIL && cont->type != LispCons_t) + LispDestroy(mac, "%s is not a list, at %s", + LispStrObj(mac, cont), fname); + + /* check displaced-to */ + if (disp != NIL && disp->type != LispArray_t) + LispDestroy(mac, "%s is not an array, at %s", + LispStrObj(mac, disp), fname); + + /* check displaced-index-offset */ + if (off != NIL) { + if (!INDEX_P(off)) + LispDestroy(mac, "%s is a bad :DISPLACED-INDEX-OFFSET, at %s", + LispStrObj(mac, off), fname); + offset = (int)NUMBER_VALUE(off); + } + + c = 0; + if (init != NIL) + ++c; + if (cont != NIL) + ++c; + if (disp != NIL || offset >= 0) + ++c; + if (c > 1) + LispDestroy(mac, "more than one initialization specified, at %s", + fname); + + zero = count == 0; + if (disp != NIL) { + if (offset < 0) + offset = 0; + for (c = 1, obj = disp->data.array.dim; obj != NIL; obj = CDR(obj)) + c *= (int)NUMBER_VALUE(CAR(obj)); + if (c < count + offset) + LispDestroy(mac, "array-total-size + displaced-index-offset " + "exceeds total size, at %s", fname); + for (c = 0, ary = disp->data.array.list; c < offset; c++) + ary = CDR(ary); + } + else if (cont != NIL) { + if (rank == 1) { + for (ary = cont, c = 0; c < count; ary = CDR(ary), ++c) + if (ary->type != LispCons_t) + LispDestroy(mac, "bad argument or size %s, at %s", + LispStrObj(mac, ary), fname); + if (ary != NIL) + LispDestroy(mac, "bad argument or size %s, at %s", + LispStrObj(mac, ary), fname); + ary = cont; + } + else { + LispObj *err = NIL; + /* check if list matches */ + int i, j, k, *dims, *loop; + + /* create iteration variables */ + dims = LispMalloc(mac, sizeof(int) * rank); + loop = LispCalloc(mac, 1, sizeof(int) * (rank - 1)); + for (i = 0, obj = dim; obj != NIL; i++, obj = CDR(obj)) + dims[i] = (int)NUMBER_VALUE(CAR(obj)); + + /* check if list matches specified dimensions */ + while (loop[0] < dims[0]) { + for (obj = cont, i = 0; i < rank - 1; i++) { + for (j = 0; j < loop[i]; j++) + obj = CDR(obj); + err = obj; + if ((obj = CAR(obj))->type != LispCons_t) + goto make_array_error; + err = obj; + } + --i; + for (;;) { + ++loop[i]; + if (i && loop[i] >= dims[i]) + loop[i] = 0; + else + break; + --i; + } + for (k = 0; k < dims[rank - 1]; obj = CDR(obj), k++) { + if (obj->type != LispCons_t) + goto make_array_error; + } + if (obj == NIL) + continue; +make_array_error: + LispFree(mac, dims); + LispFree(mac, loop); + LispDestroy(mac, "bad argument or size %s, at %s", + LispStrObj(mac, err), fname); + } + + /* list is correct, use it to fill initial values */ + + /* reset loop */ + memset(loop, 0, sizeof(int) * (rank - 1)); + + GCProtect(); + /* fill array with supplied values */ + while (loop[0] < dims[0]) { + for (obj = cont, i = 0; i < rank - 1; i++) { + for (j = 0; j < loop[i]; j++) + obj = CDR(obj); + obj = CAR(obj); + } + --i; + for (;;) { + ++loop[i]; + if (i && loop[i] >= dims[i]) + loop[i] = 0; + else + break; + --i; + } + for (k = 0; k < dims[rank - 1]; obj = CDR(obj), k++) { + if (ary == NIL) + ary = CONS(CAR(obj), NIL); + else { + CDR(ary) = CONS(CAR(ary), CDR(ary)); + CAR(ary) = CAR(obj); + } + } + } + LispFree(mac, dims); + LispFree(mac, loop); + ary = LispReverse(ary); + GCUProtect(); + } + } + else { + GCProtect(); + /* allocate array */ + if (count) { + --count; + ary = CONS(init, NIL); + while (count) { + CDR(ary) = CONS(CAR(ary), CDR(ary)); + CAR(ary) = init; + count--; + } + } + GCUProtect(); + } + + if (type == LispNil_t) + type = LispTrue_t; + obj = LispNew(mac, ary, dim); + obj->type = LispArray_t; + obj->data.array.list = ary; + obj->data.array.dim = dim; + obj->data.array.rank = rank; + obj->data.array.type = type; /* XXX ignored */ + obj->data.array.zero = zero; + + return (obj); +} + +LispObj * +Lisp_Makelist(LispMac *mac, LispObj *list, char *fname) +{ + int count; + LispObj *res, *data, *tail; + + if (!INDEX_P(CAR(list))) + LispDestroy(mac, "%s is not a positive integer, at %s", + LispStrObj(mac, CAR(list)), fname); + + count = NUMBER_VALUE(CAR(list)); + LispGetKeys(mac, fname, "INITIAL-ELEMENT", CDR(list), &data); + + GCProtect(); + res = tail = CONS(data, data); + for (; count > 1; count--) + res = CONS(data, res); + CDR(tail) = NIL; + GCUProtect(); + + return (res); +} + +LispObj * +Lisp_Makunbound(LispMac *mac, LispObj *list, char *fname) +{ + if (!SYMBOL_P(CAR(list))) + LispDestroy(mac, "%s is not a symbol, at %s", + LispStrObj(mac, CAR(list)), fname); + + LispUnsetVar(mac, CAR(list)); + + return (CAR(list)); +} + +LispObj * +Lisp_Mapcar(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj, *eval, *res, *cdres, *car, *cdr, *ptr, *fun, *frm = FRM; + int i, level; + + fun = EVAL(CAR(list)); + if (!SYMBOL_P(fun) && fun->type != LispLambda_t) + LispDestroy(mac, "%s is not a valid function name, at %s", + LispStrObj(mac, fun), fname); + cdres = NIL; + for (level = 0, res = NIL; ; level++) { + LispObj *tfrm = FRM; + + eval = cdr = CONS(fun, NIL); + FRM = CONS(eval, FRM); /* protect eval, as there is n EVAL's below */ + for (ptr = CDR(list); ptr != NIL; ptr = CDR(ptr)) { + car = EVAL(CAR(ptr)); + if (car->type != LispCons_t) + goto mapcar_done; + for (i = 0, obj = car; i < level; i++) { + if ((obj = CDR(obj)) == NIL) + goto mapcar_done; + } + /* quote back to avoid double eval */ + GCProtect(); + car = QUOTE(CAR(obj)); + CDR(cdr) = CONS(car, NIL); + cdr = CDR(cdr); + GCUProtect(); + } + obj = EVAL(eval); + FRM = tfrm; + if (res == NIL) { + GCProtect(); + res = cdres = CONS(obj, NIL); + FRM = CONS(res, FRM); /* protect res linking to FRM */ + GCUProtect(); + } + else { + CDR(cdres) = CONS(obj, NIL); + cdres = CDR(cdres); + } + } + + FRM = frm; /* no need for GC protection now */ + + /* to be CL compatible */ +mapcar_done: + return (res); +} + +LispObj * +Lisp_Max(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispMinMax(mac, list, fname, 1)); +} + +LispObj * +Lisp_Member(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list), *res = NIL; + + list = CAR(CDR(list)); + if (list->type == LispNil_t) + return (NIL); + else if (list->type != LispCons_t) + LispDestroy(mac, ExpectingListAt, fname); + + for (; list != NIL; list = CDR(list)) + if (_LispEqual(mac, obj, CAR(list)) == T) { + res = list; + break; + } + + return (res); +} + +LispObj * +Lisp_Min(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispMinMax(mac, list, fname, 0)); +} + +LispObj * +Lisp_Minusp(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list); + + if (!NUMBER_P(obj)) + LispDestroy(mac, "expecting number, at %s", fname); + + return (NUMBER_VALUE(obj) < 0.0 ? T : NIL); +} + +LispObj * +Lisp_Nth(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispNth(mac, list, fname, 0)); +} + +LispObj * +Lisp_Nthcdr(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispNth(mac, list, fname, 1)); +} + +LispObj * +Lisp_Null(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res = NIL; + + if (list != NIL && CAR(list)->type == LispNil_t) + res = T; + return (res); +} + +LispObj * +Lisp_Numberp(LispMac *mac, LispObj *list, char *fname) +{ + return (NUMBER_P(CAR(list)) ? T : NIL); +} + +LispObj * +Lisp_Oddp(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list); + + if (!INTEGER_P(obj)) + LispDestroy(mac, "expecting integer, at %s", fname); + + return ((int)NUMBER_VALUE(obj) % 2 ? T : NIL); +} + +LispObj * +Lisp_Or(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res = NIL; + + for (; list != NIL; list = CDR(list)) { + if ((res = EVAL(CAR(list))) != NIL) + break; + } + return (res); +} + +LispObj * +Lisp_Plusp(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list); + + if (!NUMBER_P(obj)) + LispDestroy(mac, "expecting number, at %s", fname); + + return (NUMBER_VALUE(obj) > 0.0 ? T : NIL); +} + +LispObj * +Lisp_Prin1(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list), *stream; + + list = CDR(list); + if (list == NIL || CAR(list) == NIL) + stream = NIL; + else + stream = CAR(list); + + LispPrint(mac, obj, stream, 0); + + return (obj); +} + +LispObj * +Lisp_Princ(LispMac *mac, LispObj *list, char *fname) +{ + int princ = mac->princ; + LispObj *obj = CAR(list), *stream; + + list = CDR(list); + if (list == NIL || CAR(list) == NIL) + stream = NIL; + else + stream = CAR(list); + + mac->princ = 1; + LispPrint(mac, obj, stream, 0); + mac->princ = princ; + + return (obj); +} + +LispObj * +Lisp_Print(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list), *stream; + + list = CDR(list); + if (list == NIL || CAR(list) == NIL) + stream = NIL; + else + stream = CAR(list); + + LispPrint(mac, obj, stream, 1); + + return (obj); +} + +LispObj * +Lisp_Prog1(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *frm, *res = EVAL(CAR(list)); + + frm = FRM; + FRM = CONS(res, FRM); + for (list = CDR(list); list != NIL; list = CDR(list)) + (void)EVAL(CAR(list)); + FRM = frm; + + return (res); +} + +LispObj * +Lisp_Prog2(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *frm, *res; + + (void)EVAL(CAR(list)); + list = CDR(list); + res = EVAL(CAR(list)); + frm = FRM; + FRM = CONS(res, FRM); + for (list = CDR(list); list != NIL; list = CDR(list)) + (void)EVAL(CAR(list)); + FRM = frm; + + return (res); +} + +LispObj * +Lisp_Progn(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res = NIL; + + for (; list != NIL; list = CDR(list)) + res = EVAL(CAR(list)); + + return (res); +} + +LispObj * +Lisp_Progv(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *old_frm, *old_env, *res, *cons = NIL, *valist = NIL; + LispObj *syms, *values, *body; + + old_frm = FRM; + + /* get symbol names */ + syms = EVAL(CAR(list)); + GCProtect(); + FRM = CONS(syms, FRM); + GCUProtect(); + + /* get symbol values */ + list = CDR(list); + values = EVAL(CAR(list)); + GCProtect(); + FRM = CONS(values, FRM); + GCUProtect(); + list = CDR(list); + + /* the body to be executed */ + body = list; + + /* fill variable list */ + for (; syms->type == LispCons_t; syms = CDR(syms)) { + if (values->type != LispCons_t) + break; + if (!SYMBOL_P(CAR(syms))) + LispDestroy(mac, "%s is not a symbol, at %s", + LispStrObj(mac, CAR(syms)), fname); + if (valist == NIL) { + GCProtect(); + valist = cons = CONS(CONS(CAR(syms), CAR(values)), NIL); + FRM = CONS(valist, FRM); + GCUProtect(); + } + else { + CDR(cons) = CONS(CONS(CAR(syms), CAR(values)), NIL); + cons = CDR(cons); + } + values = CDR(values); + } + + /* add variables */ + old_env = ENV; + for (; valist != NIL; valist = CDR(valist)) { + cons = CAR(valist); + LispAddVar(mac, CAR(cons), CDR(cons)); + } + + res = Lisp_Progn(mac, body, fname); + + ENV = old_env; + FRM = old_frm; + + return (res); +} + +LispObj * +Lisp_Provide(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *feat = CAR(list), *obj; + + if (!STRING_P(feat) && !SYMBOL_P(feat)) + LispDestroy(mac, "cannot provide %s", LispStrObj(mac, feat)); + + for (obj = MOD; obj != NIL; obj = CDR(obj)) { + if (STRPTR(CAR(obj)) == STRPTR(feat)) + return (feat); + } + + if (MOD == NIL) + MOD = CONS(feat, NIL); + else { + CDR(MOD) = CONS(CAR(MOD), CDR(MOD)); + CAR(MOD) = feat; + } + + return (feat); +} + +LispObj * +Lisp_Quit(LispMac *mac, LispObj *list, char *fname) +{ + int status = 0; + + if (list != NIL) { + if (!INTEGER_P(CAR(list))) + LispDestroy(mac, "bad exit status argument %s, at %s", + LispStrObj(mac, CAR(list)), fname); + status = (int)NUMBER_VALUE(CAR(list)); + } + + exit(status); +} + +LispObj * +Lisp_Quote(LispMac *mac, LispObj *list, char *fname) +{ + return (CAR(list)); +} + +/* XXX needs to be extended to accept parameters */ +LispObj * +Lisp_Read(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj; + + obj = LispRun(mac); + if (obj == EOLIST) + LispDestroy(mac, "object cannot start with #\\)"); + + return (obj); +} + +/* Destructively replaces seq1 elements with seq2 elements + * (replace sequence1 sequence2 &key :start1 :end1 :start2 :end2) + */ +LispObj * +Lisp_Replace(LispMac *mac, LispObj *list, char *fname) +{ + int len, len1, len2, start1, end1, start2, end2; + LispObj *seq1, *seq2, *ostart1, *oend1, *ostart2, *oend2; + + seq1 = CAR(list); + len1 = Lisp_Length(mac, list, fname)->data.real; + + list = CDR(list); + seq2 = CAR(list); + len2 = Lisp_Length(mac, list, fname)->data.real; + + list = CDR(list); + LispGetKeys(mac, fname, "START1:END1:START2:END2", list, + &ostart1, &oend1, &ostart2, &oend2); + + if (ostart1 == NIL) + start1 = 0; + else if (INDEX_P(ostart1)) + goto replace_not_integer; + else + start1 = NUMBER_VALUE(ostart1); + if (oend1 == NIL) + end1 = len1; + else if (INDEX_P(oend1)) + goto replace_not_integer; + else + end1 = NUMBER_VALUE(oend1); + + if (ostart2 == NIL) + start2 = 0; + else if (INDEX_P(ostart2)) + goto replace_not_integer; + else + start2 = NUMBER_VALUE(ostart2); + if (oend2 == NIL) + end2 = len2; + else if (INDEX_P(oend2)) + goto replace_not_integer; + else + end2 = NUMBER_VALUE(oend2); + + if (start1 == end1 || start2 == end2) + goto replace_done; + + if (start1 > end1 || end1 > len1 || start2 > end2 || end2 > len2) + goto replace_out_of_range; + + len = end1 - start1; + if (len > end2 - start2) + len = end2 - start2; + + if (STRING_P(seq1)) { + char *string; + + if (!STRING_P(seq2)) + goto replace_type_mismatch; + + string = LispStrdup(mac, STRPTR(seq1)); + strncpy(string + start1, STRPTR(seq2) + start2, len); + seq1->data.atom = LispDoGetAtom(mac, string, 0, 0); + LispFree(mac, string); + } + else { + int i; + LispObj *from, *to; + + if (seq1->type == LispArray_t) + seq1 = seq1->data.array.list; + if (seq2->type == LispArray_t) + seq2 = seq2->data.array.list; + + /* adjust pointers */ + for (i = 0, from = seq2; i < start2; i++, from = CDR(from)) + ; + for (i = 0, to = seq1; i < start1; i++, to = CDR(to)) + ; + + /* copy data */ + for (i = 0; i < len; i++, from = CDR(from), to = CDR(to)) + CAR(to) = CAR(from); + } + + goto replace_done; + +replace_not_integer: + LispDestroy(mac, "expecting a positive integer, at %s", fname); + +replace_out_of_range: + LispDestroy(mac, "index out of range, at %s", fname); + +replace_type_mismatch: + LispDestroy(mac, "sequences type don't match, at %s", fname); + +replace_done: + return (seq1); +} + +LispObj * +Lisp_Return(LispMac *mac, LispObj *list, char *fname) +{ + unsigned blevel = mac->block.block_level; + + while (blevel) { + LispBlock *block = mac->block.block[--blevel]; + + if (block->type == LispBlockClosure) + /* if reached a function call */ + break; + if (block->type == LispBlockTag && block->tag.type == LispNil_t) { + mac->block.block_ret = list == NIL ? NIL : EVAL(CAR(list)); + LispBlockUnwind(mac); + longjmp(block->jmp, 1); + } + } + LispDestroy(mac, "no visible NIL block, at %s", fname); + /*NOTREACHED*/ + + return (NIL); +} + +LispObj * +Lisp_ReturnFrom(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *tag = CAR(list); + unsigned blevel = mac->block.block_level; + + if (tag != NIL && tag != T && !SYMBOL_P(tag)) + LispDestroy(mac, "%s is not a symbol, at %s", + LispStrObj(mac, tag), fname); + + list = CDR(list); + while (blevel) { + int jmp = 1; + LispBlock *block = mac->block.block[--blevel]; + + if (tag->type == block->tag.type) { + switch (tag->type) { + case LispNil_t: + case LispTrue_t: + break; + case LispAtom_t: + jmp = tag->data.atom == block->tag.data.atom; + break; + default: + /* only atom, nil or t can be used */ + jmp = 0; + break; + } + } + if (block->type != LispBlockTag && block->type != LispBlockClosure) + break; + if (jmp) { + mac->block.block_ret = list == NIL ? NIL : EVAL(CAR(list)); + LispBlockUnwind(mac); + longjmp(block->jmp, 1); + } + if (block->type != LispBlockTag) + /* can use return-from only in the current function */ + break; + } + LispDestroy(mac, "no visible block named %s, at %s", + LispStrObj(mac, tag), fname); + /*NOTREACHED*/ + + return (NIL); +} + +LispObj * +Lisp_Reverse(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res; + + switch (CAR(list)->type) { + case LispNil_t: + return (NIL); + break; + case LispCons_t: + break; + default: + LispDestroy(mac, ExpectingListAt, fname); + /*NOTREACHED*/ + } + + GCProtect(); + res = NIL; + list = CAR(list); + while (list->type == LispCons_t && list != NIL) { + res = CONS(CAR(list), res); + list = CDR(list); + } + GCUProtect(); + + return (res); +} + +LispObj * +Lisp_Rplaca(LispMac *mac, LispObj *list, char *fname) +{ + if (CAR(list)->type != LispCons_t) + LispDestroy(mac, "%s is not of type cons, at %s", + LispStrObj(mac, CAR(list)), fname); + + CAR(CAR(list)) = CAR(CDR(list)); + + return (CAR(list)); +} + +LispObj * +Lisp_Rplacd(LispMac *mac, LispObj *list, char *fname) +{ + if (CAR(list)->type != LispCons_t) + LispDestroy(mac, "%s is not of type cons, at %s", + LispStrObj(mac, CAR(list)), fname); + + CDR(CAR(list)) = CAR(CDR(list)); + + return (CAR(list)); +} + +LispObj * +Lisp_Set(LispMac *mac, LispObj *list, char *fname) +{ + int count; + LispObj *var, *val, *res = NIL; + /* res always set, is minimum args is 2 */ + + for (count = 0, var = list; var != NIL; count++, var = CDR(var)) + ; + if (count & 1) + LispDestroy(mac, "odd number of arguments, at %s", fname); + + for (var = CAR(list), val = CAR(CDR(list)); list != NIL; + list = CDR(CDR(list))) + res = _LispSet(mac, CAR(list), CAR(CDR(list)), fname, 0); + + return (res); +} + +LispObj * +Lisp_SetQ(LispMac *mac, LispObj *list, char *fname) +{ + int count; + LispObj *var, *val, *res = NIL; + /* res always set, is minimum args is 2 */ + + for (count = 0, var = list; var != NIL; count++, var = CDR(var)) + ; + if (count & 1) + LispDestroy(mac, "odd number of arguments, at %s", fname); + + for (var = CAR(list), val = CAR(CDR(list)); list != NIL; + list = CDR(CDR(list))) + res = _LispSet(mac, CAR(list), CAR(CDR(list)), fname, 1); + + return (res); +} + +LispObj * +Lisp_Setf(LispMac *mac, LispObj *list, char *fname) +{ + int count; + LispAtom *atom; + LispObj *place, *setf, *res = NIL; + + for (count = 0, place = list; place != NIL; count++, place = CDR(place)) + ; + if (count & 1) + LispDestroy(mac, "odd number of arguments, at %s", fname); + + for (place = CAR(list), list = CDR(list); + ; place = CAR(list), list = CDR(list)) { + /* if a variable, just work like setq */ + if (SYMBOL_P(place)) + res = _LispSet(mac, place, CAR(list), fname, 1); + else if (place->type == LispCons_t) { + int struc_access = 0; + + /* the default setf method for structures is generated here + * (cannot be done in EVAL as SETF is a macro), and the + * code executed is as if this definition were supplied: + * (defsetf THE-STRUCT-FIELD (struct) (value) + * `(xedit::struct-store 'THE-STRUCT-FIELD ,struct ,value)) + */ + + setf = CAR(place); + if (!SYMBOL_P(setf) || setf->data.atom->property == NULL) + LispDestroy(mac, "%s is a invalid %s place", + LispStrObj(mac, place), fname); + + atom = setf->data.atom; + + if (atom->property->defsetf == 0) { + if (atom->property->defstruct && + atom->property->structure.function >= 0) { + /* user didn't provide any special defsetf */ + setf = ATOM("XEDIT::STRUCT-STORE"); + struc_access = 1; + } + else + LispDestroy(mac, "%s is a invalid %s place", + LispStrObj(mac, place), fname); + } + else + setf = setf->data.atom->property->setf; + + if (SYMBOL_P(setf)) { + /* just change function call, and append value to arguments */ + LispObj *cod, *cdr, *obj, *frm = FRM; + + GCProtect(); + cod = cdr = CONS(setf, NIL); + FRM = CONS(cod, FRM); + GCUProtect(); + + if (struc_access) { + /* using builtin setf method for structure field */ + CDR(cdr) = CONS(QUOTE(CAR(place)), NIL); + cdr = CDR(cdr); + } + + for (obj = CDR(place); obj != NIL; obj = CDR(obj)) { + CDR(cdr) = CONS(CAR(obj), NIL); + cdr = CDR(cdr); + } + CDR(cdr) = CONS(CAR(list), NIL); + res = EVAL(cod); + frm = FRM; + } + else + res = LispRunSetf(mac, setf, place, CAR(list)); + + } + else + LispDestroy(mac, "%s is not a %s place", + LispStrObj(mac, place), fname); + + if ((list = CDR(list)) == NIL) + break; + } + + return (res); +} + +LispObj * +Lisp_Stringp(LispMac *mac, LispObj *list, char *fname) +{ + return (STRING_P(CAR(list)) ? T : NIL); +} + +LispObj * +Lisp_Subseq(LispMac *mac, LispObj *list, char *fname) +{ + int start, end, length, sublen; + LispObj *seq, *ostart, *oend, *res; + + seq = CAR(list); + if (seq != NIL && seq->type != LispCons_t && + !STRING_P(seq) && seq->type != LispArray_t) + LispDestroy(mac, "%s is not a sequence, at %s", + LispStrObj(mac, seq), fname); + length = Lisp_Length(mac, list, fname)->data.real; + + list = CDR(list); + ostart = CAR(list); + list = CDR(list); + oend = list == NIL ? NIL : CAR(list); + if (!INDEX_P(ostart) || (oend != NIL && !INDEX_P(oend))) + LispDestroy(mac, "expecting positive integer, at %s", fname); + + start = NUMBER_VALUE(ostart); + + if (oend != NIL) + end = NUMBER_VALUE(oend); + else + end = length; + + if (start > end || end > length) + LispDestroy(mac, "bad index, at %s", fname); + + sublen = end - start; + + if (seq == NIL) + res = NIL; + else if (STRING_P(seq)) { + char *str = LispMalloc(mac, sublen + 1); + + strncpy(str, STRPTR(seq) + start, sublen); + str[sublen] = '\0'; + res = STRING(str); + LispFree(mac, str); + } + else { + LispObj *obj; + + GCProtect(); + if (end > start) { + /* list or array */ + int count; + LispObj *cdr; + + if (seq->type == LispArray_t) + obj = seq->data.array.list; + else + obj = seq; + /* goto first element to copy */ + for (count = 0; count < start; count++, obj = CDR(obj)) + ; + res = cdr = CONS(CAR(obj), NIL); + for (++count, obj = CDR(obj); count < end; count++, obj = CDR(obj)) { + CDR(cdr) = CONS(CAR(obj), NIL); + cdr = CDR(cdr); + } + } + else + res = NIL; + + if (seq->type == LispArray_t) { + obj = LispNew(mac, res, NIL); + obj->type = LispArray_t; + obj->data.array.list = res; + obj->data.array.dim = CONS(REAL(sublen), NIL); + obj->data.array.rank = 1; + obj->data.array.type = seq->data.array.type; + obj->data.array.zero = length == 0; + res = obj; + } + GCUProtect(); + } + + return (res); +} + +LispObj * +Lisp_Symbolp(LispMac *mac, LispObj *list, char *fname) +{ + switch (CAR(list)->type) { + case LispNil_t: + case LispTrue_t: + case LispAtom_t: + case LispLambda_t: + return (T); + default: + return (NIL); + } + /*NOTREACHED*/ +} + +LispObj * +Lisp_SymbolPlist(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *sym = CAR(list); + + if (sym == NIL || sym == T) + return (sym); + else if (!SYMBOL_P(sym)) + LispDestroy(mac, "%s is not a symbol, at %s", + LispStrObj(mac, sym), fname); + + return (sym->data.atom->property && sym->data.atom->property->property ? + sym->data.atom->property->properties : NIL); +} + +LispObj * +Lisp_Tagbody(LispMac *mac, LispObj *list, char *fname) +{ + int did_jump, *pdid_jump = &did_jump, body_jump, *pbody_jump = &body_jump; + LispObj * volatile body; + LispObj *res, **pres = &res; + LispBlock *block, *body_block; + + for (body = list; body != NIL; body = CDR(body)) + if (body->type == LispCons_t) + break; + + if (body == NIL) + return (NIL); + + *pdid_jump = 1; + *pres = NIL; + block = LispBeginBlock(mac, NIL, LispBlockTag); + if (setjmp(block->jmp) == 0) { + body = list; + while (1) { + *pbody_jump = 1; + body_block = LispBeginBlock(mac, NIL, LispBlockBody); + if (setjmp(body_block->jmp) == 0) { + for (; body != NIL; body = CDR(body)) { + if (CAR(body)->type == LispCons_t) + *pres = EVAL(CAR(body)); + } + *pbody_jump = 0; + } + LispEndBlock(mac, body_block); + if (*pbody_jump) { + int found = 0; + LispObj *ptr, *tag; + + tag = mac->block.block_ret; + for (ptr = body; ptr != NIL; ptr = CDR(ptr)) { + if (CAR(ptr)->type == tag->type && + ((CAR(ptr) == NIL && tag->type == LispNil_t) || + (CAR(ptr) == T && tag->type == LispTrue_t) || + (NUMBER_P(ptr) && NUMBER_P(tag) && + NUMBER_VALUE(ptr) == NUMBER_VALUE(tag)) || + (SYMBOL_P(CAR(ptr)) && SYMBOL_P(tag) && + CAR(ptr)->data.atom == tag->data.atom))) { + found = 1; + break; + } + } + if (ptr == NIL) { + for (ptr = list; ptr != body; ptr = CDR(ptr)) { + if (CAR(ptr)->type == tag->type && + ((CAR(ptr) == NIL && tag->type == LispNil_t) || + (CAR(ptr) == T && tag->type == LispTrue_t) || + (NUMBER_P(ptr) && NUMBER_P(tag) && + NUMBER_VALUE(ptr) == NUMBER_VALUE(tag)) || + (SYMBOL_P(CAR(ptr)) && SYMBOL_P(tag) && + CAR(ptr)->data.atom == tag->data.atom))) { + found = 1; + break; + } + } + } + /* XXX no search for duplicated tags, if there are + * duplicated tags, will just search the body for the tag, + * if the end of the list is reached, search again from + * beginning. This is (I believe) allowable for an interpreter, + * but if (byte) compiled code is to be generated, duplicated + * tags must not be allowed. */ + if ((body = ptr) == NIL) + LispDestroy(mac, "no such tag %s, at %s", + LispStrObj(mac, tag), fname); + + /* search for start of code */ + for (body = CDR(body); body != NIL; body = CDR(body)) { + if (CAR(body)->type == LispCons_t) + break; + } + + /* just jumped to the bottom of the code body */ + if (body == NIL) + break; + } + else + /* 'go' not called */ + break; + *pdid_jump = 1; + } + *pdid_jump = 0; + } + LispEndBlock(mac, block); + if (*pdid_jump) + *pres = mac->block.block_ret; + + return (*pres); +} + +LispObj * +Lisp_Terpri(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *stream = NIL; + + if (list == NIL || CAR(list) == NIL) + stream = NIL; + else if (CAR(list)->type != LispStream_t) + LispDestroy(mac, "%s is not a stream, at %s", + LispStrObj(mac, CAR(list)), fname); + else + stream = CAR(list); + LispPrintf(mac, stream, "\n"); + mac->newline = 1; + mac->column = 0; + fflush(lisp_stdout); + + return (NIL); +} + +LispObj * +Lisp_Throw(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *tag = EVAL(CAR(list)); + unsigned blevel = mac->block.block_level; + + if (blevel == 0) + LispDestroy(mac, "%s called not within a block", fname); + + while (blevel) { + int jmp = 1; + LispBlock *block = mac->block.block[--blevel]; + + if (block->type == LispBlockCatch && tag->type == block->tag.type) { + switch(tag->type) { + case LispNil_t: + case LispTrue_t: + break; + case LispAtom_t: + case LispString_t: + jmp = tag->data.atom == block->tag.data.atom; + break; + case LispCharacter_t: + case LispInteger_t: + jmp = tag->data.integer == block->tag.data.integer; + break; + case LispReal_t: + jmp = tag->data.real == block->tag.data.real; + break; + default: + jmp = memcmp(tag, &(block->tag), sizeof(LispObj)) == 0; + break; + } + if (jmp) { + mac->block.block_ret = EVAL(CAR(CDR(list))); + LispBlockUnwind(mac); + longjmp(block->jmp, 1); + } + } + } + LispDestroy(mac, "%s is not a tag to %s", LispStrObj(mac, tag), fname); + /*NOTREACHED*/ + + return (NIL); +} + +LispObj * +Lisp_Typep(LispMac *mac, LispObj *list, char *fname) +{ + LispType type = LispStruct_t; + LispObj *obj; + char *atom = NULL; + + obj = CAR(CDR(list)); + if (obj == NIL || obj == T) + return (obj); + else if (!SYMBOL_P(obj)) + LispDestroy(mac, "%s is a bad type specification, at %s", + LispStrObj(mac, obj), fname); + else { + atom = STRPTR(obj); + if (strcmp(atom, "ATOM") == 0) + type = LispAtom_t; + else if (strcmp(atom, "REAL") == 0) + type = LispReal_t; + else if (strcmp(atom, "LIST") == 0) + type = LispCons_t; + else if (strcmp(atom, "STRING") == 0) + type = LispString_t; + else if (strcmp(atom, "OPAQUE") == 0) + type = LispOpaque_t; + } + + obj = CAR(list); + if (type != LispStruct_t && obj->type == type) + return (T); + else if (obj->type == LispStruct_t) + return (STRPTR(CAR(obj->data.struc.def)) == atom ? T : NIL); + + return (NIL); +} + +LispObj * +Lisp_Unless(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispWhenUnless(mac, list, 0)); +} + +LispObj * +Lisp_UnwindProtect(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *prot = CAR(list), *res, **pres = &res; + int did_jump, *pdid_jump = &did_jump; + LispBlock *block; + + /* run protected code */ + *pres = NIL; + *pdid_jump = 1; + block = LispBeginBlock(mac, NIL, LispBlockProtect); + if (setjmp(block->jmp) == 0) { + *pres = EVAL(prot); + *pdid_jump = 0; + } + LispEndBlock(mac, block); + if (!mac->destroyed && *pdid_jump) + *pres = mac->block.block_ret; + + /* run cleanup, unprotected code */ + if (CDR(list) != NIL) + res = Lisp_Progn(mac, CDR(list), fname); + else if (mac->destroyed) + /* no cleanup code */ + LispDestroy(mac, NULL); /* special handling if mac->destroyed */ + + return (res); +} + +LispObj * +Lisp_Vector(LispMac *mac, LispObj *list, char *fname) +{ + int count; + LispObj *dim, *ary = list, *obj; + + for (count = 0; list != NIL; count++, list = CDR(list)) + ; + dim = CONS(REAL((double)count), NIL); + + obj = LispNew(mac, ary, dim); /* no need to gc protect, as dim is argument*/ + obj->type = LispArray_t; + obj->data.array.list = ary; + obj->data.array.dim = dim; + obj->data.array.rank = 1; + obj->data.array.type = LispTrue_t; + obj->data.array.zero = count == 0; + + return (obj); +} + +LispObj * +Lisp_When(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispWhenUnless(mac, list, 1)); +} + +LispObj * +Lisp_Until(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispWhileUntil(mac, list, 0)); +} + +LispObj * +Lisp_While(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispWhileUntil(mac, list, 1)); +} + +/* helper functions for setf + * DONT explicitly call these functions. Non standard functions + */ +LispObj * +Lisp_XeditEltStore(LispMac *mac, LispObj *list, char *fname) +{ + int len, pos; + LispObj *seq, *opos, *value; + + seq = CAR(list); + /* if not a sequence, Lisp_Length will see it */ + len = Lisp_Length(mac, list, fname)->data.real; + + list = CDR(list); + opos = CAR(list); + if (!INDEX_P(opos) || NUMBER_VALUE(opos) >= len) + LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, opos), fname); + pos = NUMBER_VALUE(opos); + + list = CDR(list); + value = CAR(list); + if (STRING_P(seq)) { + int c; + char *string; + + if (value->type != LispCharacter_t) + LispDestroy(mac, "%s is not a character, at %s", + LispStrObj(mac, value), fname); + + c = value->data.integer; + if (c < 0 || c > 255) + LispDestroy(mac, "cannot represent character %d, at %s", c, fname); + + string = LispStrdup(mac, STRPTR(seq)); + string[pos] = c; + + seq->data.atom = LispDoGetAtom(mac, string, 0, 0); + LispFree(mac, string); + } + else { + if (seq->type == LispArray_t) + seq = seq->data.array.list; + + for (; pos > 0; pos--, seq = CDR(seq)) + ; + CAR(seq) = value; + } + + return (value); +} + +LispObj * +Lisp_XeditPut(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *sym, *key, *val; + + if ((sym = CAR(list))->type != LispAtom_t) + LispDestroy(mac, "expecting symbol, at %s", fname); + list = CDR(list); + key = CAR(list); + list = CDR(list); + val = CAR(list); + + return (CAR(LispPutAtomProperty(mac, sym->data.atom, key, val))); +} + +LispObj * +Lisp_XeditVectorStore(LispMac *mac, LispObj *list, char *fname) +{ + long c, count, idx, seq; + LispObj *ary = CAR(list), *dim = CDR(list), *obj; + + if (ary->type != LispArray_t) + LispDestroy(mac, "%s is not an array, at %s", + LispStrObj(mac, ary), fname); + + for (count = 0, list = dim, obj = ary->data.array.dim; CDR(list) != NIL; + count++, list = CDR(list), obj = CDR(obj)) { + if (count >= ary->data.array.rank) + LispDestroy(mac, "too many subscripts %s, at %s", + LispStrObj(mac, dim), fname); + if (!INDEX_P(CAR(list)) || + NUMBER_VALUE(CAR(list)) >= NUMBER_VALUE(CAR(obj))) + LispDestroy(mac, "%s is out of range or a bad index, at %s", + LispStrObj(mac, CAR(list)), fname); + } + if (count < ary->data.array.rank) + LispDestroy(mac, "too few subscripts %s, at %s", + LispStrObj(mac, dim), fname); + + for (count = seq = 0, list = dim; CDR(list) != NIL; + list = CDR(list), seq++) { + for (idx = 0, obj = ary->data.array.dim; idx < seq; obj = CDR(obj), ++idx) + ; + for (c = 1, obj = CDR(obj); obj != NIL; obj = CDR(obj)) + c *= NUMBER_VALUE(CAR(obj)); + count += c * NUMBER_VALUE(CAR(list)); + } + + for (ary = ary->data.array.list; count > 0; ary = CDR(ary), count--) + ; + + CAR(ary) = CAR(list); + + return (CAR(list)); +} + +LispObj * +Lisp_Zerop(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list); + + if (!NUMBER_P(obj)) + LispDestroy(mac, "expecting number, at %s", fname); + + return (NUMBER_VALUE(obj) == 0 ? T : NIL); +} Index: xc/programs/xedit/lisp/core.h diff -u /dev/null xc/programs/xedit/lisp/core.h:1.7 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/core.h Fri Oct 19 20:19:34 2001 @@ -0,0 +1,148 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/core.h,v 1.7 2001/10/20 00:19:34 paulo Exp $ */ + +#ifndef Lisp_core_h +#define Lisp_core_h + +#include "internal.h" + +LispObj *Lisp_Mul(LispMac*, LispObj*, char*); /* * */ +LispObj *Lisp_Plus(LispMac*, LispObj*, char*); /* + */ +LispObj *Lisp_Minus(LispMac*, LispObj*, char*); /* - */ +LispObj *Lisp_Div(LispMac*, LispObj*, char*); /* / */ +LispObj *Lisp_OnePlus(LispMac*, LispObj*, char*); /* 1+ */ +LispObj *Lisp_OneMinus(LispMac*, LispObj*, char*); /* 1- */ +LispObj *Lisp_Less(LispMac*, LispObj*, char*); /* < */ +LispObj *Lisp_LessEqual(LispMac*, LispObj*, char*); /* <= */ +LispObj *Lisp_Equal_(LispMac*, LispObj*, char*); /* = */ +LispObj *Lisp_Greater(LispMac*, LispObj*, char*); /* > */ +LispObj *Lisp_GreaterEqual(LispMac*, LispObj*, char*); /* >= */ +LispObj *Lisp_NotEqual(LispMac*, LispObj*, char*); /* /= */ +LispObj *Lisp_Aref(LispMac*, LispObj*, char*); /* aref */ +LispObj *Lisp_Assoc(LispMac*, LispObj*, char*); /* assoc */ +LispObj *Lisp_And(LispMac*, LispObj*, char*); /* and */ +LispObj *Lisp_Append(LispMac*, LispObj*, char*); /* append */ +LispObj *Lisp_Apply(LispMac*, LispObj*, char*); /* apply */ +LispObj *Lisp_Atom(LispMac*, LispObj*, char*); /* attom */ +LispObj *Lisp_Block(LispMac*, LispObj*, char*); /* block */ +LispObj *Lisp_Butlast(LispMac*, LispObj*, char*); /* butlast */ +LispObj *Lisp_Car(LispMac*, LispObj*, char*); /* car */ +LispObj *Lisp_Case(LispMac*, LispObj*, char*); /* case */ +LispObj *Lisp_Catch(LispMac*, LispObj*, char*); /* catch */ +LispObj *Lisp_Cdr(LispMac*, LispObj*, char*); /* cdr */ +LispObj *Lisp_Coerce(LispMac*, LispObj*, char*); /* coerce */ +LispObj *Lisp_Cond(LispMac*, LispObj*, char*); /* cond */ +LispObj *Lisp_Cons(LispMac*, LispObj*, char*); /* cons */ +LispObj *Lisp_Decf(LispMac*, LispObj*, char*); /* decf */ +LispObj *Lisp_Defmacro(LispMac*, LispObj*, char*); /* defmacro */ +LispObj *Lisp_Defun(LispMac*, LispObj*, char*); /* defun */ +LispObj *Lisp_Defsetf(LispMac*, LispObj*, char*); /* defsetf */ +LispObj *Lisp_Do(LispMac*, LispObj*, char*); /* do */ +LispObj *Lisp_DoP(LispMac*, LispObj*, char*); /* do* */ +LispObj *Lisp_DoList(LispMac*, LispObj*, char*); /* dolist */ +LispObj *Lisp_DoTimes(LispMac*, LispObj*, char*); /* dotimes */ +LispObj *Lisp_Elt(LispMac*, LispObj*, char*); /* elt */ +LispObj *Lisp_Equal(LispMac*, LispObj*, char*); /* equal */ +LispObj *Lisp_Error(LispMac*, LispObj*, char*); /* error */ +LispObj *Lisp_Eval(LispMac*, LispObj*, char*); /* eval */ +LispObj *Lisp_Evenp(LispMac*, LispObj*, char*); /* evenp */ +LispObj *Lisp_FMakunbound(LispMac*, LispObj*, char*); /* fmakunbound */ +LispObj *Lisp_Funcall(LispMac*, LispObj*, char*); /* funcall */ +LispObj *Lisp_Gc(LispMac*, LispObj*, char*); /* gc */ +LispObj *Lisp_Get(LispMac*, LispObj*, char*); /* get */ +LispObj *Lisp_Go(LispMac*, LispObj*, char*); /* go */ +LispObj *Lisp_If(LispMac*, LispObj*, char*); /* if */ +LispObj *Lisp_Incf(LispMac*, LispObj*, char*); /* incf */ +LispObj *Lisp_Integerp(LispMac*, LispObj*, char*); /* integerp */ +LispObj *Lisp_Lambda(LispMac*, LispObj*, char*); /* lambda */ +LispObj *Lisp_Last(LispMac*, LispObj*, char*); /* last */ +LispObj *Lisp_Length(LispMac*, LispObj*, char*); /* length */ +LispObj *Lisp_Let(LispMac*, LispObj*, char*); /* let */ +LispObj *Lisp_LetP(LispMac*, LispObj*, char*); /* let* */ +LispObj *Lisp_List(LispMac*, LispObj*, char*); /* list */ +LispObj *Lisp_ListP(LispMac*, LispObj*, char*); /* list* */ +LispObj *Lisp_Listp(LispMac*, LispObj*, char*); /* listp */ +LispObj *Lisp_Loop(LispMac*, LispObj*, char*); /* loop */ +LispObj *Lisp_Makearray(LispMac*, LispObj*, char*); /* make-array */ +LispObj *Lisp_Makelist(LispMac*, LispObj*, char*); /* make-list */ +LispObj *Lisp_Makunbound(LispMac*, LispObj*, char*); /* makunbound */ +LispObj *Lisp_Mapcar(LispMac*, LispObj*, char*); /* mapcar */ +LispObj *Lisp_Max(LispMac*, LispObj*, char*); /* max */ +LispObj *Lisp_Member(LispMac*, LispObj*, char*); /* member */ +LispObj *Lisp_Min(LispMac*, LispObj*, char*); /* min */ +LispObj *Lisp_Minusp(LispMac*, LispObj*, char*); /* minusp */ +LispObj *Lisp_Nth(LispMac*, LispObj*, char*); /* nth */ +LispObj *Lisp_Nthcdr(LispMac*, LispObj*, char*); /* nthcdr */ +LispObj *Lisp_Null(LispMac*, LispObj*, char*); /* null */ +LispObj *Lisp_Numberp(LispMac*, LispObj*, char*); /* numberp */ +LispObj *Lisp_Oddp(LispMac*, LispObj*, char*); /* oddp */ +LispObj *Lisp_Or(LispMac*, LispObj*, char*); /* or */ +LispObj *Lisp_Plusp(LispMac*, LispObj*, char*); /* plusp */ +LispObj *Lisp_Prin1(LispMac*, LispObj*, char*); /* prin1 */ +LispObj *Lisp_Princ(LispMac*, LispObj*, char*); /* princ */ +LispObj *Lisp_Print(LispMac*, LispObj*, char*); /* print */ +LispObj *Lisp_Prog1(LispMac*, LispObj*, char*); /* prog1 */ +LispObj *Lisp_Prog2(LispMac*, LispObj*, char*); /* prog2 */ +LispObj *Lisp_Progn(LispMac*, LispObj*, char*); /* progn */ +LispObj *Lisp_Progv(LispMac*, LispObj*, char*); /* progv */ +LispObj *Lisp_Provide(LispMac*, LispObj*, char*); /* provide */ +LispObj *Lisp_Quit(LispMac*, LispObj*, char*); /* quit */ +LispObj *Lisp_Quote(LispMac*, LispObj*, char*); /* quote */ +LispObj *Lisp_Read(LispMac*, LispObj*, char*); /* read */ +LispObj *Lisp_Replace(LispMac*, LispObj*, char*); /* replace */ +LispObj *Lisp_Return(LispMac*, LispObj*, char*); /* return */ +LispObj *Lisp_ReturnFrom(LispMac*, LispObj*, char*); /* return-from */ +LispObj *Lisp_Reverse(LispMac*, LispObj*, char*); /* reverse */ +LispObj *Lisp_Rplaca(LispMac*, LispObj*, char*); /* rplaca */ +LispObj *Lisp_Rplacd(LispMac*, LispObj*, char*); /* rplaca */ +LispObj *Lisp_Set(LispMac*, LispObj*, char*); /* set */ +LispObj *Lisp_Setf(LispMac*, LispObj*, char*); /* setf */ +LispObj *Lisp_SetQ(LispMac*, LispObj*, char*); /* setq */ +LispObj *Lisp_Stringp(LispMac*, LispObj*, char*); /* stringp */ +LispObj *Lisp_Subseq(LispMac*, LispObj*, char*); /* subseq */ +LispObj *Lisp_Symbolp(LispMac*, LispObj*, char*); /* symbolp */ +LispObj *Lisp_SymbolPlist(LispMac*, LispObj*, char*); /* symbol-plist */ +LispObj *Lisp_Tagbody(LispMac*, LispObj*, char*); /* tagbody */ +LispObj *Lisp_Terpri(LispMac*, LispObj*, char*); /* terpri */ +LispObj *Lisp_Throw(LispMac*, LispObj*, char*); /* throw */ +LispObj *Lisp_Typep(LispMac*, LispObj*, char*); /* typep */ +LispObj *Lisp_Unless(LispMac*, LispObj*, char*); /* unless */ +LispObj *Lisp_Until(LispMac*, LispObj*, char*); /* until */ +LispObj *Lisp_UnwindProtect(LispMac*, LispObj*, char*); /* unwind-protect */ +LispObj *Lisp_Vector(LispMac*, LispObj*, char*); /* vector */ +LispObj *Lisp_When(LispMac*, LispObj*, char*); /* when */ +LispObj *Lisp_While(LispMac*, LispObj*, char*); /* while */ +LispObj *Lisp_XeditEltStore(LispMac*, LispObj*, char*); /* xedit::elt-store */ +LispObj *Lisp_XeditPut(LispMac*, LispObj*, char*); /* xedit::put */ +LispObj *Lisp_XeditVectorStore(LispMac*, LispObj*, char*); /* xedit::vector-store */ +LispObj *Lisp_Zerop(LispMac*, LispObj*, char*); /* zerop */ + +#endif /* Lisp_core_h */ Index: xc/programs/xedit/lisp/debugger.c diff -u /dev/null xc/programs/xedit/lisp/debugger.c:1.11 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/debugger.c Sat Oct 27 23:34:29 2001 @@ -0,0 +1,853 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/debugger.c,v 1.11 2001/10/28 03:34:29 tsi Exp $ */ + +#include <ctype.h> +#include "debugger.h" + +#define DebuggerHelp 0 +#define DebuggerAbort 1 +#define DebuggerBacktrace 2 +#define DebuggerContinue 3 +#define DebuggerFinish 4 +#define DebuggerFrame 5 +#define DebuggerNext 6 +#define DebuggerNexti 7 +#define DebuggerPrint 8 +#define DebuggerStep 9 +#define DebuggerStepi 10 +#define DebuggerBreak 11 +#define DebuggerDelete 12 +#define DebuggerDown 13 +#define DebuggerUp 14 +#define DebuggerInfo 15 +#define DebuggerWatch 16 + +#define DebuggerInfoBreakpoints 0 +#define DebuggerInfoBacktrace 1 + +/* + * Prototypes + */ +static void LispDebuggerCommand(LispMac*, LispObj *obj); + +/* + * Initialization + */ +static struct { + char *name; + int action; +} commands[] = { + {"help", DebuggerHelp}, + {"abort", DebuggerAbort}, + {"backtrace", DebuggerBacktrace}, + {"b", DebuggerBreak}, + {"break", DebuggerBreak}, + {"bt", DebuggerBacktrace}, + {"continue", DebuggerContinue}, + {"d", DebuggerDelete}, + {"delete", DebuggerDelete}, + {"down", DebuggerDown}, + {"finish", DebuggerFinish}, + {"frame", DebuggerFrame}, + {"info", DebuggerInfo}, + {"n", DebuggerNext}, + {"next", DebuggerNext}, + {"ni", DebuggerNexti}, + {"nexti", DebuggerNexti}, + {"print", DebuggerPrint}, + {"run", DebuggerContinue}, + {"s", DebuggerStep}, + {"step", DebuggerStep}, + {"si", DebuggerStepi}, + {"stepi", DebuggerStepi}, + {"up", DebuggerUp}, + {"watch", DebuggerWatch}, +}; + +static struct { + char *name; + int subaction; +} info_commands[] = { + {"breakpoints", DebuggerInfoBreakpoints}, + {"stack", DebuggerInfoBacktrace}, + {"watchpoints", DebuggerInfoBreakpoints}, +}; + +static char debugger_help[] = +"Available commands are:\n\ +\n\ +help - This message.\n\ +abort - Abort the current execution, and return to toplevel.\n\ +backtrace, bt - Print backtrace.\n\ +b, break - Set breakpoint at function name argument.\n\ +continue - Continue execution.\n\ +d, delete - Delete breakpoint(s), all breakpoint if no arguments given.\n\ +down - Set environment to frame called by the current one.\n\ +finish - Executes until current form is finished.\n\ +frame - Set environment to selected frame.\n\ +info - Prints information about the debugger state.\n\ +n, next - Evaluate next form.\n\ +nexti, ni - Evaluate next form, including variables.\n\ +print - Print value of variable name argument.\n\ +run - Continue execution.\n\ +s, step - Evaluate next form, stopping on any subforms.\n\ +si, stepi - Evaluate next form including variables, stopping on subforms.\n\ +up - Set environment to frame that called the current one.\n\ +\n\ +Commands may be abbreviated.\n"; + +static char debugger_info_help[] = +"Available subcommands are:\n\ +\n\ +breakpoints - List and prints status of breakpoints, and watchpoints.\n\ +stack - Backtrace of stack.\n\ +watchpoints - List and prints status of watchpoints, and breakpoints.\n\ +\n\ +Subcommands may be abbreviated.\n"; + +/* Debugger variables layout (if you change it, update description): + * + * DBG + * is a macro for mac->dbglist + * is a NIL terminated list + * every element is a list in the format (NOT NIL terminated): + * (list* NAM ARG ENV LEX) + * where + * NAM is an ATOM for the function/macro name + * or NIL for lambda expressions + * ARG is NAM arguments (a LIST) + * ENV is the contents of the global ENV (a LIST) + * LEX is the contents of the global LEX (a LIST) + * new elements are added to the beggining of the list + * + * BRK + * is macro for mac->brklist + * is a NIL terminated list + * every element is a list in the format (NIL terminated): + * (list NAM IDX TYP HIT VAR VAL FRM) + * where + * NAM is an ATOM for the name of the object at + * wich the breakpoint was added + * IDX is a REAL, the breakpoint number + * must be stored, as breakpoints may be deleted + * TYP is a REAL that must be an integer of enum LispBreakType + * HIT is a REAL, with the number of times this breakpoint was + * hitted. + * VAR variable to watch a SYMBOL (not needed for breakpoints) + * VAL value of watched variable (not needed for breakpoints) + * FRM frame where variable started being watched + * (not needed for breakpoints) + * new elements are added to the end of the list + */ + +/* + * Implementation + */ +void +LispDebugger(LispMac *mac, LispDebugCall call, LispObj *name, LispObj *arg) +{ + int force = 0; + LispObj *obj, *prev; + + switch (call) { + case LispDebugCallBegin: + ++mac->debug_level; + GCProtect(); + DBG = CONS(CONS(name, CONS(arg, CONS(ENV, LEX))), DBG); + GCUProtect(); + for (obj = BRK; obj != NIL; obj = CDR(obj)) + if (STRPTR(CAR(CAR(obj))) == STRPTR(name) && + CAR(CDR(CDR(CAR(obj))))->data.real == LispDebugBreakFunction) + break; + if (obj != NIL) { + if (!mac->newline) + fputc('\n', lisp_stdout); + fprintf(lisp_stdout, "BREAK #"); + LispPrintObj(mac, NIL, CAR(CDR(CAR(obj))), 1); + fprintf(lisp_stdout, "> ("); + LispPrintObj(mac, NIL, CAR(CAR(DBG)), 1); + fputc(' ', lisp_stdout); + LispPrintObj(mac, NIL, CAR(CDR(CAR(DBG))), 0); + fprintf(lisp_stdout, ")\n"); + force = 1; + /* update hits counter */ + CAR(CDR(CDR(CDR(CAR(obj)))))->data.real += 1.0; + } + break; + case LispDebugCallEnd: + DBG = CDR(DBG); + if (mac->debug_level < mac->debug_step) + mac->debug_step = mac->debug_level; + --mac->debug_level; + break; + case LispDebugCallFatal: + LispDebuggerCommand(mac, NIL); + return; + case LispDebugCallBegini: + case LispDebugCallEndi: + if (mac->debug != LispDebugNexti && mac->debug != LispDebugStepi) + return; + break; + case LispDebugCallWatch: + break; + } + + /* didn't return, check watchpoints */ + if (call == LispDebugCallEnd || call == LispDebugCallWatch) { +watch_again: + for (prev = obj = BRK; obj != NIL; prev = obj, obj = CDR(obj)) { + if (CAR(CDR(CDR(CAR(obj))))->data.real == LispDebugBreakVariable) { + /* the variable */ + LispObj *wat = CAR(CDR(CDR(CDR(CDR(CAR(obj)))))); + LispObj *sym = LispGetVarCons(mac, CAAR(obj)); + LispObj *frm = CAR(CDR(CDR(CDR(CDR(CDR(CDR(CAR(obj)))))))); + + if ((sym == NULL && mac->debug_level <= 0) || + (sym != wat && frm->data.real > mac->debug_level)) { + fprintf(lisp_stdout, "WATCH #%g> %s deleted. Variable does " + "not exist anymore.\n", + CAR(CDR(CAR(obj)))->data.real, + STRPTR(CAR(CAR(obj)))); + /* force debugger to stop */ + force = 1; + if (obj == prev) { + BRK = CDR(BRK); + goto watch_again; + } + else + CDR(prev) = CDR(obj); + obj = prev; + } + else { + /* current value */ + LispObj *cur = CDR(wat); + /* last value */ + LispObj *val = CAR(CDR(CDR(CDR(CDR(CDR(CAR(obj))))))); + if (_LispEqual(mac, val, cur) == NIL) { + fprintf(lisp_stdout, "WATCH #%g> %s\n", + CAR(CDR(CAR(obj)))->data.real, + STRPTR(CAR(CAR(obj)))); + fprintf(lisp_stdout, "OLD: "); + LispPrintObj(mac, NIL, val, 1); + fprintf(lisp_stdout, "\nNEW: "); + LispPrintObj(mac, NIL, cur, 1); + fputc('\n', lisp_stdout); + + /* update current value */ + CAR(CDR(CDR(CDR(CDR(CDR(CAR(obj))))))) = cur; + /* update hits counter */ + CAR(CDR(CDR(CDR(CAR(obj)))))->data.real += 1.0; + /* force debugger to stop */ + force = 1; + } + } + } + } + + if (call == LispDebugCallWatch) + /* special call, just don't keep gc protected variables that may be + * using a lot of memory... */ + return; + } + + switch (mac->debug) { + case LispDebugUnspec: + LispDebuggerCommand(mac, NIL); + goto debugger_done; + case LispDebugRun: + if (force) + LispDebuggerCommand(mac, NIL); + goto debugger_done; + case LispDebugFinish: + if (!force && + (call != LispDebugCallEnd || mac->debug_level != mac->debug_step)) + goto debugger_done; + break; + case LispDebugNext: + if (call == LispDebugCallBegin) { + if (!force && mac->debug_level != mac->debug_step) + goto debugger_done; + } + else if (call == LispDebugCallEnd) { + if (!force && mac->debug_level >= mac->debug_step) + goto debugger_done; + } + break; + case LispDebugStep: + break; + case LispDebugNexti: + if (call == LispDebugCallBegini) { + if (!force && mac->debug_level != mac->debug_step) + goto debugger_done; + } + else if (call == LispDebugCallEndi) { + if (!force && mac->debug_level >= mac->debug_step) + goto debugger_done; + } + break; + case LispDebugStepi: + break; + } + + if (call == LispDebugCallBegin) { + if (!mac->newline) + fputc('\n', lisp_stdout); + fprintf(lisp_stdout, "#%d> ", mac->debug_level); + + fputc('(', lisp_stdout); + LispPrintObj(mac, NIL, CAR(CAR(DBG)), 1); + fputc(' ', lisp_stdout); + LispPrintObj(mac, NIL, CAR(CDR(CAR(DBG))), 0); + fprintf(lisp_stdout, ")\n"); + LispDebuggerCommand(mac, NIL); + } + else if (call == LispDebugCallEnd) { + if (!mac->newline) + fputc('\n', lisp_stdout); + fprintf(lisp_stdout, "#%d= ", mac->debug_level + 1); + + LispPrintObj(mac, NIL, arg, 1); + fputc('\n', lisp_stdout); + LispDebuggerCommand(mac, NIL); + } + else if (call == LispDebugCallBegini) { + if (!mac->newline) + fputc('\n', lisp_stdout); + fprintf(lisp_stdout, "#%d+> ", mac->debug_level + 1); + + LispPrintObj(mac, NIL, arg, 1); + fputc('\n', lisp_stdout); + LispDebuggerCommand(mac, arg); + } + else if (call == LispDebugCallEndi) { + if (!mac->newline) + fputc('\n', lisp_stdout); + fprintf(lisp_stdout, "#%d+= ", mac->debug_level + 1); + + LispPrintObj(mac, NIL, arg, 1); + fputc('\n', lisp_stdout); + mac->newline = 1; + LispDebuggerCommand(mac, arg); + } + else if (force) + LispDebuggerCommand(mac, arg); + +debugger_done: + return; +} + +static void +LispDebuggerCommand(LispMac *mac, LispObj *args) +{ + LispObj *obj, *frm, *curframe, + *old_frm = FRM, *old_env = ENV, *old_lex = LEX; + int i = 0, frame, matches, action = -1, subaction = 0; + char *cmd, *arg, *ptr, line[256]; + + frame = mac->debug_level; + curframe = CAR(DBG); + + line[0] = '\0'; + arg = line; + for (;;) { + fprintf(lisp_stdout, "%s", DBGPROMPT); + fflush(lisp_stdout); + if (fgets(line, sizeof(line), lisp_stdin) == NULL) { + fputc('\n', lisp_stdout); + return; + } + /* get command */ + ptr = line; + while (*ptr && isspace(*ptr)) + ++ptr; + cmd = ptr; + while (*ptr && !isspace(*ptr)) + ++ptr; + if (*ptr) + *ptr++ = '\0'; + + if (*cmd) { /* if *cmd is nul, then arg may be still set */ + /* get argument(s) */ + while (*ptr && isspace(*ptr)) + ++ptr; + arg = ptr; + /* goto end of line */ + if (*ptr) { + while (*ptr) + ++ptr; + --ptr; + while (*ptr && isspace(*ptr)) + --ptr; + if (*ptr) + *++ptr = '\0'; + } + } + + if (*cmd == '\0') { + if (action < 0) { + if (mac->debug == LispDebugFinish) + action = DebuggerFinish; + else if (mac->debug == LispDebugNext) + action = DebuggerNext; + else if (mac->debug == LispDebugStep) + action = DebuggerStep; + else if (mac->debug == LispDebugNexti) + action = DebuggerNexti; + else if (mac->debug == LispDebugStepi) + action = DebuggerStepi; + else if (mac->debug == LispDebugRun) + action = DebuggerContinue; + else + continue; + } + } + else { + for (i = matches = 0; i < sizeof(commands) / sizeof(commands[0]); + i++) { + char *str = commands[i].name; + + ptr = cmd; + while (*ptr && *ptr == *str) { + ++ptr; + ++str; + } + if (*ptr == '\0') { + action = commands[i].action; + if (*str == '\0') { + matches = 1; + break; + } + ++matches; + } + } + if (matches == 0) { + fprintf(lisp_stdout, "* Command unknown: %s. " + "Type help for help.\n", cmd); + continue; + } + else if (matches > 1) { + fprintf(lisp_stdout, "* Command is ambiguous: %s. " + "Type help for help.\n", cmd); + continue; + } + } + + switch (action) { + case DebuggerHelp: + fprintf(lisp_stdout, debugger_help); + break; + case DebuggerInfo: + if (*arg == '\0') { + fprintf(lisp_stdout, debugger_info_help); + break; + } + + for (i = matches = 0; + i < sizeof(info_commands) / sizeof(info_commands[0]); + i++) { + char *str = info_commands[i].name; + + ptr = arg; + while (*ptr && *ptr == *str) { + ++ptr; + ++str; + } + if (*ptr == '\0') { + subaction = info_commands[i].subaction; + if (*str == '\0') { + matches = 1; + break; + } + ++matches; + } + } + if (matches == 0) { + fprintf(lisp_stdout, "* Command unknown: %s. " + "Type info for help.\n", arg); + continue; + } + else if (matches > 1) { + fprintf(lisp_stdout, "* Command is ambiguous: %s. " + "Type info for help.\n", arg); + continue; + } + + switch (subaction) { + case DebuggerInfoBreakpoints: + fprintf(lisp_stdout, "Num\tHits\tType\t\tWhat\n"); + for (obj = BRK; obj != NIL; obj = CDR(obj)) { + /* breakpoint number */ + fputc('#', lisp_stdout); + LispPrintObj(mac, NIL, CAR(CDR(CAR(obj))), 1); + + /* number of hits */ + fprintf(lisp_stdout, "\t"); + LispPrintObj(mac, NIL, + CAR(CDR(CDR(CDR(CAR(obj))))), 1); + + /* breakpoint type */ + fprintf(lisp_stdout, "\t"); + switch ((int)CAR(CDR(CDR(CAR(obj))))->data.real) { + case LispDebugBreakFunction: + fprintf(lisp_stdout, "Function"); + break; + case LispDebugBreakVariable: + fprintf(lisp_stdout, "Variable"); + break; + } + + /* breakpoint object */ + fprintf(lisp_stdout, "\t"); + LispPrintObj(mac, NIL, CAR(CAR(obj)), 1); + fputc('\n', lisp_stdout); + } + break; + case DebuggerInfoBacktrace: + goto debugger_print_backtrace; + } + break; + case DebuggerAbort: + /* Almost the same code as LispDestroy */ + while (mac->mem.mem_level) + free(mac->mem.mem[--mac->mem.mem_level]); + + LispTopLevel(mac); + if (mac->st) { + mac->cp = &(mac->st[strlen(mac->st)]); + mac->tok = 0; + } + mac->column = 0; + mac->newline = 1; + siglongjmp(mac->jmp, 1);/* don't need to restore environment */ + /*NOTREACHED*/ + break; + case DebuggerBreak: + for (ptr = arg; *ptr; ptr++) { + if (isspace(*ptr)) + break; + else + *ptr = toupper(*ptr); + } + + if (!*arg || *ptr || strchr(arg, '(') || strchr(arg, '(') || + strchr(arg, ';')) { + fprintf(lisp_stdout, "* Bad function name " + "'%s' specified.\n", arg); + } + else { + for (obj = frm = BRK; obj != NIL; frm = obj, obj = CDR(obj)) + ; + i = mac->debug_break; + ++mac->debug_break; + GCProtect(); + obj = CONS(ATOM2(arg), + CONS(REAL(i), + CONS(REAL(LispDebugBreakFunction), + CONS(REAL(0), NIL)))); + if (BRK == NIL) + BRK = CONS(obj, NIL); + else + CDR(frm) = CONS(obj, NIL); + GCUProtect(); + } + break; + case DebuggerWatch: { + int vframe; + LispObj *sym, *val, *atom; + + /* make variable name uppercase, an ATOM */ + ptr = arg; + while (*ptr) { + *ptr = toupper(*ptr); + ++ptr; + } + atom = ATOM2(arg); + val = LispGetVar(mac, atom); + if (val == NULL) { + fprintf(lisp_stdout, "* No variable named '%s' " + "in the selected frame.\n", arg); + break; + } + + /* variable is available at the current frame */ + sym = LispGetVarCons(mac, atom); + + /* find the lowest frame where the variable is visible */ + vframe = 0; + if (frame) { + for (; vframe < frame; vframe++) { + for (frm = DBG, i = mac->debug_level; i > vframe; + frm = CDR(frm), i--) + ; + obj = CAR(frm); + if (FRM == old_frm) { + /* if first time selecting a new frame */ + GCProtect(); + FRM = CONS(ENV, old_frm); + GCUProtect(); + } + ENV = CAR(CDR(CDR(obj))); + LEX = CDR(CDR(CDR(obj))); + + if (LispGetVarCons(mac, atom) == sym) + /* got variable initial frame */ + break; + } + vframe = i; + if (vframe != frame) { + /* restore environment */ + for (frm = DBG, i = mac->debug_level; i > frame; + frm = CDR(frm), i--) + ; + obj = CAR(frm); + ENV = CAR(CDR(CDR(obj))); + LEX = CDR(CDR(CDR(obj))); + } + } + + i = mac->debug_break; + ++mac->debug_break; + for (obj = frm = BRK; obj != NIL; frm = obj, obj = CDR(obj)) + ; + + GCProtect(); + obj = CONS(atom, /* NAM */ + CONS(REAL(i), /* IDX */ + CONS(REAL(LispDebugBreakVariable), /* TYP */ + CONS(REAL(0), /* HIT */ + CONS(sym, /* VAR */ + CONS(val, /* VAL */ + CONS(REAL(vframe),/* FRM */ + NIL))))))); + + /* add watchpoint */ + if (BRK == NIL) + BRK = CONS(obj, NIL); + else + CDR(frm) = CONS(obj, NIL); + GCUProtect(); + } break; + case DebuggerDelete: + if (*arg == 0) { + int confirm = 0; + + for (;;) { + int ch; + + fprintf(lisp_stdout, "* Delete all breakpoints? " + "(y or n) "); + fflush(lisp_stdout); + if ((ch = fgetc(lisp_stdin)) == '\n') + continue; + while ((i = fgetc(lisp_stdin)) != '\n' && i != EOF) + ; + if (tolower(ch) == 'n') + break; + else if (tolower(ch) == 'y') { + confirm = 1; + break; + } + } + if (confirm) + BRK = NIL; + } + else { + for (ptr = arg; *ptr;) { + while (*ptr && isdigit(*ptr)) + ++ptr; + if (*ptr && !isspace(*ptr)) { + *ptr = '\0'; + fprintf(lisp_stdout, "* Bad breakpoint number " + "'%s' specified.\n", arg); + break; + } + i = atoi(arg); + for (obj = frm = BRK; frm != NIL; + obj = frm, frm = CDR(frm)) + if (CAR(CDR(CAR(frm)))->data.real == i) + break; + if (frm == NIL) { + fprintf(lisp_stdout, "* No breakpoint number " + "%d available.\n", i); + break; + } + if (obj == frm) + BRK = CDR(BRK); + else + CDR(obj) = CDR(frm); + while (*ptr && isspace(*ptr)) + ++ptr; + arg = ptr; + } + } + break; + case DebuggerFrame: + i = -1; + ptr = arg; + if (*ptr) { + i = 0; + while (*ptr && isdigit(*ptr)) { + i *= 10; + i += *ptr - '0'; + ++ptr; + } + if (*ptr) { + fprintf(lisp_stdout, "* Frame identifier must " + "be a positive number.\n"); + break; + } + } + else + goto debugger_print_frame; + if (i >= 0 && i <= mac->debug_level) + goto debugger_new_frame; + fprintf(lisp_stdout, "* No such frame %d.\n", i); + break; + case DebuggerDown: + if (frame + 1 > mac->debug_level) { + fprintf(lisp_stdout, "* Cannot go down.\n"); + break; + } + i = frame + 1; + goto debugger_new_frame; + break; + case DebuggerUp: + if (frame == 0) { + fprintf(lisp_stdout, "* Cannot go up.\n"); + break; + } + i = frame - 1; + goto debugger_new_frame; + break; + case DebuggerPrint: + ptr = arg; + while (*ptr) { + *ptr = toupper(*ptr); + ++ptr; + } + obj = LispGetVar(mac, ATOM2(arg)); + if (obj) { + LispPrintObj(mac, NIL, obj, 1); + fputc('\n', lisp_stdout); + } + else + fprintf(lisp_stdout, "* No variable named '%s' " + "in the selected frame.\n", arg); + break; + case DebuggerBacktrace: +debugger_print_backtrace: + if (DBG == NIL) { + fprintf(lisp_stdout, "* No stack.\n"); + break; + } + DBG = LispReverse(DBG); + for (obj = DBG, i = 0; obj != NIL; obj = CDR(obj), i++) { + frm = CAR(obj); + fprintf(lisp_stdout, "#%d> (", i); + LispPrintObj(mac, NIL, CAR(frm), 1); + fputc(' ', lisp_stdout); + LispPrintObj(mac, NIL, CAR(CDR(frm)), 0); + fprintf(lisp_stdout, ")\n"); + } + DBG = LispReverse(DBG); + if (mac->debug == LispDebugNexti || + mac->debug == LispDebugStepi) { + fprintf(lisp_stdout, "#%d+> ", i); + LispPrintObj(mac, NIL, args, 1); + fputc('\n', lisp_stdout); + } + break; + case DebuggerContinue: + mac->debug = LispDebugRun; + goto debugger_command_done; + case DebuggerFinish: + if (mac->debug != LispDebugFinish) { + mac->debug_step = mac->debug_level - 2; + mac->debug = LispDebugFinish; + } + else + mac->debug_step = mac->debug_level - 1; + goto debugger_command_done; + case DebuggerNext: + if (mac->debug != LispDebugNext && + mac->debug != LispDebugNexti) { + mac->debug = LispDebugNext; + mac->debug_step = mac->debug_level + 1; + } + goto debugger_command_done; + case DebuggerNexti: + if (mac->debug != LispDebugNext && + mac->debug != LispDebugNexti) { + mac->debug = LispDebugNexti; + mac->debug_step = mac->debug_level + 1; + } + goto debugger_command_done; + case DebuggerStep: + mac->debug = LispDebugStep; + goto debugger_command_done; + case DebuggerStepi: + mac->debug = LispDebugStepi; + goto debugger_command_done; + } + continue; + +debugger_new_frame: + /* goto here with i as the new frame value, after error checking */ + if (i != frame) { + frame = i; + for (frm = DBG, i = mac->debug_level; i > frame; frm = CDR(frm), i--) + ; + curframe = CAR(frm); + + if (FRM == old_frm) { + /* if first time selecting a new frame */ + GCProtect(); + FRM = CONS(ENV, old_frm); + GCUProtect(); + } + ENV = CAR(CDR(CDR(curframe))); + LEX = CDR(CDR(CDR(curframe))); + } +debugger_print_frame: + fprintf(lisp_stdout, "#%d> (", frame); + LispPrintObj(mac, NIL, CAR(curframe), 1); + fputc(' ', lisp_stdout); + LispPrintObj(mac, NIL, CAR(CDR(curframe)), 0); + fprintf(lisp_stdout, ")\n"); + + + } + +debugger_command_done: + FRM = old_frm; + ENV = old_env; + LEX = old_lex; +} Index: xc/programs/xedit/lisp/debugger.h diff -u /dev/null xc/programs/xedit/lisp/debugger.h:1.4 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/debugger.h Wed Oct 10 03:02:51 2001 @@ -0,0 +1,74 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/debugger.h,v 1.4 2001/10/10 07:02:51 paulo Exp $ */ + +#ifndef Lisp_debugger_h +#define Lisp_debugger_h + +/* + * Definitions + */ +#define DBGPROMPT "DEBUG> " + +/* + * Types + */ +typedef enum _LispDebugState { + LispDebugUnspec, /* initial state */ + LispDebugRun, /* just run, until breakpoint or error */ + LispDebugFinish, /* evaluates until selected form is finished */ + LispDebugNext, /* evaluate form */ + LispDebugStep, /* evaluate form, and step on subforms */ + LispDebugNexti, /* Like next, but includes variables evaluation */ + LispDebugStepi /* Like step, but includes variables evaluation */ +} LispDebugState; + +typedef enum _LispDebugCall { + LispDebugCallBegin, + LispDebugCallEnd, + LispDebugCallBegini, + LispDebugCallEndi, + LispDebugCallFatal, + LispDebugCallWatch /* just remove watched variables that lost context */ +} LispDebugCall; + +typedef enum _LispDebugBreak { + LispDebugBreakFunction, + LispDebugBreakVariable +} LispDebugBreak; + +#include "private.h" + +/* + * Prototypes + */ +void LispDebugger(LispMac*, LispDebugCall, LispObj*, LispObj*); + +#endif /* Lisp_debugger_h */ Index: xc/programs/xedit/lisp/format.c diff -u /dev/null xc/programs/xedit/lisp/format.c:1.11 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/format.c Sat Oct 27 23:34:29 2001 @@ -0,0 +1,2031 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/format.c,v 1.11 2001/10/28 03:34:29 tsi Exp $ */ + +#include "format.h" +#include <ctype.h> +#include <math.h> + +/* + * Initialization + */ +static char *BadArgument = "bad argument to directive, at %s"; +/* not very descriptive... */ + +extern char *LispCharNames[]; + +/* + * Implementation + */ +LispObj * +Lisp_Format(LispMac *mac, LispObj *list, char *fname) +{ + int len, princ = mac->princ, newline = mac->newline, tmp, nindirection = 0; + int num_args, cur_arg, iteration = -1; + char *fmt, stk[1024], **indirection = NULL, *ptr, *str = NULL; + LispObj *stream, *format, *arguments, *arg, *plural, *obj, *ilist, *sargs, + *alist; + unsigned char *uptr; + + sargs = NIL; /* place to temporarily save arguments, num_args and cur_arg */ + stream = CAR(list); + list = CDR(list); + if ((format = CAR(list))->type != LispString_t) + LispDestroy(mac, "expecting string, at %s", fname); + list = CDR(list); + arg = arguments = list; + + /* count number of arguments */ + for (num_args = cur_arg = 0; arg->type == LispCons_t; arg = CDR(arg)) + ++num_args; + arg = arguments; + + if (stream == NIL) { + stream = LispNew(mac, NIL, NIL); + stream->type = LispStream_t; + stream->data.stream.source.str = NULL; + stream->data.stream.size = 0; + stream->data.stream.idx = 0; + } + else if (stream == T) + stream = NIL; + else if (stream->type != LispStream_t) + LispDestroy(mac, "%s is not a stream, at %s", + LispStrObj(mac, stream), fname); + + /* ilist is used to store the previous/original stream and a description + * of the formating directive. + */ + ilist = CONS(CONS(NIL, stream), NIL); + /* alist is used to store saved data, to allow temporarily saving + * arguments or data when processing complex directives. + */ + alist = NIL; + + plural = NIL; + len = 0; + fmt = STRPTR(format); + while (1) { + if (*fmt == '\0') { + if (iteration >= 0 && STRPTR(CAR(CAR(ilist)))[0] == '{') { + int done = 0; + + if (iteration != 0 && --iteration == 0) { + iteration = -1; + done = 1; + } + fmt = indirection[(int)CAR(alist)->data.real + 1]; + if (STRPTR(CAR(CAR(ilist)))[1] == '@') { + /* using normal arguments */ + if (STRPTR(CAR(CAR(ilist)))[2] == ':') { + if (CDR(CAR(alist))->type == LispCons_t) { + CAR(alist) = CDR(CAR(alist)); + plural = NIL; + arg = CAR(CAR(alist)); + if (arg->type != LispCons_t) + LispDestroy(mac, BadArgument, fname); + arguments = obj = arg; + for (num_args = cur_arg = 0; obj->type == LispCons_t; + obj = CDR(obj)) + ++num_args; + } + else if (CDR(CAR(alist)) != NIL) + goto not_enough_args; + else + done = 1; /* no more arguments */ + } + else if (arg == NIL) + done = 1; + } + else { + if (STRPTR(CAR(CAR(ilist)))[1] == ':') { + if (CDR(CAR(CAR(alist)))->type == LispCons_t) { + CAR(CAR(alist)) = CDR(CAR(CAR(alist))); + arg = CAR(CAR(CAR(alist))); + if (arg->type != LispCons_t) + LispDestroy(mac, BadArgument, fname); + arguments = obj = arg; + for (num_args = cur_arg = 0; obj->type == LispCons_t; + obj = CDR(obj)) + ++num_args; + } + else if (CDR(CAR(CAR(alist))) != NIL) + goto not_enough_args; + else + done = 1; + } + else if (arg->type != LispCons_t) { + arg = CAR(ilist); + done = 1; + } + if (arg->type != LispCons_t) + done = 1; /* no more arguments */ + } + if (done) { + iteration = -1; + nindirection = (int)CAR(alist)->data.real; + fmt = indirection[nindirection]; + if (STRPTR(CAR(CAR(ilist)))[1] == ':' || + STRPTR(CAR(CAR(ilist)))[2] == ':') { + arg = CDR(CDR(CAR(ilist))); + plural = NIL; + arguments = CAR(CAR(sargs)); + num_args = (int)CAR(CDR(CAR(sargs)))->data.real; + cur_arg = (int)CDR(CDR(CAR(sargs)))->data.real; + sargs = CDR(sargs); + } + ilist = CDR(ilist); + alist = CDR(alist); + stream = CDR(CAR(ilist)); + } + } + else if (nindirection) + fmt = indirection[--nindirection]; + else + break; + continue; + } + if (*fmt == '~') { + char *end; + int radix = 10, mincol = 0, minpad = 0, colinc = 1, padchar = ' '; + int argc, nargs[7], defs[7], padidx, isradix, isprinc, ise; + int atsign = 0, collon = 0; + int w = 0, d = 1, e = 1, k = 0, n = 1, overidx, overflowchar = 0, + expidx, exponentchar = 'E', colnum = 1, hash = -1; + + if (len) { + stk[len] = '\0'; + mac->column += LispPrintf(mac, stream, "%s", stk); + len = 0; + } + ++fmt; + argc = 0; + padidx = overidx = expidx = -1; /* minimal error check */ + while (1) { + if (*fmt == ',') { /* use default value */ + ++fmt; + defs[argc] = 1; + } + else if (*fmt == '-' || *fmt == '+' || + isdigit(*fmt)) { /* mincol specified */ + nargs[argc] = strtol(fmt, &end, 10); + defs[argc] = 0; + fmt = end; + if (*fmt == ',') /* more args */ + ++fmt; + } + else if (*fmt == '\'') { /* use default value */ + ++fmt; + if (overidx != 1) + expidx = argc; + else { + overidx = padidx; + padidx = argc; + } + if (!*fmt) + goto error_parsing; + nargs[argc] = *fmt++; + defs[argc] = 0; + if (*fmt == ',') /* more args */ + ++fmt; + } + else if (*fmt == ':') { + ++fmt; + collon = 1; + continue; + } + else if (*fmt == '@') { + ++fmt; + atsign = 1; + continue; + } + else if (*fmt == '#') { + nargs[argc] = num_args - cur_arg; + ++fmt; + hash = argc; + defs[argc] = 0; + if (*fmt == ',') /* more args */ + ++fmt; + } + else + break; + if (++argc > sizeof(nargs) / sizeof(nargs[0])) + LispDestroy(mac, "too many arguments to directive, at %s", + fname); + } + + switch (*fmt) { + case 'a': /* Ascii */ + case 'A': /* ~mincol,colinc,minpad,padcharA */ + isprinc = 1; + goto print_object; + case 'b': /* Binary */ + case 'B': /* ~mincol,padchar,commacharB */ + isradix = 0; + radix = 2; + goto print_number; + case 'w': /* Write */ + case 'W': /* XXX must output identically to write */ + case 's': /* S-expression */ + case 'S': /* ~mincol,colinc,minpad,padcharS */ + isprinc = 0; + goto print_object; + case 'd': /* Decimal */ + case 'D': /* ~mincol,padcharD */ + isradix = 0; + radix = 10; + goto print_number; + case 'o': /* Octal */ + case 'O': /* ~mincol,padchar,commacharB */ + isradix = 0; + radix = 8; + goto print_number; + case 'x': /* Hexadecimal */ + case 'X': /* ~mincol,padchar,commacharB */ + isradix = 0; + radix = 16; + goto print_number; + case 'r': /* Radix */ + case 'R': /* ~radix,mincol,padchar,commacharR */ + isradix = 1; + goto print_number; + case 'p': /* Plural */ + case 'P': + mac->newline = 0; + if (collon) { + if (plural != NIL) + arg = plural; + else + plural = arg; + if (plural->type != LispCons_t) + goto not_enough_args; + } + else { + if (arg->type != LispCons_t) + goto not_enough_args; + plural = arg; + } + if (!NUMBER_P(CAR(plural)) || + NUMBER_VALUE(CAR(plural)) != 1) { + if (atsign) + mac->column += LispPrintf(mac, stream, "ies"); + else + mac->column += LispPrintf(mac, stream, "s"); + } + else { + if (atsign) + mac->column += LispPrintf(mac, stream, "y"); + } + break; + case 'c': /* Character */ + case 'C': + if (arg->type != LispCons_t) + goto not_enough_args; + if (CAR(arg)->type != LispCharacter_t) + LispDestroy(mac, "expecting character, at %s", fname); + mac->newline = atsign || collon || + CAR(arg)->data.integer != '\n'; + if (atsign && !collon) + mac->column += LispPrintf(mac, stream, "#\\"); + if ((atsign || collon) && + (CAR(arg)->data.integer <= ' ' || + CAR(arg)->data.integer == 0177)) + mac->column += + LispPrintf(mac, stream, "%s", + CAR(arg)->data.integer == 0177 ? + "Rubout" : + LispCharNames[CAR(arg)->data.integer]); + else + mac->column += LispPrintf(mac, stream, "%c", + CAR(arg)->data.integer); + break; + case 'f': /* Floating-point */ + case 'F': /* ~w,d,k,overflowchar,padcharF */ + ise = 0; + goto print_float_number; + case 'e': /* Exponential floating-point */ + case 'E': /* ~w,d,e,k,overflowchar,padchar,exponentcharE */ + ise = 1; + goto print_float_number; + case 'g': /* General floating-point */ + case 'G': /* ~w,d,e,k,overflowchar,padchar,exponentcharG */ + ise = 1; + goto print_float_number; + case '$': /* Dollars floating-point */ + /* ~d,n,w,padchar$ */ + ise = 0; + goto print_float_number; + case '&': + if (mac->newline) + len = -1; + case '%': + if (argc && !defs[0]) + len += nargs[0]; + else + len += 1; + if (padidx >= 0) + LispDestroy(mac, BadArgument, fname); + if (len > 0) { + mac->newline = 1; + mac->column = 0; + } + while (len > 0) { + LispPrintf(mac, stream, "\n"); + --len; + } + len = 0; + ++fmt; + /* no arguments used */ + continue; + case '~': + if (argc && !defs[0]) + len = nargs[0]; + else + len = 1; + if (padidx >= 0) + LispDestroy(mac, BadArgument, fname); + while (len) { + mac->column += LispPrintf(mac, stream, "~"); + --len; + } + ++fmt; + /* no arguments used */ + continue; + case '|': + if (argc && !defs[0]) + len = nargs[0]; + else + len = 1; + if (padidx >= 0) + LispDestroy(mac, BadArgument, fname); + if (len > 0) { + mac->newline = 1; + mac->column = 0; + } + while (len) { + LispPrintf(mac, stream, "\f"); + --len; + } + ++fmt; + /* no arguments used */ + continue; + case '\n': + ++fmt; + while (*fmt && isspace(*fmt)) { + if (collon) /* if collon, don't ignore following + * whitespaces, just the leading newline + */ + mac->column += LispPrintf(mac, stream, "%c", *fmt); + ++fmt; + } + /* no arguments used */ + continue; + case 't': /* Tabulate */ + case 'T': /* ~colnum,colincT */ + if (argc && !defs[0]) + colnum = nargs[0]; + if (argc > 1 && !defs[1]) + colinc = nargs[1]; + if (!atsign) { + if (mac->column < colnum) { + /* output spaces until mac->column == colnum */ + while (mac->column < colnum) + mac->column += + LispPrintf(mac, stream, "%c", ' '); + } + else { + /* output colinc spaces */ + while (colinc > 0) { + mac->column += + LispPrintf(mac, stream, "%c", ' '); + --colinc; + } + } + } + else { + /* relative tabulation, use colnum as colrel */ + while (colnum > 0) { + /* outputs colrel spaces */ + mac->column += LispPrintf(mac, stream, "%c", ' '); + --colnum; + } + if (colinc > 0) { + /* outputs spaces until mac->column is + * multiple of colinc */ + while (mac->column % colinc) + mac->column += + LispPrintf(mac, stream, "%c", ' '); + } + } + ++fmt; + /* no arguments used */ + continue; + case '*': /* ignore/jump to argument */ + len = 1; + if (argc && !defs[0]) + len = nargs[0]; + + if (len < 0 || argc > 1) + LispDestroy(mac, BadArgument, fname); + + if (!collon && !atsign) { + /* forward */ + if (arg->type != LispCons_t) + goto not_enough_args; + while (len) { + plural = arg; + if ((arg = CDR(arg)) == NIL) + break; + ++cur_arg; + --len; + } + } + else { + /* count how many arguments processed */ + for (tmp = 0, plural = arguments; plural != arg; + tmp++, plural = CDR(plural)) + ; + tmp -= len; + plural = NIL; + arg = arguments; + cur_arg = 0; + + if (!atsign) /* backwards, else goto argument */ + len = tmp; + if (len > 0) + for (tmp = 0; tmp < len; + tmp++, plural = arg, arg = CDR(arg)) + cur_arg++; + } + len = 0; + ++fmt; + /* no arguments used */ + continue; + case '?': /* Indirection */ + if (atsign) { + /* cannot be implemented calling Lisp_Format + * recursively, as we don't know how many arguments + * will be (un)consumed */ + + if (arg->type != LispCons_t) + goto not_enough_args; + if (!STRING_P(CAR(arg))) + LispDestroy(mac, "expecting string, at %s", fname); + indirection = LispRealloc(mac, indirection, + sizeof(char*) * + (nindirection + 1)); + indirection[nindirection++] = ++fmt; + fmt = STRPTR(CAR(arg)); + plural = arg; + arg = CDR(arg); + ++cur_arg; + /* don't increment fmt */ + continue; + } + else { + LispObj *fmt, *lst; + + if (arg->type != LispCons_t) + goto not_enough_args; + fmt = CAR(arg); + arg = CDR(arg); + ++cur_arg; + if (arg->type != LispCons_t) + goto not_enough_args; + lst = CAR(arg); + GCProtect(); + Lisp_Format(mac, CONS(stream, CONS(fmt, lst)), fname); + GCUProtect(); + } + break; + + /* Here start the "complex" format directives */ + case '(': /* Case-conversion start */ + if (argc) + LispDestroy(mac, BadArgument, fname); + /* format the data in a temporary stream */ + GCProtect(); + obj = LispNew(mac, NIL, NIL); + obj->type = LispStream_t; + obj->data.stream.source.str = NULL; + obj->data.stream.size = 0; + obj->data.stream.idx = 0; + stk[len++] = '('; + if (atsign) + stk[len++] = '@'; + if (collon) + stk[len++] = ':'; + stk[len] = '\0'; + ilist = CONS(CONS(STRING(stk), obj), ilist); + alist = CONS(NIL, alist); + GCUProtect(); + stream = obj; + len = 0; + ++fmt; + /* no arguments used */ + continue; + case ')': /* Case-conversion end */ + if (argc) + LispDestroy(mac, BadArgument, fname); + if (CAR(CAR(ilist)) == NIL || + STRPTR(CAR(CAR(ilist)))[0] != '(') + LispDestroy(mac, "mismatched ~), at %s", fname); + /* remember if atsign and/or collon was set */ + strcpy(stk, STRPTR(CAR(CAR(ilist)))); + len = 1; + if (stk[len] == '@') { + atsign = 1; + ++len; + } + else + atsign = 0; + if (stk[len] == ':') + collon = 1; + else + collon = 0; + + if ((uptr = stream->data.stream.source.str) != NULL) { + if (atsign && collon) { /* uppercase everything */ + while (*uptr) { + *uptr = toupper(*uptr); + ++uptr; + } + } + else if (atsign) { /* capitalizes the first word */ + while (*uptr && !isalpha(*uptr)) + ++uptr; + if (*uptr) { + *uptr = toupper(*uptr); + ++uptr; + } + while (*uptr) { + *uptr = tolower(*uptr); + ++uptr; + } + } + else if (collon) { /* capitalizes all words */ + while (*uptr) { + while (*uptr && !isalpha(*uptr)) + ++uptr; + if (*uptr) { + *uptr = toupper(*uptr); + ++uptr; + } + while (*uptr && isalpha(*uptr)) { + *uptr = tolower(*uptr); + ++uptr; + } + } + } + else { /* lowercase everything */ + while (*uptr) { + *uptr = tolower(*uptr); + ++uptr; + } + } + uptr = stream->data.stream.source.str; + } + ilist = CDR(ilist); + alist = CDR(alist); + stream = CDR(CAR(ilist)); + if (uptr) + mac->column += LispPrintf(mac, stream, "%s", uptr); + len = 0; + ++fmt; + /* no arguments used */ + continue; + case '[': { /* Conditional-expression start */ + char *end, **fields; + int field, nfields, obrack, oless, def; + int done = 0, scollon = 0; + + if (argc > 1) + LispDestroy(mac, BadArgument, fname); + + def = field = -1; + obrack = 1; + fields = NULL; + nfields = oless = 0; + /* split fields as strings, to allow easier processing */ + ptr = str = fmt + 1; + while (!done) { + switch (*ptr) { + case '~': + scollon = 0; + end = ptr; /* "maybe" end */ + ++ptr; + while (*ptr) { + if (*ptr == ',' || *ptr == '@' || + *ptr == '#' || *ptr == '+' || + *ptr == '-' || isdigit(*ptr)) + ++ptr; + else if (*ptr == '\'') { + ++ptr; + if (!*ptr) + goto error_parsing; + ++ptr; + } + else if (*ptr == ':') { + scollon = 1; + ++ptr; + } + else /* a directive was found */ + break; + } + if (*ptr == '<') + ++oless; + else if (*ptr == '>') + --oless; /* don't check if smaller than + * zero. this may be a condition + * that will never be evaluated + */ + else if (*ptr == '[') + ++obrack; + else if (*ptr == ']' || *ptr == ';') { + if (obrack == 1 && *ptr == ']') + done = 1; + if (oless <= 0 && obrack == 1) { + fields = LispRealloc(mac, fields, + sizeof(char*) * + (nfields + 1)); + len = end - str; + fields[nfields] = LispMalloc(mac, len + 1); + strncpy(fields[nfields], str, len); + fields[nfields][len] = '\0'; + if (scollon) + def = nfields + 1; + ++nfields; + str = ptr + 1; + } + if (*ptr == ']') + --obrack; + } + ++ptr; + break; + case '\0': + goto error_parsing; + default: + ++ptr; + break; + } + } + fmt = ptr; + + if (collon) { + if (arg->type != LispCons_t) + goto not_enough_args; + if (CAR(arg) == NIL) { + if (nfields && fields[0][0]) + field = 0; + } + else if (nfields > 1 && fields[1][0]) + field = 1; + /* don't update plural, just consume argument */ + arg = CDR(arg); + ++cur_arg; + } + else if (atsign) { + if (arg->type != LispCons_t) + goto not_enough_args; + if (CAR(arg) == NIL) { + plural = arg; + arg = CDR(arg); + ++cur_arg; + } + else if (nfields && fields[0][0]) + field = 0; + } + else if (argc && !defs[0]) { + if (nargs[0] < nfields) + field = nargs[0]; + else if (def >= 0) + field = def; + } + else { + if (arg->type != LispCons_t) + goto not_enough_args; + if (!INTEGER_P(CAR(arg))) + LispDestroy(mac, "%s is not an index, at %s", + LispStrObj(mac, CAR(arg)), fname); + if (NUMBER_VALUE(CAR(arg)) < nfields && + NUMBER_VALUE(CAR(arg)) >= 0) + field = NUMBER_VALUE(CAR(arg)); + else if (def >= 0) + field = def; + plural = arg; + arg = CDR(arg); + ++cur_arg; + } + if (field >= 0 && field < nfields) { + indirection = LispRealloc(mac, indirection, + sizeof(char*) * + (nindirection + 1)); + indirection[nindirection++] = fmt; + GCProtect(); + fmt = STRPTR(STRING(fields[field])); + GCUProtect(); + } + while (--nfields >= 0) + LispFree(mac, fields[nfields]); + LispFree(mac, fields); + len = 0; + /* if any argument used, already updated arg */ + } continue; + case ']': /* Conditional-expression end */ + LispDestroy(mac, "mismatched ~], at %s", fname); + case '{': { /* Iteration start */ + int op = 1, scollon = 0, done = 0; + char *end; + + if (argc > 1) + LispDestroy(mac, BadArgument, fname); + + /* how many iterations, 0 means until all arguments are + * consumed */ + iteration = 0; + if (argc && !defs[0]) + iteration = nargs[0]; + + ptr = str = ++fmt; + while (!done) { + switch (*ptr) { + case '~': + scollon = 0; + end = ptr; /* "maybe" end */ + ++ptr; + while (*ptr) { + if (*ptr == ',' || *ptr == '@' || + *ptr == '#' || *ptr == '+' || + *ptr == '-' || isdigit(*ptr)) + ++ptr; + else if (*ptr == '\'') { + ++ptr; + if (!*ptr) + goto error_parsing; + ++ptr; + } + else if (*ptr == ':') { + scollon = 1; + ++ptr; + } + else /* a directive was found */ + break; + } + if (*ptr == '{') + ++op; + else if (*ptr == '}') { + if (--op == 0) { + char *st = str; + + len = end - str; + str = LispMalloc(mac, len + 1); + strncpy(str, st, len); + str[len] = '\0'; + done = 1; + ++ptr; + continue; /* i.e. break the loop */ + } + } + ++ptr; + break; + case '\0': + goto error_parsing; + default: + ++ptr; + break; + } + } + if (iteration == -1 && (!argc || !defs[0])) + iteration = scollon; /* iterate at least once, if scollon */ + else if (iteration <= 0 && scollon) + iteration = 1; + if (iteration < 0 || + (iteration == 0 && argc && !defs[0])) { + /* if no iterations were requested */ + if (!atsign) { + /* consume one element even if no iterations */ + if (arg->type != LispCons_t) + goto not_enough_args; + plural = arg; + arg = CDR(arg); + ++cur_arg; + fmt = ptr; + iteration = -1; + LispFree(mac, str); + /* don't need to do anything more... */ + continue; + } + else if (arg->type != LispCons_t) { + /* no arguments left, don't even start iteration */ + fmt = ptr; + iteration = -1; + LispFree(mac, str); + continue; + } + } + + if (!atsign) { /* need to check for errors later */ + if (arg->type != LispCons_t) + LispDestroy(mac, BadArgument, fname); + if (collon && CAR(arg)->type != LispCons_t) + LispDestroy(mac, BadArgument, fname); + } + + end = ptr; + /* if got here, than no errors detected so far */ + if (!*str) { + /* if string is empty, use next argument as control + * string */ + LispFree(mac, str); + if (arg->type != LispCons_t) + goto not_enough_args; + else if (!STRING_P(CAR(arg))) + LispDestroy(mac, "expecting string, at %s", fname); + ptr = STRPTR(CAR(arg)); + plural = arg; + arg = CDR(arg); + ++cur_arg; + } + else { + GCProtect(); + ptr = STRPTR(STRING(str)); + LispFree(mac, str); + GCUProtect(); + } + + len = 0; + stk[len++] = '{'; + if (atsign) + stk[len++] = '@'; + if (collon) + stk[len++] = ':'; + stk[len] = '\0'; + GCProtect(); + ilist = CONS(CONS(STRING(stk), stream), ilist); + alist = CONS(REAL((double)nindirection), alist); + if (!atsign) { + CAR(alist) = collon ? + CONS(CAR(arg), CDR(arg)) : CDR(arg); + plural = NIL; + arg = collon ? CAR(CAR(arg)) : CAR(arg); + sargs = CONS(CONS(arguments, + CONS(REAL((double)num_args), + REAL((double)cur_arg))), sargs); + arguments = obj = arg; + for (num_args = cur_arg = 0; obj->type == LispCons_t; + obj = CDR(obj)) + ++num_args; + } + else if (collon && arg->type == LispCons_t) { + CAR(alist) = arg; + plural = NIL; + arg = CAR(arg); + sargs = CONS(CONS(arguments, + CONS(REAL((double)num_args), + REAL((double)cur_arg))), sargs); + arguments = obj = arg; + for (num_args = cur_arg = 0; obj->type == LispCons_t; + obj = CDR(obj)) + ++num_args; + } + GCUProtect(); + indirection = LispRealloc(mac, indirection, + sizeof(char*) * + (nindirection + 2)); + indirection[nindirection++] = end; + indirection[nindirection++] = ptr; + len = 0; + fmt = ptr; + } continue; + case '}': /* Iteration end */ + LispDestroy(mac, "mismatched ~}, at %s", fname); + case '<': /* Justification start */ + len = 0; + stk[len++] = '<'; + if (atsign) + stk[len++] = '@'; + if (collon) + stk[len++] = ':'; + stk[len] = '\0'; + if (argc && !defs[0]) + mincol = nargs[0]; + if (argc > 1 && !defs[1]) + colinc = nargs[1]; + if (argc > 2 && !defs[2]) + minpad = nargs[2]; + if (argc > 3 && !defs[3]) + padchar = nargs[3]; + if (argc > 4 || (padidx != -1 && padidx != 3)) + LispDestroy(mac, BadArgument, fname); + GCProtect(); + obj = LispNew(mac, NIL, NIL); + obj->type = LispStream_t; + obj->data.stream.source.str = NULL; + obj->data.stream.size = 0; + obj->data.stream.idx = 0; + stream = obj; + ilist = CONS(CONS(STRING(stk), obj), ilist); + alist = CONS(CONS(NIL, CONS(obj, NIL)), alist); + obj = CONS(REAL((double)mincol), + CONS(REAL((double)colinc), + CONS(REAL((double)minpad), + CONS(REAL((double)padchar), + CONS(NIL, + CONS(NIL, + REAL((double)mac->column))))))); + /* chars after and line width, + * i.e. defaults for first + * parameter, if any. + */ + CAR(CAR(alist)) = obj; + GCUProtect(); + len = 0; + ++fmt; + /* no arguments used */ + continue; + case ';': /* separator for ~[ and ~<, in this code, + * only used for ~< */ + if (!STRING_P(CAR(CAR(ilist))) || + STRPTR(CAR(CAR(ilist)))[0] != '<') + LispDestroy(mac, "~; not allowed here, at %s", fname); + + GCProtect(); + if (collon && CDR(CDR(CAR(alist))) == NIL) { + double dtmp; + + if (argc && !defs[0]) { /* chars after */ + dtmp = nargs[0]; + CAR(CDR(CDR(CDR(CDR(CAR(CAR(alist))))))) = + REAL(dtmp); + } + if (argc > 1 && !defs[1]) { /* line width */ + dtmp = nargs[1]; + CAR(CDR(CDR(CDR(CDR(CDR(CAR(CAR(alist)))))))) = + REAL(dtmp); + } + } + obj = LispNew(mac, NIL, NIL); + obj->type = LispStream_t; + obj->data.stream.source.str = NULL; + obj->data.stream.size = 0; + obj->data.stream.idx = 0; + CDR(CAR(alist)) = CONS(obj, CDR(CAR(alist))); + stream = CDR(CAR(ilist)) = obj; + GCUProtect(); + ++fmt; + /* no arguments used */ + continue; + case '>': { /* Justification end */ + double left, inc; + int bytes, count, pos; + LispObj *charsafter, *linewidth, *pad, *otmp; + + if (argc) + LispDestroy(mac, BadArgument, fname); + if (CAR(CAR(ilist)) == NIL || + STRPTR(CAR(CAR(ilist)))[0] != '<') + LispDestroy(mac, "mismatched ~>, at %s", fname); + + /* remember if atsign and/or collon was set */ + strcpy(stk, STRPTR(CAR(CAR(ilist)))); + len = 1; + if (stk[len] == '@') { + atsign = 1; + ++len; + } + else + atsign = 0; + if (stk[len] == ':') + collon = 1; + else + collon = 0; + + /* restore parameters */ + obj = CAR(CAR(alist)); + mincol = (int)CAR(obj)->data.real; + colinc = (int)CAR(CDR(obj))->data.real; + minpad = (int)CAR(CDR(CDR(obj)))->data.real; + padchar = (int)CAR(CDR(CDR(CDR(obj))))->data.real; + charsafter = CAR(CDR(CDR(CDR(CDR(obj))))); + linewidth = CAR(CDR(CDR(CDR(CDR(CDR(obj)))))); + mac->column = (int)CDR(CDR(CDR(CDR(CDR(CDR(obj))))))-> + data.real; + + /* if use default for either charsafter or linewidth */ + GCProtect(); + if (charsafter != NIL && linewidth == NIL) + linewidth = REAL(72.0); + else if (charsafter == NIL && linewidth != NIL) + charsafter = REAL(0.0); + GCUProtect(); + + /* count number of fields and set pad variable */ + for (argc = bytes = 0, pad = obj = CDR(CAR(alist)); + obj != NIL; argc++, pad = obj, obj = CDR(obj)) { + if (CAR(obj)->data.stream.source.str) + bytes += strlen((char*) + CAR(obj)->data.stream.source.str); + } + if (charsafter == NIL) + pad = NIL; + else if (pad != NIL) + --argc; + + obj = LispReverse(CDR(CAR(alist))); + if (pad != NIL) { + obj = CDR(obj); + pad = CAR(pad); + if (pad->data.stream.source.str) + str = (char*)pad->data.stream.source.str; + else + str = ""; + bytes -= strlen(str); + } + + /* first, adds minpad, if any to strings */ + if (minpad) { + for (otmp = pad || collon ? obj : CDR(obj), tmp = 1; + otmp != NIL; + otmp = CDR(otmp), tmp++) { + len = CAR(obj)->data.stream.source.str ? + strlen((char*) + CAR(obj)->data.stream.source.str) : 0; + len += minpad + 1; + if (len > CAR(obj)->data.stream.size) { + ptr = realloc(CAR(obj)->data.stream.source.str, + len); + if (ptr == NULL) + LispDestroy(mac, "out of memory"); + CAR(obj)->data.stream.source.str = + (unsigned char*)ptr; + CAR(obj)->data.stream.size = len; + } + else + ptr = (char*)CAR(obj)->data.stream.source.str; + CAR(obj)->data.stream.idx = len; + if (len > minpad + 1 && (tmp < argc || !atsign)) + memmove(ptr + minpad, ptr, len - minpad); + if (tmp == argc && atsign) { /* right pad */ + int tlen = len; + + for (len -= minpad + 1; len < tlen; len++) + ptr[len] = padchar; + } + else { + len = minpad; + while (--len >= 0) + ptr[len] = padchar; + } + bytes += minpad; + } + } + + /* adjust mincol */ + if (colinc > 0) { + while (bytes > mincol) + mincol += colinc; + } + else if (mincol < bytes) + mincol = bytes; + + left = mincol - bytes; + if (left < 0) + left = 0; + if (argc > 1) { + if (collon ^ atsign) + inc = left / (double)argc; + else if (collon) + inc = left / (double)(argc + 1); + else + inc = left / (double)(argc - 1); + } + else + inc = left; + + ilist = CDR(ilist); + alist = CDR(alist); + stream = CDR(CAR(ilist)); + /* format strings in the output stream */ + for (tmp = pos = 0; obj != NIL; tmp++, obj = CDR(obj)) { + if (CAR(obj)->data.stream.source.str) + ptr = (char*)CAR(obj)->data.stream.source.str; + else + ptr = ""; + count = len = strlen(ptr); + if (pad != NIL && + mac->column + len + charsafter->data.real > + linewidth->data.real) { + char *nl; + + mac->column += LispPrintf(mac, stream, "%s", str); + if ((nl = strrchr(str, '\n')) != NULL) { + mac->column = 0; + ++nl; + while (*nl++) + ++mac->column; + } + } + + if (tmp + 1 == argc) { + if (!atsign || collon) { + if (atsign) { + count += (int)(left / 2.0); + left -= (int)(left / 2.0); + } + else { + count += (int)left; + left -= (int)left; + } + } + else if (!atsign) { + count += (int)left; + left -= (int)left; + } + } + else if (tmp != 0 || collon) { + double dleft = left; + + left -= inc; + count += dleft - left; + if ((int)(left + 0.5) != (int)left) + ++count; + } + + while (len < count) { + mac->column += LispPrintf(mac, stream, + "%c", padchar); + ++len; + } + mac->column += LispPrintf(mac, stream, "%s", ptr); + } + + while (left > 0.0) { + mac->column += LispPrintf(mac, stream, "%c", padchar); + left -= 1.0; + } + + len = 0; + ++fmt; + /* no arguments used */ + } continue; + case '^': /* Up and out */ + if (argc > 3 || padidx != -1) + LispDestroy(mac, BadArgument, fname); + tmp = -1; + if (argc && !defs[0]) /* terminate if tmp == 0 */ + tmp = nargs[0]; + if (argc > 1 && !defs[1]) /* terminate if tmp == len */ + len = nargs[1]; + if (argc > 2 && !defs[2]) { /* if tmp <= len <= nargs[2] */ + if (tmp <= len && len <= nargs[2]) + tmp = 0; + else + tmp = 1; + } + if (argc == 2) + tmp = (len == tmp) ? 0 : 1; + len = 0; + + if (CAR(CAR(ilist)) != NIL && + STRPTR(CAR(CAR(ilist)))[0] == '{' && collon) { + /* needs special handling */ + LispObj *next = T; + + if (STRPTR(CAR(CAR(ilist)))[1] == '@' && + STRPTR(CAR(CAR(ilist)))[2] == ':') + next = CDR(CAR(alist)); + else if (STRPTR(CAR(CAR(ilist)))[1] == ':') + next = CDR(CAR(CAR(alist))); + + if (hash != -1 || next == NIL) { + if (next == NIL || + (hash != -1 && arg->type != LispCons_t)) { + while (*fmt) + ++fmt; + } + else + ++fmt; + if ((hash != -1 && arg->type != LispCons_t)) + iteration = 1; /* force finalization */ + continue; + } + } + + if (tmp == 0 || (tmp == -1 && arg->type != LispCons_t)) { + if (CAR(CAR(ilist)) != NIL) { + if (STRPTR(CAR(CAR(ilist)))[0] == '{') { + if (collon) { + /* passed the test above */ + ++fmt; + continue; + } + while (*fmt) + ++fmt; + } + else if (STRPTR(CAR(CAR(ilist)))[0] == '(') + fmt = "~)"; /* make the loop find + * the end... */ + else if (STRPTR(CAR(CAR(ilist)))[0] == '<') { + /* need to remove the last stream, to + * format correctly */ + if (CDR(CAR(alist)) != NIL) + /* don't need to update stream */ + CDR(CAR(alist)) = CDR(CDR(CAR(alist))); + fmt = "~>"; + } + } + else + goto format_done; + } + else + ++fmt; + /* no arguments used */ + continue; + default: + LispDestroy(mac, "unknown directive ~%c, at %s", + *fmt, fname); + } + ++fmt; + plural = arg; + arg = CDR(arg); + ++cur_arg; + continue; + +print_number: + mac->newline = 0; + if (arg->type != LispCons_t) + goto not_enough_args; + /* if not an integer */ + if (!INTEGER_P(CAR(arg))) { + /* print just as 'A' */ + isprinc = 1; + goto print_object; + } + else { + int sign; + long num = (long)NUMBER_VALUE(CAR(arg)); + + len = 0; + if ((sign = num < 0) != 0) + num = -num; + + /* check for radix */ + if (isradix) { + if (argc == 0 || defs[0]) { + radix = 0; + ++len; + goto print_number_args; + } + radix = nargs[0]; + ++len; + } + if (radix < 2 || radix > 32) + LispDestroy(mac, "radix must be in the range 2 to 32," + " at %s", fname); + +print_number_args: + /* get print arguments */ + if (len < argc && !defs[len]) + mincol = nargs[len]; + ++len; + if (len < argc && !defs[len]) + padchar = nargs[len]; + + if (padidx >= 0 && padidx != len) + LispDestroy(mac, BadArgument, fname); + + if (radix) { + len = 0; + do { + int val; + + val = num % radix; + num -= val; + num /= radix; + if (len) + memmove(stk + 1, stk, len); + *stk = val < 10 ? val + '0' : (val - 10) + 'A'; + ++len; + } while (num); + if (sign || atsign) { + memmove(stk + 1, stk, len); + *stk = sign ? '-' : '+'; + ++len; + } + } + else if (atsign) { /* roman */ + long num = (long)NUMBER_VALUE(CAR(arg)); + + if ((double)num != NUMBER_VALUE(CAR(arg)) || + num <= 0 || num > (3999 + (collon ? 1000 : 0))) + LispDestroy(mac, BadArgument, fname); + + /* if collon, print in old roman format */ + len = 0; + while (num > 1000) { + stk[len++] = 'M'; + num -= 1000; + } + if (!collon) { + if (num >= 900) { + strcpy(stk + len, "CM"); + len += 2, + num -= 900; + } + else if (num < 500 && num >= 400) { + strcpy(stk + len, "CD"); + len += 2; + num -= 400; + } + } + if (num >= 500) { + stk[len++] = 'D'; + num -= 500; + } + while (num >= 100) { + stk[len++] = 'C'; + num -= 100; + } + + if (!collon) { + if (num >= 90) { + strcpy(stk + len, "XC"); + len += 2, + num -= 90; + } + else if (num < 50 && num >= 40) { + strcpy(stk + len, "XL"); + len += 2; + num -= 40; + } + } + if (num >= 50) { + stk[len++] = 'L'; + num -= 50; + } + while (num >= 10) { + stk[len++] = 'X'; + num -= 10; + } + + if (!collon) { + if (num == 9) { + strcpy(stk + len, "IX"); + len += 2, + num -= 9; + } + else if (num == 4) { + strcpy(stk + len, "IV"); + len += 2; + num -= 4; + } + } + if (num >= 5) { + stk[len++] = 'V'; + num -= 5; + } + while (num) { + stk[len++] = 'I'; + num -= 1; + } + } + else { /* english */ + len = 0; +#define SIGNLEN 6 /* strlen("minus ") */ + if (sign) { + strcpy(stk, "minus "); + len += SIGNLEN; + } + else if (num == 0) { + if (collon) { + strcpy(stk, "zeroth"); + len += 6; /*123456*/ + } + else { + strcpy(stk, "zero"); + len += 4; /*1234*/ + } + } + while (1) { + char *d, *h, *t; + int l, count = 0; + long val = num; + static char *ds[] = { + "", "one", "two", "three", + "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", + "twelve", "thirteen", "fourteen", "fifteen", + "sixteen", "seventeen", "eighteen", "nineteen" + }; + static char *dsth[] = { + "", "first", "second", + "third", "fourth", "fifth", + "sixth", "seventh", "eighth", + "ninth", "tenth", "eleventh", + "twelfth", "thirteenth", "fourteenth", + "fifteenth", "sixteenth", "seventeenth", + "eighteenth", "nineteenth" + }; + static char *hs[] = { + "", "", "twenty", "thirty", "forty", + "fifty", "sixty", "seventy", "eighty", "ninety" + }; + static char *hsth[] = { + "", "", "twentieth", "thirtieth", + "fortieth", "fiftieth", "sixtieth", "seventieth", + "eightieth", "ninetieth" + }; + static char *ts[] = { + "", "thousand", "million", "billion", "trillion" + }; + static char *tsth[] = { + "", "thousandth", "millionth", "billionth", + "trillionth" + }; + + while (val >= 1000) { + val /= 1000; + ++count; + } + if (count > sizeof(ts) / sizeof(ts[0])) + LispDestroy(mac, "format is too large, at %s", + fname); + + t = ds[val / 100]; + if (collon && !count && (val % 10) == 0) + h = hsth[(val % 100) / 10]; + else + h = hs[(val % 100) / 10]; + + if (collon && !count) + d = *h ? dsth[val % 10] : dsth[val % 20]; + else + d = *h ? ds[val % 10] : ds[val % 20]; + + if (((!sign && len) || len > SIGNLEN) && + (*t || *h || *d)) { + if (!collon || count || *h || *t) { + strcpy(stk + len, ", "); + len += 2; + } + else { + strcpy(stk + len, " "); + ++len; + } + } + if (*t) { + if (collon && !count && (val % 100) == 0) + l = sprintf(stk + len, "%s hundredth", t); + else + l = sprintf(stk + len, "%s hundred", t); + len += l; + } + if (*h) { + if (*t) { + if (collon && !count) { + strcpy(stk + len, " "); + ++len; + } + else { + strcpy(stk + len, " and "); + len += 5; /*12345*/ + } + } + l = sprintf(stk + len, "%s", h); + len += l; + } + if (*d) { + if (*h) { + strcpy(stk + len, "-"); + ++len; + } + else if (*t) { + if (collon && !count) { + strcpy(stk + len, " "); + ++len; + } + else { + strcpy(stk + len, " and "); + len += 5; /*12345*/ + } + } + l = sprintf(stk + len, "%s", d); + len += l; + } + if (!count) + break; + else + tmp = count; + if (count > 1) { + val *= 1000; + while (--count) + val *= 1000; + num -= val; + } + else + num %= 1000; + + if (collon && num == 0 && !*t && !*h) + l = sprintf(stk + len, " %s", tsth[tmp]); + else + l = sprintf(stk + len, " %s", ts[tmp]); + len += l; + + if (num == 0) + break; + } + } + + stk[len] = '\0'; + while (mincol > len) { + mac->column += LispPrintf(mac, stream, "%c", padchar); + --mincol; + } + mac->column += LispPrintf(mac, stream, "%s", stk); + len = 0; + } + ++fmt; + plural = arg; + arg = CDR(arg); + ++cur_arg; + continue; + +print_float_number: + mac->newline = 0; + if (arg->type != LispCons_t) + goto not_enough_args; + if (CAR(arg)->type != LispReal_t) { + /* print just as 'A' */ + isprinc = 1; + goto print_object; + } + else { + double num = CAR(arg)->data.real; + char sprint[1024]; + int l, sign, ee = 0, expt = 0, elen = 1, kset = 0, dset = 0, + eset = 0; + + /* get print arguments */ + l = 0; + if (*fmt == '$') { + if (argc && !defs[l]) { + d = nargs[l]; + dset = 1; + } + else + d = 2; /* defaults to 2 for '$' */ + ++l; + if (argc > l && !defs[l]) + n = nargs[l]; + ++l; + if (argc > l && !defs[l]) + w = nargs[l]; + ++l; + if (argc > l && !defs[l]) + padchar = nargs[l]; + if (argc > 4 || d < 0 || n < 0 || + (argc > 2 && !defs[2] && w < 2) || + (padidx != -1 && (padidx != 3))) + LispDestroy(mac, BadArgument, fname); + kset = 1; + } + else { + if (argc && !defs[l]) + w = nargs[l]; + ++l; + if (argc > l && !defs[l]) { + d = nargs[l]; + dset = 1; + } + ++l; + if (ise) { + if (argc > l && !defs[l]) { + e = nargs[l]; + eset = 1; + } + ++l; + } + if (argc > l && !defs[l]) { + k = nargs[l]; + kset = 1; + } + ++l; + if (argc > l && !defs[l]) + overflowchar = nargs[l]; + ++l; + if (argc > l && !defs[l]) + padchar = nargs[l]; + ++l; + if (argc > l && !defs[l]) + exponentchar = nargs[l]; + + if (overidx == -1 && padidx != -1) { + overidx = padidx; + padidx = -1; + } + if ((argc > 2 && !defs[2] && w < 2) || + (argc > 1 && !defs[1] && d < 0) || + (overidx != -1 && (overidx != 3 + ise)) || + (padidx != -1 && (padidx != 4 + ise))) + LispDestroy(mac, BadArgument, fname); + } + + sign = num < 0.0; + if (sign) + num = -num; + + if (toupper(*fmt) == 'G') { + double dtmp = 10.0; + int ww, dd, n = 0, q; + + /* decide if print as ~F or ~E + */ + if (num == 0.0) + q = 1; + else { + l = sprintf(stk, "%f", num); + while (l > 1 && stk[l - 1] == '0') + --l; + q = l + (sign || atsign); + } + + if (num >= 10.0) + for (n = 1; dtmp <= num; n++, dtmp *= 10.0) + ; + else + for (dtmp /= 10.0, n = 1; dtmp >= num; n--, dtmp /= 10.0) + ; + + if (w) + ww = w - ((e ? e : 2) + 2); + else + ww = 0; + if (!dset) { + d = n > 7 ? 7 : n; + if (d < q) + d = q; + } + dd = d - n; + + if (d >= dd && dd >= 0) { + dset = kset = 1; + w = ww; + d = dd; + k = 0; + ise = 0; + /* add that amount of pads after number, + * to "emulate" ~ee,@T */ + ee = eset ? e + 2 : 4; + } + } + + if (ise) { + if (k > 0 && d) { + if ((d -= (k - 1)) < 0) + LispDestroy(mac, BadArgument, fname); + } + else if (k < 0 && -k > d) + LispDestroy(mac, BadArgument, fname); + } + + len = 0; + if (*fmt != '$') { + if (sign) + stk[len++] = '-'; + else if (atsign) + stk[len++] = '+'; + } + + /* adjust scale factor/exponent */ + l = k; + while (l > 0) { + --l; + --expt; + num *= 10.0; + } + while (l < 0) { + ++l; + ++expt; + num /= 10.0; + } + if (ise) { + if (!kset) + k = 1; + if (num > 1.0) { + l = sprintf(sprint, "%1.1f", num); + while (l > 1 && sprint[--l] != '.') + ; + } + else { + int pos; + char sprint2[1024]; + + if (dset) { + sprintf(sprint2, "%%1.%df", d); + l = sprintf(sprint, sprint2, num); + } + else + l = sprintf(sprint, "%f", num); + for (pos = 0; sprint[pos] && sprint[pos] != '.'; pos++) + ; + if (sprint[pos]) { + for (l = 0, pos++; sprint[pos] == '0'; pos++, l--) + ; + if (!sprint[pos]) + l = k; + } + else + l = k; + } + while (l > k) { + --l; + num /= 10.0; + ++expt; + } + while (l < k) { + ++l; + num *= 10.0; + --expt; + } + } + + if (!dset) { + int left = 20; + double integral, fractional; + + fractional = modf(num, &integral); + if (w) { + l = sprintf(sprint, "%f", integral); + while (l > 1 && sprint[l - 1] == '0') + --l; + if (l && sprint[l - 1] == '.') + --l; + left = w - l - 1 - sign; + } + l = sprintf(sprint, "%f", fractional); + while (l && sprint[l - 1] == '0') + --l; + l -= 2 + (w && sign); + if (l > left) + l = left; + sprintf(sprint, "%%1.%df", l > 0 ? l : 0); + } + else + sprintf(sprint, "%%1.%df", d); + l = sprintf(stk + len, sprint, num); + + len += l; + if (ise) { + l = sprintf(stk + len, "%c%c", exponentchar, + expt < 0 ? '-' : '+'); + len += l; + if (e) + sprintf(sprint, "%%0%dd", e); + else + strcpy(sprint, "%d"); + l = sprintf(stk + len, sprint, expt < 0 ? -expt : expt); + len += l; + elen = l + 2; /* sign and exponentchar */ + } + + /* adjust width */ + l = len; + if (ise) + len -= elen; + + /* find '.' in string */ + for (tmp = 0; tmp < len; tmp++) + if (stk[tmp] == '.') + break; + + if (tmp == len) { + /* '.' not found */ + memmove(stk + len + 1 + d, stk + len, l - tmp); + stk[tmp] = '.'; + len = tmp + 1; + for (tmp = 0; tmp < d; len++, tmp++) + stk[len] = '0'; + len = l + 1 + d; + } + else if (dset) { + int tmp2; + + ++tmp; + tmp2 = tmp; + /* correct exponent string */ + if (ise) + memmove(stk + tmp + d, stk + l - elen, elen); + /* pad with '0' chars if required */ + for (tmp = len; tmp < l - elen; tmp++) + stk[tmp] = '0'; + len = tmp2 + d + (ise ? elen : 0); + } + + /* '$' does not have an overflowchar parameter */ + if (w && *fmt != '$') { + if (len > w && num < 1) { + int inc = sign || atsign; + + /* cut the leading '0' */ + memmove(stk + inc, stk + inc + 1, len - inc - 1); + --len; + } + if (((ise && elen - 2 > e) || len > w) && overflowchar) { + for (len = 0; len < w; len++) + stk[len] = overflowchar; + } + } + + l = len; + stk[len] = '\0'; + if (*fmt == '$') { + if (collon) { + if (sign) + mac->column += LispPrintf(mac, stream, "%c", '-'); + else if (atsign) + mac->column += LispPrintf(mac, stream, "%c", '+'); + } + /* make sure not too much padchars are printed */ + if (len < n + d + 1) + len = n + d + 1 + (sign || atsign); + } + + while (len < w) { + mac->column += LispPrintf(mac, stream, "%c", padchar); + ++len; + } + + if (*fmt == '$') { + if (!collon) { + if (sign) + mac->column += LispPrintf(mac, stream, "%c", '-'); + else if (atsign) + mac->column += LispPrintf(mac, stream, "%c", '+'); + } + for (tmp = 0; tmp < l; tmp++) + if (stk[tmp] == '.') + break; + if (tmp < l) + --tmp; + while (tmp < n) { + mac->column += LispPrintf(mac, stream, "%c", '0'); + ++tmp; + } + } + mac->column += LispPrintf(mac, stream, "%s", stk); + while (ee > 0) { + /* not padchar, but real spaces. + * Note that this is only executed if ~G decided to + * print the number in ~F format. This is a ~ee,@T + * emulation */ + mac->column += LispPrintf(mac, stream, "%c", ' '); + --ee; + } + len = 0; + } + ++fmt; + plural = arg; + arg = CDR(arg); + ++cur_arg; + continue; + +print_object: + mac->newline = 0; + if (arg->type != LispCons_t) + goto not_enough_args; + + if (padidx >= 0 && padidx != 3) + LispDestroy(mac, BadArgument, fname); + + /* get print arguments */ + if (argc && !defs[0]) + mincol = nargs[0]; + if (argc > 1 && !defs[1]) + colinc = nargs[1]; + if (argc > 2 && !defs[2]) + minpad = nargs[2]; + if (argc > 3 && !defs[3]) + padchar = nargs[3]; + + if (atsign) { + int justsize = mac->justsize; + + mac->justsize = 1; + len = LispPrintObj(mac, stream, CAR(arg), 1); + mac->justsize = justsize; + while (len < mincol) { + mac->column += LispPrintf(mac, stream, "%c", padchar); + ++len; + } + } + + if (isprinc) + mac->princ = 1; + if (collon && toupper(*fmt) == 'A' && CAR(arg) == NIL) + len = LispPrintf(mac, stream, "%s", "()"); + else + len = LispPrintObj(mac, stream, CAR(arg), 1); + mac->column += len; /* XXX maybe should look if the object has + * newlines, and adjust mac->column in + * that case */ + if (!atsign) { + while (len < mincol) { + mac->column += LispPrintf(mac, stream, "%c", padchar); + ++len; + } + } + if (isprinc) + mac->princ = princ; + len = 0; + ++fmt; + plural = arg; + arg = CDR(arg); + ++cur_arg; + continue; + +not_enough_args: + LispDestroy(mac, "no arguments left, at %s", fname); +error_parsing: + LispDestroy(mac, "error parsing directive, at %s", fname); + } + else { + mac->newline = 0; + if (len + 1 < sizeof(stk)) + stk[len++] = *fmt; + else { + stk[len] = '\0'; + mac->column += LispPrintf(mac, stream, "%s", stk); + len = 0; + } + } + ++fmt; + } +format_done: + if (len) { + stk[len] = '\0'; + mac->column += LispPrintf(mac, stream, "%s", stk); + } + + if (stream != NIL && (stream->data.stream.size >= 0 || + stream->data.stream.source.fp != lisp_stdout)) + mac->newline = newline; + else + fflush(lisp_stdout); + + LispFree(mac, indirection); + + if (CAR(CAR(ilist)) != NIL) { + char c; + + switch (STRPTR(CAR(CAR(ilist)))[0]) { + case '(': + c = ')'; + break; + case '{': + c = '}'; + break; + case '<': + c = '>'; + break; + default: + c = '?'; + break; + } + LispDestroy(mac, "expecting ~%c, at %s", c, fname); + } + + if (stream != NIL && stream->data.stream.size >= 0) { + if (stream->data.stream.source.str == NULL) + return (STRING("")); + return (STRING((char*)stream->data.stream.source.str)); + } + + return (stream); +} Index: xc/programs/xedit/lisp/format.h diff -u /dev/null xc/programs/xedit/lisp/format.h:1.1 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/format.h Sun Sep 9 19:03:47 2001 @@ -0,0 +1,42 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/format.h,v 1.1 2001/09/09 23:03:47 paulo Exp $ */ + +#ifndef Lisp_format_h +#define Lisp_format_h + +#include "private.h" + +/* + * Prototypes + */ +LispObj *Lisp_Format(LispMac*, LispObj*, char*); /* format */ + +#endif /* Lisp_format_h */ Index: xc/programs/xedit/lisp/helper.c diff -u /dev/null xc/programs/xedit/lisp/helper.c:1.15 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/helper.c Sat Oct 27 23:34:29 2001 @@ -0,0 +1,949 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/helper.c,v 1.15 2001/10/28 03:34:29 tsi Exp $ */ + +#include "helper.h" +#include <ctype.h> + +/* + * Prototypes + */ +static LispObj *_LispReallyDo(LispMac*, LispObj*, char*, int); +static LispObj *_LispReallyDoListTimes(LispMac*, LispObj*, char*, int); +extern int LispGet(LispMac*); +extern int LispUnget(LispMac*); + +/* + * Implementation + */ +LispObj * +_LispEqual(LispMac *mac, LispObj *left, LispObj *right) +{ + LispObj *res = NIL; + + if (left->type == right->type) { + switch (left->type) { + case LispNil_t: + case LispTrue_t: + res = T; + break; + case LispReal_t: + if (left->data.real == right->data.real) + res = T; + break; + case LispCharacter_t: + case LispInteger_t: + if (left->data.integer == right->data.integer) + res = T; + break; + case LispAtom_t: + case LispString_t: + if (STRPTR(left) == STRPTR(right)) + res = T; + break; + case LispCons_t: + if (_LispEqual(mac, CAR(left), CAR(right)) == T && + _LispEqual(mac, CDR(left), CDR(right)) == T) + res = T; + break; + case LispQuote_t: + res = _LispEqual(mac, left->data.quote, right->data.quote); + break; + case LispLambda_t: + res = _LispEqual(mac, left->data.lambda.name, + right->data.lambda.name); + break; + case LispOpaque_t: + if (left->data.opaque.data == right->data.opaque.data) + res = T; + break; + default: + if (left == right) + res = T; + break; + } + } + + return (res); +} + +LispObj * +_LispNth(LispMac *mac, LispObj *list, char *name, int cdr) +{ + int count, maxpos; + LispObj *nth = CAR(list), *seq = CDR(list), *setf = list; + + if (!INDEX_P(nth)) + LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, nth), name); + if (seq->type != LispCons_t) + LispDestroy(mac, "%s is not of type list, at %s", + LispStrObj(mac, seq), name); + maxpos = NUMBER_VALUE(nth); + for (count = 0, seq = CAR(seq); + count < maxpos && seq->type == LispCons_t; + ++count, setf = seq, seq = CDR(seq)) + ; + + if (count == maxpos) + return (cdr || seq == NIL ? seq : CAR(seq)); + + return (NIL); +} + +LispObj * +_LispFindPlace(LispMac *mac, LispObj *list, LispObj *ref) +{ + LispObj *place; + + for (; list->type == LispCons_t; list = CDR(list)) { + if (CAR(list) == ref) + return (list); + else if (CDR(list) == ref) + return (list); + else if ((place = _LispFindPlace(mac, CAR(list), ref)) != NULL) + return (place); + } + + return (NULL); +} + +LispObj * +_LispMinMax(LispMac *mac, LispObj *list, char *name, int max) +{ + double real, val; + LispObj *obj; + + obj = EVAL(CAR(list)); + if (!NUMBER_P(obj)) + LispDestroy(mac, ExpectingNumberAt, name); + real = NUMBER_VALUE(obj); + for (list = CDR(list); list != NIL; list = CDR(list)) { + obj = EVAL(CAR(list)); + if (!NUMBER_P(obj)) + LispDestroy(mac, ExpectingNumberAt, name); + val = NUMBER_VALUE(obj); + if ((max && val > real) || (!max && val < real)) + real = val; + } + + return (REAL(real)); +} + +LispObj * +_LispBoolCond(LispMac *mac, LispObj *list, char *name, int op) +{ + LispObj *obj; + double value, val; + int cond; + + cond = 1; + obj = op == NOT_EQUAL ? CAR(list) : EVAL(CAR(list)); + if (!NUMBER_P(obj)) + LispDestroy(mac, ExpectingNumberAt, name); + value = NUMBER_VALUE(obj); + + /* special handling, as (/= 3 6 5 2) => T, but (/= 3 3 5 3) => NIL + * all elements must be different to be True + * Also, for NOT_EQUAL, arguments must be evaluated before calling + * this function. + */ + if (op == NOT_EQUAL) { + LispObj *cmp; + + list = CDR(list); + if (list == NIL) + return (T); + + /* check if numbers first */ + for (obj = list; obj != NIL; obj = CDR(obj)) + if (CAR(obj)->type != LispReal_t) + LispDestroy(mac, ExpectingNumberAt, name); + + do { + for (cmp = list; cmp != NIL; cmp = CDR(cmp)) { + obj = CAR(cmp); + if (value == NUMBER_VALUE(obj)) + return (NIL); + } + value = NUMBER_VALUE(CAR(list)); + list = CDR(list); + } while (list != NIL); + return (T); + } + + for (list = CDR(list); list != NIL; list = CDR(list)) { + obj = EVAL(CAR(list)); + if (!NUMBER_P(obj)) + LispDestroy(mac, ExpectingNumberAt, name); + val = NUMBER_VALUE(obj); + switch (op) { + case LESS: + if (value >= val) + cond = 0; + break; + case LESS_EQUAL: + if (value > val) + cond = 0; + break; + case EQUAL: + if (value != val) + cond = 0; + break; + case GREATER: + if (value <= val) + cond = 0; + break; + case GREATER_EQUAL: + if (value < val) + cond = 0; + break; + } + if (!cond) + break; + value = val; + } + return (cond ? T : NIL); +} + +LispObj * +_LispCharBoolCond(LispMac *mac, LispObj *list, char *name, int op, int cas) +{ + LispObj *obj; + long value, comp; + int cond; + + cond = 1; + obj = op == NOT_EQUAL ? CAR(list) : EVAL(CAR(list)); + if (obj->type != LispCharacter_t) + LispDestroy(mac, "expecting character, at %s", name); + value = obj->data.integer; + if (cas) + value = toupper(value); + + if (op == NOT_EQUAL) { + LispObj *cmp; + + list = CDR(list); + if (list == NIL) + return (T); + + for (obj = list; obj != NIL; obj = CDR(obj)) + if (CAR(obj)->type != LispCharacter_t) + LispDestroy(mac, "expecting character, at %s", name); + + do { + for (cmp = list; cmp != NIL; cmp = CDR(cmp)) { + obj = CAR(cmp); + comp = obj->data.integer; + if (cas) + comp = toupper(comp); + if (value == comp) + return (NIL); + } + value = CAR(list)->data.integer; + if (cas) + value = toupper(value); + list = CDR(list); + } while (list != NIL); + return (T); + } + + for (list = CDR(list); list != NIL; list = CDR(list)) { + obj = EVAL(CAR(list)); + if (obj->type != LispCharacter_t) + LispDestroy(mac, "expecting character, at %s", name); + comp = obj->data.integer; + if (cas) + comp = toupper(comp); + switch (op) { + case LESS: + if (value >= comp) + cond = 0; + break; + case LESS_EQUAL: + if (value > comp) + cond = 0; + break; + case EQUAL: + if (value != comp) + cond = 0; + break; + case GREATER: + if (value <= comp) + cond = 0; + break; + case GREATER_EQUAL: + if (value < comp) + cond = 0; + break; + } + if (!cond) + break; + value = obj->data.integer; + if (cas) + value = toupper(value); + } + return (cond ? T : NIL); +} + +LispObj * +_LispDefLambda(LispMac *mac, LispObj *list, LispFunType type) +{ + LispObj *name = NIL, *args, *code, *obj = NIL, *fun, *sto; + static char *types[4] = {"LAMBDA", "FUNCTION", "MACRO", "SETF-METHOD"}; + static char *fnames[4] = {"LAMBDA", "DEFUN", "DEFMACRO", "DEFSETF"}; + int num_args, rest, optional, key; + + /* name */ + if (type != LispLambda) { + if ((name = CAR(list))->type != LispAtom_t) + LispDestroy(mac, "%s cannot be a %s name, at %s", + LispStrObj(mac, name), types[type], fnames[type]); + list = CDR(list); + } + + /* args */ + args = CAR(list); + num_args = rest = optional = key = 0; + + if (args->type == LispCons_t) { + for (obj = args; obj != NIL; obj = CDR(obj), ++num_args) + if (CAR(obj)->type == LispCons_t && (key || optional)) { + /* is this a default value? */ + if (!SYMBOL_P(CAR(CAR(obj)))) + LispDestroy(mac, "%s cannot be a %s argument name, at %s %s", + LispStrObj(mac, CAR(CAR(obj))), types[type], + fnames[type], + type == LispLambda ? "..." : STRPTR(name)); + else if (CDR(CAR(obj)) != NIL && + (CDR(CAR(obj))->type != LispCons_t || + CDR(CDR(CAR(obj))) != NIL)) + LispDestroy(mac, "bad argument specification %s, at %s %s", + LispStrObj(mac, CAR(obj)), types[type], + fnames[type], + type == LispLambda ? "..." : STRPTR(name)); + } + else if (!SYMBOL_P(CAR(obj)) || + STRPTR(CAR(obj))[0] == ':') + LispDestroy(mac, "%s cannot be a %s argument name, at %s %s", + LispStrObj(mac, CAR(obj)), types[type], fnames[type], + type == LispLambda ? "..." : STRPTR(name)); + else if (STRPTR(CAR(obj))[0] == '&') { + if (strcmp(STRPTR(CAR(obj)) + 1, "REST") == 0) { + if (rest || CDR(obj) == NIL || CDR(CDR(obj)) != NIL) + LispDestroy(mac, "syntax error parsing &REST," + " at %s %s", fnames[type], + type == LispLambda ? + "..." : STRPTR(name)); + rest = 1; + } + else if (strcmp(STRPTR(CAR(obj)) + 1, "KEY") == 0) { + if (rest) + LispDestroy(mac, "&KEY not allowed after &REST," + " at %s %s", fnames[type], + type == LispLambda ? + "..." : STRPTR(name)); + if (key || optional || CDR(obj) == NIL) + LispDestroy(mac, "syntax error parsing &KEY," + " at %s %s", fnames[type], + type == LispLambda ? + "..." : STRPTR(name)); + key = 1; + } + else if (strcmp(STRPTR(CAR(obj)) + 1, "OPTIONAL") == 0) { + if (rest) + LispDestroy(mac, "&OPTIONAL not allowed after &REST," + " at %s %s", fnames[type], + type == LispLambda ? + "..." : STRPTR(name)); + if (key || optional || CDR(obj) == NIL) + LispDestroy(mac, "syntax error parsing &OPTIONAL," + " at %s %s", fnames[type], + type == LispLambda ? + "..." : STRPTR(name)); + optional = 1; + } + else + LispDestroy(mac, "%s not allowed %at %s %s", + STRPTR(CAR(obj)), fnames[type], + type == LispLambda ? "..." : STRPTR(name)); + } + } + else if (args != NIL) + LispDestroy(mac, "%s cannot be a %s argument list, at %s %s", + LispStrObj(mac, args), types[type], fnames[type], + type == LispLambda ? "..." : STRPTR(name)); + + if (type == LispSetf) { + list = CDR(list); + sto = CAR(list); + if (sto->type != LispCons_t) + LispDestroy(mac, "%s is a bad store value, at %s", + LispStrObj(mac, sto), fnames[type]); + for (obj = CAR(sto); obj->type == LispCons_t; obj = CDR(obj)) + if (!SYMBOL_P(CAR(obj)) || STRPTR(CAR(obj))[0] == ':') + LispDestroy(mac, "%s cannot be a variable name, at %s", + LispStrObj(mac, CAR(obj)), fnames[type]); + args = CONS(args, sto); + } + + /* code */ + code = CDR(list); + + GCProtect(); + fun = LispNewLambda(mac, name, args, code, num_args, type, + key, optional, rest); + GCUProtect(); + + if (type == LispSetf) + LispSetAtomSetfProperty(mac, name->data.atom, fun); + else if (type != LispLambda) { + if (name->data.atom->property) { + if ((name->data.atom->property->function || + name->data.atom->property->builtin)) + fprintf(lisp_stderr, "*** Warning: %s is being redefined\n", + STRPTR(name)); + + if (name->data.atom->property->builtin) + LispRemAtomBuiltinProperty(mac, name->data.atom); + } + LispSetAtomFunctionProperty(mac, name->data.atom, fun); + } + + return (type != LispLambda ? name : fun); +} + +static LispObj * +_LispReallyDo(LispMac *mac, LispObj *list, char *fname, int refs) +{ + LispObj *old_frm, *old_env, *env, *res, *args, *test, *body, *obj; + + env = res = NIL; + old_frm = FRM; + old_env = ENV; + args = CAR(list); + test = CAR(CDR(list)); + body = CDR(CDR(list)); + + if (test->type != LispCons_t) + LispDestroy(mac, "end test condition must be a list, at %s", + LispStrObj(mac, args), fname); + + /* Add variables */ + if (args != NIL && args->type != LispCons_t) + LispDestroy(mac, "%s is not of type list, at %s", + LispStrObj(mac, args), fname); + + for (obj = args; obj != NIL; obj = CDR(obj)) { + LispObj *var, *val, *step; + + var = val = NIL; + step = NULL; + list = CAR(obj); + if (SYMBOL_P(list)) + var = list; + else if (list->type != LispCons_t) + LispDestroy(mac, "%s is not of type list, at %s", + LispStrObj(mac, list), fname); + else { + if ((var = CAR(list))->type != LispAtom_t) + LispDestroy(mac, "%s is invalid as a variable name, at %s", + LispStrObj(mac, var), fname); + if ((list = CDR(list)) != NIL) { + val = EVAL(CAR(list)); + if ((list = CDR(list)) != NIL) + step = CAR(list); + } + } + GCProtect(); + if (step) + list = CONS(var, CONS(val, CONS(step, NIL))); + else + list = CONS(var, CONS(val, NIL)); + if (env == NIL) { + env = CONS(list, NIL); + FRM = CONS(env, FRM); + } + else { + CDR(env) = CONS(CAR(env), CDR(env)); + CAR(env) = list; + } + GCUProtect(); + if (refs) + LispAddVar(mac, var, val); + } + + /* Need to update CAR(FRM) or will run loop without gc protection! */ + env = CAR(FRM) = LispReverse(env); + if (!refs) { + for (obj = env; obj != NIL; obj = CDR(obj)) { + list = CAR(obj); + LispAddVar(mac, CAR(list), CAR(CDR(list))); + } + } + + /* Execute iterations */ + for (;;) { + if (EVAL(CAR(test)) != NIL) { + if (CDR(test) != NIL) + res = EVAL(CAR(CDR(test))); + break; + } + (void)Lisp_Progn(mac, body, fname); + /* Update variables */ + for (obj = env; obj != NIL; obj = CDR(obj)) { + list = CAR(obj); + if (CDR(CDR(list)) != NIL) + LispSetVar(mac, CAR(list), + EVAL(CAR(CDR(CDR(list))))); + } + } + + ENV = old_env; + FRM = old_frm; + + return (res); +} + +LispObj * +_LispDo(LispMac *mac, LispObj *list, char *fname, int refs) +{ + int did_jump, *pdid_jump = &did_jump; + LispObj *res, **pres = &res; + LispBlock *block; + + *pres = NIL; + *pdid_jump = 1; + block = LispBeginBlock(mac, NIL, LispBlockTag); + if (setjmp(block->jmp) == 0) { + *pres = _LispReallyDo(mac, list, fname, refs); + *pdid_jump = 0; + } + LispEndBlock(mac, block); + if (*pdid_jump) + *pres = mac->block.block_ret; + + return (*pres); +} + +static LispObj * +_LispReallyDoListTimes(LispMac *mac, LispObj *list, char *fname, int times) +{ + double count = 0.0; + LispObj *var, *val = NIL, *res = NIL, *body, *old_frm, *old_env; + + /* Parse arguments */ + if (CAR(list)->type != LispCons_t) + LispDestroy(mac, "expecting list, at %s", fname); + body = CDR(list); + list = CAR(list); + if ((var = CAR(list))->type != LispAtom_t) + LispDestroy(mac, "%s is invalid as a variable name, at %s", + LispStrObj(mac, var), fname); + list = CDR(list); + + /* Save environment */ + old_frm = FRM; + old_env = ENV; + + if (list == NIL) { + if (!times) + val = res = NIL; + else + LispDestroy(mac, "NIL is not a number, at %s", fname); + } + else { + if (list->type == LispCons_t) { + val = CAR(list); + list = CDR(list); + if (list == NIL) + res = NIL; + else if (list->type == LispCons_t) + res = CAR(list); + else + LispDestroy(mac, "expecting list, at %s", fname); + } + else + LispDestroy(mac, "%s is not a list, at %s", + LispStrObj(mac, val), fname); + + val = EVAL(val); + + if (times && (!INTEGER_P(val))) + LispDestroy(mac, "%s is not an integer, at %s", + LispStrObj(mac, val), fname); + else if (!times && (val != NIL && val->type != LispCons_t)) + LispDestroy(mac, "%s is not a list, at %s", + LispStrObj(mac, val), fname); + } + + /* Protect iteration control from gc */ + FRM = CONS(val, FRM); + + /* Initialize counter */ + if (times) + LispAddVar(mac, var, REAL(count)); + else + LispAddVar(mac, var, CAR(val)); + + /* Execute iterations */ + for (;;) { + /* Check loop */ + if (times) { + if ((count += 1.0) > NUMBER_VALUE(val)) + break; + } + else if (val == NIL) + break; + + (void)Lisp_Progn(mac, body, fname); + + /* Update variables */ + if (times) + LispSetVar(mac, var, REAL(count)); + else { + val = CDR(val); + if (val == NIL) + break; + else if (val->type != LispCons_t) + LispDestroy(mac, "true list required, at %s", fname); + LispSetVar(mac, var, CAR(val)); + } + } + + ENV = old_env; + FRM = old_frm; + + return (res == NIL ? NIL : EVAL(res)); +} + +LispObj * +_LispDoListTimes(LispMac *mac, LispObj *list, char *fname, int times) +{ + int did_jump, *pdid_jump = &did_jump; + LispObj *res, **pres = &res; + LispBlock *block; + + *pres = NIL; + *pdid_jump = 1; + block = LispBeginBlock(mac, NIL, LispBlockTag); + if (setjmp(block->jmp) == 0) { + *pres = _LispReallyDoListTimes(mac, list, fname, times); + *pdid_jump = 0; + } + LispEndBlock(mac, block); + if (*pdid_jump) + *pres = mac->block.block_ret; + + return (*pres); +} + +LispObj * +_LispSet(LispMac *mac, LispObj *var, LispObj *val, char *fname, int eval) +{ + char *name; + + if (!SYMBOL_P(var)) + LispDestroy(mac, "%s is not a symbol, at %s", + LispStrObj(mac, var), fname); + + name = STRPTR(var); + if (isdigit(name[0]) || name[0] == '(' || name[0] == ')' + || name[0] == ';' || name[0] == '\'' || name[0] == '#') + LispDestroy(mac, "bad name %s, at %s", name, fname); + if (eval) + val = EVAL(val); + + return (LispSetVar(mac, var, val)); +} + +LispObj * +_LispWhenUnless(LispMac *mac, LispObj *list, int op) +{ + LispObj *obj, *res = NIL; + + obj = EVAL(CAR(list)); + if ((obj->type == LispNil_t) ^ op) { + for (obj = CDR(list); obj != NIL; obj = CDR(obj)) + res = EVAL(CAR(obj)); + } + return (res); +} + +LispObj * +_LispWhileUntil(LispMac *mac, LispObj *list, int op) +{ + LispObj *obj, *res = NIL; + + /*CONSTCOND*/ + while (1) { + obj = EVAL(CAR(list)); + if ((obj->type == LispNil_t) ^ op) { + for (obj = CDR(list); obj != NIL; obj = CDR(obj)) + res = EVAL(CAR(obj)); + } + else + break; + } + return (res); +} + +LispObj * +_LispLoadFile(LispMac *mac, char *filename, char *fname, + int verbose, int print, int ifdoesnotexist) +{ + LispObj *obj, *res = NIL; + FILE *fp; + int ch, level; + + if ((fp = fopen(filename, "r")) == NULL) { + if (ifdoesnotexist) + LispDestroy(mac, "cannot open %s, at %s", filename, fname); + return (NIL); + } + + if (verbose) + fprintf(lisp_stderr, "; Loading %s\n", filename); + + if (mac->stream.stream_level + 1 >= mac->stream.stream_size) { + LispStream *stream = (LispStream*) + realloc(mac->stream.stream, sizeof(LispStream) * + (mac->stream.stream_size + 1)); + + if (stream == NULL) { + fclose(fp); + LispDestroy(mac, "out of memory"); + } + + mac->stream.stream = stream; + ++mac->stream.stream_size; + } + mac->stream.stream[mac->stream.stream_level].fp = mac->fp; + mac->stream.stream[mac->stream.stream_level].st = mac->st; + mac->stream.stream[mac->stream.stream_level].cp = mac->cp; + mac->stream.stream[mac->stream.stream_level].tok = mac->tok; + ++mac->stream.stream_level; + memset(mac->stream.stream + mac->stream.stream_level, 0, sizeof(LispStream)); + mac->stream.stream[mac->stream.stream_level].fp = fp; + mac->fp = fp; + mac->st = mac->cp = NULL; + mac->tok = 0; + + level = mac->level; + mac->level = 0; + + ch = LispGet(mac); + if (ch != '#') + LispUnget(mac); + else if (LispGet(mac) == '!') { + for (;;) { + ch = LispGet(mac); + if (ch == '\n' || ch == EOF) + break; + } + } + else { + LispUnget(mac); + LispUnget(mac); + } + + /*CONSTCOND*/ + while (1) { + if ((obj = LispRun(mac)) != NULL) { + if (obj == EOLIST) + LispDestroy(mac, "object cannot start with #\\)"); + res = EVAL(obj); + if (print) + LispPrint(mac, res, NIL, 1); + } + if (mac->tok == EOF) + break; + } + mac->level = level; + free(mac->st); + --mac->stream.stream_level; + + mac->fp = mac->stream.stream[mac->stream.stream_level].fp; + mac->st = mac->stream.stream[mac->stream.stream_level].st; + mac->cp = mac->stream.stream[mac->stream.stream_level].cp; + mac->tok = mac->stream.stream[mac->stream.stream_level].tok; + + return (res); +} + +void +_LispGetStringArgs(LispMac *mac, LispObj *list, char *fname, + char **string1, char **string2, + int *start1, int *end1, int *start2, int *end2) +{ + int len1, len2; + LispObj *lstring1, *lstring2, *lstart1, *lend1, *lstart2, *lend2; + + lstring1 = CAR(list); + list = CDR(list); + lstring2 = CAR(list); + if ((!STRING_P(lstring1) && !SYMBOL_P(lstring1)) || + (!STRING_P(lstring2) && !SYMBOL_P(lstring2))) + LispDestroy(mac, "expecting string, at %s", fname); + + *string1 = STRPTR(lstring1); + *string2 = STRPTR(lstring2); + + LispGetKeys(mac, fname, "START1:END1:START2:END2", CDR(list), + &lstart1, &lend1, &lstart2, &lend2); + + if ((lstart1 != NIL && !INDEX_P(lstart1)) || + (lend1 != NIL && !INDEX_P(lend1)) || + (lstart2 != NIL && !INDEX_P(lstart2)) || + (lend2 != NIL && !INDEX_P(lend2))) + LispDestroy(mac, "expecting positive integer, at %s", fname); + + len1 = strlen(*string1); + *start1 = lstart1 == NIL ? 0 : NUMBER_VALUE(lstart1); + *end1 = lend1 == NIL ? len1 : NUMBER_VALUE(lend1); + len2 = strlen(*string2); + *start2 = lstart2 == NIL ? 0 : NUMBER_VALUE(lstart2); + *end2 = lend2 == NIL ? len2 : NUMBER_VALUE(lend2); + + if (*start1 > *end1 || *end1 > len1 || *start2 > *end2 || *end2 > len2) + LispDestroy(mac, "bad string index, at %s", fname); +} + +void +_LispGetStringCaseArgs(LispMac *mac, LispObj *list, char *fname, + char **string, int *start, int *end) +{ + int len; + LispObj *lstring, *lstart, *lend; + + lstring = CAR(list); + if (!STRING_P(lstring) && !SYMBOL_P(lstring)) + LispDestroy(mac, "expecting string, at %s", fname); + + *string = STRPTR(lstring); + + LispGetKeys(mac, fname, "START:END", CDR(list), &lstart, &lend); + + if ((lstart != NIL && !INDEX_P(lstart)) || + (lend != NIL && !INDEX_P(lend))) + LispDestroy(mac, "expecting positive integer, at %s", fname); + + len = strlen(*string); + *start = lstart == NIL ? 0 : NUMBER_VALUE(lstart); + *end = lend == NIL ? len : NUMBER_VALUE(lend); + + if (*start > *end || *end > len) + LispDestroy(mac, "bad string index, at %s", fname); +} + +LispObj * +_LispStringDoTrim(LispMac *mac, LispObj *list, char *fname, int left, int right) +{ + char *str; + int start, end, sstart, send, len; + LispObj *chars, *string; + + chars = CAR(list); + if (!STRING_P(chars) && chars->type != LispCons_t) + LispDestroy(mac, "%s is not a sequence, at %s", + LispStrObj(mac, chars), fname); + string = CAR(CDR(list)); + if (!STRING_P(string) && !SYMBOL_P(string)) + LispDestroy(mac, "expecting string, at %s", fname); + + sstart = start = 0; + send = end = strlen(STRPTR(string)); + + if (STRING_P(chars)) { + char *cmp; + + if (left) { + for (str = STRPTR(string); *str; str++) { + for (cmp = STRPTR(chars); *cmp; cmp++) + if (*str == *cmp) + break; + if (*cmp == '\0') + break; + ++start; + } + } + if (right) { + for (str = STRPTR(string) + end - 1; end > 0; str--) { + for (cmp = STRPTR(chars); *cmp; cmp++) + if (*str == *cmp) + break; + if (*cmp == '\0') + break; + --end; + } + } + } + else { + LispObj *obj; + + if (left) { + for (str = STRPTR(string); *str; str++) { + for (obj = chars; obj != NIL; obj = CDR(obj)) + /* Should really ignore non character input ? */ + if (CAR(obj)->type == LispCharacter_t && + *str == CAR(obj)->data.integer) + break; + if (obj == NIL) + break; + ++start; + } + } + if (right) { + for (str = STRPTR(string) + end - 1; end > 0; str--) { + for (obj = chars; obj != NIL; obj = CDR(obj)) + /* Should really ignore non character input ? */ + if (CAR(obj)->type == LispCharacter_t && + *str == CAR(obj)->data.integer) + break; + if (obj == NIL) + break; + --end; + } + } + } + + if (sstart == start && send == end) + return (string); + + len = end - start; + str = LispMalloc(mac, len + 1); + strncpy(str, STRPTR(string) + start, len); + str[len] = '\0'; + + string = STRING(str); + LispFree(mac, str); + + return (string); +} Index: xc/programs/xedit/lisp/helper.h diff -u /dev/null xc/programs/xedit/lisp/helper.h:1.3 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/helper.h Mon Oct 15 03:05:52 2001 @@ -0,0 +1,190 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/helper.h,v 1.3 2001/10/15 07:05:52 paulo Exp $ */ + +#ifndef Lisp_helper_h +#define Lisp_helper_h + +#include "private.h" + +/* + * Defines + */ +#define LESS 0 +#define LESS_EQUAL 1 +#define EQUAL 2 +#define GREATER 3 +#define GREATER_EQUAL 4 +#define NOT_EQUAL 5 + +/* + * Prototypes + */ +/* + (do ({(var [init [step]])}*) + (end-test {result}*) + {declaration}* {tag | statement}*) + (do* ({(var [init [step]])}*) + (end-test {result}*) + {declaration}* {tag | statement}*) + */ +LispObj *_LispDo(LispMac*, LispObj*, char*, int); + +/* + (dolist (var listform [resultform]) + {declaration}* {tag | statement}*) + (dotimes (var countform [resultform]) + {declaration}* {tag | statement}*) + */ +LispObj *_LispDoListTimes(LispMac*, LispObj*, char*, int); + +/* + (equal x y) + * called directly by several functions */ +LispObj *_LispEqual(LispMac*, LispObj*, LispObj*); + +/* + (nth n list) + (nthcdr n list) + */ +LispObj *_LispNth(LispMac*, LispObj*, char*, int); + +/* When no <setf-place> is set, this function searchs for the one */ +LispObj *_LispFindPlace(LispMac*, LispObj*, LispObj*); + +/* + (min number &rest more-numbers) + (max number &rest more-numbers) + */ +LispObj *_LispMinMax(LispMac*, LispObj*, char*, int); + +/* + (< number &rest more-numbers) + (<= number &rest more-numbers) + (= number &rest more-numbers) + (> number &rest more-numbers) + (>= number &rest more-numbers) + */ +LispObj *_LispBoolCond(LispMac*, LispObj*, char*, int); + +/* + (char< character &rest more-characters) + (char<= character &rest more-characters) + (char= character &rest more-characters) + (char> character &rest more-characters) + (char>= character &rest more-characters) + (char/= character &rest more-characters) + (char-equal character &rest more-characters) + (char-not-equal character &rest more-characters) + (char-lessp character &rest more-characters) + (char-greaterp character &rest more-characters) + (char-not-lessp character &rest more-characters) + (char-not-greaterp character &rest more-characters) + */ +LispObj *_LispCharBoolCond(LispMac*, LispObj*, char*, int, int); + +/* + (defmacro name lambda-list [[ {declaration}* | doc-string ]] {form}*) + (defun name lambda-list [[ {declaration}* | doc-string ]] {form}*) + (lambda lambda-list {declaration | doc-string}* {form}*) + * doc-string not yet implemented + */ +LispObj *_LispDefLambda(LispMac*, LispObj*, LispFunType); + +/* + (set symbol value) + (setq {var form}*) + * used also by setf when creating a new symbol + * XXX current setq implementation expects only 2 arguments + */ +LispObj *_LispSet(LispMac*, LispObj*, LispObj*, char*, int); + +/* + (when test {form}*) + (unless test {form}*) + */ +LispObj *_LispWhenUnless(LispMac*, LispObj*, int); + +/* + (while test {form}*) + (until test {form}*) + * XXX emacs identical code, should be rewritten to be just a test + * condition of (loop) + */ +LispObj *_LispWhileUntil(LispMac*, LispObj*, int); + +/* + * Load and execute a file. Used by (load) and (require) + */ +LispObj *_LispLoadFile(LispMac*, char*, char*, int, int, int); + +/* + (string= string1 string2 &key :start1 :end1 :start2 :end2) + (string< string1 string2 &key :start1 :end1 :start2 :end2) + (string> string1 string2 &key :start1 :end1 :start2 :end2) + (string<= string1 string2 &key :start1 :end1 :start2 :end2) + (string>= string1 string2 &key :start1 :end1 :start2 :end2) + (string/= string1 string2 &key :start1 :end1 :start2 :end2) + (string-equal string1 string2 &key :start1 :end1 :start2 :end2) + (string-lessp string1 string2 &key :start1 :end1 :start2 :end2) + (string-greaterp string1 string2 &key :start1 :end1 :start2 :end2) + (string-not-lessp string1 string2 &key :start1 :end1 :start2 :end2) + (string-not-greaterp string1 string2 &key :start1 :end1 :start2 :end2) + (string-not-equal string1 string2 &key :start1 :end1 :start2 :end2) +*/ +void _LispGetStringArgs(LispMac*, LispObj*, char*, + char**, /* string1 */ + char**, /* string2 */ + int*, /* start1 */ + int*, /* end1 */ + int*, /* start2 */ + int*); /* end2 */ + +/* + (string-trim character-bag string) + (string-left-trim character-bag string) + (string-right-trim character-bag string) +*/ +LispObj *_LispStringDoTrim(LispMac*, LispObj*, char*, int, int); + +/* + (string-upcase string &key :start :end) + (string-downcase string &key :start :end) + (string-capitalize string &key :start :end) +*/ +void _LispGetStringCaseArgs(LispMac*, LispObj*, char*, char**, int*, int*); + +/* + * Initialization + */ +extern char *ExpectingListAt; +extern char *ExpectingNumberAt; + +#endif /* Lisp_helper_h */ Index: xc/programs/xedit/lisp/internal.h diff -u /dev/null xc/programs/xedit/lisp/internal.h:1.11 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/internal.h Fri Oct 19 20:19:34 2001 @@ -0,0 +1,267 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/internal.h,v 1.11 2001/10/20 00:19:34 paulo Exp $ */ + +#ifndef Lisp_internal_h +#define Lisp_internal_h + +#include <stdio.h> +#include "lisp.h" + +/* + * Defines + */ +#define CAR(list) ((list)->data.cons.car) +#define CAAR(list) ((list)->data.cons.car->data.cons.car) +#define CADR(list) ((list)->data.cons.cdr->data.cons.car) +#define CDR(list) ((list)->data.cons.cdr) +#define CDAR(list) ((list)->data.cons.car->data.cons.cdr) +#define CONS(car, cdr) LispNewCons(mac, car, cdr) +#define EVAL(list) LispEval(mac, list) +#define ATOM(atom) LispNewAtom(mac, atom) +#define ATOM2(atom) LispNewAtom(mac, LispGetString(mac, atom)) +#define QUOTE(quote) LispNewQuote(mac, quote) +#define BACKQUOTE(bquote) LispNewBackquote(mac, bquote) +#define COMMA(comma, at) LispNewComma(mac, comma, at) +#define REAL(num) LispNewReal(mac, num) +#define STRING(str) LispNewString(mac, str) +#define CHAR(c) LispNewCharacter(mac, c) +#define INTEGER(i) LispNewInteger(mac, i) +#define OPAQUE(data, type) LispNewOpaque(mac, (void*)((long)data), type) +#define CHECKO(obj, typ) \ + (obj)->type == LispOpaque_t && \ + ((obj)->data.opaque.type == typ || (obj)->data.opaque.type == 0) +#define PROTECT(key, list) LispProtect(mac, key, list) +#define UPROTECT(key, list) LispUProtect(mac, key, list) + +#define GCProtect() ++gcpro +#define GCUProtect() --gcpro + +#define STRPTR(obj) (obj)->data.atom->string + +#define NUMBER_P(obj) \ + ((obj)->type == LispReal_t || (obj)->type == LispInteger_t) + +/* assumes NUMBER_P is true */ +#define NUMBER_VALUE(obj) \ + (obj->type == LispReal_t ? obj->data.real : obj->data.integer) + +#define INTEGER_P(obj) \ + ((obj)->type == LispInteger_t || \ + ((obj)->type == LispReal_t && (long)(obj)->data.real == (obj)->data.real)) + +/* positive integer */ +#define INDEX_P(obj) (INTEGER_P(obj) && NUMBER_VALUE(obj) >= 0) + +#define SYMBOL_P(obj) ((obj)->type == LispAtom_t) +#define STRING_P(obj) ((obj)->type == LispString_t) + +/* + * Types + */ +typedef struct _LispObj LispObj; +typedef struct _LispAtom LispAtom; +typedef struct _LispBuiltin LispBuiltin; +typedef struct _LispModuleData LispModuleData; + +typedef enum _LispType { + LispNil_t, + LispTrue_t, + LispAtom_t, + LispInteger_t, + LispReal_t, + LispCons_t, + LispQuote_t, + LispCharacter_t, + LispString_t, + LispLambda_t, + LispArray_t, + LispStruct_t, + LispStream_t, + LispOpaque_t, + LispBackquote_t, + LispComma_t +} LispType; + +typedef enum _LispFunType { + LispLambda, + LispFunction, + LispMacro, + LispSetf +} LispFunType; + +struct _LispObj { + LispType type : 6; + unsigned int mark : 1; /* gc protected */ + unsigned int dirty : 1; + unsigned int prot: 1; /* protection for constant/unamed variables */ + union { + LispAtom *atom; + long integer; + double real; + LispObj *quote; + struct { + LispObj *car; + LispObj *cdr; + } cons; + struct { + LispObj *name; + LispObj *code; + unsigned int num_args : 12; + LispFunType type : 4; + unsigned int key : 1; + unsigned int optional : 1; + unsigned int rest : 1; + } lambda; + struct { + LispObj *list; /* stored as a linear list */ + LispObj *dim; /* dimensions of array */ + unsigned int rank : 8; /* i.e. array-rank-limit => 256 */ + unsigned int type : 7; /* converted to LispType, if not + * Lisp{Nil,True}_t only accepts given + * type in array fields */ + unsigned int zero : 1; /* at least one of the dimensions + * is zero */ + } array; + struct { + LispObj *fields; /* structure fields */ + LispObj *def; /* structure definition */ + } struc; + struct { + union { + FILE *fp; + unsigned char *str; + } source; + int size; /* if smaller than zero, use source.fp */ + int idx; /* index in string */ + } stream; + struct { + void *data; + int type; + } opaque; + struct { + LispObj *eval; + int atlist; + } comma; + } data; +}; + +struct _LispBuiltin { + char *name; + LispObj *(*fn)(LispMac*, LispObj*, char*); + int eval : 1; + int min_args : 15; + int max_args : 15; +}; + +typedef LispObj *(*LispFunPtr)(LispMac*, LispObj*, char*); +typedef int (*LispLoadModule)(LispMac*); +typedef int (*LispUnloadModule)(LispMac*); + +#define LISP_MODULE_VERSION 1 +struct _LispModuleData { + int version; + LispLoadModule load; + LispUnloadModule unload; +}; + +/* + * Prototypes + */ +LispObj *LispEval(LispMac*, LispObj*); + +LispObj *LispNew(LispMac*, LispObj*, LispObj*); +LispObj *LispNewAtom(LispMac*, char*); +LispObj *LispNewReal(LispMac*, double); +LispObj *LispNewString(LispMac*, char*); +LispObj *LispNewCharacter(LispMac*, long); +LispObj *LispNewInteger(LispMac*, long); +LispObj *LispNewQuote(LispMac*, LispObj*); +LispObj *LispNewBackquote(LispMac*, LispObj*); +LispObj *LispNewComma(LispMac*, LispObj*, int); +LispObj *LispNewCons(LispMac*, LispObj*, LispObj*); +LispObj *LispNewSymbol(LispMac*, char*, LispObj*); +LispObj *LispNewLambda(LispMac*, LispObj*, LispObj*, LispObj*, + int, LispFunType, int, int, int); +LispObj *LispNewStruct(LispMac*, LispObj*, LispObj*); +LispObj *LispNewOpaque(LispMac*, void*, int); + +char *LispGetString(LispMac*, char*); + +/* This function does not allocate a copy of it's argument, but the argument + * itself. The argument string should never change. */ +char *LispGetPermString(LispMac*, char*); + +void *LispMalloc(LispMac*, unsigned); +void *LispCalloc(LispMac*, unsigned, unsigned); +void *LispRealloc(LispMac*, void*, unsigned); +char *LispStrdup(LispMac*, char*); +void LispFree(LispMac*, void*); +/* LispMused means memory is now safe from LispDestroy, and should not be + * freed in case of an error */ +void LispMused(LispMac*, void*); + +void LispGC(LispMac*, LispObj*, LispObj*); + +char *LispStrObj(LispMac*, LispObj*); + +void LispDestroy(LispMac *mac, char *fmt, ...); + +LispObj *LispSetVariable(LispMac*, LispObj*, LispObj*, char*, int); + +int LispRegisterOpaqueType(LispMac*, char*); + +int LispPrintf(LispMac*, LispObj*, char*, ...); +int LispPrintString(LispMac*, LispObj*, char*); +int LispPrintObj(LispMac*, LispObj*, LispObj*, int); + +void LispProtect(LispMac*, LispObj*, LispObj*); +void LispUProtect(LispMac*, LispObj*, LispObj*); + +/* search argument list for the specified keys. + * example: LispGetKeys(mac, fname, "START:END", list, &start, &end); + * note that the separator for key names is the ':' character. + * values not present in the argument list get the default value of NIL, + * values specified more than once get only the first specification, + * and if an unknown is on the argument list, a fatal error happens. */ +void LispGetKeys(LispMac*, char*, char*, LispObj*, ...); + +/* this function should be called when a module is loaded, and is called + * when loading the interpreter */ +void LispAddBuiltinFunction(LispMac*, LispBuiltin*); + +/* + * Initialization + */ +extern LispObj *NIL, *T; +extern int gcpro; +extern FILE *lisp_stdin, *lisp_stdout, *lisp_stderr; + +#endif /* Lisp_internal_h */ Index: xc/programs/xedit/lisp/lisp.c diff -u /dev/null xc/programs/xedit/lisp/lisp.c:1.27 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/lisp.c Wed Jan 9 23:29:18 2002 @@ -0,0 +1,3568 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/lisp.c,v 1.27 2002/01/10 04:29:18 dawes Exp $ */ + +#include <stdlib.h> +#include <string.h> +#ifdef sun /* Don't ask.... */ +#include <strings.h> +#endif +#include <ctype.h> +#include <stdarg.h> +#include <signal.h> + +#ifndef X_NOT_POSIX +#include <unistd.h> /* for sysconf(), and getpagesize() */ +#endif + +#if defined(linux) +#include <asm/page.h> /* for PAGE_SIZE */ +#define HAS_GETPAGESIZE +#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */ +#endif + +#if defined(CSRG_BASED) +#define HAS_GETPAGESIZE +#endif + +#if defined(sun) +#define HAS_GETPAGESIZE +#endif + +#if defined(QNX4) +#define HAS_GETPAGESIZE +#endif + +#if defined(__QNXNTO__) +#define HAS_SC_PAGESIZE +#endif + +#include "private.h" + +#include "format.h" +#include "require.h" +#include "struct.h" +#include "time.h" + +/* + * Prototypes + */ +/* run a user function, to be called only by LispEval */ +LispObj *LispRunFunMac(LispMac*, LispObj*, LispObj*); +/* expands and executes a setf method, to be called only by Lisp_Setf */ +LispObj *LispRunSetf(LispMac*, LispObj*, LispObj*, LispObj*); + +/* build argument list, assigning defaults and/or positioning &key arguments + * return value is gc protected, and should be called only by + * LispEval and LispRunSetf + */ +static LispObj *LispBuildArguments(LispMac*, LispObj*, LispObj*, + char*, int); + +/* build argument list for builtin functions or functions that don't have + * any of the &some-name special parameters. + * return value is gc protected, and should be called only by + * LispEval and LispRunSetf + */ +static LispObj *LispBuildSimpleArguments(LispMac*, LispObj*, + char*, int, int, int); + +int LispGet(LispMac*); +int LispUnget(LispMac*); +static int LispSkipComment(LispMac*); +static int LispSkipWhiteSpace(LispMac*); +static char *LispIntToOpaqueType(LispMac*, int); +static LispObj *LispEvalBackquote(LispMac*, LispObj*); + +static LispProperty *LispAllocAtomProperty(LispMac*); + + /* if no properties remaining, free atom->property, + * and this way, make string candidate to gc */ +static void LispCheckAtomProperty(LispMac*, LispAtom*); + +static LispObj *LispDoGetAtomProperty(LispMac*, LispAtom*, LispObj*, int); + + +void LispSnprint(LispMac*, LispObj*, char*, int); +void LispSnprintObj(LispMac*, LispObj*, char**, int*, int); + +void LispCheckMemLevel(LispMac*); + +void LispAllocSeg(LispMac*); +void LispMark(LispObj*); + +#ifdef SIGNALRETURNSINT +int LispAbortSignal(int); +int LispFPESignal(int); +#else +void LispAbortSignal(int); +void LispFPESignal(int); +#endif + +static int GetPageSize(void); + +/* + * Initialization + */ +static LispObj lispnil = {LispNil_t}; +static LispObj lispt = {LispTrue_t}; +static LispObj lispdot = {LispAtom_t}; +LispObj *NIL = &lispnil, *T = &lispt; +static LispObj *DOT = &lispdot; +static LispObj **objseg, *freeobj = &lispnil; +static int pagesize, segsize, numseg; +static int nfree, nobjs; +int gcpro; + +char *ExpectingListAt = "expecting list, at %s"; +char *ExpectingNumberAt = "expecting number, at %s"; +FILE *lisp_stdin, *lisp_stdout, *lisp_stderr; + +char *LispCharNames[] = { +"Null", "Soh", "Stx", "Etx", +"Eot", "Enq", "Ack", "Bel", +"Backspace", "Tab", "Newline", "Vt", +"Page", "Return", "So", "Si", +"Dle", "Dc1", "Dc2", "Dc3", +"Dc4", "Nak", "Syn", "Etb", +"Can", "Em", "Sub", "Escape", +"Fs", "Gs", "Rs", "Us", +"Space" +}; + +static LispBuiltin lispbuiltins[] = { + {"*", Lisp_Mul, 1, 0, 0,}, + {"+", Lisp_Plus, 1, 0, 0,}, + {"-", Lisp_Minus, 1, 1, 0,}, + {"/", Lisp_Div, 1, 1, 0,}, + {"1+", Lisp_OnePlus, 1, 1, 1,}, + {"1-", Lisp_OneMinus, 1, 1, 1,}, + {"<", Lisp_Less, 0, 1, 0,}, + {"<=", Lisp_LessEqual, 0, 1, 0,}, + {"=", Lisp_Equal_, 0, 1, 0,}, + {">", Lisp_Greater, 0, 1, 0,}, + {">=", Lisp_GreaterEqual, 0, 1, 0,}, + {"/=", Lisp_NotEqual, 1, 1, 0,}, + {"APPEND", Lisp_Append, 0, 0, 0,}, + {"APPLY", Lisp_Apply, 0, 2, 0,}, + {"AND", Lisp_And, 0, 0, 0,}, + {"AREF", Lisp_Aref, 1, 2, 0,}, + {"ASSOC", Lisp_Assoc, 1, 2, 2,}, + {"ATOM", Lisp_Atom, 1, 0, 1,}, + {"BLOCK", Lisp_Block, 0, 1, 0,}, + {"BUTLAST", Lisp_Butlast, 1, 1, 2,}, + {"CAR", Lisp_Car, 1, 1, 1,}, + {"CASE", Lisp_Case, 0, 1, 0,}, + {"CATCH", Lisp_Catch, 0, 1, 0,}, + {"CDR", Lisp_Cdr, 1, 1, 1,}, + {"CHAR", Lisp_Char, 1, 2, 2,}, + {"SCHAR", Lisp_Char, 1, 2, 2,}, + {"CHAR<", Lisp_CharLess, 0, 1, 0,}, + {"CHAR<=", Lisp_CharLessEqual, 0, 1, 0,}, + {"CHAR=", Lisp_CharEqual_, 0, 1, 0,}, + {"CHAR>", Lisp_CharGreater, 0, 1, 0,}, + {"CHAR>=", Lisp_CharGreaterEqual, 0, 1, 0,}, + {"CHAR/=", Lisp_CharNotEqual_, 1, 1, 0,}, + {"CHAR-LESSP", Lisp_CharLessp, 0, 1, 0,}, + {"CHAR-NOT-GREATERP", Lisp_CharNotGreaterp, 0, 1, 0,}, + {"CHAR-EQUAL", Lisp_CharEqual, 0, 1, 0,}, + {"CHAR-GREATERP", Lisp_CharGreaterp, 0, 1, 0,}, + {"CHAR-NOT-LESSP", Lisp_CharNotLessp, 0, 1, 0,}, + {"CHAR-NOT-EQUAL", Lisp_CharNotEqual, 1, 1, 0,}, + {"CHAR-DOWNCASE", Lisp_CharDowncase, 1, 1, 1,}, + {"CHAR-INT", Lisp_CharInt, 1, 1, 1,}, + {"CHAR-UPCASE", Lisp_CharUpcase, 1, 1, 1,}, + {"CHARACTER", Lisp_Character, 1, 1, 1,}, + {"COERCE", Lisp_Coerce, 1, 2, 2,}, + {"COND", Lisp_Cond, 0, 0, 0,}, + {"CONS", Lisp_Cons, 1, 2, 2,}, + {"DECF", Lisp_Decf, 0, 1, 2,}, + {"DEFMACRO", Lisp_Defmacro, 0, 2, 0,}, + {"DEFSTRUCT", Lisp_Defstruct, 0, 1, 0,}, + {"DEFUN", Lisp_Defun, 0, 2, 0,}, + {"DEFSETF", Lisp_Defsetf, 0, 2, 0,}, + {"DO", Lisp_Do, 0, 2, 0,}, + {"DO*", Lisp_DoP, 0, 2, 0,}, + {"DOLIST", Lisp_DoList, 0, 1, 0,}, + {"DOTIMES", Lisp_DoTimes, 0, 1, 0,}, + {"ELT", Lisp_Elt, 1, 2, 2,}, + {"ENDP", Lisp_Null, 1, 1, 1,}, + {"EQUAL", Lisp_Equal, 1, 2, 2,}, + {"ERROR", Lisp_Error, 1, 1, 0,}, + {"EVAL", Lisp_Eval, 1, 1, 1,}, + {"EVENP", Lisp_Evenp, 1, 1, 1,}, + {"FIRST", Lisp_Car, 1, 1, 1,}, + {"FMAKUNBOUND", Lisp_FMakunbound, 1, 1, 1,}, + {"FORMAT", Lisp_Format, 1, 2, 0,}, + {"FUNCALL", Lisp_Funcall, 0, 1, 0,}, + {"GC", Lisp_Gc, 1, 0, 0,}, + {"GET", Lisp_Get, 1, 2, 3,}, + {"GO", Lisp_Go, 0, 1, 1,}, + {"IF", Lisp_If, 0, 2, 3,}, + {"INCF", Lisp_Incf, 0, 1, 2,}, + {"INT-CHAR", Lisp_IntChar, 1, 1, 1,}, + {"INTEGERP", Lisp_Integerp, 1, 1, 1,}, + {"LAST", Lisp_Last, 1, 1, 0,}, + {"LAMBDA", Lisp_Lambda, 0, 1, 0,}, + {"LENGTH", Lisp_Length, 1, 1, 1,}, + {"LET", Lisp_Let, 0, 1, 0,}, + {"LET*", Lisp_LetP, 0, 1, 0,}, + {"LIST", Lisp_List, 1, 0, 0,}, + {"LIST*", Lisp_ListP, 0, 1, 0,}, + {"LISTP", Lisp_Listp, 1, 1, 1,}, + {"LOAD", Lisp_Load, 1, 1, 0,}, + {"LOOP", Lisp_Loop, 0, 0, 0,}, + {"MAKE-ARRAY", Lisp_Makearray, 1, 1, 0,}, + {"MAKE-LIST", Lisp_Makelist, 1, 1, 3,}, + {"MAKUNBOUND", Lisp_Makunbound, 1, 1, 1,}, + {"MAPCAR", Lisp_Mapcar, 0, 2, 0,}, + {"MAX", Lisp_Max, 0, 1, 0,}, + {"MEMBER", Lisp_Member, 1, 2, 2,}, + {"MIN", Lisp_Min, 0, 1, 0,}, + {"MINUSP", Lisp_Minusp, 1, 1, 1,}, + {"NOT", Lisp_Null, 1, 0, 1,}, + {"NTH", Lisp_Nth, 1, 2, 2,}, + {"NTHCDR", Lisp_Nthcdr, 1, 2, 2,}, + {"NULL", Lisp_Null, 1, 0, 1,}, + {"NUMBERP", Lisp_Numberp, 1, 1, 1,}, + {"ODDP", Lisp_Oddp, 1, 1, 1,}, + {"OR", Lisp_Or, 0, 0, 0,}, + {"PLUSP", Lisp_Plusp, 1, 1, 1,}, + {"PRIN1", Lisp_Prin1, 1, 1, 2,}, + {"PRINC", Lisp_Princ, 1, 1, 2,}, + {"PRINT", Lisp_Print, 1, 1, 2,}, + {"PROG1", Lisp_Prog1, 0, 1, 0,}, + {"PROG2", Lisp_Prog2, 0, 2, 0,}, + {"PROGN", Lisp_Progn, 0, 0, 0,}, + {"PROGV", Lisp_Progv, 0, 2, 0,}, + {"PROVIDE", Lisp_Provide, 1, 1, 1,}, + {"QUIT", Lisp_Quit, 1, 0, 1,}, + {"QUOTE", Lisp_Quote, 0, 1, 1,}, + {"READ", Lisp_Read, 1, 0, 0,}, + {"REPLACE", Lisp_Replace, 1, 2, 10,}, + {"READ-FROM-STRING", Lisp_ReadFromString, 1, 1, 9,}, + {"REQUIRE", Lisp_Require, 1, 1, 2,}, + {"REST", Lisp_Cdr, 1, 1, 1,}, + {"RETURN", Lisp_Return, 0, 0, 1,}, + {"RETURN-FROM", Lisp_ReturnFrom, 0, 1, 2,}, + {"REVERSE", Lisp_Reverse, 1, 1, 1,}, + {"RPLACA", Lisp_Rplaca, 1, 2, 2,}, + {"RPLACD", Lisp_Rplacd, 1, 2, 2,}, + {"SET", Lisp_Set, 1, 2, 0,}, + {"SETF", Lisp_Setf, 0, 2, 0,}, + {"SETQ", Lisp_SetQ, 0, 2, 0,}, + {"STRING", Lisp_String, 1, 1, 1,}, + {"STRINGP", Lisp_Stringp, 1, 1, 1,}, + {"STRING=", Lisp_StringEqual_, 1, 2, 11,}, + {"STRING<", Lisp_StringLess, 1, 2, 11,}, + {"STRING>", Lisp_StringGreater, 1, 2, 11,}, + {"STRING<=", Lisp_StringLessEqual, 1, 2, 11,}, + {"STRING>=", Lisp_StringGreaterEqual, 1, 2, 11,}, + {"STRING/=", Lisp_StringNotEqual_, 1, 2, 11,}, + {"STRING-EQUAL", Lisp_StringEqual, 1, 2, 11,}, + {"STRING-GREATERP", Lisp_StringGreaterp, 1, 2, 11,}, + {"STRING-NOT-EQUAL", Lisp_StringNotEqual, 1, 2, 11,}, + {"STRING-NOT-GREATERP", Lisp_StringNotGreaterp, 1, 2, 11,}, + {"STRING-NOT-LESSP", Lisp_StringNotLessp, 1, 2, 11,}, + {"STRING-LESSP", Lisp_StringLessp, 1, 2, 11,}, + {"STRING-TRIM", Lisp_StringTrim, 1, 2, 2,}, + {"STRING-LEFT-TRIM", Lisp_StringLeftTrim, 1, 2, 2,}, + {"STRING-RIGHT-TRIM", Lisp_StringRightTrim, 1, 2, 2,}, + {"STRING-UPCASE", Lisp_StringUpcase, 1, 1, 5,}, + {"STRING-DOWNCASE", Lisp_StringDowncase, 1, 1, 5,}, + {"STRING-CAPITALIZE", Lisp_StringCapitalize, 1, 1, 5,}, + {"SUBSEQ", Lisp_Subseq, 1, 2, 3,}, + {"SYMBOLP", Lisp_Symbolp, 1, 1, 1,}, + {"SYMBOL-PLIST", Lisp_SymbolPlist, 1, 1, 1,}, + {"TAGBODY", Lisp_Tagbody, 0, 0, 0,}, + {"TERPRI", Lisp_Terpri, 1, 0, 1,}, + {"TYPEP", Lisp_Typep, 1, 2, 2,}, + {"THROW", Lisp_Throw, 0, 2, 2,}, + {"TIME", Lisp_Time, 0, 1, 1,}, + {"UNLESS", Lisp_Unless, 0, 1, 0,}, + {"UNTIL", Lisp_Until, 0, 1, 0,}, + {"UNWIND-PROTECT", Lisp_UnwindProtect, 0, 1, 0,}, + {"VECTOR", Lisp_Vector, 1, 0, 0,}, + {"WHEN", Lisp_When, 0, 1, 0,}, + {"WHILE", Lisp_While, 0, 1, 0,}, + {"XEDIT::CHAR-STORE", Lisp_XeditCharStore, 1, 3, 3,}, + {"XEDIT::ELT-STORE", Lisp_XeditEltStore, 1, 3, 3,}, + {"XEDIT::MAKE-STRUCT", Lisp_XeditMakeStruct, 1, 1, 0,}, + {"XEDIT::PUT", Lisp_XeditPut, 1, 3, 3,}, + {"XEDIT::STRUCT-ACCESS", Lisp_XeditStructAccess, 1, 2, 2,}, + {"XEDIT::STRUCT-TYPE", Lisp_XeditStructType, 1, 2, 2,}, + {"XEDIT::STRUCT-STORE", Lisp_XeditStructStore, 1, 3, 3,}, + {"XEDIT::VECTOR-STORE", Lisp_XeditVectorStore, 1, 3, 0,}, + {"ZEROP", Lisp_Zerop, 1, 1, 1,}, +}; + +/* + * Implementation + */ +static int +GetPageSize(void) +{ + static int pagesize = -1; + + if (pagesize != -1) + return pagesize; + + /* Try each supported method in the preferred order */ + +#if defined(_SC_PAGESIZE) || defined(HAS_SC_PAGESIZE) + pagesize = sysconf(_SC_PAGESIZE); +#endif + +#ifdef _SC_PAGE_SIZE + if (pagesize == -1) + pagesize = sysconf(_SC_PAGE_SIZE); +#endif + +#ifdef HAS_GETPAGESIZE + if (pagesize == -1) + pagesize = getpagesize(); +#endif + +#ifdef PAGE_SIZE + if (pagesize == -1) + pagesize = PAGE_SIZE; +#endif + + if (pagesize == -1) + pagesize = 0; + + return pagesize; +} + +void +LispDestroy(LispMac *mac, char *fmt, ...) +{ + if (!mac->destroyed) { + va_list ap; + + if (!mac->newline) + fputc('\n', lisp_stderr); + fprintf(lisp_stderr, "%s", "*** Error: "); + + va_start(ap, fmt); + vfprintf(lisp_stderr, fmt, ap); + va_end(ap); + + fputc('\n', lisp_stderr); + fflush(lisp_stderr); + + mac->column = 0; + mac->newline = 1; + + if (mac->debugging) { + LispDebugger(mac, LispDebugCallWatch, NIL, NIL); + LispDebugger(mac, LispDebugCallFatal, NIL, NIL); + } + + mac->destroyed = 1; + LispBlockUnwind(mac); + if (mac->errexit) + exit(1); + } + + if (mac->debugging) { + /* when stack variables could be changed, this must be also changed! */ + mac->debug_level = -1; + mac->debug = LispDebugUnspec; + } + + while (mac->mem.mem_level) + free(mac->mem.mem[--mac->mem.mem_level]); + + /* panic */ + LispTopLevel(mac); + if (mac->st) { + mac->cp = &(mac->st[strlen(mac->st)]); + mac->tok = 0; + } + + if (!mac->running) { + fprintf(lisp_stderr, "*** Fatal: nowhere to longjmp.\n"); + abort(); + } + + siglongjmp(mac->jmp, 1); +} + +void +LispTopLevel(LispMac *mac) +{ + ENV = GLB; + LEX = COD = FRM = NIL; + if (mac->debugging) { + DBG = NIL; + if (mac->debug == LispDebugFinish) + mac->debug = LispDebugUnspec; + mac->debug_level = -1; + mac->debug_step = 0; + } + gcpro = 0; + mac->block.block_level = 0; + if (mac->block.block_size) { + while (mac->block.block_size) + free(mac->block.block[--mac->block.block_size]); + free(mac->block.block); + mac->block.block = NULL; + } + + mac->destroyed = 0; + mac->princ = mac->justsize = 0; + if (mac->stream.stream_level) { + free(mac->st); + if (mac->stream.stream[mac->stream.stream_level].fp) + fclose(mac->stream.stream[mac->stream.stream_level].fp); + --mac->stream.stream_level; + while (mac->stream.stream_level) { + if (mac->stream.stream[mac->stream.stream_level].fp) + fclose(mac->stream.stream[mac->stream.stream_level].fp); + free(mac->stream.stream[mac->stream.stream_level].st); + --mac->stream.stream_level; + } + mac->fp = mac->stream.stream[0].fp; + mac->st = mac->stream.stream[0].st; + mac->cp = mac->stream.stream[0].cp; + mac->tok = mac->stream.stream[0].tok; + } + if (mac->mem.mem_level) { + fprintf(lisp_stderr, "*** Warning: %d raw memory pointer(s) left. " + "Probably a leak.\n", mac->mem.mem_level); + mac->mem.mem_level = 0; + } + + fflush(lisp_stdout); + fflush(lisp_stderr); +} + +void +LispGC(LispMac *mac, LispObj *car, LispObj *cdr) +{ + LispObj *entry; + unsigned i, j; + LispAtom *atom, *patom, *natom; +#ifdef DEBUG + struct timeval start, end; + long sec, msec; + int count = nfree; + int strings_free = 0; +#endif + + if (gcpro) + return; + +#ifdef DEBUG + fprintf(lisp_stderr, "gc: "); + gettimeofday(&start, NULL); +#endif + + LispMark(MOD); + LispMark(GLB); + LispMark(ENV); + LispMark(COD); + LispMark(FRM); + LispMark(RUN[0]); + LispMark(RUN[1]); + LispMark(RUN[2]); + LispMark(RES[0]); + LispMark(RES[1]); + LispMark(RES[2]); + LispMark(DBG); + LispMark(BRK); + LispMark(PRO); + LispMark(car); + LispMark(cdr); + + /* Make all strings candidate to be released */ + for (i = 0; i < STRTBLSZ; i++) { + atom = mac->strs[i]; + while (atom) { + atom->mark = LispNil_t; + if (atom->property) { + if (atom->property->property) + LispMark(atom->property->properties); + if (atom->property->function) + LispMark(atom->property->fun.function); + if (atom->property->defsetf) + LispMark(atom->property->setf); + if (atom->property->defstruct) + LispMark(atom->property->structure.definition); + } + atom = atom->next; + } + } + + for (j = 0; j < numseg; j++) + for (i = 0, entry = objseg[j]; i < segsize; i++, entry++) { + if (entry->prot) + entry->dirty = entry->mark = LispTrue_t; + else if (entry->mark) + entry->mark = LispNil_t; + else if (entry->dirty) { + if (entry->type == LispStream_t) { + if (entry->data.stream.size < 0) + fclose(entry->data.stream.source.fp); + else + free(entry->data.stream.source.str); + } + CAR(entry) = NIL; + CDR(entry) = freeobj; + freeobj = entry; + entry->dirty = LispNil_t; + ++nfree; + } + } + + /* Needs a new pass because of the 'prot' field of cells. */ + for (j = 0; j < numseg; j++) + for (i = 0, entry = objseg[j]; i < segsize; i++, entry++) { + if (entry->dirty || entry->mark) { + switch (entry->type) { + case LispAtom_t: + case LispString_t: + entry->data.atom->mark = LispTrue_t; + break; + default: + break; + } + } + } + + /* Free unused strings */ + for (i = 0; i < STRTBLSZ; i++) { + patom = atom = mac->strs[i]; + while (atom) { + natom = atom->next; + if (!atom->property && + !atom->prot && atom->mark == LispNil_t) { + /* it is not required to call LispFree here */ + if (!atom->prot) + free(atom->string); + free(atom); + if (patom == atom) + patom = mac->strs[i] = natom; + else + patom->next = natom; +#ifdef DEBUG + ++strings_free; +#endif + } + else + patom = atom; + atom = natom; + } + } + +#ifdef DEBUG + gettimeofday(&end, NULL); + sec = end.tv_sec - start.tv_sec; + msec = end.tv_usec - start.tv_usec; + if (msec < 0) { + --sec; + msec += 1000000; + } + fprintf(lisp_stderr, "%ld sec, %ld msec, ", sec, msec); + fprintf(lisp_stderr, "%d recovered, %d free, %d protected, %d total\n", nfree - count, nfree, nobjs - nfree, nobjs); + fprintf(lisp_stderr, "%d string(s) freed\n", strings_free); +#endif +} + +void +LispCheckMemLevel(LispMac *mac) +{ + if (mac->mem.mem_level + 1 >= mac->mem.mem_size) { + void **ptr = (void**)realloc(mac->mem.mem, + (mac->mem.mem_size + 16) * sizeof(void*)); + + if (ptr == NULL) + LispDestroy(mac, "out of memory"); + mac->mem.mem = ptr; + mac->mem.mem_size += 16; + } +} + +void +LispMused(LispMac *mac, void *pointer) +{ + int i; + + for (i = 0; i < mac->mem.mem_level; i++) + if (mac->mem.mem[i] == pointer) { + --mac->mem.mem_level; + if (mac->mem.mem_level > i) + memmove(mac->mem.mem + i, mac->mem.mem + i + 1, + sizeof(void*) * (mac->mem.mem_level - i)); + break; + } +} + +void * +LispMalloc(LispMac *mac, unsigned size) +{ + void *pointer; + + LispCheckMemLevel(mac); + if ((pointer = malloc(size)) == NULL) + LispDestroy(mac, "out of memory, couldn't allocate %u bytes", size); + + mac->mem.mem[mac->mem.mem_level++] = pointer; + + return (pointer); +} + +void * +LispCalloc(LispMac *mac, unsigned nmemb, unsigned size) +{ + void *pointer; + + LispCheckMemLevel(mac); + if ((pointer = calloc(nmemb, size)) == NULL) + LispDestroy(mac, "out of memory, couldn't allocate %u bytes", size); + + mac->mem.mem[mac->mem.mem_level++] = pointer; + + return (pointer); +} + +void * +LispRealloc(LispMac *mac, void *pointer, unsigned size) +{ + void *ptr; + int i; + + for (i = 0; i < mac->mem.mem_level; i++) + if (mac->mem.mem[i] == pointer) + break; + if (i == mac->mem.mem_level) + LispCheckMemLevel(mac); + + if ((ptr = realloc(pointer, size)) == NULL) + LispDestroy(mac, "out of memory, couldn't realloc"); + + if (i == mac->mem.mem_level) + mac->mem.mem[mac->mem.mem_level++] = ptr; + else + mac->mem.mem[i] = ptr; + + return (ptr); +} + +char * +LispStrdup(LispMac *mac, char *str) +{ + char *ptr = LispMalloc(mac, strlen(str) + 1); + + strcpy(ptr, str); + + return (ptr); +} + +void +LispFree(LispMac *mac, void *pointer) +{ + int i; + + for (i = 0; i < mac->mem.mem_level; i++) + if (mac->mem.mem[i] == pointer) + break; + + /* If the memory was allocated on a previous form, just free it */ + if (i < mac->mem.mem_level) { + memmove(mac->mem.mem + i, mac->mem.mem + i + 1, + sizeof(void*) * (mac->mem.mem_level - i - 1)); + --mac->mem.mem_level; + } + + free(pointer); +} + +LispObj * +LispSetVariable(LispMac *mac, LispObj *var, LispObj *val, char *fname, int eval) +{ + return (_LispSet(mac, var, val, fname, eval)); +} + +int +LispRegisterOpaqueType(LispMac *mac, char *desc) +{ + LispOpaque *opaque; + int ii = 0; + char *pp = desc; + + while (*pp) + ii = (ii << 1) ^ *pp++; + if (ii < 0) + ii = -ii; + ii %= STRTBLSZ; + for (opaque = mac->opqs[ii]; opaque; opaque = opaque->next) + if (strcmp(opaque->desc, desc) == 0) + return (opaque->type); + opaque = (LispOpaque*)LispMalloc(mac, sizeof(LispOpaque)); + opaque->desc = LispDoGetAtom(mac, desc, 1, 0)->string; + opaque->next = mac->opqs[ii]; + mac->opqs[ii] = opaque; + LispMused(mac, opaque); + + return (opaque->type = ++mac->opaque); +} + +static char * +LispIntToOpaqueType(LispMac *mac, int type) +{ + int i; + LispOpaque *opaque; + + if (type) { + for (i = 0; i < STRTBLSZ; i++) { + opaque = mac->opqs[i]; + while (opaque) { + if (opaque->type == type) + return (opaque->desc); + opaque = opaque->next; + } + } + LispDestroy(mac, "Opaque type %d not registered", type); + } + + return ("NIL"); +} + +LispAtom * +LispDoGetAtom(LispMac *mac, char *str, int prot, int perm) +{ + LispAtom *atom; + int ii = 0; + char *pp = str; + + while (*pp) + ii = (ii << 1) ^ *pp++; + if (ii < 0) + ii = -ii; + ii %= STRTBLSZ; + for (atom = mac->strs[ii]; atom; atom = atom->next) + if (strcmp(atom->string, str) == 0) { + if (prot && !atom->prot) + atom->prot = 1; + return (atom); + } + atom = (LispAtom*)LispMalloc(mac, sizeof(LispAtom)); + if (perm) + atom->string = str; + else + atom->string = LispStrdup(mac, str); + LispMused(mac, atom); + if (!perm) + LispMused(mac, atom->string); + atom->property = NULL; + atom->next = mac->strs[ii]; + mac->strs[ii] = atom; + atom->dirty = 1; + atom->mark = 0; + atom->prot = !!prot; + + return (atom); +} + +static LispProperty * +LispAllocAtomProperty(LispMac *mac) +{ + LispProperty *prop = LispCalloc(mac, 1, sizeof(LispProperty)); + + return (prop); +} + +static void +LispCheckAtomProperty(LispMac *mac, LispAtom *atom) +{ + if (atom->property) { + LispProperty *prop = atom->property; + + if (prop->object && prop->value == NULL) + prop->object = 0; + if ((prop->function || prop->builtin) && prop->fun.function == NULL) + prop->function = prop->builtin = 0; + if (prop->property && prop->properties == NULL) + prop->property = 0; + if (prop->defsetf && prop->setf == NULL) + prop->defsetf = 0; + if (prop->defstruct && prop->structure.definition == NULL) + prop->defstruct = 0; + + if (prop->object == 0 && prop->function == 0 && prop->builtin == 0 && + prop->properties == 0 && prop->defsetf == 0 && + prop->defstruct == 0) { + LispFree(mac, atom->property); + atom->property = NULL; + } + } +} + +void +LispSetAtomObjectProperty(LispMac *mac, LispAtom *atom, LispObj *object) +{ + LispProperty *prop = atom->property; + + if (prop == NULL) + prop = LispAllocAtomProperty(mac); + + prop->object = 1; + prop->value = object; + + if (atom->property == NULL) { + LispMused(mac, prop); + atom->property = prop; + } +} + +void +LispRemAtomObjectProperty(LispMac *mac, LispAtom *atom) +{ + if (atom->property && atom->property->value) { + atom->property->value = NULL; + LispCheckAtomProperty(mac, atom); + } + else + LispDestroy(mac, "internal error at INTERNAL:REMOVE-OBJECT-PROPERTY"); +} + +void +LispSetAtomFunctionProperty(LispMac *mac, LispAtom *atom, LispObj *function) +{ + if (atom->property == NULL) { + atom->property = LispAllocAtomProperty(mac); + LispMused(mac, atom->property); + } + + if (atom->property->fun.function == NULL) + atom->property->function = 1; + else + atom->property->builtin = 0; /* just make sure it is unset */ + + atom->property->fun.function = function; +} + +void +LispRemAtomFunctionProperty(LispMac *mac, LispAtom *atom) +{ + if (atom->property && atom->property->fun.function) { + atom->property->fun.function = NULL; + LispCheckAtomProperty(mac, atom); + } + else + LispDestroy(mac, "internal error at INTERNAL:REMOVE-FUNCTION-PROPERTY"); +} + +void +LispSetAtomBuiltinProperty(LispMac *mac, LispAtom *atom, LispBuiltin *builtin) +{ + if (atom->property == NULL) { + atom->property = LispAllocAtomProperty(mac); + LispMused(mac, atom->property); + } + + if (atom->property->fun.function == NULL) + atom->property->builtin = 1; + else + atom->property->function = 0; /* just make sure it is unset */ + + atom->property->fun.builtin = builtin; +} + +void +LispRemAtomBuiltinProperty(LispMac *mac, LispAtom *atom) +{ + if (atom->property && atom->property->fun.builtin) { + atom->property->fun.function = NULL; + LispCheckAtomProperty(mac, atom); + } + else + LispDestroy(mac, "internal error at INTERNAL:REMOVE-BUILTIN-PROPERTY"); +} + +void +LispSetAtomSetfProperty(LispMac *mac, LispAtom *atom, LispObj *setf) +{ + LispProperty *prop = atom->property; + + if (prop == NULL) + prop = LispAllocAtomProperty(mac); + + prop->defsetf = 1; + prop->setf = setf; + + if (atom->property == NULL) { + LispMused(mac, prop); + atom->property = prop; + } +} + +void +LispRemAtomSetfProperty(LispMac *mac, LispAtom *atom) +{ + if (atom->property && atom->property->setf) { + atom->property->setf = NULL; + LispCheckAtomProperty(mac, atom); + } + else + LispDestroy(mac, "internal error at INTERNAL:REMOVE-SETF-PROPERTY"); +} + +void +LispSetAtomStructProperty(LispMac *mac, LispAtom *atom, LispObj *def, int fun) +{ + LispProperty *prop = atom->property; + + if (prop == NULL) + prop = LispAllocAtomProperty(mac); + + prop->defstruct = 1; + prop->structure.definition = def; + prop->structure.function = fun; + + if (atom->property == NULL) { + LispMused(mac, prop); + atom->property = prop; + } +} + +void +LispRemAtomStructProperty(LispMac *mac, LispAtom *atom) +{ + if (atom->property && atom->property->defstruct) { + atom->property->structure.definition = NULL; + LispCheckAtomProperty(mac, atom); + } + else + LispDestroy(mac, "internal error at INTERNAL:REMOVE-STRUCTURE-PROPERTY"); +} + +char * +LispGetString(LispMac *mac, char *str) +{ + return (LispDoGetAtom(mac, str, 0, 0)->string); +} + +char * +LispGetPermString(LispMac *mac, char *str) +{ + return (LispDoGetAtom(mac, str, 1, 1)->string); +} + +static LispObj * +LispDoGetAtomProperty(LispMac *mac, LispAtom *atom, LispObj *key, int add) +{ + LispObj *obj, *res = NULL; + LispProperty *prop = atom->property; + + if (prop == NULL && add) + prop = LispAllocAtomProperty(mac); + + if (add && prop->properties == NULL) { + prop->property = 1; + prop->properties = NIL; + } + + if (prop && prop->property) { + for (obj = prop->properties; obj != NIL; obj = CDR(CDR(obj))) { + if (_LispEqual(mac, key, CAR(obj)) == T) { + res = CDR(obj); + break; + } + } + } + else + obj = NIL; + + if (obj == NIL) { + if (add) { + prop->properties = CONS(key, CONS(NIL, prop->properties)); + res = CDR(prop->properties); + } + else + res = NIL; + } + + if (atom->property == NULL && add) { + LispMused(mac, prop); + atom->property = prop; + } + + return (res); +} + +LispObj * +LispGetAtomProperty(LispMac *mac, LispAtom *atom, LispObj *key) +{ + return (LispDoGetAtomProperty(mac, atom, key, 0)); +} + +LispObj * +LispPutAtomProperty(LispMac *mac, LispAtom *atom, LispObj *key, LispObj *val) +{ + LispObj *res = LispDoGetAtomProperty(mac, atom, key, 1); + + CAR(res) = val; + + return (res); +} + +void +LispAddBuiltinFunction(LispMac *mac, LispBuiltin *builtin) +{ + LispAtom *atom = LispDoGetAtom(mac, builtin->name, 0, 1); + + LispSetAtomBuiltinProperty(mac, atom, builtin); +} + +void +LispAllocSeg(LispMac *mac) +{ + unsigned i; + LispObj **list, *obj; + + if ((obj = (LispObj*)calloc(1, sizeof(LispObj) * segsize)) == NULL) + LispDestroy(mac, "out of memory"); + if ((list = (LispObj**)realloc(objseg, + sizeof(LispObj*) * (numseg + 1))) == NULL) { + free(obj); + LispDestroy(mac, "out of memory"); + } + objseg = list; + objseg[numseg] = obj; + + nfree += segsize; + nobjs += segsize; + for (i = 0; i < segsize - 1; i++, obj++) { + CAR(obj) = NIL; + CDR(obj) = obj + 1; + } + CAR(obj) = NIL; + CDR(obj) = freeobj; + freeobj = objseg[numseg]; + ++numseg; +#ifdef DEBUG + fprintf(lisp_stdout, "gc: %d cell(s) allocated at %d segment(s)\n", nobjs, numseg); +#endif +} + +void +LispMark(LispObj *obj) +{ + if (obj->mark) + return; + + switch (obj->type) { + case LispNil_t: + if (obj == NIL) + return; + break; + case LispTrue_t: + if (obj == T) + return; + break; + case LispLambda_t: + LispMark(obj->data.lambda.name); + LispMark(obj->data.lambda.code); + break; + case LispQuote_t: + case LispBackquote_t: + LispMark(obj->data.quote); + break; + case LispComma_t: + LispMark(obj->data.comma.eval); + break; + case LispCons_t: + /* circular list on car */ + if (CAR(obj) == obj) { + obj->mark = LispTrue_t; + obj = CDR(obj); + } + for (; obj->type == LispCons_t && obj->mark == LispNil_t; + obj = CDR(obj)) { + LispMark(CAR(obj)); + obj->mark = LispTrue_t; + } + if (obj->type != LispCons_t) + LispMark(obj); + return; + case LispArray_t: + LispMark(obj->data.array.list); + LispMark(obj->data.array.dim); + break; + case LispStruct_t: + /* def is protected when protecting STR */ + LispMark(obj->data.struc.fields); + break; + default: + break; + } + obj->mark = LispTrue_t; +} + +/* It is better to keep the prot field unused for now. It should be + * be set only once, and thus, only used for constants. + * It was being used to protect arguments to Xt callbacks, but since + * Xt widgets can be destroyed, and arguments may be shared, it is + * required to have a "key" associated with every protected object/list. + */ +void +LispProtect(LispMac *mac, LispObj *key, LispObj *list) +{ + PRO = CONS(CONS(key, list), PRO); +} + +void +LispUProtect(LispMac *mac, LispObj *key, LispObj *list) +{ + LispObj *prev, *obj; + + for (prev = obj = PRO; obj != NIL; prev = obj, obj = CDR(obj)) + if (CAR(CAR(obj)) == key && CDR(CAR(obj)) == list) { + if (obj == PRO) + PRO = CDR(PRO); + else + CDR(prev) = CDR(obj); + return; + } + + LispDestroy(mac, "no match for (%s %s), at INTERNAL:UPROTECT", + LispStrObj(mac, key), LispStrObj(mac, list)); +} + +int +LispGet(LispMac *mac) +{ + int ch; + + if (mac->tok == EOF) + return (EOF); + + if (mac->cp) + ch = *mac->cp; + else + ch = 0; + + if (!ch) { + if (mac->fp) { + char *ret; + char *code = malloc(1024); + int len; + + if (code) { + ret = fgets(code, 1024, mac->fp); + len = ret ? strlen(code) : -1; + } + else + len = -1; + if (len <= 0) { + free(code); + return (mac->tok = EOF); + } + if (mac->level == 0 || !mac->st) { + if (mac->st) + free(mac->st); + mac->st = mac->cp = code; + } + else { + char *tmp = realloc(mac->st, (len = strlen(mac->st)) + strlen(code) + 1); + + if (!tmp) { + free(mac->st); + mac->st = NULL; + return (mac->tok = EOF); + } + mac->cp = &tmp[len]; + mac->st = tmp; + strcpy(mac->cp, code); + free(code); + } + return (LispGet(mac)); + } + else + return (mac->tok = EOF); + } + + ++mac->cp; + if (ch == '\n' && mac->interactive && mac->fp == lisp_stdin) { + mac->newline = 1; + mac->column = 0; + } + + return (mac->tok = ch); +} + +int +LispUnget(LispMac *mac) +{ + if (mac->cp > mac->st) { + --mac->cp; + return (1); + } + return (0); +} + +LispObj * +LispNew(LispMac *mac, LispObj *car, LispObj *cdr) +{ + LispObj *obj; + + if (nfree < (segsize >> 2)) { + /* changed if test from + * if (freeobj == NIL) + * to + * if (nfree < (segsize >> 2)) + * this is required, because since gc can be disabled, it is possible + * to enter loops where code will fill exactly segsize objects, and + * gc protect just before allocating a new object. + * An example code that would generate such problem is: + * (setq n 1e6) + * (loop (if (<= n 0) (return n) (setf n (- n 1)))) + */ + LispGC(mac, car, cdr); + if (freeobj == NIL) + LispAllocSeg(mac); + else if (nfree < (segsize >> 2)) { + /* allocates new segment anyway, to avoid too much calls to gc */ + obj = freeobj; + while (CDR(freeobj) != NIL) + freeobj = CDR(freeobj); + cdr = freeobj; + freeobj = NIL; + LispAllocSeg(mac); + CDR(cdr) = objseg[numseg - 1]; + freeobj = obj; + } + } + + obj = freeobj; + freeobj = CDR(obj); + + obj->dirty = LispTrue_t; + obj->prot = LispNil_t; + --nfree; + + return (obj); +} + +LispObj * +LispNewAtom(LispMac *mac, char *str) +{ + char *ptr = str; + LispObj *atom = LispNew(mac, NIL, NIL); + + /* store atoms as uppercase */ + while (*ptr) { + if (toupper(*ptr) != *ptr) { + unsigned char *tmp; + + ptr = LispStrdup(mac, str); + for (tmp = (unsigned char*)ptr; *tmp; tmp++) + *tmp = toupper(*tmp); + break; + } + ++ptr; + } + if (*ptr == '\0') + ptr = str; + + atom->type = LispAtom_t; + atom->data.atom = LispDoGetAtom(mac, ptr, 0, 0); + if (ptr != str) + LispFree(mac, ptr); + + return (atom); +} + +LispObj * +LispNewReal(LispMac *mac, double value) +{ + LispObj *real = LispNew(mac, NIL, NIL); + + real->type = LispReal_t; + real->data.real = value; + + return (real); +} + +LispObj * +LispNewString(LispMac *mac, char *str) +{ + LispObj *string = LispNew(mac, NIL, NIL); + + string->type = LispString_t; + string->data.atom = LispDoGetAtom(mac, str, 0, 0); + + return (string); +} + +LispObj * +LispNewCharacter(LispMac *mac, long c) +{ + LispObj *character = LispNew(mac, NIL, NIL); + + character->type = LispCharacter_t; + character->data.integer = c; + + return (character); +} + +LispObj * +LispNewInteger(LispMac *mac, long i) +{ + LispObj *integer = LispNew(mac, NIL, NIL); + + integer->type = LispInteger_t; + integer->data.integer = i; + + return (integer); +} + +LispObj * +LispNewQuote(LispMac *mac, LispObj *obj) +{ + LispObj *quote = LispNew(mac, obj, NIL); + + quote->type = LispQuote_t; + quote->data.quote = obj; + + return (quote); +} + +LispObj * +LispNewBackquote(LispMac *mac, LispObj *obj) +{ + LispObj *backquote = LispNew(mac, obj, NIL); + + backquote->type = LispBackquote_t; + backquote->data.quote = obj; + + return (backquote); +} + +LispObj * +LispNewComma(LispMac *mac, LispObj *obj, int atlist) +{ + LispObj *comma = LispNew(mac, obj, NIL); + + comma->type = LispComma_t; + comma->data.comma.eval = obj; + comma->data.comma.atlist = atlist; + + return (comma); +} + +LispObj * +LispNewCons(LispMac *mac, LispObj *car, LispObj *cdr) +{ + LispObj *cons = LispNew(mac, car, cdr); + + cons->type = LispCons_t; + CAR(cons) = car; + CDR(cons) = cdr; + + return (cons); +} + +LispObj * +LispNewLambda(LispMac *mac, LispObj *name, LispObj *args, LispObj *code, + int num_args, LispFunType type, int key, int optional, int rest) +{ + LispObj *fun = LispNew(mac, args, code); + + fun->type = LispLambda_t; + fun->data.lambda.name = name; + GCProtect(); + fun->data.lambda.code = CONS(args, code); + GCUProtect(); + fun->data.lambda.num_args = num_args; + fun->data.lambda.type = type; + fun->data.lambda.key = key; + fun->data.lambda.optional = optional; + fun->data.lambda.rest = rest; + + return (fun); +} + +LispObj * +LispNewStruct(LispMac *mac, LispObj *fields, LispObj *def) +{ + LispObj *struc = LispNew(mac, fields, def); + + struc->type = LispStruct_t; + struc->data.struc.fields = fields; + struc->data.struc.def = def; + + return (struc); +} + +LispObj * +LispNewOpaque(LispMac *mac, void *data, int type) +{ + LispObj *opaque = LispNew(mac, NIL, NIL); + + opaque->type = LispOpaque_t; + opaque->data.opaque.data = data; + opaque->data.opaque.type = type; + + return (opaque); +} + +LispObj * +LispGetVar(LispMac *mac, LispObj *atom) +{ + LispObj *env; + LispAtom *name = atom->data.atom; + /* XXX no type checking for maximal speed, + * if got here, atom must be of an ATOM */ + + if (ENV != GLB) { + for (env = ENV; env != LEX; env = CDR(env)) + if (CAAR(env)->data.atom == name) + return (CDAR(env)); + + if (LEX != NIL) { + for (env = GLB; env != NIL; env = CDR(env)) + if (CAAR(env)->data.atom == name) + return (CDAR(env)); + } + return (NULL); + } + + /* atom->property is only set for global variables */ + return (name->property ? name->property->value : NULL); +} + +LispObj * +LispGetVarCons(LispMac *mac, LispObj *atom) +{ + LispObj *env; + LispAtom *name = atom->data.atom; + /* XXX no type checking for maximal speed, + * if got here, atom must be an ATOM */ + + for (env = ENV; env != LEX; env = CDR(env)) + if (CAAR(env)->data.atom == name) + return (CAR(env)); + + if (LEX != NIL) { + for (env = GLB; env != NIL; env = CDR(env)) + if (CAAR(env)->data.atom == name) + return (CAR(env)); + } + + /* if returns NULL, variable is unbound */ + return (NULL); +} + +/* Only removes global variables. To be called by makunbound + * Local variables are unbounded once their block is closed anyway. + */ +void +LispUnsetVar(LispMac *mac, LispObj *atom) +{ + LispObj *env, *prv; + LispAtom *name = atom->data.atom; + /* XXX no type checking for maximal speed, + * if got here, atom must be an ATOM */ + + for (prv = env = GLB; env != NIL; prv = env, env = CDR(env)) + if (CAAR(env)->data.atom == name) { + if (env == GLB) + GLB = CDR(GLB); + else + CDR(prv) = CDR(env); + if (env == ENV) + ENV = CDR(ENV); + LispRemAtomObjectProperty(mac, name); + break; + } +} + +LispObj * +LispAddVar(LispMac *mac, LispObj *atom, LispObj *obj) +{ + LispObj *env; + LispAtom *name = atom->data.atom; + /* XXX no type checking for maximal speed, + * if got here, atom must be an ATOM */ + + if (LEX != NIL) { + for (env = ENV; env != LEX; env = CDR(env)) + if (CAAR(env)->data.atom == name) + return (CDAR(env) = obj); + } + else { + for (env = ENV; env != GLB; env = CDR(env)) + if (CAAR(env)->data.atom == name) + return (CDAR(env) = obj); + } + + GCProtect(); + ENV = CONS(CONS(atom, obj), ENV); + GCUProtect(); + + return (obj); +} + +LispObj * +LispSetVar(LispMac *mac, LispObj *atom, LispObj *obj) +{ + LispObj *env; + LispAtom *name = atom->data.atom; + /* XXX no type checking for maximal speed, + * if got here, atom must be an ATOM */ + + for (env = ENV; env != GLB; env = CDR(env)) + if (CAAR(env)->data.atom == name) + return (CDAR(env) = obj); + + for (env = GLB; env != NIL; env = CDR(env)) + if (CAAR(env)->data.atom == name) + return (CDAR(env) = CAAR(env)->data.atom->property->value = obj); + + GCProtect(); + LispSetAtomObjectProperty(mac, name, obj); + if (GLB == NIL) + ENV = GLB = CONS(CONS(atom, obj), NIL); + else { + CDR(GLB) = CONS(CAR(GLB), CDR(GLB)); + CAR(GLB) = CONS(atom, obj); + } + GCUProtect(); + + return (obj); +} + +LispObj * +LispReverse(LispObj *list) +{ + LispObj *tmp, *res = NIL; + + while (list != NIL) { + tmp = CDR(list); + CDR(list) = res; + res = list; + list = tmp; + } + + return (res); +} + +LispObj * +LispEnvRun(LispMac *mac, LispObj *args, LispFunPtr fn, char *fname, int refs) +{ + LispObj *old_frm, *old_env, *env, *res, *list, *pair; + + old_frm = FRM; + old_env = ENV; + env = CAR(args); + list = NIL; + + if (env != NIL) { + if (env->type != LispCons_t) + LispDestroy(mac, "%s is not of type list, at %s", + LispStrObj(mac, env), fname); + } + + for (; env != NIL; env = CDR(env)) { + LispObj *var = NIL, *val = NIL; + + pair = CAR(env); + if (SYMBOL_P(pair)) { + var = pair; + val = NIL; + } + else if (pair->type == LispCons_t) { + var = CAR(pair); + if (!SYMBOL_P(var)) + LispDestroy(mac, "%s is invalid as a variable name, at %s", + LispStrObj(mac, var), fname); + pair = CDR(pair); + if (pair == NIL) + val = NIL; + else { + val = CAR(pair); + if (CDR(pair) != NIL) + LispDestroy(mac, "too much arguments to initialize %s, at %s", + STRPTR(var), fname); + } + } + else + LispDestroy(mac, "%s is not of type list, at %s", + LispStrObj(mac, pair), fname); + val = EVAL(val); + if (!refs) { + GCProtect(); + pair = CONS(var, val); + if (list == NIL) { + list = CONS(pair, NIL); + FRM = CONS(list, FRM); + } + else { + CDR(list) = CONS(CAR(list), CDR(list)); + CAR(list) = pair; + } + GCUProtect(); + } + else + LispAddVar(mac, var, val); + } + + if (!refs && list != NIL) { + /* Need to update CAR(FRM) or will run function without gc protection! */ + list = CAR(FRM) = LispReverse(list); + for (; list != NIL; list = CDR(list)) { + pair = CAR(list); + LispAddVar(mac, CAR(pair), CDR(pair)); + } + } + + res = fn(mac, CDR(args), fname); + + ENV = old_env; + FRM = old_frm; + + return (res); +} + +LispBlock * +LispBeginBlock(LispMac *mac, LispObj *tag, LispBlockType type) +{ + unsigned blevel = mac->block.block_level + 1; + LispBlock *block = NULL; + + if (blevel > mac->block.block_size) { + LispBlock **blk = realloc(mac->block.block, + sizeof(LispBlock*) * (blevel + 1)); + + if (blk == NULL) + LispDestroy(mac, "out of memory"); + else if ((block = malloc(sizeof(LispBlock))) == NULL) + LispDestroy(mac, "out of memory"); + mac->block.block = blk; + mac->block.block[mac->block.block_size] = block; + mac->block.block_size = blevel; + } + block = mac->block.block[mac->block.block_level]; + if (type == LispBlockCatch) + tag = EVAL(tag); + block->type = type; + memcpy(&(block->tag), tag, sizeof(LispObj)); + + block->level = mac->level; + block->block_level = mac->block.block_level; + + mac->block.block_level = blevel; + + if (mac->debugging) { + block->debug_level = mac->debug_level; + block->debug_step = mac->debug_step; + } + + return (block); +} + +void +LispEndBlock(LispMac *mac, LispBlock *block) +{ + mac->level = block->level; + mac->block.block_level = block->block_level; + + if (mac->debugging) { + if (mac->debug_level >= block->debug_level) { + while (mac->debug_level > block->debug_level) { + DBG = CDR(DBG); + --mac->debug_level; + } + } + else + LispDestroy(mac, "this should never happen: " + "mac->debug_level < block->debug_level"); + mac->debug_step = block->debug_step; + } +} + +void +LispBlockUnwind(LispMac *mac) +{ + LispBlock *block; + int blevel = mac->block.block_level; + + while (blevel > 0) { + block = mac->block.block[--blevel]; + if (block->type == LispBlockProtect) + longjmp(block->jmp, 1); + } +} + +static int +LispSkipComment(LispMac *mac) +{ + int ch; + + /*CONSTCOND*/ + while (1) { + while (ch = LispGet(mac), ch != '\n' && ch != EOF) + ; + if (ch == EOF) + return (0); + while (ch = LispGet(mac), isspace(ch) && ch != EOF) + ; + if (ch == EOF) + return (0); + if (ch != ';') { + LispUnget(mac); + return (1); + } + } + /*NOTREACHED*/ +} + +static int +LispSkipWhiteSpace(LispMac *mac) +{ + int ch; + + while (ch = LispGet(mac), isspace(ch) && ch != EOF) + ; + if (ch == ';') { + if (!LispSkipComment(mac)) + return (EOF); + return (LispGet(mac)); + } + else if (ch == '#') { + /* multiline comment */ + if (LispGet(mac) == '|') { + int comm = 1; /* comments may nest */ + + while (1) { + ch = LispGet(mac); + if (ch == '|' && LispGet(mac) == '#') { + if (--comm == 0) + return (LispSkipWhiteSpace(mac)); + } + else if (ch == '#' && LispGet(mac) == '|') + ++comm; + else if (ch == EOF) + return (EOF); + } + } + else + LispUnget(mac); + } + return (ch); +} + +void +LispGetKeys(LispMac *mac, char *fname, char *spec, LispObj *list, ...) +{ + va_list ap; + int nargs, ncvt; + LispObj *obj, **arg; + char *ptr, *end, *str; + + /* count how many arguments specified and check arguments */ + for (obj = list, nargs = 0; obj != NIL; obj = CDR(obj)) { + if (!SYMBOL_P(CAR(obj)) || STRPTR(CAR(obj))[0] != ':') + LispDestroy(mac, "&KEY needs arguments as pairs, at %s", fname); + else if (CDR(obj) == NIL) + LispDestroy(mac, "expecting %s value, at %s", + STRPTR(CAR(obj)), fname); + obj = CDR(obj); + ++nargs; + } + + va_start(ap, list); + for (ncvt = 0, ptr = spec, end = strchr(spec, ':'); end; + ptr = end + 1, end = strchr(ptr, ':')) { + arg = (LispObj**)va_arg(ap, LispObj**); + *arg = NULL; /* to know if it was found */ + + for (obj = list; obj != NIL; obj = CDR(obj)) { + str = STRPTR(CAR(obj)) + 1; + obj = CDR(obj); + if (strncmp(str, ptr, end - ptr) == 0) { + *arg = CAR(obj); + ++ncvt; + break; + } + } + if (*arg == NULL) + *arg = NIL; + } + if (ptr) { + /* last or unique argument */ + arg = (LispObj**)va_arg(ap, LispObj**); + *arg = NULL; /* to know if it was found */ + + for (obj = list; obj != NIL; obj = CDR(obj)) { + str = STRPTR(CAR(obj)) + 1; + obj = CDR(obj); + if (strcmp(str, ptr) == 0) { + *arg = CAR(obj); + ++ncvt; + break; + } + } + if (*arg == NULL) + *arg = NIL; + } + va_end(ap); + + /* if got here, arguments are correctly specified as pairs */ + if (ncvt < nargs) { + /* Possible error. If argument value specified more than once, it is + * not triggered as an error, but if an incorrect argument name was + * specified, it is a fatal error (probably a typo in the code) */ + + for (obj = list; obj != NIL; obj = CDR(CDR(obj))) { + int match = 0; + + for (ptr = spec, end = strchr(ptr, ':'); end; + ptr = end + 1, end = strchr(ptr, ':')) + if (strncmp(STRPTR(CAR(obj)) + 1, ptr, end - ptr) == 0) { + match = 1; + break; + } + + if (!match && ptr && strcmp(STRPTR(CAR(obj)) + 1, ptr) == 0) + match = 1; + + if (!match) + LispDestroy(mac, "%s is not an argument to %s", + STRPTR(CAR(obj)), fname); + } + } +} + +LispObj * +LispRun(LispMac *mac) +{ + static char *DOTMSG = "illegal end of dotted list"; + static char *QUOTMSG = "illegal quoted object"; + int ch, len, dquote = 0, escape = 0, size, dot = 0, hash = 0; + LispObj *res, *obj, *cons, *code, *frm; + char stk[1024], *str; + + code = COD; + frm = FRM; + switch (ch = LispSkipWhiteSpace(mac)) { + case '(': + if (LispSkipWhiteSpace(mac) == ')') { + res = NIL; + break; + } + (void)LispUnget(mac); + res = cons = CONS(NIL, NIL); + if (COD == NIL) + COD = res; + else + FRM = CONS(res, FRM); + if ((CAR(cons) = LispRun(mac)) == DOT) + LispDestroy(mac, "illegal start of dotted list"); + while ((obj = LispRun(mac)) != EOLIST) { + if (obj == NULL) + goto endofinput; + if (obj == DOT) { + if (dot) + LispDestroy(mac, DOTMSG); + dot = 1; + } + else { + if (dot) { + if (++dot > 2) + LispDestroy(mac, DOTMSG); + CDR(cons) = obj; + } + else { + CDR(cons) = CONS(obj, NIL); + cons = CDR(cons); + } + } + } + if (dot == 1) + LispDestroy(mac, DOTMSG); + break; + case ')': + return (EOLIST); + case EOF: + return (NULL); + case '\'': + if ((obj = LispRun(mac)) == NULL || obj == EOLIST) + LispDestroy(mac, QUOTMSG); + res = QUOTE(obj); + break; + case '`': + if ((obj = LispRun(mac)) == NULL || obj == EOLIST) + LispDestroy(mac, QUOTMSG); + res = BACKQUOTE(obj); + break; + case ',': { + int atlist = LispGet(mac); + + if (atlist == EOF) + goto endofinput; + else if (atlist != '@') + LispUnget(mac); + if ((obj = LispRun(mac)) == NULL || obj == EOLIST) + LispDestroy(mac, QUOTMSG); + res = COMMA(obj, atlist == '@'); + } break; + case '#': + hash = 1; + ch = LispGet(mac); + if (ch == EOF) + goto endofinput; + else if (ch != '\\') + LispDestroy(mac, "syntax error at #"); + ch = '#'; + goto string_label; + case '"': + dquote = 1; + escape = 1; + goto string_label; + default: +string_label: + len = 0; + size = sizeof(stk); + str = stk; + while (ch != EOF && ((dquote || (hash && len < 2)) || + (!isspace(ch) && (ch != ')' && ch != '(' && ch != ';')))) { + if (len >= size - 1) { + char *tmp; + + if (str == stk) + tmp = (char*)LispMalloc(mac, size + 1024); + else + tmp = (char*)LispRealloc(mac, str, size + 1024); + str = tmp; + size += 1024; + } + + if (ch == '\\') + escape = !escape; + + if (dquote) { + if (!escape) { + if (ch == '"') + break; + str[len++] = ch; + } + } + else if (hash) { + if (!escape) + str[len++] = ch; + } + else if (!escape) + str[len++] = toupper(ch); + ch = LispGet(mac); + if (escape) + escape = 0; + } + str[len] = '\0'; + if (ch == '(' || ch == ')' || ch == ';') + LispUnget(mac); + if (dquote) + res = STRING(str); + else if (isdigit(str[0]) || + ((str[0] == '-' || str[0] == '.' || str[0] == '+') && + isdigit(str[1]))) { + double value; + char *cp; + + value = strtod(str, &cp); + if (cp && *cp) + res = ATOM(str); + else + res = REAL(value); + } + else if (hash) { + long c = 0; + + if (len == 1) + LispDestroy(mac, "syntax error at #"); + else if (len > 2) { + if (len == 6 && (str[1] == 'u' || str[1] == 'U')) { + char *end; + + c = strtoul(str + 2, &end, 16); + if (!*end) + goto gotchar; + } + for (c = 0; c <= ' '; c++) + if (strcasecmp(LispCharNames[c], str + 1) == 0) + break; + if (c > ' ') { + /* extra or special cases */ + if (strcasecmp(str + 1, "Rubout") == 0) + c = 0177; + else if (strcasecmp(str + 1, "Nul") == 0) + c = 0; + else if (strcasecmp(str + 1, "Bs") == 0) + c = 010; + else if (strcasecmp(str + 1, "Ht") == 0) + c = 011; + else if (strcasecmp(str + 1, "Lf") == 0) + c = 012; + else if (strcasecmp(str + 1, "Ff") == 0) + c = 014; + else if (strcasecmp(str + 1, "Cr") == 0) + c = 015; + else if (strcasecmp(str + 1, "Esc") == 0) + c = 033; + else if (strcasecmp(str + 1, "Del") == 0) + c = 0177; + else if (strcasecmp(str + 1, "Linefeed") == 0) + c = 012; + else if (strcasecmp(str + 1, "Delete") == 0) + c = 0177; + else + LispDestroy(mac, "no character named \"%s\"", + str + 1); + } + } + else + c = *(unsigned char*)(str + 1); +gotchar: + res = CHAR(c); + } + else { + if (!len || strcmp(str, "NIL") == 0) + res = NIL; + else if (strcmp(str, "T") == 0) + res = T; + else if (strcmp(str, ".") == 0) + res = DOT; + else + res = ATOM(str); + } + if (str != stk) + LispFree(mac, str); + break; + } + + if (code == NIL) + COD = res; + FRM = frm; + + return (res); + +endofinput: + LispDestroy(mac, "unexpected end of input"); + /*NOTREACHED*/ + + return (NIL); +} + +LispObj * +LispEvalBackquote(LispMac *mac, LispObj *arg) +{ + LispObj *res = NIL, *frm = FRM; + + if (arg->type == LispComma_t) { + if (arg->data.comma.atlist) + LispDestroy(mac, ",@ only allowed on lists"); + else if (arg->data.comma.eval->type == LispComma_t) + res = arg->data.comma.eval; + else + /* just evaluate it */ + res = EVAL(arg->data.comma.eval); + } + else if (arg->type == LispCons_t) { + LispObj *obj, *cdr = NIL, *ptr; + /* create new form, evaluating any commas inside */ + + res = NIL; + for (ptr = arg; ; ptr = CDR(ptr)) { + int atcons = 1, atlist = 0; + + if (ptr->type != LispCons_t) { + atcons = 0; + obj = ptr; + } + else + obj = CAR(ptr); + if (obj->type == LispComma_t) { + atlist = obj->data.comma.atlist; + if (obj->data.comma.eval->type == LispComma_t) { + if (atlist) + LispDestroy(mac, ",@ only allowed on lists"); + obj = obj->data.comma.eval; + } + else + obj = EVAL(obj->data.comma.eval); + } + else if (obj->type == LispBackquote_t) + obj = LispEvalBackquote(mac, obj->data.quote); + else if (obj->type == LispCons_t) + obj = LispEvalBackquote(mac, obj); + /* else do nothing */ + + if (res == NIL) { + if (frm != FRM) + /* just free a cons, in case of code like: + * (setq c nil d '(1 2 3)) + * `(,@c ,@d) + */ + FRM = frm; + + /* link to FRM to protect from gc, + * actually, should protect with COD, but this would + * require EVAL to also save/restore COD, causing + * a bit slower EVAL time. + */ + GCProtect(); + if (!atlist) { + if (atcons) + /* easier case */ + res = cdr = CONS(obj, NIL); + else + res = cdr = obj; + } + else { + /* add list contents */ + if (obj->type != LispCons_t) + res = cdr = obj; + else { + res = cdr = CONS(CAR(obj), NIL); + for (obj = CDR(obj); obj->type == LispCons_t; + obj = CDR(obj)) { + CDR(cdr) = CONS(CAR(obj), NIL); + cdr = CDR(cdr); + } + if (obj != NIL) { + CDR(cdr) = obj; + cdr = CDR(cdr); + } + } + } + FRM = CONS(res, FRM); + GCUProtect(); + } + else { + if (cdr->type != LispCons_t) + LispDestroy(mac, "cannot append to %s", + LispStrObj(mac, cdr)); + if (!atlist) { + if (atcons) { + CDR(cdr) = CONS(obj, NIL); + cdr = CDR(cdr); + } + else { + CDR(cdr) = obj; + cdr = obj; + } + } + else { + if (obj->type != LispCons_t) { + CDR(cdr) = obj; + if (obj != NIL) + cdr = obj; + } + else { + for (; obj->type == LispCons_t; obj = CDR(obj)) { + CDR(cdr) = CONS(CAR(obj), NIL); + cdr = CDR(cdr); + } + if (obj != NIL) { + CDR(cdr) = obj; + cdr = CDR(cdr); + } + } + } + } + if (ptr->type != LispCons_t) + break; + } + } + else if (arg->type == LispBackquote_t) + res = BACKQUOTE(LispEvalBackquote(mac, arg->data.quote)); + else + /* 'obj == `obj */ + res = arg; + + return (res); +} + +static LispObj * +LispBuildArguments(LispMac *mac, LispObj *desc, LispObj *values, + char *fname, int macro) +{ + int rest, optional, key; + LispObj *args = NIL, *list = desc, *res, *cdr = NIL, *arg, *keyword = NIL; + + /* build argument list */ + while (list != NIL) { + if (STRPTR(CAR(list))[0] != '&') { + if (args == NIL) { + GCProtect(); + args = cdr = CONS(list, NIL); + FRM = CONS(args, FRM); + GCUProtect(); + } + else { + CDR(cdr) = CONS(list, NIL); + cdr = CDR(cdr); + } + } + list = CDR(list); + } + + /* fill argument list */ + list = desc; + rest = optional = key = 0; + cdr = values; + arg = args; + while (list != NIL) { + if (STRPTR(CAR(list))[0] == '&') { + if (strcmp(STRPTR(CAR(list)) + 1, "KEY") == 0) + key = 1; + else if (strcmp(STRPTR(CAR(list)) + 1, "REST") == 0) { + rest = 1; + break; + } + else /* "OPTIONAL" */ + optional = 1; + } + else { + if (cdr == NIL) { + if (key || optional) + break; + else + LispDestroy(mac, "too few arguments to %s", fname); + } + else { + if (key) { + if (!SYMBOL_P(CAR(cdr)) || STRPTR(CAR(cdr))[0] != ':') + LispDestroy(mac, "&KEY needs arguments as pairs, at %s", + fname); + else if (CDR(cdr) == NIL) + LispDestroy(mac, "expecting %s value, at %s", + STRPTR(CAR(cdr)), fname); + keyword = CAR(cdr); + cdr = CDR(cdr); + } + if (macro) + res = CAR(cdr); + else + res = EVAL(CAR(cdr)); + if (key) { + LispObj *atmp, *cmp, *ltmp = desc; + + for (; ltmp != NIL; ltmp = CDR(ltmp)) { + if ((cmp = CAR(ltmp))->type == LispCons_t) + cmp = CAR(cmp); + else if (STRPTR(cmp)[0] == '&') + continue; + if (strcmp(STRPTR(cmp), STRPTR(keyword) + 1) == 0) + break; + } + if (ltmp == NIL) + LispDestroy(mac, "%s is not an argument to %s", + STRPTR(keyword), fname); + for (atmp = args; atmp != NIL; atmp = CDR(atmp)) + if (CAR(atmp) == ltmp) { + CAR(atmp) = res; + break; + } + /* else, silently ignore setting argument + * more than once? */ + } + else + CAR(arg) = res; + cdr = CDR(cdr); + } + arg = CDR(arg); + } + list = CDR(list); + } + if (rest) { + res = CAR(cdr); + if (!macro) + res = EVAL(res); + CAR(arg) = CONS(res, NIL); + arg = CAR(arg); + cdr = CDR(cdr); + while (cdr->type == LispCons_t) { + res = CAR(cdr); + if (!macro) + res = EVAL(res); + CDR(arg) = CONS(res, NIL); + arg = CDR(arg); + cdr = CDR(cdr); + } + } + else if (cdr != NIL) + LispDestroy(mac, "too many arguments to %s", fname); + + /* set to NIL or default any unspecified arguments */ + if (key || optional) { + arg = args; + list = desc; + + for (; list != NIL; list = CDR(list)) + if (STRPTR(CAR(list))[0] != '&') { + if (CAR(arg) == list) { + if (CAR(list)->type == LispCons_t && + CDR(CAR(list))->type == LispCons_t) { + if (macro) + CAR(arg) = CAR(CDR(CAR(list))); + else + CAR(arg) = EVAL(CAR(CDR(CAR(list)))); + } + else + CAR(arg) = NIL; + } + arg = CDR(arg); + } + } + + return (args); +} + +/* if max_args == 0, then any number of arguments accepted, + * if min_args < 0 then, if max_args == 0, no args are accepted */ +static LispObj * +LispBuildSimpleArguments(LispMac *mac, LispObj *values, char *fname, + int min_args, int max_args, int macro) +{ + int num_objs = 0; + LispObj *res, *args = NIL, *cdr = values; + + while (cdr->type == LispCons_t) { + ++num_objs; + cdr = CDR(cdr); + } + if (num_objs < min_args) + LispDestroy(mac, "too few arguments to %s", fname); + else if ((max_args || min_args < 0) && num_objs > max_args) + LispDestroy(mac, "too many arguments to %s", fname); + + if (macro) + args = values; + else if (num_objs) { + LispObj *arg = values; + + res = EVAL(CAR(arg)); + GCProtect(); + args = cdr = CONS(res, NIL); + FRM = CONS(args, FRM); + GCUProtect(); + arg = CDR(arg); + while (arg->type == LispCons_t) { + CDR(cdr) = CONS(EVAL(CAR(arg)), NIL); + cdr = CDR(cdr); + arg = CDR(arg); + } + } + + return (args); +} + +LispObj * +LispEval(LispMac *mac, LispObj *obj) +{ + char *strname = NULL; + LispObj *name = NIL, *fun, *cons = NIL, *frm, *res, *car; + LispBuiltin *fn; + + if (!obj) + LispDestroy(mac, "internal error, at INTERNAL:EVAL"); + + switch (obj->type) { + case LispAtom_t: + strname = STRPTR(obj); + if (mac->debugging) + LispDebugger(mac, LispDebugCallBegini, NIL, obj); + if (strname[0] != ':' && (obj = LispGetVar(mac, obj)) == NULL) + LispDestroy(mac, "the variable %s is unbound", strname); + if (mac->debugging) + LispDebugger(mac, LispDebugCallEndi, NIL, obj); + return (obj); + case LispQuote_t: + if (mac->debugging) { + LispDebugger(mac, LispDebugCallBegini, NIL, obj); + LispDebugger(mac, LispDebugCallEndi, NIL, obj->data.quote); + } + return (obj->data.quote); + case LispBackquote_t: + return LispEvalBackquote(mac, obj->data.quote); + case LispComma_t: + LispDestroy(mac, "illegal comma outside of backquote"); + case LispCons_t: + cons = obj; + break; + case LispNil_t: + case LispTrue_t: + case LispReal_t: + case LispString_t: + case LispOpaque_t: + default: + /* don't {step,next}i on literals */ + return (obj); + } + car = CAR(cons); + fun = NIL; + switch (car->type) { + case LispAtom_t: + name = car; + strname = STRPTR(name); + break; + case LispLambda_t: + name = NIL; + strname = "NIL"; + fun = car; + break; + default: + LispDestroy(mac, "%s is invalid as a function, at INTERNAL:EVAL", + LispStrObj(mac, car)); + /*NOTREACHED*/ + } + + ++mac->level; + frm = FRM; + + if (mac->debugging) + LispDebugger(mac, LispDebugCallBegin, name, CDR(cons)); + + if (fun == NIL && name->data.atom->property) { + LispAtom *atom = name->data.atom; + + if (atom->property->builtin) { + LispObj *args; + + fn = atom->property->fun.builtin; + args = LispBuildSimpleArguments(mac, CDR(cons), strname, + fn->min_args, fn->max_args, + !fn->eval); + + res = fn->fn(mac, args, strname); + if (mac->debugging) + LispDebugger(mac, LispDebugCallEnd, name, res); + FRM = frm; + --mac->level; + + return (res); + } + + if (atom->property->function) + fun = name->data.atom->property->fun.function; + else if (atom->property->defstruct) { + LispObj *args; + int min_args, max_args; + + /* Expands call to xedit::struct-* functions. + * Besides this is a implementation dependent trick, + * I believe it is better than another implementation I wrote, + * were I added a LispBuiltin for every access function, and + * also a defsetf. This new way is hacky, but uses plenty less + * memory, and is probably faster. + * Maybe these atoms should be store in LispMac, for faster + * access. + */ + + if (atom->property->structure.function == STRUCT_CONSTRUCTOR) + atom = ATOM("XEDIT::MAKE-STRUCT")->data.atom; + else if (atom->property->structure.function == STRUCT_CHECK) + atom = ATOM("XEDIT::STRUCT-TYPE")->data.atom; + else + atom = ATOM("XEDIT::STRUCT-ACCESS")->data.atom; + + fn = atom->property->fun.builtin; + min_args = fn->min_args > 0 ? fn->min_args - 1 : fn->min_args; + max_args = fn->max_args > 0 ? fn->max_args - 1 : fn->max_args; + args = LispBuildSimpleArguments(mac, CDR(cons), strname, + min_args, max_args, !fn->eval); + + GCProtect(); + args = CONS(name, args); + FRM = CONS(args, FRM); + GCUProtect(); + + res = fn->fn(mac, args, strname); + if (mac->debugging) + LispDebugger(mac, LispDebugCallEnd, name, res); + FRM = frm; + --mac->level; + + return (res); + } + } + + if (fun != NIL) { + LispObj *args = NIL; + + if (!fun->data.lambda.key && !fun->data.lambda.optional && + !fun->data.lambda.rest) + args = LispBuildSimpleArguments(mac, CDR(cons), strname, + -1, fun->data.lambda.num_args, + fun->data.lambda.type == LispMacro); + else + args = LispBuildArguments(mac, CAR(fun->data.lambda.code), + CDR(cons), strname, + fun->data.lambda.type == LispMacro); + + res = LispRunFunMac(mac, fun, args); + if (mac->debugging) + LispDebugger(mac, LispDebugCallEnd, fun->data.lambda.name, res); + FRM = frm; + --mac->level; + + return (res); + } + + LispDestroy(mac, "the function %s is not defined", strname); + /*NOTREACHED*/ + + return (NIL); +} + +LispObj * +LispRunFunMac(LispMac *mac, LispObj *fun, LispObj *list) +{ + volatile LispFunType type = fun->data.lambda.type; + LispObj *old_env, *old_lex, *args, *code, *res, *frm; + + old_env = ENV; + old_lex = LEX; + + args = CAR(fun->data.lambda.code); + code = CDR(fun->data.lambda.code); + + LEX = ENV; + + for (; args != NIL; args = CDR(args)) { + if (CAR(args)->type == LispCons_t) { + LispAddVar(mac, CAR(CAR(args)), CAR(list)); + list = CDR(list); + } + else if (STRPTR(CAR(args))[0] != '&') { + LispAddVar(mac, CAR(args), CAR(list)); + list = CDR(list); + } + } + + if (type != LispMacro) { + int did_jump = 1, *pdid_jump = &did_jump; + LispObj **pres = &res; + LispBlock *block = + LispBeginBlock(mac, fun->data.lambda.name, LispBlockClosure); + char *strname = type == LispLambda ? + "#<LAMBDA>" : STRPTR(fun->data.lambda.name), **pstrname = &strname; + + *pres = NIL; + if (setjmp(block->jmp) == 0) { + *pres = Lisp_Progn(mac, code, *pstrname); + *pdid_jump = 0; + } + LispEndBlock(mac, block); + if (*pdid_jump) + *pres = mac->block.block_ret; + } + else + res = Lisp_Progn(mac, code, STRPTR(fun->data.lambda.name)); + + LEX = old_lex; + ENV = old_env; + + /* res is not gc protected, link to FRM */ + if (type == LispMacro) { + frm = FRM; + FRM = CONS(res, FRM); + res = EVAL(res); + FRM = frm; + } + + return (res); +} + +LispObj * +LispRunSetf(LispMac *mac, LispObj *setf, LispObj *place, LispObj *value) +{ + static char *fname = "INTERNAL:EXPAND-SETF"; + LispObj *old_env, *old_lex, *args, *desc, *sto, *code, *exp, *res; + + desc = CAAR(setf->data.lambda.code); + + if (setf->data.lambda.key || setf->data.lambda.optional || + setf->data.lambda.rest) + args = LispBuildArguments(mac, desc, CDR(place), fname, 1); + else + args = LispBuildSimpleArguments(mac, CDR(place), fname, -1, + setf->data.lambda.num_args, 1); + + /* if no errors so far, evaluate setf parameter before setting + * setting new environment */ + value = QUOTE(EVAL(value)); + + old_env = ENV; + old_lex = LEX; + sto = CDAR(setf->data.lambda.code); + code = CDR(setf->data.lambda.code); + LEX = ENV; + + /* create new environment */ + + /* bind store value first, so gc does not need to be disabled. + * Currently, only first store argument used */ + LispAddVar(mac, CAR(sto), value); + + for (; desc != NIL; desc = CDR(desc)) { + if (CAR(desc)->type == LispCons_t) { + LispAddVar(mac, CAR(CAR(desc)), CAR(args)); + args = CDR(args); + } + else if (STRPTR(CAR(desc))[0] != '&') { + LispAddVar(mac, CAR(desc), CAR(args)); + args = CDR(args); + } + } + + /* build expansion macro */ + exp = Lisp_Progn(mac, code, STRPTR(setf->data.lambda.name)); + + /* restore enviroment */ + LEX = old_lex; + ENV = old_env; + + /* protect expansion, and executes it */ + GCProtect(); + old_env = FRM; + FRM = CONS(exp, FRM); + GCUProtect(); + res = EVAL(exp); + FRM = old_env; + + return (res); +} + +void +LispSnprintObj(LispMac *mac, LispObj *obj, char **str, int *len, int paren) +{ + int sz; + + if (*len < 1) + return; + switch (obj->type) { + case LispNil_t: + sz = snprintf(*str, *len, "NIL"); + *len -= sz; + *str += sz; + break; + case LispTrue_t: + sz = snprintf(*str, *len, "T"); + *len -= sz; + *str += sz; + break; + case LispOpaque_t: + sz = snprintf(*str, *len, "#0x%08x-%s", (int)obj->data.opaque.data, + LispIntToOpaqueType(mac, obj->data.opaque.type)); + *len -= sz; + *str += sz; + break; + case LispAtom_t: + sz = snprintf(*str, *len, "%s", STRPTR(obj)); + *len -= sz; + *str += sz; + break; + case LispString_t: + sz = snprintf(*str, *len, "\"%s\"", STRPTR(obj)); + *len -= sz; + *str += sz; + break; + case LispCharacter_t: + sz = snprintf(*str, *len, "#\\"); + if ((*len -= sz) <= 0) + return; + *str += sz; + if (obj->data.integer >= 0 && obj->data.integer <= ' ') + sz = snprintf(*str, *len, "%s", + LispCharNames[obj->data.integer]); + else if (obj->data.integer == 0177) + sz = snprintf(*str, *len, "Rubout"); + else if (obj->data.integer > 0xff) + sz = snprintf(*str, *len, "U%04X", (int)obj->data.integer); + else + sz = snprintf(*str, *len, "%c", (int)obj->data.integer); + *str += sz; + *len -= sz; + break; + case LispReal_t: + sz = snprintf(*str, *len, "%g", obj->data.real); + *len -= sz; + *str += sz; + break; + case LispInteger_t: + sz = snprintf(*str, *len, "%ld", obj->data.integer); + *len -= sz; + *str += sz; + break; + case LispCons_t: { + LispObj *car, *cdr; + + car = CAR(obj); + cdr = CDR(obj); + if (!cdr || cdr->type == LispNil_t) { + if (paren) { + sz = snprintf(*str, *len, "("); + if ((*len -= sz) <= 0) + return; + *str += sz; + } + LispSnprintObj(mac, car, str, len, car->type == LispCons_t); + if (*len <= 0) + return; + if (paren) { + sz = snprintf(*str, *len, ")"); + if ((*len -= sz) <= 0) + return; + *str += sz; + } + } + else { + if (paren) { + sz = snprintf(*str, *len, "("); + if ((*len -= sz) <= 0) + return; + *str += sz; + } + LispSnprintObj(mac, car, str, len, car->type == LispCons_t); + if (*len <= 0) + return; + if (cdr->type != LispCons_t) { + sz = snprintf(*str, *len, " . "); + if ((*len -= sz) <= 0) + return; + *str += sz; + LispSnprintObj(mac, cdr, str, len, 0); + } + else { + sz = snprintf(*str, *len, " "); + if ((*len -= sz) <= 0) + return; + *str += sz; + LispSnprintObj(mac, cdr, str, len, car->type != LispCons_t && + cdr->type != LispCons_t); + if (*len <= 0) + return; + } + if (paren) { + sz = snprintf(*str, *len, ")"); + *len -= sz; + *str += sz; + } + } + } break; + case LispQuote_t: + sz = snprintf(*str, *len, "'"); + *len -= sz; + *str += sz; + LispSnprintObj(mac, obj->data.quote, str, len, 1); + break; + case LispBackquote_t: + sz = snprintf(*str, *len, "`"); + *len -= sz; + *str += sz; + LispSnprintObj(mac, obj->data.quote, str, len, 1); + break; + case LispComma_t: + if (obj->data.comma.atlist) + sz = snprintf(*str, *len, ",@"); + else + sz = snprintf(*str, *len, ","); + *len -= sz; + *str += sz; + LispSnprintObj(mac, obj->data.comma.eval, str, len, 1); + break; + case LispArray_t: + if (obj->data.array.rank == 1) + sz = snprintf(*str, *len, "#("); + else + sz = snprintf(*str, *len, "#%dA(", obj->data.array.rank); + if ((*len -= sz) <= 0) + return; + *str += sz; + if (!obj->data.array.zero) { + if (obj->data.array.rank == 1) { + LispObj *ary; + long count; + + for (ary = obj->data.array.dim, count = 1; + ary != NIL; ary = CDR(ary)) + count *= (int)NUMBER_VALUE(CAR(ary)); + for (ary = obj->data.array.list; count > 0; + ary = CDR(ary), count--) { + LispSnprintObj(mac, CAR(ary), str, len, 0); + if (*len <= 0) + return; + if (count - 1 > 0) { + sz = snprintf(*str, *len, " "); + if ((*len -= sz) <= 0) + return; + *str += sz; + } + } + } + else { + LispObj *ary; + int i, k, rank, *dims, *loop; + + rank = obj->data.array.rank; + dims = LispMalloc(mac, sizeof(int) * rank); + loop = LispCalloc(mac, 1, sizeof(int) * (rank - 1)); + + /* fill dim */ + for (i = 0, ary = obj->data.array.dim; ary != NIL; + i++, ary = CDR(ary)) + dims[i] = (int)NUMBER_VALUE(CAR(ary)); + + i = 0; + ary = obj->data.array.list; + while (loop[0] < dims[0]) { + for (; i < rank - 1; i++) { + sz = snprintf(*str, *len, "("); + if ((*len -= sz) <= 0) + goto snprint_array_done; + *str += sz; + } + --i; + for (;;) { + ++loop[i]; + if (i && loop[i] >= dims[i]) + loop[i] = 0; + else + break; + --i; + } + for (k = 0; k < dims[rank - 1] - 1; k++, ary = CDR(ary)) { + LispSnprintObj(mac, CAR(ary), str, len, 0); + if (*len <= 0) + goto snprint_array_done; + sz = snprintf(*str, *len, " "); + if ((*len -= sz) <= 0) + goto snprint_array_done; + *str += sz; + } + LispSnprintObj(mac, CAR(ary), str, len, 1); + if (*len <= 0) + goto snprint_array_done; + ary = CDR(ary); + for (k = rank - 1; k > i; k--) { + sz = snprintf(*str, *len, ")"); + if ((*len -= sz) <= 0) + goto snprint_array_done; + *str += sz; + } + if (loop[0] < dims[0]) { + sz = snprintf(*str, *len, " "); + if ((*len -= sz) <= 0) + goto snprint_array_done; + *str += sz; + } + } + +snprint_array_done: + LispFree(mac, dims); + LispFree(mac, loop); + } + } + sz = snprintf(*str, *len, ")"); + *len -= sz; + *str += sz; + break; + case LispStruct_t: { + LispObj *def = obj->data.struc.def; + LispObj *field = obj->data.struc.fields; + + sz = snprintf(*str, *len, "S#(%s", STRPTR(CAR(def))); + if ((*len -= sz) <= 0) + return; + *str += sz; + def = CDR(def); + for (; def != NIL; def = CDR(def), field = CDR(field)) { + sz = snprintf(*str, *len, " :%s ", SYMBOL_P(CAR(def)) ? + STRPTR(CAR(def)) : STRPTR(CAR(CAR(def)))); + if ((*len -= sz) <= 0) + return; + *str += sz; + LispSnprintObj(mac, CAR(field), str, len, 1); + if (*len <= 0) + return; + } + sz = snprintf(*str, *len, ")"); + *len -= sz; + *str += sz; + } break; + default: + break; + } +} + +char * +LispStrObj(LispMac *mac, LispObj *obj) +{ + static char string[12]; + + LispSnprint(mac, obj, string, sizeof(string) - 1); + return (string); +} + +void +LispSnprint(LispMac *mac, LispObj *obj, char *str, int len) +{ + char *s = str; + int l = len; + + if (!obj || !str || len <= 0) + LispDestroy(mac, "internal error, at INTERNAL:SPRINT"); + LispSnprintObj(mac, obj, &str, &len, 1); + if (len <= 0) { + /* this is a internal function, so I assume that str has enough space */ + if (*s == '(') + strcpy(s + l - 5, "...)"); + else + strcpy(s + l - 4, "..."); + } +} + +/* assumes string is writable, escapes " as \" and \ as \\ */ +int +LispPrintString(LispMac *mac, LispObj *stream, char *str) +{ + int len, ch; + char *prt, *ptr, *pquote, *pslash; + + if (!mac->princ) { + len = LispPrintf(mac, stream, "%c", '"'); + for (prt = str, pquote = strchr(prt, '"'), pslash = strchr(prt, '\\'); + pquote || pslash; + prt = ptr, pquote = pquote ? strchr(prt, '"') : NULL, + pslash = pslash ? strchr(prt, '\\') : NULL) { + if (pquote && pslash) + ptr = pquote < pslash ? pquote : pslash; + else + ptr = pquote ? pquote : pslash; + ch = ptr == pquote ? '"' : '\\'; + *ptr = '\0'; + len += LispPrintf(mac, stream, "%s", prt); + len += LispPrintf(mac, stream, "%c%c", '\\', ch); + *ptr = ch; + ++ptr; + } + len += LispPrintf(mac, stream, "%s", prt); + len += LispPrintf(mac, stream, "%c", '"'); + } + else + len = LispPrintf(mac, stream, "%s", str); + + return (len); +} + +int +LispPrintf(LispMac *mac, LispObj *stream, char *fmt, ...) +{ + int size; + va_list ap; + FILE *fp = NULL; + + if (stream == NIL) + fp = lisp_stdout; + else if (stream->data.stream.size < 0) + fp = stream->data.stream.source.fp; + + va_start(ap, fmt); + if (fp && !mac->justsize) + size = vfprintf(fp, fmt, ap); + else { + int n; + unsigned char stk[1024], *ptr = stk; + + size = sizeof(stk); + n = vsnprintf((char*)stk, size, fmt, ap); + if (n < 0 || n >= size) { + while (1) { + char *tmp; + + va_end(ap); + if (n > size) + size = n + 1; + else + size *= 2; + if ((tmp = realloc(ptr, size)) == NULL) { + free(ptr); + LispDestroy(mac, "out of memory"); + } + va_start(ap, fmt); + n = vsnprintf((char*)ptr, size, fmt, ap); + if (n >= 0 && n < size) + break; + } + } + size = strlen((char*)ptr); + + if (!mac->justsize) { + while (stream->data.stream.idx + size >= stream->data.stream.size) { + unsigned char *tmp = realloc(stream->data.stream.source.str, + stream->data.stream.size + pagesize); + + if (tmp == NULL) { + if (ptr != stk) + free(ptr); + LispDestroy(mac, "out of memory"); + } + stream->data.stream.source.str = tmp; + stream->data.stream.size += pagesize; + } + strcpy((char*)stream->data.stream.source.str + + stream->data.stream.idx, (char*)ptr); + stream->data.stream.idx += size; + } + if (ptr != stk) + free(ptr); + } + va_end(ap); + + return (size); +} + +int +LispPrintObj(LispMac *mac, LispObj *stream, LispObj *obj, int paren) +{ + int len = 0; + + switch (obj->type) { + case LispNil_t: + len += LispPrintf(mac, stream, "NIL"); + break; + case LispTrue_t: + len += LispPrintf(mac, stream, "T"); + break; + case LispOpaque_t: + len += LispPrintf(mac, stream, "#0x%08x-%s", + (int)obj->data.opaque.data, + LispIntToOpaqueType(mac, obj->data.opaque.type)); + break; + case LispAtom_t: + len += LispPrintf(mac, stream, "%s", STRPTR(obj)); + break; + case LispString_t: + len += LispPrintString(mac, stream, STRPTR(obj)); + break; + case LispCharacter_t: + if (!mac->princ) + len += LispPrintf(mac, stream, "#\\"); + if (obj->data.integer >= 0 && obj->data.integer <= ' ') + len += LispPrintf(mac, stream, "%s", + LispCharNames[obj->data.integer]); + else if (obj->data.integer == 0177) + len += LispPrintf(mac, stream, "Rubout"); + else if (obj->data.integer > 0xff) + len += LispPrintf(mac, stream, "U%04X", (int)obj->data.integer); + else + len += LispPrintf(mac, stream, "%c", obj->data.integer); + break; + case LispReal_t: + len += LispPrintf(mac, stream, "%g", obj->data.real); + break; + case LispInteger_t: + len += LispPrintf(mac, stream, "%ld", obj->data.integer); + break; + case LispCons_t: { + LispObj *car, *cdr; + + car = CAR(obj); + cdr = CDR(obj); + if (!cdr || cdr->type == LispNil_t) { + if (paren) + len += LispPrintf(mac, stream, "("); + len += LispPrintObj(mac, stream, car, car->type == LispCons_t); + if (paren) + len += LispPrintf(mac, stream, ")"); + } + else { + if (paren) + len += LispPrintf(mac, stream, "("); + LispPrintObj(mac, stream, car, car->type == LispCons_t); + if (cdr->type != LispCons_t) { + len += LispPrintf(mac, stream, " . "); + len += LispPrintObj(mac, stream, cdr, 0); + } + else { + len += LispPrintf(mac, stream, " "); + len += LispPrintObj(mac, stream, cdr, + car->type != LispCons_t && + cdr->type != LispCons_t); + } + if (paren) + len += LispPrintf(mac, stream, ")"); + } + } break; + case LispQuote_t: + len += LispPrintf(mac, stream, "'"); + len += LispPrintObj(mac, stream, obj->data.quote, 1); + break; + case LispBackquote_t: + len += LispPrintf(mac, stream, "`"); + len += LispPrintObj(mac, stream, obj->data.quote, 1); + break; + case LispComma_t: + if (obj->data.comma.atlist) + len += LispPrintf(mac, stream, ",@"); + else + len += LispPrintf(mac, stream, ","); + len += LispPrintObj(mac, stream, obj->data.comma.eval, 1); + break; + case LispArray_t: + if (obj->data.array.rank == 1) + len += LispPrintf(mac, stream, "#("); + else + len += LispPrintf(mac, stream, "#%dA(", obj->data.array.rank); + + if (!obj->data.array.zero) { + if (obj->data.array.rank == 1) { + LispObj *ary; + long count; + + for (ary = obj->data.array.dim, count = 1; + ary != NIL; ary = CDR(ary)) + count *= (int)NUMBER_VALUE(CAR(ary)); + for (ary = obj->data.array.list; count > 0; + ary = CDR(ary), count--) { + len += LispPrintObj(mac, stream, CAR(ary), 0); + if (count - 1 > 0) + len += LispPrintf(mac, stream, " "); + } + } + else { + LispObj *ary; + int i, k, rank, *dims, *loop; + + rank = obj->data.array.rank; + dims = LispMalloc(mac, sizeof(int) * rank); + loop = LispCalloc(mac, 1, sizeof(int) * (rank - 1)); + + /* fill dim */ + for (i = 0, ary = obj->data.array.dim; ary != NIL; + i++, ary = CDR(ary)) + dims[i] = (int)NUMBER_VALUE(CAR(ary)); + + i = 0; + ary = obj->data.array.list; + while (loop[0] < dims[0]) { + for (; i < rank - 1; i++) + len += LispPrintf(mac, stream, "("); + --i; + for (;;) { + ++loop[i]; + if (i && loop[i] >= dims[i]) + loop[i] = 0; + else + break; + --i; + } + for (k = 0; k < dims[rank - 1] - 1; k++, ary = CDR(ary)) { + len += LispPrintObj(mac, stream, CAR(ary), 1); + len += LispPrintf(mac, stream, " "); + } + len += LispPrintObj(mac, stream, CAR(ary), 0); + ary = CDR(ary); + for (k = rank - 1; k > i; k--) + len += LispPrintf(mac, stream, ")"); + if (loop[0] < dims[0]) + len += LispPrintf(mac, stream, " "); + } + LispFree(mac, dims); + LispFree(mac, loop); + } + } + len += LispPrintf(mac, stream, ")"); + break; + case LispStruct_t: { + LispObj *def = obj->data.struc.def; + LispObj *field = obj->data.struc.fields; + + len += LispPrintf(mac, stream, "S#(%s", STRPTR(CAR(def))); + def = CDR(def); + for (; def != NIL; def = CDR(def), field = CDR(field)) { + len += LispPrintf(mac, stream, " :%s ", + SYMBOL_P(CAR(def)) ? + STRPTR(CAR(def)) : + STRPTR(CAR(CAR(def)))); + len += LispPrintObj(mac, stream, CAR(field), 1); + } + len += LispPrintf(mac, stream, ")"); + } break; + case LispLambda_t: + switch (obj->data.lambda.type) { + case LispLambda: + len += LispPrintf(mac, stream, "#<LAMBDA "); + break; + case LispFunction: + len += LispPrintf(mac, stream, "#<FUNCTION %s ", + STRPTR(obj->data.lambda.name)); + break; + case LispMacro: + len += LispPrintf(mac, stream, "#<MACRO %s ", + STRPTR(obj->data.lambda.name)); + break; + case LispSetf: + len += LispPrintf(mac, stream, "#<SETF %s ", + STRPTR(obj->data.lambda.name)); + break; + } + len += LispPrintObj(mac, stream, obj->data.lambda.code, 1); + len += LispPrintf(mac, stream, ">"); + break; + case LispStream_t: + if (obj->data.stream.size < 0) + len += LispPrintf(mac, stream, "#<STREAM 0x%8x>", + (int)obj->data.stream.source.fp); + else + len += LispPrintString(mac, stream, + obj->data.stream.source.str ? + (char*)obj->data.stream.source.str : ""); + break; + } + + return (len); +} + +void +LispPrint(LispMac *mac, LispObj *obj, LispObj *stream, int newline) +{ + if (!obj || !stream) + LispDestroy(mac, "internal error, at INTERNAL:PRINT"); + if (stream != NIL && stream->type != LispStream_t) + LispDestroy(mac, "%s is not a stream", LispStrObj(mac, stream)); + if (newline && !mac->newline) { + LispPrintf(mac, stream, "\n"); + mac->column = 0; + } + /* XXX maybe should check for newlines in object */ + mac->column = LispPrintObj(mac, stream, obj, 1); + mac->newline = 0; + fflush(lisp_stdout); +} + +void +LispUpdateResults(LispMac *mac, LispObj *cod, LispObj *res) +{ + GCProtect(); + LispSetVar(mac, RUN[2], LispGetVar(mac, RUN[1])); + LispSetVar(mac, RUN[1], LispGetVar(mac, RUN[0])); + LispSetVar(mac, RUN[0], cod); + + LispSetVar(mac, RES[2], LispGetVar(mac, RES[1])); + LispSetVar(mac, RES[1], LispGetVar(mac, RES[0])); + LispSetVar(mac, RES[0], res); + GCUProtect(); +} + +/* Needs a rewrite to either allow only one LispMac per process or some + * smarter error handling */ +static LispMac *global_mac = NULL; + +#ifdef SIGNALRETURNSINT +int +LispAbortSignal(int signum) +{ + if (global_mac != NULL) + LispDestroy(global_mac, "aborted"); +} + +int +LispFPESignal(int signum) +{ + if (global_mac != NULL) + LispDestroy(global_mac, "Floating point exception"); +} +#else +void +LispAbortSignal(int signum) +{ + if (global_mac != NULL) + LispDestroy(global_mac, "aborted"); +} + +void +LispFPESignal(int signum) +{ + if (global_mac != NULL) + LispDestroy(global_mac, "Floating point exception"); +} +#endif + +void +LispMachine(LispMac *mac) +{ + LispObj *cod, *obj; + + LispTopLevel(mac); + /*CONSTCOND*/ + while (1) { + mac->sigint = signal(SIGINT, LispAbortSignal); + mac->sigfpe = signal(SIGFPE, LispFPESignal); + global_mac = mac; + if (sigsetjmp(mac->jmp, 1) == 0) { + mac->running = 1; + if (mac->interactive && mac->prompt) { + fprintf(lisp_stdout, "%s", mac->prompt); + fflush(lisp_stdout); + } + mac->level = 0; + if ((cod = LispRun(mac)) != NULL) { + if (cod == EOLIST) + LispDestroy(mac, "object cannot start with #\\)"); + obj = EVAL(cod); + if (mac->interactive) { + LispPrint(mac, obj, NIL, 1); + LispUpdateResults(mac, cod, obj); + if (!mac->newline) { + LispPrintf(mac, NIL, "\n"); + mac->newline = 1; + mac->column = 0; + } + } + } + signal(SIGINT, mac->sigint); + signal(SIGFPE, mac->sigfpe); + global_mac = NULL; + LispTopLevel(mac); + if (mac->tok == EOF) + break; + continue; + } + signal(SIGINT, mac->sigint); + signal(SIGFPE, mac->sigfpe); + global_mac = NULL; + } + mac->running = 0; +} + +void +LispExecute(LispMac *mac, char *str) +{ + int level, running = mac->running; + LispObj *obj; + + if (str == NULL || *str == '\0') + return; + + if (mac->stream.stream_level + 1 >= mac->stream.stream_size) { + LispStream *stream = (LispStream*) + realloc(mac->stream.stream, sizeof(LispStream) * + (mac->stream.stream_size + 1)); + + if (stream == NULL) { + fprintf(lisp_stderr, "out of memory"); + return; + } + + mac->stream.stream = stream; + ++mac->stream.stream_size; + } + mac->stream.stream[mac->stream.stream_level].fp = mac->fp; + mac->stream.stream[mac->stream.stream_level].st = mac->st; + mac->stream.stream[mac->stream.stream_level].cp = mac->cp; + mac->stream.stream[mac->stream.stream_level].tok = mac->tok; + ++mac->stream.stream_level; + memset(mac->stream.stream + mac->stream.stream_level, 0, sizeof(LispStream)); + mac->stream.stream[mac->stream.stream_level].fp = NULL; + mac->fp = NULL; + mac->st = mac->cp = LispStrdup(mac, str); + mac->tok = 0; + + level = mac->level; + mac->level = 0; + + if (running || sigsetjmp(mac->jmp, 1) == 0) { + if (!running) + mac->running = 1; + + /*CONSTCOND*/ + while (1) { + if ((obj = LispRun(mac)) != NULL) { + if (obj == EOLIST) + LispDestroy(mac, "object cannot start with #\\)"); + GCProtect(); + (void)EVAL(obj); + GCUProtect(); + } + if (mac->tok == EOF) + break; + } + + LispFree(mac, mac->st); + mac->level = level; + --mac->stream.stream_level; + + mac->fp = mac->stream.stream[mac->stream.stream_level].fp; + mac->st = mac->stream.stream[mac->stream.stream_level].st; + mac->cp = mac->stream.stream[mac->stream.stream_level].cp; + mac->tok = mac->stream.stream[mac->stream.stream_level].tok; + } + mac->running = running; +} + +LispMac * +LispBegin(int argc, char *argv[]) +{ + int i; + char results[4]; + char *fname = "INTERNAL:BEGIN"; + LispMac *mac = malloc(sizeof(LispMac)); + + if (mac == NULL) + return (NULL); + + if (lisp_stdin == NULL) + lisp_stdin = fdopen(0, "r"); + if (lisp_stdout == NULL) + lisp_stdout = fdopen(1, "w"); + if (lisp_stderr == NULL) + lisp_stderr = fdopen(2, "w"); + + pagesize = GetPageSize(); + segsize = pagesize / sizeof(LispObj); + bzero((char*)mac, sizeof(LispMac)); + MOD = ENV = GLB = LEX = COD = FRM = DBG = BRK = PRO = NIL; + LispAllocSeg(mac); + + /* initialize stream management */ + mac->stream.stream = (LispStream*)calloc(1, sizeof(LispStream)); + if (argc > 1) { + i = 1; + + if (strcmp(argv[1], "-d") == 0) { + mac->debugging = 1; + mac->debug_level = -1; + ++i; + } + if (i < argc && + (mac->stream.stream[0].fp = mac->fp = fopen(argv[i], "r")) == NULL) { + fprintf(lisp_stderr, "Cannot open %s.\n", argv[i]); + exit(1); + } + } + if (mac->fp == NULL) { + mac->stream.stream[0].fp = mac->fp = lisp_stdin; + mac->interactive = 1; + } + else { + int ch = LispGet(mac); + + if (ch != '#') + LispUnget(mac); + else if (LispGet(mac) == '!') { + for (;;) { + ch = LispGet(mac); + if (ch == '\n' || ch == EOF) + break; + } + } + else { + LispUnget(mac); + LispUnget(mac); + } + } + mac->stream.stream_size = 1; + + /* initialize memory management */ + mac->mem.mem = (void**)calloc(mac->mem.mem_size = 16, sizeof(void*)); + mac->mem.mem_level = 0; + + mac->prompt = "> "; + mac->newline = 1; + mac->column = 0; + + mac->errexit = !mac->interactive; + + if (mac->interactive) { + /* add +, ++, +++, *, **, and *** */ + for (i = 0; i < 3; i++) { + results[i] = '+'; + results[i + 1] = '\0'; + RUN[i] = ATOM2(results); + _LispSet(mac, RUN[i], NIL, fname, 0); + } + for (i = 0; i < 3; i++) { + results[i] = '*'; + results[i + 1] = '\0'; + RES[i] = ATOM2(results); + _LispSet(mac, RES[i], NIL, fname, 0); + } + } + else + RUN[0] = RUN[1] = RUN[2] = RES[0] = RES[1] = RES[2] = NIL; + + for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) + LispAddBuiltinFunction(mac, &lispbuiltins[i]); + + return (mac); +} + +void +LispEnd(LispMac *mac) +{ + if (mac->fp != lisp_stdin) + fclose(mac->fp); +} + +void +LispSetPrompt(LispMac *mac, char *prompt) +{ + mac->prompt = prompt; +} + +void +LispSetInteractive(LispMac *mac, int interactive) +{ + mac->interactive = !!interactive; +} + +void +LispSetExitOnError(LispMac *mac, int errexit) +{ + mac->errexit = !!errexit; +} + +void +LispDebug(LispMac *mac, int enable) +{ + mac->debugging = !!enable; + + /* assumes we are at the toplevel */ + DBG = BRK = NIL; + mac->debug_level = -1; + mac->debug_step = 0; +} Index: xc/programs/xedit/lisp/lisp.cf diff -u /dev/null xc/programs/xedit/lisp/lisp.cf:1.4 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/lisp.cf Sat Oct 27 23:34:31 2001 @@ -0,0 +1,15 @@ +XCOMM $XFree86: xc/programs/xedit/lisp/lisp.cf,v 1.4 2001/10/28 03:34:31 tsi Exp $ + +#if 0 +#ifndef BuildSharedLispModules +#if HasDlopen +#define BuildSharedLispModules YES +#else +#define BuildSharedLispModules NO +#endif +#endif +#else +#define BuildSharedLispModules NO +#endif + +LISPDIR = $(LIBDIR)/xedit/lisp Index: xc/programs/xedit/lisp/lisp.h diff -u /dev/null xc/programs/xedit/lisp/lisp.h:1.2 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/lisp.h Wed Oct 3 03:46:02 2001 @@ -0,0 +1,46 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/lisp.h,v 1.2 2001/10/03 07:46:02 paulo Exp $ */ + +#ifndef Lisp_lisp_h +#define Lisp_lisp_h + +typedef struct _LispMac LispMac; + +LispMac *LispBegin(int argc, char *argv[]); +void LispEnd(LispMac*); +void LispExecute(LispMac*, char*); +void LispMachine(LispMac*); +void LispSetPrompt(LispMac*, char*); +void LispSetInteractive(LispMac*, int); +void LispSetExitOnError(LispMac*, int); +void LispDebug(LispMac*, int); /* argument is boolean to enable/disable */ + +#endif /* Lisp_lisp_h */ Index: xc/programs/xedit/lisp/lisp.rules diff -u /dev/null xc/programs/xedit/lisp/lisp.rules:1.9 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/lisp.rules Sat Oct 27 23:34:31 2001 @@ -0,0 +1,18 @@ +XCOMM $XFree86: xc/programs/xedit/lisp/lisp.rules,v 1.9 2001/10/28 03:34:31 tsi Exp $ + +#ifndef LispModuleTarget +#define LispModuleTarget(module,liblist,options) @@\ +AllTarget(module.so) @@\ + @@\ +module.o: module.c @@\ + RemoveFile($@) @@\ + $(CC) -c $(CFLAGS) options -o $@ $? @@\ + @@\ +module.so: module.o @@\ + RemoveFile($@) @@\ + $(CC) -o $@ $(SHLIBLDFLAGS) $? $(LDOPTIONS) liblist $(EXTRA_LOAD_FLAGS) @@\ + @@\ +clean:: @@\ + RemoveFile(module.o) @@\ + RemoveFile(module.so) +#endif Index: xc/programs/xedit/lisp/lsp.c diff -u /dev/null xc/programs/xedit/lisp/lsp.c:1.1 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/lsp.c Fri Aug 31 11:00:14 2001 @@ -0,0 +1,45 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/lsp.c,v 1.1 2001/08/31 15:00:14 paulo Exp $ */ + +#include "lisp.h" + +int +main(int argc, char *argv[]) +{ + LispMac *mac = LispBegin(argc, argv); + + LispExecute(mac, "(require \"fun\")\n"); + LispMachine(mac); + + LispEnd(mac); + + return (0); +} Index: xc/programs/xedit/lisp/private.h diff -u /dev/null xc/programs/xedit/lisp/private.h:1.15 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/private.h Fri Oct 19 20:19:35 2001 @@ -0,0 +1,279 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/private.h,v 1.15 2001/10/20 00:19:35 paulo Exp $ */ + +#ifndef Lisp_private_h +#define Lisp_private_h + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <setjmp.h> +#include <unistd.h> +#include <sys/time.h> +#include "internal.h" + +#include "core.h" +#include "debugger.h" +#include "helper.h" +#include "string.h" +#include "struct.h" + +/* + * Defines + */ +#define STRTBLSZ 23 + +#define MOD mac->modlist +#define GLB mac->glblist +#define ENV mac->envlist +#define LEX mac->lexlist +#define COD mac->codlist +#define FRM mac->frmlist +#define RUN mac->runlist +#define RES mac->reslist +#define DBG mac->dbglist +#define BRK mac->brklist +#define PRO mac->prolist + +#define EOLIST (LispObj*)1 /* end-of-list ")" found in LispRun */ + +/* + * Types + */ +typedef struct _LispStream LispStream; +typedef struct _LispBlock LispBlock; +typedef struct _LispOpaque LispOpaque; +typedef struct _LispModule LispModule; +typedef struct _LispProperty LispProperty; + +struct _LispStream { + FILE *fp; + char *st; + char *cp; + int tok; +}; + +/* Possible values to attach to a LispAtom include: + * a generic LispObject for global variable value + * a function definition + * a pointer to a builtin function definition + * the atom properties list, read with (get), set with (setf (get ...) ...) + * a setf expansion macro or function replacement name + * a structure definition + */ +struct _LispProperty { + unsigned int object : 1; + unsigned int function : 1; + unsigned int builtin : 1; + unsigned int property : 1; + unsigned int defsetf : 1; + unsigned int defstruct : 1; + LispObj *value; + union { + LispObj *function; + LispBuiltin *builtin; + } fun; /* cannot have both, a builtin and user function attached, + * virtually, builtin and user function are the same */ + LispObj *properties; + LispObj *setf; + struct { + LispObj *definition; +#define STRUCT_CHECK -2 +#define STRUCT_CONSTRUCTOR -1 + int function; /* if >= 0, it is a structure field index */ + } structure; +}; + +struct _LispAtom { + unsigned int mark : 1; /* gc protected */ + unsigned int dirty : 1; + unsigned int prot : 1; /* never released */ + char *string; + LispProperty *property; + struct _LispAtom *next; +}; + +struct _LispOpaque { + int type; + char *desc; + LispOpaque *next; +}; + +typedef enum _LispBlockType { + LispBlockTag, /* may become "invisible" */ + LispBlockCatch, /* can be used to jump across function calls */ + LispBlockClosure, /* hides blocks of type LispBlockTag bellow it */ + LispBlockProtect, /* used by unwind-protect */ + LispBlockBody /* used by tagbody and go */ +} LispBlockType; + +struct _LispBlock { + LispBlockType type; + LispObj tag; + jmp_buf jmp; + int level; + int block_level; + int debug_level; + int debug_step; +}; + +struct _LispModule { + LispModule *next; + void *handle; + LispModuleData *data; +}; + +struct _LispMac { + FILE *fp; + char *st; + char *cp; + int tok; + int level; + int princ; /* don't quote strings? */ + int justsize; /* just calculate size of output, + * needed to calculate formatted output */ + int newline; /* at a newline in the output */ + int column; /* column number in the output */ + int interactive; + int errexit; + LispAtom *strs[STRTBLSZ]; + LispOpaque *opqs[STRTBLSZ]; + int opaque; + sigjmp_buf jmp; + struct { + unsigned stream_level; + unsigned stream_size; + LispStream *stream; + } stream; + struct { + unsigned block_level; + unsigned block_size; + LispObj *block_ret; + LispBlock **block; + } block; + struct { + unsigned mem_level; + unsigned mem_size; + void **mem; + } mem; /* memory from Lisp*Alloc, to be release in error */ + LispModule *module; + char *prompt; + + LispObj *modlist; /* module list */ + LispObj *glblist; /* global variables */ + LispObj *envlist; /* alive variables */ + LispObj *lexlist; /* lexical instead of dynamic scope */ + LispObj *codlist; /* current code */ + LispObj *frmlist; /* input data */ + LispObj *runlist[3]; /* +, ++, and +++ */ + LispObj *reslist[3]; /* *, **, and *** */ + LispObj *dbglist; /* debug information */ + LispObj *brklist; /* breakpoints information */ + LispObj *prolist; /* protect objects list */ + +#ifdef SIGNALRETURNSINT + int (*sigint)(int); + int (*sigfpe)(int); +#else + void (*sigint)(int); + void (*sigfpe)(int); +#endif + + int destroyed; /* reached LispDestroy, used by unwind-protect */ + int running; /* there is somewhere to siglongjmp */ + + int debugging; /* debugger enabled? */ + int debug_level; /* almost always the same as mac->level */ + int debug_step; /* control for stoping and printing output */ + int debug_break; /* next breakpoint number */ + LispDebugState debug; +}; + +/* + * Prototypes + */ +LispObj *LispEnvRun(LispMac*, LispObj*, LispFunPtr, char*, int); +LispObj *LispGetVar(LispMac*, LispObj*); +LispObj *LispGetVarCons(LispMac*, LispObj*); /* used by debugger */ +LispObj *LispAddVar(LispMac*, LispObj*, LispObj*); +LispObj *LispSetVar(LispMac*, LispObj*, LispObj*); +void LispUnsetVar(LispMac*, LispObj*); + +/* destructive fast reverse, note that don't receive a LispMac* argument */ +LispObj *LispReverse(LispObj *list); + +/* reads an expression from the selected stream */ +LispObj *LispRun(LispMac*); + +#if 0 +/* generated by gperf */ +extern struct _LispBuiltin *LispFindBuiltin(const char*, unsigned int); +#endif + +/* (print) */ +void LispPrint(LispMac*, LispObj*, LispObj*, int); + +LispBlock *LispBeginBlock(LispMac*, LispObj*, LispBlockType); +void LispEndBlock(LispMac*, LispBlock*); + /* if unwind-protect active, jump to cleanup code, else do nothing */ +void LispBlockUnwind(LispMac*); + +void LispUpdateResults(LispMac*, LispObj*, LispObj*); +void LispTopLevel(LispMac*); + +LispAtom *LispDoGetAtom(LispMac*, char *str, int, int); + /* get value from atom's property list */ +LispObj *LispGetAtomProperty(LispMac*, LispAtom*, LispObj*); + /* put value in atom's property list */ +LispObj *LispPutAtomProperty(LispMac*, LispAtom*, LispObj*, LispObj*); + + /* create or change object property */ +void LispSetAtomObjectProperty(LispMac*, LispAtom*, LispObj*); + /* remove object property */ +void LispRemAtomObjectProperty(LispMac*, LispAtom*); + /* define function, or replace function definition */ +void LispSetAtomFunctionProperty(LispMac*, LispAtom*, LispObj*); + /* remove function property */ +void LispRemAtomFunctionProperty(LispMac*, LispAtom*); + /* define builtin, or replace builtin definition */ +void LispSetAtomBuiltinProperty(LispMac*, LispAtom*, LispBuiltin*); + /* remove builtin property */ +void LispRemAtomBuiltinProperty(LispMac*, LispAtom*); + /* define setf macro, or replace current definition */ +void LispSetAtomSetfProperty(LispMac*, LispAtom*, LispObj*); + /* remove setf macro */ +void LispRemAtomSetfProperty(LispMac*, LispAtom*); + /* create or change structure property */ +void LispSetAtomStructProperty(LispMac*, LispAtom*, LispObj*, int); + /* remove structure property */ +void LispRemAtomStructProperty(LispMac*, LispAtom*); + +#endif /* Lisp_private_h */ Index: xc/programs/xedit/lisp/require.c diff -u /dev/null xc/programs/xedit/lisp/require.c:1.7 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/require.c Wed Oct 17 23:15:22 2001 @@ -0,0 +1,142 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/require.c,v 1.7 2001/10/18 03:15:22 paulo Exp $ */ + +#include "require.h" + +/* + * Initialization + */ +static char *BadArgumentAt = "bad argument %s, at %s"; + +/* + * Implementation + */ +LispObj * +Lisp_Load(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *file = CAR(list), *verbose, *print, *ifdoesnotexist; + + if (!STRING_P(file)) + LispDestroy(mac, BadArgumentAt, LispStrObj(mac, file), fname); + + LispGetKeys(mac, fname, "VERBOSE:PRINT:IF-DOES-NOT-EXIST", CDR(list), + &verbose, &print, &ifdoesnotexist); + + return (_LispLoadFile(mac, STRPTR(file), fname, + verbose != NIL, print != NIL, ifdoesnotexist != NIL)); +} + +LispObj * +Lisp_Require(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *feat = CAR(list), *nam, *obj; + char filename[1024], *ext; + int len; + + if (!STRING_P(feat) && !SYMBOL_P(feat)) + LispDestroy(mac, BadArgumentAt, LispStrObj(mac, feat), fname); + + if (CDR(list) != NIL) { + nam = CAR(CDR(list)); + + if (!STRING_P(nam)) + LispDestroy(mac, "%s is not of type string, at %s", + LispStrObj(mac, nam), fname); + } + else + nam = feat; + + for (obj = MOD; obj != NIL; obj = CDR(obj)) { + if (STRPTR(CAR(obj)) == STRPTR(feat)) + return (feat); + } + + if (STRPTR(nam)[0] != '/') { +#ifdef LISPDIR + snprintf(filename, sizeof(filename), "%s", LISPDIR); +#else + getcwd(filename, sizeof(filename)); +#endif + } + else + filename[0] = '\0'; + *(filename + sizeof(filename) - 5) = '\0'; /* make sure there is place for ext */ + len = strlen(filename); + if (!len || filename[len - 1] != '/') { + strcat(filename, "/"); + ++len; + } + + snprintf(filename + len, sizeof(filename) - len - 5, "%s", STRPTR(nam)); + + ext = filename + strlen(filename); + +#ifdef SHARED_MODULES + strcpy(ext, ".so"); + if (access(filename, R_OK) == 0) { + LispModule *module; + char data[64]; + int len; + + if (mac->module == NULL) { + /* export our own symbols */ + if (dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL) == NULL) + LispDestroy(mac, dlerror()); + } + +#if 0 + if (mac->interactive) + fprintf(lisp_stderr, "; Loading %s\n", filename); +#endif + module = (LispModule*)LispMalloc(mac, sizeof(LispModule)); + if ((module->handle = dlopen(filename, RTLD_LAZY | RTLD_GLOBAL)) == NULL) + LispDestroy(mac, dlerror()); + snprintf(data, sizeof(data), "%sLispModuleData", STRPTR(nam)); + if ((module->data = (LispModuleData*)dlsym(module->handle, data)) == NULL) { + dlclose(module->handle); + LispDestroy(mac, "cannot find LispModuleData for %s", + LispStrObj(mac, feat)); + } + LispMused(mac, module); + module->next = mac->module; + mac->module = module; + if (module->data->load) + (module->data->load)(mac); + + return (Lisp_Provide(mac, CONS(feat, NIL), "PROVIDE")); + } +#endif + + strcpy(ext, ".lsp"); + (void)_LispLoadFile(mac, filename, fname, 0, 0, 0); + + return (feat); +} Index: xc/programs/xedit/lisp/require.h diff -u /dev/null xc/programs/xedit/lisp/require.h:1.2 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/require.h Mon Oct 15 03:05:52 2001 @@ -0,0 +1,44 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/require.h,v 1.2 2001/10/15 07:05:52 paulo Exp $ */ + +#ifndef Lisp_require_h +#define Lisp_require_h + +#include "private.h" +#include "helper.h" +#ifdef SHARED_MODULES +#include <dlfcn.h> +#endif + +LispObj *Lisp_Load(LispMac*, LispObj*, char*); /* load */ +LispObj *Lisp_Require(LispMac*, LispObj*, char*); /* require */ + +#endif /* Lisp_require_h */ Index: xc/programs/xedit/lisp/string.c diff -u /dev/null xc/programs/xedit/lisp/string.c:1.3 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/string.c Sat Oct 27 23:34:31 2001 @@ -0,0 +1,783 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/string.c,v 1.3 2001/10/28 03:34:31 tsi Exp $ */ + +#include "string.h" +#include "private.h" +#include <ctype.h> + +LispObj * +Lisp_Char(LispMac *mac, LispObj *list, char *fname) +{ + int c, pos; + LispObj *str = CAR(list), *idx = CAR(CDR(list)); + + if (!STRING_P(str)) + LispDestroy(mac, "%s is not a string, at %s", + LispStrObj(mac, str), fname); + if (!NUMBER_P(idx)) + LispDestroy(mac, "%s is not a number, at %s", + LispStrObj(mac, str), fname); + + if (INDEX_P(idx)) + LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, idx), fname); + + if ((pos = NUMBER_VALUE(idx)) >= strlen(STRPTR(str))) + LispDestroy(mac, "index %d is too large, at %s", pos, fname); + + c = *(unsigned char*)(STRPTR(str) + pos); + + return (CHAR(c)); +} + +/* helper function for setf + * DONT explicitly call. Non standard function + */ +LispObj * +Lisp_XeditCharStore(LispMac *mac, LispObj *list, char *fname) +{ + char *string; + int c, pos, len; + LispObj *str, *idx, *value; + + str = CAR(list); + if (!STRING_P(str)) + LispDestroy(mac, "%s is not a string, at %s", + LispStrObj(mac, str), fname); + list = CDR(list); + idx = CAR(list); + if (idx->type != LispReal_t) + LispDestroy(mac, "%s is not a number, at %s", + LispStrObj(mac, str), fname); + if (!INDEX_P(idx)) + LispDestroy(mac, "bad index %s, at %s", LispStrObj(mac, idx), fname); + if ((pos = NUMBER_VALUE(idx)) >= (len = strlen(STRPTR(str)))) + LispDestroy(mac, "index %d is too large, at %s", pos, fname); + list = CDR(list); + value = CAR(list); + if (value->type != LispCharacter_t) + LispDestroy(mac, "%s is not a character, at %s", + LispStrObj(mac, value), fname); + + c = value->data.integer; + + if (c < 0 || c > 255) + LispDestroy(mac, "cannot represent character %d, at %s", c, fname); + + string = LispStrdup(mac, STRPTR(str)); + string[pos] = c; + + str->data.atom = LispDoGetAtom(mac, string, 0, 0); + LispFree(mac, string); + + return (value); +} + +LispObj * +Lisp_CharLess(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, LESS, 0)); +} + +LispObj * +Lisp_CharLessEqual(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, LESS_EQUAL, 0)); +} + +LispObj * +Lisp_CharEqual_(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, EQUAL, 0)); +} + +LispObj * +Lisp_CharGreater(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, GREATER, 0)); +} + +LispObj * +Lisp_CharGreaterEqual(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, GREATER_EQUAL, 0)); +} + +LispObj * +Lisp_CharNotEqual_(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, NOT_EQUAL, 0)); +} + +LispObj * +Lisp_CharLessp(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, LESS, 1)); +} + +LispObj * +Lisp_CharNotGreaterp(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, LESS_EQUAL, 1)); +} + +LispObj * +Lisp_CharEqual(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, EQUAL, 1)); +} + +LispObj * +Lisp_CharGreaterp(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, GREATER, 1)); +} + +LispObj * +Lisp_CharNotLessp(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, GREATER_EQUAL, 1)); +} + +LispObj * +Lisp_CharNotEqual(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispCharBoolCond(mac, list, fname, NOT_EQUAL, 1)); +} + +LispObj * +Lisp_Character(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list); + + if (obj->type == LispCharacter_t) + return (obj); + else if ((SYMBOL_P(obj) || STRING_P(obj)) && + STRPTR(obj)[1] == '\0') + return (CHAR((unsigned char)STRPTR(obj)[0])); + else if (INDEX_P(obj)) { + int c = NUMBER_VALUE(obj); + + if (c <= 0xffff) + return (CHAR(c)); + } + + LispDestroy(mac, "cannot convert %s to character, at %s", + LispStrObj(mac, obj), fname); + + /*NOTREACHED*/ + return (NIL); +} + +LispObj * +Lisp_CharDowncase(LispMac *mac, LispObj *list, char *fname) +{ + int c; + LispObj *obj = CAR(list); + + if (obj->type != LispCharacter_t) + LispDestroy(mac, "%s is not a character, at %s", + LispStrObj(mac, obj), fname); + + c = tolower((int)obj->data.integer); + if (c == obj->data.integer) + return (obj); + + return (CHAR(c)); +} + +LispObj * +Lisp_CharInt(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list); + + if (obj->type != LispCharacter_t) + LispDestroy(mac, "%s is not a character, at %s", + LispStrObj(mac, obj), fname); + + return (REAL(obj->data.integer)); +} + +LispObj * +Lisp_CharUpcase(LispMac *mac, LispObj *list, char *fname) +{ + int c; + LispObj *obj = CAR(list); + + if (obj->type != LispCharacter_t) + LispDestroy(mac, "%s is not a character, at %s", + LispStrObj(mac, obj), fname); + + c = toupper((int)obj->data.integer); + if (c == obj->data.integer) + return (obj); + + return (CHAR(c)); +} + +LispObj * +Lisp_IntChar(LispMac *mac, LispObj *list, char *fname) +{ + long character = 0; + LispObj *obj = CAR(list); + + if (INTEGER_P(obj)) + character = NUMBER_VALUE(obj); + else + LispDestroy(mac, "cannot convert %s to character, at %s", + LispStrObj(mac, obj), fname); + + return (character >= 0 && character < 0xffff ? CHAR(character) : NIL); +} + +LispObj * +Lisp_String(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *obj = CAR(list); + + if (STRING_P(obj)) + return (obj); + else if (SYMBOL_P(obj)) + return (STRING(STRPTR(obj))); + else if (obj->type == LispCharacter_t) { + char string[2]; + + string[0] = obj->data.integer; + string[1] = '\0'; + return (STRING(string)); + } + else + LispDestroy(mac, "expecting string, symbol or character, at %s", fname); + /*NOTREACHED*/ + return (NIL); +} + +LispObj * +Lisp_ReadFromString(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + int level, length, start, end; + LispObj *res, *eof_error, *eof_value, *ostart, *oend, *preserve; + + if (!STRING_P(CAR(list))) + LispDestroy(mac, "expecting string, at %s", fname); + str = STRPTR(CAR(list)); + + length = strlen(str); + eof_error = eof_value = ostart = oend = preserve = NIL; + + list = CDR(list); + if (list != NIL) { + eof_error = CAR(list); + list = CDR(list); + if (list != NIL) { + eof_value = CAR(list); + list = CDR(list); + if (list != NIL) + LispGetKeys(mac, fname, "START:END:PRESERVE-WHITESPACE", list, + &ostart, &oend, &preserve); + } + } + + if (ostart == NIL) + start = 0; + else { + if (!INDEX_P(ostart)) + LispDestroy(mac, "expecting positive integer, at %s", fname); + start = NUMBER_VALUE(ostart); + } + if (oend == NIL) + end = length; + else { + if (!INDEX_P(oend)) + LispDestroy(mac, "expecting positive integer, at %s", fname); + end = NUMBER_VALUE(oend); + } + if (start >= end || end > length) + LispDestroy(mac, "bad string index or length, at %s", fname); + + if (mac->stream.stream_level + 1 >= mac->stream.stream_size) { + LispStream *stream = (LispStream*) + realloc(mac->stream.stream, sizeof(LispStream) * + (mac->stream.stream_size + 1)); + + if (stream == NULL) { + fprintf(lisp_stderr, "out of memory"); + return (NIL); + } + + mac->stream.stream = stream; + ++mac->stream.stream_size; + } + mac->stream.stream[mac->stream.stream_level].fp = mac->fp; + mac->stream.stream[mac->stream.stream_level].st = mac->st; + mac->stream.stream[mac->stream.stream_level].cp = mac->cp; + mac->stream.stream[mac->stream.stream_level].tok = mac->tok; + ++mac->stream.stream_level; + memset(mac->stream.stream + mac->stream.stream_level, 0, sizeof(LispStream)); + mac->stream.stream[mac->stream.stream_level].fp = NULL; + mac->fp = NULL; + length = end - start; + mac->st = mac->cp = LispMalloc(mac, length + 1); + strncpy(mac->st, str + start, length); + mac->st[length] = '\0'; + mac->tok = 0; + + level = mac->level; + mac->level = 0; + + res = LispRun(mac); + + LispFree(mac, mac->st); + mac->level = level; + --mac->stream.stream_level; + + mac->fp = mac->stream.stream[mac->stream.stream_level].fp; + mac->st = mac->stream.stream[mac->stream.stream_level].st; + mac->cp = mac->stream.stream[mac->stream.stream_level].cp; + mac->tok = mac->stream.stream[mac->stream.stream_level].tok; + + if (res == EOLIST) + LispDestroy(mac, "object cannot start with #\\)"); + if (res == NULL) + LispDestroy(mac, "unexpected end of input, at %s", fname); + + return (res); +} + +LispObj * +Lisp_StringTrim(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispStringDoTrim(mac, list, fname, 1, 1)); +} + +LispObj * +Lisp_StringLeftTrim(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispStringDoTrim(mac, list, fname, 1, 0)); +} + +LispObj * +Lisp_StringRightTrim(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispStringDoTrim(mac, list, fname, 0, 1)); +} + +LispObj * +Lisp_StringEqual_(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, len; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + len = end1 - start1; + + if (len != (end2 - start2) || + strncmp(string1 + start1, string2 + start2, len)) + return (NIL); + + return (T); +} + +/* Note, most functions bellow also compare with the ending '\0'. + * This is expected, to avoid an extra if */ +LispObj * +Lisp_StringLess(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) + if (*string1 < *string2) + return (REAL(c1)); + else if (*string1 != *string2) + break; + + return (NIL); +} + +LispObj * +Lisp_StringGreater(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) + if (*string1 > *string2) + return (REAL(c1)); + else if (*string1 != *string2) + break; + + return (NIL); +} + +LispObj * +Lisp_StringLessEqual(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) + if (*string1 < *string2) + return (REAL(c1)); + else if (*string1 != *string2) + return (NIL); + else if (!*string1) + break; + + return (REAL(c1)); +} + +LispObj * +Lisp_StringGreaterEqual(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) + if (*string1 > *string2) + return (REAL(c1)); + else if (*string1 != *string2) + return (NIL); + else if (!*string1) + break; + + return (REAL(c1)); +} + +LispObj * +Lisp_StringNotEqual_(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) + if (*string1 != *string2) + return (REAL(c1)); + + return (NIL); +} + +LispObj * +Lisp_StringEqual(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, len; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + len = end1 - start1; + + if (len != (end2 - start2) || + strncasecmp(string1 + start1, string2 + start2, len)) + return (NIL); + + return (T); +} + +LispObj * +Lisp_StringLessp(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2, ch1, ch2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) { + ch1 = toupper(*string1); + ch2 = toupper(*string2); + if (ch1 < ch2) + return (REAL(c1)); + else if (ch1 != ch2) + break; + } + + return (NIL); +} + +LispObj * +Lisp_StringGreaterp(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2, ch1, ch2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) { + ch1 = toupper(*string1); + ch2 = toupper(*string2); + if (ch1 > ch2) + return (REAL(c1)); + else if (ch1 != ch2) + break; + } + + return (NIL); +} + +LispObj * +Lisp_StringNotGreaterp(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2, ch1, ch2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) { + ch1 = toupper(*string1); + ch2 = toupper(*string2); + if (ch1 < ch2) + return (REAL(c1)); + else if (ch1 != ch2) + return (NIL); + else if (!*string1) + break; + } + + return (REAL(c1)); +} + +LispObj * +Lisp_StringNotLessp(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2, ch1, ch2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) { + ch1 = toupper(*string1); + ch2 = toupper(*string2); + if (ch1 > ch2) + return (REAL(c1)); + else if (ch1 != ch2) + return (NIL); + else if (!*string1) + break; + } + + return (REAL(c1)); +} + +LispObj * +Lisp_StringNotEqual(LispMac *mac, LispObj *list, char *fname) +{ + char *string1, *string2; + int start1, end1, start2, end2, c1, c2; + + _LispGetStringArgs(mac, list, fname, &string1, &string2, + &start1, &end1, &start2, &end2); + + string1 += start1; + string2 += start2; + + for (c1 = start1, c2 = start2; c1 <= end1 && c2 <= end2; + c1++, c2++, string1++, string2++) + if (toupper(*string1) != toupper(*string2)) + return (REAL(c1)); + + return (NIL); +} + +LispObj * +Lisp_StringUpcase(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res; + char *string, *str; + int start, end, c, done; + + _LispGetStringCaseArgs(mac, list, fname, &string, &start, &end); + + /* first check if something need to be done */ + for (done = 1, c = start; c < end; c++) + if (string[c] != toupper(string[c])) { + done = 0; + break; + } + + if (done) + return (CAR(list)); + + /* upcase a copy of argument */ + str = LispStrdup(mac, string); + for (c = start; c < end; c++) + str[c] = toupper(str[c]); + + res = STRING(str); + LispFree(mac, str); + + return (res); +} + +LispObj * +Lisp_StringDowncase(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res; + char *string, *str; + int start, end, c, done; + + _LispGetStringCaseArgs(mac, list, fname, &string, &start, &end); + + /* first check if something need to be done */ + for (done = 1, c = start; c < end; c++) + if (string[c] != tolower(string[c])) { + done = 0; + break; + } + + if (done) + return (CAR(list)); + + /* downcase a copy of argument */ + str = LispStrdup(mac, string); + for (c = start; c < end; c++) + str[c] = tolower(str[c]); + + res = STRING(str); + LispFree(mac, str); + + return (res); +} + +LispObj * +Lisp_StringCapitalize(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res; + char *string, *str; + int start, end, c, done, up; + + _LispGetStringCaseArgs(mac, list, fname, &string, &start, &end); + + /* first check if something need to be done */ + for (done = up = 1, c = start; c < end; c++) { + if (up) { + if (!isalpha(string[c])) + continue; + if (string[c] != toupper(string[c])) { + done = 0; + break; + } + up = 0; + } + else { + if (isalpha(string[c])) { + if (string[c] != tolower(string[c])) { + done = 0; + break; + } + } + else + up = 1; + } + } + + if (done) + return (CAR(list)); + + /* capitalize a copy of argument */ + str = LispStrdup(mac, string); + for (up = 1, c = start; c < end; c++) { + if (up) { + if (!isalpha(str[c])) + continue; + str[c] = toupper(str[c]); + up = 0; + } + else { + if (isalpha(string[c])) + str[c] = tolower(str[c]); + else + up = 1; + } + } + + res = STRING(str); + LispFree(mac, str); + + return (res); +} Index: xc/programs/xedit/lisp/string.h diff -u /dev/null xc/programs/xedit/lisp/string.h:1.2 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/string.h Wed Oct 17 23:15:22 2001 @@ -0,0 +1,77 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/string.h,v 1.2 2001/10/18 03:15:22 paulo Exp $ */ + +#ifndef Lisp_string_h +#define Lisp_string_h + +#include "internal.h" + +LispObj *Lisp_Char(LispMac*, LispObj*, char*); /* char */ +LispObj *Lisp_CharLess(LispMac*, LispObj*, char*); /* char< */ +LispObj *Lisp_CharLessEqual(LispMac*, LispObj*, char*); /* char<= */ +LispObj *Lisp_CharEqual_(LispMac*, LispObj*, char*); /* char= */ +LispObj *Lisp_CharGreater(LispMac*, LispObj*, char*); /* char> */ +LispObj *Lisp_CharGreaterEqual(LispMac*, LispObj*, char*); /* char>= */ +LispObj *Lisp_CharNotEqual_(LispMac*, LispObj*, char*); /* char/= */ +LispObj *Lisp_CharLessp(LispMac*, LispObj*, char*); /* char-lessp */ +LispObj *Lisp_CharNotGreaterp(LispMac*, LispObj*, char*); /* char-not-greaterp */ +LispObj *Lisp_CharEqual(LispMac*, LispObj*, char*); /* char-equal */ +LispObj *Lisp_CharGreaterp(LispMac*, LispObj*, char*); /* char-greaterp */ +LispObj *Lisp_CharNotLessp(LispMac*, LispObj*, char*); /* char-not-lessp */ +LispObj *Lisp_CharNotEqual(LispMac*, LispObj*, char*); /* char-not-equal */ +LispObj *Lisp_Character(LispMac*, LispObj*, char*); /* character */ +LispObj *Lisp_CharDowncase(LispMac*, LispObj*, char*); /* char-downcase */ +LispObj *Lisp_CharInt(LispMac*, LispObj*, char*); /* char-int */ +LispObj *Lisp_CharUpcase(LispMac*, LispObj*, char*); /* char-upcase */ +LispObj *Lisp_IntChar(LispMac*, LispObj*, char*); /* int-char */ +LispObj *Lisp_ReadFromString(LispMac*, LispObj*, char*); /* read-from-string */ +LispObj *Lisp_String(LispMac*, LispObj*, char*); /* string */ +LispObj *Lisp_StringTrim(LispMac*, LispObj*, char*); /* string-trim */ +LispObj *Lisp_StringLeftTrim(LispMac*, LispObj*, char*); /* string-left-trim */ +LispObj *Lisp_StringRightTrim(LispMac*, LispObj*, char*); /* string-right-trim */ +LispObj *Lisp_StringEqual_(LispMac*, LispObj*, char*); /* string= */ +LispObj *Lisp_StringLess(LispMac*, LispObj*, char*); /* string< */ +LispObj *Lisp_StringGreater(LispMac*, LispObj*, char*); /* string> */ +LispObj *Lisp_StringLessEqual(LispMac*, LispObj*, char*); /* string<= */ +LispObj *Lisp_StringGreaterEqual(LispMac*, LispObj*, char*);/* string>= */ +LispObj *Lisp_StringNotEqual_(LispMac*, LispObj*, char*); /* string/= */ +LispObj *Lisp_StringEqual(LispMac*, LispObj*, char*); /* string-equal */ +LispObj *Lisp_StringGreaterp(LispMac*, LispObj*, char*); /* string-greaterp */ +LispObj *Lisp_StringLessp(LispMac*, LispObj*, char*); /* string-lessp */ +LispObj *Lisp_StringNotLessp(LispMac*, LispObj*, char*); /* string-not-lessp */ +LispObj *Lisp_StringNotGreaterp(LispMac*, LispObj*, char*); /* string-not-greaterp */ +LispObj *Lisp_StringNotEqual(LispMac*, LispObj*, char*); /* string-not-equal */ +LispObj *Lisp_StringUpcase(LispMac*, LispObj*, char*); /* string-upcase */ +LispObj *Lisp_StringDowncase(LispMac*, LispObj*, char*); /* string-downcase */ +LispObj *Lisp_StringCapitalize(LispMac*, LispObj*, char*); /* string-capitalize */ +LispObj *Lisp_XeditCharStore(LispMac*, LispObj*, char*); /* xedit::char-store */ + +#endif /* Lisp_String_h */ Index: xc/programs/xedit/lisp/struct.c diff -u /dev/null xc/programs/xedit/lisp/struct.c:1.5 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/struct.c Sat Oct 27 23:34:31 2001 @@ -0,0 +1,271 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/struct.c,v 1.5 2001/10/28 03:34:31 tsi Exp $ */ + +#include "struct.h" + +/* + * Implementation + */ +LispObj * +Lisp_Defstruct(LispMac *mac, LispObj *list, char *fname) +{ + LispAtom *atom; + int i, sz, len, slen; + char *name, *strname, *sname; + LispObj *str = list, *obj; + + /* get structure name */ + if (!SYMBOL_P(CAR(list)) || + /* reserved name(s) */ + strcmp(STRPTR(CAR(list)), "ARRAY") == 0) + LispDestroy(mac, "%s cannot be a structure name, at %s", + LispStrObj(mac, CAR(list)), fname); + + strname = STRPTR(CAR(list)); + len = strlen(strname); + + /* get structure fields and default values */ + for (list = CDR(list); list != NIL; list = CDR(list)) { + if ((!SYMBOL_P(CAR(list)) && + /* if not field name, with NIL as default value */ + (CAR(list)->type != LispCons_t || + !SYMBOL_P(CAR(CAR(list))))) || + /* and not a pair, with field name and default value */ + STRPTR(CAR(list))[0] == ':' || + /* and it is a valid field name */ + strcmp(STRPTR(CAR(list)), "P") == 0) + /* p is invalid as a field name due to `type'-p */ + LispDestroy(mac, "%s cannot be a field for %s, at %s", + LispStrObj(mac, CAR(list)), STRPTR(CAR(str)), fname); + + /* check for repeated field names */ + for (obj = CDR(str); obj != list; obj = CDR(obj)) { + if (STRPTR(CAR(obj)) == STRPTR(CAR(list))) + LispDestroy(mac, "only one slot named :%s allowed, at %s", + LispStrObj(mac, CAR(obj)), fname); + } + } + + /* XXX any memory allocation failure below should be a fatal error */ + + /* MAKE- */ + sz = len + 6; + name = LispMalloc(mac, sz); + + sprintf(name, "MAKE-%s", strname); + atom = ATOM(name)->data.atom; + LispSetAtomStructProperty(mac, atom, str, STRUCT_CONSTRUCTOR); + + sprintf(name, "%s-P", strname); + atom = ATOM(name)->data.atom; + LispSetAtomStructProperty(mac, atom, str, STRUCT_CHECK); + + for (i = 0, list = CDR(str); list != NIL; i++, list = CDR(list)) { + sname = STRPTR(CAR(list)); + slen = strlen(sname); + if (len + slen + 2 > sz) { + sz = len + slen + 2; + name = LispRealloc(mac, name, sz); + } + sprintf(name, "%s-%s", strname, sname); + atom = ATOM(name)->data.atom; + LispSetAtomStructProperty(mac, atom, str, i); + } + + LispFree(mac, name); + + atom = CAR(str)->data.atom; + if (atom->property && atom->property->defstruct) + fprintf(lisp_stderr, "*** Warning: structure %s is being redefined\n", + strname); + + return (CAR(str)); +} + +/* helper functions + * DONT explicitly call them. Non standard functions. + */ +LispObj * +Lisp_XeditMakeStruct(LispMac *mac, LispObj *list, char *fname) +{ + int count; + LispAtom *atom = NULL; + LispObj *obj, *str = CAR(list), *fld, *nam, *val, *frm; + + if (!SYMBOL_P(str) || + (atom = str->data.atom)->property == NULL || + atom->property->defstruct == 0 || + atom->property->structure.function != STRUCT_CONSTRUCTOR) + LispDestroy(mac, "invalid arguments, at %s", fname); + str = atom->property->structure.definition; + + fld = NIL; + frm = FRM; + + /* create structure fields, using default initial values */ + for (obj = CDR(str); obj != NIL; obj = CDR(obj)) { + if (SYMBOL_P(CAR(obj))) + val = NIL; + else + val = EVAL(CAR(CDR(CAR(obj)))); + + if (fld == NIL) { + GCProtect(); + fld = CONS(val, NIL); + FRM = CONS(fld, FRM); /* GC protect fld linking to FRM */ + GCUProtect(); + } + else { + CDR(fld) = CONS(CAR(fld), CDR(fld)); + CAR(fld) = val; + } + } + fld = CAR(FRM) = LispReverse(fld); + + for (list = CDR(list); list != NIL; list = CDR(list)) { + if ((nam = EVAL(CAR(list)))->type != LispAtom_t || + STRPTR(nam)[0] != ':') + LispDestroy(mac, "%s is a illegal field for %s", + LispStrObj(mac, nam), fname); + + /* check if field name is a valid field name */ + for (count = 0, obj = CDR(str); obj != NIL; ++count, obj = CDR(obj)) { + if ((SYMBOL_P(CAR(obj)) && + strcmp(STRPTR(CAR(obj)), STRPTR(nam) + 1) == 0) || + (CAR(obj)->type == LispCons_t && + strcmp(STRPTR(CAR(CAR(obj))), STRPTR(nam) + 1) == 0)) + break; + } + + /* check if structure has named field */ + if (obj == NIL) + LispDestroy(mac, ":%s is not a %s field, at %s", + STRPTR(nam), STRPTR(CAR(str)), fname); + + /* value supplied? */ + if ((list = CDR(list)) == NIL) + LispDestroy(mac, "expecting value for field, at %s", fname); + + /* set structure field value */ + for (obj = fld; count; obj = CDR(obj)) + --count; + if (obj->prot == LispNil_t) { + CAR(obj) = CAR(list); + /* set value only if the first time */ + obj->prot = LispTrue_t; + } + } + + /* clean protect flag */ + for (obj = fld; obj != NIL; obj = CDR(obj)) + obj->prot = LispNil_t; + + FRM = frm; /* GC Uprotect fld */ + + return (STRUCT(fld, str)); +} + +LispObj * +Lisp_XeditStructAccess(LispMac *mac, LispObj *list, char *fname) +{ + int len = 0; + LispAtom *atom = NULL; + LispObj *str = CAR(list), *obj = CAR(CDR(list)); + + if (!SYMBOL_P(str) || + (atom = str->data.atom)->property == NULL || + atom->property->defstruct == 0 || + (len = atom->property->structure.function) < 0) + LispDestroy(mac, "invalid arguments, at %s", fname); + str = atom->property->structure.definition; + + /* check if the object is of the required type */ + if (obj->type != LispStruct_t || obj->data.struc.def != str) + LispDestroy(mac, "%s is not a %s", + LispStrObj(mac, obj), STRPTR(CAR(str))); + + for (obj = CAR(obj); len; obj = CDR(obj)) + --len; + + return (CAR(obj)); +} + +LispObj * +Lisp_XeditStructStore(LispMac *mac, LispObj *list, char *fname) +{ + int len = 0; + LispAtom *atom = NULL; + LispObj *strdef, *str, *value; + + strdef = CAR(list); + list = CDR(list); + str = CAR(list); + list = CDR(list); + value = CAR(list); + + if (!SYMBOL_P(strdef) || + (atom = strdef->data.atom)->property == NULL || + atom->property->defstruct == 0 || + (len = atom->property->structure.function) < 0) + LispDestroy(mac, "invalid arguments, at %s", fname); + strdef = atom->property->structure.definition; + + /* check if the object is of the required type */ + if (str->type != LispStruct_t || str->data.struc.def != strdef) + LispDestroy(mac, "%s is not a %s", + LispStrObj(mac, str), + STRPTR(CAR(strdef))); + + for (str = CAR(str); len; str = CDR(str)) + --len; + + return (CAR(str) = value); +} + +LispObj * +Lisp_XeditStructType(LispMac *mac, LispObj *list, char *fname) +{ + LispAtom *atom = NULL; + LispObj *str = CAR(list), *obj = CAR(CDR(list)); + + if (!SYMBOL_P(str) || + (atom = str->data.atom)->property == NULL || + atom->property->defstruct == 0 || + atom->property->structure.function != STRUCT_CHECK) + LispDestroy(mac, "invalid arguments, at %s", fname); + str = atom->property->structure.definition; + + /* check if the object is of the required type */ + if (obj->type == LispStruct_t && obj->data.struc.def == str) + return (T); + + return (NIL); +} Index: xc/programs/xedit/lisp/struct.h diff -u /dev/null xc/programs/xedit/lisp/struct.h:1.2 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/struct.h Wed Oct 17 23:15:23 2001 @@ -0,0 +1,51 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/struct.h,v 1.2 2001/10/18 03:15:23 paulo Exp $ */ + +#ifndef Lisp_struct_h +#define Lisp_struct_h + +#include "private.h" + +/* + * Defines + */ +#define STRUCT(fields, def) LispNewStruct(mac, fields, def) + +/* + * Prototypes + */ +LispObj *Lisp_Defstruct(LispMac*, LispObj*, char*); /* defstruct */ +LispObj *Lisp_XeditMakeStruct(LispMac*, LispObj*, char*); /* xedit::make-struct */ +LispObj *Lisp_XeditStructAccess(LispMac*, LispObj*, char*);/* xedit::struct-access */ +LispObj *Lisp_XeditStructStore(LispMac*, LispObj*, char*); /* xedit::struct-store */ +LispObj *Lisp_XeditStructType(LispMac*, LispObj*, char*); /* xedit::struct-type */ + +#endif /* Lisp_struct_h */ Index: xc/programs/xedit/lisp/time.c diff -u /dev/null xc/programs/xedit/lisp/time.c:1.2 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/time.c Sun Sep 9 19:03:47 2001 @@ -0,0 +1,114 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/time.c,v 1.2 2001/09/09 23:03:47 paulo Exp $ */ + +#include "time.h" + +/* + * Implementation +*/ +LispObj * +Lisp_Time(LispMac *mac, LispObj *list, char *fname) +{ + struct itimerval real, virt, prof; + long sec, usec; + LispObj *res; +#define MONTH 60 * 60 * 31 + + real.it_value.tv_sec = + virt.it_value.tv_sec = + prof.it_value.tv_sec = + real.it_interval.tv_sec = + virt.it_interval.tv_sec = + prof.it_interval.tv_sec = MONTH; + real.it_value.tv_usec = + virt.it_value.tv_usec = + prof.it_value.tv_usec = + real.it_interval.tv_usec = + virt.it_interval.tv_usec = + prof.it_interval.tv_usec = 0; + + setitimer(ITIMER_REAL, &real, NULL); + setitimer(ITIMER_VIRTUAL, &virt, NULL); + setitimer(ITIMER_PROF, &prof, NULL); + + getitimer(ITIMER_REAL, &real); + getitimer(ITIMER_VIRTUAL, &virt); + getitimer(ITIMER_PROF, &prof); + + res = EVAL(CAR(list)); + + getitimer(ITIMER_REAL, &real); + getitimer(ITIMER_VIRTUAL, &virt); + getitimer(ITIMER_PROF, &prof); + + sec = real.it_interval.tv_sec - real.it_value.tv_sec; + usec = real.it_interval.tv_usec - real.it_value.tv_usec; + if (usec < 0) { + --sec; + usec += 1000000; + } + fprintf(lisp_stderr, "Real time : %g sec\n", sec + usec / 1000000.0); + + sec = virt.it_interval.tv_sec - virt.it_value.tv_sec; + usec = virt.it_interval.tv_usec - virt.it_value.tv_usec + 10000; + if (usec < 0) { + --sec; + usec += 1000000; + } + fprintf(lisp_stderr, "Virtual time: %g sec\n", sec + usec / 1000000.0); + + sec = prof.it_interval.tv_sec - prof.it_value.tv_sec; + usec = prof.it_interval.tv_usec - prof.it_value.tv_usec + 10000; + if (usec < 0) { + --sec; + usec += 1000000; + } + fprintf(lisp_stderr, "Profile time: %g sec\n", sec + usec / 1000000.0); + + real.it_value.tv_sec = + virt.it_value.tv_sec = + prof.it_value.tv_sec = + real.it_interval.tv_sec = + virt.it_interval.tv_sec = + prof.it_interval.tv_sec = + real.it_value.tv_usec = + virt.it_value.tv_usec = + prof.it_value.tv_usec = + real.it_interval.tv_usec = + virt.it_interval.tv_usec = + prof.it_interval.tv_usec = 0; + + setitimer(ITIMER_REAL, &real, NULL); + setitimer(ITIMER_VIRTUAL, &virt, NULL); + setitimer(ITIMER_PROF, &prof, NULL); + + return (res); +} Index: xc/programs/xedit/lisp/time.h diff -u /dev/null xc/programs/xedit/lisp/time.h:1.1 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/time.h Fri Aug 31 11:00:14 2001 @@ -0,0 +1,39 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/time.h,v 1.1 2001/08/31 15:00:14 paulo Exp $ */ + +#ifndef Lisp_time_h +#define Lisp_time_h + +#include "private.h" + +LispObj *Lisp_Time(LispMac*, LispObj*, char*); /* time */ + +#endif /* Lisp_time_h */ Index: xc/programs/xedit/lisp/modules/Imakefile diff -u /dev/null xc/programs/xedit/lisp/modules/Imakefile:1.6 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/modules/Imakefile Sat Oct 27 23:34:31 2001 @@ -0,0 +1,20 @@ +XCOMM $XFree86: xc/programs/xedit/lisp/modules/Imakefile,v 1.6 2001/10/28 03:34:31 tsi Exp $ + +#include "../lisp.cf" +#include "../lisp.rules" + +INCLUDES = -I.. -I$(XINCLUDESRC) + +#if BuildSharedLispModules +LispModuleTarget(x11, $(XLIB),) +LispModuleTarget(xt, $(XTOOLLIB) $(XLIB),) +LispModuleTarget(xaw, $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB),) +LispModuleTarget(psql, -lpq, -I/usr/include/pgsql) + +InstallMultipleFlags(x11.so,$(LISPDIR),$(INSTINCFLAGS)) +InstallMultipleFlags(xt.so,$(LISPDIR),$(INSTINCFLAGS)) +InstallMultipleFlags(xaw.so,$(LISPDIR),$(INSTINCFLAGS)) +InstallMultipleFlags(psql.so,$(LISPDIR),$(INSTINCFLAGS)) +#endif + +InstallMultipleFlags(fun.lsp,$(LISPDIR),$(INSTINCFLAGS)) Index: xc/programs/xedit/lisp/modules/fun.lsp diff -u /dev/null xc/programs/xedit/lisp/modules/fun.lsp:1.5 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/modules/fun.lsp Fri Oct 19 20:19:36 2001 @@ -0,0 +1,150 @@ +;; +;; 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. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/modules/fun.lsp,v 1.5 2001/10/20 00:19:36 paulo Exp $ +;; +(provide "fun") + +(defun caar (a) (car (car a))) +(defun cadr (a) (nth 1 a)) +(defun cdar (a) (cdr (car a))) +(defun cddr (a) (nthcdr 2 a)) +(defun caaar (a) (car (car (car a)))) +(defun caadr (a) (car (car (cdr a)))) +(defun cadar (a) (car (cdr (car a)))) +(defun caddr (a) (nth 2 a)) +(defun cdaar (a) (cdr (car (car a)))) +(defun cdadr (a) (cdr (car (cdr a)))) +(defun cddar (a) (cdr (cdr (car a)))) +(defun cdddr (a) (nthcdr 3 a)) +(defun caaaar (a) (car (car (car (car a))))) +(defun caaadr (a) (car (car (car (cdr a))))) +(defun caadar (a) (car (car (cdr (car a))))) +(defun caaddr (a) (car (car (cdr (cdr a))))) +(defun cadaar (a) (car (cdr (car (car a))))) +(defun cadadr (a) (car (cdr (car (cdr a))))) +(defun caddar (a) (car (cdr (cdr (car a))))) +(defun cadddr (a) (nth 3 a)) +(defun cdaaar (a) (cdr (car (car (car a))))) +(defun cdaadr (a) (cdr (car (car (cdr a))))) +(defun cdadar (a) (cdr (car (cdr (car a))))) +(defun cdaddr (a) (cdr (car (cdr (cdr a))))) +(defun cddaar (a) (cdr (cdr (car (car a))))) +(defun cddadr (a) (cdr (cdr (car (cdr a))))) +(defun cdddar (a) (cdr (cdr (cdr (car a))))) +(defun cddddr (a) (nthcdr 4 a)) + +(defun second (a) (nth 1 a)) +(defun third (a) (nth 2 a)) +(defun fourth (a) (nth 3 a)) +(defun fifth (a) (nth 4 a)) +(defun sixth (a) (nth 5 a)) +(defun seventh (a) (nth 6 a)) +(defun eighth (a) (nth 7 a)) +(defun ninth (a) (nth 8 a)) +(defun tenth (a) (nth 9 a)) + +(defun copy-seq (sequence) (subseq sequence 0)) + +(defmacro push (object place) + (list 'setf place (list 'cons object place))) + +(defmacro pop (place) + (list 'prog1 (list 'car place) (list 'setf place (list 'cdr place)))) + +(defmacro prog (init &rest body) + `(block nil (let ,init (tagbody ,@body)))) + +(defmacro prog* (init &rest body) + `(block nil (let* ,init (tagbody ,@body)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; setf +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defsetf car (list) (value) `(progn (rplaca ,list ,value) ,value)) +(defsetf cdr (list) (value) `(progn (rplacd ,list ,value) ,value)) + +(defsetf caar (list) (value) `(progn (rplaca (car ,list) ,value) ,value)) +(defsetf cadr (list) (value) `(progn (rplaca (cdr ,list) ,value) ,value)) +(defsetf cdar (list) (value) `(progn (rplacd (car ,list) ,value) ,value)) +(defsetf cddr (list) (value) `(progn (rplacd (cdr ,list) ,value) ,value)) +(defsetf caaar (list) (value) `(progn (rplaca (caar ,list) ,value) ,value)) +(defsetf caadr (list) (value) `(progn (rplaca (cadr ,list) ,value) ,value)) +(defsetf cadar (list) (value) `(progn (rplaca (cdar ,list) ,value) ,value)) +(defsetf caddr (list) (value) `(progn (rplaca (cddr ,list) ,value) ,value)) +(defsetf cdaar (list) (value) `(progn (rplacd (caar ,list) ,value) ,value)) +(defsetf cdadr (list) (value) `(progn (rplacd (cadr ,list) ,value) ,value)) +(defsetf cddar (list) (value) `(progn (rplacd (cdar ,list) ,value) ,value)) +(defsetf cdddr (list) (value) `(progn (rplacd (cddr ,list) ,value) ,value)) +(defsetf caaaar (list) (value) `(progn (rplaca (caaar ,list) ,value) ,value)) +(defsetf caaadr (list) (value) `(progn (rplaca (caadr ,list) ,value) ,value)) +(defsetf caadar (list) (value) `(progn (rplaca (cadar ,list) ,value) ,value)) +(defsetf caaddr (list) (value) `(progn (rplaca (caddr ,list) ,value) ,value)) +(defsetf cadaar (list) (value) `(progn (rplaca (cdaar ,list) ,value) ,value)) +(defsetf cadadr (list) (value) `(progn (rplaca (cdadr ,list) ,value) ,value)) +(defsetf caddar (list) (value) `(progn (rplaca (cddar ,list) ,value) ,value)) +(defsetf cadddr (list) (value) `(progn (rplaca (cdddr ,list) ,value) ,value)) +(defsetf cdaaar (list) (value) `(progn (rplacd (caaar ,list) ,value) ,value)) +(defsetf cdaadr (list) (value) `(progn (rplacd (caadr ,list) ,value) ,value)) +(defsetf cdadar (list) (value) `(progn (rplacd (cadar ,list) ,value) ,value)) +(defsetf cdaddr (list) (value) `(progn (rplacd (caddr ,list) ,value) ,value)) +(defsetf cddaar (list) (value) `(progn (rplacd (cdaar ,list) ,value) ,value)) +(defsetf cddadr (list) (value) `(progn (rplacd (cdadr ,list) ,value) ,value)) +(defsetf cdddar (list) (value) `(progn (rplacd (cddar ,list) ,value) ,value)) +(defsetf cddddr (list) (value) `(progn (rplacd (cdddr ,list) ,value) ,value)) + +(defsetf first (list) (value) `(progn (rplaca ,list ,value) ,value)) +(defsetf second (list) (value) `(progn (rplaca (nthcdr 1 ,list) ,value) ,value)) +(defsetf third (list) (value) `(progn (rplaca (nthcdr 2 ,list) ,value) ,value)) +(defsetf fourth (list) (value) `(progn (rplaca (nthcdr 3 ,list) ,value) ,value)) +(defsetf fifth (list) (value) `(progn (rplaca (nthcdr 4 ,list) ,value) ,value)) +(defsetf sixth (list) (value) `(progn (rplaca (nthcdr 5 ,list) ,value) ,value)) +(defsetf seventh (list) (value) `(progn (rplaca (nthcdr 6 ,list) ,value) ,value)) +(defsetf eighth (list) (value) `(progn (rplaca (nthcdr 7 ,list) ,value) ,value)) +(defsetf ninth (list) (value) `(progn (rplaca (nthcdr 8 ,list) ,value) ,value)) +(defsetf tenth (list) (value) `(progn (rplaca (nthcdr 9 ,list) ,value) ,value)) + +(defsetf rest (list) (value) `(progn (rplacd ,list ,value) ,value)) + +(defun xedit::nth-store (index list value) + (rplaca (nthcdr index list) value) value) +(defsetf nth xedit::nth-store) + +(defsetf aref (array &rest indices) (value) + `(xedit::vector-store ,array ,@indices ,value)) + +(defsetf get (symbol key &optional default) (value) + `(xedit::put ,symbol ,key ,value)) + +(defsetf char xedit::char-store) +(defsetf schar xedit::char-store) +(defsetf elt xedit::elt-store) + +(defsetf subseq (sequence start &optional end) (value) + `(progn (replace ,sequence ,value :start1 ,start :end1 ,end) ,value)) Index: xc/programs/xedit/lisp/modules/psql.c diff -u /dev/null xc/programs/xedit/lisp/modules/psql.c:1.3 --- /dev/null Fri Jan 18 15:27:15 2002 +++ xc/programs/xedit/lisp/modules/psql.c Mon Oct 15 11:36:51 2001 @@ -0,0 +1,758 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/modules/psql.c,v 1.3 2001/10/15 15:36:51 paulo Exp $ */ + +#include <stdlib.h> +#include <libpq-fe.h> +#undef USE_SSL /* cannot get it to compile... */ +#include <postgres.h> +#include <utils/geo_decls.h> +#include "internal.h" + +/* + * Prototypes + */ +int psqlLoadModule(LispMac *mac); + +LispObj *Lisp_PQbackendPID(LispMac*, LispObj*, char*); +LispObj *Lisp_PQclear(LispMac*, LispObj*, char*); +LispObj *Lisp_PQconsumeInput(LispMac*, LispObj*, char*); +LispObj *Lisp_PQdb(LispMac*, LispObj*, char*); +LispObj *Lisp_PQerrorMessage(LispMac*, LispObj*, char*); +LispObj *Lisp_PQexec(LispMac*, LispObj*, char*); +LispObj *Lisp_PQfinish(LispMac*, LispObj*, char*); +LispObj *Lisp_PQfname(LispMac*, LispObj*, char*); +LispObj *Lisp_PQfnumber(LispMac*, LispObj*, char*); +LispObj *Lisp_PQfsize(LispMac*, LispObj*, char*); +LispObj *Lisp_PQftype(LispMac*, LispObj*, char*); +LispObj *Lisp_PQgetlength(LispMac*, LispObj*, char*); +LispObj *Lisp_PQgetvalue(LispMac*, LispObj*, char*); +LispObj *Lisp_PQhost(LispMac*, LispObj*, char*); +LispObj *Lisp_PQnfields(LispMac*, LispObj*, char*); +LispObj *Lisp_PQnotifies(LispMac*, LispObj*, char*); +LispObj *Lisp_PQntuples(LispMac*, LispObj*, char*); +LispObj *Lisp_PQoptions(LispMac*, LispObj*, char*); +LispObj *Lisp_PQpass(LispMac*, LispObj*, char*); +LispObj *Lisp_PQport(LispMac*, LispObj*, char*); +LispObj *Lisp_PQresultStatus(LispMac*, LispObj*, char*); +LispObj *Lisp_PQsetdb(LispMac*, LispObj*, char*); +LispObj *Lisp_PQsocket(LispMac*, LispObj*, char*); +LispObj *Lisp_PQstatus(LispMac*, LispObj*, char*); +LispObj *Lisp_PQtty(LispMac*, LispObj*, char*); +LispObj *Lisp_PQuser(LispMac*, LispObj*, char*); + +/* + * Initialization + */ +static LispBuiltin lispbuiltins[] = { + {"PQ-BACKEND-PID", Lisp_PQbackendPID, 1, 1, 1,}, + {"PQ-CLEAR", Lisp_PQclear, 1, 1, 1,}, + {"PQ-CONSUME-INPUT", Lisp_PQconsumeInput, 1, 1, 1,}, + {"PQ-DB", Lisp_PQdb, 1, 1, 1,}, + {"PQ-ERROR-MESSAGE", Lisp_PQerrorMessage, 1, 1, 1,}, + {"PQ-EXEC", Lisp_PQexec, 1, 2, 2,}, + {"PQ-FINISH", Lisp_PQfinish, 1, 1, 1,}, + {"PQ-FNAME", Lisp_PQfname, 1, 2, 2,}, + {"PQ-FNUMBER", Lisp_PQfnumber, 1, 2, 2,}, + {"PQ-FSIZE", Lisp_PQfsize, 1, 2, 2,}, + {"PQ-FTYPE", Lisp_PQftype, 1, 2, 2,}, + {"PQ-GETLENGTH", Lisp_PQgetlength, 1, 3, 3,}, + {"PQ-GETVALUE", Lisp_PQgetvalue, 1, 3, 4,}, + {"PQ-HOST", Lisp_PQhost, 1, 1, 1,}, + {"PQ-NFIELDS", Lisp_PQnfields, 1, 1, 1,}, + {"PQ-NOTIFIES", Lisp_PQnotifies, 1, 1, 1,}, + {"PQ-NTUPLES", Lisp_PQntuples, 1, 1, 1,}, + {"PQ-OPTIONS", Lisp_PQoptions, 1, 1, 1,}, + {"PQ-PASS", Lisp_PQpass, 1, 1, 1,}, + {"PQ-PORT", Lisp_PQport, 1, 1, 1,}, + {"PQ-RESULT-STATUS", Lisp_PQresultStatus, 1, 1, 1,}, + {"PQ-SETDB", Lisp_PQsetdb, 1, 5, 5,}, + {"PQ-SETDB-LOGIN", Lisp_PQsetdb, 1, 7, 7,}, + {"PQ-SOCKET", Lisp_PQsocket, 1, 1, 1,}, + {"PQ-STATUS", Lisp_PQstatus, 1, 1, 1,}, + {"PQ-TTY", Lisp_PQtty, 1, 1, 1,}, + {"PQ-USER", Lisp_PQuser, 1, 1, 1,}, +}; + +LispModuleData psqlLispModuleData = { + LISP_MODULE_VERSION, + psqlLoadModule +}; + +static int PGconn_t, PGresult_t; + +/* + * Implementation + */ +int +psqlLoadModule(LispMac *mac) +{ + int i; + char *fname = "INTERNAL:PSQL-LOAD-MODULE"; + + PGconn_t = LispRegisterOpaqueType(mac, "PGconn*"); + PGresult_t = LispRegisterOpaqueType(mac, "PGresult*"); + GCProtect(); + + /* NOTE: Implemented just enough to make programming examples + * (and my needs) work. + * Completing this is an exercise to the reader, or may be implemented + * when/if required. + */ + LispExecute(mac, + "(DEFSTRUCT PG-NOTIFY RELNAME BE-PID)\n" + "(DEFSTRUCT PG-POINT X Y)\n" + "(DEFSTRUCT PG-BOX HIGH LOW)\n" + "(DEFSTRUCT PG-POLYGON SIZE NUM-POINTS BOUNDBOX POINTS)\n"); + + /* enum ConnStatusType */ + (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-OK"), + REAL(CONNECTION_OK), fname, 0); + (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-BAD"), + REAL(CONNECTION_BAD), fname, 0); + (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-STARTED"), + REAL(CONNECTION_STARTED), fname, 0); + (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-MADE"), + REAL(CONNECTION_MADE), fname, 0); + (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-AWAITING-RESPONSE"), + REAL(CONNECTION_AWAITING_RESPONSE), fname, 0); + (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-AUTH-OK"), + REAL(CONNECTION_AUTH_OK), fname, 0); + (void)LispSetVariable(mac, ATOM2("PG-CONNECTION-SETENV"), + REAL(CONNECTION_SETENV), fname, 0); + + + /* enum ExecStatusType */ + (void)LispSetVariable(mac, ATOM2("PGRES-EMPTY-QUERY"), + REAL(PGRES_EMPTY_QUERY), fname, 0); + (void)LispSetVariable(mac, ATOM2("PGRES-COMMAND-OK"), + REAL(PGRES_COMMAND_OK), fname, 0); + (void)LispSetVariable(mac, ATOM2("PGRES-TUPLES-OK"), + REAL(PGRES_TUPLES_OK), fname, 0); + (void)LispSetVariable(mac, ATOM2("PGRES-COPY-OUT"), + REAL(PGRES_COPY_OUT), fname, 0); + (void)LispSetVariable(mac, ATOM2("PGRES-COPY-IN"), + REAL(PGRES_COPY_IN), fname, 0); + (void)LispSetVariable(mac, ATOM2("PGRES-BAD-RESPONSE"), + REAL(PGRES_BAD_RESPONSE), fname, 0); + (void)LispSetVariable(mac, ATOM2("PGRES-NONFATAL-ERROR"), + REAL(PGRES_NONFATAL_ERROR), fname, 0); + (void)LispSetVariable(mac, ATOM2("PGRES-FATAL-ERROR"), + REAL(PGRES_FATAL_ERROR), fname, 0); + GCUProtect(); + + for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) + LispAddBuiltinFunction(mac, &lispbuiltins[i]); + + return (1); +} + +LispObj * +Lisp_PQbackendPID(LispMac *mac, LispObj *list, char *fname) +{ + int pid; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + pid = PQbackendPID(conn); + + return (REAL(pid)); +} + +LispObj * +Lisp_PQclear(LispMac *mac, LispObj *list, char *fname) +{ + PGresult *res; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + + res = (PGresult*)(CAR(list)->data.opaque.data); + PQclear(res); + + return (NIL); +} + +LispObj * +Lisp_PQconsumeInput(LispMac *mac, LispObj *list, char *fname) +{ + int result; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + result = PQconsumeInput(conn); + + return (REAL(result)); +} + +LispObj * +Lisp_PQdb(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + str = PQdb(conn); + + return (str ? STRING(str) : NIL); +} + +LispObj * +Lisp_PQerrorMessage(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + str = PQerrorMessage(conn); + + return (str ? STRING(str) : NIL); +} + +LispObj * +Lisp_PQexec(LispMac *mac, LispObj *list, char *fname) +{ + PGconn *conn; + PGresult *res; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispString_t) + LispDestroy(mac, "expecting string, at %s", fname); + + res = PQexec(conn, STRPTR(CAR(list))); + + return (res ? OPAQUE(res, PGresult_t) : NIL); +} + +LispObj * +Lisp_PQfinish(LispMac *mac, LispObj *list, char *fname) +{ + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + PQfinish(conn); + + return (NIL); +} + +LispObj * +Lisp_PQfname(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + int field; + PGresult *res; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + res = (PGresult*)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || + (int)CAR(list)->data.real != CAR(list)->data.real) + LispDestroy(mac, "expecting positive integer, at %s", fname); + field = (int)CAR(list)->data.real; + + str = PQfname(res, field); + + return (str ? STRING(str) : NIL); +} + +LispObj * +Lisp_PQfnumber(LispMac *mac, LispObj *list, char *fname) +{ + int num; + PGresult *res; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + res = (PGresult*)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispString_t) + LispDestroy(mac, "expecting string, at %s", + LispStrObj(mac, CAR(list)), fname); + + num = PQfnumber(res, STRPTR(CAR(list))); + + return (REAL(num)); +} + +LispObj * +Lisp_PQfsize(LispMac *mac, LispObj *list, char *fname) +{ + int size, field; + PGresult *res; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + res = (PGresult*)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || + (int)CAR(list)->data.real != CAR(list)->data.real) + LispDestroy(mac, "expecting positive integer, at %s", fname); + field = (int)CAR(list)->data.real; + + size = PQfsize(res, field); + + return (REAL(size)); +} + +LispObj * +Lisp_PQftype(LispMac *mac, LispObj *list, char *fname) +{ + Oid oid; + int field; + PGresult *res; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + res = (PGresult*)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || + (int)CAR(list)->data.real != CAR(list)->data.real) + LispDestroy(mac, "expecting positive integer, at %s", fname); + field = (int)CAR(list)->data.real; + + oid = PQftype(res, field); + + return (REAL(oid)); +} + +LispObj * +Lisp_PQgetlength(LispMac *mac, LispObj *list, char *fname) +{ + PGresult *res; + int tuple, field, len; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + res = (PGresult*)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || + (int)CAR(list)->data.real != CAR(list)->data.real) + LispDestroy(mac, "expecting positive integer, at %s", fname); + tuple = (int)CAR(list)->data.real; + list = CDR(list); + if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || + (int)CAR(list)->data.real != CAR(list)->data.real) + LispDestroy(mac, "expecting positive integer, at %s", fname); + field = (int)CAR(list)->data.real; + + len = PQgetlength(res, tuple, field); + + return (REAL(len)); +} + +/* (pq-getvalue connection tuple field &optional type-specifier) */ +LispObj * +Lisp_PQgetvalue(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + double real = 0.0; + PGresult *res; + int tuple, field, isreal = 0; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + res = (PGresult*)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || + (int)CAR(list)->data.real != CAR(list)->data.real) + LispDestroy(mac, "expecting positive integer, at %s", fname); + tuple = (int)CAR(list)->data.real; + list = CDR(list); + if (CAR(list)->type != LispReal_t || CAR(list)->data.real < 0 || + (int)CAR(list)->data.real != CAR(list)->data.real) + LispDestroy(mac, "expecting positive integer, at %s", fname); + field = (int)CAR(list)->data.real; + + str = PQgetvalue(res, tuple, field); + + list = CDR(list); + if (list != NIL) { + if (CAR(list)->type != LispAtom_t) + LispDestroy(mac, "expecting atom, at %s"); + if (strcmp(STRPTR(CAR(list)), "INT16") == 0) { + real = *(short*)str; + isreal = 1; + goto simple_type; + } + else if (strcmp(STRPTR(CAR(list)), "INT32") == 0) { + real = *(int*)str; + isreal = 1; + goto simple_type; + } + else if (strcmp(STRPTR(CAR(list)), "FLOAT") == 0) { + real = *(float*)str; + isreal = 1; + goto simple_type; + } + else if (strcmp(STRPTR(CAR(list)), "REAL") == 0) { + real = *(double*)str; + isreal = 1; + goto simple_type; + } + else if (strcmp(STRPTR(CAR(list)), "PG-POLYGON") == 0) + goto polygon_type; + else if (strcmp(STRPTR(CAR(list)), "STRING") != 0) + LispDestroy(mac, "unknown type specifier %s, at %s", + STRPTR(CAR(list)), fname); + } + +simple_type: + return (isreal ? REAL(real) : (str ? STRING(str) : NIL)); + +polygon_type: + { + LispObj *poly, *box, *p = NIL, *cdr, *obj; + POLYGON *polygon; + int i, size; + + size = PQgetlength(res, tuple, field); + polygon = (POLYGON*)(str - sizeof(int)); + + GCProtect(); + /* get polygon->boundbox */ + cdr = EVAL(CONS(ATOM("MAKE-PG-POINT"), + CONS(ATOM(":X"), + CONS(REAL(polygon->boundbox.high.x), + CONS(ATOM(":Y"), + CONS(REAL(polygon->boundbox.high.y), NIL)))))); + obj = EVAL(CONS(ATOM("MAKE-PG-POINT"), + CONS(ATOM(":X"), + CONS(REAL(polygon->boundbox.low.x), + CONS(ATOM(":Y"), + CONS(REAL(polygon->boundbox.low.y), NIL)))))); + box = EVAL(CONS(ATOM("MAKE-PG-BOX"), + CONS(ATOM(":HIGH"), + CONS(cdr, + CONS(ATOM(":LOW"), + CONS(obj, NIL)))))); + /* get polygon->p values */ + for (i = 0; i < polygon->npts; i++) { + obj = EVAL(CONS(ATOM("MAKE-PG-POINT"), + CONS(ATOM(":X"), + CONS(REAL(polygon->p[i].x), + CONS(ATOM(":Y"), + CONS(REAL(polygon->p[i].y), NIL)))))); + if (i == 0) + p = cdr = CONS(obj, NIL); + else { + CDR(cdr) = CONS(obj, NIL); + cdr = CDR(cdr); + } + } + + /* make result */ + poly = EVAL(CONS(ATOM("MAKE-PG-POLYGON"), + CONS(ATOM(":SIZE"), + CONS(REAL(size), + CONS(ATOM(":NUM-POINTS"), + CONS(REAL(polygon->npts), + CONS(ATOM(":BOUNDBOX"), + CONS(box, + CONS(ATOM(":POINTS"), + CONS(QUOTE(p), NIL)))))))))); + GCUProtect(); + + return (poly); + } +} + +LispObj * +Lisp_PQhost(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + str = PQhost(conn); + + return (str ? STRING(str) : NIL); +} + +LispObj * +Lisp_PQnfields(LispMac *mac, LispObj *list, char *fname) +{ + int nfields; + PGresult *res; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + + res = (PGresult*)(CAR(list)->data.opaque.data); + nfields = PQnfields(res); + + return (REAL(nfields)); +} + +LispObj * +Lisp_PQnotifies(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res, *code, *frm = FRM; + PGconn *conn; + PGnotify *notifies; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + if ((notifies = PQnotifies(conn)) == NULL) + return (NIL); + + GCProtect(); + code = CONS(ATOM("MAKE-PG-NOTIFY"), + CONS(ATOM(":RELNAME"), + CONS(STRING(notifies->relname), + CONS(ATOM(":BE-PID"), + CONS(REAL(notifies->be_pid), NIL))))); + FRM = CONS(code, FRM); + GCUProtect(); + res = EVAL(code); + FRM = frm; + + free(notifies); + + return (res); +} + +LispObj * +Lisp_PQntuples(LispMac *mac, LispObj *list, char *fname) +{ + int ntuples; + PGresult *res; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + + res = (PGresult*)(CAR(list)->data.opaque.data); + ntuples = PQntuples(res); + + return (REAL(ntuples)); +} + +LispObj * +Lisp_PQoptions(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + str = PQoptions(conn); + + return (str ? STRING(str) : NIL); +} + +LispObj * +Lisp_PQpass(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + str = PQpass(conn); + + return (str ? STRING(str) : NIL); +} + +LispObj * +Lisp_PQport(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + str = PQport(conn); + + return (str ? STRING(str) : NIL); +} + +LispObj * +Lisp_PQsetdb(LispMac *mac, LispObj *list, char *fname) +{ + PGconn *conn; + LispObj *obj; + char *host, *port, *options, *tty, *dbname, *login, *pass; + + for (obj = list; obj != NIL; obj = CDR(obj)) + if (CAR(obj) != NIL && CAR(obj)->type != LispString_t) + LispDestroy(mac, "expecting string, at %s", fname); + + host = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); + list = CDR(list); + port = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); + list = CDR(list); + options = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); + list = CDR(list); + tty = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); + list = CDR(list); + dbname = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); + list = CDR(list); + if (list != NIL) { + login = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); + list = CDR(list); + pass = CAR(list) == NIL ? NULL : STRPTR(CAR(list)); + } + else + login = pass = NULL; + + conn = PQsetdbLogin(host, port, options, tty, dbname, login, pass); + + return (conn ? OPAQUE(conn, PGconn_t) : NIL); +} + +LispObj * +Lisp_PQresultStatus(LispMac *mac, LispObj *list, char *fname) +{ + int status; + PGresult *res; + + if (!CHECKO(CAR(list), PGresult_t)) + LispDestroy(mac, "cannot convert %s to PGresult*, at %s", + LispStrObj(mac, CAR(list)), fname); + + res = (PGresult*)(CAR(list)->data.opaque.data); + status = PQresultStatus(res); + + return (REAL(status)); +} + +LispObj * +Lisp_PQsocket(LispMac *mac, LispObj *list, char *fname) +{ + int sock; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + sock = PQsocket(conn); + + return (REAL(sock)); +} + +LispObj * +Lisp_PQstatus(LispMac *mac, LispObj *list, char *fname) +{ + int status; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + status = PQstatus(conn); + + return (REAL(status)); +} + +LispObj * +Lisp_PQtty(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + str = PQtty(conn); + + return (str ? STRING(str) : NIL); +} + +LispObj * +Lisp_PQuser(LispMac *mac, LispObj *list, char *fname) +{ + char *str; + PGconn *conn; + + if (!CHECKO(CAR(list), PGconn_t)) + LispDestroy(mac, "cannot convert %s to PGconn*, at %s", + LispStrObj(mac, CAR(list)), fname); + + conn = (PGconn*)(CAR(list)->data.opaque.data); + str = PQuser(conn); + + return (str ? STRING(str) : NIL); +} Index: xc/programs/xedit/lisp/modules/x11.c diff -u /dev/null xc/programs/xedit/lisp/modules/x11.c:1.4 --- /dev/null Fri Jan 18 15:27:16 2002 +++ xc/programs/xedit/lisp/modules/x11.c Mon Oct 15 03:05:53 2001 @@ -0,0 +1,373 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/modules/x11.c,v 1.4 2001/10/15 07:05:53 paulo Exp $ */ + +#include <stdlib.h> +#include <string.h> +#include "internal.h" +#include <X11/Xlib.h> + +/* + * Prototypes + */ +int x11LoadModule(LispMac*); + +LispObj *Lisp_XOpenDisplay(LispMac*, LispObj*, char*); +LispObj *Lisp_XCloseDisplay(LispMac*, LispObj*, char*); +LispObj *Lisp_XDefaultRootWindow(LispMac*, LispObj*, char*); +LispObj *Lisp_XDefaultScreenOfDisplay(LispMac*, LispObj*, char*); +LispObj *Lisp_XBlackPixelOfScreen(LispMac*, LispObj*, char*); +LispObj *Lisp_XWhitePixelOfScreen(LispMac*, LispObj*, char*); +LispObj *Lisp_XDefaultGCOfScreen(LispMac*, LispObj*, char*); +LispObj *Lisp_XCreateSimpleWindow(LispMac*, LispObj*, char*); +LispObj *Lisp_XMapWindow(LispMac*, LispObj*, char*); +LispObj *Lisp_XDestroyWindow(LispMac*, LispObj*, char*); +LispObj *Lisp_XFlush(LispMac*, LispObj*, char*); + +LispObj *Lisp_XDrawLine(LispMac*, LispObj*, char*); + +/* + * Initialization + */ +static LispBuiltin lispbuiltins[] = { + {"X-OPEN-DISPLAY", Lisp_XOpenDisplay, 1,0,1,}, + {"X-CLOSE-DISPLAY", Lisp_XCloseDisplay, 1,1,1,}, + {"X-DEFAULT-ROOT-WINDOW", Lisp_XDefaultRootWindow, 1,1,1,}, + {"X-DEFAULT-SCREEN-OF-DISPLAY", Lisp_XDefaultScreenOfDisplay, 1,1,1,}, + {"X-BLACK-PIXEL-OF-SCREEN", Lisp_XBlackPixelOfScreen, 1,1,1,}, + {"X-WHITE-PIXEL-OF-SCREEN", Lisp_XWhitePixelOfScreen, 1,1,1,}, + {"X-DEFAULT-GC-OF-SCREEN", Lisp_XDefaultGCOfScreen, 1,1,1,}, + {"X-CREATE-SIMPLE-WINDOW", Lisp_XCreateSimpleWindow, 1,9,9,}, + {"X-MAP-WINDOW", Lisp_XMapWindow, 1,2,2,}, + {"X-DESTROY-WINDOW", Lisp_XDestroyWindow, 1,2,2,}, + {"X-FLUSH", Lisp_XFlush, 1,1,1,}, + {"X-DRAW-LINE", Lisp_XDrawLine, 1,7,7,}, +}; + +LispModuleData x11LispModuleData = { + LISP_MODULE_VERSION, + x11LoadModule +}; + +static int x11Display_t, x11Screen_t, x11Window_t, x11GC_t; + +/* + * Implementation + */ +int +x11LoadModule(LispMac *mac) +{ + int i; + + x11Display_t = LispRegisterOpaqueType(mac, "Display*"); + x11Screen_t = LispRegisterOpaqueType(mac, "Screen*"); + x11Window_t = LispRegisterOpaqueType(mac, "Window"); + x11GC_t = LispRegisterOpaqueType(mac, "GC"); + + for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) + LispAddBuiltinFunction(mac, &lispbuiltins[i]); + + return (1); +} + +LispObj * +Lisp_XOpenDisplay(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *nam; + char *dname; + + if (list == NIL) + dname = NULL; + else if ((nam = CAR(list))->type == LispString_t) + dname = STRPTR(nam); + else + LispDestroy(mac, "%s is not a valid display name, at %s", + LispStrObj(mac, nam), fname); + + return (OPAQUE(XOpenDisplay(dname), x11Display_t)); +} + +LispObj * +Lisp_XCloseDisplay(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), x11Display_t)) + LispDestroy(mac, "cannot convert %s to Display*, at %s", + LispStrObj(mac, CAR(list)), fname); + + XCloseDisplay((Display*)(CAR(list)->data.opaque.data)); + + return (NIL); +} + +LispObj * +Lisp_XDefaultRootWindow(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), x11Display_t)) + LispDestroy(mac, "cannot convert %s to Display*, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (OPAQUE(XDefaultRootWindow((Display*)(CAR(list)->data.opaque.data)), + x11Window_t)); +} + +LispObj * +Lisp_XDefaultScreenOfDisplay(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), x11Display_t)) + LispDestroy(mac, "cannot convert %s to Display*, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (OPAQUE(XDefaultScreenOfDisplay((Display*)(CAR(list)->data.opaque.data)), + x11Screen_t)); +} + +LispObj * +Lisp_XBlackPixelOfScreen(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), x11Screen_t)) + LispDestroy(mac, "cannot convert %s to Screen*, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (REAL((double) + XBlackPixelOfScreen((Screen*)(CAR(list)->data.opaque.data)))); +} + +LispObj * +Lisp_XWhitePixelOfScreen(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), x11Screen_t)) + LispDestroy(mac, "cannot convert %s to Screen*, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (REAL((double) + XWhitePixelOfScreen((Screen*)(CAR(list)->data.opaque.data)))); +} + +LispObj * +Lisp_XDefaultGCOfScreen(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), x11Screen_t)) + LispDestroy(mac, "cannot convert %s to Screen*, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (OPAQUE(XDefaultGCOfScreen((Screen*)(CAR(list)->data.opaque.data)), + x11GC_t)); +} + +LispObj * +Lisp_XCreateSimpleWindow(LispMac *mac, LispObj *list, char *fname) +{ + Display *display; + Window parent; + int x, y; + unsigned int width, height, border_width; + unsigned long border, background; + + if (!CHECKO(CAR(list), x11Display_t)) + LispDestroy(mac, "cannot convert %s to Display*, at %s", + LispStrObj(mac, CAR(list)), fname); + display = (Display*)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (!CHECKO(CAR(list), x11Window_t)) + LispDestroy(mac, "cannot convert %s to Window, at %s", + LispStrObj(mac, CAR(list)), fname); + parent = (Window)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (CAR(list)->type != LispReal_t || + (int)(CAR(list)->data.real) != CAR(list)->data.real) + LispDestroy(mac, "Cannot convert %s to int, at %s", + LispStrObj(mac, CAR(list)), fname); + x = (int)(CAR(list)->data.real); + list = CDR(list); + + if (CAR(list)->type != LispReal_t || + (int)(CAR(list)->data.real) != CAR(list)->data.real) + LispDestroy(mac, "Cannot convert %s to int, at %s", + LispStrObj(mac, CAR(list)), fname); + y = (int)(CAR(list)->data.real); + list = CDR(list); + + if (CAR(list)->type != LispReal_t || + CAR(list)->data.real < 0 || + (int)(CAR(list)->data.real) != CAR(list)->data.real) + LispDestroy(mac, "Cannot convert %s to unsigned int, at %s", + LispStrObj(mac, CAR(list)), fname); + width = (unsigned int)(CAR(list)->data.real); + list = CDR(list); + + if (CAR(list)->type != LispReal_t || + CAR(list)->data.real < 0 || + (int)(CAR(list)->data.real) != CAR(list)->data.real) + LispDestroy(mac, "Cannot convert %s to unsigned int, at %s", + LispStrObj(mac, CAR(list)), fname); + height = (unsigned int)(CAR(list)->data.real); + list = CDR(list); + + if (CAR(list)->type != LispReal_t || + CAR(list)->data.real < 0 || + (int)(CAR(list)->data.real) != CAR(list)->data.real) + LispDestroy(mac, "Cannot convert %s to unsigned int, at %s", + LispStrObj(mac, CAR(list)), fname); + border_width = (unsigned int)(CAR(list)->data.real); + list = CDR(list); + + if (CAR(list)->type != LispReal_t || + CAR(list)->data.real < 0 || + (int)(CAR(list)->data.real) != CAR(list)->data.real) + LispDestroy(mac, "Cannot convert %s to unsigned long, at %s", + LispStrObj(mac, CAR(list)), fname); + border = (unsigned int)(CAR(list)->data.real); + list = CDR(list); + + if (CAR(list)->type != LispReal_t || + CAR(list)->data.real < 0 || + (int)(CAR(list)->data.real) != CAR(list)->data.real) + LispDestroy(mac, "Cannot convert %s to unsigned long, at %s", + LispStrObj(mac, CAR(list)), fname); + background = (unsigned int)(CAR(list)->data.real); + + return (OPAQUE( + XCreateSimpleWindow(display, parent, x, y, width, height, + border_width, border, background), + x11Window_t)); +} + +LispObj * +Lisp_XMapWindow(LispMac *mac, LispObj *list, char *fname) +{ + Display *display; + Window window; + + if (!CHECKO(CAR(list), x11Display_t)) + LispDestroy(mac, "cannot convert %s to Display*, at %s", + LispStrObj(mac, CAR(list)), fname); + display = (Display*)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (!CHECKO(CAR(list), x11Window_t)) + LispDestroy(mac, "cannot convert %s to Window, at %s", + LispStrObj(mac, CAR(list)), fname); + window = (Window)(CAR(list)->data.opaque.data); + + XMapWindow(display, window); + + return (CAR(list)); +} + +LispObj * +Lisp_XDestroyWindow(LispMac *mac, LispObj *list, char *fname) +{ + Display *display; + Window window; + + if (!CHECKO(CAR(list), x11Display_t)) + LispDestroy(mac, "cannot convert %s to Display*, at %s", + LispStrObj(mac, CAR(list)), fname); + display = (Display*)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (!CHECKO(CAR(list), x11Window_t)) + LispDestroy(mac, "cannot convert %s to Window, at %s", + LispStrObj(mac, CAR(list)), fname); + window = (Window)(CAR(list)->data.opaque.data); + + XDestroyWindow(display, window); + + return (NIL); +} + +LispObj * +Lisp_XFlush(LispMac *mac, LispObj *list, char *fname) +{ + Display *display; + + if (!CHECKO(CAR(list), x11Display_t)) + LispDestroy(mac, "cannot convert %s to Display*, at %s", + LispStrObj(mac, CAR(list)), fname); + display = (Display*)(CAR(list)->data.opaque.data); + + XFlush(display); + + return (NIL); +} + +LispObj * +Lisp_XDrawLine(LispMac *mac, LispObj *list, char *fname) +{ + Display *display; + Drawable window; + GC gc; + int x0, y0, x1, y1; + + if (!CHECKO(CAR(list), x11Display_t)) + LispDestroy(mac, "cannot convert %s to Display*, at %s", + LispStrObj(mac, CAR(list)), fname); + display = (Display*)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (!CHECKO(CAR(list), x11Window_t)) + LispDestroy(mac, "cannot convert %s to Drawable, at %s", + LispStrObj(mac, CAR(list)), fname); + window = (Drawable)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (!CHECKO(CAR(list), x11GC_t)) + LispDestroy(mac, "cannot convert %s to GC, at %s", + LispStrObj(mac, CAR(list)), fname); + gc = (GC)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (CAR(list)->type != LispReal_t) + LispDestroy(mac, "Cannot convert %s to int, at %s", + LispStrObj(mac, CAR(list)), fname); + x0 = (int)(CAR(list)->data.real); + list = CDR(list); + if (CAR(list)->type != LispReal_t) + LispDestroy(mac, "Cannot convert %s to int, at %s", + LispStrObj(mac, CAR(list)), fname); + y0 = (int)(CAR(list)->data.real); + list = CDR(list); + if (CAR(list)->type != LispReal_t) + LispDestroy(mac, "Cannot convert %s to int, at %s", + LispStrObj(mac, CAR(list)), fname); + x1 = (int)(CAR(list)->data.real); + list = CDR(list); + if (CAR(list)->type != LispReal_t) + LispDestroy(mac, "Cannot convert %s to int, at %s", + LispStrObj(mac, CAR(list)), fname); + y1 = (int)(CAR(list)->data.real); + list = CDR(list); + + XDrawLine(display, window, gc, x0, y0, x1, y1); + + return (NIL); +} Index: xc/programs/xedit/lisp/modules/xaw.c diff -u /dev/null xc/programs/xedit/lisp/modules/xaw.c:1.7 --- /dev/null Fri Jan 18 15:27:16 2002 +++ xc/programs/xedit/lisp/modules/xaw.c Wed Oct 17 23:15:25 2001 @@ -0,0 +1,337 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/modules/xaw.c,v 1.7 2001/10/18 03:15:25 paulo Exp $ */ + +#include <stdlib.h> +#include <X11/Intrinsic.h> +#include <X11/Xaw/AsciiSink.h> +#include <X11/Xaw/AsciiSrc.h> +#include <X11/Xaw/AsciiText.h> +#include <X11/Xaw/Box.h> +#include <X11/Xaw/Command.h> +#include <X11/Xaw/Dialog.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Grip.h> +#include <X11/Xaw/Label.h> +#include <X11/Xaw/List.h> +#include <X11/Xaw/MenuButton.h> +#include <X11/Xaw/MultiSink.h> +#include <X11/Xaw/MultiSrc.h> +#include <X11/Xaw/Paned.h> +#include <X11/Xaw/Panner.h> +#include <X11/Xaw/Porthole.h> +#include <X11/Xaw/Repeater.h> +#include <X11/Xaw/Scrollbar.h> +#include <X11/Xaw/Simple.h> +#include <X11/Xaw/SimpleMenu.h> +#include <X11/Xaw/SmeBSB.h> +#include <X11/Xaw/Sme.h> +#include <X11/Xaw/SmeLine.h> +#include <X11/Xaw/StripChart.h> +#include <X11/Xaw/Text.h> +#include <X11/Xaw/TextSink.h> +#include <X11/Xaw/TextSrc.h> +#include <X11/Xaw/Tip.h> +#include <X11/Xaw/Toggle.h> +#include <X11/Xaw/Tree.h> +#include <X11/Xaw/Viewport.h> +#include <X11/Vendor.h> +#include "internal.h" + +/* + * Prototypes + */ +int xawLoadModule(LispMac*); + +LispObj *Lisp_XawCoerceToListReturnStruct(LispMac*, LispObj*, char*); +LispObj *Lisp_XawFormDoLayout(LispMac*, LispObj*, char*); +LispObj *Lisp_XawListHighlight(LispMac*, LispObj*, char*); +LispObj *Lisp_XawListUnhighlight(LispMac*, LispObj*, char*); +LispObj *Lisp_XawTextGetSource(LispMac*, LispObj*, char*); +LispObj *Lisp_XawTextLastPosition(LispMac*, LispObj*, char*); +LispObj *Lisp_XawTextGetInsertionPoint(LispMac*, LispObj*, char*); +LispObj *Lisp_XawTextSetInsertionPoint(LispMac*, LispObj*, char*); + +/* + * Initialization + */ + +static LispBuiltin lispbuiltins[] = { + {"XAW-COERCE-TO-LIST-RETURN-STRUCT",Lisp_XawCoerceToListReturnStruct,1,1,1,}, + {"XAW-FORM-DO-LAYOUT", Lisp_XawFormDoLayout, 1,2,2,}, + {"XAW-LIST-HIGHLIGHT", Lisp_XawListHighlight, 1,2,2,}, + {"XAW-LIST-UNHIGHLIGHT", Lisp_XawListUnhighlight, 1,1,1,}, + {"XAW-TEXT-GET-SOURCE", Lisp_XawTextGetSource, 1,1,1,}, + {"XAW-TEXT-LAST-POSITION", Lisp_XawTextLastPosition, 1,1,1,}, + {"XAW-TEXT-GET-INSERTION-POINT", Lisp_XawTextGetInsertionPoint, 1,1,1,}, + {"XAW-TEXT-SET-INSERTION-POINT", Lisp_XawTextSetInsertionPoint, 1,2,2,}, +}; + +LispModuleData xawLispModuleData = { + LISP_MODULE_VERSION, + xawLoadModule +}; + +static int xawWidget_t, xawWidgetClass_t, xawListReturnStruct_t, charpp_t; + +/* + * Implementation + */ +int +xawLoadModule(LispMac *mac) +{ + int i; + char *fname = "INTERNAL:XAW-LOAD-MODULE"; + + xawWidget_t = LispRegisterOpaqueType(mac, "Widget"); + xawWidgetClass_t = LispRegisterOpaqueType(mac, "WidgetClass"); + xawListReturnStruct_t = LispRegisterOpaqueType(mac, "XawListReturnStruct"); + charpp_t = LispRegisterOpaqueType(mac, "char**"); + + LispExecute(mac, "(DEFSTRUCT XAW-LIST-RETURN-STRUCT STRING INDEX)\n"); + + GCProtect(); + (void)LispSetVariable(mac, ATOM2("ASCII-SINK-OBJECT-CLASS"), + OPAQUE(asciiSinkObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("ASCII-SRC-OBJECT-CLASS"), + OPAQUE(asciiSinkObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("ASCII-TEXT-WIDGET-CLASS"), + OPAQUE(asciiTextWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("BOX-WIDGET-CLASS"), + OPAQUE(boxWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("COMMAND-WIDGET-CLASS"), + OPAQUE(commandWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("DIALOG-WIDGET-CLASS"), + OPAQUE(dialogWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("FORM-WIDGET-CLASS"), + OPAQUE(formWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("GRIP-WIDGET-CLASS"), + OPAQUE(gripWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("LABEL-WIDGET-CLASS"), + OPAQUE(labelWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("LIST-WIDGET-CLASS"), + OPAQUE(listWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("MENU-BUTTON-WIDGET-CLASS"), + OPAQUE(menuButtonWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("MULTI-SINK-OBJEC-TCLASS"), + OPAQUE(multiSinkObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("MULTI-SRC-OBJECT-CLASS"), + OPAQUE(multiSrcObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("PANED-WIDGET-CLASS"), + OPAQUE(panedWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("PANNER-WIDGET-CLASS"), + OPAQUE(pannerWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("PORTHOLE-WIDGET-CLASS"), + OPAQUE(portholeWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("REPEATER-WIDGET-CLASS"), + OPAQUE(repeaterWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("SCROLLBAR-WIDGET-CLASS"), + OPAQUE(scrollbarWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("SIMPLE-MENU-WIDGET-CLASS"), + OPAQUE(simpleMenuWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("SIMPLE-WIDGET-CLASS"), + OPAQUE(simpleWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("SME-BSB-OBJECT-CLASS"), + OPAQUE(smeBSBObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("SME-LINE-OBJECT-CLASS"), + OPAQUE(smeLineObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("SME-OBJECT-CLASS"), + OPAQUE(smeObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("STRIP-CHART-WIDGET-CLASS"), + OPAQUE(stripChartWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("TEXT-WIDGET-CLASS"), + OPAQUE(textWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("TEXT-SINKOBJECT-CLASS"), + OPAQUE(textSinkObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("TEXT-SRC-OBJECT-CLASS"), + OPAQUE(textSrcObjectClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("TIP-WIDGET-CLASS"), + OPAQUE(tipWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("TOGGLE-WIDGET-CLASS"), + OPAQUE(toggleWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("TREE-WIDGET-CLASS"), + OPAQUE(treeWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("VIEWPORT-WIDGET-CLASS"), + OPAQUE(viewportWidgetClass, xawWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("VENDOR-SHELL-WIDGET-CLASS"), + OPAQUE(vendorShellWidgetClass, xawWidgetClass_t), + fname, 0); + GCUProtect(); + + for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) + LispAddBuiltinFunction(mac, &lispbuiltins[i]); + + return (1); +} + +LispObj * +Lisp_XawCoerceToListReturnStruct(LispMac *mac, LispObj *list, char *fname) +{ + LispObj *res, *code, *frm = FRM; + XawListReturnStruct *retlist; + + if (!CHECKO(CAR(list), xawListReturnStruct_t)) + LispDestroy(mac, "cannot convert %s to XawListReturnStruct, at %s", + LispStrObj(mac, CAR(list)), fname); + + retlist = (XawListReturnStruct*)(CAR(list)->data.opaque.data); + + GCProtect(); + code = CONS(ATOM("MAKE-XAW-LIST-RETURN-STRUCT"), + CONS(ATOM(":STRING"), + CONS(STRING(retlist->string), + CONS(ATOM(":INDEX"), + CONS(REAL(retlist->list_index), NIL))))); + FRM = CONS(code, FRM); + GCUProtect(); + + res = EVAL(code); + FRM = frm; + + return (res); +} + +LispObj * +Lisp_XawFormDoLayout(LispMac *mac, LispObj *list, char *fname) +{ + int force; + + if (!CHECKO(CAR(list), xawWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + + force = CAR(CDR(list)) != NIL; + XawFormDoLayout((Widget)(CAR(list)->data.opaque.data), force); + + return (NIL); +} + +LispObj * +Lisp_XawTextGetSource(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xawWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (OPAQUE(XawTextGetSource((Widget)(CAR(list)->data.opaque.data)), + xawWidget_t)); +} + +LispObj * +Lisp_XawTextLastPosition(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xawWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (REAL(XawTextLastPosition((Widget)(CAR(list)->data.opaque.data)))); +} + +LispObj * +Lisp_XawTextGetInsertionPoint(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xawWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (REAL(XawTextGetInsertionPoint((Widget)(CAR(list)->data.opaque.data)))); +} + +LispObj * +Lisp_XawTextSetInsertionPoint(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xawWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + if (CAR(CDR(list))->type != LispReal_t) + LispDestroy(mac, "cannot convert %s to XawTextPosition, at %s", + LispStrObj(mac, CAR(CDR(list))), fname); + + XawTextSetInsertionPoint((Widget)(CAR(list)->data.opaque.data), + (XawTextPosition)(CAR(CDR(list))->data.real)); + + return (NIL); +} + +LispObj * +Lisp_XawListHighlight(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xawWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + if (CAR(CDR(list))->type != LispReal_t) + LispDestroy(mac, "expecting number, at %s", fname); + XawListHighlight((Widget)(CAR(list)->data.opaque.data), + (int)(CAR(CDR(list))->data.real)); + + return (NIL); +} + +LispObj * +Lisp_XawListUnhighlight(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xawWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + XawListUnhighlight((Widget)(CAR(list)->data.opaque.data)); + + return (NIL); +} Index: xc/programs/xedit/lisp/modules/xt.c diff -u /dev/null xc/programs/xedit/lisp/modules/xt.c:1.10 --- /dev/null Fri Jan 18 15:27:16 2002 +++ xc/programs/xedit/lisp/modules/xt.c Fri Oct 19 20:19:36 2001 @@ -0,0 +1,1082 @@ +/* + * 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. + * + * Author: Paulo César Pereira de Andrade + */ + +/* $XFree86: xc/programs/xedit/lisp/modules/xt.c,v 1.10 2001/10/20 00:19:36 paulo Exp $ */ + +#include <stdlib.h> +#include <stdio.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#include "internal.h" + +/* + * Types + */ +typedef struct { + XrmQuark qname; + XrmQuark qtype; + Cardinal size; +} ResourceInfo; + +typedef struct { + WidgetClass widget_class; + ResourceInfo **resources; + Cardinal num_resources; + Cardinal num_cons_resources; +} ResourceList; + +typedef struct { + Arg *args; + Cardinal num_args; +} Resources; + +typedef struct { + LispMac *mac; + LispObj *data; + /* data is => (list* widget callback argument) */ +} CallbackArgs; + +/* + * Prototypes + */ +int xtLoadModule(LispMac*); +void _LispXtCleanupCallback(Widget, XtPointer, XtPointer); + +void _LispXtCallback(Widget, XtPointer, XtPointer); + +LispObj *Lisp_XtCoerceToWidgetList(LispMac*, LispObj*, char*); +LispObj *Lisp_XtAddCallback(LispMac*, LispObj*, char*); +LispObj *Lisp_XtAppInitialize(LispMac*, LispObj*, char*); +LispObj *Lisp_XtAppMainLoop(LispMac*, LispObj*, char*); +LispObj *Lisp_XtAppPending(LispMac*, LispObj*, char*); +LispObj *Lisp_XtAppProcessEvent(LispMac*, LispObj*, char*); +LispObj *Lisp_XtCreateWidget(LispMac*, LispObj*, char*); +LispObj *Lisp_XtCreateManagedWidget(LispMac*, LispObj*, char*); +LispObj *Lisp_XtCreatePopupShell(LispMac*, LispObj*, char*); +LispObj *Lisp_XtDestroyWidget(LispMac*, LispObj*, char*); +LispObj *Lisp_XtGetValues(LispMac*, LispObj*, char*); +LispObj *Lisp_XtManageChild(LispMac*, LispObj*, char*); +LispObj *Lisp_XtPopup(LispMac*, LispObj*, char*); +LispObj *Lisp_XtPopdown(LispMac*, LispObj*, char*); +LispObj *Lisp_XtRealizeWidget(LispMac*, LispObj*, char*); +LispObj *Lisp_XtSetSensitive(LispMac*, LispObj*, char*); +LispObj *Lisp_XtSetValues(LispMac*, LispObj*, char*); +LispObj *Lisp_XtWidgetToApplicationContext(LispMac*, LispObj*, char*); + +LispObj *_LispXtCreateWidget(LispMac*, LispObj*, char*, int); + +static Resources *LispConvertResources(LispMac*, LispObj*, Widget, + ResourceList*, ResourceList*); +static void LispFreeResources(Resources*); + +static int bcmp_action_resource(_Xconst void*, _Xconst void*); +static ResourceInfo *GetResourceInfo(char*, ResourceList*, ResourceList*); +static ResourceList *GetResourceList(WidgetClass); +static int bcmp_action_resource_list(_Xconst void*, _Xconst void*); +static ResourceList *FindResourceList(WidgetClass); +static int qcmp_action_resource_list(_Xconst void*, _Xconst void*); +static ResourceList *CreateResourceList(WidgetClass); +static int qcmp_action_resource(_Xconst void*, _Xconst void*); +static void BindResourceList(ResourceList*); + +static void PopdownAction(Widget, XEvent*, String*, Cardinal*); +static void QuitAction(Widget, XEvent*, String*, Cardinal*); + + +/* + * Initialization + */ +static LispBuiltin lispbuiltins[] = { + {"XT-COERCE-TO-WIDGET-LIST", Lisp_XtCoerceToWidgetList, 1,2,2,}, + {"XT-ADD-CALLBACK", Lisp_XtAddCallback, 1,3,4,}, + {"XT-APP-INITIALIZE", Lisp_XtAppInitialize, 1,2,4,}, + {"XT-APP-PENDING", Lisp_XtAppPending, 1,1,1,}, + {"XT-APP-MAIN-LOOP", Lisp_XtAppMainLoop, 1,1,1,}, + {"XT-APP-PROCESS-EVENT", Lisp_XtAppProcessEvent, 1,1,2,}, + {"XT-CREATE-MANAGED-WIDGET", Lisp_XtCreateManagedWidget, 1,3,4,}, + {"XT-CREATE-WIDGET", Lisp_XtCreateWidget, 1,3,4,}, + {"XT-CREATE-POPUP-SHELL", Lisp_XtCreatePopupShell, 1,3,4,}, + {"XT-DESTROY-WIDGET", Lisp_XtDestroyWidget, 1,1,1,}, + {"XT-GET-VALUES", Lisp_XtGetValues, 1,2,2,}, + {"XT-MANAGE-CHILD", Lisp_XtManageChild, 1,1,1,}, + {"XT-POPUP", Lisp_XtPopup, 1,2,2,}, + {"XT-POPDOWN", Lisp_XtPopdown, 1,1,1,}, + {"XT-REALIZE-WIDGET", Lisp_XtRealizeWidget, 1,1,1,}, + {"XT-SET-SENSITIVE", Lisp_XtSetSensitive, 1,2,2,}, + {"XT-SET-VALUES", Lisp_XtSetValues, 1,2,2,}, + {"XT-WIDGET-TO-APPLICATION-CONTEXT",Lisp_XtWidgetToApplicationContext,1,1,1,}, +}; + +LispModuleData xtLispModuleData = { + LISP_MODULE_VERSION, + xtLoadModule, +}; + +static ResourceList **resource_list; +static Cardinal num_resource_list; + +static Atom delete_window; +static int xtAppContext_t, xtWidget_t, xtWidgetClass_t, xtWidgetList_t; + +static XtActionsRec actions[] = { + {"xt-popdown", PopdownAction}, + {"xt-quit", QuitAction}, +}; + +static XrmQuark qCardinal, qInt, qString, qWidget; + +/* + * Implementation + */ +int +xtLoadModule(LispMac *mac) +{ + int i; + char *fname = "INTERNAL:XT-LOAD-MODULE"; + + xtAppContext_t = LispRegisterOpaqueType(mac, "XtAppContext"); + xtWidget_t = LispRegisterOpaqueType(mac, "Widget"); + xtWidgetClass_t = LispRegisterOpaqueType(mac, "WidgetClass"); + xtWidgetList_t = LispRegisterOpaqueType(mac, "WidgetList"); + + LispExecute(mac, "(DEFSTRUCT XT-WIDGET-LIST NUM-CHILDREN CHILDREN)\n"); + + GCProtect(); + (void)LispSetVariable(mac, ATOM2("CORE-WIDGET-CLASS"), + OPAQUE(coreWidgetClass, xtWidgetClass_t), + fname, 0); + (void)LispSetVariable(mac, ATOM2("TRANSIENT-SHELL-WIDGET-CLASS"), + OPAQUE(transientShellWidgetClass, xtWidgetClass_t), + fname, 0); + + /* parameters for XtPopup */ + (void)LispSetVariable(mac, ATOM2("XT-GRAB-EXCLUSIVE"), + REAL(XtGrabExclusive), fname, 0); + (void)LispSetVariable(mac, ATOM2("XT-GRAB-NONE"), + REAL(XtGrabNone), fname, 0); + (void)LispSetVariable(mac, ATOM2("XT-GRAB-NONE-EXCLUSIVE"), + REAL(XtGrabNonexclusive), fname, 0); + + /* parameters for XtAppProcessEvent */ + (void)LispSetVariable(mac, ATOM2("XT-IM-XEVENT"), + REAL(XtIMXEvent), fname, 0); + (void)LispSetVariable(mac, ATOM2("XT-IM-TIMER"), + REAL(XtIMTimer), fname, 0); + (void)LispSetVariable(mac, ATOM2("XT-IM-ALTERNATE-INPUT"), + REAL(XtIMAlternateInput), fname, 0); + (void)LispSetVariable(mac, ATOM2("XT-IM-SIGNAL"), + REAL(XtIMSignal), fname, 0); + (void)LispSetVariable(mac, ATOM2("XT-IM-ALL"), + REAL(XtIMSignal), fname, 0); + GCUProtect(); + + qCardinal = XrmPermStringToQuark(XtRCardinal); + qInt = XrmPermStringToQuark(XtRInt); + qString = XrmPermStringToQuark(XtRString); + qWidget = XrmPermStringToQuark(XtRWidget); + + for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) + LispAddBuiltinFunction(mac, &lispbuiltins[i]); + + return (1); +} + +void +_LispXtCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + CallbackArgs *args = (CallbackArgs*)user_data; + LispMac *mac = args->mac; + LispObj *code, *frm = FRM; + + GCProtect(); + /* callback name */ /* reall caller */ + code = CONS(QUOTE(CDR(CDR(args->data))), CONS(OPAQUE(w, xtWidget_t), + CONS(CAR(CDR(args->data)), CONS(OPAQUE(call_data, 0), NIL)))); + /* user arguments */ + FRM = CONS(code, FRM); + GCUProtect(); + + (void)Lisp_Funcall(mac, code, "FUNCALL"); + FRM = frm; +} + +void +_LispXtCleanupCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + CallbackArgs *args = (CallbackArgs*)user_data; + LispMac *mac = args->mac; + + UPROTECT(CAR(args->data), args->data); +} + +LispObj * +Lisp_XtCoerceToWidgetList(LispMac *mac, LispObj *list, char *fname) +{ + int i; + WidgetList children; + Cardinal num_children; + LispObj *obj, *cdr, *wid; + + if (CAR(list)->type != LispReal_t) + LispDestroy(mac, "expecting number, at %s", fname); + if (!CHECKO(CAR(CDR(list)), xtWidgetList_t)) + LispDestroy(mac, "cannot convert %s to XawListReturnStruct, at %s", + LispStrObj(mac, CAR(list)), fname); + + num_children = CAR(list)->data.real; + children = (WidgetList)(CAR(CDR(list))->data.opaque.data); + + GCProtect(); + wid = cdr = NIL; + for (i = 0; i < num_children; i++) { + obj = CONS(OPAQUE(children[i], xtWidget_t), NIL); + if (wid == NIL) + wid = cdr = CONS(OPAQUE(children[i], xtWidget_t), NIL); + else { + CDR(cdr) = CONS(OPAQUE(children[i], xtWidget_t), NIL); + cdr = CDR(cdr); + } + } + + obj = EVAL(CONS(ATOM("MAKE-XT-WIDGET-LIST"), + CONS(ATOM(":NUM-CHILDREN"), + CONS(REAL(num_children), + CONS(ATOM(":CHILDREN"), + CONS(QUOTE(wid), NIL)))))); + GCUProtect(); + + return (obj); +} + +LispObj * +Lisp_XtAddCallback(LispMac *mac, LispObj *list, char *fname) +{ + CallbackArgs *arguments; + LispObj *widget, *name, *callback, *args, *data; + + widget = CAR(list); + if (!CHECKO(widget, xtWidget_t)) + LispDestroy(mac, + "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + list = CDR(list); + + name = CAR(list); + if (name->type != LispString_t) + LispDestroy(mac, "expecting string, at %s", fname); + list = CDR(list); + + callback = CAR(list); + if (callback->type != LispAtom_t) + LispDestroy(mac, "expecting atom, at %s", fname); + list = CDR(list); + + GCProtect(); + if (list == NIL) + args = list; + else + args = QUOTE(CAR(list)); + + data = CONS(widget, CONS(args, callback)); + PROTECT(widget, data); + GCUProtect(); + + arguments = XtNew(CallbackArgs); + arguments->mac = mac; + arguments->data = data; + + XtAddCallback((Widget)(widget->data.opaque.data), STRPTR(name), + _LispXtCallback, (XtPointer)arguments); + XtAddCallback((Widget)(widget->data.opaque.data), XtNdestroyCallback, + _LispXtCleanupCallback, (XtPointer)arguments); + + return (NIL); +} + +LispObj * +Lisp_XtAppInitialize(LispMac *mac, LispObj *list, char *fname) +{ + XtAppContext appcon; + char *app, *cname; + Widget shell; + int zero = 0; + Resources *resources = NULL; + String *fallback = NULL; + + if (CAR(list)->type != LispAtom_t) + LispDestroy(mac, "expecting atom, at %s", fname); + app = STRPTR(CAR(list)); + list = CDR(list); + + if (CAR(list)->type != LispString_t) { + LispDestroy(mac, "cannot convert %s to string, at %s", + LispStrObj(mac, CAR(list)), fname); + } + cname = STRPTR(CAR(list)); + + /* check if fallback resources given */ + if (list != NIL && CDR(list)->type == LispCons_t && + CDR(CDR(list))->type == LispCons_t) { + int count; + LispObj *ptr, *obj = CAR(CDR(CDR(list))); + + if (obj->type != LispCons_t) + LispDestroy(mac, "expecting string list, at %s", fname); + + for (ptr = obj, count = 0; ptr->type == LispCons_t; + ptr = CDR(ptr), count++) + if (CAR(ptr)->type != LispString_t) + LispDestroy(mac, "%s is not a string, at %s", + LispStrObj(mac, CAR(ptr)), fname); + + /* fallback resources was correctly specified */ + fallback = LispMalloc(mac, sizeof(String) * (count + 1)); + for (ptr = obj, count = 0; ptr->type == LispCons_t; + ptr = CDR(ptr), count++) + fallback[count] = STRPTR(CAR(ptr)); + fallback[count] = NULL; + } + + GCProtect(); + shell = XtAppInitialize(&appcon, cname, NULL, 0, &zero, NULL, + fallback, NULL, 0); + if (fallback) + LispFree(mac, fallback); + (void)LispSetVariable(mac, ATOM(app), OPAQUE(appcon, xtAppContext_t), + fname, 0); + GCUProtect(); + + XtAppAddActions(appcon, actions, XtNumber(actions)); + + list = CDR(list); + if (list == NIL || CAR(list) == NIL) + resources = NULL; + else if (CAR(list)->type != LispCons_t) + LispDestroy(mac, "expecting argument list, at %s", fname); + else { + resources = LispConvertResources(mac, CAR(list), shell, + GetResourceList(XtClass(shell)), + NULL); + if (resources) { + XtSetValues(shell, resources->args, resources->num_args); + LispFreeResources(resources); + } + } + + return (OPAQUE(shell, xtWidget_t)); +} + +LispObj * +Lisp_XtAppMainLoop(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xtAppContext_t)) + LispDestroy(mac, + "cannot convert %s to XtAppContext, at %s", + LispStrObj(mac, CAR(list)), fname); + + XtAppMainLoop((XtAppContext)(CAR(list)->data.opaque.data)); + + return (NIL); +} + +LispObj * +Lisp_XtAppPending(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xtAppContext_t)) + LispDestroy(mac, + "cannot convert %s to XtAppContext, at %s", + LispStrObj(mac, CAR(list)), fname); + + return (REAL(XtAppPending((XtAppContext)(CAR(list)->data.opaque.data)))); +} + +LispObj * +Lisp_XtAppProcessEvent(LispMac *mac, LispObj *list, char *fname) +{ + XtInputMask mask; + XtAppContext appcon; + + if (!CHECKO(CAR(list), xtAppContext_t)) + LispDestroy(mac, + "cannot convert %s to XtAppContext, at %s", + LispStrObj(mac, CAR(list)), fname); + + appcon = (XtAppContext)(CAR(list)->data.opaque.data); + list = CDR(list); + if (list == NIL) + mask = XtIMAll; + else if (!INTEGER_P(CAR(list))) + LispDestroy(mac, "expecting XtInputMask, at %s", fname); + mask = NUMBER_VALUE(CAR(list)); + switch (mask) { + case 0: + break; + case XtIMXEvent: + case XtIMTimer: + case XtIMAlternateInput: + case XtIMSignal: + case XtIMAll: + XtAppProcessEvent(appcon, mask); + break; + default: + LispDestroy(mac, "bad XtInputMask, at %s", mask, fname); + break; + } + + return (NIL); +} + +LispObj * +Lisp_XtRealizeWidget(LispMac *mac, LispObj *list, char *fname) +{ + Widget widget; + + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, + "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + + widget = (Widget)(CAR(list)->data.opaque.data); + XtRealizeWidget(widget); + + if (XtIsSubclass(widget, shellWidgetClass)) { + if (!delete_window) + delete_window = XInternAtom(XtDisplay(widget), + "WM_DELETE_WINDOW", False); + (void)XSetWMProtocols(XtDisplay(widget), XtWindow(widget), + &delete_window, 1); + } + + return (NIL); +} + +LispObj * +Lisp_XtDestroyWidget(LispMac *mac, LispObj *list, char *fname) +{ + Widget widget; + + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, + "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + + widget = (Widget)(CAR(list)->data.opaque.data); + XtDestroyWidget(widget); + + return (NIL); +} + +#define UNMANAGED 0 +#define MANAGED 1 +#define SHELL 2 +LispObj * +Lisp_XtCreateWidget(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispXtCreateWidget(mac, list, fname, UNMANAGED)); +} + +LispObj * +Lisp_XtCreateManagedWidget(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispXtCreateWidget(mac, list, fname, MANAGED)); +} + +LispObj * +Lisp_XtCreatePopupShell(LispMac *mac, LispObj *list, char *fname) +{ + return (_LispXtCreateWidget(mac, list, fname, SHELL)); +} + +LispObj * +_LispXtCreateWidget(LispMac *mac, LispObj *list, char *fname, int options) +{ + char *name; + WidgetClass widget_class; + Widget widget, parent; + Resources *resources = NULL; + + if (CAR(list)->type != LispString_t) + LispDestroy(mac, "cannot convert %s to char*, at %s", + LispStrObj(mac, CAR(list)), fname); + name = STRPTR(CAR(list)); + list = CDR(list); + + if (!CHECKO(CAR(list), xtWidgetClass_t)) + LispDestroy(mac, "cannot convert %s to WidgetClass, at %s", + LispStrObj(mac, CAR(list)), fname); + widget_class = (WidgetClass)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + parent = (Widget)(CAR(list)->data.opaque.data); + list = CDR(list); + + if (options != SHELL) + widget = XtCreateWidget(name, widget_class, parent, NULL, 0); + else + widget = XtCreatePopupShell(name, widget_class, parent, NULL, 0); + + if (list == NIL || CAR(list) == NIL) + resources = NULL; + else if (CAR(list)->type != LispCons_t) + LispDestroy(mac, "expecting argument list, at %s", fname); + else { + resources = LispConvertResources(mac, CAR(list), widget, + GetResourceList(widget_class), + GetResourceList(XtClass(parent))); + XtSetValues(widget, resources->args, resources->num_args); + } + if (options == MANAGED) + XtManageChild(widget); + if (resources) + LispFreeResources(resources); + + return (OPAQUE(widget, xtWidget_t)); +} + +LispObj * +Lisp_XtGetValues(LispMac *mac, LispObj *list, char *fname) +{ + Arg args[1]; + Widget widget; + ResourceList *rlist, *plist; + ResourceInfo *resource; + LispObj *obj, *res, *ptr; + char c1; + short c2; + int c4; +#ifdef LONG64 + long c8; +#endif + + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + widget = (Widget)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispCons_t) + LispDestroy(mac, "expecting string list, at %s", fname); + + rlist = GetResourceList(XtClass(widget)); + plist = XtParent(widget) ? GetResourceList(XtClass(XtParent(widget))) : NULL; + + GCProtect(); + res = NIL; + for (list = CAR(list); list != NIL; list = CDR(list)) { + if (CAR(list)->type != LispString_t) + LispDestroy(mac, "%s is not a string, at %s", + LispStrObj(mac, CAR(list)), fname); + if ((resource = GetResourceInfo(STRPTR(CAR(list)), rlist, plist)) + == NULL) { + int i; + Widget child; + + for (i = 0; i < rlist->num_resources; i++) { + if (rlist->resources[i]->qtype == qWidget) { + XtSetArg(args[0], + XrmQuarkToString(rlist->resources[i]->qname), + &child); + XtGetValues(widget, args, 1); + if (child && XtParent(child) == widget) { + resource = + GetResourceInfo(STRPTR(CAR(list)), + GetResourceList(XtClass(child)), + NULL); + if (resource) + break; + } + } + } + if (resource == NULL) { + fprintf(stderr, "resource %s not available.\n", + STRPTR(CAR(list))); + continue; + } + } + switch (resource->size) { + case 1: + XtSetArg(args[0], STRPTR(CAR(list)), &c1); + break; + case 2: + XtSetArg(args[0], STRPTR(CAR(list)), &c2); + break; + case 4: + XtSetArg(args[0], STRPTR(CAR(list)), &c4); + break; +#ifdef LONG64 + case 1: + XtSetArg(args[0], STRPTR(CAR(list)), &c8); + break; +#endif + } + XtGetValues(widget, args, 1); + + /* special resources */ + if (resource->qtype == qString) { +#ifdef LONG64 + obj = CONS(CAR(list), STRING((char*)c8)); +#else + obj = CONS(CAR(list), STRING((char*)c4)); +#endif + } + else if (resource->qtype == qCardinal || resource->qtype == qInt) { +#ifdef LONG64 + if (sizeof(int) == 8) + obj = CONS(CAR(list), REAL(c8)); + else +#endif + obj = CONS(CAR(list), REAL(c4)); + } + else { + switch (resource->size) { + case 1: + obj = CONS(CAR(list), OPAQUE(c1, 0)); + break; + case 2: + obj = CONS(CAR(list), OPAQUE(c2, 0)); + break; + case 4: + obj = CONS(CAR(list), OPAQUE(c4, 0)); + break; +#ifdef LONG64 + case 8: + obj = CONS(CAR(list), OPAQUE(c8, 0)); + break; +#endif + } + } + + if (res == NIL) + res = ptr = CONS(obj, NIL); + else { + CDR(ptr) = CONS(obj, NIL); + ptr = CDR(ptr); + } + } + GCUProtect(); + + return (res); +} + +LispObj * +Lisp_XtManageChild(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + XtManageChild((Widget)(CAR(list)->data.opaque.data)); + + return (NIL); +} + +LispObj * +Lisp_XtPopup(LispMac *mac, LispObj *list, char *fname) +{ + XtGrabKind kind; + + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + if (CAR(CDR(list))->type != LispReal_t) + LispDestroy(mac, "cannot convert %s to XtGrabKind, at %s", + LispStrObj(mac, CAR(CDR(list))), fname); + kind = (XtGrabKind)(CAR(CDR(list))->data.real); + if (kind != XtGrabExclusive && kind != XtGrabNone && + kind != XtGrabNonexclusive) + LispDestroy(mac, "cannot convert %d to XtGrabKind, at %s", + kind, fname); + XtPopup((Widget)(CAR(list)->data.opaque.data), kind); + + return (NIL); +} + +LispObj * +Lisp_XtPopdown(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + XtPopdown((Widget)(CAR(list)->data.opaque.data)); + + return (NIL); +} + +LispObj * +Lisp_XtSetSensitive(LispMac *mac, LispObj *list, char *fname) +{ + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + XtSetSensitive((Widget)(CAR(list)->data.opaque.data), + CAR(CDR(list)) != NIL); + + return (CAR(CDR(list)) == NIL ? NIL : T); +} + +LispObj * +Lisp_XtSetValues(LispMac *mac, LispObj *list, char *fname) +{ + Widget widget; + Resources *resources; + + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + widget = (Widget)(CAR(list)->data.opaque.data); + list = CDR(list); + if (CAR(list)->type != LispCons_t) + LispDestroy(mac, "expecting string list, at %s", fname); + + resources = LispConvertResources(mac, CAR(list), widget, + GetResourceList(XtClass(widget)), + XtParent(widget) ? + GetResourceList(XtClass(XtParent(widget))) : + NULL); + XtSetValues(widget, resources->args, resources->num_args); + LispFreeResources(resources); + + return (NIL); +} + +LispObj * +Lisp_XtWidgetToApplicationContext(LispMac *mac, LispObj *list, char *fname) +{ + Widget widget; + XtAppContext appcon; + + if (!CHECKO(CAR(list), xtWidget_t)) + LispDestroy(mac, "cannot convert %s to Widget, at %s", + LispStrObj(mac, CAR(list)), fname); + widget = (Widget)(CAR(list)->data.opaque.data); + appcon = XtWidgetToApplicationContext(widget); + + return (OPAQUE(appcon, xtAppContext_t)); +} + +static Resources * +LispConvertResources(LispMac *mac, LispObj *list, Widget widget, + ResourceList *rlist, ResourceList *plist) +{ + char c1; + short c2; + int c4; +#ifdef LONG64 + long c8; +#endif + XrmValue from, to; + LispObj *arg, *val; + ResourceInfo *resource; + char *fname = "XT-INTERNAL:CONVERT-RESOURCES"; + Resources *resources = (Resources*)XtCalloc(1, sizeof(Resources)); + + for (; list != NIL; list = CDR(list)) { + if (list->type != LispCons_t || CAR(list)->type != LispCons_t) { + XtFree((XtPointer)resources); + LispDestroy(mac, "expecting cons, at %s", fname); + } + arg = CAR(CAR(list)); + val = CDR(CAR(list)); + + if (arg->type != LispString_t) { + XtFree((XtPointer)resources); + LispDestroy(mac, "resource name must be a string, at %s", fname); + } + + if ((resource = GetResourceInfo(STRPTR(arg), rlist, plist)) == NULL) { + int i; + Arg args[1]; + Widget child; + + for (i = 0; i < rlist->num_resources; i++) { + if (rlist->resources[i]->qtype == qWidget) { + XtSetArg(args[0], + XrmQuarkToString(rlist->resources[i]->qname), + &child); + XtGetValues(widget, args, 1); + if (child && XtParent(child) == widget) { + resource = + GetResourceInfo(STRPTR(arg), + GetResourceList(XtClass(child)), + NULL); + if (resource) + break; + } + } + } + if (resource == NULL) { + fprintf(stderr, "resource %s not available.\n", STRPTR(arg)); + continue; + } + } + + if (val->type == LispReal_t || val->type == LispOpaque_t) { + resources->args = (Arg*) + XtRealloc((XtPointer)resources->args, + sizeof(Arg) * (resources->num_args + 1)); + if (val->type == LispReal_t) + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), (int)val->data.real); + else + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), val->data.opaque.data); + ++resources->num_args; + continue; + } + else if (val->type != LispString_t) { + XtFree((XtPointer)resources); + LispDestroy(mac, + "resource value must be string, number or opaque, not %s at %s", + LispStrObj(mac, val), fname); + } + + from.size = val == NIL ? 1 : strlen(STRPTR(val)) + 1; + from.addr = val == NIL ? "" : STRPTR(val); + switch (to.size = resource->size) { + case 1: + to.addr = (XtPointer)&c1; + break; + case 2: + to.addr = (XtPointer)&c2; + break; + case 4: + to.addr = (XtPointer)&c4; + break; +#ifdef LONG64 + case 8: + to.addr = (XtPointer)&c8; + break; +#endif + default: + fprintf(stderr, "bad resource size %d, for %s.\n", + to.size, STRPTR(arg)); + continue; + } + + if (qString == resource->qtype) +#ifdef LONG64 + c8 = (long)from.addr; +#else + c4 = (long)from.addr; +#endif + else if (!XtConvertAndStore(widget, XtRString, &from, + XrmQuarkToString(resource->qtype), &to)) + /* The type converter already have printed an error message */ + continue; + + resources->args = (Arg*) + XtRealloc((XtPointer)resources->args, + sizeof(Arg) * (resources->num_args + 1)); + switch (to.size) { + case 1: + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), c1); + break; + case 2: + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), c2); + break; + case 4: + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), c4); + break; +#ifdef LONG64 + case 8: + XtSetArg(resources->args[resources->num_args], + XrmQuarkToString(resource->qname), c8); + break; +#endif + } + ++resources->num_args; + } + + return (resources); +} + +static void +LispFreeResources(Resources *resources) +{ + if (resources) { + XtFree((XtPointer)resources->args); + XtFree((XtPointer)resources); + } +} + +static int +bcmp_action_resource(_Xconst void *string, _Xconst void *resource) +{ + return (strcmp((String)string, + XrmQuarkToString((*(ResourceInfo**)resource)->qname))); +} + +static ResourceInfo * +GetResourceInfo(char *name, ResourceList *rlist, ResourceList *plist) +{ + ResourceInfo **resource = NULL; + + if (rlist->resources) + resource = (ResourceInfo**) + bsearch(name, rlist->resources, rlist->num_resources, + sizeof(ResourceInfo*), bcmp_action_resource); + + if (resource == NULL && plist) { + resource = (ResourceInfo**) + bsearch(name, &plist->resources[plist->num_resources], + plist->num_cons_resources, sizeof(ResourceInfo*), + bcmp_action_resource); + } + + return (resource ? *resource : NULL); +} + +static ResourceList * +GetResourceList(WidgetClass wc) +{ + ResourceList *list; + + if ((list = FindResourceList(wc)) == NULL) + list = CreateResourceList(wc); + + return (list); +} + +static int +bcmp_action_resource_list(_Xconst void *wc, _Xconst void *list) +{ + return ((char*)wc - (char*)((*(ResourceList**)list)->widget_class)); +} + +static ResourceList * +FindResourceList(WidgetClass wc) +{ + ResourceList **list; + + if (!resource_list) + return (NULL); + + list = (ResourceList**) + bsearch(wc, resource_list, num_resource_list, + sizeof(ResourceList*), bcmp_action_resource_list); + + return (list ? *list : NULL); +} + +static int +qcmp_action_resource_list(_Xconst void *left, _Xconst void *right) +{ + return ((char*)((*(ResourceList**)left)->widget_class) - + (char*)((*(ResourceList**)right)->widget_class)); +} + +static ResourceList * +CreateResourceList(WidgetClass wc) +{ + ResourceList *list; + + list = (ResourceList*)XtMalloc(sizeof(ResourceList)); + list->widget_class = wc; + list->num_resources = list->num_cons_resources = 0; + list->resources = NULL; + + resource_list = (ResourceList**) + XtRealloc((XtPointer)resource_list, sizeof(ResourceList*) * + (num_resource_list + 1)); + resource_list[num_resource_list++] = list; + qsort(resource_list, num_resource_list, sizeof(ResourceList*), + qcmp_action_resource_list); + BindResourceList(list); + + return (list); +} + +static int +qcmp_action_resource(_Xconst void *left, _Xconst void *right) +{ + return (strcmp(XrmQuarkToString((*(ResourceInfo**)left)->qname), + XrmQuarkToString((*(ResourceInfo**)right)->qname))); +} + +static void +BindResourceList(ResourceList *list) +{ + XtResourceList xt_list, cons_list; + Cardinal i, num_xt, num_cons; + + XtGetResourceList(list->widget_class, &xt_list, &num_xt); + XtGetConstraintResourceList(list->widget_class, &cons_list, &num_cons); + list->num_resources = num_xt; + list->num_cons_resources = num_cons; + + list->resources = (ResourceInfo**) + XtMalloc(sizeof(ResourceInfo*) * (num_xt + num_cons)); + + for (i = 0; i < num_xt; i++) { + list->resources[i] = (ResourceInfo*)XtMalloc(sizeof(ResourceInfo)); + list->resources[i]->qname = + XrmPermStringToQuark(xt_list[i].resource_name); + list->resources[i]->qtype = + XrmPermStringToQuark(xt_list[i].resource_type); + list->resources[i]->size = xt_list[i].resource_size; + } + + for (; i < num_xt + num_cons; i++) { + list->resources[i] = (ResourceInfo*)XtMalloc(sizeof(ResourceInfo)); + list->resources[i]->qname = + XrmPermStringToQuark(cons_list[i - num_xt].resource_name); + list->resources[i]->qtype = + XrmPermStringToQuark(cons_list[i - num_xt].resource_type); + list->resources[i]->size = cons_list[i - num_xt].resource_size; + } + + XtFree((XtPointer)xt_list); + if (cons_list) + XtFree((XtPointer)cons_list); + + qsort(list->resources, list->num_resources, sizeof(ResourceInfo*), + qcmp_action_resource); + if (num_cons) + qsort(&list->resources[num_xt], list->num_cons_resources, + sizeof(ResourceInfo*), qcmp_action_resource); +} + +/*ARGSUSED*/ +static void +PopdownAction(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + XtPopdown(w); +} + +/*ARGSUSED*/ +static void +QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + exit(0); +} Index: xc/programs/xedit/lisp/test/hello.lsp diff -u /dev/null xc/programs/xedit/lisp/test/hello.lsp:1.2 --- /dev/null Fri Jan 18 15:27:16 2002 +++ xc/programs/xedit/lisp/test/hello.lsp Sat Sep 29 00:46:06 2001 @@ -0,0 +1,72 @@ +;; +;; 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. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/test/hello.lsp,v 1.2 2001/09/29 04:46:06 paulo Exp $ +;; +(require "xaw") +(require "xt") + +(defun quit-callback (widget user call) (quit)) + +(defun fix-shell-size (shell) + (let ((size (xt-get-values shell '("width" "height")))) + (xt-set-values shell + (list (cons "minWidth" (cdar size)) + (cons "maxWidth" (cdar size)) + (cons "minHeight" (cdadr size)) + (cons "maxHeight" (cdadr size))) + ) + ) +) + +(setq toplevel + (xt-app-initialize 'appcontext "Hello" + '(("title" . "Hello World!")))) + +(setq form + (xt-create-managed-widget "form" form-widget-class toplevel + '(("background" . "gray85") + ("displayList" . "foreground rgb:7/9/7;lines 1,-1,-1,-1,-1,1;foreground gray90;lines -1,0,0,0,0,-1") + ))) + +(setq button + (xt-create-managed-widget "button" command-widget-class form + '(("label" . "Goodbye world!") + ("tip" . "This sample uses some customizations") + ("foreground" . "gray10") + ("background" . "gray80") + ("displayList" . "foreground rgb:7/9/7;lines 1,-1,-1,-1,-1,1;foreground gray90;lines -1,0,0,0,0,-1") + ))) +(xt-add-callback button "callback" 'quit-callback) + +(xt-realize-widget toplevel) + +(fix-shell-size toplevel) + +(xt-app-main-loop appcontext) Index: xc/programs/xedit/lisp/test/psql-1.lsp diff -u /dev/null xc/programs/xedit/lisp/test/psql-1.lsp:1.1 --- /dev/null Fri Jan 18 15:27:16 2002 +++ xc/programs/xedit/lisp/test/psql-1.lsp Wed Oct 10 03:02:52 2001 @@ -0,0 +1,80 @@ +;; Postgresql C library interface, example program 1, using the xedit +;; lisp interface + +;; Test the C version of libpq, the PostgreSQL frontend library. +(require "psql") + +(defun exit-nicely (conn) + (pq-finish conn) + (quit 1) +) + +;; begin, by setting the parameters for a backend connection if the +;; parameters are null, then the system will try to use reasonable +;; defaults by looking up environment variables or, failing that, +;; using hardwired constants +(setq pghost nil) ; host name of the backend server +(setq pgport nil) ; port of the backend server +(setq pgoptions nil) ; special options to start up the backend server +(setq pgtty nil) ; debugging tty for the backend server +(setq pgdbname "template1") + +;; make a connection to the database +(setq conn (pq-setdb pghost pgport pgoptions pgtty pgdbname)) + +;; check to see that the backend connection was successfully made +(when (= (pq-status conn) pg-connection-bad) + (format t "Connection to database '~A' failed.~%" pgdbname) + (format t "~A" (pq-error-message conn)) + (exit-nicely conn)) + +;; start a transaction block +(setq res (pq-exec conn "BEGIN")) +(when (or (null res) (not (= (pq-result-status res) pgres-command-ok))) + (format t "BEGIN command failed~%") + (pq-clear res) + (exit-nicely conn)) + +;; Should PQclear PGresult whenever it is no longer needed to avoid memory leaks +(pq-clear res) + +;; fetch rows from the pg_database, the system catalog of databases +(setq res (pq-exec conn "DECLARE mycursor CURSOR FOR select * from pg_database")) +(when (or (null res) (not (= (pq-result-status res) pgres-command-ok))) + (format t "DECLARE CURSOR command failed~%") + (pq-clear res) + (exit-nicely conn)) +(pq-clear res) +(setq res (pq-exec conn "FETCH ALL in mycursor")) +(when (or (null res) (not (= (pq-result-status res) pgres-tuples-ok))) + (format t "FETCH ALL command didn't return tuples properly~%") + (pq-clear res) + (exit-nicely conn)) + +;; first, print out the attribute names +(setq nfields (pq-nfields res)) +(dotimes (i nfields) + (format t "~15@<~A~>" (pq-fname res i)) +) +(format t "~%") + +;; next, print out the rows +(setq ntuples (pq-ntuples res)) +(dotimes (i ntuples) + (dotimes (j nfields) + (format t "~15@<~A~>" (pq-getvalue res i j)) + ) + (format t "~%") +) +(pq-clear res) + +;; close the cursor +(setq res (pq-exec conn "CLOSE mycursor")) +(pq-clear res) + +;; commit the transaction +(setq res (pq-exec conn "COMMIT")) +(pq-clear res) + +;; close the connection to the database and cleanup +(pq-finish conn) Index: xc/programs/xedit/lisp/test/psql-2.lsp diff -u /dev/null xc/programs/xedit/lisp/test/psql-2.lsp:1.1 --- /dev/null Fri Jan 18 15:27:16 2002 +++ xc/programs/xedit/lisp/test/psql-2.lsp Wed Oct 10 03:02:52 2001 @@ -0,0 +1,74 @@ +;; Postgresql C library interface, example program 2, using the xedit +;; lisp interface + +;; Test of the asynchronous notification interface +;; +;; Start this program, then from psql in another window do +;; NOTIFY TBL2; +;; +;; Or, if you want to get fancy, try this: +;; Populate a database with the following: +;; +;; CREATE TABLE TBL1 (i int4); +;; +;; CREATE TABLE TBL2 (i int4); +;; +;; CREATE RULE r1 AS ON INSERT TO TBL1 DO +;; (INSERT INTO TBL2 values (new.i); NOTIFY TBL2); +;; +;; and do +;; +;; INSERT INTO TBL1 values (10); +(require "psql") + +(defun exit-nicely (conn) + (pq-finish conn) + (quit 1) +) + +;; begin, by setting the parameters for a backend connection if the +;; parameters are null, then the system will try to use reasonable +;; defaults by looking up environment variables or, failing that, +;; using hardwired constants +(setq pghost nil) ; host name of the backend server +(setq pgport nil) ; port of the backend server +(setq pgoptions nil) ; special options to start up the backend server +(setq pgtty nil) ; debugging tty for the backend server +(setq pgdbname "test") ; change this to the name of your test database + ;; XXX Note: getenv not yet implemented in the + ; lisp interpreter + +;; make a connection to the database +(setq conn (pq-setdb pghost pgport pgoptions pgtty pgdbname)) + +;; check to see that the backend connection was successfully made +(when (= (pq-status conn) pg-connection-bad) + (format t "Connection to database '~A' failed.~%" pgdbname) + (format t "~A" (pq-error-message conn)) + (exit-nicely conn)) + +(setq res (pq-exec conn "LISTEN TBL2")) +(when (= (pq-status conn) pg-connection-bad) + (format t "LISTEN command failed~%") + (format t "~A" (pq-error-message conn)) + (exit-nicely conn)) + +;; Should PQclear PGresult whenever it is no longer needed to avoid memory leaks +(pq-clear res) + +(loop + ;; wait a little bit between checks; waiting with select() + ;; would be more efficient. + ;; XXX Note: sleep not yet implemented in the lisp interpreter + + ;; collect any asynchronous backend messages + (pq-consume-input conn) + + ;; check for asynchronous notify messages + (when (setq notifies (pq-notifies conn)) + (format t "ASYNC NOTIFY of '~A' from backend pid '~D' received~%" + (pg-notify-relname notifies) (pg-notify-be-pid notifies)) + ) +) + +(pq-finish conn) Index: xc/programs/xedit/lisp/test/psql-3.lsp diff -u /dev/null xc/programs/xedit/lisp/test/psql-3.lsp:1.1 --- /dev/null Fri Jan 18 15:27:16 2002 +++ xc/programs/xedit/lisp/test/psql-3.lsp Wed Oct 10 03:02:52 2001 @@ -0,0 +1,118 @@ +;; Postgresql C library interface, example program 3, using the xedit +;; lisp interface + +;; Test the binary cursor interface +;; +;; populate a database by doing the following: +;; +;; CREATE TABLE test1 (i int4, d real, p polygon); +;; +;; INSERT INTO test1 values (1, 3.567, polygon '(3.0, 4.0, 1.0, 2.0)'); +;; +;; INSERT INTO test1 values (2, 89.05, polygon '(4.0, 3.0, 2.0, 1.0)'); +;; +;; the expected output is: +;; +;; tuple 0: got i = (4 bytes) 1, d = (4 bytes) 3.567000, p = (4 +;; bytes) 2 points boundbox = (hi=3.000000/4.000000, lo = +;; 1.000000,2.000000) tuple 1: got i = (4 bytes) 2, d = (4 bytes) +;; 89.050003, p = (4 bytes) 2 points boundbox = +;; (hi=4.000000/3.000000, lo = 2.000000,1.000000) + +;; Output of the lisp code: +;; +;; type[0] = 23, size[0] = 4 +;; type[1] = 700, size[1] = 4 +;; type[2] = 604, size[2] = -1 +;; tuple 0: got +;; i = (4 bytes) 1 +;; d = (4 bytes) 3.567 +;; p = (4 bytes) 2 points boundbox = (hi=3.0/4.0, lo = 1.0/2.0) +;; tuple 1: got +;; i = (4 bytes) 2 +;; d = (4 bytes) 89.05 +;; p = (4 bytes) 2 points boundbox = (hi=4.0/3.0, lo = 2.0/1.0) + + +(require "psql") + +(defun exit-nicely (conn) + (pq-finish conn) + (quit 1) +) + +;; begin, by setting the parameters for a backend connection if the +;; parameters are null, then the system will try to use reasonable +;; defaults by looking up environment variables or, failing that, +;; using hardwired constants +(setq pghost nil) ; host name of the backend server +(setq pgport nil) ; port of the backend server +(setq pgoptions nil) ; special options to start up the backend server +(setq pgtty nil) ; debugging tty for the backend server +(setq pgdbname "test") ; change this to the name of your test database + ;; XXX Note: getenv not yet implemented in the + ; lisp interpreter + +;; make a connection to the database +(setq conn (pq-setdb pghost pgport pgoptions pgtty pgdbname)) + +;; check to see that the backend connection was successfully made +(when (= (pq-status conn) pg-connection-bad) + (format t "Connection to database '~A' failed.~%" pgdbname) + (format t "~A" (pq-error-message conn)) + (exit-nicely conn)) + +(setq res (pq-exec conn "BEGIN")) +(when (= (pq-status conn) pg-connection-bad) + (format t "BEGIN command failed~%") + (pq-clear res) + (exit-nicely conn)) + +;; Should PQclear PGresult whenever it is no longer needed to avoid memory leaks +(pq-clear res) + +(setq res (pq-exec conn "DECLARE mycursor BINARY CURSOR FOR select * from test1")) +(when (= (pq-status conn) pg-connection-bad) + (format t "DECLARE CURSOR command failed~%") + (pq-clear res) + (exit-nicely conn)) +(pq-clear res) + +(setq res (pq-exec conn "FETCH ALL in mycursor")) +(when (or (null res) (not (= (pq-result-status res) pgres-tuples-ok))) + (format t "FETCH ALL command didn't return tuples properly~%") + (pq-clear res) + (exit-nicely conn)) + +(setq i-fnum (pq-fnumber res "i")) +(setq d-fnum (pq-fnumber res "d")) +(setq p-fnum (pq-fnumber res "p")) + +(dotimes (i 3) + (format t "type[~D] = ~D, size[~D] = ~D~%" + i (pq-ftype res i) i (pq-fsize res i)) +) + +(dotimes (i (pq-ntuples res)) + (setq i-val (pq-getvalue res i i-fnum 'int32)) + (setq d-val (pq-getvalue res i d-fnum 'float)) + (setq p-val (pq-getvalue res i p-fnum 'pg-polygon)) + (format t "tuple ~D: got~%" i) + (format t " i = (~D bytes) ~D~%" (pq-getlength res i i-fnum) i-val) + (format t " d = (~D bytes) ~D~%" (pq-getlength res i d-fnum) d-val) + (format t " p = (~D bytes) ~D points~,8@Tboundbox = (hi=~F/~F, lo = ~F/~F)~%" + (pq-getlength res i d-fnum) (pg-polygon-num-points p-val) + (pg-point-x (pg-box-high (pg-polygon-boundbox p-val))) + (pg-point-y (pg-box-high (pg-polygon-boundbox p-val))) + (pg-point-x (pg-box-low (pg-polygon-boundbox p-val))) + (pg-point-y (pg-box-low (pg-polygon-boundbox p-val)))) +) +(pq-clear res) + +(setq res (pq-exec conn "CLOSE mycursor")) +(pq-clear res) + +(setq res (pq-exec conn "COMMIT")) +(pq-clear res) + +(pq-finish conn) Index: xc/programs/xedit/lisp/test/widgets.lsp diff -u /dev/null xc/programs/xedit/lisp/test/widgets.lsp:1.2 --- /dev/null Fri Jan 18 15:27:16 2002 +++ xc/programs/xedit/lisp/test/widgets.lsp Sat Sep 29 00:46:06 2001 @@ -0,0 +1,71 @@ +;; +;; 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. +;; +;; Author: Paulo César Pereira de Andrade +;; +;; +;; $XFree86: xc/programs/xedit/lisp/test/widgets.lsp,v 1.2 2001/09/29 04:46:06 paulo Exp $ +;; +(require "xaw") +(require "xt") + +(defun quit-callback (widget user call) (quit)) + +(setq toplevel + (xt-app-initialize 'appcontext "Widgets" + '(("title" . "Widgets (without customization)")))) + +(setq vpane + (xt-create-managed-widget "vpane" paned-widget-class toplevel)) +(setq form + (xt-create-managed-widget "form" form-widget-class vpane)) +(xt-create-managed-widget "command" command-widget-class form + '(("label" . "Command Widget"))) +(xt-create-managed-widget "label" label-widget-class form + '(("label" . "Label Widget") ("fromVert" . "command"))) +(xt-create-managed-widget "button" menu-button-widget-class form + '(("label" . "MenuButton Widget") ("fromVert" . "label"))) + +(setq popup + (xt-create-managed-widget "menu" simple-menu-widget-class toplevel)) +(xt-create-managed-widget "smebsb" sme-bsb-object-class popup + '(("label" . "SmeBSB Object"))) +(xt-create-managed-widget "smeline" sme-line-object-class popup) +(xt-create-managed-widget "smebsb2" sme-bsb-object-class popup + '(("label" . "SmeBSB Object two"))) + +(xt-create-managed-widget "toggle" toggle-widget-class form + '(("label" . "Toggle Widget") ("fromVert" . "button"))) +(xt-create-managed-widget "repeater" repeater-widget-class form + '(("label" . "Repeater Widget") ("fromVert" . "toggle"))) + +(setq quit + (xt-create-managed-widget "quit" command-widget-class vpane + '(("label" . "Quit")))) +(xt-add-callback quit "callback" 'quit-callback) + +(xt-realize-widget toplevel) +(xt-app-main-loop appcontext) Index: xc/programs/xev/xev.c diff -u xc/programs/xev/xev.c:1.4 xc/programs/xev/xev.c:1.5 --- xc/programs/xev/xev.c:1.4 Wed Mar 7 10:54:15 2001 +++ xc/programs/xev/xev.c Mon Jan 7 15:38:30 2002 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xev/xev.c,v 1.4 2001/03/07 15:54:15 dawes Exp $ */ +/* $XFree86: xc/programs/xev/xev.c,v 1.5 2002/01/07 20:38:30 dawes Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -604,7 +604,9 @@ (unsigned int *)&hintp->width, (unsigned int *)&hintp->height); if ((geom_result & WidthValue) && (geom_result & HeightValue)) { +#ifndef max #define max(a,b) ((a) > (b) ? (a) : (b)) +#endif hintp->width = max (hintp->width, hintp->min_width); hintp->height = max (hintp->height, hintp->min_height); hintp->flags |= USSize; Index: xc/programs/xeyes/Eyes.c diff -u xc/programs/xeyes/Eyes.c:1.2 xc/programs/xeyes/Eyes.c:1.4 --- xc/programs/xeyes/Eyes.c:1.2 Mon Feb 14 14:20:59 2000 +++ xc/programs/xeyes/Eyes.c Mon Aug 27 19:35:13 2001 @@ -1,5 +1,5 @@ /* $XConsortium: Eyes.c,v 1.28 94/04/17 20:45:22 eswu Exp $ */ -/* $XFree86: xc/programs/xeyes/Eyes.c,v 1.2 2000/02/14 19:20:59 dawes Exp $ */ +/* $XFree86: xc/programs/xeyes/Eyes.c,v 1.4 2001/08/27 23:35:13 dawes Exp $ */ /* Copyright (c) 1991 X Consortium @@ -46,12 +46,8 @@ # include <X11/extensions/shape.h> #if (defined(SVR4) || defined(SYSV) && defined(i386)) -#if __STDC__ extern double hypot(double, double); -#else -extern double hypot(); #endif -#endif #define offset(field) XtOffsetOf(EyesRec, eyes.field) #define goffset(field) XtOffsetOf(WidgetRec, core.field) @@ -101,7 +97,7 @@ static int delays[] = { 50, 100, 200, 400, 0 }; -static void ClassInitialize() +static void ClassInitialize(void) { XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0 ); @@ -110,10 +106,11 @@ WidgetClass eyesWidgetClass = (WidgetClass) &eyesClassRec; /* ARGSUSED */ -static void Initialize (greq, gnew, args, num_args) - Widget greq, gnew; - ArgList args; - Cardinal *num_args; +static void Initialize ( + Widget greq, + Widget gnew, + ArgList args, + Cardinal *num_args) { EyesWidget w = (EyesWidget)gnew; XtGCMask valuemask; @@ -175,11 +172,12 @@ w->eyes.shapeGC = 0; } -static void eyeLiner (w, d, outgc, centergc, num) - EyesWidget w; - Drawable d; - GC outgc, centergc; - int num; +static void eyeLiner ( + EyesWidget w, + Drawable d, + GC outgc, + GC centergc, + int num) { Display *dpy = XtDisplay(w); @@ -198,9 +196,9 @@ } } -static TPoint computePupil (num, mouse) - int num; - TPoint mouse; +static TPoint computePupil ( + int num, + TPoint mouse) { double cx, cy; double dist; @@ -237,18 +235,18 @@ return ret; } -static void computePupils (mouse, pupils) - TPoint mouse; - TPoint pupils[2]; +static void computePupils ( + TPoint mouse, + TPoint pupils[2]) { pupils[0] = computePupil (0, mouse); pupils[1] = computePupil (1, mouse); } -static void eyeBall (w, gc, num) - EyesWidget w; - GC gc; - int num; +static void eyeBall ( + EyesWidget w, + GC gc, + int num) { Display *dpy = XtDisplay(w); Window win = XtWindow(w); @@ -260,8 +258,7 @@ 90 * 64, 360 * 64); } -static void repaint_window (w) - EyesWidget w; +static void repaint_window (EyesWidget w) { if (XtIsRealized ((Widget) w)) { eyeLiner (w, XtWindow (w), w->eyes.outGC, w->eyes.centerGC, 0); @@ -273,9 +270,9 @@ } /* ARGSUSED */ -static void draw_it (client_data, id) - XtPointer client_data; - XtIntervalId *id; /* unused */ +static void draw_it ( + XtPointer client_data, + XtIntervalId *id) /* unused */ { EyesWidget w = (EyesWidget)client_data; Window rep_root, rep_child; @@ -327,8 +324,7 @@ delays[w->eyes.update], draw_it, (XtPointer)w); } /* draw_it */ -static void Resize (gw) - Widget gw; +static void Resize (Widget gw) { EyesWidget w = (EyesWidget) gw; XGCValues xgcv; @@ -366,10 +362,10 @@ } } -static void Realize (gw, valueMask, attrs) - Widget gw; - XtValueMask *valueMask; - XSetWindowAttributes *attrs; +static void Realize ( + Widget gw, + XtValueMask *valueMask, + XSetWindowAttributes *attrs) { EyesWidget w = (EyesWidget)gw; @@ -385,8 +381,7 @@ delays[w->eyes.update], draw_it, (XtPointer)gw); } -static void Destroy (gw) - Widget gw; +static void Destroy (Widget gw) { EyesWidget w = (EyesWidget)gw; @@ -398,10 +393,10 @@ } /* ARGSUSED */ -static void Redisplay(gw, event, region) - Widget gw; - XEvent *event; - Region region; +static void Redisplay( + Widget gw, + XEvent *event, + Region region) { EyesWidget w; @@ -414,10 +409,12 @@ } /* ARGSUSED */ -static Boolean SetValues (current, request, new, args, num_args) - Widget current, request, new; - ArgList args; - Cardinal *num_args; +static Boolean SetValues ( + Widget current, + Widget request, + Widget new, + ArgList args, + Cardinal *num_args) { return( FALSE ); } Index: xc/programs/xeyes/transform.c diff -u xc/programs/xeyes/transform.c:1.3 xc/programs/xeyes/transform.c:1.4 --- xc/programs/xeyes/transform.c:1.3 Thu Feb 17 09:00:35 2000 +++ xc/programs/xeyes/transform.c Mon Aug 27 19:35:13 2001 @@ -1,19 +1,16 @@ /* * transformed coordinate system objects for X */ -/* $XFree86: xc/programs/xeyes/transform.c,v 1.3 2000/02/17 14:00:35 dawes Exp $ */ +/* $XFree86: xc/programs/xeyes/transform.c,v 1.4 2001/08/27 23:35:13 dawes Exp $ */ # include <X11/Xos.h> # include <stdlib.h> # include <X11/Xlib.h> # include "transform.h" +#if 0 static XPoint * -TranslatePoints (points, n_points, t, mode) - TPoint *points; - int n_points; - Transform *t; - int mode; +TranslatePoints (TPoint *points, int n_points, Transform *t, int mode) { XPoint *xpoints; int i; @@ -33,16 +30,16 @@ return xpoints; } -void -TFillPolygon (dpy, d, gc, t, points, n_points, shape, mode) - Display *dpy; - Drawable d; - GC gc; - Transform *t; - TPoint *points; - int n_points; - int shape; - int mode; +static void +TFillPolygon ( + Display *dpy, + Drawable d, + GC gc, + Transform *t, + TPoint *points, + int n_points, + int shape, + int mode) { XPoint *xpoints; @@ -54,14 +51,18 @@ } } -void -TDrawArc (dpy, d, gc, t, x, y, width, height, angle1, angle2) - Display *dpy; - Drawable d; - GC gc; - Transform *t; - double x, y, width, height; - int angle1, angle2; +static void +TDrawArc ( + Display *dpy, + Drawable d, + GC gc, + Transform *t, + double x, + double y, + double width, + double height, + int angle1, + int angle2) { int xx, xy, xw, xh; @@ -79,6 +80,7 @@ } XDrawArc (dpy, d, gc, xx, xy, xw, xh, angle1, angle2); } +#endif void TFillArc (dpy, d, gc, t, x, y, width, height, angle1, angle2) Index: xc/programs/xeyes/xeyes.c diff -u xc/programs/xeyes/xeyes.c:1.3 xc/programs/xeyes/xeyes.c:1.4 --- xc/programs/xeyes/xeyes.c:1.3 Thu Feb 17 09:00:35 2000 +++ xc/programs/xeyes/xeyes.c Mon Aug 27 19:35:13 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xeyes/xeyes.c,v 1.3 2000/02/17 14:00:35 dawes Exp $ */ +/* $XFree86: xc/programs/xeyes/xeyes.c,v 1.4 2001/08/27 23:35:13 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -41,7 +41,8 @@ /* Exit with message describing command line format */ -void usage() +static void +usage(void) { fprintf(stderr, "usage: xeyes\n"); @@ -70,11 +71,8 @@ static Atom wm_delete_window; /*ARGSUSED*/ -static void quit(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +static void +quit(Widget w, XEvent *event, String *params, Cardinal *num_params) { if (event->type == ClientMessage && event->xclient.data.l[0] != wm_delete_window) { @@ -90,9 +88,7 @@ }; int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { XtAppContext app_context; Widget toplevel; Index: xc/programs/xf86dga/dga.c diff -u xc/programs/xf86dga/dga.c:3.17 xc/programs/xf86dga/dga.c:3.19 --- xc/programs/xf86dga/dga.c:3.17 Sun May 14 16:44:00 2000 +++ xc/programs/xf86dga/dga.c Sat Oct 27 23:34:32 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xf86dga/dga.c,v 3.17 2000/05/14 20:44:00 alanh Exp $ */ +/* $XFree86: xc/programs/xf86dga/dga.c,v 3.19 2001/10/28 03:34:32 tsi Exp $ */ #include <X11/Xos.h> #include <X11/Intrinsic.h> @@ -26,7 +26,6 @@ #define MINMINOR 0 /* copied from xf86Io.c */ -#if !defined(AMOEBA) && !defined(MINIX) static int GetTimeInMillis(void) { @@ -35,7 +34,6 @@ gettimeofday(&tp, 0); return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); } -#endif /* !AMOEBA && !MINIX */ int main(int argc, char *argv[]) @@ -47,7 +45,7 @@ char *addr; int width, bank, banks, ram; XEvent event; - Colormap cmap; + Colormap cmap = 0; Visual *vis; int flags; Index: xc/programs/xfd/grid.c diff -u xc/programs/xfd/grid.c:1.4 xc/programs/xfd/grid.c:1.5 --- xc/programs/xfd/grid.c:1.4 Wed Jan 17 18:45:26 2001 +++ xc/programs/xfd/grid.c Fri Dec 14 15:01:31 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: grid.c,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ + * $Xorg: grid.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xfd/grid.c,v 1.4 2001/01/17 23:45:26 dawes Exp $ */ +/* $XFree86: xc/programs/xfd/grid.c,v 1.5 2001/12/14 20:01:31 dawes Exp $ */ #include <X11/IntrinsicP.h> Index: xc/programs/xfd/grid.h diff -u xc/programs/xfd/grid.h:1.1.1.3 xc/programs/xfd/grid.h:1.2 --- xc/programs/xfd/grid.h:1.1.1.3 Tue Jan 16 17:49:38 2001 +++ xc/programs/xfd/grid.h Fri Dec 14 15:01:31 2001 @@ -1,9 +1,13 @@ -/* $Xorg: grid.h,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ */ +/* $Xorg: grid.h,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfd/gridP.h diff -u xc/programs/xfd/gridP.h:1.1.1.3 xc/programs/xfd/gridP.h:1.2 --- xc/programs/xfd/gridP.h:1.1.1.3 Tue Jan 16 17:49:43 2001 +++ xc/programs/xfd/gridP.h Fri Dec 14 15:01:31 2001 @@ -1,9 +1,13 @@ -/* $Xorg: gridP.h,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ */ +/* $Xorg: gridP.h,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfd/xfd.c diff -u xc/programs/xfd/xfd.c:1.5 xc/programs/xfd/xfd.c:1.6 --- xc/programs/xfd/xfd.c:1.5 Sun Apr 1 10:00:20 2001 +++ xc/programs/xfd/xfd.c Fri Dec 14 15:01:31 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: xfd.c,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ + * $Xorg: xfd.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xfd/xfd.c,v 1.5 2001/04/01 14:00:20 tsi Exp $ */ +/* $XFree86: xc/programs/xfd/xfd.c,v 1.6 2001/12/14 20:01:31 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> Index: xc/programs/xfd/xfd.man diff -u xc/programs/xfd/xfd.man:1.7 xc/programs/xfd/xfd.man:1.8 --- xc/programs/xfd/xfd.man:1.7 Sat Jan 27 13:21:12 2001 +++ xc/programs/xfd/xfd.man Fri Dec 14 15:01:31 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xfd.man,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ +.\" $Xorg: xfd.man,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ .\" Copyright 1989, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xfd/xfd.man,v 1.7 2001/01/27 18:21:12 dawes Exp $ +.\" $XFree86: xc/programs/xfd/xfd.man,v 1.8 2001/12/14 20:01:31 dawes Exp $ .\" .TH XFD 1 __xorgversion__ .SH NAME Index: xc/programs/xfindproxy/xfindproxy.c diff -u xc/programs/xfindproxy/xfindproxy.c:1.5 xc/programs/xfindproxy/xfindproxy.c:1.8 --- xc/programs/xfindproxy/xfindproxy.c:1.5 Wed Jan 17 18:45:27 2001 +++ xc/programs/xfindproxy/xfindproxy.c Fri Dec 14 15:01:32 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xfindproxy.c,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ */ +/* $Xorg: xfindproxy.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xfindproxy/xfindproxy.c,v 1.5 2001/01/17 23:45:27 dawes Exp $ */ +/* $XFree86: xc/programs/xfindproxy/xfindproxy.c,v 1.8 2001/12/14 20:01:32 dawes Exp $ */ #include <stdio.h> @@ -37,11 +41,7 @@ #include <X11/PM/PMproto.h> #include "xfindproxy.h" -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern char *getenv(); -#endif #include <ctype.h> static void PMprocessMessages(IceConn iceConn, IcePointer clientData, @@ -339,6 +339,7 @@ } } /*NOTREACHED*/ + exit(0); } Index: xc/programs/xfindproxy/xfindproxy.h diff -u xc/programs/xfindproxy/xfindproxy.h:1.1.1.3 xc/programs/xfindproxy/xfindproxy.h:1.2 --- xc/programs/xfindproxy/xfindproxy.h:1.1.1.3 Tue Jan 16 17:49:55 2001 +++ xc/programs/xfindproxy/xfindproxy.h Fri Dec 14 15:01:32 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xfindproxy.h,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ */ +/* $Xorg: xfindproxy.h,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfindproxy/xfindproxy.man diff -u xc/programs/xfindproxy/xfindproxy.man:1.6 xc/programs/xfindproxy/xfindproxy.man:1.7 --- xc/programs/xfindproxy/xfindproxy.man:1.6 Sat Jan 27 13:21:12 2001 +++ xc/programs/xfindproxy/xfindproxy.man Fri Dec 14 15:01:32 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xfindproxy.man,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ +.\" $Xorg: xfindproxy.man,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ .\" Copyright 1996, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" from The Open Group. .\" .\" -.\" $XFree86: xc/programs/xfindproxy/xfindproxy.man,v 1.6 2001/01/27 18:21:12 dawes Exp $ +.\" $XFree86: xc/programs/xfindproxy/xfindproxy.man,v 1.7 2001/12/14 20:01:32 dawes Exp $ .\" .TH XFINDPROXY 1 __xorgversion__ .SH NAME Index: xc/programs/xfontsel/ULabel.c diff -u xc/programs/xfontsel/ULabel.c:1.1 xc/programs/xfontsel/ULabel.c:1.3 --- xc/programs/xfontsel/ULabel.c:1.1 Sat Feb 12 22:26:23 2000 +++ xc/programs/xfontsel/ULabel.c Sat Oct 27 23:34:32 2001 @@ -47,7 +47,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xfontsel/ULabel.c,v 1.1 2000/02/13 03:26:23 dawes Exp $ */ +/* $XFree86: xc/programs/xfontsel/ULabel.c,v 1.3 2001/10/28 03:34:32 tsi Exp $ */ /* * ULabel.c - UCSLabel widget @@ -63,13 +63,8 @@ #include <X11/Xmu/Drawing.h> #include <stdio.h> #include <ctype.h> - /* needed for abs() */ -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -int abs(); -#endif #define streq(a,b) (strcmp( (a), (b) ) == 0) @@ -246,7 +241,6 @@ char *str; int n; { - int i; char *ep; unsigned short codepoint; XChar2b *ptr; @@ -285,7 +279,6 @@ char *str; int n; { - int i; char *ep; unsigned short codepoint; XChar2b *ptr; @@ -571,9 +564,7 @@ XEvent *event; Region region; { - extern WidgetClass commandWidgetClass; UCSLabelWidget w = (UCSLabelWidget) gw; - UCSLabelWidgetClass lwclass = (UCSLabelWidgetClass) XtClass (gw); GC gc; /* Index: xc/programs/xfontsel/XFontSel.ad diff -u xc/programs/xfontsel/XFontSel.ad:1.1 xc/programs/xfontsel/XFontSel.ad:1.2 --- xc/programs/xfontsel/XFontSel.ad:1.1 Sat Feb 12 22:26:24 2000 +++ xc/programs/xfontsel/XFontSel.ad Mon Aug 13 17:46:51 2001 @@ -32,7 +32,7 @@ ! Ralph R. Swick, Digital Equipment Corporation/M.I.T. Project Athena ! one weekend in November, 1989 ! -! $XFree86: xc/programs/xfontsel/XFontSel.ad,v 1.1 2000/02/13 03:26:24 dawes Exp $ +! $XFree86: xc/programs/xfontsel/XFontSel.ad,v 1.2 2001/08/13 21:46:51 dawes Exp $ *appDefaultsVersion: 1 @@ -114,6 +114,8 @@ !*field1*menu*courier.Font: *fontName*skipAdjust: true + +*sampleText*international: false *sampleText*Label: \ Processing fonts... Index: xc/programs/xfontsel/xfontsel.c diff -u xc/programs/xfontsel/xfontsel.c:1.4 xc/programs/xfontsel/xfontsel.c:1.7 --- xc/programs/xfontsel/xfontsel.c:1.4 Sun Apr 1 10:00:20 2001 +++ xc/programs/xfontsel/xfontsel.c Sat Oct 27 23:34:32 2001 @@ -31,7 +31,7 @@ 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.4 2001/04/01 14:00:20 tsi Exp $ */ +/* $XFree86: xc/programs/xfontsel/xfontsel.c,v 1.7 2001/10/28 03:34:32 tsi Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -84,7 +84,7 @@ void QuitAction(); XtActionsRec xfontsel_actions[] = { - "Quit", QuitAction + {"Quit", QuitAction} }; Atom wm_delete_window; @@ -150,7 +150,7 @@ {"-scaled", "scaledFonts", XrmoptionNoArg, "True"}, }; -Syntax(call) +static void Syntax(call) char *call; { fprintf (stderr, "usage: %s [-options ...] -fn font\n\n", call); @@ -226,6 +226,15 @@ typedef enum {ValidateCurrentField, SkipCurrentField} ValidateAction; +static void EnableAllItems(int field); +static void EnableRemainingItems(ValidateAction current_field_action); +static void FlushXqueue(Display *dpy); +static void MarkInvalidFonts(Boolean *set, FieldValue *val); +static void ScheduleWork(XtProc proc, XtPointer closure, int priority); +static void SetCurrentFontCount(void); +static void SetNoFonts(void); +static void SetParsingFontCount(int count); + XtAppContext appCtx; int numFonts; int numBadFonts; @@ -387,9 +396,8 @@ * If the workQueue was previously empty, then makes sure that * Xt knows we have (background) work to do. */ - -ScheduleWork( proc, closure, priority ) +static void ScheduleWork( proc, closure, priority ) XtProc proc; XtPointer closure; int priority; @@ -747,6 +755,47 @@ } +/* A verbatim copy from xc/lib/font/fontfile/fontdir.c */ + +/* + * Compare two strings just like strcmp, but preserve decimal integer + * sorting order, i.e. "2" < "10" or "iso8859-2" < "iso8859-10" < + * "iso10646-1". Strings are sorted as if sequences of digits were + * prefixed by a length indicator (i.e., does not ignore leading zeroes). + * + * Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> + */ +#define Xisdigit(c) ('\060' <= (c) && (c) <= '\071') + +static int strcmpn(const char *s1, const char *s2) +{ + int digits, predigits = 0; + const char *ss1, *ss2; + + while (1) { + if (*s1 == 0 && *s2 == 0) + return 0; + digits = Xisdigit(*s1) && Xisdigit(*s2); + if (digits && !predigits) { + ss1 = s1; + ss2 = s2; + while (Xisdigit(*ss1) && Xisdigit(*ss2)) + ss1++, ss2++; + if (!Xisdigit(*ss1) && Xisdigit(*ss2)) + return -1; + if (Xisdigit(*ss1) && !Xisdigit(*ss2)) + return 1; + } + if ((unsigned char)*s1 < (unsigned char)*s2) + return -1; + if ((unsigned char)*s1 > (unsigned char)*s2) + return 1; + predigits = digits; + s1++, s2++; + } +} + + /* Order is *, (nil), rest */ int AlphabeticSort(fval1, fval2) FieldValue *fval1, *fval2; @@ -759,7 +808,7 @@ return -1; if (!fval2->string) return 1; - return strcmp(fval1->string, fval2->string); + return strcmpn(fval1->string, fval2->string); } @@ -871,7 +920,7 @@ } -SetNoFonts() +static void SetNoFonts(void) { matchingFontCount = 0; SetCurrentFontCount(); @@ -982,7 +1031,7 @@ } -SetCurrentFontCount() +static void SetCurrentFontCount(void) { char label[80]; Arg args[1]; @@ -997,7 +1046,7 @@ } -SetParsingFontCount(count) +static void SetParsingFontCount(int count) { char label[80]; Arg args[1]; @@ -1061,7 +1110,7 @@ currentFontNameString[pos++] = DELIM; if ((i = currentFont.value_index[f]) != -1) { FieldValue *val = &fieldValues[f]->value[i]; - if (str = val->string) + if ((str = val->string)) len = strlen(str); else { str = ""; @@ -1139,7 +1188,7 @@ } -MarkInvalidFonts( set, val ) +static void MarkInvalidFonts( set, val ) Boolean *set; FieldValue *val; { @@ -1159,7 +1208,7 @@ } -EnableRemainingItems(current_field_action) +static void EnableRemainingItems(current_field_action) ValidateAction current_field_action; { if (matchingFontCount == 0 || matchingFontCount == numFonts) { @@ -1203,7 +1252,7 @@ } -EnableAllItems(field) +static void EnableAllItems(int field) { FieldValue *value = fieldValues[field]->value; int count; @@ -1242,7 +1291,6 @@ int i, j; FieldValue *v; int *font; - char *str; for (i = fieldValues[f]->count, v = fieldValues[f]->value; --i >= 0; v++) { if (!v->enable || !v->string || !strcmp(v->string, "0")) @@ -1374,7 +1422,7 @@ } -FlushXqueue(dpy) +static void FlushXqueue(dpy) Display *dpy; { XSync(dpy, False); Index: xc/programs/xfs/xfs.man diff -u xc/programs/xfs/xfs.man:3.15 xc/programs/xfs/xfs.man:3.16 --- xc/programs/xfs/xfs.man:3.15 Wed Apr 18 12:13:22 2001 +++ xc/programs/xfs/xfs.man Fri Dec 14 15:01:32 2001 @@ -1,8 +1,12 @@ -.\" $XFree86: xc/programs/xfs/xfs.man,v 3.15 2001/04/18 16:13:22 dawes Exp $ +.\" $XFree86: xc/programs/xfs/xfs.man,v 3.16 2001/12/14 20:01:32 dawes Exp $ .\" .\" Copyright 1991, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. @@ -32,7 +36,7 @@ .\" no representations about the .\" suitability of this software for any purpose. It is provided "as is" .\" without express or implied warranty. -.\" $Xorg: xfs.man,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ +.\" $Xorg: xfs.man,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ .TH XFS 1 __xorgversion__ .SH NAME xfs \- X font server Index: xc/programs/xfs/difs/Imakefile diff -u xc/programs/xfs/difs/Imakefile:1.5 xc/programs/xfs/difs/Imakefile:1.6 --- xc/programs/xfs/difs/Imakefile:1.5 Wed Jan 17 18:45:28 2001 +++ xc/programs/xfs/difs/Imakefile Tue Jul 31 20:45:04 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xfs/difs/Imakefile,v 1.5 2001/01/17 23:45:28 dawes Exp $ +XCOMM $XFree86: xc/programs/xfs/difs/Imakefile,v 1.6 2001/08/01 00:45:04 tsi Exp $ #undef ServerDefines #include <Server.tmpl> @@ -17,7 +17,7 @@ fonts.o difsutils.o cache.o initfonts.o atom.o -INCLUDES = -I../include -I$(FONTINCSRC) -I$(EXTINCSRC) +INCLUDES = -I../include -I$(FONTINCSRC) -I$(EXTINCSRC) -I$(FONTLIBSRC)/include DEFINES = AllocateLocalDefines #if BuildLowMem LOWMEMDEFINES = -DLOWMEMFTPT Index: xc/programs/xfs/difs/atom.c diff -u xc/programs/xfs/difs/atom.c:3.3 xc/programs/xfs/difs/atom.c:3.4 --- xc/programs/xfs/difs/atom.c:3.3 Wed Jan 17 18:45:28 2001 +++ xc/programs/xfs/difs/atom.c Fri Dec 14 15:01:33 2001 @@ -1,11 +1,15 @@ -/* $Xorg: atom.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: atom.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * font server atom manipulations */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -46,7 +50,7 @@ * @(#)atom.c 4.1 5/2/91 * */ -/* $XFree86: xc/programs/xfs/difs/atom.c,v 3.3 2001/01/17 23:45:28 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/atom.c,v 3.4 2001/12/14 20:01:33 dawes Exp $ */ #include "misc.h" #include "fsresource.h" Index: xc/programs/xfs/difs/cache.c diff -u xc/programs/xfs/difs/cache.c:1.5 xc/programs/xfs/difs/cache.c:1.6 --- xc/programs/xfs/difs/cache.c:1.5 Wed Jan 17 18:45:28 2001 +++ xc/programs/xfs/difs/cache.c Fri Dec 14 15:01:33 2001 @@ -1,8 +1,12 @@ -/* $Xorg: cache.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: cache.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * @(#)cache.c 4.2 91/05/02 * */ -/* $XFree86: xc/programs/xfs/difs/cache.c,v 1.5 2001/01/17 23:45:28 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/cache.c,v 1.6 2001/12/14 20:01:33 dawes Exp $ */ #include "cachestr.h" #include "misc.h" Index: xc/programs/xfs/difs/charinfo.c diff -u xc/programs/xfs/difs/charinfo.c:1.9 xc/programs/xfs/difs/charinfo.c:1.12 --- xc/programs/xfs/difs/charinfo.c:1.9 Wed Jan 17 18:45:28 2001 +++ xc/programs/xfs/difs/charinfo.c Fri Dec 14 15:01:33 2001 @@ -1,9 +1,13 @@ -/* $Xorg: charinfo.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: charinfo.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -45,11 +49,12 @@ * 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.9 2001/01/17 23:45:28 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/charinfo.c,v 1.12 2001/12/14 20:01:33 dawes Exp $ */ #include <X11/Xos.h> #include "misc.h" #include "fontstruct.h" +#include "fontutil.h" #include "clientstr.h" #define FSMD_H #include "FSproto.h" @@ -72,7 +77,9 @@ #define n2dChars(pfi) (((pfi)->lastRow - (pfi)->firstRow + 1) * \ ((pfi)->lastCol - (pfi)->firstCol + 1)) +#if 0 static CharInfoRec junkDefault; +#endif typedef int (*MetricsFunc)(FontPtr, unsigned long, unsigned char *, FontEncoding, unsigned long *, CharInfoPtr *); @@ -168,9 +175,11 @@ fsfree (xchars); return err; } -/* if (glyphCount != 1 || +#if 0 + if (glyphCount != 1 || (*xci == defaultPtr && defaultCh != ((r<<8)+c))) - *xci = &junkDefault;*/ + *xci = &junkDefault; +#endif xci++; } } Index: xc/programs/xfs/difs/difsutils.c diff -u xc/programs/xfs/difs/difsutils.c:1.6 xc/programs/xfs/difs/difsutils.c:1.7 --- xc/programs/xfs/difs/difsutils.c:1.6 Wed Jan 17 18:45:28 2001 +++ xc/programs/xfs/difs/difsutils.c Fri Dec 14 15:01:33 2001 @@ -1,4 +1,4 @@ -/* $Xorg: difsutils.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: difsutils.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * misc utility routines */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,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.6 2001/01/17 23:45:28 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/difsutils.c,v 1.7 2001/12/14 20:01:33 dawes Exp $ */ #define XK_LATIN1 Index: xc/programs/xfs/difs/dispatch.c diff -u xc/programs/xfs/difs/dispatch.c:3.9 xc/programs/xfs/difs/dispatch.c:3.12 --- xc/programs/xfs/difs/dispatch.c:3.9 Sun Apr 1 10:00:20 2001 +++ xc/programs/xfs/difs/dispatch.c Fri Dec 14 15:01:33 2001 @@ -1,4 +1,4 @@ -/* $Xorg: dispatch.c,v 1.5 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: dispatch.c,v 1.6 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * protocol dispatcher */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/dispatch.c,v 3.9 2001/04/01 14:00:20 tsi Exp $ */ +/* $XFree86: xc/programs/xfs/difs/dispatch.c,v 3.12 2001/12/14 20:01:33 dawes Exp $ */ #include <stdlib.h> #include "dispatch.h" @@ -141,8 +145,10 @@ op = MAJOROP; if (op >= NUM_PROC_VECTORS) result = ProcBadRequest (client); - else + else if (*client->requestVector[op] != NULL) result = (*client->requestVector[op]) (client); + else + result = FSBadRequest; } if (result != FSSuccess) { if (client->noClientException != FSSuccess) @@ -202,8 +208,12 @@ return (client->noClientException = -2); if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) || (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l'))) { + int status; + client->swapped = TRUE; - SwapConnClientPrefix(prefix); + status = SwapConnClientPrefix(client, prefix); + if (status != FSSuccess) + return (status); } client->major_version = prefix->major_version; client->minor_version = prefix->minor_version; @@ -247,6 +257,12 @@ /* build up a list of the stuff */ for (i = 0, ad = auth_data; i < (int)prefix->num_auths; i++) { + if (ad - (char *)auth_data > (stuff->length << 2) - 4) { + int lengthword = stuff->length; + + SendErrToClient(client, FSBadLength, (pointer)&lengthword); + return (FSBadLength); + } /* copy carefully in case wire data is not aligned */ client_auth[i].namelen = (((unsigned char *)ad)[0] << 8) + ((unsigned char *)ad)[1]; @@ -259,6 +275,15 @@ client_auth[i].data = (char *) ad; ad += client_auth[i].datalen; } + if (!(int)prefix->num_auths) + ad += 4; + if (ad - (char *)auth_data > (stuff->length << 2)) { + int lengthword = stuff->length; + + SendErrToClient(client, FSBadLength, (pointer)&lengthword); + return (FSBadLength); + } + num_alts = ListAlternateServers(&altservers); for (i = 0, altlen = 0; i < num_alts; i++) { /* subset + len + namelen + pad */ @@ -370,7 +395,7 @@ */ void -SendErrToClient( +DoSendErrToClient( ClientPtr client, int error, pointer data) /* resource id, format, resolution, etc */ @@ -573,7 +598,15 @@ } } /* build up a list of the stuff */ - for (i = 0, ad = (char *)stuff + SIZEOF(fsCreateACReq); i < (int)stuff->num_auths; i++) { + for (i = 0, ad = (char *)stuff + SIZEOF(fsCreateACReq); + i < (int)stuff->num_auths; i++) { + if (ad - (char *)stuff + SIZEOF(fsCreateACReq) > + (stuff->length << 2) - 4) { + int lengthword = stuff->length; + + SendErrToClient(client, FSBadLength, (pointer)&lengthword); + return (FSBadLength); + } /* copy carefully in case data is not aligned */ acp[i].namelen = (((unsigned char *)ad)[0] << 8) + ((unsigned char *)ad)[1]; @@ -586,6 +619,14 @@ acp[i].data = (char *) ad; ad += acp[i].datalen; } + if (!(int)stuff->num_auths) + ad += 4; + if (ad - (char *)stuff > (stuff->length << 2)) { + int lengthword = stuff->length; + + SendErrToClient(client, FSBadLength, (pointer)&lengthword); + return (FSBadLength); + } /* XXX needs work for AuthContinue */ index = stuff->num_auths; @@ -702,6 +743,13 @@ REQUEST(fsSetResolutionReq); REQUEST_AT_LEAST_SIZE(fsSetResolutionReq); + if ((stuff->length << 2) - SIZEOF(fsSetResolutionReq) < + stuff->num_resolutions * SIZEOF(fsResolution)) { + int lengthword = stuff->length; + + SendErrToClient(client, FSBadLength, &lengthword); + return FSBadLength; + } new_res = (fsResolution *) fsalloc(SIZEOF(fsResolution) * stuff->num_resolutions); if (!new_res) { @@ -725,6 +773,13 @@ REQUEST(fsReq); REQUEST_AT_LEAST_SIZE(fsReq); + if ((stuff->length << 2) - SIZEOF(fsResolution) < client->num_resolutions * + sizeof(fsResolution)) { + int lengthword = stuff->length; + + SendErrToClient(client, FSBadLength, &lengthword); + return FSBadLength; + } reply.type = FS_Reply; reply.num_resolutions = client->num_resolutions; reply.sequenceNumber = client->sequence; @@ -944,7 +999,7 @@ } void -CloseDownClient(ClientPtr client) +DoCloseDownClient(ClientPtr client) { if (client->clientGone != CLIENT_GONE) { DeleteClientFontStuff(client); Index: xc/programs/xfs/difs/events.c diff -u xc/programs/xfs/difs/events.c:3.6 xc/programs/xfs/difs/events.c:3.7 --- xc/programs/xfs/difs/events.c:3.6 Wed Jan 17 18:45:28 2001 +++ xc/programs/xfs/difs/events.c Fri Dec 14 15:01:34 2001 @@ -1,4 +1,4 @@ -/* $Xorg: events.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: events.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * event handling stuff */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,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.6 2001/01/17 23:45:28 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/events.c,v 3.7 2001/12/14 20:01:34 dawes Exp $ */ #include <swaprep.h> Index: xc/programs/xfs/difs/extensions.c diff -u xc/programs/xfs/difs/extensions.c:1.5 xc/programs/xfs/difs/extensions.c:1.7 --- xc/programs/xfs/difs/extensions.c:1.5 Wed Jan 17 18:45:29 2001 +++ xc/programs/xfs/difs/extensions.c Fri Dec 14 15:01:34 2001 @@ -1,4 +1,4 @@ -/* $Xorg: extensions.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: extensions.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * font server extensions */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,13 +46,14 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/extensions.c,v 1.5 2001/01/17 23:45:29 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/extensions.c,v 1.7 2001/12/14 20:01:34 dawes Exp $ */ #include "FSproto.h" #include "misc.h" #include "clientstr.h" #include "extentst.h" #include "difs.h" +#include "dispatch.h" #define EXTENSION_BASE 128 #define EXTENSION_EVENT_BASE 64 Index: xc/programs/xfs/difs/fontinfo.c diff -u xc/programs/xfs/difs/fontinfo.c:1.8 xc/programs/xfs/difs/fontinfo.c:1.10 --- xc/programs/xfs/difs/fontinfo.c:1.8 Wed Jan 17 18:45:29 2001 +++ xc/programs/xfs/difs/fontinfo.c Fri Dec 14 15:01:34 2001 @@ -1,4 +1,4 @@ -/* $Xorg: fontinfo.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: fontinfo.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * font data query */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,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.8 2001/01/17 23:45:29 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/fontinfo.c,v 1.10 2001/12/14 20:01:34 dawes Exp $ */ #include "FS.h" #include "FSproto.h" @@ -54,6 +58,7 @@ #include "closestr.h" #include "globals.h" #include "difs.h" +#include "dispatch.h" #include <swapreq.h> #include <swaprep.h> Index: xc/programs/xfs/difs/fonts.c diff -u xc/programs/xfs/difs/fonts.c:3.9 xc/programs/xfs/difs/fonts.c:3.13 --- xc/programs/xfs/difs/fonts.c:3.9 Sun Apr 1 10:00:20 2001 +++ xc/programs/xfs/difs/fonts.c Fri Dec 14 15:01:34 2001 @@ -1,4 +1,4 @@ -/* $Xorg: fonts.c,v 1.4 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: fonts.c,v 1.5 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * font control */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/fonts.c,v 3.9 2001/04/01 14:00:20 tsi Exp $ */ +/* $XFree86: xc/programs/xfs/difs/fonts.c,v 3.13 2001/12/14 20:01:34 dawes Exp $ */ #include "FS.h" #include "FSproto.h" @@ -56,6 +60,8 @@ #include "closestr.h" #include "globals.h" #include "difs.h" +#include "dispatch.h" +#include "swaprep.h" static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; static int num_fpes = 0; @@ -631,15 +637,12 @@ char *paths, int *bad) { - int i, - validpaths, - err; + int i, validpaths, err = 0; int len; int type; char *cp = paths; char *name; - FontPathElementPtr fpe, - *fplist; + FontPathElementPtr fpe, *fplist; fplist = (FontPathElementPtr *) fsalloc(sizeof(FontPathElementPtr) * npaths); @@ -709,8 +712,12 @@ } } if (validpaths < npaths) { - fplist = (FontPathElementPtr *) + FontPathElementPtr *ftmp = (FontPathElementPtr *) fsrealloc(fplist, sizeof(FontPathElementPtr) * validpaths); + + if (!ftmp) + goto bail; + fplist = ftmp; npaths = validpaths; } if (validpaths == 0) { Index: xc/programs/xfs/difs/globals.c diff -u xc/programs/xfs/difs/globals.c:1.1.1.3 xc/programs/xfs/difs/globals.c:1.2 --- xc/programs/xfs/difs/globals.c:1.1.1.3 Tue Jan 16 17:50:34 2001 +++ xc/programs/xfs/difs/globals.c Fri Dec 14 15:01:34 2001 @@ -1,11 +1,15 @@ -/* $Xorg: globals.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: globals.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * various font server globals */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/difs/initfonts.c diff -u xc/programs/xfs/difs/initfonts.c:1.5 xc/programs/xfs/difs/initfonts.c:1.7 --- xc/programs/xfs/difs/initfonts.c:1.5 Wed Jan 17 18:45:29 2001 +++ xc/programs/xfs/difs/initfonts.c Fri Dec 14 15:01:34 2001 @@ -1,8 +1,12 @@ -/* $Xorg: initfonts.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: initfonts.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,13 +47,13 @@ * %W% %E% * */ -/* $XFree86: xc/programs/xfs/difs/initfonts.c,v 1.5 2001/01/17 23:45:29 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/initfonts.c,v 1.7 2001/12/14 20:01:34 dawes Exp $ */ #include "font.h" #include "difs.h" #ifdef FONTCACHE #include "misc.h" -#include "fontcacheP.h" +#include <X11/extensions/fontcacheP.h> #define CACHE_HI_MARK (2048 * 1024) #define CACHE_LOW_MARK (((2048 * 1024) / 4) * 3) Index: xc/programs/xfs/difs/main.c diff -u xc/programs/xfs/difs/main.c:3.7 xc/programs/xfs/difs/main.c:3.11 --- xc/programs/xfs/difs/main.c:3.7 Sun Apr 1 10:00:20 2001 +++ xc/programs/xfs/difs/main.c Fri Dec 14 15:01:35 2001 @@ -1,4 +1,4 @@ -/* $Xorg: main.c,v 1.4 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: main.c,v 1.5 2001/02/09 02:05:42 xorgcvs Exp $ */ /* * Font server main routine */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,9 +46,11 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/main.c,v 3.7 2001/04/01 14:00:20 tsi Exp $ */ +/* $XFree86: xc/programs/xfs/difs/main.c,v 3.11 2001/12/14 20:01:35 dawes Exp $ */ #include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> #include "FS.h" #include "FSproto.h" #include "clientstr.h" @@ -81,7 +87,6 @@ main(int argc, char *argv[]) { int i, oldumask; - struct passwd *pwent; argcGlobal = argc; argvGlobal = argv; @@ -171,11 +176,14 @@ exit(0); } -void +int NotImplemented(void) { NoopDDA(); /* dummy to get difsutils.o to link */ - FatalError("Not implemented\n"); + /* Getting here can become the next xfs exploit... so don't exit */ + ErrorF("Not implemented\n"); + + return (FSBadImplementation); } static Bool Index: xc/programs/xfs/difs/resource.c diff -u xc/programs/xfs/difs/resource.c:3.5 xc/programs/xfs/difs/resource.c:3.7 --- xc/programs/xfs/difs/resource.c:3.5 Wed Jan 17 18:45:29 2001 +++ xc/programs/xfs/difs/resource.c Fri Dec 14 15:01:35 2001 @@ -1,8 +1,12 @@ -/* $Xorg: resource.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: resource.c,v 1.4 2001/02/09 02:05:42 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * %W% %G% * */ -/* $XFree86: xc/programs/xfs/difs/resource.c,v 3.5 2001/01/17 23:45:29 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/resource.c,v 3.7 2001/12/14 20:01:35 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 @@ -66,6 +70,7 @@ #include "os.h" #include "fsresource.h" #include "clientstr.h" +#include "dispatch.h" #include "globals.h" static void rebuild_table(int client); Index: xc/programs/xfs/difs/swaprep.c diff -u xc/programs/xfs/difs/swaprep.c:1.4 xc/programs/xfs/difs/swaprep.c:1.5 --- xc/programs/xfs/difs/swaprep.c:1.4 Wed Jan 17 18:45:29 2001 +++ xc/programs/xfs/difs/swaprep.c Fri Dec 14 15:01:35 2001 @@ -1,4 +1,4 @@ -/* $Xorg: swaprep.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: swaprep.c,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* * font server reply swapping */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,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.4 2001/01/17 23:45:29 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/swaprep.c,v 1.5 2001/12/14 20:01:35 dawes Exp $ */ #include <swaprep.h> #include <swapreq.h> Index: xc/programs/xfs/difs/swapreq.c diff -u xc/programs/xfs/difs/swapreq.c:1.5 xc/programs/xfs/difs/swapreq.c:1.7 --- xc/programs/xfs/difs/swapreq.c:1.5 Wed Jan 17 18:45:29 2001 +++ xc/programs/xfs/difs/swapreq.c Fri Dec 14 15:01:35 2001 @@ -1,4 +1,4 @@ -/* $Xorg: swapreq.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: swapreq.c,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* * swapped requests */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,13 +46,14 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/swapreq.c,v 1.5 2001/01/17 23:45:29 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/swapreq.c,v 1.7 2001/12/14 20:01:35 dawes Exp $ */ #include <swapreq.h> #include "FSproto.h" #include "clientstr.h" #include "globals.h" +#include "dispatch.h" void SwapLongs(long *list, unsigned long count) @@ -135,8 +140,8 @@ return ((*ProcVector[stuff->reqType]) (client)); } -static void -swap_auth(pointer data, int num) +static int +swap_auth(ClientPtr client, pointer data, int num, int length) { unsigned char *p; unsigned char t; @@ -146,6 +151,12 @@ p = data; for (i = 0; i < num; i++) { + if (p - (unsigned char *)data > length - 4) { + int lengthword = length; + + SendErrToClient(client, FSBadLength, (pointer)&lengthword); + return (FSBadLength); + } namelen = *(CARD16 *) p; t = p[0]; p[0] = p[1]; @@ -159,15 +170,30 @@ p += (namelen + 3) & ~3; p += (datalen + 3) & ~3; } + if (!num) + p += 4; + if (p - (unsigned char *)data != length) { + int lengthword = length; + + SendErrToClient(client, FSBadLength, (pointer)&lengthword); + return (FSBadLength); + } + + return (FSSuccess); } int SProcCreateAC(ClientPtr client) { + int status; + REQUEST(fsCreateACReq); stuff->length = lswaps(stuff->length); stuff->acid = lswapl(stuff->acid); - swap_auth((pointer) &stuff[1], stuff->num_auths); + status = swap_auth(client, (pointer) &stuff[1], + stuff->num_auths, stuff->length); + if (status != FSSuccess) + return (status); return ((*ProcVector[stuff->reqType]) (client)); } @@ -177,6 +203,9 @@ REQUEST(fsSetResolutionReq); stuff->length = lswaps(stuff->length); stuff->num_resolutions = lswaps(stuff->num_resolutions); + if ((int)stuff->length - (&stuff[1] - &stuff[0]) != + stuff->num_resolutions * sizeof(fsResolution)) + return (FSBadLength); SwapShorts((short *) &stuff[1], stuff->num_resolutions); return ((*ProcVector[stuff->reqType]) (client)); @@ -255,11 +284,14 @@ return ((*ProcVector[stuff->reqType]) (client)); } -void -SwapConnClientPrefix(fsConnClientPrefix *pCCP) +int +SwapConnClientPrefix(ClientPtr client, fsConnClientPrefix *pCCP) { + REQUEST(fsFakeReq); + pCCP->major_version = lswaps(pCCP->major_version); pCCP->minor_version = lswaps(pCCP->minor_version); pCCP->auth_len = lswaps(pCCP->auth_len); - swap_auth((pointer) &pCCP[1], pCCP->num_auths); + return (swap_auth(client, (pointer) &pCCP[1], + pCCP->num_auths, stuff->length)); } Index: xc/programs/xfs/difs/tables.c diff -u xc/programs/xfs/difs/tables.c:1.5 xc/programs/xfs/difs/tables.c:1.6 --- xc/programs/xfs/difs/tables.c:1.5 Wed Jan 17 18:45:29 2001 +++ xc/programs/xfs/difs/tables.c Fri Dec 14 15:01:35 2001 @@ -1,4 +1,4 @@ -/* $Xorg: tables.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: tables.c,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* * all the dispatch, error, event and reply vectors */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,7 +46,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.5 2001/01/17 23:45:29 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/tables.c,v 1.6 2001/12/14 20:01:35 dawes Exp $ */ #include <dispatch.h> #include <swaprep.h> Index: xc/programs/xfs/include/access.h diff -u xc/programs/xfs/include/access.h:1.4 xc/programs/xfs/include/access.h:1.5 --- xc/programs/xfs/include/access.h:1.4 Wed Jan 17 18:45:30 2001 +++ xc/programs/xfs/include/access.h Fri Dec 14 15:01:36 2001 @@ -1,8 +1,12 @@ -/* $Xorg: access.h,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ +/* $Xorg: access.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * @(#)access.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/access.h,v 1.4 2001/01/17 23:45:30 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/access.h,v 1.5 2001/12/14 20:01:36 dawes Exp $ */ #ifndef _ACCESS_H_ #define _ACCESS_H_ Index: xc/programs/xfs/include/accstr.h diff -u xc/programs/xfs/include/accstr.h:1.5 xc/programs/xfs/include/accstr.h:1.7 --- xc/programs/xfs/include/accstr.h:1.5 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/accstr.h Fri Dec 14 15:01:36 2001 @@ -1,8 +1,12 @@ -/* $Xorg: accstr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: accstr.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -44,7 +48,7 @@ * @(#)accstr.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/accstr.h,v 1.5 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/accstr.h,v 1.7 2001/12/14 20:01:36 dawes Exp $ */ #ifndef _ACCSTR_H_ #define _ACCSTR_H_ @@ -64,9 +68,9 @@ extern int AddHost(HostList *list, HostAddress *addr); extern int RemoveHost(HostList *list, HostAddress *addr); extern int ValidHost(HostList list, HostAddress *addr); +#endif /* os/access.c */ extern int GetHostAddress(HostAddress *addr); -#endif #endif /* _ACCSTR_H_ */ Index: xc/programs/xfs/include/assert.h diff -u xc/programs/xfs/include/assert.h:1.1.1.3 xc/programs/xfs/include/assert.h:1.2 --- xc/programs/xfs/include/assert.h:1.1.1.3 Tue Jan 16 17:51:29 2001 +++ xc/programs/xfs/include/assert.h Fri Dec 14 15:01:36 2001 @@ -1,8 +1,12 @@ -/* $Xorg: assert.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: assert.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/include/auth.h diff -u xc/programs/xfs/include/auth.h:1.5 xc/programs/xfs/include/auth.h:1.6 --- xc/programs/xfs/include/auth.h:1.5 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/auth.h Fri Dec 14 15:01:36 2001 @@ -1,8 +1,12 @@ -/* $Xorg: auth.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: auth.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * @(#)auth.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/auth.h,v 1.5 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/auth.h,v 1.6 2001/12/14 20:01:36 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.3 xc/programs/xfs/include/authstr.h:1.2 --- xc/programs/xfs/include/authstr.h:1.1.1.3 Tue Jan 16 17:51:33 2001 +++ xc/programs/xfs/include/authstr.h Fri Dec 14 15:01:37 2001 @@ -1,8 +1,12 @@ -/* $Xorg: authstr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: authstr.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/include/cache.h diff -u xc/programs/xfs/include/cache.h:1.4 xc/programs/xfs/include/cache.h:1.5 --- xc/programs/xfs/include/cache.h:1.4 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/cache.h Fri Dec 14 15:01:37 2001 @@ -1,8 +1,12 @@ -/* $Xorg: cache.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: cache.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * @(#)cache.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/cache.h,v 1.4 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/cache.h,v 1.5 2001/12/14 20:01:37 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.3 xc/programs/xfs/include/cachestr.h:1.2 --- xc/programs/xfs/include/cachestr.h:1.1.1.3 Tue Jan 16 17:51:38 2001 +++ xc/programs/xfs/include/cachestr.h Fri Dec 14 15:01:37 2001 @@ -1,8 +1,12 @@ -/* $Xorg: cachestr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: cachestr.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/include/client.h diff -u xc/programs/xfs/include/client.h:1.6 xc/programs/xfs/include/client.h:1.7 --- xc/programs/xfs/include/client.h:1.6 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/client.h Fri Dec 14 15:01:37 2001 @@ -1,9 +1,13 @@ -/* $Xorg: client.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: client.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,7 +43,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.6 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/client.h,v 1.7 2001/12/14 20:01:37 dawes Exp $ */ #ifndef _CLIENT_H_ #define _CLIENT_H_ Index: xc/programs/xfs/include/clientstr.h diff -u xc/programs/xfs/include/clientstr.h:1.5 xc/programs/xfs/include/clientstr.h:1.7 --- xc/programs/xfs/include/clientstr.h:1.5 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/clientstr.h Fri Dec 14 15:01:37 2001 @@ -1,8 +1,12 @@ -/* $Xorg: clientstr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: clientstr.h,v 1.4 2001/02/09 02:05:43 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,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.5 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/clientstr.h,v 1.7 2001/12/14 20:01:37 dawes Exp $ */ #ifndef _CLIENTSTR_H_ #define _CLIENTSTR_H_ @@ -80,7 +84,15 @@ pointer closure; } WorkQueueRec; - -extern void CloseDownClient(ClientPtr client); +#ifndef CloseDownClient +#ifdef DEBUG +#define CloseDownClient(client) \ + fprintf(stderr, "CloseDownClient %s %d\n", __FILE__, __LINE__),\ + DoCloseDownClient(client) +#else +#define CloseDownClient DoCloseDownClient +#endif +extern void DoCloseDownClient(ClientPtr client); +#endif #endif /* _CLIENTSTR_H_ */ Index: xc/programs/xfs/include/closestr.h diff -u xc/programs/xfs/include/closestr.h:1.1.1.5 xc/programs/xfs/include/closestr.h:1.2 --- xc/programs/xfs/include/closestr.h:1.1.1.5 Tue Jan 16 17:51:46 2001 +++ xc/programs/xfs/include/closestr.h Fri Dec 14 15:01:37 2001 @@ -1,8 +1,12 @@ -/* $Xorg: closestr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ +/* $Xorg: closestr.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/include/closure.h diff -u xc/programs/xfs/include/closure.h:1.1.1.3 xc/programs/xfs/include/closure.h:1.2 --- xc/programs/xfs/include/closure.h:1.1.1.3 Tue Jan 16 17:51:49 2001 +++ xc/programs/xfs/include/closure.h Fri Dec 14 15:01:37 2001 @@ -1,8 +1,12 @@ -/* $Xorg: closure.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: closure.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/include/difs.h diff -u xc/programs/xfs/include/difs.h:1.2 xc/programs/xfs/include/difs.h:1.4 --- xc/programs/xfs/include/difs.h:1.2 Sat Aug 21 09:48:50 1999 +++ xc/programs/xfs/include/difs.h Tue Jul 31 20:45:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xfs/include/difs.h,v 1.2 1999/08/21 13:48:50 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/difs.h,v 1.4 2001/08/01 00:45:04 tsi Exp $ */ /* * Copyright (C) 1999 The XFree86 Project, Inc. All Rights Reserved. * @@ -77,12 +77,10 @@ /* difs/fontinfo.c */ extern void CopyCharInfo ( CharInfoPtr ci, fsXCharInfo *dst ); extern int convert_props ( FontInfoPtr pinfo, fsPropInfo **props ); -#if 0 extern int QueryExtents ( ClientPtr client, ClientFontPtr cfp, int item_size, int nranges, Bool range_flag, pointer range_data ); extern int QueryBitmaps ( ClientPtr client, ClientFontPtr cfp, int item_size, fsBitmapFormat format, int nranges, Bool range_flag, pointer range_data ); -#endif /* difs/main.c */ -extern void NotImplemented(void); +extern int NotImplemented(void); #endif Index: xc/programs/xfs/include/difsfn.h diff -u xc/programs/xfs/include/difsfn.h:1.4 xc/programs/xfs/include/difsfn.h:1.5 --- xc/programs/xfs/include/difsfn.h:1.4 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/difsfn.h Fri Dec 14 15:01:37 2001 @@ -1,8 +1,12 @@ -/* $Xorg: difsfn.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: difsfn.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,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.4 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/difsfn.h,v 1.5 2001/12/14 20:01:37 dawes Exp $ */ #ifndef _DIFSFONT_H_ #define _DIFSFONT_H_ Index: xc/programs/xfs/include/difsfnst.h diff -u xc/programs/xfs/include/difsfnst.h:1.4 xc/programs/xfs/include/difsfnst.h:1.5 --- xc/programs/xfs/include/difsfnst.h:1.4 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/difsfnst.h Fri Dec 14 15:01:38 2001 @@ -1,8 +1,12 @@ -/* $Xorg: difsfnst.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: difsfnst.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,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.4 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/difsfnst.h,v 1.5 2001/12/14 20:01:38 dawes Exp $ */ #ifndef _DIFSFONTST_H_ #define _DIFSFONTST_H_ Index: xc/programs/xfs/include/difsutils.h diff -u xc/programs/xfs/include/difsutils.h:1.3 xc/programs/xfs/include/difsutils.h:1.4 --- xc/programs/xfs/include/difsutils.h:1.3 Sat Aug 21 09:48:51 1999 +++ xc/programs/xfs/include/difsutils.h Mon Jun 25 16:40:18 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xfs/include/difsutils.h,v 1.3 1999/08/21 13:48:51 dawes Exp $ + * $XFree86: xc/programs/xfs/include/difsutils.h,v 1.4 2001/06/25 20:40:18 paulo Exp $ */ /************************************************************ @@ -45,16 +45,20 @@ extern Bool QueueWorkProc (DifsWorkFunc function, ClientPtr client, pointer data); extern Bool RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData); extern Bool ValidHost (HostList list, HostAddress *addr); +#if 0 extern Bool XpClientIsBitmapClient (ClientPtr client); extern Bool XpClientIsPrintClient (ClientPtr client, FontPathElementPtr fpe); -#if 0 extern FontResolutionPtr GetClientResolutions (int *num); #endif extern int AddHost (HostList *list, HostAddress *addr); +#if 0 extern int GetDefaultPointSize (void); +#endif extern int RemoveHost (HostList *list, HostAddress *addr); extern int SetDefaultResolutions (char *str); +#if 0 extern int client_auth_generation (ClientPtr client); +#endif extern int set_font_authorizations (char **authorizations, int *authlen, ClientPtr client); extern int strncmpnocase (char *first, char *second, int n); extern pointer Xalloc (unsigned long m); Index: xc/programs/xfs/include/dispatch.h diff -u xc/programs/xfs/include/dispatch.h:1.2 xc/programs/xfs/include/dispatch.h:1.3 --- xc/programs/xfs/include/dispatch.h:1.2 Sun Mar 7 06:41:00 1999 +++ xc/programs/xfs/include/dispatch.h Tue Aug 28 19:44:54 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xfs/include/dispatch.h,v 1.2 1999/03/07 11:41:00 dawes Exp $ + * $XFree86: xc/programs/xfs/include/dispatch.h,v 1.3 2001/08/28 23:44:54 paulo Exp $ */ /************************************************************ @@ -36,7 +36,14 @@ extern void Dispatch (void); extern int ProcInitialConnection (ClientPtr client); extern int ProcEstablishConnection (ClientPtr client); -extern void SendErrToClient (ClientPtr client, int error, pointer data); +#ifdef DEBUG +#define SendErrToClient(client, error, data) \ + fprintf(stderr, "SendErrToClient %s %d\n", __FILE__, __LINE__),\ + DoSendErrToClient(client, error, data) +#else +#define SendErrToClient DoSendErrToClient +#endif +extern void DoSendErrToClient (ClientPtr client, int error, pointer data); extern int ProcBadRequest (ClientPtr client); extern int ProcNoop (ClientPtr client); extern int ProcListCatalogues (ClientPtr client); Index: xc/programs/xfs/include/extentst.h diff -u xc/programs/xfs/include/extentst.h:1.5 xc/programs/xfs/include/extentst.h:1.6 --- xc/programs/xfs/include/extentst.h:1.5 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/extentst.h Fri Dec 14 15:01:38 2001 @@ -1,8 +1,12 @@ -/* $Xorg: extentst.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: extentst.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * @(#)extentst.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/extentst.h,v 1.5 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/extentst.h,v 1.6 2001/12/14 20:01:38 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.3 xc/programs/xfs/include/globals.h:1.2 --- xc/programs/xfs/include/globals.h:1.1.1.3 Tue Jan 16 17:51:59 2001 +++ xc/programs/xfs/include/globals.h Fri Dec 14 15:01:38 2001 @@ -1,8 +1,12 @@ -/* $Xorg: globals.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: globals.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/include/misc.h diff -u xc/programs/xfs/include/misc.h:3.6 xc/programs/xfs/include/misc.h:3.9 --- xc/programs/xfs/include/misc.h:3.6 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/misc.h Fri Dec 14 15:01:38 2001 @@ -1,9 +1,13 @@ -/* $Xorg: misc.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: misc.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,7 +43,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.6 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/misc.h,v 3.9 2001/12/14 20:01:38 dawes Exp $ */ #ifndef _MISC_H_ #define _MISC_H_ @@ -51,13 +55,7 @@ #include "assert.h" /* so its everywhere */ #ifndef NULL - -#ifndef X_NOT_STDC_ENV #include <stddef.h> -#else -#define NULL 0 -#endif - #endif #define MAXCLIENTS 128 @@ -72,7 +70,6 @@ #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) -#define abs(a) ((a) > 0 ? (a) : -(a)) #include "os.h" @@ -123,7 +120,7 @@ extern void BitOrderInvert(unsigned char *buf, int nbytes); -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define fsCat(x,y) x##_##y #else #define fsCat(x,y) x/**/_/**/y Index: xc/programs/xfs/include/os.h diff -u xc/programs/xfs/include/os.h:3.10 xc/programs/xfs/include/os.h:3.13 --- xc/programs/xfs/include/os.h:3.10 Wed Jan 17 18:45:31 2001 +++ xc/programs/xfs/include/os.h Fri Dec 14 15:01:38 2001 @@ -1,8 +1,12 @@ -/* $Xorg: os.h,v 1.4 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: os.h,v 1.5 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * $NCDXorg: @(#)os.h,v 4.2 1991/05/10 07:59:16 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/include/os.h,v 3.10 2001/01/17 23:45:31 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/os.h,v 3.13 2001/12/14 20:01:38 dawes Exp $ */ #ifndef _OS_H_ #define _OS_H_ @@ -63,7 +67,7 @@ #include "X11/Xalloca.h" -#define MAX_REQUEST_SIZE 16384 +#define MAX_REQUEST_SIZE 8192 #ifdef SIGNALRETURNSINT #define SIGVAL int @@ -80,7 +84,7 @@ extern Bool CloneSelf; extern char ErrorFile[]; #ifdef FONTCACHE -#include "fontcacheP.h" +#include <X11/extensions/fontcacheP.h> extern FontCacheSettings cacheSettings; #endif Index: xc/programs/xfs/include/osstruct.h diff -u xc/programs/xfs/include/osstruct.h:1.1.1.4 xc/programs/xfs/include/osstruct.h:1.4 --- xc/programs/xfs/include/osstruct.h:1.1.1.4 Tue Jan 16 17:52:04 2001 +++ xc/programs/xfs/include/osstruct.h Fri Dec 14 15:01:38 2001 @@ -1,8 +1,12 @@ -/* $Xorg: osstruct.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: osstruct.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,22 +47,23 @@ * @(#)osstruct.h 4.1 91/05/02 * */ +/* $XFree86: xc/programs/xfs/include/osstruct.h,v 1.4 2001/12/14 20:01:38 dawes Exp $ */ #ifndef _OSSTRUCT_H_ #define _OSSTRUCT_H_ #include "os.h" typedef struct _alt_server { - char subset; - short namelen; - char *name; + char subset; + unsigned short namelen; + char *name; } AlternateServerRec; typedef struct _auth { - short namelen; - short datalen; - char *name; - char *data; + unsigned short namelen; + unsigned short datalen; + char *name; + char *data; } AuthRec; #endif /* _OSSTRUCT_H_ */ Index: xc/programs/xfs/include/servermd.h diff -u xc/programs/xfs/include/servermd.h:1.1.1.5 xc/programs/xfs/include/servermd.h:1.5 --- xc/programs/xfs/include/servermd.h:1.1.1.5 Tue Jan 16 17:52:09 2001 +++ xc/programs/xfs/include/servermd.h Wed Dec 19 16:37:35 2001 @@ -1,8 +1,12 @@ -/* $Xorg: servermd.h,v 1.4 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: servermd.h,v 1.6 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,15 +44,17 @@ * 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/servermd.h,v 1.5 2001/12/19 21:37:35 dawes Exp $ */ + #ifndef _SERVERMD_H_ #define _SERVERMD_H_ #ifndef VENDOR_RELEASE -#define VENDOR_RELEASE 6510 +#define VENDOR_RELEASE 6600 #endif #ifndef VENDOR_STRING -#define VENDOR_STRING "The X.Org Group" +#define VENDOR_STRING "The XFree86 Project (experimental version)" #endif #ifndef DEFAULT_FS_PORT Index: xc/programs/xfs/include/site.h diff -u xc/programs/xfs/include/site.h:1.1.1.3 xc/programs/xfs/include/site.h:1.2 --- xc/programs/xfs/include/site.h:1.1.1.3 Tue Jan 16 17:52:11 2001 +++ xc/programs/xfs/include/site.h Fri Dec 14 15:01:39 2001 @@ -1,8 +1,12 @@ -/* $Xorg: site.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: site.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/include/swapreq.h diff -u xc/programs/xfs/include/swapreq.h:1.1 xc/programs/xfs/include/swapreq.h:1.2 --- xc/programs/xfs/include/swapreq.h:1.1 Sun Oct 25 02:12:32 1998 +++ xc/programs/xfs/include/swapreq.h Mon Jun 25 16:40:18 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xfs/include/swapreq.h,v 1.1 1998/10/25 07:12:32 dawes Exp $ + * $XFree86: xc/programs/xfs/include/swapreq.h,v 1.2 2001/06/25 20:40:18 paulo Exp $ */ /************************************************************ @@ -48,7 +48,7 @@ extern int SProcResourceRequest(ClientPtr client); extern int SProcSetResolution(ClientPtr client); extern int SProcSimpleRequest(ClientPtr client); -extern void SwapConnClientPrefix(fsConnClientPrefix *pCCP); +extern int SwapConnClientPrefix(ClientPtr client, fsConnClientPrefix *pCCP); extern void SwapLongs(long *list, unsigned long count); extern void SwapShorts(short *list, unsigned long count); Index: xc/programs/xfs/os/Imakefile diff -u xc/programs/xfs/os/Imakefile:3.7 xc/programs/xfs/os/Imakefile:3.8 --- xc/programs/xfs/os/Imakefile:3.7 Wed Jan 17 18:45:32 2001 +++ xc/programs/xfs/os/Imakefile Tue Jul 31 20:45:05 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xfs/os/Imakefile,v 3.7 2001/01/17 23:45:32 dawes Exp $ +XCOMM $XFree86: xc/programs/xfs/os/Imakefile,v 3.8 2001/08/01 00:45:05 tsi Exp $ #undef ServerDefines #include <Server.tmpl> @@ -20,7 +20,8 @@ OBJS = connection.o waitfor.o daemon.o io.o utils.o osinit.o \ config.o access.o osglue.o error.o $(OBJS1) -INCLUDES = -I../include -I$(FONTINCSRC) -I$(EXTINCSRC) +INCLUDES = -I../include -I$(FONTINCSRC) -I$(EXTINCSRC) \ + -I$(FONTLIBSRC)/include -I$(FONTLIBSRC)/bitmap CONN_DEFINES = $(CONNECTION_FLAGS) -DFONT_t -DTRANS_SERVER -DTRANS_REOPEN Index: xc/programs/xfs/os/access.c diff -u xc/programs/xfs/os/access.c:3.4 xc/programs/xfs/os/access.c:3.7 --- xc/programs/xfs/os/access.c:3.4 Wed Jan 17 18:45:32 2001 +++ xc/programs/xfs/os/access.c Fri Dec 14 15:01:40 2001 @@ -1,9 +1,13 @@ -/* $Xorg: access.c,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: access.c,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,10 +43,9 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/access.c,v 3.4 2001/01/17 23:45:32 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/access.c,v 3.7 2001/12/14 20:01:40 dawes Exp $ */ #include <X11/Xos.h> -#ifndef MINIX #ifndef Lynx #include <sys/param.h> #include <sys/socket.h> @@ -51,15 +54,13 @@ #endif #include <netdb.h> #include <netinet/in.h> -#else -#include <net/gen/netdb.h> -#endif /* !MINIX */ #include "clientstr.h" #include "misc.h" #include "site.h" #include "accstr.h" #include "osdep.h" #include "osstruct.h" +#include "accstr.h" long MaxClients = DEFAULT_CLIENT_LIMIT; Index: xc/programs/xfs/os/config.c diff -u xc/programs/xfs/os/config.c:3.10 xc/programs/xfs/os/config.c:3.14 --- xc/programs/xfs/os/config.c:3.10 Wed Jan 17 18:45:32 2001 +++ xc/programs/xfs/os/config.c Fri Dec 14 15:01:40 2001 @@ -1,8 +1,12 @@ -/* $Xorg: config.c,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: config.c,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,10 +47,12 @@ * $NCDXorg: @(#)config.c,v 4.6 1991/07/09 14:08:09 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/config.c,v 3.10 2001/01/17 23:45:32 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/config.c,v 3.14 2001/12/14 20:01:40 dawes Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <ctype.h> +#include <X11/Xtrans.h> #include <X11/Xos.h> #include "misc.h" #include "configstr.h" @@ -55,8 +61,11 @@ #include "access.h" #include "difsutils.h" #ifdef FONTCACHE -#include "fontcacheP.h" +#include <X11/extensions/fontcacheP.h> #endif +#include "fontutil.h" +#include "difs.h" +#include "snfstr.h" extern int portFromCmdline; Index: xc/programs/xfs/os/config.h diff -u xc/programs/xfs/os/config.h:1.1.1.3 xc/programs/xfs/os/config.h:1.2 --- xc/programs/xfs/os/config.h:1.1.1.3 Tue Jan 16 17:50:58 2001 +++ xc/programs/xfs/os/config.h Fri Dec 14 15:01:40 2001 @@ -1,8 +1,12 @@ -/* $Xorg: config.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: config.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfs/os/configstr.h diff -u xc/programs/xfs/os/configstr.h:1.4 xc/programs/xfs/os/configstr.h:1.5 --- xc/programs/xfs/os/configstr.h:1.4 Wed Jan 17 18:45:32 2001 +++ xc/programs/xfs/os/configstr.h Fri Dec 14 15:01:41 2001 @@ -1,8 +1,12 @@ -/* $Xorg: configstr.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: configstr.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * @(#)configstr.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/os/configstr.h,v 1.4 2001/01/17 23:45:32 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/configstr.h,v 1.5 2001/12/14 20:01:41 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.20 xc/programs/xfs/os/connection.c:3.23 --- xc/programs/xfs/os/connection.c:3.20 Wed Jan 17 18:45:32 2001 +++ xc/programs/xfs/os/connection.c Fri Dec 14 15:01:41 2001 @@ -1,4 +1,4 @@ -/* $Xorg: connection.c,v 1.4 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: connection.c,v 1.5 2001/02/09 02:05:44 xorgcvs Exp $ */ /* * handles connections */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -63,7 +67,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.20 2001/01/17 23:45:32 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/connection.c,v 3.23 2001/12/14 20:01:41 dawes Exp $ */ #include <X11/Xtrans.h> #include <stdlib.h> @@ -71,7 +75,6 @@ #include <stdio.h> #include <errno.h> #include <X11/Xos.h> -#ifndef MINIX #ifndef Lynx #include <sys/param.h> #include <sys/socket.h> @@ -82,7 +85,6 @@ #include <socket.h> #include <uio.h> #endif -#endif #include <signal.h> #include "FS.h" @@ -96,18 +98,9 @@ #include "dispatch.h" #include "fsevents.h" -#ifdef MINIX -#include <sys/nbio.h> -#define select(n,r,w,x,t) nbio_select(n,r,w,x,t) -#endif - #ifdef __EMX__ #define _NFILE OPEN_MAX #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) -#endif - -#ifdef X_NOT_STDC_ENV -extern int errno; #endif Index: xc/programs/xfs/os/daemon.c diff -u xc/programs/xfs/os/daemon.c:1.5 xc/programs/xfs/os/daemon.c:1.8 --- xc/programs/xfs/os/daemon.c:1.5 Thu Apr 26 16:26:31 2001 +++ xc/programs/xfs/os/daemon.c Fri Nov 16 11:47:58 2001 @@ -27,7 +27,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xfs/os/daemon.c,v 1.5 2001/04/26 20:26:31 alanh Exp $ */ +/* $XFree86: xc/programs/xfs/os/daemon.c,v 1.8 2001/11/16 16:47:58 dawes Exp $ */ #include <X11/Xos.h> #include <stdio.h> @@ -38,16 +38,13 @@ #else #include <sys/ioctl.h> #endif -#if defined(__osf__) || defined(linux) || defined(MINIX) || defined(__GNU__) || defined(__CYGWIN__) +#if defined(__osf__) || defined(linux) || defined(__GNU__) || defined(__CYGWIN__) #define setpgrp setpgid #endif #ifdef hpux #include <sys/ptyio.h> #endif #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #include <sys/types.h> #ifdef X_NOT_POSIX #define Pid_t int @@ -85,7 +82,7 @@ default: /* parent */ -#ifndef CSRG_BASED +#if !defined(CSRG_BASED) && !defined(__QNXNTO__) #if defined(SVR4) stat = setpgid(child_id, child_id); /* This gets error EPERM. Why? */ @@ -94,11 +91,9 @@ stat = 0; /* don't know how to set child's process group */ #else stat = setpgrp(child_id, child_id); -#ifndef MINIX if (stat != 0) FatalError("setting process grp for daemon failed, errno = %d\n", errno); -#endif /* MINIX */ #endif #endif #endif /* !CSRG_BASED */ @@ -115,7 +110,7 @@ * Close standard file descriptors and get rid of controlling tty */ -#ifdef CSRG_BASED +#if defined(CSRG_BASED) || defined(__QNXNTO__) daemon (0, 0); #else #if defined(SYSV) || defined(SVR4) @@ -129,16 +124,6 @@ close (2); #if !defined(__EMX__) && !defined(__CYGWIN__) -#ifdef MINIX -#if 0 - /* Use setsid() to get rid of our controlling tty, this requires an extra - * fork though. - */ - setsid(); - if (fork() > 0) - _exit(0); -#endif -#else /* !MINIX */ #if !((defined(SYSV) || defined(SVR4)) && defined(i386)) if ((i = open ("/dev/tty", O_RDWR)) >= 0) { /* did open succeed? */ #if defined(USG) && defined(TCCLRCTTY) @@ -155,7 +140,6 @@ (void) close (i); } #endif /* !((SYSV || SVR4) && i386) */ -#endif /* MINIX */ #endif /* !__EMX__ */ /* @@ -167,7 +151,7 @@ #endif /* CSRG_BASED */ } -#if defined(linux) || defined(CSRG_BASED) +#if defined(linux) || defined(CSRG_BASED) || defined(__QNXNTO__) FILE *pidFilePtr; static int pidFd; char *pidFile = "/var/run/xfs.pid"; @@ -176,7 +160,7 @@ int StorePid () { -#if defined(linux) || defined(CSRG_BASED) +#if defined(linux) || defined(CSRG_BASED) || defined(__QNXNTO__) int oldpid; if (pidFile[0] != '\0') { Index: xc/programs/xfs/os/error.c diff -u xc/programs/xfs/os/error.c:1.8 xc/programs/xfs/os/error.c:1.10 --- xc/programs/xfs/os/error.c:1.8 Sun Apr 1 10:00:21 2001 +++ xc/programs/xfs/os/error.c Fri Dec 14 15:01:41 2001 @@ -1,11 +1,15 @@ -/* $Xorg: error.c,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: error.c,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* * error message handling */ /* Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -40,7 +44,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/error.c,v 1.8 2001/04/01 14:00:21 tsi Exp $ */ +/* $XFree86: xc/programs/xfs/os/error.c,v 1.10 2001/12/14 20:01:41 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -146,7 +150,6 @@ /* * used for informational messages */ -/* VARARGS1 */ void NoticeF(char *f, ...) { @@ -167,7 +170,6 @@ /* * used for non-fatal error messages */ -/* VARARGS1 */ void ErrorF(char * f, ...) { @@ -184,7 +186,6 @@ va_end(args); } -/* VARARGS1 */ void FatalError(char * f, ...) { Index: xc/programs/xfs/os/io.c diff -u xc/programs/xfs/os/io.c:3.12 xc/programs/xfs/os/io.c:3.18 --- xc/programs/xfs/os/io.c:3.12 Wed Jan 17 18:45:32 2001 +++ xc/programs/xfs/os/io.c Fri Dec 14 15:01:41 2001 @@ -1,4 +1,4 @@ -/* $Xorg: io.c,v 1.4 2000/08/17 19:54:22 cpqbld Exp $ */ +/* $Xorg: io.c,v 1.5 2001/02/09 02:05:44 xorgcvs Exp $ */ /* * i/o functions */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,13 +46,12 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/io.c,v 3.12 2001/01/17 23:45:32 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/io.c,v 3.18 2001/12/14 20:01:41 dawes Exp $ */ #include <X11/Xtrans.h> #include <stdio.h> #include <errno.h> #include <sys/types.h> -#ifndef MINIX #ifndef Lynx #include <sys/param.h> #ifndef __EMX__ @@ -57,7 +60,6 @@ #else #include <uio.h> #endif -#endif #include "FSproto.h" #include "clientstr.h" @@ -66,10 +68,6 @@ #include "globals.h" #include "dispatch.h" -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN @@ -127,14 +125,24 @@ int ReadRequest(ClientPtr client) { - OsCommPtr oc = (OsCommPtr) client->osPrivate; - ConnectionInputPtr oci = oc->input; + OsCommPtr oc; + ConnectionInputPtr oci; fsReq *request; - int fd = oc->fd; - int result, + int fd, + result, gotnow, needed = 0; + if (client == NULL) + return -1; + oc = (OsCommPtr) client->osPrivate; + if (oc == NULL) + return -1; + oci = oc->input; + fd = oc->fd; + if (oci != NULL && fd < 0) + return -1; + if (AvailableInput) { if (AvailableInput != oc) { ConnectionInputPtr aci = AvailableInput->input; @@ -207,6 +215,10 @@ oci->bufcnt = gotnow; } /* fill 'er up */ + if (oc->trans_conn == NULL) { + yield_control_death(); + return -1; + } result = _FontTransRead(oc->trans_conn, oci->buffer + oci->bufcnt, oci->size - oci->bufcnt); if (result <= 0) { @@ -230,7 +242,7 @@ (oci->bufcnt < BUFSIZE) && (needed < BUFSIZE)) { char *ibuf; - ibuf = (char *) fsrealloc(oci, BUFSIZE); + ibuf = (char *) fsrealloc(oci->buffer, BUFSIZE); if (ibuf) { oci->size = BUFSIZE; oci->buffer = ibuf; Index: xc/programs/xfs/os/osdep.h diff -u xc/programs/xfs/os/osdep.h:3.8 xc/programs/xfs/os/osdep.h:3.11 --- xc/programs/xfs/os/osdep.h:3.8 Wed Jan 17 18:45:32 2001 +++ xc/programs/xfs/os/osdep.h Fri Dec 14 15:01:41 2001 @@ -1,8 +1,12 @@ -/* $Xorg: osdep.h,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ +/* $Xorg: osdep.h,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * @(#)osdep.h 4.1 5/2/91 * */ -/* $XFree86: xc/programs/xfs/os/osdep.h,v 3.8 2001/01/17 23:45:32 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/osdep.h,v 3.11 2001/12/14 20:01:41 dawes Exp $ */ #ifndef _OSDEP_H_ #define _OSDEP_H_ @@ -51,7 +55,7 @@ #define BOTIMEOUT 200 /* in milliseconds */ #define BUFSIZE 4096 #define BUFWATERMARK 8192 -#define MAXBUFSIZE (1 << 18) +#define MAXBUFSIZE (1 << 15) #ifndef sgi /* SGI defines OPEN_MAX in a useless way */ #ifndef X_NOT_POSIX @@ -101,9 +105,7 @@ #endif #endif /*__GNU__*/ -#ifndef NULL -#define NULL 0 -#endif +#include <stddef.h> typedef struct _connectionInput { struct _connectionInput *next; Index: xc/programs/xfs/os/osglue.c diff -u xc/programs/xfs/os/osglue.c:3.10 xc/programs/xfs/os/osglue.c:3.15 --- xc/programs/xfs/os/osglue.c:3.10 Wed Jan 17 18:45:33 2001 +++ xc/programs/xfs/os/osglue.c Fri Dec 14 15:01:41 2001 @@ -1,8 +1,12 @@ -/* $Xorg: osglue.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ +/* $Xorg: osglue.c,v 1.4 2001/02/09 02:05:44 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -43,7 +47,7 @@ * $NCDXorg: @(#)osglue.c,v 4.6 1991/07/09 14:07:30 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/osglue.c,v 3.10 2001/01/17 23:45:33 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/osglue.c,v 3.15 2001/12/14 20:01:41 dawes Exp $ */ /* * this is miscellaneous OS specific stuff. @@ -54,6 +58,7 @@ #include <X11/Xtrans.h> #include "osstruct.h" #include <stdio.h> +#include <stdlib.h> #define XK_LATIN1 #include <X11/keysymdef.h> #ifdef __EMX__ Index: xc/programs/xfs/os/osinit.c diff -u xc/programs/xfs/os/osinit.c:1.4 xc/programs/xfs/os/osinit.c:1.5 --- xc/programs/xfs/os/osinit.c:1.4 Wed Jan 17 18:45:33 2001 +++ xc/programs/xfs/os/osinit.c Fri Dec 14 15:01:41 2001 @@ -1,11 +1,15 @@ -/* $Xorg: osinit.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ +/* $Xorg: osinit.c,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* * os init code */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -46,7 +50,7 @@ * @(#)osinit.c 4.3 5/7/91 * */ -/* $XFree86: xc/programs/xfs/os/osinit.c,v 1.4 2001/01/17 23:45:33 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/osinit.c,v 1.5 2001/12/14 20:01:41 dawes Exp $ */ #include "os.h" Index: xc/programs/xfs/os/utils.c diff -u xc/programs/xfs/os/utils.c:3.13 xc/programs/xfs/os/utils.c:3.18 --- xc/programs/xfs/os/utils.c:3.13 Tue Feb 13 14:19:18 2001 +++ xc/programs/xfs/os/utils.c Mon Jan 7 15:38:30 2002 @@ -1,4 +1,4 @@ -/* $Xorg: utils.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ +/* $Xorg: utils.c,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* * misc os utilities */ @@ -6,7 +6,11 @@ Copyright 1990, 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,13 +46,11 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/utils.c,v 3.13 2001/02/13 19:19:18 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/utils.c,v 3.18 2002/01/07 20:38:30 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include "misc.h" #include "globals.h" #include <signal.h> @@ -59,6 +61,7 @@ #include <unistd.h> #include <pwd.h> #include <grp.h> +#include <errno.h> #include <sys/types.h> #ifndef X_NOT_POSIX @@ -85,14 +88,7 @@ #define SIGNALS_RESET_WHEN_CAUGHT #endif -#ifdef X_NOT_STDC_ENV -char *realloc(); -#else -#ifdef abs -#undef abs -#endif #include <stdlib.h> -#endif extern char *configfilename; static Bool dropPriv = FALSE; /* whether or not to drop root privileges */ @@ -109,13 +105,20 @@ OldListenRec *OldListen = NULL; int OldListenCount = 0; +#ifdef STDERR_FILENO +# define WRITES write(STDERR_FILENO, s, strlen(s)) +#else +# define WRITES write(fileno(stderr), s, strlen(s)) +#endif + /* ARGSUSED */ SIGVAL AutoResetServer(int n) { + int olderrno = errno; #ifdef DEBUG - fprintf(stderr, "got a reset signal\n"); + WRITES("got a reset signal\n"); #endif dispatchException |= DE_RESET; @@ -124,28 +127,31 @@ #ifdef SIGNALS_RESET_WHEN_CAUGHT signal(SIGHUP, AutoResetServer); #endif + errno = olderrno; } /* ARGSUSED */ SIGVAL GiveUp(int n) { - + int olderrno = errno; #ifdef DEBUG - fprintf(stderr, "got a TERM signal\n"); + WRITES("got a TERM signal\n"); #endif dispatchException |= DE_TERMINATE; isItTimeToYield = TRUE; + errno = olderrno; } /* ARGSUSED */ SIGVAL ServerReconfig(int n) { + int olderrno = errno; #ifdef DEBUG - fprintf(stderr, "got a re-config signal\n"); + WRITES("got a re-config signal\n"); #endif dispatchException |= DE_RECONFIG; @@ -154,15 +160,17 @@ #ifdef SIGNALS_RESET_WHEN_CAUGHT signal(SIGUSR1, ServerReconfig); #endif + errno = olderrno; } /* ARGSUSED */ SIGVAL ServerCacheFlush(int n) { + int olderrno = errno; #ifdef DEBUG - fprintf(stderr, "got a flush signal\n"); + WRITES("got a flush signal\n"); #endif dispatchException |= DE_FLUSH; @@ -171,15 +179,17 @@ #ifdef SIGNALS_RESET_WHEN_CAUGHT signal(SIGUSR2, ServerCacheFlush); #endif + errno = olderrno; } /* ARGSUSED */ SIGVAL CleanupChild(int n) { + int olderrno = errno; #ifdef DEBUG - fprintf(stderr, "got a child signal\n"); + WRITES("got a child signal\n"); #endif wait(NULL); @@ -187,6 +197,7 @@ #ifdef SIGNALS_RESET_WHEN_CAUGHT signal(SIGCHLD, CleanupChild); #endif + errno = olderrno; } long @@ -474,6 +485,7 @@ ErrorF("fatal: couldn't set groupid to xfs user's group\n"); exit(1); } +#ifndef QNX4 #ifndef __CYGWIN__ if (setgroups(0, NULL)) { ErrorF("fatal: couldn't drop supplementary groups\n"); @@ -484,6 +496,7 @@ ErrorF("fatal: couldn't init supplementary groups\n"); exit(1); } +#endif /* QNX4 */ if (setuid(pwent->pw_uid)) { ErrorF("fatal: couldn't set userid to %s user\n", user); exit(1); Index: xc/programs/xfs/os/waitfor.c diff -u xc/programs/xfs/os/waitfor.c:3.12 xc/programs/xfs/os/waitfor.c:3.15 --- xc/programs/xfs/os/waitfor.c:3.12 Wed Jan 17 18:45:33 2001 +++ xc/programs/xfs/os/waitfor.c Fri Dec 14 15:01:41 2001 @@ -1,11 +1,15 @@ -/* $Xorg: waitfor.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ +/* $Xorg: waitfor.c,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* * waits for input */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -46,13 +50,13 @@ * $NCDXorg: @(#)waitfor.c,v 4.5 1991/06/24 11:59:20 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/waitfor.c,v 3.12 2001/01/17 23:45:33 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/waitfor.c,v 3.15 2001/12/14 20:01:41 dawes Exp $ */ #include <X11/Xos.h> /* strings, time, etc */ #include <stdio.h> #include <errno.h> -#if !defined(MINIX) && !defined(Lynx) +#if !defined(Lynx) #include <sys/param.h> #endif @@ -62,20 +66,11 @@ #include "osdep.h" #include "os.h" -#ifdef MINIX -#include <sys/nbio.h> -#define select(n,r,w,x,t) nbio_select(n,r,w,x,t) -#endif - #ifdef __EMX__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif extern WorkQueuePtr workQueue; - -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif extern fd_set WellKnownConnections; Index: xc/programs/xfsinfo/Imakefile diff -u xc/programs/xfsinfo/Imakefile:1.1 xc/programs/xfsinfo/Imakefile:1.3 --- xc/programs/xfsinfo/Imakefile:1.1 Sat Jan 6 16:58:28 2001 +++ xc/programs/xfsinfo/Imakefile Tue Aug 28 12:48:09 2001 @@ -1,9 +1,13 @@ XCOMM $XConsortium: Imakefile /main/8 1996/09/28 17:16:50 rws $ + + + +XCOMM $XFree86: xc/programs/xfsinfo/Imakefile,v 1.3 2001/08/28 16:48:09 tsi Exp $ + 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 xc/programs/xfsinfo/xfsinfo.c:1.2 xc/programs/xfsinfo/xfsinfo.c:1.4 --- xc/programs/xfsinfo/xfsinfo.c:1.2 Sun Apr 1 10:00:21 2001 +++ xc/programs/xfsinfo/xfsinfo.c Fri Dec 14 15:01:42 2001 @@ -7,7 +7,11 @@ Portions Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -26,7 +30,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xfsinfo/xfsinfo.c,v 1.2 2001/04/01 14:00:21 tsi Exp $ */ +/* $XFree86: xc/programs/xfsinfo/xfsinfo.c,v 1.4 2001/12/14 20:01:42 dawes Exp $ */ /* * Copyright 1990 Network Computing Devices; @@ -57,7 +61,7 @@ #include <stdio.h> #include <stdlib.h> #include <X11/Xos.h> -#include "FSlib.h" +#include <X11/fonts/FSlib.h> static void print_server_info(FSServer *svr); static void print_catalogue_info(FSServer *svr); Index: xc/programs/xfsinfo/xfsinfo.man diff -u xc/programs/xfsinfo/xfsinfo.man:1.4 xc/programs/xfsinfo/xfsinfo.man:1.5 --- xc/programs/xfsinfo/xfsinfo.man:1.4 Wed Apr 18 12:13:23 2001 +++ xc/programs/xfsinfo/xfsinfo.man Fri Dec 14 15:01:42 2001 @@ -2,7 +2,11 @@ .\" Copyright 1991, Network Computing Devices, Inc .\" Copyright 1993, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" 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 $ +.\" $XFree86: xc/programs/xfsinfo/xfsinfo.man,v 1.5 2001/12/14 20:01:42 dawes Exp $ .\" .TH XFSINFO 1 __xorgversion__ .SH NAME Index: xc/programs/xfwp/io.c diff -u xc/programs/xfwp/io.c:1.9 xc/programs/xfwp/io.c:1.11 --- xc/programs/xfwp/io.c:1.9 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/io.c Fri Dec 14 15:01:43 2001 @@ -1,16 +1,13 @@ -/* $Xorg: io.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ +/* $Xorg: io.c,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* -Copyright "1986-1997 The Open Group All Rights Reserved +Copyright "1986-1997, 1998 The Open Group -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to use the Software without restriction, -including, without limitation, the rights to copy, modify, -merge, publish, distribute and sublicense the Software, to make, -have made, license and distribute derivative works thereof, and -to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +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. The above copyright notice and the following permission notice shall be included in all copies of the Software: @@ -32,7 +29,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/io.c,v 1.9 2001/01/17 23:45:34 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/io.c,v 1.11 2001/12/14 20:01:43 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -55,9 +52,6 @@ #include "transport.h" #include "io.h" -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif /* * Error messages returned to clients who are denied access Index: xc/programs/xfwp/io.h diff -u xc/programs/xfwp/io.h:1.3 xc/programs/xfwp/io.h:1.4 --- xc/programs/xfwp/io.h:1.3 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/io.h Fri Dec 14 15:01:43 2001 @@ -1,9 +1,13 @@ -/* $Xorg: io.h,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ +/* $Xorg: io.h,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* Copyright "1986-1997, 1998 The Open Group -All Rights Reserved +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. The above copyright notice and the following permission notice shall be included in all copies of the Software: Index: xc/programs/xfwp/misc.c diff -u xc/programs/xfwp/misc.c:1.6 xc/programs/xfwp/misc.c:1.7 --- xc/programs/xfwp/misc.c:1.6 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/misc.c Fri Dec 14 15:01:43 2001 @@ -1,16 +1,13 @@ -/* $Xorg: misc.c,v 1.5 2000/08/17 19:54:23 cpqbld Exp $ */ +/* $Xorg: misc.c,v 1.6 2001/02/09 02:05:45 xorgcvs Exp $ */ /* -Copyright "1986-1997 The Open Group All Rights Reserved +Copyright "1986-1997, 1998 The Open Group -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to use the Software without restriction, -including, without limitation, the rights to copy, modify, -merge, publish, distribute and sublicense the Software, to make, -have made, license and distribute derivative works thereof, and -to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +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. The above copyright notice and the following permission notice shall be included in all copies of the Software: @@ -31,7 +28,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/misc.c,v 1.6 2001/01/17 23:45:34 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/misc.c,v 1.7 2001/12/14 20:01:43 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/xfwp/misc.h diff -u xc/programs/xfwp/misc.h:1.3 xc/programs/xfwp/misc.h:1.4 --- xc/programs/xfwp/misc.h:1.3 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/misc.h Fri Dec 14 15:01:43 2001 @@ -1,9 +1,13 @@ -/* $Xorg: misc.h,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: misc.h,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* Copyright "1986-1997, 1998 The Open Group -All Rights Reserved +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. The above copyright notice and the following permission notice shall be included in all copies of the Software: Index: xc/programs/xfwp/pm.c diff -u xc/programs/xfwp/pm.c:1.6 xc/programs/xfwp/pm.c:1.7 --- xc/programs/xfwp/pm.c:1.6 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/pm.c Fri Dec 14 15:01:43 2001 @@ -1,16 +1,13 @@ -/* $Xorg: pm.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: pm.c,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* -Copyright "1986-1997 The Open Group All Rights Reserved +Copyright "1986-1997, 1998 The Open Group -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to use the Software without restriction, -including, without limitation, the rights to copy, modify, -merge, publish, distribute and sublicense the Software, to make, -have made, license and distribute derivative works thereof, and -to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +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. The above copyright notice and the following permission notice shall be included in all copies of the Software: @@ -32,7 +29,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/pm.c,v 1.6 2001/01/17 23:45:34 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/pm.c,v 1.7 2001/12/14 20:01:43 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/xfwp/pm.h diff -u xc/programs/xfwp/pm.h:1.4 xc/programs/xfwp/pm.h:1.5 --- xc/programs/xfwp/pm.h:1.4 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/pm.h Fri Dec 14 15:01:43 2001 @@ -1,16 +1,13 @@ -/* $Xorg: pm.h,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: pm.h,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* -Copyright "1986-1997 The Open Group All Rights Reserved +Copyright "1986-1997, 1998 The Open Group -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to use the Software without restriction, -including, without limitation, the rights to copy, modify, -merge, publish, distribute and sublicense the Software, to make, -have made, license and distribute derivative works thereof, and -to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +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. The above copyright notice and the following permission notice shall be included in all copies of the Software: @@ -32,7 +29,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/pm.h,v 1.4 2001/01/17 23:45:34 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/pm.h,v 1.5 2001/12/14 20:01:43 dawes Exp $ */ #ifndef _PM_H #define _PM_H Index: xc/programs/xfwp/transport.c diff -u xc/programs/xfwp/transport.c:1.4 xc/programs/xfwp/transport.c:1.7 --- xc/programs/xfwp/transport.c:1.4 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/transport.c Fri Dec 14 15:01:43 2001 @@ -1,16 +1,13 @@ -/* $Xorg: transport.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: transport.c,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* -Copyright "1986-1997 The Open Group All Rights Reserved +Copyright "1986-1997, 1998 The Open Group -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to use the Software without restriction, -including, without limitation, the rights to copy, modify, -merge, publish, distribute and sublicense the Software, to make, -have made, license and distribute derivative works thereof, and -to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +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. The above copyright notice and the following permission notice shall be included in all copies of the Software: @@ -32,6 +29,7 @@ X Window System is a trademark of The Open Group. */ +/* $XFree86: xc/programs/xfwp/transport.c,v 1.7 2001/12/14 20:01:43 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -42,10 +40,6 @@ #include <netdb.h> #include <X11/Xfuncs.h> /* Need for bzero() */ - -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #include <X11/ICE/ICElib.h> /* Need typedef for Bool */ Index: xc/programs/xfwp/transport.h diff -u xc/programs/xfwp/transport.h:1.3 xc/programs/xfwp/transport.h:1.4 --- xc/programs/xfwp/transport.h:1.3 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/transport.h Fri Dec 14 15:01:44 2001 @@ -1,9 +1,13 @@ -/* $Xorg: transport.h,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: transport.h,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* Copyright "1986-1997, 1998 The Open Group -All Rights Reserved +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. The above copyright notice and the following permission notice shall be included in all copies of the Software: Index: xc/programs/xfwp/xfwp.c diff -u xc/programs/xfwp/xfwp.c:1.11 xc/programs/xfwp/xfwp.c:1.12 --- xc/programs/xfwp/xfwp.c:1.11 Wed Jan 17 18:45:34 2001 +++ xc/programs/xfwp/xfwp.c Fri Dec 14 15:01:44 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xfwp.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: xfwp.c,v 1.4 2001/02/09 02:05:45 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xfwp/xfwp.h diff -u xc/programs/xfwp/xfwp.h:1.9 xc/programs/xfwp/xfwp.h:1.10 --- xc/programs/xfwp/xfwp.h:1.9 Wed Jan 17 18:45:35 2001 +++ xc/programs/xfwp/xfwp.h Fri Dec 14 15:01:44 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xfwp.h,v 1.5 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: xfwp.h,v 1.6 2001/02/09 02:05:46 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xfwp/xfwp.h,v 1.9 2001/01/17 23:45:35 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/xfwp.h,v 1.10 2001/12/14 20:01:44 dawes Exp $ */ #ifndef _XFWP_H #define _XFWP_H Index: xc/programs/xfwp/xfwp.man diff -u xc/programs/xfwp/xfwp.man:1.7 xc/programs/xfwp/xfwp.man:1.8 --- xc/programs/xfwp/xfwp.man:1.7 Wed Feb 7 17:35:23 2001 +++ xc/programs/xfwp/xfwp.man Fri Dec 14 15:01:44 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xfwp.man,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ +.\" $Xorg: xfwp.man,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $ .\" Copyright 1996, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" from The Open Group. .\" .\" -.\" $XFree86: xc/programs/xfwp/xfwp.man,v 1.7 2001/02/07 22:35:23 tsi Exp $ +.\" $XFree86: xc/programs/xfwp/xfwp.man,v 1.8 2001/12/14 20:01:44 dawes Exp $ .\" .nh .TH XFWP 1 __xorgversion__ Index: xc/programs/xgc/constants.h diff -u xc/programs/xgc/constants.h:1.1 xc/programs/xgc/constants.h:1.2 --- xc/programs/xgc/constants.h:1.1 Sat Feb 12 22:26:26 2000 +++ xc/programs/xgc/constants.h Mon Jan 7 15:38:30 2002 @@ -7,7 +7,9 @@ */ /* Find the max of two numbers */ +#ifndef max #define max(x,y) (((x)>(y))?(x):(y)) +#endif #ifndef TRUE #define TRUE 1 Index: xc/programs/xgc/dashlist.c diff -u xc/programs/xgc/dashlist.c:1.1 xc/programs/xgc/dashlist.c:1.3 --- xc/programs/xgc/dashlist.c:1.1 Sat Feb 12 22:26:26 2000 +++ xc/programs/xgc/dashlist.c Sun Jul 29 17:23:21 2001 @@ -7,12 +7,11 @@ ** functions to create more than one of these dashlist choice things ** will fail in a big way. */ +/* $XFree86: xc/programs/xgc/dashlist.c,v 1.3 2001/07/29 21:23:21 tsi Exp $ */ #include <stdio.h> #include <X11/Xos.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xaw/Form.h> Index: xc/programs/xgc/interpret.c diff -u xc/programs/xgc/interpret.c:1.3 xc/programs/xgc/interpret.c:1.4 --- xc/programs/xgc/interpret.c:1.3 Thu Feb 17 09:00:36 2000 +++ xc/programs/xgc/interpret.c Mon Jan 7 15:38:30 2002 @@ -3,7 +3,7 @@ ** ** interprets and executes lines in the Xgc syntax. */ -/* $XFree86: xc/programs/xgc/interpret.c,v 1.3 2000/02/17 14:00:36 dawes Exp $ */ +/* $XFree86: xc/programs/xgc/interpret.c,v 1.4 2002/01/07 20:38:30 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -157,15 +157,15 @@ } } else if (!strcmp(word1,"planemask")) - GC_change_planemask((unsigned int) atoi(word2),FALSE); + GC_change_planemask((unsigned long) atoi(word2),FALSE); else if (!strcmp(word1,"dashlist")) GC_change_dashlist(atoi(word2),FALSE); else if (!strcmp(word1,"font")) GC_change_font(word2,FALSE); else if (!strcmp(word1,"foreground")) - GC_change_foreground((unsigned int) atoi(word2),FALSE); + GC_change_foreground((unsigned long) atoi(word2),FALSE); else if (!strcmp(word1,"background")) - GC_change_background((unsigned int) atoi(word2),FALSE); + GC_change_background((unsigned long) atoi(word2),FALSE); else if (!strcmp(word1,"percent")) change_percent(atoi(word2), FALSE); else fprintf(stderr,"Ack... %s %s\n",word1,word2); Index: xc/programs/xgc/main.c diff -u xc/programs/xgc/main.c:1.4 xc/programs/xgc/main.c:1.5 --- xc/programs/xgc/main.c:1.4 Sun Apr 1 10:00:21 2001 +++ xc/programs/xgc/main.c Sat Oct 27 23:34:34 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xgc/main.c,v 1.4 2001/04/01 14:00:21 tsi Exp $ */ +/* $XFree86: xc/programs/xgc/main.c,v 1.5 2001/10/28 03:34:34 tsi Exp $ */ /* xgc ** @@ -47,6 +47,7 @@ #include <stdlib.h> #include "xgc.h" +#define DEFINE_TILE #include "tile" #include "main.h" Index: xc/programs/xgc/tests.c diff -u xc/programs/xgc/tests.c:1.5 xc/programs/xgc/tests.c:1.9 --- xc/programs/xgc/tests.c:1.5 Tue Nov 14 13:20:39 2000 +++ xc/programs/xgc/tests.c Wed Jan 9 23:29:18 2002 @@ -1,6 +1,6 @@ /* ** $XConsortium: tests.c,v 1.20 91/06/08 18:57:07 rws Exp $ -** $XFree86: xc/programs/xgc/tests.c,v 1.5 2000/11/14 18:20:39 dawes Exp $ +** $XFree86: xc/programs/xgc/tests.c,v 1.9 2002/01/10 04:29:18 dawes Exp $ ** */ @@ -15,7 +15,7 @@ #ifdef SVR4 #define SYSV #endif -#if !defined(SYSV) && !defined(MINIX) +#if !defined(SYSV) && !defined(QNX4) #include <sys/timeb.h> #include <sys/resource.h> #endif @@ -28,10 +28,6 @@ #define random lrand48 #endif -#ifdef X_NOT_STDC_ENV -extern long random(); -#endif - extern XStuff X; extern Widget result; @@ -53,10 +49,10 @@ timer(flag) int flag; { -#if !defined(SYSV) && !defined(MINIX) && !defined(AMOEBA) +#if !defined(SYSV) static struct timeval starttime; /* starting time for gettimeofday() */ struct timeval endtime; /* ending time for gettimeofday() */ -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(QNX4) static struct rusage startusage; /* starting time for getrusage() */ struct rusage endusage; /* ending time for getrusage() */ #endif @@ -67,13 +63,13 @@ switch (flag) { case StartTimer: /* store initial values */ gettimeofday(&starttime,&tz); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(QNX4) getrusage(RUSAGE_SELF,&startusage); #endif return((long) NULL); case EndTimer: gettimeofday(&endtime,&tz); /* store final values */ -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(QNX4) getrusage(RUSAGE_SELF,&endusage); #endif @@ -81,7 +77,7 @@ elapsed time = ending time - starting time, but there are three different timers and two different units of time, ack... */ -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(QNX4) elapsedtime = (long) ((long) ((endtime.tv_sec - endusage.ru_utime.tv_sec - endusage.ru_stime.tv_sec - starttime.tv_sec + startusage.ru_utime.tv_sec Index: xc/programs/xgc/tile diff -u xc/programs/xgc/tile:1.1 xc/programs/xgc/tile:1.2 --- xc/programs/xgc/tile:1.1 Sat Feb 12 22:26:29 2000 +++ xc/programs/xgc/tile Sat Oct 27 23:34:34 2001 @@ -1,6 +1,17 @@ +/* $XFree86: xc/programs/xgc/tile,v 1.2 2001/10/28 03:34:34 tsi Exp $ */ + +#if !defined(tile_width) && !defined(tile_height) + #define tile_width 16 #define tile_height 16 + +#ifdef DEFINE_TILE + static unsigned char tile_bits[] = { 0xff, 0x80, 0xfc, 0x80, 0x70, 0xc0, 0xc0, 0xc0, 0xe0, 0xe3, 0xe0, 0xef, 0xf0, 0xff, 0xf0, 0xdf, 0xfb, 0x0f, 0xff, 0x0f, 0xf7, 0x07, 0xc7, 0x07, 0x03, 0x03, 0x03, 0x0e, 0x01, 0x3f, 0x01, 0xff}; + +#endif + +#endif Index: xc/programs/xhost/xhost.c diff -u xc/programs/xhost/xhost.c:3.14 xc/programs/xhost/xhost.c:3.20 --- xc/programs/xhost/xhost.c:3.14 Tue Jan 30 17:06:21 2001 +++ xc/programs/xhost/xhost.c Fri Dec 14 15:01:45 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xhost.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: xhost.c,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $ */ /* Copyright 1985, 1986, 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xhost/xhost.c,v 3.14 2001/01/30 22:06:21 tsi Exp $ */ +/* $XFree86: xc/programs/xhost/xhost.c,v 3.20 2001/12/14 20:01:45 dawes Exp $ */ #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN) #define NEEDSOCKETS @@ -40,16 +44,13 @@ #include <X11/Xfuncs.h> #include <stdio.h> #include <signal.h> +#ifdef X_NOT_POSIX #include <setjmp.h> +#endif #include <ctype.h> #include <X11/Xauth.h> #include <X11/Xmu/Error.h> - -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -char *malloc(); -#endif #ifdef NEEDSOCKETS #ifdef att @@ -61,7 +62,6 @@ #include <interlan/netdb.h> #include <interlan/in.h> #else -#ifndef AMOEBA #ifndef Lynx #include <sys/socket.h> #else @@ -69,13 +69,6 @@ #endif #include <netdb.h> #include <netinet/in.h> -#else -#include <server/ip/gen/socket.h> -#include <server/ip/types.h> -#include <server/ip/gen/in.h> -#include <server/ip/gen/inet.h> -#include <server/ip/gen/netdb.h> -#endif #endif #endif /* NEEDSOCKETS */ @@ -111,7 +104,11 @@ #include <sys/param.h> #define NGROUPS_MAX NGROUPS #endif +#ifdef sun +/* Go figure, there's no getdomainname() prototype available */ +extern int getdomainname(char *name, size_t len); #endif +#endif static int change_host(Display *dpy, char *name, Bool add); static char *get_hostname(XHostAddress *ha); @@ -540,17 +537,16 @@ * be found. */ +#ifdef X_NOT_POSIX jmp_buf env; +#endif static char * get_hostname(XHostAddress *ha) { #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN) static struct hostent *hp = NULL; -#ifdef X_NOT_STDC_ENV - char *inet_ntoa(); #endif -#endif #ifdef DNETCONN struct nodeent *np; static char nodeaddr[5 + 2 * DN_MAXADDL]; @@ -561,6 +557,9 @@ char *kname; static char kname_out[255]; #endif +#ifndef X_NOT_POSIX + struct sigaction sa; +#endif #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN) if (ha->family == FamilyInternet) { @@ -576,11 +575,22 @@ gethostbyaddr will continue after a signal, so we have to jump out of it. */ +#ifndef X_NOT_POSIX + memset(&sa, 0, sizeof sa); + sa.sa_handler = nameserver_lost; + sa.sa_flags = 0; /* don't restart syscalls */ + sigaction(SIGALRM, &sa, NULL); +#else signal(SIGALRM, nameserver_lost); +#endif alarm(4); +#ifdef X_NOT_POSIX if (setjmp(env) == 0) { +#endif hp = gethostbyaddr (ha->address, ha->length, AF_INET); +#ifdef X_NOT_POSIX } +#endif alarm(0); if (hp) return (hp->h_name); @@ -609,7 +619,6 @@ #ifdef SECURE_RPC if (netname2user(netname, &uid, &gid, &gidlen, gidlist)) { struct passwd *pwd; - char *cp; pwd = getpwuid(uid); if (pwd) @@ -654,7 +663,11 @@ nameserver_lost(int sig) { nameserver_timedout = 1; +#ifdef X_NOT_POSIX + /* not needed with POSIX signals - stuck syscalls will not + be restarted after signal delivery */ longjmp(env, -1); +#endif } /* Index: xc/programs/xhost/xhost.man diff -u xc/programs/xhost/xhost.man:1.7 xc/programs/xhost/xhost.man:1.8 --- xc/programs/xhost/xhost.man:1.7 Sat Jan 27 13:21:15 2001 +++ xc/programs/xhost/xhost.man Fri Dec 14 15:01:45 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xhost.man,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ +.\" $Xorg: xhost.man,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xhost/xhost.man,v 1.7 2001/01/27 18:21:15 dawes Exp $ +.\" $XFree86: xc/programs/xhost/xhost.man,v 1.8 2001/12/14 20:01:45 dawes Exp $ .\" .TH XHOST 1 __xorgversion__ .SH NAME Index: xc/programs/xieperf/abort.c diff -u xc/programs/xieperf/abort.c:1.6 xc/programs/xieperf/abort.c:1.7 --- xc/programs/xieperf/abort.c:1.6 Wed Jan 17 18:45:36 2001 +++ xc/programs/xieperf/abort.c Fri Dec 14 15:01:46 2001 @@ -1,11 +1,15 @@ -/* $Xorg: abort.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: abort.c,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $ */ /**** module abort.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/abort.c,v 1.6 2001/01/17 23:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/abort.c,v 1.7 2001/12/14 20:01:46 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/arith.c diff -u xc/programs/xieperf/arith.c:1.5 xc/programs/xieperf/arith.c:1.6 --- xc/programs/xieperf/arith.c:1.5 Wed Jan 17 18:45:36 2001 +++ xc/programs/xieperf/arith.c Fri Dec 14 15:01:46 2001 @@ -1,11 +1,15 @@ -/* $Xorg: arith.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: arith.c,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $ */ /**** module arith.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/arith.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/arith.c,v 1.6 2001/12/14 20:01:46 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/await.c diff -u xc/programs/xieperf/await.c:3.4 xc/programs/xieperf/await.c:3.6 --- xc/programs/xieperf/await.c:3.4 Wed Jan 17 18:45:36 2001 +++ xc/programs/xieperf/await.c Fri Dec 14 15:01:46 2001 @@ -1,11 +1,15 @@ -/* $Xorg: await.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: await.c,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $ */ /**** module await.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/await.c,v 3.4 2001/01/17 23:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/await.c,v 3.6 2001/12/14 20:01:46 dawes Exp $ */ #ifdef WIN32 #include <X11/Xthreads.h> @@ -227,16 +231,16 @@ if ( ++AwaitHandlerSeen == 2 ) { - exit( 1 ); + _exit( 1 ); } if ( ( pid = fork() ) == -1 ) { - exit( 1 ); + _exit( 1 ); } else if ( pid == 0 ) /* child */ { - AbortFlo(xplocal); - exit( 0 ); + AbortFlo(xplocal); /* XXX is this safe ? */ + _exit( 0 ); } else /* parent */ { Index: xc/programs/xieperf/band.c diff -u xc/programs/xieperf/band.c:1.5 xc/programs/xieperf/band.c:1.6 --- xc/programs/xieperf/band.c:1.5 Wed Jan 17 18:45:36 2001 +++ xc/programs/xieperf/band.c Fri Dec 14 15:01:46 2001 @@ -1,10 +1,14 @@ -/* $Xorg: band.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: band.c,v 1.4 2001/02/09 02:05:46 xorgcvs Exp $ */ /**** module band.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -66,7 +70,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/band.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/band.c,v 1.6 2001/12/14 20:01:46 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/blend.c diff -u xc/programs/xieperf/blend.c:1.5 xc/programs/xieperf/blend.c:1.6 --- xc/programs/xieperf/blend.c:1.5 Wed Jan 17 18:45:36 2001 +++ xc/programs/xieperf/blend.c Fri Dec 14 15:01:46 2001 @@ -1,11 +1,15 @@ -/* $Xorg: blend.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ +/* $Xorg: blend.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module blend.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/blend.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/blend.c,v 1.6 2001/12/14 20:01:46 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/cache.c diff -u xc/programs/xieperf/cache.c:1.5 xc/programs/xieperf/cache.c:1.6 --- xc/programs/xieperf/cache.c:1.5 Wed Jan 17 18:45:36 2001 +++ xc/programs/xieperf/cache.c Fri Dec 14 15:01:46 2001 @@ -1,11 +1,15 @@ -/* $Xorg: cache.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: cache.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module cache.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -68,7 +72,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/cache.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/cache.c,v 1.6 2001/12/14 20:01:46 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/compare.c diff -u xc/programs/xieperf/compare.c:1.5 xc/programs/xieperf/compare.c:1.6 --- xc/programs/xieperf/compare.c:1.5 Wed Jan 17 18:45:36 2001 +++ xc/programs/xieperf/compare.c Fri Dec 14 15:01:47 2001 @@ -1,11 +1,15 @@ -/* $Xorg: compare.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: compare.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module compare.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/compare.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/compare.c,v 1.6 2001/12/14 20:01:47 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/complex.c diff -u xc/programs/xieperf/complex.c:1.5 xc/programs/xieperf/complex.c:1.6 --- xc/programs/xieperf/complex.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/complex.c Fri Dec 14 15:01:47 2001 @@ -1,10 +1,14 @@ -/* $Xorg: complex.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: complex.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module complex.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -66,7 +70,7 @@ Syd Logan -- AGE Logic, Inc. January 3, 1994 *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/complex.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/complex.c,v 1.6 2001/12/14 20:01:47 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/constrain.c diff -u xc/programs/xieperf/constrain.c:1.5 xc/programs/xieperf/constrain.c:1.6 --- xc/programs/xieperf/constrain.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/constrain.c Fri Dec 14 15:01:47 2001 @@ -1,11 +1,15 @@ -/* $Xorg: constrain.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: constrain.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module constrain.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/constrain.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/constrain.c,v 1.6 2001/12/14 20:01:47 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/convolve.c diff -u xc/programs/xieperf/convolve.c:1.5 xc/programs/xieperf/convolve.c:1.6 --- xc/programs/xieperf/convolve.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/convolve.c Fri Dec 14 15:01:48 2001 @@ -1,11 +1,15 @@ -/* $Xorg: convolve.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: convolve.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module convolve.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/convolve.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/convolve.c,v 1.6 2001/12/14 20:01:48 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/creatdstry.c diff -u xc/programs/xieperf/creatdstry.c:1.5 xc/programs/xieperf/creatdstry.c:1.6 --- xc/programs/xieperf/creatdstry.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/creatdstry.c Fri Dec 14 15:01:48 2001 @@ -1,11 +1,15 @@ -/* $Xorg: creatdstry.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: creatdstry.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module creatdstry.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/creatdstry.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/creatdstry.c,v 1.6 2001/12/14 20:01:48 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/cvttoindex.c diff -u xc/programs/xieperf/cvttoindex.c:1.5 xc/programs/xieperf/cvttoindex.c:1.6 --- xc/programs/xieperf/cvttoindex.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/cvttoindex.c Fri Dec 14 15:01:48 2001 @@ -1,11 +1,15 @@ -/* $Xorg: cvttoindex.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: cvttoindex.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module cvttoindex.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/cvttoindex.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/cvttoindex.c,v 1.6 2001/12/14 20:01:48 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/dither.c diff -u xc/programs/xieperf/dither.c:1.5 xc/programs/xieperf/dither.c:1.6 --- xc/programs/xieperf/dither.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/dither.c Fri Dec 14 15:01:48 2001 @@ -1,11 +1,15 @@ -/* $Xorg: dither.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: dither.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module dither.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/dither.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/dither.c,v 1.6 2001/12/14 20:01:48 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/encode.c diff -u xc/programs/xieperf/encode.c:1.5 xc/programs/xieperf/encode.c:1.6 --- xc/programs/xieperf/encode.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/encode.c Fri Dec 14 15:01:48 2001 @@ -1,10 +1,14 @@ -/* $Xorg: encode.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: encode.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module encode.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -66,7 +70,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/encode.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/encode.c,v 1.6 2001/12/14 20:01:48 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/errors.c diff -u xc/programs/xieperf/errors.c:1.5 xc/programs/xieperf/errors.c:1.6 --- xc/programs/xieperf/errors.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/errors.c Fri Dec 14 15:01:48 2001 @@ -1,10 +1,14 @@ -/* $Xorg: errors.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: errors.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module errors.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -66,7 +70,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/errors.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/errors.c,v 1.6 2001/12/14 20:01:48 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xieperf/events.c diff -u xc/programs/xieperf/events.c:3.7 xc/programs/xieperf/events.c:3.9 --- xc/programs/xieperf/events.c:3.7 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/events.c Fri Dec 14 15:01:49 2001 @@ -1,10 +1,14 @@ -/* $Xorg: events.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: events.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module events.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -66,7 +70,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/events.c,v 3.7 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/events.c,v 3.9 2001/12/14 20:01:49 dawes Exp $ */ #ifdef WIN32 #define _WILLWINSOCK_ @@ -76,11 +80,6 @@ #include <X11/Xpoll.h> #include "xieperf.h" -#ifdef MINIX -#include <sys/nbio.h> -#define select(n,r,w,x,t) nbio_select(n,r,w,x,t) -#endif - static XieExtensionInfo *xieInfo=NULL; static int timeout = 60; /* in seconds */ @@ -194,14 +193,9 @@ tv.tv_sec = delta; tv.tv_usec = 0L; XFlush( xp->d ); -#ifndef AMOEBA FD_ZERO(&rd); FD_SET(Xsocket, &rd); Select( Xsocket + 1, &rd, NULL, NULL, &tv ); -#else /* AMOEBA */ - (void) _X11TransAmSelect(ConnectionNumber(xp->d), - delta * 1000); -#endif /* AMOEBA */ continue; } xie_event = event.type - xieInfo->first_event; Index: xc/programs/xieperf/exportcl.c diff -u xc/programs/xieperf/exportcl.c:1.5 xc/programs/xieperf/exportcl.c:1.6 --- xc/programs/xieperf/exportcl.c:1.5 Wed Jan 17 18:45:37 2001 +++ xc/programs/xieperf/exportcl.c Fri Dec 14 15:01:49 2001 @@ -1,11 +1,15 @@ -/* $Xorg: exportcl.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: exportcl.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module exportcl.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/exportcl.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/exportcl.c,v 1.6 2001/12/14 20:01:49 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/funcode.c diff -u xc/programs/xieperf/funcode.c:1.5 xc/programs/xieperf/funcode.c:1.6 --- xc/programs/xieperf/funcode.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/funcode.c Fri Dec 14 15:01:49 2001 @@ -1,11 +1,15 @@ -/* $Xorg: funcode.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: funcode.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module funcode.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -69,7 +73,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/funcode.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/funcode.c,v 1.6 2001/12/14 20:01:49 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/geometry.c diff -u xc/programs/xieperf/geometry.c:1.5 xc/programs/xieperf/geometry.c:1.6 --- xc/programs/xieperf/geometry.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/geometry.c Fri Dec 14 15:01:49 2001 @@ -1,11 +1,15 @@ -/* $Xorg: geometry.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ +/* $Xorg: geometry.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module geometry.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/geometry.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/geometry.c,v 1.6 2001/12/14 20:01:49 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/getnext.c diff -u xc/programs/xieperf/getnext.c:1.4 xc/programs/xieperf/getnext.c:1.5 --- xc/programs/xieperf/getnext.c:1.4 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/getnext.c Fri Dec 14 15:01:50 2001 @@ -1,11 +1,15 @@ -/* $Xorg: getnext.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ +/* $Xorg: getnext.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module getnext.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/getnext.c,v 1.4 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/getnext.c,v 1.5 2001/12/14 20:01:50 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xieperf/import.c diff -u xc/programs/xieperf/import.c:1.5 xc/programs/xieperf/import.c:1.6 --- xc/programs/xieperf/import.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/import.c Fri Dec 14 15:01:50 2001 @@ -1,11 +1,15 @@ -/* $Xorg: import.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ +/* $Xorg: import.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module import.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/import.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/import.c,v 1.6 2001/12/14 20:01:50 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/importcl.c diff -u xc/programs/xieperf/importcl.c:1.5 xc/programs/xieperf/importcl.c:1.6 --- xc/programs/xieperf/importcl.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/importcl.c Fri Dec 14 15:01:50 2001 @@ -1,11 +1,15 @@ -/* $Xorg: importcl.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ +/* $Xorg: importcl.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module importcl.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/importcl.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/importcl.c,v 1.6 2001/12/14 20:01:50 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/logical.c diff -u xc/programs/xieperf/logical.c:1.5 xc/programs/xieperf/logical.c:1.6 --- xc/programs/xieperf/logical.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/logical.c Fri Dec 14 15:01:50 2001 @@ -1,11 +1,15 @@ -/* $Xorg: logical.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ +/* $Xorg: logical.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module logical.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/logical.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/logical.c,v 1.6 2001/12/14 20:01:50 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/math.c diff -u xc/programs/xieperf/math.c:1.5 xc/programs/xieperf/math.c:1.6 --- xc/programs/xieperf/math.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/math.c Fri Dec 14 15:01:50 2001 @@ -1,11 +1,15 @@ -/* $Xorg: math.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ +/* $Xorg: math.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module math.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/math.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/math.c,v 1.6 2001/12/14 20:01:50 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/modify.c diff -u xc/programs/xieperf/modify.c:3.7 xc/programs/xieperf/modify.c:3.9 --- xc/programs/xieperf/modify.c:3.7 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/modify.c Fri Dec 14 15:01:50 2001 @@ -1,11 +1,15 @@ -/* $Xorg: modify.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: modify.c,v 1.4 2001/02/09 02:05:47 xorgcvs Exp $ */ /**** module modify.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/modify.c,v 3.7 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/modify.c,v 3.9 2001/12/14 20:01:50 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> @@ -790,12 +794,8 @@ #ifdef WIN32 #define RAND( x, y ) ( ( rand() / ((RAND_MAX + 1) / 2.0) ) * ( y - x ) + x ) #else -#ifndef X_NOT_STDC_ENV #include <math.h> #include <stdlib.h> -#else -extern long random(); -#endif #if defined(SYSV) || defined(SVR4) || defined(__osf__) || defined(CSRG_BASED) #define random lrand48 #endif Index: xc/programs/xieperf/mtchhist.c diff -u xc/programs/xieperf/mtchhist.c:1.5 xc/programs/xieperf/mtchhist.c:1.6 --- xc/programs/xieperf/mtchhist.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/mtchhist.c Fri Dec 14 15:01:51 2001 @@ -1,11 +1,15 @@ -/* $Xorg: mtchhist.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: mtchhist.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module mtchhist.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/mtchhist.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/mtchhist.c,v 1.6 2001/12/14 20:01:51 dawes Exp $ */ #include "xieperf.h" Index: xc/programs/xieperf/pasteup.c diff -u xc/programs/xieperf/pasteup.c:1.5 xc/programs/xieperf/pasteup.c:1.6 --- xc/programs/xieperf/pasteup.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/pasteup.c Fri Dec 14 15:01:51 2001 @@ -1,11 +1,15 @@ -/* $Xorg: pasteup.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: pasteup.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module pasteup.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/pasteup.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/pasteup.c,v 1.6 2001/12/14 20:01:51 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/point.c diff -u xc/programs/xieperf/point.c:1.5 xc/programs/xieperf/point.c:1.6 --- xc/programs/xieperf/point.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/point.c Fri Dec 14 15:01:51 2001 @@ -1,11 +1,15 @@ -/* $Xorg: point.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: point.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module point.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/point.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/point.c,v 1.6 2001/12/14 20:01:51 dawes Exp $ */ #include "xieperf.h" Index: xc/programs/xieperf/purgecolst.c diff -u xc/programs/xieperf/purgecolst.c:1.5 xc/programs/xieperf/purgecolst.c:1.6 --- xc/programs/xieperf/purgecolst.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/purgecolst.c Fri Dec 14 15:01:51 2001 @@ -1,11 +1,15 @@ -/* $Xorg: purgecolst.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: purgecolst.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module purgecolst.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/purgecolst.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/purgecolst.c,v 1.6 2001/12/14 20:01:51 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/query.c diff -u xc/programs/xieperf/query.c:1.5 xc/programs/xieperf/query.c:1.6 --- xc/programs/xieperf/query.c:1.5 Wed Jan 17 18:45:38 2001 +++ xc/programs/xieperf/query.c Fri Dec 14 15:01:51 2001 @@ -1,11 +1,15 @@ -/* $Xorg: query.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: query.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module query.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/query.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/query.c,v 1.6 2001/12/14 20:01:51 dawes Exp $ */ #include "xieperf.h" Index: xc/programs/xieperf/redefine.c diff -u xc/programs/xieperf/redefine.c:1.5 xc/programs/xieperf/redefine.c:1.6 --- xc/programs/xieperf/redefine.c:1.5 Wed Jan 17 18:45:39 2001 +++ xc/programs/xieperf/redefine.c Fri Dec 14 15:01:51 2001 @@ -1,11 +1,15 @@ -/* $Xorg: redefine.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: redefine.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module redefine.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/redefine.c,v 1.5 2001/01/17 23:45:39 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/redefine.c,v 1.6 2001/12/14 20:01:51 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/rgb.c diff -u xc/programs/xieperf/rgb.c:1.5 xc/programs/xieperf/rgb.c:1.6 --- xc/programs/xieperf/rgb.c:1.5 Wed Jan 17 18:45:39 2001 +++ xc/programs/xieperf/rgb.c Fri Dec 14 15:01:51 2001 @@ -1,11 +1,15 @@ -/* $Xorg: rgb.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: rgb.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module rgb.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/rgb.c,v 1.5 2001/01/17 23:45:39 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/rgb.c,v 1.6 2001/12/14 20:01:51 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/tests.c diff -u xc/programs/xieperf/tests.c:1.4 xc/programs/xieperf/tests.c:1.5 --- xc/programs/xieperf/tests.c:1.4 Wed Jan 17 18:45:39 2001 +++ xc/programs/xieperf/tests.c Fri Dec 14 15:01:52 2001 @@ -1,11 +1,15 @@ -/* $Xorg: tests.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ +/* $Xorg: tests.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module tests.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/tests.c,v 1.4 2001/01/17 23:45:39 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/tests.c,v 1.5 2001/12/14 20:01:52 dawes Exp $ */ #include <stdio.h> /* for stderr */ #include "xieperf.h" Index: xc/programs/xieperf/uconstrain.c diff -u xc/programs/xieperf/uconstrain.c:1.5 xc/programs/xieperf/uconstrain.c:1.6 --- xc/programs/xieperf/uconstrain.c:1.5 Wed Jan 17 18:45:39 2001 +++ xc/programs/xieperf/uconstrain.c Fri Dec 14 15:01:52 2001 @@ -1,11 +1,15 @@ -/* $Xorg: uconstrain.c,v 1.3 2000/08/17 19:54:28 cpqbld Exp $ */ +/* $Xorg: uconstrain.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module uconstrain.c ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/uconstrain.c,v 1.5 2001/01/17 23:45:39 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/uconstrain.c,v 1.6 2001/12/14 20:01:52 dawes Exp $ */ #include "xieperf.h" Index: xc/programs/xieperf/xieperf.c diff -u xc/programs/xieperf/xieperf.c:3.6 xc/programs/xieperf/xieperf.c:3.8 --- xc/programs/xieperf/xieperf.c:3.6 Tue Jan 23 15:38:30 2001 +++ xc/programs/xieperf/xieperf.c Fri Dec 14 15:01:53 2001 @@ -1,11 +1,15 @@ -/* $Xorg: xieperf.c,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ */ +/* $Xorg: xieperf.c,v 1.4 2001/02/09 02:05:48 xorgcvs Exp $ */ /**** module xieperf.c ****/ /**************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/xieperf.c,v 3.6 2001/01/23 20:38:30 herrb Exp $ */ +/* $XFree86: xc/programs/xieperf/xieperf.c,v 3.8 2001/12/14 20:01:53 dawes Exp $ */ #include <X11/Xos.h> #include <stdio.h> @@ -78,14 +82,8 @@ #include "xieperf.h" #include <X11/Xmu/SysUtil.h> #include <X11/Xmu/StdCmap.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#define Time_t long -extern Time_t time (); -#else #include <time.h> #define Time_t time_t -#endif #ifndef O_BINARY #define O_BINARY 0 #endif Index: xc/programs/xieperf/xieperf.h diff -u xc/programs/xieperf/xieperf.h:1.4 xc/programs/xieperf/xieperf.h:1.6 --- xc/programs/xieperf/xieperf.h:1.4 Wed Jan 17 18:45:40 2001 +++ xc/programs/xieperf/xieperf.h Fri Dec 14 15:01:53 2001 @@ -1,11 +1,15 @@ -/* $Xorg: xieperf.h,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ */ +/* $Xorg: xieperf.h,v 1.4 2001/02/09 02:05:49 xorgcvs Exp $ */ /**** module xieperf.h ****/ /****************************************************************************** Copyright 1993, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -67,7 +71,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/xieperf.h,v 1.4 2001/01/17 23:45:40 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/xieperf.h,v 1.6 2001/12/14 20:01:53 dawes Exp $ */ #include <stdio.h> #ifndef VMS @@ -87,18 +91,11 @@ #include <X11/Xfuncs.h> #include <X11/extensions/XIElib.h> -#ifndef NULL -#define NULL 0 -#endif +#include <stddef.h> #include <sys/types.h> #include <sys/stat.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -char *malloc(); -char *realloc(); -#endif #include <fcntl.h> #ifdef SIGNALRETURNSINT #define SIGNAL_T int Index: xc/programs/xieperf/xieperf.man diff -u xc/programs/xieperf/xieperf.man:1.7 xc/programs/xieperf/xieperf.man:1.8 --- xc/programs/xieperf/xieperf.man:1.7 Sat Jan 27 13:21:15 2001 +++ xc/programs/xieperf/xieperf.man Fri Dec 14 15:01:53 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xieperf.man,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ +.\" $Xorg: xieperf.man,v 1.4 2001/02/09 02:05:49 xorgcvs Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -59,7 +63,7 @@ .\" Title to this software shall at all times remain with AGE .\" Logic, Inc. .\" -.\" $XFree86: xc/programs/xieperf/xieperf.man,v 1.7 2001/01/27 18:21:15 dawes Exp $ +.\" $XFree86: xc/programs/xieperf/xieperf.man,v 1.8 2001/12/14 20:01:53 dawes Exp $ .\" .TH xieperf 1 __xorgversion__ .SH NAME Index: xc/programs/xinit/Imakefile diff -u xc/programs/xinit/Imakefile:3.11 xc/programs/xinit/Imakefile:3.15 --- xc/programs/xinit/Imakefile:3.11 Thu Apr 19 11:08:32 2001 +++ xc/programs/xinit/Imakefile Thu Nov 1 10:29:05 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xinit/Imakefile,v 3.11 2001/04/19 15:08:32 dawes Exp $ +XCOMM $XFree86: xc/programs/xinit/Imakefile,v 3.15 2001/11/01 15:29:05 dawes Exp $ #if HasVFork VFORK_DEFINES = -DHAS_VFORK @@ -21,22 +21,20 @@ SRCS1 = xinit.c OBJS1 = xinit.o SAMPLECONFIG = xinitrc - PROGRAMS = ProgramTargetName(xinit) startx $(SAMPLECONFIG) + PROGRAMS = xinit #if HasCookieMaker COOKIEDEFS = -DHAS_COOKIE_MAKER -DMK_COOKIE=MkCookieCmd #endif +all:: startx $(SAMPLECONFIG) + ComplexProgramTarget_1(xinit,$(LOCAL_LIBRARIES),$(DEFFILE)) #ifndef OS2Architecture MakeScriptFromCpp(xinitrc, -DXINITDIR=$(XINITDIR)) #endif -#ifdef i386ScoArchitecture -MakeScriptFromCpp(startx, -DXINITDIR=$(XINITDIR) -DBINDIR=$(BINDIR)) -#else -MakeScriptFromCpp(startx, -DXINITDIR=$(XINITDIR) $(COOKIEDEFS)) -#endif +MakeScriptFromCpp(startx, -DXINITDIR=$(XINITDIR) -DBINDIR=$(BINDIR) $(COOKIEDEFS)) EXTRAMANDEFS=-D__xinitdir__=$(XINITDIR) Index: xc/programs/xinit/startx.cpp diff -u xc/programs/xinit/startx.cpp:3.8 xc/programs/xinit/startx.cpp:3.12 --- xc/programs/xinit/startx.cpp:3.8 Fri Apr 27 07:04:53 2001 +++ xc/programs/xinit/startx.cpp Fri Nov 30 15:57:48 2001 @@ -1,8 +1,8 @@ XCOMM!/bin/sh 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 +XCOMM This is just a sample implementation of a slightly less primitive XCOMM interface than xinit. It looks for user .xinitrc and .xserverrc XCOMM files, then system xinitrc and xserverrc files, else lets xinit choose XCOMM its default. The system xinitrc should probably do things like check @@ -10,8 +10,8 @@ XCOMM and pop a clock and serveral xterms. 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 $ +XCOMM +XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.12 2001/11/30 20:57:48 dawes Exp $ #ifdef SCO @@ -40,11 +40,10 @@ if [ -f /usr/lib/merge/xmergeset.sh ]; then . /usr/lib/merge/xmergeset.sh -else if [ -f /usr/lib/merge/console.disp ]; then +elif [ -f /usr/lib/merge/console.disp ]; then XMERGE=`cat /usr/lib/merge/console.disp` export XMERGE fi -fi scoclientrc=$HOME/.startxrc #endif @@ -53,6 +52,8 @@ userserverrc=$HOME/.xserverrc sysclientrc=XINITDIR/xinitrc sysserverrc=XINITDIR/xserverrc +defaultclient=BINDIR/xterm +defaultserver=BINDIR/X defaultclientargs="" defaultserverargs="" clientargs="" @@ -65,25 +66,38 @@ #endif if [ -f $userclientrc ]; then defaultclientargs=$userclientrc -else if [ -f $sysclientrc ]; then +elif [ -f $sysclientrc ]; then defaultclientargs=$sysclientrc fi -fi #ifdef SCO fi #endif if [ -f $userserverrc ]; then defaultserverargs=$userserverrc -else if [ -f $sysserverrc ]; then +elif [ -f $sysserverrc ]; then defaultserverargs=$sysserverrc fi -fi -display=:0 whoseargs="client" -while [ "x$1" != "x" ]; do +while [ x"$1" != x ]; do case "$1" in + # '' required to prevent cpp from treating "/*" as a C comment. + /''*|\./''*) + if [ "$whoseargs" = "client" ]; then + if [ x"$clientargs" = x ]; then + client="$1" + else + clientargs="$clientargs $1" + fi + else + if [ x"$serverargs" = x ]; then + server="$1" + else + serverargs="$serverargs $1" + fi + fi + ;; --) whoseargs="server" ;; @@ -91,26 +105,40 @@ if [ "$whoseargs" = "client" ]; then clientargs="$clientargs $1" else - serverargs="$serverargs $1" - case "$1" in - :[0-9]*) + # display must be the FIRST server argument + if [ x"$serverargs" = x ] && \ + expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then display="$1" - ;; - esac + else + serverargs="$serverargs $1" + fi fi ;; esac shift done -if [ x"$clientargs" = x ]; then - clientargs="$defaultclientargs" +XCOMM process client arguments +if [ x"$client" = x ]; then + # if no client arguments either, use rc file instead + if [ x"$clientargs" = x ]; then + client="$defaultclientargs" + else + client=$defaultclient + fi fi -if [ x"$serverargs" = x ]; then - serverargs="$defaultserverargs" + +XCOMM process server arguments +if [ x"$server" = x ]; then + # if no server arguments or display either, use rc file instead + if [ x"$serverargs" = x -a x"$display" = x ]; then + server="$defaultserverargs" + else + server=$defaultserver + fi fi - -if [ X"$XAUTHORITY" = X ]; then + +if [ x"$XAUTHORITY" = x ]; then export XAUTHORITY=$HOME/.Xauthority fi @@ -125,8 +153,10 @@ #define HOSTNAME hostname #endif #endif + +authdisplay=${display:-:0} mcookie=`MK_COOKIE` -for displayname in $display `HOSTNAME`$display; do +for displayname in $authdisplay `HOSTNAME`$authdisplay; do if ! xauth list "$displayname" | grep "$displayname " >/dev/null 2>&1; then xauth add $displayname . $mcookie removelist="$displayname $removelist" @@ -134,7 +164,7 @@ done #endif -xinit $clientargs -- $serverargs +xinit $client $clientargs -- $server $display $serverargs if [ x"$removelist" != x ]; then xauth remove $removelist Index: xc/programs/xinit/startx.man diff -u xc/programs/xinit/startx.man:1.7 xc/programs/xinit/startx.man:1.8 --- xc/programs/xinit/startx.man:1.7 Thu Apr 19 11:08:32 2001 +++ xc/programs/xinit/startx.man Fri Dec 14 15:01:56 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: startx.man,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ +.\" $Xorg: startx.man,v 1.4 2001/02/09 02:05:49 xorgcvs Exp $ .\" Copyright 1993, 1998 The Open Group +.\" +.\" 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. .\" -.\" All Rights Reserved. -.\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xinit/startx.man,v 1.7 2001/04/19 15:08:32 dawes Exp $ +.\" $XFree86: xc/programs/xinit/startx.man,v 1.8 2001/12/14 20:01:56 dawes Exp $ .\" .TH STARTX 1 __xorgversion__ .SH NAME Index: xc/programs/xinit/xinit.c diff -u xc/programs/xinit/xinit.c:3.26 xc/programs/xinit/xinit.c:3.31 --- xc/programs/xinit/xinit.c:3.26 Mon Apr 16 02:51:46 2001 +++ xc/programs/xinit/xinit.c Fri Dec 14 15:01:56 2001 @@ -1,10 +1,14 @@ -/* $Xorg: xinit.c,v 1.4 2000/08/17 19:54:30 cpqbld Exp $ */ +/* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */ /* Copyright 1986, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xinit/xinit.c,v 3.26 2001/04/16 06:51:46 torrey Exp $ */ +/* $XFree86: xc/programs/xinit/xinit.c,v 3.31 2001/12/14 20:01:56 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xos.h> @@ -47,9 +51,7 @@ #endif #include <errno.h> #include <setjmp.h> -#ifdef NeedVarargsPrototypes #include <stdarg.h> -#endif #if !defined(SIGCHLD) && defined(SIGCLD) #define SIGCHLD SIGCLD @@ -67,11 +69,7 @@ #define environ envsave #endif -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern char *getenv(); -#endif extern char **environ; char **newenviron = NULL; @@ -163,7 +161,7 @@ char *program; Display *xd; /* server connection */ #ifndef SYSV -#if defined(SVR4) || defined(_POSIX_SOURCE) || defined(CSRG_BASED) || defined(__EMX__) || defined(Lynx) +#if defined(__CYGWIN__) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(CSRG_BASED) || defined(__EMX__) || defined(Lynx) int status; #else union wait status; @@ -171,9 +169,8 @@ #endif /* SYSV */ int serverpid = -1; int clientpid = -1; - -#ifdef X_NOT_STDC_ENV -extern int errno; +#ifndef X_NOT_POSIX +volatile int gotSignal = 0; #endif static void Execute ( char **vec, char **envp ); @@ -194,16 +191,34 @@ #define SIGVAL void #endif +#ifdef X_NOT_POSIX +/* Can't use Error() in signal handlers */ +#ifndef STDERR_FILENO +#define WRITES(s) write(STDERR_FILENO, (s), strlen(s)) +#else +#define WRITES(s) write(fileno(stderr), (s), strlen(s)) +#endif +#endif + static SIGVAL sigCatch(int sig) { +#ifdef X_NOT_POSIX + char buf[1024]; + signal(SIGQUIT, SIG_IGN); signal(SIGINT, SIG_IGN); signal(SIGHUP, SIG_IGN); signal(SIGPIPE, SIG_IGN); - Error("unexpected signal %d\r\n", sig); + snprintf(buf, sizeof buf, "%s: unexpected signal %d\r\n", + program, sig); + WRITES(buf); shutdown(); - exit(1); + _exit(ERR_EXIT); +#else + /* On system with POSIX signals, just interrupt the system call */ + gotSignal = sig; +#endif } static SIGVAL @@ -252,6 +267,10 @@ int client_given = 0, server_given = 0; int client_args_given = 0, server_args_given = 0; int start_of_client_args, start_of_server_args; +#ifndef X_NOT_POSIX + struct sigaction sa; +#endif + #ifdef __EMX__ envsave = envp; /* circumvent an EMX problem */ @@ -411,16 +430,33 @@ #ifdef SIGCHLD signal(SIGCHLD, SIG_DFL); /* Insurance */ #endif +#ifdef X_NOT_POSIX signal(SIGQUIT, sigCatch); signal(SIGINT, sigCatch); signal(SIGHUP, sigCatch); signal(SIGPIPE, sigCatch); +#else + /* Let those signal interrupt the wait() call in the main loop */ + memset(&sa, 0, sizeof sa); + sa.sa_handler = sigCatch; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; /* do not set SA_RESTART */ + + sigaction(SIGQUIT, &sa, NULL); + sigaction(SIGINT, &sa, NULL); + sigaction(SIGHUP, &sa, NULL); + sigaction(SIGPIPE, &sa, NULL); +#endif signal(SIGALRM, sigAlarm); signal(SIGUSR1, sigUsr1); if (startServer(server) > 0 && startClient(client) > 0) { pid = -1; - while (pid != clientpid && pid != serverpid) + while (pid != clientpid && pid != serverpid +#ifndef X_NOT_POSIX + && gotSignal == 0 +#endif + ) pid = wait(NULL); } signal(SIGQUIT, SIG_IGN); @@ -429,7 +465,12 @@ signal(SIGPIPE, SIG_IGN); shutdown(); - +#ifndef X_NOT_POSIX + if (gotSignal != 0) { + Error("unexpected signal %d.\n", gotSignal); + exit(ERR_EXIT); + } +#endif if (serverpid < 0 ) Fatal("Server error.\n"); if (clientpid < 0) @@ -639,7 +680,7 @@ fprintf (stderr, "is in your path.\r\n"); fprintf (stderr, "\n"); - exit (ERR_EXIT); + _exit (ERR_EXIT); } return (clientpid); } Index: xc/programs/xinit/xinit.man diff -u xc/programs/xinit/xinit.man:3.9 xc/programs/xinit/xinit.man:3.10 --- xc/programs/xinit/xinit.man:3.9 Wed Feb 7 18:25:56 2001 +++ xc/programs/xinit/xinit.man Fri Dec 14 15:01:56 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xinit.man,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ +.\" $Xorg: xinit.man,v 1.4 2001/02/09 02:05:49 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xinit/xinit.man,v 3.9 2001/02/07 23:25:56 dawes Exp $ +.\" $XFree86: xc/programs/xinit/xinit.man,v 3.10 2001/12/14 20:01:56 dawes Exp $ .\" .TH XINIT 1 __xorgversion__ .SH NAME Index: xc/programs/xkbcomp/Imakefile diff -u xc/programs/xkbcomp/Imakefile:3.17 xc/programs/xkbcomp/Imakefile:3.18 --- xc/programs/xkbcomp/Imakefile:3.17 Sun Jan 21 16:19:40 2001 +++ xc/programs/xkbcomp/Imakefile Wed Oct 10 08:56:58 2001 @@ -3,11 +3,14 @@ -XCOMM $XFree86: xc/programs/xkbcomp/Imakefile,v 3.17 2001/01/21 21:19:40 tsi Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/Imakefile,v 3.18 2001/10/10 12:56:58 alanh Exp $ #define IHaveSubdirs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' +#if CrossCompiling + CROSS = cross +#endif SRCS = xkbcomp.c xkbscan.c expr.c vmod.c indicators.c misc.c \ keymap.c keycodes.c keytypes.c compat.c action.c alias.c \ symbols.c geometry.c xkbpath.c listing.c \ @@ -18,8 +21,8 @@ xkbparse.o parseutils.o utils.o DEPLIBS = $(DEPXKBFILELIB) $(DEPXLIBONLY) LOCAL_LIBRARIES = $(XKBFILELIB) $(XLIB) - SUBDIRS = compat geometry keycodes keymap semantics symbols types \ - compiled rules + SUBDIRS = $(CROSS) compat geometry keycodes keymap semantics symbols \ + types compiled rules ROOT_DEFINES = -DDFLT_XKB_CONFIG_ROOT=\"$(LIBDIR)/xkb\" @@ -30,7 +33,6 @@ SpecialCObjectRule(xkbpath,$(ICONFIGFILES),$(ROOT_DEFINES)) YaccFile(xkbparse,$(YFLAGS)) - install:: @echo "Creating $(LIBDIR)/xkb" Index: xc/programs/xkbcomp/geometry.c diff -u xc/programs/xkbcomp/geometry.c:1.1.1.6 xc/programs/xkbcomp/geometry.c:1.3 --- xc/programs/xkbcomp/geometry.c:1.1.1.6 Tue Jan 16 17:54:59 2001 +++ xc/programs/xkbcomp/geometry.c Wed Dec 19 16:30:30 2001 @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbcomp/geometry.c,v 1.3 2001/12/19 21:30:30 dawes Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -2598,13 +2599,8 @@ VarDef * var; if (def->common.stmtType==StmtIndicatorMapDef) { - IndicatorMapDef *imap= (IndicatorMapDef *)def; - Atom name= imap->name; - VarDef * body= imap->body; def->common.stmtType= StmtDoodadDef; def->type= XkbIndicatorDoodad; - def->name= name; - def->body= body; } InitDoodadInfo(&new,def->type,si,info); new.name= XkbInternAtom(info->dpy,XkbAtomGetString(NULL,def->name),False); @@ -3066,7 +3062,7 @@ return False; } } - if (di->defs.defined&_GD_Priority==0) { + if ((di->defs.defined & _GD_Priority) == 0) { /* calculate priority -- should be just above previous doodad/row */ } switch (di->type) { Index: xc/programs/xkbcomp/listing.c diff -u xc/programs/xkbcomp/listing.c:3.7 xc/programs/xkbcomp/listing.c:3.9 --- xc/programs/xkbcomp/listing.c:3.7 Wed Jan 17 18:45:44 2001 +++ xc/programs/xkbcomp/listing.c Fri Dec 14 15:01:57 2001 @@ -1,4 +1,4 @@ -/* $Xorg: listing.c,v 1.4 2000/08/17 19:54:32 cpqbld Exp $ */ +/* $Xorg: listing.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */ /************************************************************ Copyright 1996 by Silicon Graphics Computer Systems, Inc. @@ -28,7 +28,11 @@ Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -66,7 +70,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xkbcomp/listing.c,v 3.7 2001/01/17 23:45:44 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/listing.c,v 3.9 2001/12/14 20:01:57 dawes Exp $ */ #include <stdio.h> @@ -82,9 +86,7 @@ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR listingDebug #include "xkbcomp.h" -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE #include <limits.h> Index: xc/programs/xkbcomp/utils.c diff -u xc/programs/xkbcomp/utils.c:3.5 xc/programs/xkbcomp/utils.c:3.6 --- xc/programs/xkbcomp/utils.c:3.5 Wed Jan 17 18:45:45 2001 +++ xc/programs/xkbcomp/utils.c Wed Jul 25 11:05:24 2001 @@ -25,21 +25,13 @@ * 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 $ */ +/* $XFree86: xc/programs/xkbcomp/utils.c,v 3.6 2001/07/25 15:05:24 dawes Exp $ */ #include "utils.h" #include <ctype.h> +#include <stdlib.h> +#include <stdarg.h> -#ifndef X_NOT_STDC_ENV -#include <stdlib.h> -#else -char *malloc(); -#endif - -#if NeedVarargsPrototypes -#include <stdarg.h> -#endif - /***====================================================================***/ Opaque @@ -152,7 +144,6 @@ return(True); } -#if NeedVarargsPrototypes void uEntry(int l,char *s,...) { @@ -167,24 +158,7 @@ va_end(args); uEntryLevel+= l; } -#else -void -uEntry(l,s,a1,a2,a3,a4,a5,a6) -int l; -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ -int i; - for (i=0;i<uEntryLevel;i++) { - putc(' ',entryFile); - } - fprintf(entryFile,s,a1,a2,a3,a4,a5,a6); - uEntryLevel+= l; - return; -} -#endif - void #if NeedFunctionPrototypes uExit(int l,char *rtVal) @@ -234,7 +208,6 @@ return(True); } -#if NeedVarargsPrototypes void uDebug(char *s,...) { @@ -249,24 +222,7 @@ va_end(args); fflush(uDebugFile); } -#else -void -uDebug(s,a1,a2,a3,a4,a5,a6) -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ -int i; - - for (i=(uDebugIndentLevel*uDebugIndentSize);i>0;i--) { - putc(' ',uDebugFile); - } - fprintf(uDebugFile,s,a1,a2,a3,a4,a5,a6); - fflush(uDebugFile); - return; -} -#endif -#if NeedVarargsPrototypes void uDebugNOI(char *s,...) { @@ -277,17 +233,6 @@ va_end(args); fflush(uDebugFile); } -#else -void -uDebugNOI(s,a1,a2,a3,a4,a5,a6) -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ - fprintf(uDebugFile,s,a1,a2,a3,a4,a5,a6); - fflush(uDebugFile); - return; -} -#endif /***====================================================================***/ @@ -318,7 +263,6 @@ return(True); } -#if NeedVarargsPrototypes void uInformation(char *s, ...) { @@ -329,21 +273,9 @@ va_end(args); fflush(errorFile); } -#else -void -uInformation(s,a1,a2,a3,a4,a5,a6) -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6); - fflush(errorFile); - return; -} -#endif /***====================================================================***/ -#if NeedVarargsPrototypes void uAction(char *s, ...) { @@ -357,24 +289,9 @@ va_end(args); fflush(errorFile); } -#else -void -uAction(s,a1,a2,a3,a4,a5,a6) -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ - if (prefix!=NULL) - fprintf(errorFile,"%s",prefix); - fprintf(errorFile," "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6); - fflush(errorFile); - return; -} -#endif /***====================================================================***/ -#if NeedVarargsPrototypes void uWarning(char *s, ...) { @@ -391,27 +308,9 @@ fflush(errorFile); outCount++; } -#else -void -uWarning(s,a1,a2,a3,a4,a5,a6) -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ - if ((outCount==0)&&(preMsg!=NULL)) - fprintf(errorFile,"%s\n",preMsg); - if (prefix!=NULL) - fprintf(errorFile,"%s",prefix); - fprintf(errorFile,"Warning: "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6); - fflush(errorFile); - outCount++; - return; -} -#endif /***====================================================================***/ -#if NeedVarargsPrototypes void uError(char *s, ...) { @@ -428,27 +327,9 @@ fflush(errorFile); outCount++; } -#else -void -uError(s,a1,a2,a3,a4,a5,a6) -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ - if ((outCount==0)&&(preMsg!=NULL)) - fprintf(errorFile,"%s\n",preMsg); - if (prefix!=NULL) - fprintf(errorFile,"%s",prefix); - fprintf(errorFile,"Error: "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6); - fflush(errorFile); - outCount++; - return; -} -#endif /***====================================================================***/ -#if NeedVarargsPrototypes void uFatalError(char *s, ...) { @@ -468,29 +349,9 @@ exit(1); /* NOTREACHED */ } -#else -void -uFatalError(s,a1,a2,a3,a4,a5,a6) -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ - if ((outCount==0)&&(preMsg!=NULL)) - fprintf(errorFile,"%s\n",preMsg); - if (prefix!=NULL) - fprintf(errorFile,"%s",prefix); - fprintf(errorFile,"Fatal Error: "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6); - fprintf(errorFile," Exiting\n"); - fflush(errorFile); - outCount++; - exit(1); - /* NOTREACHED */ -} -#endif /***====================================================================***/ -#if NeedVarargsPrototypes void uInternalError(char *s, ...) { @@ -507,23 +368,6 @@ fflush(errorFile); outCount++; } -#else -void -uInternalError(s,a1,a2,a3,a4,a5,a6) -char *s; -Opaque a1,a2,a3,a4,a5,a6; -{ - if ((outCount==0)&&(preMsg!=NULL)) - fprintf(errorFile,"%s\n",preMsg); - if (prefix!=NULL) - fprintf(errorFile,"%s",prefix); - fprintf(errorFile,"Internal error: "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6); - fflush(errorFile); - outCount++; - return; -} -#endif void #if NeedFunctionPrototypes Index: xc/programs/xkbcomp/utils.h diff -u xc/programs/xkbcomp/utils.h:3.3 xc/programs/xkbcomp/utils.h:3.4 --- xc/programs/xkbcomp/utils.h:3.3 Wed Jan 17 18:45:45 2001 +++ xc/programs/xkbcomp/utils.h Wed Jul 25 11:05:24 2001 @@ -27,7 +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 $ */ +/* $XFree86: xc/programs/xkbcomp/utils.h,v 3.4 2001/07/25 15:05:24 dawes Exp $ */ /***====================================================================***/ @@ -36,9 +36,7 @@ #include <X11/Xfuncproto.h> #include <X11/Xfuncs.h> -#ifndef NULL -#define NULL 0 -#endif +#include <stddef.h> #ifndef NUL #define NUL '\0' Index: xc/programs/xkbcomp/xkbcomp.c diff -u xc/programs/xkbcomp/xkbcomp.c:3.14 xc/programs/xkbcomp/xkbcomp.c:3.15 --- xc/programs/xkbcomp/xkbcomp.c:3.14 Wed Jan 17 18:45:45 2001 +++ xc/programs/xkbcomp/xkbcomp.c Wed Jul 25 11:05:24 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbcomp.c,v 3.14 2001/01/17 23:45:45 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbcomp.c,v 3.15 2001/07/25 15:05:24 dawes Exp $ */ #include <stdio.h> #include <ctype.h> @@ -43,9 +43,7 @@ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags #include "xkbcomp.h" -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include "xkbpath.h" #include "parseutils.h" #include "misc.h" Index: xc/programs/xkbcomp/xkbcomp.h diff -u xc/programs/xkbcomp/xkbcomp.h:3.7 xc/programs/xkbcomp/xkbcomp.h:3.8 --- xc/programs/xkbcomp/xkbcomp.h:3.7 Wed Jan 17 18:45:45 2001 +++ xc/programs/xkbcomp/xkbcomp.h Wed Dec 19 16:30:30 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbcomp.h,v 3.7 2001/01/17 23:45:45 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbcomp.h,v 3.8 2001/12/19 21:30:30 dawes Exp $ */ #ifndef XKBCOMP_H #define XKBCOMP_H 1 @@ -228,14 +228,6 @@ VarDef *def; } InterpDef; -typedef struct _IndicatorMapDef { - ParseCommon common; - unsigned merge; - Atom name; - VarDef * body; - void * pad; /* so that sizeof(IndicatorMapDef) == sizeof(DoodadDef) */ -} IndicatorMapDef; - typedef struct _IndicatorNameDef { ParseCommon common; unsigned merge; @@ -301,6 +293,11 @@ Atom name; VarDef * body; } DoodadDef; + +/* IndicatorMapDef doesn't use the type field, but the rest of the fields + need to be at the same offsets as in DoodadDef. Use #define to avoid + any strict aliasing problems. */ +#define IndicatorMapDef DoodadDef typedef struct _XkbFile { ParseCommon common; Index: xc/programs/xkbcomp/xkbpath.c diff -u xc/programs/xkbcomp/xkbpath.c:3.4 xc/programs/xkbcomp/xkbpath.c:3.5 --- xc/programs/xkbcomp/xkbpath.c:3.4 Wed Jan 17 18:45:45 2001 +++ xc/programs/xkbcomp/xkbpath.c Wed Jul 25 11:05:24 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbpath.c,v 3.4 2001/01/17 23:45:45 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbpath.c,v 3.5 2001/07/25 15:05:24 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/XKBlib.h> @@ -32,9 +32,7 @@ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags #include "utils.h" -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include <X11/extensions/XKM.h> #include "xkbpath.h" Index: xc/programs/xkbcomp/cross/Imakefile diff -u /dev/null xc/programs/xkbcomp/cross/Imakefile:1.2 --- /dev/null Fri Jan 18 15:27:24 2002 +++ xc/programs/xkbcomp/cross/Imakefile Wed Oct 10 09:19:06 2001 @@ -0,0 +1,46 @@ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/cross/Imakefile,v 1.2 2001/10/10 13:19:06 alanh Exp $ + +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' + + SRCS = xkbcomp.c xkbscan.c expr.c vmod.c indicators.c misc.c \ + keymap.c keycodes.c keytypes.c compat.c action.c alias.c \ + symbols.c geometry.c xkbpath.c listing.c \ + xkbparse.c parseutils.c utils.c + OBJS = xkbcomp.o xkbscan.o expr.o vmod.o indicators.o misc.o alias.o \ + keymap.o keycodes.o keytypes.o compat.o action.o \ + symbols.o geometry.o xkbpath.o listing.o \ + xkbparse.o parseutils.o utils.o + DEPLIBS = $(DEPXKBFILELIB) $(DEPXLIBONLY) +XCOMM Assumes local libraries installed in /usr/X11R6/lib +LOCAL_LIBRARIES = -L/usr/X11R6/lib $(XKBFILELIB) $(XLIB) + +ROOT_DEFINES = -DDFLT_XKB_CONFIG_ROOT=\"$(LIBDIR)/xkb\" + +INCLUDES = -I.. -I$(EXTINCSRC) + +YaccFile(xkbparse,$(YFLAGS)) + +all:: + +ComplexHostProgramTarget(xkbcomp) + +LinkSourceFile(action.c,..) +LinkSourceFile(alias.c,..) +LinkSourceFile(compat.c,..) +LinkSourceFile(expr.c,..) +LinkSourceFile(geometry.c,..) +LinkSourceFile(indicators.c,..) +LinkSourceFile(keycodes.c,..) +LinkSourceFile(keymap.c,..) +LinkSourceFile(keytypes.c,..) +LinkSourceFile(listing.c,..) +LinkSourceFile(misc.c,..) +LinkSourceFile(parseutils.c,..) +LinkSourceFile(symbols.c,..) +LinkSourceFile(utils.c,..) +LinkSourceFile(vmod.c,..) +LinkSourceFile(xkbcomp.c,..) +LinkSourceFile(xkbpath.c,..) +LinkSourceFile(xkbscan.c,..) +LinkSourceFile(xkbparse.y,..) Index: xc/programs/xkbcomp/geometry/dell diff -u xc/programs/xkbcomp/geometry/dell:3.4 xc/programs/xkbcomp/geometry/dell:3.5 --- xc/programs/xkbcomp/geometry/dell:3.4 Wed Jan 17 18:45:49 2001 +++ xc/programs/xkbcomp/geometry/dell Fri Dec 14 15:01:57 2001 @@ -1,8 +1,12 @@ -// $Xorg: dell,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ +// $Xorg: dell,v 1.4 2001/02/09 02:05:49 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/geometry/fujitsu diff -u xc/programs/xkbcomp/geometry/fujitsu:1.1.1.3 xc/programs/xkbcomp/geometry/fujitsu:1.2 --- xc/programs/xkbcomp/geometry/fujitsu:1.1.1.3 Tue Jan 16 17:57:45 2001 +++ xc/programs/xkbcomp/geometry/fujitsu Fri Dec 14 15:01:57 2001 @@ -1,8 +1,12 @@ -// $Xorg: fujitsu,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ +// $Xorg: fujitsu,v 1.4 2001/02/09 02:05:49 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/geometry/hp diff -u xc/programs/xkbcomp/geometry/hp:1.4 xc/programs/xkbcomp/geometry/hp:1.5 --- xc/programs/xkbcomp/geometry/hp:1.4 Wed Jan 17 18:45:49 2001 +++ xc/programs/xkbcomp/geometry/hp Fri Dec 14 15:01:58 2001 @@ -1,8 +1,12 @@ -// $Xorg: hp,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ +// $Xorg: hp,v 1.4 2001/02/09 02:05:50 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/geometry/keytronic diff -u xc/programs/xkbcomp/geometry/keytronic:1.1.1.4 xc/programs/xkbcomp/geometry/keytronic:1.2 --- xc/programs/xkbcomp/geometry/keytronic:1.1.1.4 Tue Jan 16 17:57:49 2001 +++ xc/programs/xkbcomp/geometry/keytronic Fri Dec 14 15:01:58 2001 @@ -1,8 +1,12 @@ -// $Xorg: keytronic,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ +// $Xorg: keytronic,v 1.4 2001/02/09 02:05:50 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/geometry/nec diff -u xc/programs/xkbcomp/geometry/nec:3.4 xc/programs/xkbcomp/geometry/nec:3.5 --- xc/programs/xkbcomp/geometry/nec:3.4 Wed Jan 17 18:45:49 2001 +++ xc/programs/xkbcomp/geometry/nec Fri Dec 14 15:01:58 2001 @@ -1,8 +1,12 @@ -// $Xorg: nec,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ +// $Xorg: nec,v 1.4 2001/02/09 02:05:50 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/geometry/nec,v 3.4 2001/01/17 23:45:49 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/geometry/nec,v 3.5 2001/12/14 20:01:58 dawes Exp $ default xkb_geometry "pc98" { Index: xc/programs/xkbcomp/geometry/pc diff -u xc/programs/xkbcomp/geometry/pc:3.10 xc/programs/xkbcomp/geometry/pc:3.11 --- xc/programs/xkbcomp/geometry/pc:3.10 Wed Jan 17 18:45:49 2001 +++ xc/programs/xkbcomp/geometry/pc Fri Dec 14 15:01:58 2001 @@ -1,8 +1,12 @@ -// $Xorg: pc,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ +// $Xorg: pc,v 1.4 2001/02/09 02:05:50 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/geometry/pc,v 3.10 2001/01/17 23:45:49 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/geometry/pc,v 3.11 2001/12/14 20:01:58 dawes Exp $ default xkb_geometry "pc101" { Index: xc/programs/xkbcomp/geometry/sony diff -u xc/programs/xkbcomp/geometry/sony:1.1.1.3 xc/programs/xkbcomp/geometry/sony:1.2 --- xc/programs/xkbcomp/geometry/sony:1.1.1.3 Tue Jan 16 17:58:00 2001 +++ xc/programs/xkbcomp/geometry/sony Fri Dec 14 15:01:58 2001 @@ -1,8 +1,12 @@ -// $Xorg: sony,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ +// $Xorg: sony,v 1.4 2001/02/09 02:05:51 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/geometry/sun diff -u xc/programs/xkbcomp/geometry/sun:1.5 xc/programs/xkbcomp/geometry/sun:1.6 --- xc/programs/xkbcomp/geometry/sun:1.5 Wed Jan 17 18:45:49 2001 +++ xc/programs/xkbcomp/geometry/sun Fri Dec 14 15:01:58 2001 @@ -1,8 +1,12 @@ -// $Xorg: sun,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ +// $Xorg: sun,v 1.4 2001/02/09 02:05:51 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/geometry/sun,v 1.5 2001/01/17 23:45:49 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/geometry/sun,v 1.6 2001/12/14 20:01:58 dawes Exp $ // xkb_geometry "type4" { Index: xc/programs/xkbcomp/keycodes/Imakefile diff -u xc/programs/xkbcomp/keycodes/Imakefile:3.12 xc/programs/xkbcomp/keycodes/Imakefile:3.14 --- xc/programs/xkbcomp/keycodes/Imakefile:3.12 Sun Jan 21 16:19:40 2001 +++ xc/programs/xkbcomp/keycodes/Imakefile Sat Sep 29 16:42:07 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xkbcomp/keycodes/Imakefile,v 3.12 2001/01/21 21:19:40 tsi Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/keycodes/Imakefile,v 3.14 2001/09/29 20:42:07 herrb Exp $ #define IHaveSubdirs Index: xc/programs/xkbcomp/keycodes/fujitsu diff -u xc/programs/xkbcomp/keycodes/fujitsu:1.1.1.3 xc/programs/xkbcomp/keycodes/fujitsu:1.2 --- xc/programs/xkbcomp/keycodes/fujitsu:1.1.1.3 Tue Jan 16 17:58:27 2001 +++ xc/programs/xkbcomp/keycodes/fujitsu Fri Dec 14 15:01:59 2001 @@ -1,8 +1,12 @@ -// $Xorg: fujitsu,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ +// $Xorg: fujitsu,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/keycodes/hp diff -u xc/programs/xkbcomp/keycodes/hp:1.4 xc/programs/xkbcomp/keycodes/hp:1.5 --- xc/programs/xkbcomp/keycodes/hp:1.4 Wed Jan 17 18:45:51 2001 +++ xc/programs/xkbcomp/keycodes/hp Fri Dec 14 15:02:00 2001 @@ -1,8 +1,12 @@ -// $Xorg: hp,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ +// $Xorg: hp,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/keycodes/ibm diff -u xc/programs/xkbcomp/keycodes/ibm:1.1.1.5 xc/programs/xkbcomp/keycodes/ibm:1.2 --- xc/programs/xkbcomp/keycodes/ibm:1.1.1.5 Tue Jan 16 17:58:31 2001 +++ xc/programs/xkbcomp/keycodes/ibm Fri Dec 14 15:02:00 2001 @@ -1,8 +1,12 @@ -// $Xorg: ibm,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ +// $Xorg: ibm,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/keycodes/macintosh diff -u xc/programs/xkbcomp/keycodes/macintosh:1.3 xc/programs/xkbcomp/keycodes/macintosh:1.5 --- xc/programs/xkbcomp/keycodes/macintosh:1.3 Tue Sep 19 08:46:23 2000 +++ xc/programs/xkbcomp/keycodes/macintosh Wed Oct 3 03:44:22 2001 @@ -26,7 +26,7 @@ //other dealings in this Software without prior written authorization //from the X Consortium. // -// $XFree86: xc/programs/xkbcomp/keycodes/macintosh,v 1.3 2000/09/19 12:46:23 eich Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/macintosh,v 1.5 2001/10/03 07:44:22 alanh Exp $ // default xkb_keycodes "macintosh" { Index: xc/programs/xkbcomp/keycodes/sony diff -u xc/programs/xkbcomp/keycodes/sony:1.1.1.3 xc/programs/xkbcomp/keycodes/sony:1.2 --- xc/programs/xkbcomp/keycodes/sony:1.1.1.3 Tue Jan 16 17:58:33 2001 +++ xc/programs/xkbcomp/keycodes/sony Fri Dec 14 15:02:00 2001 @@ -1,8 +1,12 @@ -// $Xorg: sony,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ +// $Xorg: sony,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/keycodes/sun diff -u xc/programs/xkbcomp/keycodes/sun:3.4 xc/programs/xkbcomp/keycodes/sun:3.5 --- xc/programs/xkbcomp/keycodes/sun:3.4 Wed Jan 17 18:45:51 2001 +++ xc/programs/xkbcomp/keycodes/sun Fri Dec 14 15:02:00 2001 @@ -1,8 +1,12 @@ -// $Xorg: sun,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ +// $Xorg: sun,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keycodes/sun,v 3.4 2001/01/17 23:45:51 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/sun,v 3.5 2001/12/14 20:02:00 dawes Exp $ // default xkb_keycodes "type4" { Index: xc/programs/xkbcomp/keycodes/xfree86 diff -u xc/programs/xkbcomp/keycodes/xfree86:3.16 xc/programs/xkbcomp/keycodes/xfree86:3.17 --- xc/programs/xkbcomp/keycodes/xfree86:3.16 Thu Mar 8 16:25:15 2001 +++ xc/programs/xkbcomp/keycodes/xfree86 Fri Nov 30 07:12:04 2001 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/keycodes/xfree86,v 3.16 2001/03/08 21:25:15 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/xfree86,v 3.17 2001/11/30 12:12:04 eich Exp $ // "standard" XFree86 codes // It seems that the "default" must be the first entry in the file. @@ -352,6 +352,7 @@ xkb_keycodes "abnt2" { include "xfree86(basic)" <BKSL> = 94; + <AC12> = 51; }; Index: xc/programs/xkbcomp/keycodes/xfree98 diff -u xc/programs/xkbcomp/keycodes/xfree98:3.6 xc/programs/xkbcomp/keycodes/xfree98:3.7 --- xc/programs/xkbcomp/keycodes/xfree98:3.6 Wed Jan 17 18:45:51 2001 +++ xc/programs/xkbcomp/keycodes/xfree98 Fri Dec 14 15:02:00 2001 @@ -1,8 +1,12 @@ -// $Xorg: xfree98,v 1.3 2000/08/17 19:54:38 cpqbld Exp $ +// $Xorg: xfree98,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keycodes/xfree98,v 3.6 2001/01/17 23:45:51 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/xfree98,v 3.7 2001/12/14 20:02:00 dawes Exp $ // default xkb_keycodes "pc98" { Index: xc/programs/xkbcomp/keymap/sony diff -u xc/programs/xkbcomp/keymap/sony:3.3 xc/programs/xkbcomp/keymap/sony:3.4 --- xc/programs/xkbcomp/keymap/sony:3.3 Wed Jan 17 18:45:53 2001 +++ xc/programs/xkbcomp/keymap/sony Fri Dec 14 15:02:01 2001 @@ -1,8 +1,12 @@ -// $Xorg: sony,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ +// $Xorg: sony,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/keymap/xfree86 diff -u xc/programs/xkbcomp/keymap/xfree86:3.20.2.2 xc/programs/xkbcomp/keymap/xfree86:3.26 --- xc/programs/xkbcomp/keymap/xfree86:3.20.2.2 Fri May 25 14:50:14 2001 +++ xc/programs/xkbcomp/keymap/xfree86 Wed Jan 16 13:20:11 2002 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/keymap/xfree86,v 3.20.2.2 2001/05/25 18:50:14 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/xfree86,v 3.26 2002/01/16 18:20:11 dawes Exp $ default xkb_keymap "us" { xkb_keycodes { include "xfree86" }; @@ -124,13 +124,6 @@ xkb_symbols { include "en_US(pc105)+lt_std" }; xkb_geometry { include "pc(pc102)" }; }; -xkb_keymap "lt_p" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+lt_p" }; - xkb_geometry { include "pc(pc102)" }; -}; xkb_keymap "lv" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -145,6 +138,20 @@ xkb_symbols { include "en_US(pc105)+mk" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "mt" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+mt" }; + xkb_geometry { include "pc(pc102)" }; +}; +xkb_keymap "mt_us" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+mt_us" }; + xkb_geometry { include "pc(pc102)" }; +}; xkb_keymap "no" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -321,5 +328,13 @@ xkb_types { include "default" }; xkb_compatibility { include "default" }; xkb_symbols { include "en_US(pc105)+tr" }; + xkb_geometry { include "pc(pc102)" }; +}; +// Additions by Arabeyes Team, <support@arabeyes.org> +xkb_keymap "ar" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+ar" }; xkb_geometry { include "pc(pc102)" }; }; Index: xc/programs/xkbcomp/keymap/xfree98 diff -u xc/programs/xkbcomp/keymap/xfree98:3.6 xc/programs/xkbcomp/keymap/xfree98:3.7 --- xc/programs/xkbcomp/keymap/xfree98:3.6 Wed Jan 17 18:45:53 2001 +++ xc/programs/xkbcomp/keymap/xfree98 Fri Dec 14 15:02:01 2001 @@ -1,8 +1,12 @@ -// $Xorg: xfree98,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ +// $Xorg: xfree98,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/xfree98,v 3.6 2001/01/17 23:45:53 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/xfree98,v 3.7 2001/12/14 20:02:01 dawes Exp $ default xkb_keymap "jp" { xkb_keycodes { include "xfree98" }; Index: xc/programs/xkbcomp/keymap/sun/de diff -u xc/programs/xkbcomp/keymap/sun/de:3.4 xc/programs/xkbcomp/keymap/sun/de:3.5 --- xc/programs/xkbcomp/keymap/sun/de:3.4 Wed Jan 17 18:45:56 2001 +++ xc/programs/xkbcomp/keymap/sun/de Fri Dec 14 15:02:01 2001 @@ -1,8 +1,12 @@ -// $Xorg: de,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ +// $Xorg: de,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/keymap/sun/es diff -u xc/programs/xkbcomp/keymap/sun/es:1.2 xc/programs/xkbcomp/keymap/sun/es:1.3 --- xc/programs/xkbcomp/keymap/sun/es:1.2 Fri Oct 27 20:34:05 2000 +++ xc/programs/xkbcomp/keymap/sun/es Fri Dec 14 15:02:01 2001 @@ -2,7 +2,11 @@ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/sun/es,v 1.2 2000/10/28 00:34:05 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/sun/es,v 1.3 2001/12/14 20:02:01 dawes Exp $ // xkb_keymap "type4_es" { xkb_keycodes { include "sun(type4_euro)" }; Index: xc/programs/xkbcomp/keymap/sun/fi diff -u xc/programs/xkbcomp/keymap/sun/fi:1.2 xc/programs/xkbcomp/keymap/sun/fi:1.3 --- xc/programs/xkbcomp/keymap/sun/fi:1.2 Fri Oct 27 20:34:05 2000 +++ xc/programs/xkbcomp/keymap/sun/fi Fri Dec 14 15:02:02 2001 @@ -2,7 +2,11 @@ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/sun/fi,v 1.2 2000/10/28 00:34:05 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/sun/fi,v 1.3 2001/12/14 20:02:02 dawes Exp $ // xkb_keymap "type4_fi" { xkb_keycodes { include "sun(type4_euro)" }; Index: xc/programs/xkbcomp/keymap/sun/fr diff -u xc/programs/xkbcomp/keymap/sun/fr:1.2 xc/programs/xkbcomp/keymap/sun/fr:1.3 --- xc/programs/xkbcomp/keymap/sun/fr:1.2 Fri Oct 27 20:34:05 2000 +++ xc/programs/xkbcomp/keymap/sun/fr Fri Dec 14 15:02:02 2001 @@ -2,7 +2,11 @@ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/sun/fr,v 1.2 2000/10/28 00:34:05 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/sun/fr,v 1.3 2001/12/14 20:02:02 dawes Exp $ // xkb_keymap "type4_fr" { xkb_keycodes { include "sun(type4_euro)" }; Index: xc/programs/xkbcomp/keymap/sun/no diff -u xc/programs/xkbcomp/keymap/sun/no:1.2 xc/programs/xkbcomp/keymap/sun/no:1.3 --- xc/programs/xkbcomp/keymap/sun/no:1.2 Fri Oct 27 20:34:05 2000 +++ xc/programs/xkbcomp/keymap/sun/no Fri Dec 14 15:02:02 2001 @@ -2,7 +2,11 @@ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/sun/no,v 1.2 2000/10/28 00:34:05 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/sun/no,v 1.3 2001/12/14 20:02:02 dawes Exp $ // xkb_keymap "type4_no" { xkb_keycodes { include "sun(type4_euro)" }; Index: xc/programs/xkbcomp/keymap/sun/pl diff -u xc/programs/xkbcomp/keymap/sun/pl:1.2 xc/programs/xkbcomp/keymap/sun/pl:1.3 --- xc/programs/xkbcomp/keymap/sun/pl:1.2 Fri Oct 27 20:34:05 2000 +++ xc/programs/xkbcomp/keymap/sun/pl Fri Dec 14 15:02:02 2001 @@ -2,7 +2,11 @@ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/sun/pl,v 1.2 2000/10/28 00:34:05 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/sun/pl,v 1.3 2001/12/14 20:02:02 dawes Exp $ // xkb_keymap "type4_pl" { xkb_keycodes { include "sun(type4_euro)" }; Index: xc/programs/xkbcomp/keymap/sun/ru diff -u xc/programs/xkbcomp/keymap/sun/ru:1.2 xc/programs/xkbcomp/keymap/sun/ru:1.3 --- xc/programs/xkbcomp/keymap/sun/ru:1.2 Fri Oct 27 20:34:05 2000 +++ xc/programs/xkbcomp/keymap/sun/ru Fri Dec 14 15:02:02 2001 @@ -2,7 +2,11 @@ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/sun/ru,v 1.2 2000/10/28 00:34:05 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/sun/ru,v 1.3 2001/12/14 20:02:02 dawes Exp $ // xkb_keymap "type4_ru" { xkb_keycodes { include "sun(type4_euro)" }; Index: xc/programs/xkbcomp/keymap/sun/uk diff -u xc/programs/xkbcomp/keymap/sun/uk:1.2 xc/programs/xkbcomp/keymap/sun/uk:1.3 --- xc/programs/xkbcomp/keymap/sun/uk:1.2 Fri Oct 27 20:34:05 2000 +++ xc/programs/xkbcomp/keymap/sun/uk Fri Dec 14 15:02:02 2001 @@ -2,7 +2,11 @@ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/sun/uk,v 1.2 2000/10/28 00:34:05 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/sun/uk,v 1.3 2001/12/14 20:02:02 dawes Exp $ // xkb_keymap "type4_uk" { xkb_keycodes { include "sun(type4_euro)" }; Index: xc/programs/xkbcomp/keymap/sun/us diff -u xc/programs/xkbcomp/keymap/sun/us:3.3 xc/programs/xkbcomp/keymap/sun/us:3.4 --- xc/programs/xkbcomp/keymap/sun/us:3.3 Wed Jan 17 18:45:56 2001 +++ xc/programs/xkbcomp/keymap/sun/us Fri Dec 14 15:02:02 2001 @@ -1,8 +1,12 @@ -// $Xorg: us,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ +// $Xorg: us,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/rules/sgi.lst diff -u xc/programs/xkbcomp/rules/sgi.lst:3.6.2.1 xc/programs/xkbcomp/rules/sgi.lst:3.7 --- xc/programs/xkbcomp/rules/sgi.lst:3.6.2.1 Wed May 23 14:32:19 2001 +++ xc/programs/xkbcomp/rules/sgi.lst Wed May 23 12:03:51 2001 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/rules/sgi.lst,v 3.6.2.1 2001/05/23 18:32:19 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/rules/sgi.lst,v 3.7 2001/05/23 16:03:51 dawes Exp $ ! model indy SGI O2, Indigo^2 or Indy Index: xc/programs/xkbcomp/rules/sun.lst diff -u xc/programs/xkbcomp/rules/sun.lst:3.4.2.1 xc/programs/xkbcomp/rules/sun.lst:3.5 --- xc/programs/xkbcomp/rules/sun.lst:3.4.2.1 Wed May 23 14:32:19 2001 +++ xc/programs/xkbcomp/rules/sun.lst Wed May 23 12:03:51 2001 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/rules/sun.lst,v 3.4.2.1 2001/05/23 18:32:19 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/rules/sun.lst,v 3.5 2001/05/23 16:03:51 dawes Exp $ ! model type4 Sun Type4 Index: xc/programs/xkbcomp/rules/xfree86 diff -u xc/programs/xkbcomp/rules/xfree86:3.33 xc/programs/xkbcomp/rules/xfree86:3.41 --- xc/programs/xkbcomp/rules/xfree86:3.33 Thu Apr 5 22:16:25 2001 +++ xc/programs/xkbcomp/rules/xfree86 Fri Dec 28 11:03:30 2001 @@ -4,7 +4,7 @@ // Rules for resolving XKB components for use with XFree86 // Copyright 1996 by Joseph Moss // -// $XFree86: xc/programs/xkbcomp/rules/xfree86,v 3.33 2001/04/06 02:16:25 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/rules/xfree86,v 3.41 2001/12/28 16:03:30 dawes Exp $ // ! model = keycodes geometry @@ -23,6 +23,7 @@ abnt2 = xfree86(abnt2) pc hp = xfree86 pc(pc104) itouch = xfree86 pc(pc104) + logiinetnav = xfree86 pc(pc104) logicordless = xfree86 pc(pc104) logiinternet = xfree86 pc(pc104) compaq = xfree86 pc(pc104) @@ -32,6 +33,7 @@ rapidaccess = xfree86 pc(pc104) rapidaccess2 = xfree86 pc(pc104) chicony = xfree86 pc(pc104) + dell = xfree86 pc(pc104) macintosh = xfree86 macintosh(macintosh) macintosh_old = macintosh macintosh(macintosh) powerpcps2 = powerpcps2 pc(pc104) @@ -92,6 +94,9 @@ itouch us = us(pc104)+inet(itouch) itouch en_US = en_US(pc104)+inet(itouch) itouch * = en_US(pc104)+inet(itouch)+%l%(v) + logiinetnav us = us(pc104)+inet(logiinetnav) + logiinetnav en_US = en_US(pc104)+inet(logiinetnav) + logiinetnav * = en_US(pc104)+inet(logiinetnav)+%l%(v) logicordless us = us(pc104)+inet(logicordless) logicordless en_US = en_US(pc104)+inet(logicordless) logicordless * = en_US(pc104)+inet(logicordless)+%l%(v) @@ -116,6 +121,9 @@ chicony us = us(pc104)+inet(chicony) chicony en_US = en_US(pc104)+inet(chicony) chicony * = en_US(pc104)+inet(chicony)+%l%(v) + dell us = us(pc104)+inet(dell) + dell en_US = en_US(pc104)+inet(dell) + dell * = en_US(pc104)+inet(dell)+%l%(v) macintosh us = macintosh/us(extended) macintosh en_US = macintosh/us(extended) macintosh * = macintosh/us(extended)+macintosh/%l%(v) @@ -137,6 +145,9 @@ ! option = symbols grp:switch = +group(switch) + grp:win_switch = +group(win_switch) + grp:lwin_switch = +group(lwin_switch) + grp:rwin_switch = +group(rwin_switch) grp:toggle = +group(toggle) grp:shift_toggle = +group(shift_toggle) grp:ctrl_shift_toggle = +group(ctrl_shift_toggle) @@ -144,13 +155,34 @@ grp:ctrl_alt_toggle = +group(ctrl_alt_toggle) grp:alt_shift_toggle = +group(alt_shift_toggle) grp:menu_toggle = +group(menu_toggle) + grp:lwin_toggle = +group(lwin_toggle) + grp:rwin_toggle = +group(rwin_toggle) + lv3:switch = +level3(switch) + lv3:menu_switch = +level3(menu_switch) + lv3:win_switch = +level3(win_switch) + lv3:lwin_switch = +level3(lwin_switch) + lv3:rwin_switch = +level3(rwin_switch) ctrl:nocaps = +ctrl(nocaps) ctrl:swapcaps = +ctrl(swapcaps) ctrl:ctrl_ac = +ctrl(ctrl_ac) ctrl:ctrl_aa = +ctrl(ctrl_aa) + altwin:menu = +altwin(menu) + altwin:meta_alt = +altwin(meta_alt) + altwin:meta_win = +altwin(meta_win) + altwin:left_meta_win = +altwin(left_meta_win) + altwin:super_win = +altwin(super_win) + altwin:hyper_win = +altwin(hyper_win) + compose:ralt = +compose(ralt) + compose:rwin = +compose(rwin) + compose:menu = +compose(menu) ! option = compat grp_led:num = +leds(num) grp_led:caps = +leds(caps) grp_led:scroll = +leds(scroll) +! option = types + caps:internal = +caps(internal) + caps:internal_nocancel = +caps(internal_nocancel) + caps:shift = +caps(shift) + caps:shift_nocancel = +caps(shift_nocancel) Index: xc/programs/xkbcomp/rules/xfree86.lst diff -u xc/programs/xkbcomp/rules/xfree86.lst:3.30.2.2 xc/programs/xkbcomp/rules/xfree86.lst:3.42 --- xc/programs/xkbcomp/rules/xfree86.lst:3.30.2.2 Fri May 25 14:50:14 2001 +++ xc/programs/xkbcomp/rules/xfree86.lst Wed Jan 16 13:20:12 2002 @@ -4,7 +4,7 @@ // Rules descriptions for XFree86 // Copyright 1996 by Joseph Moss // -// $XFree86: xc/programs/xkbcomp/rules/xfree86.lst,v 3.30.2.2 2001/05/25 18:50:14 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/rules/xfree86.lst,v 3.42 2002/01/16 18:20:12 dawes Exp $ ! model pc101 Generic 101-key PC @@ -24,63 +24,94 @@ itouch Logitech iTouch logicordless Logitech Cordless Desktop Pro logiinternet Logitech Internet Keyboard + logiinetnav Logitech Internet Navigator 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 + dell Dell Internet Keyboard + +// The entries here should be ordered as follows: +// +// US entries first +// others in alphabetical order by the language/country name in English + ! layout us U.S. English - en_US U.S. English w/ISO9995-3 + en_US U.S. English w/ ISO9995-3 us_intl U.S. English w/ deadkeys + al Albanian + ar Arabic am Armenian az Azerbaidjani by Belarusian be Belgian + ben Bengali br Brazilian bg Bulgarian + mm Burmese ca Canadian + hr Croatian cz Czech cz_qwerty Czech (qwerty) dk Danish + nl Dutch dvorak Dvorak ee Estonian fi Finnish fr French fr_CH Swiss French + ge_la Georgian (latin) + ge_ru Georgian (russian) de German de_CH Swiss German el Greek - hr Croatian + guj Gujarati + gur Gurmukhi + dev Hindi hu Hungarian is Icelandic + iu Inuktitut + ir Iranian il Israeli it Italian jp Japanese + la Latin America lt Lithuanian qwerty "numeric" lt_std Lithuanian azerty standard - lt_p Lithuanian qwerty "programmer's" lv Latvian mk Macedonian + mt Maltese + mt_us Maltese (US layout) no Norwegian pl Polish + pl2 Polish (qwertz) pt Portuguese ro Romanian ru Russian + ru_yawerty Russian (cyrillic phonetic) + se_FI Northern Saami (Finland) + se_NO Northern Saami (Norway) + se_SE Northern Saami (Sweden) sr Serbian si Slovenian sk Slovak sk_qwerty Slovak (qwerty) es Spanish se Swedish + tj Tajik + tml Tamil th Thai + tr Turkish + tr_f Turkish (F) ua Ukrainian gb United Kingdom vn Vietnamese + yu Yugoslavian nec/jp PC-98xx Series - tr Turkish ! variant nodeadkeys Eliminate dead keys @@ -88,13 +119,24 @@ ! option grp Group Shift/Lock behavior grp:switch R-Alt switches group while pressed + grp:lwin_switch Left Win-key switches group while pressed + grp:rwin_switch Right Win-key switches group while pressed + grp:win_switch Both Win-keys switch group while pressed grp:toggle Right Alt key changes group grp:caps_toggle Caps Lock key changes group grp:menu_toggle Menu key changes group + grp:lwin_toggle Left Win-key changes group + grp:rwin_toggle Right Win-key changes group grp:shift_toggle Both Shift keys together change group grp:ctrl_shift_toggle Control+Shift changes group grp:ctrl_alt_toggle Alt+Control changes group grp:alt_shift_toggle Alt+Shift changes group + lv3 Third level choosers + lv3:switch Press Right Control to choose 3rd level + lv3:menu_switch Press Menu key to choose 3rd level + lv3:win_switch Press any of Win-keys to choose 3rd level + lv3:lwin_switch Press Left Win-key to choose 3rd level + lv3:rwin_switch Press Right Win-key to choose 3rd level ctrl Control Key Position ctrl:nocaps Make CapsLock an additional Control ctrl:swapcaps Swap Control and Caps Lock @@ -104,4 +146,20 @@ grp_led:num Num_Lock LED shows alternative group grp_led:caps Caps_Lock LED shows alternative group grp_led:scroll Scroll_Lock LED shows alternative group + caps CapsLock key behavior + caps:internal uses internal capitalization. Shift cancels Caps. + caps:internal_nocancel uses internal capitalization. Shift doesn't cancel Cap$ + caps:shift acts as Shift with locking. Shift cancels Caps. + caps:shift_nocancel acts as Shift with locking. Shift doesn't cancel Caps. + + altwin Alt/Win key behavior + altwin:menu Add the standard behavior to Menu key. + altwin:meta_alt Alt and Meta on the Alt keys (default). + altwin:meta_win Meta is mapped to the Win-keys. + altwin:left_meta_win Meta is mapped to the left Win-key. + altwin:meta_super Super is mapped to the Win-keys (default). + altwin:meta_hyper Hyper is mapped to the Win-keys. + compose:ralt Right Alt is Compose + compose:rwin Right Win-key is Compose + compose:menu Menu is Compose Index: xc/programs/xkbcomp/symbols/Imakefile diff -u xc/programs/xkbcomp/symbols/Imakefile:3.38.2.1 xc/programs/xkbcomp/symbols/Imakefile:3.45 --- xc/programs/xkbcomp/symbols/Imakefile:3.38.2.1 Wed May 23 16:21:53 2001 +++ xc/programs/xkbcomp/symbols/Imakefile Wed Jan 16 13:20:12 2002 @@ -3,18 +3,34 @@ -XCOMM $XFree86: xc/programs/xkbcomp/symbols/Imakefile,v 3.38.2.1 2001/05/23 20:21:53 dawes Exp $ +XCOMM $XFree86: xc/programs/xkbcomp/symbols/Imakefile,v 3.45 2002/01/16 18:20:12 dawes Exp $ #define IHaveSubdirs TESTDATA = - 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 sk sk_qwerty sr th ua us us_intl \ - us_group3 vn tr + DATAFILES = al altwin am ar az \ + be ben bg br by \ + ca ca_enhanced compose ctrl \ + czsk cz cz_qwerty \ + de de_CH dev dk dvorak \ + ee el en_US es \ + fi fr fr_CH \ + gb ge_la ge_ru group guj gur \ + hu hu_US hr \ + il il_phonetic iso9995-3 inet ir is it iu \ + jp \ + keypad \ + la level3 lock lt lt_std lv \ + mk mm mt mt_us \ + nl no \ + pc104 pl pl2 pt \ + ralt ro ru ru_yawerty \ + sapmi se se_FI se_NO se_SE si sk sk_qwerty sr \ + th tj tml tr tr_f \ + ua us us_intl us_group2 us_group3 \ + vn \ + yu + SUBDIRS = digital fujitsu hp macintosh nec sgi sony sun xfree68 MakeXkbDir($(LIBDIR)/xkb,symbols) Index: xc/programs/xkbcomp/symbols/al diff -u /dev/null xc/programs/xkbcomp/symbols/al:1.1 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/al Wed Nov 21 17:28:52 2001 @@ -0,0 +1,108 @@ + +// albanian keyboard layout +// done by Pablo Saratxaga <pablo@mandrakesoft.com> +// +// it seems the grave on AltGr-7 is not a dead key, I put a dead_grave +// in AltGr-Shift-7 for convenience + +partial hidden alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + name[Group1]= "Albanian"; + key <ESC> { [ Escape ] }; + + // Alphanumeric section + key <TLDE> { [ backslash, bar ] }; + key <AE01> { [ 1, exclam ], + [ asciitilde, dead_tilde ] }; + key <AE02> { [ 2, quotedbl ], + [ dead_caron ] }; + key <AE03> { [ 3, numbersign ], + [ dead_circumflex ] }; + key <AE04> { [ 4, dollar ], + [ dead_breve ] }; + key <AE05> { [ 5, percent ], + [ dead_abovering ] }; + key <AE06> { [ 6, asciicircum ], + [ dead_ogonek ] }; + key <AE07> { [ 7, ampersand ], + [ grave, dead_grave ] }; + key <AE08> { [ 8, asterisk ], + [ dead_abovedot ] }; + key <AE09> { [ 9, parenleft ], + [ dead_acute ] }; + key <AE10> { [ 0, parenright ], + [ dead_doubleacute ] }; + key <AE11> { [ minus, underscore ], + [ dead_diaeresis ] }; + key <AE12> { [ equal, plus ], + [ dead_cedilla ] }; + + key <AD01> { [ q, Q ], + [ backslash ] }; + key <AD02> { [ w, W ], + [ bar ] }; + key <AD03> { [ e, E ], + [ EuroSign ] }; + key <AD04> { [ r, R ] }; + key <AD05> { [ t, T ] }; + key <AD06> { [ z, Z ] }; + key <AD07> { [ u, U ] }; + key <AD08> { [ i, I ] }; + key <AD09> { [ o, O ] }; + key <AD10> { [ p, P ] }; + key <AD11> { [ ccedilla, Ccedilla ], + [ division ] }; + key <AD12> { [ at, apostrophe ], + [ multiply ] }; + + key <AC01> { [ a, A ] }; + key <AC02> { [ s, S ], + [ dstroke ] }; + key <AC03> { [ d, D ], + [ Dstroke ] }; + key <AC04> { [ f, F ], + [ bracketleft ] }; + key <AC05> { [ g, G ], + [ bracketright ] }; + key <AC06> { [ h, H ] }; + key <AC07> { [ j, J ] }; + key <AC08> { [ k, K ], + [ lstroke ] }; + key <AC09> { [ l, L ], + [ Lstroke ] }; + key <AC10> { [ ediaeresis, Ediaeresis ], + [ dollar ] }; + key <AC11> { [ bracketleft, braceleft ], + [ ssharp ] }; + key <BKSL> { [ bracketright, braceright ], + [ currency ] }; + + key <AB01> { [ y, Y ] }; + key <AB02> { [ x, X ] }; + key <AB03> { [ c, C ] }; + key <AB04> { [ v, V ], + [ at ] }; + key <AB05> { [ b, B ], + [ braceleft ] }; + key <AB06> { [ n, N ], + [ braceright ] }; + key <AB07> { [ m, M ], + [ section ] }; + key <AB08> { [ comma, semicolon ], + [ less ] }; + key <AB09> { [ period, colon ], + [ greater ] }; + key <AB10> { [ slash, question ] }; + + key <RALT> { [ Mode_switch ] }; + key <RWIN> { [ Multi_key ] }; + // End alphanumeric section + + // begin modifier mappings + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; + +}; + Index: xc/programs/xkbcomp/symbols/altwin diff -u /dev/null xc/programs/xkbcomp/symbols/altwin:1.4 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/altwin Wed Oct 10 15:18:32 2001 @@ -0,0 +1,48 @@ +// $XFree86: xc/programs/xkbcomp/symbols/altwin,v 1.4 2001/10/10 19:18:32 herrb Exp $ + +partial modifier_keys +xkb_symbols "meta_alt" { + key <LALT> { [ Alt_L, Meta_L ] }; + key <RALT> { [ Alt_R, Meta_R ] }; + modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; +// modifier_map Mod4 {}; +}; + +partial modifier_keys +xkb_symbols "meta_win" { + key <LALT> { [ Alt_L, Alt_L ] }; + key <RALT> { [ Alt_R, Alt_R ] }; + key <LWIN> { [ Meta_L ] }; + key <RWIN> { [ Meta_R ] }; + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod4 { Meta_L, Meta_R }; +}; + +partial modifier_keys +xkb_symbols "left_meta_win" { + key <LALT> { [ Alt_L, Alt_L ] }; + key <LWIN> { [ Meta_L ] }; + modifier_map Mod1 { Alt_L }; + modifier_map Mod4 { Meta_L }; +}; + +partial modifier_keys +xkb_symbols "super_win" { + key <LWIN> { [ Super_L ] }; + key <RWIN> { [ Super_R ] }; + modifier_map Mod4 { Super_L, Super_R }; +}; + +partial modifier_keys +xkb_symbols "hyper_win" { + key <LWIN> { [ Hyper_L ] }; + key <RWIN> { [ Hyper_R ] }; + modifier_map Mod4 { Hyper_L, Hyper_R }; +}; + +// Use Menu for the menu key +partial modifier_keys +xkb_symbols "menu" { + key <MENU> { [ Menu ] }; +}; + Index: xc/programs/xkbcomp/symbols/am diff -u xc/programs/xkbcomp/symbols/am:1.2 xc/programs/xkbcomp/symbols/am:1.3 --- xc/programs/xkbcomp/symbols/am:1.2 Fri Oct 27 20:34:06 2000 +++ xc/programs/xkbcomp/symbols/am Wed Nov 21 17:28:52 2001 @@ -1,6 +1,6 @@ // $XConsortium: am /main/3 1997/12/18 12:40:12 rch $ // -// $XFree86: xc/programs/xkbcomp/symbols/am,v 1.2 2000/10/28 00:34:06 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/am,v 1.3 2001/11/21 22:28:52 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { @@ -13,106 +13,106 @@ // Alphanumeric section key <TLDE> { [ grave, asciitilde ], - [ Armenian_but, Armenian_exclam ] }; - key <LSGT> { [ Armenian_eternity, greater ], - [ question, Armenian_hyphen ] }; + [ 0x100055d, 0x100055c ] }; + key <LSGT> { [ less, greater ], + [ question, 0x100058a ] }; key <BKSL> { [ backslash, bar ], - [ Armenian_guillemotright, Armenian_guillemotleft ] }; + [ guillemotright, guillemotleft ] }; key <AE01> { [ 1, exclam ], - [ Armenian_fe, Armenian_FE ] }; + [ 0x1000586, 0x1000556 ] }; key <AE02> { [ 2, at ], - [ Armenian_dza, Armenian_DZA ] }; + [ 0x1000571, 0x1000541 ] }; key <AE03> { [ 3, numbersign ], - [ Armenian_en_dash, Armenian_em_dash ] }; + [ 0x1002013, 0x1002014 ] }; key <AE04> { [ 4, dollar ], - [ Armenian_comma, dollar ] }; + [ comma, dollar ] }; key <AE05> { [ 5, percent ], - [ Armenian_verjaket, Armenian_ellipsis ] }; + [ 0x1000589, 0x1002026 ] }; key <AE06> { [ 6, asciicircum ], - [ Armenian_question, percent ] }; + [ 0x100055e, percent ] }; key <AE07> { [ 7, ampersand ], - [ Armenian_mijaket, Armenian_ligature_ew ] }; + [ period, 0x1000587 ] }; key <AE08> { [ 8, asterisk ], - [ Armenian_shesht, Armenian_apostroph ] }; + [ 0x100055b, 0x10002bc ] }; key <AE09> { [ 9, parenleft ], - [ Armenian_parenright, Armenian_parenleft ] }; + [ parenright, parenleft ] }; key <AE10> { [ 0, parenright ], - [ Armenian_o, Armenian_O ] }; + [ 0x1000585, 0x1000555 ] }; key <AE11> { [ minus, underscore ], - [ Armenian_e, Armenian_E ] }; + [ 0x1000567, 0x1000537 ] }; key <AE12> { [ equal, plus ], - [ Armenian_ghat, Armenian_GHAT ] }; + [ 0x1000572, 0x1000542 ] }; key <AD01> { [ q, Q ], - [ Armenian_tche, Armenian_TCHE ] }; + [ 0x1000573, 0x1000543 ] }; key <AD02> { [ w, W ], - [ Armenian_pyur, Armenian_PYUR ] }; + [ 0x1000583, 0x1000553 ] }; key <AD03> { [ e, E ], - [ Armenian_ben, Armenian_BEN ] }; + [ 0x1000562, 0x1000532 ] }; key <AD04> { [ r, R ], - [ Armenian_se, Armenian_SE ] }; + [ 0x100057d, 0x100054d ] }; key <AD05> { [ t, T ], - [ Armenian_men, Armenian_MEN ] }; + [ 0x1000574, 0x1000544 ] }; key <AD06> { [ y, Y ], - [ Armenian_vo, Armenian_VO ] }; + [ 0x1000578, 0x1000548 ] }; key <AD07> { [ u, U ], - [ Armenian_vyun, Armenian_VYUN ] }; + [ 0x1000582, 0x1000552 ] }; key <AD08> { [ i, I ], - [ Armenian_ken, Armenian_KEN ] }; + [ 0x100056f, 0x100053f ] }; key <AD09> { [ o, O ], - [ Armenian_at, Armenian_AT ] }; + [ 0x1000568, 0x1000538 ] }; key <AD10> { [ p, P ], - [ Armenian_to, Armenian_TO ] }; + [ 0x1000569, 0x1000539 ] }; key <AD11> { [ bracketleft, braceleft ], - [ Armenian_tsa, Armenian_TSA ] }; + [ 0x100056e, 0x100053e ] }; key <AD12> { [ bracketright, braceright ], - [ Armenian_tso, Armenian_TSO ] }; + [ 0x1000581, 0x1000551 ] }; key <AC01> { [ a, A ], - [ Armenian_je, Armenian_JE ] }; + [ 0x100057b, 0x100054b ] }; key <AC02> { [ s, S ], - [ Armenian_vev, Armenian_VEV ] }; + [ 0x100057e, 0x100054e ] }; key <AC03> { [ d, D ], - [ Armenian_gim, Armenian_GIM ] }; + [ 0x1000563, 0x1000533 ] }; key <AC04> { [ f, F ], - [ Armenian_yech, Armenian_YECH ] }; + [ 0x1000565, 0x1000535 ] }; key <AC05> { [ g, G ], - [ Armenian_ayb, Armenian_AYB ] }; + [ 0x1000561, 0x1000531 ] }; key <AC06> { [ h, H ], - [ Armenian_nu, Armenian_NU ] }; + [ 0x1000576, 0x1000546 ] }; key <AC07> { [ j, J ], - [ Armenian_ini, Armenian_INI ] }; + [ 0x100056b, 0x100053b ] }; key <AC08> { [ k, K ], - [ Armenian_tyun, Armenian_TYUN ] }; + [ 0x100057f, 0x100054f ] }; key <AC09> { [ l, L ], - [ Armenian_ho, Armenian_HO ] }; + [ 0x1000570, 0x1000540 ] }; key <AC10> { [ semicolon, colon ], - [ Armenian_pe, Armenian_PE ] }; + [ 0x100057a, 0x100054a ] }; key <AC11> { [ apostrophe, quotedbl ], - [ Armenian_re, Armenian_RE ] }; + [ 0x1000580, 0x1000550 ] }; key <AB01> { [ z, Z ], - [ Armenian_zhe, Armenian_ZHE ] }; + [ 0x100056a, 0x100053a ] }; key <AB02> { [ x, X ], - [ Armenian_da, Armenian_DA ] }; + [ 0x1000564, 0x1000534 ] }; key <AB03> { [ c, C ], - [ Armenian_cha, Armenian_CHA ] }; + [ 0x1000579, 0x1000549 ] }; key <AB04> { [ v, V ], - [ Armenian_hi, Armenian_HI ] }; + [ 0x1000575, 0x1000545 ] }; key <AB05> { [ b, B ], - [ Armenian_za, Armenian_ZA ] }; + [ 0x1000566, 0x1000536 ] }; key <AB06> { [ n, N ], - [ Armenian_lyun, Armenian_LYUN ] }; + [ 0x100056c, 0x100053c ] }; key <AB07> { [ m, M ], - [ Armenian_ke, Armenian_KE ] }; + [ 0x1000584, 0x1000554 ] }; key <AB08> { [ comma, less ], - [ Armenian_khe, Armenian_KHE ] }; + [ 0x100056d, 0x100053d ] }; key <AB09> { [ period, greater ], - [ Armenian_sha, Armenian_SHA ] }; + [ 0x1000577, 0x1000547 ] }; key <AB10> { [ slash, question ], - [ Armenian_ra, Armenian_RA ] }; + [ 0x100057c, 0x100054c ] }; // Begin modifier mappings Index: xc/programs/xkbcomp/symbols/ar diff -u /dev/null xc/programs/xkbcomp/symbols/ar:1.2 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/ar Wed Jan 16 13:20:12 2002 @@ -0,0 +1,146 @@ +// $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/ar,v 1.2 2002/01/16 18:20:12 dawes Exp $ +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Arabic"; + +// NOTES: +// +// there is also combined shadda diacritis in AltGr position of simple +// diacritics fatha, fathatan, damma, dammatan, kasra and kasratan +// should a third state be added to Group2 ? +// + + key <TLDE> { [ ], [ Arabic_thal, Arabic_shadda ] }; + 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 <AD01> { [ ], [ Arabic_dad, Arabic_fatha ] }; + key <AD02> { [ ], [ Arabic_sad, Arabic_fathatan ] }; + key <AD03> { [ ], [ Arabic_theh, Arabic_damma ] }; + key <AD04> { [ ], [ Arabic_qaf, Arabic_dammatan ] }; + key <AD05> { [ ], [ Arabic_feh, 0x100fef9 ] }; + key <AD06> { [ ], [ Arabic_ghain, Arabic_hamzaunderalef ] }; + key <AD07> { [ ], [ Arabic_ain, grave ] }; + key <AD08> { [ ], [ Arabic_ha, division ] }; + key <AD09> { [ ], [ Arabic_khah, multiply ] }; + key <AD10> { [ ], [ Arabic_hah, Arabic_semicolon ] }; + key <AD11> { [ ], [ Arabic_jeem, braceleft ] }; + key <AD12> { [ ], [ Arabic_dal, braceright ] }; + + key <AC01> { [ ], [ Arabic_sheen, backslash ] }; + key <AC02> { [ ], [ Arabic_seen, S ] }; + key <AC03> { [ ], [ Arabic_yeh, bracketleft ] }; + key <AC04> { [ ], [ Arabic_beh, bracketright ] }; + key <AC05> { [ ], [ Arabic_lam, 0x100fef7 ] }; + key <AC06> { [ ], [ Arabic_alef, Arabic_hamzaonalef ] }; + key <AC07> { [ ], [ Arabic_teh, Arabic_tatweel ] }; + key <AC08> { [ ], [ Arabic_noon, Arabic_comma ] }; + key <AC09> { [ ], [ Arabic_meem, slash ] }; + key <AC10> { [ ], [ Arabic_kaf, colon ] }; + key <AC11> { [ ], [ Arabic_tah, quotedbl ] }; + key <BKSL> { [ ], [ less, greater ] }; + + key <LSGT> { [ ], [ bar, brokenbar ] }; + key <AB01> { [ ], [Arabic_hamzaonyeh, asciitilde ] }; + key <AB02> { [ ], [ Arabic_hamza, Arabic_sukun ] }; + key <AB03> { [ ], [Arabic_hamzaonwaw, Arabic_kasra ] }; + key <AB04> { [ ], [ Arabic_ra, Arabic_kasratan ] }; + key <AB05> { [ ], [ 0x100fefb, 0x100fef5 ] }; + key <AB06> { [ ], [Arabic_alefmaksura, Arabic_maddaonalef ] }; + key <AB07> { [ ], [Arabic_tehmarbuta, apostrophe ] }; + key <AB08> { [ ], [ Arabic_waw, comma ] }; + key <AB09> { [ ], [ Arabic_zain, period ] }; + key <AB10> { [ ], [ Arabic_zah, Arabic_question_mark ] }; + + // 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 "qwerty" { + include "ar(basic)" +}; + +partial alphanumeric_keys +xkb_symbols "azerty" { + include "ar(basic)" + + // the north african arabic keyboard differs from the middle east one + // by the numeric row; it follows French keyboard style + // + // PROBLEM: some chars are inaccessible: ! @ # $ % ^ * + // should they go elsewhere? replace " ' that are now in double ? + // also, dead_circumflex and dead_diaeresis from French keyboard + // as well as ugrave are missing, which questions the utility of the + // other accentuated latin letters. Maybe this is useful only with + // a French keyboard in Group1 ? Then, shouldn't Group1 be filled ? + + key <AE01> { [ ], [ ampersand, 1 ] }; + key <AE02> { [ ], [ eacute, 2 ] }; + key <AE03> { [ ], [ quotedbl, 3 ] }; + key <AE04> { [ ], [ apostrophe, 4 ] }; + key <AE05> { [ ], [ parenleft, 5 ] }; + key <AE06> { [ ], [ minus, 6 ] }; + key <AE07> { [ ], [ egrave, 7 ] }; + key <AE08> { [ ], [ underscore, 8 ] }; + key <AE09> { [ ], [ ccedilla, 9 ] }; + key <AE10> { [ ], [ agrave, 0 ] }; + key <AE11> { [ ], [ parenright, degree ] }; +}; + +partial alphanumeric_keys +xkb_symbols "digits" { + include "ar(basic)" + + // use arabic script digits + + key <AE01> { [ ], [ 0x1000661, exclam ] }; + key <AE02> { [ ], [ 0x1000662, at ] }; + key <AE03> { [ ], [ 0x1000663, numbersign ] }; + key <AE04> { [ ], [ 0x1000664, dollar ] }; + key <AE05> { [ ], [ 0x1000665, percent ] }; + key <AE06> { [ ], [ 0x1000666, asciicircum ] }; + key <AE07> { [ ], [ 0x1000667, ampersand ] }; + key <AE08> { [ ], [ 0x1000668, asterisk ] }; + key <AE09> { [ ], [ 0x1000669, parenleft ] }; + key <AE10> { [ ], [ 0x1000660, parenright ] }; +}; + +partial alphanumeric_keys +xkb_symbols "qwerty_digits" { + include "ar(digits)" +}; + +partial alphanumeric_keys +xkb_symbols "azerty_digits" { + include "ar(azerty)" + + key <AE01> { [ ], [ ampersand, 0x1000661 ] }; + key <AE02> { [ ], [ eacute, 0x1000662 ] }; + key <AE03> { [ ], [ quotedbl, 0x1000663 ] }; + key <AE04> { [ ], [ apostrophe, 0x1000664 ] }; + key <AE05> { [ ], [ parenleft, 0x1000665 ] }; + key <AE06> { [ ], [ minus, 0x1000666 ] }; + key <AE07> { [ ], [ egrave, 0x1000667 ] }; + key <AE08> { [ ], [ underscore, 0x1000668 ] }; + key <AE09> { [ ], [ ccedilla, 0x1000669 ] }; + key <AE10> { [ ], [ agrave, 0x1000660 ] }; +}; + Index: xc/programs/xkbcomp/symbols/az diff -u xc/programs/xkbcomp/symbols/az:1.1 xc/programs/xkbcomp/symbols/az:1.2 --- xc/programs/xkbcomp/symbols/az:1.1 Fri Oct 27 14:31:08 2000 +++ xc/programs/xkbcomp/symbols/az Wed Nov 21 17:28:52 2001 @@ -1,79 +1,98 @@ // $TOG: us /main/12 1997/06/14 06:37:07 kaleb $ +// // symbols definition for a very simple Azerbaidjani keyboard layout. -// $XFree86: xc/programs/xkbcomp/symbols/az,v 1.1 2000/10/27 18:31:08 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/az,v 1.2 2001/11/21 22:28:52 dawes Exp $ +// both latin and cyrillic layouts are available. +// the cyrillic layout uses the corresponding latin letters in group2; +// so it is useful to type in latin for people accostumed to cyrillic layout +// +// 2001 - Pablo Saratxaga <pablo@mandrakesoft.com> partial hidden alphanumeric_keys modifier_keys xkb_symbols "basic" { - name[Group1]= "Azeri"; + name[Group1]= "Azeri"; - // Alphanumeric section - key <TLDE> { [ grave, asciitilde ], - [ dead_grave, dead_tilde ] }; - - key <AE02> { [ 2, quotedbl ], - [ at ] }; - key <AE03> { [ 3, apostrophe ], - [ slash ] }; - key <AE04> { [ 4, semicolon ], - [ dollar ] }; - key <AE05> { [ 5, percent ], - [ sterling ] }; - key <AE06> { [ 6, colon ], - [ EuroSign, periodcentered ] }; - key <AE07> { [ 7, question ], - [ ampersand ] }; - key <AE08> { [ 8, asterisk ], - [ asciicircum, dead_circumflex ] }; - key <AE09> { [ 9, parenleft ], - [ numbersign ] }; - key <AE10> { [ 0, parenright ], - [ section ] }; - key <AE11> { [ minus, underscore ], - [ hyphen ] }; - - key <AD02> { [ udiaeresis, Udiaeresis ], - [ w, W ] }; - key <AD03> { [ e, E ], - [ e, E ] }; - key <AD04> { [ r, R ], - [ registered ] }; - key <AD05> { [ t, T ], - [ brokenbar, brokenbar ] }; - key <AD08> { [ i, Iabovedot ] }; - key <AD11> { [ odiaeresis, Odiaeresis ], - [ bracketleft, braceleft ] }; - key <AD12> { [ gbreve, Gbreve ], - [ bracketright, braceright ] }; - - key <AC10> { [ idotless, I ], - [ semicolon, colon ] }; - key <AC11> { [ schwa, SCHWA ], - [ apostrophe, quotedbl ] }; - - key <AB03> { [ c, C ], - [ copyright, division ] }; - key <AB07> { [ m, M ], - [ periodcentered, currency ] }; - key <AB08> { [ ccedilla, Ccedilla ], - [ comma, less ] }; - key <AB09> { [ scedilla, Scedilla ], - [ period, greater ] }; - key <AB10> { [ period, comma ] }; - - key <BKSL> { [ gcaron, Gcaron ], - [ backslash, bar ] }; - key <LSGT> { [ less, greater ], - [ backslash, slash ] }; - - // End alphanumeric section - - // begin modifier mappings - modifier_map Shift { Shift_L }; - modifier_map Lock { Caps_Lock }; - modifier_map Control{ Control_L }; + key <TLDE> {[ grave, asciitilde ], + [ dead_grave, dead_tilde ]}; + key <AE01> {[ 1, exclam ]}; + key <AE02> {[ 2, quotedbl ], + [ at ]}; + key <AE03> {[ 3, apostrophe ], + [ numbersign ]}; + key <AE04> {[ 4, semicolon ], + [ dollar ]}; + key <AE05> {[ 5, percent ], + [ sterling ]}; + key <AE06> {[ 6, colon ], + [ EuroSign, periodcentered ]}; + key <AE07> {[ 7, question ], + [ ampersand ]}; + key <AE08> {[ 8, asterisk ], + [ asciicircum, dead_circumflex ]}; + key <AE09> {[ 9, parenleft ]}; + key <AE10> {[ 0, parenright ], + [ section ]}; + key <AE11> {[ minus, underscore ], + [ hyphen, emdash ]}; + key <AE12> {[ equal, plus ]}; + + key <AD01> {[ q, Q ]}; + key <AD02> {[ udiaeresis, Udiaeresis ], + [ w, W ]}; + key <AD03> {[ e, E ]}; + key <AD04> {[ r, R ], + [ registered ]}; + key <AD05> {[ t, T ], + [ brokenbar ]}; + key <AD06> {[ y, Y ]}; + key <AD07> {[ u, U ]}; + key <AD08> {[ i, Iabovedot ]}; + key <AD09> {[ o, O ]}; + key <AD10> {[ p, P ]}; + key <AD11> {[ odiaeresis, Odiaeresis ], + [ bracketleft, braceleft ]}; + key <AD12> {[ gbreve, Gbreve ], + [ bracketright, braceright ]}; + + key <AC01> {[ a, A ]}; + key <AC02> {[ s, S ]}; + key <AC03> {[ d, D ]}; + key <AC04> {[ f, F ]}; + key <AC05> {[ g, G ]}; + key <AC06> {[ h, H ]}; + key <AC07> {[ j, J ]}; + key <AC08> {[ k, K ]}; + key <AC09> {[ l, L ]}; + key <AC10> {[ idotless, I ]}; + key <AC11> {[ 0x1000259, 0x100018f ]}; + key <BKSL> {[ backslash, slash ]}; + + key <LSGT> {[ less, greater ], + [ bar ]}; + key <AB01> {[ z, z ]}; + key <AB02> {[ x, X ]}; + key <AB03> {[ c, C ], + [ copyright, division ]}; + key <AB04> {[ v, V ]}; + key <AB05> {[ b, B ]}; + key <AB06> {[ n, N ]}; + key <AB07> {[ m, M ], + [ periodcentered, currency ]}; + key <AB08> {[ ccedilla, Ccedilla ]}; + key <AB09> {[ scedilla, Scedilla ]}; + key <AB10> {[ period, comma ]}; + + // 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 @@ -84,119 +103,111 @@ partial alphanumeric_keys xkb_symbols "cyrillic" { - // Describes the differences between a very simple en_US - // keyboard and a very simple Azerbaidjani cyrillic keybaord + name[Group1]= "Cyrillic"; + name[Group2]= "Latin"; - name[Group1]= "Cyrillic"; - name[Group2]= "Latin"; - - key <TLDE> { [ grave, asciitilde ], - [ w, W ] }; - - key <AE02> { [ 2, at ], - [ 2, quotedbl ] }; - key <AE03> { [ 3, numbersign ], - [ 3, apostrophe ] }; - key <AE04> { [ 4, semicolon ], - [ 4, dollar ] }; - key <AE05> { [ 5, percent ], - [ 5, percent ] }; - key <AE06> { [ 6, colon ], - [ 6, asciicircum ] }; - key <AE07> { [ 7, question ], - [ 7, ampersand ] }; - key <AE08> { [ 8, asterisk ], - [ 8, braceleft ] }; - key <AE09> { [ 9, parenleft ], - [ 9, bracketleft ] }; - key <AE10> { [ 0, parenright ], - [ 0, bracketright ] }; - key <AE11> { [ minus, underscore ], - [ minus, braceright ] }; - - key <AD01> { [ Cyrillic_je, Cyrillic_JE ], - [ y, Y ] }; - key <AD02> { [ Cyrillic_u_straight, Cyrillic_U_straight ], - [ udiaeresis, Udiaeresis ] }; - key <AD03> { [ Cyrillic_u, Cyrillic_U ], - [ u, U ] }; - key <AD04> { [ Cyrillic_ka, Cyrillic_KA ], - [ k, K ] }; - key <AD05> { [ Cyrillic_ie, Cyrillic_IE ], - [ e, E ] }; - key <AD06> { [ Cyrillic_en, Cyrillic_EN ], - [ n, N ] }; - key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ], - [ q, Q ] }; - key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ], - [ scedilla, Scedilla ] }; - key <AD09> { [ Cyrillic_shha, Cyrillic_SHHA ], - [ h, H ] }; - key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ], - [ z, Z ] }; - key <AD11> { [ Cyrillic_ha, Cyrillic_HA ], - [ x, X ] }; - key <AD12> { [ Cyrillic_che_vertstroke, Cyrillic_CHE_vertstroke ], - [ c, C ] }; - - key <AC01> { [ Cyrillic_ef, Cyrillic_EF ], - [ f, F ] }; - key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ], - [ idotless, I ] }; - key <AC03> { [ Cyrillic_ve, Cyrillic_VE ], - [ v, V ] }; - key <AC04> { [ Cyrillic_a, Cyrillic_A ], - [ a, A ] }; - key <AC05> { [ Cyrillic_pe, Cyrillic_PE ], - [ p, P ] }; - key <AC06> { [ Cyrillic_er, Cyrillic_ER ], - [ r, R ] }; - key <AC07> { [ Cyrillic_o, Cyrillic_O ], - [ o, O ] }; - key <AC08> { [ Cyrillic_el, Cyrillic_EL ], - [ l, L ] }; - key <AC09> { [ Cyrillic_de, Cyrillic_DE ], - [ d, D ] }; - key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ], - [ j, J ] }; - key <AC11> { [ Cyrillic_ka_vertstroke, Cyrillic_KA_vertstroke ], - [ g, G ] }; - - key <AB01> { [ Cyrillic_schwa, Cyrillic_SCHWA ], - [ schwa, SCHWA ] }; - key <AB02> { [ Cyrillic_che, Cyrillic_CHE ], - [ ccedilla, Ccedilla ] }; - key <AB03> { [ Cyrillic_es, Cyrillic_ES ], - [ s, S ] }; - key <AB04> { [ Cyrillic_em, Cyrillic_EM ], - [ m, M ] }; - key <AB05> { [ Cyrillic_i, Cyrillic_I ], - [ i, Iabovedot ] }; - key <AB06> { [ Cyrillic_te, Cyrillic_TE ], - [ t, T ] }; - key <AB07> { [ Cyrillic_ghe_bar, Cyrillic_GHE_bar ], - [ gbreve, Gbreve ] }; - key <AB08> { [ Cyrillic_be, Cyrillic_BE ], - [ b, B ] }; - key <AB09> { [ Cyrillic_o_bar, Cyrillic_O_bar ], - [ odiaeresis, Odiaeresis ] }; - key <AB10> { [ slash, question ], - [ period, comma ] }; - - - key <BKSL> { [ backslash, bar ], - [ apostrophe ] }; - key <LSGT> { [ less, greater ], - [ bar, brokenbar ] }; - - // 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 }; + key <TLDE> {[ grave, asciitilde ], + [ w, W ]}; + key <AE01> {[ 1, exclam ]}; + key <AE02> {[ 2, quotedbl ], + [ at ]}; + key <AE03> {[ 3, numbersign ], + [ apostrophe ]}; + key <AE04> {[ 4, semicolon ], + [ dollar ]}; + key <AE05> {[ 5, percent ]}; + key <AE06> {[ 6, colon ], + [ asciicircum ]}; + key <AE07> {[ 7, question ], + [ ampersand ]}; + key <AE08> {[ 8, asterisk ], + [ braceleft ]}; + key <AE09> {[ 9, parenleft ], + [ bracketleft ]}; + key <AE10> {[ 0, parenright ], + [ bracketright ]}; + key <AE11> {[ minus, underscore ], + [ braceright ]}; + key <AE12> {[ equal, plus ]}; + + key <AD01> {[ Cyrillic_je, Cyrillic_JE ], + [ y, Y ]}; + key <AD02> {[ 0x10004af, 0x10004ae ], + [ udiaeresis, Udiaeresis ]}; + key <AD03> {[ Cyrillic_u, Cyrillic_U ], + [ u, U ]}; + key <AD04> {[ Cyrillic_ka, Cyrillic_KA ], + [ k, K ]}; + key <AD05> {[ Cyrillic_ie, Cyrillic_IE ], + [ e, E ]}; + key <AD06> {[ Cyrillic_en, Cyrillic_EN ], + [ n, N ]}; + key <AD07> {[ Cyrillic_ghe, Cyrillic_GHE ], + [ q, Q ]}; + key <AD08> {[ Cyrillic_sha, Cyrillic_SHA ], + [ scedilla, Scedilla ]}; + key <AD09> {[ 0x10004bb, 0x10004ba ], + [ h, H ]}; + key <AD10> {[ Cyrillic_ze, Cyrillic_ZE ], + [ z, Z ]}; + key <AD11> {[ Cyrillic_ha, Cyrillic_HA ], + [ x, X ]}; + key <AD12> {[ 0x10004b9, 0x10004b8 ], + [ c, C ]}; + + key <AC01> {[ Cyrillic_ef, Cyrillic_EF ], + [ f, F ]}; + key <AC02> {[ Cyrillic_yeru, Cyrillic_YERU ], + [ idotless, I ]}; + key <AC03> {[ Cyrillic_ve, Cyrillic_VE ], + [ v, V ]}; + key <AC04> {[ Cyrillic_a, Cyrillic_A ], + [ a, A ]}; + key <AC05> {[ Cyrillic_pe, Cyrillic_PE ], + [ p, P ]}; + key <AC06> {[ Cyrillic_er, Cyrillic_ER ], + [ r, R ]}; + key <AC07> {[ Cyrillic_o, Cyrillic_O ], + [ o, O ]}; + key <AC08> {[ Cyrillic_el, Cyrillic_EL ], + [ l, L ]}; + key <AC09> {[ Cyrillic_de, Cyrillic_DE ], + [ d, D ]}; + key <AC10> {[ Cyrillic_zhe, Cyrillic_ZHE ], + [ j, J ]}; + key <AC11> {[ 0x100049d, 0x100049c ], + [ g, G ]}; + key <BKSL> {[ backslash, slash ]}; + + key <LSGT> {[ less, greater ], + [ bar ]}; + key <AB01> {[ 0x10004d9, 0x10004d8 ], + [ 0x1000259, 0x100018f ]}; + key <AB02> {[ Cyrillic_che, Cyrillic_CHE ], + [ ccedilla, Ccedilla ]}; + key <AB03> {[ Cyrillic_es, Cyrillic_ES ], + [ s, S ]}; + key <AB04> {[ Cyrillic_em, Cyrillic_EM ], + [ m, M ]}; + key <AB05> {[ Cyrillic_i, Cyrillic_I ], + [ i, Iabovedot ]}; + key <AB06> {[ Cyrillic_te, Cyrillic_TE ], + [ t, T ]}; + key <AB07> {[ 0x1000493, 0x1000492 ], + [ gbreve, Gbreve ]}; + key <AB08> {[ Cyrillic_be, Cyrillic_BE ], + [ b, B ]}; + key <AB09> {[ 0x10004e9, 0x10004e8 ], + [ odiaeresis, Odiaeresis ]}; + key <AB10> {[ period, comma ], + [ slash, question ]}; + + // 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 }; }; - - Index: xc/programs/xkbcomp/symbols/ben diff -u /dev/null xc/programs/xkbcomp/symbols/ben:1.1 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/ben Wed Nov 21 17:28:52 2001 @@ -0,0 +1,67 @@ +// $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/ben,v 1.1 2001/11/21 22:28:52 dawes Exp $ +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Bengali"; + key <TLDE> { [], [ ] }; + + // Mainly numbers. + key <AE01> { [], [ 0x10009E7 ] }; + key <AE02> { [], [ 0x10009E8 ] }; + key <AE03> { [], [ 0x10009E9 ] }; + key <AE04> { [], [ 0x10009EA ] }; + key <AE05> { [], [ 0x10009EB ] }; + key <AE06> { [], [ 0x10009EC ] }; + key <AE07> { [], [ 0x10009ED ] }; + key <AE08> { [], [ 0x10009EE ] }; + key <AE09> { [], [ 0x10009EF, parenleft ] }; + key <AE10> { [], [ 0x10009E6, parenright ] }; + key <AE11> { [], [ minus, 0x1000983 ] }; + key <AE12> { [], [ 0x100098B, 0x10009C3 ] }; + +// Mainly long vowels + + key <AD01> { [], [ 0x10009CC, 0x1000994 ] }; + key <AD02> { [], [ 0x10009C8, 0x1000990 ] }; + key <AD03> { [], [ 0x10009BE, 0x1000986 ] }; + key <AD04> { [], [ 0x10009C0, 0x1000988 ] }; + key <AD05> { [], [ 0x10009C2, 0x100098A ] }; + +// Mainly voiced consonants + + key <AD06> { [], [ 0x10009AC, 0x10009AD ] }; + key <AD07> { [], [ 0x10009B9, 0x1000999 ] }; + key <AD08> { [], [ 0x1000997, 0x1000998 ] }; + key <AD09> { [], [ 0x10009A6, 0x10009A7 ] }; + key <AD10> { [], [ 0x100099C, 0x100099D ] }; + key <AD11> { [], [ 0x10009A1, 0x10009A2 ] }; + key <AD12> { [], [ 0x10009BC, 0x100099E ] }; + +// Mainly short vowels + key <AC01> { [], [ 0x10009CB, 0x1000993 ] }; + key <AC02> { [], [ 0x10009C7, 0x100098F ] }; + key <AC03> { [], [ 0x10009CD, 0x1000985 ] }; + key <AC04> { [], [ 0x10009BF, 0x1000987 ] }; + key <AC05> { [], [ 0x10009C1, 0x1000989 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [], [ 0x10009AA, 0x10009AB ] }; + key <AC07> { [], [ 0x10009B0, 0x10009DD ] }; + key <AC08> { [], [ 0x1000995, 0x1000996 ] }; + key <AC09> { [], [ 0x10009A4, 0x10009A5 ] }; + key <AC10> { [], [ 0x100099A, 0x100099B ] }; + key <AC11> { [], [ 0x100099F, 0x10009A0 ] }; + key <BKSL> { [], [ backslash, bar ] }; + + key <AB01> { [], [ z, Z ] }; + key <AB02> { [], [ 0x1000982, 0x1000981 ] }; + key <AB03> { [], [ 0x10009AE, 0x10009A3 ] }; + key <AB04> { [], [ 0x10009A8, 0x10009A8 ] }; + key <AB05> { [], [ 0x10009AC, 0x10009AC ] }; + key <AB06> { [], [ 0x10009B2, 0x10009B2 ] }; + key <AB07> { [], [ 0x10009B8, 0x10009B6 ] }; + key <AB08> { [], [ comma, 0x10009B7 ] }; + key <AB09> { [], [ period, 0x1000964 ] }; + key <AB10> { [], [ 0x10009DF, 0x10009AF ] }; +}; Index: xc/programs/xkbcomp/symbols/compose diff -u /dev/null xc/programs/xkbcomp/symbols/compose:1.1 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/compose Fri Aug 17 12:31:25 2001 @@ -0,0 +1,17 @@ +// $XFree86: xc/programs/xkbcomp/symbols/compose,v 1.1 2001/08/17 16:31:25 dawes Exp $ + +partial modifier_keys +xkb_symbols "ralt" { + key <RALT> { [ Multi_key, Multi_key ] }; +}; + +partial modifier_keys +xkb_symbols "rwin" { + key <RWIN> { [ Multi_key, Multi_key ] }; +}; + +partial modifier_keys +xkb_symbols "menu" { + key <MENU> { [ Multi_key, Multi_key ] }; +}; + Index: xc/programs/xkbcomp/symbols/cz diff -u xc/programs/xkbcomp/symbols/cz:1.1 xc/programs/xkbcomp/symbols/cz:1.3 --- xc/programs/xkbcomp/symbols/cz:1.1 Fri May 18 19:35:35 2001 +++ xc/programs/xkbcomp/symbols/cz Mon Oct 1 09:44:16 2001 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/symbols/cz,v 1.1 2001/05/18 23:35:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/cz,v 1.3 2001/10/01 13:44:16 eich Exp $ partial alphanumeric_keys xkb_symbols "basic" { @@ -9,6 +9,11 @@ // to satisfy most unix, windows and mac users. // 2001 by Kamil Toman <ktoman@email.cz> + // Switching to US added by Jan Holesovsky <kendy@suse.cz>, 2001 + + include "us_group2(basic)" + include "group(shift_toggle)" + name[Group1]= "Czech"; key.type = "FOUR_LEVEL"; @@ -128,5 +133,11 @@ key <RALT> { type="TWO_LEVEL", [ ISO_Level3_Shift, ISO_Level3_Shift ] }; modifier_map Mod5 { <RALT> }; +}; + + // Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) +xkb_symbols "bksl" { + include "cz(basic)" + key <BKSL> { [ backslash, bar, + slash, NoSymbol ] }; }; - Index: xc/programs/xkbcomp/symbols/cz_qwerty diff -u xc/programs/xkbcomp/symbols/cz_qwerty:1.1 xc/programs/xkbcomp/symbols/cz_qwerty:1.2 --- xc/programs/xkbcomp/symbols/cz_qwerty:1.1 Fri May 18 19:35:35 2001 +++ xc/programs/xkbcomp/symbols/cz_qwerty Mon Oct 1 09:44:16 2001 @@ -1,15 +1,16 @@ -// $XFree86: xc/programs/xkbcomp/symbols/cz_qwerty,v 1.1 2001/05/18 23:35:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/cz_qwerty,v 1.2 2001/10/01 13:44:16 eich 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). + // of 'Z' 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 ] }; + key <AD06> { [ y, Y, + NoSymbol, NoSymbol ] }; }; Index: xc/programs/xkbcomp/symbols/czsk diff -u /dev/null xc/programs/xkbcomp/symbols/czsk:1.7 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/czsk Thu Oct 4 09:12:05 2001 @@ -0,0 +1,737 @@ +// 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.7 2001/10/04 13:12:05 alanh 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.9 xc/programs/xkbcomp/symbols/de:3.10 --- xc/programs/xkbcomp/symbols/de:3.9 Wed Jan 17 18:45:57 2001 +++ xc/programs/xkbcomp/symbols/de Mon Oct 1 10:04:15 2001 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/de,v 3.9 2001/01/17 23:45:57 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/de,v 3.10 2001/10/01 14:04:15 eich Exp $ default partial alphanumeric_keys xkb_symbols "basic" { @@ -36,7 +36,7 @@ key <AE11> { [ ssharp, question ], [ backslash, questiondown ] }; key <AE12> { [ dead_acute, dead_grave ], - [ dead_cedilla ] }; + [ dead_cedilla, dead_ogonek ] }; key <AD01> { [ q, Q ], [ at ] }; @@ -53,7 +53,7 @@ key <AC04> { [ f, F ] }; key <AC05> { [ g, G ] }; key <AC10> { [ odiaeresis, Odiaeresis ], - [ dead_acute ] }; + [ dead_doubleacute ] }; key <AC11> { [ adiaeresis, Adiaeresis ], [ dead_circumflex ] }; @@ -81,32 +81,6 @@ }; partial alphanumeric_keys -xkb_symbols "Sundeadkeys" { - // modify the default German layout to use Sun dead keys - include "de(basic)" - key <TLDE> { [ SunFA_Circum, degree ], - [ notsign ] }; - key <AE12> { [ SunFA_Acute, SunFA_Grave ], - [ SunFA_Cedilla ] }; - key <AD11> { [ udiaeresis, Udiaeresis ], - [ SunFA_Diaeresis ] }; - key <AD12> { [ plus, asterisk ], - [ SunFA_Tilde, dead_macron ] }; - key <AC10> { [ odiaeresis, Odiaeresis ], - [ SunFA_Acute ] }; - key <AC11> { [ adiaeresis, Adiaeresis ], - [ SunFA_Circum ] }; - - key <BKSL> { [ numbersign, acute ], - [ SunFA_Grave ] }; -}; - -partial alphanumeric_keys -xkb_symbols "sundeadkeys" { - include "de(Sundeadkeys)" -}; - -partial alphanumeric_keys xkb_symbols "nodeadkeys" { // modify the default German layout to not have any dead keys include "de(basic)" @@ -119,10 +93,36 @@ key <AD12> { [ plus, asterisk ], [ asciitilde, macron ] }; key <AC10> { [ odiaeresis, Odiaeresis ], - [ acute ] }; + [ doubleacute ] }; key <AC11> { [ adiaeresis, Adiaeresis ], [ asciicircum ] }; key <BKSL> { [ numbersign, apostrophe ], [ grave ] }; +}; + +partial alphanumeric_keys +xkb_symbols "deadgraveacute" { + // modify the default German layout to have only acute and grave + // as dead keys (tilde and circumflex are needed as spacing characters + // in many programming languages) + include "de(basic)" + key <TLDE> { [ asciicircum, degree ], + [ notsign ] }; + key <AD12> { [ plus, asterisk ], + [ asciitilde, dead_macron ] }; + key <BKSL> { [ numbersign, apostrophe ], + [ grave ] }; +}; + +partial alphanumeric_keys +xkb_symbols "deadacute" { + // modify the default German layout to have only acute as + // dead keys (ASCII grave, tilde and circumflex are needed as + // spacing characters in many programming languages and text formatters) + include "de(deadgraveacute)" + key <AE12> { [ dead_acute, grave ], + [ dead_cedilla, dead_ogonek ] }; + key <BKSL> { [ numbersign, apostrophe ], + [ dead_grave ] }; }; Index: xc/programs/xkbcomp/symbols/dev diff -u /dev/null xc/programs/xkbcomp/symbols/dev:1.1 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/dev Wed Nov 21 17:28:52 2001 @@ -0,0 +1,67 @@ +// $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/dev,v 1.1 2001/11/21 22:28:52 dawes Exp $ +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Hindi"; + key <TLDE> { [], [ 0x100094A, 0x1000912 ] }; + + // Mainly numbers. + key <AE01> { [], [ 0x1000967, 0x100090D ] }; + key <AE02> { [], [ 0x1000968, 0x1000945 ] }; + key <AE03> { [], [ 0x1000969 ] }; + key <AE04> { [], [ 0x100096A ] }; + key <AE05> { [], [ 0x100096B ] }; + key <AE06> { [], [ 0x100096C ] }; + key <AE07> { [], [ 0x100096D ] }; + key <AE08> { [], [ 0x100096e ] }; + key <AE09> { [], [ 0x100096F, parenleft ] }; + key <AE10> { [], [ 0x1000966, parenright ] }; + key <AE11> { [], [ 0x1000903 ] }; + key <AE12> { [], [ 0x1000943, 0x100090B ] }; + +// Mainly long vowels + + key <AD01> { [], [ 0x100094C, 0x1000914 ] }; + key <AD02> { [], [ 0x1000948, 0x1000910 ] }; + key <AD03> { [], [ 0x100093E, 0x1000906 ] }; + key <AD04> { [], [ 0x1000940, 0x1000908 ] }; + key <AD05> { [], [ 0x1000942, 0x100090A ] }; + +// Mainly voiced consonants + + key <AD06> { [], [ 0x100092C, 0x100092D ] }; + key <AD07> { [], [ 0x1000939, 0x1000919 ] }; + key <AD08> { [], [ 0x1000917, 0x1000918 ] }; + key <AD09> { [], [ 0x1000926, 0x1000927 ] }; + key <AD10> { [], [ 0x100091C, 0x100091D ] }; + key <AD11> { [], [ 0x1000921, 0x1000922 ] }; + key <AD12> { [], [ 0x100093C, 0x100091E ] }; + +// Mainly short vowels + key <AC01> { [], [ 0x100094B, 0x1000913 ] }; + key <AC02> { [], [ 0x1000947, 0x100090F ] }; + key <AC03> { [], [ 0x100094D, 0x1000905 ] }; + key <AC04> { [], [ 0x100093F, 0x1000907 ] }; + key <AC05> { [], [ 0x1000941, 0x1000909 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [], [ 0x100092A, 0x100092B ] }; + key <AC07> { [], [ 0x1000930, 0x1000931 ] }; + key <AC08> { [], [ 0x1000915, 0x1000916 ] }; + key <AC09> { [], [ 0x1000924, 0x1000925 ] }; + key <AC10> { [], [ 0x100091A, 0x100091B ] }; + key <AC11> { [], [ 0x100091F, 0x1000920 ] }; + key <BKSL> { [], [ 0x1000949, 0x1000911 ] }; + + key <AB01> { [], [ 0x1000946, 0x100090E ] }; + key <AB02> { [], [ 0x1000902, 0x1000901 ] }; + key <AB03> { [], [ 0x100092E, 0x1000923 ] }; + key <AB04> { [], [ 0x1000928, 0x1000929 ] }; + key <AB05> { [], [ 0x1000935, 0x1000934 ] }; + key <AB06> { [], [ 0x1000932, 0x1000933 ] }; + key <AB07> { [], [ 0x1000938, 0x1000936 ] }; + key <AB08> { [], [ comma, 0x1000937 ] }; + key <AB09> { [], [ period, 0x1000964 ] }; + key <AB10> { [], [ 0x100092F, question ] }; +}; Index: xc/programs/xkbcomp/symbols/en_US diff -u xc/programs/xkbcomp/symbols/en_US:3.4 xc/programs/xkbcomp/symbols/en_US:3.6 --- xc/programs/xkbcomp/symbols/en_US:3.4 Wed Jan 17 18:45:58 2001 +++ xc/programs/xkbcomp/symbols/en_US Sat Oct 27 23:34:35 2001 @@ -1,4 +1,5 @@ // $Xorg: en_US,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/en_US,v 3.6 2001/10/28 03:34:35 tsi Exp $ partial hidden alphanumeric_keys xkb_symbols "basic" { @@ -7,44 +8,49 @@ }; default xkb_symbols "pc101" { - key <RALT> { [ Mode_switch, Multi_key ] }; + include "us(pc101)" - augment "us(pc101)" + replace key <RALT> { [ Mode_switch, Multi_key ] }; + include "iso9995-3(basic101)" modifier_map Mod3 { Mode_switch }; }; xkb_symbols "pc102" { - key <RALT> { [ Mode_switch, Multi_key ] }; + include "us(pc102)" + + replace key <RALT> { [ Mode_switch, Multi_key ] }; - augment "us(pc102)" include "iso9995-3(basic)" modifier_map Mod3 { Mode_switch }; }; xkb_symbols "pc104" { - key <RALT> { [ Mode_switch ] }; - key <RWIN> { [ Multi_key ] }; + include "us(pc104)" + + replace key <RALT> { [ Mode_switch ] }; + replace key <RWIN> { [ Multi_key ] }; - augment "us(pc104)" include "iso9995-3(basic101)" modifier_map Mod3 { Mode_switch }; }; xkb_symbols "pc105" { - key <RALT> { [ Mode_switch ] }; - key <RWIN> { [ Multi_key ] }; + include "us(pc105)" - augment "us(pc105)" + replace key <RALT> { [ Mode_switch ] }; + replace key <RWIN> { [ Multi_key ] }; + include "iso9995-3(basic)" modifier_map Mod3 { Mode_switch }; }; xkb_symbols "pc_universal" { - key <RALT> { [ Mode_switch ] }; - key <RWIN> { [ Multi_key ] }; + include "us(pc_universal)" + + replace key <RALT> { [ Mode_switch ] }; + replace key <RWIN> { [ Multi_key ] }; - augment "us(pc_universal)" include "iso9995-3(basic)" modifier_map Mod3 { Mode_switch }; @@ -59,47 +65,52 @@ include "iso9995-3(basic)" }; xkb_symbols "pc101_nodeadkeys" { - key <RALT> { [ Mode_switch, Multi_key ] }; + include "us(pc101)" - augment "us(pc101)" + replace key <RALT> { [ Mode_switch, Multi_key ] }; + include "iso9995-3(nodeadkeys101)" modifier_map Mod3 { Mode_switch }; }; xkb_symbols "pc102_nodeadkeys" { - key <RALT> { [ Mode_switch, Multi_key ] }; + include "us(pc102)" + + replace key <RALT> { [ Mode_switch, Multi_key ] }; - augment "us(pc102)" include "iso9995-3(nodeadkeys)" modifier_map Mod3 { Mode_switch }; }; xkb_symbols "pc104_nodeadkeys" { - key <RALT> { [ Mode_switch ] }; - key <RWIN> { [ Multi_key ] }; + include "us(pc104)" + + replace key <RALT> { [ Mode_switch ] }; + replace key <RWIN> { [ Multi_key ] }; - augment "us(pc104)" include "iso9995-3(nodeadkeys101)" modifier_map Mod3 { Mode_switch }; }; xkb_symbols "pc105_nodeadkeys" { - key <RALT> { [ Mode_switch ] }; - key <RWIN> { [ Multi_key ] }; + include "us(pc105)" - augment "us(pc105)" + replace key <RALT> { [ Mode_switch ] }; + replace key <RWIN> { [ Multi_key ] }; + include "iso9995-3(nodeadkeys101)" modifier_map Mod3 { Mode_switch }; }; xkb_symbols "pc_universal_nodeadkeys" { - key <RALT> { [ Mode_switch ] }; - key <RWIN> { [ Multi_key ] }; + include "us(pc_universal)" + + replace key <RALT> { [ Mode_switch ] }; + replace key <RWIN> { [ Multi_key ] }; - augment "us(pc_universal)" include "iso9995-3(nodeadkeys101)" modifier_map Mod3 { Mode_switch }; Index: xc/programs/xkbcomp/symbols/ge_la diff -u /dev/null xc/programs/xkbcomp/symbols/ge_la:1.1 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/ge_la Wed Nov 21 17:28:52 2001 @@ -0,0 +1,71 @@ +// ge_la (Georgian "latin layout") + +// From the comments of the xmodmap file: +// +// Georgian keyboard map, in the so called "latin" layout. +// 1999, Pablo Saratxaga <srtxg@chanae.alphanet.ch> +// +// Georgian mode is toggled by Right_Ctrl key and shifted by AltGr key. +// uppercase in georgian mode gives the lower case ascii, this can be useful +// to type whithout switching mode. +// +// the layout has been copied from +// http://members.tripod.com/~beso/html/L-K-COD.HTM +// with some few changes it is: +// +// `~ 1!1! 2@2@ 3 3 4$4$ 5% 6^6^ 7&7& 8*8* 9(9( 0)0) -_-_ =+=+ \|\| BackSp +// Tab qQქq wWწჭ eEეe rRრr tTტღ yYყთ uUუu iIიi oOáƒo Ppპp [{[{ ]}]} +// CapsLock aAáƒa sSსშ dDდd fFფf gGგg hHჰh jJჯჟ kKკk lLლl ;:;: '"'" Return +// Shift «» zZზძ xXხx cCცჩ vVვv bBბb nNნn mMმm ,<,< .>.> /?/? Shift +// Ctrl Alt Space Space Space NonBreakingSpace  ModeShift ModeLock +// +// the chars ჱჲჳჴჵჶ are not mapped... +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple Georgian "latin layout" keyboard + + name[Group2]= "Georgian"; + + key <AD01> {[], [ 0x010010e5, q ] }; + key <AD02> {[], [ 0x010010ec, 0x010010ed ] }; + key <AD03> {[], [ 0x010010d4, e ] }; + key <AD04> {[], [ 0x010010e0, r ] }; + key <AD05> {[], [ 0x010010e2, 0x010010e6 ] }; + key <AD06> {[], [ 0x010010e7, 0x010010d7 ] }; + key <AD07> {[], [ 0x010010e3, u ] }; + key <AD08> {[], [ 0x010010d8, i ] }; + key <AD09> {[], [ 0x010010dd, o ] }; + key <AD10> {[], [ 0x010010de, p ] }; + key <AD11> {[], [ bracketleft, braceleft ] }; + key <AD12> {[], [ bracketright, braceright ] }; + + key <AC01> {[], [ 0x010010d0, a ] }; + key <AC02> {[], [ 0x010010e1, 0x010010e8 ] }; + key <AC03> {[], [ 0x010010d3, d ] }; + key <AC04> {[], [ 0x010010e4, f ] }; + key <AC05> {[], [ 0x010010d2, g ] }; + key <AC06> {[], [ 0x010010f0, h ] }; + key <AC07> {[], [ 0x010010ef, 0x010010df ] }; + key <AC08> {[], [ 0x010010d9, k ] }; + key <AC09> {[], [ 0x010010da, l ] }; + key <AC10> {[], [ semicolon, colon ] }; + key <AC11> {[], [ apostrophe, quotedbl ] }; + key <BKSL> {[], [ backslash, bar ] }; + + key <LSGT> {[], [ guillemotleft,guillemotright ] }; + key <AB01> {[], [ 0x010010d6, 0x010010eb ] }; + key <AB02> {[], [ 0x010010ee, x ] }; + key <AB03> {[], [ 0x010010ea, 0x010010d9 ] }; + key <AB04> {[], [ 0x010010d5, v ] }; + key <AB05> {[], [ 0x010010d1, b ] }; + key <AB06> {[], [ 0x010010dc, n ] }; + key <AB07> {[], [ 0x010010db, m ] }; + key <AB08> {[], [ comma, less ] }; + key <AB09> {[], [ period, greater ] }; + key <AB10> {[], [ slash, question ] }; + +}; Index: xc/programs/xkbcomp/symbols/ge_ru diff -u /dev/null xc/programs/xkbcomp/symbols/ge_ru:1.1 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/ge_ru Wed Nov 21 17:28:52 2001 @@ -0,0 +1,83 @@ +// ge_ru (Georgian "russian layout") + +// From the comments of the xmodmap file: +// +// Georgian keyboard map, in the so called "russian" layout. +// 1999, Pablo Saratxaga <srtxg@chanae.alphanet.ch> +// +// Georgian mode is toggled by Right_Ctrl key and shifted by AltGr key. +// uppercase in georgian mode gives the lower case ascii, this can be useful +// to type whithout switching mode. +// +// the layout has been copied from +// http://members.tripod.com/~beso/html/RU-K-COD.HTM +// with some few changes it is: +// +// `~^~ 1!1! 2@2 3 3 4$4; 5%5: 6^6, 7&7. 8*8* 9(9( 0)0) -_-_ =+ | \| BackSp +// Tab qQღq wWცw eEუe rRკr tTეt yYნy uUგu iIშi oOწp [{ხ[ ]}ჯ] +// CapsLock aAფa sSთs dDვd fFáƒf gGპg hHრh jJáƒj kKლk lLდ; ;:ჟ: '"ძ% Return +// Shift «» zZჭz xXჩx cCსc vVმv bBიb nNტn mMქm ,<ბ< .>ყ> /?ჰ? Shift +// Ctrl Alt Space Space Space NonBreakingSpace  ModeShift ModeLock +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple Georgian "russian layout" keyboard + + name[Group2]= "Georgian"; + + key <TLDE> {[], [ asciicircum, asciitilde ] }; + key <AE01> {[], [ 1, exclam ] }; + key <AE02> {[], [ 2, at ] }; // 2 0xeb + key <AE03> {[], [ 3, numbersign ] }; // 3 0xec + key <AE04> {[], [ 4, semicolon ] }; + key <AE05> {[], [ 5, colon ] }; + key <AE06> {[], [ 6, comma ] }; + key <AE07> {[], [ 7, period ] }; + key <AE08> {[], [ 8, asterisk ] }; + key <AE09> {[], [ 9, parenleft ] }; + key <AE10> {[], [ 0, parenright ] }; + key <AE11> {[], [ minus, underscore ] }; + key <AE12> {[], [ numbersign, bar ] }; + + key <AD01> {[], [ 0x010010e6, q ] }; + key <AD02> {[], [ 0x010010ea, w ] }; + key <AD03> {[], [ 0x010010e3, e ] }; + key <AD04> {[], [ 0x010010d9, r ] }; + key <AD05> {[], [ 0x010010d4, t ] }; + key <AD06> {[], [ 0x010010dc, y ] }; + key <AD07> {[], [ 0x010010d2, u ] }; + key <AD08> {[], [ 0x010010e8, i ] }; + key <AD09> {[], [ 0x010010ec, o ] }; + key <AD10> {[], [ 0x010010d6, p ] }; + key <AD11> {[], [ 0x010010ee, bracketleft ] }; + key <AD12> {[], [ 0x010010ef, bracketright ] }; + + key <AC01> {[], [ 0x010010e4, a ] }; + key <AC02> {[], [ 0x010010d7, s ] }; + key <AC03> {[], [ 0x010010d5, d ] }; + key <AC04> {[], [ 0x010010d0, f ] }; + key <AC05> {[], [ 0x010010de, g ] }; + key <AC06> {[], [ 0x010010e0, h ] }; + key <AC07> {[], [ 0x010010dd, j ] }; + key <AC08> {[], [ 0x010010da, k ] }; + key <AC09> {[], [ 0x010010d3, l ] }; + key <AC10> {[], [ 0x010010df, semicolon ] }; + key <AC11> {[], [ 0x010010eb, percent ] }; + key <BKSL> {[], [ backslash, bar ] }; // 0xe9 0xea + + key <LSGT> {[], [ guillemotleft,guillemotright ] }; // 0xab 0xbb 0xe7 0xe8 + key <AB01> {[], [ 0x010010ed, z ] }; + key <AB02> {[], [ 0x010010e9, x ] }; + key <AB03> {[], [ 0x010010e1, c ] }; + key <AB04> {[], [ 0x010010db, v ] }; + key <AB05> {[], [ 0x010010d8, b ] }; + key <AB06> {[], [ 0x010010e2, n ] }; + key <AB07> {[], [ 0x010010e5, m ] }; + key <AB08> {[], [ 0x010010d1, less ] }; + key <AB09> {[], [ 0x010010e7, greater ] }; + key <AB10> {[], [ 0x010010f0, question ] }; + +}; Index: xc/programs/xkbcomp/symbols/group diff -u xc/programs/xkbcomp/symbols/group:3.5 xc/programs/xkbcomp/symbols/group:3.6 --- xc/programs/xkbcomp/symbols/group:3.5 Wed Jan 17 18:45:58 2001 +++ xc/programs/xkbcomp/symbols/group Fri Aug 17 09:27:58 2001 @@ -2,7 +2,7 @@ // 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.5 2001/01/17 23:45:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/group,v 3.6 2001/08/17 13:27:58 dawes Exp $ partial modifier_keys xkb_symbols "switch" { key <RALT> { @@ -11,6 +11,46 @@ }; }; +// using the group(win_switch) map, both Windows'logo keys temporarily +// choose the second keyboard group (until release). If you use this +// map, you would declare you keyboard as pc101 or pc102 instead of +// pc104 or pc105. +partial modifier_keys +xkb_symbols "win_switch" { + key <LWIN> { + symbols[Group1] = [ Mode_switch, Multi_key ], + virtualMods= AltGr + }; + key <RWIN> { + symbols[Group1] = [ Mode_switch, Multi_key ], + virtualMods= AltGr + }; +}; + +// using the group(lwin_switch) map, the left Windows' logo key +// temporarily chooses the second keyboard group (until it is +// released). If you use this map, you would declare you keyboard as +// pc101 or pc102 instead of pc104 or pc105. +partial modifier_keys +xkb_symbols "lwin_switch" { + key <LWIN> { + symbols[Group1] = [ Mode_switch, Multi_key ], + virtualMods= AltGr + }; +}; + +// using the group(rwin_switch) map, the right Windows' logo key +// temporarily chooses the second keyboard group (until it is +// released). If you use this map, you would declare you keyboard as +// pc101 or pc102 instead of pc104 or pc105. +partial modifier_keys +xkb_symbols "rwin_switch" { + key <RWIN> { + symbols[Group1] = [ Mode_switch, Multi_key ], + virtualMods= AltGr + }; +}; + // using the group(toggle) map, pressing the right alt key switches to // the next sequential group (until the next explicit group change). partial modifier_keys @@ -117,4 +157,28 @@ partial modifier_keys xkb_symbols "menu_toggle" { key <MENU> { [ ISO_Next_Group, Menu ] }; +}; + +// using the group(lwin_toggle) map, pressing the left Windows' logo key +// toggles groups. If you use this map, you would declare you keyboard +// as pc101 or pc102 instead of pc104 or pc105. +partial modifier_keys +xkb_symbols "lwin_toggle" { + virtual_modifiers AltGr; + key <LWIN> { + virtualMods= AltGr, + symbols[Group1] = [ ISO_Next_Group ] + }; +}; + +// using the group(rwin_toggle) map, pressing the right Windows' logo key +// toggles groups. If you use this map, you would declare you keyboard +// as pc101 or pc102 instead of pc104 or pc105. +partial modifier_keys +xkb_symbols "rwin_toggle" { + virtual_modifiers AltGr; + key <RWIN> { + virtualMods= AltGr, + symbols[Group1] = [ ISO_Next_Group ] + }; }; Index: xc/programs/xkbcomp/symbols/guj diff -u /dev/null xc/programs/xkbcomp/symbols/guj:1.1 --- /dev/null Fri Jan 18 15:27:27 2002 +++ xc/programs/xkbcomp/symbols/guj Wed Nov 21 17:28:52 2001 @@ -0,0 +1,67 @@ +// $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/guj,v 1.1 2001/11/21 22:28:52 dawes Exp $ +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Gujarati"; + key <TLDE> { [], [ ] }; + + // Mainly numbers. + key <AE01> { [], [ 0x1000AE7, 0x1000A8D ] }; + key <AE02> { [], [ 0x1000AE8, 0x1000AC5 ] }; + key <AE03> { [], [ 0x1000AE9 ] }; + key <AE04> { [], [ 0x1000AEA ] }; + key <AE05> { [], [ 0x1000AEB ] }; + key <AE06> { [], [ 0x1000AEC ] }; + key <AE07> { [], [ 0x1000AED ] }; + key <AE08> { [], [ 0x1000AEE ] }; + key <AE09> { [], [ 0x1000AEF, parenleft ] }; + key <AE10> { [], [ 0x1000AE6, parenright ] }; + key <AE11> { [], [ minus, 0x1000A83 ] }; + key <AE12> { [], [ 0x1000A8B, 0x1000AC3 ] }; + +// Mainly long vowels + + key <AD01> { [], [ 0x1000ACC, 0x1000A94 ] }; + key <AD02> { [], [ 0x1000AC8, 0x1000A90 ] }; + key <AD03> { [], [ 0x1000ABE, 0x1000A86 ] }; + key <AD04> { [], [ 0x1000AC0, 0x1000A88 ] }; + key <AD05> { [], [ 0x1000AC2, 0x1000A8A ] }; + +// Mainly voiced consonants + + key <AD06> { [], [ 0x1000AAC, 0x1000AAD ] }; + key <AD07> { [], [ 0x1000AB9, 0x1000A99 ] }; + key <AD08> { [], [ 0x1000A97, 0x1000A98 ] }; + key <AD09> { [], [ 0x1000AA6, 0x1000AA7 ] }; + key <AD10> { [], [ 0x1000A9C, 0x1000A9D ] }; + key <AD11> { [], [ 0x1000AA1, 0x1000AA2 ] }; + key <AD12> { [], [ 0x1000ABC, 0x1000A9E ] }; + +// Mainly short vowels + key <AC01> { [], [ 0x1000ACB, 0x1000A93 ] }; + key <AC02> { [], [ 0x1000AC7, 0x1000A8F ] }; + key <AC03> { [], [ 0x1000ACD, 0x1000A85 ] }; + key <AC04> { [], [ 0x1000ABF, 0x1000A87 ] }; + key <AC05> { [], [ 0x1000AC1, 0x1000A89 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [], [ 0x1000AAA, 0x1000AAB ] }; + key <AC07> { [], [ 0x1000AB0, guj_rra ] }; + key <AC08> { [], [ 0x1000A95, 0x1000A96 ] }; + key <AC09> { [], [ 0x1000AA4, 0x1000AA5 ] }; + key <AC10> { [], [ 0x1000A9A, 0x1000A9B ] }; + key <AC11> { [], [ 0x1000A9F, 0x1000AA0 ] }; + key <BKSL> { [], [ 0x1000AC9, 0x1000A91 ] }; + + key <AB01> { [], [ z , Z ] }; + key <AB02> { [], [ 0x1000A82, 0x1000A81 ] }; + key <AB03> { [], [ 0x1000AAE, 0x1000AA3 ] }; + key <AB04> { [], [ 0x1000AA8, guj_nnna ] }; + key <AB05> { [], [ 0x1000AB5, guj_llla ] }; + key <AB06> { [], [ 0x1000AB2, 0x1000AB3 ] }; + key <AB07> { [], [ 0x1000AB8, 0x1000AB6 ] }; + key <AB08> { [], [ comma, 0x1000AB7 ] }; + key <AB09> { [], [ period, 0x1000964 ] }; + key <AB10> { [], [ 0x1000AAF, question ] }; +}; Index: xc/programs/xkbcomp/symbols/gur diff -u /dev/null xc/programs/xkbcomp/symbols/gur:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/gur Wed Nov 21 17:28:52 2001 @@ -0,0 +1,67 @@ +// $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/gur,v 1.1 2001/11/21 22:28:52 dawes Exp $ +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Gurmukhi"; + key <TLDE> { [], [ ] }; + + // Mainly numbers. + key <AE01> { [], [ 0x1000A67 ] }; + key <AE02> { [], [ 0x1000A68 ] }; + key <AE03> { [], [ 0x1000A69 ] }; + key <AE04> { [], [ 0x1000A6A ] }; + key <AE05> { [], [ 0x1000A6B ] }; + key <AE06> { [], [ 0x1000A6C ] }; + key <AE07> { [], [ 0x1000A6D ] }; + key <AE08> { [], [ 0x1000A6e ] }; + key <AE09> { [], [ 0x1000A6F, parenleft ] }; + key <AE10> { [], [ 0x1000A66, parenright ] }; + key <AE11> { [], [ gur_visarga ] }; + key <AE12> { [], [ gur_v_r, gur_v_r_s ] }; + +// Mainly long vowels + + key <AD01> { [], [ 0x1000A4C, 0x1000A14 ] }; + key <AD02> { [], [ 0x1000A48, 0x1000A10 ] }; + key <AD03> { [], [ 0x1000A3E, 0x1000A06 ] }; + key <AD04> { [], [ 0x1000A40, 0x1000A08 ] }; + key <AD05> { [], [ 0x1000A42, 0x1000A0A ] }; + +// Mainly voiced consonants + + key <AD06> { [], [ 0x1000A2C, 0x1000A2D ] }; + key <AD07> { [], [ 0x1000A39, 0x1000A19 ] }; + key <AD08> { [], [ 0x1000A17, 0x1000A18 ] }; + key <AD09> { [], [ 0x1000A26, 0x1000A27 ] }; + key <AD10> { [], [ 0x1000A1C, 0x1000A1D ] }; + key <AD11> { [], [ 0x1000A21, 0x1000A22 ] }; + key <AD12> { [], [ 0x1000A3C, 0x1000A1E ] }; + +// Mainly short vowels + key <AC01> { [], [ 0x1000A4B, 0x1000A13 ] }; + key <AC02> { [], [ 0x1000A47, 0x1000A0F ] }; + key <AC03> { [], [ 0x1000A4D, 0x1000A05 ] }; + key <AC04> { [], [ 0x1000A3F, 0x1000A07 ] }; + key <AC05> { [], [ 0x1000A41, 0x1000A09 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [], [ 0x1000A2A, 0x1000A2B ] }; + key <AC07> { [], [ 0x1000A30, 0x1000A30 ] }; + key <AC08> { [], [ 0x1000A15, 0x1000A16 ] }; + key <AC09> { [], [ 0x1000A24, 0x1000A25 ] }; + key <AC10> { [], [ 0x1000A1A, 0x1000A1B ] }; + key <AC11> { [], [ 0x1000A1F, 0x1000A20 ] }; + key <BKSL> { [], [ backslash, bar ] }; + + key <AB01> { [], [ z, Z ] }; + key <AB02> { [], [ 0x1000A02, 0x1000A70 ] }; + key <AB03> { [], [ 0x1000A2E, 0x1000A23 ] }; + key <AB04> { [], [ 0x1000A28, 0x1000A28 ] }; + key <AB05> { [], [ 0x1000A35, 0x1000A35 ] }; + key <AB06> { [], [ 0x1000A32, 0x1000A33 ] }; + key <AB07> { [], [ 0x1000A38, 0x1000A36 ] }; + key <AB08> { [], [ comma, less ] }; + key <AB09> { [], [ period, 0x1000964 ] }; + key <AB10> { [], [ 0x1000A2F, question ] }; +}; Index: xc/programs/xkbcomp/symbols/inet diff -u xc/programs/xkbcomp/symbols/inet:1.13 xc/programs/xkbcomp/symbols/inet:1.16 --- xc/programs/xkbcomp/symbols/inet:1.13 Thu Apr 5 22:16:26 2001 +++ xc/programs/xkbcomp/symbols/inet Fri Dec 28 11:03:30 2001 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/symbols/inet,v 1.13 2001/04/06 02:16:26 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/inet,v 1.16 2001/12/28 16:03:30 dawes Exp $ partial alphanumeric_keys xkb_symbols "hp" { @@ -49,6 +49,43 @@ key <I66> { [ XF86Start ] }; }; +partial alphanumeric_keys +xkb_symbols "logiinetnav" { + + // Describes the extra keys on a newer Logitech iTouch keyboard. + + name[Group1]= "LogiInternetNavigator"; + + // Media keys + key <I20> { [ XF86AudioMute ] }; + key <I6D> { [ XF86AudioMedia ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + + // Left side + key <I5F> { [ XF86Standby ] }; + key <I13> { [ XF86Finance ] }; + key <I14> { [ XF86Favorites ] }; + key <I15> { [ XF86Community ] }; + key <I66> { [ XF86Start ] }; + + // Right side + key <I12> { [ XF86VendorHome ] }; + key <I6C> { [ XF86Mail ] }; + key <I32> { [ XF86HomePage ] }; + key <I11> { [ XF86Shop ] }; + key <I65> { [ XF86Search ] }; + + // Wheel buttons + key <I6A> { [ XF86Back ] }; + key <I69> { [ XF86Forward ] }; + +}; + partial alphanumeric_keys xkb_symbols "logicordless" { @@ -240,4 +277,19 @@ key <I26> { [ XF86LaunchB ] }; key <I2E> { [ XF86LaunchC ] }; }; + + +partial alphanumeric_keys +xkb_symbols "dell" { + + // From <liblit@acm.org> + // Describes the extra keys on a Dell Internet keyboard. + + name[Group1]= "Dell"; + key <I12> { [ XF86Mail ] }; + key <I26> { [ XF86HomePage ] }; + key <I1E> { [ XF86Search ] }; + key <I5F> { [ XF86Standby ] }; +}; + Index: xc/programs/xkbcomp/symbols/ir diff -u /dev/null xc/programs/xkbcomp/symbols/ir:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/ir Wed Nov 21 17:28:52 2001 @@ -0,0 +1,82 @@ +// $XConsortium: +// $XFree86: +// Iranian keymap, by Robert Brady <robert@suse.co.uk> +// data supplied by Roozbeh Pournader <roozbeh@Sina.sharif.ac.ir> +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Iranian"; + key <TLDE> { [], [ 0x100200d ] }; + + // Mainly numbers. + key <AE01> { [], [ 1, exclam ] }; + key <AE02> { [], [ 2, 0x100066C ] }; + key <AE03> { [], [ 3, 0x100066B ] }; + key <AE04> { [], [ 4, currency ] }; + key <AE05> { [], [ 5, 0x100066A ] }; + key <AE06> { [], [ 6, 0x10000D7 ] }; + key <AE07> { [], [ 7, Arabic_comma ] }; + key <AE08> { [], [ 8, asterisk ] }; + key <AE09> { [], [ 9, parenleft ] }; + key <AE10> { [], [ 0, parenright ] }; + key <AE11> { [], [ minus, Arabic_tatweel ] }; + key <AE12> { [], [ equal, plus ] }; + + key <AD01> { [], [ Arabic_dad, Arabic_sukun ] }; + key <AD02> { [], [ Arabic_sad, Arabic_dammatan ] }; + key <AD03> { [], [ Arabic_theh, Arabic_kasratan ] }; + key <AD04> { [], [ Arabic_qaf, Arabic_fathatan ] }; + key <AD05> { [], [ Arabic_feh, Arabic_damma ] }; + key <AD06> { [], [ Arabic_ghain, Arabic_kasra ] }; + key <AD07> { [], [ Arabic_ain, Arabic_fatha ] }; + key <AD08> { [], [ Arabic_heh, Arabic_shadda ] }; + key <AD09> { [], [ Arabic_khah, bracketright ] }; + key <AD10> { [], [ Arabic_hah, bracketleft ] }; + key <AD11> { [], [ Arabic_jeem, braceright ] }; + key <AD12> { [], [ 0x1000686, braceleft ] }; + + key <AC01> { [], [ Arabic_sheen, Arabic_hamzaonwaw ] }; + key <AC02> { [], [ Arabic_seen, Arabic_hamzaonyeh ] }; + key <AC03> { [], [ 0x10006cc, Arabic_yeh ] }; + key <AC04> { [], [ Arabic_beh, Arabic_hamzaunderalef] }; + key <AC05> { [], [ Arabic_lam, Arabic_hamzaonalef ] }; + key <AC06> { [], [ Arabic_alef, Arabic_maddaonalef ] }; + key <AC07> { [], [ Arabic_teh, Arabic_tehmarbuta ] }; + key <AC08> { [], [ Arabic_noon, guillemotright ] }; + key <AC09> { [], [ Arabic_meem, guillemotleft ] }; + key <AC10> { [], [ 0x10006a9, colon ] }; + key <AC11> { [], [ 0x10006af, 0x100061b ] }; + + key <BKSL> { [], [ backslash, bar ] }; + key <SPCE> { [], [ space, 0x100200c ] }; + + key <AB01> { [], [ Arabic_zah, Arabic_kaf ] }; + key <AB02> { [], [ Arabic_tah ] }; + key <AB03> { [], [ Arabic_zain, 0x1000698 ] }; + key <AB04> { [], [ 0x1000631 ] }; + key <AB05> { [], [ Arabic_thal, 0x100200c ] }; + key <AB06> { [], [ Arabic_dal ] }; + key <AB07> { [], [ 0x100067e, Arabic_hamza ] }; + key <AB08> { [], [ Arabic_waw, greater ] }; + key <AB09> { [], [ period, less ] }; + key <AB10> { [], [ slash, Arabic_question_mark ] }; +}; + +partial alphanumeric_keys +xkb_symbols "digits" { + include "AR(basic)" + + // use arabic script digits + + key <AE01> { [], [ 0x10006f1, exclam ] }; + key <AE02> { [], [ 0x10006f2, 0x100066C ] }; + key <AE03> { [], [ 0x10006f3, 0x100066B ] }; + key <AE04> { [], [ 0x10006f4, currency ] }; + key <AE05> { [], [ 0x10006f5, 0x100066A ] }; + key <AE06> { [], [ 0x10006f6, 0x10000D7 ] }; + key <AE07> { [], [ 0x10006f7, Arabic_comma ] }; + key <AE08> { [], [ 0x10006f8, asterisk ] }; + key <AE09> { [], [ 0x10006f9, parenleft ] }; + key <AE10> { [], [ 0x10006f0, parenright ] }; + +}; + Index: xc/programs/xkbcomp/symbols/is diff -u xc/programs/xkbcomp/symbols/is:3.5 xc/programs/xkbcomp/symbols/is:3.6 --- xc/programs/xkbcomp/symbols/is:3.5 Wed Jan 17 18:45:58 2001 +++ xc/programs/xkbcomp/symbols/is Mon Oct 1 10:04:15 2001 @@ -1,6 +1,6 @@ // $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.5 2001/01/17 23:45:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/is,v 3.6 2001/10/01 14:04:15 eich Exp $ default partial alphanumeric_keys xkb_symbols "default" { @@ -49,7 +49,7 @@ // key <AC04> { [ f, F ] }; // key <AC05> { [ g, G ] }; key <AC10> { [ ae, AE ], - [ asciircum ] }; + [ asciicircum ] }; key <AC11> { [ dead_acute, Adiaeresis ], [ dead_circumflex ] }; Index: xc/programs/xkbcomp/symbols/iu diff -u /dev/null xc/programs/xkbcomp/symbols/iu:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/iu Wed Nov 21 17:28:52 2001 @@ -0,0 +1,79 @@ +// +// Inuktitut keyboard for X11 +// written by Pablo Saratxaga <pablo@mandrakesoft.com> +// + + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a syllabic inuktitut keyboard ("Naamajut" layout) + + name[Group1]= "US/ASCII"; + name[Group2]= "Inuktitut"; + + key <AE01> { [], [ 0x01001595, 1 ] }; + key <AE02> { [], [ 0x01001449, 2 ] }; + key <AE03> { [], [ 0x01001550, 3 ] }; + key <AE04> { [], [ 0x01001483, 4 ] }; + key <AE05> { [], [ 0x01001466, 5 ] }; + key <AE06> { [], [ 0x01001585, 6 ] }; + key <AE07> { [], [ 0x010014bb, 7 ] }; + key <AE08> { [], [ 0x010014d0, 8 ] }; + key <AE09> { [], [ 0x010014ea, 9 ] }; + key <AE10> { [], [ 0x0100153e, 0 ] }; + key <AE11> { [], [ minus, underscore ] }; + key <AE12> { [], [ 0x0100155d, equal ] }; + + key <AD01> { [], [ 0x0100158f, 0x0100148b ] }; + key <AD02> { [], [ 0x01001403, 0x01001431 ] }; + key <AD03> { [], [ 0x0100157f, 0x01001546 ] }; + key <AD04> { [], [ 0x0100146d, 0x01001596 ] }; + key <AD05> { [], [ 0x0100144e, 0x01001671 ] }; + key <AD06> { [], [ 0x010014ef, 0x01001673 ] }; + key <AD07> { [], [ 0x010014a5, 0x01001675 ] }; + key <AD08> { [], [ 0x010014c2, 0x010015a4 ] }; + key <AD09> { [], [ 0x010014d5, 0x010015a0 ] }; + key <AD10> { [], [ 0x01001528, 0x010015a6 ] }; + key <AD11> { [], [ 0x010014a1, 0x01001505 ] }; + key <AD12> { [], [ dead_abovedot, 0x0100141e ] }; + + key <AC01> { [], [ 0x01001591, 0x0100148d ] }; + key <AC02> { [], [ 0x01001405, 0x01001433 ] }; + key <AC03> { [], [ 0x01001581, 0x01001548 ] }; + key <AC04> { [], [ 0x0100146f, 0x01001555 ] }; + key <AC05> { [], [ 0x01001450, parenleft ] }; + key <AC06> { [], [ 0x010014f1, parenright ] }; + key <AC07> { [], [ 0x010014a7, 0x0100152a ] }; + key <AC08> { [], [ 0x010014c4, 0x01001557 ] }; + key <AC09> { [], [ 0x010014d7, 0x010015a2 ] }; + key <AC10> { [], [ semicolon, colon ] }; + key <AC11> { [], [ apostrophe, quotedbl ] }; + + key <AB01> { [], [ 0x01001593, 0x01001490 ] }; + key <AB02> { [], [ 0x0100140a, 0x01001438 ] }; + key <AB03> { [], [ 0x01001583, 0x0100154b ] }; + key <AB04> { [], [ 0x01001472, question ] }; + key <AB05> { [], [ 0x01001455, 0x0100157c ] }; + key <AB06> { [], [ 0x010014f4, 0x010014c7 ] }; + key <AB07> { [], [ 0x010014aa, 0x010014da ] }; + key <AB08> { [], [ comma, less ] }; + key <AB09> { [], [ period, greater ] }; + key <AB10> { [], [ 0x0100152d, 0x01001559 ] }; + + key <TLDE> { [], [ 0x0100157b, 0x01001575 ] }; + key <LSGT> { [], [ 0x01001579, 0x01001577 ] }; + key <BKSL> { [], [ backslash, 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 }; +}; + + Index: xc/programs/xkbcomp/symbols/la diff -u /dev/null xc/programs/xkbcomp/symbols/la:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/la Wed Nov 21 17:28:52 2001 @@ -0,0 +1,85 @@ +// $XConsortium: es /main/3 1996/08/31 12:19:38 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/la,v 1.1 2001/11/21 22:28:52 dawes Exp $ +// Modified for a real Latin American Keyboard by Fabian Mandelbaum +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple Latin American keybaord + + name[Group1]= "Latin American"; + + key <TLDE> { [ bar, degree ], + [ notsign, notsign ] }; + key <LSGT> { [ less, greater ], + [ bar, brokenbar ] }; + key <AE01> { [ 1, exclam ], + [ bar, exclamdown ] }; + key <AE02> { [ 2, quotedbl ], + [ at, oneeighth ] }; + key <AE03> { [ 3, numbersign ], + [ periodcentered, sterling ] }; + key <AE04> { [ 4, dollar ], + [ asciitilde, dollar ] }; + key <AE06> { [ 6, ampersand ], + [ notsign, fiveeighths ] }; + key <AE07> { [ 7, slash ] }; + key <AE08> { [ 8, parenleft ] }; + key <AB08> { [ comma, semicolon ] }; + key <AE10> { [ 0, equal ] }; + key <AE09> { [ 9, parenright ] }; + key <AB09> { [ period, colon ] }; + key <AB10> { [ minus, underscore ] }; + key <AC10> { [ ntilde, Ntilde ], + [ asciitilde,dead_doubleacute ] }; + key <AE11> { [ apostrophe, question ] }; + key <AC11> { [ braceleft, bracketleft ], + [ dead_circumflex, braceleft ] }; + key <BKSL> { [ braceright, bracketright ], + [ dead_grave, braceright ] }; + key <AD11> { [ dead_acute, dead_diaeresis ] }; + key <AE12> { [ questiondown, exclamdown ] }; + key <AD12> { [ plus, asterisk ], + [ asciitilde, dead_macron ] }; + key <AD03> { [ e, E ], + [ EuroSign, cent ] }; + + // 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 }; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + include "es(basic)" + + key <AC11> { [ SunFA_Acute, SunFA_Diaeresis ], + [ braceleft, braceleft ] }; + key <AD11> { [ SunFA_Grave, SunFA_Circum ], + [ bracketleft, dead_abovering ] }; +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + include "es(Sundeadkeys)" +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + include "es(basic)" + + key <AC10> { [ ntilde, Ntilde ], + [ asciitilde, doubleacute ] }; + key <AC11> { [ acute, diaeresis ], + [ braceleft, braceleft ] }; + key <BKSL> { [ ccedilla, Ccedilla ], + [ braceright, breve ] }; + key <AD11> { [ grave, asciicircum ], + [ bracketleft, degree ] }; + key <AD12> { [ plus, asterisk ], + [ bracketright, macron ] }; +}; Index: xc/programs/xkbcomp/symbols/level3 diff -u /dev/null xc/programs/xkbcomp/symbols/level3:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/level3 Fri Aug 17 09:27:58 2001 @@ -0,0 +1,58 @@ +// using the level(switch) map, the right Control key temporarily +// chooses the third group level (until it is released). +// +// $XFree86: xc/programs/xkbcomp/symbols/level3,v 1.1 2001/08/17 13:27:58 dawes Exp $ +// + +partial modifier_keys +xkb_symbols "switch" { + key <RCTL> { + symbols[Group1] = [ ISO_Level3_Shift ] + }; + modifier_map Mod5 { ISO_Level3_Shift }; +}; + +// using the level(menu_switch) map, the Menu key temporarily +// chooses the third group level (until it is released). +partial modifier_keys +xkb_symbols "menu_switch" { + key <MENU> { + symbols[Group1] = [ ISO_Level3_Shift ] + }; + modifier_map Mod5 { ISO_Level3_Shift }; +}; + +// using the level(win_switch) map, the both Windows' logo keys +// temporarily choose the third group level. If you use this map, you +// would define you keyboard as pc101 or pc102 instead of pc104 or +// pc105. +partial modifier_keys +xkb_symbols "win_switch" { + include group(lwin_switch); + include group(rwin_switch); +}; + +// using the level(lwin_switch) map, the left Windows' logo key +// temporarily chooses the third group level. If you use this map, +// you would define you keyboard as pc101 or pc102 instead of pc104 +// or pc105. +partial modifier_keys +xkb_symbols "lwin_switch" { + key <LWIN> { + symbols[Group1] = [ ISO_Level3_Shift ] + }; + modifier_map Mod5 { ISO_Level3_Shift }; +}; + +// using the level(rwin_switch) map, the right Windows' logo key +// temporarily chooses the third group level. If you use this map, +// you would define you keyboard as pc101 or pc102 instead of pc104 +// or pc105. +partial modifier_keys +xkb_symbols "rwin_switch" { + key <RWIN> { + symbols[Group1] = [ ISO_Level3_Shift ] + }; + modifier_map Mod5 { ISO_Level3_Shift }; +}; + Index: xc/programs/xkbcomp/symbols/lt_a diff -u /dev/null xc/programs/xkbcomp/symbols/lt_a:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/lt_a Wed Nov 21 17:28:52 2001 @@ -0,0 +1,101 @@ +// $XConsortium: lt /main/3 1997/12/18 12:40:12 rch $ + +partial alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple Lithuanian "azerty" keyboard + + name[Group1]= "Lithuanian"; + + key <TLDE> {[], [ grave, asciitilde ]}; + key <AE01> {[ exclam, 1 ]}; + key <AE02> {[ quotedbl, 2 ], + [ at ]}; + key <AE03> {[ slash, 3 ], + [ numbersign ]}; + key <AE04> {[ semicolon, 4 ], + [ dollar ]}; + key <AE05> {[ colon, 5 ], + [ percent ]}; + key <AE06> {[ comma, 6 ], + [ asciicircum ]}; + key <AE07> {[ period, 7 ], + [ ampersand ]}; + key <AE08> {[ question, 8 ], + [ asterisk ]}; + key <AE09> {[ parenleft, 9 ]}; + key <AE10> {[ parenright, 0 ]}; + key <AE11> {[ underscore, minus ], + [ minus, underscore ]}; + key <AE12> {[ plus, equal ], + [ equal, plus ]}; + key <AD01> {[ Aogonek, aogonek ], + [ q, Q ]}; + key <AD02> {[ zcaron, Zcaron ], + [ w, W ]}; + key <AD11> {[ iogonek, Iogonek ], + [ bracketleft, braceleft ]}; + key <AD12> {[ leftdoublequotemark, doublelowquotemark ], + [ bracketright, braceright ]}; + key <AC10> {[ uogonek, Uogonek ], + [ semicolon, colon ]}; + key <AC11> {[ eabovedot, Eabovedot ], + [ apostrophe, quotedbl ]}; + key <AB02> {[ umacron, Umacron ], + [ x, X ]}; + key <AB08> {[ ccaron, Ccaron ], + [ comma, less ]}; + key <AB09> {[ scaron, Scaron ], + [ period, greater ]}; + key <AB10> {[ eogonek, Eogonek ], + [ slash, question ]}; + + // 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 }; +}; + +xkb_symbols "generic101" { + include "lt(basic)" +}; + +xkb_symbols "pc101" { + include "lt(generic101)" +}; + +default +xkb_symbols "pc102" { + include "lt(pc101)" + include "lt(left_switch)" +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + include "lt(basic)" // for consistent naming +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + include "lt(Sundeadkeys)" // for consistent naming +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + include "lt(basic)" // for consistent naming +}; + +// definition for the extra key on 102-key keyboards +// between left Control and Alt +xkb_symbols "left_switch" { + key <LSGT> { [ Mode_switch, Multi_key ], + [ Mode_switch, Multi_key ] }; + // Begin modifier mappings + modifier_map Mod3 { Mode_switch }; +}; + Index: xc/programs/xkbcomp/symbols/lv diff -u xc/programs/xkbcomp/symbols/lv:1.1.2.1 xc/programs/xkbcomp/symbols/lv:1.2 --- xc/programs/xkbcomp/symbols/lv:1.1.2.1 Wed May 23 16:21:53 2001 +++ xc/programs/xkbcomp/symbols/lv Wed May 23 16:13:23 2001 @@ -1,6 +1,6 @@ // 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 $ +// $XFree86: xc/programs/xkbcomp/symbols/lv,v 1.2 2001/05/23 20:13:23 dawes Exp $ partial default alphanumeric_keys modifier_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/mm diff -u /dev/null xc/programs/xkbcomp/symbols/mm:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/mm Wed Nov 21 17:28:52 2001 @@ -0,0 +1,67 @@ +// $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/mm,v 1.1 2001/11/21 22:28:52 dawes Exp $ +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Burmese"; + key <TLDE> { [], [ ] }; + + // Mainly numbers. + key <AE01> { [], [ 0x1001041, exclam ] }; + key <AE02> { [], [ 0x1001042 ] }; + key <AE03> { [], [ 0x1001043 ] }; + key <AE04> { [], [ 0x1001044 ] }; + key <AE05> { [], [ 0x1001045 ] }; + key <AE06> { [], [ 0x1001046 ] }; + key <AE07> { [], [ 0x1001047 ] }; + key <AE08> { [], [ 0x1001048 ] }; + key <AE09> { [], [ 0x1001049, parenleft ] }; + key <AE10> { [], [ 0x1001040, parenright ] }; + key <AE11> { [], [ minus, 0x1001038 ] }; + key <AE12> { [], [ 0x1001052, 0x1001056 ] }; + +// Mainly long vowels + + key <AD01> { [], [ 0x100102A, 0x100102A ] }; + key <AD02> { [], [ 0x1001032, 0x1001032 ] }; + key <AD03> { [], [ 0x100102C, 0x1001021 ] }; + key <AD04> { [], [ 0x100102E, 0x1001024 ] }; + key <AD05> { [], [ 0x1001030, 0x1001026 ] }; + +// Mainly voiced consonants + + key <AD06> { [], [ 0x1001017, 0x1001018 ] }; + key <AD07> { [], [ 0x100101F, 0x1001004 ] }; + key <AD08> { [], [ 0x1001002, 0x1001003 ] }; + key <AD09> { [], [ 0x1001012, 0x1001013 ] }; + key <AD10> { [], [ 0x1001007, 0x1001008 ] }; + key <AD11> { [], [ 0x100100d, 0x100100e ] }; + key <AD12> { [], [ 0x100100a, 0x1001009 ] }; + +// Mainly short vowels + key <AC01> { [], [ 0x1001029, 0x1001029 ] }; + key <AC02> { [], [ 0x1001027, 0x1001027 ] }; + key <AC03> { [], [ 0x1001039, 0x1001021 ] }; + key <AC04> { [], [ 0x100102D, 0x1001023 ] }; + key <AC05> { [], [ 0x100102F, 0x1001025 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [], [ 0x1001015, 0x1001016 ] }; + key <AC07> { [], [ 0x100101B, 0x100101B ] }; + key <AC08> { [], [ 0x1001000, 0x1001001 ] }; + key <AC09> { [], [ 0x1001010, 0x1001011 ] }; + key <AC10> { [], [ 0x1001005, 0x1001006 ] }; + key <AC11> { [], [ 0x100100b, 0x100100c ] }; + key <BKSL> { [], [ 0x100104E, 0x100104F ] }; + + key <AB01> { [], [ 0x100104C, 0x100104D ] }; + key <AB02> { [], [ 0x1001037, 0x1001036 ] }; + key <AB03> { [], [ 0x1001019, 0x100100f ] }; + key <AB04> { [], [ 0x1001014, 0x1001014 ] }; + key <AB05> { [], [ 0x1001017, 0x1001017 ] }; + key <AB06> { [], [ 0x100101C, 0x100101C ] }; + key <AB07> { [], [ 0x100101E, 0x1001050 ] }; + key <AB08> { [], [ comma, 0x1001051 ] }; + key <AB09> { [], [ period, 0x100104A ] }; + key <AB10> { [], [ slash, 0x100101A ] }; +}; Index: xc/programs/xkbcomp/symbols/mt diff -u /dev/null xc/programs/xkbcomp/symbols/mt:1.2 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/mt Mon Dec 17 15:00:47 2001 @@ -0,0 +1,59 @@ +// Maltese keyboard map (for UK-based keyboards) +// by Ramon Casha (ramon.casha@linux.org.mt) +// +// $XFree86: xc/programs/xkbcomp/symbols/mt,v 1.2 2001/12/17 20:00:47 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a UK keyboard + // and a Maltese layout. + include "gb(basic)" + name[Group1]= "Maltese (UK layout)"; + + // define the ^ as a deadkey for long accents (â). The use of + // long accents was officially dropped recently but there are + // still exists literature using it. + key <AE06> { + symbols[Group1]= [ 6, dead_circumflex ], + symbols[Group2]= [ asciicircum ] + }; + // define the grave accent as a deadkey for the ordinary accent (à). + key <TLDE> { + symbols[Group1]= [ dead_grave, notsign ], + symbols[Group2]= [ grave, bar ] + }; + // the following four sets are the four additional letters Å,Õ,¡,¯ (CGHZ) + key <AE12> { + symbols[Group1]= [ cabovedot, Cabovedot ], + symbols[Group2]= [ equal, plus ] + }; + key <AD11> { + symbols[Group1]= [ gabovedot, Gabovedot ], + symbols[Group2]= [ bracketleft, braceleft ] + }; + key <AD12> { + symbols[Group1]= [ hstroke, Hstroke ], + symbols[Group2]= [ bracketright, braceright ] + }; + key <LSGT> { + symbols[Group1]= [ zabovedot, Zabovedot ], + symbols[Group2]= [ backslash, bar ] + }; + // add Å Õ ¡ and ¯ as AltGr + C G H or Z for convenience. + key <AC05> { [], [ gabovedot, Gabovedot ] }; + key <AC06> { [], [ hstroke, Hstroke ] }; + key <AB01> { [], [ zabovedot, Zabovedot ] }; + key <AB03> { [], [ cabovedot, Cabovedot ] }; + // and the Euro sign as AltGr-E + key <AD03> { [], [ EuroSign ] }; + + // 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/mt_us diff -u /dev/null xc/programs/xkbcomp/symbols/mt_us:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/mt_us Fri Aug 17 12:31:25 2001 @@ -0,0 +1,58 @@ +// Maltese keyboard map (for US-based keyboards) +// by Ramon Casha (ramon.casha@linux.org.mt) +// +// $XFree86: xc/programs/xkbcomp/symbols/mt_us,v 1.1 2001/08/17 16:31:25 dawes Exp $ + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and the interim Maltese keyboard + + name[Group1]= "Maltese"; + + // define the ^ as a deadkey for long accents (â). The use of + // long accents was officially dropped recently but there are + // still exists literature using it. + key <AE06> { + symbols[Group1]= [ 6, dead_circumflex ], + symbols[Group2]= [ asciicircum ] + }; + // define the grave accent as a deadkey for the ordinary accent (à). + key <TLDE> { + symbols[Group1]= [ dead_grave, asciitilde ], + symbols[Group2]= [ grave ] + }; + // the following four sets are the four additional letters Å,Õ,¡,¯ (CGHZ) + key <AE12> { + symbols[Group1]= [ cabovedot, Cabovedot ], + symbols[Group2]= [ equal, plus ] + }; + key <AD11> { + symbols[Group1]= [ gabovedot, Gabovedot ], + symbols[Group2]= [ bracketleft, braceleft ] + }; + key <AD12> { + symbols[Group1]= [ hstroke, Hstroke ], + symbols[Group2]= [ bracketright, braceright ] + }; + key <BKSL> { + symbols[Group1]= [ zabovedot, Zabovedot ], + symbols[Group2]= [ backslash, bar ] + }; + // add Å Õ ¡ and ¯ as AltGr + C G H or Z for convenience. + key <AC05> { [], [ gabovedot, Gabovedot ] }; + key <AC06> { [], [ hstroke, Hstroke ] }; + key <AB01> { [], [ zabovedot, Zabovedot ] }; + key <AB03> { [], [ cabovedot, Cabovedot ] }; + key <AD03> { [], [ EuroSign ] }; + + // 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/nl diff -u /dev/null xc/programs/xkbcomp/symbols/nl:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/nl Wed Nov 21 17:28:52 2001 @@ -0,0 +1,98 @@ +// Converted keytable file to xkb/symbols/ file +// with mk_xkb by root@linux.chanae.stben.be Tue Sep 30 00:53:29 MET DST 1997 + +// converted from the nl-latin.map of the Linux kbd package by +// Pablo Saratxaga <srtxg@f2219.n293.z2.fidonet.org> + +default partial alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple US/ASCII + // keyboard and a very simple Nederland keyboard + + // Alphanumeric section + name[Group1]= "Nederland"; + + key <AE01> { [ 1, exclam ], + [ onesuperior ] }; + key <AE02> { [ 2, quotedbl ], + [ twosuperior ] }; + key <AE03> { [ 3, numbersign ], + [ threesuperior ] }; + key <AE04> { [ 4, dollar ], + [ onequarter ] }; + key <AE05> { [ 5, percent ], + [ onehalf ] }; + key <AE06> { [ 6, ampersand ], + [ threequarters ] }; + key <AE07> { [ 7, underscore ], + [ sterling ] }; + key <AE08> { [ 8, parenleft ], + [ braceleft ] }; + key <AE09> { [ 9, parenright ], + [ braceright ] }; + key <AE10> { [ 0, apostrophe ] }; + key <AE11> { [ slash, question ], + [ backslash ] }; + key <AE12> { [ degree, dead_tilde ], + [ dead_cedilla ] }; + key <AD03> { [ e, E ], + [ eacute, Eacute ] }; + key <AD04> { [ r, R ], + [ paragraph, registered ] }; + key <AD05> { [ t, T ], + [ thorn, THORN ] }; + key <AD06> { [ y, Y ], + [ ydiaeresis, yen ] }; + key <AD07> { [ u, U ], + [ udiaeresis, Udiaeresis ] }; + key <AD08> { [ i, I ], + [ idiaeresis, Idiaeresis ] }; + key <AD09> { [ o, O ], + [ ograve, Ograve ] }; + key <AD10> { [ p, P ], + [ paragraph ] }; + key <AD11> { [ dead_diaeresis, dead_tilde ], + [ asciitilde, asciicircum ] }; + key <AD12> { [ asterisk, bar ] }; + key <AC01> { [ a, A ], + [ aacute, Aacute ] }; + key <AC02> { [ s, S ], + [ ssharp ] }; + key <AC03> { [ d, D ], + [ eth, ETH ] }; + key <AC04> { [ f, F ], + [ ordfeminine, ordfeminine ] }; + key <AC10> { [ plus, plusminus ] }; + key <AC11> { [ apostrophe, grave ], + [ dead_acute, dead_grave ] }; + key <TLDE> { [ at, section ], + [ notsign ] }; + key <BKSL> { [ less, greater ] }; + key <AB01> { [ z, Z ], + [ guillemotleft ] }; + key <AB02> { [ x, X ], + [ guillemotright ] }; + key <AB03> { [ c, C ], + [ cent, copyright ] }; + key <AB06> { [ n, N ], + [ ntilde, Ntilde ] }; + key <AB07> { [ m, M ], + [ Greek_mu, masculine ] }; + key <AB08> { [ comma, semicolon ], + [ cedilla, guillemotleft ] }; + key <AB09> { [ period, colon ], + [ periodcentered, guillemotright ] }; + key <AB10> { [ minus, equal ], + [ hyphen ] }; + key <LSGT> { [ bracketleft, bracketright ], + [ bar ] }; + + // 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/pc104 diff -u xc/programs/xkbcomp/symbols/pc104:3.4 xc/programs/xkbcomp/symbols/pc104:3.5 --- xc/programs/xkbcomp/symbols/pc104:3.4 Wed Jan 17 18:45:59 2001 +++ xc/programs/xkbcomp/symbols/pc104 Fri Aug 17 09:27:58 2001 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/pc104,v 3.4 2001/01/17 23:45:59 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/pc104,v 3.5 2001/08/17 13:27:58 dawes Exp $ // Use "Alt_*" for both alt keys, "Meta_*" for both windows keys, and Menu for // the menu key @@ -23,4 +23,10 @@ key <RALT> { [ Alt_R ] }; key <RWIN> { [ Meta_R ] }; key <MENU> { [ Multi_key ] }; +}; + +// Use Menu for the menu key +partial modifier_keys +xkb_symbols "menu" { + key <MENU> { [ Menu ] }; }; Index: xc/programs/xkbcomp/symbols/pl2 diff -u /dev/null xc/programs/xkbcomp/symbols/pl2:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/pl2 Wed Nov 21 17:28:52 2001 @@ -0,0 +1,119 @@ +// $XConsortium: pl2 /main/3 1996/08/31 12:20:05 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/pl2,v 3.4 1999/08/30 02:34:28 dawes Exp +// $ +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple QWERTZ Polish keybaord + + name[Group1]= "Polish"; + + key <TLDE> { [ abovedot, dead_ogonek ] }; + + key <AE01> { [ 1, excalem ], + [ asciitilde ] }; + key <AE02> { [ 2, quotedbl ], + [ dead_caron ] }; + key <AE03> { [ 3, numbersign ], + [ dead_circumflex ] }; + key <AE04> { [ 4, dollar ], + [ dead_breve ] }; + key <AE05> { [ 5, percent ], + [ degree ] }; + key <AE06> { [ 6, ampersand ], + [ dead_ogonek ] }; + key <AE07> { [ 7, slash ], + [ dead_grave ] }; + key <AE08> { [ 8, parenleft ], + [ dead_abovedot ] }; + key <AE09> { [ 9, parenright ], + [ dead_acute ] }; + key <AE10> { [ 0, equal ], + [ dead_doubleacute ] }; + key <AE11> { [ plus, question ], + [ dead_diaeresis ] }; + key <AE12> { [ apostrophe, asterisk ], + [ dead_cedilla ] }; + + key <AD01> { [ q, Q ], + [ backslash ] }; + key <AD02> { [ w, W ], + [ bar ] }; + key <AD03> { [ e, E ], + [ EuroSign, cent ] }; + key <AD04> { [ r, R ] }; + key <AD05> { [ t, T ] }; + key <AD06> { [ z, Z ] }; + key <AD07> { [ u, U ] }; + key <AD08> { [ i, I ] }; + key <AD09> { [ o, O ] }; + key <AD10> { [ p, P ] }; + key <AD11> { [ zabovedot, nacute ], + [ division ] }; + key <AD12> { [ sacute, cacute ], + [ multiply ] }; + + key <AC01> { [ a, A ] }; + key <AC02> { [ s, S ], + [ dstroke ] }; + key <AC03> { [ d, D ], + [ Dstroke ] }; + key <AC04> { [ f, F ], + [ bracketleft ] }; + key <AC05> { [ g, G ], + [ bracketright ] }; + key <AC06> { [ h, H ] }; + key <AC07> { [ j, J ] }; + key <AC08> { [ k, K ] }; + key <AC09> { [ l, L ] }; + key <AC10> { [ lstroke, Lstroke ], + [ dollar ] }; + key <AC11> { [ aogonek, eogonek ], + [ ssharp ] }; + + key <BKSL> { [ oacute, zacute ] }; + + key <AB01> { [ y, Y ] }; + key <AB02> { [ x, X ] }; + key <AB03> { [ C, C ] }; + 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 ] }; + key <AB10> { [ minus, underscore ] }; + + key <LSGT> { [ less, greater ], + [ bar ] }; + + // 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 }; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + include "pl2(basic)" // for consistent naming +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + include "pl2(Sundeadkeys)" // for consistent naming +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + include "pl2(basic)" // for consistent naming +}; +// end of file /usr/X11R6/bin/X11/xkb/symbols/pl2 + Index: xc/programs/xkbcomp/symbols/ro diff -u xc/programs/xkbcomp/symbols/ro:3.1.6.1 xc/programs/xkbcomp/symbols/ro:3.4 --- xc/programs/xkbcomp/symbols/ro:3.1.6.1 Wed May 23 14:32:19 2001 +++ xc/programs/xkbcomp/symbols/ro Fri Dec 21 16:03:59 2001 @@ -4,45 +4,33 @@ // and the corresponing letter we are able to generate the romanian characters // // Created by Cristian Gafton, <gafton@redhat.com> (C) 2000 +// Modified by Miºu Moldovan, <dumol@go.ro> (C) 2001 +// Modified by Marius Andreiana, <mandreiana@yahoo.com> (C) 2001 // -// $XFree86: xc/programs/xkbcomp/symbols/ro,v 3.1.6.1 2001/05/23 18:32:19 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/ro,v 3.4 2001/12/21 21:03:59 dawes Exp $ +// Diacriticele se scriu cu ALT-ul din dreapta si q,t,i,a,s (+shift eventual) +// + -partial hidden alphanumeric_keys modifier_keys +default partial alphanumeric_keys xkb_symbols "basic" { + name[Group1]= "Romanian"; - key <TLDE> { [], [ acircumflex, acircumflex ] }; - key <AC01> { [], [ atilde, acircumflex ] }; - key <AC02> { [], [ masculine, ordfeminine ] }; - key <AD05> { [], [ thorn, Thorn ] }; + // Alphanumeric section + key <AD01> { [], [ acircumflex, Acircumflex ] }; + key <AC01> { [], [ abreve, Abreve ] }; + key <AC02> { [], [ scedilla, Scedilla ] }; + key <AD05> { [], [ tcedilla, Tcedilla ] }; key <AD08> { [], [ icircumflex, Icircumflex ] }; -}; - -default -xkb_symbols "pc101" { - key <RALT> { [ Mode_switch, Multi_key ] }; - - include "ro(basic)" - - modifier_map Mod3 { Mode_switch }; -}; - -xkb_symbols "pc104" { - key <RALT> { [ Mode_switch ] }; - key <RWIN> { [ Multi_key ] }; - - include "ro(basic)" - - modifier_map Mod3 { Mode_switch }; -}; -xkb_symbols "alt_is_meta" { - key <LALT> { [ Meta_L ] }; - key <LWIN> { [ Alt_L ] }; + key <RALT> { [ Mode_switch, Multi_key ] }; + // End alphanumeric section - include "ro(pc104)" + // begin modifier mappings + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; - // modifier mappings - modifier_map Mod1 { Meta_L, Meta_R }; - modifier_map Mod4 { Alt_L, Alt_R }; }; Index: xc/programs/xkbcomp/symbols/ru diff -u xc/programs/xkbcomp/symbols/ru:3.8 xc/programs/xkbcomp/symbols/ru:3.9 --- xc/programs/xkbcomp/symbols/ru:3.8 Wed Jan 17 18:45:59 2001 +++ xc/programs/xkbcomp/symbols/ru Wed Jan 16 13:20:12 2002 @@ -1,116 +1,121 @@ // $Xorg: ru,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ // -// russian standard keyboard +// russian standard keyboard // AEN <aen@logic.ru> -// -// $XFree86: xc/programs/xkbcomp/symbols/ru,v 3.8 2001/01/17 23:45:59 dawes Exp $ +// Last Changes 2001/12/23 by Leon Kanter <leon@blackcatlinux.com> +// $XFree86: xc/programs/xkbcomp/symbols/ru,v 3.9 2002/01/16 18:20:12 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { // Describes the differences between a very simple en_US - // keyboard and a very simple Russian keybaord + // keyboard and a very simple Russian keyboard name[Group1]= "US/ASCII"; name[Group2]= "Russian"; - 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 <AE03> { [ 3, numbersign ], + [ 3, numbersign ] }; key <AE04> { [ 4, dollar ], [ 4, asterisk ] }; - key <AE03> { [ 3, numbersign ], - [ 3, apostrophe ] }; - 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, colon ] }; - key <AB06> { [ n, N ], - [ Cyrillic_te, Cyrillic_TE ] }; - key <AB05> { [ b, B ], - [ Cyrillic_i, Cyrillic_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, comma ] }; - 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, period ] }; key <AE08> { [ 8, asterisk ], [ 8, semicolon ] }; - 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 ], - [ Cyrillic_shcha, Cyrillic_SHCHA ] }; - key <AE10> { [ 0, parenright ], - [ 0, parenright ] }; key <AE09> { [ 9, parenleft ], [ 9, parenleft ] }; - key <AB09> { [ period, greater ], - [ Cyrillic_yu, Cyrillic_YU ] }; + key <AE10> { [ 0, parenright ], + [ 0, parenright ] }; + key <AE11> { [ minus, underscore ], + [ minus, underscore ] }; + key <AE12> { [ equal, plus ], + [ equal, plus ] }; + key <BKSL> { [ backslash, bar ], + [ backslash, bar ] }; key <AB10> { [ slash, question ], [ slash, question ] }; - key <AC09> { [ l, L ], - [ Cyrillic_de, Cyrillic_DE ] }; - key <AC10> { [ semicolon, colon ], - [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LSGT> { [ less, greater ], + [ slash, bar ] }; + +key.type[group2]="ALPHABETIC"; + + key <TLDE> { [ grave, asciitilde ], + [ Cyrillic_io, Cyrillic_IO ] }; + key <AD01> { [ q, Q ], + [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD02> { [ w, W ], + [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD03> { [ e, E ], + [ Cyrillic_u, Cyrillic_U ] }; + key <AD04> { [ r, R ], + [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD05> { [ t, T ], + [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD06> { [ y, Y ], + [ Cyrillic_en, Cyrillic_EN ] }; + key <AD07> { [ u, U ], + [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD08> { [ i, I ], + [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD09> { [ o, O ], + [ Cyrillic_shcha, Cyrillic_SHCHA ] }; 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 ], [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; - key <BKSL> { [ backslash, bar ], - [ backslash, bar ] }; + key <AC01> { [ a, A ], + [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ s, S ], + [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC03> { [ d, D ], + [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ f, F ], + [ Cyrillic_a, Cyrillic_A ] }; + key <AC05> { [ g, G ], + [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC06> { [ h, H ], + [ Cyrillic_er, Cyrillic_ER ] }; + key <AC07> { [ j, J ], + [ Cyrillic_o, Cyrillic_O ] }; + key <AC08> { [ k, K ], + [ Cyrillic_el, Cyrillic_EL ] }; + key <AC09> { [ l, L ], + [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ semicolon, colon ], + [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC11> { [ apostrophe, quotedbl ], + [ Cyrillic_e, Cyrillic_E ] }; + key <AB01> { [ z, Z ], + [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB02> { [ x, X ], + [ Cyrillic_che, Cyrillic_CHE ] }; + key <AB03> { [ c, C ], + [ Cyrillic_es, Cyrillic_ES ] }; + key <AB04> { [ v, V ], + [ Cyrillic_em, Cyrillic_EM ] }; + key <AB06> { [ n, N ], + [ Cyrillic_te, Cyrillic_TE ] }; + key <AB05> { [ b, B ], + [ Cyrillic_i, Cyrillic_I ] }; + key <AB07> { [ m, M ], + [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AB08> { [ comma, less ], + [ Cyrillic_be, Cyrillic_BE ] }; + key <AB09> { [ period, greater ], + [ Cyrillic_yu, Cyrillic_YU ] }; +key.type[group2]="TWO_LEVEL"; + // End alphanumeric section // Begin modifier mappings @@ -124,21 +129,167 @@ partial alphanumeric_keys xkb_symbols "winkeys" { include "ru(basic)" - key <AE04> { [ 4, dollar ], - [ 4, semicolon ] }; + key <AE03> { [ 3, numbersign ], + [ 3, numerosign ] }; + key <AE04> { [ 4, dollar ], + [ 4, semicolon ] }; + 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 ] }; +}; + +partial alphanumeric_keys +xkb_symbols "typewriter" { + include "ru(basic)" + key <TLDE> { [ grave, asciitilde ], + [ apostrophe, quotedbl ] }; + key <AE01> { [ 1, exclam ], + [ exclam, 1 ] }; + key <AE02> { [ 2, at ], + [ numerosign, 2 ] }; key <AE03> { [ 3, numbersign ], - [ 3, numbersign ] }; + [ slash, 3 ] }; + key <AE04> { [ 4, dollar ], + [ semicolon, 4 ] }; key <AE05> { [ 5, percent ], + [ colon, 5 ] }; + key <AE06> { [ 6, asciicircum ], + [ comma, 6 ] }; + key <AE07> { [ 7, ampersand ], + [ period, 7 ] }; + key <AE08> { [ 8, asterisk ], + [ underscore, 8 ] }; + key <AE09> { [ 9, parenleft ], + [ question, 9 ] }; + key <AE10> { [ 0, parenright ], + [ percent, 0 ] }; + key <BKSL> { [ backslash, bar ], + [ parenleft, parenright ] }; + +key.type[group2]="ALPHABETIC"; + + key <AD12> { [ bracketright, braceright ], + [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <AB05> { [ b, B ], + [ Cyrillic_i, Cyrillic_I ] }; + key <AB10> { [ slash, question ], + [ Cyrillic_io, Cyrillic_IO ] }; +}; + +partial alphanumeric_keys +xkb_symbols "phonetic" { + include "ru(basic)" + + key <AE01> { [ 1, exclam ], + [ 1, exclam ] }; + key <AE02> { [ 2, at ], + [ 2, at ] }; + key <AE03> { [ 3, numbersign ], + [ 3, Cyrillic_io ] }; + key <AE04> { [ 4, dollar ], + [ 4, Cyrillic_IO ] }; + key <AE05> { [ 5, percent ], [ 5, percent ] }; key <AE06> { [ 6, asciicircum ], - [ 6, colon ] }; + [ 6, asciicircum ] }; key <AE07> { [ 7, ampersand ], - [ 7, question ] }; + [ 7, ampersand ] }; key <AE08> { [ 8, asterisk ], - [ 8, asterisk ] }; + [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ], + [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ], + [ 0, parenright ] }; + + key <AB09> { [ period, greater ], + [ period, greater ] }; key <AB10> { [ slash, question ], - [ period, comma ] }; + [ slash, question ] }; + key <AB08> { [ comma, less ], + [ comma, less ] }; + key <AC10> { [ semicolon, colon ], + [ semicolon, colon ] }; + key <AC11> { [ apostrophe, quotedbl ], + [ apostrophe, quotedbl ] }; + key <LSGT> { [ less, greater ], + [ bar, brokenbar ] }; + +key.type[group2]="ALPHABETIC"; + + key <TLDE> { [ grave, asciitilde ], + [ Cyrillic_yu, Cyrillic_YU ] }; + key <AD01> { [ q, Q ], + [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB01> { [ z, Z ], + [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AC02> { [ s, S ], + [ Cyrillic_es, Cyrillic_ES ] }; + key <AC01> { [ a, A ], + [ Cyrillic_a, Cyrillic_A ] }; + key <AD02> { [ w, W ], + [ Cyrillic_ve, Cyrillic_VE ] }; + key <AB03> { [ c, C ], + [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AB02> { [ x, X ], + [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AC03> { [ d, D ], + [ Cyrillic_de, Cyrillic_DE ] }; + key <AD03> { [ e, E ], + [ Cyrillic_ie, Cyrillic_IE ] }; + key <AB04> { [ v, V ], + [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC04> { [ f, F ], + [ Cyrillic_ef, Cyrillic_EF ] }; + key <AD05> { [ t, T ], + [ Cyrillic_te, Cyrillic_TE ] }; + key <AD04> { [ r, R ], + [ Cyrillic_er, Cyrillic_ER ] }; + key <AB06> { [ n, N ], + [ Cyrillic_en, Cyrillic_EN ] }; + key <AB05> { [ b, B ], + [ Cyrillic_be, Cyrillic_BE ] }; + key <AC06> { [ h, H ], + [ Cyrillic_ha, Cyrillic_HA ] }; + key <AC05> { [ g, G ], + [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD06> { [ y, Y ], + [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AB07> { [ m, M ], + [ Cyrillic_em, Cyrillic_EM ] }; + key <AC07> { [ j, J ], + [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD07> { [ u, U ], + [ Cyrillic_u, Cyrillic_U ] }; + key <AC08> { [ k, K ], + [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD08> { [ i, I ], + [ Cyrillic_i, Cyrillic_I ] }; + key <AD09> { [ o, O ], + [ Cyrillic_o, Cyrillic_O ] }; + key <AC09> { [ l, L ], + [ Cyrillic_el, Cyrillic_EL ] }; + key <AD10> { [ p, P ], + [ Cyrillic_pe, Cyrillic_PE ] }; + key <AE11> { [ minus, underscore ], + [ minus, Cyrillic_hardsign ] }; + key <AD11> { [ bracketleft, braceleft ], + [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AE12> { [ equal, plus ], + [ Cyrillic_che, Cyrillic_CHE ] }; + key <AD12> { [ bracketright, braceright ], + [ Cyrillic_shcha, Cyrillic_SHCHA ] }; key <BKSL> { [ backslash, bar ], - [ slash, bar ] }; -}; + [ Cyrillic_e, Cyrillic_E ] }; + 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/ru_yawerty diff -u /dev/null xc/programs/xkbcomp/symbols/ru_yawerty:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/ru_yawerty Wed Nov 21 17:28:52 2001 @@ -0,0 +1,93 @@ +// ru_yawerty (cyrillic phonetic) + +// From the comments of the xmodmap file: +// +// Bulgarian Cyrillic keyboard.map. "Cyrillic" mode is toggled by +// Right_Ctrl key and shifted by AltGr key. Eugene Crosser's `ru.map' +// was used as a template. Note that this is a "phonetic" keyboard, +// not a `BDS' one! --L.Georgiev + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple "YAWERTY" cyrillic keyboard + + name[Group1]= "US/ASCII"; + name[Group2]= "Cyrillic"; + + + key <TLDE> { [ quoteleft, asciitilde ], + [ Cyrillic_che, Cyrillic_CHE ] }; + + key <AE12> { [ equal, plus ], + [ Cyrillic_yu, Cyrillic_YU ] }; + + key <AD01> { [ q, Q ], + [ Cyrillic_ya, Cyrillic_YA ] }; + key <AD02> { [ w, W ], + [ Cyrillic_ve, Cyrillic_VE ] }; + key <AD03> { [ e, E ], + [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD04> { [ r, R ], + [ Cyrillic_er, Cyrillic_ER ] }; + key <AD05> { [ t, T ], + [ Cyrillic_te, Cyrillic_TE ] }; + key <AD06> { [ y, Y ], + [ Cyrillic_hardsign, Cyrillic_HARDSIGN ] }; + key <AD07> { [ u, U ], + [ Cyrillic_u, Cyrillic_U ] }; + key <AD08> { [ i, I ], + [ Cyrillic_i, Cyrillic_I ] }; + key <AD09> { [ o, O ], + [ Cyrillic_o, Cyrillic_O ] }; + key <AD10> { [ p, P ], + [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD11> { [ bracketleft, braceleft ], + [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD12> { [ bracketright, braceright ], + [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + + key <AC01> { [ a, A ], + [ Cyrillic_a, Cyrillic_A ] }; + key <AC02> { [ s, S ], + [ Cyrillic_es, Cyrillic_ES ] }; + key <AC03> { [ d, D ], + [ Cyrillic_de, Cyrillic_DE ] }; + key <AC04> { [ f, F ], + [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC05> { [ g, G ], + [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AC06> { [ h, H ], + [ Cyrillic_ha, Cyrillic_HA ] }; + key <AC07> { [ j, J ], + [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AC08> { [ k, K ], + [ Cyrillic_ka, Cyrillic_KA ] }; + key <AC09> { [ l, L ], + [ Cyrillic_el, Cyrillic_EL ] }; + + key <AB01> { [ z, Z ], + [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AB02> { [ x, X ], + [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <AB03> { [ c, C ], + [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AB04> { [ v, V ], + [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AB05> { [ b, B ], + [ Cyrillic_be, Cyrillic_BE ] }; + key <AB06> { [ n, N ], + [ Cyrillic_en, Cyrillic_EN ] }; + key <AB07> { [ m, M ], + [ Cyrillic_em, Cyrillic_EM ] }; + + // 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/sapmi diff -u /dev/null xc/programs/xkbcomp/symbols/sapmi:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/sapmi Wed Nov 21 16:20:55 2001 @@ -0,0 +1,194 @@ +// Northern Sami keyboards for Finland, Norway and Sweden +// +// Describes the differences between a very simple en_US +// keyboard and a Norwegian Northern Sami keyboard (with +// dead key support) according to the spec on +// http://www.hum.uit.no/a/trond/se-lat9-no-keys.html +// Written by Børre Gaup <boerre.gaup@pc.nu> +// +// $XFree86: xc/programs/xkbcomp/symbols/sapmi,v 1.1 2001/11/21 21:20:55 dawes Exp $ +// +// Quick usage +// For a Norwegian Northern Sami setup: +// setxkbmap -layout sapmi +// For a Swedish/Finnish Northern Sami setup: +// setxkbmap -layout "sapmi(sefi)" +// For a Swedish/Finnish Northern Sami setup, with an en_US keyboard as Group3: +// setxkbmap "sapmi(sefi)+us_group3" + +partial alphanumeric_keys + xkb_symbols "basic" { + + + name[Group1]= "Sámegiella"; + + key <TLDE> { [ bar, section ], + [ brokenbar, paragraph ]}; + key <AE01> { [ 1, exclam ], + [ copyright, exclamdown ]}; + key <AE02> { [ 2, quotedbl ], + [ at, registered ]}; + key <AE03> { [ 3, numbersign ], + [ sterling, less ]}; + key <AE04> { [ 4, dollar ], + [ dollar, greater ]}; + + // 0x2022 BULLET and 0x2030 PER MILLE SIGN + key <AE05> { [ 5, percent ], + [ 0x01002022, 0x01002030 ]}; + key <AE06> { [ 6, ampersand ], + [ section, paragraph ]}; + key <AE07> { [ 7, slash ], + [ braceleft, bar ]}; + key <AE08> { [ 8, parenleft ], + [ bracketleft, braceleft ]}; + key <AE09> { [ 9, parenright ], + [ bracketright, braceright ]}; + key <AE10> { [ 0, equal ], + [ braceright, notequal ]}; + key <AE11> { [ plus, question ], + [ division, questiondown ]}; + key <AE12> { [ backslash, grave ], + [ acute, asciitilde ]}; + + + key <AD01> { [ aacute, Aacute ], + [ q, Q ]}; + key <AD02> { [ scaron, Scaron ], + [ w, W ]}; + key <AD03> { [ e, E ], + [ eacute, Eacute ]}; + key <AD04> { [ r, R ], + [ registered, trademark ]}; + key <AD05> { [ t, T ], + [ tslash, Tslash ]}; + key <AD06> { [ y, Y ], + [ yacute, Yacute ]}; + key <AD07> { [ u, U ], + [ udiaeresis, Udiaeresis ]}; + key <AD08> { [ i, I ], + [ idiaeresis, Idiaeresis ]}; + key <AD09> { [ o, O ], + [ oe, OE ]}; + key <AD10> { [ p, P ], + [ thorn, THORN ]}; + key <AD11> { [ aring, Aring ], + [ acircumflex, Acircumflex ]}; + key <AD12> { [ eng, ENG ], + [ quotedbl, asciicircum ]}; + + key <AC01> { [ a, A ], + [ agrave, Agrave ]}; + key <AC02> { [ s, S ], + [ ssharp, apostrophe ]}; + key <AC03> { [ d, D ], + [ eth, ETH ]}; + key <AC04> { [ f, F ], + [ ordfeminine, ordfeminine ]}; + key <AC05> { [ g, G ], + [ gcaron, Gcaron ]}; + // 0x01e5 LATIN SMALL LETTER G WITH STROKE and + // 0x01e4 LATIN CAPITAL LETTER G WITH STROKE + key <AC06> { [ h, H ], + [ 0x010001e5, 0x010001e4 ]}; + key <AC07> { [ j, J ], + [ notsign, multiply ]}; + // 0x01e9 LATIN SMALL LETTER K WITH CARON and + // 0x01e8 LATIN CAPITAL LETTER K WITH CARON + key <AC08> { [ k, K ], + [ 0x010001e9, 0x010001e8 ]}; + key <AC09> { [ l, L ], + [ degree, hyphen ]}; + key <AC10> { [ oslash, Ooblique ], + [ odiaeresis, Odiaeresis ]}; + key <AC11> { [ ae, AE ], + [ adiaeresis, Adiaeresis ]}; + key <BKSL> { [ dstroke, Dstroke ], + [ apostrophe, asterisk ]}; + + // 0x01ef LATIN SMALL LETTER EZH WITH CARON and + // 0x01ee LATIN CAPITAL LETTER EZH WITH CARON + key <LSGT> { [ zcaron, Zcaron ], + [ 0x010001ef, 0x010001ee ]}; + // 0x0292 LATIN SMALL LETTER EZH and + // 0x01b7 LATIN CAPITAL LETTER EZH + key <AB01> { [ z, Z ], + [ 0x01000292, 0x010001b7 ]}; + key <AB02> { [ ccaron, Ccaron ], + [ x, X ]}; + key <AB03> { [ c, C ], + [ ccedilla, Ccedilla ]}; + key <AB04> { [ v, V ], + [ lessthanequal, guillemotleft ]}; + key <AB05> { [ b, B ], + [greaterthanequal, guillemotright ]}; + key <AB06> { [ n, N ], + [leftsinglequotemark,leftdoublequotemark ]}; + key <AB07> { [ m, M ], + [rightsinglequotemark,rightdoublequotemark]}; + key <AB08> { [ comma, semicolon ], + [singlelowquotemark,doublelowquotemark ]}; + key <AB09> { [ period, colon ], + [ ellipsis, periodcentered ]}; + key <AB10> { [ minus, underscore ], + [ endash, emdash ]}; + + key <SPCE> { [ space, space ], + [ nobreakspace, nobreakspace ]}; + + // 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 }; +}; + + + xkb_symbols "sefi" { + + // Describes the differences between a Norwegian Northern Sami + // (keyboard with dead key support) and a Swedish/Finnish Sami + // keyboard according to the specs at: + // http://www.hum.uit.no/a/trond/se-lat9-sefi-keys.html + + name[Group1]= "Sámegiella"; + + include "sapmi(basic)" + + key <AC10> { [ odiaeresis, Odiaeresis ], + [ oslash, Ooblique ]}; + key <AC11> { [ adiaeresis, Adiaeresis ], + [ ae, AE ]}; +}; + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + + // For naming consistency + + include "sapmi(basic)" + +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + + // For naming consistency + + include "sapmi(Sundeadkeys)" + +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Modifies the basic Norwegian layout to eliminate dead keys + + include "sapmi(basic)" + key <AE12> { [ backslash, grave ], + [ acute, ogonek ] }; + +}; Index: xc/programs/xkbcomp/symbols/se diff -u xc/programs/xkbcomp/symbols/se:3.7 xc/programs/xkbcomp/symbols/se:3.8 --- xc/programs/xkbcomp/symbols/se:3.7 Wed Jan 17 18:45:59 2001 +++ xc/programs/xkbcomp/symbols/se Fri Aug 17 09:27:58 2001 @@ -3,7 +3,7 @@ -// $XFree86: xc/programs/xkbcomp/symbols/se,v 3.7 2001/01/17 23:45:59 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/se,v 3.8 2001/08/17 13:27:58 dawes Exp $ partial alphanumeric_keys xkb_symbols "basic" { @@ -19,7 +19,7 @@ key <LSGT> { [ less, greater ], [ bar, brokenbar ]}; key <SPCE> { [ space, space ], - [ nobreakspace, nobreakspace ]}; + [ space, nobreakspace ]}; key <AE01> { [ 1, exclam ], [ exclamdown, onesuperior ]}; key <AE02> { [ 2, quotedbl ], Index: xc/programs/xkbcomp/symbols/se_FI diff -u /dev/null xc/programs/xkbcomp/symbols/se_FI:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/se_FI Wed Nov 21 16:20:55 2001 @@ -0,0 +1,10 @@ +// Northern Sami keyboard for Finland +// Written by Børre Gaup <boerre.gaup@pc.nu> +// Quick usage: setxkbmap se_FI +// +// $XFree86: xc/programs/xkbcomp/symbols/se_FI,v 1.1 2001/11/21 21:20:55 dawes Exp $ + +partial alphanumeric_keys + xkb_symbols "basic" { + include "sapmi(sefi)" +}; Index: xc/programs/xkbcomp/symbols/se_NO diff -u /dev/null xc/programs/xkbcomp/symbols/se_NO:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/se_NO Wed Nov 21 16:20:55 2001 @@ -0,0 +1,10 @@ +// Northern Sami keyboard for Norway +// Written by Børre Gaup <boerre.gaup@pc.nu> +// Quick usage: setxkbmap se_FI +// +// $XFree86: xc/programs/xkbcomp/symbols/se_NO,v 1.1 2001/11/21 21:20:55 dawes Exp $ + +partial alphanumeric_keys + xkb_symbols "basic" { + include "sapmi(basic)" +}; Index: xc/programs/xkbcomp/symbols/se_SE diff -u /dev/null xc/programs/xkbcomp/symbols/se_SE:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/se_SE Wed Nov 21 16:20:55 2001 @@ -0,0 +1,10 @@ +// Northern Sami keyboard for Sweden +// Written by Børre Gaup <boerre.gaup@pc.nu> +// Quick usage: setxkbmap se_FI +// +// $XFree86: xc/programs/xkbcomp/symbols/se_SE,v 1.1 2001/11/21 21:20:55 dawes Exp $ + +partial alphanumeric_keys + xkb_symbols "basic" { + include "sapmi(sefi)" +}; Index: xc/programs/xkbcomp/symbols/sk diff -u xc/programs/xkbcomp/symbols/sk:1.1 xc/programs/xkbcomp/symbols/sk:1.3 --- xc/programs/xkbcomp/symbols/sk:1.1 Fri May 18 19:35:35 2001 +++ xc/programs/xkbcomp/symbols/sk Mon Dec 24 17:23:10 2001 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/symbols/sk,v 1.1 2001/05/18 23:35:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/sk,v 1.3 2001/12/24 22:23:10 dawes Exp $ partial alphanumeric_keys xkb_symbols "basic" { @@ -9,6 +9,11 @@ // to satisfy most unix, windows and mac users. // 2001 by Kamil Toman <ktoman@email.cz> + // Switching to US added by Jan Holesovsky <kendy@suse.cz>, 2001 + + include "us_group2(basic)" + include "group(shift_toggle)" + name[Group1] = "Slovak"; key.type = "FOUR_LEVEL"; @@ -17,7 +22,7 @@ grave, asciitilde ] }; key <AE01> { [ plus, 1, exclam, dead_tilde ] }; - key <AE02> { [ lacute, 2, + key <AE02> { [ lcaron, 2, at, dead_caron ] }; key <AE03> { [ scaron, 3, numbersign, dead_circumflex ] }; Index: xc/programs/xkbcomp/symbols/sk_qwerty diff -u xc/programs/xkbcomp/symbols/sk_qwerty:1.1 xc/programs/xkbcomp/symbols/sk_qwerty:1.2 --- xc/programs/xkbcomp/symbols/sk_qwerty:1.1 Fri May 18 19:35:35 2001 +++ xc/programs/xkbcomp/symbols/sk_qwerty Mon Oct 1 10:04:16 2001 @@ -1,15 +1,16 @@ -// $XFree86: xc/programs/xkbcomp/symbols/sk_qwerty,v 1.1 2001/05/18 23:35:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/sk_qwerty,v 1.2 2001/10/01 14:04:16 eich 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). + // of 'Z' 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 ] }; + key <AD06> { [ y, Y, + NoSymbol, NoSymbol ] }; }; Index: xc/programs/xkbcomp/symbols/sr diff -u xc/programs/xkbcomp/symbols/sr:1.1 xc/programs/xkbcomp/symbols/sr:1.2 --- xc/programs/xkbcomp/symbols/sr:1.1 Tue Nov 14 12:33:03 2000 +++ xc/programs/xkbcomp/symbols/sr Fri Aug 17 09:27:58 2001 @@ -3,7 +3,7 @@ // Authors of this keyboard map are Milos Rancic <millosh@galeb.etf.bg.ac.yu> // and Anton Zinoviev <anton@lml.bas.bg>. -// $XFree86: xc/programs/xkbcomp/symbols/sr,v 1.1 2000/11/14 17:33:03 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/sr,v 1.2 2001/08/17 13:27:58 dawes Exp $ default partial alphanumeric_keys xkb_symbols "basic" { @@ -104,7 +104,7 @@ key <AB03> { [ c, C ], [ Cyrillic_tse, Cyrillic_TSE ] }; key <AB04> { [ v, V ], - [ Cyrillic_zhe, Cyrillic_ZHE ] }; + [ Cyrillic_ve, Cyrillic_VE ] }; key <AB05> { [ b, B ], [ Cyrillic_be, Cyrillic_BE ] }; key <AB06> { [ n, N ], Index: xc/programs/xkbcomp/symbols/tj diff -u /dev/null xc/programs/xkbcomp/symbols/tj:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/tj Wed Nov 21 17:28:52 2001 @@ -0,0 +1,162 @@ +// +// Tajik keyboard +// it is a Russian layout keyboard, with SHCHA replaced with +// dead_cedilla/dead_macron +// that allows to type the SHCHA with dead_cedilla + SHA +// and all the extra Tajik keys: +// dead_cedilla + KA, HA --> KA descender, HA descender +// dead_macron + I, U, GHE --> I macron, U macron, GHE horizontal stroke +// it requires proper dead_cedilla and dead_macron entries in Compose file +// it also allows to use Mode_switch when in cyrillic mode to enter +// special letters by doing Mode_switch + base letter +// +// AEN <aen@logic.ru> (for the Russian layout) +// Pablo Saratxaga <pablo@mandrakesoft> (for the dead keys changes) +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple Tajik keybaord + + name[Group1]= "US/ASCII"; + name[Group2]= "Tajik"; + + 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 ], + [ 0x010004b7, 0x010004b6 ] }; + key <AC03> { [ d, D ], + [ Cyrillic_ve, Cyrillic_VE ] }; + key <AD03> { [ e, E ], + [ Cyrillic_u, Cyrillic_U ], + [ 0x010004ef, 0x010004ee ] }; + key <AE04> { [ 4, dollar ], + [ 4, asterisk ] }; + key <AE03> { [ 3, numbersign ], + [ 3, apostrophe ] }; + 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 ], + [ 0x0100049b, 0x0100049a ] }; + key <AE05> { [ 5, percent ], + [ 5, colon ] }; + key <AB06> { [ n, N ], + [ Cyrillic_te, Cyrillic_TE ] }; + key <AB05> { [ b, B ], + [ Cyrillic_i, Cyrillic_I ], + [ 0x010004e3, 0x010004e2 ] }; + 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, comma ] }; + key <AB07> { [ m, M ], + [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AC07> { [ j, J ], + [ Cyrillic_o, Cyrillic_O ] }; + key <AD07> { [ u, U ], + [ Cyrillic_ghe, Cyrillic_GHE ], + [ 0x01000493, 0x01000492 ] }; + key <AE07> { [ 7, ampersand ], + [ 7, period ] }; + key <AE08> { [ 8, asterisk ], + [ 8, semicolon ] }; + key <AB08> { [ comma, less ], + [ Cyrillic_be, Cyrillic_BE ] }; + key <AC08> { [ k, K ], + [ Cyrillic_el, Cyrillic_EL ] }; + key <AD08> { [ i, I ], + [ Cyrillic_sha, Cyrillic_SHA ], + [ Cyrillic_shcha, Cyrillic_SHCHA] }; + key <AD09> { [ o, O ], + [ dead_cedilla, dead_macron ] }; + key <AE10> { [ 0, parenright ], + [ 0, parenright ] }; + key <AE09> { [ 9, parenleft ], + [ 9, parenleft ] }; + key <AB09> { [ period, greater ], + [ Cyrillic_yu, Cyrillic_YU ] }; + key <AB10> { [ slash, question ], + [ slash, question ] }; + key <AC09> { [ l, L ], + [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ semicolon, colon ], + [ Cyrillic_zhe, Cyrillic_ZHE ], + [ 0x01000497, 0x01000496 ] }; + 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 ], + [ 0x010004b3, 0x010004b2 ] }; + key <AE12> { [ equal, plus ], + [ equal, plus ] }; + key <AD12> { [ bracketright, braceright ], + [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <BKSL> { [ backslash, bar ], + [ backslash, 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 "ru(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/tml diff -u /dev/null xc/programs/xkbcomp/symbols/tml:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/tml Wed Nov 21 17:28:52 2001 @@ -0,0 +1,67 @@ +// $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ +// $XFree86: xc/programs/xkbcomp/symbols/tml,v 1.1 2001/11/21 22:28:52 dawes Exp $ +partial default alphanumeric_keys +xkb_symbols "basic" { + name[Group2]= "Tamil"; + key <TLDE> { [], [ 0x1000BCA, 0x1000B92 ] }; + + // Mainly numbers. + key <AE01> { [], [ 0x1000BE7 ] }; + key <AE02> { [], [ 0x1000BE8 ] }; + key <AE03> { [], [ 0x1000BE9 ] }; + key <AE04> { [], [ 0x1000BEA ] }; + key <AE05> { [], [ 0x1000BEB ] }; + key <AE06> { [], [ 0x1000BEC ] }; + key <AE07> { [], [ 0x1000BED ] }; + key <AE08> { [], [ 0x1000BEE ] }; + key <AE09> { [], [ 0x1000BEF, parenleft ] }; + key <AE10> { [], [ 0x1000BF0, parenright] }; + key <AE11> { [], [ 0x1000BF1, 0x1000B83 ] }; + key <AE12> { [], [ 0x1000BF2, plus] }; + +// Mainly long vowels + + key <AD01> { [], [ 0x1000BCC, 0x1000B94 ] }; + key <AD02> { [], [ 0x1000BC8, 0x1000B90 ] }; + key <AD03> { [], [ 0x1000BBE, 0x1000B86 ] }; + key <AD04> { [], [ 0x1000BC0, 0x1000B88 ] }; + key <AD05> { [], [ 0x1000BC2, 0x1000B8A ] }; + +// Mainly voiced consonants + + key <AD06> { [], [ ] }; + key <AD07> { [], [ 0x1000BB9, 0x1000B99 ] }; + key <AD08> { [], [ ] }; + key <AD09> { [], [ ] }; + key <AD10> { [], [ ] }; + key <AD11> { [], [ ] }; + key <AD12> { [], [ 0x1000BBC, 0x1000B9E ] }; + +// Mainly short vowels + key <AC01> { [], [ 0x1000BCB, 0x1000B93 ] }; + key <AC02> { [], [ 0x1000BC7, 0x1000B8F ] }; + key <AC03> { [], [ 0x1000BCD, 0x1000B85 ] }; + key <AC04> { [], [ 0x1000BBF, 0x1000B87 ] }; + key <AC05> { [], [ 0x1000BC1, 0x1000B89 ] }; + +// Mainly unvoiced consonants + + key <AC06> { [], [ 0x1000BAA ] }; + key <AC07> { [], [ 0x1000BB0, 0x1000BB1 ] }; + key <AC08> { [], [ 0x1000B95 ] }; + key <AC09> { [], [ 0x1000BA4 ] }; + key <AC10> { [], [ 0x1000B9A ] }; + key <AC11> { [], [ 0x1000B9F ] }; + key <BKSL> { [], [ backslash, bar ] }; + + key <AB01> { [], [ 0x1000BC6, 0x1000B8E ] }; + key <AB02> { [], [ 0x1000B82 ] }; + key <AB03> { [], [ 0x1000BAE, 0x1000BA3 ] }; + key <AB04> { [], [ 0x1000BA8, 0x1000BA9 ] }; + key <AB05> { [], [ 0x1000BB5, 0x1000BB4 ] }; + key <AB06> { [], [ 0x1000BB2, 0x1000BB3 ] }; + key <AB07> { [], [ 0x1000BB8 ] }; + key <AB08> { [], [ comma, 0x1000BB7 ] }; + key <AB09> { [], [ period, 0x1000964 ] }; + key <AB10> { [], [ 0x1000BAF, question ] }; +}; Index: xc/programs/xkbcomp/symbols/tr diff -u xc/programs/xkbcomp/symbols/tr:1.1 xc/programs/xkbcomp/symbols/tr:1.2 --- xc/programs/xkbcomp/symbols/tr:1.1 Wed Dec 6 15:18:08 2000 +++ xc/programs/xkbcomp/symbols/tr Wed Nov 21 17:28:52 2001 @@ -1,119 +1,65 @@ -// $XFree86: xc/programs/xkbcomp/symbols/tr,v 1.1 2000/12/06 20:18:08 eich Exp $ -default partial alphanumeric_keys +// $XFree86: xc/programs/xkbcomp/symbols/tr,v 1.2 2001/11/21 22:28:52 dawes Exp $ +// Converted keytable file to xkb/symbols/ file +// with mk_xkb by root@linux.chanae.stben.be Tue Sep 30 01:21:59 MET DST 1997 + +// turkish "Q" keyboard, copyed from LyX turkish keyboard description +// as the names of some chars in iso-8859-9 are not consistent whith +// the rest of latin iso-8859-* I declare them in hexa (ugly, but what else?) +// +// Pablo Saratxaga <srtxg@f2219.n293.z2.fidonet.org> + + +default partial alphanumeric_keys xkb_symbols "basic" { // Describes the differences between a very simple US/ASCII - // keyboard and a very simple Turkish Q keyboard Togan Muftuoglu - // toganm@yahoo.com 23 November 2000 + // keyboard and a very simple Turkish "Q" (computer modern) keybaord // Alphanumeric section - name[Group1]= "Turkish"; - key <TLDE> { [ quotedbl, eacute ], - [ notsign ] }; - key <AE02> { [ 2, apostrophe ], - [ twosuperior ] }; - key <AE03> { [ 3, asciicircum ], - [ numbersign ] }; - key <AE04> { [ 4, plus ], - [ dollar ] }; - key <AE05> { [ 5, percent ], - [ onehalf ] }; - key <AE06> { [ 6, ampersand ], - [ threequarters ] }; - key <AE07> { [ 7, slash ], + name[Group1]= "Turkish \"Q\" (computer modern)"; + + key <AE02> { [ 2, apostrophe ], + [ at ] }; + key <AE03> { [ 3, dead_circumflex ], + [ numbersign ] }; + key <AE04> { [ 4, plus ], + [ dollar ] }; + key <AE06> { [ 6, ampersand ], + [ asciicircum ] }; + key <AE07> { [ 7, slash ], [ braceleft ] }; - key <AE08> { [ 8, parenleft ], + key <AE08> { [ 8, parenleft ], [ bracketleft ] }; - key <AE09> { [ 9, parenright ], - [ bracketright, plusminus ] }; - key <AE10> { [ 0, equal ], - [ braceright, degree ] }; - key <AE11> { [ asterisk, question ], - [ backslash, questiondown ] }; - key <AE12> { [ minus, underscore ] }; - - key <AD01> { [ q, Q ], - [ at ] }; - key <AD03> { [ e, E ], - [ EuroSign ] }; - key <AD05> { [ t, T ] }; - key <AD07> { [ u, U ] }; - key <AD08> { [ yacute, I ] }; - key <AD11> { [ eth, Eth ], - [ dead_diaeresis ] }; + key <AE09> { [ 9, parenright ], + [ bracketright ] }; + key <AE10> { [ 0, equal ], + [ braceright ] }; + key <AE11> { [ asterisk, question ], + [ backslash ] }; + key <AE12> { [ minus, underscore ] }; + key <AD08> { [ idotless, I ] }; + key <AD11> { [ gbreve, Gbreve ] }; key <AD12> { [ udiaeresis, Udiaeresis ], - [ asciitilde, dead_macron ] }; - key <AC10> { [ thorn, Thorn ], - [ acute ] }; - key <AC11> { [ i, Yacute ], - [ dead_circumflex ] }; - key <BKSL> { [ comma, semicolon ], - [ grave ] }; - - key <LSGT> { [ less, greater ], + [ asciitilde ] }; + key <AC10> { [ scedilla, Scedilla ] }; + key <AC11> { [ i, Iabovedot ] }; + key <TLDE> { [ backslash, quotedbl ], + [ asciitilde ] }; + key <BKSL> { [ comma, semicolon ], [ bar ] }; - key <AB07> { [ m, M ], - [ mu ] }; - key <AB08> { [ odiaeresis, Odiaeresis ] }; - key <AB09> { [ ccedilla, Ccedilla ], - [ periodcentered, division ] }; - key <AB10> { [ period, colon ], - [slash ] }; - key <RALT> { [ Mode_switch, Multi_key ] }; - - // End alphanumeric section, begin "Keypad" - key <KPDL> { [ KP_Delete, KP_Separator ] }; - // End "Keypad" section + key <AB08> { [ odiaeresis, Odiaeresis ], + [ less ] }; + key <AB09> { [ ccedilla, Ccedilla ], + [ greater ] }; + key <AB10> { [ period, colon ] }; + key <LSGT> { [ less, greater ], + [ bar ] }; + + // 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 }; + modifier_map Mod3 { Mode_switch }; }; - -partial alphanumeric_keys -xkb_symbols "Sundeadkeys" { - // modify the default Turkish Q layout to use Sun dead keys - include "tr(basic)" - key <TLDE> { [ quotedbl, eacute ], - [ notsign ] }; - key <AE12> { [ minus, underscore ] }; - key <AD11> { [ eth, Eth ], - [ SunFA_Diaeresis ] }; - key <AD12> { [ udiaeresis, Udiaeresis ], - [ SunFA_Tilde, dead_macron ] }; - key <AC10> { [ thorn, Thorn ], - [ SunFA_Acute ] }; - key <AC11> { [ i, Yacute ], - [ SunFA_Circum ] }; - - key <BKSL> { [ comma, semicolon ], - [ SunFA_Grave ] }; -}; - -partial alphanumeric_keys -xkb_symbols "sundeadkeys" { - include "tr(Sundeadkeys)" -}; - -partial alphanumeric_keys -xkb_symbols "nodeadkeys" { - // modify the default Turkish Q layout to not have any dead keys - include "tr(basic)" - key <TLDE> { [ quotedbl, eacute ], - [ notsign ] }; - key <AE12> { [ minus, underscore ] }; - key <AD11> { [ eth, Eth ], - [ diaeresis ] }; - key <AD12> { [ udiaeresis, Udiaeresis ], - [ asciitilde, macron ] }; - key <AC10> { [ thorn, Thorn ], - [ acute ] }; - key <AC11> { [ i, Yacute ], - [ asciicircum ] }; - - key <BKSL> { [ comma, semicolon ], - [ grave ] }; -}; - Index: xc/programs/xkbcomp/symbols/tr_f diff -u /dev/null xc/programs/xkbcomp/symbols/tr_f:1.1 --- /dev/null Fri Jan 18 15:27:28 2002 +++ xc/programs/xkbcomp/symbols/tr_f Wed Nov 21 17:28:52 2001 @@ -0,0 +1,134 @@ +// Converted keytable file to xkb/symbols/ file +// with mk_xkb by root@linux.chanae.stben.be Tue Sep 30 01:29:39 MET DST 1997 + +// turkish "F" keyboard, copyed from LyX turkish keyboard description +// right Ctrl key switches to an almost US keyboard (number row is mangled +// us keyboard mode, this to allow simple access by AltGr while in turkish +// mode to all needed symbols) +// as the names of some chars in iso-8859-9 are not consistent whith +// the rest of latin iso-8859-* I declare them in hexa (ugly, but what else?) +// +// Pablo Saratxaga <srtxg@f2219.n293.z2.fidonet.org> +// FIXME: I'm not sure about the ISO_* stuff, the original *.map uses +// AltGr_Lock as modifier. + +partial alphanumeric_keys +xkb_symbols "toggle" { + include "tr_f(basic)" + key <RCTL> { [ ISO_Next_Group, Caps_Lock ] }; +}; +partial alphanumeric_keys +xkb_symbols "shift_toggle" { + include "tr_f(basic)" + key <LFSH> { [ Shift_L, ISO_Prev_Group ] }; + key <RTSH> { [ Shift_R, ISO_Next_Group ] }; +}; + +default partial alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple US/ASCII + // keyboard and a very simple Turkish "F" (traditional) keyboard + + // Alphanumeric section + name[Group1]= "Turkish \"F\" (traditional)"; + name[Group2]= "US/ASCII"; + + key <AE02> { [ 2, apostrophe ], + [ at ] }; + key <AE03> { [ 3, dead_circumflex ], + [ numbersign ] }; + key <AE04> { [ 4, plus ], + [ dollar ] }; + key <AE06> { [ 6, ampersand ], + [ asciicircum ] }; + key <AE07> { [ 7, slash ], + [ braceleft ] }; + key <AE08> { [ 8, parenleft ], + [ bracketleft ] }; + key <AE09> { [ 9, parenright ], + [ bracketright ] }; + key <AE10> { [ 0, equal ], + [ braceright ] }; + key <AE11> { [ asterisk, question ], + [ backslash, underscore ] }; + key <AE12> { [ minus, underscore ], + [ equal, plus ] }; + key <AD01> { [ f, F ], + [ q, Q ] }; + key <AD02> { [ g, G ], + [ w, W ] }; + key <AD03> { [ gbreve, Gbreve ], + [ e, E ] }; + key <AD04> { [ idotless I ], + [ r, R ] }; + key <AD05> { [ o, O ], + [ t, T ] }; + key <AD06> { [ d, D ], + [ y, Y ] }; + key <AD07> { [ r, R ], + [ u, U ] }; + key <AD08> { [ n, N ], + [ i, I ] }; + key <AD09> { [ h, H ], + [ o, O ] }; + key <AD10> { [ p, P ] }; + key <AD11> { [ q, Q ], + [ bracketleft, braceleft ] }; + key <AD12> { [ w, W ], + [ bracketright, braceright ] }; + key <AC01> { [ u, U ], + [ a, A ] }; + key <AC02> { [ i, Iabovedot ], + [ s, S ] }; + key <AC03> { [ e, E ], + [ d, D ] }; + key <AC04> { [ a, A ], + [ f, F ] }; + key <AC05> { [ g, G ] }; + key <AC06> { [ t, T ], + [ h, H ] }; + key <AC07> { [ k, K ], + [ j, J ] }; + key <AC08> { [ m, M ], + [ k, K ] }; + key <AC09> { [ l, L ] }; + key <AC10> { [ y, Y ], + [ semicolon, colon ] }; + key <AC11> { [ scedilla, Scedilla ], + [ apostrophe, quotedbl ] }; + key <TLDE> { [ backslash, quotedbl ], + [ grave, asciitilde ] }; + key <BKSL> { [ x, X ], + [ backslash, bar ] }; + key <AB01> { [ j, J ], + [ z, Z ] }; + key <AB02> { [ odiaeresis, Odiaeresis ], + [ x, X ] }; + key <AB03> { [ v, V ], + [ c, C ] }; + key <AB04> { [ c, C ], + [ v, V ] }; + key <AB05> { [ ccedilla, Ccedilla ], + [ b, B ] }; + key <AB06> { [ z, Z ], + [ n, N ] }; + key <AB07> { [ s, S ], + [ m, M ] }; + key <AB08> { [ b, B ], + [ comma, less ] }; + key <AB09> { [ period, colon ], + [ period, greater ] }; + key <AB10> { [ comma, semicolon ], + [ slash, question ] }; + key <LSGT> { [ less, greater ], + [ 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 }; +}; Index: xc/programs/xkbcomp/symbols/ua diff -u xc/programs/xkbcomp/symbols/ua:1.1 xc/programs/xkbcomp/symbols/ua:1.2 --- xc/programs/xkbcomp/symbols/ua:1.1 Sat May 29 22:28:13 1999 +++ xc/programs/xkbcomp/symbols/ua Mon Jan 14 13:30:11 2002 @@ -1,6 +1,7 @@ // ukrainian standard keyboard // AEN <aen@logic.ru> & Leon Kanter <leon@geon.donetsk.ua> -// $XFree86: xc/programs/xkbcomp/symbols/ua,v 1.1 1999/05/30 02:28:13 dawes Exp $ +// Last Changes 2001/12/11 by Andriy Rysin <arysin@yahoo.com> +// $XFree86: xc/programs/xkbcomp/symbols/ua,v 1.2 2002/01/14 18:30:11 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { @@ -12,102 +13,105 @@ name[Group2]= "Ukrainian"; key <TLDE> { [ grave, asciitilde ], - [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; - key <LSGT> { [ less, greater ], - [ bar, brokenbar ] }; - key <AD01> { [ q, Q ], - [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + [ apostrophe, asciitilde ] }; key <AE01> { [ 1, exclam ], [ 1, exclam ] }; - key <AB01> { [ z, Z ], - [ Cyrillic_ya, Cyrillic_YA ] }; - key <AC02> { [ s, S ], - [ Ukrainian_i, Ukrainian_I ] }; - 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 <AE03> { [ 3, numbersign ], + [ 3, numbersign ] }; key <AE04> { [ 4, dollar ], [ 4, asterisk ] }; - key <AE03> { [ 3, numbersign ], - [ 3, apostrophe ] }; - 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, colon ] }; - key <AB06> { [ n, N ], - [ Cyrillic_te, Cyrillic_TE ] }; - key <AB05> { [ b, B ], - [ Cyrillic_i, Cyrillic_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, comma ] }; - 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, period ] }; key <AE08> { [ 8, asterisk ], [ 8, semicolon ] }; - key <AB08> { [ comma, less ], - [ Cyrillic_be, Cyrillic_BE ] }; - key <AC08> { [ k, K ], - [ Cyrillic_el, Cyrillic_EL ] }; + key <AE09> { [ 9, parenleft ], + [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ], + [ 0, parenright ] }; + key <AE11> { [ minus, underscore ], + [ minus, underscore ] }; + key <AE12> { [ equal, plus ], + [ equal, plus ] }; + + key <AD01> { [ q, Q ], + [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD02> { [ w, W ], + [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD03> { [ e, E ], + [ Cyrillic_u, Cyrillic_U ] }; + key <AD04> { [ r, R ], + [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD05> { [ t, T ], + [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD06> { [ y, Y ], + [ Cyrillic_en, Cyrillic_EN ] }; + key <AD07> { [ u, U ], + [ Cyrillic_ghe, Cyrillic_GHE ] }; key <AD08> { [ i, I ], [ Cyrillic_sha, Cyrillic_SHA ] }; key <AD09> { [ o, O ], [ Cyrillic_shcha, Cyrillic_SHCHA ] }; - key <AE10> { [ 0, parenright ], - [ 0, parenright ] }; - key <AE09> { [ 9, parenleft ], - [ 9, parenleft ] }; - key <AB09> { [ period, greater ], - [ Cyrillic_yu, Cyrillic_YU ] }; - key <AB10> { [ slash, question ], - [ slash, question ] }; - 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 ], - [ Ukrainian_ie, Ukrainian_IE ] }; key <AD11> { [ bracketleft, braceleft ], [ Cyrillic_ha, Cyrillic_HA ] }; - key <AE12> { [ equal, plus ], - [ equal, plus ] }; key <AD12> { [ bracketright, braceright ], [ Ukrainian_yi, Ukrainian_YI ] }; key <BKSL> { [ backslash, bar ], - [ backslash, bar ] }; + [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + + key <AC01> { [ a, A ], + [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ s, S ], + [ Ukrainian_i, Ukrainian_I ] }; + key <AC03> { [ d, D ], + [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ f, F ], + [ Cyrillic_a, Cyrillic_A ] }; + key <AC05> { [ g, G ], + [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC06> { [ h, H ], + [ Cyrillic_er, Cyrillic_ER ] }; + key <AC07> { [ j, J ], + [ Cyrillic_o, Cyrillic_O ] }; + key <AC08> { [ k, K ], + [ Cyrillic_el, Cyrillic_EL ] }; + key <AC09> { [ l, L ], + [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ semicolon, colon ], + [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC11> { [ apostrophe, quotedbl ], + [ Ukrainian_ie, Ukrainian_IE ] }; + key <AB01> { [ z, Z ], + [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB02> { [ x, X ], + [ Cyrillic_che, Cyrillic_CHE ] }; + key <AB03> { [ c, C ], + [ Cyrillic_es, Cyrillic_ES ] }; + key <AB04> { [ v, V ], + [ Cyrillic_em, Cyrillic_EM ] }; + key <AB06> { [ n, N ], + [ Cyrillic_te, Cyrillic_TE ] }; + key <AB05> { [ b, B ], + [ Cyrillic_i, Cyrillic_I ] }; + key <AB07> { [ m, M ], + [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AB08> { [ comma, less ], + [ Cyrillic_be, Cyrillic_BE ] }; + key <AB09> { [ period, greater ], + [ Cyrillic_yu, Cyrillic_YU ] }; + key <AB10> { [ slash, question ], + [ slash, question ] }; + + key <LSGT> { [ less, greater ], + [ slash, bar ] }; // End alphanumeric section // Begin modifier mappings @@ -121,20 +125,142 @@ partial alphanumeric_keys xkb_symbols "winkeys" { include "ua(basic)" - key <AE04> { [ 4, dollar ], - [ 4, semicolon ] }; + key <AE03> { [ 3, numbersign ], + [ 3, numerosign ] }; + key <AE04> { [ 4, dollar ], + [ 4, semicolon ] }; + 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 <AC02> { [ s, S ], +// [ Ukrainian_i, Ukrainian_I ] }; + +// key <AB05> { [ b, B ], +// [ Cyrillic_i, Cyrillic_I ] }; +}; + +partial alphanumeric_keys +xkb_symbols "typewriter" { + include "ua(basic)" + key <TLDE> { [ grave, asciitilde ], + [ apostrophe, quotedbl ] }; + key <AE01> { [ 1, exclam ], + [ exclam, 1 ] }; + key <AE02> { [ 2, at ], + [ numerosign, 2 ] }; key <AE03> { [ 3, numbersign ], - [ 3, numbersign ] }; + [ slash, 3 ] }; + key <AE04> { [ 4, dollar ], + [ semicolon, 4 ] }; key <AE05> { [ 5, percent ], - [ 5, percent ] }; + [ colon, 5 ] }; key <AE06> { [ 6, asciicircum ], - [ 6, colon ] }; + [ comma, 6 ] }; key <AE07> { [ 7, ampersand ], - [ 7, question ] }; + [ period, 7 ] }; key <AE08> { [ 8, asterisk ], - [ 8, asterisk ] }; + [ underscore, 8 ] }; + key <AE09> { [ 9, parenleft ], + [ question, 9 ] }; + key <AE10> { [ 0, parenright ], + [ percent, 0 ] }; + + key <AD12> { [ bracketright, braceright ], + [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + + key <AC02> { [ s, S ], + [ Cyrillic_i, Cyrillic_I ] }; + + key <AB05> { [ b, B ], + [ Ukrainian_i, Ukrainian_I ] }; + key <AB10> { [ slash, question ], - [ period, comma ] }; + [ Ukrainian_yi, Ukrainian_YI ] }; + key <BKSL> { [ backslash, bar ], - [ slash, bar ] }; + [ parenleft, parenright ] }; +}; + +partial alphanumeric_keys +xkb_symbols "phonetic" { + include "ua(basic)" + + key <AD01> { [ q, Q ], + [ Cyrillic_ya, Cyrillic_YA ] }; + key <AD02> { [ w, W ], + [ Cyrillic_ve, Cyrillic_VE ] }; + key <AD03> { [ e, E ], + [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD04> { [ r, R ], + [ Cyrillic_er, Cyrillic_ER ] }; + key <AD05> { [ t, T ], + [ Cyrillic_te, Cyrillic_TE ] }; + key <AD06> { [ y, Y ], + [ Cyrillic_i, Cyrillic_i ] }; + key <AD07> { [ u, U ], + [ Cyrillic_u, Cyrillic_U ] }; + key <AD08> { [ i, I ], + [ Ukrainian_i, Ukrainian_I ] }; + key <AD09> { [ o, O ], + [ Cyrillic_o, Cyrillic_O ] }; + key <AD10> { [ p, P ], + [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD11> { [ bracketleft, braceleft ], + [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD12> { [ bracketright, braceright ], + [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + + key <AC01> { [ a, A ], + [ Cyrillic_a, Cyrillic_A ] }; + key <AC02> { [ s, S ], + [ Cyrillic_es, Cyrillic_ES ] }; + key <AC03> { [ d, D ], + [ Cyrillic_de, Cyrillic_DE ] }; + key <AC04> { [ f, F ], + [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC05> { [ g, G ], + [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AC06> { [ h, H ], + [ Cyrillic_ha, Cyrillic_HA ] }; + key <AC07> { [ j, J ], + [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AC08> { [ k, K ], + [ Cyrillic_ka, Cyrillic_KA ] }; + key <AC09> { [ l, L ], + [ Cyrillic_el, Cyrillic_EL ] }; + key <AC10> { [ semicolon, colon ], + [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + key <AC11> { [ quoteright, quotedbl ], + [ quoteright, quotedbl ] }; + key <BKSL> { [ backslash, bar ], + [ Cyrillic_yu, Cyrillic_YU ] }; + + key <AB01> { [ z, Z ], + [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AB02> { [ x, X ], + [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <AB03> { [ c, C ], + [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AB04> { [ v, V ], + [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AB05> { [ b, B ], + [ Cyrillic_be, Cyrillic_BE ] }; + key <AB06> { [ n, N ], + [ Cyrillic_en, Cyrillic_EN ] }; + key <AB07> { [ m, M ], + [ Cyrillic_em, Cyrillic_EM ] }; + key <AB08> { [ comma, less ], + [ comma, less ] }; + key <AB09> { [ period, greater ], + [ period, greater ] }; + key <AB10> { [ slash, question ], + [ slash, question ] }; }; Index: xc/programs/xkbcomp/symbols/us diff -u xc/programs/xkbcomp/symbols/us:3.10 xc/programs/xkbcomp/symbols/us:3.11 --- xc/programs/xkbcomp/symbols/us:3.10 Wed Jan 17 18:45:59 2001 +++ xc/programs/xkbcomp/symbols/us Fri Aug 17 09:27:58 2001 @@ -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.10 2001/01/17 23:45:59 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/us,v 3.11 2001/08/17 13:27:58 dawes Exp $ partial hidden alphanumeric_keys modifier_keys xkb_symbols "basic" { @@ -220,15 +220,15 @@ // definition for the extra keys on 104-key "Windows95" keyboards xkb_symbols "pc104" { include "us(generic101)" - key <LALT> { [ Alt_L ] }; - key <RALT> { [ Alt_R ] }; - key <LWIN> { [ Meta_L ] }; - key <RWIN> { [ Multi_key ] }; - key <MENU> { [ Menu ] }; + key <LALT> { [ Alt_L, Meta_L ] }; + key <RALT> { [ Alt_R, Meta_R ] }; + key <LWIN> { [ Super_L ] }; + key <RWIN> { [ Super_R ] }; + key <MENU> { [ Menu ] }; // modifier mappings - modifier_map Mod1 { Alt_L, Alt_R }; - modifier_map Mod4 { Meta_L, Meta_R }; + modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; + modifier_map Mod4 { Super_L, Super_R }; }; // definition of Euro-style, Right "logo" key == [Mode_switch, Multi_key] Index: xc/programs/xkbcomp/symbols/us_group2 diff -u /dev/null xc/programs/xkbcomp/symbols/us_group2:1.1 --- /dev/null Fri Jan 18 15:27:29 2002 +++ xc/programs/xkbcomp/symbols/us_group2 Mon Oct 1 10:04:16 2001 @@ -0,0 +1,277 @@ +// $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, +// one shift key, one control key and caps lock. It +// uses the punctuation keys configurations common on PC +// keyboards (e.g. key <ABO9> is { [], [ period greater ] }) + +// This file is a modified version of US keyboard for +// use mainly in cz* and sk* keyboards. +// Modified by Jan Holesovsky <kendy@suse.cz>, 2001 + +// $XFree86: xc/programs/xkbcomp/symbols/us_group2,v 1.1 2001/10/01 14:04:16 eich Exp $ + +partial hidden alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + name[Group2]= "US/ASCII"; + key <ESC> { [], [ Escape ] }; + + // Alphanumeric section + 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 <BKSP> { [], [ BackSpace ] }; + + key <TAB> { [], [ Tab, ISO_Left_Tab ] }; + key <AD01> { [], [ q, Q ] }; + key <AD02> { [], [ w, W ] }; + key <AD03> { [], [ e, E ] }; + key <AD04> { [], [ r, R ] }; + key <AD05> { [], [ t, T ] }; + key <AD06> { [], [ y, Y ] }; + key <AD07> { [], [ u, U ] }; + key <AD08> { [], [ i, I ] }; + key <AD09> { [], [ o, O ] }; + key <AD10> { [], [ p, P ] }; + key <AD11> { [], [ bracketleft, braceleft ] }; + key <AD12> { [], [ bracketright, braceright ] }; + key <RTRN> { [], [ Return ] }; + + key <CAPS> { [], [ Caps_Lock ] }; + key <AC01> { [], [ a, A ] }; + key <AC02> { [], [ s, S ] }; + key <AC03> { [], [ d, D ] }; + key <AC04> { [], [ f, F ] }; + key <AC05> { [], [ g, G ] }; + key <AC06> { [], [ h, H ] }; + key <AC07> { [], [ j, J ] }; + key <AC08> { [], [ k, K ] }; + key <AC09> { [], [ l, L ] }; + key <AC10> { [], [ semicolon, colon ] }; + key <AC11> { [], [ quoteright, quotedbl ] }; + + key <LFSH> { [], [ Shift_L ] }; + key <AB01> { [], [ z, Z ] }; + key <AB02> { [], [ x, X ] }; + key <AB03> { [], [ c, C ] }; + key <AB04> { [], [ v, V ] }; + key <AB05> { [], [ b, B ] }; + key <AB06> { [], [ n, N ] }; + key <AB07> { [], [ m, M ] }; + key <AB08> { [], [ comma, less ] }; + key <AB09> { [], [ period, greater ] }; + key <AB10> { [], [ slash, question ] }; + key <BKSL> { [], [ backslash, bar ] }; + + key <LCTL> { [], [ Control_L ] }; + key <SPCE> { [], [ space ] }; + // End alphanumeric section + + // begin modifier mappings + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; +}; + +// definition of a US/ASCII layout for a typical 101-key keyboard. +// Includes the basic alphanumeric and punctuation keys and then +// defines the "extra" (right) modifier keys, function keys, cursor, +// edit, and keypad keys. +xkb_symbols "generic101" { + include "us_group2(basic)" + key <RTSH> { [], [ Shift_R ] }; + key <LALT> { [], [ Alt_L ] }; + key <RCTL> { [], [ Control_R ] }; + key <RALT> { [], [ Alt_R ] }; + + // Begin "Function" section + key <FK01> { [], [ F1 ] }; + key <FK02> { [], [ F2 ] }; + key <FK03> { [], [ F3 ] }; + key <FK04> { [], [ F4 ] }; + key <FK05> { [], [ F5 ] }; + key <FK06> { [], [ F6 ] }; + key <FK07> { [], [ F7 ] }; + key <FK08> { [], [ F8 ] }; + key <FK09> { [], [ F9 ] }; + key <FK10> { [], [ F10 ] }; + key <FK11> { [], [ F11 ] }; + key <FK12> { [], [ F12 ] }; + // End "Function" section + + // Begin "Editing" section + key <PRSC> { + type= "PC_SYSRQ", + symbols[Group2]= [], [ Print, Sys_Req ] + }; + key <SYRQ> { + type= "PC_SYSRQ", + symbols[Group2]= [], [ Print, Sys_Req ] + }; + key <SCLK> { [], [ Scroll_Lock ] }; + key <PAUS> { + type= "PC_BREAK", + symbols[Group2]= [], [ Pause, Break ] + }; + key <BRK> { + type= "PC_BREAK", + symbols[Group2]= [], [ Pause, Break ] + }; + key <INS> { [], [ Insert ] }; + key <HOME> { [], [ Home ] }; + key <PGUP> { [], [ Prior ] }; + key <DELE> { [], [ Delete ] }; + key <END> { [], [ End ] }; + key <PGDN> { [], [ Next ] }; + + key <UP> { [], [ Up ] }; + key <LEFT> { [], [ Left ] }; + key <DOWN> { [], [ Down ] }; + key <RGHT> { [], [ Right ] }; + + // End "Editing" section, begin "Keypad" + key <NMLK> { [], [ Num_Lock, Pointer_EnableKeys ] }; + key <KPDV> { [], [ KP_Divide ] }; + key <KPMU> { [], [ KP_Multiply ] }; + key <KPSU> { [], [ KP_Subtract ] }; + + key <KP7> { [], [ KP_Home, KP_7 ] }; + key <KP8> { [], [ KP_Up, KP_8 ] }; + key <KP9> { [], [ KP_Prior, KP_9 ] }; + key <KPAD> { [], [ KP_Add ] }; + + key <KP4> { [], [ KP_Left, KP_4 ] }; + key <KP5> { [], [ KP_Begin, KP_5 ] }; + key <KP6> { [], [ KP_Right, KP_6 ] }; + + key <KP1> { [], [ KP_End, KP_1 ] }; + key <KP2> { [], [ KP_Down, KP_2 ] }; + key <KP3> { [], [ KP_Next, KP_3 ] }; + key <KPEN> { [], [ KP_Enter ] }; + + key <KP0> { [], [ KP_Insert, KP_0 ] }; + key <KPDL> { [], [ KP_Delete, KP_Decimal ] }; + // End "Keypad" section + + + // begin modifier mappings + modifier_map Shift { Shift_R }; + modifier_map Control{ Control_R }; + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod2 { Num_Lock }; + modifier_map Mod5 { Scroll_Lock }; +}; + +// definition for the PC-AT type 101 key keyboard +default +xkb_symbols "pc101" { + include "us_group2(generic101)" + key <LALT> { [], [ Alt_L, Meta_L ] }; + key <RALT> { [], [ Alt_R, Meta_R ] }; + + // begin modifier mappings + modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; +}; + +// definition for the extra key on 102-key keyboards +xkb_symbols "pc102" { + include "us_group2(pc101)" + key <LSGT> { [], [ less, greater ] }; +}; + +// definition of Euro-style, Alt_R == [Mode_switch, Multi_key] +xkb_symbols "pc101euro" { + include "us_group2(generic101)" + key <LALT> { [], [ Alt_L, Meta_L ] }; + key <RALT> { [], [ Mode_switch, Multi_key ] }; + + // begin modifier mappings + modifier_map Mod1 { Alt_L, Meta_L }; +}; + +// definition of Alternate Euro-style, Alt_R == [Multi_key] +xkb_symbols "pc101compose" { + include "us_group2(generic101)" + key <LALT> { [], [ Alt_L, Meta_L ] }; + key <RALT> { [], [ Multi_key ] }; + + // begin modifier mappings + modifier_map Mod1 { Alt_L, Meta_L }; +}; + +xkb_symbols "pc102euro" { + include "us_group2(pc101euro)" + key <LSGT> { [], [ less, greater ] }; +}; + +xkb_symbols "pc102compose" { + include "us_group2(pc101compose)" + key <LSGT> { [], [ less, greater ] }; +}; + +// definition for the extra keys on 104-key "Windows95" keyboards +xkb_symbols "pc104" { + include "us_group2(generic101)" + key <LALT> { [], [ Alt_L ] }; + key <RALT> { [], [ Alt_R ] }; + key <LWIN> { [], [ Meta_L ] }; + key <RWIN> { [], [ Multi_key ] }; + key <MENU> { [], [ Menu ] }; + + // modifier mappings + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod4 { Meta_L, Meta_R }; +}; + +// definition of Euro-style, Right "logo" key == [Mode_switch, Multi_key] +xkb_symbols "pc104euro" { + include "us_group2(pc104)" + key <RALT> { [], [ Mode_switch ] }; + key <RWIN> { [], [ Multi_key ] }; +}; + +// put the compose key on the right "logo" key +xkb_symbols "pc104compose" { + include "us_group2(pc104)" + key <RWIN> { [], [ Multi_key ] }; +}; + +// defintion which includes both the Windows95 keyboards _and_ +// the extra key on most European keyboards. +xkb_symbols "pc105" { + include "us_group2(pc104)" + key <LSGT> { [], [ less, greater ] }; +}; +xkb_symbols "pc105euro" { + include "us_group2(pc104euro)" + key <LSGT> { [], [ less, greater ] }; +}; +xkb_symbols "pc105compose" { + include "us_group2(pc104compose)" + key <LSGT> { [], [ less, greater ] }; +}; +// universal maps are identical to pc105; wish we had aliases for map names. +xkb_symbols "pc_universal" { + include "us_group2(pc104)" + key <LSGT> { [], [ less, greater ] }; +}; +xkb_symbols "pc_universal_euro" { + include "us_group2(pc104euro)" + key <LSGT> { [], [ less, greater ] }; +}; +xkb_symbols "pc_universal_compose" { + include "us_group2(pc104compose)" + key <LSGT> { [], [ less, greater ] }; +}; Index: xc/programs/xkbcomp/symbols/us_intl diff -u xc/programs/xkbcomp/symbols/us_intl:1.3 xc/programs/xkbcomp/symbols/us_intl:1.4 --- xc/programs/xkbcomp/symbols/us_intl:1.3 Fri Oct 27 14:31:10 2000 +++ xc/programs/xkbcomp/symbols/us_intl Fri Nov 2 18:29:34 2001 @@ -1,10 +1,33 @@ // -// $XFree86: xc/programs/xkbcomp/symbols/us_intl,v 1.3 2000/10/27 18:31:10 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/us_intl,v 1.4 2001/11/02 23:29:34 dawes Exp $ // // Dead-keys definition for a very simple US/ASCII layout. // by Conectiva (http://www.conectiva.com.br) // modified by Ricardo Y. Igarashi (iga@that.com.br) +// Added the following deadkeys, to make it truly international: +// +// dead_macron: on AltGr-minus +// dead_breve: on AltGr-parenleft +// dead_abovedot: on AltGr-period +// dead_abovering: on AltGr-0 +// dead_doubleacute: on AltGr-equal (as quotedbl is already used) +// dead_caron: on AltGr-less (AltGr-shift-comma) +// dead_cedilla: on AltGr-comma +// dead_ogonek: on AltGr-semicolon +// dead_belowdot: on AltGr-underscore (AltGr-shift-minus) +// dead_hook: on AltGr-question +// dead_horn: on AltGr-plus (AltGr-shift-equal) +// dead_diaeresis: on AltGr-colon (Alt-shift-semicolon) +// +// those were already there: +// dead_grave +// dead_acute +// dead_circumflex +// dead_tilde +// dead_diaeresis + + partial default alphanumeric_keys xkb_symbols "basic" { @@ -17,6 +40,24 @@ [ asciicircum, asciicircum ] }; key <AC11> { [ dead_acute, dead_diaeresis ], [ apostrophe, quotedbl ] }; + + key <AE09> { [ 9, parenleft ] + [ dead_breve, dead_breve ] }; + key <AE10> { [ 0, parenright ] + [ dead_abovering, dead_abovering ] }; + key <AE11> { [ minus, underscore ], + [ dead_macron, dead_belowdot ] }; + key <AE12> { [ equal, plus ], + [ dead_doubleacute, dead_horn ] }; + key <AC10> { [ semicolon, colon ] + [ dead_ogonek, dead_diaeresis ] }; + key <AB08> { [ comma, less ] + [ dead_cedilla, dead_caron ] }; + key <AB09> { [ period, greater ] + [ dead_abovedot, dead_circumflex ] }; + key <AB10> { [ slash, question ] + [ dead_hook, dead_hook ] }; + // End alphanumeric section }; Index: xc/programs/xkbcomp/symbols/vn diff -u xc/programs/xkbcomp/symbols/vn:1.2 xc/programs/xkbcomp/symbols/vn:1.3 --- xc/programs/xkbcomp/symbols/vn:1.2 Fri Oct 27 20:34:07 2000 +++ xc/programs/xkbcomp/symbols/vn Wed Nov 21 17:28:52 2001 @@ -15,7 +15,7 @@ // aclark (2000-07-27) // I've modified this to refer to the correct keysyms in the server // -// $XFree86: xc/programs/xkbcomp/symbols/vn,v 1.2 2000/10/28 00:34:07 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/vn,v 1.3 2001/11/21 22:28:52 dawes Exp $ partial modifier_keys xkb_symbols "toggle" { @@ -87,9 +87,9 @@ key <AD10> { [ p, P ], [ p, P ] }; key <AD11> { [ bracketleft, braceleft ], - [ uhorn, Uhorn ] }; + [ 0x10001b0, 0x10001af ] }; key <AD12> { [ bracketright, braceright ], - [ ohorn, Ohorn ] }; + [ 0x10001a1, 0x10001a0 ] }; key <RTRN> { [ Return ], [ Return ] }; Index: xc/programs/xkbcomp/symbols/yu diff -u /dev/null xc/programs/xkbcomp/symbols/yu:1.3 --- /dev/null Fri Jan 18 15:27:29 2002 +++ xc/programs/xkbcomp/symbols/yu Wed Nov 21 17:31:05 2001 @@ -0,0 +1,83 @@ +// Converted keytable file to xkb/symbols/ file +// with mk_xkb by root@linux.chanae.stben.be Tue Sep 30 00:34:26 MET DST 1997 + +// Yugoslavian keyboard. +// Source: the keyboard pictures on MS-DOS 6.22 manual +// Pablo Saratxaga <srtxg@f2219.n293.z2.fidonet.org> + +default partial alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple US/ASCII + // keyboard and a very simple Yugoslav keybaord + + // Alphanumeric section + name[Group1]= "Yugoslav"; + + key <AE01> { [ 1, exclam ], + [ asciitilde ] }; + key <AE02> { [ 2, quotedbl ], + [ dead_caron ] }; + key <AE03> { [ 3, numbersign ], + [ dead_circumflex ] }; + key <AE04> { [ 4, dollar ], + [ dead_breve ] }; + key <AE05> { [ 5, percent ], + [ degree ] }; + key <AE06> { [ 6, ampersand ], + [ dead_ogonek ] }; + key <AE07> { [ 7, slash ], + [ dead_grave ] }; + key <AE08> { [ 8, parenleft ], + [ abovedot ] }; + key <AE09> { [ 9, parenright ], + [ dead_acute ] }; + key <AE10> { [ 0, equal ], + [ dead_doubleacute ] }; + key <AE11> { [ apostrophe, question ], + [ dead_diaeresis ] }; + key <AE12> { [ plus, asterisk ], + [ dead_cedilla ] }; + key <AD01> { [ q, Q ], + [ backslash ] }; + key <AD02> { [ w, W ], + [ bar ] }; + key <AD11> { [ scaron, Scaron ], + [ division ] }; + key <AD12> { [ dstroke, Dstroke ], + [ multiply ] }; + 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 <TLDE> { [ dead_diaeresis, dead_cedilla ] }; + key <BKSL> { [ zcaron, Zcaron ] }; + 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 ] }; + key <AB10> { [ minus, underscore ] }; + key <LSGT> { [ less, greater ], + [ bar ] }; + + // 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/fujitsu/jp diff -u xc/programs/xkbcomp/symbols/fujitsu/jp:1.1.1.3 xc/programs/xkbcomp/symbols/fujitsu/jp:1.2 --- xc/programs/xkbcomp/symbols/fujitsu/jp:1.1.1.3 Tue Jan 16 17:59:50 2001 +++ xc/programs/xkbcomp/symbols/fujitsu/jp Fri Dec 14 15:02:03 2001 @@ -1,8 +1,12 @@ -// $Xorg: jp,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ +// $Xorg: jp,v 1.4 2001/02/09 02:05:52 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/symbols/fujitsu/us diff -u xc/programs/xkbcomp/symbols/fujitsu/us:1.1.1.3 xc/programs/xkbcomp/symbols/fujitsu/us:1.2 --- xc/programs/xkbcomp/symbols/fujitsu/us:1.1.1.3 Tue Jan 16 17:59:51 2001 +++ xc/programs/xkbcomp/symbols/fujitsu/us Fri Dec 14 15:02:03 2001 @@ -1,8 +1,12 @@ -// $Xorg: us,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ +// $Xorg: us,v 1.4 2001/02/09 02:05:53 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/symbols/hp/us diff -u xc/programs/xkbcomp/symbols/hp/us:1.3 xc/programs/xkbcomp/symbols/hp/us:1.4 --- xc/programs/xkbcomp/symbols/hp/us:1.3 Wed Jan 17 18:46:02 2001 +++ xc/programs/xkbcomp/symbols/hp/us Fri Dec 14 15:02:03 2001 @@ -1,8 +1,12 @@ -// $Xorg: us,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ +// $Xorg: us,v 1.4 2001/02/09 02:05:53 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/symbols/macintosh/us diff -u xc/programs/xkbcomp/symbols/macintosh/us:1.4 xc/programs/xkbcomp/symbols/macintosh/us:1.6 --- xc/programs/xkbcomp/symbols/macintosh/us:1.4 Mon Apr 23 16:31:09 2001 +++ xc/programs/xkbcomp/symbols/macintosh/us Wed Oct 3 03:44:23 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.4 2001/04/23 20:31:09 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/macintosh/us,v 1.6 2001/10/03 07:44:23 alanh Exp $ // some symbols need a special charset, most symbols not added yet Index: xc/programs/xkbcomp/symbols/nec/jp diff -u xc/programs/xkbcomp/symbols/nec/jp:3.9 xc/programs/xkbcomp/symbols/nec/jp:3.10 --- xc/programs/xkbcomp/symbols/nec/jp:3.9 Wed Jan 17 18:46:03 2001 +++ xc/programs/xkbcomp/symbols/nec/jp Fri Dec 14 15:02:04 2001 @@ -1,8 +1,12 @@ -// $Xorg: jp,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ +// $Xorg: jp,v 1.4 2001/02/09 02:05:53 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/symbols/nec/jp,v 3.9 2001/01/17 23:46:03 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/nec/jp,v 3.10 2001/12/14 20:02:04 dawes Exp $ // // symbols for a NEC PC98 keyboard default xkb_symbols "pc98" { Index: xc/programs/xkbcomp/symbols/sony/us diff -u xc/programs/xkbcomp/symbols/sony/us:1.1.1.3 xc/programs/xkbcomp/symbols/sony/us:1.2 --- xc/programs/xkbcomp/symbols/sony/us:1.1.1.3 Tue Jan 16 18:00:03 2001 +++ xc/programs/xkbcomp/symbols/sony/us Fri Dec 14 15:02:04 2001 @@ -1,8 +1,12 @@ -// $Xorg: us,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ +// $Xorg: us,v 1.4 2001/02/09 02:05:53 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. Index: xc/programs/xkbcomp/symbols/sun/us diff -u xc/programs/xkbcomp/symbols/sun/us:1.3 xc/programs/xkbcomp/symbols/sun/us:1.6 --- xc/programs/xkbcomp/symbols/sun/us:1.3 Wed Jan 17 18:46:04 2001 +++ xc/programs/xkbcomp/symbols/sun/us Fri Dec 14 15:02:05 2001 @@ -1,8 +1,12 @@ -// $Xorg: us,v 1.3 2000/08/17 19:54:46 cpqbld Exp $ +// $Xorg: us,v 1.4 2001/02/09 02:05:53 xorgcvs Exp $ // //Copyright 1996, 1998 The Open Group // -//All Rights Reserved. +//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. // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. @@ -20,6 +24,8 @@ //other dealings in this Software without prior written authorization //from The Open Group. // +// $XFree86: xc/programs/xkbcomp/symbols/sun/us,v 1.6 2001/12/14 20:02:05 dawes Exp $ +// // US/ASCII layout for a Type 4 Sun keyboard xkb_symbols "sun4" { include "us(basic)" @@ -217,8 +223,8 @@ modifier_map Mod1 { Alt_L }; modifier_map Mod2 { Num_Lock }; modifier_map Mod3 { Mode_switch }; - modifier_map Mod4 { Meta_L }; - modifier_map Mod5 { Meta_R }; + modifier_map Mod4 { Meta_L, Meta_R}; + modifier_map Mod5 { Scroll_Lock }; }; // US/ASCII layout for a Type 5 Sun keyboard w/ broken OpenLook keymap Index: xc/programs/xkbcomp/types/caps diff -u /dev/null xc/programs/xkbcomp/types/caps:1.1 --- /dev/null Fri Jan 18 15:27:30 2002 +++ xc/programs/xkbcomp/types/caps Mon Aug 13 15:39:04 2001 @@ -0,0 +1,46 @@ +// $XFree86: xc/programs/xkbcomp/types/caps,v 1.1 2001/08/13 19:39:04 dawes Exp $ + +// CapsLock uses internal capitalization rules +// Shift cancels CapsLock +partial xkb_types "internal" { + type "ALPHABETIC" { + modifiers = Shift+Lock; + map[Shift] = Level2; + preserve[Lock]= Lock; + level_name[Level1] = "Base"; + level_name[Level2] = "Caps"; + }; +}; +// CapsLock uses internal capitalization rules +// Shift doesn't cancel CapsLock +partial xkb_types "internal_nocancel" { + type "ALPHABETIC" { + modifiers = Shift; + map[Shift] = Level2; + level_name[Level1] = "Base"; + level_name[Level2] = "Caps"; + }; +}; +// CapsLock acts as Shift with locking +// Shift cancels CapsLock +partial xkb_types "shift" { + type "ALPHABETIC" { + modifiers = Shift+Lock; + map[Shift] = Level2; + map[Lock]= Level2; + level_name[Level1] = "Base"; + level_name[Level2] = "Caps"; + }; +}; +// CapsLock acts as Shift with locking +// Shift doesn't cancel CapsLock +partial xkb_types "shift_nocancel" { + type "ALPHABETIC" { + modifiers = Shift+Lock; + map[Shift] = Level2; + map[Lock]= Level2; + map[Shift+Lock]= Level2; + level_name[Level1] = "Base"; + level_name[Level2] = "Caps"; + }; +}; Index: xc/programs/xkbcomp/types/complete diff -u xc/programs/xkbcomp/types/complete:1.2 xc/programs/xkbcomp/types/complete:1.3 --- xc/programs/xkbcomp/types/complete:1.2 Fri May 18 19:35:35 2001 +++ xc/programs/xkbcomp/types/complete Mon Aug 13 13:46:06 2001 @@ -3,11 +3,10 @@ // // // -// $XFree86: xc/programs/xkbcomp/types/complete,v 1.2 2001/05/18 23:35:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/types/complete,v 1.3 2001/08/13 17:46:06 dawes Exp $ default xkb_types "complete" { include "basic" - replace "nocancel" include "mousekeys" include "pc" include "iso9995" Index: xc/programs/xkbevd/cfgscan.c diff -u xc/programs/xkbevd/cfgscan.c:3.6 xc/programs/xkbevd/cfgscan.c:3.7 --- xc/programs/xkbevd/cfgscan.c:3.6 Wed Jan 17 18:46:07 2001 +++ xc/programs/xkbevd/cfgscan.c Tue Jul 31 20:45:05 2001 @@ -24,9 +24,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbevd/cfgscan.c,v 3.6 2001/01/17 23:46:07 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/cfgscan.c,v 3.7 2001/08/01 00:45:05 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <ctype.h> #include <X11/Xos.h> #include <X11/X.h> Index: xc/programs/xkbevd/utils.c diff -u xc/programs/xkbevd/utils.c:3.4 xc/programs/xkbevd/utils.c:3.6 --- xc/programs/xkbevd/utils.c:3.4 Wed Jan 17 18:46:08 2001 +++ xc/programs/xkbevd/utils.c Mon Jan 14 13:30:11 2002 @@ -1,6 +1,6 @@ /*\ - * $XFree86: xc/programs/xkbevd/utils.c,v 3.4 2001/01/17 23:46:08 dawes Exp $ + * $XFree86: xc/programs/xkbevd/utils.c,v 3.6 2002/01/14 18:30:11 dawes Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -27,13 +27,10 @@ \*/ /* $Xorg: utils.c,v 1.5 2000/08/17 19:54:49 cpqbld Exp $ */ +#define DEBUG_VAR_LOCAL #include "utils.h" #include <ctype.h> -#ifndef X_NOT_STDC_ENV -#include <stdlib.h> -#else -char *malloc(); -#endif +#include <stdlib.h> /***====================================================================***/ Index: xc/programs/xkbevd/utils.h diff -u xc/programs/xkbevd/utils.h:1.4 xc/programs/xkbevd/utils.h:1.6 --- xc/programs/xkbevd/utils.h:1.4 Wed Jan 17 18:46:09 2001 +++ xc/programs/xkbevd/utils.h Mon Jan 14 13:30:11 2002 @@ -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.4 2001/01/17 23:46:09 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/utils.h,v 1.6 2002/01/14 18:30:11 dawes Exp $ */ /***====================================================================***/ @@ -35,15 +35,11 @@ #include <X11/Xos.h> #include <X11/Xfuncproto.h> #include <X11/Xfuncs.h> -#ifdef NeedVarargsPrototypes #include <stdarg.h> -#endif +#include <stddef.h> _XFUNCPROTOBEGIN -#ifndef NULL -#define NULL 0 -#endif #ifndef NUL #define NUL '\0' @@ -193,7 +189,7 @@ #define DEBUG_VAR debugFlags #endif -#ifdef DEBUG_VAR_NOT_LOCAL +#ifndef DEBUG_VAR_LOCAL extern #endif unsigned int DEBUG_VAR; Index: xc/programs/xkbevd/xkbevd.c diff -u xc/programs/xkbevd/xkbevd.c:3.8 xc/programs/xkbevd/xkbevd.c:3.9 --- xc/programs/xkbevd/xkbevd.c:3.8 Wed Jan 17 18:46:09 2001 +++ xc/programs/xkbevd/xkbevd.c Wed Jul 25 11:05:25 2001 @@ -24,15 +24,11 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbevd/xkbevd.c,v 3.8 2001/01/17 23:46:09 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/xkbevd.c,v 3.9 2001/07/25 15:05:25 dawes Exp $ */ #define DEBUG_VAR xkbevdDebug #include <X11/Xosdefs.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern char *getenv(); -#endif #include "xkbevd.h" Index: xc/programs/xkbprint/psgeom.c diff -u xc/programs/xkbprint/psgeom.c:1.4 xc/programs/xkbprint/psgeom.c:1.5 --- xc/programs/xkbprint/psgeom.c:1.4 Wed Jan 17 18:46:10 2001 +++ xc/programs/xkbprint/psgeom.c Wed Jul 25 11:05:25 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbprint/psgeom.c,v 1.4 2001/01/17 23:46:10 dawes Exp $ */ +/* $XFree86: xc/programs/xkbprint/psgeom.c,v 1.5 2001/07/25 15:05:25 dawes Exp $ */ #define XK_TECHNICAL #define XK_PUBLISHING @@ -46,9 +46,7 @@ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include "utils.h" #include "xkbprint.h" Index: xc/programs/xkbprint/utils.c diff -u xc/programs/xkbprint/utils.c:3.4 xc/programs/xkbprint/utils.c:3.5 --- xc/programs/xkbprint/utils.c:3.4 Wed Jan 17 18:46:11 2001 +++ xc/programs/xkbprint/utils.c Wed Jul 25 11:05:25 2001 @@ -25,15 +25,11 @@ * 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 $ */ +/* $XFree86: xc/programs/xkbprint/utils.c,v 3.5 2001/07/25 15:05:25 dawes Exp $ */ #include "utils.h" #include <ctype.h> -#ifndef X_NOT_STDC_ENV -#include <stdlib.h> -#else -char *malloc(); -#endif +#include <stdlib.h> /***====================================================================***/ Index: xc/programs/xkbprint/utils.h diff -u xc/programs/xkbprint/utils.h:1.4 xc/programs/xkbprint/utils.h:1.5 --- xc/programs/xkbprint/utils.h:1.4 Wed Jan 17 18:46:11 2001 +++ xc/programs/xkbprint/utils.h Wed Jul 25 11:05:25 2001 @@ -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.4 2001/01/17 23:46:11 dawes Exp $ */ +/* $XFree86: xc/programs/xkbprint/utils.h,v 1.5 2001/07/25 15:05:25 dawes Exp $ */ /***====================================================================***/ @@ -35,15 +35,11 @@ #include <X11/Xos.h> #include <X11/Xfuncproto.h> #include <X11/Xfuncs.h> -#ifdef NeedVarargsPrototypes #include <stdarg.h> -#endif +#include <stddef.h> _XFUNCPROTOBEGIN -#ifndef NULL -#define NULL 0 -#endif #ifndef NUL #define NUL '\0' Index: xc/programs/xkbprint/xkbprint.c diff -u xc/programs/xkbprint/xkbprint.c:3.8 xc/programs/xkbprint/xkbprint.c:3.9 --- xc/programs/xkbprint/xkbprint.c:3.8 Wed Jan 17 18:46:11 2001 +++ xc/programs/xkbprint/xkbprint.c Wed Jul 25 11:05:25 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbprint/xkbprint.c,v 3.8 2001/01/17 23:46:11 dawes Exp $ */ +/* $XFree86: xc/programs/xkbprint/xkbprint.c,v 3.9 2001/07/25 15:05:25 dawes Exp $ */ #include <stdio.h> #include <ctype.h> @@ -43,9 +43,7 @@ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include "utils.h" #include "xkbprint.h" Index: xc/programs/xkbutils/LED.c diff -u xc/programs/xkbutils/LED.c:1.4 xc/programs/xkbutils/LED.c:1.5 --- xc/programs/xkbutils/LED.c:1.4 Wed Jan 17 18:46:13 2001 +++ xc/programs/xkbutils/LED.c Wed Jul 25 11:05:25 2001 @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbutils/LED.c,v 1.4 2001/01/17 23:46:13 dawes Exp $ */ +/* $XFree86: xc/programs/xkbutils/LED.c,v 1.5 2001/07/25 15:05:25 dawes Exp $ */ #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> @@ -35,13 +35,8 @@ #include <X11/Xmu/Drawing.h> #include <stdio.h> #include <ctype.h> - /* needed for abs() */ -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -int abs(); -#endif #define streq(a,b) (strcmp( (a), (b) ) == 0) Index: xc/programs/xkbutils/utils.c diff -u xc/programs/xkbutils/utils.c:3.4 xc/programs/xkbutils/utils.c:3.5 --- xc/programs/xkbutils/utils.c:3.4 Wed Jan 17 18:46:13 2001 +++ xc/programs/xkbutils/utils.c Wed Jul 25 11:05:25 2001 @@ -25,15 +25,11 @@ * 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 $ */ +/* $XFree86: xc/programs/xkbutils/utils.c,v 3.5 2001/07/25 15:05:25 dawes Exp $ */ #include "utils.h" #include <ctype.h> -#ifndef X_NOT_STDC_ENV -#include <stdlib.h> -#else -char *malloc(); -#endif +#include <stdlib.h> /***====================================================================***/ Index: xc/programs/xkbutils/utils.h diff -u xc/programs/xkbutils/utils.h:1.4 xc/programs/xkbutils/utils.h:1.5 --- xc/programs/xkbutils/utils.h:1.4 Wed Jan 17 18:46:13 2001 +++ xc/programs/xkbutils/utils.h Wed Jul 25 11:05:26 2001 @@ -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.4 2001/01/17 23:46:13 dawes Exp $ */ +/* $XFree86: xc/programs/xkbutils/utils.h,v 1.5 2001/07/25 15:05:26 dawes Exp $ */ /***====================================================================***/ @@ -35,15 +35,11 @@ #include <X11/Xos.h> #include <X11/Xfuncproto.h> #include <X11/Xfuncs.h> -#ifdef NeedVarargsPrototypes #include <stdarg.h> -#endif +#include <stddef.h> _XFUNCPROTOBEGIN -#ifndef NULL -#define NULL 0 -#endif #ifndef NUL #define NUL '\0' Index: xc/programs/xkill/xkill.c diff -u xc/programs/xkill/xkill.c:1.5 xc/programs/xkill/xkill.c:1.6 --- xc/programs/xkill/xkill.c:1.5 Sun Apr 1 10:00:22 2001 +++ xc/programs/xkill/xkill.c Fri Dec 14 15:02:06 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xkill.c,v 1.4 2000/08/17 19:54:51 cpqbld Exp $ */ +/* $Xorg: xkill.c,v 1.5 2001/02/09 02:05:54 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xkill/xkill.c,v 1.5 2001/04/01 14:00:22 tsi Exp $ */ +/* $XFree86: xc/programs/xkill/xkill.c,v 1.6 2001/12/14 20:02:06 dawes Exp $ */ /* * xkill - simple program for destroying unwanted clients Index: xc/programs/xkill/xkill.man diff -u xc/programs/xkill/xkill.man:1.7 xc/programs/xkill/xkill.man:1.8 --- xc/programs/xkill/xkill.man:1.7 Sat Jan 27 13:21:17 2001 +++ xc/programs/xkill/xkill.man Fri Dec 14 15:02:06 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xkill.man,v 1.3 2000/08/17 19:54:51 cpqbld Exp $ +.\" $Xorg: xkill.man,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xkill/xkill.man,v 1.7 2001/01/27 18:21:17 dawes Exp $ +.\" $XFree86: xc/programs/xkill/xkill.man,v 1.8 2001/12/14 20:02:06 dawes Exp $ .\" .TH XKILL 1 __xorgversion__ .SH NAME Index: xc/programs/xload/Imakefile diff -u xc/programs/xload/Imakefile:1.6 xc/programs/xload/Imakefile:1.7 --- xc/programs/xload/Imakefile:1.6 Mon Jan 15 15:56:18 2001 +++ xc/programs/xload/Imakefile Mon Aug 13 15:35:01 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.6 2001/01/15 20:56:18 dawes Exp $ +XCOMM $XFree86: xc/programs/xload/Imakefile,v 1.7 2001/08/13 19:35:01 dawes Exp $ DEPLIBS = XawClientDepLibs LOCAL_LIBRARIES = XawClientLibs @@ -18,8 +18,8 @@ #elif defined(BSDOSArchitecture) && !defined(NetBSDArchitecture) && !defined(OpenBSDArchitecture) SYS_LIBRARIES = -lutil -lkvm #endif - SRCS = xload.c get_load.c - OBJS = xload.o get_load.o + SRCS = xload.c get_load.c get_rload.c + OBJS = xload.o get_load.o get_rload.o OSMAJORVERSION = OSMajorVersion OSMINORVERSION = OSMinorVersion DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) Index: xc/programs/xload/get_load.c diff -u xc/programs/xload/get_load.c:1.8 xc/programs/xload/get_load.c:1.15 --- xc/programs/xload/get_load.c:1.8 Sun Apr 8 01:00:09 2001 +++ xc/programs/xload/get_load.c Mon Jan 7 15:38:31 2002 @@ -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.8 2001/04/08 05:00:09 torrey Exp $ */ +/* $XFree86: xc/programs/xload/get_load.c,v 1.15 2002/01/07 20:38:31 dawes Exp $ */ /* Copyright (c) 1989 X Consortium @@ -43,18 +43,19 @@ #include <X11/Intrinsic.h> #include <X11/Xlocale.h> #include <stdio.h> +#include "xload.h" #if !defined(DGUX) -#ifdef att +#if defined(att) || defined(QNX4) #define LOADSTUB #endif #ifndef macII #ifndef apollo #ifndef LOADSTUB -#if !defined(linux) && !defined(AMOEBA) && !defined(__EMX__) && !defined(__GNU__) +#if !defined(linux) && !defined(__EMX__) && !defined(__GNU__) #include <nlist.h> -#endif /* linux || AMOEBA */ +#endif /* !linux && ... */ #endif /* LOADSTUB */ #endif /* apollo */ #endif /* macII */ @@ -151,9 +152,8 @@ #ifdef X_NOT_POSIX extern long lseek(); #endif -extern void exit(); -static xload_error( +static void xload_error( #if NeedFunctionPrototypes char *, char * #endif @@ -202,8 +202,8 @@ /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) /* Apollo version */ Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* pointer to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ { time_$clock_t timeNow; double temp; @@ -246,7 +246,7 @@ static int kmem; static struct var v; static struct proc *p; -static caddr_t first_buf, last_buf; +static XtPointer first_buf, last_buf; void InitLoadPoint() /* SYSV386 version */ { @@ -270,15 +270,15 @@ if ((p=(struct proc *)malloc(v.v_proc*sizeof(*p))) == NULL) xload_error("cannot allocat space for", PROC_NAME); - first_buf = (caddr_t) namelist[2].n_value; + first_buf = (XtPointer) namelist[2].n_value; last_buf = first_buf + v.v_buf * sizeof(struct buf); } /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) /* SYSV386 version */ Widget w; /* unused */ -caddr_t closure; /* unused */ -caddr_t call_data; /* pointer to (double) return value */ +XtPointer closure; /* unused */ +XtPointer call_data; /* pointer to (double) return value */ { double *loadavg = (double *)call_data; static double avenrun = 0.0; @@ -353,57 +353,6 @@ } #else /* not KVM_ROUTINES */ -#ifdef AMOEBA -#include <amoeba.h> -#include <cmdreg.h> -#include <stderr.h> -#include <ampolicy.h> - -static capability pooldircap; -extern char *getenv(); - -void -InitLoadPoint() -{ - register char *s; - - if ((s = getenv("XLOAD_HOST")) != NULL) { - /* do an xload of a single host */ - if (host_lookup(s, &pooldircap) != STD_OK) - xload_error("cannot lookup run server", s); - if (dir_lookup(&pooldircap, "proc", &pooldircap) != STD_OK) - xload_error("cannot lookup run server", s); - } else { - /* Else we do an xload of a pool. - * Environment variable RUN_SERVER overrides the default one. - */ - if ((s = getenv("RUN_SERVER")) == NULL) - s = DEF_RUNSVR_POOL; - if (name_lookup(s, &pooldircap) != STD_OK) - xload_error("cannot lookup run server", s); - } -} - -/* ARGSUSED */ -void GetLoadPoint( w, closure, call_data ) - Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* pointer to (double) return value */ -{ - long ips, loadav, mfree; - - if (pro_getload(&pooldircap, &ips, &loadav, &mfree) != STD_OK) { - /* - * No run server. We don't want to crash, though: - * it will probably come up again. - */ - InitLoadPoint(); - loadav = 0; - } - *(double *)call_data = (double)loadav / 1024.0; -} -#else /* AMOEBA */ - #ifdef linux void InitLoadPoint() @@ -413,8 +362,8 @@ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* pointer to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ { static int fd = -1; int n; @@ -476,8 +425,8 @@ /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* pointer to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ { host_t host; struct processor_set_basic_info info; @@ -513,8 +462,8 @@ /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* pointer to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ { double *loadavg = (double *)call_data; @@ -542,8 +491,8 @@ /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* pointer to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ { *(double *)call_data = 1.0; } @@ -559,8 +508,8 @@ /*ARGSUSED*/ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* pointer to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ { double *loadavg = (double *)call_data; struct tbl_loadavg load_data; @@ -574,6 +523,43 @@ #else /* not __osf__ */ +#ifdef __QNXNTO__ +#include <time.h> +#include <sys/neutrino.h> +static _Uint64t nto_idle = 0, nto_idle_last = 0; +static int nto_idle_id; +static struct timespec nto_now, nto_last; + +void +InitLoadPoint() +{ + nto_idle_id = ClockId(1, 1); /* Idle thread */ + ClockTime(nto_idle_id, NULL, &nto_idle_last); + clock_gettime( CLOCK_REALTIME, &nto_last); +} + +/* ARGSUSED */ +void +GetLoadPoint( w, closure, call_data ) /* QNX NTO version */ +Widget w; /* unused */ +XtPointer closure; /* unused */ +XtPointer call_data; /* pointer to (double) return value */ +{ + double *loadavg = (double *)call_data; + double timediff; + double temp = 0.0; + + ClockTime(nto_idle_id, NULL, &nto_idle); + clock_gettime( CLOCK_REALTIME, &nto_now); + timediff = 1000000000.0 * (nto_now.tv_sec - nto_last.tv_sec) + + (nto_now.tv_nsec - nto_last.tv_nsec); + temp = 1.0 - (nto_idle-nto_idle_last)/timediff; + *loadavg = temp >= 0 ? temp : 0; + nto_idle_last = nto_idle; + nto_last = nto_now; +} +#else /* not __QNXNTO__ */ + #ifdef __bsdi__ #include <kvm.h> @@ -610,8 +596,8 @@ void GetLoadPoint(w, closure, call_data) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* ptr to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* ptr to (double) return value */ { double *loadavg = (double *)call_data; fixpt_t t; @@ -624,8 +610,8 @@ return; } -#else /* not __bsdi__ */ +#else /* not __bsdi__ */ #if defined(BSD) && (BSD >= 199306) void InitLoadPoint() @@ -634,8 +620,8 @@ void GetLoadPoint(w, closure, call_data) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* ptr to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* ptr to (double) return value */ { double *loadavg = (double *)call_data; @@ -699,10 +685,6 @@ #define KERNEL_FILE "/kernel/unix" #endif -#ifdef MINIX -#define KERNEL_FILE "/sys/kernel" -#endif /* MINIX */ - #ifdef sgi #if (OSMAJORVERSION > 4) #define KERNEL_FILE "/unix" @@ -792,10 +774,6 @@ # endif # endif /* MOTOROLA */ -# ifdef MINIX -# define KERNEL_LOAD_VARIABLE "_loadav" -# endif /* MINIX */ - #endif /* KERNEL_LOAD_VARIABLE */ /* @@ -832,10 +810,10 @@ }; #endif /* macII */ -static kmem; +static int kmem; static long loadavg_seek; -InitLoadPoint() +void InitLoadPoint() { #ifdef macII extern nlist(); @@ -883,7 +861,7 @@ } #else /* sun svr4 5.5 or later */ -#if (!defined(SVR4) || !defined(__STDC__)) && !defined(sgi) && !defined(MOTOROLA) && !(BSD >= 199103) && !defined(MINIX) +#if (!defined(SVR4)) && !defined(sgi) && !defined(MOTOROLA) && !(BSD >= 199103) extern void nlist(); #endif @@ -924,8 +902,8 @@ /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* pointer to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ { double *loadavg = (double *)call_data; @@ -1073,25 +1051,7 @@ } # endif /* mips */ # else /* not sony NEWSOS4 */ -# ifdef MINIX - { -/* Indices in the loadav array */ -#define LDAV_CURR 0 /* run queue lenght at this moment */ -#define LDAV_6 1 /* av. run q len over 64 ticks (1s) */ -#define LDAV_12 2 /* av. run q len over 4096 ticks */ -#define LDAV_16 3 /* av. run q len over 65536 tick */ -#define LDAV_TOT 4 /* cummulative run q lenght */ -#define LDAV_NR 5 /* size of the loadav array */ -#define LDAV_SCALE_SHFT 8 /* values are scaled by 256 */ - - unsigned long loadav[LDAV_NR]; /* load avarage array */ - - (void) read(kmem, (char *)loadav, sizeof(loadav)); - *loadavg = (double)loadav[LDAV_12]/0x1000; - } -# else /* !MINIX */ (void) read(kmem, (char *)loadavg, sizeof(double)); -# endif /* MINIX */ # endif /* sony NEWOS4 */ # endif /* MOTOROLA else */ # endif /* AIXV3 else */ @@ -1102,16 +1062,16 @@ } #endif /* BSD >= 199306 else */ #endif /* __bsdi__ else */ +#endif /* __QNXNTO__ else */ #endif /* __osf__ else */ #endif /* LOADSTUB else */ #endif /* __DARWIN__ else */ #endif /* __GNU__ else */ #endif /* linux else */ -#endif /* AMOEBA else */ #endif /* KVM_ROUTINES else */ #endif /* SYSV && i386 else */ -static xload_error(str1, str2) +static void xload_error(str1, str2) char *str1, *str2; { (void) fprintf(stderr,"xload: %s %s\n", str1, str2); @@ -1148,8 +1108,8 @@ void GetLoadPoint(w, closure, call_data) Widget w; /* unused */ - caddr_t closure; /* unused */ - caddr_t call_data; /* ptr to (double) return value */ + XtPointer closure; /* unused */ + XtPointer call_data; /* ptr to (double) return value */ { double *loadavg = (double *)call_data; Index: xc/programs/xload/get_rload.c diff -u /dev/null xc/programs/xload/get_rload.c:1.5 --- /dev/null Fri Jan 18 15:27:31 2002 +++ xc/programs/xload/get_rload.c Mon Jan 7 16:46:49 2002 @@ -0,0 +1,76 @@ +/* $XFree86: xc/programs/xload/get_rload.c,v 1.5 2002/01/07 21:46:49 dawes Exp $ */ + +#include <stdio.h> +#include <X11/Intrinsic.h> +#include <fcntl.h> +#include <stdlib.h> +#include <unistd.h> +#include "xload.h" + +/* Not all OS supports get_rload + steal the STUB idea from get_load + */ +#if defined(QNX4) +#define RLOADSTUB +#endif + +#ifdef RLOADSTUB +void GetRLoadPoint( w, closure, call_data ) + Widget w; /* unused */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ + +{ + *(double *)call_data = 1.0; +} +#else /* RLOADSTUB */ + +#include <protocols/rwhod.h> +#ifndef _PATH_RWHODIR +#define _PATH_RWHODIR "/var/spool/rwho" +#endif + +typedef struct _XLoadResources { + Boolean show_label; + Boolean use_lights; + String remote; +} XLoadResources; + +extern XLoadResources resources ; + +#define WHDRSIZE ((int)(sizeof (buf) - sizeof (buf.wd_we))) + +void GetRLoadPoint( w, closure, call_data ) + Widget w; /* unused */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ + +{ + int f; + static char *fname = NULL; + static struct whod buf; + int cc; + + *(double *)call_data = 0.0; /* to be on the safe side */ + + if (fname == NULL) { + if ((fname = malloc(strlen(_PATH_RWHODIR)+strlen("/whod.")+strlen(resources.remote)+1)) == NULL) { + fprintf(stderr,"GetRLoadPoint: malloc() failed\n"); + exit(1); + } + strcpy(fname,_PATH_RWHODIR); + strcat(fname,"/whod."); + strcat(fname,resources.remote); + } + if ((f = open(fname, O_RDONLY, 0)) < 0) + return; + + cc = read(f, &buf, sizeof(buf)); + close(f); + if (cc < WHDRSIZE) + return; + + *(double *)call_data = buf.wd_loadav[0] / 100.0; +} + +#endif /* RLOADSTUB */ Index: xc/programs/xload/xload.c diff -u xc/programs/xload/xload.c:1.2 xc/programs/xload/xload.c:1.6 --- xc/programs/xload/xload.c:1.2 Thu May 11 14:14:45 2000 +++ xc/programs/xload/xload.c Mon Aug 27 19:35:14 2001 @@ -1,5 +1,5 @@ /* $XConsortium: xload.c,v 1.37 94/04/17 20:43:44 converse Exp $ */ -/* $XFree86: xc/programs/xload/xload.c,v 1.2 2000/05/11 18:14:45 tsi Exp $ */ +/* $XFree86: xc/programs/xload/xload.c,v 1.6 2001/08/27 23:35:14 dawes Exp $ */ /* Copyright (c) 1989 X Consortium @@ -34,7 +34,9 @@ * xload - display system load average in a window */ + #include <stdio.h> +#include <unistd.h> #include <X11/Intrinsic.h> #include <X11/Xatom.h> #include <X11/StringDefs.h> @@ -45,15 +47,15 @@ #include <X11/Xaw/Paned.h> #include <X11/Xaw/StripChart.h> #include <X11/Xmu/SysUtil.h> +#include "xload.h" #include "xload.bit" char *ProgramName; -extern void exit(), GetLoadPoint(); -static void quit(); -static void ClearLights(); -static void SetLights(); +static void quit(Widget w, XEvent *event, String *params, Cardinal *num_params); +static void ClearLights(Display *dpy); +static void SetLights(XtPointer data, XtIntervalId *timer); /* * Definition of the Application resources structure. @@ -62,6 +64,7 @@ typedef struct _XLoadResources { Boolean show_label; Boolean use_lights; + String remote; } XLoadResources; /* @@ -78,6 +81,7 @@ {"-nolabel", "*showLabel", XrmoptionNoArg, "False"}, {"-lights", "*useLights", XrmoptionNoArg, "True"}, {"-jumpscroll", "*load.jumpScroll", XrmoptionSepArg, NULL}, + {"-remote", "*remote", XrmoptionSepArg, NULL}, }; /* @@ -92,11 +96,14 @@ Offset(show_label), XtRImmediate, (XtPointer) TRUE}, {"useLights", XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(use_lights), XtRImmediate, (XtPointer) FALSE}, + {"remote", XtCString, XtRString, sizeof(XtRString), + Offset(remote), XtRImmediate, (XtPointer) FALSE}, + }; #undef Offset -static XLoadResources resources; +XLoadResources resources; static XtActionsRec xload_actions[] = { { "quit", quit }, @@ -108,7 +115,7 @@ * Exit with message describing command line format. */ -void usage() +static void usage(void) { fprintf (stderr, "usage: %s [-options ...]\n\n", ProgramName); fprintf (stderr, "where options include:\n"); @@ -134,14 +141,14 @@ " -nolabel removes the label from above the chart.\n"); fprintf (stderr, " -jumpscroll value number of pixels to scroll on overflow\n"); + fprintf (stderr, + " -remote host remote host to monitor\n"); fprintf (stderr, "\n"); exit(1); } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { XtAppContext app_con; Widget toplevel, load, pane, label_wid, load_parent; @@ -221,29 +228,7 @@ XtGetValues(label_wid, args, ONE); if ( strcmp("label", label) == 0 ) { -#ifdef AMOEBA - char *s; - char *getenv(); - - host[255] = '\0'; - if ((s = getenv("XLOAD_HOST")) != NULL) { - strncpy(host, s, 255); - } else if ((s = getenv("RUN_SERVER")) != NULL) { - /* specific runserver specified; use its name */ - strncpy(host, s, 255); - - { /* if the last component is ".run", remove it */ - char *slash = strrchr(host, '/'); - if (slash != NULL && strcmp(slash + 1, ".run") == 0) { - *slash = '\0'; - } - } - } else { - (void) XmuGetHostname (host, 255); /* "amoeba" */ - } -#else (void) XmuGetHostname (host, 255); -#endif XtSetArg (args[0], XtNlabel, host); XtSetValues (label_wid, args, ONE); } @@ -256,8 +241,11 @@ load = XtCreateManagedWidget ("load", stripChartWidgetClass, load_parent, NULL, ZERO); - XtAddCallback(load, XtNgetValue, GetLoadPoint, NULL); - + if (resources.remote) + XtAddCallback(load, XtNgetValue, GetRLoadPoint, NULL); + else + XtAddCallback(load, XtNgetValue, GetLoadPoint, NULL); + XtRealizeWidget (toplevel); wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW", False); @@ -296,7 +284,10 @@ toplevel = (Widget) data; dpy = XtDisplay (toplevel); - GetLoadPoint (toplevel, (XtPointer) 0, (XtPointer) &value); + if (resources.remote) + GetRLoadPoint (toplevel, (XtPointer) 0, (XtPointer) &value); + else + GetLoadPoint (toplevel, (XtPointer) 0, (XtPointer) &value); new_leds = (1 << (int) (value + 0.1)) - 1; change = new_leds ^ current_leds; i = 1; @@ -333,3 +324,9 @@ XtDestroyApplicationContext(XtWidgetToApplicationContext(w)); exit (0); } + + + + + + Index: xc/programs/xload/xload.h diff -u /dev/null xc/programs/xload/xload.h:1.2 --- /dev/null Fri Jan 18 15:27:31 2002 +++ xc/programs/xload/xload.h Tue Aug 28 13:10:39 2001 @@ -0,0 +1,12 @@ +/* $XFree86: xc/programs/xload/xload.h,v 1.2 2001/08/28 17:10:39 tsi Exp $ */ + +#ifndef _XLOAD_H_ +#define _XLOAD_H_ + +#include <X11/Intrinsic.h> + +extern void InitLoadPoint(void); +extern void GetLoadPoint(Widget w, XtPointer closure, XtPointer call_data); +extern void GetRLoadPoint(Widget w, XtPointer closure, XtPointer call_data); + +#endif Index: xc/programs/xload/xload.man diff -u xc/programs/xload/xload.man:1.3 xc/programs/xload/xload.man:1.4 --- xc/programs/xload/xload.man:1.3 Sat Jan 27 13:21:17 2001 +++ xc/programs/xload/xload.man Mon Aug 13 15:35:01 2001 @@ -1,13 +1,13 @@ .\" $XConsortium: xload.man,v 1.29 94/04/17 20:43:44 matt Exp $ .\" -.\" $XFree86: xc/programs/xload/xload.man,v 1.3 2001/01/27 18:21:17 dawes Exp $ +.\" $XFree86: xc/programs/xload/xload.man,v 1.4 2001/08/13 19:35:01 dawes Exp $ .\" .TH XLOAD 1 __xorgversion__ .SH NAME xload \- system load average display for X .SH SYNOPSIS .ta 6n -\fBxload\fP [-\fItoolkitoption\fP ...] [-scale \fIinteger\fP] [-update \fIseconds\fP] [-hl \fIcolor\fP] [-highlight \fIcolor\fP] +\fBxload\fP [-\fItoolkitoption\fP ...] [-scale \fIinteger\fP] [-update \fIseconds\fP] [-hl \fIcolor\fP] [-highlight \fIcolor\fP] [-remote \fIhost\fP] .br [-jumpscroll \fIpixels\fP] [-label \fIstring\fP] [-nolabel] [-lights] .SH DESCRIPTION @@ -55,6 +55,9 @@ This option specifies the interval in seconds at which \fIxload\fP updates its display. The minimum amount of time allowed between updates is 1 second. The default is 10. +.TP 8 +.B \-remote \fIhost\fP +This option tells \fIxload\fP to display the load of \fIhost\fP instead of \fIlocalhost\fP. \fIXload\fP gets the information from the \fIrwhod\fP database and consequently requires \fIrwhod\fP to be executing both on \fIlocalhost\fP and \fIhost\fP. .SH RESOURCES In addition to the resources available to each of the widgets used by \fIxload\fP there is one resource defined by the application itself. Index: xc/programs/xlogo/Logo.c diff -u xc/programs/xlogo/Logo.c:1.4 xc/programs/xlogo/Logo.c:1.5 --- xc/programs/xlogo/Logo.c:1.4 Wed Jan 17 18:46:16 2001 +++ xc/programs/xlogo/Logo.c Fri Dec 14 15:02:07 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Logo.c,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ */ +/* $Xorg: Logo.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */ /* Copyright 1988, 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xlogo/Logo.c,v 1.4 2001/01/17 23:46:16 dawes Exp $ */ +/* $XFree86: xc/programs/xlogo/Logo.c,v 1.5 2001/12/14 20:02:07 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.4 xc/programs/xlogo/Logo.h:1.2 --- xc/programs/xlogo/Logo.h:1.1.1.4 Tue Jan 16 18:01:26 2001 +++ xc/programs/xlogo/Logo.h Fri Dec 14 15:02:07 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Logo.h,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ */ +/* $Xorg: Logo.h,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */ /* Copyright 1988, 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xlogo/LogoP.h diff -u xc/programs/xlogo/LogoP.h:1.1.1.3 xc/programs/xlogo/LogoP.h:1.2 --- xc/programs/xlogo/LogoP.h:1.1.1.3 Tue Jan 16 18:01:27 2001 +++ xc/programs/xlogo/LogoP.h Fri Dec 14 15:02:07 2001 @@ -1,9 +1,13 @@ -/* $Xorg: LogoP.h,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ */ +/* $Xorg: LogoP.h,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */ /* Copyright 1988, 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xlogo/xlogo.c diff -u xc/programs/xlogo/xlogo.c:3.5 xc/programs/xlogo/xlogo.c:3.8 --- xc/programs/xlogo/xlogo.c:3.5 Wed Jan 17 18:46:16 2001 +++ xc/programs/xlogo/xlogo.c Fri Dec 14 15:02:07 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: xlogo.c,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ + * $Xorg: xlogo.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ * */ -/* $XFree86: xc/programs/xlogo/xlogo.c,v 3.5 2001/01/17 23:46:16 dawes Exp $ */ +/* $XFree86: xc/programs/xlogo/xlogo.c,v 3.8 2001/12/14 20:02:07 dawes Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> @@ -31,12 +35,7 @@ #ifdef XKB #include <X11/extensions/XKBbells.h> #endif - -#ifdef X_NOT_STDC_ENV -extern void exit(); -#else #include <stdlib.h> -#endif static void quit(Widget w, XEvent *event, String *params, Cardinal *num_params); @@ -150,10 +149,3 @@ } } -#ifdef MINIX -SmcCloseStatus -SmcCloseConnection(SmcConn smcConn, int count, char **reasonMsgs) -{ - return SmcClosedNow; -} -#endif Index: xc/programs/xlogo/xlogo.man diff -u xc/programs/xlogo/xlogo.man:1.7 xc/programs/xlogo/xlogo.man:1.8 --- xc/programs/xlogo/xlogo.man:1.7 Sat Jan 27 13:21:17 2001 +++ xc/programs/xlogo/xlogo.man Fri Dec 14 15:02:07 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xlogo.man,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ +.\" $Xorg: xlogo.man,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xlogo/xlogo.man,v 1.7 2001/01/27 18:21:17 dawes Exp $ +.\" $XFree86: xc/programs/xlogo/xlogo.man,v 1.8 2001/12/14 20:02:07 dawes Exp $ .\" .TH XLOGO 1 __xorgversion__ .SH NAME Index: xc/programs/xlsatoms/xlsatoms.c diff -u xc/programs/xlsatoms/xlsatoms.c:1.5 xc/programs/xlsatoms/xlsatoms.c:1.6 --- xc/programs/xlsatoms/xlsatoms.c:1.5 Sun Apr 1 10:00:23 2001 +++ xc/programs/xlsatoms/xlsatoms.c Fri Dec 14 15:02:08 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: xlsatoms.c,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ + * $Xorg: xlsatoms.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xlsatoms/xlsatoms.c,v 1.5 2001/04/01 14:00:23 tsi Exp $ */ +/* $XFree86: xc/programs/xlsatoms/xlsatoms.c,v 1.6 2001/12/14 20:02:08 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/xlsatoms/xlsatoms.man diff -u xc/programs/xlsatoms/xlsatoms.man:1.7 xc/programs/xlsatoms/xlsatoms.man:1.8 --- xc/programs/xlsatoms/xlsatoms.man:1.7 Sat Jan 27 13:21:17 2001 +++ xc/programs/xlsatoms/xlsatoms.man Fri Dec 14 15:02:08 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xlsatoms.man,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ +.\" $Xorg: xlsatoms.man,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ .\" Copyright 1989, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xlsatoms/xlsatoms.man,v 1.7 2001/01/27 18:21:17 dawes Exp $ +.\" $XFree86: xc/programs/xlsatoms/xlsatoms.man,v 1.8 2001/12/14 20:02:08 dawes Exp $ .\" .TH XLSATOMS 1 __xorgversion__ .SH NAME Index: xc/programs/xlsclients/xlscli.man diff -u xc/programs/xlsclients/xlscli.man:1.7 xc/programs/xlsclients/xlscli.man:1.8 --- xc/programs/xlsclients/xlscli.man:1.7 Sat Jan 27 13:21:18 2001 +++ xc/programs/xlsclients/xlscli.man Fri Dec 14 15:02:08 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xlscli.man,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ +.\" $Xorg: xlscli.man,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ .\" Copyright 1991, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xlsclients/xlscli.man,v 1.7 2001/01/27 18:21:18 dawes Exp $ +.\" $XFree86: xc/programs/xlsclients/xlscli.man,v 1.8 2001/12/14 20:02:08 dawes Exp $ .\" .TH XLSCLIENTS 1 __xorgversion__ .SH NAME Index: xc/programs/xlsclients/xlsclients.c diff -u xc/programs/xlsclients/xlsclients.c:1.5 xc/programs/xlsclients/xlsclients.c:1.6 --- xc/programs/xlsclients/xlsclients.c:1.5 Sun Apr 1 10:00:23 2001 +++ xc/programs/xlsclients/xlsclients.c Fri Dec 14 15:02:09 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: xlsclients.c,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ + * $Xorg: xlsclients.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xlsclients/xlsclients.c,v 1.5 2001/04/01 14:00:23 tsi Exp $ */ +/* $XFree86: xc/programs/xlsclients/xlsclients.c,v 1.6 2001/12/14 20:02:09 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/xlsfonts/dsimple.c diff -u xc/programs/xlsfonts/dsimple.c:3.4 xc/programs/xlsfonts/dsimple.c:3.6 --- xc/programs/xlsfonts/dsimple.c:3.4 Wed Jan 17 18:46:19 2001 +++ xc/programs/xlsfonts/dsimple.c Fri Dec 14 15:02:09 2001 @@ -1,9 +1,13 @@ -/* $Xorg: dsimple.c,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ */ +/* $Xorg: dsimple.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,21 +26,15 @@ from The Open Group. */ -/* $XFree86: xc/programs/xlsfonts/dsimple.c,v 3.4 2001/01/17 23:46:19 dawes Exp $ */ +/* $XFree86: xc/programs/xlsfonts/dsimple.c,v 3.6 2001/12/14 20:02:09 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> #include <stdio.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern char *malloc(), *realloc(); -#endif -#if NeedVarargsPrototypes #include <stdarg.h> -#endif /* * Other_stuff.h: Definitions of routines in other_stuff. * @@ -492,28 +490,14 @@ * in code so we can tell where we are. Outl may be invoked like * printf with up to 7 arguments. */ -/* VARARGS1 */ void -outl( -#if NeedVarargsPrototypes - char *msg, ...) -#else -msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) -char *msg; -char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; -#endif +outl(char *msg, ...) { -#if NeedVarargsPrototypes va_list args; -#endif fflush(stdout); -#if NeedVarargsPrototypes va_start(args, msg); vfprintf(stderr, msg, args); va_end(args); -#else - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); -#endif fprintf(stderr, "\n"); fflush(stderr); } @@ -523,29 +507,15 @@ * Standard fatal error routine - call like printf but maximum of 7 arguments. * Does not require dpy or screen defined. */ -/* VARARGS1 */ -void Fatal_Error( -#if NeedVarargsPrototypes - char *msg, ...) -#else -msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) -char *msg; -char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; -#endif +void Fatal_Error(char *msg, ...) { -#if NeedVarargsPrototypes va_list args; -#endif fflush(stdout); fflush(stderr); fprintf(stderr, "%s: error: ", program_name); -#if NeedVarargsPrototypes va_start(args, msg); vfprintf(stderr, msg, args); va_end(args); -#else - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); -#endif fprintf(stderr, "\n"); exit(1); } Index: xc/programs/xlsfonts/dsimple.h diff -u xc/programs/xlsfonts/dsimple.h:1.4 xc/programs/xlsfonts/dsimple.h:1.7 --- xc/programs/xlsfonts/dsimple.h:1.4 Wed Jan 17 18:46:19 2001 +++ xc/programs/xlsfonts/dsimple.h Fri Dec 14 15:02:10 2001 @@ -1,9 +1,13 @@ -/* $Xorg: dsimple.h,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ */ +/* $Xorg: dsimple.h,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,6 +26,7 @@ from The Open Group. */ +/* $XFree86: xc/programs/xlsfonts/dsimple.h,v 1.7 2001/12/14 20:02:10 dawes Exp $ */ /* * Just_display.h: This file contains the definitions needed to use the @@ -95,14 +100,9 @@ void blip(); Window Window_With_Name(); #endif -#if NeedVarargsPrototypes #if __GNUC__ void Fatal_Error(char *, ...) __attribute__((__noreturn__)); #else void Fatal_Error(char *, ...); #endif void outl(char *, ...); -#else -void Fatal_Error(); -void outl(); -#endif Index: xc/programs/xlsfonts/xlsfonts.c diff -u xc/programs/xlsfonts/xlsfonts.c:1.7 xc/programs/xlsfonts/xlsfonts.c:1.8 --- xc/programs/xlsfonts/xlsfonts.c:1.7 Fri Apr 27 08:58:28 2001 +++ xc/programs/xlsfonts/xlsfonts.c Fri Dec 14 15:02:10 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: xlsfonts.c,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ + * $Xorg: xlsfonts.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -20,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/xlsfonts/xlsfonts.c,v 1.7 2001/04/27 12:58:28 dawes Exp $ */ +/* $XFree86: xc/programs/xlsfonts/xlsfonts.c,v 1.8 2001/12/14 20:02:10 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xutil.h> Index: xc/programs/xlsfonts/xlsfonts.man diff -u xc/programs/xlsfonts/xlsfonts.man:1.7 xc/programs/xlsfonts/xlsfonts.man:1.8 --- xc/programs/xlsfonts/xlsfonts.man:1.7 Sat Jan 27 13:21:18 2001 +++ xc/programs/xlsfonts/xlsfonts.man Fri Dec 14 15:02:10 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xlsfonts.man,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ +.\" $Xorg: xlsfonts.man,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xlsfonts/xlsfonts.man,v 1.7 2001/01/27 18:21:18 dawes Exp $ +.\" $XFree86: xc/programs/xlsfonts/xlsfonts.man,v 1.8 2001/12/14 20:02:10 dawes Exp $ .\" .TH XLSFONTS 1 __xorgversion__ .SH NAME Index: xc/programs/xmag/CutPaste.c diff -u xc/programs/xmag/CutPaste.c:1.5 xc/programs/xmag/CutPaste.c:1.6 --- xc/programs/xmag/CutPaste.c:1.5 Wed Jan 17 18:46:19 2001 +++ xc/programs/xmag/CutPaste.c Fri Dec 14 15:02:11 2001 @@ -1,9 +1,13 @@ -/* $Xorg: CutPaste.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: CutPaste.c,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/CutPaste.c,v 1.5 2001/01/17 23:46:19 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/CutPaste.c,v 1.6 2001/12/14 20:02:11 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium */ Index: xc/programs/xmag/RootWin.c diff -u xc/programs/xmag/RootWin.c:1.4 xc/programs/xmag/RootWin.c:1.5 --- xc/programs/xmag/RootWin.c:1.4 Wed Jan 17 18:46:20 2001 +++ xc/programs/xmag/RootWin.c Fri Dec 14 15:02:11 2001 @@ -1,9 +1,13 @@ -/* $Xorg: RootWin.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: RootWin.c,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/RootWin.c,v 1.4 2001/01/17 23:46:20 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/RootWin.c,v 1.5 2001/12/14 20:02:11 dawes Exp $ */ #include <X11/IntrinsicP.h> Index: xc/programs/xmag/RootWin.h diff -u xc/programs/xmag/RootWin.h:1.1.1.3 xc/programs/xmag/RootWin.h:1.2 --- xc/programs/xmag/RootWin.h:1.1.1.3 Tue Jan 16 18:01:41 2001 +++ xc/programs/xmag/RootWin.h Fri Dec 14 15:02:11 2001 @@ -1,9 +1,13 @@ -/* $Xorg: RootWin.h,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: RootWin.h,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xmag/RootWinP.h diff -u xc/programs/xmag/RootWinP.h:1.1.1.3 xc/programs/xmag/RootWinP.h:1.2 --- xc/programs/xmag/RootWinP.h:1.1.1.3 Tue Jan 16 18:01:42 2001 +++ xc/programs/xmag/RootWinP.h Fri Dec 14 15:02:11 2001 @@ -1,9 +1,13 @@ -/* $Xorg: RootWinP.h,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: RootWinP.h,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xmag/Scale.c diff -u xc/programs/xmag/Scale.c:3.7 xc/programs/xmag/Scale.c:3.9 --- xc/programs/xmag/Scale.c:3.7 Wed Jan 17 18:46:20 2001 +++ xc/programs/xmag/Scale.c Fri Dec 14 15:02:11 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Scale.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: Scale.c,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/Scale.c,v 3.7 2001/01/17 23:46:20 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/Scale.c,v 3.9 2001/12/14 20:02:11 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -31,9 +35,7 @@ #include <stdio.h> #include <ctype.h> #include <math.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #if defined(ISC) && __STDC__ && !defined(ISC30) extern double atof(char *); #endif Index: xc/programs/xmag/Scale.h diff -u xc/programs/xmag/Scale.h:1.4 xc/programs/xmag/Scale.h:1.5 --- xc/programs/xmag/Scale.h:1.4 Wed Jan 17 18:46:20 2001 +++ xc/programs/xmag/Scale.h Fri Dec 14 15:02:11 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Scale.h,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: Scale.h,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/Scale.h,v 1.4 2001/01/17 23:46:20 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/Scale.h,v 1.5 2001/12/14 20:02:11 dawes Exp $ */ #ifndef _XawScale_h #define _XawScale_h Index: xc/programs/xmag/ScaleP.h diff -u xc/programs/xmag/ScaleP.h:1.1.1.3 xc/programs/xmag/ScaleP.h:1.2 --- xc/programs/xmag/ScaleP.h:1.1.1.3 Tue Jan 16 18:01:44 2001 +++ xc/programs/xmag/ScaleP.h Fri Dec 14 15:02:11 2001 @@ -1,9 +1,13 @@ -/* $Xorg: ScaleP.h,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: ScaleP.h,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ */ /* Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xmag/xmag.c diff -u xc/programs/xmag/xmag.c:1.8 xc/programs/xmag/xmag.c:1.10 --- xc/programs/xmag/xmag.c:1.8 Wed Jan 17 18:46:20 2001 +++ xc/programs/xmag/xmag.c Fri Dec 14 15:02:11 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xmag.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: xmag.c,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ */ /* Copyright 1991, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,12 +26,10 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/xmag.c,v 1.8 2001/01/17 23:46:20 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/xmag.c,v 1.10 2001/12/14 20:02:11 dawes Exp $ */ -#ifndef X_NOT_STDC_ENV #include <stdlib.h> /* for exit() and abs() */ -#endif #include <stdio.h> #include <X11/Intrinsic.h> Index: xc/programs/xmag/xmag.man diff -u xc/programs/xmag/xmag.man:1.6 xc/programs/xmag/xmag.man:1.7 --- xc/programs/xmag/xmag.man:1.6 Sat Jan 27 13:21:18 2001 +++ xc/programs/xmag/xmag.man Fri Dec 14 15:02:12 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xmag.man,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ +.\" $Xorg: xmag.man,v 1.4 2001/02/09 02:05:55 xorgcvs Exp $ .\" Copyright 1991, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xmag/xmag.man,v 1.6 2001/01/27 18:21:18 dawes Exp $ +.\" $XFree86: xc/programs/xmag/xmag.man,v 1.7 2001/12/14 20:02:12 dawes Exp $ .\" .TH XMAG 1 __xorgversion__ .SH NAME Index: xc/programs/xman/Imakefile diff -u xc/programs/xman/Imakefile:1.3 xc/programs/xman/Imakefile:1.5 --- xc/programs/xman/Imakefile:1.3 Thu Apr 19 15:54:51 2001 +++ xc/programs/xman/Imakefile Thu Nov 1 18:35:35 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.3 2001/04/19 19:54:51 dawes Exp $ +XCOMM $XFree86: xc/programs/xman/Imakefile,v 1.5 2001/11/01 23:35:35 dawes Exp $ #ifdef XmanSearchPath XMANSYSPATH = XmanSearchPath @@ -15,6 +15,18 @@ MKSTEMP = -DHAS_MKSTEMP #endif +XCOMM select internal format of manpath configuration file +#if defined(FreeBSDArchitecture) || \ + (defined(LinuxDistribution) && (LinuxDistribution == LinuxDebian)) +MANCONFIGSTYLE = -DMANCONFIGSTYLE_FreeBSD +#elif defined(LinuxArchitecture) +MANCONFIGSTYLE = -DMANCONFIGSTYLE_Linux +#elif defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) +MANCONFIGSTYLE = -DMANCONFIGSTYLE_OpenBSD +#elif defined(BSDArchitecture) +MANCONFIGSTYLE = -DMANCONFIGSTYLE_BSD +#endif + #if HasGroff GROFF = -DHAS_GROFF #endif @@ -29,8 +41,9 @@ OSMINORVERSION = OSMinorVersion DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) \ -DOSMINORVERSION=$(OSMINORVERSION) \ - $(SNPDEFINES) $(HELPFILE) $(MANPATHS) $(MKSTEMP) $(GROFF) - INCLUDES = $(SNPINCLUDES) + $(SNPDEFINES) $(HELPFILE) $(MANPATHS) $(MKSTEMP) $(GROFF) \ + $(MANCONFIGSTYLE) + INCLUDES = -I$(SNPINCLUDES) DEPLIBS = XawClientDepLibs LOCAL_LIBRARIES = XawClientLibs SRCS = ScrollByL.c handler.c man.c buttons.c help.c \ Index: xc/programs/xman/ScrollByL.c diff -u xc/programs/xman/ScrollByL.c:1.4 xc/programs/xman/ScrollByL.c:1.6 --- xc/programs/xman/ScrollByL.c:1.4 Tue Sep 26 11:57:26 2000 +++ xc/programs/xman/ScrollByL.c Sat Oct 27 23:34:36 2001 @@ -28,19 +28,16 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/ScrollByL.c,v 1.4 2000/09/26 15:57:26 tsi Exp $ */ +/* $XFree86: xc/programs/xman/ScrollByL.c,v 1.6 2001/10/28 03:34:36 tsi Exp $ */ -#if ( !defined(lint) && !defined(SABER)) +#if !defined(lint) && !defined(SABER) && 0 static char rcs_version[] = "$Athena: ScrollByL.c,v 4.5 88/12/19 13:46:04 kit Exp $"; #endif #include <stdio.h> #include <ctype.h> - #include <X11/Xos.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include <X11/IntrinsicP.h> #include <sys/stat.h> /* depends on IntrinsicP.h */ Index: xc/programs/xman/main.c diff -u xc/programs/xman/main.c:1.3 xc/programs/xman/main.c:1.4 --- xc/programs/xman/main.c:1.3 Fri Mar 3 18:16:27 2000 +++ xc/programs/xman/main.c Sat Oct 27 23:34:36 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/main.c,v 1.3 2000/03/03 23:16:27 dawes Exp $ */ +/* $XFree86: xc/programs/xman/main.c,v 1.4 2001/10/28 03:34:36 tsi Exp $ */ /* * xman - X window system manual page display program. @@ -41,7 +41,7 @@ #include <X11/Xaw/Cardinals.h> #endif /* ZERO */ -#if ( !defined(lint) && !defined(SABER)) /* Version can be retrieved */ +#if !defined(lint) && !defined(SABER) && 0 static char version[] = XMAN_VERSION; /* via strings. */ #endif Index: xc/programs/xman/man.c diff -u xc/programs/xman/man.c:1.5 xc/programs/xman/man.c:1.6 --- xc/programs/xman/man.c:1.5 Tue Aug 1 14:53:07 2000 +++ xc/programs/xman/man.c Thu Nov 1 18:35:35 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/man.c,v 1.5 2000/08/01 18:53:07 dawes Exp $ */ +/* $XFree86: xc/programs/xman/man.c,v 1.6 2001/11/01 23:35:35 dawes Exp $ */ #include "globals.h" @@ -107,6 +107,10 @@ if (!ReadManConfig(manpath + strlen(manpath))) #endif { +#ifdef MANCONF + if (manpath[strlen(manpath) - 1] != ':') + strcat(manpath, ":"); +#endif strcat(manpath, SYSMANPATH); #ifdef LOCALMANPATH strcat(manpath, ":"); @@ -965,7 +969,7 @@ #ifdef MANCONF -#if defined(__FreeBSD__) +#if defined(MANCONFIGSTYLE_FreeBSD) /* Function Name: ReadManConfig * Description: Reads man.conf file used by FreeBSD man @@ -1010,7 +1014,7 @@ } -#elif defined(linux) /* not __FreeBSD__ */ +#elif defined(MANCONFIGSTYLE_Linux) /* not FreeBSD */ /* Function Name: ReadManConfig * Description: Reads man.conf file used by Linux man @@ -1050,7 +1054,7 @@ return(!firstpath); } -#elif defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(MANCONFIGSTYLE_OpenBSD) /* not FreeBSD or Linux */ /* Function Name: ReadManConfig * Description: Reads man.conf file used by Open/NetBSD @@ -1106,12 +1110,7 @@ return(!firstpath); } -#elif defined(BSD) - -/* Keep this ever AFTER linux, {Free,Net,Open}BSD and any other system in - * which "BSD" is defined but whose man.conf doesn't follows the original - * BSD 4.4 format. - */ +#elif defined(MANCONFIGSTYLE_BSD) /* not FreeBSD, Linux, or OpenBSD */ /* Function Name: ReadManConfig * Description: Reads man.conf file used by BSD 4.4 @@ -1156,6 +1155,6 @@ #error "MANCONF defined (in vendor.h) for unknown operating system." -#endif /* __FreeBSD__ ... BSD */ +#endif /* MANCONFIGSTYLE == FreeBSD ... BSD */ #endif /* MANCONF */ Index: xc/programs/xman/man.h diff -u xc/programs/xman/man.h:1.3 xc/programs/xman/man.h:1.4 --- xc/programs/xman/man.h:1.3 Fri Mar 3 18:16:27 2000 +++ xc/programs/xman/man.h Wed Jul 25 11:05:27 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/man.h,v 1.3 2000/03/03 23:16:27 dawes Exp $ */ +/* $XFree86: xc/programs/xman/man.h,v 1.4 2001/07/25 15:05:27 dawes Exp $ */ /* X toolkit header files */ @@ -190,13 +190,7 @@ #define StrAlloc(ptr) XtNewString(ptr) /* Standard library function definitions. */ - -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -char *getenv(), *malloc(), *realloc(); -void exit(); -#endif /* buttons.c */ Index: xc/programs/xman/misc.c diff -u xc/programs/xman/misc.c:1.6 xc/programs/xman/misc.c:1.7 --- xc/programs/xman/misc.c:1.6 Thu Apr 19 15:54:51 2001 +++ xc/programs/xman/misc.c Fri Dec 28 12:09:08 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/misc.c,v 1.6 2001/04/19 19:54:51 dawes Exp $ */ +/* $XFree86: xc/programs/xman/misc.c,v 1.7 2001/12/28 17:09:08 dawes Exp $ */ /* * xman - X window system manual page display program. @@ -402,7 +402,7 @@ FILE * Format(ManpageGlobals * man_globals, char * entry) { - FILE * file; + FILE * file = NULL; #ifdef HAS_MKSTEMP int fd; #endif Index: xc/programs/xman/vendor.h diff -u xc/programs/xman/vendor.h:1.7 xc/programs/xman/vendor.h:1.9 --- xc/programs/xman/vendor.h:1.7 Thu Apr 19 15:54:51 2001 +++ xc/programs/xman/vendor.h Sat Nov 3 19:13:48 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/vendor.h,v 1.7 2001/04/19 19:54:51 dawes Exp $ */ +/* $XFree86: xc/programs/xman/vendor.h,v 1.9 2001/11/04 00:13:48 dawes Exp $ */ /* Vendor-specific definitions */ @@ -59,9 +59,9 @@ # define SEARCHOTHER CAT #endif -#if defined(__FreeBSD__) +#if defined(MANCONFIGSTYLE_FreeBSD) # define MANCONF "/etc/manpath.config" -#elif (defined(BSD) && (BSD >= 199103)) || defined(linux) +#elif defined(MANCONFIGSTYLE_Linux) || defined(MANCONFIGSTYLE_OpenBSD) || defined(MANCONFIGSTYLE_BSD) # define MANCONF "/etc/man.conf" #endif Index: xc/programs/xmh/bbox.c diff -u xc/programs/xmh/bbox.c:1.1.1.1 xc/programs/xmh/bbox.c:1.2 --- xc/programs/xmh/bbox.c:1.1.1.1 Wed Apr 27 03:12:49 1994 +++ xc/programs/xmh/bbox.c Sat Oct 27 23:34:38 2001 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/bbox.c,v 1.2 2001/10/28 03:34:38 tsi Exp $ */ /* bbox.c -- management of buttons and buttonboxes. * @@ -232,7 +233,7 @@ Widget widget; int value; /* TRUE for enable, FALSE for disable. */ { - static Arg arglist[] = {XtNsensitive, (XtArgVal)False}; + static Arg arglist[] = {{XtNsensitive, (XtArgVal)False}}; arglist[0].value = (XtArgVal) value; XtSetValues(widget, arglist, XtNumber(arglist)); } Index: xc/programs/xmh/command.c diff -u xc/programs/xmh/command.c:3.5 xc/programs/xmh/command.c:3.8 --- xc/programs/xmh/command.c:3.5 Sun Dec 13 02:37:52 1998 +++ xc/programs/xmh/command.c Sun Dec 9 10:48:36 2001 @@ -1,5 +1,5 @@ /* $XConsortium: command.c,v 2.49 95/04/05 19:59:06 kaleb Exp $ */ -/* $XFree86: xc/programs/xmh/command.c,v 3.5 1998/12/13 07:37:52 dawes Exp $ */ +/* $XFree86: xc/programs/xmh/command.c,v 3.8 2001/12/09 15:48:36 herrb Exp $ */ /* * COPYRIGHT 1987, 1989 @@ -114,7 +114,7 @@ } -static int childdone; /* Gets nonzero when the child process +static volatile int childdone; /* Gets nonzero when the child process finishes. */ /* ARGSUSED */ static void @@ -138,7 +138,7 @@ { XtAppContext appCtx = XtWidgetToApplicationContext(toplevel); int return_status; - int old_stdin, old_stdout, old_stderr; + int old_stdin = 0, old_stdout = 0, old_stderr = 0; int pid; fd_set readfds, fds; Boolean output_to_pipe = False; @@ -420,7 +420,7 @@ /* Execute the given command, waiting until it's finished. Put the output in the specified file path. Returns 0 if stderr empty, -1 otherwise */ -DoCommand(argv, inputfile, outputfile) +int DoCommand(argv, inputfile, outputfile) char **argv; /* The command to execute, and its args. */ char *inputfile; /* Input file for command. */ char *outputfile; /* Output file for command. */ Index: xc/programs/xmh/compfuncs.c diff -u xc/programs/xmh/compfuncs.c:1.1.1.1 xc/programs/xmh/compfuncs.c:1.2 --- xc/programs/xmh/compfuncs.c:1.1.1.1 Wed Apr 27 03:12:49 1994 +++ xc/programs/xmh/compfuncs.c Tue Jul 31 20:45:06 2001 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/compfuncs.c,v 1.2 2001/08/01 00:45:06 tsi Exp $ */ /* comp.c -- action procedures to handle composition buttons. */ @@ -112,7 +113,7 @@ /* Utility routine; creates a composition screen containing a forward message of the messages in the given msglist. */ -CreateForward(mlist, params, num_params) +void CreateForward(mlist, params, num_params) MsgList mlist; String *params; Cardinal num_params; Index: xc/programs/xmh/externs.h diff -u xc/programs/xmh/externs.h:1.1.1.3 xc/programs/xmh/externs.h:1.4 --- xc/programs/xmh/externs.h:1.1.1.3 Tue Jan 16 05:25:45 1996 +++ xc/programs/xmh/externs.h Sat Oct 27 23:34:38 2001 @@ -25,148 +25,162 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/externs.h,v 1.4 2001/10/28 03:34:38 tsi Exp $ */ +#include <X11/Intrinsic.h> #include <errno.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -extern int errno; -extern char *getenv(); -extern void exit(); -extern void free(); -#endif /* Action routines are declared in actions.h */ /* Functions which begin with `Do' are the corresponding callbacks. */ /* from command.c */ -extern char * DoCommandToFile (/* Widget, XtPointer, XtPointer */); -extern char * DoCommandToString (/* Widget, XtPointer, XtPointer */); +extern int DoCommand (char **, char *, char *); +extern char * DoCommandToFile (char **); +extern char * DoCommandToString (char **); - /* from compfuncs. */ + /* from compfuncs.c */ -extern void DoResetCompose (/* Widget, XtPointer, XtPointer */); +extern void DoResetCompose (Widget, XtPointer, XtPointer); +extern void CreateForward (MsgList, String *, Cardinal); /* from folder.c */ -extern void DoClose (/* Widget, XtPointer, XtPointer */); -extern void DoComposeMessage (/* Widget, XtPointer, XtPointer */); -extern void DoOpenFolder (/* Widget, XtPointer, XtPointer */); -extern void DoOpenFolderInNewWindow (/* Widget, XtPointer, XtPointer */); -extern void DoCreateFolder (/* Widget, XtPointer, XtPointer */); -extern void DoDeleteFolder (/* Widget, XtPointer, XtPointer */); -extern void DoSaveYourself (/* Widget, XtPointer, XtPointer */); -extern void Push (/* Stack, char* */); -extern char * Pop (/* Stack */); +extern void DoClose (Widget, XtPointer, XtPointer); +extern void DoComposeMessage (Widget, XtPointer, XtPointer); +extern void DoOpenFolder (Widget, XtPointer, XtPointer); +extern void DoOpenFolderInNewWindow (Widget, XtPointer, XtPointer); +extern void DoCreateFolder (Widget, XtPointer, XtPointer); +extern void DoDeleteFolder (Widget, XtPointer, XtPointer); +extern void DoSaveYourself (Widget, XtPointer, XtPointer); +extern void Push (Stack *, char *); +extern char * Pop (Stack *); + /* from init.c */ + +extern void InitializeWorld (int, char **); + /* from menu.c */ + +extern void AttachMenuToButton (Button, Widget, char *); +extern void AddMenuEntry (Widget, char *, ...); +extern void DoRememberMenuSelection (Widget, XtPointer, XtPointer); +extern void SendMenuEntryEnableMsg (Button, char *, int); +extern void ToggleMenuItem (Widget, Boolean); -extern void AttachMenuToButton (/* Button, Widget, char * */); -extern void AddMenuEntry (/* Widget, char *, ... */); -extern void DoRememberMenuSelection (/* Widget, XtPointer, XtPointer */); -extern void SendMenuEntryEnableMsg (/* Button, char *, int */); -extern void ToggleMenuItem (/* Widget, Boolean */); + /* from miscfuncs.c */ +extern int ScanDir (char *, char ***, int (*)(char *)); + /* from msg.c */ + +extern Widget CreateFileSource (Widget, String, Boolean); +extern char* MsgName (Msg); + + /* from pick.c */ -extern Widget CreateFileSource (/* Widget, String, Boolean */); -extern char* MsgName (/* Msg */); +extern void InitPick (void); +extern void AddPick (Scrn, Toc, char *, char *); /* from popup.c */ -extern void DestroyPopup (/* Widget, XtPointer, XtPointer */); -extern void WMDeletePopup (/* Widget, XEvent* */); -extern void PopupPrompt (/* Widget, String, XtCallbackProc */); -extern void PopupConfirm (/* Widget, String, XtCallbackList, ... */); -extern void PopupNotice (/* char *, XtCallbackProc, XtPointer */); -extern void PopupError (/* Widget, String */); +extern void DestroyPopup (Widget, XtPointer, XtPointer); +extern void WMDeletePopup (Widget, XEvent*); +extern void PopupPrompt (Widget, String, XtCallbackProc); +extern void PopupConfirm (Widget, String, + XtCallbackList, XtCallbackList); +extern void PopupNotice (char *, XtCallbackProc, XtPointer); +extern void PopupError (Widget, String); extern void PopupWarningHandler(); /* for Xt to call */ /* from screen.c */ -extern void EnableProperButtons (/* Scrn */); -extern Scrn CreateNewScrn (/* ScrnKind */); -extern Scrn NewViewScrn (/* void */); -extern Scrn NewCompScrn (/* void */); -extern void ScreenSetAssocMsg (/* Scrn, Msg */); -extern void DestroyScrn (/* Scrn */); -extern void MapScrn (/* Scrn */); -extern Scrn ScrnFromWidget (/* Widget */); +extern void EnableProperButtons (Scrn); +extern Scrn CreateNewScrn (ScrnKind); +extern Scrn NewViewScrn (void); +extern Scrn NewCompScrn (void); +extern void ScreenSetAssocMsg (Scrn, Msg); +extern void DestroyScrn (Scrn); +extern void MapScrn (Scrn); +extern Scrn ScrnFromWidget (Widget); /* from toc.c */ -extern Boolean TocHasChanges (/* Toc */); +extern int TocFolderExists (Toc); +extern Boolean TocHasChanges (Toc); /* from tocfuncs.c */ -extern Boolean UserWantsAction (/* Widget, Scrn */); -extern void DoIncorporateNewMail (/* Widget, XtPointer, XtPointer */); -extern void DoCommit (/* Widget, XtPointer, XtPointer */); -extern void DoPack (/* Widget, XtPointer, XtPointer */); -extern void DoSort (/* Widget, XtPointer, XtPointer */); -extern void DoForceRescan (/* Widget, XtPointer, XtPointer */); -extern void DoReverseReadOrder (/* Widget, XtPointer, XtPointer */); -extern void DoNextView (/* Widget, XtPointer, XtPointer */); -extern void DoPrevView (/* Widget, XtPointer, XtPointer */); -extern void DoDelete (/* Widget, XtPointer, XtPointer */); -extern void DoMove (/* Widget, XtPointer, XtPointer */); -extern void DoCopy (/* Widget, XtPointer, XtPointer */); -extern void DoUnmark (/* Widget, XtPointer, XtPointer */); -extern void DoViewNew (/* Widget, XtPointer, XtPointer */); -extern void DoReply (/* Widget, XtPointer, XtPointer */); -extern void DoForward (/* Widget, XtPointer, XtPointer */); -extern void DoTocUseAsComp (/* Widget, XtPointer, XtPointer */); -extern void DoPrint (/* Widget, XtPointer, XtPointer */); -extern void DoPickMessages (/* Widget, XtPointer, XtPointer */); -extern void DoSelectSequence (/* Widget, XtPointer, XtPointer */); -extern void DoOpenSeq (/* Widget, XtPointer, XtPointer */); -extern void DoAddToSeq (/* Widget, XtPointer, XtPointer */); -extern void DoRemoveFromSeq (/* Widget, XtPointer, XtPointer */); -extern void DoDeleteSeq (/* Widget, XtPointer, XtPointer */); +extern Boolean UserWantsAction (Widget, Scrn); +extern void DoIncorporateNewMail (Widget, XtPointer, XtPointer); +extern void DoCommit (Widget, XtPointer, XtPointer); +extern void DoPack (Widget, XtPointer, XtPointer); +extern void DoSort (Widget, XtPointer, XtPointer); +extern void DoForceRescan (Widget, XtPointer, XtPointer); +extern void DoReverseReadOrder (Widget, XtPointer, XtPointer); +extern void DoNextView (Widget, XtPointer, XtPointer); +extern void DoPrevView (Widget, XtPointer, XtPointer); +extern void DoDelete (Widget, XtPointer, XtPointer); +extern void DoMove (Widget, XtPointer, XtPointer); +extern void DoCopy (Widget, XtPointer, XtPointer); +extern void DoUnmark (Widget, XtPointer, XtPointer); +extern void DoViewNew (Widget, XtPointer, XtPointer); +extern void DoReply (Widget, XtPointer, XtPointer); +extern void DoForward (Widget, XtPointer, XtPointer); +extern void DoTocUseAsComp (Widget, XtPointer, XtPointer); +extern void DoPrint (Widget, XtPointer, XtPointer); +extern void DoPickMessages (Widget, XtPointer, XtPointer); +extern void DoSelectSequence (Widget, XtPointer, XtPointer); +extern void DoOpenSeq (Widget, XtPointer, XtPointer); +extern void DoAddToSeq (Widget, XtPointer, XtPointer); +extern void DoRemoveFromSeq (Widget, XtPointer, XtPointer); +extern void DoDeleteSeq (Widget, XtPointer, XtPointer); /* from util.c */ -extern void Punt (/* char * */); -extern int myopen (/* char *, int, int */); -extern FILE * myfopen (/* char *, char * */); -extern int myclose (/* int */); -extern int myfclose (/* FILE * */); -extern char * MakeNewTempFileName (/* void */); -extern char ** MakeArgv (/* int */); -extern char ** ResizeArgv (/* char **, int */); -extern FILEPTR FOpenAndCheck (/* char *, char * */); -extern char * ReadLine (/* FILE * */); -extern char * ReadLineWithCR (/* FILE * */); -extern void DeleteFileAndCheck (/* char * */); -extern void CopyFileAndCheck (/* char *, char * */); -extern void RenameAndCheck (/* char *, char * */); -extern char * CreateGeometry (/* int, int, int, int, int */); -extern int FileExists (/* char * */); -extern Boolean IsSubfolder (/* char * */); -extern void SetCurrentFolderName (/* Scrn, char * */); -extern void ChangeLabel (/* Widget, char * */); -extern Widget CreateTextSW (/* Scrn, char *, ArgList, Cardinal */); -extern Widget CreateTitleBar (/* Scrn, char * */); -extern void Feep (/* type, volume, window */); -extern MsgList CurMsgListOrCurMsg (/* Toc */); -extern int GetWidth (/* Widget */); -extern int GetHeight (/* Widget */); -extern Toc SelectedToc (/* Scrn */); -extern Toc CurrentToc (/* Scrn */); +extern void Punt (char *); +extern int myopen (char *, int, int); +extern FILE * myfopen (char *, char *); +extern void myclose (int); +extern void myfclose (FILE *); +extern char * MakeNewTempFileName (void); +extern char ** MakeArgv (int); +extern char ** ResizeArgv (char **, int); +extern FILEPTR FOpenAndCheck (char *, char *); +extern char * ReadLine (FILE *); +extern char * ReadLineWithCR (FILE *); +extern void DeleteFileAndCheck (char *); +extern void CopyFileAndCheck (char *, char *); +extern void RenameAndCheck (char *, char *); +extern char * CreateGeometry (int, int, int, int, int); +extern int FileExists (char *); +extern long LastModifyDate (char *); +extern int GetFileLength (char *); +extern Boolean IsSubfolder (char *); +extern void SetCurrentFolderName (Scrn, char *); +extern void ChangeLabel (Widget, char *); +extern Widget CreateTextSW (Scrn, char *, ArgList, Cardinal); +extern Widget CreateTitleBar (Scrn, char *); +extern void Feep (int, int, Window); +extern MsgList CurMsgListOrCurMsg (Toc); +extern int GetWidth (Widget); +extern int GetHeight (Widget); +extern Toc SelectedToc (Scrn); +extern Toc CurrentToc (Scrn); extern int strncmpIgnoringCase(); -extern void StoreWindowName (/* Scrn, char * */); -extern void InitBusyCursor (/* Scrn */); -extern void ShowBusyCursor (/* void */); -extern void UnshowBusyCursor (/* void */); -extern void SetCursorColor (/* Widget, Cursor, unsigned long */); +extern void StoreWindowName (Scrn, char *); +extern void InitBusyCursor (Scrn); +extern void ShowBusyCursor (void); +extern void UnshowBusyCursor (void); +extern void SetCursorColor (Widget, Cursor, unsigned long); /* from viewfuncs.c */ -extern void DoCloseView (/* Widget, XtPointer, XtPointer */); -extern void DoViewReply (/* Widget, XtPointer, XtPointer */); -extern void DoViewForward (/* Widget, XtPointer, XtPointer */); -extern void DoViewUseAsComposition (/* Widget, XtPointer, XtPointer */); -extern void DoEditView (/* Widget, XtPointer, XtPointer */); -extern void DoSaveView (/* Widget, XtPointer, XtPointer */); -extern void DoPrintView (/* Widget, XtPointer, XtPointer */); +extern void DoCloseView (Widget, XtPointer, XtPointer); +extern void DoViewReply (Widget, XtPointer, XtPointer); +extern void DoViewForward (Widget, XtPointer, XtPointer); +extern void DoViewUseAsComposition (Widget, XtPointer, XtPointer); +extern void DoEditView (Widget, XtPointer, XtPointer); +extern void DoSaveView (Widget, XtPointer, XtPointer); +extern void DoPrintView (Widget, XtPointer, XtPointer); Index: xc/programs/xmh/folder.c diff -u xc/programs/xmh/folder.c:1.1.1.2 xc/programs/xmh/folder.c:1.3 --- xc/programs/xmh/folder.c:1.1.1.2 Thu Jan 26 19:27:58 1995 +++ xc/programs/xmh/folder.c Sat Oct 27 23:34:38 2001 @@ -24,17 +24,19 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/folder.c,v 1.3 2001/10/28 03:34:38 tsi Exp $ */ /* folder.c -- implement buttons relating to folders and other globals. */ - #include "xmh.h" +#include <X11/Xmu/CharSet.h> #include <X11/Xaw/Cardinals.h> #include <X11/Xatom.h> #include <sys/stat.h> #include <ctype.h> #include "bboxint.h" #include "tocintrnl.h" +#include "actions.h" typedef struct { /* client data structure for callbacks */ Scrn scrn; /* the xmh scrn of action */ @@ -287,7 +289,7 @@ if (scrnList[i]->folderbuttons) { char *c; Button button; - if (c = strchr(name, '/')) { /* if is subfolder */ + if ((c = strchr(name, '/'))) { /* if is subfolder */ c[0] = '\0'; button = BBoxFindButtonNamed(scrnList[i]->folderbuttons, name); Index: xc/programs/xmh/init.c diff -u xc/programs/xmh/init.c:1.1.1.3.18.1 xc/programs/xmh/init.c:1.5 --- xc/programs/xmh/init.c:1.1.1.3.18.1 Fri May 25 14:50:15 2001 +++ xc/programs/xmh/init.c Mon Jan 7 15:20:12 2002 @@ -25,7 +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 $ */ +/* $XFree86: xc/programs/xmh/init.c,v 1.5 2002/01/07 20:20:12 dawes Exp $ */ /* Init.c - Handle start-up initialization. */ @@ -174,7 +174,7 @@ }; /* Tell the user how to use this program. */ -Syntax(call) +static void Syntax(call) char *call; { (void) fprintf(stderr, "usage: %s [-path <path>] [-initial <folder>]\n", @@ -205,10 +205,9 @@ } -static _IOErrorHandler(dpy) +static int _IOErrorHandler(dpy) Display *dpy; { - extern char* SysErrMsg(); (void) fprintf (stderr, "%s:\tfatal IO error after %lu requests (%lu known processed)\n", progName, @@ -222,6 +221,7 @@ } Punt("Cannot continue from server error."); + return 0; } /*ARGSUSED*/ @@ -263,7 +263,7 @@ /* All the start-up initialization goes here. */ -InitializeWorld(argc, argv) +void InitializeWorld(argc, argv) int argc; char **argv; { @@ -416,7 +416,7 @@ } fid = myfopen(ptr, "r"); if (fid) { - while (ptr = ReadLine(fid)) { + while ((ptr = ReadLine(fid))) { char *cp; (void) strncpy(str2, ptr, 5); @@ -432,7 +432,7 @@ (void) strcpy(str, ptr); } } - (void) myfclose(fid); + myfclose(fid); } else { (void) strcpy(str, "Mail"); } Index: xc/programs/xmh/main.c diff -u xc/programs/xmh/main.c:1.1.1.2 xc/programs/xmh/main.c:1.2 --- xc/programs/xmh/main.c:1.1.1.2 Thu Jan 26 19:28:09 1995 +++ xc/programs/xmh/main.c Tue Jul 31 20:45:06 2001 @@ -23,6 +23,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/main.c,v 1.2 2001/08/01 00:45:06 tsi Exp $ */ #define MAIN 1 /* Makes global.h actually declare vars */ #include "xmh.h" @@ -90,7 +91,7 @@ Boolean ExitLoop = FALSE; #endif -main(argc, argv) +int main(argc, argv) int argc; char **argv; { @@ -141,6 +142,6 @@ } #ifdef DEBUG_CLEANUP XtDestroyApplicationContext(appCtx); - exit(0); #endif + exit(0); } Index: xc/programs/xmh/menu.c diff -u xc/programs/xmh/menu.c:1.1.1.1 xc/programs/xmh/menu.c:1.3 --- xc/programs/xmh/menu.c:1.1.1.1 Wed Apr 27 03:12:51 1994 +++ xc/programs/xmh/menu.c Sat Oct 27 23:34:38 2001 @@ -25,6 +25,7 @@ in this Software without prior written authorization from the X Consortium. * */ +/* $XFree86: xc/programs/xmh/menu.c,v 1.3 2001/10/28 03:34:38 tsi Exp $ */ #include "xmh.h" #include "bboxint.h" @@ -65,7 +66,7 @@ int value; { Widget entry; - static Arg args[] = { XtNsensitive, (XtArgVal) NULL }; + static Arg args[] = {{XtNsensitive, (XtArgVal) NULL}}; if ((entry = XtNameToWidget(button->menu, entry_name)) != NULL) { args[0].value = (XtArgVal) ((value == 0) ? False : True); @@ -74,9 +75,7 @@ } -void ToggleMenuItem(entry, state) - Widget entry; - Boolean state; +void ToggleMenuItem(Widget entry, Boolean state) { Arg args[1]; Index: xc/programs/xmh/miscfuncs.c diff -u xc/programs/xmh/miscfuncs.c:3.3 xc/programs/xmh/miscfuncs.c:3.6 --- xc/programs/xmh/miscfuncs.c:3.3 Wed Dec 25 20:41:01 1996 +++ xc/programs/xmh/miscfuncs.c Sat Oct 27 23:34:39 2001 @@ -1,5 +1,5 @@ /* $XConsortium: miscfuncs.c,v 1.7 94/12/01 17:15:05 kaleb Exp $ */ -/* $XFree86: xc/programs/xmh/miscfuncs.c,v 3.3 1996/12/26 01:41:01 dawes Exp $ */ +/* $XFree86: xc/programs/xmh/miscfuncs.c,v 3.6 2001/10/28 03:34:39 tsi Exp $ */ #include <X11/Xos.h> @@ -20,16 +20,11 @@ #endif #endif -#ifdef X_NOT_STDC_ENV -char *malloc(); -char *realloc(); -#else #include <stdlib.h> -#endif -#if defined(SYSV) && (defined(i386) || defined(MOTOROLA)) || defined(MINIX) +#if defined(SYSV) && (defined(i386) || defined(MOTOROLA)) /* These systems don't have the ftruncate() system call, so we emulate it. * This emulation can only shorten, not lengthen. @@ -86,8 +81,8 @@ (void) chmod(tmp_file, stat_val.st_mode); /* Close files, delete original, rename temp file to original. */ - (void) myclose(new_fid); - (void) myclose(fd); + myclose(new_fid); + myclose(fd); (void) unlink(name); /* remove original */ (void) rename(tmp_file, name); /* rename temp file */ @@ -142,7 +137,7 @@ return(-1); /* Read entries in the directory. */ - for (i = 0; E = readdir(Dp); ) + for (i = 0; (E = readdir(Dp)); ) if (!Selector || (*Selector)(E->d_name)) { /* User wants them all, or he wants this one. */ if (++i >= size) { Index: xc/programs/xmh/msg.c diff -u xc/programs/xmh/msg.c:1.1.1.3 xc/programs/xmh/msg.c:1.3 --- xc/programs/xmh/msg.c:1.1.1.3 Tue Jan 16 05:26:00 1996 +++ xc/programs/xmh/msg.c Sat Oct 27 23:34:39 2001 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/msg.c,v 1.3 2001/10/28 03:34:39 tsi Exp $ */ /* msgs.c -- handle operations on messages. */ @@ -221,7 +222,7 @@ /* Save any changes to a message. Also calls the toc routine to update the scanline for this msg. Returns True if saved, false otherwise. */ -MsgSaveChanges(msg) +int MsgSaveChanges(msg) Msg msg; { int i; @@ -672,7 +673,7 @@ FILEPTR to; int p, c, l, inheader, sendwidth, sendbreakwidth; char *ptr, *ptr2, **argv, str[100]; - static sendcount = -1; + static int sendcount = -1; (void) MsgSaveChanges(msg); from = FOpenAndCheck(MsgFileName(msg), "r"); sendcount = (sendcount + 1) % 10; @@ -681,7 +682,7 @@ sendwidth = app_resources.send_line_width; sendbreakwidth = app_resources.break_send_line_width; inheader = TRUE; - while (ptr = ReadLine(from)) { + while ((ptr = ReadLine(from))) { if (inheader) { if (strncmpIgnoringCase(ptr, "sendwidth:", 10) == 0) { if (atoi(ptr+10) > 0) sendwidth = atoi(ptr+10); @@ -733,8 +734,8 @@ } } while (*ptr); } - (void) myfclose(from); - (void) myfclose(to); + myfclose(from); + myfclose(to); argv = MakeArgv(3); argv[0] = "send"; argv[1] = "-push"; @@ -772,7 +773,7 @@ fid = myopen(file, O_RDONLY, 0666); if (compsize != read(fid, blankcomp, compsize)) Punt("Error reading in MsgLoadComposition!"); - (void) myclose(fid); + myclose(fid); DeleteFileAndCheck(file); } else { blankcomp = "To: \n--------\n"; @@ -783,7 +784,7 @@ fid = myopen(MsgFileName(msg), O_WRONLY | O_TRUNC | O_CREAT, 0666); if (compsize != write(fid, blankcomp, compsize)) Punt("Error writing in MsgLoadComposition!"); - (void) myclose(fid); + myclose(fid); TocSetCacheValid(msg->toc); msg->startPos = startPos; } @@ -964,10 +965,7 @@ */ Widget -CreateFileSource(w, filename, edit) -Widget w; -String filename; -Boolean edit; +CreateFileSource(Widget w, String filename, Boolean edit) { Arg arglist[10]; Cardinal num_args = 0; @@ -983,4 +981,3 @@ return(XtCreateWidget("textSource", asciiSrcObjectClass, w, arglist, num_args)); } - Index: xc/programs/xmh/pick.c diff -u xc/programs/xmh/pick.c:1.1.1.1 xc/programs/xmh/pick.c:1.2 --- xc/programs/xmh/pick.c:1.1.1.1 Wed Apr 27 03:12:53 1994 +++ xc/programs/xmh/pick.c Tue Jul 31 20:45:06 2001 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/pick.c,v 1.2 2001/08/01 00:45:06 tsi Exp $ */ /* pick.c -- handle a pick subwidget. */ @@ -96,7 +97,7 @@ static void DeleteWidget(), AddDetailGroup(); -InitPick() +void InitPick(void) { TypeName[RTfrom] = "From:"; TypeName[RTto] = "To:"; @@ -116,13 +117,13 @@ } -static PrepareToUpdate(form) +static void PrepareToUpdate(form) FormBox form; { XawFormDoLayout(form->inner, FALSE); } -static ExecuteUpdate(form) +static void ExecuteUpdate(form) FormBox form; { XawFormDoLayout(form->inner, TRUE); @@ -258,7 +259,7 @@ static int argvsize; -static AppendArgv(ptr) +static void AppendArgv(ptr) char *ptr; { argvsize++; @@ -266,7 +267,7 @@ argv[argvsize - 1] = XtNewString(ptr); } -static EraseLast() +static void EraseLast(void) { argvsize--; XtFree((char *) argv[argvsize]); @@ -275,7 +276,7 @@ -static ParseRow(row) +static Boolean ParseRow(row) RowList row; { int result = FALSE; @@ -340,7 +341,7 @@ } -static ParseGroup(group) +static Boolean ParseGroup(group) Group group; { int found = FALSE; @@ -638,7 +639,7 @@ } -static AddGeneralGroup(form) +static void AddGeneralGroup(form) FormBox form; { Group group; @@ -733,7 +734,7 @@ } -AddPick(scrn, toc, fromseq, toseq) +void AddPick(scrn, toc, fromseq, toseq) Scrn scrn; Toc toc; char *fromseq, *toseq; Index: xc/programs/xmh/screen.c diff -u xc/programs/xmh/screen.c:1.1.1.2 xc/programs/xmh/screen.c:1.2 --- xc/programs/xmh/screen.c:1.1.1.2 Thu Jan 26 19:28:19 1995 +++ xc/programs/xmh/screen.c Sat Oct 27 23:34:39 2001 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/screen.c,v 1.2 2001/10/28 03:34:39 tsi Exp $ */ /* scrn.c -- management of scrns. */ @@ -316,6 +317,7 @@ case STtocAndView: MakeTocAndView(scrn); break; case STview: MakeView(scrn); break; case STcomp: MakeComp(scrn); break; + default: break; } if (kind != STpick) { @@ -362,6 +364,9 @@ XtInstallAllAccelerators(scrn->viewwidget, scrn->widget); XtSetKeyboardFocus(scrn->parent, scrn->viewwidget); break; + + default: + break; } InitBusyCursor(scrn); @@ -433,7 +438,7 @@ } } Punt("ScrnFromWidget failed!"); - /*NOTREACHED*/ + return NULL; } @@ -513,6 +518,8 @@ BBoxDisable( BBoxFindButtonNamed(scrn->viewbuttons, "save")); BBoxDisable( BBoxFindButtonNamed(scrn->viewbuttons, "insert")); } + break; + default: break; } } Index: xc/programs/xmh/toc.c diff -u xc/programs/xmh/toc.c:3.1 xc/programs/xmh/toc.c:3.4 --- xc/programs/xmh/toc.c:3.1 Thu Jan 26 23:55:00 1995 +++ xc/programs/xmh/toc.c Sat Oct 27 23:34:39 2001 @@ -1,5 +1,5 @@ /* $XConsortium: toc.c,v 2.59 95/01/09 16:52:53 swick Exp $ - * $XFree86: xc/programs/xmh/toc.c,v 3.1 1995/01/27 04:55:00 dawes Exp $ + * $XFree86: xc/programs/xmh/toc.c,v 3.4 2001/10/28 03:34:39 tsi Exp $ * * * COPYRIGHT 1987 @@ -33,10 +33,6 @@ #include "tocutil.h" #include <sys/stat.h> -#ifdef MINIX -#define S_IWRITE S_IWUSR -#endif - static int IsDir(name) char *name; { @@ -133,7 +129,7 @@ int i; char *ptr, *ptr2; - while (ptr = ReadLine(fid)) { + while ((ptr = ReadLine(fid))) { while (*ptr == ' ' || *ptr == '\t') ptr++; ptr2 = ptr; while (*ptr2 && *ptr2 != ' ' && *ptr2 != '\t') ptr2++; @@ -165,7 +161,6 @@ Toc toc; char **namelist; int i; - extern alphasort(); numFolders = ScanDir(app_resources.mail_path, &namelist, IsDir); if (numFolders < 0) { (void) mkdir(app_resources.mail_path, 0700); @@ -947,11 +942,11 @@ { Toc toc = (Toc) client_data; Msg msg; - int i, cur; - char str[100], **argv; + int i, cur = 0; + char str[100], **argv = NULL; FateType curfate, fate; Toc desttoc; - Toc curdesttoc; + Toc curdesttoc = NULL; XtCallbackRec confirms[2]; confirms[0].callback = TocCommitChanges; @@ -996,6 +991,8 @@ cur = 1; curdesttoc = desttoc; break; + default: + break; } } if (curfate != Fignore && @@ -1029,6 +1026,8 @@ argv[cur++] = TocMakeFolderName(toc); argv[cur++] = TocMakeFolderName(curdesttoc); break; + default: + break; } if (app_resources.debug) { for (i = 0; i < cur; i++) @@ -1094,7 +1093,7 @@ if (toc->validity == valid) { fid = FOpenAndCheck(file, "r"); TocStopUpdate(toc); - while (ptr = ReadLineWithCR(fid)) { + while ((ptr = ReadLineWithCR(fid))) { if (atoi(ptr) > 0) { msg = TUAppendToc(toc, ptr); if (firstmessage == NULL) firstmessage = msg; @@ -1104,7 +1103,7 @@ TocSetCurMsg(toc, firstmessage); } TocStartUpdate(toc); - (void) myfclose(fid); + myfclose(fid); } DeleteFileAndCheck(file); @@ -1243,10 +1242,10 @@ MenuBoxButtons[XMH_SEQUENCE].button_name); sequenceMenu = BBoxMenuOfButton(button); - if (selected = XawSimpleMenuGetActiveEntry(sequenceMenu)) + if ((selected = XawSimpleMenuGetActiveEntry(sequenceMenu))) ToggleMenuItem(selected, False); - if (original = XtNameToWidget(sequenceMenu, seqname)) { + if ((original = XtNameToWidget(sequenceMenu, seqname))) { ToggleMenuItem(original, True); sequence = TocGetSeqNamed(scrn->toc, seqname); TocSetSelectedSequence(scrn->toc, sequence); Index: xc/programs/xmh/tocfuncs.c diff -u xc/programs/xmh/tocfuncs.c:1.1.1.3 xc/programs/xmh/tocfuncs.c:1.3 --- xc/programs/xmh/tocfuncs.c:1.1.1.3 Sun Feb 4 02:49:04 1996 +++ xc/programs/xmh/tocfuncs.c Sat Oct 27 23:34:39 2001 @@ -24,6 +24,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xmh/tocfuncs.c,v 1.3 2001/10/28 03:34:39 tsi Exp $ */ /* tocfuncs.c -- action procedures concerning things in the toc widget. */ @@ -71,7 +72,7 @@ { Toc toc = scrn->toc; MsgList mlist; - FateType fate; + FateType fate = Fignore; Msg msg; if (toc == NULL) return; @@ -287,7 +288,7 @@ /* Utility: change the fate of a set of messages. */ -static MarkMessages(scrn, fate, skip) +static void MarkMessages(scrn, fate, skip) Scrn scrn; FateType fate; int skip; @@ -889,7 +890,7 @@ /* In case the action was given the name of a sequence to open. */ if (*num_params) { Toc toc = scrn->toc; - if (selected_sequence = TocGetSeqNamed(toc, params[0])) { + if ((selected_sequence = TocGetSeqNamed(toc, params[0]))) { TocSetSelectedSequence(toc, selected_sequence); TocChangeViewedSeq(toc, selected_sequence); } @@ -936,7 +937,7 @@ typedef enum {ADD, REMOVE, DELETE} TwiddleOperation; -static TwiddleSequence(scrn, op) +static void TwiddleSequence(scrn, op) Scrn scrn; TwiddleOperation op; { Index: xc/programs/xmh/tocutil.c diff -u xc/programs/xmh/tocutil.c:3.1 xc/programs/xmh/tocutil.c:3.3 --- xc/programs/xmh/tocutil.c:3.1 Thu Jan 26 23:55:04 1995 +++ xc/programs/xmh/tocutil.c Sat Oct 27 23:34:40 2001 @@ -1,6 +1,6 @@ /* * $XConsortium: tocutil.c,v 2.60 95/01/09 16:52:53 swick Exp $ - * $XFree86: xc/programs/xmh/tocutil.c,v 3.1 1995/01/27 04:55:04 dawes Exp $ + * $XFree86: xc/programs/xmh/tocutil.c,v 3.3 2001/10/28 03:34:40 tsi Exp $ * * * COPYRIGHT 1987, 1989 @@ -163,7 +163,7 @@ Toc toc; Msg msg; { - int msgid, h, l, m; + int msgid, h = 0, l, m; char str[100]; static Boolean ordered = True; msgid = msg->msgid; @@ -276,7 +276,7 @@ (void) sprintf(str, "%s/.mh_sequences", toc->path); fid = myfopen(str, "r"); if (fid) { - while (ptr = ReadLine(fid)) { + while ((ptr = ReadLine(fid))) { ptr2 = strchr(ptr, ':'); if (ptr2) { *ptr2 = 0; @@ -390,7 +390,7 @@ position = 0; i = 0; curmsg = NULL; - while (ptr = fgets(buf, bufsiz, fid)) { + while ((ptr = fgets(buf, bufsiz, fid))) { toc->msgs[toc->nummsgs++] = msg = XtNew(MsgRec); bzero((char *) msg, sizeof(MsgRec)); msg->toc = toc; @@ -502,11 +502,11 @@ if (fid < 0 && toc->length != toc->origlength) fid = myopen(toc->scanfile, O_RDWR, 0666); if (fid >= 0) { -#if defined(SYSV) && (defined(i386) || defined(MOTOROLA)) || defined(MINIX) +#if defined(SYSV) && (defined(i386) || defined(MOTOROLA)) (void) ftruncate_emu(fid, toc->length, toc->scanfile); #else (void) ftruncate(fid, toc->length); - (void) myclose(fid); + myclose(fid); #endif toc->origlength = toc->length; } @@ -550,7 +550,7 @@ * Need to make sure the scanfile exists at this point. */ int fid = myopen(toc->scanfile, O_RDWR|O_CREAT, 0666); - (void) myclose(fid); + myclose(fid); XtAppAddWorkProc(XtWidgetToApplicationContext(toplevel), UpdateScanFile, (XtPointer)toc); @@ -619,7 +619,7 @@ char *ptr; { Msg msg; - int msgid, i; + int msgid; TUGetFullFolderInfo(toc); if (toc->validity != valid) Index: xc/programs/xmh/tsource.c diff -u xc/programs/xmh/tsource.c:1.1.1.1 xc/programs/xmh/tsource.c:1.2 --- xc/programs/xmh/tsource.c:1.1.1.1 Wed Apr 27 03:12:53 1994 +++ xc/programs/xmh/tsource.c Sat Oct 27 23:34:40 2001 @@ -24,6 +24,7 @@ * or publicity pertaining to distribution of the software without specific, * written prior permission. */ +/* $XFree86: xc/programs/xmh/tsource.c,v 1.2 2001/10/28 03:34:40 tsi Exp $ */ /* File: tsource.c -- the code for a toc source */ @@ -236,7 +237,7 @@ XawTextPosition textindex; Msg msg; char c; - int ddir, doff, i, whiteSpace; + int ddir, doff, i, whiteSpace = 0; ddir = (dir == XawsdRight) ? 1 : -1; doff = (dir == XawsdRight) ? 0 : -1; @@ -291,6 +292,8 @@ textindex = 0; else textindex = toc->lastPos; + break; + default: break; } return textindex; Index: xc/programs/xmh/util.c diff -u xc/programs/xmh/util.c:3.3 xc/programs/xmh/util.c:3.6 --- xc/programs/xmh/util.c:3.3 Tue Jan 16 10:09:28 1996 +++ xc/programs/xmh/util.c Wed Oct 31 17:50:31 2001 @@ -1,6 +1,6 @@ /* * $XConsortium: util.c /main/42 1996/01/14 16:51:55 kaleb $ - * $XFree86: xc/programs/xmh/util.c,v 3.3 1996/01/16 15:09:28 dawes Exp $ + * $XFree86: xc/programs/xmh/util.c,v 3.6 2001/10/31 22:50:31 tsi Exp $ * * * COPYRIGHT 1987 @@ -89,14 +89,14 @@ -int myclose(fid) +void myclose(fid) { if (close(fid) < 0) Punt("Error in myclose!"); DEBUG1( "# %d : <Closed>\n", fid) } -int myfclose(file) +void myfclose(file) FILE *file; { int fid = fileno(file); @@ -114,7 +114,7 @@ static int uniqueid = 0; do { (void) sprintf(name, "%s/xmh_%ld_%d", app_resources.temp_dir, - getpid(), uniqueid++); + (long)getpid(), uniqueid++); } while (FileExists(name)); return name; } @@ -236,8 +236,8 @@ n = read(fromfid, buf, 512); if (n) (void) write(tofid, buf, n); } while (n); - (void) myclose(fromfid); - (void) myclose(tofid); + myclose(fromfid); + myclose(tofid); } @@ -283,14 +283,13 @@ return result; } - -FileExists(file) +int FileExists(file) char *file; { return (access(file, F_OK) == 0); } -LastModifyDate(file) +long LastModifyDate(file) char *file; { struct stat buf; @@ -298,7 +297,7 @@ return buf.st_mtime; } -GetFileLength(file) +int GetFileLength(file) char *file; { struct stat buf; @@ -325,7 +324,7 @@ Widget widget; char *str; { - static Arg arglist[] = {XtNlabel, (XtArgVal)NULL}; + static Arg arglist[] = {{XtNlabel, (XtArgVal)NULL}}; arglist[0].value = (XtArgVal) str; XtSetValues(widget, arglist, XtNumber(arglist)); } Index: xc/programs/xmodmap/exec.c diff -u xc/programs/xmodmap/exec.c:1.4 xc/programs/xmodmap/exec.c:1.5 --- xc/programs/xmodmap/exec.c:1.4 Wed Jan 17 18:46:20 2001 +++ xc/programs/xmodmap/exec.c Fri Dec 14 15:02:13 2001 @@ -1,9 +1,13 @@ -/* $Xorg: exec.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: exec.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -52,7 +56,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.4 2001/01/17 23:46:20 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/exec.c,v 1.5 2001/12/14 20:02:13 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> Index: xc/programs/xmodmap/handle.c diff -u xc/programs/xmodmap/handle.c:3.5 xc/programs/xmodmap/handle.c:3.7 --- xc/programs/xmodmap/handle.c:3.5 Mon Apr 23 17:41:47 2001 +++ xc/programs/xmodmap/handle.c Fri Dec 14 15:02:13 2001 @@ -1,9 +1,13 @@ -/* $Xorg: handle.c,v 1.5 2000/08/17 19:54:54 cpqbld Exp $ */ +/* $Xorg: handle.c,v 1.6 2001/02/09 02:05:56 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmodmap/handle.c,v 3.5 2001/04/23 21:41:47 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/handle.c,v 3.7 2001/12/14 20:02:13 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> @@ -30,13 +34,7 @@ #include <ctype.h> #include "xmodmap.h" #include "wq.h" - -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -char *malloc(); -char *realloc(); -#endif static XModifierKeymap *map = NULL; Index: xc/programs/xmodmap/pf.c diff -u xc/programs/xmodmap/pf.c:1.1.1.3 xc/programs/xmodmap/pf.c:1.2 --- xc/programs/xmodmap/pf.c:1.1.1.3 Tue Jan 16 18:01:49 2001 +++ xc/programs/xmodmap/pf.c Fri Dec 14 15:02:13 2001 @@ -1,9 +1,13 @@ -/* $Xorg: pf.c,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ */ +/* $Xorg: pf.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xmodmap/wq.h diff -u xc/programs/xmodmap/wq.h:1.4 xc/programs/xmodmap/wq.h:1.5 --- xc/programs/xmodmap/wq.h:1.4 Wed Jan 17 18:46:21 2001 +++ xc/programs/xmodmap/wq.h Fri Dec 14 15:02:13 2001 @@ -1,9 +1,13 @@ -/* $Xorg: wq.h,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ */ +/* $Xorg: wq.h,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmodmap/wq.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/wq.h,v 1.5 2001/12/14 20:02:13 dawes Exp $ */ #ifndef _WQ_H #define _WQ_H Index: xc/programs/xmodmap/xmodmap.c diff -u xc/programs/xmodmap/xmodmap.c:1.6 xc/programs/xmodmap/xmodmap.c:1.7 --- xc/programs/xmodmap/xmodmap.c:1.6 Sun Apr 1 10:00:23 2001 +++ xc/programs/xmodmap/xmodmap.c Fri Dec 14 15:02:13 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xmodmap.c,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ */ +/* $Xorg: xmodmap.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmodmap/xmodmap.c,v 1.6 2001/04/01 14:00:23 tsi Exp $ */ +/* $XFree86: xc/programs/xmodmap/xmodmap.c,v 1.7 2001/12/14 20:02:13 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> Index: xc/programs/xmodmap/xmodmap.h diff -u xc/programs/xmodmap/xmodmap.h:1.4 xc/programs/xmodmap/xmodmap.h:1.5 --- xc/programs/xmodmap/xmodmap.h:1.4 Wed Jan 17 18:46:21 2001 +++ xc/programs/xmodmap/xmodmap.h Fri Dec 14 15:02:13 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xmodmap.h,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ */ +/* $Xorg: xmodmap.h,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */ /* Copyright 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmodmap/xmodmap.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/xmodmap.h,v 1.5 2001/12/14 20:02:13 dawes Exp $ */ extern char *ProgramName; extern Display *dpy; Index: xc/programs/xmodmap/xmodmap.man diff -u xc/programs/xmodmap/xmodmap.man:1.9 xc/programs/xmodmap/xmodmap.man:1.10 --- xc/programs/xmodmap/xmodmap.man:1.9 Sat Jan 27 13:21:21 2001 +++ xc/programs/xmodmap/xmodmap.man Fri Dec 14 15:02:13 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: xmodmap.man,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ +.\" $Xorg: xmodmap.man,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ .\" Copyright 1988, 1989, 1990, 1998 The Open Group .\" Copyright 1987 Sun Microsystems, Inc. .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.9 2001/01/27 18:21:21 dawes Exp $ +.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.10 2001/12/14 20:02:13 dawes Exp $ .\" .de EX \"Begin example .ne 5 Index: xc/programs/xprop/xprop.c diff -u xc/programs/xprop/xprop.c:1.10 xc/programs/xprop/xprop.c:1.11 --- xc/programs/xprop/xprop.c:1.10 Tue Jan 23 15:22:19 2001 +++ xc/programs/xprop/xprop.c Fri Dec 14 15:02:14 2001 @@ -1,11 +1,15 @@ -/* $Xorg: xprop.c,v 1.5 2000/08/17 19:54:55 cpqbld Exp $ */ +/* $Xorg: xprop.c,v 1.6 2001/02/09 02:05:56 xorgcvs Exp $ */ /* Copyright 1990, 1998 The Open Group Copyright (c) 2000 The XFree86 Project, Inc. -All Rights Reserved. - +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. + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xprop/xprop.c,v 1.10 2001/01/23 20:22:19 dawes Exp $ */ +/* $XFree86: xc/programs/xprop/xprop.c,v 1.11 2001/12/14 20:02:14 dawes Exp $ */ #include <X11/Xlib.h> Index: xc/programs/xprop/xprop.man diff -u xc/programs/xprop/xprop.man:1.8 xc/programs/xprop/xprop.man:1.9 --- xc/programs/xprop/xprop.man:1.8 Sat Jan 27 13:21:21 2001 +++ xc/programs/xprop/xprop.man Fri Dec 14 15:02:14 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: xprop.man,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ +.\" $Xorg: xprop.man,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" Copyright \(co 2000 The XFree86 Project, Inc. .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xprop/xprop.man,v 1.8 2001/01/27 18:21:21 dawes Exp $ +.\" $XFree86: xc/programs/xprop/xprop.man,v 1.9 2001/12/14 20:02:14 dawes Exp $ .\" .TH XPROP 1 __vendorversion__ .SH NAME Index: xc/programs/xrandr/Imakefile diff -u /dev/null xc/programs/xrandr/Imakefile:1.3 --- /dev/null Fri Jan 18 15:27:35 2002 +++ xc/programs/xrandr/Imakefile Sun Jun 10 21:40:14 2001 @@ -0,0 +1,12 @@ +XCOMM $XFree86: xc/programs/xrandr/Imakefile,v 1.3 2001/06/11 01:40:14 keithp Exp $ + +DEFINES=$(RANDRDEFINES) +DEPLIBS=$(DEPXRANDRLIB) $(DEPXLIB) +LOCAL_LIBRARIES=$(XRANDRLIB) $(XLIB) + +SRCS=xrandr.c +OBJS=xrandr.o + +ComplexProgramTarget(xrandr) +LinkBuildBinary(ProgramTargetName(xrandr)) + Index: xc/programs/xrandr/xrandr.c diff -u /dev/null xc/programs/xrandr/xrandr.c:1.8 --- /dev/null Fri Jan 18 15:27:35 2002 +++ xc/programs/xrandr/xrandr.c Wed Jul 11 12:40:32 2001 @@ -0,0 +1,211 @@ +/* + * $XFree86: xc/programs/xrandr/xrandr.c,v 1.8 2001/07/11 16:40:32 keithp Exp $ + * + * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. + * Copyright © 2001 Compaq Computer 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 name of Keith Packard or Compaq 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 and COMPAQ 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. + * Blame Jim Gettys for any bugs... + */ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xproto.h> +#include <X11/extensions/Xrandr.h> +#include <string.h> +#include <stdlib.h> + +static char *program_name; + +static char *direction[5] = { + "normal", + "left", + "inverted", + "right", + "\n"}; + + +static void +usage(void) +{ + fprintf(stderr, "usage: %s [options]\n", program_name); + fprintf(stderr, " where options are:\n"); + fprintf(stderr, " -display <display> or -d <display>\n"); + fprintf(stderr, " -help\n"); + fprintf(stderr, " -o <normal,inverted,left,right,0,1,2,3>\n"); + fprintf(stderr, " or --orientation <normal,inverted,left,right,0,1,2,3>\n"); + fprintf(stderr, " -q or --query\n"); + fprintf(stderr, " -s <size> or --size <size>\n"); + fprintf(stderr, " -v or --verbose\n"); + fprintf(stderr, " or --screen <screen>\n"); + + exit(1); + /*NOTREACHED*/ +} + +int +main (int argc, char **argv) +{ + Display *dpy; + XRRScreenSize *sizes; + XRRScreenConfiguration *sc; + int nsize; + Window root; + Status status = RRSetConfigFailed; + int rot = -1; + int verbose = 0, query = 0; + Rotation rotation, current_rotation, rotations; + XRRScreenChangeNotifyEvent event; + char *display_name = NULL; + int i; + SizeID current_size; + VisualGroupID current_visual_group; + int size = -1; + int dirind = 0; + int setit = 0; + int screen = -1; + + program_name = argv[0]; + if (argc == 1) query = 1; + for (i = 1; i < argc; i++) { + if (!strcmp ("-display", argv[i]) || !strcmp ("-d", argv[i])) { + if (++i>=argc) usage (); + display_name = argv[i]; + continue; + } + if (!strcmp("-help", argv[i])) { + usage(); + } + if (!strcmp ("-v", argv[i]) || !strcmp ("--verbose", argv[i])) { + verbose = 1; + continue; + } + if (!strcmp ("-s", argv[i]) || !strcmp ("--size", argv[i])) { + if (++i>=argc) usage (); + size = atoi (argv[i]); + if (size < 0) usage(); + setit = 1; + continue; + } + if (!strcmp ("--screen", argv[i])) { + if (++i>=argc) usage (); + screen = atoi (argv[i]); + if (screen < 0) usage(); + continue; + } + if (!strcmp ("-q", argv[i]) || !strcmp ("--query", argv[i])) { + query = 1; + continue; + } + if (!strcmp ("-o", argv[i]) || !strcmp ("--orientation", argv[i])) { + char *endptr; + if (++i>=argc) usage (); + dirind = strtol(argv[i], &endptr, 0); + if (*endptr != '\0') { + for (dirind = 0; dirind < 4; dirind++) { + if (strcmp (direction[dirind], argv[i]) == 0) break; + } + if ((dirind < 0) || (dirind > 3)) usage(); + } + rot = dirind; + setit = 1; + continue; + } + usage(); + } + if (verbose) query = 1; + + dpy = XOpenDisplay (display_name); + if (dpy == NULL) { + fprintf (stderr, "Can't open display %s\n", display_name); + exit (1); + } + if (screen < 0) + screen = DefaultScreen (dpy); + if (screen >= ScreenCount (dpy)) { + fprintf (stderr, "Invalid screen number %d (display has %d)\n", + screen, ScreenCount (dpy)); + exit (1); + } + + root = RootWindow (dpy, screen); + + sc = XRRGetScreenInfo (dpy, root); + + if (sc == NULL) + exit (1); + + current_size = XRRCurrentConfig (sc, ¤t_visual_group, ¤t_rotation); + if (size < 0) + size = current_size; + if (rot < 0) + { + for (rot = 0; rot < 4; rot++) + if (1 << rot == current_rotation) + break; + } + + sizes = XRRSizes(sc, &nsize); + for (i = 0; i < nsize; i++) { + if (query) + printf ("SZ: Pixels Physical\n%d: %4d x%4d (%4dmm x%4dmm)\n", + i, sizes[i].width, sizes[i].height, + sizes[i].mwidth, sizes[i].mheight); + } + + if (size >= nsize) usage(); + rotations = XRRRotations(sc, ¤t_rotation); + rotation = 1 << rot ; + if (query) { + for (i = 0; i < 4; i ++) { + if ((current_rotation >> i) & 1) + printf("Current rotation - %s\n", direction[i]); + } + printf ("Rotations possible - "); + for (i = 0; i < 4; i ++) { + if ((rotations >> i) & 1) printf("%s ", direction[i]); + } + printf ("\n"); + } + + if (verbose) printf("Setting size to %d, rotation to %s\n", + size, direction[rot]); + + if (setit) XRRScreenChangeSelectInput (dpy, root, True); + if (setit) status = XRRSetScreenConfig (dpy, sc, DefaultRootWindow (dpy), + (SizeID) size, current_visual_group, (Rotation) rotation, CurrentTime); + if (verbose && setit) { + if (status == RRSetConfigSuccess) + { + XNextEvent(dpy, (XEvent *) &event); + printf("Got an event!\n"); + printf(" window = %d\n root = %d\n size_index = %d\n visual_group_index %d\n rotation %d\n", + (int) event.window, (int) event.root, + event.size_index, event.visual_group_index, event.rotation); + printf(" timestamp = %ld, config_timestamp = %ld\n", + event.timestamp, event.config_timestamp); + printf(" %dX%d pixels, %dX%d mm\n", + event.width, event.height, + event.mwidth, event.mheight); + } + } + XRRFreeScreenInfo(sc); + return(0); +} + Index: xc/programs/xrandr/xrandr.man diff -u /dev/null xc/programs/xrandr/xrandr.man:1.2 --- /dev/null Fri Jan 18 15:27:35 2002 +++ xc/programs/xrandr/xrandr.man Sun Jun 10 21:40:14 2001 @@ -0,0 +1,59 @@ +.\" +.\" Copyright © 2001 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/xrandr/xrandr.man,v 1.2 2001/06/11 01:40:14 keithp Exp $ +.\" +.TH XRANDR 1 __vendorversion__ +.SH NAME +xrandr \- primitive command line interface to RandR extension +.SH SYNOPSIS +.B "xrandr" +[-help] [-display \fIdisplay\fP] +[-o \fIorientation\fP] +[-q] [-v] +[-s \fIsize\fP] +.SH DESCRIPTION +.I Xrandr +is uses to set the screen size and/or orientation. +The +.I -s +option is a small integer index used to specify which size the screen should be set to. +To find out what sizes are available, use the +.I -q +option, which reports the sizes available, the current rotation, and +the possibee rotations. +The +.I -o +option is used to specify the orientation of the screen, +and can be one of +\f"Inormal inverted left right 0 1 2 3"\fP. +The +.I -help +option prints out a usage summary. +.SH "SEE ALSO" +RandR(3) +.SH AUTHORS +Keith Packard +XFree86 Core Team, SuSE Inc. +.br +Jim Gettys, +Compaq Computer Corporation, Cambridge Research Laboratory Index: xc/programs/xrdb/xrdb.c diff -u xc/programs/xrdb/xrdb.c:3.13 xc/programs/xrdb/xrdb.c:3.15 --- xc/programs/xrdb/xrdb.c:3.13 Wed Jan 17 18:46:22 2001 +++ xc/programs/xrdb/xrdb.c Tue Nov 6 11:11:37 2001 @@ -30,7 +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 $ */ +/* $XFree86: xc/programs/xrdb/xrdb.c,v 3.15 2001/11/06 16:11:37 alanh Exp $ */ /* * this program is used to load, or dump the resource manager database @@ -49,18 +49,7 @@ #include <stdio.h> #include <ctype.h> #include <errno.h> - -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -char *malloc(); -char *realloc(); -#endif - -#if defined(X_NOT_STDC_ENV) && !defined(__EMX__) -extern int errno; -#endif - #include <stdarg.h> #define SCREEN_RESOURCES "SCREEN_RESOURCES" @@ -132,19 +121,14 @@ Bool dont_execute = False; String defines; int defines_base; -char *cmd_defines[512]; +#define MAX_CMD_DEFINES 512 +char *cmd_defines[MAX_CMD_DEFINES]; int num_cmd_defines = 0; String includes; Display *dpy; Buffer buffer; Entries newDB; -#if !defined(sgi) && !defined(WIN32) -#ifdef X_NOT_STDC_ENV -extern FILE *popen(); -#endif -#endif - static void fatal(char *, ...); static void addstring ( String *arg, const char *s ); static void FormatEntries ( Buffer *buffer, Entries *entries ); @@ -868,7 +852,11 @@ addstring(&includes, arg); continue; } else if (arg[1] == 'U' || arg[1] == 'D') { - cmd_defines[num_cmd_defines++] = arg; + if (num_cmd_defines < MAX_CMD_DEFINES) { + cmd_defines[num_cmd_defines++] = arg; + } else { + fatal("%s: Too many -U/-D arguments\n", ProgramName); + } continue; } Syntax (); @@ -920,6 +908,7 @@ (whichResources == RALL || whichResources == RSCREENS) #endif ) { + char inputbuf[1024]; #ifdef WIN32 strcpy(tmpname, "\\temp\\xrdb_XXXXXX"); #else @@ -946,8 +935,8 @@ if (!fp) fatal("%s: Failed to open temp file: %s\n", ProgramName, filename); - while ((i = getc(stdin)) != EOF) - putc(i, fp); + while (fgets(inputbuf, sizeof(inputbuf), stdin) != NULL) + fputs(inputbuf, fp); fclose(fp); } @@ -1076,6 +1065,8 @@ FILE *input, *output; char *cmd; + defines.val[defines_base] = '\0'; + defines.used = defines_base; buffer.used = 0; InitEntries(&newDB); DoScreenDefines(dpy, scrno, &defines); Index: xc/programs/xrdb/xrdb.man diff -u xc/programs/xrdb/xrdb.man:1.7 xc/programs/xrdb/xrdb.man:1.8 --- xc/programs/xrdb/xrdb.man:1.7 Sat Jan 27 13:21:22 2001 +++ xc/programs/xrdb/xrdb.man Fri Dec 14 15:02:14 2001 @@ -1,8 +1,12 @@ -.\" $Xorg: xrdb.man,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ +.\" $Xorg: xrdb.man,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ .\" Copyright 1991, Digital Equipment Corporation. .\" Copyright 1991, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xrdb/xrdb.man,v 1.7 2001/01/27 18:21:22 dawes Exp $ +.\" $XFree86: xc/programs/xrdb/xrdb.man,v 1.8 2001/12/14 20:02:14 dawes Exp $ .\" .TH XRDB 1 __xorgversion__ .SH NAME Index: xc/programs/xrefresh/xrefresh.c diff -u xc/programs/xrefresh/xrefresh.c:3.4 xc/programs/xrefresh/xrefresh.c:3.6 --- xc/programs/xrefresh/xrefresh.c:3.4 Wed Jan 17 18:46:22 2001 +++ xc/programs/xrefresh/xrefresh.c Fri Dec 14 15:02:15 2001 @@ -2,7 +2,11 @@ Copyright 1987, 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -42,12 +46,12 @@ ******************************************************************/ /* - * $Xorg: xrefresh.c,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ + * $Xorg: xrefresh.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ * * Kitchen sink version, useful for clearing small areas and flashing the * screen. */ -/* $XFree86: xc/programs/xrefresh/xrefresh.c,v 3.4 2001/01/17 23:46:22 dawes Exp $ */ +/* $XFree86: xc/programs/xrefresh/xrefresh.c,v 3.6 2001/12/14 20:02:15 dawes Exp $ */ #include <stdio.h> #include <errno.h> @@ -55,12 +59,7 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <ctype.h> - -#ifdef X_NOT_STDC_ENV -char *malloc(); -#else #include <stdlib.h> -#endif Window win; Index: xc/programs/xrefresh/xrefresh.man diff -u xc/programs/xrefresh/xrefresh.man:1.7 xc/programs/xrefresh/xrefresh.man:1.8 --- xc/programs/xrefresh/xrefresh.man:1.7 Sat Jan 27 13:21:22 2001 +++ xc/programs/xrefresh/xrefresh.man Fri Dec 14 15:02:15 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xrefresh.man,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ +.\" $Xorg: xrefresh.man,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xrefresh/xrefresh.man,v 1.7 2001/01/27 18:21:22 dawes Exp $ +.\" $XFree86: xc/programs/xrefresh/xrefresh.man,v 1.8 2001/12/14 20:02:15 dawes Exp $ .\" .TH XREFRESH 1 __xorgversion__ .SH NAME Index: xc/programs/xrx/helper/GetUrl.c diff -u xc/programs/xrx/helper/GetUrl.c:1.1.1.3 xc/programs/xrx/helper/GetUrl.c:1.4 --- xc/programs/xrx/helper/GetUrl.c:1.1.1.3 Tue Jan 16 18:02:29 2001 +++ xc/programs/xrx/helper/GetUrl.c Fri Dec 14 15:02:16 2001 @@ -1,9 +1,13 @@ -/* $Xorg: GetUrl.c,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ */ +/* $Xorg: GetUrl.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,6 +26,8 @@ The Open Group. */ +/* $XFree86: xc/programs/xrx/helper/GetUrl.c,v 1.4 2001/12/14 20:02:16 dawes Exp $ */ + /* * This file is really split into two major parts where GetUrl is implemented * in two completely different ways. @@ -89,7 +95,7 @@ #include <ctype.h> /* get definitions for the HTTP protocol */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define TRANS(func) _HttpTrans##func #else #define TRANS(func) _HttpTrans/**/func Index: xc/programs/xrx/helper/GetUrl.h diff -u xc/programs/xrx/helper/GetUrl.h:1.1.1.3 xc/programs/xrx/helper/GetUrl.h:1.2 --- xc/programs/xrx/helper/GetUrl.h:1.1.1.3 Tue Jan 16 18:02:31 2001 +++ xc/programs/xrx/helper/GetUrl.h Fri Dec 14 15:02:16 2001 @@ -1,9 +1,13 @@ -/* $Xorg: GetUrl.h,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ */ +/* $Xorg: GetUrl.h,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/helper/helper.c diff -u xc/programs/xrx/helper/helper.c:1.4 xc/programs/xrx/helper/helper.c:1.5 --- xc/programs/xrx/helper/helper.c:1.4 Wed Jan 17 18:46:23 2001 +++ xc/programs/xrx/helper/helper.c Fri Dec 14 15:02:16 2001 @@ -1,9 +1,13 @@ -/* $Xorg: helper.c,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ */ +/* $Xorg: helper.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/helper/httptran.c diff -u xc/programs/xrx/helper/httptran.c:1.4 xc/programs/xrx/helper/httptran.c:1.6 --- xc/programs/xrx/helper/httptran.c:1.4 Wed Jan 17 18:46:23 2001 +++ xc/programs/xrx/helper/httptran.c Fri Dec 14 15:02:16 2001 @@ -1,9 +1,13 @@ -/* $Xorg: httptran.c,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ */ +/* $Xorg: httptran.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,9 +27,9 @@ */ -/* $XFree86: xc/programs/xrx/helper/httptran.c,v 1.4 2001/01/17 23:46:23 dawes Exp $ */ +/* $XFree86: xc/programs/xrx/helper/httptran.c,v 1.6 2001/12/14 20:02:16 dawes Exp $ */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define TRANS(func) _HttpTrans##func #else #define TRANS(func) _HttpTrans/**/func Index: xc/programs/xrx/helper/xrx.man diff -u xc/programs/xrx/helper/xrx.man:1.6 xc/programs/xrx/helper/xrx.man:1.7 --- xc/programs/xrx/helper/xrx.man:1.6 Sat Jan 27 13:21:22 2001 +++ xc/programs/xrx/helper/xrx.man Fri Dec 14 15:02:16 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xrx.man,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ +.\" $Xorg: xrx.man,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ .\" Copyright 1996, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" from The Open Group. .\" .\" -.\" $XFree86: xc/programs/xrx/helper/xrx.man,v 1.6 2001/01/27 18:21:22 dawes Exp $ +.\" $XFree86: xc/programs/xrx/helper/xrx.man,v 1.7 2001/12/14 20:02:16 dawes Exp $ .\" .TH XRX 1 __xorgversion__ .SH NAME Index: xc/programs/xrx/plugin/Global.c diff -u xc/programs/xrx/plugin/Global.c:1.1.1.3 xc/programs/xrx/plugin/Global.c:1.2 --- xc/programs/xrx/plugin/Global.c:1.1.1.3 Tue Jan 16 18:03:00 2001 +++ xc/programs/xrx/plugin/Global.c Fri Dec 14 15:02:17 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Global.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ +/* $Xorg: Global.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/plugin/Imakefile diff -u xc/programs/xrx/plugin/Imakefile:1.8 xc/programs/xrx/plugin/Imakefile:1.11 --- xc/programs/xrx/plugin/Imakefile:1.8 Sat Mar 3 18:07:50 2001 +++ xc/programs/xrx/plugin/Imakefile Wed Nov 21 17:54:17 2001 @@ -1,9 +1,9 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ +XCOMM $Xorg: Imakefile,v 1.4 2001/02/20 15:51:17 pookie Exp $ -XCOMM $XFree86: xc/programs/xrx/plugin/Imakefile,v 1.8 2001/03/03 23:07:50 tsi Exp $ +XCOMM $XFree86: xc/programs/xrx/plugin/Imakefile,v 1.11 2001/11/21 22:54:17 dawes Exp $ XCOMM This isn't an option we must build a shared lib #define DoSharedLib YES @@ -21,6 +21,9 @@ SOCKET_DEFINES = -DBSD44SOCKETS #endif +/* Netscape be damned. Allow fresh (re-)installs to proceed correctly */ +#if UseInstalledX11 + #ifdef SGIArchitecture #if OSMajorVersion == 5 && OSMinorVersion < 3 || OSMajorVersion == 6 && OSMinorVersion < 2 XT_DEFINES = -DXUSE_XTREGISTERWINDOW @@ -72,7 +75,7 @@ #endif #endif -#ifdef AlphaArchitecture +#if defined(AlphaArchitecture) && defined(OSF1Architecture) #if OSMajorVersion < 4 XT_DEFINES = -DXUSE_XTREGISTERWINDOW #endif @@ -83,6 +86,8 @@ XT_DEFINES = -DXUSE_XTREGISTERWINDOW #endif +#endif /* UseInstalledX11 */ + PLUGIN_DEFINES = -DXP_UNIX PLUGIN_INCLUDES = -I./include @@ -100,6 +105,8 @@ OBJS = Main.o SetWin.o PProcess.o NewNDest.o Global.o stubs.o \ $(PARAMS_OBJS) $(XMISC_OBJS) +#if UseInstalledX11 + XCOMM we need to link in the right libraries so it will work no matter XCOMM which libraries Netscape itself is using. #if !VendorHasX11R6_3libXext @@ -129,15 +136,23 @@ LDPOSTLIBS = LDPRELIBS = #endif +#ifdef SequentArchitecture + RXICELIB = $(ICELIB) + XONLYLIB = -lX11 -lsocket +PLUGIN_LDOPTIONS = $(LDPRELIBS) +#endif #else PLUGIN_LDOPTIONS = $(LDPRELIBS) #endif /* Sun and HP don't ship it yet, SGI has it inside libXt. */ -#ifdef AlphaArchitecture +#if defined(AlphaArchitecture) && defined(OSF1Architecture) RXICELIB = $(ICELIB) #endif +#else /* UseInstalledX11 */ +PLUGIN_LDOPTIONS = $(LDPRELIBS) +#endif /* UseInstalledX11 */ REQUIREDLIBS = $(X11R6_3_EXTENSIONS) $(PLUGIN_LDOPTIONS) $(RXICELIB) $(XTOOLONLYLIB) $(XLIB) Index: xc/programs/xrx/plugin/Main.c diff -u xc/programs/xrx/plugin/Main.c:1.6 xc/programs/xrx/plugin/Main.c:1.8 --- xc/programs/xrx/plugin/Main.c:1.6 Wed Jan 17 18:46:24 2001 +++ xc/programs/xrx/plugin/Main.c Fri Dec 14 15:02:17 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Main.c,v 1.4 2000/08/17 19:54:59 cpqbld Exp $ */ +/* $Xorg: Main.c,v 1.5 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,6 +26,7 @@ The Open Group. */ +/* $XFree86: xc/programs/xrx/plugin/Main.c,v 1.8 2001/12/14 20:02:17 dawes Exp $ */ /* * RX plug-in module based on the UnixTemplate file provided by Netcape. @@ -563,9 +568,11 @@ void NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) { + /* PluginInstance* This; if (instance != NULL) This = (PluginInstance*) instance->pdata; + */ } @@ -576,7 +583,9 @@ return; if (instance != NULL) { +#if 0 PluginInstance* This = (PluginInstance*) instance->pdata; +#endif if (printInfo->mode == NP_FULL) { /* @@ -596,14 +605,17 @@ * etc. */ + /* void* platformPrint = printInfo->print.fullPrint.platformPrint; NPBool printOne = printInfo->print.fullPrint.printOne; + */ /* Do the default*/ printInfo->print.fullPrint.pluginPrinted = FALSE; } +#if 0 else { /* If not fullscreen, we must be embedded */ /* * PLUGIN DEVELOPERS: @@ -622,5 +634,6 @@ void* platformPrint = printInfo->print.embedPrint.platformPrint; } +#endif } } Index: xc/programs/xrx/plugin/NewNDest.c diff -u xc/programs/xrx/plugin/NewNDest.c:1.4 xc/programs/xrx/plugin/NewNDest.c:1.5 --- xc/programs/xrx/plugin/NewNDest.c:1.4 Wed Jan 17 18:46:24 2001 +++ xc/programs/xrx/plugin/NewNDest.c Fri Dec 14 15:02:17 2001 @@ -1,9 +1,13 @@ -/* $Xorg: NewNDest.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ +/* $Xorg: NewNDest.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/plugin/PProcess.c diff -u xc/programs/xrx/plugin/PProcess.c:1.4 xc/programs/xrx/plugin/PProcess.c:1.6 --- xc/programs/xrx/plugin/PProcess.c:1.4 Wed Jan 17 18:46:24 2001 +++ xc/programs/xrx/plugin/PProcess.c Fri Dec 14 15:02:17 2001 @@ -1,9 +1,13 @@ -/* $Xorg: PProcess.c,v 1.5 2000/08/17 19:54:59 cpqbld Exp $ */ +/* $Xorg: PProcess.c,v 1.6 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,6 +26,7 @@ The Open Group. */ +/* $XFree86: xc/programs/xrx/plugin/PProcess.c,v 1.6 2001/12/14 20:02:17 dawes Exp $ */ #include "RxPlugin.h" #include "XUrls.h" @@ -80,7 +85,7 @@ if (sizehints) { XGetWMNormalHints (dpy, win, sizehints, &mask); - if (mask & USPosition|PPosition) { + if (mask & (USPosition|PPosition)) { *x = sizehints->x; *y = sizehints->y; *width = sizehints->width; Index: xc/programs/xrx/plugin/RxPlugin.h diff -u xc/programs/xrx/plugin/RxPlugin.h:1.4 xc/programs/xrx/plugin/RxPlugin.h:1.5 --- xc/programs/xrx/plugin/RxPlugin.h:1.4 Wed Jan 17 18:46:24 2001 +++ xc/programs/xrx/plugin/RxPlugin.h Fri Dec 14 15:02:17 2001 @@ -1,9 +1,13 @@ -/* $Xorg: RxPlugin.h,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ +/* $Xorg: RxPlugin.h,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/plugin/SetWin.c diff -u xc/programs/xrx/plugin/SetWin.c:1.4 xc/programs/xrx/plugin/SetWin.c:1.5 --- xc/programs/xrx/plugin/SetWin.c:1.4 Wed Jan 17 18:46:24 2001 +++ xc/programs/xrx/plugin/SetWin.c Fri Dec 14 15:02:17 2001 @@ -1,9 +1,13 @@ -/* $Xorg: SetWin.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ +/* $Xorg: SetWin.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/plugin/libxrx.man diff -u xc/programs/xrx/plugin/libxrx.man:1.7 xc/programs/xrx/plugin/libxrx.man:1.8 --- xc/programs/xrx/plugin/libxrx.man:1.7 Sat Jan 27 13:21:22 2001 +++ xc/programs/xrx/plugin/libxrx.man Fri Dec 14 15:02:17 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: libxrx.man,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ +.\" $Xorg: libxrx.man,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ .\" Copyright 1996, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -20,7 +24,7 @@ .\" from The Open Group. .\" .\" -.\" $XFree86: xc/programs/xrx/plugin/libxrx.man,v 1.7 2001/01/27 18:21:22 dawes Exp $ +.\" $XFree86: xc/programs/xrx/plugin/libxrx.man,v 1.8 2001/12/14 20:02:17 dawes Exp $ .\" .TH LIBXRX 1 __xorgversion__ .SH NAME Index: xc/programs/xrx/plugin/include/npapi.h diff -u xc/programs/xrx/plugin/include/npapi.h:1.4 xc/programs/xrx/plugin/include/npapi.h:1.5 --- xc/programs/xrx/plugin/include/npapi.h:1.4 Wed Jan 17 18:46:25 2001 +++ xc/programs/xrx/plugin/include/npapi.h Wed Jul 25 11:05:28 2001 @@ -4,7 +4,7 @@ * npapi.h Revision: 1.76 * Netscape client plug-in API spec */ -/* $XFree86: xc/programs/xrx/plugin/include/npapi.h,v 1.4 2001/01/17 23:46:25 dawes Exp $ */ +/* $XFree86: xc/programs/xrx/plugin/include/npapi.h,v 1.5 2001/07/25 15:05:28 dawes Exp $ */ #ifndef _NPAPI_H_ #define _NPAPI_H_ @@ -53,9 +53,7 @@ #ifndef TRUE #define TRUE (1) #endif -#ifndef NULL -#define NULL (0L) -#endif +#include <stddef.h> typedef unsigned char NPBool; typedef void* NPEvent; Index: xc/programs/xrx/rx/BuildReq.c diff -u xc/programs/xrx/rx/BuildReq.c:1.1.1.3 xc/programs/xrx/rx/BuildReq.c:1.2 --- xc/programs/xrx/rx/BuildReq.c:1.1.1.3 Tue Jan 16 18:03:22 2001 +++ xc/programs/xrx/rx/BuildReq.c Fri Dec 14 15:02:18 2001 @@ -1,9 +1,13 @@ -/* $Xorg: BuildReq.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: BuildReq.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/PParse.c diff -u xc/programs/xrx/rx/PParse.c:1.1.1.3 xc/programs/xrx/rx/PParse.c:1.2 --- xc/programs/xrx/rx/PParse.c:1.1.1.3 Tue Jan 16 18:03:23 2001 +++ xc/programs/xrx/rx/PParse.c Fri Dec 14 15:02:18 2001 @@ -1,9 +1,13 @@ -/* $Xorg: PParse.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: PParse.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/PRead.c diff -u xc/programs/xrx/rx/PRead.c:1.1.1.3 xc/programs/xrx/rx/PRead.c:1.2 --- xc/programs/xrx/rx/PRead.c:1.1.1.3 Tue Jan 16 18:03:25 2001 +++ xc/programs/xrx/rx/PRead.c Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: PRead.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: PRead.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/Prefs.c diff -u xc/programs/xrx/rx/Prefs.c:1.5 xc/programs/xrx/rx/Prefs.c:1.6 --- xc/programs/xrx/rx/Prefs.c:1.5 Wed Jan 17 18:46:25 2001 +++ xc/programs/xrx/rx/Prefs.c Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Prefs.c,v 1.4 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: Prefs.c,v 1.5 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ The Open Group. */ -/* $XFree86: xc/programs/xrx/rx/Prefs.c,v 1.5 2001/01/17 23:46:25 dawes Exp $ */ +/* $XFree86: xc/programs/xrx/rx/Prefs.c,v 1.6 2001/12/14 20:02:19 dawes Exp $ */ #include "Prefs.h" #include <ctype.h> Index: xc/programs/xrx/rx/Prefs.h diff -u xc/programs/xrx/rx/Prefs.h:1.1.1.3 xc/programs/xrx/rx/Prefs.h:1.2 --- xc/programs/xrx/rx/Prefs.h:1.1.1.3 Tue Jan 16 18:03:26 2001 +++ xc/programs/xrx/rx/Prefs.h Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Prefs.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: Prefs.h,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/Rx.h diff -u xc/programs/xrx/rx/Rx.h:1.1.1.3 xc/programs/xrx/rx/Rx.h:1.2 --- xc/programs/xrx/rx/Rx.h:1.1.1.3 Tue Jan 16 18:03:27 2001 +++ xc/programs/xrx/rx/Rx.h Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: Rx.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: Rx.h,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/RxI.h diff -u xc/programs/xrx/rx/RxI.h:1.1.1.3 xc/programs/xrx/rx/RxI.h:1.2 --- xc/programs/xrx/rx/RxI.h:1.1.1.3 Tue Jan 16 18:03:28 2001 +++ xc/programs/xrx/rx/RxI.h Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: RxI.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: RxI.h,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/XAuth.c diff -u xc/programs/xrx/rx/XAuth.c:1.1.1.4 xc/programs/xrx/rx/XAuth.c:1.2 --- xc/programs/xrx/rx/XAuth.c:1.1.1.4 Tue Jan 16 18:03:30 2001 +++ xc/programs/xrx/rx/XAuth.c Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: XAuth.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: XAuth.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/XAuth.h diff -u xc/programs/xrx/rx/XAuth.h:1.1.1.3 xc/programs/xrx/rx/XAuth.h:1.2 --- xc/programs/xrx/rx/XAuth.h:1.1.1.3 Tue Jan 16 18:03:31 2001 +++ xc/programs/xrx/rx/XAuth.h Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: XAuth.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: XAuth.h,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/XDpyName.c diff -u xc/programs/xrx/rx/XDpyName.c:1.4 xc/programs/xrx/rx/XDpyName.c:1.5 --- xc/programs/xrx/rx/XDpyName.c:1.4 Wed Jan 17 18:46:25 2001 +++ xc/programs/xrx/rx/XDpyName.c Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: XDpyName.c,v 1.4 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: XDpyName.c,v 1.5 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/XDpyName.h diff -u xc/programs/xrx/rx/XDpyName.h:1.1.1.3 xc/programs/xrx/rx/XDpyName.h:1.2 --- xc/programs/xrx/rx/XDpyName.h:1.1.1.3 Tue Jan 16 18:03:35 2001 +++ xc/programs/xrx/rx/XDpyName.h Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: XDpyName.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: XDpyName.h,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/rx/XUrls.c diff -u xc/programs/xrx/rx/XUrls.c:1.7 xc/programs/xrx/rx/XUrls.c:1.11 --- xc/programs/xrx/rx/XUrls.c:1.7 Wed Jan 17 18:46:25 2001 +++ xc/programs/xrx/rx/XUrls.c Fri Dec 14 15:02:19 2001 @@ -1,9 +1,13 @@ -/* $Xorg: XUrls.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: XUrls.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,9 +26,10 @@ The Open Group. */ -/* $XFree86: xc/programs/xrx/rx/XUrls.c,v 1.7 2001/01/17 23:46:25 dawes Exp $ */ +/* $XFree86: xc/programs/xrx/rx/XUrls.c,v 1.11 2001/12/14 20:02:19 dawes Exp $ */ #include "RxI.h" +#include "XUrls.h" #include <sys/utsname.h> #include <sys/types.h> #include <sys/socket.h> @@ -33,9 +38,6 @@ #include <stdlib.h> #include <limits.h> /* for MAXHOSTNAMELEN */ #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif /* and in case we didn't get it from the headers above */ #ifndef MAXHOSTNAMELEN @@ -65,11 +67,7 @@ char* display_name, char* dest_url) { - struct sockaddr_in local, remote; - struct hostent* hp; struct utsname host; - int s, rv, namelen; - char dest_hostname[MAXHOSTNAMELEN + 1]; *myname = '\0'; @@ -78,6 +76,11 @@ /* for some reason this doesn't work on Solaris 2.x */ #if !(defined(sun) && defined(SVR4)) + struct sockaddr_in local, remote; + struct hostent* hp; + int s, rv, namelen; + char dest_hostname[MAXHOSTNAMELEN + 1]; + ParseHostname (dest_url, dest_hostname, sizeof dest_hostname); hp = gethostbyname (dest_hostname); @@ -163,7 +166,7 @@ char * GetXUrl(char *display_name, char *auth, char* dest_url) { - char *dpy_name, *proto; + char *dpy_name, *proto = NULL; char *url, *ptr; char *name; struct hostent *host; @@ -238,7 +241,7 @@ char * GetXPrintUrl(char *display_name, char *printer, char *auth, char* dest_url) { - char *dpy_name, *proto; + char *dpy_name, *proto = NULL; char *url, *ptr; char *name; struct hostent *host; Index: xc/programs/xrx/rx/XUrls.h diff -u xc/programs/xrx/rx/XUrls.h:1.4 xc/programs/xrx/rx/XUrls.h:1.5 --- xc/programs/xrx/rx/XUrls.h:1.4 Wed Jan 17 18:46:25 2001 +++ xc/programs/xrx/rx/XUrls.h Fri Dec 14 15:02:20 2001 @@ -1,9 +1,13 @@ -/* $Xorg: XUrls.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ +/* $Xorg: XUrls.h,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/testplugin/testplugin.c diff -u xc/programs/xrx/testplugin/testplugin.c:1.1.1.3 xc/programs/xrx/testplugin/testplugin.c:1.2 --- xc/programs/xrx/testplugin/testplugin.c:1.1.1.3 Tue Jan 16 18:03:41 2001 +++ xc/programs/xrx/testplugin/testplugin.c Fri Dec 14 15:02:20 2001 @@ -1,9 +1,13 @@ -/* $Xorg: testplugin.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ +/* $Xorg: testplugin.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/testplugin/testplugin.man diff -u xc/programs/xrx/testplugin/testplugin.man:1.6 xc/programs/xrx/testplugin/testplugin.man:1.7 --- xc/programs/xrx/testplugin/testplugin.man:1.6 Sat Jan 27 13:21:22 2001 +++ xc/programs/xrx/testplugin/testplugin.man Fri Dec 14 15:02:21 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: testplugin.man,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ +.\" $Xorg: testplugin.man,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ .\" Copyright 1996, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xrx/testplugin/testplugin.man,v 1.6 2001/01/27 18:21:22 dawes Exp $ +.\" $XFree86: xc/programs/xrx/testplugin/testplugin.man,v 1.7 2001/12/14 20:02:21 dawes Exp $ .\" .TH TESTPLUGIN 1 __xorgversion__ .SH NAME Index: xc/programs/xrx/xnest-plugin/NewNDest.c diff -u xc/programs/xrx/xnest-plugin/NewNDest.c:1.4 xc/programs/xrx/xnest-plugin/NewNDest.c:1.5 --- xc/programs/xrx/xnest-plugin/NewNDest.c:1.4 Wed Jan 17 18:46:26 2001 +++ xc/programs/xrx/xnest-plugin/NewNDest.c Fri Dec 14 15:02:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: NewNDest.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ +/* $Xorg: NewNDest.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/xnest-plugin/PProcess.c diff -u xc/programs/xrx/xnest-plugin/PProcess.c:1.4 xc/programs/xrx/xnest-plugin/PProcess.c:1.5 --- xc/programs/xrx/xnest-plugin/PProcess.c:1.4 Wed Jan 17 18:46:26 2001 +++ xc/programs/xrx/xnest-plugin/PProcess.c Fri Dec 14 15:02:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: PProcess.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ +/* $Xorg: PProcess.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/xnest-plugin/RxPlugin.h diff -u xc/programs/xrx/xnest-plugin/RxPlugin.h:1.4 xc/programs/xrx/xnest-plugin/RxPlugin.h:1.5 --- xc/programs/xrx/xnest-plugin/RxPlugin.h:1.4 Wed Jan 17 18:46:26 2001 +++ xc/programs/xrx/xnest-plugin/RxPlugin.h Fri Dec 14 15:02:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: RxPlugin.h,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ +/* $Xorg: RxPlugin.h,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/xnest-plugin/SetWin.c diff -u xc/programs/xrx/xnest-plugin/SetWin.c:1.5 xc/programs/xrx/xnest-plugin/SetWin.c:1.6 --- xc/programs/xrx/xnest-plugin/SetWin.c:1.5 Wed Jan 17 18:46:26 2001 +++ xc/programs/xrx/xnest-plugin/SetWin.c Fri Dec 14 15:02:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: SetWin.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ +/* $Xorg: SetWin.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xrx/xnest-plugin/XnestDis.c diff -u xc/programs/xrx/xnest-plugin/XnestDis.c:1.1.1.3 xc/programs/xrx/xnest-plugin/XnestDis.c:1.2 --- xc/programs/xrx/xnest-plugin/XnestDis.c:1.1.1.3 Tue Jan 16 18:03:52 2001 +++ xc/programs/xrx/xnest-plugin/XnestDis.c Fri Dec 14 15:02:21 2001 @@ -1,9 +1,13 @@ -/* $Xorg: XnestDis.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ +/* $Xorg: XnestDis.c,v 1.4 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xset/xset.c diff -u xc/programs/xset/xset.c:3.21 xc/programs/xset/xset.c:3.25 --- xc/programs/xset/xset.c:3.21 Wed Jan 17 18:46:27 2001 +++ xc/programs/xset/xset.c Fri Dec 14 15:02:22 2001 @@ -1,12 +1,16 @@ /* - * $Xorg: xset.c,v 1.5 2000/08/17 19:55:03 cpqbld Exp $ + * $Xorg: xset.c,v 1.6 2001/02/09 02:05:58 xorgcvs Exp $ */ /* Copyright 1985, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,18 +27,13 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xset/xset.c,v 3.21 2001/01/17 23:46:27 dawes Exp $ */ +/* $XFree86: xc/programs/xset/xset.c,v 3.25 2001/12/14 20:02:22 dawes Exp $ */ /* Modified by Stephen so keyboard rate is set using XKB extensions */ #include <stdio.h> #include <ctype.h> #include <stdarg.h> - -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#else -char *malloc(); -#endif #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <X11/Xlib.h> @@ -83,7 +82,11 @@ #include <X11/XKBlib.h> #endif #ifdef FONTCACHE +#include <X11/extensions/fontcache.h> #include <X11/extensions/fontcacheP.h> + +static Status set_font_cache(Display *, long, long, long); +static void query_cache_status(Display *dpy); #endif #define ON 1 @@ -687,7 +690,7 @@ } #if defined(XF86MISC) || defined(XKB) else if (strcmp(arg, "rate") == 0) { /* ...or this one. */ - int delay, rate; + int delay = 0, rate = 0; int rate_set = 0; #ifdef XF86MISC if (XF86MiscQueryVersion(dpy, &major, &minor)) { @@ -1178,6 +1181,7 @@ } #ifdef FONTCACHE +static Status set_font_cache(dpy, himark, lowmark, balance) Display *dpy; long himark; @@ -1185,7 +1189,7 @@ long balance; { FontCacheSettings cs; - int status; + Status status; cs.himark = himark * 1024; cs.lowmark = lowmark * 1024; @@ -1384,13 +1388,10 @@ * This is the information-getting function for telling the user what the * current settings and statistics are. */ - +static void query_cache_status(dpy) Display *dpy; { - int scr = DefaultScreen (dpy); - int i, j; - int dummy; FontCacheSettings cs; FontCacheStatistics cstats; @@ -1407,25 +1408,23 @@ } if (FontCacheGetCacheStatistics(dpy, &cstats)) { printf("font cache statistics:\n"); - printf(" cache purged: %d\n", cstats.purge_runs); - printf(" cache status: %d\n", cstats.purge_stat); - printf(" cache balance: %d\n", cstats.balance); + printf(" cache purged: %ld\n", cstats.purge_runs); + printf(" cache status: %ld\n", cstats.purge_stat); + printf(" cache balance: %ld\n", cstats.balance); printf("font cache entry statistics:\n"); - printf(" hits: %d\n", cstats.f.hits); - printf(" misshits: %d\n", cstats.f.misshits); - printf(" purged: %d\n", cstats.f.purged); - printf(" usage: %d\n", cstats.f.usage); + printf(" hits: %ld\n", cstats.f.hits); + printf(" misshits: %ld\n", cstats.f.misshits); + printf(" purged: %ld\n", cstats.f.purged); + printf(" usage: %ld\n", cstats.f.usage); printf("large bitmap cache entry statistics:\n"); - printf(" hits: %d\n", cstats.v.hits); - printf(" misshits: %d\n", cstats.v.misshits); - printf(" purged: %d\n", cstats.v.purged); - printf(" usage: %d\n", cstats.v.usage); + printf(" hits: %ld\n", cstats.v.hits); + printf(" misshits: %ld\n", cstats.v.misshits); + printf(" purged: %ld\n", cstats.v.purged); + printf(" usage: %ld\n", cstats.v.usage); } } else { printf("Server does not have the FontCache Extension\n"); } - - return 0; } #endif Index: xc/programs/xset/xset.man diff -u xc/programs/xset/xset.man:3.13 xc/programs/xset/xset.man:3.14 --- xc/programs/xset/xset.man:3.13 Sat Jan 27 13:21:23 2001 +++ xc/programs/xset/xset.man Fri Dec 14 15:02:22 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xset.man,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ +.\" $Xorg: xset.man,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xset/xset.man,v 3.13 2001/01/27 18:21:23 dawes Exp $ +.\" $XFree86: xc/programs/xset/xset.man,v 3.14 2001/12/14 20:02:22 dawes Exp $ .\" .TH XSET 1 __xorgversion__ .SH NAME Index: xc/programs/xsetroot/xsetroot.c diff -u xc/programs/xsetroot/xsetroot.c:1.7 xc/programs/xsetroot/xsetroot.c:1.8 --- xc/programs/xsetroot/xsetroot.c:1.7 Sun Apr 1 10:00:24 2001 +++ xc/programs/xsetroot/xsetroot.c Fri Dec 14 15:02:23 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: xsetroot.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ + * $Xorg: xsetroot.c,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ * Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -28,7 +32,7 @@ * Author: Mark Lillibridge, MIT Project Athena * 11-Jun-87 */ -/* $XFree86: xc/programs/xsetroot/xsetroot.c,v 1.7 2001/04/01 14:00:24 tsi Exp $ */ +/* $XFree86: xc/programs/xsetroot/xsetroot.c,v 1.8 2001/12/14 20:02:23 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xutil.h> Index: xc/programs/xsetroot/xsetroot.man diff -u xc/programs/xsetroot/xsetroot.man:1.7 xc/programs/xsetroot/xsetroot.man:1.8 --- xc/programs/xsetroot/xsetroot.man:1.7 Sat Jan 27 13:21:23 2001 +++ xc/programs/xsetroot/xsetroot.man Fri Dec 14 15:02:23 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xsetroot.man,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ +.\" $Xorg: xsetroot.man,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xsetroot/xsetroot.man,v 1.7 2001/01/27 18:21:23 dawes Exp $ +.\" $XFree86: xc/programs/xsetroot/xsetroot.man,v 1.8 2001/12/14 20:02:23 dawes Exp $ .\" .TH XSETROOT 1 __xorgversion__ .SH NAME Index: xc/programs/xsm/Imakefile diff -u xc/programs/xsm/Imakefile:1.6 xc/programs/xsm/Imakefile:1.7 --- xc/programs/xsm/Imakefile:1.6 Wed Jan 17 18:46:28 2001 +++ xc/programs/xsm/Imakefile Tue Jul 31 20:45:07 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/xsm/Imakefile,v 1.6 2001/01/17 23:46:28 dawes Exp $ +XCOMM $XFree86: xc/programs/xsm/Imakefile,v 1.7 2001/08/01 00:45:07 tsi Exp $ #if !defined(RshCmd) #if SystemV @@ -32,6 +32,8 @@ OBJS1 = auth.o choose.o info.o list.o lock.o log.o \ mainwin.o misc.o popup.o printhex.o prop.o remote.o \ restart.o save.o saveutil.o signals.o xsm.o xtwatch.o + + INCLUDES = -I. PROGS1 = xsm Index: xc/programs/xsm/auth.c diff -u xc/programs/xsm/auth.c:1.6 xc/programs/xsm/auth.c:1.7 --- xc/programs/xsm/auth.c:1.6 Wed Jan 17 18:46:28 2001 +++ xc/programs/xsm/auth.c Fri Dec 14 15:02:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: auth.c,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ +/* $Xorg: auth.c,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.6 2001/01/17 23:46:28 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/auth.c,v 1.7 2001/12/14 20:02:23 dawes Exp $ */ #include "xsm.h" Index: xc/programs/xsm/auth.h diff -u xc/programs/xsm/auth.h:1.4 xc/programs/xsm/auth.h:1.6 --- xc/programs/xsm/auth.h:1.4 Wed Jan 17 18:46:28 2001 +++ xc/programs/xsm/auth.h Fri Dec 14 15:02:23 2001 @@ -1,9 +1,13 @@ -/* $Xorg: auth.h,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ +/* $Xorg: auth.h,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,10 +23,17 @@ 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.4 2001/01/17 23:46:28 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/auth.h,v 1.6 2001/12/14 20:02:23 dawes Exp $ */ +#ifndef _AUTH_H_ +#define _AUTH_H_ + +#include <X11/ICE/ICEutil.h> + extern Bool HostBasedAuthProc(char *hostname); extern Status SetAuthentication(int count, IceListenObj *listenObjs, IceAuthDataEntry **authDataEntries); extern void FreeAuthenticationData(int count, IceAuthDataEntry *authDataEntries); + +#endif Index: xc/programs/xsm/choose.c diff -u xc/programs/xsm/choose.c:1.4 xc/programs/xsm/choose.c:1.5 --- xc/programs/xsm/choose.c:1.4 Wed Jan 17 18:46:28 2001 +++ xc/programs/xsm/choose.c Fri Dec 14 15:02:24 2001 @@ -1,9 +1,13 @@ -/* $Xorg: choose.c,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ +/* $Xorg: choose.c,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:46:28 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/choose.c,v 1.5 2001/12/14 20:02:24 dawes Exp $ */ #include "xsm.h" #include "saveutil.h" Index: xc/programs/xsm/choose.h diff -u xc/programs/xsm/choose.h:1.4 xc/programs/xsm/choose.h:1.6 --- xc/programs/xsm/choose.h:1.4 Wed Jan 17 18:46:28 2001 +++ xc/programs/xsm/choose.h Fri Dec 14 15:02:24 2001 @@ -1,9 +1,13 @@ -/* $Xorg: choose.h,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ +/* $Xorg: choose.h,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,8 +23,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/xsm/choose.h,v 1.4 2001/01/17 23:46:28 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/choose.h,v 1.6 2001/12/14 20:02:24 dawes Exp $ */ +#ifndef _CHOOSE_H_ +#define _CHOOSE_H_ + +#include <X11/Intrinsic.h> + extern int GetSessionNames(int *count_ret, String **short_names_ret, String **long_names_ret, Bool **locked_ret); extern void FreeSessionNames(int count, String *namesShort, String *namesLong, @@ -30,3 +39,5 @@ Boolean *continue_to_dispatch); extern void ChooseSession(void); extern void create_choose_session_popup(void); + +#endif Index: xc/programs/xsm/globals.c diff -u xc/programs/xsm/globals.c:1.4 xc/programs/xsm/globals.c:1.6 --- xc/programs/xsm/globals.c:1.4 Wed Jan 17 18:46:28 2001 +++ xc/programs/xsm/globals.c Fri Dec 14 15:02:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: globals.c,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ +/* $Xorg: globals.c,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:46:28 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/globals.c,v 1.6 2001/12/14 20:02:25 dawes Exp $ */ #include <X11/ICE/ICEutil.h> @@ -84,3 +88,4 @@ XtAppContext appContext; Widget topLevel; +XtSignalId sig_term_id, sig_usr1_id; Index: xc/programs/xsm/info.c diff -u xc/programs/xsm/info.c:1.5 xc/programs/xsm/info.c:1.6 --- xc/programs/xsm/info.c:1.5 Wed Jan 17 18:46:28 2001 +++ xc/programs/xsm/info.c Fri Dec 14 15:02:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: info.c,v 1.4 2000/08/17 19:55:04 cpqbld Exp $ */ +/* $Xorg: info.c,v 1.5 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.5 2001/01/17 23:46:28 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/info.c,v 1.6 2001/12/14 20:02:25 dawes Exp $ */ #include "xsm.h" #include "restart.h" Index: xc/programs/xsm/info.h diff -u xc/programs/xsm/info.h:3.3 xc/programs/xsm/info.h:3.5 --- xc/programs/xsm/info.h:3.3 Wed Jan 17 18:46:28 2001 +++ xc/programs/xsm/info.h Fri Dec 14 15:02:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: info.h,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ +/* $Xorg: info.h,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,8 +23,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/xsm/info.h,v 3.3 2001/01/17 23:46:28 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/info.h,v 3.5 2001/12/14 20:02:25 dawes Exp $ */ +#ifndef _INFO_H_ +#define _INFO_H_ + +#include "xsm.h" + extern void ShowHint(ClientRec *client); extern void DisplayProps(ClientRec *client); extern char * GetProgramName(char *fullname); @@ -31,3 +40,5 @@ extern void ClientInfoXtProc(Widget w, XtPointer client_data, XtPointer callData); extern void create_client_info_popup(void); + +#endif Index: xc/programs/xsm/list.c diff -u xc/programs/xsm/list.c:1.1.1.3 xc/programs/xsm/list.c:1.2 --- xc/programs/xsm/list.c:1.1.1.3 Tue Jan 16 18:04:36 2001 +++ xc/programs/xsm/list.c Fri Dec 14 15:02:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: list.c,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ +/* $Xorg: list.c,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xsm/list.h diff -u xc/programs/xsm/list.h:1.4 xc/programs/xsm/list.h:1.6 --- xc/programs/xsm/list.h:1.4 Wed Jan 17 18:46:29 2001 +++ xc/programs/xsm/list.h Fri Dec 14 15:02:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: list.h,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ +/* $Xorg: list.h,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,8 +23,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/xsm/list.h,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/list.h,v 1.6 2001/12/14 20:02:25 dawes Exp $ */ +#ifndef _LIST_H_ +#define _LIST_H_ + typedef struct _List { struct _List *prev; struct _List *next; @@ -37,3 +44,5 @@ extern void ListFreeOne(List *e); extern Status ListSearchAndFreeOne(List *l, char *thing); extern int ListCount(List *l); + +#endif Index: xc/programs/xsm/lock.c diff -u xc/programs/xsm/lock.c:3.3 xc/programs/xsm/lock.c:3.4 --- xc/programs/xsm/lock.c:3.3 Wed Jan 17 18:46:29 2001 +++ xc/programs/xsm/lock.c Fri Dec 14 15:02:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lock.c,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ +/* $Xorg: lock.c,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.3 2001/01/17 23:46:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/lock.c,v 3.4 2001/12/14 20:02:25 dawes Exp $ */ #include "xsm.h" #include "lock.h" Index: xc/programs/xsm/lock.h diff -u xc/programs/xsm/lock.h:1.4 xc/programs/xsm/lock.h:1.6 --- xc/programs/xsm/lock.h:1.4 Wed Jan 17 18:46:29 2001 +++ xc/programs/xsm/lock.h Fri Dec 14 15:02:25 2001 @@ -1,9 +1,13 @@ -/* $Xorg: lock.h,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ +/* $Xorg: lock.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,10 +23,17 @@ 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.4 2001/01/17 23:46:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/lock.h,v 1.6 2001/12/14 20:02:25 dawes Exp $ */ +#ifndef _LOCK_H_ +#define _LOCK_H_ + +#include <X11/Xdefs.h> + extern Status LockSession(char *session_name, Bool write_id); extern void UnlockSession(char* session_name); extern char * GetLockId(char *session_name); extern Bool CheckSessionLocked(char *session_name, Bool get_id, char **id_ret); extern void UnableToLockSession(char *session_name); + +#endif Index: xc/programs/xsm/log.c diff -u xc/programs/xsm/log.c:1.4 xc/programs/xsm/log.c:1.5 --- xc/programs/xsm/log.c:1.4 Wed Jan 17 18:46:29 2001 +++ xc/programs/xsm/log.c Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: log.c,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ +/* $Xorg: log.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:46:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/log.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */ #include "xsm.h" #include "save.h" Index: xc/programs/xsm/log.h diff -u xc/programs/xsm/log.h:1.4 xc/programs/xsm/log.h:1.6 --- xc/programs/xsm/log.h:1.4 Wed Jan 17 18:46:29 2001 +++ xc/programs/xsm/log.h Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: log.h,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ +/* $Xorg: log.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,9 +23,16 @@ 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.4 2001/01/17 23:46:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/log.h,v 1.6 2001/12/14 20:02:26 dawes Exp $ */ +#ifndef _LOG_H_ +#define _LOG_H_ + +#include <X11/Intrinsic.h> + extern void DisplayLogXtProc(Widget w, XtPointer client_data, XtPointer callData); extern void add_log_text(char *str); extern void create_log_popup(void); + +#endif Index: xc/programs/xsm/mainwin.c diff -u xc/programs/xsm/mainwin.c:1.4 xc/programs/xsm/mainwin.c:1.5 --- xc/programs/xsm/mainwin.c:1.4 Wed Jan 17 18:46:29 2001 +++ xc/programs/xsm/mainwin.c Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mainwin.c,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ +/* $Xorg: mainwin.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:46:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/mainwin.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */ #include "xsm.h" #include "info.h" Index: xc/programs/xsm/mainwin.h diff -u xc/programs/xsm/mainwin.h:1.4 xc/programs/xsm/mainwin.h:1.6 --- xc/programs/xsm/mainwin.h:1.4 Wed Jan 17 18:46:29 2001 +++ xc/programs/xsm/mainwin.h Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: mainwin.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: mainwin.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,6 +23,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/xsm/mainwin.h,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/mainwin.h,v 1.6 2001/12/14 20:02:26 dawes Exp $ */ +#ifndef _MAINWIN_H_ +#define _MAINWIN_H_ + extern void create_main_window(void); + +#endif Index: xc/programs/xsm/misc.c diff -u xc/programs/xsm/misc.c:1.4 xc/programs/xsm/misc.c:1.6 --- xc/programs/xsm/misc.c:1.4 Wed Jan 17 18:46:29 2001 +++ xc/programs/xsm/misc.c Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: misc.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: misc.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:46:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/misc.c,v 1.6 2001/12/14 20:02:26 dawes Exp $ */ #include "xsm.h" @@ -96,29 +100,6 @@ { return !strncmp (a, b, strlen (b)); } - - - -#ifdef X_NOT_STDC_ENV - -char * -Strstr(char *s1, char *s2) -{ - int n1, n2; - - n1 = strlen (s1); - n2 = strlen (s2); - - for (; n1 >= n2; s1++, n1--) - { - if (!strncmp (s1, s2, n2)) - return s1; - } - - return NULL; -} - -#endif Index: xc/programs/xsm/popup.c diff -u xc/programs/xsm/popup.c:1.4 xc/programs/xsm/popup.c:1.5 --- xc/programs/xsm/popup.c:1.4 Wed Jan 17 18:46:30 2001 +++ xc/programs/xsm/popup.c Fri Dec 14 15:02:26 2001 @@ -1,10 +1,14 @@ -/* $Xorg: popup.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: popup.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /* Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,7 +27,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xsm/popup.c,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/popup.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */ #include "xsm.h" #include <X11/Shell.h> Index: xc/programs/xsm/popup.h diff -u xc/programs/xsm/popup.h:1.4 xc/programs/xsm/popup.h:1.6 --- xc/programs/xsm/popup.h:1.4 Wed Jan 17 18:46:30 2001 +++ xc/programs/xsm/popup.h Fri Dec 14 15:02:26 2001 @@ -1,10 +1,14 @@ -/* $Xorg: popup.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: popup.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /* Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -23,8 +27,15 @@ from The Open Group. */ -/* $XFree86: xc/programs/xsm/popup.h,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/popup.h,v 1.6 2001/12/14 20:02:26 dawes Exp $ */ +#ifndef _POPUP_H_ +#define _POPUP_H_ + +#include <X11/Intrinsic.h> + extern void PopupPopup(Widget parent, Widget popup, Bool transient, Bool first_time, int offset_x, int offset_y, String delAction); + +#endif Index: xc/programs/xsm/printhex.c diff -u xc/programs/xsm/printhex.c:1.1.1.3 xc/programs/xsm/printhex.c:1.2 --- xc/programs/xsm/printhex.c:1.1.1.3 Tue Jan 16 18:04:54 2001 +++ xc/programs/xsm/printhex.c Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: printhex.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: printhex.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xsm/prop.c diff -u xc/programs/xsm/prop.c:1.4 xc/programs/xsm/prop.c:1.5 --- xc/programs/xsm/prop.c:1.4 Wed Jan 17 18:46:30 2001 +++ xc/programs/xsm/prop.c Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: prop.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: prop.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:46:30 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/prop.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */ #include "xsm.h" #include "info.h" Index: xc/programs/xsm/prop.h diff -u xc/programs/xsm/prop.h:1.4 xc/programs/xsm/prop.h:1.6 --- xc/programs/xsm/prop.h:1.4 Wed Jan 17 18:46:30 2001 +++ xc/programs/xsm/prop.h Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: prop.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: prop.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,8 +23,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/xsm/prop.h,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/prop.h,v 1.6 2001/12/14 20:02:26 dawes Exp $ */ +#ifndef _PROP_H_ +#define _PROP_H_ + +#include "xsm.h" + extern void FreePropValues(List *propValues); extern void FreeProp(Prop *prop); extern void SetInitialProperties(ClientRec *client, List *props); @@ -31,3 +40,5 @@ extern void DeletePropertiesProc(SmsConn smsConn, SmPointer managerData, int numProps, char **propNames); extern void GetPropertiesProc(SmsConn smsConn, SmPointer managerData); + +#endif Index: xc/programs/xsm/remote.c diff -u xc/programs/xsm/remote.c:1.4 xc/programs/xsm/remote.c:1.5 --- xc/programs/xsm/remote.c:1.4 Wed Jan 17 18:46:30 2001 +++ xc/programs/xsm/remote.c Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: remote.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: remote.c,v 1.5 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:46:30 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/remote.c,v 1.5 2001/12/14 20:02:26 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.5 xc/programs/xsm/restart.c:1.6 --- xc/programs/xsm/restart.c:1.5 Wed Jan 17 18:46:30 2001 +++ xc/programs/xsm/restart.c Fri Dec 14 15:02:26 2001 @@ -1,9 +1,13 @@ -/* $Xorg: restart.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: restart.c,v 1.5 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.5 2001/01/17 23:46:30 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/restart.c,v 1.6 2001/12/14 20:02:26 dawes Exp $ */ #include "xsm.h" #include "log.h" Index: xc/programs/xsm/restart.h diff -u xc/programs/xsm/restart.h:1.4 xc/programs/xsm/restart.h:1.6 --- xc/programs/xsm/restart.h:1.4 Wed Jan 17 18:46:30 2001 +++ xc/programs/xsm/restart.h Fri Dec 14 15:02:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: restart.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: restart.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,8 +23,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/xsm/restart.h,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/restart.h,v 1.6 2001/12/14 20:02:27 dawes Exp $ */ +#ifndef _RESTART_H_ +#define _RESTART_H_ + +#include "xsm.h" + extern Bool CheckIsManager(char *program); extern void GetRestartInfo(char *restart_service_prop, char *client_host_name, Bool *run_local, char **restart_protocol, @@ -29,3 +38,5 @@ extern void Clone(ClientRec *client, Bool useSavedState); extern void StartDefaultApps(void); extern void StartNonSessionAwareApps(void); + +#endif Index: xc/programs/xsm/save.c diff -u xc/programs/xsm/save.c:3.3 xc/programs/xsm/save.c:3.4 --- xc/programs/xsm/save.c:3.3 Wed Jan 17 18:46:30 2001 +++ xc/programs/xsm/save.c Fri Dec 14 15:02:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: save.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: save.c,v 1.5 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.3 2001/01/17 23:46:30 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/save.c,v 3.4 2001/12/14 20:02:27 dawes Exp $ */ #include "xsm.h" #include "save.h" Index: xc/programs/xsm/save.h diff -u xc/programs/xsm/save.h:1.4 xc/programs/xsm/save.h:1.6 --- xc/programs/xsm/save.h:1.4 Wed Jan 17 18:46:31 2001 +++ xc/programs/xsm/save.h Fri Dec 14 15:02:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: save.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: save.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,8 +23,14 @@ 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.4 2001/01/17 23:46:31 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/save.h,v 1.6 2001/12/14 20:02:27 dawes Exp $ */ +#ifndef _SAVE_H_ +#define _SAVE_H_ + +#include <X11/Intrinsic.h> +#include "list.h" + extern void DoSave(int saveType, int interactStyle, Bool fast); extern void LetClientInteract(List *cl); extern void StartPhase2(void); @@ -38,3 +48,5 @@ extern void PopupBadSave(void); extern void ShutdownDontSaveXtProc(Widget w, XtPointer client_data, XtPointer callData); + +#endif Index: xc/programs/xsm/saveutil.c diff -u xc/programs/xsm/saveutil.c:1.5 xc/programs/xsm/saveutil.c:1.6 --- xc/programs/xsm/saveutil.c:1.5 Wed Jan 17 18:46:31 2001 +++ xc/programs/xsm/saveutil.c Fri Dec 14 15:02:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: saveutil.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: saveutil.c,v 1.5 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.5 2001/01/17 23:46:31 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/saveutil.c,v 1.6 2001/12/14 20:02:27 dawes Exp $ */ #include "xsm.h" #include "log.h" Index: xc/programs/xsm/saveutil.h diff -u xc/programs/xsm/saveutil.h:1.5 xc/programs/xsm/saveutil.h:1.7 --- xc/programs/xsm/saveutil.h:1.5 Wed Jan 17 18:46:31 2001 +++ xc/programs/xsm/saveutil.h Fri Dec 14 15:02:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: saveutil.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: saveutil.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,11 +23,17 @@ 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.5 2001/01/17 23:46:31 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/saveutil.h,v 1.7 2001/12/14 20:02:27 dawes Exp $ */ +#ifndef _SAVEUTIL_H_ +#define _SAVEUTIL_H_ + +#include <stdio.h> + extern void set_session_save_file_name(char *session_name); extern int ReadSave(char *session_name, char **sm_id); extern void WriteSave(char *sm_id); extern Status DeleteSession(char *session_name); extern Bool getnextline(char **pbuf, int *plen, FILE *f); +#endif Index: xc/programs/xsm/signals.c diff -u xc/programs/xsm/signals.c:3.2 xc/programs/xsm/signals.c:3.6 --- xc/programs/xsm/signals.c:3.2 Wed Jan 17 18:46:31 2001 +++ xc/programs/xsm/signals.c Fri Dec 14 15:02:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: signals.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: signals.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,13 +23,19 @@ 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.2 2001/01/17 23:46:31 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/signals.c,v 3.6 2001/12/14 20:02:27 dawes Exp $ */ +#include <stdlib.h> + #include <X11/Xos.h> #include <X11/Xfuncs.h> +#include <X11/Intrinsic.h> #include <X11/SM/SMlib.h> +#include "save.h" + +#include <errno.h> #ifdef USG #ifndef __TYPES__ #include <sys/types.h> /* forgot to protect it... */ @@ -61,6 +71,8 @@ #undef _POSIX_SOURCE #endif #endif +#include "list.h" +#include "save.h" #if defined(X_NOT_POSIX) && defined(SIGNALRETURNSINT) #define SIGVAL int @@ -84,12 +96,11 @@ #define SIGNALS_RESET_WHEN_CAUGHT #endif -#ifndef NULL -#define NULL 0 -#endif +#include <stddef.h> int checkpoint_from_signal = 0; +extern XtSignalId sig_term_id, sig_usr1_id; extern Bool wantShutdown; @@ -111,10 +122,10 @@ void -sig_child_handler () +sig_child_handler (XtPointer closure, XtSignalId id) { - int pid; + int pid, olderrno = errno; #if !defined(USE_POSIX_WAIT) && (defined(USE_SYSV_SIGNALS) && \ (defined(CRAY) || !defined(SIGTSTP))) @@ -148,11 +159,18 @@ #endif /* USE_POSIX_WAIT else */ } while (pid > 0); + errno = olderrno; } +void +sig_term_handler(int sig) +{ + XtNoticeSignal(sig_term_id); +} + void -sig_term_handler () +xt_sig_term_handler (XtPointer closure, XtSignalId *id) { wantShutdown = 1; @@ -160,9 +178,13 @@ DoSave (SmSaveLocal, SmInteractStyleNone, 1 /* fast */); } +void sig_usr1_handler(int sig) +{ + XtNoticeSignal(sig_usr1_id); +} void -sig_usr1_handler () +xt_sig_usr1_handler (XtPointer closure, XtSignalId *id) { wantShutdown = 0; @@ -173,7 +195,7 @@ void -register_signals () +register_signals (XtAppContext appContext) { /* @@ -195,6 +217,7 @@ */ Signal (SIGTERM, sig_term_handler); + sig_term_id = XtAppAddSignal(appContext, xt_sig_term_handler, NULL); /* @@ -202,6 +225,7 @@ */ Signal (SIGUSR1, sig_usr1_handler); + sig_usr1_id = XtAppAddSignal(appContext, xt_sig_usr1_handler, NULL); } Index: xc/programs/xsm/xsm.c diff -u xc/programs/xsm/xsm.c:1.7 xc/programs/xsm/xsm.c:1.9 --- xc/programs/xsm/xsm.c:1.7 Wed Jan 17 18:46:31 2001 +++ xc/programs/xsm/xsm.c Fri Dec 14 15:02:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xsm.c,v 1.6 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: xsm.c,v 1.7 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.7 2001/01/17 23:46:31 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/xsm.c,v 1.9 2001/12/14 20:02:27 dawes Exp $ */ /* * X Session Manager. @@ -96,6 +100,7 @@ extern Widget shutdownButton; extern Widget clientListWidget; extern Widget savePopup; +extern XtSignalId sig_term_id, sig_usr1_id; extern int checkpoint_from_signal; @@ -155,7 +160,7 @@ wmDeleteAtom = XInternAtom ( XtDisplay (topLevel), "WM_DELETE_WINDOW", False); - register_signals (); + register_signals (appContext); /* Index: xc/programs/xsm/xsm.h diff -u xc/programs/xsm/xsm.h:1.4 xc/programs/xsm/xsm.h:1.8 --- xc/programs/xsm/xsm.h:1.4 Wed Jan 17 18:46:31 2001 +++ xc/programs/xsm/xsm.h Fri Dec 14 15:02:27 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xsm.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: xsm.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,8 +23,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/xsm/xsm.h,v 1.4 2001/01/17 23:46:31 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/xsm.h,v 1.8 2001/12/14 20:02:27 dawes Exp $ */ +#ifndef _XSM_H_ +#define _XSM_H_ + #include <X11/Xos.h> #include <X11/Xfuncs.h> @@ -53,9 +60,7 @@ #endif #include <ctype.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include <X11/StringDefs.h> #include <X11/Intrinsic.h> @@ -181,11 +186,7 @@ extern void nomem(void); -#ifndef X_NOT_STDC_ENV #define Strstr strstr -#else -extern char *Strstr(); -#endif /* Fix ISC brain damage. When using gcc fdopen isn't declared in <stdio.h>. */ #if defined(ISC) && __STDC__ @@ -207,9 +208,11 @@ extern void sig_child_handler(void); extern void sig_term_handler(void); extern void sig_usr1_handler(void); -extern void register_signals(void); +extern void register_signals(XtAppContext); extern int execute_system_command(char *s); #ifdef XKB #include <X11/extensions/XKBbells.h> #endif + +#endif /* _XSM_H_ */ Index: xc/programs/xsm/xsm.man diff -u xc/programs/xsm/xsm.man:1.6 xc/programs/xsm/xsm.man:1.7 --- xc/programs/xsm/xsm.man:1.6 Sat Jan 27 13:21:24 2001 +++ xc/programs/xsm/xsm.man Fri Dec 14 15:02:28 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xsm.man,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ +.\" $Xorg: xsm.man,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ .\" Copyright 1994,1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xsm/xsm.man,v 1.6 2001/01/27 18:21:24 dawes Exp $ +.\" $XFree86: xc/programs/xsm/xsm.man,v 1.7 2001/12/14 20:02:28 dawes Exp $ .\" .TH XSM 1 __xorgversion__ .SH NAME Index: xc/programs/xsm/xtwatch.c diff -u xc/programs/xsm/xtwatch.c:1.4 xc/programs/xsm/xtwatch.c:1.5 --- xc/programs/xsm/xtwatch.c:1.4 Wed Jan 17 18:46:31 2001 +++ xc/programs/xsm/xtwatch.c Fri Dec 14 15:02:28 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xtwatch.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: xtwatch.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,7 +23,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.4 2001/01/17 23:46:31 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/xtwatch.c,v 1.5 2001/12/14 20:02:28 dawes Exp $ */ #include <X11/ICE/ICElib.h> #include <X11/Intrinsic.h> Index: xc/programs/xsm/xtwatch.h diff -u xc/programs/xsm/xtwatch.h:1.4 xc/programs/xsm/xtwatch.h:1.6 --- xc/programs/xsm/xtwatch.h:1.4 Wed Jan 17 18:46:31 2001 +++ xc/programs/xsm/xtwatch.h Fri Dec 14 15:02:28 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xtwatch.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ +/* $Xorg: xtwatch.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -19,6 +23,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/xsm/xtwatch.h,v 1.4 2001/01/17 23:46:31 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/xtwatch.h,v 1.6 2001/12/14 20:02:28 dawes Exp $ */ +#ifndef _XTWATCH_H_ +#define _XTWATCH_H_ + +#include <X11/Intrinsic.h> + extern Status InitWatchProcs(XtAppContext appContext); + +#endif Index: xc/programs/xstdcmap/xstdcmap.c diff -u xc/programs/xstdcmap/xstdcmap.c:1.6 xc/programs/xstdcmap/xstdcmap.c:1.8 --- xc/programs/xstdcmap/xstdcmap.c:1.6 Sun Apr 1 10:00:24 2001 +++ xc/programs/xstdcmap/xstdcmap.c Fri Dec 14 15:02:30 2001 @@ -1,10 +1,14 @@ /* - * $Xorg: xstdcmap.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ + * $Xorg: xstdcmap.c,v 1.5 2001/02/09 02:06:01 xorgcvs Exp $ * * Copyright 1989, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * * * Author: Donna Converse, MIT X Consortium */ -/* $XFree86: xc/programs/xstdcmap/xstdcmap.c,v 1.6 2001/04/01 14:00:24 tsi Exp $ */ +/* $XFree86: xc/programs/xstdcmap/xstdcmap.c,v 1.8 2001/12/14 20:02:30 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -32,10 +36,6 @@ #include <X11/Xresource.h> #include <X11/Xatom.h> #include <X11/Xmu/StdCmap.h> - -#ifdef X_NOT_STDC_ENV -extern void exit(); -#endif #define REPLACE 1 #define DO_NOT_REPLACE 0 Index: xc/programs/xstdcmap/xstdcmap.man diff -u xc/programs/xstdcmap/xstdcmap.man:1.7 xc/programs/xstdcmap/xstdcmap.man:1.8 --- xc/programs/xstdcmap/xstdcmap.man:1.7 Sat Jan 27 13:21:24 2001 +++ xc/programs/xstdcmap/xstdcmap.man Fri Dec 14 15:02:30 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xstdcmap.man,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ +.\" $Xorg: xstdcmap.man,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ .\" Copyright 1989, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" 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 $ +.\" $XFree86: xc/programs/xstdcmap/xstdcmap.man,v 1.8 2001/12/14 20:02:30 dawes Exp $ .\" .de EX \"Begin example .ne 5 Index: xc/programs/xterm/256colres.h diff -u xc/programs/xterm/256colres.h:1.2 xc/programs/xterm/256colres.h:1.3 --- xc/programs/xterm/256colres.h:1.2 Thu Feb 10 13:57:34 2000 +++ xc/programs/xterm/256colres.h Mon Jun 18 15:09:24 2001 @@ -1,244 +1,244 @@ /* * This header file was generated by ./256colres.pl */ -/* $XFree86: xc/programs/xterm/256colres.h,v 1.2 2000/02/10 18:57:34 dawes Exp $ */ -COLOR_RES("color16", screen.Acolors[16], DFT_COLOR("rgb:00/00/00")), -COLOR_RES("color17", screen.Acolors[17], DFT_COLOR("rgb:00/00/2a")), -COLOR_RES("color18", screen.Acolors[18], DFT_COLOR("rgb:00/00/55")), -COLOR_RES("color19", screen.Acolors[19], DFT_COLOR("rgb:00/00/7f")), -COLOR_RES("color20", screen.Acolors[20], DFT_COLOR("rgb:00/00/aa")), -COLOR_RES("color21", screen.Acolors[21], DFT_COLOR("rgb:00/00/d4")), -COLOR_RES("color22", screen.Acolors[22], DFT_COLOR("rgb:00/2a/00")), -COLOR_RES("color23", screen.Acolors[23], DFT_COLOR("rgb:00/2a/2a")), -COLOR_RES("color24", screen.Acolors[24], DFT_COLOR("rgb:00/2a/55")), -COLOR_RES("color25", screen.Acolors[25], DFT_COLOR("rgb:00/2a/7f")), -COLOR_RES("color26", screen.Acolors[26], DFT_COLOR("rgb:00/2a/aa")), -COLOR_RES("color27", screen.Acolors[27], DFT_COLOR("rgb:00/2a/d4")), -COLOR_RES("color28", screen.Acolors[28], DFT_COLOR("rgb:00/55/00")), -COLOR_RES("color29", screen.Acolors[29], DFT_COLOR("rgb:00/55/2a")), -COLOR_RES("color30", screen.Acolors[30], DFT_COLOR("rgb:00/55/55")), -COLOR_RES("color31", screen.Acolors[31], DFT_COLOR("rgb:00/55/7f")), -COLOR_RES("color32", screen.Acolors[32], DFT_COLOR("rgb:00/55/aa")), -COLOR_RES("color33", screen.Acolors[33], DFT_COLOR("rgb:00/55/d4")), -COLOR_RES("color34", screen.Acolors[34], DFT_COLOR("rgb:00/7f/00")), -COLOR_RES("color35", screen.Acolors[35], DFT_COLOR("rgb:00/7f/2a")), -COLOR_RES("color36", screen.Acolors[36], DFT_COLOR("rgb:00/7f/55")), -COLOR_RES("color37", screen.Acolors[37], DFT_COLOR("rgb:00/7f/7f")), -COLOR_RES("color38", screen.Acolors[38], DFT_COLOR("rgb:00/7f/aa")), -COLOR_RES("color39", screen.Acolors[39], DFT_COLOR("rgb:00/7f/d4")), -COLOR_RES("color40", screen.Acolors[40], DFT_COLOR("rgb:00/aa/00")), -COLOR_RES("color41", screen.Acolors[41], DFT_COLOR("rgb:00/aa/2a")), -COLOR_RES("color42", screen.Acolors[42], DFT_COLOR("rgb:00/aa/55")), -COLOR_RES("color43", screen.Acolors[43], DFT_COLOR("rgb:00/aa/7f")), -COLOR_RES("color44", screen.Acolors[44], DFT_COLOR("rgb:00/aa/aa")), -COLOR_RES("color45", screen.Acolors[45], DFT_COLOR("rgb:00/aa/d4")), -COLOR_RES("color46", screen.Acolors[46], DFT_COLOR("rgb:00/d4/00")), -COLOR_RES("color47", screen.Acolors[47], DFT_COLOR("rgb:00/d4/2a")), -COLOR_RES("color48", screen.Acolors[48], DFT_COLOR("rgb:00/d4/55")), -COLOR_RES("color49", screen.Acolors[49], DFT_COLOR("rgb:00/d4/7f")), -COLOR_RES("color50", screen.Acolors[50], DFT_COLOR("rgb:00/d4/aa")), -COLOR_RES("color51", screen.Acolors[51], DFT_COLOR("rgb:00/d4/d4")), -COLOR_RES("color52", screen.Acolors[52], DFT_COLOR("rgb:2a/00/00")), -COLOR_RES("color53", screen.Acolors[53], DFT_COLOR("rgb:2a/00/2a")), -COLOR_RES("color54", screen.Acolors[54], DFT_COLOR("rgb:2a/00/55")), -COLOR_RES("color55", screen.Acolors[55], DFT_COLOR("rgb:2a/00/7f")), -COLOR_RES("color56", screen.Acolors[56], DFT_COLOR("rgb:2a/00/aa")), -COLOR_RES("color57", screen.Acolors[57], DFT_COLOR("rgb:2a/00/d4")), -COLOR_RES("color58", screen.Acolors[58], DFT_COLOR("rgb:2a/2a/00")), -COLOR_RES("color59", screen.Acolors[59], DFT_COLOR("rgb:2a/2a/2a")), -COLOR_RES("color60", screen.Acolors[60], DFT_COLOR("rgb:2a/2a/55")), -COLOR_RES("color61", screen.Acolors[61], DFT_COLOR("rgb:2a/2a/7f")), -COLOR_RES("color62", screen.Acolors[62], DFT_COLOR("rgb:2a/2a/aa")), -COLOR_RES("color63", screen.Acolors[63], DFT_COLOR("rgb:2a/2a/d4")), -COLOR_RES("color64", screen.Acolors[64], DFT_COLOR("rgb:2a/55/00")), -COLOR_RES("color65", screen.Acolors[65], DFT_COLOR("rgb:2a/55/2a")), -COLOR_RES("color66", screen.Acolors[66], DFT_COLOR("rgb:2a/55/55")), -COLOR_RES("color67", screen.Acolors[67], DFT_COLOR("rgb:2a/55/7f")), -COLOR_RES("color68", screen.Acolors[68], DFT_COLOR("rgb:2a/55/aa")), -COLOR_RES("color69", screen.Acolors[69], DFT_COLOR("rgb:2a/55/d4")), -COLOR_RES("color70", screen.Acolors[70], DFT_COLOR("rgb:2a/7f/00")), -COLOR_RES("color71", screen.Acolors[71], DFT_COLOR("rgb:2a/7f/2a")), -COLOR_RES("color72", screen.Acolors[72], DFT_COLOR("rgb:2a/7f/55")), -COLOR_RES("color73", screen.Acolors[73], DFT_COLOR("rgb:2a/7f/7f")), -COLOR_RES("color74", screen.Acolors[74], DFT_COLOR("rgb:2a/7f/aa")), -COLOR_RES("color75", screen.Acolors[75], DFT_COLOR("rgb:2a/7f/d4")), -COLOR_RES("color76", screen.Acolors[76], DFT_COLOR("rgb:2a/aa/00")), -COLOR_RES("color77", screen.Acolors[77], DFT_COLOR("rgb:2a/aa/2a")), -COLOR_RES("color78", screen.Acolors[78], DFT_COLOR("rgb:2a/aa/55")), -COLOR_RES("color79", screen.Acolors[79], DFT_COLOR("rgb:2a/aa/7f")), -COLOR_RES("color80", screen.Acolors[80], DFT_COLOR("rgb:2a/aa/aa")), -COLOR_RES("color81", screen.Acolors[81], DFT_COLOR("rgb:2a/aa/d4")), -COLOR_RES("color82", screen.Acolors[82], DFT_COLOR("rgb:2a/d4/00")), -COLOR_RES("color83", screen.Acolors[83], DFT_COLOR("rgb:2a/d4/2a")), -COLOR_RES("color84", screen.Acolors[84], DFT_COLOR("rgb:2a/d4/55")), -COLOR_RES("color85", screen.Acolors[85], DFT_COLOR("rgb:2a/d4/7f")), -COLOR_RES("color86", screen.Acolors[86], DFT_COLOR("rgb:2a/d4/aa")), -COLOR_RES("color87", screen.Acolors[87], DFT_COLOR("rgb:2a/d4/d4")), -COLOR_RES("color88", screen.Acolors[88], DFT_COLOR("rgb:55/00/00")), -COLOR_RES("color89", screen.Acolors[89], DFT_COLOR("rgb:55/00/2a")), -COLOR_RES("color90", screen.Acolors[90], DFT_COLOR("rgb:55/00/55")), -COLOR_RES("color91", screen.Acolors[91], DFT_COLOR("rgb:55/00/7f")), -COLOR_RES("color92", screen.Acolors[92], DFT_COLOR("rgb:55/00/aa")), -COLOR_RES("color93", screen.Acolors[93], DFT_COLOR("rgb:55/00/d4")), -COLOR_RES("color94", screen.Acolors[94], DFT_COLOR("rgb:55/2a/00")), -COLOR_RES("color95", screen.Acolors[95], DFT_COLOR("rgb:55/2a/2a")), -COLOR_RES("color96", screen.Acolors[96], DFT_COLOR("rgb:55/2a/55")), -COLOR_RES("color97", screen.Acolors[97], DFT_COLOR("rgb:55/2a/7f")), -COLOR_RES("color98", screen.Acolors[98], DFT_COLOR("rgb:55/2a/aa")), -COLOR_RES("color99", screen.Acolors[99], DFT_COLOR("rgb:55/2a/d4")), -COLOR_RES("color100", screen.Acolors[100], DFT_COLOR("rgb:55/55/00")), -COLOR_RES("color101", screen.Acolors[101], DFT_COLOR("rgb:55/55/2a")), -COLOR_RES("color102", screen.Acolors[102], DFT_COLOR("rgb:55/55/55")), -COLOR_RES("color103", screen.Acolors[103], DFT_COLOR("rgb:55/55/7f")), -COLOR_RES("color104", screen.Acolors[104], DFT_COLOR("rgb:55/55/aa")), -COLOR_RES("color105", screen.Acolors[105], DFT_COLOR("rgb:55/55/d4")), -COLOR_RES("color106", screen.Acolors[106], DFT_COLOR("rgb:55/7f/00")), -COLOR_RES("color107", screen.Acolors[107], DFT_COLOR("rgb:55/7f/2a")), -COLOR_RES("color108", screen.Acolors[108], DFT_COLOR("rgb:55/7f/55")), -COLOR_RES("color109", screen.Acolors[109], DFT_COLOR("rgb:55/7f/7f")), -COLOR_RES("color110", screen.Acolors[110], DFT_COLOR("rgb:55/7f/aa")), -COLOR_RES("color111", screen.Acolors[111], DFT_COLOR("rgb:55/7f/d4")), -COLOR_RES("color112", screen.Acolors[112], DFT_COLOR("rgb:55/aa/00")), -COLOR_RES("color113", screen.Acolors[113], DFT_COLOR("rgb:55/aa/2a")), -COLOR_RES("color114", screen.Acolors[114], DFT_COLOR("rgb:55/aa/55")), -COLOR_RES("color115", screen.Acolors[115], DFT_COLOR("rgb:55/aa/7f")), -COLOR_RES("color116", screen.Acolors[116], DFT_COLOR("rgb:55/aa/aa")), -COLOR_RES("color117", screen.Acolors[117], DFT_COLOR("rgb:55/aa/d4")), -COLOR_RES("color118", screen.Acolors[118], DFT_COLOR("rgb:55/d4/00")), -COLOR_RES("color119", screen.Acolors[119], DFT_COLOR("rgb:55/d4/2a")), -COLOR_RES("color120", screen.Acolors[120], DFT_COLOR("rgb:55/d4/55")), -COLOR_RES("color121", screen.Acolors[121], DFT_COLOR("rgb:55/d4/7f")), -COLOR_RES("color122", screen.Acolors[122], DFT_COLOR("rgb:55/d4/aa")), -COLOR_RES("color123", screen.Acolors[123], DFT_COLOR("rgb:55/d4/d4")), -COLOR_RES("color124", screen.Acolors[124], DFT_COLOR("rgb:7f/00/00")), -COLOR_RES("color125", screen.Acolors[125], DFT_COLOR("rgb:7f/00/2a")), -COLOR_RES("color126", screen.Acolors[126], DFT_COLOR("rgb:7f/00/55")), -COLOR_RES("color127", screen.Acolors[127], DFT_COLOR("rgb:7f/00/7f")), -COLOR_RES("color128", screen.Acolors[128], DFT_COLOR("rgb:7f/00/aa")), -COLOR_RES("color129", screen.Acolors[129], DFT_COLOR("rgb:7f/00/d4")), -COLOR_RES("color130", screen.Acolors[130], DFT_COLOR("rgb:7f/2a/00")), -COLOR_RES("color131", screen.Acolors[131], DFT_COLOR("rgb:7f/2a/2a")), -COLOR_RES("color132", screen.Acolors[132], DFT_COLOR("rgb:7f/2a/55")), -COLOR_RES("color133", screen.Acolors[133], DFT_COLOR("rgb:7f/2a/7f")), -COLOR_RES("color134", screen.Acolors[134], DFT_COLOR("rgb:7f/2a/aa")), -COLOR_RES("color135", screen.Acolors[135], DFT_COLOR("rgb:7f/2a/d4")), -COLOR_RES("color136", screen.Acolors[136], DFT_COLOR("rgb:7f/55/00")), -COLOR_RES("color137", screen.Acolors[137], DFT_COLOR("rgb:7f/55/2a")), -COLOR_RES("color138", screen.Acolors[138], DFT_COLOR("rgb:7f/55/55")), -COLOR_RES("color139", screen.Acolors[139], DFT_COLOR("rgb:7f/55/7f")), -COLOR_RES("color140", screen.Acolors[140], DFT_COLOR("rgb:7f/55/aa")), -COLOR_RES("color141", screen.Acolors[141], DFT_COLOR("rgb:7f/55/d4")), -COLOR_RES("color142", screen.Acolors[142], DFT_COLOR("rgb:7f/7f/00")), -COLOR_RES("color143", screen.Acolors[143], DFT_COLOR("rgb:7f/7f/2a")), -COLOR_RES("color144", screen.Acolors[144], DFT_COLOR("rgb:7f/7f/55")), -COLOR_RES("color145", screen.Acolors[145], DFT_COLOR("rgb:7f/7f/7f")), -COLOR_RES("color146", screen.Acolors[146], DFT_COLOR("rgb:7f/7f/aa")), -COLOR_RES("color147", screen.Acolors[147], DFT_COLOR("rgb:7f/7f/d4")), -COLOR_RES("color148", screen.Acolors[148], DFT_COLOR("rgb:7f/aa/00")), -COLOR_RES("color149", screen.Acolors[149], DFT_COLOR("rgb:7f/aa/2a")), -COLOR_RES("color150", screen.Acolors[150], DFT_COLOR("rgb:7f/aa/55")), -COLOR_RES("color151", screen.Acolors[151], DFT_COLOR("rgb:7f/aa/7f")), -COLOR_RES("color152", screen.Acolors[152], DFT_COLOR("rgb:7f/aa/aa")), -COLOR_RES("color153", screen.Acolors[153], DFT_COLOR("rgb:7f/aa/d4")), -COLOR_RES("color154", screen.Acolors[154], DFT_COLOR("rgb:7f/d4/00")), -COLOR_RES("color155", screen.Acolors[155], DFT_COLOR("rgb:7f/d4/2a")), -COLOR_RES("color156", screen.Acolors[156], DFT_COLOR("rgb:7f/d4/55")), -COLOR_RES("color157", screen.Acolors[157], DFT_COLOR("rgb:7f/d4/7f")), -COLOR_RES("color158", screen.Acolors[158], DFT_COLOR("rgb:7f/d4/aa")), -COLOR_RES("color159", screen.Acolors[159], DFT_COLOR("rgb:7f/d4/d4")), -COLOR_RES("color160", screen.Acolors[160], DFT_COLOR("rgb:aa/00/00")), -COLOR_RES("color161", screen.Acolors[161], DFT_COLOR("rgb:aa/00/2a")), -COLOR_RES("color162", screen.Acolors[162], DFT_COLOR("rgb:aa/00/55")), -COLOR_RES("color163", screen.Acolors[163], DFT_COLOR("rgb:aa/00/7f")), -COLOR_RES("color164", screen.Acolors[164], DFT_COLOR("rgb:aa/00/aa")), -COLOR_RES("color165", screen.Acolors[165], DFT_COLOR("rgb:aa/00/d4")), -COLOR_RES("color166", screen.Acolors[166], DFT_COLOR("rgb:aa/2a/00")), -COLOR_RES("color167", screen.Acolors[167], DFT_COLOR("rgb:aa/2a/2a")), -COLOR_RES("color168", screen.Acolors[168], DFT_COLOR("rgb:aa/2a/55")), -COLOR_RES("color169", screen.Acolors[169], DFT_COLOR("rgb:aa/2a/7f")), -COLOR_RES("color170", screen.Acolors[170], DFT_COLOR("rgb:aa/2a/aa")), -COLOR_RES("color171", screen.Acolors[171], DFT_COLOR("rgb:aa/2a/d4")), -COLOR_RES("color172", screen.Acolors[172], DFT_COLOR("rgb:aa/55/00")), -COLOR_RES("color173", screen.Acolors[173], DFT_COLOR("rgb:aa/55/2a")), -COLOR_RES("color174", screen.Acolors[174], DFT_COLOR("rgb:aa/55/55")), -COLOR_RES("color175", screen.Acolors[175], DFT_COLOR("rgb:aa/55/7f")), -COLOR_RES("color176", screen.Acolors[176], DFT_COLOR("rgb:aa/55/aa")), -COLOR_RES("color177", screen.Acolors[177], DFT_COLOR("rgb:aa/55/d4")), -COLOR_RES("color178", screen.Acolors[178], DFT_COLOR("rgb:aa/7f/00")), -COLOR_RES("color179", screen.Acolors[179], DFT_COLOR("rgb:aa/7f/2a")), -COLOR_RES("color180", screen.Acolors[180], DFT_COLOR("rgb:aa/7f/55")), -COLOR_RES("color181", screen.Acolors[181], DFT_COLOR("rgb:aa/7f/7f")), -COLOR_RES("color182", screen.Acolors[182], DFT_COLOR("rgb:aa/7f/aa")), -COLOR_RES("color183", screen.Acolors[183], DFT_COLOR("rgb:aa/7f/d4")), -COLOR_RES("color184", screen.Acolors[184], DFT_COLOR("rgb:aa/aa/00")), -COLOR_RES("color185", screen.Acolors[185], DFT_COLOR("rgb:aa/aa/2a")), -COLOR_RES("color186", screen.Acolors[186], DFT_COLOR("rgb:aa/aa/55")), -COLOR_RES("color187", screen.Acolors[187], DFT_COLOR("rgb:aa/aa/7f")), -COLOR_RES("color188", screen.Acolors[188], DFT_COLOR("rgb:aa/aa/aa")), -COLOR_RES("color189", screen.Acolors[189], DFT_COLOR("rgb:aa/aa/d4")), -COLOR_RES("color190", screen.Acolors[190], DFT_COLOR("rgb:aa/d4/00")), -COLOR_RES("color191", screen.Acolors[191], DFT_COLOR("rgb:aa/d4/2a")), -COLOR_RES("color192", screen.Acolors[192], DFT_COLOR("rgb:aa/d4/55")), -COLOR_RES("color193", screen.Acolors[193], DFT_COLOR("rgb:aa/d4/7f")), -COLOR_RES("color194", screen.Acolors[194], DFT_COLOR("rgb:aa/d4/aa")), -COLOR_RES("color195", screen.Acolors[195], DFT_COLOR("rgb:aa/d4/d4")), -COLOR_RES("color196", screen.Acolors[196], DFT_COLOR("rgb:d4/00/00")), -COLOR_RES("color197", screen.Acolors[197], DFT_COLOR("rgb:d4/00/2a")), -COLOR_RES("color198", screen.Acolors[198], DFT_COLOR("rgb:d4/00/55")), -COLOR_RES("color199", screen.Acolors[199], DFT_COLOR("rgb:d4/00/7f")), -COLOR_RES("color200", screen.Acolors[200], DFT_COLOR("rgb:d4/00/aa")), -COLOR_RES("color201", screen.Acolors[201], DFT_COLOR("rgb:d4/00/d4")), -COLOR_RES("color202", screen.Acolors[202], DFT_COLOR("rgb:d4/2a/00")), -COLOR_RES("color203", screen.Acolors[203], DFT_COLOR("rgb:d4/2a/2a")), -COLOR_RES("color204", screen.Acolors[204], DFT_COLOR("rgb:d4/2a/55")), -COLOR_RES("color205", screen.Acolors[205], DFT_COLOR("rgb:d4/2a/7f")), -COLOR_RES("color206", screen.Acolors[206], DFT_COLOR("rgb:d4/2a/aa")), -COLOR_RES("color207", screen.Acolors[207], DFT_COLOR("rgb:d4/2a/d4")), -COLOR_RES("color208", screen.Acolors[208], DFT_COLOR("rgb:d4/55/00")), -COLOR_RES("color209", screen.Acolors[209], DFT_COLOR("rgb:d4/55/2a")), -COLOR_RES("color210", screen.Acolors[210], DFT_COLOR("rgb:d4/55/55")), -COLOR_RES("color211", screen.Acolors[211], DFT_COLOR("rgb:d4/55/7f")), -COLOR_RES("color212", screen.Acolors[212], DFT_COLOR("rgb:d4/55/aa")), -COLOR_RES("color213", screen.Acolors[213], DFT_COLOR("rgb:d4/55/d4")), -COLOR_RES("color214", screen.Acolors[214], DFT_COLOR("rgb:d4/7f/00")), -COLOR_RES("color215", screen.Acolors[215], DFT_COLOR("rgb:d4/7f/2a")), -COLOR_RES("color216", screen.Acolors[216], DFT_COLOR("rgb:d4/7f/55")), -COLOR_RES("color217", screen.Acolors[217], DFT_COLOR("rgb:d4/7f/7f")), -COLOR_RES("color218", screen.Acolors[218], DFT_COLOR("rgb:d4/7f/aa")), -COLOR_RES("color219", screen.Acolors[219], DFT_COLOR("rgb:d4/7f/d4")), -COLOR_RES("color220", screen.Acolors[220], DFT_COLOR("rgb:d4/aa/00")), -COLOR_RES("color221", screen.Acolors[221], DFT_COLOR("rgb:d4/aa/2a")), -COLOR_RES("color222", screen.Acolors[222], DFT_COLOR("rgb:d4/aa/55")), -COLOR_RES("color223", screen.Acolors[223], DFT_COLOR("rgb:d4/aa/7f")), -COLOR_RES("color224", screen.Acolors[224], DFT_COLOR("rgb:d4/aa/aa")), -COLOR_RES("color225", screen.Acolors[225], DFT_COLOR("rgb:d4/aa/d4")), -COLOR_RES("color226", screen.Acolors[226], DFT_COLOR("rgb:d4/d4/00")), -COLOR_RES("color227", screen.Acolors[227], DFT_COLOR("rgb:d4/d4/2a")), -COLOR_RES("color228", screen.Acolors[228], DFT_COLOR("rgb:d4/d4/55")), -COLOR_RES("color229", screen.Acolors[229], DFT_COLOR("rgb:d4/d4/7f")), -COLOR_RES("color230", screen.Acolors[230], DFT_COLOR("rgb:d4/d4/aa")), -COLOR_RES("color231", screen.Acolors[231], DFT_COLOR("rgb:d4/d4/d4")), -COLOR_RES("color232", screen.Acolors[232], DFT_COLOR("rgb:08/08/08")), -COLOR_RES("color233", screen.Acolors[233], DFT_COLOR("rgb:12/12/12")), -COLOR_RES("color234", screen.Acolors[234], DFT_COLOR("rgb:1c/1c/1c")), -COLOR_RES("color235", screen.Acolors[235], DFT_COLOR("rgb:26/26/26")), -COLOR_RES("color236", screen.Acolors[236], DFT_COLOR("rgb:30/30/30")), -COLOR_RES("color237", screen.Acolors[237], DFT_COLOR("rgb:3a/3a/3a")), -COLOR_RES("color238", screen.Acolors[238], DFT_COLOR("rgb:44/44/44")), -COLOR_RES("color239", screen.Acolors[239], DFT_COLOR("rgb:4e/4e/4e")), -COLOR_RES("color240", screen.Acolors[240], DFT_COLOR("rgb:58/58/58")), -COLOR_RES("color241", screen.Acolors[241], DFT_COLOR("rgb:62/62/62")), -COLOR_RES("color242", screen.Acolors[242], DFT_COLOR("rgb:6c/6c/6c")), -COLOR_RES("color243", screen.Acolors[243], DFT_COLOR("rgb:76/76/76")), -COLOR_RES("color244", screen.Acolors[244], DFT_COLOR("rgb:80/80/80")), -COLOR_RES("color245", screen.Acolors[245], DFT_COLOR("rgb:8a/8a/8a")), -COLOR_RES("color246", screen.Acolors[246], DFT_COLOR("rgb:94/94/94")), -COLOR_RES("color247", screen.Acolors[247], DFT_COLOR("rgb:9e/9e/9e")), -COLOR_RES("color248", screen.Acolors[248], DFT_COLOR("rgb:a8/a8/a8")), -COLOR_RES("color249", screen.Acolors[249], DFT_COLOR("rgb:b2/b2/b2")), -COLOR_RES("color250", screen.Acolors[250], DFT_COLOR("rgb:bc/bc/bc")), -COLOR_RES("color251", screen.Acolors[251], DFT_COLOR("rgb:c6/c6/c6")), -COLOR_RES("color252", screen.Acolors[252], DFT_COLOR("rgb:d0/d0/d0")), -COLOR_RES("color253", screen.Acolors[253], DFT_COLOR("rgb:da/da/da")), -COLOR_RES("color254", screen.Acolors[254], DFT_COLOR("rgb:e4/e4/e4")), -COLOR_RES("color255", screen.Acolors[255], DFT_COLOR("rgb:ee/ee/ee")), +/* $XFree86: xc/programs/xterm/256colres.h,v 1.3 2001/06/18 19:09:24 dickey Exp $ */ +COLOR_RES("16", screen.Acolors[16], DFT_COLOR("rgb:00/00/00")), +COLOR_RES("17", screen.Acolors[17], DFT_COLOR("rgb:00/00/2a")), +COLOR_RES("18", screen.Acolors[18], DFT_COLOR("rgb:00/00/55")), +COLOR_RES("19", screen.Acolors[19], DFT_COLOR("rgb:00/00/7f")), +COLOR_RES("20", screen.Acolors[20], DFT_COLOR("rgb:00/00/aa")), +COLOR_RES("21", screen.Acolors[21], DFT_COLOR("rgb:00/00/d4")), +COLOR_RES("22", screen.Acolors[22], DFT_COLOR("rgb:00/2a/00")), +COLOR_RES("23", screen.Acolors[23], DFT_COLOR("rgb:00/2a/2a")), +COLOR_RES("24", screen.Acolors[24], DFT_COLOR("rgb:00/2a/55")), +COLOR_RES("25", screen.Acolors[25], DFT_COLOR("rgb:00/2a/7f")), +COLOR_RES("26", screen.Acolors[26], DFT_COLOR("rgb:00/2a/aa")), +COLOR_RES("27", screen.Acolors[27], DFT_COLOR("rgb:00/2a/d4")), +COLOR_RES("28", screen.Acolors[28], DFT_COLOR("rgb:00/55/00")), +COLOR_RES("29", screen.Acolors[29], DFT_COLOR("rgb:00/55/2a")), +COLOR_RES("30", screen.Acolors[30], DFT_COLOR("rgb:00/55/55")), +COLOR_RES("31", screen.Acolors[31], DFT_COLOR("rgb:00/55/7f")), +COLOR_RES("32", screen.Acolors[32], DFT_COLOR("rgb:00/55/aa")), +COLOR_RES("33", screen.Acolors[33], DFT_COLOR("rgb:00/55/d4")), +COLOR_RES("34", screen.Acolors[34], DFT_COLOR("rgb:00/7f/00")), +COLOR_RES("35", screen.Acolors[35], DFT_COLOR("rgb:00/7f/2a")), +COLOR_RES("36", screen.Acolors[36], DFT_COLOR("rgb:00/7f/55")), +COLOR_RES("37", screen.Acolors[37], DFT_COLOR("rgb:00/7f/7f")), +COLOR_RES("38", screen.Acolors[38], DFT_COLOR("rgb:00/7f/aa")), +COLOR_RES("39", screen.Acolors[39], DFT_COLOR("rgb:00/7f/d4")), +COLOR_RES("40", screen.Acolors[40], DFT_COLOR("rgb:00/aa/00")), +COLOR_RES("41", screen.Acolors[41], DFT_COLOR("rgb:00/aa/2a")), +COLOR_RES("42", screen.Acolors[42], DFT_COLOR("rgb:00/aa/55")), +COLOR_RES("43", screen.Acolors[43], DFT_COLOR("rgb:00/aa/7f")), +COLOR_RES("44", screen.Acolors[44], DFT_COLOR("rgb:00/aa/aa")), +COLOR_RES("45", screen.Acolors[45], DFT_COLOR("rgb:00/aa/d4")), +COLOR_RES("46", screen.Acolors[46], DFT_COLOR("rgb:00/d4/00")), +COLOR_RES("47", screen.Acolors[47], DFT_COLOR("rgb:00/d4/2a")), +COLOR_RES("48", screen.Acolors[48], DFT_COLOR("rgb:00/d4/55")), +COLOR_RES("49", screen.Acolors[49], DFT_COLOR("rgb:00/d4/7f")), +COLOR_RES("50", screen.Acolors[50], DFT_COLOR("rgb:00/d4/aa")), +COLOR_RES("51", screen.Acolors[51], DFT_COLOR("rgb:00/d4/d4")), +COLOR_RES("52", screen.Acolors[52], DFT_COLOR("rgb:2a/00/00")), +COLOR_RES("53", screen.Acolors[53], DFT_COLOR("rgb:2a/00/2a")), +COLOR_RES("54", screen.Acolors[54], DFT_COLOR("rgb:2a/00/55")), +COLOR_RES("55", screen.Acolors[55], DFT_COLOR("rgb:2a/00/7f")), +COLOR_RES("56", screen.Acolors[56], DFT_COLOR("rgb:2a/00/aa")), +COLOR_RES("57", screen.Acolors[57], DFT_COLOR("rgb:2a/00/d4")), +COLOR_RES("58", screen.Acolors[58], DFT_COLOR("rgb:2a/2a/00")), +COLOR_RES("59", screen.Acolors[59], DFT_COLOR("rgb:2a/2a/2a")), +COLOR_RES("60", screen.Acolors[60], DFT_COLOR("rgb:2a/2a/55")), +COLOR_RES("61", screen.Acolors[61], DFT_COLOR("rgb:2a/2a/7f")), +COLOR_RES("62", screen.Acolors[62], DFT_COLOR("rgb:2a/2a/aa")), +COLOR_RES("63", screen.Acolors[63], DFT_COLOR("rgb:2a/2a/d4")), +COLOR_RES("64", screen.Acolors[64], DFT_COLOR("rgb:2a/55/00")), +COLOR_RES("65", screen.Acolors[65], DFT_COLOR("rgb:2a/55/2a")), +COLOR_RES("66", screen.Acolors[66], DFT_COLOR("rgb:2a/55/55")), +COLOR_RES("67", screen.Acolors[67], DFT_COLOR("rgb:2a/55/7f")), +COLOR_RES("68", screen.Acolors[68], DFT_COLOR("rgb:2a/55/aa")), +COLOR_RES("69", screen.Acolors[69], DFT_COLOR("rgb:2a/55/d4")), +COLOR_RES("70", screen.Acolors[70], DFT_COLOR("rgb:2a/7f/00")), +COLOR_RES("71", screen.Acolors[71], DFT_COLOR("rgb:2a/7f/2a")), +COLOR_RES("72", screen.Acolors[72], DFT_COLOR("rgb:2a/7f/55")), +COLOR_RES("73", screen.Acolors[73], DFT_COLOR("rgb:2a/7f/7f")), +COLOR_RES("74", screen.Acolors[74], DFT_COLOR("rgb:2a/7f/aa")), +COLOR_RES("75", screen.Acolors[75], DFT_COLOR("rgb:2a/7f/d4")), +COLOR_RES("76", screen.Acolors[76], DFT_COLOR("rgb:2a/aa/00")), +COLOR_RES("77", screen.Acolors[77], DFT_COLOR("rgb:2a/aa/2a")), +COLOR_RES("78", screen.Acolors[78], DFT_COLOR("rgb:2a/aa/55")), +COLOR_RES("79", screen.Acolors[79], DFT_COLOR("rgb:2a/aa/7f")), +COLOR_RES("80", screen.Acolors[80], DFT_COLOR("rgb:2a/aa/aa")), +COLOR_RES("81", screen.Acolors[81], DFT_COLOR("rgb:2a/aa/d4")), +COLOR_RES("82", screen.Acolors[82], DFT_COLOR("rgb:2a/d4/00")), +COLOR_RES("83", screen.Acolors[83], DFT_COLOR("rgb:2a/d4/2a")), +COLOR_RES("84", screen.Acolors[84], DFT_COLOR("rgb:2a/d4/55")), +COLOR_RES("85", screen.Acolors[85], DFT_COLOR("rgb:2a/d4/7f")), +COLOR_RES("86", screen.Acolors[86], DFT_COLOR("rgb:2a/d4/aa")), +COLOR_RES("87", screen.Acolors[87], DFT_COLOR("rgb:2a/d4/d4")), +COLOR_RES("88", screen.Acolors[88], DFT_COLOR("rgb:55/00/00")), +COLOR_RES("89", screen.Acolors[89], DFT_COLOR("rgb:55/00/2a")), +COLOR_RES("90", screen.Acolors[90], DFT_COLOR("rgb:55/00/55")), +COLOR_RES("91", screen.Acolors[91], DFT_COLOR("rgb:55/00/7f")), +COLOR_RES("92", screen.Acolors[92], DFT_COLOR("rgb:55/00/aa")), +COLOR_RES("93", screen.Acolors[93], DFT_COLOR("rgb:55/00/d4")), +COLOR_RES("94", screen.Acolors[94], DFT_COLOR("rgb:55/2a/00")), +COLOR_RES("95", screen.Acolors[95], DFT_COLOR("rgb:55/2a/2a")), +COLOR_RES("96", screen.Acolors[96], DFT_COLOR("rgb:55/2a/55")), +COLOR_RES("97", screen.Acolors[97], DFT_COLOR("rgb:55/2a/7f")), +COLOR_RES("98", screen.Acolors[98], DFT_COLOR("rgb:55/2a/aa")), +COLOR_RES("99", screen.Acolors[99], DFT_COLOR("rgb:55/2a/d4")), +COLOR_RES("100", screen.Acolors[100], DFT_COLOR("rgb:55/55/00")), +COLOR_RES("101", screen.Acolors[101], DFT_COLOR("rgb:55/55/2a")), +COLOR_RES("102", screen.Acolors[102], DFT_COLOR("rgb:55/55/55")), +COLOR_RES("103", screen.Acolors[103], DFT_COLOR("rgb:55/55/7f")), +COLOR_RES("104", screen.Acolors[104], DFT_COLOR("rgb:55/55/aa")), +COLOR_RES("105", screen.Acolors[105], DFT_COLOR("rgb:55/55/d4")), +COLOR_RES("106", screen.Acolors[106], DFT_COLOR("rgb:55/7f/00")), +COLOR_RES("107", screen.Acolors[107], DFT_COLOR("rgb:55/7f/2a")), +COLOR_RES("108", screen.Acolors[108], DFT_COLOR("rgb:55/7f/55")), +COLOR_RES("109", screen.Acolors[109], DFT_COLOR("rgb:55/7f/7f")), +COLOR_RES("110", screen.Acolors[110], DFT_COLOR("rgb:55/7f/aa")), +COLOR_RES("111", screen.Acolors[111], DFT_COLOR("rgb:55/7f/d4")), +COLOR_RES("112", screen.Acolors[112], DFT_COLOR("rgb:55/aa/00")), +COLOR_RES("113", screen.Acolors[113], DFT_COLOR("rgb:55/aa/2a")), +COLOR_RES("114", screen.Acolors[114], DFT_COLOR("rgb:55/aa/55")), +COLOR_RES("115", screen.Acolors[115], DFT_COLOR("rgb:55/aa/7f")), +COLOR_RES("116", screen.Acolors[116], DFT_COLOR("rgb:55/aa/aa")), +COLOR_RES("117", screen.Acolors[117], DFT_COLOR("rgb:55/aa/d4")), +COLOR_RES("118", screen.Acolors[118], DFT_COLOR("rgb:55/d4/00")), +COLOR_RES("119", screen.Acolors[119], DFT_COLOR("rgb:55/d4/2a")), +COLOR_RES("120", screen.Acolors[120], DFT_COLOR("rgb:55/d4/55")), +COLOR_RES("121", screen.Acolors[121], DFT_COLOR("rgb:55/d4/7f")), +COLOR_RES("122", screen.Acolors[122], DFT_COLOR("rgb:55/d4/aa")), +COLOR_RES("123", screen.Acolors[123], DFT_COLOR("rgb:55/d4/d4")), +COLOR_RES("124", screen.Acolors[124], DFT_COLOR("rgb:7f/00/00")), +COLOR_RES("125", screen.Acolors[125], DFT_COLOR("rgb:7f/00/2a")), +COLOR_RES("126", screen.Acolors[126], DFT_COLOR("rgb:7f/00/55")), +COLOR_RES("127", screen.Acolors[127], DFT_COLOR("rgb:7f/00/7f")), +COLOR_RES("128", screen.Acolors[128], DFT_COLOR("rgb:7f/00/aa")), +COLOR_RES("129", screen.Acolors[129], DFT_COLOR("rgb:7f/00/d4")), +COLOR_RES("130", screen.Acolors[130], DFT_COLOR("rgb:7f/2a/00")), +COLOR_RES("131", screen.Acolors[131], DFT_COLOR("rgb:7f/2a/2a")), +COLOR_RES("132", screen.Acolors[132], DFT_COLOR("rgb:7f/2a/55")), +COLOR_RES("133", screen.Acolors[133], DFT_COLOR("rgb:7f/2a/7f")), +COLOR_RES("134", screen.Acolors[134], DFT_COLOR("rgb:7f/2a/aa")), +COLOR_RES("135", screen.Acolors[135], DFT_COLOR("rgb:7f/2a/d4")), +COLOR_RES("136", screen.Acolors[136], DFT_COLOR("rgb:7f/55/00")), +COLOR_RES("137", screen.Acolors[137], DFT_COLOR("rgb:7f/55/2a")), +COLOR_RES("138", screen.Acolors[138], DFT_COLOR("rgb:7f/55/55")), +COLOR_RES("139", screen.Acolors[139], DFT_COLOR("rgb:7f/55/7f")), +COLOR_RES("140", screen.Acolors[140], DFT_COLOR("rgb:7f/55/aa")), +COLOR_RES("141", screen.Acolors[141], DFT_COLOR("rgb:7f/55/d4")), +COLOR_RES("142", screen.Acolors[142], DFT_COLOR("rgb:7f/7f/00")), +COLOR_RES("143", screen.Acolors[143], DFT_COLOR("rgb:7f/7f/2a")), +COLOR_RES("144", screen.Acolors[144], DFT_COLOR("rgb:7f/7f/55")), +COLOR_RES("145", screen.Acolors[145], DFT_COLOR("rgb:7f/7f/7f")), +COLOR_RES("146", screen.Acolors[146], DFT_COLOR("rgb:7f/7f/aa")), +COLOR_RES("147", screen.Acolors[147], DFT_COLOR("rgb:7f/7f/d4")), +COLOR_RES("148", screen.Acolors[148], DFT_COLOR("rgb:7f/aa/00")), +COLOR_RES("149", screen.Acolors[149], DFT_COLOR("rgb:7f/aa/2a")), +COLOR_RES("150", screen.Acolors[150], DFT_COLOR("rgb:7f/aa/55")), +COLOR_RES("151", screen.Acolors[151], DFT_COLOR("rgb:7f/aa/7f")), +COLOR_RES("152", screen.Acolors[152], DFT_COLOR("rgb:7f/aa/aa")), +COLOR_RES("153", screen.Acolors[153], DFT_COLOR("rgb:7f/aa/d4")), +COLOR_RES("154", screen.Acolors[154], DFT_COLOR("rgb:7f/d4/00")), +COLOR_RES("155", screen.Acolors[155], DFT_COLOR("rgb:7f/d4/2a")), +COLOR_RES("156", screen.Acolors[156], DFT_COLOR("rgb:7f/d4/55")), +COLOR_RES("157", screen.Acolors[157], DFT_COLOR("rgb:7f/d4/7f")), +COLOR_RES("158", screen.Acolors[158], DFT_COLOR("rgb:7f/d4/aa")), +COLOR_RES("159", screen.Acolors[159], DFT_COLOR("rgb:7f/d4/d4")), +COLOR_RES("160", screen.Acolors[160], DFT_COLOR("rgb:aa/00/00")), +COLOR_RES("161", screen.Acolors[161], DFT_COLOR("rgb:aa/00/2a")), +COLOR_RES("162", screen.Acolors[162], DFT_COLOR("rgb:aa/00/55")), +COLOR_RES("163", screen.Acolors[163], DFT_COLOR("rgb:aa/00/7f")), +COLOR_RES("164", screen.Acolors[164], DFT_COLOR("rgb:aa/00/aa")), +COLOR_RES("165", screen.Acolors[165], DFT_COLOR("rgb:aa/00/d4")), +COLOR_RES("166", screen.Acolors[166], DFT_COLOR("rgb:aa/2a/00")), +COLOR_RES("167", screen.Acolors[167], DFT_COLOR("rgb:aa/2a/2a")), +COLOR_RES("168", screen.Acolors[168], DFT_COLOR("rgb:aa/2a/55")), +COLOR_RES("169", screen.Acolors[169], DFT_COLOR("rgb:aa/2a/7f")), +COLOR_RES("170", screen.Acolors[170], DFT_COLOR("rgb:aa/2a/aa")), +COLOR_RES("171", screen.Acolors[171], DFT_COLOR("rgb:aa/2a/d4")), +COLOR_RES("172", screen.Acolors[172], DFT_COLOR("rgb:aa/55/00")), +COLOR_RES("173", screen.Acolors[173], DFT_COLOR("rgb:aa/55/2a")), +COLOR_RES("174", screen.Acolors[174], DFT_COLOR("rgb:aa/55/55")), +COLOR_RES("175", screen.Acolors[175], DFT_COLOR("rgb:aa/55/7f")), +COLOR_RES("176", screen.Acolors[176], DFT_COLOR("rgb:aa/55/aa")), +COLOR_RES("177", screen.Acolors[177], DFT_COLOR("rgb:aa/55/d4")), +COLOR_RES("178", screen.Acolors[178], DFT_COLOR("rgb:aa/7f/00")), +COLOR_RES("179", screen.Acolors[179], DFT_COLOR("rgb:aa/7f/2a")), +COLOR_RES("180", screen.Acolors[180], DFT_COLOR("rgb:aa/7f/55")), +COLOR_RES("181", screen.Acolors[181], DFT_COLOR("rgb:aa/7f/7f")), +COLOR_RES("182", screen.Acolors[182], DFT_COLOR("rgb:aa/7f/aa")), +COLOR_RES("183", screen.Acolors[183], DFT_COLOR("rgb:aa/7f/d4")), +COLOR_RES("184", screen.Acolors[184], DFT_COLOR("rgb:aa/aa/00")), +COLOR_RES("185", screen.Acolors[185], DFT_COLOR("rgb:aa/aa/2a")), +COLOR_RES("186", screen.Acolors[186], DFT_COLOR("rgb:aa/aa/55")), +COLOR_RES("187", screen.Acolors[187], DFT_COLOR("rgb:aa/aa/7f")), +COLOR_RES("188", screen.Acolors[188], DFT_COLOR("rgb:aa/aa/aa")), +COLOR_RES("189", screen.Acolors[189], DFT_COLOR("rgb:aa/aa/d4")), +COLOR_RES("190", screen.Acolors[190], DFT_COLOR("rgb:aa/d4/00")), +COLOR_RES("191", screen.Acolors[191], DFT_COLOR("rgb:aa/d4/2a")), +COLOR_RES("192", screen.Acolors[192], DFT_COLOR("rgb:aa/d4/55")), +COLOR_RES("193", screen.Acolors[193], DFT_COLOR("rgb:aa/d4/7f")), +COLOR_RES("194", screen.Acolors[194], DFT_COLOR("rgb:aa/d4/aa")), +COLOR_RES("195", screen.Acolors[195], DFT_COLOR("rgb:aa/d4/d4")), +COLOR_RES("196", screen.Acolors[196], DFT_COLOR("rgb:d4/00/00")), +COLOR_RES("197", screen.Acolors[197], DFT_COLOR("rgb:d4/00/2a")), +COLOR_RES("198", screen.Acolors[198], DFT_COLOR("rgb:d4/00/55")), +COLOR_RES("199", screen.Acolors[199], DFT_COLOR("rgb:d4/00/7f")), +COLOR_RES("200", screen.Acolors[200], DFT_COLOR("rgb:d4/00/aa")), +COLOR_RES("201", screen.Acolors[201], DFT_COLOR("rgb:d4/00/d4")), +COLOR_RES("202", screen.Acolors[202], DFT_COLOR("rgb:d4/2a/00")), +COLOR_RES("203", screen.Acolors[203], DFT_COLOR("rgb:d4/2a/2a")), +COLOR_RES("204", screen.Acolors[204], DFT_COLOR("rgb:d4/2a/55")), +COLOR_RES("205", screen.Acolors[205], DFT_COLOR("rgb:d4/2a/7f")), +COLOR_RES("206", screen.Acolors[206], DFT_COLOR("rgb:d4/2a/aa")), +COLOR_RES("207", screen.Acolors[207], DFT_COLOR("rgb:d4/2a/d4")), +COLOR_RES("208", screen.Acolors[208], DFT_COLOR("rgb:d4/55/00")), +COLOR_RES("209", screen.Acolors[209], DFT_COLOR("rgb:d4/55/2a")), +COLOR_RES("210", screen.Acolors[210], DFT_COLOR("rgb:d4/55/55")), +COLOR_RES("211", screen.Acolors[211], DFT_COLOR("rgb:d4/55/7f")), +COLOR_RES("212", screen.Acolors[212], DFT_COLOR("rgb:d4/55/aa")), +COLOR_RES("213", screen.Acolors[213], DFT_COLOR("rgb:d4/55/d4")), +COLOR_RES("214", screen.Acolors[214], DFT_COLOR("rgb:d4/7f/00")), +COLOR_RES("215", screen.Acolors[215], DFT_COLOR("rgb:d4/7f/2a")), +COLOR_RES("216", screen.Acolors[216], DFT_COLOR("rgb:d4/7f/55")), +COLOR_RES("217", screen.Acolors[217], DFT_COLOR("rgb:d4/7f/7f")), +COLOR_RES("218", screen.Acolors[218], DFT_COLOR("rgb:d4/7f/aa")), +COLOR_RES("219", screen.Acolors[219], DFT_COLOR("rgb:d4/7f/d4")), +COLOR_RES("220", screen.Acolors[220], DFT_COLOR("rgb:d4/aa/00")), +COLOR_RES("221", screen.Acolors[221], DFT_COLOR("rgb:d4/aa/2a")), +COLOR_RES("222", screen.Acolors[222], DFT_COLOR("rgb:d4/aa/55")), +COLOR_RES("223", screen.Acolors[223], DFT_COLOR("rgb:d4/aa/7f")), +COLOR_RES("224", screen.Acolors[224], DFT_COLOR("rgb:d4/aa/aa")), +COLOR_RES("225", screen.Acolors[225], DFT_COLOR("rgb:d4/aa/d4")), +COLOR_RES("226", screen.Acolors[226], DFT_COLOR("rgb:d4/d4/00")), +COLOR_RES("227", screen.Acolors[227], DFT_COLOR("rgb:d4/d4/2a")), +COLOR_RES("228", screen.Acolors[228], DFT_COLOR("rgb:d4/d4/55")), +COLOR_RES("229", screen.Acolors[229], DFT_COLOR("rgb:d4/d4/7f")), +COLOR_RES("230", screen.Acolors[230], DFT_COLOR("rgb:d4/d4/aa")), +COLOR_RES("231", screen.Acolors[231], DFT_COLOR("rgb:d4/d4/d4")), +COLOR_RES("232", screen.Acolors[232], DFT_COLOR("rgb:08/08/08")), +COLOR_RES("233", screen.Acolors[233], DFT_COLOR("rgb:12/12/12")), +COLOR_RES("234", screen.Acolors[234], DFT_COLOR("rgb:1c/1c/1c")), +COLOR_RES("235", screen.Acolors[235], DFT_COLOR("rgb:26/26/26")), +COLOR_RES("236", screen.Acolors[236], DFT_COLOR("rgb:30/30/30")), +COLOR_RES("237", screen.Acolors[237], DFT_COLOR("rgb:3a/3a/3a")), +COLOR_RES("238", screen.Acolors[238], DFT_COLOR("rgb:44/44/44")), +COLOR_RES("239", screen.Acolors[239], DFT_COLOR("rgb:4e/4e/4e")), +COLOR_RES("240", screen.Acolors[240], DFT_COLOR("rgb:58/58/58")), +COLOR_RES("241", screen.Acolors[241], DFT_COLOR("rgb:62/62/62")), +COLOR_RES("242", screen.Acolors[242], DFT_COLOR("rgb:6c/6c/6c")), +COLOR_RES("243", screen.Acolors[243], DFT_COLOR("rgb:76/76/76")), +COLOR_RES("244", screen.Acolors[244], DFT_COLOR("rgb:80/80/80")), +COLOR_RES("245", screen.Acolors[245], DFT_COLOR("rgb:8a/8a/8a")), +COLOR_RES("246", screen.Acolors[246], DFT_COLOR("rgb:94/94/94")), +COLOR_RES("247", screen.Acolors[247], DFT_COLOR("rgb:9e/9e/9e")), +COLOR_RES("248", screen.Acolors[248], DFT_COLOR("rgb:a8/a8/a8")), +COLOR_RES("249", screen.Acolors[249], DFT_COLOR("rgb:b2/b2/b2")), +COLOR_RES("250", screen.Acolors[250], DFT_COLOR("rgb:bc/bc/bc")), +COLOR_RES("251", screen.Acolors[251], DFT_COLOR("rgb:c6/c6/c6")), +COLOR_RES("252", screen.Acolors[252], DFT_COLOR("rgb:d0/d0/d0")), +COLOR_RES("253", screen.Acolors[253], DFT_COLOR("rgb:da/da/da")), +COLOR_RES("254", screen.Acolors[254], DFT_COLOR("rgb:e4/e4/e4")), +COLOR_RES("255", screen.Acolors[255], DFT_COLOR("rgb:ee/ee/ee")), Index: xc/programs/xterm/256colres.pl diff -u xc/programs/xterm/256colres.pl:1.5 xc/programs/xterm/256colres.pl:1.6 --- xc/programs/xterm/256colres.pl:1.5 Fri Jun 16 20:27:35 2000 +++ xc/programs/xterm/256colres.pl Mon Jun 18 15:09:25 2001 @@ -1,6 +1,6 @@ #! /usr/bin/perl # Author: Thomas E. Dickey -# $XFree86: xc/programs/xterm/256colres.pl,v 1.5 2000/06/17 00:27:35 dawes Exp $ +# $XFree86: xc/programs/xterm/256colres.pl,v 1.6 2001/06/18 19:09:25 dickey Exp $ # Construct a header file defining default resources for the 256-color model # of xterm. This is modeled after the 256colors2.pl script. @@ -16,7 +16,7 @@ /* \$XFree86\$ */ EOF -$line1="COLOR_RES(\"color%d\","; +$line1="COLOR_RES(\"%d\","; $line2="\tscreen.Acolors[%d],"; $line3="\tDFT_COLOR(\"rgb:%2.2x/%2.2x/%2.2x\")),\n"; Index: xc/programs/xterm/88colres.h diff -u xc/programs/xterm/88colres.h:1.2 xc/programs/xterm/88colres.h:1.3 --- xc/programs/xterm/88colres.h:1.2 Thu Feb 10 13:57:35 2000 +++ xc/programs/xterm/88colres.h Mon Jun 18 15:09:25 2001 @@ -1,76 +1,76 @@ /* * This header file was generated by ./88colres.pl */ -/* $XFree86: xc/programs/xterm/88colres.h,v 1.2 2000/02/10 18:57:35 dawes Exp $ */ -COLOR_RES("color16", screen.Acolors[16], DFT_COLOR("rgb:00/00/00")), -COLOR_RES("color17", screen.Acolors[17], DFT_COLOR("rgb:00/00/8b")), -COLOR_RES("color18", screen.Acolors[18], DFT_COLOR("rgb:00/00/cd")), -COLOR_RES("color19", screen.Acolors[19], DFT_COLOR("rgb:00/00/ff")), -COLOR_RES("color20", screen.Acolors[20], DFT_COLOR("rgb:00/8b/00")), -COLOR_RES("color21", screen.Acolors[21], DFT_COLOR("rgb:00/8b/8b")), -COLOR_RES("color22", screen.Acolors[22], DFT_COLOR("rgb:00/8b/cd")), -COLOR_RES("color23", screen.Acolors[23], DFT_COLOR("rgb:00/8b/ff")), -COLOR_RES("color24", screen.Acolors[24], DFT_COLOR("rgb:00/cd/00")), -COLOR_RES("color25", screen.Acolors[25], DFT_COLOR("rgb:00/cd/8b")), -COLOR_RES("color26", screen.Acolors[26], DFT_COLOR("rgb:00/cd/cd")), -COLOR_RES("color27", screen.Acolors[27], DFT_COLOR("rgb:00/cd/ff")), -COLOR_RES("color28", screen.Acolors[28], DFT_COLOR("rgb:00/ff/00")), -COLOR_RES("color29", screen.Acolors[29], DFT_COLOR("rgb:00/ff/8b")), -COLOR_RES("color30", screen.Acolors[30], DFT_COLOR("rgb:00/ff/cd")), -COLOR_RES("color31", screen.Acolors[31], DFT_COLOR("rgb:00/ff/ff")), -COLOR_RES("color32", screen.Acolors[32], DFT_COLOR("rgb:8b/00/00")), -COLOR_RES("color33", screen.Acolors[33], DFT_COLOR("rgb:8b/00/8b")), -COLOR_RES("color34", screen.Acolors[34], DFT_COLOR("rgb:8b/00/cd")), -COLOR_RES("color35", screen.Acolors[35], DFT_COLOR("rgb:8b/00/ff")), -COLOR_RES("color36", screen.Acolors[36], DFT_COLOR("rgb:8b/8b/00")), -COLOR_RES("color37", screen.Acolors[37], DFT_COLOR("rgb:8b/8b/8b")), -COLOR_RES("color38", screen.Acolors[38], DFT_COLOR("rgb:8b/8b/cd")), -COLOR_RES("color39", screen.Acolors[39], DFT_COLOR("rgb:8b/8b/ff")), -COLOR_RES("color40", screen.Acolors[40], DFT_COLOR("rgb:8b/cd/00")), -COLOR_RES("color41", screen.Acolors[41], DFT_COLOR("rgb:8b/cd/8b")), -COLOR_RES("color42", screen.Acolors[42], DFT_COLOR("rgb:8b/cd/cd")), -COLOR_RES("color43", screen.Acolors[43], DFT_COLOR("rgb:8b/cd/ff")), -COLOR_RES("color44", screen.Acolors[44], DFT_COLOR("rgb:8b/ff/00")), -COLOR_RES("color45", screen.Acolors[45], DFT_COLOR("rgb:8b/ff/8b")), -COLOR_RES("color46", screen.Acolors[46], DFT_COLOR("rgb:8b/ff/cd")), -COLOR_RES("color47", screen.Acolors[47], DFT_COLOR("rgb:8b/ff/ff")), -COLOR_RES("color48", screen.Acolors[48], DFT_COLOR("rgb:cd/00/00")), -COLOR_RES("color49", screen.Acolors[49], DFT_COLOR("rgb:cd/00/8b")), -COLOR_RES("color50", screen.Acolors[50], DFT_COLOR("rgb:cd/00/cd")), -COLOR_RES("color51", screen.Acolors[51], DFT_COLOR("rgb:cd/00/ff")), -COLOR_RES("color52", screen.Acolors[52], DFT_COLOR("rgb:cd/8b/00")), -COLOR_RES("color53", screen.Acolors[53], DFT_COLOR("rgb:cd/8b/8b")), -COLOR_RES("color54", screen.Acolors[54], DFT_COLOR("rgb:cd/8b/cd")), -COLOR_RES("color55", screen.Acolors[55], DFT_COLOR("rgb:cd/8b/ff")), -COLOR_RES("color56", screen.Acolors[56], DFT_COLOR("rgb:cd/cd/00")), -COLOR_RES("color57", screen.Acolors[57], DFT_COLOR("rgb:cd/cd/8b")), -COLOR_RES("color58", screen.Acolors[58], DFT_COLOR("rgb:cd/cd/cd")), -COLOR_RES("color59", screen.Acolors[59], DFT_COLOR("rgb:cd/cd/ff")), -COLOR_RES("color60", screen.Acolors[60], DFT_COLOR("rgb:cd/ff/00")), -COLOR_RES("color61", screen.Acolors[61], DFT_COLOR("rgb:cd/ff/8b")), -COLOR_RES("color62", screen.Acolors[62], DFT_COLOR("rgb:cd/ff/cd")), -COLOR_RES("color63", screen.Acolors[63], DFT_COLOR("rgb:cd/ff/ff")), -COLOR_RES("color64", screen.Acolors[64], DFT_COLOR("rgb:ff/00/00")), -COLOR_RES("color65", screen.Acolors[65], DFT_COLOR("rgb:ff/00/8b")), -COLOR_RES("color66", screen.Acolors[66], DFT_COLOR("rgb:ff/00/cd")), -COLOR_RES("color67", screen.Acolors[67], DFT_COLOR("rgb:ff/00/ff")), -COLOR_RES("color68", screen.Acolors[68], DFT_COLOR("rgb:ff/8b/00")), -COLOR_RES("color69", screen.Acolors[69], DFT_COLOR("rgb:ff/8b/8b")), -COLOR_RES("color70", screen.Acolors[70], DFT_COLOR("rgb:ff/8b/cd")), -COLOR_RES("color71", screen.Acolors[71], DFT_COLOR("rgb:ff/8b/ff")), -COLOR_RES("color72", screen.Acolors[72], DFT_COLOR("rgb:ff/cd/00")), -COLOR_RES("color73", screen.Acolors[73], DFT_COLOR("rgb:ff/cd/8b")), -COLOR_RES("color74", screen.Acolors[74], DFT_COLOR("rgb:ff/cd/cd")), -COLOR_RES("color75", screen.Acolors[75], DFT_COLOR("rgb:ff/cd/ff")), -COLOR_RES("color76", screen.Acolors[76], DFT_COLOR("rgb:ff/ff/00")), -COLOR_RES("color77", screen.Acolors[77], DFT_COLOR("rgb:ff/ff/8b")), -COLOR_RES("color78", screen.Acolors[78], DFT_COLOR("rgb:ff/ff/cd")), -COLOR_RES("color79", screen.Acolors[79], DFT_COLOR("rgb:ff/ff/ff")), -COLOR_RES("color80", screen.Acolors[80], DFT_COLOR("rgb:2e/2e/2e")), -COLOR_RES("color81", screen.Acolors[81], DFT_COLOR("rgb:5c/5c/5c")), -COLOR_RES("color82", screen.Acolors[82], DFT_COLOR("rgb:73/73/73")), -COLOR_RES("color83", screen.Acolors[83], DFT_COLOR("rgb:8b/8b/8b")), -COLOR_RES("color84", screen.Acolors[84], DFT_COLOR("rgb:a2/a2/a2")), -COLOR_RES("color85", screen.Acolors[85], DFT_COLOR("rgb:b9/b9/b9")), -COLOR_RES("color86", screen.Acolors[86], DFT_COLOR("rgb:d0/d0/d0")), -COLOR_RES("color87", screen.Acolors[87], DFT_COLOR("rgb:e7/e7/e7")), +/* $XFree86: xc/programs/xterm/88colres.h,v 1.3 2001/06/18 19:09:25 dickey Exp $ */ +COLOR_RES("16", screen.Acolors[16], DFT_COLOR("rgb:00/00/00")), +COLOR_RES("17", screen.Acolors[17], DFT_COLOR("rgb:00/00/8b")), +COLOR_RES("18", screen.Acolors[18], DFT_COLOR("rgb:00/00/cd")), +COLOR_RES("19", screen.Acolors[19], DFT_COLOR("rgb:00/00/ff")), +COLOR_RES("20", screen.Acolors[20], DFT_COLOR("rgb:00/8b/00")), +COLOR_RES("21", screen.Acolors[21], DFT_COLOR("rgb:00/8b/8b")), +COLOR_RES("22", screen.Acolors[22], DFT_COLOR("rgb:00/8b/cd")), +COLOR_RES("23", screen.Acolors[23], DFT_COLOR("rgb:00/8b/ff")), +COLOR_RES("24", screen.Acolors[24], DFT_COLOR("rgb:00/cd/00")), +COLOR_RES("25", screen.Acolors[25], DFT_COLOR("rgb:00/cd/8b")), +COLOR_RES("26", screen.Acolors[26], DFT_COLOR("rgb:00/cd/cd")), +COLOR_RES("27", screen.Acolors[27], DFT_COLOR("rgb:00/cd/ff")), +COLOR_RES("28", screen.Acolors[28], DFT_COLOR("rgb:00/ff/00")), +COLOR_RES("29", screen.Acolors[29], DFT_COLOR("rgb:00/ff/8b")), +COLOR_RES("30", screen.Acolors[30], DFT_COLOR("rgb:00/ff/cd")), +COLOR_RES("31", screen.Acolors[31], DFT_COLOR("rgb:00/ff/ff")), +COLOR_RES("32", screen.Acolors[32], DFT_COLOR("rgb:8b/00/00")), +COLOR_RES("33", screen.Acolors[33], DFT_COLOR("rgb:8b/00/8b")), +COLOR_RES("34", screen.Acolors[34], DFT_COLOR("rgb:8b/00/cd")), +COLOR_RES("35", screen.Acolors[35], DFT_COLOR("rgb:8b/00/ff")), +COLOR_RES("36", screen.Acolors[36], DFT_COLOR("rgb:8b/8b/00")), +COLOR_RES("37", screen.Acolors[37], DFT_COLOR("rgb:8b/8b/8b")), +COLOR_RES("38", screen.Acolors[38], DFT_COLOR("rgb:8b/8b/cd")), +COLOR_RES("39", screen.Acolors[39], DFT_COLOR("rgb:8b/8b/ff")), +COLOR_RES("40", screen.Acolors[40], DFT_COLOR("rgb:8b/cd/00")), +COLOR_RES("41", screen.Acolors[41], DFT_COLOR("rgb:8b/cd/8b")), +COLOR_RES("42", screen.Acolors[42], DFT_COLOR("rgb:8b/cd/cd")), +COLOR_RES("43", screen.Acolors[43], DFT_COLOR("rgb:8b/cd/ff")), +COLOR_RES("44", screen.Acolors[44], DFT_COLOR("rgb:8b/ff/00")), +COLOR_RES("45", screen.Acolors[45], DFT_COLOR("rgb:8b/ff/8b")), +COLOR_RES("46", screen.Acolors[46], DFT_COLOR("rgb:8b/ff/cd")), +COLOR_RES("47", screen.Acolors[47], DFT_COLOR("rgb:8b/ff/ff")), +COLOR_RES("48", screen.Acolors[48], DFT_COLOR("rgb:cd/00/00")), +COLOR_RES("49", screen.Acolors[49], DFT_COLOR("rgb:cd/00/8b")), +COLOR_RES("50", screen.Acolors[50], DFT_COLOR("rgb:cd/00/cd")), +COLOR_RES("51", screen.Acolors[51], DFT_COLOR("rgb:cd/00/ff")), +COLOR_RES("52", screen.Acolors[52], DFT_COLOR("rgb:cd/8b/00")), +COLOR_RES("53", screen.Acolors[53], DFT_COLOR("rgb:cd/8b/8b")), +COLOR_RES("54", screen.Acolors[54], DFT_COLOR("rgb:cd/8b/cd")), +COLOR_RES("55", screen.Acolors[55], DFT_COLOR("rgb:cd/8b/ff")), +COLOR_RES("56", screen.Acolors[56], DFT_COLOR("rgb:cd/cd/00")), +COLOR_RES("57", screen.Acolors[57], DFT_COLOR("rgb:cd/cd/8b")), +COLOR_RES("58", screen.Acolors[58], DFT_COLOR("rgb:cd/cd/cd")), +COLOR_RES("59", screen.Acolors[59], DFT_COLOR("rgb:cd/cd/ff")), +COLOR_RES("60", screen.Acolors[60], DFT_COLOR("rgb:cd/ff/00")), +COLOR_RES("61", screen.Acolors[61], DFT_COLOR("rgb:cd/ff/8b")), +COLOR_RES("62", screen.Acolors[62], DFT_COLOR("rgb:cd/ff/cd")), +COLOR_RES("63", screen.Acolors[63], DFT_COLOR("rgb:cd/ff/ff")), +COLOR_RES("64", screen.Acolors[64], DFT_COLOR("rgb:ff/00/00")), +COLOR_RES("65", screen.Acolors[65], DFT_COLOR("rgb:ff/00/8b")), +COLOR_RES("66", screen.Acolors[66], DFT_COLOR("rgb:ff/00/cd")), +COLOR_RES("67", screen.Acolors[67], DFT_COLOR("rgb:ff/00/ff")), +COLOR_RES("68", screen.Acolors[68], DFT_COLOR("rgb:ff/8b/00")), +COLOR_RES("69", screen.Acolors[69], DFT_COLOR("rgb:ff/8b/8b")), +COLOR_RES("70", screen.Acolors[70], DFT_COLOR("rgb:ff/8b/cd")), +COLOR_RES("71", screen.Acolors[71], DFT_COLOR("rgb:ff/8b/ff")), +COLOR_RES("72", screen.Acolors[72], DFT_COLOR("rgb:ff/cd/00")), +COLOR_RES("73", screen.Acolors[73], DFT_COLOR("rgb:ff/cd/8b")), +COLOR_RES("74", screen.Acolors[74], DFT_COLOR("rgb:ff/cd/cd")), +COLOR_RES("75", screen.Acolors[75], DFT_COLOR("rgb:ff/cd/ff")), +COLOR_RES("76", screen.Acolors[76], DFT_COLOR("rgb:ff/ff/00")), +COLOR_RES("77", screen.Acolors[77], DFT_COLOR("rgb:ff/ff/8b")), +COLOR_RES("78", screen.Acolors[78], DFT_COLOR("rgb:ff/ff/cd")), +COLOR_RES("79", screen.Acolors[79], DFT_COLOR("rgb:ff/ff/ff")), +COLOR_RES("80", screen.Acolors[80], DFT_COLOR("rgb:2e/2e/2e")), +COLOR_RES("81", screen.Acolors[81], DFT_COLOR("rgb:5c/5c/5c")), +COLOR_RES("82", screen.Acolors[82], DFT_COLOR("rgb:73/73/73")), +COLOR_RES("83", screen.Acolors[83], DFT_COLOR("rgb:8b/8b/8b")), +COLOR_RES("84", screen.Acolors[84], DFT_COLOR("rgb:a2/a2/a2")), +COLOR_RES("85", screen.Acolors[85], DFT_COLOR("rgb:b9/b9/b9")), +COLOR_RES("86", screen.Acolors[86], DFT_COLOR("rgb:d0/d0/d0")), +COLOR_RES("87", screen.Acolors[87], DFT_COLOR("rgb:e7/e7/e7")), Index: xc/programs/xterm/88colres.pl diff -u xc/programs/xterm/88colres.pl:1.3 xc/programs/xterm/88colres.pl:1.4 --- xc/programs/xterm/88colres.pl:1.3 Tue Jun 13 20:16:17 2000 +++ xc/programs/xterm/88colres.pl Mon Jun 18 15:09:25 2001 @@ -1,6 +1,6 @@ #!/usr/bin/perl # Author: Steve Wall <steve_wall@redcom.com> -# $XFree86: xc/programs/xterm/88colres.pl,v 1.3 2000/06/14 00:16:17 dawes Exp $ +# $XFree86: xc/programs/xterm/88colres.pl,v 1.4 2001/06/18 19:09:25 dickey Exp $ # Made from 256colres.pl # Construct a header file defining default resources for the @@ -17,7 +17,7 @@ /* \$XFree86\$ */ EOF -$line1="COLOR_RES(\"color%d\","; +$line1="COLOR_RES(\"%d\","; $line2="\tscreen.Acolors[%d],"; $line3="\tDFT_COLOR(\"rgb:%2.2x/%2.2x/%2.2x\")),\n"; @steps=(0,139,205,255); Index: xc/programs/xterm/INSTALL diff -u xc/programs/xterm/INSTALL:3.23 xc/programs/xterm/INSTALL:3.25 --- xc/programs/xterm/INSTALL:3.23 Sun Mar 11 19:54:16 2001 +++ xc/programs/xterm/INSTALL Fri Nov 23 14:50:46 2001 @@ -1,7 +1,7 @@ --- $XFree86: xc/programs/xterm/INSTALL,v 3.23 2001/03/12 00:54:16 dickey Exp $ +-- $XFree86: xc/programs/xterm/INSTALL,v 3.25 2001/11/23 19:50:46 dawes Exp $ -- Thomas E. Dickey -Xterm is normally built as part of the X Windows source tree, using +Xterm is normally built as part of the X Window System source tree, using imake to generate a Makefile from Imakefile. You can also use the configure script to generate a Makefile from Makefile.in: @@ -76,6 +76,14 @@ positions 0-31. Many applications use the line-drawing characters, e.g., to make boxes. When xterm loads a font, it checks if those characters are present, and draws its own if they are missing. + + --disable-color-class disable color class resources + + Use this option to change most of the color resources to use Foreground + as the color class. This is the older (before patch #157) behavior + which has the drawback that setting the Foreground resource on most + platforms prevents use of color since the class is evaluated before + the instance. --disable-color-mode disable default colorMode resource Index: xc/programs/xterm/Imakefile diff -u xc/programs/xterm/Imakefile:3.35.2.1 xc/programs/xterm/Imakefile:3.40 --- xc/programs/xterm/Imakefile:3.35.2.1 Mon May 28 02:53:37 2001 +++ xc/programs/xterm/Imakefile Wed Oct 10 15:46:22 2001 @@ -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.35.2.1 2001/05/28 06:53:37 torrey Exp $ +XCOMM $XFree86: xc/programs/xterm/Imakefile,v 3.40 2001/10/10 19:46:22 dickey Exp $ XCOMM /* Uncomment SCROLLBAR_RIGHT if you want the scroll bar to be on the right */ @@ -92,8 +92,8 @@ #ifdef UTF8support UTF8_OPTION = -DOPT_WIDE_CHARS - UTF8SRC = charclass.c keysym2ucs.c precompose.c wcwidth.c - UTF8OBJ = charclass.o keysym2ucs.o precompose.o wcwidth.o + UTF8SRC = charclass.c precompose.c wcwidth.c xutf8.c + UTF8OBJ = charclass.o precompose.o wcwidth.o xutf8.o #endif #if BuildXftLibrary #define XRenderSupport @@ -196,6 +196,8 @@ #endif #endif +InstallNamedProg(uxterm,uxterm,$(BINDIR)) + NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,$(TERMCAPLIB)) InstallProgramWithFlags(resize,$(BINDIR),NullParameter) @@ -210,6 +212,7 @@ InstallNamedNonExec(terminfo,xterm.terminfo,$(LIBDIR)/etc) InstallAppDefaults(XTerm) +InstallAppDefaults(UXTerm) InstallAppDefaultsLong(XTerm-col,XTerm-color) InstallManPage(xterm,$(MANDIR)) InstallManPage(resize,$(MANDIR)) Index: xc/programs/xterm/MANIFEST diff -u xc/programs/xterm/MANIFEST:1.10 xc/programs/xterm/MANIFEST:1.13 --- xc/programs/xterm/MANIFEST:1.10 Tue Mar 13 04:48:43 2001 +++ xc/programs/xterm/MANIFEST Wed Sep 19 21:06:35 2001 @@ -1,4 +1,4 @@ -MANIFEST for xterm-152, version xterm-152 +MANIFEST for xterm, version xterm-159 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode @@ -88,6 +88,8 @@ 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 +xutf8.c JC's cleanup of UTF8 +xutf8.h JC's cleanup of UTF8 tektests subdirectory tektests/aitest.tek tek4014 demo: draw a globe tektests/dmerc.tek tek4014 demo: draws a Mercator projection with orbit Index: xc/programs/xterm/Makefile.in diff -u xc/programs/xterm/Makefile.in:3.37 xc/programs/xterm/Makefile.in:3.39 --- xc/programs/xterm/Makefile.in:3.37 Tue Mar 13 04:48:43 2001 +++ xc/programs/xterm/Makefile.in Sat Jan 5 17:05:02 2002 @@ -1,4 +1,4 @@ -## $XFree86: xc/programs/xterm/Makefile.in,v 3.37 2001/03/13 09:48:43 dickey Exp $ ## +## $XFree86: xc/programs/xterm/Makefile.in,v 3.39 2002/01/05 22:05:02 dickey Exp $ ## SHELL = /bin/sh @@ -115,6 +115,7 @@ actual_resize = `echo resize| sed '$(transform)'` binary_xterm = `echo xterm$x| $(TRANSFORM)` binary_resize = `echo resize$x| $(TRANSFORM)` +binary_uxterm = `echo uxterm| $(TRANSFORM)` install \ install-bin \ @@ -128,6 +129,7 @@ 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_PROGRAM) -m 755 $(srcdir)/uxterm $(BINDIR)/$(binary_uxterm) install \ install-man \ @@ -144,6 +146,9 @@ @echo installing $(APPSDIR)/$(CLASS)-color @sed -e s/XTerm/$(CLASS)/ $(srcdir)/XTerm-col.ad >XTerm.tmp @$(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$(CLASS)-color + @echo installing $(APPSDIR)/UXTerm + @sed -e s/XTerm/$(CLASS)/ $(srcdir)/UXTerm.ad >XTerm.tmp + @$(INSTALL_DATA) XTerm.tmp $(APPSDIR)/UXTerm @rm -f XTerm.tmp install :: @@ -167,10 +172,12 @@ uninstall: -$(RM) $(BINDIR)/$(binary_xterm) -$(RM) $(BINDIR)/$(binary_resize) + -$(RM) $(BINDIR)/$(binary_uxterm) -$(RM) $(MANDIR)/$(actual_xterm).$(manext) -$(RM) $(MANDIR)/$(actual_resize).$(manext) -$(RM) $(APPSDIR)/$(CLASS) -$(RM) $(APPSDIR)/$(CLASS)-color + -$(RM) $(APPSDIR)/UXTerm mostlyclean: -$(RM) *.[ois] XtermLog.* .pure core *~ *.bak *.BAK *.out *.tmp Index: xc/programs/xterm/Tekproc.c diff -u xc/programs/xterm/Tekproc.c:3.33 xc/programs/xterm/Tekproc.c:3.35 --- xc/programs/xterm/Tekproc.c:3.33 Wed Apr 11 21:02:49 2001 +++ xc/programs/xterm/Tekproc.c Sat Jan 5 17:05:02 2002 @@ -1,35 +1,63 @@ /* - * $Xorg: Tekproc.c,v 1.4 2000/08/17 19:55:07 cpqbld Exp $ + * $Xorg: Tekproc.c,v 1.5 2001/02/09 02:06:02 xorgcvs Exp $ * * Warning, there be crufty dragons here. */ -/* $XFree86: xc/programs/xterm/Tekproc.c,v 3.33 2001/04/12 01:02:49 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/Tekproc.c,v 3.35 2002/01/05 22:05:02 dickey Exp $ */ /* -Copyright (c) 1988 X Consortium +Copyright 2001 by Thomas E. Dickey -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and 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: + All Rights Reserved +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and 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 ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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(s) of the above copyright +holders shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization. + + +Copyright 1988 The Open Group + +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. + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +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 X Consortium shall not be +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 X Consortium. +in this Software without prior written authorization from The Open Group. * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. Index: xc/programs/xterm/UXTerm.ad diff -u xc/programs/xterm/UXTerm.ad:1.1 xc/programs/xterm/UXTerm.ad:1.2 --- xc/programs/xterm/UXTerm.ad:1.1 Sat Aug 26 00:33:53 2000 +++ xc/programs/xterm/UXTerm.ad Wed Nov 14 19:29:12 2001 @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xterm/UXTerm.ad,v 1.1 2000/08/26 04:33:53 dawes Exp $ +! $XFree86: xc/programs/xterm/UXTerm.ad,v 1.2 2001/11/15 00:29:12 dawes Exp $ ! Use ! xterm -class UXTerm @@ -12,5 +12,5 @@ *VT100*font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1 *VT100*font3: -misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1 *VT100*font4: -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso10646-1 -*VT100*font5: -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1 +*VT100*font5: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 *VT100*font6: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1 Index: xc/programs/xterm/XTerm-col.ad diff -u xc/programs/xterm/XTerm-col.ad:3.0 xc/programs/xterm/XTerm-col.ad:3.1 --- xc/programs/xterm/XTerm-col.ad:3.0 Sun Sep 17 02:33:11 1995 +++ xc/programs/xterm/XTerm-col.ad Sat Jan 5 17:05:02 2002 @@ -1,17 +1,20 @@ -! $XFree86: xc/programs/xterm/XTerm-col.ad,v 3.0 1995/09/17 06:33:11 dawes Exp $ +! $XFree86: xc/programs/xterm/XTerm-col.ad,v 3.1 2002/01/05 22:05:02 dickey Exp $ #include "XTerm" *VT100*colorMode: on *VT100*dynamicColors: on -! Uncomment this use color for underline attribute +! Uncomment this to use color for underline attribute !*VT100*colorULMode: on !*VT100*underLine: off ! Uncomment this to use color for the bold attribute !*VT100*colorBDMode: on +! Uncomment this to use the bold/underline colors in preference to other colors +!*VT100*colorAttrMode: on + *VT100*color0: black *VT100*color1: red3 *VT100*color2: green3 @@ -30,4 +33,3 @@ *VT100*color15: white *VT100*colorUL: yellow *VT100*colorBD: white - Index: xc/programs/xterm/XTerm.ad diff -u xc/programs/xterm/XTerm.ad:3.19 xc/programs/xterm/XTerm.ad:3.22 --- xc/programs/xterm/XTerm.ad:3.19 Wed Jan 17 18:46:34 2001 +++ xc/programs/xterm/XTerm.ad Sat Jan 5 17:05:02 2002 @@ -3,7 +3,7 @@ ! ! ! -! $XFree86: xc/programs/xterm/XTerm.ad,v 3.19 2001/01/17 23:46:34 dawes Exp $ +! $XFree86: xc/programs/xterm/XTerm.ad,v 3.22 2002/01/05 22:05:02 dickey Exp $ XTerm.JoinSession:False @@ -111,7 +111,7 @@ *VT100*boldColors: on *VT100*dynamicColors: on -! Uncomment this use color for underline attribute +! Uncomment this to use color for underline attribute !*VT100*colorULMode: on !*VT100*underLine: off Index: xc/programs/xterm/button.c diff -u xc/programs/xterm/button.c:3.61 xc/programs/xterm/button.c:3.65 --- xc/programs/xterm/button.c:3.61 Sat Apr 28 09:51:55 2001 +++ xc/programs/xterm/button.c Sat Jan 5 20:34:23 2002 @@ -1,6 +1,6 @@ /* $Xorg: button.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ /* - * Copyright 1999-2000 by Thomas E. Dickey + * Copyright 1999,2000,2001,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -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.61 2001/04/28 13:51:55 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/button.c,v 3.65 2002/01/06 01:34:23 dickey Exp $ */ /* button.c Handles button events in the terminal emulator. @@ -67,6 +67,8 @@ #include <X11/Xmu/Atoms.h> #include <X11/Xmu/StdSel.h> +#include <xutf8.h> + #include <data.h> #include <error.h> #include <menu.h> @@ -764,17 +766,6 @@ do_select_end (w, event, params, num_params, True); } -#ifndef X_HAVE_UTF8_STRING -static Atom XA_UTF8_STRING(Display *dpy) -{ - static AtomPtr p = NULL; - - if(p == NULL) - p = XmuMakeAtom("UTF8_STRING"); - return XmuInternAtom(dpy, p); -} -#endif - struct _SelectionList { String *params; Cardinal count; @@ -825,37 +816,8 @@ *result = q - buffer; return buffer; } - -/* Convert a Latin-1 string to UTF-8 */ - -static Char * -Latin1toUTF8(Char *s, int len, int *len_return) -{ - Char *p = s; - 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++; - } else { - *q++ = 0xC0 | ((*p >> 6) & 0x3); - *q++ = 0x80 | (*p & 0x3F); - p++; - } - } - - *len_return = q - t; - return t; -} +#if 0 /* Eliminate all control characters from a UTF-8 string, doing something reasonable with PS and LS */ @@ -924,73 +886,10 @@ *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 <NUL> */ - 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 +#endif /* OPT_WIDE_CHARS */ + static Atom * _SelectionTargets(Widget w) { @@ -1015,7 +914,7 @@ } n = 0; utf8SelectionTargets[n] = XA_UTF8_STRING(XtDisplay(w)); n++; -#if OPT_USE_UTF8_API +#ifdef X_HAVE_UTF8_STRING if (screen->i18nSelections) { utf8SelectionTargets[n] = XA_TEXT(XtDisplay(w)); n++; utf8SelectionTargets[n] = XA_COMPOUND_TEXT(XtDisplay(w)); n++; @@ -1036,7 +935,7 @@ return NULL; } n = 0; -#if OPT_USE_UTF8_API +#ifdef X_HAVE_UTF8_STRING eightBitSelectionTargets[n] = XA_UTF8_STRING(XtDisplay(w)); n++; #endif if (screen->i18nSelections) { @@ -1077,7 +976,7 @@ default: cutbuffer = -1; } TRACE(("Cutbuffer: %d, target: %lu\n", cutbuffer, - (unsigned long)targets[0])); + targets ? (unsigned long)targets[0] : 0)); if (cutbuffer >= 0) { int inbytes; unsigned long nbytes; @@ -1098,42 +997,47 @@ targets = _SelectionTargets(w); } - target = targets[0]; + if (targets != 0) { + target = targets[0]; - if (targets[1] == None) { /* last target in list */ - params++; - num_params--; - targets = _SelectionTargets(w); - } else { - targets = &(targets[1]); - } + if (targets[1] == None) { /* last target in list */ + params++; + num_params--; + targets = _SelectionTargets(w); + } else { + targets = &(targets[1]); + } - if (num_params) { - list = XtNew(struct _SelectionList); - list->params = params; - list->count = num_params; - list->targets = targets; - list->time = ev_time; - } else list = NULL; - - XtGetSelectionValue(w, selection, - target, - SelectionReceived, - (XtPointer)list, ev_time); + if (num_params) { + list = XtNew(struct _SelectionList); + list->params = params; + list->count = num_params; + list->targets = targets; + list->time = ev_time; + } else list = NULL; + + 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(Display *dpy, Atom type, Char *line, int len) { Char *cp; + char *name; + + name = XGetAtomName(dpy, type); - Trace("Getting %s\n", tag); + Trace("Getting %s (%ld)\n", XGetAtomName(dpy, type), (long int)type); for (cp = line; cp < line + len; cp++) Trace("%c\n", *cp); } #else -#define GettingSelection(tag,line,len) /* nothing */ +#define GettingSelection(dpy,type,line,len) /* nothing */ #endif #ifndef VMS @@ -1205,12 +1109,13 @@ int *format GCC_UNUSED) { char **text_list = NULL; - Char *(*conversion_function)(Char*, int, int*) = NULL; - Char *line = (Char*)value; int text_list_count; XTextProperty text_prop; TScreen *screen; Display *dpy; +#if OPT_TRACE && OPT_WIDE_CHARS + Char *line = (Char*)value; +#endif if (!IsXtermWidget(w)) return; @@ -1220,26 +1125,17 @@ if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0 || value == NULL) goto fail; - text_prop.value = value; + text_prop.value = (unsigned char *)value; text_prop.encoding = *type; text_prop.format = *format; text_prop.nitems = *length; #if OPT_WIDE_CHARS if(screen->wide_chars) { - /* Convert the selection to UTF-8. */ - if (*type == XA_UTF8_STRING(XtDisplay(w))) { - GettingSelection("UTF8_STRING", line, *length); - if(XTextPropertyToStringListUnchecked(&text_prop, &text_list, - &text_list_count) < 0) { - TRACE(("Conversion failed\n")); - text_list = NULL; - } - conversion_function = filterUTF8; - } -#if OPT_USE_UTF8_API - if (*type == XA_COMPOUND_TEXT(XtDisplay(w))) { - GettingSelection("COMPOUND_TEXT", line, *length); + if (*type == XA_UTF8_STRING(XtDisplay(w)) || + *type == XA_STRING || + *type == XA_COMPOUND_TEXT(XtDisplay(w))) { + GettingSelection(dpy, *type, line, *length); if(Xutf8TextPropertyToTextList(dpy, &text_prop, &text_list, &text_list_count) < 0) { @@ -1247,52 +1143,30 @@ text_list = NULL; } } -#endif - 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 */ { /* 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 { + + /* There's no need to special-case UTF8_STRING. If Xlib + doesn't know about it, we didn't request it. If a broken + selection holder sends it anyhow, the conversion function + will fail. */ + + if (*type == XA_UTF8_STRING(XtDisplay(w)) || + *type == XA_STRING || + *type == XA_COMPOUND_TEXT(XtDisplay(w))) { + Status rc; + GettingSelection(dpy, *type, line, *length); + if(*type == XA_STRING && screen->brokenSelections) { rc = XTextPropertyToStringList(&text_prop, &text_list, &text_list_count); - } - if(rc < 0) { + } else { + rc = XmbTextPropertyToTextList(dpy, &text_prop, + &text_list, + &text_list_count); + } + if (rc < 0) { TRACE(("Conversion failed\n")); text_list = NULL; } @@ -1302,16 +1176,9 @@ 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); - } + _WriteSelectionData(((XtermWidget)w)->screen.respond, + (Char*)text_list[i], len); } XFreeStringList(text_list); } else @@ -1868,7 +1735,7 @@ /* E` E' E^ E: I` I' I^ I: */ 48, 48, 48, 48, 48, 48, 48, 48, /* D- N~ O` O' O^ O~ O: X */ - 48, 48, 48, 48, 48, 48, 48, 216, + 48, 48, 48, 48, 48, 48, 48, 215, /* O/ U` U' U^ U: Y' P B */ 48, 48, 48, 48, 48, 48, 48, 48, /* a` a' a^ a~ a: ao ae c, */ @@ -1876,7 +1743,7 @@ /* e` e' e^ e: i` i' i^ i: */ 48, 48, 48, 48, 48, 48, 48, 48, /* d n~ o` o' o^ o~ o: -: */ - 48, 48, 48, 48, 48, 48, 48, 248, + 48, 48, 48, 48, 48, 48, 48, 247, /* o/ u` u' u^ u: y' P y: */ 48, 48, 48, 48, 48, 48, 48, 48}; @@ -2247,17 +2114,15 @@ return False; screen = &((XtermWidget)w)->screen; - - *value = (XtPointer) screen->selection_data; - if (conversion_function(d, (char**)value, 1, + if (conversion_function(d, &screen->selection_data, 1, conversion_style, &textprop) < Success) return False; *value = (XtPointer) textprop.value; *length = textprop.nitems; *type = textprop.encoding; - *format = 8; + *format = textprop.format; return True; } @@ -2295,16 +2160,16 @@ *value = (XtPointer) targetP; *targetP++ = XA_STRING; *targetP++ = XA_TEXT(d); -#if OPT_USE_UTF8_API +#ifdef X_HAVE_UTF8_STRING *targetP++ = XA_COMPOUND_TEXT(d); *targetP++ = XA_UTF8_STRING(d); -#else /* OPT_USE_UTF8_API */ +#else *targetP = XA_COMPOUND_TEXT(d); if_OPT_WIDE_CHARS(screen, { *targetP = XA_UTF8_STRING(d); }) targetP++; -#endif /* OPT_USE_UTF8_API */ +#endif *targetP++ = XA_LENGTH(d); *targetP++ = XA_LIST_LENGTH(d); memcpy ( (char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); @@ -2316,57 +2181,33 @@ #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 */ - - -#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; + return + _ConvertSelectionHelper(w, + type, value, length, format, + Xutf8TextListToTextProperty, + XStringStyle); } 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; + return + _ConvertSelectionHelper(w, + type, value, length, format, + Xutf8TextListToTextProperty, + XUTF8StringStyle); + } + if (screen->wide_chars && *target == XA_TEXT(d)) { + return + _ConvertSelectionHelper(w, + type, value, length, format, + Xutf8TextListToTextProperty, + XStdICCTextStyle); } 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 @@ -2400,17 +2241,15 @@ XCompoundTextStyle); } +#ifdef X_HAVE_UTF8_STRING 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 } +#endif if (*target == XA_LIST_LENGTH(d)) { *value = XtMalloc(4); Index: xc/programs/xterm/charproc.c diff -u xc/programs/xterm/charproc.c:3.120 xc/programs/xterm/charproc.c:3.128 --- xc/programs/xterm/charproc.c:3.120 Fri Apr 20 05:30:38 2001 +++ xc/programs/xterm/charproc.c Mon Jan 7 16:02:44 2002 @@ -1,12 +1,12 @@ /* - * $Xorg: charproc.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ + * $Xorg: charproc.c,v 1.6 2001/02/09 02:06:02 xorgcvs Exp $ */ -/* $XFree86: xc/programs/xterm/charproc.c,v 3.120 2001/04/20 09:30:38 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/charproc.c,v 3.128 2002/01/07 21:02:44 dawes Exp $ */ /* -Copyright 1999-2001 by Thomas E. Dickey +Copyright 1999, 2000, 2001, 2002 by Thomas E. Dickey All Rights Reserved @@ -35,14 +35,13 @@ authorization. -Copyright (c) 1988 X Consortium +Copyright 1988 The Open Group -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and 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: +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -50,13 +49,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +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 X Consortium shall not be +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 X Consortium. +in this Software without prior written authorization from The Open Group. */ /* @@ -105,6 +104,10 @@ #include <precompose.h> #endif +#if OPT_INPUT_METHOD +#include <X11/Xlocale.h> +#endif + #include <stdio.h> #include <ctype.h> @@ -123,6 +126,7 @@ #include <main.h> #include <fontutils.h> #include <xcharmouse.h> +#include <charclass.h> #if OPT_ZICONBEEP || OPT_TOOLBAR #define HANDLE_STRUCT_NOTIFY 1 @@ -157,6 +161,10 @@ #define StopBlinking(screen) /* nothing */ #endif +#if OPT_INPUT_METHOD +static void PreeditPosition(TScreen *screen); +#endif + #define DEFAULT -1 #define BELLSUPPRESSMSEC 200 @@ -212,7 +220,8 @@ " #if OPT_SHIFT_FONTS "\ - Shift <KeyPress> KP_Add:larger-vt-font() \n\ + Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \n\ + Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \n\ Shift <KeyPress> KP_Subtract:smaller-vt-font() \n\ " #endif @@ -237,7 +246,7 @@ !Lock Ctrl @Num_Lock <Btn3Down>:popup-menu(fontMenu) \n\ ! @Num_Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ ~Ctrl ~Meta <Btn3Down>:start-extend() \n\ - ~Meta <Btn3Motion>:select-extend() \n\ + ~Meta <Btn3Motion>:select-extend() \n\ Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ Lock @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ @@ -368,8 +377,10 @@ Bres(XtNappkeypadDefault, XtCAppkeypadDefault, misc.appkeypadDefault, FALSE), Bres(XtNautoWrap, XtCAutoWrap, misc.autoWrap, TRUE), Bres(XtNawaitInput, XtCAwaitInput, screen.awaitInput, FALSE), +Bres(XtNfreeBoldBox, XtCBoolean, screen.free_bold_box, FALSE), +Bres(XtNforceBoxChars, XtCBoolean, screen.force_box_chars, FALSE), Bres(XtNbackarrowKey, XtCBackarrowKey, screen.backarrow_key, TRUE), -Bres(XtNboldMode, XtCBoldMode, screen.bold_mode, 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), @@ -387,32 +398,33 @@ 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(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), -Bres(XtNreverseVideo, XtCReverseVideo, misc.re_verse, FALSE), +Bres(XtNreverseVideo, XtCReverseVideo, misc.re_verse, FALSE), Bres(XtNreverseWrap, XtCReverseWrap, misc.reverseWrap, FALSE), Bres(XtNscrollBar, XtCScrollBar, misc.scrollbar, FALSE), Bres(XtNscrollKey, XtCScrollCond, screen.scrollkey, FALSE), Bres(XtNscrollTtyOutput, XtCScrollCond, screen.scrollttyoutput, TRUE), Bres(XtNsignalInhibit, XtCSignalInhibit, misc.signalInhibit, FALSE), Bres(XtNtiteInhibit, XtCTiteInhibit, misc.titeInhibit, FALSE), +Bres(XtNtiXtraScroll, XtCTiXtraScroll, misc.tiXtraScroll, FALSE), Bres(XtNtrimSelection, XtCTrimSelection, screen.trim_selection, FALSE), -Bres(XtNunderLine, XtCUnderLine, screen.underline, TRUE), +Bres(XtNunderLine, XtCUnderLine, screen.underline, TRUE), Bres(XtNvisualBell, XtCVisualBell, screen.visualbell, FALSE), -Cres(XtNcursorColor, screen.cursorcolor, XtDefaultForeground), -Cres(XtNforeground, screen.foreground, XtDefaultForeground), -Cres(XtNpointerColor, screen.mousecolor, XtDefaultForeground), -Dres(XtNbackground, core.background_pixel, XtDefaultBackground), -Dres(XtNpointerColorBackground, screen.mousecolorback, "XtDefaultBackground"), +Cres(XtNcursorColor, XtCCursorColor, screen.cursorcolor, XtDefaultForeground), +Cres(XtNforeground, XtCForeground, screen.foreground, XtDefaultForeground), +Cres(XtNpointerColor, XtCPointerColor,screen.mousecolor, XtDefaultForeground), +Cres(XtNbackground, XtCBackground, core.background_pixel, XtDefaultBackground), +Cres(XtNpointerColorBackground, XtCBackground, screen.mousecolorback, "XtDefaultBackground"), Ires(XtNbellSuppressTime, XtCBellSuppressTime, screen.bellSuppressTime, BELLSUPPRESSMSEC), Ires(XtNinternalBorder, XtCBorderWidth, screen.border, DEFBORDER), Ires(XtNlimitResize, XtCLimitResize, misc.limit_resize, 1), Ires(XtNmultiClickTime, XtCMultiClickTime, screen.multiClickTime, MULTICLICKTIME), -Ires(XtNnMarginBell, XtCColumn, screen.nmarginbell, N_MARGINBELL), +Ires(XtNnMarginBell, XtCColumn, screen.nmarginbell, N_MARGINBELL), Ires(XtNprinterControlMode, XtCPrinterControlMode, screen.printer_controlmode, 0), Ires(XtNsaveLines, XtCSaveLines, screen.savelines, SAVELINES), Ires(XtNscrollLines, XtCScrollLines, screen.scrolllines, SCROLLLINES), @@ -427,7 +439,7 @@ Sres(XtNcharClass, XtCCharClass, screen.charClass, NULL), Sres(XtNdecTerminalID, XtCDecTerminalID, screen.term_id, DFT_DECID), Sres(XtNfont, XtCFont, misc.f_n, DEFFONT), -Sres(XtNgeometry, XtCGeometry, misc.geo_metry, NULL), +Sres(XtNgeometry, XtCGeometry, misc.geo_metry, NULL), Sres(XtNkeyboardDialect, XtCKeyboardDialect, screen.keyboard_dialect, DFT_KBD_DIALECT), Sres(XtNprinterCommand, XtCPrinterCommand, screen.printer_command, OS_DEPENDENT_PRINT_COMMAND), Sres(XtNtekGeometry, XtCGeometry, misc.T_geometry, NULL), @@ -472,13 +484,13 @@ #endif #if OPT_HIGHLIGHT_COLOR -Cres(XtNhighlightColor, screen.highlightcolor, XtDefaultForeground), +Cres(XtNhighlightColor, XtCHighlightColor, screen.highlightcolor, XtDefaultForeground), #endif /* OPT_HIGHLIGHT_COLOR */ #if OPT_INPUT_METHOD Bres(XtNopenIm, XtCOpenIm, misc.open_im, TRUE), Sres(XtNinputMethod, XtCInputMethod, misc.input_method, NULL), -Sres(XtNpreeditType, XtCPreeditType, misc.preedit_type, "Root"), +Sres(XtNpreeditType, XtCPreeditType, misc.preedit_type, "OverTheSpot,Root"), #endif #if OPT_ISO_COLORS @@ -490,26 +502,26 @@ Bres(XtNcolorRVMode, XtCColorMode, screen.colorRVMode, FALSE), Bres(XtNcolorULMode, XtCColorMode, screen.colorULMode, FALSE), -COLOR_RES(XtNcolor0, screen.Acolors[COLOR_0], DFT_COLOR("black")), -COLOR_RES(XtNcolor1, screen.Acolors[COLOR_1], DFT_COLOR("red3")), -COLOR_RES(XtNcolor2, screen.Acolors[COLOR_2], DFT_COLOR("green3")), -COLOR_RES(XtNcolor3, screen.Acolors[COLOR_3], DFT_COLOR("yellow3")), -COLOR_RES(XtNcolor4, screen.Acolors[COLOR_4], DFT_COLOR("blue3")), -COLOR_RES(XtNcolor5, screen.Acolors[COLOR_5], DFT_COLOR("magenta3")), -COLOR_RES(XtNcolor6, screen.Acolors[COLOR_6], DFT_COLOR("cyan3")), -COLOR_RES(XtNcolor7, screen.Acolors[COLOR_7], DFT_COLOR("gray90")), -COLOR_RES(XtNcolor8, screen.Acolors[COLOR_8], DFT_COLOR("gray30")), -COLOR_RES(XtNcolor9, screen.Acolors[COLOR_9], DFT_COLOR("red")), -COLOR_RES(XtNcolor10, screen.Acolors[COLOR_10], DFT_COLOR("green")), -COLOR_RES(XtNcolor11, screen.Acolors[COLOR_11], DFT_COLOR("yellow")), -COLOR_RES(XtNcolor12, screen.Acolors[COLOR_12], DFT_COLOR("blue")), -COLOR_RES(XtNcolor13, screen.Acolors[COLOR_13], DFT_COLOR("magenta")), -COLOR_RES(XtNcolor14, screen.Acolors[COLOR_14], DFT_COLOR("cyan")), -COLOR_RES(XtNcolor15, screen.Acolors[COLOR_15], DFT_COLOR("white")), -COLOR_RES(XtNcolorBD, screen.Acolors[COLOR_BD], DFT_COLOR(XtDefaultForeground)), -COLOR_RES(XtNcolorBL, screen.Acolors[COLOR_BL], DFT_COLOR(XtDefaultForeground)), -COLOR_RES(XtNcolorUL, screen.Acolors[COLOR_UL], DFT_COLOR(XtDefaultForeground)), -COLOR_RES(XtNcolorRV, screen.Acolors[COLOR_RV], DFT_COLOR(XtDefaultForeground)), +COLOR_RES("0", screen.Acolors[COLOR_0], DFT_COLOR("black")), +COLOR_RES("1", screen.Acolors[COLOR_1], DFT_COLOR("red3")), +COLOR_RES("2", screen.Acolors[COLOR_2], DFT_COLOR("green3")), +COLOR_RES("3", screen.Acolors[COLOR_3], DFT_COLOR("yellow3")), +COLOR_RES("4", screen.Acolors[COLOR_4], DFT_COLOR("blue3")), +COLOR_RES("5", screen.Acolors[COLOR_5], DFT_COLOR("magenta3")), +COLOR_RES("6", screen.Acolors[COLOR_6], DFT_COLOR("cyan3")), +COLOR_RES("7", screen.Acolors[COLOR_7], DFT_COLOR("gray90")), +COLOR_RES("8", screen.Acolors[COLOR_8], DFT_COLOR("gray30")), +COLOR_RES("9", screen.Acolors[COLOR_9], DFT_COLOR("red")), +COLOR_RES("10", screen.Acolors[COLOR_10], DFT_COLOR("green")), +COLOR_RES("11", screen.Acolors[COLOR_11], DFT_COLOR("yellow")), +COLOR_RES("12", screen.Acolors[COLOR_12], DFT_COLOR("blue")), +COLOR_RES("13", screen.Acolors[COLOR_13], DFT_COLOR("magenta")), +COLOR_RES("14", screen.Acolors[COLOR_14], DFT_COLOR("cyan")), +COLOR_RES("15", screen.Acolors[COLOR_15], DFT_COLOR("white")), +COLOR_RES("BD", screen.Acolors[COLOR_BD], DFT_COLOR(XtDefaultForeground)), +COLOR_RES("BL", screen.Acolors[COLOR_BL], DFT_COLOR(XtDefaultForeground)), +COLOR_RES("UL", screen.Acolors[COLOR_UL], DFT_COLOR(XtDefaultForeground)), +COLOR_RES("RV", screen.Acolors[COLOR_RV], DFT_COLOR(XtDefaultForeground)), #if OPT_256_COLORS # include <256colres.h> @@ -558,6 +570,10 @@ Sres(XtNwideFont, XtCWideFont, misc.f_w, DEFWIDEFONT), #endif +#if OPT_INPUT_METHOD +Sres(XtNximFont, XtCXimFont, misc.f_x, DEFXIMFONT), +#endif + #if OPT_XMC_GLITCH Bres(XtNxmcInline, XtCXmcInline, screen.xmc_inline, FALSE), Bres(XtNxmcMoveSGR, XtCXmcMoveSGR, screen.move_sgr_ok, TRUE), @@ -2479,7 +2495,7 @@ (Dimension) FontWidth(screen) * (tt_width) + 2*screen->border - + screen->fullVwin.scrollbar, + + screen->fullVwin.sb_info.width, (Dimension) FontHeight(screen) * (tt_length) + 2 * screen->border, @@ -2536,6 +2552,9 @@ else HideCursor(); } +#if OPT_INPUT_METHOD + PreeditPosition(screen); +#endif if (QLength(screen->display)){ select_mask = X_mask; @@ -2611,6 +2630,9 @@ else HideCursor(); } +#if OPT_INPUT_METHOD + PreeditPosition(screen); +#endif XFlush(screen->display); /* always flush writes before waiting */ @@ -2699,6 +2721,28 @@ } #endif /* VMS */ +#if OPT_INPUT_METHOD +/* + * For OverTheSpot, client has to inform the position for XIM preedit. + */ +static void PreeditPosition(TScreen *screen) +{ + XPoint spot; + XVaNestedList list; + + if (!screen->xic) return; + spot.x = CurCursorX(screen, screen->cur_row, screen->cur_col); + spot.y = CursorY(screen, screen->cur_row) + screen->fs_ascent; + list = XVaCreateNestedList(0, + XNSpotLocation, &spot, + XNForeground, screen->foreground, + XNBackground, term->core.background_pixel, + NULL); + XSetICValues(screen->xic, XNPreeditAttributes, list, NULL); + XFree(list); +} +#endif + /* * process a string of characters according to the character set indicated * by charset. worry about end of line conditions (wraparound if selected). @@ -3150,7 +3194,7 @@ screen->cursor_set = (func == bitset) ? ON : OFF; break; case 30: /* rxvt */ - if (screen->fullVwin.scrollbar != ((func == bitset) ? ON : OFF)) + if (screen->fullVwin.sb_info.width != ((func == bitset) ? ON : OFF)) ToggleScrollBar(termw); break; #if OPT_SHIFT_FONTS @@ -3219,6 +3263,10 @@ FromAlternate(screen); CursorRestore(termw); } + } else if (termw->misc.tiXtraScroll) { + if(func == bitset) { + xtermScroll(screen, screen->max_row); + } } break; case 1047: @@ -3232,6 +3280,10 @@ ClearScreen(screen); FromAlternate(screen); } + } else if (termw->misc.tiXtraScroll) { + if(func == bitset) { + xtermScroll(screen, screen->max_row); + } } break; case 66: /* DECNKM */ @@ -3241,6 +3293,10 @@ case 67: /* DECBKM */ /* back-arrow mapped to backspace or delete(D)*/ (*func)(&termw->keyboard.flags, MODE_DECBKM); + TRACE(("DECSET DECBKM %s\n", + (termw->keyboard.flags & MODE_DECBKM) + ? "on" + : "off")); update_decbkm(); break; case SET_VT200_MOUSE: /* xterm bogus sequence */ @@ -3490,6 +3546,10 @@ else FromAlternate(screen); /* update_altscreen done by ToAlt and FromAlt */ + } else if (termw->misc.tiXtraScroll) { + if(screen->save_modes[DP_X_ALTSCRN]) { + xtermScroll(screen, screen->max_row); + } } break; case SET_VT200_MOUSE: /* mouse bogus sequence */ @@ -3874,6 +3934,8 @@ if(!screen->alternate) return; TRACE(("FromAlternate\n")); + if(screen->scroll_amt) + FlushScroll(screen); screen->alternate = FALSE; SwitchBufs(screen); update_altscreen(); @@ -4070,7 +4132,7 @@ if (cols < 0) value = screen->max_col + 1; value *= FontWidth(screen); - value += (2 * screen->border) + Scrollbar(screen); + value += (2 * screen->border) + ScrollbarWidth(screen); if (!okDimension(value, askedWidth)) return; } @@ -4158,6 +4220,8 @@ XtOverrideTranslations(vtparent, XtParseTranslationTable(xterm_trans)); (void) XSetWMProtocols (XtDisplay(vtparent), XtWindow(vtparent), &wm_delete_window, 1); + TRACE_TRANS("shell", vtparent); + TRACE_TRANS("vt100", (Widget)(term)); if (screen->allbuf == NULL) VTallocbuf (); return (1); @@ -4186,6 +4250,27 @@ (XtConvertArgList) NULL, (Cardinal) 0); } +#if OPT_TRACE +#define init_Bres(name) \ + TRACE(("init " #name " = %s\n", \ + (wnew->name = request->name) != FALSE \ + ? "on" : "off")) +#define init_Cres(name) \ + TRACE(("init " #name " = %#lx\n", \ + wnew->name = request->name)) +#define init_Ires(name) \ + TRACE(("init " #name " = %d\n", \ + wnew->name = request->name)) +#define init_Sres(name) \ + TRACE(("init " #name " = %s\n", \ + (wnew->name = request->name) != NULL \ + ? wnew->name : "<null>")) +#else +#define init_Bres(name) wnew->name = request->name +#define init_Cres(name) wnew->name = request->name +#define init_Ires(name) wnew->name = request->name +#define init_Sres(name) wnew->name = request->name +#endif /* ARGSUSED */ static void VTInitialize ( @@ -4247,43 +4332,46 @@ wnew->screen.mouse_row = -1; wnew->screen.mouse_col = -1; - wnew->screen.c132 = request->screen.c132; - wnew->screen.curses = request->screen.curses; - wnew->screen.hp_ll_bc = request->screen.hp_ll_bc; + init_Bres(screen.force_box_chars); + init_Bres(screen.free_bold_box); + + init_Bres(screen.c132); + init_Bres(screen.curses); + init_Bres(screen.hp_ll_bc); #if OPT_XMC_GLITCH - wnew->screen.xmc_glitch = request->screen.xmc_glitch; - wnew->screen.xmc_attributes = request->screen.xmc_attributes; - wnew->screen.xmc_inline = request->screen.xmc_inline; - wnew->screen.move_sgr_ok = request->screen.move_sgr_ok; + init_Ires(screen.xmc_glitch); + init_Ires(screen.xmc_attributes); + init_Bres(screen.xmc_inline); + init_Bres(screen.move_sgr_ok); #endif - wnew->screen.foreground = request->screen.foreground; - wnew->screen.cursorcolor = request->screen.cursorcolor; + init_Cres(screen.foreground); + init_Cres(screen.cursorcolor); #if OPT_BLINK_CURS - wnew->screen.cursor_blink = request->screen.cursor_blink; - wnew->screen.cursor_on = request->screen.cursor_on; - wnew->screen.cursor_off = request->screen.cursor_off; -#endif - wnew->screen.border = request->screen.border; - wnew->screen.jumpscroll = request->screen.jumpscroll; - wnew->screen.old_fkeys = request->screen.old_fkeys; - wnew->screen.delete_is_del = request->screen.delete_is_del; + init_Bres(screen.cursor_blink); + init_Ires(screen.cursor_on); + init_Ires(screen.cursor_off); +#endif + init_Ires(screen.border); + init_Bres(screen.jumpscroll); + init_Bres(screen.old_fkeys); + init_Bres(screen.delete_is_del); wnew->keyboard.type = wnew->screen.old_fkeys ? keyboardIsLegacy : keyboardIsDefault; #ifdef ALLOWLOGGING - wnew->screen.logfile = request->screen.logfile; + init_Sres(screen.logfile); #endif - wnew->screen.marginbell = request->screen.marginbell; - wnew->screen.mousecolor = request->screen.mousecolor; - wnew->screen.mousecolorback = request->screen.mousecolorback; - wnew->screen.multiscroll = request->screen.multiscroll; - wnew->screen.nmarginbell = request->screen.nmarginbell; - wnew->screen.savelines = request->screen.savelines; - wnew->screen.scrolllines = request->screen.scrolllines; - wnew->screen.scrollttyoutput = request->screen.scrollttyoutput; - wnew->screen.scrollkey = request->screen.scrollkey; + init_Bres(screen.marginbell); + init_Cres(screen.mousecolor); + init_Cres(screen.mousecolorback); + init_Bres(screen.multiscroll); + init_Ires(screen.nmarginbell); + init_Ires(screen.savelines); + init_Ires(screen.scrolllines); + init_Bres(screen.scrollttyoutput); + init_Bres(screen.scrollkey); - wnew->screen.term_id = request->screen.term_id; + init_Sres(screen.term_id); for (s = request->screen.term_id; *s; s++) { if (!isalpha(CharOf(*s))) break; @@ -4298,12 +4386,12 @@ wnew->screen.terminal_id)); 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; + init_Bres(screen.visualbell); + init_Bres(screen.poponbell); + init_Ires(misc.limit_resize); #if OPT_NUM_LOCK - wnew->misc.real_NumLock = request->misc.real_NumLock; - wnew->misc.alwaysUseMods = request->misc.alwaysUseMods; + init_Bres(misc.real_NumLock); + init_Bres(misc.alwaysUseMods); wnew->misc.num_lock = 0; wnew->misc.alt_left = 0; wnew->misc.alt_right = 0; @@ -4312,60 +4400,60 @@ wnew->misc.meta_right = 0; #endif #if OPT_SHIFT_FONTS - wnew->misc.shift_fonts = request->misc.shift_fonts; + init_Bres(misc.shift_fonts); #endif #if OPT_SUNPC_KBD - wnew->misc.ctrl_fkeys = request->misc.ctrl_fkeys; + init_Ires(misc.ctrl_fkeys); #endif #if OPT_TEK4014 - wnew->misc.tekInhibit = request->misc.tekInhibit; - wnew->misc.tekSmall = request->misc.tekSmall; - wnew->screen.TekEmu = request->screen.TekEmu; + init_Bres(misc.tekInhibit); + init_Bres(misc.tekSmall); + init_Bres(screen.TekEmu); #endif #if OPT_TCAP_QUERY wnew->screen.tc_query = -1; #endif - wnew->misc.re_verse0 = - wnew->misc.re_verse = request->misc.re_verse; - wnew->screen.multiClickTime = request->screen.multiClickTime; - wnew->screen.bellSuppressTime = request->screen.bellSuppressTime; - wnew->screen.charClass = request->screen.charClass; - wnew->screen.cutNewline = request->screen.cutNewline; - 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->misc.re_verse0 = request->misc.re_verse; + init_Bres(misc.re_verse); + init_Ires(screen.multiClickTime); + init_Ires(screen.bellSuppressTime); + init_Sres(screen.charClass); + init_Bres(screen.cutNewline); + init_Bres(screen.cutToBeginningOfLine); + init_Bres(screen.highlight_selection); + init_Bres(screen.trim_selection); + init_Bres(screen.i18nSelections); + init_Bres(screen.brokenSelections); + init_Bres(screen.always_highlight); wnew->screen.pointer_cursor = request->screen.pointer_cursor; - wnew->screen.answer_back = request->screen.answer_back; + init_Sres(screen.answer_back); - wnew->screen.printer_command = request->screen.printer_command; - wnew->screen.printer_autoclose = request->screen.printer_autoclose; - wnew->screen.printer_extent = request->screen.printer_extent; - wnew->screen.printer_formfeed = request->screen.printer_formfeed; - wnew->screen.printer_controlmode = request->screen.printer_controlmode; + init_Sres(screen.printer_command); + init_Bres(screen.printer_autoclose); + init_Bres(screen.printer_extent); + init_Bres(screen.printer_formfeed); + init_Ires(screen.printer_controlmode); #if OPT_PRINT_COLORS - wnew->screen.print_attributes = request->screen.print_attributes; + init_Ires(screen.print_attributes); #endif - TRACE(("keyboard_dialect:%s\n", request->screen.keyboard_dialect)); - wnew->screen.keyboard_dialect = request->screen.keyboard_dialect; + init_Sres(screen.keyboard_dialect); - wnew->screen.input_eight_bits = request->screen.input_eight_bits; - wnew->screen.output_eight_bits = request->screen.output_eight_bits; - wnew->screen.control_eight_bits = request->screen.control_eight_bits; - wnew->screen.backarrow_key = request->screen.backarrow_key; - wnew->screen.meta_sends_esc = request->screen.meta_sends_esc; - wnew->screen.allowSendEvents = request->screen.allowSendEvents; + init_Bres(screen.input_eight_bits); + init_Bres(screen.output_eight_bits); + init_Bres(screen.control_eight_bits); + init_Bres(screen.backarrow_key); + init_Bres(screen.meta_sends_esc); + init_Bres(screen.allowSendEvents); #ifndef NO_ACTIVE_ICON wnew->screen.fnt_icon = request->screen.fnt_icon; #endif /* NO_ACTIVE_ICON */ - wnew->misc.titeInhibit = request->misc.titeInhibit; - wnew->misc.dynamicColors = request->misc.dynamicColors; + init_Bres(misc.titeInhibit); + init_Bres(misc.tiXtraScroll); + init_Bres(misc.dynamicColors); for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) { - wnew->screen.menu_font_names[i] = request->screen.menu_font_names[i]; + init_Sres(screen.menu_font_names[i]); } /* set default in realize proc */ wnew->screen.menu_font_names[fontMenu_fontdefault] = NULL; @@ -4374,8 +4462,8 @@ wnew->screen.menu_font_number = fontMenu_fontdefault; #if OPT_DEC_CHRSET - wnew->screen.font_doublesize = request->screen.font_doublesize; - wnew->screen.cache_doublesize = request->screen.cache_doublesize; + init_Bres(screen.font_doublesize); + init_Ires(screen.cache_doublesize); if (wnew->screen.cache_doublesize > NUM_CHRSET) wnew->screen.cache_doublesize = NUM_CHRSET; if (wnew->screen.cache_doublesize == 0) @@ -4385,15 +4473,17 @@ wnew->screen.cache_doublesize)); #endif +#if OPT_ISO_COLORS || OPT_DEC_CHRSET || OPT_WIDE_CHARS wnew->num_ptrs = (OFF_ATTRS+1); /* OFF_FLAGS, OFF_CHARS, OFF_ATTRS */ +#endif #if OPT_ISO_COLORS - wnew->screen.boldColors = request->screen.boldColors; - wnew->screen.colorAttrMode = request->screen.colorAttrMode; - wnew->screen.colorBDMode = request->screen.colorBDMode; - wnew->screen.colorBLMode = request->screen.colorBLMode; - wnew->screen.colorMode = request->screen.colorMode; - wnew->screen.colorULMode = request->screen.colorULMode; - wnew->screen.colorRVMode = request->screen.colorRVMode; + init_Bres(screen.boldColors); + init_Bres(screen.colorAttrMode); + init_Bres(screen.colorBDMode); + init_Bres(screen.colorBLMode); + init_Bres(screen.colorMode); + init_Bres(screen.colorULMode); + init_Bres(screen.colorRVMode); for (i = 0, color_ok = False; i < MAXCOLORS; i++) { wnew->screen.Acolors[i] = request->screen.Acolors[i]; @@ -4432,7 +4522,7 @@ #endif /* OPT_ISO_COLORS */ #if OPT_HIGHLIGHT_COLOR - wnew->screen.highlightcolor = request->screen.highlightcolor; + init_Cres(screen.highlightcolor); #endif #if OPT_DEC_CHRSET @@ -4440,7 +4530,7 @@ #endif #if OPT_WIDE_CHARS - wnew->screen.wide_chars = request->screen.wide_chars; + init_Bres(screen.wide_chars); if (request->screen.utf8_mode) { wnew->screen.wide_chars = True; wnew->screen.utf8_mode = 2; /* disable further change */ @@ -4450,8 +4540,8 @@ wnew->num_ptrs = (OFF_COM2H+1); #endif - wnew->screen.bold_mode = request->screen.bold_mode; - wnew->screen.underline = request->screen.underline; + init_Bres(screen.bold_mode); + init_Bres(screen.underline); #ifdef XRENDERFONT wnew->screen.renderFont = 0; wnew->screen.renderFontBold = 0; @@ -4464,6 +4554,8 @@ wnew->keyboard.flags = MODE_SRM; if (wnew->screen.backarrow_key) wnew->keyboard.flags |= MODE_DECBKM; + TRACE(("initialized DECBKM %s\n", + (wnew->keyboard.flags & MODE_DECBKM) ? "on" : "off")); /* look for focus related events on the shell, because we need * to care about the shell's border being part of our focus. @@ -4482,7 +4574,7 @@ #if HANDLE_STRUCT_NOTIFY #if OPT_TOOLBAR wnew->screen.fullVwin.menu_bar = request->screen.fullVwin.menu_bar; - wnew->screen.fullVwin.menu_height = request->screen.fullVwin.menu_height; + init_Ires(screen.fullVwin.menu_height); #else /* Flag icon name with "***" on window output when iconified. * Put in a handler that will tell us when we get Map/Unmap events. @@ -4521,6 +4613,8 @@ if (wnew->screen.savelines < 0) wnew->screen.savelines = 0; + init_Bres(screen.awaitInput); + wnew->flags = 0; if (!wnew->screen.jumpscroll) wnew->flags |= SMOOTHSCROLL; @@ -4787,7 +4881,7 @@ screen->savedlines = 0; if (term->misc.scrollbar) { - screen->fullVwin.scrollbar = 0; + screen->fullVwin.sb_info.width = 0; ScrollBarOn (term, FALSE, TRUE); } CursorSave (term); @@ -4812,7 +4906,7 @@ char *name; unsigned long code; } known_style[] = { - { "OverTheSpot", (XIMPreeditPosition | XIMStatusArea) }, + { "OverTheSpot", (XIMPreeditPosition | XIMStatusNothing) }, { "OffTheSpot", (XIMPreeditArea | XIMStatusArea) }, { "Root", (XIMPreeditNothing | XIMStatusNothing) }, }; @@ -4822,7 +4916,7 @@ if (!term->misc.open_im) return; if (!term->misc.input_method || !*term->misc.input_method) { - if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p) + if ((p = XSetLocaleModifiers("")) != NULL && *p) xim = XOpenIM(XtDisplay(term), NULL, NULL, NULL); } else { s = term->misc.input_method; @@ -4909,22 +5003,73 @@ } /* - * This program only understands the Root preedit_style yet - * Then misc.preedit_type should default to: - * "OverTheSpot,OffTheSpot,Root" - * - * /MaF + * Check for styles we do not yet support. */ - if (input_style != (XIMPreeditNothing | XIMStatusNothing)) { - fprintf(stderr,"This program only supports the 'Root' preedit type\n"); + if (input_style == (XIMPreeditArea | XIMStatusArea)) { + fprintf(stderr,"This program doesn't support the 'OffTheSpot' preedit type\n"); XCloseIM(xim); return; } - term->screen.xic = XCreateIC(xim, XNInputStyle, input_style, - XNClientWindow, XtWindow(term), - XNFocusWindow, XtWindow(term), - NULL); + /* + * For XIMPreeditPosition (or OverTheSpot), XIM client has to + * prepare a font. + * The font has to be locale-dependent XFontSet, whereas + * XTerm use Unicode font. This leads a problem that the + * same font cannot be used for XIM preedit. + */ + if (input_style != (XIMPreeditNothing | XIMStatusNothing)) { + char **missing_charset_list; + int missing_charset_count; + char *def_string; + XVaNestedList p_list; + XPoint spot = {0, 0}; + XFontSetExtents *extents; + XFontStruct **fonts; + char **font_name_list; + + term->screen.fs = XCreateFontSet(XtDisplay(term), + term->misc.f_x, + &missing_charset_list, + &missing_charset_count, + &def_string); + if (term->screen.fs == NULL) { + fprintf(stderr,"Preparation of font set " + "\"%s\" for XIM failed.\n", term->misc.f_x); + term->screen.fs = XCreateFontSet(XtDisplay(term), + DEFXIMFONT, + &missing_charset_list, + &missing_charset_count, + &def_string); + } + if (term->screen.fs == NULL) { + fprintf(stderr,"Preparation of default font set " + "\"%s\" for XIM failed.\n", DEFXIMFONT); + XCloseIM(xim); + return; + } + extents = XExtentsOfFontSet(term->screen.fs); + j = XFontsOfFontSet(term->screen.fs, &fonts, &font_name_list); + for (i = 0, term->screen.fs_ascent = 0; i < j; i++) { + if (term->screen.fs_ascent < (*fonts)->ascent) + term->screen.fs_ascent = (*fonts)->ascent; + } + p_list = XVaCreateNestedList(0, + XNSpotLocation, &spot, + XNFontSet, term->screen.fs, + NULL); + term->screen.xic = XCreateIC(xim, + XNInputStyle, input_style, + XNClientWindow, XtWindow(term), + XNFocusWindow, XtWindow(term), + XNPreeditAttributes, p_list, + NULL); + } else { + term->screen.xic = XCreateIC(xim, XNInputStyle, input_style, + XNClientWindow, XtWindow(term), + XNFocusWindow, XtWindow(term), + NULL); + } if (!term->screen.xic) { fprintf(stderr,"Failed to create input context\n"); @@ -5020,6 +5165,7 @@ Char c2l = 0; int base; #endif + int cursor_col; if (screen->cursor_state == BLINKED_OFF) return; @@ -5030,7 +5176,7 @@ return; screen->cursor_row = screen->cur_row; - screen->cursor_col = screen->cur_col; + cursor_col = screen->cursor_col = screen->cur_col; #ifndef NO_ACTIVE_ICON if (IsIcon(screen)) { @@ -5042,12 +5188,20 @@ #if OPT_WIDE_CHARS base = #endif - clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[screen->cursor_col]; - flags = SCRN_BUF_ATTRS(screen, screen->cursor_row)[screen->cursor_col]; + clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; if_OPT_WIDE_CHARS(screen,{ - int my_col = screen->cursor_col; - chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[screen->cursor_col]; + int my_col; + chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; + if (clo == HIDDEN_LO && chi == HIDDEN_HI) { + /* if cursor points to non-initial part of wide character, + * back it up + */ + --cursor_col; + clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; + chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; + } + my_col = cursor_col; base = (chi << 8) | clo; if (iswide(base)) my_col += 1; @@ -5057,6 +5211,8 @@ c2h = SCRN_BUF_COM2H(screen, screen->cursor_row)[my_col]; }) + flags = SCRN_BUF_ATTRS(screen, screen->cursor_row)[cursor_col]; + if (clo == 0 #if OPT_WIDE_CHARS && chi == 0 @@ -5070,11 +5226,11 @@ * cursor and update the GC's if needed. */ if_OPT_EXT_COLORS(screen,{ - fg_bg = (SCRN_BUF_FGRND(screen, screen->cursor_row)[screen->cursor_col] << 8) | - (SCRN_BUF_BGRND(screen, screen->cursor_row)[screen->cursor_col]); + fg_bg = (SCRN_BUF_FGRND(screen, screen->cursor_row)[cursor_col] << 8) | + (SCRN_BUF_BGRND(screen, screen->cursor_row)[cursor_col]); }) if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - fg_bg = SCRN_BUF_COLOR(screen, screen->cursor_row)[screen->cursor_col]; + fg_bg = SCRN_BUF_COLOR(screen, screen->cursor_row)[cursor_col]; }) fg_pix = getXtermForeground(flags,extract_fg(fg_bg,flags)); bg_pix = getXtermBackground(flags,extract_bg(fg_bg,flags)); @@ -5156,7 +5312,7 @@ screen->cur_row, screen->cur_col)); drawXtermText(screen, flags, currentGC, - x = CurCursorX(screen, screen->cur_row, screen->cur_col), + x = CurCursorX(screen, screen->cur_row, cursor_col), y = CursorY(screen, screen->cur_row), curXtermChrSet(screen->cur_row), PAIRED_CHARS(&clo, &chi), 1, 0); @@ -5208,12 +5364,15 @@ Char c2l = 0; int base; #endif + int cursor_col; if (screen->cursor_state == OFF) /* FIXME */ return; if(screen->cursor_row - screen->topline > screen->max_row) return; + cursor_col = screen->cursor_col; + #ifndef NO_ACTIVE_ICON if (IsIcon(screen)) { screen->cursor_state = OFF; @@ -5224,20 +5383,21 @@ #if OPT_WIDE_CHARS base = #endif - clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[screen->cursor_col]; - flags = SCRN_BUF_ATTRS(screen, screen->cursor_row)[screen->cursor_col]; + clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; + flags = SCRN_BUF_ATTRS(screen, screen->cursor_row)[cursor_col]; - if_OPT_EXT_COLORS(screen,{ - fg_bg = (SCRN_BUF_FGRND(screen, screen->cursor_row)[screen->cursor_col] << 8) | - (SCRN_BUF_BGRND(screen, screen->cursor_row)[screen->cursor_col]); - }) - if_OPT_ISO_TRADITIONAL_COLORS(screen,{ - fg_bg = SCRN_BUF_COLOR(screen, screen->cursor_row)[screen->cursor_col]; - }) - if_OPT_WIDE_CHARS(screen,{ - int my_col = screen->cursor_col; - chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[screen->cursor_col]; + int my_col; + chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; + if (clo == HIDDEN_LO && chi == HIDDEN_HI) { + /* if cursor points to non-initial part of wide character, + * back it up + */ + --cursor_col; + clo = SCRN_BUF_CHARS(screen, screen->cursor_row)[cursor_col]; + chi = SCRN_BUF_WIDEC(screen, screen->cursor_row)[cursor_col]; + } + my_col = cursor_col; base = (chi << 8) | clo; if (iswide(base)) my_col += 1; @@ -5247,6 +5407,14 @@ c2h = SCRN_BUF_COM2H(screen, screen->cursor_row)[my_col]; }) + if_OPT_EXT_COLORS(screen,{ + fg_bg = (SCRN_BUF_FGRND(screen, screen->cursor_row)[cursor_col] << 8) | + (SCRN_BUF_BGRND(screen, screen->cursor_row)[cursor_col]); + }) + if_OPT_ISO_TRADITIONAL_COLORS(screen,{ + fg_bg = SCRN_BUF_COLOR(screen, screen->cursor_row)[cursor_col]; + }) + if (screen->cursor_row > screen->endHRow || (screen->cursor_row == screen->endHRow && screen->cursor_col >= screen->endHCol) || @@ -5270,7 +5438,7 @@ TRACE(("%s @%d, HideCursor calling drawXtermText cur(%d,%d)\n", __FILE__, __LINE__, screen->cursor_row, screen->cursor_col)); drawXtermText(screen, flags, currentGC, - x = CurCursorX(screen, screen->cursor_row, screen->cursor_col), + x = CurCursorX(screen, screen->cursor_row, cursor_col), y = CursorY(screen, screen->cursor_row), curXtermChrSet(screen->cursor_row), PAIRED_CHARS(&clo, &chi), 1, 0); @@ -5388,8 +5556,15 @@ if (full) { /* RIS */ TabReset (term->tabs); term->keyboard.flags = MODE_SRM; +#if OPT_INITIAL_ERASE + if (term->keyboard.reset_DECBKM == 1) + term->keyboard.flags |= MODE_DECBKM; + else if (term->keyboard.reset_DECBKM == 2) +#endif if (term->screen.backarrow_key) term->keyboard.flags |= MODE_DECBKM; + TRACE(("full reset DECBKM %s\n", + (term->keyboard.flags & MODE_DECBKM) ? "on" : "off")); update_appcursor(); update_appkeypad(); update_decbkm(); @@ -5416,7 +5591,7 @@ XtMakeResizeRequest( (Widget) term, (Dimension) 80*FontWidth(screen) - + 2 * screen->border + Scrollbar(screen), + + 2 * screen->border + ScrollbarWidth(screen), (Dimension) FontHeight(screen) * (screen->max_row + 1) + 2 * screen->border, &junk, &junk); @@ -5431,10 +5606,8 @@ * There's a tiny difference, to accommodate usage of xterm. * We reset autowrap to the resource values rather than turning * it off. - * - * FIXME: also reset DECNKM when it's implemented. */ - term->keyboard.flags &= ~(MODE_DECCKM|MODE_KAM); + term->keyboard.flags &= ~(MODE_DECCKM|MODE_KAM|MODE_DECKPAM); bitcpy(&term->flags, term->initflags, WRAPAROUND|REVERSEWRAP); bitclr(&term->flags, INSERT|INVERSE|BOLD|BLINK|UNDERLINE|INVISIBLE); if_OPT_ISO_COLORS(screen,{reset_SGR_Colors();}) @@ -5443,7 +5616,8 @@ update_reversewrap(); CursorSave(term); - memset(screen->sc, 0, sizeof(screen->sc)); + screen->sc[screen->alternate != False].row = + screen->sc[screen->alternate != False].col = 0; } longjmp(vtjmpbuf, 1); /* force ground state in parser */ } Index: xc/programs/xterm/configure diff -u xc/programs/xterm/configure:3.58 xc/programs/xterm/configure:3.62 --- xc/programs/xterm/configure:3.58 Sat Apr 28 09:51:55 2001 +++ xc/programs/xterm/configure Sun Nov 4 21:07:15 2001 @@ -201,6 +201,7 @@ --enable-88-color enable 88-color support --disable-blink-cursor disable support for blinking cursor --disable-bold-color disable PC-style mapping of bold colors + --disable-color-class disable separate color class resources --disable-color-mode disable default colorMode resource --disable-highlighting disable support for color highlighting --disable-doublechars disable support for double-size chars @@ -209,9 +210,9 @@ --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 EOF cat <<EOF + --disable-initial-erase disable setup for stty erase --disable-input-method disable input-method --enable-logging enable logging --enable-logfile-exec enable exec'd logfile filter @@ -223,9 +224,9 @@ --disable-tek4014 disable tek4014 emulation --enable-toolbar compile-in toolbar for pulldown menus --disable-vt52 disable VT52 emulation - --enable-wide-chars enable wide-character support EOF cat <<EOF + --enable-wide-chars enable wide-character support --enable-dec-locator enable DECterm Locator support --disable-ziconbeep disable -ziconbeep option Testing/development Options: @@ -600,7 +601,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:604: checking host system type" >&5 +echo "configure:605: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -659,7 +660,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:663: checking for $ac_word" >&5 +echo "configure:664: 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 @@ -689,7 +690,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:693: checking for $ac_word" >&5 +echo "configure:694: 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 @@ -740,7 +741,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:744: checking for $ac_word" >&5 +echo "configure:745: 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 @@ -772,7 +773,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:776: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:777: 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. @@ -783,12 +784,12 @@ cat > conftest.$ac_ext << EOF -#line 787 "configure" +#line 788 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:793: \"$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 @@ -814,12 +815,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:818: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:819: 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:823: checking whether we are using GNU C" >&5 +echo "configure:824: 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 @@ -828,7 +829,7 @@ yes; #endif EOF -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 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:833: \"$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 @@ -847,7 +848,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:851: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:852: 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 @@ -879,7 +880,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:883: checking how to run the C preprocessor" >&5 +echo "configure:884: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -894,13 +895,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 898 "configure" +#line 899 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:905: \"$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 : @@ -911,13 +912,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 915 "configure" +#line 916 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:921: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:922: \"$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 : @@ -928,13 +929,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 932 "configure" +#line 933 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:938: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:939: \"$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 : @@ -960,13 +961,13 @@ if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:964: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:965: 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 <<EOF -#line 970 "configure" +#line 971 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -984,7 +985,7 @@ if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 988 "configure" +#line 989 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -1010,7 +1011,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:1014: checking for $ac_word" >&5 +echo "configure:1015: 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 @@ -1051,7 +1052,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:1055: checking for a BSD compatible install" >&5 +echo "configure:1056: 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 @@ -1125,9 +1126,9 @@ ### checks for UNIX variants that set C preprocessor variables echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1129: checking for AIX" >&5 +echo "configure:1130: checking for AIX" >&5 cat > conftest.$ac_ext <<EOF -#line 1131 "configure" +#line 1132 "configure" #include "confdefs.h" #ifdef _AIX yes @@ -1149,7 +1150,7 @@ echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1153: checking for POSIXized ISC" >&5 +echo "configure:1154: 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 @@ -1171,17 +1172,17 @@ ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1175: checking for minix/config.h" >&5 +echo "configure:1176: 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 -#line 1180 "configure" +#line 1181 "configure" #include "confdefs.h" #include <minix/config.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1186: \"$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* @@ -1221,6 +1222,7 @@ ### checks for header files for ac_hdr in \ +ncurses/term.h \ stdlib.h \ termios.h \ unistd.h \ @@ -1228,17 +1230,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1232: checking for $ac_hdr" >&5 +echo "configure:1234: 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 -#line 1237 "configure" +#line 1239 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1244: \"$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* @@ -1265,12 +1267,12 @@ 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 +echo "configure:1271: 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 <<EOF -#line 1274 "configure" +#line 1276 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -1279,7 +1281,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1303,13 +1305,13 @@ ### checks for typedefs echo $ac_n "checking for size_t in <sys/types.h> or <stdio.h>""... $ac_c" 1>&6 -echo "configure:1307: checking for size_t in <sys/types.h> or <stdio.h>" >&5 +echo "configure:1309: checking for size_t in <sys/types.h> or <stdio.h>" >&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 <<EOF -#line 1313 "configure" +#line 1315 "configure" #include "confdefs.h" #include <sys/types.h> @@ -1322,7 +1324,7 @@ size_t x ; return 0; } EOF -if { (eval echo configure:1326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_size_t=yes else @@ -1342,12 +1344,12 @@ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1346: checking for ANSI C header files" >&5 +echo "configure:1348: 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 <<EOF -#line 1351 "configure" +#line 1353 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1355,7 +1357,7 @@ #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1361: \"$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* @@ -1372,7 +1374,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 -#line 1376 "configure" +#line 1378 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1390,7 +1392,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 -#line 1394 "configure" +#line 1396 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1411,7 +1413,7 @@ : else cat > conftest.$ac_ext <<EOF -#line 1415 "configure" +#line 1417 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1422,7 +1424,7 @@ exit (0); } EOF -if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1446,12 +1448,12 @@ fi echo $ac_n "checking for time_t""... $ac_c" 1>&6 -echo "configure:1450: checking for time_t" >&5 +echo "configure:1452: 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 <<EOF -#line 1455 "configure" +#line 1457 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1490,12 +1492,12 @@ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1494: checking for $ac_func" >&5 +echo "configure:1496: 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 <<EOF -#line 1499 "configure" +#line 1501 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1518,7 +1520,7 @@ ; return 0; } EOF -if { (eval echo configure:1522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1524: \"$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 @@ -1544,12 +1546,12 @@ echo $ac_n "checking for memmove""... $ac_c" 1>&6 -echo "configure:1548: checking for memmove" >&5 +echo "configure:1550: 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 <<EOF -#line 1553 "configure" +#line 1555 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char memmove(); below. */ @@ -1572,7 +1574,7 @@ ; return 0; } EOF -if { (eval echo configure:1576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1578: \"$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 @@ -1591,12 +1593,12 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for bcopy""... $ac_c" 1>&6 -echo "configure:1595: checking for bcopy" >&5 +echo "configure:1597: 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 <<EOF -#line 1600 "configure" +#line 1602 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char bcopy(); below. */ @@ -1619,7 +1621,7 @@ ; return 0; } EOF -if { (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1625: \"$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 @@ -1635,7 +1637,7 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking if bcopy does overlapping moves""... $ac_c" 1>&6 -echo "configure:1639: checking if bcopy does overlapping moves" >&5 +echo "configure:1641: 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 @@ -1644,7 +1646,7 @@ cf_cv_good_bcopy=unknown else cat > conftest.$ac_ext <<EOF -#line 1648 "configure" +#line 1650 "configure" #include "confdefs.h" int main() { @@ -1657,7 +1659,7 @@ } EOF -if { (eval echo configure:1661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1663: \"$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 @@ -1695,7 +1697,7 @@ echo $ac_n "checking for full tgetent function""... $ac_c" 1>&6 -echo "configure:1699: checking for full tgetent function" >&5 +echo "configure:1701: 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 @@ -1710,7 +1712,7 @@ echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&5 else cat > conftest.$ac_ext <<EOF -#line 1714 "configure" +#line 1716 "configure" #include "confdefs.h" /* terminfo implementations ignore the buffer argument, making it useless for @@ -1724,7 +1726,7 @@ tgetent(buffer, "vt100"); exit(buffer[0] == 0); } EOF -if { (eval echo configure:1728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1730: \"$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 @@ -1760,7 +1762,7 @@ EOF cat > conftest.$ac_ext <<EOF -#line 1764 "configure" +#line 1766 "configure" #include "confdefs.h" #include <termcap.h> @@ -1771,7 +1773,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:1775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TERMCAP_H 1 @@ -1789,7 +1791,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:1793: checking for partial tgetent function" >&5 +echo "configure:1795: 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 @@ -1798,14 +1800,14 @@ for cf_termlib in $cf_TERMLIB ; do LIBS="$cf_save_LIBS -l$cf_termlib" cat > conftest.$ac_ext <<EOF -#line 1802 "configure" +#line 1804 "configure" #include "confdefs.h" int main() { tgetent(0, 0) ; return 0; } EOF -if { (eval echo configure:1809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1811: \"$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" @@ -1828,17 +1830,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1832: checking for $ac_hdr" >&5 +echo "configure:1834: 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 -#line 1837 "configure" +#line 1839 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1844: \"$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* @@ -1879,17 +1881,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1883: checking for $ac_hdr" >&5 +echo "configure:1885: 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 -#line 1888 "configure" +#line 1890 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1895: \"$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* @@ -1916,13 +1918,13 @@ done echo $ac_n "checking for lastlog path""... $ac_c" 1>&6 -echo "configure:1920: checking for lastlog path" >&5 +echo "configure:1922: 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 <<EOF -#line 1926 "configure" +#line 1928 "configure" #include "confdefs.h" #include <sys/types.h> @@ -1937,7 +1939,7 @@ char *path = _PATH_LASTLOG ; return 0; } EOF -if { (eval echo configure:1941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1943: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_path_lastlog="_PATH_LASTLOG" else @@ -1964,7 +1966,7 @@ echo $ac_n "checking for utmp implementation""... $ac_c" 1>&6 -echo "configure:1968: checking for utmp implementation" >&5 +echo "configure:1970: 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 @@ -1972,7 +1974,7 @@ cf_cv_have_utmp=no for cf_header in utmpx utmp ; do cat > conftest.$ac_ext <<EOF -#line 1976 "configure" +#line 1978 "configure" #include "confdefs.h" #include <sys/types.h> @@ -1988,7 +1990,7 @@ ; return 0; } EOF -if { (eval echo configure:1992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp=$cf_header break @@ -1998,7 +2000,7 @@ rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 2002 "configure" +#line 2004 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2014,7 +2016,7 @@ ; return 0; } EOF -if { (eval echo configure:2018: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp=$cf_header cat >> confdefs.h <<\EOF @@ -2049,13 +2051,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:2053: checking if utmp.ut_host is declared" >&5 +echo "configure:2055: 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 <<EOF -#line 2059 "configure" +#line 2061 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2064,7 +2066,7 @@ struct $cf_cv_have_utmp x; char *y = &x.ut_host[0] ; return 0; } EOF -if { (eval echo configure:2068: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_host=yes else @@ -2088,7 +2090,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:2092: checking for exit-status in $cf_cv_have_utmp" >&5 +echo "configure:2094: 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 @@ -2100,7 +2102,7 @@ ut_exit.ut_exit do cat > conftest.$ac_ext <<EOF -#line 2104 "configure" +#line 2106 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2109,7 +2111,7 @@ struct $cf_cv_have_utmp x; long y = x.$cf_result = 0 ; return 0; } EOF -if { (eval echo configure:2113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xstatus=$cf_result break @@ -2141,13 +2143,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:2145: checking if utmp.ut_xtime is declared" >&5 +echo "configure:2147: 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 <<EOF -#line 2151 "configure" +#line 2153 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2156,7 +2158,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0 ; return 0; } EOF -if { (eval echo configure:2160: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xtime=yes else @@ -2164,7 +2166,7 @@ cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 2168 "configure" +#line 2170 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2173,7 +2175,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec ; return 0; } EOF -if { (eval echo configure:2177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xtime=define else @@ -2208,13 +2210,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:2212: checking if utmp.ut_session is declared" >&5 +echo "configure:2214: 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 <<EOF -#line 2218 "configure" +#line 2220 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2223,7 +2225,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_session ; return 0; } EOF -if { (eval echo configure:2227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_session=yes else @@ -2248,14 +2250,14 @@ echo $ac_n "checking if $cf_cv_have_utmp is SYSV flavor""... $ac_c" 1>&6 -echo "configure:2252: checking if $cf_cv_have_utmp is SYSV flavor" >&5 +echo "configure:2254: 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 <<EOF -#line 2259 "configure" +#line 2261 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2269,7 +2271,7 @@ end${cf_prefix}ent(); ; return 0; } EOF -if { (eval echo configure:2273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_sysv_utmp=yes else @@ -2292,7 +2294,7 @@ echo $ac_n "checking if you want to link with utempter""... $ac_c" 1>&6 -echo "configure:2296: checking if you want to link with utempter" >&5 +echo "configure:2298: 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 @@ -2307,7 +2309,7 @@ if test $use_utempter = yes ; then echo $ac_n "checking if we can link with utempter library""... $ac_c" 1>&6 -echo "configure:2311: checking if we can link with utempter library" >&5 +echo "configure:2313: 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 @@ -2315,7 +2317,7 @@ cf_save_LIBS="$LIBS" LIBS="-lutempter $LIBS" cat > conftest.$ac_ext <<EOF -#line 2319 "configure" +#line 2321 "configure" #include "confdefs.h" #include <utempter.h> @@ -2327,7 +2329,7 @@ ; return 0; } EOF -if { (eval echo configure:2331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_have_utempter=yes @@ -2358,13 +2360,13 @@ echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6 -echo "configure:2362: checking if external errno is declared" >&5 +echo "configure:2364: 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 <<EOF -#line 2368 "configure" +#line 2370 "configure" #include "confdefs.h" #ifdef HAVE_STDLIB_H @@ -2377,7 +2379,7 @@ long x = (long) errno ; return 0; } EOF -if { (eval echo configure:2381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2383: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval 'cf_cv_dcl_'errno'=yes' else @@ -2408,13 +2410,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:2412: checking if external errno exists" >&5 +echo "configure:2414: 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 <<EOF -#line 2418 "configure" +#line 2420 "configure" #include "confdefs.h" #undef errno @@ -2424,7 +2426,7 @@ errno = 2 ; return 0; } EOF -if { (eval echo configure:2428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2430: \"$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 @@ -2456,7 +2458,7 @@ echo $ac_n "checking for tty group name""... $ac_c" 1>&6 -echo "configure:2460: checking for tty group name" >&5 +echo "configure:2462: 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 @@ -2514,7 +2516,7 @@ echo $ac_n "checking if we may use tty group""... $ac_c" 1>&6 -echo "configure:2518: checking if we may use tty group" >&5 +echo "configure:2520: 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 @@ -2523,7 +2525,7 @@ cf_cv_tty_group=unknown else cat > conftest.$ac_ext <<EOF -#line 2527 "configure" +#line 2529 "configure" #include "confdefs.h" #include <unistd.h> @@ -2548,7 +2550,7 @@ } EOF -if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2554: \"$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 @@ -2573,7 +2575,7 @@ ### checks for compiler characteristics echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:2577: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:2579: 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 @@ -2616,7 +2618,7 @@ done cat > conftest.$ac_ext <<EOF -#line 2620 "configure" +#line 2622 "configure" #include "confdefs.h" #ifndef CC_HAS_PROTOS @@ -2632,7 +2634,7 @@ struct s2 {int (*f) (double a);}; ; return 0; } EOF -if { (eval echo configure:2636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else @@ -2678,12 +2680,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2682: checking for working const" >&5 +echo "configure:2684: 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 <<EOF -#line 2687 "configure" +#line 2689 "configure" #include "confdefs.h" int main() { @@ -2732,7 +2734,7 @@ ; return 0; } EOF -if { (eval echo configure:2736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2756,12 +2758,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:2760: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2762: 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 <<EOF -#line 2765 "configure" +#line 2767 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -2777,7 +2779,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2781: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2800,13 +2802,13 @@ echo $ac_n "checking for POSIX wait functions""... $ac_c" 1>&6 -echo "configure:2804: checking for POSIX wait functions" >&5 +echo "configure:2806: 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 <<EOF -#line 2810 "configure" +#line 2812 "configure" #include "confdefs.h" #include <stdlib.h> @@ -2824,7 +2826,7 @@ ; return 0; } EOF -if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_posix_wait=yes else @@ -2845,13 +2847,13 @@ echo $ac_n "checking if this platform has SYSV flavor""... $ac_c" 1>&6 -echo "configure:2849: checking if this platform has SYSV flavor" >&5 +echo "configure:2851: 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 <<EOF -#line 2855 "configure" +#line 2857 "configure" #include "confdefs.h" #include <curses.h> @@ -2876,7 +2878,7 @@ ; return 0; } EOF -if { (eval echo configure:2880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sysv=yes else @@ -2897,7 +2899,7 @@ echo $ac_n "checking for elf_begin in -lelf""... $ac_c" 1>&6 -echo "configure:2901: checking for elf_begin in -lelf" >&5 +echo "configure:2903: 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 @@ -2905,7 +2907,7 @@ ac_save_LIBS="$LIBS" LIBS="-lelf $LIBS" cat > conftest.$ac_ext <<EOF -#line 2909 "configure" +#line 2911 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2916,7 +2918,7 @@ elf_begin() ; return 0; } EOF -if { (eval echo configure:2920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2922: \"$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 @@ -2933,13 +2935,13 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking if this is an SVR4 system""... $ac_c" 1>&6 -echo "configure:2937: checking if this is an SVR4 system" >&5 +echo "configure:2939: 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 <<EOF -#line 2943 "configure" +#line 2945 "configure" #include "confdefs.h" #include <elf.h> @@ -2960,7 +2962,7 @@ ; return 0; } EOF -if { (eval echo configure:2964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_svr4=yes else @@ -2986,13 +2988,13 @@ echo $ac_n "checking if we must define _GNU_SOURCE""... $ac_c" 1>&6 -echo "configure:2990: checking if we must define _GNU_SOURCE" >&5 +echo "configure:2992: 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 <<EOF -#line 2996 "configure" +#line 2998 "configure" #include "confdefs.h" #include <sys/types.h> int main() { @@ -3002,7 +3004,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:3006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_gnu_source=no else @@ -3012,7 +3014,7 @@ cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat > conftest.$ac_ext <<EOF -#line 3016 "configure" +#line 3018 "configure" #include "confdefs.h" #include <sys/types.h> int main() { @@ -3022,7 +3024,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:3026: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_gnu_source=no else @@ -3047,7 +3049,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:3051: checking for X" >&5 +echo "configure:3053: checking for X" >&5 # Check whether --with-x or --without-x was given. @@ -3110,12 +3112,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 3114 "configure" +#line 3116 "configure" #include "confdefs.h" #include <$x_direct_test_include> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3119: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3121: \"$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* @@ -3184,14 +3186,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <<EOF -#line 3188 "configure" +#line 3190 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:3195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3197: \"$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. @@ -3291,7 +3293,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:3295: checking for open in -lc_s" >&5 +echo "configure:3297: 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 @@ -3299,7 +3301,7 @@ ac_save_LIBS="$LIBS" LIBS="-lc_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 3303 "configure" +#line 3305 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3310,7 +3312,7 @@ open() ; return 0; } EOF -if { (eval echo configure:3314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3316: \"$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 @@ -3327,7 +3329,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:3331: checking for gethostname in -lbsd" >&5 +echo "configure:3333: 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 @@ -3335,7 +3337,7 @@ ac_save_LIBS="$LIBS" LIBS="-lbsd $LIBS" cat > conftest.$ac_ext <<EOF -#line 3339 "configure" +#line 3341 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3346,7 +3348,7 @@ gethostname() ; return 0; } EOF -if { (eval echo configure:3350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3352: \"$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 @@ -3363,7 +3365,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:3367: checking for gethostname in -lnsl_s" >&5 +echo "configure:3369: 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 @@ -3371,7 +3373,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 3375 "configure" +#line 3377 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3382,7 +3384,7 @@ gethostname() ; return 0; } EOF -if { (eval echo configure:3386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3388: \"$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 @@ -3399,7 +3401,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:3403: checking for XOpenDisplay in -lX11_s" >&5 +echo "configure:3405: 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 @@ -3407,7 +3409,7 @@ ac_save_LIBS="$LIBS" LIBS="-lX11_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 3411 "configure" +#line 3413 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3418,7 +3420,7 @@ XOpenDisplay() ; return 0; } EOF -if { (eval echo configure:3422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3424: \"$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 @@ -3435,7 +3437,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:3439: checking for XtAppInitialize in -lXt_s" >&5 +echo "configure:3441: 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 @@ -3443,7 +3445,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXt_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 3447 "configure" +#line 3449 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3454,7 +3456,7 @@ XtAppInitialize() ; return 0; } EOF -if { (eval echo configure:3458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3460: \"$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 @@ -3495,7 +3497,7 @@ ;; *) echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:3499: checking for socket in -lsocket" >&5 +echo "configure:3501: 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 @@ -3503,7 +3505,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 3507 "configure" +#line 3509 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3514,7 +3516,7 @@ socket() ; return 0; } EOF -if { (eval echo configure:3518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3520: \"$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 @@ -3542,7 +3544,7 @@ fi echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6 -echo "configure:3546: checking for gethostname in -lnsl" >&5 +echo "configure:3548: 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 @@ -3550,7 +3552,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3554 "configure" +#line 3556 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3561,7 +3563,7 @@ gethostname() ; return 0; } EOF -if { (eval echo configure:3565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3567: \"$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 @@ -3612,17 +3614,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:3616: checking whether -R must be followed by a space" >&5 +echo "configure:3618: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <<EOF -#line 3619 "configure" +#line 3621 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:3626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -3638,14 +3640,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <<EOF -#line 3642 "configure" +#line 3644 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:3649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -3677,7 +3679,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:3681: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:3683: 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 @@ -3685,7 +3687,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <<EOF -#line 3689 "configure" +#line 3691 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3696,7 +3698,7 @@ dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:3700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3702: \"$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 @@ -3718,7 +3720,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:3722: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:3724: 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 @@ -3726,7 +3728,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <<EOF -#line 3730 "configure" +#line 3732 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3737,7 +3739,7 @@ dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:3741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3743: \"$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 @@ -3766,12 +3768,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:3770: checking for gethostbyname" >&5 +echo "configure:3772: 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 <<EOF -#line 3775 "configure" +#line 3777 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname(); below. */ @@ -3794,7 +3796,7 @@ ; return 0; } EOF -if { (eval echo configure:3798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3800: \"$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 @@ -3815,7 +3817,7 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3819: checking for gethostbyname in -lnsl" >&5 +echo "configure:3821: 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 @@ -3823,7 +3825,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3827 "configure" +#line 3829 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3834,7 +3836,7 @@ gethostbyname() ; return 0; } EOF -if { (eval echo configure:3838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3840: \"$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 @@ -3864,12 +3866,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:3868: checking for connect" >&5 +echo "configure:3870: 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 <<EOF -#line 3873 "configure" +#line 3875 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -3892,7 +3894,7 @@ ; return 0; } EOF -if { (eval echo configure:3896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3898: \"$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 @@ -3913,7 +3915,7 @@ if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3917: checking for connect in -lsocket" >&5 +echo "configure:3919: 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 @@ -3921,7 +3923,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 3925 "configure" +#line 3927 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3932,7 +3934,7 @@ connect() ; return 0; } EOF -if { (eval echo configure:3936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3938: \"$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 @@ -3956,12 +3958,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:3960: checking for remove" >&5 +echo "configure:3962: 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 <<EOF -#line 3965 "configure" +#line 3967 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove(); below. */ @@ -3984,7 +3986,7 @@ ; return 0; } EOF -if { (eval echo configure:3988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3990: \"$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 @@ -4005,7 +4007,7 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:4009: checking for remove in -lposix" >&5 +echo "configure:4011: 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 @@ -4013,7 +4015,7 @@ ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 4017 "configure" +#line 4019 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4024,7 +4026,7 @@ remove() ; return 0; } EOF -if { (eval echo configure:4028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4030: \"$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 @@ -4048,12 +4050,12 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:4052: checking for shmat" >&5 +echo "configure:4054: 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 <<EOF -#line 4057 "configure" +#line 4059 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat(); below. */ @@ -4076,7 +4078,7 @@ ; return 0; } EOF -if { (eval echo configure:4080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4082: \"$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 @@ -4097,7 +4099,7 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:4101: checking for shmat in -lipc" >&5 +echo "configure:4103: 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 @@ -4105,7 +4107,7 @@ ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <<EOF -#line 4109 "configure" +#line 4111 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4116,7 +4118,7 @@ shmat() ; return 0; } EOF -if { (eval echo configure:4120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4122: \"$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 @@ -4149,7 +4151,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:4153: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:4155: 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 @@ -4157,7 +4159,7 @@ ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4161 "configure" +#line 4163 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4168,7 +4170,7 @@ IceConnectionNumber() ; return 0; } EOF -if { (eval echo configure:4172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4174: \"$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 @@ -4213,7 +4215,7 @@ done echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:4217: checking for XOpenDisplay in -lX11" >&5 +echo "configure:4219: 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 @@ -4221,7 +4223,7 @@ ac_save_LIBS="$LIBS" LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4225 "configure" +#line 4227 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4232,7 +4234,7 @@ XOpenDisplay() ; return 0; } EOF -if { (eval echo configure:4236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4238: \"$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 @@ -4253,7 +4255,7 @@ fi echo $ac_n "checking for XtAppInitialize in -lXt""... $ac_c" 1>&6 -echo "configure:4257: checking for XtAppInitialize in -lXt" >&5 +echo "configure:4259: 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 @@ -4261,7 +4263,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4265 "configure" +#line 4267 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4272,7 +4274,7 @@ XtAppInitialize() ; return 0; } EOF -if { (eval echo configure:4276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4278: \"$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 @@ -4335,17 +4337,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4339: checking for $ac_hdr" >&5 +echo "configure:4341: 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 -#line 4344 "configure" +#line 4346 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4351: \"$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* @@ -4393,7 +4395,7 @@ echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6 -echo "configure:4397: checking for XextCreateExtension in -lXext" >&5 +echo "configure:4399: 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 @@ -4401,7 +4403,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXext $LIBS" cat > conftest.$ac_ext <<EOF -#line 4405 "configure" +#line 4407 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4412,7 +4414,7 @@ XextCreateExtension() ; return 0; } EOF -if { (eval echo configure:4416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4418: \"$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 @@ -4449,13 +4451,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:4453: checking for $cf_test in $cf_path" >&5 +echo "configure:4455: checking for $cf_test in $cf_path" >&5 else echo $ac_n "checking for $cf_test""... $ac_c" 1>&6 -echo "configure:4456: checking for $cf_test" >&5 +echo "configure:4458: checking for $cf_test" >&5 fi cat > conftest.$ac_ext <<EOF -#line 4459 "configure" +#line 4461 "configure" #include "confdefs.h" #include <X11/Intrinsic.h> @@ -4464,7 +4466,7 @@ ; return 0; } EOF -if { (eval echo configure:4468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_result=yes else @@ -4490,21 +4492,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:4494: checking for $cf_lib in $cf_path" >&5 +echo "configure:4496: 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:4498: checking for $cf_test in $cf_lib" >&5 +echo "configure:4500: checking for $cf_test in $cf_lib" >&5 fi cat > conftest.$ac_ext <<EOF -#line 4501 "configure" +#line 4503 "configure" #include "confdefs.h" int main() { $cf_test() ; return 0; } EOF -if { (eval echo configure:4508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else @@ -4542,13 +4544,13 @@ echo $ac_n "checking for declaration of fd_set""... $ac_c" 1>&6 -echo "configure:4546: checking for declaration of fd_set" >&5 +echo "configure:4548: 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 <<EOF -#line 4552 "configure" +#line 4554 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4556,7 +4558,7 @@ fd_set x ; return 0; } EOF -if { (eval echo configure:4560: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=sys/types.h else @@ -4565,7 +4567,7 @@ rm -rf conftest* echo "trying X11/Xpoll.h" 1>&5 cat > conftest.$ac_ext <<EOF -#line 4569 "configure" +#line 4571 "configure" #include "confdefs.h" #ifdef HAVE_X11_XPOLL_H @@ -4575,7 +4577,7 @@ fd_set x ; return 0; } EOF -if { (eval echo configure:4579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=X11/Xpoll.h else @@ -4584,7 +4586,7 @@ rm -rf conftest* echo "trying sys/select.h" 1>&5 cat > conftest.$ac_ext <<EOF -#line 4588 "configure" +#line 4590 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4593,7 +4595,7 @@ fd_set x ; return 0; } EOF -if { (eval echo configure:4597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=sys/select.h else @@ -4619,13 +4621,13 @@ echo $ac_n "checking for IRIX 6.5 baud-rate redefinitions""... $ac_c" 1>&6 -echo "configure:4623: checking for IRIX 6.5 baud-rate redefinitions" >&5 +echo "configure:4625: 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 <<EOF -#line 4629 "configure" +#line 4631 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4638,7 +4640,7 @@ ; return 0; } EOF -if { (eval echo configure:4642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_termio_c_ispeed=yes @@ -4666,12 +4668,12 @@ for ac_func in grantpt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4670: checking for $ac_func" >&5 +echo "configure:4672: 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 <<EOF -#line 4675 "configure" +#line 4677 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4694,7 +4696,7 @@ ; return 0; } EOF -if { (eval echo configure:4698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4700: \"$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 @@ -4716,7 +4718,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for openpty in -lutil""... $ac_c" 1>&6 -echo "configure:4720: checking for openpty in -lutil" >&5 +echo "configure:4722: 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 @@ -4724,7 +4726,7 @@ ac_save_LIBS="$LIBS" LIBS="-lutil $LIBS" cat > conftest.$ac_ext <<EOF -#line 4728 "configure" +#line 4730 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4735,7 +4737,7 @@ openpty() ; return 0; } EOF -if { (eval echo configure:4739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4741: \"$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 @@ -4769,7 +4771,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:4773: checking for $ac_word" >&5 +echo "configure:4775: 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 @@ -4807,12 +4809,12 @@ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4811: checking for $ac_func" >&5 +echo "configure:4813: 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 <<EOF -#line 4816 "configure" +#line 4818 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4835,7 +4837,7 @@ ; return 0; } EOF -if { (eval echo configure:4839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4841: \"$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 @@ -4859,9 +4861,68 @@ fi done +for ac_func in Xutf8LookupString +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:4868: 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 <<EOF +#line 4873 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4896: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +EXTRAHDRS="$EXTRAHDRS xutf8.h" + EXTRASRCS="$EXTRASRCS xutf8.c" + EXTRAOBJS="$EXTRAOBJS xutf8.o" + +fi +done + + echo $ac_n "checking if we should use imake to help""... $ac_c" 1>&6 -echo "configure:4865: checking if we should use imake to help" >&5 +echo "configure:4926: 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 @@ -4886,7 +4947,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:4890: checking for $ac_word" >&5 +echo "configure:4951: 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 @@ -5044,7 +5105,7 @@ fi echo $ac_n "checking for default terminal-id""... $ac_c" 1>&6 -echo "configure:5048: checking for default terminal-id" >&5 +echo "configure:5109: 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 @@ -5065,7 +5126,7 @@ echo $ac_n "checking for default terminal-type""... $ac_c" 1>&6 -echo "configure:5069: checking for default terminal-type" >&5 +echo "configure:5130: 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 @@ -5082,7 +5143,7 @@ echo $ac_n "checking for private terminfo-directory""... $ac_c" 1>&6 -echo "configure:5086: checking for private terminfo-directory" >&5 +echo "configure:5147: 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 @@ -5123,7 +5184,7 @@ echo $ac_n "checking if you want active-icons""... $ac_c" 1>&6 -echo "configure:5127: checking if you want active-icons" >&5 +echo "configure:5188: 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 @@ -5149,7 +5210,7 @@ fi echo $ac_n "checking if you want ANSI color""... $ac_c" 1>&6 -echo "configure:5153: checking if you want ANSI color" >&5 +echo "configure:5214: 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 @@ -5175,7 +5236,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:5179: checking if you want 16 colors like aixterm" >&5 +echo "configure:5240: 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 @@ -5199,7 +5260,7 @@ echo $ac_n "checking if you want 256 colors""... $ac_c" 1>&6 -echo "configure:5203: checking if you want 256 colors" >&5 +echo "configure:5264: 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 @@ -5226,7 +5287,7 @@ else echo $ac_n "checking if you want 88 colors""... $ac_c" 1>&6 -echo "configure:5230: checking if you want 88 colors" >&5 +echo "configure:5291: 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 @@ -5257,7 +5318,7 @@ fi echo $ac_n "checking if you want blinking cursor""... $ac_c" 1>&6 -echo "configure:5261: checking if you want blinking cursor" >&5 +echo "configure:5322: 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 @@ -5283,7 +5344,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:5287: checking if you want bold colors mapped like IBM PC" >&5 +echo "configure:5348: 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 @@ -5306,8 +5367,32 @@ EOF + echo $ac_n "checking if you want separate color-classes""... $ac_c" 1>&6 +echo "configure:5372: checking if you want separate color-classes" >&5 + +# Check whether --enable-color-class or --disable-color-class was given. +if test "${enable_color_class+set}" = set; then + enableval="$enable_color_class" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_color_class=no + else + enable_color_class=yes + fi +else + enableval=yes + enable_color_class=yes + +fi + + echo "$ac_t""$enable_color_class" 1>&6 + test $enable_color_class = no && cat >> confdefs.h <<\EOF +#define OPT_COLOR_CLASS FALSE +EOF + + echo $ac_n "checking if you want color-mode enabled by default""... $ac_c" 1>&6 -echo "configure:5311: checking if you want color-mode enabled by default" >&5 +echo "configure:5396: 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 @@ -5333,7 +5418,7 @@ fi echo $ac_n "checking if you want support for color highlighting""... $ac_c" 1>&6 -echo "configure:5337: checking if you want support for color highlighting" >&5 +echo "configure:5422: 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 @@ -5357,7 +5442,7 @@ echo $ac_n "checking if you want support for doublesize characters""... $ac_c" 1>&6 -echo "configure:5361: checking if you want support for doublesize characters" >&5 +echo "configure:5446: 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 @@ -5381,7 +5466,7 @@ echo $ac_n "checking if you want fallback-support for box characters""... $ac_c" 1>&6 -echo "configure:5385: checking if you want fallback-support for box characters" >&5 +echo "configure:5470: 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 @@ -5405,7 +5490,7 @@ 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 +echo "configure:5494: 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 @@ -5427,7 +5512,7 @@ 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 +echo "configure:5516: 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 @@ -5437,7 +5522,7 @@ LIBS="$cf_freetype_libs $LIBS" cat > conftest.$ac_ext <<EOF -#line 5441 "configure" +#line 5526 "configure" #include "confdefs.h" #include <X11/Xlib.h> @@ -5449,7 +5534,7 @@ ; return 0; } EOF -if { (eval echo configure:5453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_x_freetype=yes else @@ -5479,7 +5564,7 @@ fi echo $ac_n "checking if you want support for HP-style function keys""... $ac_c" 1>&6 -echo "configure:5483: checking if you want support for HP-style function keys" >&5 +echo "configure:5568: 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 @@ -5505,7 +5590,7 @@ fi echo $ac_n "checking if you want support for SCO-style function keys""... $ac_c" 1>&6 -echo "configure:5509: checking if you want support for SCO-style function keys" >&5 +echo "configure:5594: 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 @@ -5531,7 +5616,7 @@ fi echo $ac_n "checking if you want support for internationalization""... $ac_c" 1>&6 -echo "configure:5535: checking if you want support for internationalization" >&5 +echo "configure:5620: checking if you want support for internationalization" >&5 # Check whether --enable-i18n or --disable-i18n was given. if test "${enable_i18n+set}" = set; then @@ -5557,7 +5642,7 @@ fi echo $ac_n "checking if you want support for initial-erase setup""... $ac_c" 1>&6 -echo "configure:5561: checking if you want support for initial-erase setup" >&5 +echo "configure:5646: 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 @@ -5583,7 +5668,7 @@ fi echo $ac_n "checking if you want support for input-method""... $ac_c" 1>&6 -echo "configure:5587: checking if you want support for input-method" >&5 +echo "configure:5672: 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 @@ -5603,13 +5688,13 @@ echo "$ac_t""$enable_ximp" 1>&6 echo $ac_n "checking if X libraries support input-method""... $ac_c" 1>&6 -echo "configure:5607: checking if X libraries support input-method" >&5 +echo "configure:5692: 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 <<EOF -#line 5613 "configure" +#line 5698 "configure" #include "confdefs.h" #include <X11/IntrinsicP.h> @@ -5636,7 +5721,7 @@ ; return 0; } EOF -if { (eval echo configure:5640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_input_method=yes else @@ -5659,7 +5744,7 @@ fi echo $ac_n "checking if you want support for logging""... $ac_c" 1>&6 -echo "configure:5663: checking if you want support for logging" >&5 +echo "configure:5748: checking if you want support for logging" >&5 # Check whether --enable-logging or --disable-logging was given. if test "${enable_logging+set}" = set; then @@ -5683,7 +5768,7 @@ EOF echo $ac_n "checking if you want to allow logging via a pipe""... $ac_c" 1>&6 -echo "configure:5687: checking if you want to allow logging via a pipe" >&5 +echo "configure:5772: 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 @@ -5710,7 +5795,7 @@ fi echo $ac_n "checking if you want support for iconify/maximize translations""... $ac_c" 1>&6 -echo "configure:5714: checking if you want support for iconify/maximize translations" >&5 +echo "configure:5799: 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 @@ -5734,7 +5819,7 @@ echo $ac_n "checking if you want NumLock to override keyboard tables""... $ac_c" 1>&6 -echo "configure:5738: checking if you want NumLock to override keyboard tables" >&5 +echo "configure:5823: 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 @@ -5758,7 +5843,7 @@ echo $ac_n "checking if you want support for right-scrollbar""... $ac_c" 1>&6 -echo "configure:5762: checking if you want support for right-scrollbar" >&5 +echo "configure:5847: 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 @@ -5784,7 +5869,7 @@ fi echo $ac_n "checking if you want check for redundant name-change""... $ac_c" 1>&6 -echo "configure:5788: checking if you want check for redundant name-change" >&5 +echo "configure:5873: 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 @@ -5808,7 +5893,7 @@ echo $ac_n "checking if you want to use termcap-query/report""... $ac_c" 1>&6 -echo "configure:5812: checking if you want to use termcap-query/report" >&5 +echo "configure:5897: 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 @@ -5832,7 +5917,7 @@ echo $ac_n "checking if you want support for tek4014""... $ac_c" 1>&6 -echo "configure:5836: checking if you want support for tek4014" >&5 +echo "configure:5921: checking if you want support for tek4014" >&5 # Check whether --enable-tek4014 or --disable-tek4014 was given. if test "${enable_tek4014+set}" = set; then @@ -5862,7 +5947,7 @@ fi echo $ac_n "checking if you want pulldown menus with a toolbar""... $ac_c" 1>&6 -echo "configure:5866: checking if you want pulldown menus with a toolbar" >&5 +echo "configure:5951: 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 @@ -5886,7 +5971,7 @@ echo $ac_n "checking if you want VT52 emulation""... $ac_c" 1>&6 -echo "configure:5890: checking if you want VT52 emulation" >&5 +echo "configure:5975: checking if you want VT52 emulation" >&5 # Check whether --enable-vt52 or --disable-vt52 was given. if test "${enable_vt52+set}" = set; then @@ -5910,7 +5995,7 @@ echo $ac_n "checking if you want wide-character support""... $ac_c" 1>&6 -echo "configure:5914: checking if you want wide-character support" >&5 +echo "configure:5999: 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 @@ -5933,13 +6018,13 @@ #define OPT_WIDE_CHARS 1 EOF - EXTRAHDRS="$EXTRAHDRS charclass.h keysym2ucs.h precompose.h wcwidth.h" - EXTRASRCS="$EXTRASRCS charclass.c keysym2ucs.c precompose.c wcwidth.c" - EXTRAOBJS="$EXTRAOBJS charclass.o keysym2ucs.o precompose.o wcwidth.o" + EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h" + EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c" + EXTRAOBJS="$EXTRAOBJS charclass.o precompose.o wcwidth.o" fi echo $ac_n "checking if you want DECterm Locator support""... $ac_c" 1>&6 -echo "configure:5943: checking if you want DECterm Locator support" >&5 +echo "configure:6028: 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 @@ -5965,7 +6050,7 @@ fi echo $ac_n "checking if you want -ziconbeep option""... $ac_c" 1>&6 -echo "configure:5969: checking if you want -ziconbeep option" >&5 +echo "configure:6054: checking if you want -ziconbeep option" >&5 # Check whether --enable-ziconbeep or --disable-ziconbeep was given. if test "${enable_ziconbeep+set}" = set; then @@ -5992,7 +6077,7 @@ echo $ac_n "checking if you want debugging traces""... $ac_c" 1>&6 -echo "configure:5996: checking if you want debugging traces" >&5 +echo "configure:6081: checking if you want debugging traces" >&5 # Check whether --enable-trace or --disable-trace was given. if test "${enable_trace+set}" = set; then @@ -6021,7 +6106,7 @@ echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6 -echo "configure:6025: checking if you want to see long compiling messages" >&5 +echo "configure:6110: 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 @@ -6061,7 +6146,7 @@ echo $ac_n "checking if you want magic cookie emulation""... $ac_c" 1>&6 -echo "configure:6065: checking if you want magic cookie emulation" >&5 +echo "configure:6150: 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 @@ -6090,7 +6175,7 @@ if test -n "$GCC" ; then echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6 -echo "configure:6094: checking if you want to turn on gcc warnings" >&5 +echo "configure:6179: 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 @@ -6130,9 +6215,9 @@ if test "$GCC" = yes then echo "checking for $CC __attribute__ directives" 1>&6 -echo "configure:6134: checking for $CC __attribute__ directives" >&5 +echo "configure:6219: checking for $CC __attribute__ directives" >&5 cat > conftest.$ac_ext <<EOF -#line 6136 "configure" +#line 6221 "configure" #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -6170,7 +6255,7 @@ EOF ;; esac - if { (eval echo configure:6174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:6259: \"$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 @@ -6187,11 +6272,11 @@ if test "$GCC" = yes then cat > conftest.$ac_ext <<EOF -#line 6191 "configure" +#line 6276 "configure" int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } EOF echo "checking for $CC warning options" 1>&6 -echo "configure:6195: checking for $CC warning options" >&5 +echo "configure:6280: checking for $CC warning options" >&5 cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" cf_warn_CONST="" @@ -6209,7 +6294,7 @@ Wstrict-prototypes $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo configure:6213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:6298: \"$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" @@ -6231,8 +6316,12 @@ ### remove from CPPFLAGS the optional features we define in xtermcfg.h for cf_def in \ + ALLOWLOGGING \ + OPT_WIDE_CHARS \ SCROLLBAR_RIGHT \ - OPT_WIDE_CHARS + USE_TTY_GROUP \ + USE_UTEMPTER \ + XRENDERFONT do CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//` done Index: xc/programs/xterm/configure.in diff -u xc/programs/xterm/configure.in:3.47 xc/programs/xterm/configure.in:3.51 --- xc/programs/xterm/configure.in:3.47 Wed Apr 11 21:02:50 2001 +++ xc/programs/xterm/configure.in Sun Nov 4 21:07:15 2001 @@ -1,5 +1,5 @@ dnl -dnl $XFree86: xc/programs/xterm/configure.in,v 3.47 2001/04/12 01:02:50 dickey Exp $ +dnl $XFree86: xc/programs/xterm/configure.in,v 3.51 2001/11/05 02:07:15 dickey Exp $ dnl dnl --------------------------------------------------------------------------- dnl @@ -57,6 +57,7 @@ ### checks for header files AC_CHECK_HEADERS( \ +ncurses/term.h \ stdlib.h \ termios.h \ unistd.h \ @@ -128,6 +129,11 @@ AC_CHECK_FUNCS( \ XkbStdBell \ ) +AC_CHECK_FUNCS(Xutf8LookupString, [],[ + EXTRAHDRS="$EXTRAHDRS xutf8.h" + EXTRASRCS="$EXTRASRCS xutf8.c" + EXTRAOBJS="$EXTRAOBJS xutf8.o" +]) AC_MSG_CHECKING(if we should use imake to help) CF_ARG_DISABLE(imake, @@ -264,6 +270,14 @@ AC_MSG_RESULT($enable_pc_color) test $enable_pc_color = no && AC_DEFINE(OPT_PC_COLORS,0) + AC_MSG_CHECKING(if you want separate color-classes) + CF_ARG_DISABLE(color-class, + [ --disable-color-class disable separate color class resources], + [enable_color_class=no], + [enable_color_class=yes]) + AC_MSG_RESULT($enable_color_class) + test $enable_color_class = no && AC_DEFINE(OPT_COLOR_CLASS,FALSE) + AC_MSG_CHECKING(if you want color-mode enabled by default) CF_ARG_DISABLE(color-mode, [ --disable-color-mode disable default colorMode resource], @@ -461,9 +475,9 @@ AC_MSG_RESULT($enable_wchar) if test $enable_wchar = yes ; then AC_DEFINE(OPT_WIDE_CHARS,1) - EXTRAHDRS="$EXTRAHDRS charclass.h keysym2ucs.h precompose.h wcwidth.h" - EXTRASRCS="$EXTRASRCS charclass.c keysym2ucs.c precompose.c wcwidth.c" - EXTRAOBJS="$EXTRAOBJS charclass.o keysym2ucs.o precompose.o wcwidth.o" + EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h" + EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c" + EXTRAOBJS="$EXTRAOBJS charclass.o precompose.o wcwidth.o" fi AC_MSG_CHECKING(if you want DECterm Locator support) @@ -535,8 +549,12 @@ ### remove from CPPFLAGS the optional features we define in xtermcfg.h for cf_def in \ + ALLOWLOGGING \ + OPT_WIDE_CHARS \ SCROLLBAR_RIGHT \ - OPT_WIDE_CHARS + USE_TTY_GROUP \ + USE_UTEMPTER \ + XRENDERFONT do CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//` done Index: xc/programs/xterm/fontutils.c diff -u xc/programs/xterm/fontutils.c:1.31 xc/programs/xterm/fontutils.c:1.32 --- xc/programs/xterm/fontutils.c:1.31 Thu Jan 4 13:26:12 2001 +++ xc/programs/xterm/fontutils.c Mon Jun 18 15:09:26 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/fontutils.c,v 1.31 2001/01/04 18:26:12 keithp Exp $ + * $XFree86: xc/programs/xterm/fontutils.c,v 1.32 2001/06/18 19:09:26 dickey Exp $ */ /************************************************************ @@ -44,6 +44,7 @@ #include <data.h> #include <menu.h> +#include <xstrings.h> #include <xterm.h> #include <stdio.h> @@ -455,11 +456,11 @@ 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, + 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 ( + return term->screen.free_bold_box || ( (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) @@ -531,10 +532,8 @@ if (fontnum == fontMenu_fontescape && nfontname != screen->menu_font_names[fontnum]) { - tmpname = (char *) malloc (strlen(nfontname) + 1); - if (!tmpname) + if ((tmpname = x_strdup(nfontname)) == 0) return 0; - strcpy (tmpname, nfontname); } TRACE(("xtermLoadFont normal %s\n", nfontname)); @@ -763,7 +762,6 @@ * characters. Check that they are all present. The null character * (0) is special, and is not used. */ - screen->force_box_chars = False; for (ch = 1; ch < 32; ch++) { int n = ch; #if OPT_WIDE_CHARS @@ -810,12 +808,12 @@ if (tmpname) free (tmpname); if (new_normalGC) - XtReleaseGC ((Widget) term, screen->fullVwin.normalGC); - if (new_normalGC && new_normalGC != new_normalboldGC) + XtReleaseGC ((Widget) term, new_normalGC); + if (new_normalboldGC && new_normalGC != new_normalboldGC) XtReleaseGC ((Widget) term, new_normalboldGC); if (new_reverseGC) XtReleaseGC ((Widget) term, new_reverseGC); - if (new_reverseGC && new_reverseGC != new_reverseboldGC) + if (new_reverseboldGC && new_reverseGC != new_reverseboldGC) XtReleaseGC ((Widget) term, new_reverseboldGC); if (nfs) XFreeFont (screen->display, nfs); @@ -864,7 +862,7 @@ XftResult result; pat = XftNameParse (term->misc.face_name); - XftPatternBuild (pat, + XftPatternBuild (pat, XFT_FAMILY, XftTypeString, "mono", XFT_SIZE, XftTypeInteger, term->misc.face_size, XFT_SPACING, XftTypeInteger, XFT_MONO, Index: xc/programs/xterm/input.c diff -u xc/programs/xterm/input.c:3.52 xc/programs/xterm/input.c:3.55 --- xc/programs/xterm/input.c:3.52 Wed Jan 17 18:46:36 2001 +++ xc/programs/xterm/input.c Wed Oct 10 15:46:23 2001 @@ -2,10 +2,10 @@ * $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 $ */ +/* $XFree86: xc/programs/xterm/input.c,v 3.55 2001/10/10 19:46:23 dickey Exp $ */ /* - * Copyright 1999-2000 by Thomas E. Dickey + * Copyright 1999-2001 by Thomas E. Dickey * * All Rights Reserved * @@ -78,9 +78,12 @@ #include <X11/StringDefs.h> #include <ctype.h> +#include <xutf8.h> + #include <data.h> #include <fontutils.h> -#include <keysym2ucs.h> + +#define KEYSYM_FMT "0x%04lX" /* simplify matching <X11/keysymdef.h> */ /* 0123456789 abc def0123456789abdef0123456789abcdef0123456789abcd */ static char *kypd_num = " XXXXXXXX\tXXX\rXXXxxxxXXXXXXXXXXXXXXXXXXXXX*+,-./0123456789XX="; @@ -207,9 +210,9 @@ for (n = 0; n < sizeof(table)/sizeof(table[0]); n++) { if (table[n].before == keysym) { - TRACE(("...Input keypad before was %#04lx\n", keysym)); + TRACE(("...Input keypad before was "KEYSYM_FMT"\n", keysym)); keysym = table[n].after; - TRACE(("...Input keypad changed to %#04lx\n", keysym)); + TRACE(("...Input keypad changed to "KEYSYM_FMT"\n", keysym)); break; } } @@ -315,7 +318,38 @@ return result; } +/* + * Add input-actions for widgets that are overlooked (scrollbar and toolbar): + * + * a) Sometimes the scrollbar passes through translations, sometimes it + * doesn't. We add the KeyPress translations here, just to be sure. + * b) In the normal (non-toolbar) configuration, the xterm widget covers + * almost all of the window. With a toolbar, there's a relatively + * large area that the user would expect to enter keystrokes since the + * program can get the focus. + */ void +xtermAddInput(Widget w) +{ + static char input_trans[] = "\ + ~Meta <KeyPress>:insert-seven-bit() \n\ + Meta <KeyPress>:insert-eight-bit() \n"; + + /* *INDENT-OFF* */ + XtActionsRec input_actions[] = { + { "insert", HandleKeyPressed }, /* alias */ + { "insert-eight-bit", HandleEightBitKeyPressed }, + { "insert-seven-bit", HandleKeyPressed }, + { "secure", HandleSecure }, + { "string", HandleStringEvent }, + }; + /* *INDENT-ON* */ + + XtAppAddActions(app_con, input_actions, XtNumber(input_actions)); + XtAugmentTranslations(w, XtParseTranslationTable(input_trans)); +} + +void Input ( register TKeyboard *keyboard, register TScreen *screen, @@ -335,9 +369,6 @@ int dec_code; short modify_parm = 0; int keypad_mode = ((keyboard->flags & MODE_DECKPAM) != 0); -#if OPT_WIDE_CHARS - long ucs; -#endif /* Ignore characters typed at the keyboard */ if (keyboard->flags & MODE_KAM) @@ -352,16 +383,19 @@ else #endif #if OPT_I18N_SUPPORT - if (screen->xic -#if OPT_WIDE_CHARS - && !screen->utf8_mode -#endif - ) { + if (screen->xic) { Status status_return; - nbytes = XmbLookupString (screen->xic, event, - strbuf, sizeof(strbuf), - &keysym, &status_return); - } +#if OPT_WIDE_CHARS + if(screen->utf8_mode) + nbytes = Xutf8LookupString (screen->xic, event, + strbuf, sizeof(strbuf), + &keysym, &status_return); + else +#endif + nbytes = XmbLookupString (screen->xic, event, + strbuf, sizeof(strbuf), + &keysym, &status_return); + } else #endif { @@ -370,40 +404,13 @@ &keysym, &compose_status); } -#if OPT_WIDE_CHARS - /* - * FIXME: As long as Xlib does not provide proper UTF-8 conversion via - * XLookupString(), we have to generate them here. Once Xlib is fully - * UTF-8 capable, this code here should be removed again. - */ - if (screen->utf8_mode) { - ucs = -1; - if (nbytes == 1 && strbuf[0]) { - /* Take ISO 8859-1 character delivered by XLookupString() */ - ucs = (unsigned char) strbuf[0]; - } 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) - nbytes = convertFromUTF8(ucs, (Char *)strbuf); - } -#endif - string = (Char *)&strbuf[0]; reply.a_pintro = 0; reply.a_final = 0; reply.a_nparam = 0; reply.a_inters = 0; - TRACE(("Input keysym %#04lx, %d:'%.*s'%s%s%s%s%s%s%s%s%s%s%s%s\n", + TRACE(("Input keysym "KEYSYM_FMT", %d:'%.*s'%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", keysym, nbytes, nbytes > 0 ? nbytes : 1, @@ -417,9 +424,12 @@ ModifierName(event->state & Mod4Mask), ModifierName(event->state & Mod5Mask), eightbit ? " 8bit" : " 7bit", - IsFunctionKey(keysym) ? " FKey" : "", - IsMiscFunctionKey(keysym) ? " MiscFKey" : "", - IsEditFunctionKey(keysym) ? " EditFkey" : "")); + IsKeypadKey(keysym) ? " KeypadKey" : "", + IsCursorKey(keysym) ? " CursorKey" : "", + IsPFKey(keysym) ? " PFKey" : "", + IsFunctionKey(keysym) ? " FKey" : "", + IsMiscFunctionKey(keysym) ? " MiscFKey" : "", + IsEditFunctionKey(keysym) ? " EditFkey" : "")); #if OPT_SUNPC_KBD /* @@ -427,12 +437,17 @@ * Other (Sun, PC) keyboards commonly have keypad(+), but no keypad(,) * - it's a pain for users to work around. */ - if (term->keyboard.type != keyboardIsSun - && (event->state & ShiftMask) == 0 - && term->keyboard.type == keyboardIsVT220 - && keysym == XK_KP_Add) { - keysym = XK_KP_Separator; - TRACE(("...Input keypad(+), change keysym to %#04lx\n", keysym)); + if (term->keyboard.type == keyboardIsVT220 + && (event->state & ShiftMask) == 0) { + if (keysym == XK_KP_Add) { + keysym = XK_KP_Separator; + TRACE(("...Input keypad(+), change keysym to "KEYSYM_FMT"\n", keysym)); + } + if (event->state & ControlMask + && keysym == XK_KP_Separator) { + keysym = XK_KP_Subtract; + TRACE(("...Input control/keypad(,), change keysym to "KEYSYM_FMT"\n", keysym)); + } } #endif @@ -452,8 +467,7 @@ if (nbytes == 1 && IsKeypadKey(keysym) && term->misc.real_NumLock - && ((term->misc.num_lock == 0) - || (term->misc.num_lock & event->state) != 0)) { + && (term->misc.num_lock & event->state) != 0) { keypad_mode = 0; TRACE(("...Input num_lock, force keypad_mode off\n")); } @@ -530,9 +544,9 @@ { #ifdef XK_KP_Home if (keysym >= XK_KP_Home && keysym <= XK_KP_Begin) { - TRACE(("...Input keypad before was %#04lx\n", keysym)); + TRACE(("...Input keypad before was "KEYSYM_FMT"\n", keysym)); keysym += XK_Home - XK_KP_Home; - TRACE(("...Input keypad changed to %#04lx\n", keysym)); + TRACE(("...Input keypad changed to "KEYSYM_FMT"\n", keysym)); } #endif } @@ -1143,8 +1157,10 @@ DATA( "FN", "kf33", XK_F33, 0), DATA( "FO", "kf34", XK_F34, 0), DATA( "FP", "kf35", XK_F35, 0), +#ifdef SunXK_F36 DATA( "FQ", "kf36", SunXK_F36, 0), DATA( "FR", "kf37", SunXK_F37, 0), +#endif DATA( "K1", "ka1", XK_KP_Home, 0), DATA( "K4", "kc1", XK_KP_End, 0), DATA( "k1", "kf1", XK_F1, 0), Index: xc/programs/xterm/keysym2ucs.c diff -u xc/programs/xterm/keysym2ucs.c:1.4 xc/programs/xterm/keysym2ucs.c:1.5 --- xc/programs/xterm/keysym2ucs.c:1.4 Mon Jan 24 17:21:55 2000 +++ xc/programs/xterm/keysym2ucs.c Mon Jun 18 15:09:26 2001 @@ -1,6 +1,5 @@ -/* $XFree86: xc/programs/xterm/keysym2ucs.c,v 1.4 2000/01/24 22:21:55 dawes Exp $ */ -/* - * This module converts keysym values into the corresponding ISO 10646-1 +/* $XFree86: xc/programs/xterm/keysym2ucs.c,v 1.5 2001/06/18 19:09:26 dickey Exp $ + * This module converts keysym values into the corresponding ISO 10646 * (UCS, Unicode) values. * * The array keysymtab[] contains pairs of X11 keysym values for graphical @@ -12,29 +11,40 @@ * by Xlib via XmbLookupString() and should ideally not have to be * done in X applications. But we are not there yet. * - * We allow to represent any UCS character in the range U+00000000 to - * U+00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff. + * We allow to represent any UCS character in the range U-00000000 to + * U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff. * This admittedly does not cover the entire 31-bit space of UCS, but - * it does cover all of the characters up to U+10FFFF, which can be + * it does cover all of the characters up to U-10FFFF, which can be * represented by UTF-16, and more, and it is very unlikely that higher * UCS codes will ever be assigned by ISO. So to get Unicode character - * U+ABCD you can directly use keysym 0x1000abcd. + * U+ABCD you can directly use keysym 0x0100abcd. * * NOTE: The comments in the table below contain the actual character * encoded in UTF-8, so for viewing and editing best use an editor in * UTF-8 mode. * - * Author: Markus G. Kuhn <mkuhn@acm.org>, University of Cambridge, June 1999 + * Author: Markus G. Kuhn <mkuhn@acm.org>, University of Cambridge, April 2001 * * Special thanks to Richard Verhoeven <river@win.tue.nl> for preparing * an initial draft of the mapping table. * * This software is in the public domain. Share and enjoy! + * + * AUTOMATICALLY GENERATED FILE, DO NOT EDIT !!! (unicode/convmap.pl) */ + +#ifndef KEYSYM2UCS_INCLUDED + +#include "keysym2ucs.h" +#define VISIBLE /* */ + +#else + +#define VISIBLE static -#include <keysym2ucs.h> +#endif -struct codepair { +static struct codepair { unsigned short keysym; unsigned short ucs; } keysymtab[] = { @@ -428,22 +438,22 @@ { 0x07f7, 0x03c7 }, /* Greek_chi χ GREEK SMALL LETTER CHI */ { 0x07f8, 0x03c8 }, /* Greek_psi ψ GREEK SMALL LETTER PSI */ { 0x07f9, 0x03c9 }, /* Greek_omega ω GREEK SMALL LETTER OMEGA */ -/* 0x08a1 leftradical ? ??? */ -/* 0x08a2 topleftradical ? ??? */ -/* 0x08a3 horizconnector ? ??? */ + { 0x08a1, 0x23b7 }, /* leftradical ⎷ ??? */ + { 0x08a2, 0x250c }, /* topleftradical ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */ + { 0x08a3, 0x2500 }, /* horizconnector ─ BOX DRAWINGS LIGHT HORIZONTAL */ { 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */ { 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */ { 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */ -/* 0x08a7 topleftsqbracket ? ??? */ -/* 0x08a8 botleftsqbracket ? ??? */ -/* 0x08a9 toprightsqbracket ? ??? */ -/* 0x08aa botrightsqbracket ? ??? */ -/* 0x08ab topleftparens ? ??? */ -/* 0x08ac botleftparens ? ??? */ -/* 0x08ad toprightparens ? ??? */ -/* 0x08ae botrightparens ? ??? */ -/* 0x08af leftmiddlecurlybrace ? ??? */ -/* 0x08b0 rightmiddlecurlybrace ? ??? */ + { 0x08a7, 0x23a1 }, /* topleftsqbracket ⎡ ??? */ + { 0x08a8, 0x23a3 }, /* botleftsqbracket ⎣ ??? */ + { 0x08a9, 0x23a4 }, /* toprightsqbracket ⎤ ??? */ + { 0x08aa, 0x23a6 }, /* botrightsqbracket ⎦ ??? */ + { 0x08ab, 0x239b }, /* topleftparens ⎛ ??? */ + { 0x08ac, 0x239d }, /* botleftparens ⎠??? */ + { 0x08ad, 0x239e }, /* toprightparens ⎞ ??? */ + { 0x08ae, 0x23a0 }, /* botrightparens ⎠ ??? */ + { 0x08af, 0x23a8 }, /* leftmiddlecurlybrace ⎨ ??? */ + { 0x08b0, 0x23ac }, /* rightmiddlecurlybrace ⎬ ??? */ /* 0x08b1 topleftsummation ? ??? */ /* 0x08b2 botleftsummation ? ??? */ /* 0x08b3 topvertsummationconnector ? ??? */ @@ -459,8 +469,8 @@ { 0x08c1, 0x221d }, /* variation ∠PROPORTIONAL TO */ { 0x08c2, 0x221e }, /* infinity ∞ INFINITY */ { 0x08c5, 0x2207 }, /* nabla ∇ NABLA */ - { 0x08c8, 0x2245 }, /* approximate ≅ APPROXIMATELY EQUAL TO */ -/* 0x08c9 similarequal ? ??? */ + { 0x08c8, 0x223c }, /* approximate ∼ TILDE OPERATOR */ + { 0x08c9, 0x2243 }, /* similarequal ≃ ASYMPTOTICALLY EQUAL TO */ { 0x08cd, 0x21d4 }, /* ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW */ { 0x08ce, 0x21d2 }, /* implies ⇒ RIGHTWARDS DOUBLE ARROW */ { 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */ @@ -477,7 +487,7 @@ { 0x08fc, 0x2191 }, /* uparrow ↑ UPWARDS ARROW */ { 0x08fd, 0x2192 }, /* rightarrow → RIGHTWARDS ARROW */ { 0x08fe, 0x2193 }, /* downarrow ↓ DOWNWARDS ARROW */ - { 0x09df, 0x2422 }, /* blank ⢠BLANK SYMBOL */ +/* 0x09df blank ? ??? */ { 0x09e0, 0x25c6 }, /* soliddiamond â—† BLACK DIAMOND */ { 0x09e1, 0x2592 }, /* checkerboard â–’ MEDIUM SHADE */ { 0x09e2, 0x2409 }, /* ht ≠SYMBOL FOR HORIZONTAL TABULATION */ @@ -491,11 +501,11 @@ { 0x09ec, 0x250c }, /* upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */ { 0x09ed, 0x2514 }, /* lowleftcorner â”” BOX DRAWINGS LIGHT UP AND RIGHT */ { 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ -/* 0x09ef horizlinescan1 ? ??? */ -/* 0x09f0 horizlinescan3 ? ??? */ + { 0x09ef, 0x23ba }, /* horizlinescan1 ⎺ HORIZONTAL SCAN LINE-1 (Unicode 3.2 draft) */ + { 0x09f0, 0x23bb }, /* horizlinescan3 ⎻ HORIZONTAL SCAN LINE-3 (Unicode 3.2 draft) */ { 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */ -/* 0x09f2 horizlinescan7 ? ??? */ -/* 0x09f3 horizlinescan9 ? ??? */ + { 0x09f2, 0x23bc }, /* horizlinescan7 ⎼ HORIZONTAL SCAN LINE-7 (Unicode 3.2 draft) */ + { 0x09f3, 0x23bd }, /* horizlinescan9 ⎽ HORIZONTAL SCAN LINE-9 (Unicode 3.2 draft) */ { 0x09f4, 0x251c }, /* leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ { 0x09f5, 0x2524 }, /* rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT */ { 0x09f6, 0x2534 }, /* bott â”´ BOX DRAWINGS LIGHT UP AND HORIZONTAL */ @@ -513,7 +523,7 @@ { 0x0aaa, 0x2013 }, /* endash – EN DASH */ /* 0x0aac signifblank ? ??? */ { 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */ -/* 0x0aaf doubbaselinedot ? ??? */ + { 0x0aaf, 0x2025 }, /* doubbaselinedot ‥ TWO DOT LEADER */ { 0x0ab0, 0x2153 }, /* onethird â…“ VULGAR FRACTION ONE THIRD */ { 0x0ab1, 0x2154 }, /* twothirds â…” VULGAR FRACTION TWO THIRDS */ { 0x0ab2, 0x2155 }, /* onefifth â…• VULGAR FRACTION ONE FIFTH */ @@ -525,7 +535,7 @@ { 0x0ab8, 0x2105 }, /* careof â„… CARE OF */ { 0x0abb, 0x2012 }, /* figdash ‒ FIGURE DASH */ { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */ - { 0x0abd, 0x002e }, /* decimalpoint . FULL STOP */ +/* 0x0abd decimalpoint ? ??? */ { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */ /* 0x0abf marker ? ??? */ { 0x0ac3, 0x215b }, /* oneeighth â…› VULGAR FRACTION ONE EIGHTH */ @@ -538,7 +548,7 @@ { 0x0acc, 0x25c1 }, /* leftopentriangle â— WHITE LEFT-POINTING TRIANGLE */ { 0x0acd, 0x25b7 }, /* rightopentriangle â–· WHITE RIGHT-POINTING TRIANGLE */ { 0x0ace, 0x25cb }, /* emopencircle â—‹ WHITE CIRCLE */ - { 0x0acf, 0x25a1 }, /* emopenrectangle â–¡ WHITE SQUARE */ + { 0x0acf, 0x25af }, /* emopenrectangle â–¯ WHITE VERTICAL RECTANGLE */ { 0x0ad0, 0x2018 }, /* leftsinglequotemark ‘ LEFT SINGLE QUOTATION MARK */ { 0x0ad1, 0x2019 }, /* rightsinglequotemark ’ RIGHT SINGLE QUOTATION MARK */ { 0x0ad2, 0x201c }, /* leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK */ @@ -552,7 +562,7 @@ { 0x0adc, 0x25c0 }, /* filledlefttribullet â—€ BLACK LEFT-POINTING TRIANGLE */ { 0x0add, 0x25b6 }, /* filledrighttribullet â–¶ BLACK RIGHT-POINTING TRIANGLE */ { 0x0ade, 0x25cf }, /* emfilledcircle â— BLACK CIRCLE */ - { 0x0adf, 0x25a0 }, /* emfilledrect â–  BLACK SQUARE */ + { 0x0adf, 0x25ae }, /* emfilledrect â–® BLACK VERTICAL RECTANGLE */ { 0x0ae0, 0x25e6 }, /* enopencircbullet â—¦ WHITE BULLET */ { 0x0ae1, 0x25ab }, /* enopensquarebullet â–« WHITE SMALL SQUARE */ { 0x0ae2, 0x25ad }, /* openrectbullet â–­ WHITE RECTANGLE */ @@ -589,20 +599,20 @@ { 0x0ba8, 0x2228 }, /* downcaret ∨ LOGICAL OR */ { 0x0ba9, 0x2227 }, /* upcaret ∧ LOGICAL AND */ { 0x0bc0, 0x00af }, /* overbar ¯ MACRON */ - { 0x0bc2, 0x22a4 }, /* downtack ⊤ DOWN TACK */ + { 0x0bc2, 0x22a5 }, /* downtack ⊥ UP TACK */ { 0x0bc3, 0x2229 }, /* upshoe ∩ INTERSECTION */ { 0x0bc4, 0x230a }, /* downstile ⌊ LEFT FLOOR */ { 0x0bc6, 0x005f }, /* underbar _ LOW LINE */ { 0x0bca, 0x2218 }, /* jot ∘ RING OPERATOR */ - { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD (Unicode 3.0) */ - { 0x0bce, 0x22a5 }, /* uptack ⊥ UP TACK */ + { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD */ + { 0x0bce, 0x22a4 }, /* uptack ⊤ DOWN TACK */ { 0x0bcf, 0x25cb }, /* circle â—‹ WHITE CIRCLE */ { 0x0bd3, 0x2308 }, /* upstile ⌈ LEFT CEILING */ { 0x0bd6, 0x222a }, /* downshoe ∪ UNION */ { 0x0bd8, 0x2283 }, /* rightshoe ⊃ SUPERSET OF */ { 0x0bda, 0x2282 }, /* leftshoe ⊂ SUBSET OF */ - { 0x0bdc, 0x22a3 }, /* lefttack ⊣ LEFT TACK */ - { 0x0bfc, 0x22a2 }, /* righttack ⊢ RIGHT TACK */ + { 0x0bdc, 0x22a2 }, /* lefttack ⊢ RIGHT TACK */ + { 0x0bfc, 0x22a3 }, /* righttack ⊣ LEFT TACK */ { 0x0cdf, 0x2017 }, /* hebrew_doublelowline ‗ DOUBLE LOW LINE */ { 0x0ce0, 0x05d0 }, /* hebrew_aleph × HEBREW LETTER ALEF */ { 0x0ce1, 0x05d1 }, /* hebrew_bet ב HEBREW LETTER BET */ @@ -689,7 +699,7 @@ { 0x0dd8, 0x0e38 }, /* Thai_sarau ุ THAI CHARACTER SARA U */ { 0x0dd9, 0x0e39 }, /* Thai_sarauu ู THAI CHARACTER SARA UU */ { 0x0dda, 0x0e3a }, /* Thai_phinthu ฺ THAI CHARACTER PHINTHU */ - { 0x0dde, 0x0e3e }, /* Thai_maihanakat_maitho ฾ ??? */ +/* 0x0dde Thai_maihanakat_maitho ? ??? */ { 0x0ddf, 0x0e3f }, /* Thai_baht ฿ THAI CURRENCY SYMBOL BAHT */ { 0x0de0, 0x0e40 }, /* Thai_sarae เ THAI CHARACTER SARA E */ { 0x0de1, 0x0e41 }, /* Thai_saraae ๠THAI CHARACTER SARA AE */ @@ -797,33 +807,23 @@ { 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ã…± HANGUL LETTER KAPYEOUNMIEUM */ { 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ã…¸ HANGUL LETTER KAPYEOUNPIEUP */ { 0x0ef2, 0x317f }, /* Hangul_PanSios ã…¿ HANGUL LETTER PANSIOS */ -/* 0x0ef3 Hangul_KkogjiDalrinIeung ? ??? */ + { 0x0ef3, 0x3181 }, /* Hangul_KkogjiDalrinIeung ㆠHANGUL LETTER YESIEUNG */ { 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */ { 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */ { 0x0ef6, 0x318d }, /* Hangul_AraeA ㆠHANGUL LETTER ARAEA */ { 0x0ef7, 0x318e }, /* Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE */ { 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */ -/* 0x0ef9 Hangul_J_KkogjiDalrinIeung ? ??? */ + { 0x0ef9, 0x11f0 }, /* Hangul_J_KkogjiDalrinIeung ᇰ HANGUL JONGSEONG YESIEUNG */ { 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */ { 0x0eff, 0x20a9 }, /* Korean_Won â‚© WON SIGN */ + { 0x13a4, 0x20ac }, /* Euro € EURO SIGN */ { 0x13bc, 0x0152 }, /* OE Å’ LATIN CAPITAL LIGATURE OE */ { 0x13bd, 0x0153 }, /* oe Å“ LATIN SMALL LIGATURE OE */ { 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */ - { 0x20a0, 0x20a0 }, /* EcuSign â‚  EURO-CURRENCY SIGN */ - { 0x20a1, 0x20a1 }, /* ColonSign â‚¡ COLON SIGN */ - { 0x20a2, 0x20a2 }, /* CruzeiroSign â‚¢ CRUZEIRO SIGN */ - { 0x20a3, 0x20a3 }, /* FFrancSign â‚£ FRENCH FRANC SIGN */ - { 0x20a4, 0x20a4 }, /* LiraSign ₤ LIRA SIGN */ - { 0x20a5, 0x20a5 }, /* MillSign â‚¥ MILL SIGN */ - { 0x20a6, 0x20a6 }, /* NairaSign ₦ NAIRA SIGN */ - { 0x20a7, 0x20a7 }, /* PesetaSign ₧ PESETA SIGN */ - { 0x20a8, 0x20a8 }, /* RupeeSign ₨ RUPEE SIGN */ - { 0x20a9, 0x20a9 }, /* WonSign â‚© WON SIGN */ - { 0x20aa, 0x20aa }, /* NewSheqelSign ₪ NEW SHEQEL SIGN */ - { 0x20ab, 0x20ab }, /* DongSign â‚« DONG SIGN */ { 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */ }; +VISIBLE long keysym2ucs(KeySym keysym) { int min = 0; Index: xc/programs/xterm/main.c diff -u xc/programs/xterm/main.c:3.130 xc/programs/xterm/main.c:3.145 --- xc/programs/xterm/main.c:3.130 Fri May 11 04:16:54 2001 +++ xc/programs/xterm/main.c Mon Jan 7 13:35:41 2002 @@ -1,5 +1,5 @@ #ifndef lint -static char *rid="$Xorg: main.c,v 1.6 2000/08/18 11:04:49 xorgcvs Exp $"; +static char *rid="$Xorg: main.c,v 1.7 2001/02/09 02:06:02 xorgcvs Exp $"; #endif /* lint */ /* @@ -17,15 +17,42 @@ /*********************************************************** +Copyright 2002 by Thomas E. Dickey -Copyright (c) 1987, 1988 X Consortium + All Rights Reserved -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and 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: +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and 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 ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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(s) of the above copyright +holders shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization. + + +Copyright 1987, 1988 The Open Group + +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -33,13 +60,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +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 X Consortium shall not be +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 X Consortium. +in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard. @@ -64,7 +91,7 @@ ******************************************************************/ -/* $XFree86: xc/programs/xterm/main.c,v 3.130 2001/05/11 08:16:54 alanh Exp $ */ +/* $XFree86: xc/programs/xterm/main.c,v 3.145 2002/01/07 18:35:41 dawes Exp $ */ /* main.c */ @@ -133,6 +160,10 @@ static Bool IsPts = False; #endif +#if defined(SCO) || defined(SVR4) || defined(_POSIX_SOURCE) +#define USE_POSIX_SIGNALS +#endif + #if defined(SYSV) && !defined(SVR4) && !defined(ISC22) && !defined(ISC30) /* older SYSV systems cannot ignore SIGHUP. Shell hangs, or you get extra shells, or something like that */ @@ -285,7 +316,7 @@ #endif /* } !SYSV */ -#ifdef SVR4 +#if defined(SVR4) && !defined(__CYGWIN__) #define HAS_SAVED_IDS_AND_SETEUID #endif @@ -325,7 +356,6 @@ #include <utmpx.h> #define setutent setutxent -#define getutent getutxent #define getutid getutxid #define endutent endutxent #define pututline pututxline @@ -595,19 +625,9 @@ static int parse_tty_modes (char *s, struct _xttymodes *modelist); #ifdef USE_SYSV_UTMP -#if (defined(X_NOT_STDC_ENV) || (defined(AIXV3) && (OSMAJORVERSION < 4))) && !(defined(getutent) || defined(getutid) || defined(getutline)) -extern struct utmp *getutent(); +#if (defined(AIXV3) && (OSMAJORVERSION < 4)) && !(defined(getutid)) extern struct utmp *getutid(); -extern struct utmp *getutline(); -#endif /* X_NOT_STDC_ENV || AIXV3 */ - -#ifdef X_NOT_STDC_ENV /* could remove paragraph unconditionally? */ -extern struct passwd *getpwent(); -extern struct passwd *getpwuid(); -extern struct passwd *getpwnam(); -extern void setpwent(); -extern void endpwent(); -#endif +#endif /* AIXV3 */ #else /* not USE_SYSV_UTMP */ static char etc_utmp[] = UTMP_FILENAME; @@ -780,7 +800,6 @@ {"-cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "off"}, {"+cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "on"}, {"-cc", "*charClass", XrmoptionSepArg, (caddr_t) NULL}, -{"-class", NULL, XrmoptionSkipArg, (caddr_t) NULL}, {"-cm", "*colorMode", XrmoptionNoArg, (caddr_t) "off"}, {"+cm", "*colorMode", XrmoptionNoArg, (caddr_t) "on"}, {"-cn", "*cutNewline", XrmoptionNoArg, (caddr_t) "off"}, @@ -790,8 +809,11 @@ {"+cu", "*curses", XrmoptionNoArg, (caddr_t) "off"}, {"-dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "off"}, {"+dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "on"}, -{"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, {"-fb", "*boldFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fbb", "*freeBoldBox", XrmoptionNoArg, (caddr_t)"off"}, +{"+fbb", "*freeBoldBox", XrmoptionNoArg, (caddr_t)"on"}, +{"-fbx", "*forceBoxChars", XrmoptionNoArg, (caddr_t)"off"}, +{"+fbx", "*forceBoxChars", XrmoptionNoArg, (caddr_t)"on"}, #ifndef NO_ACTIVE_ICON {"-fi", "*iconFont", XrmoptionSepArg, (caddr_t) NULL}, #endif /* NO_ACTIVE_ICON */ @@ -803,6 +825,9 @@ {"-fw", "*wideFont", XrmoptionSepArg, (caddr_t) NULL}, {"-fwb", "*wideBoldFont", XrmoptionSepArg, (caddr_t) NULL}, #endif +#if OPT_INPUT_METHOD +{"-fx", "*ximFont", XrmoptionSepArg, (caddr_t) NULL}, +#endif #if OPT_HIGHLIGHT_COLOR {"-hc", "*highlightColor", XrmoptionSepArg, (caddr_t) NULL}, #endif @@ -890,6 +915,11 @@ {"-samename", "*sameName", XrmoptionNoArg, (caddr_t) "on"}, {"+samename", "*sameName", XrmoptionNoArg, (caddr_t) "off"}, #endif +/* options that we process ourselves */ +{"-help", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, +{"-version", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, +{"-class", NULL, XrmoptionSkipArg, (caddr_t) NULL}, +{"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, /* bogus old compatibility stuff for which there are standard XtAppInitialize options now */ {"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, @@ -903,10 +933,7 @@ {"-w", ".borderWidth", XrmoptionSepArg, (caddr_t) NULL}, }; -static struct _options { - char *opt; - char *desc; -} options[] = { +static OptionHelp options[] = { { "-version", "print the version number" }, { "-help", "print out this message" }, { "-display displayname", "X server to contact" }, @@ -918,6 +945,8 @@ { "-bw number", "border width in pixels" }, { "-fn fontname", "normal text font" }, { "-fb fontname", "bold text font" }, +{ "-/+fbb", "turn on/off bold font's box checking"}, +{ "-/+fbx", "turn off/on linedrawing characters"}, #ifdef XRENDERFONT { "-fa pattern", "FreeType font-selection pattern" }, { "-fs size", "FreeType font-size" }, @@ -926,6 +955,9 @@ { "-fw fontname", "doublewidth text font" }, { "-fwb fontname", "doublewidth bold text font" }, #endif +#if OPT_INPUT_METHOD +{ "-fx fontname", "XIM fontset" }, +#endif { "-iconic", "start iconic" }, { "-name string", "client instance, icon, and title strings" }, { "-class string", "class string (XTerm)" }, @@ -998,10 +1030,10 @@ { "-ti termid", "terminal identifier" }, { "-tm string", "terminal mode keywords and characters" }, { "-tn name", "TERM environment variable name" }, -{ "-/+ulc", "turn off/on display of underline as color" }, #if OPT_WIDE_CHARS { "-/+u8", "turn on/off UTF-8 mode (implies wide-characters)" }, #endif +{ "-/+ulc", "turn off/on display of underline as color" }, #ifdef HAVE_UTMP { "-/+ut", "turn on/off utmp inhibit" }, #else @@ -1030,7 +1062,7 @@ { "-ziconbeep percent", "beep and flag icon of window having hidden output" }, #endif #if OPT_SAME_NAME -{"-/+samename", "turn on/off the no-flicker option for title and icon name" }, +{ "-/+samename", "turn on/off the no-flicker option for title and icon name" }, #endif { NULL, NULL }}; @@ -1042,6 +1074,62 @@ "will be started. Options that start with a plus sign (+) restore the default.", NULL}; +/* + * Decode a key-definition. This combines the termcap and ttyModes, for + * comparison. Note that octal escapes in ttyModes are done by the normal + * resource translation. Also, ttyModes allows '^-' as a synonym for disabled. + */ +static int decode_keyvalue(char *string, int termcap) +{ + int value = -1; + + TRACE(("...decode '%s'\n", string)); + if (*string == '^') { + switch (*++string) { + case '?': + value = A2E(127); + break; + case '-': + if (!termcap) { + errno = 0; +#if defined(_POSIX_VDISABLE) && defined(HAVE_UNISTD_H) + value = _POSIX_VDISABLE; +#endif +#if defined(_PC_VDISABLE) + if (value == -1) { + value = fpathconf(0, _PC_VDISABLE); + if (value == -1) { + if (errno != 0) + break; /* skip this (error) */ + value = 0377; + } + } +#elif defined(VDISABLE) + if (value == -1) + value = VDISABLE; +#endif + break; + } + /* FALLTHRU */ + default: + value = CONTROL(*string); + break; + } + } else if (termcap && (*string == '\\')) { + char *d; + int temp = strtol(string, &d, 8); + if (temp > 0 && d != string) + value = temp; + } else { + value = CharOf(*string); + } + return value; +} + +/* + * If we're linked to terminfo, tgetent() will return an empty buffer. We + * cannot use that to adjust the $TERMCAP variable. + */ static Boolean get_termcap(char *name, char *buffer, char *resized) { register TScreen *screen = &term->screen; @@ -1049,28 +1137,33 @@ *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ if (name != 0) { - if (tgetent (buffer, name) == 1 - && *buffer) { - if (!TEK4014_ACTIVE(screen)) { - resize (screen, buffer, resized); + if (tgetent (buffer, name) == 1) { + TRACE(("get_termcap(%s) succeeded (%s)\n", name, + *buffer + ? "ok:termcap, we can update $TERMCAP" + : "assuming this is terminfo")); + if (*buffer) { + if (!TEK4014_ACTIVE(screen)) { + resize (screen, buffer, resized); + } } return True; } else { - *buffer = 0; + *buffer = 0; /* just in case */ } } return False; } -static int abbrev (char *tst, char *cmp) +static int abbrev (char *tst, char *cmp, size_t need) { size_t len = strlen(tst); - return ((len >= 2) && (!strncmp(tst, cmp, len))); + return ((len >= need) && (!strncmp(tst, cmp, len))); } static void Syntax (char *badOption) { - struct _options *opt; + OptionHelp *opt; int col; fprintf (stderr, "%s: bad command line option \"%s\"\r\n\n", @@ -1096,12 +1189,12 @@ static void Version (void) { printf("%s(%d)\n", XFREE86_VERSION, XTERM_PATCH); - exit (0); + fflush(stdout); } static void Help (void) { - struct _options *opt; + OptionHelp *opt; char **cpp; fprintf (stderr, "%s(%d) usage:\n %s [-options ...] [-e command args]\n\n", @@ -1117,8 +1210,7 @@ putc ('\n', stderr); } putc ('\n', stderr); - - exit (0); + fflush(stderr); } #if defined(TIOCCONS) || defined(SRIOCSREDIR) @@ -1298,6 +1390,65 @@ return code; } +#ifdef USE_SYSV_UTMP +/* + * From "man utmp": + * xterm and other terminal emulators directly create a USER_PROCESS record + * and generate the ut_id by using the last two letters of /dev/ttyp%c or by + * using p%d for /dev/pts/%d. If they find a DEAD_PROCESS for this id, they + * recycle it, otherwise they create a new entry. If they can, they will mark + * it as DEAD_PROCESS on exiting and it is advised that they null ut_line, + * ut_time, ut_user and ut_host as well. + * + * Generally ut_id allows no more than 3 characters (plus null), even if the + * pty implementation allows more than 3 digits. + */ +static char * +my_utmp_id(char *device) +{ + static char result[PTYCHARLEN + 4]; + char *name = my_pty_name(device); + char *leaf = x_basename(name); + + if (name == leaf) { /* no '/' in the name */ + int len = strlen(leaf); + if (PTYCHARLEN < len) + leaf = leaf + (len - PTYCHARLEN); + strcpy(result, leaf); + } else { + sprintf(result, "p%s", leaf); + } + TRACE(("my_utmp_id (%s) -> '%s'\n", device, result)); + return result; +} +#endif + +#ifdef USE_POSIX_SIGNALS + +typedef void (*sigfunc)(int); + +/* make sure we sure we ignore SIGCHLD for the cases parent + has just been stopped and not actually killed */ + +static sigfunc +posix_signal(int signo, sigfunc func) +{ + struct sigaction act, oact; + + act.sa_handler = func; + sigemptyset(&act.sa_mask); +#ifdef SA_RESTART + act.sa_flags = SA_NOCLDSTOP|SA_RESTART; +#else + act.sa_flags = SA_NOCLDSTOP; +#endif + if (sigaction(signo, &act, &oact) < 0) + return(SIG_ERR); + return (oact.sa_handler); +} + +#endif /* linux && _POSIX_SOURCE */ + int main (int argc, char *argv[]) { @@ -1308,18 +1459,33 @@ /* Do these first, since we may not be able to open the display */ ProgramName = argv[0]; + TRACE_OPTS(options, optionDescList, XtNumber(optionDescList)); + TRACE_ARGV("Before XtAppInitialize", argv); if (argc > 1) { int n; - if (abbrev(argv[1], "-version")) - Version(); - if (abbrev(argv[1], "-help")) - Help(); + int unique = 2; + Boolean quit = True; + for (n = 1; n < argc; n++) { - if (strlen(argv[n]) > 2 - && abbrev(argv[n], "-class")) - if ((my_class = argv[++n]) == 0) + TRACE(("parsing %s\n", argv[n])); + if (abbrev(argv[n], "-version", unique)) { + Version(); + } else if (abbrev(argv[n], "-help", unique)) { + Help(); + } else if (abbrev(argv[n], "-class", 3)) { + if ((my_class = argv[++n]) == 0) { Help(); + } else { + quit = False; + } + unique = 3; + } else { + quit = False; + unique = 3; + } } + if (quit) + exit(0); } /* This dumps core on HP-UX 9.05 with X11R5 */ @@ -1717,13 +1883,18 @@ #endif /* Parse the rest of the command line */ + TRACE_ARGV("After XtAppInitialize", argv); for (argc--, argv++ ; argc > 0 ; argc--, argv++) { if(**argv != '-') Syntax (*argv); + TRACE(("parsing %s\n", argv[0])); switch(argv[0][1]) { - case 'h': - Help (); - /* NOTREACHED */ + case 'h': /* -help */ + Help(); + continue; + case 'v': /* -version */ + Version(); + continue; case 'C': #if defined(TIOCCONS) || defined(SRIOCSREDIR) #ifndef __sgi @@ -1754,8 +1925,9 @@ debug = TRUE; continue; #endif /* DEBUG */ - case 'c': /* -class */ - break; + case 'c': /* -class param */ + argc--, argv++; + continue; case 'e': if (argc <= 1) Syntax (*argv); command_to_exec = ++argv; @@ -1771,9 +1943,9 @@ { char *s; - if ((s = getenv("LC_ALL")) || - (s = getenv("LC_CTYPE")) || - (s = getenv("LANG"))) { + if (((s = getenv("LC_ALL")) != 0 && *s != '\0') || + ((s = getenv("LC_CTYPE")) != 0 && *s != '\0') || + ((s = getenv("LANG")) != 0 && *s != '\0')) { if (strstr(s, "UTF-8")) defaultUTF8[0] = '2'; } @@ -1832,6 +2004,11 @@ XtSetArg (args[0], XtNtitle, resource.title); XtSetArg (args[1], XtNiconName, resource.icon_name); + TRACE(("setting:\n\ttitle \"%s\"\n\ticon \"%s\"\n\tbased on command \"%s\"\n", + resource.title, + resource.icon_name, + *command_to_exec)); + XtSetValues (toplevel, args, 2); } @@ -1890,8 +2067,12 @@ #ifndef VMS /* Child process is out there, let's catch its termination */ - (void) signal (SIGCHLD, reapchild); +#ifdef USE_POSIX_SIGNALS + (void) posix_signal(SIGCHLD, reapchild); +#else + (void) signal (SIGCHLD, reapchild); +#endif /* Realize procs have now been executed */ #ifndef AMOEBA @@ -2375,6 +2556,7 @@ #if OPT_INITIAL_ERASE int initial_erase = VAL_INITIAL_ERASE; #endif + int rc; int tty = -1; #ifdef USE_ANY_SYSV_TERMIO struct termio tio; @@ -2413,6 +2595,7 @@ struct winsize ws; #endif /* sun vs TIOCSWINSZ */ struct passwd *pw = NULL; + char *login_name = NULL; #ifdef HAVE_UTMP #if defined(UTMPX_FOR_UTMP) struct utmpx utmp, @@ -2456,7 +2639,7 @@ signal(SIGALRM, hungtty); alarm(2); /* alarm(1) might return too soon */ - if (! sigsetjmp(env, 1)) { + if (! sigsetjmp(env, 1)) { tty = open ("/dev/tty", O_RDWR, 0); alarm(0); tty_got_hung = False; @@ -2475,6 +2658,7 @@ * necessary. ENXIO is what is normally returned if there is * no controlling terminal, but some systems (e.g. SunOS 4.0) * seem to return EIO. Solaris 2.3 is said to return EINVAL. + * Cygwin returns ENOENT. */ no_dev_tty = FALSE; if (tty < 0) { @@ -2482,6 +2666,9 @@ #ifdef ENODEV errno == ENODEV || #endif +#ifdef __CYGWIN__ + errno == ENOENT || +#endif errno == EINVAL || errno == ENOTTY || errno == EACCES) { no_dev_tty = TRUE; #ifdef HAS_LTCHARS @@ -2521,26 +2708,32 @@ lmode = d_lmode; #endif /* TIOCLSET */ #ifdef USE_ANY_SYSV_TERMIO - if(ioctl(tty, TCGETA, &tio) == -1) + if ((rc = ioctl(tty, TCGETA, &tio)) == -1) tio = d_tio; #elif defined(USE_POSIX_TERMIOS) - if (tcgetattr(tty, &tio) == -1) + if ((rc = tcgetattr(tty, &tio)) == -1) tio = d_tio; #else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ - if(ioctl(tty, TIOCGETP, (char *)&sg) == -1) + if ((rc = ioctl(tty, TIOCGETP, (char *)&sg)) == -1) sg = d_sg; - if(ioctl(tty, TIOCGETC, (char *)&tc) == -1) + if (ioctl(tty, TIOCGETC, (char *)&tc) == -1) tc = d_tc; - if(ioctl(tty, TIOCGETD, (char *)&discipline) == -1) + if (ioctl(tty, TIOCGETD, (char *)&discipline) == -1) discipline = d_disipline; #ifdef sony - if(ioctl(tty, TIOCKGET, (char *)&jmode) == -1) + if (ioctl(tty, TIOCKGET, (char *)&jmode) == -1) jmode = d_jmode; - if(ioctl(tty, TIOCKGETC, (char *)&jtc) == -1) + if (ioctl(tty, TIOCKGETC, (char *)&jtc) == -1) jtc = d_jtc; #endif /* sony */ #endif /* USE_ANY_SYSV_TERMIO */ + /* + * If ptyInitialErase is set, we want to get the pty's + * erase value. Just in case that will fail, first get + * the value from /dev/tty, so we will have something + * at least. + */ #if OPT_INITIAL_ERASE if (resource.ptyInitialErase) { #ifdef USE_ANY_SYSV_TERMIO @@ -2550,12 +2743,10 @@ #else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ initial_erase = sg.sg_erase; #endif /* USE_ANY_SYSV_TERMIO */ + TRACE(("%s initial_erase:%d (from /dev/tty)\n", + rc == 0 ? "OK" : "FAIL", + initial_erase)); } - TRACE(("%s @%d, ptyInitialErase:%d, backarrow_is_erase:%d, initial_erase:%d (from /dev/tty)\n", - __FILE__, __LINE__, - resource.ptyInitialErase, - resource.backarrow_is_erase, - initial_erase)); #endif #ifdef MINIX @@ -2569,7 +2760,6 @@ tty = -1; } - TRACE(("%s @%d, calling get_pty...\n", __FILE__, __LINE__)); if (get_pty (&screen->respond, XDisplayString(screen->display))) { /* no ptys! */ @@ -2582,28 +2772,22 @@ if (resource.ptyInitialErase) { #ifdef USE_ANY_SYSV_TERMIO struct termio my_tio; - if(ioctl(screen->respond, TCGETA, &my_tio) == 0) + if ((rc = ioctl(screen->respond, TCGETA, &my_tio)) == 0) initial_erase = my_tio.c_cc[VERASE]; #elif defined(USE_POSIX_TERMIOS) struct termios my_tio; - if (tcgetattr(screen->respond, &my_tio) == 0) + if ((rc = tcgetattr(screen->respond, &my_tio)) == 0) initial_erase = my_tio.c_cc[VERASE]; #else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ struct sgttyb my_sg; - if(ioctl(screen->respond, TIOCGETP, (char *)&my_sg) == 0) + if ((rc = ioctl(screen->respond, TIOCGETP, (char *)&my_sg)) == 0) initial_erase = my_sg.sg_erase; #endif /* USE_ANY_SYSV_TERMIO */ - } - if (resource.backarrow_is_erase) - if (initial_erase == 127) { /* see input.c */ - term->keyboard.flags &= ~MODE_DECBKM; + TRACE(("%s initial_erase:%d (from pty)\n", + (rc == 0) ? "OK" : "FAIL", + initial_erase)); } - TRACE(("%s @%d, ptyInitialErase:%d, backarrow_is_erase:%d, initial_erase:%d (from pty)\n", - __FILE__, __LINE__, - resource.ptyInitialErase, - resource.backarrow_is_erase, - initial_erase)); -#endif +#endif /* OPT_INITIAL_ERASE */ } /* avoid double MapWindow requests */ @@ -2663,39 +2847,38 @@ } } + /* + * Check if ptyInitialErase is not set. If so, we rely on the termcap + * (or terminfo) to tell us what the erase mode should be set to. + */ #if OPT_INITIAL_ERASE - TRACE(("%s @%d, resource ptyInitialErase:%d, backarrow_is_erase:%d\n", - __FILE__, __LINE__, - resource.ptyInitialErase, - resource.backarrow_is_erase)); + TRACE(("resource ptyInitialErase is %sset\n", + resource.ptyInitialErase ? "" : "not ")); if (!resource.ptyInitialErase) { char temp[1024], *p = temp; char *s = tgetstr(TERMCAP_ERASE, &p); - TRACE(("extracting initial_erase value from termcap\n")); + TRACE(("...extracting initial_erase value from termcap\n")); if (s != 0) { - if (*s == '^') { - if (*++s == '?') { - initial_erase = 127; - } else { - initial_erase = CONTROL(*s); - } - } else if (*s == '\\') { - char *d; - int value = strtol(s, &d, 8); - if (value > 0 && d != s) - initial_erase = value; - } else { - initial_erase = *s; - } - initial_erase = CharOf(initial_erase); - TRACE(("... initial_erase:%d\n", initial_erase)); + initial_erase = decode_keyvalue(s, True); } } - if (resource.backarrow_is_erase && initial_erase == 127) { - /* see input.c */ - term->keyboard.flags &= ~MODE_DECBKM; + TRACE(("...initial_erase:%d\n", initial_erase)); + + TRACE(("resource backarrowKeyIsErase is %sset\n", + resource.backarrow_is_erase ? "" : "not ")); + if (resource.backarrow_is_erase) { /* see input.c */ + if (initial_erase == 127) { + term->keyboard.flags &= ~MODE_DECBKM; + } else { + term->keyboard.flags |= MODE_DECBKM; + term->keyboard.reset_DECBKM = 1; + } + TRACE(("...sets DECBKM %s\n", + (term->keyboard.flags & MODE_DECBKM) ? "on" : "off")); + } else { + term->keyboard.reset_DECBKM = 2; } -#endif +#endif /* OPT_INITIAL_ERASE */ #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) /* tell tty how big window is */ @@ -2706,6 +2889,8 @@ ts.ts_lines = screen->max_row + 1; ts.ts_cols = screen->max_col + 1; } + i = ioctl (screen->respond, TIOCSSIZE, &ts); + TRACE(("spawn TIOCSSIZE %dx%d return %d\n", ts.ts_lines, ts.ts_cols, i)); #elif defined(TIOCSWINSZ) /* tell tty how big window is */ #if OPT_TEK4014 @@ -2722,6 +2907,8 @@ ws.ws_xpixel = FullWidth(screen); ws.ws_ypixel = FullHeight(screen); } + i = ioctl (screen->respond, TIOCSWINSZ, (char *)&ws); + TRACE(("spawn TIOCSWINSZ %dx%d return %d\n", ws.ws_row, ws.ws_col, i)); #endif /* sun vs TIOCSWINSZ */ #if defined(USE_UTEMPTER) @@ -2737,6 +2924,7 @@ if (pipe(pc_pipe) || pipe(cp_pipe)) SysError (ERROR_FORK); #endif + TRACE(("Forking...\n")); if ((screen->pid = fork ()) == -1) SysError (ERROR_FORK); @@ -3224,31 +3412,46 @@ signal (SIGQUIT, SIG_DFL); signal (SIGTERM, SIG_DFL); + /* + * If we're not asked to make the parent process set the + * terminal's erase mode, and if we had no ttyModes resource, + * then set the terminal's erase mode from our best guess. + */ #if OPT_INITIAL_ERASE - TRACE(("%s @%d, ptyInitialErase:%d, overide_tty_modes:%d, XTTYMODE_erase:%d\n", - __FILE__, __LINE__, + TRACE(("check if we should set erase to %d:%s\n\tptyInitialErase:%d,\n\toveride_tty_modes:%d,\n\tXTTYMODE_erase:%d\n", + initial_erase, + (! resource.ptyInitialErase + && !override_tty_modes + && !ttymodelist[XTTYMODE_erase].set) + ? "YES" : "NO", resource.ptyInitialErase, override_tty_modes, ttymodelist[XTTYMODE_erase].set)); if (! resource.ptyInitialErase && !override_tty_modes && !ttymodelist[XTTYMODE_erase].set) { + int old_erase; #ifdef USE_ANY_SYSV_TERMIO - if(ioctl(tty, TCGETA, &tio) == -1) + if (ioctl(tty, TCGETA, &tio) == -1) tio = d_tio; + old_erase = tio.c_cc[VERASE]; tio.c_cc[VERASE] = initial_erase; - ioctl(tty, TCSETA, &tio); + rc = ioctl(tty, TCSETA, &tio); #elif defined(USE_POSIX_TERMIOS) if (tcgetattr(tty, &tio) == -1) tio = d_tio; + old_erase = tio.c_cc[VERASE]; tio.c_cc[VERASE] = initial_erase; - tcsetattr(tty, TCSANOW, &tio); + rc = tcsetattr(tty, TCSANOW, &tio); #else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ - if(ioctl(tty, TIOCGETP, (char *)&sg) == -1) + if (ioctl(tty, TIOCGETP, (char *)&sg) == -1) sg = d_sg; + old_erase = sg.sg_erase; sg.sg_erase = initial_erase; - ioctl(tty, TIOCSETP, (char *)&sg); + rc = ioctl(tty, TIOCSETP, (char *)&sg); #endif /* USE_ANY_SYSV_TERMIO */ + TRACE(("%s setting erase to %d (was %d)\n", + rc ? "FAIL" : "OK", initial_erase, old_erase)); } #endif @@ -3320,9 +3523,7 @@ #endif /* CRAY */ } -#if defined(__QNX__) - tcsetpgrp( 0, pgrp /*setsid()*/ ); -#elif !defined(USE_SYSV_PGRP) +#if !defined(USE_SYSV_PGRP) #ifdef TIOCSCTTY setsid(); ioctl(0, TIOCSCTTY, 0); @@ -3331,6 +3532,9 @@ setpgrp(0,0); close(open(ttydev, O_WRONLY, 0)); setpgrp (0, pgrp); +#if defined(__QNX__) + tcsetpgrp( 0, pgrp /*setsid()*/ ); +#endif #endif /* !USE_SYSV_PGRP */ #endif /* AMOEBA */ @@ -3349,8 +3553,39 @@ #ifdef HAVE_UTMP pw = getpwuid(screen->uid); - if (pw && pw->pw_name) - xtermSetenv ("LOGNAME=", pw->pw_name); /* for POSIX */ + login_name = NULL; + if (pw && pw->pw_name) { +#ifdef HAVE_GETLOGIN + /* + * If the value from getlogin() differs from the value we + * get by looking in the password file, check if it does + * correspond to the same uid. If so, allow that as an + * alias for the uid. + * + * Of course getlogin() will fail if we're started from + * a window-manager, since there's no controlling terminal + * to fuss with. In that case, try to get something useful + * from the user's $LOGNAME or $USER environment variables. + */ + if (((login_name = getlogin()) != NULL + || (login_name = getenv("LOGNAME")) != NULL + || (login_name = getenv("USER")) != NULL) + && strcmp(login_name, pw->pw_name)) { + struct passwd *pw2 = getpwnam(login_name); + if (pw2 != 0 + && pw->pw_uid != pw2->pw_uid) { + login_name = NULL; + } + } +#endif + if (login_name == NULL) + login_name = pw->pw_name; + if (login_name != NULL) + login_name = x_strdup(login_name); + } + if (login_name != NULL) { + xtermSetenv ("LOGNAME=", login_name); /* for POSIX */ + } #ifdef USE_SYSV_UTMP /* Set up our utmp entry now. We need to do it here ** for the following reasons: @@ -3364,13 +3599,14 @@ (void) setutent (); /* set up entry to search for */ bzero((char *)&utmp, sizeof(utmp)); - (void) strncpy(utmp.ut_id, my_pty_id(ttydev), sizeof (utmp.ut_id)); + (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof (utmp.ut_id)); utmp.ut_type = DEAD_PROCESS; /* position to entry in utmp file */ /* Test return value: beware of entries left behind: PSz 9 Mar 00 */ if (! ( utret = getutid(&utmp) ) ) { + (void) setutent(); utmp.ut_type = USER_PROCESS; if (! ( utret = getutid(&utmp) ) ) { (void) setutent(); @@ -3378,11 +3614,11 @@ } #if OPT_TRACE if ( ! utret ) - TRACE(("getutid: NULL\n.")); + 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 )); + utret->ut_line, utret->ut_id)); #endif /* set up the new entry */ @@ -3391,11 +3627,11 @@ utmp.ut_xstatus = 2; #endif (void) strncpy(utmp.ut_user, - (pw && pw->pw_name) ? pw->pw_name : "????", + (login_name != NULL) ? login_name : "????", sizeof(utmp.ut_user)); /* why are we copying this string again? (see above) */ - (void) strncpy(utmp.ut_id, my_pty_id(ttydev), sizeof(utmp.ut_id)); + (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); (void) strncpy (utmp.ut_line, my_pty_name(ttydev), sizeof (utmp.ut_line)); @@ -3411,8 +3647,7 @@ #endif (void) strncpy(utmp.ut_host, buf, sizeof(utmp.ut_host)); #endif - (void) strncpy(utmp.ut_name, pw->pw_name, - sizeof(utmp.ut_name)); + (void) strncpy(utmp.ut_name, login_name, sizeof(utmp.ut_name)); utmp.ut_pid = getpid(); #if defined(HAVE_UTMP_UT_XTIME) @@ -3464,7 +3699,7 @@ (void) strncpy(utmp.ut_line, my_pty_name(ttydev), sizeof(utmp.ut_line)); - (void) strncpy(utmp.ut_name, pw->pw_name, + (void) strncpy(utmp.ut_name, login_name, sizeof(utmp.ut_name)); #ifdef MINIX utmp.ut_pid = getpid(); @@ -3543,7 +3778,7 @@ (void) setgid (screen->gid); #ifdef HAS_BSD_GROUPS if (geteuid() == 0 && pw) { - if (initgroups (pw->pw_name, pw->pw_gid)) { + if (initgroups (login_name, pw->pw_gid)) { perror( "initgroups failed" ); exit (errno); } @@ -3616,7 +3851,7 @@ strcpy (termcap, newtc); resize (screen, termcap, newtc); } - if (term->misc.titeInhibit) { + if (term->misc.titeInhibit && !term->misc.tiXtraScroll) { remove_termcap_entry (newtc, "ti="); remove_termcap_entry (newtc, "te="); } @@ -3631,18 +3866,17 @@ if(*newtc) strcat (newtc, ":im=\\E[4h:ei=\\E[4l:mi:"); } -#if OPT_INITIAL_ERASE if (*newtc) { +#if OPT_INITIAL_ERASE unsigned len; remove_termcap_entry (newtc, TERMCAP_ERASE "="); len = strlen(newtc); if (len != 0 && newtc[len-1] == ':') len--; sprintf(newtc + len, ":%s=\\%03o:", TERMCAP_ERASE, initial_erase & 0377); - } #endif - if(*newtc) xtermSetenv ("TERMCAP=", newtc); + } #endif /* USE_SYSV_ENVVARS */ @@ -3656,9 +3890,9 @@ #else TRACE(("spawn cannot tell pty its size\n")); #endif /* sun vs TIOCSWINSZ */ - signal(SIGHUP, SIG_DFL); if (command_to_exec) { + TRACE(("spawning command \"%s\"\n", *command_to_exec)); execvp(*command_to_exec, command_to_exec); /* print error message on screen */ fprintf(stderr, "%s: Can't execvp %s: %s\n", @@ -3692,7 +3926,7 @@ #ifdef USE_LOGIN_DASH_P if (term->misc.login_shell && pw && added_utmp_entry) - execl (bin_login, "login", "-p", "-f", pw->pw_name, 0); + execl (bin_login, "login", "-p", "-f", login_name, 0); #endif execlp (ptr, (term->misc.login_shell ? shname_minus : shname), 0); @@ -3764,8 +3998,7 @@ tslot = handshake.tty_slot; #endif /* USE_SYSV_UTMP */ free(ttydev); - ttydev = (char *)malloc((unsigned) strlen(handshake.buffer) + 1); - strcpy(ttydev, handshake.buffer); + ttydev = x_strdup(handshake.buffer); break; default: fprintf(stderr, "%s: unexpected handshake status %d\n", @@ -4057,7 +4290,7 @@ strcpy (termcap, newtc); resize (screen, termcap, newtc); } - if (term->misc.titeInhibit) { + if (term->misc.titeInhibit && !term->misc.tiXtraScroll) { remove_termcap_entry (newtc, "ti="); remove_termcap_entry (newtc, "te="); } @@ -4206,7 +4439,7 @@ #endif /* USE_HANDSHAKE */ ) { utmp.ut_type = USER_PROCESS; - (void) strncpy(utmp.ut_id, my_pty_id(ttydev), sizeof(utmp.ut_id)); + (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); (void) setutent(); utptr = getutid(&utmp); /* write it out only if it exists, and the pid's match */ @@ -4335,6 +4568,7 @@ } #endif /* ! VMS */ + /* * Does a non-blocking wait for a child process. If the system * doesn't support non-blocking wait, do nothing. @@ -4368,6 +4602,7 @@ /* ARGSUSED */ static SIGNAL_T reapchild (int n GCC_UNUSED) { + int olderrno = errno; int pid; pid = wait(NULL); @@ -4389,6 +4624,7 @@ } } while ( (pid=nonblocking_wait()) > 0); + errno = olderrno; SIGNAL_RETURN; } #endif /* !VMS */ @@ -4445,6 +4681,7 @@ int c; int count = 0; + TRACE(("parse_tty_modes\n")); while (1) { while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) s++; if (!*s) return count; @@ -4458,38 +4695,13 @@ while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) s++; if (!*s) return -1; - if (*s == '^') { - s++; - c = ((*s == '?') ? A2E(0177) : CONTROL(*s)); - if (*s == '-') { - c = -1; - errno = 0; -#if defined(_POSIX_VDISABLE) && defined(HAVE_UNISTD_H) - c = _POSIX_VDISABLE; -#endif -#if defined(_PC_VDISABLE) - if (c == -1) { - c = fpathconf(0, _PC_VDISABLE); - if (c == -1) { - if (errno != 0) - continue; /* skip this (error) */ - c = 0377; - } - } -#elif defined(VDISABLE) - if (c == -1) - c = VDISABLE; -#endif - if (c == -1) - continue; /* ignore */ - } - } else { - c = *s; + if ((c = decode_keyvalue(s++, False)) != -1) { + mp->value = c; + mp->set = 1; + count++; + TRACE(("...parsed #%d: %s=%#x\n", count, mp->name, c)); } - mp->value = c; - mp->set = 1; - count++; - s++; + while (*s && isascii(CharOf(*s)) && isgraph(CharOf(*s))) s++; } } Index: xc/programs/xterm/main.h diff -u xc/programs/xterm/main.h:3.5 xc/programs/xterm/main.h:3.6 --- xc/programs/xterm/main.h:3.5 Wed Jan 17 18:46:37 2001 +++ xc/programs/xterm/main.h Sat Sep 8 21:07:26 2001 @@ -2,7 +2,7 @@ * $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 $ */ +/* $XFree86: xc/programs/xterm/main.h,v 3.6 2001/09/09 01:07:26 dickey Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -31,6 +31,7 @@ #define DEFFONT "fixed" #define DEFWIDEFONT NULL /* grab one which is 2x as wide */ #define DEFWIDEBOLDFONT NULL +#define DEFXIMFONT "*" #define DEFBOLDFONT NULL /* no bold font uses overstriking */ #define DEFBORDER 2 #define DEFFACENAME NULL Index: xc/programs/xterm/menu.c diff -u xc/programs/xterm/menu.c:3.41 xc/programs/xterm/menu.c:3.44 --- xc/programs/xterm/menu.c:3.41 Wed Jan 17 18:46:37 2001 +++ xc/programs/xterm/menu.c Sat Jan 5 17:05:03 2002 @@ -1,7 +1,7 @@ -/* $Xorg: menu.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ +/* $Xorg: menu.c,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /* -Copyright 1999-2000 by Thomas E. Dickey +Copyright 1999, 2001 by Thomas E. Dickey All Rights Reserved @@ -23,14 +23,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -Copyright (c) 1989 X Consortium +Copyright 1989 The Open Group -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and 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: +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -38,16 +37,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +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 X Consortium shall not be +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 X Consortium. +in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xterm/menu.c,v 3.41 2001/01/17 23:46:37 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/menu.c,v 3.44 2002/01/05 22:05:03 dickey Exp $ */ #include <xterm.h> #include <data.h> @@ -1644,7 +1643,7 @@ String *params, Cardinal *param_count) { - handle_toggle (do_scrollbar, (int) term->screen.fullVwin.scrollbar, + handle_toggle (do_scrollbar, (int) term->screen.fullVwin.sb_info.width, params, *param_count, w, (XtPointer)0, (XtPointer)0); } @@ -1999,26 +1998,6 @@ #if OPT_TOOLBAR /* - * In the normal (non-toolbar) configuration, the xterm widget covers almost - * all of the window. With a toolbar, there's a relatively large area that - * the user would expect to enter keystrokes since the program can get the - * focus. - */ -static char menu_trans[] = -"\ - ~Meta <KeyPress>:insert-seven-bit() \n\ - Meta <KeyPress>:insert-eight-bit() \n\ -"; - -XtActionsRec menu_actions[] = { - { "insert", HandleKeyPressed }, /* alias */ - { "insert-eight-bit", HandleEightBitKeyPressed }, - { "insert-seven-bit", HandleKeyPressed }, - { "secure", HandleSecure }, - { "string", HandleStringEvent }, -}; - -/* * The normal style of xterm popup menu delays initialization until the menu is * first requested. When using a toolbar, we can use the same initialization, * though on the first popup there will be a little geometry layout jitter, @@ -2095,9 +2074,7 @@ "form", formWidgetClass, shell, NULL); - - XtAppAddActions(app_con, menu_actions, XtNumber(menu_actions)); - XtAugmentTranslations(*forms, XtParseTranslationTable(menu_trans)); + xtermAddInput(*forms); /* * Set a nominal value for the preferred pane size, which lets the Index: xc/programs/xterm/menu.h diff -u xc/programs/xterm/menu.h:3.25 xc/programs/xterm/menu.h:3.28 --- xc/programs/xterm/menu.h:3.25 Wed Jan 17 18:46:37 2001 +++ xc/programs/xterm/menu.h Sat Jan 5 17:05:03 2002 @@ -1,7 +1,7 @@ -/* $Xorg: menu.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ +/* $Xorg: menu.h,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /* -Copyright 1999-2000 by Thomas E. Dickey +Copyright 1999, 2000, 2001 by Thomas E. Dickey All Rights Reserved @@ -23,15 +23,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -Copyright (c) 1989 X Consortium +Copyright 1989 The Open Group -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and 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: +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -39,18 +37,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +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 X Consortium shall +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 X Consortium. +from The Open Group. */ -/* $XFree86: xc/programs/xterm/menu.h,v 3.25 2001/01/17 23:46:37 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/menu.h,v 3.28 2002/01/05 22:05:03 dickey Exp $ */ #ifndef included_menu_h #define included_menu_h @@ -369,7 +367,7 @@ #define update_scrollbar() \ update_menu_item (term->screen.vtMenu, \ vtMenuEntries[vtMenu_scrollbar].widget, \ - Scrollbar(&term->screen)) + ScrollbarWidth(&term->screen)) #define update_jumpscroll() \ update_menu_item (term->screen.vtMenu, \ Index: xc/programs/xterm/minstall.sh diff -u xc/programs/xterm/minstall.sh:1.1 xc/programs/xterm/minstall.sh:1.2 --- xc/programs/xterm/minstall.sh:1.1 Sun Mar 11 20:00:08 2001 +++ xc/programs/xterm/minstall.sh Sun Nov 4 21:07:16 2001 @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/minstall.sh,v 1.1 2001/03/12 01:00:08 dickey Exp $ +# $XFree86: xc/programs/xterm/minstall.sh,v 1.2 2001/11/05 02:07:16 dickey Exp $ # # Install manpages, substituting a reasonable section value since XFree86 4.x # doesn't use constants... @@ -18,6 +18,7 @@ NEW_FILE=temp$$ sed -e 's/__vendorversion__/"X Window System"/' \ + -e s@__apploaddir__@/usr/lib/X11/app-defaults@ \ -e s/__miscmansuffix__/$suffix/ \ $OLD_FILE >$NEW_FILE Index: xc/programs/xterm/misc.c diff -u xc/programs/xterm/misc.c:3.62 xc/programs/xterm/misc.c:3.66 --- xc/programs/xterm/misc.c:3.62 Wed Apr 11 21:02:50 2001 +++ xc/programs/xterm/misc.c Tue Oct 23 21:21:24 2001 @@ -2,11 +2,11 @@ * $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 $ */ +/* $XFree86: xc/programs/xterm/misc.c,v 3.66 2001/10/24 01:21:24 dickey Exp $ */ /* * - * Copyright 1999-2000 by Thomas E. Dickey + * Copyright 1999,2000,2001 by Thomas E. Dickey * * All Rights Reserved * @@ -82,6 +82,7 @@ #include <menu.h> #include <fontutils.h> #include <xcharmouse.h> +#include <xstrings.h> #include <VTparse.h> #if (XtSpecificationRelease < 6) @@ -499,9 +500,9 @@ #else XBell(screen->display, percent); #endif - + if (screen->poponbell) - XRaiseWindow(screen->display, VShellWindow); + XRaiseWindow(screen->display, VShellWindow); if(screen->bellSuppressTime) { /* now we change a property and wait for the notify event to come @@ -756,7 +757,7 @@ event.width = term->core.width; event.height = term->core.height; (*term->core.widget_class->core_class.expose)((Widget)term, (XEvent *)&event, NULL); - if(Scrollbar(screen)) + if(ScrollbarWidth(screen)) (*screen->scrollWidget->core.widget_class->core_class.expose)(screen->scrollWidget, (XEvent *)&event, NULL); } @@ -947,15 +948,12 @@ if(screen->logfile) free(screen->logfile); if(log_default == NULL) { - log_default = (char *)malloc(strlen(log_def_name) + 1); - if (log_default == 0) + if ((log_default = x_strdup(log_def_name)) == NULL) return; - strcpy(log_default, log_def_name); mktemp(log_default); } - if((screen->logfile = (char *)malloc(strlen(log_default) + 1)) == 0) + if((screen->logfile = x_strdup(log_default)) == 0) return; - strcpy(screen->logfile, log_default); } if(*screen->logfile == '|') { /* exec command */ #ifdef ALLOWLOGFILEEXEC @@ -1099,6 +1097,95 @@ unparseputc1(final, pTerm->screen.respond); } +/* +* Find closest color for "def" in "cmap". +* Set "def" to the resulting color. +* Based on Monish Shah's "find_closest_color()" for Vim 6.0, +* modified with ideas from David Tong's "noflash" library. +* Return FALSE if not able to find or allocate a color. +*/ +static int +find_closest_color(Display *display, Colormap cmap, XColor *def) +{ + double tmp, distance, closestDistance; + int i, closest, numFound, cmap_size; + XColor *colortable; + XVisualInfo template, *visInfoPtr; + char *found; + int attempts; + + template.visualid = XVisualIDFromVisual(DefaultVisual(display, + XDefaultScreen(display))); + visInfoPtr = XGetVisualInfo(display, (long)VisualIDMask, + &template, &numFound); + if (numFound < 1) { + /* FindClosestColor couldn't lookup visual */ + return FALSE; + } + + cmap_size = visInfoPtr->colormap_size; + XFree((char *)visInfoPtr); + colortable = (XColor *)malloc(cmap_size * sizeof(XColor)); + if (!colortable) { + return FALSE; /* out of memory */ + } + found = (char *)calloc(cmap_size, sizeof(char)); + if (!found) { + free(colortable); + return FALSE; /* out of memory */ + } + + for (i = 0; i < cmap_size; i++) { + colortable[i].pixel = (unsigned long)i; + } + XQueryColors (display, cmap, colortable, cmap_size); + + /* + * Find the color that best approximates the desired one, then + * try to allocate that color. If that fails, it must mean that + * the color was read-write (so we can't use it, since its owner + * might change it) or else it was already freed. Try again, + * over and over again, until something succeeds. + */ + for(attempts = 0; attempts < cmap_size; attempts++) { + closestDistance = 1e30; + closest = 0; + for (i = 0; i < cmap_size; i++) { + if (!found[closest]) { + /* + * Use Euclidean distance in RGB space, weighted by Y (of YIQ) + * as the objective function; this accounts for differences + * in the color sensitivity of the eye. + */ + tmp = .30 * (((int)def->red) - (int)colortable[i].red); + distance = tmp * tmp; + tmp = .61 * (((int)def->green) - (int)colortable[i].green); + distance += tmp * tmp; + tmp = .11 * (((int)def->blue) - (int)colortable[i].blue); + distance += tmp * tmp; + if (distance < closestDistance) + { + closest = i; + closestDistance = distance; + } + } + } + if (XAllocColor(display, cmap, &colortable[closest]) != 0) { + *def = colortable[closest]; + break; + } + found[closest] = TRUE; /* Don't look at this entry again */ + } + + free(colortable); + free(found); + if (attempts < cmap_size) { + return TRUE; /* Got a closest matching color */ + } else { + return FALSE; /* Couldn't allocate a near match */ + } +} + static Boolean AllocateAnsiColor( XtermWidget pTerm, @@ -1110,7 +1197,8 @@ Colormap cmap = pTerm->core.colormap; if (XParseColor(screen->display, cmap, spec, &def) - && XAllocColor(screen->display, cmap, &def)) { + && (XAllocColor(screen->display, cmap, &def) + || find_closest_color(screen->display, cmap, &def))) { SET_COLOR_RES(res, def.pixel); TRACE(("AllocateAnsiColor %s (pixel %#lx)\n", spec, def.pixel)); return(TRUE); @@ -1178,6 +1266,8 @@ ChangeAnsiColors(pTerm); return(r); } +#else +#define find_closest_color(display, cmap, def) 0 #endif /* OPT_ISO_COLORS */ /***====================================================================***/ @@ -1223,6 +1313,7 @@ return; } } + if (buf == 0) return; switch(mode) { case 0: /* new icon name and title*/ @@ -1797,7 +1888,8 @@ char *newName; if (XParseColor(screen->display, cmap, name, &def) - && XAllocColor(screen->display, cmap, &def) + && (XAllocColor(screen->display, cmap, &def) + || find_closest_color(screen->display, cmap, &def)) && (newName = XtMalloc(strlen(name)+1)) != 0) { SET_COLOR_VALUE(pNew, ndx, def.pixel); strcpy(newName, name); @@ -1906,6 +1998,16 @@ Cleanup(i); } +static void +Sleep (int msec) +{ + static struct timeval select_timeout; + + select_timeout.tv_sec = 0; + select_timeout.tv_usec = msec * 1000; + select(0, 0, 0, 0, &select_timeout); +} + /* * cleanup by sending SIGHUP to client processes */ @@ -1929,6 +2031,7 @@ hold_screen = 2; while (hold_screen) { xevents(); + Sleep(10); } } Index: xc/programs/xterm/os2main.c diff -u xc/programs/xterm/os2main.c:3.45 xc/programs/xterm/os2main.c:3.49 --- xc/programs/xterm/os2main.c:3.45 Wed Apr 11 21:02:50 2001 +++ xc/programs/xterm/os2main.c Sat Jan 5 17:05:03 2002 @@ -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.45 2001/04/12 01:02:50 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/os2main.c,v 3.49 2002/01/05 22:05:03 dickey Exp $ */ /*********************************************************** @@ -227,6 +227,7 @@ char *icon_name; char *term_name; char *tty_modes; + Boolean hold_screen; /* true if we keep window open */ Boolean utmpInhibit; Boolean messages; Boolean sunFunctionKeys; /* %%% should be widget resource? */ @@ -267,6 +268,8 @@ offset(term_name), XtRString, (caddr_t) NULL}, {"ttyModes", "TtyModes", XtRString, sizeof(char *), offset(tty_modes), XtRString, (caddr_t) NULL}, + {"hold", "Hold", XtRBoolean, sizeof (Boolean), + offset(hold_screen), XtRString, "false"}, {"utmpInhibit", "UtmpInhibit", XtRBoolean, sizeof (Boolean), offset(utmpInhibit), XtRString, "false"}, {"messages", "Messages", XtRBoolean, sizeof (Boolean), @@ -335,7 +338,6 @@ {"-cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "off"}, {"+cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "on"}, {"-cc", "*charClass", XrmoptionSepArg, (caddr_t) NULL}, -{"-class", NULL, XrmoptionSkipArg, (caddr_t) NULL}, {"-cm", "*colorMode", XrmoptionNoArg, (caddr_t) "off"}, {"+cm", "*colorMode", XrmoptionNoArg, (caddr_t) "on"}, {"-cn", "*cutNewline", XrmoptionNoArg, (caddr_t) "off"}, @@ -345,11 +347,22 @@ {"+cu", "*curses", XrmoptionNoArg, (caddr_t) "off"}, {"-dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "off"}, {"+dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "on"}, -{"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, {"-fb", "*boldFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fbb", "*freeBoldBox", XrmoptionNoArg, (caddr_t)"off"}, +{"+fbb", "*freeBoldBox", XrmoptionNoArg, (caddr_t)"on"}, +{"-fbx", "*forceBoxChars", XrmoptionNoArg, (caddr_t)"off"}, +{"+fbx", "*forceBoxChars", XrmoptionNoArg, (caddr_t)"on"}, #ifndef NO_ACTIVE_ICON {"-fi", "*iconFont", XrmoptionSepArg, (caddr_t) NULL}, #endif /* NO_ACTIVE_ICON */ +#ifdef XRENDERFONT +{"-fa", "*faceName", XrmoptionSepArg, (caddr_t) NULL}, +{"-fs", "*faceSize", XrmoptionSepArg, (caddr_t) NULL}, +#endif +#if OPT_WIDE_CHARS +{"-fw", "*wideFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fwb", "*wideBoldFont", XrmoptionSepArg, (caddr_t) NULL}, +#endif #if OPT_HIGHLIGHT_COLOR {"-hc", "*highlightColor", XrmoptionSepArg, (caddr_t) NULL}, #endif @@ -357,6 +370,8 @@ {"-hf", "*hpFunctionKeys",XrmoptionNoArg, (caddr_t) "on"}, {"+hf", "*hpFunctionKeys",XrmoptionNoArg, (caddr_t) "off"}, #endif +{"-hold", "*hold", XrmoptionNoArg, (caddr_t) "on"}, +{"+hold", "*hold", XrmoptionNoArg, (caddr_t) "off"}, {"-j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "on"}, {"+j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "off"}, /* parse logging options anyway for compatibility */ @@ -431,6 +446,11 @@ {"-samename", "*sameName", XrmoptionNoArg, (caddr_t) "on"}, {"+samename", "*sameName", XrmoptionNoArg, (caddr_t) "off"}, #endif +/* options that we process ourselves */ +{"-help", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, +{"-version", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, +{"-class", NULL, XrmoptionSkipArg, (caddr_t) NULL}, +{"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, /* bogus old compatibility stuff for which there are standard XtAppInitialize options now */ {"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, @@ -444,10 +464,7 @@ {"-w", ".borderWidth", XrmoptionSepArg, (caddr_t) NULL}, }; -static struct _options { - char *opt; - char *desc; -} options[] = { +static OptionHelp options[] = { { "-version", "print the version number" }, { "-help", "print out this message" }, { "-display displayname", "X server to contact" }, @@ -458,6 +475,17 @@ { "-bd color", "border color" }, { "-bw number", "border width in pixels" }, { "-fn fontname", "normal text font" }, +{ "-fb fontname", "bold text font" }, +{ "-/+fbb", "turn on/off bold font's box checking"}, +{ "-/+fbx", "turn off/on linedrawing characters"}, +#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" }, +#endif { "-iconic", "start iconic" }, { "-name string", "client instance, icon, and title strings" }, { "-class string", "class string (XTerm)" }, @@ -481,13 +509,13 @@ { "-cr color", "text cursor color" }, { "-/+cu", "turn on/off curses emulation" }, { "-/+dc", "turn off/on dynamic color selection" }, -{ "-fb fontname", "bold text font" }, #if OPT_HIGHLIGHT_COLOR { "-hc", "selection background color" }, #endif #if OPT_HP_FUNC_KEYS { "-/+hf", "turn on/off HP Function Key escape codes" }, #endif +{ "-/+hold", "turn on/off logic that retains window after exit" }, { "-/+im", "use insert mode for TERMCAP" }, { "-/+j", "turn on/off jump scroll" }, #ifdef ALLOWLOGGING @@ -551,7 +579,7 @@ { "-ziconbeep percent", "beep and flag icon of window having hidden output" }, #endif #if OPT_SAME_NAME -{"-/+samename", "turn on/off the no flicker option for title and icon name" }, +{ "-/+samename", "turn on/off the no-flicker option for title and icon name" }, #endif { NULL, NULL }}; @@ -577,16 +605,41 @@ "must appear at the end of the command line, otherwise the user's default shell", "will be started. Options that start with a plus sign (+) restore the default.", NULL}; + +static Boolean get_termcap(char *name, char *buffer, char *resized) +{ + register TScreen *screen = &term->screen; + + *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ + + if (name != 0) { + if (tgetent (buffer, name) == 1) { + TRACE(("get_termcap(%s) succeeded (%s)\n", name, + *buffer + ? "ok:termcap, we can update $TERMCAP" + : "assuming this is terminfo")); + if (*buffer) { + if (!TEK4014_ACTIVE(screen)) { + resize (screen, buffer, resized); + } + } + return True; + } else { + *buffer = 0; /* just in case */ + } + } + return False; +} -static int abbrev (char *tst, char *cmp) +static int abbrev (char *tst, char *cmp, size_t need) { size_t len = strlen(tst); - return ((len >= 2) && (!strncmp(tst, cmp, len))); + return ((len >= need) && (!strncmp(tst, cmp, len))); } static void Syntax (char *badOption) { - struct _options *opt; + OptionHelp *opt; int col; fprintf (stderr, "%s: bad command line option \"%s\"\r\n\n", @@ -612,12 +665,12 @@ static void Version (void) { printf("%s(%d)\n", XFREE86_VERSION, XTERM_PATCH); - exit (0); + fflush(stdout); } static void Help (void) { - struct _options *opt; + OptionHelp *opt; char **cpp; fprintf (stderr, "%s(%d) usage:\n %s [-options ...] [-e command args]\n\n", @@ -633,8 +686,7 @@ putc ('\n', stderr); } putc ('\n', stderr); - - exit (0); + fflush(stderr); } /* ARGSUSED */ @@ -672,12 +724,12 @@ Cardinal *num_params GCC_UNUSED) { #if OPT_TEK4014 - if (w == toplevel) + if (w == toplevel) { if (term->screen.Tshow) hide_vt_window(); else do_hangup(w, (XtPointer)0, (XtPointer)0); - else + } else if (term->screen.Vshow) hide_tek_window(); else @@ -798,18 +850,33 @@ /* Do these first, since we may not be able to open the display */ ProgramName = argv[0]; + TRACE_OPTS(options, optionDescList, XtNumber(optionDescList)); + TRACE_ARGV("Before XtAppInitialize", argv); if (argc > 1) { int n; - if (abbrev(argv[1], "-version")) - Version(); - if (abbrev(argv[1], "-help")) - Help(); + int unique = 2; + Boolean quit = True; + for (n = 1; n < argc; n++) { - if (strlen(argv[n]) > 2 - && abbrev(argv[n], "-class")) - if ((my_class = argv[++n]) == 0) + TRACE(("parsing %s\n", argv[n])); + if (abbrev(argv[n], "-version", unique)) { + Version(); + } else if (abbrev(argv[n], "-help", unique)) { + Help(); + } else if (abbrev(argv[n], "-class", 3)) { + if ((my_class = argv[++n]) == 0) { Help(); + } else { + quit = False; + } + unique = 3; + } else { + quit = False; + unique = 3; + } } + if (quit) + exit(0); } /* XXX: for some obscure reason EMX seems to lose the value of @@ -898,6 +965,7 @@ #if OPT_SAME_NAME sameName = resource.sameName; #endif + hold_screen = resource.hold_screen ? 1 : 0; xterm_name = resource.xterm_name; if (strcmp(xterm_name, "-") == 0) xterm_name = DFT_TERMTYPE; if (resource.icon_geometry != NULL) { @@ -921,14 +989,24 @@ XtSetValues (toplevel, ourTopLevelShellArgs, number_ourTopLevelShellArgs); +#if OPT_WIDE_CHARS + /* seems as good a place as any */ + init_classtab(); +#endif + /* Parse the rest of the command line */ + TRACE_ARGV("After XtAppInitialize", argv); for (argc--, argv++ ; argc > 0 ; argc--, argv++) { if(**argv != '-') Syntax (*argv); + TRACE(("parsing %s\n", argv[0])); switch(argv[0][1]) { - case 'h': - Help (); - /* NOTREACHED */ + case 'h': /* -help */ + Help(); + continue; + case 'v': /* -version */ + Version(); + continue; case 'C': { struct stat sbuf; @@ -954,8 +1032,9 @@ debug = TRUE; continue; #endif /* DEBUG */ - case 'c': /* -class */ - break; + case 'c': /* -class param */ + argc--, argv++; + continue; case 'e': if (argc <= 1) Syntax (*argv); command_to_exec = ++argv; @@ -966,6 +1045,20 @@ break; } +#if OPT_WIDE_CHARS + /* Test whether UTF-8 mode should be active by default */ + { + char *s; + + if (((s = getenv("LC_ALL")) != 0 && *s != '\0') || + ((s = getenv("LC_CTYPE")) != 0 && *s != '\0') || + ((s = getenv("LANG")) != 0 && *s != '\0')) { + if (strstr(s, "UTF-8")) + defaultUTF8[0] = '2'; + } + } +#endif + SetupMenus(toplevel, &form_top, &menu_top); term = (XtermWidget) XtVaCreateManagedWidget( @@ -1018,6 +1111,11 @@ XtSetArg (args[0], XtNtitle, resource.title); XtSetArg (args[1], XtNiconName, resource.icon_name); + TRACE(("setting:\n\ttitle \"%s\"\n\ticon \"%s\"\n\tbased on command \"%s\"\n", + resource.title, + resource.icon_name, + *command_to_exec)); + XtSetValues (toplevel, args, 2); } @@ -1387,16 +1485,7 @@ * the program to proceed (but not to set $TERMCAP) if the termcap * entry is not found. */ - *ptr = 0; /* initialize, in case we're using terminfo's tgetent */ - TermName = NULL; - if (resource.term_name) { - TermName = resource.term_name; - if (tgetent (ptr, resource.term_name) == 1) { - if (*ptr) - if (!TEK4014_ACTIVE(screen)) - resize (screen, termcap, newtc); - } - } + get_termcap(TermName = resource.term_name, ptr, newtc); /* * This block is invoked only if there was no terminal name specified @@ -1405,12 +1494,9 @@ if (!TermName) { TermName = *envnew; while (*envnew != NULL) { - if(tgetent(ptr, *envnew) == 1) { - TermName = *envnew; - if (*ptr) - if(!TEK4014_ACTIVE(screen)) - resize(screen, termcap, newtc); - break; + if (get_termcap(*envnew, ptr, newtc)) { + TermName = *envnew; + break; } envnew++; } @@ -1598,6 +1684,7 @@ } if (command_to_exec) { + TRACE(("spawning command \"%s\"\n", *command_to_exec)); execvpe(*command_to_exec, command_to_exec, gblenvp); @@ -1728,7 +1815,8 @@ #ifdef DEBUG if (debug) fputs ("Exiting\n", stderr); #endif - Cleanup (0); + if (!hold_screen) + Cleanup (0); } } while ( (pid=nonblocking_wait()) > 0); Index: xc/programs/xterm/ptydata.c diff -u xc/programs/xterm/ptydata.c:1.13 xc/programs/xterm/ptydata.c:1.14 --- xc/programs/xterm/ptydata.c:1.13 Fri Sep 22 06:42:08 2000 +++ xc/programs/xterm/ptydata.c Wed Aug 15 05:59:26 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/ptydata.c,v 1.13 2000/09/22 10:42:08 alanh Exp $ + * $XFree86: xc/programs/xterm/ptydata.c,v 1.14 2001/08/15 09:59:26 alanh Exp $ */ /************************************************************ @@ -80,8 +80,9 @@ * Yes, I know this is a majorly f*ugly hack, however it seems to * be necessary for Solaris x86. DWH 11/15/94 * Dunno why though.. + * (and now CYGWIN, alanh@xfree86.org 08/15/01 */ -#if defined(i386) && defined(SVR4) && defined(sun) +#if (defined(i386) && defined(SVR4) && defined(sun)) || defined(__CYGWIN__) if (errno == EIO || errno == 0 ) #else if (errno == EIO) Index: xc/programs/xterm/ptyx.h diff -u xc/programs/xterm/ptyx.h:3.86 xc/programs/xterm/ptyx.h:3.91 --- xc/programs/xterm/ptyx.h:3.86 Wed Apr 11 21:02:50 2001 +++ xc/programs/xterm/ptyx.h Sat Jan 5 17:05:03 2002 @@ -2,10 +2,10 @@ * $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 $ */ +/* $XFree86: xc/programs/xterm/ptyx.h,v 3.91 2002/01/05 22:05:03 dickey Exp $ */ /* - * Copyright 1999-2000 by Thomas E. Dickey + * Copyright 1999,2000,2001,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -303,6 +303,11 @@ #define NPARAM 30 /* Max. parameters */ typedef struct { + char *opt; + char *desc; +} OptionHelp; + +typedef struct { unsigned char a_type; unsigned char a_pintro; unsigned char a_final; @@ -382,13 +387,9 @@ #define Bres(name,class,offset,value) \ {RES_NAME(name), RES_CLASS(class), XtRBoolean, sizeof(Boolean), \ RES_OFFSET(offset), XtRImmediate, (XtPointer) value} - -#define Cres(name,offset,value) \ - {RES_NAME(name), XtCForeground, XtRPixel, sizeof(Pixel), \ - RES_OFFSET(offset), XtRString, value} -#define Dres(name,offset,value) \ - {RES_NAME(name), XtCBackground, XtRPixel, sizeof(Pixel), \ +#define Cres(name,class,offset,value) \ + {RES_NAME(name), RES_CLASS(class), XtRPixel, sizeof(Pixel), \ RES_OFFSET(offset), XtRString, value} #define Ires(name,class,offset,value) \ @@ -423,6 +424,10 @@ #define OPT_CLIP_BOLD 1 /* true if xterm uses clipping to avoid bold-trash */ #endif +#ifndef OPT_COLOR_CLASS +#define OPT_COLOR_CLASS 1 /* true if xterm uses separate color-resource classes */ +#endif + #ifndef OPT_COLOR_RES #define OPT_COLOR_RES 1 /* true if xterm delays color-resource evaluation */ #endif @@ -551,14 +556,6 @@ #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 @@ -671,10 +668,18 @@ # define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) /*nothing*/ #endif +#define COLOR_RES_NAME(root) "color" root + +#if OPT_COLOR_CLASS +#define COLOR_RES_CLASS(root) "Color" root +#else +#define COLOR_RES_CLASS(root) XtCForeground +#endif + #if OPT_COLOR_RES -#define COLOR_RES(name,offset,value) Sres(name, XtCForeground, offset.resource, value) +#define COLOR_RES(root,offset,value) Sres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset.resource, value) #else -#define COLOR_RES(name,offset,value) Cres(name, offset, value) +#define COLOR_RES(root,offset,value) Cres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset, value) #endif /***====================================================================***/ @@ -809,10 +814,19 @@ #ifndef TRACE #define TRACE(p) /*nothing*/ #endif +#ifndef TRACE_ARGV +#define TRACE_ARGV(tag,argv) /*nothing*/ +#endif #ifndef TRACE_CHILD #define TRACE_CHILD /*nothing*/ #endif +#ifndef TRACE_OPTS +#define TRACE_OPTS(opts,ress,lens) /*nothing*/ +#endif +#ifndef TRACE_TRANS +#define TRACE_TRANS(name,w) /*nothing*/ #endif +#endif /***====================================================================***/ @@ -949,6 +963,17 @@ #endif } SavedCursor; +typedef struct { + int width; /* if > 0, width of scrollbar, */ + /* and scrollbar is showing */ + Boolean rv_cached; /* see ScrollBarReverseVideo */ + int rv_active; /* ...current reverse-video */ + Pixel bg; /* ...cached background color */ + Pixel fg; /* ...cached foreground color */ + Pixel bdr; /* ...cached border color */ + Pixmap bdpix; /* ...cached border pixmap */ +} SbInfo; + struct _vtwin { Window window; /* X window id */ int width; /* width of columns */ @@ -959,8 +984,7 @@ int f_height; /* height of fonts in pixels */ int f_ascent; /* ascent of font in pixels */ int f_descent; /* descent of font in pixels */ - int scrollbar; /* if > 0, width of scrollbar, */ - /* and scrollbar is showing */ + SbInfo sb_info; GC normalGC; /* normal painting */ GC reverseGC; /* reverse painting */ GC normalboldGC; /* normal painting, bold font */ @@ -1085,11 +1109,12 @@ Boolean fnt_prop; /* true if proportional fonts */ Boolean fnt_boxes; /* true if font has box-chars */ - Boolean force_box_chars; /* true if we assume that */ + Boolean force_box_chars;/* true if we assume that */ Dimension fnt_wide; Dimension fnt_high; XFontStruct *fnt_norm; /* normal font of terminal */ XFontStruct *fnt_bold; /* bold font of terminal */ + Boolean free_bold_box; /* same_font_size's austerity */ #if OPT_WIDE_CHARS XFontStruct *fnt_dwd; /* wide font of terminal */ XFontStruct *fnt_dwdb; /* wide bold font of terminal */ @@ -1255,6 +1280,10 @@ XftFont *renderFontBold; XftDraw *renderDraw; #endif +#ifdef OPT_INPUT_METHOD + XFontSet fs; /* fontset for XIM preedit */ + int fs_ascent; /* ascent of fs */ +#endif } TScreen; typedef struct _TekPart { @@ -1289,6 +1318,9 @@ { xtermKeyboardType type; unsigned flags; +#if OPT_INITIAL_ERASE + int reset_DECBKM; /* reset should set DECBKM */ +#endif } TKeyboard; typedef struct _Misc { @@ -1300,6 +1332,9 @@ char *f_w; char *f_wb; #endif +#if OPT_INPUT_METHOD + char *f_x; +#endif int limit_resize; #ifdef ALLOWLOGGING Boolean log_on; @@ -1321,6 +1356,7 @@ Boolean useRight; #endif Boolean titeInhibit; + Boolean tiXtraScroll; Boolean appcursorDefault; Boolean appkeypadDefault; #if OPT_INPUT_METHOD @@ -1481,9 +1517,9 @@ #define ISO_PROTECT 2 #ifdef SCROLLBAR_RIGHT -#define OriginX(screen) (((term->misc.useRight)?0:Scrollbar(screen)) + screen->border) +#define OriginX(screen) (((term->misc.useRight)?0:ScrollbarWidth(screen)) + screen->border) #else -#define OriginX(screen) (Scrollbar(screen) + screen->border) +#define OriginX(screen) (ScrollbarWidth(screen) + screen->border) #endif #define CursorX(screen,col) ((col) * FontWidth(screen) + OriginX(screen)) @@ -1506,7 +1542,7 @@ : (screen)->whichVwin->f_ascent) #define FontDescent(screen) (IsIcon(screen) ? (screen)->fnt_icon->descent \ : (screen)->whichVwin->f_descent) -#define Scrollbar(screen) ((screen)->whichVwin->scrollbar) +#define ScrollbarWidth(screen) ((screen)->whichVwin->sb_info.width) #define NormalGC(screen) ((screen)->whichVwin->normalGC) #define ReverseGC(screen) ((screen)->whichVwin->reverseGC) #define NormalBoldGC(screen) ((screen)->whichVwin->normalboldGC) @@ -1532,7 +1568,7 @@ #define FontHeight(screen) ((screen)->fullVwin.f_height) #define FontAscent(screen) ((screen)->fullVwin.f_ascent) #define FontDescent(screen) ((screen)->fullVwin.f_descent) -#define Scrollbar(screen) ((screen)->fullVwin.scrollbar) +#define ScrollbarWidth(screen) ((screen)->fullVwin.sb_info.width) #define NormalGC(screen) ((screen)->fullVwin.normalGC) #define ReverseGC(screen) ((screen)->fullVwin.reverseGC) #define NormalBoldGC(screen) ((screen)->fullVwin.normalboldGC) Index: xc/programs/xterm/resize.c diff -u xc/programs/xterm/resize.c:3.48 xc/programs/xterm/resize.c:3.51 --- xc/programs/xterm/resize.c:3.48 Thu Apr 5 15:29:44 2001 +++ xc/programs/xterm/resize.c Tue Oct 9 17:52:40 2001 @@ -2,7 +2,7 @@ * $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 $ */ +/* $XFree86: xc/programs/xterm/resize.c,v 3.51 2001/10/09 21:52:40 alanh Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -178,9 +178,10 @@ #include <curses.h> #endif #else +#undef ERR /* workaround for glibc 2.1.3 */ #include <curses.h> #ifdef NCURSES_VERSION -#ifdef __CYGWIN__ +#ifdef HAVE_NCURSES_TERM_H #include <ncurses/term.h> #else #include <term.h> /* tgetent() */ @@ -189,7 +190,7 @@ #endif /* HAVE_TERMCAP_H */ #endif -#define TERMCAP_SIZE 1500 /* 1023 is standard; 'screen' exceeds */ +#define TERMCAP_SIZE 1500 /* 1023 is standard; 'screen' exceeds */ /* resets termcap string to reflect current screen size Index: xc/programs/xterm/screen.c diff -u xc/programs/xterm/screen.c:3.56 xc/programs/xterm/screen.c:3.57 --- xc/programs/xterm/screen.c:3.56 Wed Apr 11 21:02:50 2001 +++ xc/programs/xterm/screen.c Sat Sep 8 21:07:26 2001 @@ -54,7 +54,7 @@ * SOFTWARE. */ -/* $XFree86: xc/programs/xterm/screen.c,v 3.56 2001/04/12 01:02:50 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/screen.c,v 3.57 2001/09/09 01:07:26 dickey Exp $ */ /* screen.c */ @@ -1141,7 +1141,7 @@ /* small mouse movements. */ rows = (height + FontHeight(screen) / 2 - border) / FontHeight(screen); - cols = (width + FontWidth(screen) / 2 - border - Scrollbar(screen)) / + cols = (width + FontWidth(screen) / 2 - border - ScrollbarWidth(screen)) / FontWidth(screen); if (rows < 1) rows = 1; if (cols < 1) cols = 1; @@ -1200,7 +1200,7 @@ screen->cur_col = screen->max_col; screen->fullVwin.height = height - border; - screen->fullVwin.width = width - border - screen->fullVwin.scrollbar; + screen->fullVwin.width = width - border - screen->fullVwin.sb_info.width; } else if(FullHeight(screen) == height && FullWidth(screen) == width) return(0); /* nothing has changed at all */ Index: xc/programs/xterm/scrollbar.c diff -u xc/programs/xterm/scrollbar.c:3.30 xc/programs/xterm/scrollbar.c:3.31 --- xc/programs/xterm/scrollbar.c:3.30 Sun Mar 11 19:54:18 2001 +++ xc/programs/xterm/scrollbar.c Sat Sep 8 21:07:26 2001 @@ -2,7 +2,7 @@ * $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 $ */ +/* $XFree86: xc/programs/xterm/scrollbar.c,v 3.31 2001/09/09 01:07:26 dickey Exp $ */ /* * Copyright 2000,2001 by Thomas E. Dickey @@ -80,9 +80,9 @@ */ static void -ResizeScreen(register XtermWidget xw, int min_width, int min_height) +ResizeScreen(XtermWidget xw, int min_width, int min_height) { - register TScreen *screen = &xw->screen; + TScreen *screen = &xw->screen; #ifndef nothack XSizeHints sizehints; long supp; @@ -208,10 +208,10 @@ #endif /* NO_ACTIVE_ICON */ } -void DoResizeScreen (register XtermWidget xw) +void DoResizeScreen (XtermWidget xw) { int border = 2 * xw->screen.border; - ResizeScreen (xw, border + xw->screen.fullVwin.scrollbar, border); + ResizeScreen (xw, border + xw->screen.fullVwin.sb_info.width, border); } @@ -219,23 +219,17 @@ CreateScrollBar(XtermWidget xw, int x, int y, int height) { Widget scrollWidget; + Arg args[6]; - static Arg argList[] = { - {XtNx, (XtArgVal) 0}, - {XtNy, (XtArgVal) 0}, - {XtNheight, (XtArgVal) 0}, - {XtNreverseVideo, (XtArgVal) 0}, - {XtNorientation, (XtArgVal) XtorientVertical}, - {XtNborderWidth, (XtArgVal) 1}, - }; - - argList[0].value = (XtArgVal) x; - argList[1].value = (XtArgVal) y; - argList[2].value = (XtArgVal) height; - argList[3].value = (XtArgVal) xw->misc.re_verse; + XtSetArg(args[0], XtNx, x); + XtSetArg(args[1], XtNy, y); + XtSetArg(args[2], XtNheight, height); + XtSetArg(args[3], XtNreverseVideo, xw->misc.re_verse); + XtSetArg(args[4], XtNorientation, XtorientVertical); + XtSetArg(args[5], XtNborderWidth, 1); scrollWidget = XtCreateWidget("scrollbar", scrollbarWidgetClass, - (Widget)xw, argList, XtNumber(argList)); + (Widget)xw, args, XtNumber(args)); XtAddCallback (scrollWidget, XtNscrollProc, ScrollTextUpDownBy, 0); XtAddCallback (scrollWidget, XtNjumpProc, ScrollTextTo, 0); return (scrollWidget); @@ -243,35 +237,46 @@ void -ScrollBarReverseVideo(register Widget scrollWidget) +ScrollBarReverseVideo(Widget scrollWidget) { + SbInfo *sb = &(term->screen.fullVwin.sb_info); Arg args[4]; Cardinal nargs = XtNumber(args); - unsigned long bg, fg, bdr; - Pixmap bdpix; - XtSetArg(args[0], XtNbackground, &bg); - XtSetArg(args[1], XtNforeground, &fg); - XtSetArg(args[2], XtNborderColor, &bdr); - XtSetArg(args[3], XtNborderPixmap, &bdpix); - XtGetValues (scrollWidget, args, nargs); - args[0].value = (XtArgVal) fg; - args[1].value = (XtArgVal) bg; - nargs--; /* don't set border_pixmap */ - if (bdpix == XtUnspecifiedPixmap) { /* if not pixmap then pixel */ - args[2].value = args[1].value; /* keep border visible */ - } else { /* ignore since pixmap */ - nargs--; /* don't set border pixel */ + /* + * Remember the scrollbar's original colors. + */ + if (sb->rv_cached == False) { + XtSetArg(args[0], XtNbackground, &(sb->bg)); + XtSetArg(args[1], XtNforeground, &(sb->fg)); + XtSetArg(args[2], XtNborderColor, &(sb->bdr)); + XtSetArg(args[3], XtNborderPixmap, &(sb->bdpix)); + XtGetValues (scrollWidget, args, nargs); + sb->rv_cached = True; + sb->rv_active = 0; + } + + sb->rv_active = !(sb->rv_active); + XtSetArg(args[!(sb->rv_active)], XtNbackground, sb->bg); + XtSetArg(args[ (sb->rv_active)], XtNforeground, sb->fg); + nargs = 2; /* don't set border_pixmap */ + if (sb->bdpix == XtUnspecifiedPixmap) { /* if not pixmap then pixel */ + if (sb->rv_active) { /* keep border visible */ + XtSetArg(args[2], XtNborderColor, args[1].value); + } else { + XtSetArg(args[2], XtNborderColor, sb->bdr); + } + nargs = 3; } XtSetValues (scrollWidget, args, nargs); } void -ScrollBarDrawThumb(register Widget scrollWidget) +ScrollBarDrawThumb(Widget scrollWidget) { - register TScreen *screen = &term->screen; - register int thumbTop, thumbHeight, totalHeight; + TScreen *screen = &term->screen; + int thumbTop, thumbHeight, totalHeight; thumbTop = screen->topline + screen->savedlines; thumbHeight = screen->max_row + 1; @@ -304,11 +309,11 @@ } void -WindowScroll(register TScreen *screen, int top) +WindowScroll(TScreen *screen, int top) { - register int i, lines; - register int scrolltop, scrollheight, refreshtop; - register int x = 0; + int i, lines; + int scrolltop, scrollheight, refreshtop; + int x = 0; if (top < -screen->savedlines) top = -screen->savedlines; @@ -353,10 +358,10 @@ void ScrollBarOn (XtermWidget xw, int init, int doalloc) { - register TScreen *screen = &xw->screen; - register int i, j, k; + TScreen *screen = &xw->screen; + int i, j, k; - if(screen->fullVwin.scrollbar) + if(screen->fullVwin.sb_info.width) return; if (init) { /* then create it only */ @@ -403,8 +408,12 @@ } ResizeScrollBar (screen); + xtermAddInput(screen->scrollWidget); XtRealizeWidget (screen->scrollWidget); - screen->fullVwin.scrollbar = screen->scrollWidget->core.width + + TRACE_TRANS("scrollbar", screen->scrollWidget); + + screen->fullVwin.sb_info.rv_cached = False; + screen->fullVwin.sb_info.width = screen->scrollWidget->core.width + screen->scrollWidget->core.border_width; ScrollBarDrawThumb(screen->scrollWidget); @@ -433,12 +442,12 @@ } void -ScrollBarOff(register TScreen *screen) +ScrollBarOff(TScreen *screen) { - if(!screen->fullVwin.scrollbar) + if(!screen->fullVwin.sb_info.width) return; XtUnmapWidget(screen->scrollWidget); - screen->fullVwin.scrollbar = 0; + screen->fullVwin.sb_info.width = 0; DoResizeScreen (term); update_scrollbar (); if (screen->visbuf) { @@ -453,9 +462,9 @@ void ToggleScrollBar(XtermWidget w) { - register TScreen *screen = &w->screen; + TScreen *screen = &w->screen; - if (screen->fullVwin.scrollbar) { + if (screen->fullVwin.sb_info.width) { ScrollBarOff (screen); } else { ScrollBarOn (w, FALSE, FALSE); @@ -471,7 +480,7 @@ XtPointer call_data) { float *topPercent = (float *) call_data; - register TScreen *screen = &term->screen; + TScreen *screen = &term->screen; int thumbTop; /* relative to first saved line */ int newTopLine; @@ -495,8 +504,8 @@ { long pixels = (long) call_data; - register TScreen *screen = &term->screen; - register int rowOnScreen, newTopLine; + TScreen *screen = &term->screen; + int rowOnScreen, newTopLine; rowOnScreen = pixels / FontHeight(screen); if (rowOnScreen == 0) { @@ -516,7 +525,7 @@ static int specialcmplowerwiths (char *a, char *b) { - register char ca, cb; + char ca, cb; if (!a || !b) return 0; @@ -535,8 +544,8 @@ static long params_to_pixels (TScreen *screen, String *params, Cardinal n) { - register int mult = 1; - register char *s; + int mult = 1; + char *s; switch (n > 2 ? 2 : n) { case 2: @@ -567,7 +576,7 @@ AmountToScroll(Widget gw, String *params, Cardinal nparams) { if (IsXtermWidget(gw)) { - register TScreen *screen = &((XtermWidget)gw)->screen; + TScreen *screen = &((XtermWidget)gw)->screen; if (nparams > 2 && screen->send_mouse_pos != MOUSE_OFF) return 0; Index: xc/programs/xterm/trace.c diff -u xc/programs/xterm/trace.c:3.11 xc/programs/xterm/trace.c:3.14 --- xc/programs/xterm/trace.c:3.11 Mon Jun 12 22:28:41 2000 +++ xc/programs/xterm/trace.c Sun Nov 4 21:07:16 2001 @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/trace.c,v 3.11 2000/06/13 02:28:41 dawes Exp $ + * $XFree86: xc/programs/xterm/trace.c,v 3.14 2001/11/05 02:07:16 dickey Exp $ */ /************************************************************ -Copyright 1997-2000 by Thomas E. Dickey +Copyright 1997-2001 by Thomas E. Dickey All Rights Reserved @@ -30,122 +30,356 @@ /* * debugging support via TRACE macro. */ -#include <stdio.h> + +#include <xterm.h> /* for definition of GCC_UNUSED */ +#include <trace.h> + +#include <X11/StringDefs.h> + #include <time.h> +#include <stdlib.h> #include <unistd.h> #include <sys/types.h> +#include <stdio.h> #include <stdarg.h> -#include <trace.h> +#ifdef HAVE_X11_TRANSLATEI_H +#include <X11/TranslateI.h> +#else +extern String _XtPrintXlations(Widget w, + XtTranslations xlations, + Widget accelWidget, + _XtBoolean includeRHS); +#endif char *trace_who = "parent"; void -Trace(char *fmt, ...) +Trace(char *fmt,...) { - static FILE *fp; - static char *trace_out; - va_list ap; - - if (fp != 0 - && trace_who != trace_out) { - fclose(fp); - fp = 0; - } - trace_out = trace_who; - - if (!fp) { - char name[BUFSIZ]; - sprintf(name, "Trace-%s.out", trace_who); - fp = fopen(name, "w"); - if (fp != 0) { - time_t now = time((time_t*)0); + static FILE *fp; + static char *trace_out; + va_list ap; + + if (fp != 0 + && trace_who != trace_out) { + fclose(fp); + fp = 0; + } + trace_out = trace_who; + + if (!fp) { + char name[BUFSIZ]; + sprintf(name, "Trace-%s.out", trace_who); + fp = fopen(name, "w"); + if (fp != 0) { + time_t now = time((time_t *) 0); #ifdef HAVE_UNISTD_H - fprintf(fp, "process %d real (%d/%d) effective (%d/%d) -- %s", - getpid(), - getuid(), getgid(), - geteuid(), getegid(), - ctime(&now)); + fprintf(fp, "process %d real (%d/%d) effective (%d/%d) -- %s", + getpid(), + getuid(), getgid(), + geteuid(), getegid(), + ctime(&now)); #else - fprintf(fp, "process %d -- %s", - getpid(), - ctime(&now)); + fprintf(fp, "process %d -- %s", + getpid(), + ctime(&now)); #endif - } } - if (!fp) - abort(); + } + if (!fp) + abort(); + + va_start(ap, fmt); + if (fmt != 0) { + vfprintf(fp, fmt, ap); + (void) fflush(fp); + } else { + (void) fclose(fp); + (void) fflush(stdout); + (void) fflush(stderr); + } + va_end(ap); +} - va_start(ap,fmt); - if (fmt != 0) { - vfprintf(fp, fmt, ap); - (void)fflush(fp); - } else { - (void)fclose(fp); - (void)fflush(stdout); - (void)fflush(stderr); +char * +visibleChars(PAIRED_CHARS(Char * buf, Char * buf2), unsigned len) +{ + static char *result; + static unsigned used; + unsigned limit = ((len + 1) * 8) + 1; + char *dst; + + if (limit > used) { + used = limit; + result = XtRealloc(result, used); + } + dst = result; + while (len--) { + unsigned value = *buf++; +#if OPT_WIDE_CHARS + if (buf2 != 0) { + value |= (*buf2 << 8); + buf2++; } - va_end(ap); + if (value > 255) + sprintf(dst, "\\u+%04X", value); + else +#endif + if (E2A(value) < 32 || (E2A(value) >= 127 && E2A(value) < 160)) + sprintf(dst, "\\%03o", value); + else + sprintf(dst, "%c", value); + dst += strlen(dst); + } + return result; } char * -visibleChars(PAIRED_CHARS(Char *buf, Char *buf2), unsigned len) +visibleIChar(IChar * buf, unsigned len) { - static char *result; - static unsigned used; - unsigned limit = ((len + 1) * 8) + 1; - char *dst; - - if (limit > used) { - used = limit; - result = XtRealloc(result, used); - } - dst = result; - while (len--) { - unsigned value = *buf++; + static char *result; + static unsigned used; + unsigned limit = ((len + 1) * 6) + 1; + char *dst; + + if (limit > used) { + used = limit; + result = XtRealloc(result, used); + } + dst = result; + while (len--) { + unsigned value = *buf++; #if OPT_WIDE_CHARS - if (buf2 != 0) { - value |= (*buf2 << 8); - buf2++; - } - if (value > 255) - sprintf(dst, "\\u+%04X", value); - else + if (value > 255) + sprintf(dst, "\\u+%04X", value); + else #endif - if (E2A(value) < 32 || (E2A(value) >= 127 && E2A(value) < 160)) - sprintf(dst, "\\%03o", value); - else - sprintf(dst, "%c", value); - dst += strlen(dst); + if (E2A(value) < 32 || (E2A(value) >= 127 && E2A(value) < 160)) + sprintf(dst, "\\%03o", value); + else + sprintf(dst, "%c", value); + dst += strlen(dst); + } + return result; +} + +/* + * Some calls to XGetAtom() will fail, and we don't want to stop. So we use + * our own error-handler. + */ +static int +no_error(Display * dpy GCC_UNUSED, XErrorEvent * event GCC_UNUSED) +{ + return 1; +} + +void +TraceTranslations(const char *name, Widget w) +{ + String result; + XErrorHandler save = XSetErrorHandler(no_error); + XtTranslations xlations; + Widget xcelerat; + + TRACE(("TraceTranslations for %s (widget %#lx)\n", name, (long) w)); + if (w) { + XtVaGetValues(w, + XtNtranslations, &xlations, + XtNaccelerators, &xcelerat, + NULL); + TRACE(("... xlations %#08lx\n", (long) xlations)); + TRACE(("... xcelerat %#08lx\n", (long) xcelerat)); + result = _XtPrintXlations(w, xlations, xcelerat, True); + TRACE(("%s\n", result != 0 ? result : "(null)")); + } else { + TRACE(("none (widget is null)\n")); + } + XSetErrorHandler(save); +} + +void +TraceArgv(const char *tag, char **argv) +{ + int n = 0; + + TRACE(("%s:\n", tag)); + while (*argv != 0) { + TRACE((" %d:%s\n", n++, *argv++)); + } +} + +static int +cmp_options(const void *a, const void *b) +{ + return strcmp(((const OptionHelp *) a)->opt, + ((const OptionHelp *) b)->opt); +} + +static int +cmp_resources(const void *a, const void *b) +{ + return strcmp(((const XrmOptionDescRec *) a)->option, + ((const XrmOptionDescRec *) b)->option); +} + +static char * +parse_option(char *dst, char *src, char first) +{ + char *s; + + if (!strncmp(src, "-/+", 3)) { + dst[0] = first; + strcpy(dst + 1, src + 3); + } else { + strcpy(dst, src); + } + for (s = dst; *s != '\0'; s++) { + if (*s == '#' || *s == '%' || *s == 'S') { + s[1] = '\0'; + } else if (*s == ' ') { + *s = '\0'; + break; } - return result; + } + return dst; } -char * -visibleIChar(IChar *buf, unsigned len) +static Boolean +same_option(OptionHelp * opt, XrmOptionDescRec * res) { - static char *result; - static unsigned used; - unsigned limit = ((len + 1) * 6) + 1; - char *dst; - - if (limit > used) { - used = limit; - result = XtRealloc(result, used); - } - dst = result; - while (len--) { - unsigned value = *buf++; -#if OPT_WIDE_CHARS - if (value > 255) - sprintf(dst, "\\u+%04X", value); - else + char temp[BUFSIZ]; + return !strcmp(parse_option(temp, opt->opt, res->option[0]), res->option); +} + +static Boolean +standard_option(char *opt) +{ + static char *table[] = + { + "+rv", + "+synchronous", + "-background", + "-bd", + "-bg", + "-bordercolor", + "-borderwidth", + "-bw", + "-display", + "-fg", + "-fn", + "-font", + "-foreground", + "-geometry", + "-iconic", + "-name", + "-reverse", + "-rv", + "-selectionTimeout", + "-synchronous", + "-title", + "-xnllanguage", + "-xrm", + "-xtsessionID", + }; + Cardinal n; + char temp[BUFSIZ]; + + opt = parse_option(temp, opt, '-'); + for (n = 0; n < XtNumber(table); n++) { + if (!strcmp(opt, table[n])) + return True; + } + return False; +} + +/* + * Analyse the options/help messages for inconsistencies. + */ +void +TraceOptions(OptionHelp * options, XrmOptionDescRec * resources, Cardinal res_count) +{ + OptionHelp *opt_array; + size_t opt_count, j, k; + XrmOptionDescRec *res_array; + Boolean first, found; + + TRACE(("Checking options-tables for inconsistencies:\n")); + + /* count 'options' and make a sorted index to it */ + for (opt_count = 0; options[opt_count].opt != 0; ++opt_count) ; + opt_array = (OptionHelp *) calloc(opt_count, sizeof(OptionHelp)); + for (j = 0; j < opt_count; j++) + opt_array[j] = options[j]; + qsort(opt_array, opt_count, sizeof(OptionHelp), cmp_options); + + /* make a sorted index to 'resources' */ + res_array = (XrmOptionDescRec *) calloc(res_count, sizeof(*res_array)); + for (j = 0; j < res_count; j++) + res_array[j] = resources[j]; + qsort(res_array, res_count, sizeof(*res_array), cmp_resources); + +#if 0 + TRACE(("Options listed in help-message:\n")); + for (j = 0; j < opt_count; j++) + TRACE(("%5d %-28s %s\n", j, opt_array[j].opt, opt_array[j].desc)); + TRACE(("Options listed in resource-table:\n")); + for (j = 0; j < res_count; j++) + TRACE(("%5d %-28s %s\n", j, res_array[j].option, res_array[j].specifier)); #endif - if (E2A(value) < 32 || (E2A(value) >= 127 && E2A(value) < 160)) - sprintf(dst, "\\%03o", value); - else - sprintf(dst, "%c", value); - dst += strlen(dst); + + /* list all options[] not found in resources[] */ + for (j = 0, first = True; j < opt_count; j++) { + found = False; + for (k = 0; k < res_count; k++) { + if (same_option(&opt_array[j], &res_array[k])) { + found = True; + break; + } + } + if (!found) { + if (first) { + TRACE(("Options listed in help, not found in resource list:\n")); + first = False; + } + TRACE((" %-28s%s\n", opt_array[j].opt, + standard_option(opt_array[j].opt) ? " (standard)" : "")); + } + } + + /* list all resources[] not found in options[] */ + for (j = 0, first = True; j < res_count; j++) { + found = False; + for (k = 0; k < opt_count; k++) { + if (same_option(&opt_array[k], &res_array[j])) { + found = True; + break; + } + } + if (!found) { + if (first) { + TRACE(("Resource list items not found in options-help:\n")); + first = False; + } + TRACE((" %s\n", res_array[j].option)); + } + } + + TRACE(("Resource list items that will be ignored by XtAppInitialize:\n")); + for (j = 0; j < res_count; j++) { + switch (res_array[j].argKind) { + case XrmoptionSkipArg: + TRACE((" %-28s {param}\n", res_array[j].option)); + break; + case XrmoptionSkipNArgs: + TRACE((" %-28s {%ld params}\n", res_array[j].option, (long) + res_array[j].value)); + break; + case XrmoptionSkipLine: + TRACE((" %-28s {remainder of line}\n", res_array[j].option)); + break; + default: + break; } - return result; + } } Index: xc/programs/xterm/trace.h diff -u xc/programs/xterm/trace.h:3.10 xc/programs/xterm/trace.h:3.12 --- xc/programs/xterm/trace.h:3.10 Fri Sep 22 06:42:09 2000 +++ xc/programs/xterm/trace.h Tue Oct 23 21:21:25 2001 @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/trace.h,v 3.10 2000/09/22 10:42:09 alanh Exp $ + * $XFree86: xc/programs/xterm/trace.h,v 3.12 2001/10/24 01:21:25 dickey Exp $ */ /************************************************************ -Copyright 1997-2000 by Thomas E. Dickey +Copyright 1997-2001 by Thomas E. Dickey All Rights Reserved @@ -49,6 +49,15 @@ extern char *trace_who; #define TRACE_CHILD int tracing_child = (trace_who = "child") != 0; + +extern void TraceTranslations(const char *, Widget); +#define TRACE_TRANS(name,w) TraceTranslations(name,w) + +extern void TraceArgv(const char *tag, char **argv); +#define TRACE_ARGV(tag,argv) TraceArgv(tag,argv) + +extern void TraceOptions(OptionHelp *options, XrmOptionDescRec *resources, Cardinal count); +#define TRACE_OPTS(opts,ress,lens) TraceOptions(opts,ress,lens) #endif Index: xc/programs/xterm/util.c diff -u xc/programs/xterm/util.c:3.67 xc/programs/xterm/util.c:3.69 --- xc/programs/xterm/util.c:3.67 Wed May 16 14:06:38 2001 +++ xc/programs/xterm/util.c Sat Jan 5 17:05:03 2002 @@ -2,10 +2,10 @@ * $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 $ */ +/* $XFree86: xc/programs/xterm/util.c,v 3.69 2002/01/05 22:05:03 dickey Exp $ */ /* - * Copyright 1999,2000,2001 by Thomas E. Dickey + * Copyright 1999,2000,2001,2002 by Thomas E. Dickey * * All Rights Reserved * @@ -1467,11 +1467,12 @@ len * FontWidth(screen), FontHeight(screen)); y += font->ascent; +#if OPT_WIDE_CHARS if (text2) { static XftChar16 *sbuf; - static int slen; - int n; + static unsigned slen; + unsigned n; if (slen < len) { @@ -1486,6 +1487,7 @@ x, y, sbuf, len); } else +#endif { XftDrawString8 (screen->renderDraw, getColor (values.foreground), @@ -1994,7 +1996,7 @@ XSetWindowBackground( screen->display, VWindow(screen), - getXtermBackground(term->flags, -1)); + getXtermBackground(term->flags, MAXCOLORS)); } #endif /* OPT_ISO_COLORS */ Index: xc/programs/xterm/uxterm diff -u /dev/null xc/programs/xterm/uxterm:1.5 --- /dev/null Fri Jan 18 15:27:41 2002 +++ xc/programs/xterm/uxterm Sat Jan 5 17:05:03 2002 @@ -0,0 +1,44 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/uxterm,v 1.5 2002/01/05 22:05:03 dickey Exp $ +# wrapper script to setup xterm with UTF-8 locale + +program=xterm +found=no + +# Check environment variables that xterm does, in the same order: +for name in LC_ALL LC_CTYPE LANG +do + eval 'value=$'$name + if test -n "$value" ; then + case $value in + *.UTF-8) + found=yes + ;; + C|POSIX) + # Yes, I know this is not the same - but why are you + # here then? + value=en_US + ;; + esac + break + fi +done + +# If we didn't find one that used UTF-8, modify the safest one. Not everyone +# has a UTF-8 locale installed (and there appears to be no trivial/portable way +# to determine whether it is, from a shell script). We could check if the +# user's shell does not reset unknown locale specifiers, but not all shells do. +if test $found != yes ; then + if test -n "$value" ; then + eval ${name}=`echo ${value} |sed -e 's/\..*//'`.UTF-8 + eval export ${name} + else + LC_CTYPE=en_US.UTF-8 + export LC_CTYPE + fi +fi + +# for testing: +#test -f ./xterm && program=./xterm + +exec $program -class UXTerm -title 'uxterm' -u8 "$@" Index: xc/programs/xterm/version.h diff -u xc/programs/xterm/version.h:3.68 xc/programs/xterm/version.h:3.77 --- xc/programs/xterm/version.h:3.68 Sat Apr 28 09:51:56 2001 +++ xc/programs/xterm/version.h Mon Jan 7 20:40:29 2002 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/version.h,v 3.68 2001/04/28 13:51:56 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/version.h,v 3.77 2002/01/08 01:40:29 dawes 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 156 -#define XFREE86_VERSION "XFree86 4.0.3" +#define XTERM_PATCH 165 +#define XFREE86_VERSION "XFree86 4.2.0" Index: xc/programs/xterm/wcwidth.c diff -u xc/programs/xterm/wcwidth.c:1.1 xc/programs/xterm/wcwidth.c:1.3 --- xc/programs/xterm/wcwidth.c:1.1 Sat Aug 26 00:33:54 2000 +++ xc/programs/xterm/wcwidth.c Sun Jul 29 18:08:16 2001 @@ -1,17 +1,43 @@ +/* $XFree86: xc/programs/xterm/wcwidth.c,v 1.3 2001/07/29 22:08:16 tsi Exp $ */ /* * This is an implementation of wcwidth() and wcswidth() as defined in * "The Single UNIX Specification, Version 2, The Open Group, 1997" * <http://www.UNIX-systems.org/online.html> * - * Markus Kuhn -- 2000-02-08 -- public domain + * Markus Kuhn -- 2001-01-12 -- public domain */ -/* $XFree86: xc/programs/xterm/wcwidth.c,v 1.1 2000/08/26 04:33:54 dawes Exp $ */ - #include <wcwidth.h> +#define wcwidth my_wcwidth + +struct interval { + unsigned short first; + unsigned short last; +}; + +/* auxiliary function for binary search in interval table */ +static int bisearch(wchar_t ucs, const struct interval *table, int max) { + int min = 0; + int mid; + + if (ucs < table[0].first || ucs > table[max].last) + return 0; + while (max >= min) { + mid = (min + max) / 2; + if (ucs > table[mid].last) + min = mid + 1; + else if (ucs < table[mid].first) + max = mid - 1; + else + return 1; + } -/* These functions define the column width of an ISO 10646 character - * as follows: + return 0; +} + + +/* The following functions define the column width of an ISO 10646 + * character as follows: * * - The null character (U+0000) has a column width of 0. * @@ -22,6 +48,12 @@ * category code Mn or Me in the Unicode database) have a * column width of 0. * + * - Other format characters (general category code Cf in the Unicode + * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. + * + * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) + * have a column width of 0. + * * - Spacing characters in the East Asian Wide (W) or East Asian * FullWidth (F) category as defined in Unicode Technical * Report #11 have a column width of 2. @@ -34,86 +66,70 @@ * in ISO 10646. */ -int my_wcwidth(wchar_t ucs) +int wcwidth(wchar_t ucs) { /* sorted list of non-overlapping intervals of non-spacing characters */ - static const struct interval { - unsigned short first; - unsigned short last; - } combining[] = { + static const struct interval combining[] = { { 0x0300, 0x034E }, { 0x0360, 0x0362 }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, { 0x0591, 0x05A1 }, { 0x05A3, 0x05B9 }, { 0x05BB, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C4 }, { 0x064B, 0x0655 }, { 0x0670, 0x0670 }, { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, - { 0x0711, 0x0711 }, { 0x0730, 0x074A }, { 0x07A6, 0x07B0 }, - { 0x0901, 0x0902 }, { 0x093C, 0x093C }, { 0x0941, 0x0948 }, - { 0x094D, 0x094D }, { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, - { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, - { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, { 0x0A02, 0x0A02 }, - { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, - { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, - { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, - { 0x0ACD, 0x0ACD }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, - { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, - { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, - { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, - { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBF, 0x0CBF }, - { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, { 0x0D41, 0x0D43 }, - { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, - { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, - { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, - { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, - { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, - { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, - { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, - { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, - { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, { 0x17B7, 0x17BD }, - { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x18A9, 0x18A9 }, + { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, + { 0x07A6, 0x07B0 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C }, + { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 }, + { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, + { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, + { 0x0A02, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, + { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, + { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, + { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0B01, 0x0B01 }, + { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, + { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, + { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, + { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, + { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, + { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, + { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, + { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, + { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, + { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, + { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, + { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, + { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, + { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, + { 0x1160, 0x11FF }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, + { 0x17C9, 0x17D3 }, { 0x180B, 0x180E }, { 0x18A9, 0x18A9 }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x206A, 0x206F }, { 0x20D0, 0x20E3 }, { 0x302A, 0x302F }, { 0x3099, 0x309A }, - { 0xFB1E, 0xFB1E }, { 0xFE20, 0xFE23 } + { 0xFB1E, 0xFB1E }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, + { 0xFFF9, 0xFFFB } }; - int min = 0; - int max = sizeof(combining) / sizeof(struct interval) - 1; - int mid; /* test for 8-bit control characters */ if (ucs == 0) return 0; - if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) { + if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) return -1; - } - - /* first quick check for Latin-1 etc. characters */ - if (ucs < combining[0].first) - return 1; /* binary search in table of non-spacing characters */ - while (max >= min) { - mid = (min + max) / 2; - if (combining[mid].last < ucs) - min = mid + 1; - else if (combining[mid].first > ucs) - max = mid - 1; - else if (combining[mid].first <= ucs && combining[mid].last >= ucs) - return 0; - } + if (bisearch(ucs, combining, + sizeof(combining) / sizeof(struct interval) - 1)) + return 0; /* if we arrive here, ucs is not a combining or C0/C1 control character */ - /* fast test for majority of non-wide scripts */ - if (ucs < 0x1100) - return 1; - - return 1 + - ((ucs >= 0x1100 && ucs <= 0x115f) || /* Hangul Jamo */ - (ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs & ~0x0011) != 0x300a && - ucs != 0x303f) || /* CJK ... Yi */ - (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ - (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ - (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ - (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */ - (ucs >= 0xffe0 && ucs <= 0xffe6)); + return 1 + + (ucs >= 0x1100 && + (ucs <= 0x115f || /* Hangul Jamo init. consonants */ + (ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs & ~0x0011) != 0x300a && + ucs != 0x303f) || /* CJK ... Yi */ + (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ + (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ + (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ + (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */ + (ucs >= 0xffe0 && ucs <= 0xffe6) || + (ucs >= 0x20000 && ucs <= 0x2ffff))); } @@ -121,8 +137,96 @@ { int w, width = 0; + for (;*pwcs && n-- > 0; pwcs++) + if ((w = wcwidth(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + + +/* + * The following function is the same as wcwidth(), except that + * spacing characters in the East Asian Ambiguous (A) category as + * defined in Unicode Technical Report #11 have a column width of 2. + * This experimental variant might be useful for users of CJK legacy + * encodings who want to migrate to UCS. It is not otherwise + * recommended for general use. + */ +static int wcwidth_cjk(wchar_t ucs) +{ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AD, 0x00AD }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014A }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, { 0x02CD, 0x02CD }, + { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, { 0x02DD, 0x02DD }, + { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, + { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 }, { 0x0410, 0x044F }, + { 0x0451, 0x0451 }, { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, + { 0x2018, 0x2019 }, { 0x201C, 0x201D }, { 0x2020, 0x2021 }, + { 0x2025, 0x2027 }, { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, + { 0x2035, 0x2035 }, { 0x203B, 0x203B }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 }, + { 0x212B, 0x212B }, { 0x2154, 0x2155 }, { 0x215B, 0x215B }, + { 0x215E, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 }, + { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, + { 0x220B, 0x220B }, { 0x220F, 0x220F }, { 0x2211, 0x2211 }, + { 0x2215, 0x2215 }, { 0x221A, 0x221A }, { 0x221D, 0x2220 }, + { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, { 0x2227, 0x222C }, + { 0x222E, 0x222E }, { 0x2234, 0x2237 }, { 0x223C, 0x223D }, + { 0x2248, 0x2248 }, { 0x224C, 0x224C }, { 0x2252, 0x2252 }, + { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, { 0x226A, 0x226B }, + { 0x226E, 0x226F }, { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, + { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, + { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, { 0x2460, 0x24BF }, + { 0x24D0, 0x24E9 }, { 0x2500, 0x254B }, { 0x2550, 0x2574 }, + { 0x2580, 0x258F }, { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, + { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, + { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, + { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, + { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, + { 0x260E, 0x260F }, { 0x261C, 0x261C }, { 0x261E, 0x261E }, + { 0x2640, 0x2640 }, { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, + { 0x2663, 0x2665 }, { 0x2667, 0x266A }, { 0x266C, 0x266D }, + { 0x266F, 0x266F }, { 0x300A, 0x300B }, { 0x301A, 0x301B }, + { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD } + }; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1)) + return 2; + + return wcwidth(ucs); +} + + +int wcswidth_cjk(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + for (;*pwcs && n-- > 0; pwcs++) - if ((w = my_wcwidth(*pwcs)) < 0) + if ((w = wcwidth_cjk(*pwcs)) < 0) return -1; else width += w; Index: xc/programs/xterm/wcwidth.h diff -u xc/programs/xterm/wcwidth.h:1.1 xc/programs/xterm/wcwidth.h:1.2 --- xc/programs/xterm/wcwidth.h:1.1 Sat Aug 26 00:33:55 2000 +++ xc/programs/xterm/wcwidth.h Mon Jun 18 15:09:27 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/wcwidth.h,v 1.1 2000/08/26 04:33:55 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/wcwidth.h,v 1.2 2001/06/18 19:09:27 dickey Exp $ */ #ifndef included_wcwidth_h #define included_wcwidth_h 1 @@ -7,5 +7,6 @@ extern int my_wcwidth(wchar_t ucs); extern int wcswidth(const wchar_t *pwcs, size_t n); +extern int wcswidth_cjk(const wchar_t *pwcs, size_t n); #endif /* included_wcwidth_h */ Index: xc/programs/xterm/xstrings.c diff -u xc/programs/xterm/xstrings.c:1.1 xc/programs/xterm/xstrings.c:1.2 --- xc/programs/xterm/xstrings.c:1.1 Fri Sep 22 06:44:29 2000 +++ xc/programs/xterm/xstrings.c Mon Jun 18 15:09:27 2001 @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/xterm/xstrings.c,v 1.1 2000/09/22 10:44:29 alanh Exp $ */ +/* $XFree86: xc/programs/xterm/xstrings.c,v 1.2 2001/06/18 19:09:27 dickey Exp $ */ /************************************************************ -Copyright 2000 by Thomas E. Dickey +Copyright 2000,2001 by Thomas E. Dickey All Rights Reserved @@ -32,8 +32,11 @@ ********************************************************/ +#include <xterm.h> + #include <sys/types.h> #include <string.h> + #include <xstrings.h> char * @@ -47,6 +50,22 @@ cp = strrchr(name, '\\'); #endif return (cp ? cp + 1 : name); +} + +/* + * Allocates a copy of a string + */ +char * +x_strdup(char *s) +{ + if (s != 0) { + char *t = malloc(strlen(s) + 1); + if (t != 0) { + strcpy(t, s); + } + s = t; + } + return s; } /* Index: xc/programs/xterm/xstrings.h diff -u xc/programs/xterm/xstrings.h:1.1 xc/programs/xterm/xstrings.h:1.2 --- xc/programs/xterm/xstrings.h:1.1 Fri Sep 22 06:44:29 2000 +++ xc/programs/xterm/xstrings.h Mon Jun 18 15:09:27 2001 @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/xterm/xstrings.h,v 1.1 2000/09/22 10:44:29 alanh Exp $ */ +/* $XFree86: xc/programs/xterm/xstrings.h,v 1.2 2001/06/18 19:09:27 dickey Exp $ */ /************************************************************ -Copyright 2000 by Thomas E. Dickey +Copyright 2000,2001 by Thomas E. Dickey All Rights Reserved @@ -36,6 +36,7 @@ #define included_xstrings_h 1 extern char *x_basename(char *name); +extern char * x_strdup(char *s); extern char *x_strindex(char *s1, char *s2); #endif /* included_xstrings_h */ Index: xc/programs/xterm/xterm.h diff -u xc/programs/xterm/xterm.h:3.70 xc/programs/xterm/xterm.h:3.78 --- xc/programs/xterm/xterm.h:3.70 Wed Apr 11 21:02:51 2001 +++ xc/programs/xterm/xterm.h Mon Jan 7 16:02:44 2002 @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/xterm/xterm.h,v 3.70 2001/04/12 01:02:51 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/xterm.h,v 3.78 2002/01/07 21:02:44 dawes Exp $ */ /************************************************************ -Copyright 1999-2000 by Thomas E. Dickey +Copyright 1999,2000,2001,2002 by Thomas E. Dickey All Rights Reserved @@ -53,6 +53,11 @@ #ifndef HAVE_CONFIG_H +#ifdef CSRG_BASED +/* Get definition of BSD */ +#include <sys/param.h> +#endif + #ifndef HAVE_X11_DECKEYSYM_H #define HAVE_X11_DECKEYSYM_H 1 #endif @@ -71,13 +76,8 @@ #define HAVE_UNISTD_H 1 #endif -#ifndef X_NOT_STDC_ENV #define HAVE_STDLIB_H 1 #define DECL_ERRNO 1 -#else -#define size_t int -#define time_t long -#endif #if defined(CSRG_BASED) || defined(__GNU__) #define USE_POSIX_TERMIOS 1 @@ -127,7 +127,7 @@ #define USE_LASTLOG #endif -#if defined(AMOEBA) || defined(SCO) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(__QNX__) || defined(__hpux) || (defined(BSD) && (BSD >= 199103)) +#if defined(AMOEBA) || defined(SCO) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(__QNX__) || defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || defined(__CYGWIN__) #define USE_POSIX_WAIT #endif @@ -139,6 +139,10 @@ #define USE_TTY_GROUP #endif +#if defined(__CYGWIN__) +#define HAVE_NCURSES_TERM_H 1 +#endif + #ifdef __osf__ #define TTY_GROUP_NAME "terminal" #endif @@ -159,7 +163,7 @@ /***====================================================================***/ /* if compiling with gcc -ansi -pedantic, we must fix POSIX definitions */ -#if defined(__GNUC__) && defined(SVR4) && defined(sun) +#if defined(SVR4) && defined(sun) #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif @@ -268,31 +272,11 @@ #define XtNc132 "c132" #define XtNcacheDoublesize "cacheDoublesize" #define XtNcharClass "charClass" -#define XtNcolor0 "color0" -#define XtNcolor1 "color1" -#define XtNcolor10 "color10" -#define XtNcolor11 "color11" -#define XtNcolor12 "color12" -#define XtNcolor13 "color13" -#define XtNcolor14 "color14" -#define XtNcolor15 "color15" -#define XtNcolor2 "color2" -#define XtNcolor3 "color3" -#define XtNcolor4 "color4" -#define XtNcolor5 "color5" -#define XtNcolor6 "color6" -#define XtNcolor7 "color7" -#define XtNcolor8 "color8" -#define XtNcolor9 "color9" #define XtNcolorAttrMode "colorAttrMode" -#define XtNcolorBD "colorBD" #define XtNcolorBDMode "colorBDMode" -#define XtNcolorBL "colorBL" #define XtNcolorBLMode "colorBLMode" #define XtNcolorMode "colorMode" -#define XtNcolorRV "colorRV" #define XtNcolorRVMode "colorRVMode" -#define XtNcolorUL "colorUL" #define XtNcolorULMode "colorULMode" #define XtNctrlFKeys "ctrlFKeys" #define XtNcurses "curses" @@ -312,6 +296,8 @@ #define XtNfaceSize "faceSize" #define XtNfontDoublesize "fontDoublesize" #define XtNfontStyle "fontStyle" +#define XtNforceBoxChars "forceBoxChars" +#define XtNfreeBoldBox "freeBoldBox" #define XtNhighlightColor "highlightColor" #define XtNhighlightSelection "highlightSelection" #define XtNhpLowerleftBugCompat "hpLowerleftBugCompat" @@ -358,6 +344,7 @@ #define XtNtekInhibit "tekInhibit" #define XtNtekSmall "tekSmall" #define XtNtekStartup "tekStartup" +#define XtNtiXtraScroll "tiXtraScroll" #define XtNtiteInhibit "titeInhibit" #define XtNtrimSelection "trimSelection" #define XtNunderLine "underLine" @@ -366,6 +353,7 @@ #define XtNwideBoldFont "wideBoldFont" #define XtNwideChars "wideChars" #define XtNwideFont "wideFont" +#define XtNximFont "ximFont" #define XtNxmcAttributes "xmcAttributes" #define XtNxmcGlitch "xmcGlitch" #define XtNxmcInline "xmcInline" @@ -444,6 +432,7 @@ #define XtCTekInhibit "TekInhibit" #define XtCTekSmall "TekSmall" #define XtCTekStartup "TekStartup" +#define XtCTiXtraScroll "TiXtraScroll" #define XtCTiteInhibit "TiteInhibit" #define XtCTrimSelection "TrimSelection" #define XtCUnderLine "UnderLine" @@ -452,6 +441,7 @@ #define XtCWideBoldFont "WideBoldFont" #define XtCWideChars "WideChars" #define XtCWideFont "WideFont" +#define XtCXimFont "XimFont" #define XtCXmcAttributes "XmcAttributes" #define XtCXmcGlitch "XmcGlitch" #define XtCXmcInline "XmcInline" @@ -462,13 +452,14 @@ #define XtCGeometry "Geometry" #endif -#ifdef VMS -#define XtCbackground "background" -#define XtCbordercolor "borderColor" -#define XtCborderwidth "borderWidth" -#define XtCforeground "foreground" -#define XtCfont "font" -#define XtCiconic "iconic" +#if OPT_COLOR_CLASS +#define XtCCursorColor "CursorColor" +#define XtCPointerColor "PointerColor" +#define XtCHighlightColor "HighlightColor" +#else +#define XtCCursorColor XtCForeground +#define XtCPointerColor XtCForeground +#define XtCHighlightColor XtCForeground #endif /***====================================================================***/ @@ -494,7 +485,6 @@ /* button.c */ extern Boolean SendMousePosition (Widget w, XEvent* event); -extern int SetCharacterClassRange (int low, int high, int value); extern void DiredButton PROTO_XT_ACTIONS_ARGS; extern void DisownSelection (XtermWidget termw); extern void HandleGINInput PROTO_XT_ACTIONS_ARGS; @@ -583,6 +573,7 @@ extern Boolean xtermDeleteIsDEL (void); extern void Input (TKeyboard *keyboard, TScreen *screen, XKeyEvent *event, Bool eightbit); extern void StringInput (TScreen *screen, Char *string, size_t nbytes); +extern void xtermAddInput(Widget w); #if OPT_NUM_LOCK extern void VTInitModifiers(void); @@ -785,12 +776,12 @@ #define xtermColorPair() makeColorPair(term->sgr_foreground, term->sgr_background) #define getXtermForeground(flags, color) \ - (((flags) & FG_COLOR) && ((color) >= 0) \ + (((flags) & FG_COLOR) && ((color) >= 0 && (color) < MAXCOLORS) \ ? GET_COLOR_RES(term->screen.Acolors[color]) \ : term->screen.foreground) #define getXtermBackground(flags, color) \ - (((flags) & BG_COLOR) && ((color) >= 0) \ + (((flags) & BG_COLOR) && ((color) >= 0 && (color) < MAXCOLORS) \ ? GET_COLOR_RES(term->screen.Acolors[color]) \ : term->core.background_pixel) Index: xc/programs/xterm/xterm.log.html diff -u xc/programs/xterm/xterm.log.html:1.69 xc/programs/xterm/xterm.log.html:1.79 --- xc/programs/xterm/xterm.log.html:1.69 Sat Apr 28 09:51:56 2001 +++ xc/programs/xterm/xterm.log.html Sat Jan 5 17:05:03 2002 @@ -1,7 +1,7 @@ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <!-- ***************************************************************************** - * Copyright 1996,1997,1998,1999,2000 by Thomas E. Dickey * + * Copyright 1996,1997,1998,1999,2000,2001,2002 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * @@ -20,17 +20,17 @@ * 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.69 2001/04/28 13:51:56 dickey Exp $ + $XFree86: xc/programs/xterm/xterm.log.html,v 1.79 2002/01/05 22:05:03 dickey Exp $ --> <HTML> <HEAD> <TITLE>XTERM - Change Log - +
-Copyright 1997,1998,1999,2000 by Thomas E. Dickey +Copyright 1997,1998,1999,2000,2001 by Thomas E. Dickey

Contents

This file contains a list of the changes that I have made for XFree86 xterm, @@ -42,6 +42,15 @@ xc/programs/Xserver/hw/xfree86). +

Patch #165 - 2002/01/05 - XFree86 4.1.0

+
    +
  • modify uxterm script to strip encoding part from + environment variable before adding ".UTF-8" (based on Debian + #125947, but using a more portable solution). + +
  • add an assignment statement in VTInitialize() to make + awaitInput resource work. + +
  • use new macros init_Bres(), etc., in VTInitialize() to add trace of + the initialization of resources. + +
  • modify checks for $LC_ALL, related environment variables to ensure + the resulting strings are nonempty (report by Markus Kuhn). + +
  • add an ifdef in charproc.c for num_ptrs variable in case all + configure options are disabled. + +
  • modify definition of getXtermBackground() to avoid negative array + index warning on Tru64 (report by Jeremie Petit). + +
  • improve fix from patch #165 (still Debian #117184, report by Matt + Zimmerman <mdz@debian.org>) + +
  • correct install rule for uxterm in Makefile.in, to handle the + case where building in a different directory than xterm's source + (patch by Paul Gilmartin). + +
  • documented ANSI.SYS-style cursor save/restore escape sequences + in ctlseqs.ms, which are in xterm since X11R5. + +
  • correct two entries in the default charClass table, which did not + follow the manpage comment about the character number corresponding + to the class (patch by Marc Bevand <bevand_m@epita.fr>). + +
  • fix a couple of typos in comments in the app-defaults files + (David Krause <xfree86@davidkrause.com>). + +
  • resync with XFree86 CVS: +
      +
    • update language of copyrights in some files to reflect the fact + that they were reassigned from X Consortium to The Open Group in + 1998. Note that this xterm source is derived from the 1996 + version from X Consortium, does not incorporate changes made by X + Consortium or The Open Group after that date, hence we do not add + The Open Group's 1998 copyright date to related files. + +
    • save/restore errno in signal catcher (Matthieu Herrb). + +
    • modify UXTerm.ad's font5 resource so that xterm can display double + width characters using a font distributed with XFree86 (Tomohiro KUBOTA). +
    +
+ +

Patch #163 - 2001/11/13 - XFree86 4.1.0

+
    +
  • correct a case where ptyInitialErase and + backarrowKeyIsErase resources combine to set + DECBKM mode, but a reset command would not + reset xterm to that state, making the erase character revert to ^H + (Debian #117184) +
+ +

Patch #163 - 2001/11/04 - XFree86 4.1.0

+
    +
  • correct ifdef's for __QNX__ and + USE_SYSV_PGRP in main.c call to tcsetpgrp, + which broke bash behavior around patch #140 (report/patch by Frank + Liu <fliu@mail.vipstage.com>). + +
  • modify trace.c to fix missing definition of GCC_UNUSED for + compilers other than gcc when configured for trace code (report/patch + by Paul Gilmartin). + +
  • change format in TraceOptions() to use long rather than int, since + the latter could lose precision on 64-bit machines (report/patch by + Nelson Beebe). + +
  • modify xterm manual page and minstall.sh to allow imake rules + to define location of app-defaults directory (Debian #87611). + +
  • review/update list of conflicting preprocesor symbols to remove + from $CPPFLAGS at the end of the configure script. In particular, + this allows one to configure xterm without the utempter library on + Redhat 7.1 (report/patch by Adam Sulmicki). +
+ +

Patch #162 - 2001/10/23 - XFree86 4.1.0

+
    +
  • correct logic that processes -class option, so that + a following -e option is handled (Debian #116297). + +
  • improve options-decoding to allow -version and + -help options to be combined (Debian #110226). + +
  • add a 10 millisecond delay in event loop when processing + -hold option, to avoid using too much CPU time + (Debian #116213). + +
  • prefix final program execution in uxterm with "exec" + to avoid a useless shell hanging around (Christian Weisgerber). +
+ +

Patch #161 - 2001/10/10 - XFree86 4.1.0

+
    +
  • modify logic that resets keypad application mode to avoid doing + this if there is no modifier associated with the Num_Lock keysym + (report by John E Davis <davis@space.mit.edu> and Alan W Irwin + <irwin@beluga.phys.uvic.ca>). + +
  • add built-in translation for Control/KP_Separator to KP_Subtract, + to accommodate users who wish to use xmodmap to reassign the top + row of the numeric keypad. + +
  • correct Imakefile install-rule for uxname script + (reported by Nam SungHyun <namsh@lge.com>). + +
  • resync with XFree86 CVS: correct typo in <ncurses/term.h> + ifdef. +
+ +

Patch #160 - 2001/10/7 - XFree86 4.1.0

+
    +
  • modify logic in main.c (see patch #145) to avoid generating the + same identifier, for example, for /dev/tty1 and /dev/pts/1, which + is used to denote an entry in the utmp file (Debian bug report + #84676), A similar fix was also sent by Jerome Borsboom + <borsboom@westbrabant.net> in May, but I overlooked it when + reviewing bug reports. + +
  • add configure check for <ncurses/term.h> to get + rid of hardcoded __CYGWIN__ ifdef in resize.c +

    + NOTE: The CYGWIN port should not be linking resize + with ncurses. It appears that the only reason it is, is because + both the ncurses and termcap ports on that platform are badly + misconfigured (essential pieces have been removed, etc). Checking + for <ncurses/term.h> does not hurt anything, + since there are some correct installations that are set up that + way. + +

  • add a sample uxterm script, which uses the + UXTerm application defaults for UTF-8 environments. + +
  • undo change to xterm application defaults, since this introduced an + unnecessary incompatibility. The intended functionality was + already addressed by the UXTerm + app-defaults file. + +
  • resync with XFree86 CVS: +
      +
    • Modified xterm app default to use LFD fontnames instead of old type + (Michael Schroeder). +
    • Fix xterm when XIM is disabled - caused a segfault + (Tomohiro Kubota). +
    +
+ +

Patch #159 - 2001/9/19 - XFree86 4.1.0

+
    +
  • remove an ifdef for USE_HANDSHAKE added in patch + #158 from the second TIOCSSIZE ioctl call in the + initialization code. Paul Gilmartin reports that for Solaris 2.6 + (sparc), stty does not show that xterm sets rows and columns unless + the second ioctl is executed. + +
  • correct treatment of empty parameter list for some OSC strings + (report by Sami Farin <sfarin@ratol.fi>). +
+ +

Patch #158 - 2001/9/8 - XFree86 4.1.0

+
    +
  • augment key translations for scrollbar widget to ensure that + keystrokes intended for the text area are not lost if the mouse + pointer happens to fall on the scrollbar. This can happen, for + instance, if the user's app-defaults or + .Xdefaults file contains a translations resource, + though it may also happen through unrelated resource settings: + probably a bug in libXt (reported by Paul Fox + <pgf@foxharp.boston.ma.us> and Dmitry Yu. Bolkhovityanov + <D.Yu.Bolkhovityanov@inp.nsk.su>). + +
  • widen ifdef's in xterm.h to define __EXTENSIONS__ on + Solaris, for compilers other than gcc. This was added along + _POSIX_C_SOURCE with in patch + #151, but is not sufficient since Sun's compiler does not define + __STDC__ by default (report by Matthias Scheler + <tron@zhadum.de>). + +
  • modify xterm to obtain the closest matching color if an exact color + is not available, e.g., on 8-bit displays (patch by Steve Wall) + +
  • patch by Tomohiro KUBOTA <tkubota@riken.go.jp> to implement + "OverTheSpot" preedit type of XIM input: +
      +
    • This preedit type is a reasonable compromise between + simpleness of implementation and usefulness. "Root" preedit + type is easy to implement but not useful; "OnTheSpot" preedit + type is the best in the point of view of user interface but + very complex. And more, "OverTheSpot" is the preedit type + which the most XIM servers support. Thus, to achieve reasonable + usability, support of "OverTheSpot" preedit type is needed. + +
    • In "OverTheSpot" preedit type, the preedit (preconversion) + string is displayed at the position of the cursor. On the + other hand, it is XIM server's responsibility to display + the preedit string. Thus, it is needed for XIM client (here + XTerm) to inform the XIM server of the cursor position. + And more, to achieve good visual proportion, preedit string + must be written using proper font. Thus, it is XIM client's + responsibility to inform the XIM server of the proper font. + The font must be supplied by "fontset". Fontset is a set of + fonts with charsets which are specified by the current locale. + Since XTerm uses ISO10646 fonts regardless of the current locale, + the fonts for XIM must be prepared separately. It is difficult + to prepare fonts which are similar to XTerm font. Thus, my + patch uses a simple way - the default font is "*" which matches + every fonts and X library will automatically choose fonts with + proper charsets. I added "-fx" command option and "ximFont" + resource to override this default font setting. + +
    • changed the definition of "OverTheSpot" preedit type + from XIMPreeditPosition|XIMStatusArea + to XIMPreeditPosition|XIMStatusNothing. + This matches the behavior of other programs such as + Rxvt, Kterm, Gedit. + +
    • A tiny XIM bugfix is also included. By calling XSetLocaleModifiers() + with parameter of "", it can consier XMODIFIERS environmental + variable which is a standard way for users to specify XIM server + to be used. +
    + +
  • adjust configure script to accommodate repackaging of keysym2ucs.c + as include-file for xutf8.c (patch by Tomohiro KUBOTA + <kubota@debian.org>). + +
  • add the UXTerm app-defaults file to makefile install + rules (request by Juliusz Chroboczek). + +
  • correct logic in get_termcap(), which returned false + if the tgetent() call indicated that xterm was linked + with terminfo. Although the $TERMCAP variable cannot be + adjusted in this case, xterm still needs information from this call + to extract data to initialize the erase-mode when the + ptyInitialErase resource is false. + +
  • modify ScrollbarReverseVideo() function to cache the + original border color, so it can restore that when an application + flashes the screen (Bugzilla #38872). + +
  • resync with XFree86 CVS: +
      +
    • remove ifdef's for X_NOT_STDC_ENV (David Dawes). +
    • add Cygwin to special errno handling case in ptydata.c (Alan Hourihane) +
    • set screen size earlier in initialization, to address a race + with window manager resizing its clients (Keith Packard). +
    +
+ +

Patch #157 - 2001/6/18 - XFree86 4.1.0

+
    +
  • patch by Juliusz Chroboczek to clean up button.c and input.c. The + basic idea is to use a single set of APIs in the XTerm core, and put + a set of workarounds in a separate file. As you will notice, this + drastically simplifies parts of the code; in particular, the only + remaining ifdefs related to the differences between Xutf8 and legacy + systems are related to the selection provider logic. + + This defines two new files, xutf8.h and xutf8.c, provide some + half-hearted but fully portable emulation for the three Xutf8* + functions that XTerm uses. + + Putting these in a separate file will allow people to experiment with + more complex versions without making the core of XTerm more difficult + to maintain. + + The functionality of the emulation is as follows. +
      +
    • Xutf8TextListToTextProperty fully handles XStringstyle and + XUTF8StringStyle. It will only generate STRING for XStdICCTextStyle, + and wil only generate Latin-1 in XCompoundTextStyle (but label it as + COMPOUND_TEXT, as the spec requires). (I have hesitated to make this + function fail for XStdICCTextStyle and XCompoundTextStyle; this might + be a smart thing to do, in the hope that the selection requestor will + try UTF8_STRING afterwards; opinions?) + +
    • Xutf8TextPropertyToTextList fully handles STRING and UTF8_STRING. + It systematically fails for COMPOUND_TEXT. + +
    • Xutf8LookupString will properly handle single-keystroke input for + the keysyms covered by Markus' keysym2ucs function. It will not + handle either compose key input or external input methods. +
    + +
  • add an ifdef for SunXK_F36, used in + xtermcapKeycode() (patch by Mark Waggoner + <waggoner@ichips.intel.com>). + +
  • modify check for login name to try getlogin() and + $LOGNAME, $USER environment variables to detect if the user has + logged in under an alias, i.e., an account with the same user id + but a different name (Debian bug report #70084). + +
  • add resource tiXtraScroll, which can be used to + preserve the screen contents in the scrollback rather than erasing + it when starting a fullscreen application such as vi + (patch by Ken Martin <fletcher@catsreach.org>). + +
  • two patches by Denis Zaitsev <zzz@cd-club.ru>: +
      +
    • added forceBoxChars resource to control the + "line-drawing characters" option. + +
    • added freeBoldBox resource, which, when set true, + suppresses check in same_font_size(), so xterm does + not attempt to ensure that the bold font is the same size as + the normal font. +
    + +
  • change the color class for ANSI colors and similar ones such as + bold-color, etc., to follow the convention that the classname is the + instance name with a leading capital (e.g., color0 and + Color0 rather than color0 and + Foreground). There was little use for Foreground as a + class other than to create occasional confusion and bug reports, most + recently by Nelson Beebe who reports that it disables colors in xterm + but not on Linux, which is probably due to a difference in resource + evaluation order. A configure script option (--disable-color-class) + is provided for anyone who did use the older behavior. + +
  • fix a signal-handling bug. When running xterm with + ksh or similar shell such as bash 2.05, xterm will hang + and not respond to keystrokes after the user types + suspend. Additionally the popup menus do not respond, + so it is not possible to send SIGCONT to the shell. + What is happening is that the shell is sending itself SIGSTOP, and it + is being stopped. Per specification it also means that the operating + system is sending SIGCHLD to parent to the bash (XTERM). + Now the issue is that xterm assumes it cannot happen and it expects + to receive SIGCHLD only upon termination of its children. + This causes a deadlock with xterm waiting for the child to + die, and the child waiting for SIGCONT. + (report/patch by Adam Sulmicki), analysis/testing by Sven Mascheck + <sven.mascheck@student.uni-ulm.de>). + +
  • correct some inconsistent checks for XtReleaseGC() + calls in xtermLoadFont() (patch by Nam SungHyun + <namsh@lge.com>). + +
  • updated wcwidth.c and keysym2ucs.c to versions dated 2001/1/12 + and 2001/4/18, respectively from + http://www.cl.cam.ac.uk/~mgk25/ucs/ + +
  • correction to change from patch #90, which was intended to + reset the saved cursor position for normal/alternate screens + on a soft reset, but actually wiped out all of the saved cursor + information. Just reset the saved position for the current screen + (report by Michael Schroeder). + +
  • modify ShowCursor() and HideCursor() so that if the cursor points + to the second part of a wide character, make the show/hide operate on + the first position of the wide character (patch by Sven Verdoolaege). + +
  • scrolling in the alternate screen just before switching back to the + main screen can cause extra blank lines to be inserted into the + scrollback buffer (patch by Paul Vojta + <vojta@math.berkeley.edu>). + +
  • resync with XFree86 4.1.0: +
      +
    • Use TermcapLibrary as -lncurses instead of -ltermcap, fixes + problem building xterm/resize on Cygwin/XFree86 (Harold Hunt). +
    • Install xterm.termcap and xterm.terminfo when installing xterm + (Torrey T. Lyons). +
    • Fix some build issues on Cygwin/XFree86 (Suhaib Siddiqi). +
    • Define CBAUD, when it's missing in xterm, on LynxOS + (Stuart Lissaman). +
    +
+

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

  • change order of selection-target types to make 8-bit xterm prefer @@ -215,7 +605,7 @@
  • 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>). + headers relies on this (patch by Adam Sulmicki).

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

Index: xc/programs/xterm/xterm.man diff -u xc/programs/xterm/xterm.man:3.73 xc/programs/xterm/xterm.man:3.81 --- xc/programs/xterm/xterm.man:3.73 Sat Apr 28 09:51:56 2001 +++ xc/programs/xterm/xterm.man Sat Jan 5 17:05:03 2002 @@ -1,7 +1,7 @@ -.\" $Xorg: xterm.man,v 1.3 2000/08/17 19:55:10 cpqbld Exp $ +.\" $Xorg: xterm.man,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ .\" .\" -.\" Copyright 1996,1997,1998,1999,2000,2001 by Thomas E. Dickey +.\" Copyright 1996,1997,1998,1999,2000,2001,2002 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -30,33 +30,31 @@ .\" authorization. .\" .\" -.\" Copyright (c) 1989 X Consortium -.\" -.\" Permission is hereby granted, free of charge, to any person obtaining -.\" a copy of this software and 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: -.\" +.\" Copyright 1989 The Open Group +.\" +.\" 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. +.\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. -.\" +.\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +.\" 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 X Consortium shall +.\" +.\" 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 X Consortium. +.\" from The Open Group. .\" -.\" $XFree86: xc/programs/xterm/xterm.man,v 3.73 2001/04/28 13:51:56 dickey Exp $ +.\" $XFree86: xc/programs/xterm/xterm.man,v 3.81 2002/01/05 22:05:03 dickey Exp $ .\" .\" updated by Thomas E. Dickey for XFree86, July 1996. .TH XTERM 1 __vendorversion__ @@ -351,6 +349,23 @@ library if support for that library was compiled into xterm. This corresponds to the \fBfaceName\fP resource. .TP 8 +.BI \-fbb +This option indicates that \fIxterm\fP should compare normal and bold fonts bounding +boxes to ensure they are compatible. +.TP 8 +.BI \+fbb +This option indicates that \fIxterm\fP should not compare normal and bold fonts bounding +boxes to ensure they are compatible. +.TP 8 +.BI \-fbx +This option indicates that \fIxterm\fP should not assume that the +normal and bold fonts have VT100 line-drawing characters. +If any are missing, xterm will draw the characters directly. +.TP 8 +.BI \+fbx +This option indicates that \fIxterm\fP should assume that the +normal and bold fonts have VT100 line-drawing characters. +.TP 8 .BI \-fi " font" This option sets the font for active icons if that feature was compiled into xterm. @@ -368,14 +383,21 @@ draw normal text. If no doublewidth font is found, it will improvise, by stretching the normal font. +This corresponds to the \fBwideFont\fP resource. .TP 8 .B \-fwb \fIfont\fP This option specifies the font to be used for displaying bold wide text. By default, it will attempt to use a font twice as wide as the font that will be used to -draw normal text. +draw bold text. If no doublewidth font is found, it will improvise, by stretching -the normal font. +the bold font. +This corresponds to the \fBwideBoldFont\fP resource. +.TP 8 +.B \-fx \fIfont\fP +This option specifies the font to be used for displaying the preedit string +in the "OverTheSpot" input method. +See also the discussion of the \fBximFont\fP resource. .TP 8 .BI \-hc " color" This option specifies the color to use for the background of @@ -1025,6 +1047,7 @@ 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. +The default is ``false.'' .TP 8 .B "c132 (\fPclass\fB C132)" Specifies whether or not the VT102 DECCOLM escape sequence should be honored. @@ -1092,65 +1115,65 @@ in color or as underlined characters. Note that setting ``colorMode'' off disables all colors, including underlining. .TP 8 -.B "color0 (\fPclass\fB Foreground)" +.B "color0 (\fPclass\fB Color0)" .TP 8 -.B "color1 (\fPclass\fB Foreground)" +.B "color1 (\fPclass\fB Color1)" .TP 8 -.B "color2 (\fPclass\fB Foreground)" +.B "color2 (\fPclass\fB Color2)" .TP 8 -.B "color3 (\fPclass\fB Foreground)" +.B "color3 (\fPclass\fB Color3)" .TP 8 -.B "color4 (\fPclass\fB Foreground)" +.B "color4 (\fPclass\fB Color4)" .TP 8 -.B "color5 (\fPclass\fB Foreground)" +.B "color5 (\fPclass\fB Color5)" .TP 8 -.B "color6 (\fPclass\fB Foreground)" +.B "color6 (\fPclass\fB Color6)" .TP 8 -.B "color7 (\fPclass\fB Foreground)" +.B "color7 (\fPclass\fB Color7)" These specify the colors for the ISO 6429 extension. The defaults are, respectively, black, red, green, yellow, blue, magenta, cyan, and white. .TP 8 -.B "color8 (\fPclass\fB Foreground)" +.B "color8 (\fPclass\fB Color8)" .TP 8 -.B "color9 (\fPclass\fB Foreground)" +.B "color9 (\fPclass\fB Color9)" .TP 8 -.B "color10 (\fPclass\fB Foreground)" +.B "color10 (\fPclass\fB Color10)" .TP 8 -.B "color11 (\fPclass\fB Foreground)" +.B "color11 (\fPclass\fB Color11)" .TP 8 -.B "color12 (\fPclass\fB Foreground)" +.B "color12 (\fPclass\fB Color12)" .TP 8 -.B "color13 (\fPclass\fB Foreground)" +.B "color13 (\fPclass\fB Color13)" .TP 8 -.B "color14 (\fPclass\fB Foreground)" +.B "color14 (\fPclass\fB Color14)" .TP 8 -.B "color15 (\fPclass\fB Foreground)" +.B "color15 (\fPclass\fB Color15)" These specify the colors for the ISO 6429 extension if the bold attribute is also enabled. The defaults are, respectively, black, red, green, yellow, blue, magenta, cyan, and white. .TP 8 -.B "color16 (\fPclass\fB Foreground)" +.B "color16 (\fPclass\fB Color16)" .TP 8 through .TP 8 -.B "color255 \fPclass\fB Foreground)" +.B "color255 \fPclass\fB Color255)" These specify the colors for the 256-color extension. The defaults for are for colors 16 through 231 to make a 6x6x6 color cube, and colors 232 through 255 to make a grayscale ramp. .TP 8 -.B "colorBD (\fPclass\fB Foreground)" +.B "colorBD (\fPclass\fB ColorBD)" This specifies the color to use to display bold characters if the ``colorBDMode'' resource is enabled. .TP 8 -.B "colorBL (\fPclass\fB Foreground)" +.B "colorBL (\fPclass\fB ColorBL)" This specifies the color to use to display blink characters if the ``colorBLMode'' resource is enabled. .TP 8 -.B "colorRV (\fPclass\fB Foreground)" +.B "colorRV (\fPclass\fB ColorRV)" This specifies the color to use to display reverse characters if the ``colorRVMode'' resource is enabled. .TP 8 -.B "colorUL (\fPclass\fB Foreground)" +.B "colorUL (\fPclass\fB ColorUL)" This specifies the color to use to display underlined characters if the ``colorULMode'' resource is enabled. .TP 8 @@ -1165,7 +1188,7 @@ Specifies whether to make the cursor blink. The default is ``false.'' .TP 8 -.B "cursorColor (\fPclass\fB Foreground)" +.B "cursorColor (\fPclass\fB CursorColor)" Specifies the color to use for the text cursor. The default is ``black.'' .TP 8 .B "cursorOffTime (\fPclass\fB CursorOffTime)" @@ -1178,7 +1201,7 @@ in milliseconds. The default is 600. .TP 8 -.B "highlightColor (\fPclass\fB Foreground)" +.B "highlightColor (\fPclass\fB HighlightColor)" Specifies the color to use for the background of selected or otherwise highlighted text. If not specified, reverse video is used. .TP 8 @@ -1259,12 +1282,26 @@ If disabled, \fIxterm\fP will simulate doublesize characters by drawing normal characters with spaces between them. .TP 8 +.B "forceBoxChars (\fPclass\fB Boolean)" +Specifies whether \fIxterm\fP should assume the normal and bold fonts +have VT100 line-drawing characters. +If ``false'', \fIxterm\fP will check for missing characters in the 1-31 +cells and make line-drawing characters directly. +The default is ``false.'' +.TP 8 .B "foreground (\fPclass\fB Foreground)" Specifies the color to use for displaying text in the window. Setting the class name instead of the instance name is an easy way to have everything that would normally appear in the text color change color. The default is ``black.'' .TP 8 +.B "freeBoldBox (\fPclass\fB Boolean)" +Specifies whether \fIxterm\fP should assume the bounding boxes for +normal and bold fonts are compatible. +If ``false'', \fIxterm\fP compares them and will reject choices of +bold fonts that do not match the size of the normal font. +The default is ``false.'' +.TP 8 .B "geometry (\fPclass\fB Geometry)" Specifies the preferred size and position of the VT102 window. .TP 8 @@ -1375,17 +1412,21 @@ codes for PF1 to PF4. The default is ``false.'' .TP 8 -.B "pointerColor (\fPclass\fB Foreground)" +.B "pointerColor (\fPclass\fB PointerColor)" Specifies the foreground color of the pointer. The default is ``XtDefaultForeground.'' .TP 8 -.B "pointerColorBackground (\fPclass\fB Background)" +.B "pointerColorBackground (\fPclass\fB PointerColorBackground)" Specifies the background color of the pointer. The default is ``XtDefaultBackground.'' .TP 8 .B "pointerShape (\fPclass\fB Cursor)" Specifies the name of the shape of the pointer. The default is ``xterm.'' .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 "printAttributes (\fPclass\fB PrintAttributes)" Specifies whether to print graphic attributes along with the text. A real DEC VTxxx terminal will print the underline, highlighting codes @@ -1506,7 +1547,7 @@ The default is ``false.'' .TP 8 .B "titeInhibit (\fPclass\fB TiteInhibit)" -Specifies whether or not \fIxterm\fP should remove remove \fIti\fP and \fIte\fP +Specifies whether or not \fIxterm\fP should remove \fIti\fP and \fIte\fP termcap entries (used to switch between alternate screens on startup of many screen-oriented programs) from the TERMCAP string. If set, \fIxterm\fP also ignores the escape sequence to switch to the @@ -1515,6 +1556,15 @@ sequences (also known as private modes) 1047, 1048 and 1049 which have the same effect as the original 47 control sequence. .TP 8 +.B "tiXtraScroll (\fPclass\fB TiXtraScroll)" +Specifies whether \fIxterm\fP should scroll to a new page when processing +the \fIti\fP termcap entry, i.e., the privde modes 47, 1047 or 1049. +This is only in effect if \fItiteInhibit\fP is ``false'', +because the intent of this option is to provide a picture of the full-screen +application's display on the scrollback without wiping out the text that +would be shown before the application was initialized. +The default for this resource is ``false.'' +.TP 8 .B "translations (\fPclass\fB Translations)" Specifies the key and button bindings for menus, selections, ``programmed strings,'' etc. See \fBACTIONS\fP below. @@ -1548,13 +1598,40 @@ 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.'' +.B "wideBoldFont (\fPclass\fB WideBoldFont)" +This option specifies the font to be used for displaying bold wide text. +By default, +it will attempt to use a font twice as wide as the font that will be used to +draw bold text. +If no doublewidth font is found, it will improvise, by stretching +the bold font. .TP 8 .B "wideChars (\fPclass\fB WideChars)" Specifies if \fIxterm\fP should respond to control sequences that process 16-bit characters. +.TP 8 +.B "wideFont (\fPclass\fB WideFont)" +This option specifies the font to be used for displaying wide text. +By default, +it will attempt to use a font twice as wide as the font that will be used to +draw normal text. +If no doublewidth font is found, it will improvise, by stretching +the normal font. +.TP 8 +.B "ximFont (\fPclass\fB XimFont)" +This option specifies the font to be used for displaying the preedit string +in the "OverTheSpot" input method. +.IP +In "OverTheSpot" preedit type, the preedit (preconversion) +string is displayed at the position of the cursor. +It is the XIM server's responsibility to display the preedit string. +The XIM client must inform the XIM server of the cursor position. +For best results, the preedit string must be displayed with a proper font. +Therefore, \fIxterm\fP informs the XIM server of the proper font. +The font is be supplied by a "fontset", whose default value is "*". +This matches every font, the X library automatically chooses fonts with +proper charsets. +The \fBximFont\fP resource is provided to override this default font setting. .sp .PP The following resources are specified as part of the \fItek4014\fP widget @@ -2131,7 +2208,7 @@ /* E` E' E^ E: I` I' I^ I: */ 48, 48, 48, 48, 48, 48, 48, 48, /* D- N~ O` O' O^ O~ O: X */ - 48, 48, 48, 48, 48, 48, 48, 216, + 48, 48, 48, 48, 48, 48, 48, 215, /* O/ U` U' U^ U: Y' P B */ 48, 48, 48, 48, 48, 48, 48, 48, /* a` a' a^ a~ a: ao ae c, */ @@ -2139,7 +2216,7 @@ /* e` e' e^ e: i` i' i^ i: */ 48, 48, 48, 48, 48, 48, 48, 48, /* d n~ o` o' o^ o~ o: -: */ - 48, 48, 48, 48, 48, 48, 48, 248, + 48, 48, 48, 48, 48, 48, 48, 247, /* o/ u` u' u^ u: y' P y: */ 48, 48, 48, 48, 48, 48, 48, 48}; .fi @@ -2548,7 +2625,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~Ctrl KP_Add:larger-vt-font() \\n\\ + Shift Ctrl KP_Add:smaller-vt-font() \\n\\ Shift KP_Subtract:smaller-vt-font() \\n\\ ~Meta :insert-seven-bit() \\n\\ Meta :insert-eight-bit() \\n\\ @@ -2686,10 +2764,10 @@ \fI/etc/wtmp\fP the system logfile, which records user logins and logouts. .TP 5 -\fI/usr/lib/X11/app-defaults/XTerm\fP +.I __apploaddir__/XTerm the \fIxterm\fP default application resources. .TP 5 -\fI/usr/lib/X11/app-defaults/XTerm-color\fP +.I __apploaddir__/XTerm-color the \fIxterm\fP color application resources. If your display supports color, use this .in +10 Index: xc/programs/xterm/xterm_io.h diff -u xc/programs/xterm/xterm_io.h:1.3 xc/programs/xterm/xterm_io.h:1.7 --- xc/programs/xterm/xterm_io.h:1.3 Tue Feb 13 14:19:19 2001 +++ xc/programs/xterm/xterm_io.h Mon Jan 7 16:02:44 2002 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/xterm_io.h,v 1.3 2001/02/13 19:19:19 dawes Exp $ + * $XFree86: xc/programs/xterm/xterm_io.h,v 1.7 2002/01/07 21:02:44 dawes Exp $ */ /* @@ -64,8 +64,10 @@ #endif #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#ifndef USE_POSIX_TERMIOS #define USE_POSIX_TERMIOS #endif +#endif #ifdef linux #define USE_TERMIOS @@ -233,7 +235,7 @@ #ifdef Lynx #include -#elif !(defined(SYSV) || defined(linux) || defined(VMS)) +#elif !(defined(SYSV) || defined(linux) || defined(VMS) || (defined(__QNX__)&&!defined(__QNXNTO__))) #include #endif Index: xc/programs/xterm/xtermcfg.hin diff -u xc/programs/xterm/xtermcfg.hin:3.37 xc/programs/xterm/xtermcfg.hin:3.39 --- xc/programs/xterm/xtermcfg.hin:3.37 Sat Apr 28 09:51:56 2001 +++ xc/programs/xterm/xtermcfg.hin Sun Oct 7 21:08:11 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.37 2001/04/28 13:51:56 dickey Exp $ + * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.39 2001/10/08 01:08:11 dickey Exp $ */ /************************************************************ @@ -41,6 +41,7 @@ #undef DFT_TERMTYPE /* AC_ARG_WITH(default-term-type) */ #undef HAVE_GETLOGIN /* AC_CHECK_FUNCS(getlogin) */ #undef HAVE_LASTLOG_H /* CF_LASTLOG */ +#undef HAVE_NCURSES_TERM_H /* AC_CHECK_HEADERS(ncurses/term.h) */ #undef HAVE_PATHS_H /* CF_LASTLOG */ #undef HAVE_STDLIB_H /* AC_CHECK_HEADERS(stdlib.h) */ #undef HAVE_STRERROR /* AC_CHECK_FUNCS(strerror) */ @@ -67,6 +68,7 @@ #undef OPT_AIX_COLORS /* CF_ARG_DISABLE(16-color) */ #undef OPT_BLINK_CURS /* CF_ARG_DISABLE(blink-cursor) */ #undef OPT_BOX_CHARS /* CF_ARG_DISABLE(boxchars) */ +#undef OPT_COLOR_CLASS /* CF_ARG_DISABLE(color-class) */ #undef OPT_DEC_CHRSET /* CF_ARG_DISABLE(doublechars) */ #undef OPT_DEC_LOCATOR /* CF_ARG_ENABLE(dec-locator) */ #undef OPT_HIGHLIGHT_COLOR /* CF_ARG_DISABLE(highlighting) */ Index: xc/programs/xterm/xutf8.c diff -u /dev/null xc/programs/xterm/xutf8.c:1.1 --- /dev/null Fri Jan 18 15:27:42 2002 +++ xc/programs/xterm/xutf8.c Mon Jun 18 15:09:28 2001 @@ -0,0 +1,371 @@ +/* $XFree86: xc/programs/xterm/xutf8.c,v 1.1 2001/06/18 19:09:28 dickey Exp $ */ +/* +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. +*/ + +#include + +#include +#include +#include +#include + +#include + +#define KEYSYM2UCS_INCLUDED +#include "keysym2ucs.c" + +#ifndef X_HAVE_UTF8_STRING +#undef XA_UTF8_STRING +Atom _xa_utf8_string(Display *dpy) +{ + static AtomPtr p = NULL; + + if(p == NULL) + p = XmuMakeAtom("UTF8_STRING"); + + return XmuInternAtom(dpy, p); +} +#define XA_UTF8_STRING(dpy) _xa_utf8_string(dpy) + +static int +utf8countBytes(int c) +{ + if(c < 0) + return 0; + + if(c <= 0x7F) { + return 1; + } else if(c <= 0x7FF) { + return 2; + } else if(c <= 0xFFFF) { + return 3; + } else + return 4; +} + +static void +utf8insert(char *dest, int c, int *len_return) +{ + if(c < 0) + return; + + if(c <= 0x7F) { + dest[0] = c; + *len_return = 1; + } else if(c <= 0x7FF) { + dest[0] = 0xC0 | ((c >> 6) & 0x1F); + dest[1] = 0x80 | (c & 0x3F); + *len_return = 2; + } else if(c <= 0xFFFF) { + dest[0] = 0xE0 | ((c >> 12) & 0x0F); + dest[1] = 0x80 | ((c >> 6) & 0x3F); + dest[2] = 0x80 | (c & 0x3F); + *len_return = 3; + } else { + dest[0] = 0xF0 | ((c >> 18) & 0x07); + dest[1] = 0x80 | ((c >> 12) & 0x3f); + dest[2] = 0x80 | ((c >> 6) & 0x3f); + dest[3] = 0x80 | (c & 0x3f); + *len_return = 4; + } +} + +static int +l1countUtf8Bytes(char *s, int len) +{ + int l = 0; + while(len > 0) { + if((*s & 0x80) == 0) + l++; + else + l += 2; + s++; + len--; + } + return l; +} + +static void +l1utf8copy (char *d, char *s, int len) +{ + int l; + while(len > 0) { + utf8insert(d, (*s) & 0xFF, &l); + d += l; + s++; + len--; + } +} + +static void +utf8l1strcpy (char *d, char *s) +{ +#define SKIP do { s++; } while(((*s & 0x80) != 0) && (*s & 0xC0) != 0xC0) + while(*s) { + if((*s & 0x80) == 0) + *d++ = *s++; + else if((*s & 0x7C) == 0x40) { + if((s[1] & 0x80) == 0) { + s++; /* incorrect UTF-8 */ + continue; + } else if((*s & 0x7C) == 0x40) { + *d++ = ((*s & 0x03) << 6) | (s[1] & 0x3F); + s += 2; + } else { + *d++ = '?'; + SKIP; + } + } else { + *d++ = '?'; + SKIP; + } + } + *d = 0; +#undef SKIP +} + +/* Keep this in sync with utf8l1strcpy! */ +static int +utf8l1strlen(char *s) +{ +#define SKIP do { s++; } while(((*s & 0x80) != 0) && (*s & 0xC0) != 0xC0) + int len = 0; + while(*s) { + if((*s & 0x80) == 0) { + s++; + len++; + } else if((*s & 0x7C) == 0x40) { + if((s[1] & 0x80) == 0) { + s++; + continue; + } else if((*s & 0x7C) == 0x40) { + len++; + s += 2; + } else { + len++; + SKIP; + } + } else { + len++; + SKIP; + } + } +#undef SKIP + return len; +} + +int +Xutf8TextPropertyToTextList( + Display *dpy, + const XTextProperty *tp, + char ***list_return, + int *count_return) +{ + int utf8; + char **list; + int nelements; + register char *cp; + char *start; + int i, j; + int datalen = (int) tp->nitems; + int len; + + if(tp->format != 8) + return XConverterNotFound; + + if(tp->encoding == XA_STRING) + utf8 = 0; + else if(tp->encoding == XA_UTF8_STRING(dpy)) + utf8 = 1; + else + return XConverterNotFound; + + if (datalen == 0) { + *list_return = NULL; + *count_return = 0; + return 0; + } + + nelements = 1; + for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { + if (*cp == '\0') nelements++; + } + + list = (char **) malloc (nelements * sizeof (char *)); + if (!list) return XNoMemory; + + if(utf8) + len = datalen; + else + len = l1countUtf8Bytes((char*)tp->value, datalen); + + start = (char *) malloc ((len + 1) * sizeof (char)); + if (!start) { + free ((char *) list); + return XNoMemory; + } + + if(utf8) + memcpy(start, (char*)tp->value, datalen); + else + l1utf8copy(start, (char*)tp->value, datalen); + start[len] = '\0'; + + for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--) { + if (*cp == '\0') { + list[j] = start; + start = (cp + 1); + j++; + } + } + + list[j] = NULL; + *list_return = list; + *count_return = nelements; + return 0; +} + +int +Xutf8TextListToTextProperty( + Display *dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) +{ + XTextProperty proto; + unsigned int nbytes; + int i; + + if(style != XStringStyle && + style != XCompoundTextStyle && + style != XStdICCTextStyle && + style != XUTF8StringStyle) + return XConverterNotFound; + + if(style == XUTF8StringStyle) { + for (i = 0, nbytes = 0; i < count; i++) { + nbytes += (unsigned) ((list[i] ? strlen (list[i]) : 0) + 1); + } + } else { + for (i = 0, nbytes = 0; i < count; i++) { + nbytes += (unsigned) ((list[i] ? utf8l1strlen(list[i]) : 0) + 1); + } + } + + if(style == XCompoundTextStyle) + proto.encoding = XA_COMPOUND_TEXT(dpy); + else if(style == XUTF8StringStyle) + proto.encoding = XA_UTF8_STRING(dpy); + else + proto.encoding = XA_STRING; + proto.format = 8; + if (nbytes) + proto.nitems = nbytes - 1; + else + proto.nitems = 0; + proto.value = NULL; + + if (nbytes > 0) { + register char *buf = malloc (nbytes); + if (!buf) return XNoMemory; + + proto.value = (unsigned char *) buf; + for (i = 0; i < count; i++) { + char *arg = list[i]; + + if (arg) { + if(style == XUTF8StringStyle) { + strcpy(buf, arg); + } else { + utf8l1strcpy(buf, arg); + } + buf += (strlen(buf) + 1); + } else { + *buf++ = '\0'; + } + } + } else { + proto.value = (unsigned char *) malloc (1); /* easier for client */ + if (!proto.value) return XNoMemory; + + proto.value[0] = '\0'; + } + + *text_prop = proto; + return 0; +} + +int +Xutf8LookupString( + XIC ic GCC_UNUSED, + register XKeyEvent *ev, + char *buffer, + int nbytes, + KeySym *keysym_return, + Status *status_return) +{ + int rc; + KeySym keysym; + int codepoint; + int len; + + rc = XLookupString(ev, buffer, nbytes, &keysym, NULL); + + if(rc > 0) { + codepoint = buffer[0] & 0xFF; + } else { + codepoint = keysym2ucs(keysym); + } + + if(codepoint < 0) { + if(keysym == None) { + *status_return = XLookupNone; + } else { + *status_return = XLookupKeySym; + *keysym_return = keysym; + } + return 0; + } + + if(nbytes < utf8countBytes(codepoint)) { + *status_return = XBufferOverflow; + return utf8countBytes(codepoint); + } + + utf8insert(buffer, codepoint, &len); + + if(keysym != None) { + *keysym_return = keysym; + *status_return = XLookupBoth; + } else { + *status_return = XLookupChars; + } + return len; +} +#else /* X_HAVE_UTF8_STRING */ +/* Silence the compiler */ +void xutf8_dummy(void) +{ + return; +} +#endif Index: xc/programs/xterm/xutf8.h diff -u /dev/null xc/programs/xterm/xutf8.h:1.1 --- /dev/null Fri Jan 18 15:27:42 2002 +++ xc/programs/xterm/xutf8.h Mon Jun 18 15:09:28 2001 @@ -0,0 +1,61 @@ +/* $XFree86: xc/programs/xterm/xutf8.h,v 1.1 2001/06/18 19:09:28 dickey Exp $ */ +/* +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. +*/ + +#ifndef _XLIB_H_ +#error Please include before "xutf8.h" +#endif + +#ifndef X_HAVE_UTF8_STRING + +#undef XA_UTF8_STRING +Atom _xa_utf8_string(Display*); +#define XA_UTF8_STRING(dpy) _xa_utf8_string(dpy) + +#undef XUTF8StringStyle +#define XUTF8StringStyle 4 + +int Xutf8TextPropertyToTextList( + Display *, + const XTextProperty *, + char ***, + int * +); +int +Xutf8TextListToTextProperty( + Display *, + char **, + int, + XICCEncodingStyle, + XTextProperty * +); +int Xutf8LookupString( + XIC, + XKeyPressedEvent *, + char *, + int, + KeySym *, + Status * +); +#else +void xutf8_dummy(void); +#endif Index: xc/programs/xtrap/Imakefile diff -u /dev/null xc/programs/xtrap/Imakefile:1.3 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/Imakefile Thu Nov 15 07:56:16 2001 @@ -0,0 +1,53 @@ +XCOMM $XFree86: xc/programs/xtrap/Imakefile,v 1.3 2001/11/15 12:56:16 alanh Exp $ + + DEPLIBS = $(DEPXTRAPLIB) $(DEPEXTENSIONLIB) $(DEPXTOOLLIB) $(DEPXLIB) + KEYSRC = XEKeybCtrl.c + KEYOBJ = XEKeybCtrl.o + SRCS1 = xtrapinfo.c $(KEYSRC) + OBJS1 = xtrapinfo.o $(KEYOBJ) + SRCS2 = xtrapout.c $(KEYSRC) + OBJS2 = xtrapout.o $(KEYOBJ) + SRCS3 = xtrapreset.c $(KEYSRC) + OBJS3 = xtrapreset.o $(KEYOBJ) + SRCS4 = xtrapstats.c $(KEYSRC) + OBJS4 = xtrapstats.o $(KEYOBJ) + SRCS5 = xtrapin.c $(KEYSRC) + OBJS5 = xtrapin.o $(KEYOBJ) + SRCS6 = xtrapproto.c $(KEYSRC) + OBJS6 = xtrapproto.o $(KEYOBJ) + SRCS7 = xtrapchar.c chparse.c $(KEYSRC) + OBJS7 = xtrapchar.o chparse.o $(KEYOBJ) +LOCAL_LIBRARIES = $(XTRAPLIB) $(XTOOLLIB) $(XLIB) + + PROGRAMS = ProgramTargetName(xtrapinfo) \ + ProgramTargetName(xtrapout) \ + ProgramTargetName(xtrapreset) \ + ProgramTargetName(xtrapstats) \ + ProgramTargetName(xtrapin) \ + ProgramTargetName(xtrapproto) \ + ProgramTargetName(xtrapchar) + SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS6) $(SRCS7) $(SRCS8) + OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) $(OBJS7) $(OBJS8) + +AllTarget($(PROGRAMS)) + +SingleProgramTarget(xtrapinfo,$(OBJS1),$(LOCAL_LIBRARIES),) +SingleProgramTarget(xtrapout,$(OBJS2),$(LOCAL_LIBRARIES),ExtraLibraries) +SingleProgramTarget(xtrapreset,$(OBJS3),$(LOCAL_LIBRARIES),) +SingleProgramTarget(xtrapstats,$(OBJS4),$(LOCAL_LIBRARIES),) +SingleProgramTarget(xtrapin,$(OBJS5),$(LOCAL_LIBRARIES),ExtraLibraries) +SingleProgramTarget(xtrapproto,$(OBJS6),$(LOCAL_LIBRARIES),ExtraLibraries) +SingleProgramTarget(xtrapchar,$(OBJS7),$(LOCAL_LIBRARIES),ExtraLibraries) + +InstallProgram(xtrapinfo,$(BINDIR)) +InstallProgram(xtrapout,$(BINDIR)) +InstallProgram(xtrapreset,$(BINDIR)) +InstallProgram(xtrapstats,$(BINDIR)) +InstallProgram(xtrapin,$(BINDIR)) +InstallProgram(xtrapproto,$(BINDIR)) +InstallProgram(xtrapchar,$(BINDIR)) + +InstallManPage(xtrap,$(MANDIR)) +InstallManPageAliases(xtrap,$(MANDIR),xtrapreset xtrapinfo xtrapstats xtrapout xtrapin xtrapchar xtrapproto) + +DependTarget() Index: xc/programs/xtrap/XEKeybCtrl.c diff -u /dev/null xc/programs/xtrap/XEKeybCtrl.c:1.1 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/XEKeybCtrl.c Fri Nov 2 18:29:34 2001 @@ -0,0 +1,236 @@ +/* $XFree86: xc/programs/xtrap/XEKeybCtrl.c,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1992 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ +#ifndef vms +#include +#else +#include /* Character string descriptors */ +#include /* GETDVI item codes */ +#include /* device independent codes */ +#include /* I/O function codes */ +#include /* PSL definitions */ +#include /* System service codes */ +#include /* System status masks and codes */ +#include /* Terminal specific I/O defs */ +#include /* Terminal specific I/O defs */ +#define CTRL_USER_MODE 3 + +/*----------* + * Macros * + *----------*/ + +#define $CheckStatus(status)\ + if (!(status & 1)) return(status); + + /* Allocate a quadword aligned VMS descriptor. + * NOTE: This supersedes the $DESCRIPTOR macro in DESCRIP.H. + * The only difference is the _align(QUADWORD) term. + */ +#define $DESCRIPTOR_Q(name, string)\ + struct dsc$descriptor_s _align (QUADWORD) name = \ + { sizeof(string)-1, DSC$K_DTYPE_T, DSC$K_CLASS_S, string } + +/*---------------------* + * Data Declarations * + *---------------------*/ + +static $DESCRIPTOR_Q (sys_input, "SYS$INPUT:"); + +static unsigned short + comm_chan, /* Communication channel */ + comm_iosb[4]; /* I/O status block */ + +static struct getdvi_itmlst_struct + { /* $GETDVI item list */ + unsigned short int + buflen, + item_code; + unsigned int + bufadr, + retadr, + eol; + } _align (LONGWORD) getdvi_itmlst = { sizeof(int), + DVI$_DEVCHAR, + 0,0,0 }; + +static unsigned int dvi_characteristics,return_length; + +static struct exit_handler_blk + { + unsigned int flink; + void (*exit_routine)(); + unsigned char arg_cnt; + unsigned char null_byte; + unsigned short null_word; + unsigned int cond_value; + } _align (LONGWORD) exit_block; + +static unsigned int vms_condition; + +#endif /* vms */ + + + +#include +#include + +#include "XEKeybCtrl.h" + +int XEEnableCtrlKeys(void (*rtn)(int)) +{ +#ifndef vms + signal(SIGINT, rtn); /* CTRL-C */ + return(1L); + +#else /* vms */ + + int status; + + /* + * Provide the addresses of the longword to receive device chars + * and the return length of the information. + */ + getdvi_itmlst.bufadr = &dvi_characteristics; + getdvi_itmlst.retadr = &return_length; + + status = SYS$GETDVIW (0, 0, &sys_input, &getdvi_itmlst, 0, 0, 0, 0); + $CheckStatus(status); + + + /* If we have a terminal device, enable control-c and control-y */ + if (dvi_characteristics & DEV$M_TRM) + { + /* Assign a channel to the communication device. */ + status = SYS$ASSIGN ( &sys_input, /* Device name */ + &comm_chan, /* Channel returned */ + 0, 0 ); + $CheckStatus(status); + + status = XEEnableCtrlC(rtn); + $CheckStatus(status); + + status = XEEnableCtrlY(rtn); + $CheckStatus(status); + } + return (SS$_NORMAL); + +#endif /* vms */ +} + + +int XEClearCtrlKeys(void) +{ +#ifndef vms + signal(SIGINT, SIG_DFL); /* CTRL-C */ + return(1L); +#else /* vms */ + int status; + + if (dvi_characteristics & DEV$M_TRM) + { + status = SYS$DASSGN(comm_chan); + $CheckStatus(status); + } + return (SS$_NORMAL); +#endif /* vms */ +} + +int XEEnableCtrlC(void (*rtn)(int)) +{ +#ifndef vms + signal(SIGINT, rtn); /* CTRL-C */ + return(1); +#else + int status; + + status = SYS$QIOW ( 0, /* Now set the characteristics */ + comm_chan, /* Channel */ + IO$_SETMODE|IO$M_CTRLCAST, /* Set ctrl_c */ + comm_iosb, /* iosb address */ + 0, 0, /* */ + rtn, 0, /* AST routine and param */ + CTRL_USER_MODE, 0, 0, 0 ); + $CheckStatus(status); + + return (SS$_NORMAL); +#endif /* vms */ +} + + +int XEEnableCtrlY(void (*rtn)(int)) +{ +#ifndef vms + signal(SIGQUIT,rtn); /* CTRL-backslash */ + return(1); +#else /* vms */ + int status; + + status = SYS$QIOW ( 0, /* Set characteristics */ + comm_chan, /* Channel */ + IO$_SETMODE|IO$M_CTRLYAST, /* Set ctrl_y */ + comm_iosb, /* iosb address */ + 0, 0, /* */ + rtn, 0, /* AST routine and param */ + CTRL_USER_MODE, 0, 0, 0 ); + $CheckStatus(status); + + return (SS$_NORMAL); +#endif /* vms */ +} + + +int XEDeclExitHndlr(void (*rtn)(int)) +{ +#ifndef vms + return(1); /* no real way for U*IX to do this */ +#else /* vms */ + int status; + + /* + * The Exit handler routine must accept one argument. + * This argument will be the condition that signaled the + * the exit handler. + */ + exit_block.exit_routine = rtn; + exit_block.arg_cnt = 1; /* The condition code is the first argument */ + exit_block.cond_value = &vms_condition; /* Address of condition value written by VMS */ + + status = SYS$DCLEXH (&exit_block); /* Set up the condition handler */ + $CheckStatus(status); + + return (SS$_NORMAL); +#endif /* vms */ +} Index: xc/programs/xtrap/XEKeybCtrl.h diff -u /dev/null xc/programs/xtrap/XEKeybCtrl.h:1.1 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/XEKeybCtrl.h Fri Nov 2 18:29:34 2001 @@ -0,0 +1,8 @@ +/* $XFree86: xc/programs/xtrap/XEKeybCtrl.h,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ + +extern int XEEnableCtrlKeys(void(*rtn)(int)); +extern int XEEnableCtrlC(void (*rtn)(int)); +extern int XEEnableCtrlY(void (*rtn)(int)); +extern int XEClearCtrlKeys(void); +extern int XEDeclExitHndlr(void (*rtn)(int)); + Index: xc/programs/xtrap/chparse.c diff -u /dev/null xc/programs/xtrap/chparse.c:1.2 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/chparse.c Mon Jan 7 15:38:31 2002 @@ -0,0 +1,407 @@ +/* $XFree86: xc/programs/xtrap/chparse.c,v 1.2 2002/01/07 20:38:31 dawes Exp $ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* +**++ +** FACILITY: chparse - ASCII ESC & CSI parser +** +** MODULE DESCRIPTION: +** +** This module accepts single character I/O from +** stdin and returns a parsed character or sequence +** of characters. This is to be used in conjunction +** with passing data from dragon-speak to XTrap. +** +** AUTHORS: +** +** Roy Lomicka (revised by Martin Minow & later Kenneth B. Miller) +** +** CREATION DATE: March 26, 1991 +** +** DESIGN ISSUES: +** +** The algorithm is rather obscure. However, it was decided +** that it should be left in its original condition since it +** closely depicts the state transition diagram for ASCII +** sequences (about the only good thing goto's are for;) . +** The old-fashioned bracketing and tabbing schemed were +** also preserved for posterity. +** +**-- +*/ + +#include +#include +#ifdef vms +#include +#include +#include +#include +#else +#include +#include +#endif +#include +#include "chparse.h" + +#ifdef __QNX__ +#include +#endif + +#ifndef VERBOSE +#define VERBOSE 0 +#endif + +#ifndef FALSE +#define FALSE 0 +#define TRUE 1 +#endif +#define EOS '\0' +#define ERROR (-1) +#define TIMEOUT (-2) +#define NPARAM 8 +#define NINTER 8 +#define BUFFLEN 10 /* Size of typeahead buffer */ +#ifndef EXIT_SUCCESS +#ifdef vms +#define EXIT_SUCCESS (SS$_NORMAL | STS$M_INHIB_MSG) +#define EXIT_FAILURE (SS$_ABORT) +#else +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 +#endif +#endif + +#define NUL 0x00 +#define CAN 0x18 +#define SUB 0x1A +#define ESC 0x1B +#define DEL 0x7F +#define SS3 0x8f +#define DCS 0x90 +#define CSI 0x9B +#define ST 0x9C +#define OSC 0x9D +#define PM 0x9E +#define APC 0x9F + +static int kbinr(int max_delay); + +/* + * Escape sequence parser, obscure but useful. + */ +int chparse( +int max_delay, +int rest_delay, +int *state, /* Parser state (n.z. if incomplete) */ +int *private, /* Sequence private char, 'X' if error */ +int param[], /* numeric param, starting at param[1] */ +int *nparam, /* Number of parameters */ +int inter[], /* intermediate char, starting at [1] */ +int *ninter, /* Number of intermediates */ +int *final) /* Sequence terminator */ +{ + int present[NPARAM]; /* TRUE if param[i] is not defaulted */ + register int c; + register int i; + + if (*state == 0) + *private = 0; +label1: c = kbinr(max_delay); +#if 0 + printf("c %02x, *state %02x, *nparam %d\n", c, *state, *nparam); +#endif + max_delay = rest_delay; +label2: switch (c) { + case NUL: + case DEL: + goto label5; + case ESC: + case CSI: + case SS3: + case DCS: + case OSC: + case PM: + case APC: + *state = c; + *private = 0; + for (i = 0; i < NPARAM; i++) + param[i] = present[i] = 0; + for (i = 0; i < NINTER; i++) + inter[i] = EOS; + *nparam = *ninter = 0; + goto label1; + } + if (*state == 0) + goto label5; + if ((c >= 0x80 && c < 0xA0) + || c == TIMEOUT + || c == ERROR + || c == CAN + || c == SUB) { + *state = 0; + goto label5; + } + if (c < 0x20) /* Doesn't stop seq. */ + goto label5; + if (c <= 0x2F) { + if (*ninter < 7) + inter[++*ninter] = c; + goto label1; + } + if (*state == ESC) { + if (*ninter == 0 + && (c & 0x3F) < 0x20) { + c = (c & 0x3F) + 0x80; + goto label2; + } + goto label4; + } + if (c >= 0x40) + goto label3; + else if (c >= 0x3C) { /* Private introducer */ + if (*nparam != 0) + *private = 'X'; + else { + *private = c; + *nparam = 1; + } + goto label1; + } + if (*nparam == 0) + *nparam = 1; + if (*ninter != 0) { + *ninter = 0; + *private = 'X'; + } + if (c == ';') { + if (*nparam >= (NPARAM - 1)) + *private = 'X'; + else { + ++*nparam; + } + goto label1; + } + if (c > '9') { + *private = 'X'; + goto label1; + } + present[*nparam] = 1; + param[*nparam] = (param[*nparam] * 10) + (c - '0'); + goto label1; +label3: if (*nparam == 0) + *nparam = 1; +label4: *final = c; + c = *state; + *state = 0; +label5: return (c); +} + +void dumpsequence( +int state, +int c, +int private, /* Sequence private char, 'X' if error */ +int param[], /* numeric param, starting at param[1] */ +int nparam, /* Number of parameters */ +int inter[], /* intermediate char, starting at [1] */ +int ninter, /* Number of intermediates */ +int final, /* Sequence terminator */ +short *column) /* column display count */ +{ + register int i; + + if (isascii(c) && isprint(c)) { + *column +=2; + if (*column >= 79) { + printf("\n"); + *column = 2; + } + printf("%c ", c); + } + else if (private == 'X') { + *column += strlen("bad sequence "); + if (*column >= 79) { + printf("\n"); + *column = strlen("bad sequence "); + } + printf("bad sequence "); + } + else if (state != NUL) { + *column += 32; + if (*column >= 79) { + printf("\n"); + *column = 32; + } + printf("incomplete sequence (type <%02x>) ", state); + } + else { + *column += 5; /* update total chars printed */ + if (*column >= 79) { + printf("\n"); + *column = 6; + } + switch (c) { + case ESC: printf(""); break; + case DCS: printf(""); break; + case CSI: printf(""); break; + case SS3: printf(""); break; + default: printf("<%02x>", c & 0xFF); + } + if (c == ESC || c == DCS || c == CSI || c == SS3) { + *column += 1 + nparam*2 + ninter + 1; /* total chars printed */ + if (*column >= 79) { + printf("\n"); + *column = 1 + nparam*2 + ninter + 1; + } + if (private != NUL && private != 'X') + printf("%c", private); + for (i = 1; i <= nparam; i++) + printf("%s%d", (i > 1) ? "," : " ", param[i]); + for (i = 1; i <= ninter; i++) + printf("%c", inter[i]); + printf("%c", final); + } + (*column)++; + if (*column >= 79) { + printf("\n"); + *column = 1; + } + printf(" "); + } +} + +#ifdef vms +/* + * Read a character from the terminal (with selectable timeout) + */ + +int +kbinr(timeout) +int timeout; /* In seconds, 0 == immediately */ +/* + * Get one byte without echoing, if available. Returns + * ERROR Something is dwrong + * TIMEOUT Nothing read within limit. + * Note: + * timeout = 0 return immediately if nothing is present + * timeout = 1 Indeterminate, do not use + * timeout = 2 Wait at least one second. + */ +{ + register int incount; + static char buffer[BUFFLEN]; + static char *bufptr = buffer; + static char *bufend = buffer; + + if (bufptr >= bufend) { + bufptr = bufend = buffer; + incount = vmsread(buffer, BUFFLEN, 0); + if (incount == TIMEOUT) + incount = vmsread(buffer, 1, timeout); + if (incount <= 0) + return (incount); + bufend = &buffer[incount]; + } + return (*bufptr++ & 0xFF); +} + +static int tt_channel; /* Gets channel number */ +typedef struct { + short int status; + short int term_offset; + short int terminator; + short int term_size; +} IOSTAB; + +int +vmsread(buffer, size, timeout) +char *buffer; +int size; +int timeout; +{ + register int status; + IOSTAB iostab; + static $DESCRIPTOR(tt_device, "SYS$COMMAND"); + static long termset[2] = { 0, 0 }; /* No terminator */ + static short opened = FALSE; /* TRUE when opened */ + + if (!opened) { + status = sys$assign(&tt_device, &tt_channel, 0, 0); + if (status != SS$_NORMAL) + lib$stop(status); + opened = TRUE; + } + status = sys$qiow( + 0, /* Event flag */ + tt_channel, /* Input channel */ + IO$_READLBLK | IO$M_NOECHO | IO$M_NOFILTR | IO$M_TIMED, + /* Read, no echo, no translate */ + &iostab, /* I/O status block */ + NULL, /* AST block (none) */ + 0, /* AST parameter */ + buffer, /* P1 - input buffer */ + size, /* P2 - buffer length */ + timeout, /* P3 - timeout */ + &termset, /* P4 - terminator set */ + NULL, /* P5 - ignored (prompt buffer) */ + 0 /* P6 - ignored (prompt size) */ + ); + if (status == SS$_TIMEOUT) + return (TIMEOUT); + else if (status != SS$_NORMAL) + return (ERROR); + else { + if ((status = iostab.term_offset + iostab.term_size) > 0) + return (status); + return (TIMEOUT); + } +} +#else +static int +kbinr(int max_delay) +{ + auto int fdmask; + struct timeval timeout; + int count; + static unsigned char buffer[80]; + static unsigned char *bend; + static unsigned char *bptr; + + if (bptr >= bend) { + fdmask = 1 << fileno(stdin); + timeout.tv_usec = 0; + timeout.tv_sec = max_delay; + count = select(fileno(stdin) + 1, (fd_set *)&fdmask, NULL, NULL, &timeout); + if (count < 0) + return (ERROR); + else if (count == 0) + return (TIMEOUT); + if (count >= sizeof buffer) + count = sizeof buffer; + count = read(fileno(stdin), buffer, count); + if (count <= 0) + return (ERROR); + bptr = buffer; + bend = buffer + count; + } + return (*bptr++); +} +#endif Index: xc/programs/xtrap/chparse.h diff -u /dev/null xc/programs/xtrap/chparse.h:1.1 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/chparse.h Fri Nov 2 18:29:34 2001 @@ -0,0 +1,10 @@ +/* $XFree86: xc/programs/xtrap/chparse.h,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ + +extern int chparse(int max_delay, int rest_delay, int *state, int *private, + int param[], int *nparam, int inter[], int *ninter, + int *final); +extern void dumpsequence(int state, int c, int private, int param[], + int nparam, int inter[], int ninter, int final, + short *column); + + Index: xc/programs/xtrap/xtrap.man diff -u /dev/null xc/programs/xtrap/xtrap.man:1.2 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/xtrap.man Sat Nov 3 13:51:04 2001 @@ -0,0 +1,216 @@ +.\" $XFree86: xc/programs/xtrap/xtrap.man,v 1.2 2001/11/03 18:51:04 dawes Exp $ +.TH xtrap 1 +.SH NAME +xtrapreset, xtrapinfo, xtrapstats, xtrapout, xtrapin, xtrapchar, xtrapproto +- XTrap sample clients +.SH SYNTAX +.NXR "XTrap X Server Extension Sample Clients" +.B xtrapreset +[ +.B \-d[isplay] +.I display +] +.\".ll -8 +.LP +.B xtrapinfo +[ +.B \-d[isplay] +.I display +] +.\".ll -8 +.LP +.B xtrapstats +[ +.B \-d[isplay] +.I display +] +.\".ll -8 +.LP +.B xtrapout +[ +.B \-f +.I script +] [ +.B \-e +] [ +.B \-d[isplay] +.I display +] [ +.B \-v +] +.\".ll -8 +.LP +.B xtrapin +[ +.B \-f +.I script +] [ +.B \-d[isplay] +.I display +] +.\".ll -8 +.LP +.B xtrapchar +[ +.B \-v +] [ +.B \-d[isplay] +.I display +] +.LP +.B xtrapproto +[ +.B \-d[isplay] +.I display +] +.SH DESCRIPTION +.LP +These commands are +.B "SAMPLE CLIENTS" +provided with the XTrap X Server Extension +Sources, Version 3.3. +XTrap is an X Server +extension which facilitates the capturing of server protocol and synthesizing +core input events. +Information on how to obtain these sources can be +found in the SOURCES section below. +.LP +The +.B xtrapreset +command +is the simplest XTrap client in that it merely performs an XQueryExtension() +against XTrap. The name "reset" is historical. The +.I display +argument is parsed by the X Toolkit and specifies the display where XTrap is +to be loaded; see X(1). +.LP +.B xtrapinfo +displays general configuration information as a result of an GetAvailable +XTrap request to the specified server. It is simply designed to test the +request/response mechanism of the XTrap extension and client library as +well as display the configuration information that it finds. +.LP +.B xtrapstats +tests the event and request vectoring of the server extension by configuring +XTrap to collect usage statistics on all core input events and requests. It +has a primitive command-line interface for showing the counters, zeroing +out the counters, and quitting the program. +.LP +.B xtrapout +tests the output transport from the XTrap extension to the XTrap client +library. +As an aside, since xtrapout has the capability of "recording" events and +requests it receives, +.B xtrapout +is ideal for providing input to test +.B xtrapin. +Since events are the only concern for the input transport, the \-e flag can +be specified to indicate that all input events (and only events) should be +recorded by +.B xtrapout. +.I script +is specified primarily for non-U*IX machines which don't support I/O +re-direction easily. +The \-v flag is used to force recording of all requests and input events. +.LP +.B xtrapin +is used to test the input transport to the XTrap server extension. As stated +earler, it's input can be provided by +.B xtrapout +using the \-e qualifer. While it's primary function is for testing XTrap +and serving as an example for XTrap functionality, it can reasonably used as +a primitive "playback" client for X sessions. +.LP +.B xtrapchar +parses ANSI character sequences including application program sequences to +synthesize input events to X Window servers using the XTrap server extension. +The intent of this program is to serve as a sample implementation for +interfacing character-based alternative input sources into X servers (e.g. +voice recognition systems). Another application might be "remote keyboards". +The -v flag causes the program to display XTrap configuration information +and echo's characters processed to stdout. If present, this must be the +first argument. +.LP +Note: +.B xtrapchar +has only been used with Digital Workstations using the +LK201 compatible keyboard. Though reasonable effort was done to maintain +portability, no claims are made as to the current level of portability to +non-DEC servers for this program. +.LP +The +.B xtrapproto +command +is a regression test designed to test the basic XTrap protocol between a +client and server. If a given implementation is suspect, the results of +this test should be sent to an XTrap implementor and/or developer. +.SH OPTIONS +.PP +.TP 4 +.B "-d[isplay] \fIdisplay\fP" +Specifies the server to record from or playback to; see +.PN X(1). +.PP +.TP 4 +.B "-e" +Record only (and all) events. Should be used when creating input for +.PN xtrapin. +.PP +.TP 4 +.B "-f \fIscript\fP" +The pathname of the script to be recorded / played back. +.PP +.TP 4 +.B "-v" +Verbose mode. +.LP +.SH DIAGNOSTICS +.LP +.B "X Toolkit Error: Can't load DEC-XTRAP extension" +.PP +The XTrap X server extension has not been linked into the specified X +server. +.SH SOURCES +.LP +.EX +Sources have been posted on UseNet systems via anonymous ftp. +They are: +East Coast (USA): export@lcs.mit.edu:contrib/XTrap_v32*.tar.Z +West Coast (USA): gatekeeper@pa.dec.com:X11/contrib/XTrap_v32*.tar.Z + +.SH IMPORTANT NOTE +.LP +.EX +Digital participated in the X Consortium's xtest working group which +chose to evolve XTrap functionality into a new extension for X11/R6 +known as the RECORD extension (XTrap input synthesis functionality is +currently covered by the XTEST extension). It is strongly suggested +that users of XTrap technology begin developing against RECORD/XTEST +as it is the intention of the X Consortium to drive these two extensions +in the standards process for providing the protocol capturing/synthesis +functionality. Some members of the xtest working group are actively +researching migration issues between XTrap and RECORD. If you'd like +to contribute, please participate! Contact your local X Consortium Rep +for details on how to be added to the xtest mailing list. + +If you encounter problems, have questions, etc. with XTrap, please contact +via mail, phone, etc. at: + + Ken Miller + miller@zk3.dec.com + (VOICE) 603-881-6221 + (FAX) 603 881-2257 + +or paper mail at: + + Digital Equipment Corp. + Ken Miller @ ZKO3-3/Y25 + 110 Spitbrook Rd. + Nashua, NH 03062 + +Naturally email is preferred and will get the fastest response. +.EE +.SH SEE ALSO +X(1) +.NXE "X" + Index: xc/programs/xtrap/xtrapchar.c diff -u /dev/null xc/programs/xtrap/xtrapchar.c:1.3 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/xtrapchar.c Tue Dec 11 19:43:50 2001 @@ -0,0 +1,733 @@ +/* $XFree86: xc/programs/xtrap/xtrapchar.c,v 1.3 2001/12/12 00:43:50 dawes Exp $ */ +/* + * @DEC_COPYRIGHT@ + */ +/* + * HISTORY + * Log: xtrapchar.c,v $ + * Revision 1.1.2.2 1993/12/14 12:37:15 Kenneth_Miller + * ANSI-standardize code and turn client build on + * [1993/12/09 20:15:33 Kenneth_Miller] + * + * EndLog$ + */ +#if !defined(lint) && 0 +static char *rcsid = "@(#)RCSfile: xtrapchar.c,v $ Revision: 1.1.2.2 $ (DEC) Date: 1993/12/14 12:37:15 $"; +#endif +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1993 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +#define ProgName "xtrapchar" +/* +**++ +** FACILITY: xtrapchar - Converts ANSI character sequences to X. +** +** MODULE DESCRIPTION: +** +** Parses ANSI character sequences including application program +** sequences to synthesize input events to X Window servers +** using the XTrap server extension. Additionally, this main +** module is designed to be used with the voice +** recognition systems which will allow voice input into X Servers. +** +** AUTHORS: +** +** Kenneth B. Miller +** +** CREATION DATE: March 23, 1991 +** +** DESIGN ISSUES: +** +** Accepts non-buffered Ascii characters as input and +** performs a table look-up to determine what the corresponding +** X actions are to be performed. +** +** Uses chparse() which was contributed to DECUS C by Roy +** Lomicka and later revised by Martin Minow and myself. +** Also, getopt() is used to parse the command +** line arguments prior to calling XtAppInitialize(). +** Currently only the -v argument is supported to indicate +** echoing of characters received for debugging +** purposes. +** +** +** CAVEAT: +** +** This program has *only* been used with Digital Workstations +** using the LK201 compatible keyboard. Though reasonable +** effort was done to maintain portability, no claims are made +** as to the current level of portability to non-DEC servers +** for this program. +**-- +*/ +#include +#include +#include +#include +#include +#include + +#include "chparse.h" + +#ifndef vaxc +#define globalref extern +#endif + /* Special private indicators */ +#define BPRESS '!' +#define BRELEASE '"' +#define BCLICK '#' +#define APRESS '$' +#define ARELEASE '%' +#define CPRESS '(' +#define CRELEASE ')' +#define SPRESS '+' +#define SRELEASE '-' +#define DPRIVATE '=' +#define MNOTIFY '>' +#define RMNOTIFY '?' + +#define NPARAM 8 +#define NINTER 8 +#define NUL 0x00 +#define CAN 0x18 +#define SUB 0x1A +#define ESC 0x1B +#define DEL 0x7F +#define SS3 0x8f +#define DCS 0x90 +#define CSI 0x9B +#define ST 0x9C +#define OSC 0x9D +#define PM 0x9E +#define APC 0x9F + +static BOOL verbose_flag = FALSE; +static INT16 column = 0; +static int state = NUL; /* Parser state (n.z. if incomplete) */ +static Window root; +static BOOL passive_shift; /* Cap's assumed? */ +static BOOL passive_ctrl; /* Control key assumed? */ +static BOOL shift; /* Cap's on? */ +static BOOL ctrl; /* Control key? */ +static BOOL alt; /* Alt key? */ +KeyCode alt_code; +KeyCode ctrl_code; +KeyCode shift_code; + + + +#define _AdjustCol(length) \ + if ((column += length) >= 79) \ + { \ + printf("\n"); \ + column = length; \ + } + +static void KeyClick(XETC *tc, KeyCode keycode) +{ + if (passive_ctrl && !ctrl) + { + XESimulateXEventRequest(tc, KeyPress, ctrl_code, 0, 0, 0); + } + if (passive_shift && !shift) + { + XESimulateXEventRequest(tc, KeyPress, shift_code, 0, 0, 0); + } + XESimulateXEventRequest(tc, KeyPress, keycode, 0, 0, 0); + XESimulateXEventRequest(tc, KeyRelease, keycode, 0, 0, 0); + if (passive_shift && !shift) + { + XESimulateXEventRequest(tc, KeyRelease, shift_code, 0, 0, 0); + } + if (passive_ctrl && !ctrl) + { + XESimulateXEventRequest(tc, KeyRelease, ctrl_code, 0, 0, 0); + } + passive_ctrl = passive_shift = FALSE; /* Action's been completed */ +} + + +/* +** +** FORWARD DECLARATIONS +** +*/ +static int get_csi_key ( XETC *tc , int private , int param [], + int nparam , int inter [], int ninter , int final ); +static int get_ss3_key ( XETC *tc , int private , int param [], + int nparam , int inter [], int ninter , int final ); +static void send_special ( XETC *tc , int private , int param [], + int nparam , int inter [], int ninter , int final ); +static KeyCode get_typical_char ( XETC *tc , CARD32 keysym); +static KeyCode get_keycode ( XETC *tc , KeySym keysym); + + +int +main(int argc, char *argv[]) +{ + Widget appW; + Display *dpy; + XETrapGetCurRep ret_cur; + XETC *tc; + XtAppContext app; + char *tmp = NULL; + INT16 ch; + INT16 i; + KeyCode keycode; + /* ESC & CSI Parsing variables */ + int max_delay = 3; + int rest_delay = 2; + int private; /* Sequence private char, 'X' if error */ + int param[NPARAM]; /* numeric param, starting at param[1] */ + int nparam; /* Number of parameters */ + int inter[NINTER]; /* intermediate char, starting at [1] */ + int ninter; /* Number of intermediates */ + int final; /* Sequence terminator */ + int *popterr; +#ifndef vms + popterr = &opterr; +#else + popterr = XEgetopterr(); +#endif + *popterr = 0; /* don't complain about -d for display */ + while ((ch = getopt(argc, argv, "d:v")) != EOF) + { + switch(ch) + { + case 'v': + verbose_flag = TRUE; + break; + case 'd': /* -display, let's let the toolkit parse it */ + break; + default: + break; + } + } + appW = XtAppInitialize(&app,"XTrap",(XrmOptionDescList)NULL,(Cardinal)0L, + (int *)&argc, (String *)argv, NULL,(ArgList)&tmp, + (Cardinal)0); + + dpy = XtDisplay(appW); + if (verbose_flag) + { + printf("Display: %s \n", DisplayString(dpy)); + } + if ((tc = XECreateTC(dpy,0L, NULL)) == False) + { + fprintf(stderr,"%s: could not initialize XTrap extension\n", ProgName); + exit (1L); + } + root = RootWindow(dpy,DefaultScreen(dpy)); + (void)XEStartTrapRequest(tc); + alt_code = XKeysymToKeycode(tc->dpy,XK_Alt_L); + ctrl_code = XKeysymToKeycode(tc->dpy,XK_Control_L); + shift_code = XKeysymToKeycode(tc->dpy,XK_Shift_L); + + + + if (verbose_flag) + { + (void)XEGetCurrentRequest(tc,&ret_cur); + XEPrintCurrent(stderr,&ret_cur); + } + + column = 0; /* if displaying char's, don't go beyond 80 columns */ + + while ((ch = chparse(max_delay, rest_delay, &state, &private, param, + &nparam, inter, &ninter, &final)) != -1) + { + if (ch == -2) + { + continue; /* timeout condition */ + } + if ((!ferror(stdin)) && (!feof(stdin)) && (state == 0)) + { /* we got something */ + switch(ch) + { + case CSI: /* Control Sequence */ + keycode = get_csi_key(tc, private, param, nparam, inter, + ninter, final); + if (keycode) + KeyClick(tc, keycode); + break; + case SS3: /* Keypad stuff */ + keycode = get_ss3_key(tc, private, param, nparam, inter, + ninter, final); + if (keycode) + KeyClick(tc, keycode); + break; + case APC: /* Application Cmd (Button's, Press, Release) */ + send_special(tc, private, param, nparam, inter, ninter, + final); + break; + case ESC: /* Escape Sequence */ + /* send ESCAPE */ + if (!(keycode = XKeysymToKeycode(tc->dpy,XK_Escape))) + { /* must be an LK201 keyboard */ + BOOL orig_ctrl = ctrl; + /* + * the following is kind of strange. We need to + * have ctrl TRUE for get_typical_char() to + * report the verbose message correctly. We + * can't use passive_ctrl cause it resets it. + * Then, for KeyClick(), ctrl has to be FALSE + * and passive_ctrl has to be TRUE in order for + * us to get the desired [ to simulate + * an escape key. Once it's all done, we need + * to return ctrl to whatever it was and clear + * the passive_ctrl. + */ + ctrl = TRUE; /* for get_typical_char */ + keycode = get_typical_char(tc, (CARD32)'['); + ctrl = FALSE; /* for KeyClick */ + passive_ctrl = TRUE; /* for KeyClick */ + KeyClick(tc, keycode); + passive_ctrl = FALSE; /* to continue */ + ctrl = orig_ctrl; /* to continue */ + } + else + { + KeyClick(tc, keycode); + if (verbose_flag) + { + _AdjustCol(strlen("")); + printf(""); + } + } + /* send private (if valid) */ + if (private != NUL && private != 'X' && + (keycode = get_typical_char(tc, (CARD32)private))) + KeyClick(tc, keycode); + /* send addt'l parameters, if any */ + for (i = 1; i <= nparam; i++) + if ((keycode = get_typical_char(tc, (CARD32)param[i]))) + KeyClick(tc, keycode); + /* send intermediate's, if any */ + for (i = 1; i <= ninter; i++) + if ((keycode = get_typical_char(tc, (CARD32)inter[i]))) + KeyClick(tc, keycode); + /* send final character */ + if ((keycode = get_typical_char(tc, (CARD32)final))) + KeyClick(tc, keycode); + break; + + case DCS: /* We don't deal with these */ + case OSC: + case PM: + if (verbose_flag) + { + printf("Ignoring the following: "); + dumpsequence(state, ch, private, param, nparam, + inter, ninter, final, &column); + } + break; + default: /* typical character */ + keycode = get_typical_char(tc, (CARD32)ch); + if (keycode) + KeyClick(tc, keycode); + break; + } + } + else + { /* error? */ + if (ferror(stdin) || state != 0) + { + perror("Error occurred parsing input characters!\n"); + } + break; + } + } + /* Clean things up */ + XEFreeTC(tc); + (void)XCloseDisplay(dpy); + + exit(0L); +} + +static int get_csi_key(tc, private, param, nparam, inter, ninter, final) + XETC *tc; + int private; + int param[], nparam; + int inter[], ninter; + int final; +{ + KeySym keysym = 0; + switch(param[1]) + { + case 0: + switch ((char )final) + { + case 'A': keysym = XK_Up; break; + case 'B': keysym = XK_Down; break; + case 'C': keysym = XK_Right; break; + case 'D': keysym = XK_Left; break; + default: + dumpsequence(state, CSI, private, param, nparam, + inter, ninter, final, &column); + break; + } + break; + case 1: keysym = XK_Find; break; + case 2: keysym = XK_Insert; break; +#ifdef DXK_Remove + case 3: keysym = DXK_Remove; break; +#endif + case 4: keysym = XK_Select; break; + case 5: keysym = XK_Prior; break; + case 6: keysym = XK_Next; break; + case 17: keysym = XK_F6; break; + case 18: keysym = XK_F7; break; + case 19: keysym = XK_F8; break; + case 20: keysym = XK_F9; break; + case 21: keysym = XK_F10; break; + case 23: keysym = XK_F11; break; + case 24: keysym = XK_F12; break; + case 25: keysym = XK_F13; break; + case 26: keysym = XK_F14; break; + case 28: keysym = XK_Help; break; + case 29: keysym = XK_Menu; break; + case 31: keysym = XK_F17; break; + case 32: keysym = XK_F18; break; + case 33: keysym = XK_F19; break; + case 34: keysym = XK_F20; break; + default: + dumpsequence(state, CSI, private, param, nparam, + inter, ninter, final, &column); + } + + return(get_keycode(tc, keysym)); +} + + /* + * XTrap special sequences: + * ButtonPress: =!X (where 'X' is 'A', 'B', or 'C' + * for MB1, MB2, MB3 respectively) + * ButtonRelease: ="X (where 'X' is 'A', 'B', or 'C' + * for MB1, MB2, MB3 respectively) + * ButtonClick: =#X (where 'X' is 'A', 'B', or 'C' + * for MB1, MB2, MB3 respectively) + * AltPress: =$~ + * AltRelease: =%~ + * CtrlPress: =(~ + * CtrlRelease: =)~ + * ShiftPress: =+~ + * ShiftRelease: =-~ + * MotionNotify: >;X;Y~ (where 'X' is the X coord and 'Y' + * is the Y coord of the desired + * pointer position) + * Relative MotionNotify: + * ?;X;Y~ (where 'X' is the X coord and 'Y' + * is the Y coord of the desired + * pointer position) + * + */ +static void send_special(tc, private, param, nparam, inter, ninter, final) + XETC *tc; + int private; + int param[], nparam; + int inter[], ninter; + int final; +{ + switch(private) + { + case DPRIVATE: /* default APC */ + if (ninter != 1) + { /* Not my sequence */ + dumpsequence(state, APC, private, param, nparam, + inter, ninter, final, &column); + return; + } + else + { + switch(inter[1]) + { + Window rid, wid; + int x, y, wx, wy; + unsigned int sm; + CARD8 detail; + + case BPRESS: + detail = (final - 'A' + 1); + if ((Bool)XQueryPointer(tc->dpy,root,&rid,&wid,&x, + &y,&wx,&wy,&sm) == False) + { + fprintf(stderr, "\nPointer's not on screen 0!\n"); + } + else + { + XESimulateXEventRequest(tc, ButtonPress, detail, + x, y, 0); + if (verbose_flag) + { + _AdjustCol(strlen(" ")-1); + printf(" ", detail); + } + } + break; + case BRELEASE: + detail = (final - 'A' + 1); + if ((Bool)XQueryPointer(tc->dpy,root,&rid,&wid,&x, + &y,&wx,&wy,&sm) == False) + { + fprintf(stderr, "\nPointer's not on screen 0!\n"); + } + else + { + XESimulateXEventRequest(tc, ButtonRelease, detail, + x,y,0); + if (verbose_flag) + { + _AdjustCol(strlen(" ")-1); + printf(" ", detail); + } + } + break; + case BCLICK: + detail = (final - 'A' + 1); + if (XQueryPointer(tc->dpy,root,&rid,&wid,&x,&y, + &wx,&wy,&sm) + == False) + { + fprintf(stderr, "\nPointer's not on screen 0!\n"); + } + else + { + XESimulateXEventRequest(tc,ButtonPress, + detail,x,y,0); + XESimulateXEventRequest(tc,ButtonRelease, + detail,x,y,0); + if (verbose_flag) + { + _AdjustCol(strlen(" ")-1); + printf(" ", detail); + } + } + break; + case APRESS: + alt = TRUE; + XESimulateXEventRequest(tc,KeyPress,alt_code,0,0,0); + break; + case ARELEASE: + alt = FALSE; + XESimulateXEventRequest(tc,KeyRelease,alt_code,0,0,0); + break; + case SPRESS: + shift = TRUE; + XESimulateXEventRequest(tc,KeyPress,shift_code,0,0,0); + break; + case SRELEASE: + shift = FALSE; + XESimulateXEventRequest(tc,KeyRelease,shift_code, + 0,0,0); + break; + case CPRESS: + ctrl = TRUE; + XESimulateXEventRequest(tc,KeyPress,ctrl_code,0,0,0); + break; + case CRELEASE: + ctrl = FALSE; + XESimulateXEventRequest(tc,KeyRelease,ctrl_code,0,0,0); + break; + default: + fprintf(stderr, "\nInvalid Sequence!\n"); + dumpsequence(state, APC, private, param, nparam, + inter, ninter, final, &column); + } + } + break; + case MNOTIFY: + if (nparam != 3) + { /* Not my sequence */ + dumpsequence(state, APC, private, param, nparam, + inter, ninter, final, &column); + return; + } + else + { + int x, y; + + x = param[2]; + y = param[3]; + XESimulateXEventRequest(tc,MotionNotify,0,x,y,0); + if (verbose_flag) + { + _AdjustCol(strlen(" ")+3); + printf(" ",x,y); + } + } + break; + case RMNOTIFY: + if (nparam != 3) + { /* Not my sequence */ + dumpsequence(state, APC, private, param, nparam, + inter, ninter, final, &column); + return; + } + else + { + Window rid, wid; + int x, y, wx, wy; + unsigned int sm; + + if (XQueryPointer(tc->dpy,root,&rid,&wid,&x,&y,&wx,&wy,&sm) + == False) + { + fprintf(stderr, "\nPointer's not on screen 0!\n"); + } + else + { /* We're ready to go */ + x += param[2]; + y += param[3]; + XESimulateXEventRequest(tc,MotionNotify,0,x,y,0); + if (verbose_flag) + { + _AdjustCol(strlen(" ")); + printf(" ",x-param[2],param[3], + y-param[3],param[3]); + } + } + break; + default: + dumpsequence(state, APC, private, param, nparam, + inter, ninter, final, &column); + break; + } + } +} + +static int get_ss3_key(tc, private, param, nparam, inter, ninter, final) + XETC *tc; + int private; + int param[], nparam; + int inter[], ninter; + int final; +{ + KeySym keysym = 0; + switch(param[1]) + { + case 0: + switch ((char )final) + { + case 'A': keysym = XK_Up; break; + case 'B': keysym = XK_Down; break; + case 'C': keysym = XK_Right; break; + case 'D': keysym = XK_Left; break; + case 'p': keysym = XK_KP_0; break; + case 'q': keysym = XK_KP_1; break; + case 'r': keysym = XK_KP_2; break; + case 's': keysym = XK_KP_3; break; + case 't': keysym = XK_KP_4; break; + case 'u': keysym = XK_KP_5; break; + case 'v': keysym = XK_KP_6; break; + case 'w': keysym = XK_KP_7; break; + case 'x': keysym = XK_KP_8; break; + case 'y': keysym = XK_KP_9; break; + case 'm': keysym = XK_KP_Subtract; break; + case 'l': keysym = XK_KP_Separator; break; + case 'n': keysym = XK_KP_Decimal; break; + case 'M': keysym = XK_KP_Enter; break; + case 'P': keysym = XK_KP_F1; break; + case 'Q': keysym = XK_KP_F2; break; + case 'R': keysym = XK_KP_F3; break; + case 'S': keysym = XK_KP_F4; break; + default: + dumpsequence(state, SS3, private, param, nparam, + inter, ninter, final, &column); + break; + } + break; + } + + return(get_keycode(tc, keysym)); +} + +static KeyCode get_typical_char(tc, keysym) + XETC *tc; + CARD32 keysym; +{ + if (iscntrl(keysym)) + { + switch(keysym) + { + case 0x09: keysym = XK_Tab; break; + case 0x0d: keysym = XK_Return; break; + case 0x7f: keysym = XK_Delete; break; + case ESC: keysym = XK_Escape; break; + } + } + passive_shift = (keysym >= XK_A && keysym <= XK_Z) ? TRUE : FALSE; + switch(keysym) + { /* Special case shift's */ + case '!': case '"': case '@': case '#': case '$': + case '%': case '^': case '&': case '*': case '(': + case ')': case '_': case '+': case '{': case '}': + case '|': case ':': case '>': case '?': case '~': + passive_shift = TRUE; + } + + if (keysym >= 1 && keysym <= 26) + { + passive_ctrl = TRUE; + keysym += 'a' - 1; + } + else + { + passive_ctrl = FALSE; + } + + return(get_keycode(tc, keysym)); +} + +static KeyCode get_keycode(XETC *tc, KeySym keysym) +{ + char *keystr = (char *)XKeysymToString(keysym); + KeyCode keycode; + + keystr = (keystr == NULL) ? "unknown" : keystr; + if (verbose_flag) + { + if (shift || passive_shift) + { + _AdjustCol(strlen("")); + printf(""); + } + if (alt) + { + _AdjustCol(strlen("")); + printf(""); + } + if (ctrl || passive_ctrl) + { + _AdjustCol(strlen("")); + printf(""); + } + _AdjustCol(strlen(keystr)+1); + printf("%s ", keystr); + } + if (!(keycode = XKeysymToKeycode(tc->dpy,keysym))) + { + fprintf(stderr,"\n[%s ('%%0x%04x') returns bad Keycode, ignored]\n", + keystr, (unsigned int)keysym); + column = 0; + } + + return(keycode); +} Index: xc/programs/xtrap/xtrapin.c diff -u /dev/null xc/programs/xtrap/xtrapin.c:1.2 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/xtrapin.c Tue Dec 11 19:43:50 2001 @@ -0,0 +1,272 @@ +/* $XFree86: xc/programs/xtrap/xtrapin.c,v 1.2 2001/12/12 00:43:50 dawes Exp $ */ +/* + * @DEC_COPYRIGHT@ + */ +/* + * HISTORY + * Log: xtrapin.c,v $ + * Revision 1.1.4.2 1993/12/14 12:37:20 Kenneth_Miller + * ANSI-standardize code and turn client build on + * [1993/12/09 20:15:45 Kenneth_Miller] + * + * Revision 1.1.2.2 1992/04/27 13:51:39 Leela_Obilichetti + * Initial load of xtrap clients - from silver BL6 + * [92/04/27 13:49:16 Leela_Obilichetti] + * + * EndLog$ + */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ +#define ProgName "xtrapin" +/* +**++ +** FACILITY: xtrapin - Sample client to test input to XTrap extension +** +** MODULE DESCRIPTION: +** +** This is the main module for a sample/test client +** for the XTrap X11 Server Extension. It accepts +** a script file and a transport method as input +** in addition to the standard X arguments (-d, etc.). +** If no script file is provided, stdin is the default +** and can be piped from the companion "xtrapout" +** client (normally used with the -e argument which +** sends all core input events to stdout). +** +** +** AUTHORS: +** +** Kenneth B. Miller +** +** CREATION DATE: December 15, 1990 +** +** DESIGN ISSUES: +** +** See the companion "xtrapout" client. +** +** Also, getopt() is used to parse the command +** line arguments prior to calling XtAppInitialize(). +** This is because DECwindows appears to remove the user- +** defined arguments from the argv[] vector without actually +** acting upon them. +** +** +**-- +*/ +#include +#include +#include +#include +#include + +#ifndef vaxc +#define globalref extern +#endif + +static Boolean grabFlag = False; + +FILE *ifp; +XrmOptionDescRec optionTable [] = +{ + {"-f", "*script", XrmoptionSepArg, (caddr_t) NULL}, + {"-g", "*grabServer",XrmoptionSkipArg, (caddr_t) NULL}, +}; + +typedef struct +{ /* longword-align fields for arg passing */ + Time ts; + int type; + int detail; + int x; + int y; + int screen; /* this will always be 0 till vectored events! */ +} file_rec; + +/* Forward declarations */ +static Bool found_input_rec (FILE *ifp , file_rec *rec ); + +static Widget appW; +static Display *dpy; + + +int +main(int argc, char *argv[]) +{ + XETrapGetAvailRep ret_avail; + XETrapGetCurRep ret_cur; + XETC *tc; + XtAppContext app; + char *tmp = NULL; + INT16 ch; + file_rec rec; + Time last_time = 0L; + int *popterr; + char **poptarg; +#ifndef vms + popterr = &opterr; + poptarg = &optarg; +#else + popterr = XEgetopterr(); + poptarg = XEgetoptarg(); +#endif + + ifp = NULL; + *popterr = 0; /* don't complain about -d for display */ + grabFlag = False; + while ((ch = getopt(argc, argv, "d:f:g")) != EOF) + { + switch(ch) + { + case 'f': + if ((ifp = fopen(*poptarg,"rb")) == NULL) + { /* can't open it */ + fprintf(stderr,"%s: could not open output file '%s'!\n", + ProgName, *poptarg); + } + break; + case 'd': /* -display, let's let the toolkit parse it */ + break; + case 'g': + grabFlag = True; + default: + break; + } + } + ifp = (ifp ? ifp : stdin); + + appW = XtAppInitialize(&app,"XTrap",optionTable,(Cardinal)1L, + (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, + (Cardinal)NULL); + + dpy = XtDisplay(appW); +#ifdef DEBUG + XSynchronize(dpy, True); +#endif + printf("Display: %s \n", DisplayString(dpy)); + + if ((tc = XECreateTC(dpy,0L, NULL)) == False) + { + fprintf(stderr,"%s: could not initialize XTrap extension\n", ProgName); + exit (1L); + } + (void)XEGetAvailableRequest(tc,&ret_avail); + XEPrintAvail(stderr,&ret_avail); + XEPrintTkFlags(stderr,tc); + + if (grabFlag == True) + { /* + * In order to ignore GrabServer's we must configure at least one + * trap. Let's make it X_GrabServer. We don't have to receive + * a callback, though. + */ + ReqFlags requests; + (void)memset(requests,0L,sizeof(requests)); + BitTrue(requests, X_GrabServer); + XETrapSetRequests(tc, True, requests); + (void)XETrapSetGrabServer(tc, True); + } + + (void)XEStartTrapRequest(tc); + (void)XEGetCurrentRequest(tc,&ret_cur); + XEPrintCurrent(stderr,&ret_cur); + + /* Open up script file */ + while (found_input_rec(ifp,&rec) == True) + { + /* if not pipe'd, delay time delta time recorded */ + if (ifp != stdin) + { + register INT32 delta, t1, t2; + last_time = (last_time ? last_time : rec.ts); /* first rec */ + rec.ts = (rec.ts ? rec.ts : last_time); /* dual monitor bug! */ + t1 = rec.ts; t2 = last_time; /* move to signed variables */ + delta = abs(t1 - t2); /* protect from clock roll-over */ + msleep(delta); + last_time = rec.ts; + } + XESimulateXEventRequest(tc, rec.type, rec.detail, rec.x, rec.y, + rec.screen); + } + + (void)XCloseDisplay(dpy); + exit(0L); +} + +static Bool found_input_rec(FILE *ifp, file_rec *rec) +{ + int found = False; + char buff[BUFSIZ]; + char junk[16L]; + int match; + int tmp[8L]; + + while ((found != True) && (fgets(buff,BUFSIZ,ifp) != NULL)) + { + if (!strncmp(buff, "Event:", strlen("Event:"))) + { /* we want this record */ + if ((match = sscanf(buff, + "Event: %s (%d):det=%d scr=%d (%d,%d) root=%d Msk=%d TS=%d\n", + junk, &(tmp[0L]), &(tmp[1L]), &(tmp[2L]), &(tmp[3L]), + &(tmp[4L]), &(tmp[5L]), &(tmp[6L]), &(tmp[7L]))) != 9L) + { + fprintf(stderr, "%s: Error parsing script input!\n\t'%s'\n", + ProgName, buff); + } + else + { + found = True; + /* Sun's have problems with "byte" fields passed to scanf */ + rec->type = tmp[0L]; + rec->detail = tmp[1L]; + rec->screen = tmp[2L]; + rec->x = tmp[3L]; + rec->y = tmp[4L]; + rec->ts = tmp[7L]; + } + } + else if (!strncmp(buff, "Request:", strlen("Request:"))) + { /* a valid thing to see */ + continue; + } + else + { /* this stuff doesn't look like what we'd expect */ + fprintf(stderr, "%s: Not a valid script record!\n\t'%s'\n", + ProgName, buff); + } + } + + return(found); +} + Index: xc/programs/xtrap/xtrapinfo.c diff -u /dev/null xc/programs/xtrap/xtrapinfo.c:1.1 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/xtrapinfo.c Fri Nov 2 18:29:34 2001 @@ -0,0 +1,87 @@ +/* $XFree86: xc/programs/xtrap/xtrapinfo.c,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ +/* + * @DEC_COPYRIGHT@ + */ +/* + * HISTORY + * Log: xtrapinfo.c,v $ + * Revision 1.1.4.2 1993/12/14 12:37:24 Kenneth_Miller + * ANSI-standardize code and turn client build on + * [1993/12/09 20:15:55 Kenneth_Miller] + * + * Revision 1.1.2.2 1992/04/27 13:51:50 Leela_Obilichetti + * initial load of xtrap clients - from silver BL6 pool + * [92/04/27 13:49:24 Leela_Obilichetti] + * + * EndLog$ + */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ +#include +#include +#include + +int +main(int argc, char *argv[]) +{ + static Widget appW; + XtAppContext app; + char *tmp = NULL; + XETrapGetAvailRep ret_avail; + XETC *tc; + Display *dpy; + + /* Connect to Server */ + appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L, + (int *)&argc, (String *)argv, (String *)NULL, (ArgList)&tmp, + (Cardinal)NULL); + dpy = XtDisplay(appW); +#ifdef DEBUG + XSynchronize(dpy, True); +#endif + printf("Display: %s \n", DisplayString(dpy)); + if ((tc = XECreateTC(dpy,0L, NULL)) == False) + { + fprintf(stderr,"%s: could not initialize extension\n",argv[0]); + exit(1L); + } + + (void)XEGetAvailableRequest(tc,&ret_avail); + (void)XEPrintAvail(stdout,&ret_avail); + + (void)XCloseDisplay(dpy); + exit(0L); +} Index: xc/programs/xtrap/xtrapout.c diff -u /dev/null xc/programs/xtrap/xtrapout.c:1.2 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/xtrapout.c Tue Dec 11 19:43:50 2001 @@ -0,0 +1,287 @@ +/* $XFree86: xc/programs/xtrap/xtrapout.c,v 1.2 2001/12/12 00:43:50 dawes Exp $ */ +/* + * @DEC_COPYRIGHT@ + */ +/* + * HISTORY + * Log: xtrapout.c,v $ + * Revision 1.1.4.2 1993/12/14 12:37:28 Kenneth_Miller + * ANSI-standardize code and turn client build on + * [1993/12/09 20:16:01 Kenneth_Miller] + * + * Revision 1.1.2.2 1992/04/27 13:51:57 Leela_Obilichetti + * initial load of xtrap clients - from silver BL6 pool + * [92/04/27 13:49:33 Leela_Obilichetti] + * + * EndLog$ + */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1993 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ +#define ProgName "xtrapout" +/* +**++ +** FACILITY: xtrapout - Sample client to test output from XTrap extension +** +** MODULE DESCRIPTION: +** +** This is the main module for a sample/test client +** for the XTrap X11 Server Extension. It accepts +** a script output file, a transport method, +** and an "events mode" flag (-e) as input, +** in addition to the standard X arguments (-d, etc.). +** If no script file is provided, stdout is the default +** and can be piped to the companion "xtrapin" +** client (normally used with the -e argument which +** sends all core input events to stdout). +** +** +** AUTHORS: +** +** Kenneth B. Miller +** +** CREATION DATE: March 28, 1990 +** +** DESIGN ISSUES: +** +** See the companion "xtrapin" client. +** +** Also, getopt() is used to parse the command +** line arguments prior to calling XtAppInitialize(). +** This is because DECwindows appears to remove the user- +** defined arguments from the argv[] vector without actually +** acting upon them. +** +** +**-- +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "XEKeybCtrl.h" + +#ifndef vaxc +#define globalref extern +#endif + + +/* Forward declarations */ +static void SetGlobalDone (void ); +static void print_req_callback (XETC *tc , XETrapDatum *data , + char *my_buf ); +static void print_evt_callback (XETC *tc , XETrapDatum *data , + char *my_buf ); + + +FILE *ofp; +Bool GlobalDone = False; +XrmOptionDescRec optionTable [] = +{ + {"-f", "*script", XrmoptionSepArg, (caddr_t) NULL}, + {"-e", "*eventFlag", XrmoptionSkipArg, (caddr_t) NULL}, + {"-v", "*verbose", XrmoptionSkipArg, (caddr_t) NULL}, +}; + +static void SetGlobalDone(void) +{ + GlobalDone = 1L; + fprintf(stderr,"Process Completed!\n"); + return; +} + +static void print_req_callback(XETC *tc, XETrapDatum *data, char *my_buf) +{ + char *req_type; + req_type = (data->u.req.reqType == XETrapGetExtOpcode(tc) ? "XTrap" : + XERequestIDToString(data->u.req.reqType,tc)); + fprintf(ofp,"Request: %-19s (%d): length '%ld' client '%d' window=%ld\n", + req_type, data->u.req.reqType, (long)data->hdr.count, data->hdr.client, + (long)data->u.req.id); +} + +static void print_evt_callback(XETC *tc, XETrapDatum *data, char *my_buf) +{ + static Time last_time = 0; + int delta; + + delta = abs((int)last_time ? data->u.event.u.keyButtonPointer.time - + (int)last_time : (int)last_time); + last_time = data->u.event.u.keyButtonPointer.time; + + /* The "screen" and "root" fields aren't valid until "event" + * vectoring becomes a reality. Currently, XTrap intercepts + * the core events prior to when fields other than rootX, rootY, + * type, detail, time, and state are filled in. This will be + * addressed in the next release of XTrap (3.2?). + */ + fprintf(ofp, + "Event: %-15s (%d):det=%d scr=%d (%d,%d) root=%d Msk=%d TS=%d\n", + XEEventIDToString(data->u.event.u.u.type,tc), data->u.event.u.u.type, + data->u.event.u.u.detail, data->hdr.screen, /* Not really valid yet */ + data->u.event.u.keyButtonPointer.rootX, + data->u.event.u.keyButtonPointer.rootY, + (int)data->u.event.u.keyButtonPointer.root, /* Not really valid yet */ + (int)data->u.event.u.keyButtonPointer.state, + (int)delta); + fflush(ofp); +} +static Boolean eventFlag = False; +static Boolean verboseFlag = False; +static Widget appW; +static Display *dpy; + +int +main(int argc, char *argv[]) +{ + XETrapGetAvailRep ret_avail; + XETrapGetCurRep ret_cur; + XETC *tc; + ReqFlags requests; + EventFlags events; + XtAppContext app; + char *tmp = NULL; + INT16 ch; + int *popterr; + char **poptarg; +#ifndef vms + popterr = &opterr; + poptarg = &optarg; +#else + popterr = XEgetopterr(); + poptarg = XEgetoptarg(); +#endif + + eventFlag = False; + ofp = NULL; + *popterr = 0; /* don't complain about -d (display) */ + while ((ch = getopt(argc, argv, "d:evf:")) != EOF) + { + switch(ch) + { + case 'e': + eventFlag = True; + break; + case 'v': + verboseFlag = True; + break; + case 'f': + if ((ofp = fopen(*poptarg,"wb")) == NULL) + { /* can't open it */ + fprintf(stderr,"%s: could not open output file '%s'!\n", + ProgName, *poptarg); + } + break; + case 'd': /* -display, let's let the toolkit parse it */ + break; + default: + break; + } + } + ofp = (ofp ? ofp : stdout); + + appW = XtAppInitialize(&app,"XTrap",optionTable,(Cardinal)2L, + (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, + (Cardinal)NULL); + + dpy = XtDisplay(appW); +#ifdef DEBUG + XSynchronize(dpy, True); +#endif + fprintf(stderr,"Display: %s \n", DisplayString(dpy)); + if ((tc = XECreateTC(dpy,0L, NULL)) == False) + { + fprintf(stderr,"%s: could not initialize XTrap extension\n",ProgName); + exit (1L); + } + XETrapSetTimestamps(tc,True, False); + (void)XEGetAvailableRequest(tc,&ret_avail); + XEPrintAvail(stderr,&ret_avail); + XEPrintTkFlags(stderr,tc); + + /* Need to prime events/requests initially turning all off */ + (void)memset(requests,0L,sizeof(requests)); + (void)memset(events,0L,sizeof(events)); + /* Now turn on the ones you really want */ + (void)memset(events,0xFFL,XETrapMaxEvent); + if (eventFlag == False) + { /* doesn't want just events */ + (void)memset(requests,0xFFL,XETrapMaxRequest); + /* Turn off XTrap Requests for multi-client regression tests & XLib */ + BitFalse(requests, XETrapGetExtOpcode(tc)); + /* Turn off noisy events */ + BitFalse(events, MotionNotify); + } + if (verboseFlag == True) + { /* want's *all* requests/events */ + (void)memset(requests,0xFFL,XETrapMaxRequest); + (void)memset(events,0xFFL,XETrapMaxEvent); + } + /* Tell the TC about it */ + XETrapSetRequests(tc, True, requests); + XETrapSetEvents(tc, True, events); + XETrapSetMaxPacket(tc, True, XETrapMinPktSize); /* just get the minimum */ + + /* Set up callbacks for data */ + XEAddRequestCBs(tc, requests, print_req_callback, NULL); + XEAddEventCBs(tc, events, print_evt_callback, NULL); + + (void)XEStartTrapRequest(tc); + (void)XEGetCurrentRequest(tc,&ret_cur); + XEPrintCurrent(stderr,&ret_cur); + + /* Add signal handlers so that we clean up properly */ + _InitExceptionHandling((void_function)SetGlobalDone); + (void)XEEnableCtrlKeys((void_function)SetGlobalDone); + + XETrapAppWhileLoop(app,tc,&GlobalDone); + + /* Make sure key is released */ + XESimulateXEventRequest(tc, KeyRelease, + XKeysymToKeycode(dpy, XK_Control_L), 0L, 0L, 0L); + + /* close down everything nicely */ + XEFreeTC(tc); + (void)XCloseDisplay(dpy); + (void)XEClearCtrlKeys(); + _ClearExceptionHandling(); + exit(0L); +} + Index: xc/programs/xtrap/xtrapproto.c diff -u /dev/null xc/programs/xtrap/xtrapproto.c:1.2 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/xtrapproto.c Wed Nov 7 23:00:15 2001 @@ -0,0 +1,109 @@ +/* $XFree86: xc/programs/xtrap/xtrapproto.c,v 1.2 2001/11/08 04:00:15 tsi Exp $ */ +/* + * @DEC_COPYRIGHT@ + */ +/* + * HISTORY + * Log: xtrapproto.c,v $ + * Revision 1.1.2.2 1993/12/14 12:37:32 Kenneth_Miller + * ANSI-standardize code and turn client build on + * [1993/12/09 20:16:08 Kenneth_Miller] + * + * EndLog$ + */ +#if !defined(lint) && 0 +static char *rcsid = "@(#)RCSfile: xtrapproto.c,v $ Revision: 1.1.2.2 $ (DEC) Date: 1993/12/14 12:37:32 $"; +#endif +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ +#include +#include +#include + + +int +main(int argc, char *argv[]) +{ + static Widget appW; + XtAppContext app; + char *tmp = NULL; + XETrapGetAvailRep ret_avail; + XETrapGetCurRep ret_cur; + XETrapGetStatsRep ret_stats; + XETrapGetVersRep ret_vers; + XETrapGetLastInpTimeRep ret_time; + XETC *tc; + Display *dpy; + Boolean status = True; + + /* Connect to Server */ + appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L, + (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, + (Cardinal)NULL); + dpy = XtDisplay(appW); + printf("Display: %s \n", DisplayString(dpy)); + if ((tc = XECreateTC(dpy,0L, NULL)) == False) + { + fprintf(stderr,"%s: could not initialize extension\n",argv[0]); + exit(1L); + } + XSynchronize(dpy, True); + status = XEResetRequest(tc); + status = XEGetAvailableRequest(tc,&ret_avail); + XEPrintAvail(stdout,&ret_avail); + status = XEGetCurrentRequest(tc,&ret_cur); + XEPrintCurrent(stderr,&ret_cur); + XETrapSetStatistics(tc, True); /* trigger config and def stats */ + status = XEFlushConfig(tc); + status = XEGetStatisticsRequest(tc, &ret_stats); + XEPrintStatistics(stdout, &ret_stats,tc); + status = XEStartTrapRequest(tc); + status = XESimulateXEventRequest(tc, MotionNotify, 0, 10L, 20L, 0L); + status = XEStopTrapRequest(tc); + if (tc->protocol == 31) + { /* didn't work in V3.1 */ + printf("XEGetVersionRequest() & XEGetLastInpTimeRequest() are\n"); + printf("broken using the V3.1 protocol!\n"); + } + else + { + status = XEGetVersionRequest(tc,&ret_vers); + status = XEGetLastInpTimeRequest(tc, &ret_time); + } + XEFreeTC(tc); + (void)XCloseDisplay(dpy); + exit(0L); +} Index: xc/programs/xtrap/xtrapreset.c diff -u /dev/null xc/programs/xtrap/xtrapreset.c:1.1 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/xtrapreset.c Fri Nov 2 18:29:34 2001 @@ -0,0 +1,84 @@ +/* $XFree86: xc/programs/xtrap/xtrapreset.c,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ +/* + * @DEC_COPYRIGHT@ + */ +/* + * HISTORY + * Log: xtrapreset.c,v $ + * Revision 1.1.4.2 1993/12/14 12:37:37 Kenneth_Miller + * ANSI-standardize code and turn client build on + * [1993/12/09 20:16:13 Kenneth_Miller] + * + * Revision 1.1.2.2 1992/04/27 13:52:06 Leela_Obilichetti + * initial load of xtrap clients - from silver BL6 pool + * [92/04/27 13:49:41 Leela_Obilichetti] + * + * EndLog$ + */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ +#include +#include +#include + +int +main(int argc, char *argv[]) +{ + Widget appW; + XtAppContext app; + Display *dpy; + XETC *tc; + char *tmp = NULL; + + /* Connect to Server */ + appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L, + (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, + (Cardinal)NULL); + dpy = XtDisplay(appW); +#ifdef DEBUG + XSynchronize(dpy, True); +#endif + printf("Resetting Display: %s \n", DisplayString(dpy)); + + if ((tc = XECreateTC(dpy,0L, NULL)) == False) + { + fprintf(stderr,"%s: could not initialize extension\n",argv[0]); + exit (1L); + } + XEResetRequest(tc); + XCloseDisplay(dpy); + exit (0); +} Index: xc/programs/xtrap/xtrapstats.c diff -u /dev/null xc/programs/xtrap/xtrapstats.c:1.1 --- /dev/null Fri Jan 18 15:27:43 2002 +++ xc/programs/xtrap/xtrapstats.c Fri Nov 2 18:29:34 2001 @@ -0,0 +1,133 @@ +/* $XFree86: xc/programs/xtrap/xtrapstats.c,v 1.1 2001/11/02 23:29:34 dawes Exp $ */ +/* + * @DEC_COPYRIGHT@ + */ +/* + * HISTORY + * Log: xtrapstats.c,v $ + * Revision 1.1.4.2 1993/12/14 12:37:41 Kenneth_Miller + * ANSI-standardize code and turn client build on + * [1993/12/09 20:16:19 Kenneth_Miller] + * + * Revision 1.1.2.2 1992/04/27 13:52:12 Leela_Obilichetti + * initial load of xtrap clients - from silver BL6 pool + * [92/04/27 13:49:48 Leela_Obilichetti] + * + * EndLog$ + */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ +#include +#include +#include +#include + +int +main(int argc, char *argv[]) +{ + XETrapGetAvailRep ret_avail; + XETrapGetStatsRep ret_stats; + Widget appW; + XtAppContext app; + char *tmp = NULL; + XETC *tc; + Display *dpy; + Bool done; + char buffer[10]; + ReqFlags requests; + EventFlags events; + int i; + + /* Connect to Server */ + appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L, + (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, + (Cardinal)NULL); + dpy = XtDisplay(appW); +#ifdef DEBUG + XSynchronize(dpy, True); +#endif + printf("Display: %s \n", DisplayString(dpy)); + if ((tc = XECreateTC(dpy,0L, NULL)) == False) + { + fprintf(stderr,"%s: could not initialize extension\n",argv[0]); + exit(1L); + } + + (void)XEGetAvailableRequest(tc,&ret_avail); + if (BitIsFalse(ret_avail.valid, XETrapStatistics)) + { + printf("\nStatistics not available from '%s'.\n", + DisplayString(dpy)); + exit(1L); + } + XETrapSetStatistics(tc, True); + for (i=0; i<256L; i++) + { + BitTrue(requests, i); + } + XETrapSetRequests(tc, True, requests); + for (i=KeyPress; i<=MotionNotify; i++) + { + BitTrue(events, i); + } + XETrapSetEvents(tc, True, events); + done = False; + while(done == False) + { + fprintf(stderr,"Stats Command (Zero, Quit, [Show])? "); + fgets(buffer, sizeof(buffer), stdin); + switch(toupper(buffer[0])) + { + case '\n': /* Default command */ + case 'S': /* Request fresh counters & display */ + (void)XEGetStatisticsRequest(tc,&ret_stats); + (void)XEPrintStatistics(stdout,&ret_stats,tc); + break; + case 'Z': /* Zero out counters */ + XETrapSetStatistics(tc, False); + break; + case 'Q': + done = True; + break; + default: + printf("Invalid command, reenter!\n"); + break; + } + } + (void)XEFreeTC(tc); + (void)XCloseDisplay(dpy); + exit(0L); +} Index: xc/programs/xvidtune/xvidtune.c diff -u xc/programs/xvidtune/xvidtune.c:3.27 xc/programs/xvidtune/xvidtune.c:3.31 --- xc/programs/xvidtune/xvidtune.c:3.27 Thu Apr 5 22:16:26 2001 +++ xc/programs/xvidtune/xvidtune.c Sat Dec 8 13:53:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xvidtune/xvidtune.c,v 3.27 2001/04/06 02:16:26 dawes Exp $ */ +/* $XFree86: xc/programs/xvidtune/xvidtune.c,v 3.31 2001/12/08 18:53:17 herrb Exp $ */ /* @@ -53,6 +53,7 @@ int EventBase, ErrorBase; int dot_clock, mode_flags; unsigned long TestTimeout=5000; /* Default test timeout */ +XtSignalId sigId; /* Minimum extension version required */ #define MINMAJOR 0 @@ -159,6 +160,12 @@ static void CatchSig(int signal) { + XtNoticeSignal(sigId); +} + +static void +CatchXtSig(XtPointer closure, XtSignalId *id) +{ CleanUp(XtDisplay(Top)); exit(3); } @@ -754,7 +761,7 @@ static void BlankEditCB (Widget w, XtPointer client, XtPointer call) { - int i, len; + int len; char* string; fields findex = (fields) client; ScrollData* sdp = &AppRes.field[findex]; @@ -1425,6 +1432,7 @@ { fprintf(stderr, "Usage: xvidtune [option]\n"); fprintf(stderr, " where option is one of:\n"); + fprintf(stderr, " -show Print current modeline to stdout\n"); fprintf(stderr, " -next Switch to next video mode\n"); fprintf(stderr, " -prev Switch to previous video mode\n"); fprintf(stderr, " -unlock Enable mode switch hot-keys\n"); @@ -1439,7 +1447,6 @@ Widget top; XtAppContext app; Display* dpy; - int suspendTime, offTime; static XtActionsRec actions[] = { { "xvidtune-quit", QuitAction }, { "xvidtune-restore", RestoreAction }, @@ -1504,7 +1511,15 @@ if (argc != 2) usage(); - if (!strcmp(argv[1], "-next")) + if (!strcmp(argv[1], "-show")) { + if (!GetModeLine(XtDisplay (top), DefaultScreen (XtDisplay (top)))) { + fprintf(stderr, "Unable to get mode info\n"); + CleanUp(XtDisplay (top)); + return 2; + } + ShowCB(top, NULL, NULL); + return 0; + } else if (!strcmp(argv[1], "-next")) i = 1; else if (!strcmp(argv[1], "-prev")) i = -1; @@ -1536,6 +1551,7 @@ signal(SIGQUIT, CatchSig); signal(SIGTERM, CatchSig); signal(SIGHUP, CatchSig); + sigId = XtAppAddSignal(app, CatchXtSig, NULL); if (!GetModeLine(XtDisplay (top), DefaultScreen (XtDisplay (top)))) { fprintf(stderr, "Unable to get mode info\n"); Index: xc/programs/xvidtune/xvidtune.man diff -u xc/programs/xvidtune/xvidtune.man:3.13 xc/programs/xvidtune/xvidtune.man:3.14 --- xc/programs/xvidtune/xvidtune.man:3.13 Sat Jan 27 13:21:25 2001 +++ xc/programs/xvidtune/xvidtune.man Mon Aug 13 15:35:01 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/xvidtune/xvidtune.man,v 3.13 2001/01/27 18:21:25 dawes Exp $ +.\" $XFree86: xc/programs/xvidtune/xvidtune.man,v 3.14 2001/08/13 19:35:01 dawes Exp $ .\" .\" Copyright (c) 1995 Kaleb S. KEITHLEY .\" @@ -32,13 +32,14 @@ .SH SYNOPSIS .B xvidtune [ +.B -show +| .B -prev | .B -next | .B -unlock -| -] ] [ +] [ .I \-toolkitoption \&.\|.\|. ] .SH DESCRIPTION @@ -147,6 +148,10 @@ .SH OPTIONS \fIxvidtune\fP accepts the standard X Toolkit command line options as well as the following: +.TP 10 +.B \-show +Print the current settings to stdout in XF86Config +"Modeline" format and exit. .TP 10 .B \-prev Switch the Xserver to the previous video mode. Index: xc/programs/xvinfo/xvinfo.c diff -u xc/programs/xvinfo/xvinfo.c:1.6 xc/programs/xvinfo/xvinfo.c:1.7 --- xc/programs/xvinfo/xvinfo.c:1.6 Sun Apr 1 10:00:24 2001 +++ xc/programs/xvinfo/xvinfo.c Sat Oct 27 23:34:43 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xvinfo/xvinfo.c,v 1.6 2001/04/01 14:00:24 tsi Exp $ */ +/* $XFree86: xc/programs/xvinfo/xvinfo.c,v 1.7 2001/10/28 03:34:43 tsi Exp $ */ #include #include @@ -70,8 +70,8 @@ for(j = 0; j < nadaptors; j++) { fprintf(stdout, " Adaptor #%i: \"%s\"\n", j, ainfo[j].name); - fprintf(stdout, " number of ports: %i\n", ainfo[j].num_ports); - fprintf(stdout, " port base: %i\n", ainfo[j].base_id); + fprintf(stdout, " number of ports: %li\n", ainfo[j].num_ports); + fprintf(stdout, " port base: %li\n", ainfo[j].base_id); fprintf(stdout, " operations supported: "); switch(ainfo[j].type & (XvInputMask | XvOutputMask)) { case XvInputMask: @@ -98,7 +98,7 @@ fprintf(stdout, " supported visuals:\n"); for(k = 0; k < ainfo[j].num_formats; k++, format++) { - fprintf(stdout, " depth %i, visualID 0x%2x\n", + fprintf(stdout, " depth %i, visualID 0x%2lx\n", format->depth, format->visual_id); } @@ -154,10 +154,10 @@ for(n = 0; n < nencode; n++) { if(strcmp(encodings[n].name, "XV_IMAGE")) { - fprintf(stdout, " encoding ID #%i: \"%s\"\n", + fprintf(stdout, " encoding ID #%li: \"%s\"\n", encodings[n].encoding_id, encodings[n].name); - fprintf(stdout, " size: %i x %i\n", + fprintf(stdout, " size: %li x %li\n", encodings[n].width, encodings[n].height); fprintf(stdout, " rate: %f\n", @@ -173,7 +173,7 @@ for(n = 0; n < nencode; n++) { if(!strcmp(encodings[n].name, "XV_IMAGE")) { fprintf(stdout, - " maximum XvImage size: %i x %i\n", + " maximum XvImage size: %li x %li\n", encodings[n].width, encodings[n].height); break; } @@ -242,7 +242,7 @@ formats[n].depth == XvRGB); fprintf(stdout, " red, green, blue masks: " - "0x%lx, 0x%lx, 0x%lx\n", + "0x%x, 0x%x, 0x%x\n", formats[n].red_mask, formats[n].green_mask, formats[n].blue_mask); Index: xc/programs/xwd/list.c diff -u xc/programs/xwd/list.c:3.4 xc/programs/xwd/list.c:3.6 --- xc/programs/xwd/list.c:3.4 Wed Jan 17 18:46:41 2001 +++ xc/programs/xwd/list.c Fri Dec 14 15:02:33 2001 @@ -1,4 +1,4 @@ -/* $Xorg: list.c,v 1.4 2000/08/17 19:55:12 cpqbld Exp $ */ +/* $Xorg: list.c,v 1.5 2001/02/09 02:06:03 xorgcvs Exp $ */ /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each @@ -11,7 +11,11 @@ Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -30,15 +34,10 @@ from The Open Group. ----------------------------------------------------------------------- **/ -/* $XFree86: xc/programs/xwd/list.c,v 3.4 2001/01/17 23:46:41 dawes Exp $ */ +/* $XFree86: xc/programs/xwd/list.c,v 3.6 2001/12/14 20:02:33 dawes Exp $ */ #include - -#ifndef X_NOT_STDC_ENV #include -#else -char *malloc(); -#endif #include "list.h" Index: xc/programs/xwd/list.h diff -u xc/programs/xwd/list.h:1.4 xc/programs/xwd/list.h:1.5 --- xc/programs/xwd/list.h:1.4 Wed Jan 17 18:46:42 2001 +++ xc/programs/xwd/list.h Fri Dec 14 15:02:33 2001 @@ -1,4 +1,4 @@ -/* $Xorg: list.h,v 1.3 2000/08/17 19:55:12 cpqbld Exp $ */ +/* $Xorg: list.h,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each @@ -11,7 +11,11 @@ Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xwd/multiVis.c diff -u xc/programs/xwd/multiVis.c:1.6 xc/programs/xwd/multiVis.c:1.7 --- xc/programs/xwd/multiVis.c:1.6 Wed Jan 17 18:46:42 2001 +++ xc/programs/xwd/multiVis.c Fri Dec 14 15:02:34 2001 @@ -1,4 +1,4 @@ -/* $Xorg: multiVis.c,v 1.4 2000/08/17 19:55:12 cpqbld Exp $ */ +/* $Xorg: multiVis.c,v 1.5 2001/02/09 02:06:03 xorgcvs Exp $ */ /** ------------------------------------------------------------------------ This file contains functions to create a list of regions which tile a specified window. Each region contains all visible @@ -11,7 +11,11 @@ Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -30,7 +34,7 @@ from The Open Group. ------------------------------------------------------------------------ **/ -/* $XFree86: xc/programs/xwd/multiVis.c,v 1.6 2001/01/17 23:46:42 dawes Exp $ */ +/* $XFree86: xc/programs/xwd/multiVis.c,v 1.7 2001/12/14 20:02:34 dawes Exp $ */ #include #include Index: xc/programs/xwd/multiVis.h diff -u xc/programs/xwd/multiVis.h:1.1.1.4 xc/programs/xwd/multiVis.h:1.2 --- xc/programs/xwd/multiVis.h:1.1.1.4 Tue Jan 16 18:07:05 2001 +++ xc/programs/xwd/multiVis.h Fri Dec 14 15:02:34 2001 @@ -1,4 +1,4 @@ -/* $Xorg: multiVis.h,v 1.3 2000/08/17 19:55:13 cpqbld Exp $ */ +/* $Xorg: multiVis.h,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each @@ -11,7 +11,11 @@ Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xwd/wsutils.h diff -u xc/programs/xwd/wsutils.h:1.1.1.4 xc/programs/xwd/wsutils.h:1.2 --- xc/programs/xwd/wsutils.h:1.1.1.4 Tue Jan 16 18:07:08 2001 +++ xc/programs/xwd/wsutils.h Fri Dec 14 15:02:34 2001 @@ -1,4 +1,4 @@ -/* $Xorg: wsutils.h,v 1.3 2000/08/17 19:55:13 cpqbld Exp $ */ +/* $Xorg: wsutils.h,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each @@ -11,7 +11,11 @@ Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/programs/xwd/xwd.c diff -u xc/programs/xwd/xwd.c:3.7 xc/programs/xwd/xwd.c:3.10 --- xc/programs/xwd/xwd.c:3.7 Wed Jan 17 18:46:42 2001 +++ xc/programs/xwd/xwd.c Fri Dec 14 15:02:34 2001 @@ -1,10 +1,14 @@ -/* $Xorg: xwd.c,v 1.4 2000/08/17 19:55:13 cpqbld Exp $ */ +/* $Xorg: xwd.c,v 1.5 2001/02/09 02:06:03 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -21,7 +25,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xwd/xwd.c,v 3.7 2001/01/17 23:46:42 dawes Exp $ */ +/* $XFree86: xc/programs/xwd/xwd.c,v 3.10 2001/12/14 20:02:34 dawes Exp $ */ /* * xwd.c MIT Project Athena, X Window system window raster image dumper. @@ -65,13 +69,7 @@ #include #include #include - -#ifdef X_NOT_STDC_ENV -extern int errno; -char *calloc(); -#else #include -#endif #include #include @@ -643,7 +641,6 @@ { register char c; register char *ep = bp + n; - register char *sp; while (bp < ep) { c = bp[3]; Index: xc/programs/xwd/xwd.man diff -u xc/programs/xwd/xwd.man:1.7 xc/programs/xwd/xwd.man:1.8 --- xc/programs/xwd/xwd.man:1.7 Sat Jan 27 13:21:25 2001 +++ xc/programs/xwd/xwd.man Fri Dec 14 15:02:34 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xwd.man,v 1.3 2000/08/17 19:55:14 cpqbld Exp $ +.\" $Xorg: xwd.man,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xwd/xwd.man,v 1.7 2001/01/27 18:21:25 dawes Exp $ +.\" $XFree86: xc/programs/xwd/xwd.man,v 1.8 2001/12/14 20:02:34 dawes Exp $ .\" .TH XWD 1 __xorgversion__ .SH NAME Index: xc/programs/xwininfo/xwininfo.c diff -u xc/programs/xwininfo/xwininfo.c:1.7 xc/programs/xwininfo/xwininfo.c:1.8 --- xc/programs/xwininfo/xwininfo.c:1.7 Sun Apr 1 10:00:25 2001 +++ xc/programs/xwininfo/xwininfo.c Fri Dec 14 15:02:35 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xwininfo.c,v 1.3 2000/08/17 19:55:16 cpqbld Exp $ */ +/* $Xorg: xwininfo.c,v 1.4 2001/02/09 02:06:04 xorgcvs Exp $ */ /* Copyright 1987, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xwininfo/xwininfo.c,v 1.7 2001/04/01 14:00:25 tsi Exp $ */ +/* $XFree86: xc/programs/xwininfo/xwininfo.c,v 1.8 2001/12/14 20:02:35 dawes Exp $ */ /* Index: xc/programs/xwininfo/xwininfo.man diff -u xc/programs/xwininfo/xwininfo.man:1.7 xc/programs/xwininfo/xwininfo.man:1.8 --- xc/programs/xwininfo/xwininfo.man:1.7 Sat Jan 27 13:21:25 2001 +++ xc/programs/xwininfo/xwininfo.man Fri Dec 14 15:02:35 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xwininfo.man,v 1.3 2000/08/17 19:55:16 cpqbld Exp $ +.\" $Xorg: xwininfo.man,v 1.4 2001/02/09 02:06:04 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xwininfo/xwininfo.man,v 1.7 2001/01/27 18:21:25 dawes Exp $ +.\" $XFree86: xc/programs/xwininfo/xwininfo.man,v 1.8 2001/12/14 20:02:35 dawes Exp $ .\" .TH XWININFO 1 __xorgversion__ .SH NAME Index: xc/programs/xwud/xwud.c diff -u xc/programs/xwud/xwud.c:3.5 xc/programs/xwud/xwud.c:3.7 --- xc/programs/xwud/xwud.c:3.5 Wed Jan 17 18:46:43 2001 +++ xc/programs/xwud/xwud.c Fri Dec 14 15:02:35 2001 @@ -1,9 +1,13 @@ -/* $Xorg: xwud.c,v 1.4 2000/08/17 19:55:17 cpqbld Exp $ */ +/* $Xorg: xwud.c,v 1.5 2001/02/09 02:06:04 xorgcvs Exp $ */ /* Copyright 1985, 1986, 1988, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xwud/xwud.c,v 3.5 2001/01/17 23:46:43 dawes Exp $ */ +/* $XFree86: xc/programs/xwud/xwud.c,v 3.7 2001/12/14 20:02:35 dawes Exp $ */ /* xwud - marginally useful raster image undumper */ @@ -36,13 +40,7 @@ #define XK_LATIN1 #include #include - -#ifdef X_NOT_STDC_ENV -extern int errno; -extern char *malloc(); -#else #include -#endif Atom wm_protocols; Atom wm_delete_window; Index: xc/programs/xwud/xwud.man diff -u xc/programs/xwud/xwud.man:1.7 xc/programs/xwud/xwud.man:1.8 --- xc/programs/xwud/xwud.man:1.7 Sat Jan 27 13:21:26 2001 +++ xc/programs/xwud/xwud.man Fri Dec 14 15:02:35 2001 @@ -1,7 +1,11 @@ -.\" $Xorg: xwud.man,v 1.3 2000/08/17 19:55:18 cpqbld Exp $ +.\" $Xorg: xwud.man,v 1.4 2001/02/09 02:06:04 xorgcvs Exp $ .\" Copyright 1988, 1998 The Open Group .\" -.\" All Rights Reserved. +.\" 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. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. @@ -19,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xwud/xwud.man,v 1.7 2001/01/27 18:21:26 dawes Exp $ +.\" $XFree86: xc/programs/xwud/xwud.man,v 1.8 2001/12/14 20:02:35 dawes Exp $ .\" .TH XWUD 1 __xorgversion__ .SH NAME Index: xc/util/memleak/fmalloc.c diff -u xc/util/memleak/fmalloc.c:3.12 xc/util/memleak/fmalloc.c:3.13 --- xc/util/memleak/fmalloc.c:3.12 Fri Feb 16 08:24:10 2001 +++ xc/util/memleak/fmalloc.c Fri Dec 14 15:02:36 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: fmalloc.c,v 1.4 2000/08/17 19:55:20 cpqbld Exp $ + * $Xorg: fmalloc.c,v 1.5 2001/02/09 02:06:19 xorgcvs Exp $ * Copyright 1992, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -22,7 +26,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/util/memleak/fmalloc.c,v 3.12 2001/02/16 13:24:10 eich Exp $ */ +/* $XFree86: xc/util/memleak/fmalloc.c,v 3.13 2001/12/14 20:02:36 dawes Exp $ */ /* Index: xc/util/memleak/ftest.c diff -u xc/util/memleak/ftest.c:1.2 xc/util/memleak/ftest.c:1.3 --- xc/util/memleak/ftest.c:1.2 Fri Feb 16 08:24:10 2001 +++ xc/util/memleak/ftest.c Fri Dec 14 15:02:36 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: ftest.c,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ + * $Xorg: ftest.c,v 1.4 2001/02/09 02:06:19 xorgcvs Exp $ * Copyright 1992, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/util/memleak/getretmips.c diff -u xc/util/memleak/getretmips.c:1.1.1.3 xc/util/memleak/getretmips.c:1.2 --- xc/util/memleak/getretmips.c:1.1.1.3 Tue Jan 16 18:41:20 2001 +++ xc/util/memleak/getretmips.c Fri Dec 14 15:02:36 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: getretmips.c,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ + * $Xorg: getretmips.c,v 1.4 2001/02/09 02:06:19 xorgcvs Exp $ * Copyright 1992, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/util/memleak/getretspar.c diff -u xc/util/memleak/getretspar.c:1.1.1.3 xc/util/memleak/getretspar.c:1.2 --- xc/util/memleak/getretspar.c:1.1.1.3 Tue Jan 16 18:41:21 2001 +++ xc/util/memleak/getretspar.c Fri Dec 14 15:02:36 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: getretspar.c,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ + * $Xorg: getretspar.c,v 1.4 2001/02/09 02:06:19 xorgcvs Exp $ * Copyright 1992, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/util/memleak/getrettest.c diff -u xc/util/memleak/getrettest.c:1.1.1.4 xc/util/memleak/getrettest.c:1.2 --- xc/util/memleak/getrettest.c:1.1.1.4 Tue Jan 16 18:41:22 2001 +++ xc/util/memleak/getrettest.c Fri Dec 14 15:02:36 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: getrettest.c,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ + * $Xorg: getrettest.c,v 1.4 2001/02/09 02:06:19 xorgcvs Exp $ * Copyright 1992, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/util/memleak/mipsstack.s diff -u xc/util/memleak/mipsstack.s:1.1.1.3 xc/util/memleak/mipsstack.s:1.2 --- xc/util/memleak/mipsstack.s:1.1.1.3 Tue Jan 16 18:41:23 2001 +++ xc/util/memleak/mipsstack.s Fri Dec 14 15:02:37 2001 @@ -1,9 +1,13 @@ /* - * $Xorg: mipsstack.s,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ + * $Xorg: mipsstack.s,v 1.4 2001/02/09 02:06:19 xorgcvs Exp $ * Copyright 1992, 1998 The Open Group -All Rights Reserved. +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. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Index: xc/util/memleak/stackbottom.c diff -u xc/util/memleak/stackbottom.c:3.1 xc/util/memleak/stackbottom.c:3.2 --- xc/util/memleak/stackbottom.c:3.1 Tue Dec 31 00:02:27 1996 +++ xc/util/memleak/stackbottom.c Wed Jul 25 11:05:31 2001 @@ -4,7 +4,7 @@ * Cutter and Paster: Jeffrey Hsu */ -/* $XFree86: xc/util/memleak/stackbottom.c,v 3.1 1996/12/31 05:02:27 dawes Exp $ */ +/* $XFree86: xc/util/memleak/stackbottom.c,v 3.2 2001/07/25 15:05:31 dawes Exp $ */ #include @@ -46,11 +46,7 @@ longjmp(GC_jmp_buf, 1); } -# ifdef __STDC__ typedef void (*handler)(int); -# else - typedef void (*handler)(); -# endif /* Return the first nonaddressible location > p (up) or */ /* the smallest location q s.t. [q,p] is addressible (!up). */ Index: xc/util/patch/ChangeLog diff -u xc/util/patch/ChangeLog:1.1.1.1 xc/util/patch/ChangeLog:removed --- xc/util/patch/ChangeLog:1.1.1.1 Wed Apr 27 03:36:21 1994 +++ xc/util/patch/ChangeLog Fri Jan 18 15:27:47 2002 @@ -1,290 +0,0 @@ -Mon May 31 00:49:40 1993 Paul Eggert (eggert@twinsun.com) - - * patchlevel.h: PATCHLEVEL 12u9. - - * inp.c (plan_a): Don't lock the checked-out file if `patch -o' - redirected the output elsewhere. - * common.h (CHECKOUT_LOCKED, GET_LOCKED): New macros. GET and - CHECKOUT now just checkout unlocked copies. - - * Makefile (dist): Use gzip, not compress. - -Fri May 28 08:44:50 1993 Paul Eggert (eggert@twinsun.com) - - * backupfile.c (basename): Define even if NODIR isn't defined. - * patch.c (main): Ask just once to apply a reversed patch. - -Tue Sep 15 00:36:15 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u8. - -Mon Sep 14 22:01:23 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Makefile.SH: Add uninstall target. Simplify install target. - - * util.c (fatal, pfatal): Add some asterisks to make fatal - messages stand out more. - -Tue Aug 25 22:13:36 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * patch.c (main, get_some_switches), common.h, inp.c (plan_a, - plan_b), pch.c (there_is_another_patch): Add -t option, - similar to -f. - -Mon Jul 27 11:27:07 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * inp.c (plan_a, util.c (fetchname): Use a macro to simplify code. - * common.h: Define SCCSDIFF and RCSDIFF. - * inp.c (plan_a): Use them to make sure it's safe to check out - the default RCS or SCCS version. - From Paul Eggert. - -Wed Jul 22 14:37:08 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * patch.man: Use the standard comment syntax -- '\" -- instead - of '''. - -Tue Jul 21 15:26:01 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Configure: Add /etc /usr/lib /lib to pth. - -Mon Jul 20 14:10:32 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * util.h: Declare basename. - * inp.c (plan_a), util.c (fetchname): Use it to isolate the - leading path when testing for RCS and SCCS files. - -Sat Jul 11 18:03:26 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Configure: Use the user's PATH and build pth from it. - -Fri Jul 10 16:03:23 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Configure: Change cc -S to cc -c and tr '[ - ]' '[\012-\012]' - to tr ' ' '\012' for AIX 3.2. - From chip@tct.com (Chip Salzenberg). - - * util.c (makedirs): Only make the directories that don't exist. - From chip@tct.com (Chip Salzenberg). - -Wed Jul 8 01:21:15 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * util.c (fatal, pfatal): Print "patch: " before message. - * pch.c, inp.c, patch.c, util.c: Remove "patch: " from the - callers that had it. - - * util.c (pfatal): New function. - * util.h: Declare it and pfatal[1-4] macros. - * various files: Use it instead of fatal where appropriate. - - * Configure: Make /usr/local/man/man1 the first choice for the - man pages. - - * patch.c (main): Open ofp after checking for ed script. - Close ofp and rejfp before trying plan B. - From epang@sfu.ca (Eugene Pang). - - * backupfile.h: Declare get_version. - - * Move decls of rindex and popen to common.h. - - * common.h (myuid): New variable. - * patch.c (main): Initialize it. - * inp.c (myuid): Function removed. - (plan_a): Use the variable, not the function. - - * patch.c: Reinstate -E option. - -Tue Jul 7 23:19:28 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * inp.c (myuid): New function. - (plan_a): Call it. Optimize stat calls. Be smarter about - detecting checked out RCS and SCCS files. - From Paul Eggert (eggert@twinsun.com). - - * inp.c, util.c, patch.c: Don't bother checking for stat() > 0. - -Mon Jul 6 13:01:52 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * version.c (version): Don't print the RCS stuff, since we're - not updating it regularly. - - * patch.c (get_some_switches): Make the usage message more accurate. - - * patchlevel.h: PATCHLEVEL 12u7. - - * Makefile.SH (dist): New target. - Makedist: File removed. - - * inp.c (plan_a): Check whether the user can write to the - file, not whether anyone can write to the file. - -Sat Jul 4 00:06:58 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * inp.c (plan_a): Try to check out read-only files from RCS or SCCS. - - * util.c (move_file): If backing up by linking fails, try copying. - From cek@sdc.boeing.com (Conrad Kimball). - - * patch.c (get_some_switches): Eliminate -E option; always - remove empty output files. - - * util.c (fetchname): Only undo slash removal for relative - paths if -p was not given. - - * Makefile.sh: Add mostlyclean target. - -Fri Jul 3 23:48:14 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * util.c (fetchname): Accept whitespace between `Index:' and filename. - Also plug a small memory leak for diffs against /dev/null. - From eggert@twinsun.com (Paul Eggert). - - * common.h: Don't define TRUE and FALSE if already defined. - From phk@data.fls.dk (Poul-Henning Kamp). - -Wed Apr 29 10:19:33 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) - - * backupfile.c (get_version): Exit if given a bad backup type. - -Fri Mar 27 09:57:14 1992 Karl Berry (karl at hayley) - - * common.h (S_ISDIR, S_ISREG): define these. - * inp.c (plan_a): use S_ISREG, not S_IFREG. - * util.c (fetchname): use S_ISDIR, not S_IFDIR. - -Mon Mar 16 14:10:42 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u6. - -Sat Mar 14 13:13:29 1992 David J. MacKenzie (djm at frob.eng.umd.edu) - - * Configure, config.h.SH: Check for directory header and unistd.h. - - * patch.c (main): If -E was given and output file is empty after - patching, remove it. - (get_some_switches): Recognize -E option. - - * patch.c (copy_till): Make garbled output an error, not a warning - that doesn't change the exit status. - - * common.h: Protect against system declarations of malloc and realloc. - - * Makedist: Add backupfile.[ch]. - - * Configure: Look for C library where NeXT and SVR4 put it. - Look in /usr/ucb after /bin and /usr/bin for utilities, - and look in /usr/ccs/bin, to make SVR4 happier. - Recognize m68k predefine. - - * util.c (fetchname): Test of stat return value was backward. - From csss@scheme.cs.ubc.ca. - - * version.c (version): Exit with status 0, not 1. - - * Makefile.SH: Add backupfile.[cho]. - * patch.c (main): Initialize backup file generation. - (get_some_switches): Add -V option. - * common.h, util,c, patch.c: Replace origext with simple_backup_suffix. - * util.c (move_file): Use find_backup_file_name. - -Tue Dec 3 11:27:16 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u5. - - * Makefile.SH: Change clean, distclean, and realclean targets a - little so they agree with the GNU coding standards. - Add Makefile to addedbyconf, so distclean removes it. - - * Configure: Recognize Domain/OS C library in /lib/libc. - From mmuegel@mot.com (Michael S. Muegel). - - * pch.c: Fixes from Wayne Davison: - Patch now accepts no-context context diffs that are - specified with an assumed one line hunk (e.g. "*** 10 ****"). - Fixed a bug in both context and unified diff processing that would - put a zero-context hunk in the wrong place (one line too soon). - Fixed a minor problem with p_max in unified diffs where it would - set p_max to hunkmax unnecessarily (the only adverse effect was to - not supply empty lines at eof by assuming they were truncated). - -Tue Jul 2 03:25:51 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu) - - * Configure: Check for signal declaration in - /usr/include/sys/signal.h as well as /usr/include/signal.h. - - * Configure, common.h, config.h.SH: Comment out the sprintf - declaration and tests to determine its return value type. It - conflicts with ANSI C systems' prototypes in stdio.h and the - return value of sprintf is never used anyway -- it's always cast - to void. - -Thu Jun 27 13:05:32 1991 David J. MacKenzie (djm at churchy.gnu.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u4. - -Thu Feb 21 15:18:14 1991 David J. MacKenzie (djm at geech.ai.mit.edu) - - * pch.c (another_hunk): Fix off by 1 error. From - iverson@xstor.com (Tim Iverson). - -Sun Jan 20 20:18:58 1991 David J. MacKenzie (djm at geech.ai.mit.edu) - - * Makefile.SH (all): Don't make a dummy `all' file. - - * patchlevel.h: PATCHLEVEL 12u3. - - * patch.c (nextarg): New function. - (get_some_switches): Use it, to prevent dereferencing a null - pointer if an option that takes an arg is not given one (is last - on the command line). From Paul Eggert. - - * pch.c (another_hunk): Fix from Wayne Davison to recognize - single-line hunks in unified diffs (with a single line number - instead of a range). - - * inp.c (rev_in_string): Don't use `s' before defining it. From - Wayne Davison. - -Mon Jan 7 06:25:11 1991 David J. MacKenzie (djm at geech.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u2. - - * pch.c (intuit_diff_type): Recognize `+++' in diff headers, for - unified diff format. From unidiff patch 1. - -Mon Dec 3 00:14:25 1990 David J. MacKenzie (djm at albert.ai.mit.edu) - - * patch.c (get_some_switches): Make the usage message more - informative. - -Sun Dec 2 23:20:18 1990 David J. MacKenzie (djm at albert.ai.mit.edu) - - * Configure: When checking for C preprocessor, look for 'abc.*xyz' - instead of 'abc.xyz', so ANSI C preprocessors work. - - * Apply fix for -D from ksb@mentor.cc.purdue.edu (Kevin Braunsdorf). - - * Apply unidiff patches from davison@dri.com (Wayne Davison). - -Wed Mar 7 23:47:25 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) - - * pch.c: Call malformed instead of goto malformed - (just allows easier debugging). - -Tue Jan 23 21:27:00 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) - - * common.h (TMP*NAME): Make these char *, not char []. - patch.c (main): Use TMPDIR (if present) to set TMP*NAME. - common.h: Declare getenv. - -Sun Dec 17 17:29:48 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu) - - * patch.c (reverse_flag_specified): New variable. - (get_some_switches, reinitialize_almost_everything): Use it. - -Local Variables: -mode: indented-text -left-margin: 8 -version-control: never -end: Index: xc/util/patch/Configure diff -u xc/util/patch/Configure:1.1.1.3 xc/util/patch/Configure:removed --- xc/util/patch/Configure:1.1.1.3 Tue Jan 16 18:41:29 2001 +++ xc/util/patch/Configure Fri Jan 18 15:27:47 2002 @@ -1,1476 +0,0 @@ -#! /bin/sh -# -# If these # comments don't work, trim them. Don't worry about any other -# shell scripts, Configure will trim # comments from them for you. -# -# (If you are trying to port this package to a machine without sh, I would -# suggest you cut out the prototypical config.h from the end of Configure -# and edit it to reflect your system. Some packages may include samples -# of config.h for certain machines, so you might look for one of those.) -# -# oldHeader: Head.U,v 1.0 87/05/22 12:28:10 lwall Exp $ -# $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 -# working with this copy of Configure, you may wish to get metaconfig.) - -: sanity checks -: the user has a better chance than we do of setting a reasonable PATH -: but add some directories we need that are probably not there -PATH=.:${PATH}:/etc:/usr/lib:/lib -export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) - -if test ! -t 0; then - echo "Say 'sh Configure', not 'sh /dev/null 2>&1 && \ - echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \ - echo "especially on exotic machines. If yours does, try the Bourne shell instead.)" - -if test ! -d ../UU; then - if test ! -d UU; then - mkdir UU - fi - cd UU -fi - -case "$1" in --d) shift; fastread='yes';; -esac - -d_eunice='' -eunicefix='' -define='' -loclist='' -expr='' -sed='' -echo='' -cat='' -rm='' -mv='' -cp='' -tail='' -tr='' -mkdir='' -sort='' -uniq='' -grep='' -trylist='' -test='' -inews='' -egrep='' -more='' -pg='' -Mcc='' -vi='' -mailx='' -mail='' -cpp='' -Log='' -Header='' -bin='' -cc='' -contains='' -cppstdin='' -cppminus='' -d_charsprf='' -d_flexfnam='' -d_index='' -d_voidsig='' -d_dirheader='' -d_unistd='' -libc='' -mansrc='' -manext='' -models='' -split='' -small='' -medium='' -large='' -huge='' -ccflags='' -ldflags='' -n='' -c='' -package='' -registers='' -reg1='' -reg2='' -reg3='' -reg4='' -reg5='' -reg6='' -reg7='' -reg8='' -reg9='' -reg10='' -reg11='' -reg12='' -reg13='' -reg14='' -reg15='' -reg16='' -spitshell='' -shsharp='' -sharpbang='' -startsh='' -voidflags='' -defvoidused='' -CONFIG='' -: set package name -package=patch - -echo " " -echo "Beginning of configuration questions for $package kit." -: Eunice requires " " instead of "", can you believe it -echo " " - -define='define' -undef='/*undef' -libpth='/usr/lib /usr/local/lib /lib /usr/ccs/lib' -smallmach='pdp11 i8086 z8000 i80286 iAPX286' -rmlist='kit[1-9]isdone kit[1-9][0-9]isdone' -trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3 - -: We must find out about Eunice early -eunicefix=':' -if test -f /etc/unixtovms; then - eunicefix=/etc/unixtovms -fi -if test -f /etc/unixtovms.exe; then - eunicefix=/etc/unixtovms.exe -fi - -attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr" -attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200" -attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc" -attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX" -attrlist="$attrlist mc68k m68k __STDC__" -pth=`echo $PATH | tr : ' '` -d_newshome="../../NeWS" -defvoidused=7 - -: some greps do not return status, grrr. -echo "grimblepritz" >grimble -if grep blurfldyick grimble >/dev/null 2>&1 ; then - contains=contains -elif grep grimblepritz grimble >/dev/null 2>&1 ; then - contains=grep -else - contains=contains -fi -rm -f grimble -: the following should work in any shell -case "$contains" in -contains*) - echo " " - echo "AGH! Grep doesn't return a status. Attempting remedial action." - cat >contains <<'EOSS' -grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp -EOSS -chmod +x contains -esac - -: first determine how to suppress newline on echo command -echo "Checking echo to see how to suppress newlines..." -(echo "hi there\c" ; echo " ") >.echotmp -if $contains c .echotmp >/dev/null 2>&1 ; then - echo "...using -n." - n='-n' - c='' -else - cat <<'EOM' -...using \c -EOM - n='' - c='\c' -fi -echo $n "Type carriage return to continue. Your cursor should be here-->$c" -read ans -rm -f .echotmp - -: now set up to do reads with possible shell escape and default assignment -cat <myread -case "\$fastread" in -yes) ans=''; echo " " ;; -*) ans='!';; -esac -while expr "X\$ans" : "X!" >/dev/null; do - read ans - case "\$ans" in - !) - sh - echo " " - echo $n "\$rp $c" - ;; - !*) - set \`expr "X\$ans" : "X!\(.*\)\$"\` - sh -c "\$*" - echo " " - echo $n "\$rp $c" - ;; - esac -done -rp='Your answer:' -case "\$ans" in -'') ans="\$dflt";; -esac -EOSC - -: general instructions -cat <loc -$startsh -case \$# in -0) exit 1;; -esac -thing=\$1 -shift -dflt=\$1 -shift -for dir in \$*; do - case "\$thing" in - .) - if test -d \$dir/\$thing; then - echo \$dir - exit 0 - fi - ;; - *) - if test -f \$dir/\$thing; then - echo \$dir/\$thing - exit 0 - elif test -f \$dir/\$thing.exe; then - : on Eunice apparently - echo \$dir/\$thing - exit 0 - fi - ;; - esac -done -echo \$dflt -exit 1 -EOSC -chmod +x loc -$eunicefix loc -loclist=" -expr -sed -echo -cat -rm -tr -grep -" -trylist=" -test -Mcc -cpp -" -for file in $loclist; do - xxx=`loc $file $file $pth` - eval $file=$xxx - eval _$file=$xxx - case "$xxx" in - /*) - echo $file is in $xxx. - ;; - *) - echo "I don't know where $file is. I hope it's in everyone's PATH." - ;; - esac -done -echo " " -echo "Don't worry if any of the following aren't found..." -ans=offhand -for file in $trylist; do - xxx=`loc $file $file $pth` - eval $file=$xxx - eval _$file=$xxx - case "$xxx" in - /*) - echo $file is in $xxx. - ;; - *) - echo "I don't see $file out there, $ans." - ans=either - ;; - esac -done -case "$egrep" in -egrep) - echo "Substituting grep for egrep." - egrep=$grep - ;; -esac -case "$test" in -test) - echo "Hopefully test is built into your sh." - ;; -/bin/test) - echo " " - dflt=n - rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)" - echo $n "$rp $c" - . myread - case "$ans" in - y*) test=test ;; - esac - ;; -*) - test=test - ;; -esac -case "$echo" in -echo) - echo "Hopefully echo is built into your sh." - ;; -/bin/echo) - echo " " - echo "Checking compatibility between /bin/echo and builtin echo (if any)..." - $echo $n "hi there$c" >foo1 - echo $n "hi there$c" >foo2 - if cmp foo1 foo2 >/dev/null 2>&1; then - echo "They are compatible. In fact, they may be identical." - else - case "$n" in - '-n') n='' c='\c' ans='\c' ;; - *) n='-n' c='' ans='-n' ;; - esac - cat </dev/null | sed -n -e 's/^.* T _//p' -e 's/^.* T //p' > libc.list -if $contains '^printf$' libc.list >/dev/null 2>&1; then - echo "done" -else - nm $libc 2>/dev/null | sed -n -e 's/^.* D _//p' -e 's/^.* D //p' > libc.list - if $contains '^printf$' libc.list >/dev/null 2>&1; then - echo "done" - else - echo " " - echo "nm didn't seem to work right." - echo "Trying ar instead..." - if ar t $libc | sed -e 's/\.o$//' > libc.list; then - echo "Ok." - else - echo "That didn't work either. Giving up." - exit 1 - fi - fi -fi -rmlist="$rmlist libc.list" - -: make some quick guesses about what we are up against -echo " " -$echo $n "Hmm... $c" -if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then - echo "Looks kind of like a BSD system, but we'll see..." - echo exit 0 >bsd - echo exit 1 >usg - echo exit 1 >v7 -elif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then - echo "Looks kind of like a USG system, but we'll see..." - echo exit 1 >bsd - echo exit 0 >usg - echo exit 1 >v7 -else - echo "Looks kind of like a version 7 system, but we'll see..." - echo exit 1 >bsd - echo exit 1 >usg - echo exit 0 >v7 -fi -if $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then - cat <<'EOI' -There is, however, a strange, musty smell in the air that reminds me of -something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. -EOI - echo "exit 0" >eunice - eunicefix=unixtovms - d_eunice="$define" -: it so happens the Eunice I know will not run shell scripts in Unix format -else - echo " " - echo "Congratulations. You aren't running Eunice." - eunicefix=':' - d_eunice="$undef" - echo "exit 1" >eunice -fi -if test -f /xenix; then - echo "Actually, this looks more like a XENIX system..." - echo "exit 0" >xenix -else - echo " " - echo "It's not Xenix..." - echo "exit 1" >xenix -fi -chmod +x xenix -$eunicefix xenix -if test -f /venix; then - echo "Actually, this looks more like a VENIX system..." - echo "exit 0" >venix -else - echo " " - if xenix; then - : null - else - echo "Nor is it Venix..." - fi - echo "exit 1" >venix -fi -chmod +x bsd usg v7 eunice venix -$eunicefix bsd usg v7 eunice venix -rmlist="$rmlist bsd usg v7 eunice venix xenix" - -: see if sh knows # comments -echo " " -echo "Checking your sh to see if it knows about # comments..." -if sh -c '#' >/dev/null 2>&1 ; then - echo "Your sh handles # comments correctly." - shsharp=true - spitshell=cat - echo " " - echo "Okay, let's see if #! works on this system..." - echo "#!/bin/echo hi" > try - $eunicefix try - chmod +x try - try > today - if $contains hi today >/dev/null 2>&1; then - echo "It does." - sharpbang='#!' - else - echo "#! /bin/echo hi" > try - $eunicefix try - chmod +x try - try > today - if test -s today; then - echo "It does." - sharpbang='#! ' - else - echo "It doesn't." - sharpbang=': use ' - fi - fi -else - echo "Your sh doesn't grok # comments--I will strip them later on." - shsharp=false - echo "exec grep -v '^#'" >spitshell - chmod +x spitshell - $eunicefix spitshell - spitshell=`pwd`/spitshell - echo "I presume that if # doesn't work, #! won't work either!" - sharpbang=': use ' -fi - -: figure out how to guarantee sh startup -echo " " -echo "Checking out how to guarantee sh startup..." -startsh=$sharpbang'/bin/sh' -echo "Let's see if '$startsh' works..." -cat >try <.ucbsprf.c <<'EOF' -#main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); } -#EOF -#if cc .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then -# echo "Your sprintf() returns (int)." -# d_charsprf="$undef" -#else -# echo "Your sprintf() returns (char*)." -# d_charsprf="$define" -#fi -#/bin/rm -f .ucbsprf.c .ucbsprf - -: see if we can have long filenames -echo " " -rm -f 123456789abcde -if (echo hi >123456789abcdef) 2>/dev/null; then - : not version 8 - if test -f 123456789abcde; then - echo 'You cannot have filenames longer than 14 characters. Sigh.' - d_flexfnam="$undef" - else - echo 'You can have filenames longer than 14 characters.' - d_flexfnam="$define" - fi -else - : version 8 probably - echo "You can't have filenames longer than 14 chars. V8 can't even think about them!" - d_flexfnam="$undef" -fi -: index or strcpy -echo " " -case "$d_index" in -n) dflt=n;; -*) dflt=y;; -esac -if $contains '^index$' libc.list >/dev/null 2>&1 ; then - if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then - echo "Your system has both index() and strchr(). Shall I use" - rp="index() rather than strchr()? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - n*) d_index="$define" ;; - *) d_index="$undef" ;; - esac - else - d_index="$undef" - echo "index() found." - fi -else - if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then - d_index="$define" - echo "strchr() found." - else - echo "No index() or strchr() found!" - d_index="$undef" - fi -fi - -: see if signal is declared as pointer to function returning int or void -echo " " -if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 || -$contains 'void.*signal' /usr/include/sys/signal.h >/dev/null 2>&1 ; then - echo "You have void (*signal())() instead of int." - d_voidsig="$define" -else - echo "You have int (*signal())() instead of void." - d_voidsig="$undef" -fi - -: check for directory library -echo " " -if test -f /usr/include/dirent.h; then - echo "You have dirent.h." - d_dirheader="#define DIRENT" -elif test -f /usr/include/ndir.h; then - echo "You have ndir.h." - d_dirheader="#define USG" -elif test -f /usr/include/sys/ndir.h; then - echo "You have sys/ndir.h." - d_dirheader="#define SYSNDIR -#define USG" -elif test -f /usr/include/sys/dir.h; then - echo "You have sys/dir.h; I hope that's the BSD version." - d_dirheader="#define SYSDIR" -else - echo "I can't find a directory library header file. -That means you won't have numbered backups available." - d_dirheader="#define NODIR" -fi - -: check for unistd.h -echo " " -if test -f /usr/include/unistd.h; then - echo "You have unistd.h." - d_unistd="$define" -else - echo "I don't see unistd.h, but that's OK." - d_unistd="$undef" -fi - -: check for void type -echo " " -$cat <try.c <<'EOCP' -#if TRY & 1 -void main() { -#else -main() { -#endif - extern void *moo(); - void *(*goo)(); -#if TRY & 2 - void (*foo[10])(); -#endif - -#if TRY & 4 - if(*goo == moo) { - exit(0); - } -#endif - exit(0); -} -EOCP - : Argh -- AIX 3.2 does not have cc -S! - if cc -c -DTRY=7 try.c >.out 2>&1 ; then - voidflags=7 - echo "It appears to support void fully." - if $contains warning .out >/dev/null 2>&1; then - echo "However, you might get some warnings that look like this:" - $cat .out - fi - else - echo "Hmm, you compiler has some difficulty with void. Checking further..." - if cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then - echo "It supports 1..." - if cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then - voidflags=3 - echo "And it supports 2 but not 4." - else - echo "It doesn't support 2..." - if cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then - voidflags=5 - echo "But it supports 4." - else - voidflags=1 - echo "And it doesn't support 4." - fi - fi - else - echo "There is no support at all for void." - voidflags=0 - fi - fi -esac -dflt="$voidflags"; -rp="Your void support flags add up to what? [$dflt]" -$echo $n "$rp $c" -. myread -voidflags="$ans" -$rm -f try.* .out - -: see how we invoke the C preprocessor -echo " " -echo "Now, how can we feed standard input to your C preprocessor..." -cat <<'EOT' >testcpp.c -#define ABC abc -#define XYZ xyz -ABC.XYZ -EOT -echo 'Maybe "'$cpp'" will work...' -$cpp testcpp.out 2>&1 -if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, it does." - cppstdin="$cpp" - cppminus=''; -else - echo 'Nope, maybe "'$cpp' -" will work...' - $cpp - testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, it does." - cppstdin="$cpp" - cppminus='-'; - else - echo 'No such luck...maybe "cc -E" will work...' - cc -E testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "It works!" - cppstdin='cc -E' - cppminus=''; - else - echo 'Nixed again...maybe "cc -E -" will work...' - cc -E - testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Hooray, it works! I was beginning to wonder." - cppstdin='cc -E' - cppminus='-'; - else - echo 'Nope...maybe "cc -P" will work...' - cc -P testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, that does." - cppstdin='cc -P' - cppminus=''; - else - echo 'Nope...maybe "cc -P -" will work...' - cc -P - testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, that does." - cppstdin='cc -P' - cppminus='-'; - else - echo 'Hmm...perhaps you already told me...' - case "$cppstdin" in - '') ;; - *) $cppstdin $cppminus testcpp.out 2>&1;; - esac - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Hooray, you did! I was beginning to wonder." - else - echo 'Uh-uh. Time to get fancy...' - echo 'Trying (cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)' - cppstdin='(cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)' - cppminus=''; - $cppstdin testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Eureka!." - else - dflt=blurfl - $echo $n "No dice. I can't find a C preprocessor. Name one: $c" - rp='Name a C preprocessor:' - . myread - cppstdin="$ans" - $cppstdin testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "OK, that will do." - else - echo "Sorry, I can't get that to work. Go find one." - exit 1 - fi - fi - fi - fi - fi - fi - fi - fi -fi -rm -f testcpp.c testcpp.out - -: get C preprocessor symbols handy -echo " " -: AIX 3.2 rejects tr '[ - ]' because the range endpoints are the same. -echo $attrlist | $tr ' ' '\012' >Cppsym.know -$cat <Cppsym -$startsh -case "\$1" in --l) list=true - shift - ;; -esac -unknown='' -case "\$list\$#" in -1|2) - for sym do - if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then - exit 0 - elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then - : - else - unknown="\$unknown \$sym" - fi - done - set X \$unknown - shift - ;; -esac -case \$# in -0) exit 1;; -esac -echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\ -#ifdef \1\\ -exit 0; _ _ _ _\1\\ \1\\ -#endif\\ -/' >/tmp/Cppsym\$\$ -echo exit 1 >>/tmp/Cppsym\$\$ -$cppstdin $cppminus /tmp/Cppsym2\$\$ -case "\$list" in -true) awk 'NF > 5 {print substr(\$6,2,100)}' Cppsym.true -cat Cppsym.true -rmlist="$rmlist Cppsym Cppsym.know Cppsym.true" - -: see how many register declarations we want to use -case "$registers" in -'') - if Cppsym vax; then - dflt=6 - elif Cppsym sun mc68000 mc68k m68k; then - dflt=10 - elif Cppsym pyr; then - dflt=14 - elif Cppsym ns32000 ns16000; then - dflt=5 - elif Cppsym $smallmach; then - dflt=3 - else - : if you have any other numbers for me, send them in - dflt=6 - fi - ;; -*) dflt=$registers ;; -esac -cat <.foo -. .foo -awk "BEGIN { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \ - .foo -. .foo -rm -f .foo - -: preserve RCS keywords in files with variable substitution, grrr -Log='$Log' -Header='$Header' - -: set up shell script to do ~ expansion -cat >filexp <&2 - exit 1 - fi - case "\$1" in - */*) - echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` - ;; - *) - echo \$dir - ;; - esac - fi - ;; -*) - echo \$1 - ;; -esac -EOSS -chmod +x filexp -$eunicefix filexp - -: determine where public executables go -case "$bin" in -'') - dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` - ;; -*) dflt="$bin" - ;; -esac -cont=true -while $test "$cont" ; do - echo " " - rp="Where do you want to put the public executables? [$dflt]" - $echo $n "$rp $c" - . myread - bin="$ans" - bin=`filexp $bin` - if test -d $bin; then - cont='' - else - dflt=n - rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]" - $echo $n "$rp $c" - . myread - dflt='' - case "$ans" in - y*) cont='';; - esac - fi -done - -: determine where manual pages go -case "$mansrc" in -'') - dflt=`loc . /usr/man/man1 /usr/local/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1` - ;; -*) dflt="$mansrc" - ;; -esac -cont=true -while $test "$cont" ; do - echo " " - rp="Where do the manual pages (source) go? [$dflt]" - $echo $n "$rp $c" - . myread - mansrc=`filexp "$ans"` - if test -d $mansrc; then - cont='' - else - dflt=n - rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]" - $echo $n "$rp $c" - . myread - dflt='' - case "$ans" in - y*) cont='';; - esac - fi -done -case "$mansrc" in -*l) - manext=l - ;; -*n) - manext=n - ;; -*C) - manext=C - ;; -*) - manext=1 - ;; -esac - -: see what memory models we can support -case "$models" in -'') - if Cppsym pdp11; then - dflt='unsplit split' - else - ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` - case "$ans" in - X) dflt='none';; - *) if $test -d /lib/small || $test -d /usr/lib/small; then - dflt='small' - else - dflt='' - fi - if $test -d /lib/medium || $test -d /usr/lib/medium; then - dflt="$dflt medium" - fi - if $test -d /lib/large || $test -d /usr/lib/large; then - dflt="$dflt large" - fi - if $test -d /lib/huge || $test -d /usr/lib/huge; then - dflt="$dflt huge" - fi - esac - fi - ;; -*) dflt="$models" ;; -esac -$cat </dev/null 2>&1 || \ - $contains '-i' $mansrc/cc.1 >/dev/null 2>&1; then - dflt='-i' - else - dflt='none' - fi - ;; - *) dflt="$split";; - esac - rp="What flag indicates separate I and D space? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans='';; - esac - split="$ans" - unsplit='' - ;; -*large*|*small*|*medium*|*huge*) - case "$model" in - *large*) - case "$large" in - '') dflt='-Ml';; - *) dflt="$large";; - esac - rp="What flag indicates large model? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans=''; - esac - large="$ans" - ;; - *) large='';; - esac - case "$model" in - *huge*) - case "$huge" in - '') dflt='-Mh';; - *) dflt="$huge";; - esac - rp="What flag indicates huge model? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans=''; - esac - huge="$ans" - ;; - *) huge="$large";; - esac - case "$model" in - *medium*) - case "$medium" in - '') dflt='-Mm';; - *) dflt="$medium";; - esac - rp="What flag indicates medium model? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans=''; - esac - medium="$ans" - ;; - *) medium="$large";; - esac - case "$model" in - *small*) - case "$small" in - '') dflt='none';; - *) dflt="$small";; - esac - rp="What flag indicates small model? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans=''; - esac - small="$ans" - ;; - *) small='';; - esac - ;; -*) - echo "Unrecognized memory models--you may have to edit Makefile.SH" - ;; -esac - -case "$ccflags" in -'') dflt='none';; -*) dflt="$ccflags";; -esac -echo " " -rp="Any additional cc flags? [$dflt]" -$echo $n "$rp $c" -. myread -case "$ans" in -none) ans=''; -esac -ccflags="$ans" - -case "$ldflags" in -'') if venix; then - dflt='-i -z' - elif xenix; then - if test -f /usr/include/dirent.h; then - dflt='-ldir -lx' - else - dflt='-lx' - fi - else - dflt='none' - fi - ;; -*) dflt="$ldflags";; -esac -echo " " -rp="Any additional ld flags? [$dflt]" -$echo $n "$rp $c" -. myread -case "$ans" in -none) ans=''; -esac -ldflags="$ans" - -: see if we need a special compiler -echo " " -if usg; then - case "$cc" in - '') - case "$Mcc" in - /*) dflt='Mcc' - ;; - *) - case "$large" in - -M*) - dflt='cc' - ;; - *) - if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then - dflt='cc -M' - else - dflt='cc' - fi - ;; - esac - ;; - esac - ;; - *) dflt="$cc";; - esac - $cat <<'EOM' - -On some systems the default C compiler will not resolve multiple global -references that happen to have the same name. On some such systems the -"Mcc" command may be used to force these to be resolved. On other systems -a "cc -M" command is required. (Note that the -M flag on other systems -indicates a memory model to use!) What command will force resolution on -EOM - $echo $n "this system? [$dflt] $c" - rp="Command to resolve multiple refs? [$dflt]" - . myread - cc="$ans" -else - echo "Not a USG system--assuming cc can resolve multiple definitions." - cc=cc -fi - -echo " " -echo "End of configuration questions." -echo " " - -: create config.sh file -echo " " -if test -d ../UU; then - cd .. -fi -echo "Creating config.sh..." -$spitshell <config.sh -$startsh -# config.sh -# This file was produced by running the Configure script. - -d_eunice='$d_eunice' -eunicefix='$eunicefix' -define='$define' -loclist='$loclist' -expr='$expr' -sed='$sed' -echo='$echo' -cat='$cat' -rm='$rm' -mv='$mv' -cp='$cp' -tail='$tail' -tr='$tr' -mkdir='$mkdir' -sort='$sort' -uniq='$uniq' -grep='$grep' -trylist='$trylist' -test='$test' -inews='$inews' -egrep='$egrep' -more='$more' -pg='$pg' -Mcc='$Mcc' -vi='$vi' -mailx='$mailx' -mail='$mail' -cpp='$cpp' -Log='$Log' -Header='$Header' -bin='$bin' -cc='$cc' -contains='$contains' -cppstdin='$cppstdin' -cppminus='$cppminus' -d_charsprf='$d_charsprf' -d_flexfnam='$d_flexfnam' -d_index='$d_index' -d_voidsig='$d_voidsig' -d_dirheader='$d_dirheader' -d_unistd='$d_unistd' -libc='$libc' -mansrc='$mansrc' -manext='$manext' -models='$models' -split='$split' -small='$small' -medium='$medium' -large='$large' -huge='$huge' -ccflags='$ccflags' -ldflags='$ldflags' -n='$n' -c='$c' -package='$package' -registers='$registers' -reg1='$reg1' -reg2='$reg2' -reg3='$reg3' -reg4='$reg4' -reg5='$reg5' -reg6='$reg6' -reg7='$reg7' -reg8='$reg8' -reg9='$reg9' -reg10='$reg10' -reg11='$reg11' -reg12='$reg12' -reg13='$reg13' -reg14='$reg14' -reg15='$reg15' -reg16='$reg16' -spitshell='$spitshell' -shsharp='$shsharp' -sharpbang='$sharpbang' -startsh='$startsh' -voidflags='$voidflags' -defvoidused='$defvoidused' -CONFIG=true -EOT - -CONFIG=true - -echo " " -dflt='' -fastread='' -echo "If you didn't make any mistakes, then just type a carriage return here." -rp="If you need to edit config.sh, do it as a shell escape here:" -$echo $n "$rp $c" -. UU/myread -case "$ans" in -'') ;; -*) : in case they cannot read - eval $ans;; -esac -. ./config.sh - -echo " " -echo "Doing variable substitutions on .SH files..." -set x `awk '{print $1}' /dev/null 2>&1; then - dflt=n - $cat < makedepend.out &" -It can take a while, so you might not want to run it right now. - -EOM - rp="Run make depend now? [$dflt]" - $echo $n "$rp $c" - . UU/myread - case "$ans" in - y*) make depend - echo "Now you must run a make." - ;; - *) echo "You must run 'make depend' then 'make'." - ;; - esac -elif test -f Makefile; then - echo " " - echo "Now you must run a make." -else - echo "Done." -fi - -$rm -f kit*isdone -: the following is currently useless -cd UU && $rm -f $rmlist -: since this removes it all anyway -cd .. && $rm -rf UU -: end of Configure Index: xc/util/patch/EXTERN.h diff -u xc/util/patch/EXTERN.h:1.1.1.3 xc/util/patch/EXTERN.h:removed --- xc/util/patch/EXTERN.h:1.1.1.3 Tue Jan 16 18:41:30 2001 +++ xc/util/patch/EXTERN.h Fri Jan 18 15:27:47 2002 @@ -1,21 +0,0 @@ -/* oldHeader: EXTERN.h,v 2.0 86/09/17 15:35:37 lwall 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. - * - */ - -#ifdef EXT -#undef EXT -#endif -#define EXT extern - -#ifdef INIT -#undef INIT -#endif -#define INIT(x) - -#ifdef DOINIT -#undef DOINIT -#endif Index: xc/util/patch/INTERN.h diff -u xc/util/patch/INTERN.h:1.1.1.3 xc/util/patch/INTERN.h:removed --- xc/util/patch/INTERN.h:1.1.1.3 Tue Jan 16 18:41:31 2001 +++ xc/util/patch/INTERN.h Fri Jan 18 15:27:47 2002 @@ -1,19 +0,0 @@ -/* oldHeader: INTERN.h,v 2.0 86/09/17 15:35:58 lwall 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. - * - */ - -#ifdef EXT -#undef EXT -#endif -#define EXT - -#ifdef INIT -#undef INIT -#endif -#define INIT(x) = x - -#define DOINIT Index: xc/util/patch/MANIFEST diff -u xc/util/patch/MANIFEST:1.1.1.1 xc/util/patch/MANIFEST:removed --- xc/util/patch/MANIFEST:1.1.1.1 Wed Apr 27 03:36:22 1994 +++ xc/util/patch/MANIFEST Fri Jan 18 15:27:47 2002 @@ -1,27 +0,0 @@ -After all the patch kits are run you should have the following files: - -Filename Kit Description --------- --- ----------- -Configure 1 A shell script that installs everything system dependent. -EXTERN.h 4 Toggle .h files to look foreign. -INTERN.h 4 Toggle .h files to look domestic. -MANIFEST 2 This list of files. -Makefile.SH 2 The makefile. -README 1 Installation instructions. -backupfile.c 4 Make Emacs style backup file names. -backupfile.h 4 Declarations to make Emacs style backup file names. -common.h 3 Common definitions. -config.H 4 Sample config.h, in case Configure won't run. -config.h.SH 3 Produces config.h. -inp.c 3 Input file abstract data type routines. -inp.h 3 Public defs for above. -malloc.c 1 An optional malloc package. -patch.c 3 The patch program. -patch.man 2 Manual page for patch. -patchlevel.h 4 The patch level of the patch program. -pch.c 2 Patch abstract data type routines. -pch.h 3 Public defs for above. -util.c 3 Utility routines. -util.h 3 Public defs for above. -version.c 1 Version number routine. -version.h 4 Public defs for above. Index: xc/util/patch/Makefile.SH diff -u xc/util/patch/Makefile.SH:1.1.1.3 xc/util/patch/Makefile.SH:removed --- xc/util/patch/Makefile.SH:1.1.1.3 Tue Jan 16 18:41:32 2001 +++ xc/util/patch/Makefile.SH Fri Jan 18 15:27:47 2002 @@ -1,116 +0,0 @@ -case $CONFIG in - '') . config.sh ;; -esac -echo "Extracting Makefile (with variable substitutions)" -cat >Makefile <>Makefile <<'!NO!SUBS!' - -public = patch -private = -manpages = patch.man -util = Makefile - -c = patch.c pch.c inp.c util.c version.c backupfile.c - -obj = patch.o pch.o inp.o util.o version.o backupfile.o - -lintflags = -phbvxac - -addedbyconf = Makefile Makefile.old bsd config.h config.sh eunice loc pdp11 usg v7 - -# grrr -SHELL = /bin/sh - -.c.o: - $(CC) -c $(CFLAGS) $(LARGE) $*.c - -all: $(public) $(private) $(util) - @echo Done. - -patch: $(obj) - $(CC) $(LDFLAGS) $(obj) $(libs) -o patch - -config.h: config.h.SH - sh config.h.SH - -# won't work with csh -install: patch - export PATH || exit 1 - -mv $(bin)/patch $(bin)/patch.old - cp patch $(bin)/patch - chmod 755 $(bin)/patch - -cp patch.man $(mansrc)/patch.$(manext) - -uninstall: - rm -f $(bin)/patch $(mansrc)/patch.$(manext) - test ! -f $(bin)/patch.old || mv $(bin)/patch.old $(bin)/patch - -clean: - rm -f patch *.o core - -mostlyclean: clean - -distclean: clean - rm -f $(addedbyconf) - -realclean: distclean - -DISTFILES=ChangeLog Configure EXTERN.h INTERN.h MANIFEST Makefile.SH \ -README common.h config.H config.h.SH inp.c inp.h malloc.c patch.c patch.man \ -patchlevel.h pch.c pch.h util.c util.h version.c version.h backupfile.c \ -backupfile.h - -dist: $(DISTFILES) - echo patch-2.0.`sed -e '/PATCHLEVEL/!d' -e 's/[^0-9]*\([0-9a-z.]*\).*/\1/' -e q patchlevel.h` > .fname - rm -rf `cat .fname` - mkdir `cat .fname` - ln $(DISTFILES) `cat .fname` - tar chZf `cat .fname`.tar.Z `cat .fname` - rm -rf `cat .fname` .fname - -# The following lint has practically everything turned on. Unfortunately, -# you have to wade through a lot of mumbo jumbo that can't be suppressed. -# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message -# for that spot. - -lint: - lint $(lintflags) $(defs) $(c) > patch.fuzz - -patch.o: config.h common.h patch.c inp.h pch.h util.h version.h backupfile.h -pch.o: config.h common.h pch.c pch.h util.h -inp.o: config.h common.h inp.c inp.h util.h -util.o: config.h common.h util.c util.h backupfile.h -version.o: config.h common.h version.c version.h patchlevel.h util.h -backupfile.o: config.h backupfile.c backupfile.h - -!NO!SUBS! -$eunicefix Makefile Index: xc/util/patch/Makefile.nt diff -u xc/util/patch/Makefile.nt:1.1.1.2 xc/util/patch/Makefile.nt:removed --- xc/util/patch/Makefile.nt:1.1.1.2 Tue Jan 16 18:41:33 2001 +++ xc/util/patch/Makefile.nt Fri Jan 18 15:27:47 2002 @@ -1,41 +0,0 @@ -# $Xorg: Makefile.nt,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ - -# Simple Makefile for MS Windows NT. - -CC = cl - -LIBS = crtdll.lib kernel32.lib - -CFLAGS = -Zi -Od -DWIN32 -D_DLL -D_MT -D__STDC__ -DX_86_ -nologo -LDFLAGS = -link -debug:full -debugtype:cv - -SRCS = backupfile.c getopt.c getopt1.c inp.c patch.c pch.c util.c \ - version.c - -OBJS = backupfile.obj getopt.obj getopt1.obj inp.obj patch.obj pch.obj \ - util.obj version.obj - -HDRS = EXTERN.h INTERN.h backupfile.h common.h getopt.h \ - inp.h patchlevel.h pch.h util.h version.h - -all: patch.exe - -patch.exe: $(OBJS) - $(CC) $(OBJS) $(LIBS) -o $@ $(LDFLAGS) - -.c.obj: - if exist $@ del $@ - $(CC) -c -DHAVE_CONFIG_H -I. $(CPPFLAGS) $(CFLAGS) $< - -clean: - rm -f patch.exe *.obj - -backupfile.obj: $(HDRS) -getopt.obj: $(HDRS) -getopt1.obj: $(HDRS) -inp.obj: $(HDRS) -patch.obj: $(HDRS) -pch.obj: $(HDRS) -util.obj: $(HDRS) -version.obj: $(HDRS) - Index: xc/util/patch/README diff -u xc/util/patch/README:1.1.1.1 xc/util/patch/README:removed --- xc/util/patch/README:1.1.1.1 Wed Apr 27 03:36:22 1994 +++ xc/util/patch/README Fri Jan 18 15:27:47 2002 @@ -1,98 +0,0 @@ -This version of patch contains modifications made by the Free Software -Foundation, summarized in the file ChangeLog. Primarily they are to -support the unified context diff format that GNU diff can produce, and -to support making GNU Emacs-style backup files. They also include -fixes for some bugs. - -There are two GNU variants of patch: this one, which retains Larry -Wall's interactive Configure script and has patchlevels starting with -`12u'; and another one that has a GNU-style non-interactive configure -script and accepts long-named options, and has patchlevels starting -with `12g'. Unlike the 12g variant, the 12u variant contains no -copylefted code, for the paranoid. The two variants are otherwise the -same. They should be available from the same places. - -The FSF is distributing this version of patch independently because as -of this writing, Larry Wall has not released a new version of patch -since mid-1988. I have heard that he has been too busy working on -other things, like Perl. - -Here is a wish list of some projects to improve patch: - -1. Correctly handle files and patchfiles that contain NUL characters. -This is hard to do straightforwardly; it would be less work to -adopt a kind of escape encoding internally. -Let ESC be a "control prefix". ESC @ stands for NUL. ESC [ stands for ESC. -You need to crunch this when reading input (replace fgets), -and when writing the output file (replace fputs), -but otherwise everything can go along as it does now. -Be careful to handle reject files correctly; -I think they are currently created using `write', not `fputs'. - -2. Correctly handle patches produced by GNU diff for files that do -not end with a newline. - -Please send bug reports for this version of patch to -bug-gnu-utils@prep.ai.mit.edu as well as to Larry Wall (lwall@netlabs.com). - --djm@gnu.ai.mit.edu (David MacKenzie) - - Patch Kit, Version 2.0 - - Copyright (c) 1988, Larry Wall - -You may copy the patch kit in whole or in part as long as you don't try to -make money off it, or pretend that you wrote it. --------------------------------------------------------------------------- - -Please read all the directions below before you proceed any further, and -then follow them carefully. Failure to do so may void your warranty. :-) - -After you have unpacked your kit, you should have all the files listed -in MANIFEST. - -Installation - -1) Run Configure. This will figure out various things about your system. - Some things Configure will figure out for itself, other things it will - ask you about. It will then proceed to make config.h, config.sh, and - Makefile. - - You might possibly have to trim # comments from the front of Configure - if your sh doesn't handle them, but all other # comments will be taken - care of. - - If you don't have sh, you'll have to rip the prototype of config.h out - of Configure and generate the defines by hand. - -2) Glance through config.h to make sure system dependencies are correct. - Most of them should have been taken care of by running the - Configure script. - - If you have any additional changes to make to the C definitions, they - can be done in the Makefile, or in config.h. Bear in mind that they may - get undone next time you run Configure. - -3) make - - This will attempt to make patch in the current directory. - -4) make install - - This will put patch into a public directory (normally /usr/local/bin). - It will also try to put the man pages in a reasonable place. It will not - nroff the man page, however. - -5) Read the manual entry before running patch. - -6) IMPORTANT! Help save the world! Communicate any problems and - suggested patches to me, lwall@netlabs.com (Larry Wall), - so we can keep the world in sync. If you have a problem, there's - someone else out there who either has had or will have the same problem. - - If possible, send in patches such that the patch program will apply them. - Context diffs are the best, then normal diffs. Don't send ed scripts-- - I've probably changed my copy since the version you have. - - Watch for patch patches in comp.sources.bugs. Patches will generally be - in a form usable by the patch program. Your current patch level - is shown in patchlevel.h. Index: xc/util/patch/backupfile.c diff -u xc/util/patch/backupfile.c:1.1.1.3 xc/util/patch/backupfile.c:removed --- xc/util/patch/backupfile.c:1.1.1.3 Tue Jan 16 18:41:35 2001 +++ xc/util/patch/backupfile.c Fri Jan 18 15:27:47 2002 @@ -1,340 +0,0 @@ -/* backupfile.c -- make Emacs style backup file names - Copyright (C) 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it without restriction. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ - -/* $Xorg: backupfile.c,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ */ - -/* David MacKenzie . - Some algorithms adapted from GNU Emacs. */ - -#include -#include -#include -#include "backupfile.h" -#include "config.h" -char *index (); -char *rindex (); -char *malloc (); - -#ifdef DIRENT -#include -#ifdef direct -#undef direct -#endif -#define direct dirent -#define NLENGTH(direct) (strlen((direct)->d_name)) -#else /* !DIRENT */ -#define NLENGTH(direct) ((direct)->d_namlen) -#ifdef USG -#ifdef SYSNDIR -#include -#else /* !SYSNDIR */ -#include -#endif /* !SYSNDIR */ -#else /* !USG */ -#ifdef SYSDIR -#include -#endif /* SYSDIR */ -#endif /* !USG */ -#endif /* !DIRENT */ - -#ifndef isascii -#define ISDIGIT(c) (isdigit ((unsigned char) (c))) -#else -#define ISDIGIT(c) (isascii (c) && isdigit (c)) -#endif - -#if defined (HAVE_UNISTD_H) -#include -#endif - -#if defined (_POSIX_VERSION) -/* POSIX does not require that the d_ino field be present, and some - systems do not provide it. */ -#define REAL_DIR_ENTRY(dp) 1 -#else -#define REAL_DIR_ENTRY(dp) ((dp)->d_ino != 0) -#endif - -/* Which type of backup file names are generated. */ -enum backup_type backup_type = none; - -/* The extension added to file names to produce a simple (as opposed - to numbered) backup file name. */ -char *simple_backup_suffix = "~"; - -char *basename (); -char *dirname (); -static char *concat (); -char *find_backup_file_name (); -static char *make_version_name (); -static int max_backup_version (); -static int version_number (); - -/* Return NAME with any leading path stripped off. */ - -char * -basename (name) - char *name; -{ - char *base; - - base = rindex (name, '/'); - return base ? base + 1 : name; -} - -#ifndef NODIR -/* Return the name of the new backup file for file FILE, - allocated with malloc. Return 0 if out of memory. - FILE must not end with a '/' unless it is the root directory. - Do not call this function if backup_type == none. */ - -char * -find_backup_file_name (file) - char *file; -{ - char *dir; - char *base_versions; - int highest_backup; - - if (backup_type == simple) - return concat (file, simple_backup_suffix); - base_versions = concat (basename (file), ".~"); - if (base_versions == 0) - return 0; - dir = dirname (file); - if (dir == 0) - { - free (base_versions); - return 0; - } - highest_backup = max_backup_version (base_versions, dir); - free (base_versions); - free (dir); - if (backup_type == numbered_existing && highest_backup == 0) - return concat (file, simple_backup_suffix); - return make_version_name (file, highest_backup + 1); -} - -/* Return the number of the highest-numbered backup file for file - FILE in directory DIR. If there are no numbered backups - of FILE in DIR, or an error occurs reading DIR, return 0. - FILE should already have ".~" appended to it. */ - -static int -max_backup_version (file, dir) - char *file, *dir; -{ - DIR *dirp; - struct direct *dp; - int highest_version; - int this_version; - int file_name_length; - - dirp = opendir (dir); - if (!dirp) - return 0; - - highest_version = 0; - file_name_length = strlen (file); - - while ((dp = readdir (dirp)) != 0) - { - if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length) - continue; - - this_version = version_number (file, dp->d_name, file_name_length); - if (this_version > highest_version) - highest_version = this_version; - } - closedir (dirp); - return highest_version; -} - -/* Return a string, allocated with malloc, containing - "FILE.~VERSION~". Return 0 if out of memory. */ - -static char * -make_version_name (file, version) - char *file; - int version; -{ - char *backup_name; - - backup_name = malloc (strlen (file) + 16); - if (backup_name == 0) - return 0; - sprintf (backup_name, "%s.~%d~", file, version); - return backup_name; -} - -/* If BACKUP is a numbered backup of BASE, return its version number; - otherwise return 0. BASE_LENGTH is the length of BASE. - BASE should already have ".~" appended to it. */ - -static int -version_number (base, backup, base_length) - char *base; - char *backup; - int base_length; -{ - int version; - char *p; - - version = 0; - if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length])) - { - for (p = &backup[base_length]; ISDIGIT (*p); ++p) - version = version * 10 + *p - '0'; - if (p[0] != '~' || p[1]) - version = 0; - } - return version; -} - -/* Return the newly-allocated concatenation of STR1 and STR2. - If out of memory, return 0. */ - -static char * -concat (str1, str2) - char *str1, *str2; -{ - char *newstr; - char str1_length = strlen (str1); - - newstr = malloc (str1_length + strlen (str2) + 1); - if (newstr == 0) - return 0; - strcpy (newstr, str1); - strcpy (newstr + str1_length, str2); - return newstr; -} - -/* Return the leading directories part of PATH, - allocated with malloc. If out of memory, return 0. - Assumes that trailing slashes have already been - removed. */ - -char * -dirname (path) - char *path; -{ - char *newpath; - char *slash; - int length; /* Length of result, not including NUL. */ - - slash = rindex (path, '/'); - if (slash == 0) - { - /* File is in the current directory. */ - path = "."; - length = 1; - } - else - { - /* Remove any trailing slashes from result. */ - while (slash > path && *slash == '/') - --slash; - - length = slash - path + 1; - } - newpath = malloc (length + 1); - if (newpath == 0) - return 0; - strncpy (newpath, path, length); - newpath[length] = 0; - return newpath; -} - -/* If ARG is an unambiguous match for an element of the - null-terminated array OPTLIST, return the index in OPTLIST - of the matched element, else -1 if it does not match any element - or -2 if it is ambiguous (is a prefix of more than one element). */ - -int -argmatch (arg, optlist) - char *arg; - char **optlist; -{ - int i; /* Temporary index in OPTLIST. */ - int arglen; /* Length of ARG. */ - int matchind = -1; /* Index of first nonexact match. */ - int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */ - - arglen = strlen (arg); - - /* Test all elements for either exact match or abbreviated matches. */ - for (i = 0; optlist[i]; i++) - { - if (!strncmp (optlist[i], arg, arglen)) - { - if (strlen (optlist[i]) == arglen) - /* Exact match found. */ - return i; - else if (matchind == -1) - /* First nonexact match found. */ - matchind = i; - else - /* Second nonexact match found. */ - ambiguous = 1; - } - } - if (ambiguous) - return -2; - else - return matchind; -} - -/* Error reporting for argmatch. - KIND is a description of the type of entity that was being matched. - VALUE is the invalid value that was given. - PROBLEM is the return value from argmatch. */ - -void -invalid_arg (kind, value, problem) - char *kind; - char *value; - int problem; -{ - fprintf (stderr, "patch: "); - if (problem == -1) - fprintf (stderr, "invalid"); - else /* Assume -2. */ - fprintf (stderr, "ambiguous"); - fprintf (stderr, " %s `%s'\n", kind, value); -} - -static char *backup_args[] = -{ - "never", "simple", "nil", "existing", "t", "numbered", 0 -}; - -static enum backup_type backup_types[] = -{ - simple, simple, numbered_existing, numbered_existing, numbered, numbered -}; - -/* Return the type of backup indicated by VERSION. - Unique abbreviations are accepted. */ - -enum backup_type -get_version (version) - char *version; -{ - int i; - - if (version == 0 || *version == 0) - return numbered_existing; - i = argmatch (version, backup_args); - if (i >= 0) - return backup_types[i]; - invalid_arg ("version control type", version, i); - exit (1); -} -#endif /* NODIR */ Index: xc/util/patch/backupfile.h diff -u xc/util/patch/backupfile.h:1.1.1.1 xc/util/patch/backupfile.h:removed --- xc/util/patch/backupfile.h:1.1.1.1 Wed Apr 27 03:36:27 1994 +++ xc/util/patch/backupfile.h Fri Jan 18 15:27:47 2002 @@ -1,37 +0,0 @@ -/* backupfile.h -- declarations for making Emacs style backup file names - Copyright (C) 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it without restriction. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ - -/* When to make backup files. */ -enum backup_type -{ - /* Never make backups. */ - none, - - /* Make simple backups of every file. */ - simple, - - /* Make numbered backups of files that already have numbered backups, - and simple backups of the others. */ - numbered_existing, - - /* Make numbered backups of every file. */ - numbered -}; - -extern enum backup_type backup_type; -extern char *simple_backup_suffix; - -#ifdef __STDC__ -char *find_backup_file_name (char *file); -enum backup_type get_version (char *version); -#else -char *find_backup_file_name (); -enum backup_type get_version (); -#endif Index: xc/util/patch/common.h diff -u xc/util/patch/common.h:3.1 xc/util/patch/common.h:removed --- xc/util/patch/common.h:3.1 Wed Jan 17 18:20:07 2001 +++ xc/util/patch/common.h Fri Jan 18 15:27:47 2002 @@ -1,214 +0,0 @@ -/* oldHeader: common.h,v 2.0.1.2 88/06/22 20:44:53 lwall Locked $ - * $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 - * - * Revision 2.0.1.1 88/06/03 15:01:56 lwall - * patch10: support for shorter extensions. - * - * Revision 2.0 86/09/17 15:36:39 lwall - * Baseline for netwide release. - * - */ - -#define DEBUGGING - -#define VOIDUSED 7 -#include "config.h" - -/* shut lint up about the following when return value ignored */ - -#define Signal (void)signal -#define Unlink (void)unlink -#define Lseek (void)lseek -#define Fseek (void)fseek -#define Fstat (void)fstat -#define Pclose (void)pclose -#define Close (void)close -#define Fclose (void)fclose -#define Fflush (void)fflush -#define Sprintf (void)sprintf -#define Mktemp (void)mktemp -#define Strcpy (void)strcpy -#define Strcat (void)strcat - -/* NeXT declares malloc and realloc incompatibly from us in some of - these files. Temporarily redefine them to prevent errors. */ -#define malloc system_malloc -#define realloc system_realloc -#include -#include -#include -#include -#include -#include -#include -#undef malloc -#undef realloc - -#ifdef WIN32 -#include "winnt.h" -#endif - -/* constants */ - -/* AIX predefines these. */ -#ifdef TRUE -#undef TRUE -#endif -#ifdef FALSE -#undef FALSE -#endif -#define TRUE (1) -#define FALSE (0) - -#define MAXHUNKSIZE 100000 /* is this enough lines? */ -#define INITHUNKMAX 125 /* initial dynamic allocation size */ -#define MAXLINELEN 1024 -#define BUFFERSIZE 1024 - -#define SCCSPREFIX "s." -#define GET "get %s" -#define GET_LOCKED "get -e %s" -#define SCCSDIFF "get -p %s | diff - %s >/dev/null" - -#define RCSSUFFIX ",v" -#define CHECKOUT "co %s" -#define CHECKOUT_LOCKED "co -l %s" -#define RCSDIFF "rcsdiff %s > /dev/null" - -#ifdef FLEXFILENAMES -#define ORIGEXT ".orig" -#define REJEXT ".rej" -#else -#define ORIGEXT "~" -#define REJEXT "#" -#endif - -/* handy definitions */ - -#define Null(t) ((t)0) -#define Nullch Null(char *) -#define Nullfp Null(FILE *) -#define Nulline Null(LINENUM) - -#define Ctl(ch) ((ch) & 037) - -#define strNE(s1,s2) (strcmp(s1, s2)) -#define strEQ(s1,s2) (!strcmp(s1, s2)) -#define strnNE(s1,s2,l) (strncmp(s1, s2, l)) -#define strnEQ(s1,s2,l) (!strncmp(s1, s2, l)) - -/* typedefs */ - -typedef char bool; -typedef long LINENUM; /* must be signed */ -typedef unsigned MEM; /* what to feed malloc */ - -/* globals */ - -EXT int Argc; /* guess */ -EXT char **Argv; -EXT int Argc_last; /* for restarting plan_b */ -EXT char **Argv_last; - -EXT struct stat filestat; /* file statistics area */ -EXT int filemode INIT(0644); - -EXT char buf[MAXLINELEN]; /* general purpose buffer */ -EXT FILE *ofp INIT(Nullfp); /* output file pointer */ -EXT FILE *rejfp INIT(Nullfp); /* reject file pointer */ - -#ifndef WIN32 -EXT int myuid; /* cache getuid return value */ -#endif - -EXT bool using_plan_a INIT(TRUE); /* try to keep everything in memory */ -EXT bool out_of_mem INIT(FALSE); /* ran out of memory in plan a */ - -#define MAXFILEC 2 -EXT int filec INIT(0); /* how many file arguments? */ -EXT char *filearg[MAXFILEC]; -EXT bool ok_to_create_file INIT(FALSE); -EXT char *bestguess INIT(Nullch); /* guess at correct filename */ - -EXT char *outname INIT(Nullch); -EXT char rejname[128]; - -EXT char *origprae INIT(Nullch); - -EXT char *TMPOUTNAME; -EXT char *TMPINNAME; -EXT char *TMPREJNAME; -EXT char *TMPPATNAME; -EXT bool toutkeep INIT(FALSE); -EXT bool trejkeep INIT(FALSE); - -EXT LINENUM last_offset INIT(0); -#ifdef DEBUGGING -EXT int debug INIT(0); -#endif -EXT LINENUM maxfuzz INIT(2); -EXT bool force INIT(FALSE); -EXT bool batch INIT(FALSE); -EXT bool verbose INIT(TRUE); -EXT bool reverse INIT(FALSE); -EXT bool noreverse INIT(FALSE); -EXT bool skip_rest_of_patch INIT(FALSE); -EXT int strippath INIT(957); -EXT bool canonicalize INIT(FALSE); - -#define CONTEXT_DIFF 1 -#define NORMAL_DIFF 2 -#define ED_DIFF 3 -#define NEW_CONTEXT_DIFF 4 -#define UNI_DIFF 5 -EXT int diff_type INIT(0); - -EXT bool do_defines INIT(FALSE); /* patch using ifdef, ifndef, etc. */ -EXT char if_defined[128]; /* #ifdef xyzzy */ -EXT char not_defined[128]; /* #ifndef xyzzy */ -EXT char else_defined[] INIT("#else\n");/* #else */ -EXT char end_defined[128]; /* #endif xyzzy */ - -EXT char *revision INIT(Nullch); /* prerequisite revision, if any */ - -#include -#ifndef errno -extern int errno; -#endif - -FILE *popen(); -char *malloc(); -char *realloc(); -long atol(); -char *getenv(); -char *strcpy(); -char *strcat(); -char *rindex(); -#if 0 -long lseek(); -#endif -char *mktemp(); -#if 0 /* This can cause a prototype conflict. */ -#ifdef CHARSPRINTF -char *sprintf(); -#else -int sprintf(); -#endif -#endif - -#ifndef WIN32 -#if !defined(S_ISDIR) && defined(S_IFDIR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif -#if !defined(S_ISREG) && defined(S_IFREG) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif -#else -#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) -#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) -#endif - - Index: xc/util/patch/config.H diff -u xc/util/patch/config.H:1.1.1.1 xc/util/patch/config.H:removed --- xc/util/patch/config.H:1.1.1.1 Wed Apr 27 03:36:23 1994 +++ xc/util/patch/config.H Fri Jan 18 15:27:47 2002 @@ -1,33 +0,0 @@ -/* config.h - * This file was produced by running the Configure script. - * Feel free to modify any of this as the need arises. - */ - - -#/*undef EUNICE /* no file linking? */ -#/*undef VMS - -#/*undef index strchr /* cultural */ -#/*undef rindex strrchr /* differences? */ - -#/*undef void int /* is void to be avoided? */ - -/* How many register declarations are paid attention to? */ - -#define Reg1 register -#define Reg2 register -#define Reg3 register -#define Reg4 register -#define Reg5 register -#define Reg6 register -#define Reg7 -#define Reg8 -#define Reg9 -#define Reg10 -#define Reg11 -#define Reg12 -#define Reg13 -#define Reg14 -#define Reg15 -#define Reg16 - Index: xc/util/patch/config.h.SH diff -u xc/util/patch/config.h.SH:1.1.1.1 xc/util/patch/config.h.SH:removed --- xc/util/patch/config.h.SH:1.1.1.1 Wed Apr 27 03:36:23 1994 +++ xc/util/patch/config.h.SH Fri Jan 18 15:27:47 2002 @@ -1,146 +0,0 @@ -case $CONFIG in -'') - if test ! -f config.sh; then - ln ../config.sh . || \ - ln ../../config.sh . || \ - ln ../../../config.sh . || \ - (echo "Can't find config.sh."; exit 1) - echo "Using config.sh from above..." - fi - . ./config.sh - ;; -esac -echo "Extracting config.h (with variable substitutions)" -cat <config.h -/* config.h - * This file was produced by running the config.h.SH script, which - * gets its values from config.sh, which is generally produced by - * running Configure. - * - * Feel free to modify any of this as the need arises. Note, however, - * that running config.h.SH again will wipe out any changes you've made. - * For a more permanent change edit config.sh and rerun config.h.SH. - */ - - -/* EUNICE: - * This symbol, if defined, indicates that the program is being compiled - * under the EUNICE package under VMS. The program will need to handle - * things like files that don't go away the first time you unlink them, - * due to version numbering. It will also need to compensate for lack - * of a respectable link() command. - */ -/* VMS: - * This symbol, if defined, indicates that the program is running under - * VMS. It is currently only set in conjunction with the EUNICE symbol. - */ -#$d_eunice EUNICE /**/ -#$d_eunice VMS /**/ - -/* CPPSTDIN: - * This symbol contains the first part of the string which will invoke - * the C preprocessor on the standard input and produce to standard - * output. Typical value of "cc -E" or "/lib/cpp". - */ -/* CPPMINUS: - * This symbol contains the second part of the string which will invoke - * the C preprocessor on the standard input and produce to standard - * output. This symbol will have the value "-" if CPPSTDIN needs a minus - * to specify standard input, otherwise the value is "". - */ -#define CPPSTDIN "$cppstdin" -#define CPPMINUS "$cppminus" - -/* CHARSPRINTF: - * This symbol is defined if this system declares "char *sprintf()" in - * stdio.h. The trend seems to be to declare it as "int sprintf()". It - * is up to the package author to declare sprintf correctly based on the - * symbol. - */ -/* #$d_charsprf CHARSPRINTF /**/ - -/* FLEXFILENAMES: - * This symbol, if defined, indicates that the system supports filenames - * longer than 14 characters. - */ -#$d_flexfnam FLEXFILENAMES /**/ - -/* index: - * This preprocessor symbol is defined, along with rindex, if the system - * uses the strchr and strrchr routines instead. - */ -/* rindex: - * This preprocessor symbol is defined, along with index, if the system - * uses the strchr and strrchr routines instead. - */ -#$d_index index strchr /* cultural */ -#$d_index rindex strrchr /* differences? */ - -/* VOIDSIG: - * This symbol is defined if this system declares "void (*signal())()" in - * signal.h. The old way was to declare it as "int (*signal())()". It - * is up to the package author to declare things correctly based on the - * symbol. - */ -#$d_voidsig VOIDSIG /**/ - -/* DIRHEADER: - * This definition indicates which directory library header to use. - */ -$d_dirheader - -/* HAVE_UNISTD_H: - * This is defined if the system has unistd.h. - */ -#$d_unistd HAVE_UNISTD_H /**/ - -/* Reg1: - * This symbol, along with Reg2, Reg3, etc. is either the word "register" - * or null, depending on whether the C compiler pays attention to this - * many register declarations. The intent is that you don't have to - * order your register declarations in the order of importance, so you - * can freely declare register variables in sub-blocks of code and as - * function parameters. Do not use Reg more than once per routine. - */ - -#define Reg1 $reg1 /**/ -#define Reg2 $reg2 /**/ -#define Reg3 $reg3 /**/ -#define Reg4 $reg4 /**/ -#define Reg5 $reg5 /**/ -#define Reg6 $reg6 /**/ -#define Reg7 $reg7 /**/ -#define Reg8 $reg8 /**/ -#define Reg9 $reg9 /**/ -#define Reg10 $reg10 /**/ -#define Reg11 $reg11 /**/ -#define Reg12 $reg12 /**/ -#define Reg13 $reg13 /**/ -#define Reg14 $reg14 /**/ -#define Reg15 $reg15 /**/ -#define Reg16 $reg16 /**/ - -/* VOIDFLAGS: - * This symbol indicates how much support of the void type is given by this - * compiler. What various bits mean: - * - * 1 = supports declaration of void - * 2 = supports arrays of pointers to functions returning void - * 4 = supports comparisons between pointers to void functions and - * addresses of void functions - * - * The package designer should define VOIDUSED to indicate the requirements - * of the package. This can be done either by #defining VOIDUSED before - * including config.h, or by defining defvoidused in Myinit.U. If the - * level of void support necessary is not present, defines void to int. - */ -#ifndef VOIDUSED -#define VOIDUSED $defvoidused -#endif -#define VOIDFLAGS $voidflags -#if (VOIDFLAGS & VOIDUSED) != VOIDUSED -#$define void int /* is void to be avoided? */ -#$define M_VOID /* Xenix strikes again */ -#endif - -!GROK!THIS! Index: xc/util/patch/config.h.nt diff -u xc/util/patch/config.h.nt:3.1 xc/util/patch/config.h.nt:removed --- xc/util/patch/config.h.nt:3.1 Wed Jan 17 18:20:07 2001 +++ xc/util/patch/config.h.nt Fri Jan 18 15:27:47 2002 @@ -1,82 +0,0 @@ - -/* $Xorg: config.h.nt,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ */ - -/* Portability variables. -*- C -*- */ - -/* Define if the system does not support the `const' keyword. */ -#undef const - -/* Define if the system supports file names longer than 14 characters. */ -#define HAVE_LONG_FILE_NAMES 1 - -/* Define if the system has pathconf(). */ -#undef HAVE_PATHCONF - -/* Define if the system has strerror(). */ -#define HAVE_STRERROR - -/* Define if the system has ANSI C header files and library functions. */ -#define STDC_HEADERS - -/* Define if the system uses strchr instead of index - and strrchr instead of rindex. */ -#define HAVE_STRING_H - -#if defined(STDC_HEADERS) || defined(HAVE_STRING_H) -#define index strchr -#define rindex strrchr -#endif - -/* Define if the system has unistd.h. */ -#undef HAVE_UNISTD_H - -/* Define as either int or void -- the type that signal handlers return. */ -#undef RETSIGTYPE - -#ifndef RETSIGTYPE -#define RETSIGTYPE void -#endif - -/* Which directory library header to use. */ -#undef DIRENT /* dirent.h */ -#undef SYSNDIR /* sys/ndir.h */ -#undef SYSDIR /* sys/dir.h */ -#undef NDIR /* ndir.h */ -#define DIRECT /* Windoze NT direct.h */ -#define NODIR /* none -- don't make numbered backup files */ - -/* Define if the system lets you pass fewer arguments to a function - than the function actually accepts (in the absence of a prototype). - Defining it makes I/O calls slightly more efficient. - You need not bother defining it unless your C preprocessor chokes on - multi-line arguments to macros. */ -#undef CANVARARG - -/* Define Reg* as either `register' or nothing, depending on whether - the C compiler pays attention to this many register declarations. - The intent is that you don't have to order your register declarations - in the order of importance, so you can freely declare register variables - in sub-blocks of code and as function parameters. - Do not use Reg more than once per routine. - - These don't really matter a lot, since most modern C compilers ignore - register declarations and often do a better job of allocating - registers than people do. */ - -#define Reg1 -#define Reg2 -#define Reg3 -#define Reg4 -#define Reg5 -#define Reg6 -#define Reg7 -#define Reg8 -#define Reg9 -#define Reg10 -#define Reg11 -#define Reg12 -#define Reg13 -#define Reg14 -#define Reg15 -#define Reg16 - Index: xc/util/patch/inp.c diff -u xc/util/patch/inp.c:1.1.1.3 xc/util/patch/inp.c:removed --- xc/util/patch/inp.c:1.1.1.3 Tue Jan 16 18:41:40 2001 +++ xc/util/patch/inp.c Fri Jan 18 15:27:47 2002 @@ -1,387 +0,0 @@ -/* $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. - * version "XC1" - * - * Revision 2.0.1.1 88/06/03 15:06:13 lwall - * patch10: made a little smarter about sccs files - * - * Revision 2.0 86/09/17 15:37:02 lwall - * Baseline for netwide release. - * - */ - -#include "EXTERN.h" -#include "common.h" -#include "util.h" -#include "pch.h" -#include "INTERN.h" -#include "inp.h" - -/* Input-file-with-indexable-lines abstract type */ - -static long i_size; /* size of the input file */ -static char *i_womp; /* plan a buffer for entire file */ -static char **i_ptr; /* pointers to lines in i_womp */ - -static int tifd = -1; /* plan b virtual string array */ -static char *tibuf[2]; /* plan b buffers */ -static LINENUM tiline[2] = {-1, -1}; /* 1st line in each buffer */ -static LINENUM lines_per_buf; /* how many lines per buffer */ -static int tireclen; /* length of records in tmp file */ - -/* New patch--prepare to edit another file. */ - -void -re_input() -{ - if (using_plan_a) { - i_size = 0; -#ifndef lint - if (i_ptr != Null(char**)) - free((char *)i_ptr); -#endif - if (i_womp != Nullch) - free(i_womp); - i_womp = Nullch; - i_ptr = Null(char **); - } - else { - using_plan_a = TRUE; /* maybe the next one is smaller */ - Close(tifd); - tifd = -1; - free(tibuf[0]); - free(tibuf[1]); - tibuf[0] = tibuf[1] = Nullch; - tiline[0] = tiline[1] = -1; - tireclen = 0; - } -} - -/* Constuct the line index, somehow or other. */ - -void -scan_input(filename) -char *filename; -{ - if (!plan_a(filename)) - plan_b(filename); - if (verbose) { - say3("Patching file %s using Plan %s...\n", filename, - (using_plan_a ? "A" : "B") ); - } -} - -/* Try keeping everything in memory. */ - -bool -plan_a(filename) -char *filename; -{ - int ifd, statfailed; - Reg1 char *s; - Reg2 LINENUM iline; - char lbuf[MAXLINELEN]; - int output_elsewhere = strcmp(filename, outname); - - statfailed = stat(filename, &filestat); - if (statfailed && ok_to_create_file) { - if (verbose) - say2("(Creating file %s...)\n",filename); - makedirs(filename, TRUE); - close(creat(filename, 0666)); - statfailed = stat(filename, &filestat); - } else if (!statfailed && ok_to_create_file) { - /* ok_to_create_file means the file either doesn't exist - or is zero-length. Since there is no context in the patch, - avoid doubling the file if the patch has already been applied - by bailing out here if these conditions are not met. */ - if (filestat.st_size != 0) - fatal2("supposedly new file \"%s\" already exists\n", filename); - } -#ifndef WIN32 - /* For nonexistent or read-only files, look for RCS or SCCS versions. */ - if (statfailed - || (! output_elsewhere - && (/* No one can write to it. */ - (filestat.st_mode & 0222) == 0 - /* I can't write to it. */ - || ((filestat.st_mode & 0022) == 0 - && filestat.st_uid != myuid)))) { - struct stat cstat; - char *cs = Nullch; - char *filebase; - int pathlen; - - filebase = basename(filename); - pathlen = filebase - filename; - - /* Put any leading path into `s'. - Leave room in lbuf for the diff command. */ - s = lbuf + 20; - strncpy(s, filename, pathlen); - -#define try(f, a1, a2) (Sprintf(s + pathlen, f, a1, a2), stat(s, &cstat) == 0) - if ( try("RCS/%s%s", filebase, RCSSUFFIX) - || try("RCS/%s" , filebase, 0) - || try( "%s%s", filebase, RCSSUFFIX)) { - Sprintf(buf, output_elsewhere?CHECKOUT:CHECKOUT_LOCKED, filename); - Sprintf(lbuf, RCSDIFF, filename); - cs = "RCS"; - } else if ( try("SCCS/%s%s", SCCSPREFIX, filebase) - || try( "%s%s", SCCSPREFIX, filebase)) { - Sprintf(buf, output_elsewhere?GET:GET_LOCKED, s); - Sprintf(lbuf, SCCSDIFF, s, filename); - cs = "SCCS"; - } else if (statfailed) - fatal2("can't find %s\n", filename); - /* else we can't write to it but it's not under a version - control system, so just proceed. */ - if (cs) { - if (!statfailed) { - if ((filestat.st_mode & 0222) != 0) - /* The owner can write to it. */ - fatal3("file %s seems to be locked by somebody else under %s\n", - filename, cs); - /* It might be checked out unlocked. See if it's safe to - check out the default version locked. */ - if (verbose) - say3("Comparing file %s to default %s version...\n", - filename, cs); - if (system(lbuf)) - fatal3("can't check out file %s: differs from default %s version\n", - filename, cs); - } - if (verbose) - say3("Checking out file %s from %s...\n", filename, cs); - if (system(buf) || stat(filename, &filestat)) - fatal3("can't check out file %s from %s\n", filename, cs); - } - } -#endif - filemode = filestat.st_mode; - if (!S_ISREG(filemode)) - fatal2("%s is not a normal file--can't patch\n", filename); - i_size = filestat.st_size; - if (out_of_mem) { - set_hunkmax(); /* make sure dynamic arrays are allocated */ - out_of_mem = FALSE; - return FALSE; /* force plan b because plan a bombed */ - } -#ifdef lint - i_womp = Nullch; -#else - i_womp = malloc((MEM)(i_size+2)); /* lint says this may alloc less than */ - /* i_size, but that's okay, I think. */ -#endif - if (i_womp == Nullch) - return FALSE; -#ifndef WIN32 - if ((ifd = open(filename, 0)) < 0) -#else - if ((ifd = open(filename, _O_RDONLY | _O_BINARY)) < 0) -#endif - pfatal2("can't open file %s", filename); -#ifndef lint - if (read(ifd, i_womp, (int)i_size) != i_size) { - Close(ifd); /* probably means i_size > 15 or 16 bits worth */ - free(i_womp); /* at this point it doesn't matter if i_womp was */ - return FALSE; /* undersized. */ - } -#endif - Close(ifd); - if (i_size && i_womp[i_size-1] != '\n') - i_womp[i_size++] = '\n'; - i_womp[i_size] = '\0'; - - /* count the lines in the buffer so we know how many pointers we need */ - - iline = 0; - for (s=i_womp; *s; s++) { - if (*s == '\n') - iline++; - } -#ifdef lint - i_ptr = Null(char**); -#else - i_ptr = (char **)malloc((MEM)((iline + 2) * sizeof(char *))); -#endif - if (i_ptr == Null(char **)) { /* shucks, it was a near thing */ - free((char *)i_womp); - return FALSE; - } - - /* now scan the buffer and build pointer array */ - - iline = 1; - i_ptr[iline] = i_womp; - for (s=i_womp; *s; s++) { - if (*s == '\n') - i_ptr[++iline] = s+1; /* these are NOT null terminated */ - } - input_lines = iline - 1; - - /* now check for revision, if any */ - - if (revision != Nullch) { - if (!rev_in_string(i_womp)) { - if (force) { - if (verbose) - say2( -"Warning: this file doesn't appear to be the %s version--patching anyway.\n", - revision); - } - else if (batch) { - fatal2( -"this file doesn't appear to be the %s version--aborting.\n", revision); - } - else { - ask2( -"This file doesn't appear to be the %s version--patch anyway? [n] ", - revision); - if (*buf != 'y') - fatal1("aborted\n"); - } - } - else if (verbose) - say2("Good. This file appears to be the %s version.\n", - revision); - } - return TRUE; /* plan a will work */ -} - -/* Keep (virtually) nothing in memory. */ - -void -plan_b(filename) -char *filename; -{ - Reg3 FILE *ifp; - Reg1 int i = 0; - Reg2 int maxlen = 1; - Reg4 bool found_revision = (revision == Nullch); - - using_plan_a = FALSE; -#ifndef WIN32 - if ((ifp = fopen(filename, "r")) == Nullfp) -#else - if ((ifp = fopen(filename, "rb")) == Nullfp) -#endif - pfatal2("can't open file %s", filename); -#ifndef WIN32 - if ((tifd = creat(TMPINNAME, 0666)) < 0) -#else - if ((tifd = open(TMPINNAME, _O_CREAT | _O_TRUNC | _O_BINARY, _S_IWRITE)) < 0) -#endif - pfatal2("can't open file %s", TMPINNAME); - while (fgets(buf, sizeof buf, ifp) != Nullch) { - if (revision != Nullch && !found_revision && rev_in_string(buf)) - found_revision = TRUE; - if ((i = strlen(buf)) > maxlen) - maxlen = i; /* find longest line */ - } - if (revision != Nullch) { - if (!found_revision) { - if (force) { - if (verbose) - say2( -"Warning: this file doesn't appear to be the %s version--patching anyway.\n", - revision); - } - else if (batch) { - fatal2( -"this file doesn't appear to be the %s version--aborting.\n", revision); - } - else { - ask2( -"This file doesn't appear to be the %s version--patch anyway? [n] ", - revision); - if (*buf != 'y') - fatal1("aborted\n"); - } - } - else if (verbose) - say2("Good. This file appears to be the %s version.\n", - revision); - } - Fseek(ifp, 0L, 0); /* rewind file */ - lines_per_buf = BUFFERSIZE / maxlen; - tireclen = maxlen; - tibuf[0] = malloc((MEM)(BUFFERSIZE + 1)); - tibuf[1] = malloc((MEM)(BUFFERSIZE + 1)); - if (tibuf[1] == Nullch) - fatal1("out of memory\n"); - for (i=1; ; i++) { - if (! (i % lines_per_buf)) /* new block */ - if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE) - pfatal1("can't write temp file"); - if (fgets(tibuf[0] + maxlen * (i%lines_per_buf), maxlen + 1, ifp) - == Nullch) { - input_lines = i - 1; - if (i % lines_per_buf) - if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE) - pfatal1("can't write temp file"); - break; - } - } - Fclose(ifp); - Close(tifd); - if ((tifd = open(TMPINNAME, 0)) < 0) { - pfatal2("can't reopen file %s", TMPINNAME); - } -} - -/* Fetch a line from the input file, \n terminated, not necessarily \0. */ - -char * -ifetch(line,whichbuf) -Reg1 LINENUM line; -int whichbuf; /* ignored when file in memory */ -{ - if (line < 1 || line > input_lines) - return ""; - if (using_plan_a) - return i_ptr[line]; - else { - LINENUM offline = line % lines_per_buf; - LINENUM baseline = line - offline; - - if (tiline[0] == baseline) - whichbuf = 0; - else if (tiline[1] == baseline) - whichbuf = 1; - else { - tiline[whichbuf] = baseline; -#ifndef lint /* complains of long accuracy */ - Lseek(tifd, (long)baseline / lines_per_buf * BUFFERSIZE, 0); -#endif - if (read(tifd, tibuf[whichbuf], BUFFERSIZE) < 0) - pfatal2("error reading tmp file %s", TMPINNAME); - } - return tibuf[whichbuf] + (tireclen*offline); - } -} - -/* True if the string argument contains the revision number we want. */ - -bool -rev_in_string(string) -char *string; -{ - Reg1 char *s; - Reg2 int patlen; - - if (revision == Nullch) - return TRUE; - patlen = strlen(revision); - if (strnEQ(string,revision,patlen) && isspace(string[patlen])) - return TRUE; - for (s = string; *s; s++) { - if (isspace(*s) && strnEQ(s+1, revision, patlen) && - isspace(s[patlen+1] )) { - return TRUE; - } - } - return FALSE; -} Index: xc/util/patch/inp.h diff -u xc/util/patch/inp.h:1.1.1.3 xc/util/patch/inp.h:removed --- xc/util/patch/inp.h:1.1.1.3 Tue Jan 16 18:41:41 2001 +++ xc/util/patch/inp.h Fri Jan 18 15:27:47 2002 @@ -1,18 +0,0 @@ -/* oldHeader: inp.h,v 2.0 86/09/17 15:37:25 lwall 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. - * - */ - -EXT LINENUM input_lines INIT(0); /* how long is input file in lines */ -EXT LINENUM last_frozen_line INIT(0); /* how many input lines have been */ - /* irretractibly output */ - -bool rev_in_string(); -void scan_input(); -bool plan_a(); /* returns false if insufficient memory */ -void plan_b(); -char *ifetch(); - Index: xc/util/patch/malloc.c diff -u xc/util/patch/malloc.c:3.0 xc/util/patch/malloc.c:removed --- xc/util/patch/malloc.c:3.0 Tue Feb 20 09:39:19 1996 +++ xc/util/patch/malloc.c Fri Jan 18 15:27:47 2002 @@ -1,469 +0,0 @@ -/* - * @(#)nmalloc.c 1 (Caltech) 2/21/82 - * - * U of M Modified: 20 Jun 1983 ACT: strange hacks for Emacs - * - * Nov 1983, Mike@BRL, Added support for 4.1C/4.2 BSD. - * - * This is a very fast storage allocator. It allocates blocks of a small - * number of different sizes, and keeps free lists of each size. Blocks - * that don't exactly fit are passed up to the next larger size. In this - * implementation, the available sizes are (2^n)-4 (or -16) bytes long. - * This is designed for use in a program that uses vast quantities of - * memory, but bombs when it runs out. To make it a little better, it - * warns the user when he starts to get near the end. - * - * June 84, ACT: modified rcheck code to check the range given to malloc, - * rather than the range determined by the 2-power used. - * - * Jan 85, RMS: calls malloc_warning to issue warning on nearly full. - * No longer Emacs-specific; can serve as all-purpose malloc for GNU. - * You should call malloc_init to reinitialize after loading dumped Emacs. - * Call malloc_stats to get info on memory stats if MSTATS turned on. - * realloc knows how to return same block given, just changing its size, - * if the power of 2 is correct. - */ - -/* - * nextf[i] is the pointer to the next free block of size 2^(i+3). The - * smallest allocatable block is 8 bytes. The overhead information will - * go in the first int of the block, and the returned pointer will point - * to the second. - * -#ifdef MSTATS - * nmalloc[i] is the difference between the number of mallocs and frees - * for a given block size. -#endif - */ - -#define ISALLOC ((char) 0xf7) /* magic byte that implies allocation */ -#define ISFREE ((char) 0x54) /* magic byte that implies free block */ - /* this is for error checking only */ - -extern char etext; - -/* end of the program; can be changed by calling init_malloc */ -static char *endofpure = &etext; - -#ifdef MSTATS -static int nmalloc[30]; -static int nmal, nfre; -#endif /* MSTATS */ - -/* If range checking is not turned on, all we have is a flag indicating - whether memory is allocated, an index in nextf[], and a size field; to - realloc() memory we copy either size bytes or 1<<(index+3) bytes depending - on whether the former can hold the exact size (given the value of - 'index'). If range checking is on, we always need to know how much space - is allocated, so the 'size' field is never used. */ - -struct mhead { - char mh_alloc; /* ISALLOC or ISFREE */ - char mh_index; /* index in nextf[] */ -/* Remainder are valid only when block is allocated */ - unsigned short mh_size; /* size, if < 0x10000 */ -#ifdef rcheck - unsigned mh_nbytes; /* number of bytes allocated */ - int mh_magic4; /* should be == MAGIC4 */ -#endif /* rcheck */ - }; - -/* Access free-list pointer of a block. - It is stored at block + 4. - This is not a field in the mhead structure - because we want sizeof (struct mhead) - to describe the overhead for when the block is in use, - and we do not want the free-list pointer to count in that. */ - -#define CHAIN(a) \ - (*(struct mhead **) (sizeof (char *) + (char *) (a))) - -#ifdef rcheck - -/* To implement range checking, we write magic values in at the beginning and - end of each allocated block, and make sure they are undisturbed whenever a - free or a realloc occurs. */ -/* Written in each of the 4 bytes following the block's real space */ -#define MAGIC1 0x55 -/* Written in the 4 bytes before the block's real space */ -#define MAGIC4 0x55555555 -#define ASSERT(p) if (!(p)) botch("p"); else -static -botch(s) - char *s; -{ - - printf("assertion botched: %s\n", s); - abort(); -} -#define EXTRA 4 /* 4 bytes extra for MAGIC1s */ -#else -#define ASSERT(p) -#define EXTRA 0 -#endif /* rcheck */ - -/* nextf[i] is free list of blocks of size 2**(i + 3) */ - -static struct mhead *nextf[30]; - -#ifdef M_WARN -/* Number of bytes of writable memory we can expect to be able to get */ -static int lim_data; -/* Level number of warnings already issued. - 0 -- no warnings issued. - 1 -- 75% warning already issued. - 2 -- 85% warning already issued. -*/ -static int warnlevel; -#endif /* M_WARN */ - -/* nonzero once initial bunch of free blocks made */ -static int gotpool; - -/* Cause reinitialization based on job parameters; - also declare where the end of pure storage is. */ -malloc_init (end) - char *end; { - endofpure = end; -#ifdef M_WARN - lim_data = 0; - warnlevel = 0; -#endif /* M_WARN */ - } - -static -morecore (nu) /* ask system for more memory */ - register int nu; { /* size index to get more of */ - char *sbrk (); - register char *cp; - register int nblks; - register int siz; - -#ifdef M_WARN -#ifndef BSD42 -#ifdef USG - extern long ulimit (); - if (lim_data == 0) /* find out how much we can get */ - lim_data = ulimit (3, 0) - TEXT_START; -#else /*HMS: was endif */ - if (lim_data == 0) /* find out how much we can get */ - lim_data = vlimit (LIM_DATA, -1); -#endif /* USG */ /HMS:* was not here */ -#else - if (lim_data == 0) { - struct rlimit XXrlimit; - - getrlimit (RLIMIT_DATA, &XXrlimit); - lim_data = XXrlimit.rlim_cur;} /* soft limit */ -#endif /* BSD42 */ -#endif /* M_WARN */ - - /* On initial startup, get two blocks of each size up to 1k bytes */ - if (!gotpool) - getpool (), getpool (), gotpool = 1; - - /* Find current end of memory and issue warning if getting near max */ - - cp = sbrk (0); - siz = cp - endofpure; -#ifdef M_WARN - switch (warnlevel) { - case 0: - if (siz > (lim_data / 4) * 3) { - warnlevel++; - malloc_warning ("Warning: past 75% of memory limit");} - break; - case 1: - if (siz > (lim_data / 20) * 17) { - warnlevel++; - malloc_warning ("Warning: past 85% of memory limit");} - break; - case 2: - if (siz > (lim_data / 20) * 19) { - warnlevel++; - malloc_warning ("Warning: past 95% of memory limit");} - break;} -#endif /* M_WARN */ - - if ((int) cp & 0x3ff) /* land on 1K boundaries */ - sbrk (1024 - ((int) cp & 0x3ff)); - - /* Take at least 2k, and figure out how many blocks of the desired size we're about to get */ - nblks = 1; - if ((siz = nu) < 8) - nblks = 1 << ((siz = 8) - nu); - - if ((cp = sbrk (1 << (siz + 3))) == (char *) -1) - return; /* no more room! */ - if ((int) cp & 7) { /* shouldn't happen, but just in case */ - cp = (char *) (((int) cp + 8) & ~7); - nblks--;} - - /* save new header and link the nblks blocks together */ - nextf[nu] = (struct mhead *) cp; - siz = 1 << (nu + 3); - while (1) { - ((struct mhead *) cp) -> mh_alloc = ISFREE; - ((struct mhead *) cp) -> mh_index = nu; - if (--nblks <= 0) break; - CHAIN ((struct mhead *) cp) = (struct mhead *) (cp + siz); - cp += siz;} -#if 0 - CHAIN ((struct mhead *) cp) = 0; /* since sbrk() returns cleared core, this is already set */ -#endif - } - -static -getpool () { - register int nu; - register char *cp = sbrk (0); - - if ((int) cp & 0x3ff) /* land on 1K boundaries */ - sbrk (1024 - ((int) cp & 0x3ff)); - - /* Get 2k of storage */ - - cp = sbrk (04000); - if (cp == (char *) -1) - return; - - /* Divide it into an initial 8-word block - plus one block of size 2**nu for nu = 3 ... 10. */ - - CHAIN (cp) = nextf[0]; - nextf[0] = (struct mhead *) cp; - ((struct mhead *) cp) -> mh_alloc = ISFREE; - ((struct mhead *) cp) -> mh_index = 0; - cp += 8; - - for (nu = 0; nu < 7; nu++) { - CHAIN (cp) = nextf[nu]; - nextf[nu] = (struct mhead *) cp; - ((struct mhead *) cp) -> mh_alloc = ISFREE; - ((struct mhead *) cp) -> mh_index = nu; - cp += 8 << nu;}} - -char * -malloc (n) /* get a block */ - unsigned n; { - register struct mhead *p; - register unsigned int nbytes; - register int nunits = 0; - - /* Figure out how many bytes are required, rounding up to the nearest - multiple of 4, then figure out which nextf[] area to use */ - nbytes = (n + sizeof *p + EXTRA + 3) & ~3; - { - register unsigned int shiftr = (nbytes - 1) >> 2; - - while (shiftr >>= 1) - nunits++; - } - - /* If there are no blocks of the appropriate size, go get some */ - /* COULD SPLIT UP A LARGER BLOCK HERE ... ACT */ - if (nextf[nunits] == 0) - morecore (nunits); - - /* Get one block off the list, and set the new list head */ - if ((p = nextf[nunits]) == 0) - return 0; - nextf[nunits] = CHAIN (p); - - /* Check for free block clobbered */ - /* If not for this check, we would gobble a clobbered free chain ptr */ - /* and bomb out on the NEXT allocate of this size block */ - if (p -> mh_alloc != ISFREE || p -> mh_index != nunits) -#ifdef rcheck - botch ("block on free list clobbered"); -#else - abort (); -#endif /* rcheck */ - - /* Fill in the info, and if range checking, set up the magic numbers */ - p -> mh_alloc = ISALLOC; -#ifdef rcheck - p -> mh_nbytes = n; - p -> mh_magic4 = MAGIC4; - { - register char *m = (char *) (p + 1) + n; - - *m++ = MAGIC1, *m++ = MAGIC1, *m++ = MAGIC1, *m = MAGIC1; - } -#else - p -> mh_size = n; -#endif /* rcheck */ -#ifdef MSTATS - nmalloc[nunits]++; - nmal++; -#endif /* MSTATS */ - return (char *) (p + 1);} - -free (mem) - char *mem; { - register struct mhead *p; - { - register char *ap = mem; - - ASSERT (ap != 0); - p = (struct mhead *) ap - 1; - ASSERT (p -> mh_alloc == ISALLOC); -#ifdef rcheck - ASSERT (p -> mh_magic4 == MAGIC4); - ap += p -> mh_nbytes; - ASSERT (*ap++ == MAGIC1); ASSERT (*ap++ == MAGIC1); - ASSERT (*ap++ == MAGIC1); ASSERT (*ap == MAGIC1); -#endif /* rcheck */ - } - { - register int nunits = p -> mh_index; - - ASSERT (nunits <= 29); - p -> mh_alloc = ISFREE; - CHAIN (p) = nextf[nunits]; - nextf[nunits] = p; -#ifdef MSTATS - nmalloc[nunits]--; - nfre++; -#endif /* MSTATS */ - } - } - -char * -realloc (mem, n) - char *mem; - register unsigned n; { - register struct mhead *p; - register unsigned int tocopy; - register int nbytes; - register int nunits; - - if ((p = (struct mhead *) mem) == 0) - return malloc (n); - p--; - nunits = p -> mh_index; - ASSERT (p -> mh_alloc == ISALLOC); -#ifdef rcheck - ASSERT (p -> mh_magic4 == MAGIC4); - { - register char *m = mem + (tocopy = p -> mh_nbytes); - ASSERT (*m++ == MAGIC1); ASSERT (*m++ == MAGIC1); - ASSERT (*m++ == MAGIC1); ASSERT (*m == MAGIC1); - } -#else - if (p -> mh_index >= 13) - tocopy = (1 << (p -> mh_index + 3)) - sizeof *p; - else - tocopy = p -> mh_size; -#endif /* rcheck */ - - /* See if desired size rounds to same power of 2 as actual size. */ - nbytes = (n + sizeof *p + EXTRA + 7) & ~7; - - /* If ok, use the same block, just marking its size as changed. */ - if (nbytes > (4 << nunits) && nbytes <= (8 << nunits)) { -#ifdef rcheck - register char *m = mem + tocopy; - *m++ = 0; *m++ = 0; *m++ = 0; *m++ = 0; - p-> mh_nbytes = n; - m = mem + n; - *m++ = MAGIC1; *m++ = MAGIC1; *m++ = MAGIC1; *m++ = MAGIC1; -#else - p -> mh_size = n; -#endif /* rcheck */ - return mem;} - - if (n < tocopy) - tocopy = n; - { - register char *new; - void bcopy(); /*HMS: here? */ - - if ((new = malloc (n)) == 0) - return 0; - bcopy (mem, new, tocopy); - free (mem); - return new; - } - } - -#ifdef MSTATS -/* Return statistics describing allocation of blocks of size 2**n. */ - -struct mstats_value { - int blocksize; - int nfree; - int nused; - }; - -struct mstats_value -malloc_stats (size) - int size; { - struct mstats_value v; - register int i; - register struct mhead *p; - - v.nfree = 0; - - if (size < 0 || size >= 30) { - v.blocksize = 0; - v.nused = 0; - return v;} - - v.blocksize = 1 << (size + 3); - v.nused = nmalloc[size]; - - for (p = nextf[size]; p; p = CHAIN (p)) - v.nfree++; - - return v;} -#endif - -/* how much space is available? */ - -unsigned freespace() { - register int i, j; - register struct mhead *p; - register unsigned space = 0; - int local; /* address only is used */ - - space = (char *)&local - sbrk(0); /* stack space */ - - for (i = 0; i < 30; i++) { - for (j = 0, p = nextf[i]; p; p = CHAIN (p), j++) ; - space += j * (1 << (i + 3));} - - return(space);} - -/* How big is this cell? */ - -unsigned mc_size(cp) - char *cp;{ - register struct mhead *p; - - if ((p = (struct mhead *) cp) == 0) { - /*HMS? */ - } - p--; -#ifdef rcheck - return p -> mh_nbytes; -#else - return (1 << (p -> mh_index + 3)) - sizeof *p; -#if 0 - if (p -> mh_index >= 13) - return (1 << (p -> mh_index + 3)) - sizeof *p; - else - return p -> mh_size; -#endif -#endif /* rcheck */ - } - -/*HMS: Really should use memcpy, if available... */ - -void bcopy(source, dest, len) - register char *source, *dest; - register len; { - register i; - - for (i = 0; i < len; i++) - *dest++ = *source++;} Index: xc/util/patch/patch.c diff -u xc/util/patch/patch.c:1.1.1.3 xc/util/patch/patch.c:removed --- xc/util/patch/patch.c:1.1.1.3 Tue Jan 16 18:41:42 2001 +++ xc/util/patch/patch.c Fri Jan 18 15:27:47 2002 @@ -1,941 +0,0 @@ -char rcsid[] = - "$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 - * - * Copyright 1986, Larry Wall - * - * This program may be copied as long as you don't try to make any - * money off of it, or pretend that you wrote it. - * - * Revision 2.0.2.0 90/05/01 22:17:50 davison - * patch12u: unidiff support added - * - * Revision 2.0.1.6 88/06/22 20:46:39 lwall - * patch12: rindex() wasn't declared - * - * Revision 2.0.1.5 88/06/03 15:09:37 lwall - * patch10: exit code improved. - * patch10: better support for non-flexfilenames. - * - * Revision 2.0.1.4 87/02/16 14:00:04 lwall - * Short replacement caused spurious "Out of sync" message. - * - * Revision 2.0.1.3 87/01/30 22:45:50 lwall - * Improved diagnostic on sync error. - * Moved do_ed_script() to pch.c. - * - * Revision 2.0.1.2 86/11/21 09:39:15 lwall - * Fuzz factor caused offset of installed lines. - * - * Revision 2.0.1.1 86/10/29 13:10:22 lwall - * Backwards search could terminate prematurely. - * - * Revision 2.0 86/09/17 15:37:32 lwall - * Baseline for netwide release. - * - * Revision 1.5 86/08/01 20:53:24 lwall - * Changed some %d's to %ld's. - * Linted. - * - * Revision 1.4 86/08/01 19:17:29 lwall - * Fixes for machines that can't vararg. - * Added fuzz factor. - * Generalized -p. - * General cleanup. - * - * 85/08/15 van%ucbmonet@berkeley - * Changes for 4.3bsd diff -c. - * - * Revision 1.3 85/03/26 15:07:43 lwall - * Frozen. - * - * Revision 1.2.1.9 85/03/12 17:03:35 lwall - * Changed pfp->_file to fileno(pfp). - * - * Revision 1.2.1.8 85/03/12 16:30:43 lwall - * Check i_ptr and i_womp to make sure they aren't null before freeing. - * Also allow ed output to be suppressed. - * - * Revision 1.2.1.7 85/03/12 15:56:13 lwall - * Added -p option from jromine@uci-750a. - * - * Revision 1.2.1.6 85/03/12 12:12:51 lwall - * Now checks for normalness of file to patch. - * - * Revision 1.2.1.5 85/03/12 11:52:12 lwall - * Added -D (#ifdef) option from joe@fluke. - * - * Revision 1.2.1.4 84/12/06 11:14:15 lwall - * Made smarter about SCCS subdirectories. - * - * Revision 1.2.1.3 84/12/05 11:18:43 lwall - * Added -l switch to do loose string comparison. - * - * Revision 1.2.1.2 84/12/04 09:47:13 lwall - * Failed hunk count not reset on multiple patch file. - * - * Revision 1.2.1.1 84/12/04 09:42:37 lwall - * Branch for sdcrdcf changes. - * - * Revision 1.2 84/11/29 13:29:51 lwall - * Linted. Identifiers uniqified. Fixed i_ptr malloc() bug. Fixed - * multiple calls to mktemp(). Will now work on machines that can only - * read 32767 chars. Added -R option for diffs with new and old swapped. - * Various cosmetic changes. - * - * Revision 1.1 84/11/09 17:03:58 lwall - * Initial revision - * - */ - -#include "INTERN.h" -#include "common.h" -#include "EXTERN.h" -#include "version.h" -#include "util.h" -#include "pch.h" -#include "inp.h" -#include "backupfile.h" - -/* procedures */ - -void reinitialize_almost_everything(); -void get_some_switches(); -LINENUM locate_hunk(); -void abort_hunk(); -void apply_hunk(); -void init_output(); -void init_reject(); -void copy_till(); -void spew_output(); -void dump_line(); -bool patch_match(); -bool similar(); -void re_input(); -void my_exit(); - -/* TRUE if -E was specified on command line. */ -static int remove_empty_files = FALSE; - -/* TRUE if -R was specified on command line. */ -static int reverse_flag_specified = FALSE; - -/* Apply a set of diffs as appropriate. */ - -int -main(argc,argv) -int argc; -char **argv; -{ - LINENUM where; - LINENUM newwhere; - LINENUM fuzz; - LINENUM mymaxfuzz; - int hunk = 0; - int failed = 0; - int failtotal = 0; - bool rev_okayed = 0; - int i; - - setbuf(stderr, serrbuf); - for (i = 0; i= 0) ; /* while is for Eunice. */ - } - } - Fclose(rejfp); - rejfp = Nullfp; - if (failed) { - failtotal += failed; - if (!*rejname) { - Strcpy(rejname, outname); -#ifndef FLEXFILENAMES - { - char *s = rindex(rejname,'/'); - - if (!s) - s = rejname; - if (strlen(s) > 13) - if (s[12] == '.') /* try to preserve difference */ - s[12] = s[13]; /* between .h, .c, .y, etc. */ - s[13] = '\0'; - } -#endif - Strcat(rejname, REJEXT); - } - if (skip_rest_of_patch) { - say4("%d out of %d hunks ignored--saving rejects to %s\n", - failed, hunk, rejname); - } - else { - say4("%d out of %d hunks failed--saving rejects to %s\n", - failed, hunk, rejname); - } - if (move_file(TMPREJNAME, rejname) < 0) - trejkeep = TRUE; - } - set_signals(1); - } - my_exit(failtotal); -} - -/* Prepare to find the next patch to do in the patch file. */ - -void -reinitialize_almost_everything() -{ - re_patch(); - re_input(); - - input_lines = 0; - last_frozen_line = 0; - - filec = 0; - if (filearg[0] != Nullch && !out_of_mem) { - free(filearg[0]); - filearg[0] = Nullch; - } - - if (outname != Nullch) { - free(outname); - outname = Nullch; - } - - last_offset = 0; - - diff_type = 0; - - if (revision != Nullch) { - free(revision); - revision = Nullch; - } - - reverse = reverse_flag_specified; - skip_rest_of_patch = FALSE; - - get_some_switches(); - - if (filec >= 2) - fatal1("you may not change to a different patch file\n"); -} - -static char * -nextarg() -{ - if (!--Argc) - fatal2("missing argument after `%s'\n", *Argv); - return *++Argv; -} - -/* Process switches and filenames up to next '+' or end of list. */ - -void -get_some_switches() -{ - Reg1 char *s; - - rejname[0] = '\0'; - Argc_last = Argc; - Argv_last = Argv; - if (!Argc) - return; - for (Argc--,Argv++; Argc; Argc--,Argv++) { - s = Argv[0]; - if (strEQ(s, "+")) { - return; /* + will be skipped by for loop */ - } - if (*s != '-' || !s[1]) { - if (filec == MAXFILEC) - fatal1("too many file arguments\n"); - filearg[filec++] = savestr(s); - } - else { - switch (*++s) { - case 'b': - simple_backup_suffix = savestr(nextarg()); - break; - case 'B': - origprae = savestr(nextarg()); - break; - case 'c': - diff_type = CONTEXT_DIFF; - break; - case 'd': - if (!*++s) - s = nextarg(); - if (chdir(s) < 0) - pfatal2("can't cd to %s", s); - break; - case 'D': - do_defines = TRUE; - if (!*++s) - s = nextarg(); - if (!isalpha(*s) && '_' != *s) - fatal1("argument to -D is not an identifier\n"); - Sprintf(if_defined, "#ifdef %s\n", s); - Sprintf(not_defined, "#ifndef %s\n", s); - Sprintf(end_defined, "#endif /* %s */\n", s); - break; -#ifndef WIN32 - case 'e': - diff_type = ED_DIFF; - break; -#endif - case 'E': - remove_empty_files = TRUE; - break; - case 'f': - force = TRUE; - break; - case 'F': - if (*++s == '=') - s++; - maxfuzz = atoi(s); - break; - case 'l': - canonicalize = TRUE; - break; - case 'n': - diff_type = NORMAL_DIFF; - break; - case 'N': - noreverse = TRUE; - break; - case 'o': - outname = savestr(nextarg()); - break; - case 'p': - if (*++s == '=') - s++; - strippath = atoi(s); - break; - case 'r': - Strcpy(rejname, nextarg()); - break; - case 'R': - reverse = TRUE; - reverse_flag_specified = TRUE; - break; - case 's': - verbose = FALSE; - break; - case 'S': - skip_rest_of_patch = TRUE; - break; - case 't': - batch = TRUE; - break; - case 'u': - diff_type = UNI_DIFF; - break; - case 'v': - version(); - break; - case 'V': -#ifndef NODIR - backup_type = get_version (nextarg ()); -#endif - break; -#ifdef DEBUGGING - case 'x': - debug = atoi(s+1); - break; -#endif - default: - fprintf(stderr, "patch: unrecognized option `%s'\n", Argv[0]); - fprintf(stderr, "\ -Usage: patch [options] [origfile [patchfile]] [+ [options] [origfile]]...\n\ -Options:\n\ - [-ceEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n\ - [-D symbol] [-Fmax-fuzz] [-o out-file] [-p[strip-count]]\n\ - [-r rej-name] [-V {numbered,existing,simple}]\n"); - my_exit(1); - } - } - } -} - -/* Attempt to find the right place to apply this hunk of patch. */ - -LINENUM -locate_hunk(fuzz) -LINENUM fuzz; -{ - Reg1 LINENUM first_guess = pch_first() + last_offset; - Reg2 LINENUM offset; - LINENUM pat_lines = pch_ptrn_lines(); - Reg3 LINENUM max_pos_offset = input_lines - first_guess - - pat_lines + 1; - Reg4 LINENUM max_neg_offset = first_guess - last_frozen_line - 1 - + pch_context(); - - if (!pat_lines) /* null range matches always */ - return first_guess; - if (max_neg_offset >= first_guess) /* do not try lines < 0 */ - max_neg_offset = first_guess - 1; - if (first_guess <= input_lines && patch_match(first_guess, Nulline, fuzz)) - return first_guess; - for (offset = 1; ; offset++) { - Reg5 bool check_after = (offset <= max_pos_offset); - Reg6 bool check_before = (offset <= max_neg_offset); - - if (check_after && patch_match(first_guess, offset, fuzz)) { -#ifdef DEBUGGING - if (debug & 1) - say3("Offset changing from %ld to %ld\n", last_offset, offset); -#endif - last_offset = offset; - return first_guess+offset; - } - else if (check_before && patch_match(first_guess, -offset, fuzz)) { -#ifdef DEBUGGING - if (debug & 1) - say3("Offset changing from %ld to %ld\n", last_offset, -offset); -#endif - last_offset = -offset; - return first_guess-offset; - } - else if (!check_before && !check_after) - return Nulline; - } -} - -/* We did not find the pattern, dump out the hunk so they can handle it. */ - -void -abort_hunk() -{ - Reg1 LINENUM i; - Reg2 LINENUM pat_end = pch_end(); - /* add in last_offset to guess the same as the previous successful hunk */ - LINENUM oldfirst = pch_first() + last_offset; - LINENUM newfirst = pch_newfirst() + last_offset; - LINENUM oldlast = oldfirst + pch_ptrn_lines() - 1; - LINENUM newlast = newfirst + pch_repl_lines() - 1; - char *stars = (diff_type >= NEW_CONTEXT_DIFF ? " ****" : ""); - char *minuses = (diff_type >= NEW_CONTEXT_DIFF ? " ----" : " -----"); - - fprintf(rejfp, "***************\n"); - for (i=0; i<=pat_end; i++) { - switch (pch_char(i)) { - case '*': - if (oldlast < oldfirst) - fprintf(rejfp, "*** 0%s\n", stars); - else if (oldlast == oldfirst) - fprintf(rejfp, "*** %ld%s\n", oldfirst, stars); - else - fprintf(rejfp, "*** %ld,%ld%s\n", oldfirst, oldlast, stars); - break; - case '=': - if (newlast < newfirst) - fprintf(rejfp, "--- 0%s\n", minuses); - else if (newlast == newfirst) - fprintf(rejfp, "--- %ld%s\n", newfirst, minuses); - else - fprintf(rejfp, "--- %ld,%ld%s\n", newfirst, newlast, minuses); - break; - case '\n': - fprintf(rejfp, "%s", pfetch(i)); - break; - case ' ': case '-': case '+': case '!': - fprintf(rejfp, "%c %s", pch_char(i), pfetch(i)); - break; - default: - fatal1("fatal internal error in abort_hunk\n"); - } - } -} - -/* We found where to apply it (we hope), so do it. */ - -void -apply_hunk(where) -LINENUM where; -{ - Reg1 LINENUM old = 1; - Reg2 LINENUM lastline = pch_ptrn_lines(); - Reg3 LINENUM new = lastline+1; -#define OUTSIDE 0 -#define IN_IFNDEF 1 -#define IN_IFDEF 2 -#define IN_ELSE 3 - Reg4 int def_state = OUTSIDE; - Reg5 bool R_do_defines = do_defines; - Reg6 LINENUM pat_end = pch_end(); - - where--; - while (pch_char(new) == '=' || pch_char(new) == '\n') - new++; - - while (old <= lastline) { - if (pch_char(old) == '-') { - copy_till(where + old - 1); - if (R_do_defines) { - if (def_state == OUTSIDE) { - fputs(not_defined, ofp); - def_state = IN_IFNDEF; - } - else if (def_state == IN_IFDEF) { - fputs(else_defined, ofp); - def_state = IN_ELSE; - } - fputs(pfetch(old), ofp); - } - last_frozen_line++; - old++; - } - else if (new > pat_end) { - break; - } - else if (pch_char(new) == '+') { - copy_till(where + old - 1); - if (R_do_defines) { - if (def_state == IN_IFNDEF) { - fputs(else_defined, ofp); - def_state = IN_ELSE; - } - else if (def_state == OUTSIDE) { - fputs(if_defined, ofp); - def_state = IN_IFDEF; - } - } - fputs(pfetch(new), ofp); - new++; - } - else if (pch_char(new) != pch_char(old)) { - say3("Out-of-sync patch, lines %ld,%ld--mangled text or line numbers, maybe?\n", - pch_hunk_beg() + old, - pch_hunk_beg() + new); -#ifdef DEBUGGING - say3("oldchar = '%c', newchar = '%c'\n", - pch_char(old), pch_char(new)); -#endif - my_exit(1); - } - else if (pch_char(new) == '!') { - copy_till(where + old - 1); - if (R_do_defines) { - fputs(not_defined, ofp); - def_state = IN_IFNDEF; - } - while (pch_char(old) == '!') { - if (R_do_defines) { - fputs(pfetch(old), ofp); - } - last_frozen_line++; - old++; - } - if (R_do_defines) { - fputs(else_defined, ofp); - def_state = IN_ELSE; - } - while (pch_char(new) == '!') { - fputs(pfetch(new), ofp); - new++; - } - } - else { - assert(pch_char(new) == ' '); - old++; - new++; - if (R_do_defines && def_state != OUTSIDE) { - fputs(end_defined, ofp); - def_state = OUTSIDE; - } - } - } - if (new <= pat_end && pch_char(new) == '+') { - copy_till(where + old - 1); - if (R_do_defines) { - if (def_state == OUTSIDE) { - fputs(if_defined, ofp); - def_state = IN_IFDEF; - } - else if (def_state == IN_IFNDEF) { - fputs(else_defined, ofp); - def_state = IN_ELSE; - } - } - while (new <= pat_end && pch_char(new) == '+') { - fputs(pfetch(new), ofp); - new++; - } - } - if (R_do_defines && def_state != OUTSIDE) { - fputs(end_defined, ofp); - } -} - -/* Open the new file. */ - -void -init_output(name) -char *name; -{ -#ifndef WIN32 - ofp = fopen(name, "w"); -#else - ofp = fopen(name, "wb"); -#endif - if (ofp == Nullfp) - pfatal2("can't create %s", name); -} - -/* Open a file to put hunks we can't locate. */ - -void -init_reject(name) -char *name; -{ -#ifndef WIN32 - rejfp = fopen(name, "w"); -#else - rejfp = fopen(name, "wb"); -#endif - if (rejfp == Nullfp) - pfatal2("can't create %s", name); -} - -/* Copy input file to output, up to wherever hunk is to be applied. */ - -void -copy_till(lastline) -Reg1 LINENUM lastline; -{ - Reg2 LINENUM R_last_frozen_line = last_frozen_line; - - if (R_last_frozen_line > lastline) - fatal1("misordered hunks! output would be garbled\n"); - while (R_last_frozen_line < lastline) { - dump_line(++R_last_frozen_line); - } - last_frozen_line = R_last_frozen_line; -} - -/* Finish copying the input file to the output file. */ - -void -spew_output() -{ -#ifdef DEBUGGING - if (debug & 256) - say3("il=%ld lfl=%ld\n",input_lines,last_frozen_line); -#endif - if (input_lines) - copy_till(input_lines); /* dump remainder of file */ - Fclose(ofp); - ofp = Nullfp; -} - -/* Copy one line from input to output. */ - -void -dump_line(line) -LINENUM line; -{ - Reg1 char *s; - Reg2 char R_newline = '\n'; - - /* Note: string is not null terminated. */ - for (s=ifetch(line, 0); putc(*s, ofp) != R_newline; s++) ; -} - -/* Does the patch pattern match at line base+offset? */ - -bool -patch_match(base, offset, fuzz) -LINENUM base; -LINENUM offset; -LINENUM fuzz; -{ - Reg1 LINENUM pline = 1 + fuzz; - Reg2 LINENUM iline; - Reg3 LINENUM pat_lines = pch_ptrn_lines() - fuzz; - - for (iline=base+offset+fuzz; pline <= pat_lines; pline++,iline++) { - if (canonicalize) { - if (!similar(ifetch(iline, (offset >= 0)), - pfetch(pline), - pch_line_len(pline) )) - return FALSE; - } - else if (strnNE(ifetch(iline, (offset >= 0)), - pfetch(pline), - pch_line_len(pline) )) - return FALSE; - } - return TRUE; -} - -/* Do two lines match with canonicalized white space? */ - -bool -similar(a,b,len) -Reg1 char *a; -Reg2 char *b; -Reg3 int len; -{ - while (len) { - if (isspace(*b)) { /* whitespace (or \n) to match? */ - if (!isspace(*a)) /* no corresponding whitespace? */ - return FALSE; - while (len && isspace(*b) && *b != '\n') - b++,len--; /* skip pattern whitespace */ - while (isspace(*a) && *a != '\n') - a++; /* skip target whitespace */ - if (*a == '\n' || *b == '\n') - return (*a == *b); /* should end in sync */ - } - else if (*a++ != *b++) /* match non-whitespace chars */ - return FALSE; - else - len--; /* probably not necessary */ - } - return TRUE; /* actually, this is not reached */ - /* since there is always a \n */ -} - -/* Exit with cleanup. */ - -void -my_exit(status) -int status; -{ - Unlink(TMPINNAME); - if (!toutkeep) { - Unlink(TMPOUTNAME); - } - if (!trejkeep) { - Unlink(TMPREJNAME); - } - Unlink(TMPPATNAME); - exit(status); -} Index: xc/util/patch/patch.man diff -u xc/util/patch/patch.man:1.2 xc/util/patch/patch.man:removed --- xc/util/patch/patch.man:1.2 Wed Feb 7 17:35:23 2001 +++ xc/util/patch/patch.man Fri Jan 18 15:27:47 2002 @@ -1,552 +0,0 @@ -.\" -*- nroff -*- -.rn '' }` -'\" $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 -'\" -'\" Revision 2.0.1.1 88/06/03 15:12:51 lwall -'\" patch10: -B switch was contributed. -'\" -'\" Revision 2.0 86/09/17 15:39:09 lwall -'\" Baseline for netwide release. -'\" -'\" Revision 1.4 86/08/01 19:23:22 lwall -'\" Documented -v, -p, -F. -'\" Added notes to patch senders. -'\" -'\" Revision 1.3 85/03/26 15:11:06 lwall -'\" Frozen. -'\" -'\" Revision 1.2.1.4 85/03/12 16:14:27 lwall -'\" Documented -p. -'\" -'\" Revision 1.2.1.3 85/03/12 16:09:41 lwall -'\" Documented -D. -'\" -'\" Revision 1.2.1.2 84/12/05 11:06:55 lwall -'\" Added -l switch, and noted bistability bug. -'\" -'\" Revision 1.2.1.1 84/12/04 17:23:39 lwall -'\" Branch for sdcrdcf changes. -'\" -'\" Revision 1.2 84/12/04 17:22:02 lwall -'\" Baseline version. -'\" -'\" $XFree86: xc/util/patch/patch.man,v 1.2 2001/02/07 22:35:23 tsi Exp $ -.de Sh -.br -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp -.if t .sp .5v -.if n .sp -.. -'\" -'\" Set up \*(-- to give an unbreakable dash; -'\" string Tr holds user defined translation string. -'\" Bell System Logo is used as a dummy character. -'\" -'\" Shut up a groff -ww warning. -.if \n(.g .if !dTr .ds Tr -.ie n \{\ -.tr \(*W-\*(Tr -.ds -- \(*W- -.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -.ds L" "" -.ds R" "" -.ds L' ' -.ds R' ' -'br \} -.el \{\ -.ds -- \(em\| -.tr \*(Tr -.ds L" `` -.ds R" '' -.ds L' ` -.ds R' ' -'br\} -.TH PATCH 1 LOCAL -.SH NAME -patch - apply a diff file to an original -.SH SYNOPSIS -.B patch -[options] [origfile [patchfile]] [+ [options] [origfile]]... -.sp -but usually just -.sp -.B patch - -sets the maximum fuzz factor. -This switch only applies to context diffs, and causes -.I patch -to ignore up to that many lines in looking for places to install a hunk. -Note that a larger fuzz factor increases the odds of a faulty patch. -The default fuzz factor is 2, and it may not be set to more than -the number of lines of context in the context diff, ordinarily 3. -.TP 5 -.B \-l -causes the pattern matching to be done loosely, in case the tabs and -spaces have been munged in your input file. -Any sequence of whitespace in the pattern line will match any sequence -in the input file. -Normal characters must still match exactly. -Each line of the context must still match a line in the input file. -.TP 5 -.B \-n -forces -.I patch -to interpret the patch file as a normal diff. -.TP 5 -.B \-N -causes -.I patch -to ignore patches that it thinks are reversed or already applied. -See also -.B \-R . -.TP 5 -.B \-o -causes the next argument to be interpreted as the output file name. -.TP 5 -.B \-p -sets the pathname strip count, -which controls how pathnames found in the patch file are treated, in case -the you keep your files in a different directory than the person who sent -out the patch. -The strip count specifies how many slashes are to be stripped from -the front of the pathname. -(Any intervening directory names also go away.) -For example, supposing the filename in the patch file was -.sp - /u/howard/src/blurfl/blurfl.c -.sp -setting -.B \-p -or -.B \-p0 -gives the entire pathname unmodified, -.B \-p1 -gives -.sp - u/howard/src/blurfl/blurfl.c -.sp -without the leading slash, -.B \-p4 -gives -.sp - blurfl/blurfl.c -.sp -and not specifying -.B \-p -at all just gives you "blurfl.c", unless all of the directories in the -leading path (u/howard/src/blurfl) exist and that path is relative, -in which case you get the entire pathname unmodified. -Whatever you end up with is looked for either in the current directory, -or the directory specified by the -.B \-d -switch. -.TP 5 -.B \-r -causes the next argument to be interpreted as the reject file name. -.TP 5 -.B \-R -tells -.I patch -that this patch was created with the old and new files swapped. -(Yes, I'm afraid that does happen occasionally, human nature being what it -is.) -.I Patch -will attempt to swap each hunk around before applying it. -Rejects will come out in the swapped format. -The -.B \-R -switch will not work with ed diff scripts because there is too little -information to reconstruct the reverse operation. -.Sp -If the first hunk of a patch fails, -.I patch -will reverse the hunk to see if it can be applied that way. -If it can, you will be asked if you want to have the -.B \-R -switch set. -If it can't, the patch will continue to be applied normally. -(Note: this method cannot detect a reversed patch if it is a normal diff -and if the first command is an append (i.e. it should have been a delete) -since appends always succeed, due to the fact that a null context will match -anywhere. -Luckily, most patches add or change lines rather than delete them, so most -reversed normal diffs will begin with a delete, which will fail, triggering -the heuristic.) -.TP 5 -.B \-s -makes -.I patch -do its work silently, unless an error occurs. -.TP 5 -.B \-S -causes -.I patch -to ignore this patch from the patch file, but continue on looking -for the next patch in the file. -Thus -.sp - patch -S + -S + -sets internal debugging flags, and is of interest only to -.I patch -patchers. -.SH AUTHOR -Larry Wall -.br -with many other contributors. -.SH ENVIRONMENT -.TP -.B TMPDIR -Directory to put temporary files in; default is /tmp. -.TP -.B SIMPLE_BACKUP_SUFFIX -Extension to use for backup file names instead of \*(L".orig\*(R" or -\*(L"~\*(R". -.TP -.B VERSION_CONTROL -Selects when numbered backup files are made. -.SH FILES -$TMPDIR/patch* -.SH SEE ALSO -diff(1) -.SH NOTES FOR PATCH SENDERS -There are several things you should bear in mind if you are going to -be sending out patches. -First, you can save people a lot of grief by keeping a patchlevel.h file -which is patched to increment the patch level as the first diff in the -patch file you send out. -If you put a Prereq: line in with the patch, it won't let them apply -patches out of order without some warning. -Second, make sure you've specified the filenames right, either in a -context diff header, or with an Index: line. -If you are patching something in a subdirectory, be sure to tell the patch -user to specify a -.B \-p -switch as needed. -Third, you can create a file by sending out a diff that compares a -null file to the file you want to create. -This will only work if the file you want to create doesn't exist already in -the target directory. -Fourth, take care not to send out reversed patches, since it makes people wonder -whether they already applied the patch. -Fifth, while you may be able to get away with putting 582 diff listings into -one file, it is probably wiser to group related patches into separate files in -case something goes haywire. -.SH DIAGNOSTICS -Too many to list here, but generally indicative that -.I patch -couldn't parse your patch file. -.PP -The message \*(L"Hmm...\*(R" indicates that there is unprocessed text in -the patch file and that -.I patch -is attempting to intuit whether there is a patch in that text and, if so, -what kind of patch it is. -.PP -.I Patch -will exit with a non-zero status if any reject files were created. -When applying a set of patches in a loop it behooves you to check this -exit status so you don't apply a later patch to a partially patched file. -.SH CAVEATS -.I Patch -cannot tell if the line numbers are off in an ed script, and can only detect -bad line numbers in a normal diff when it finds a \*(L"change\*(R" or -a \*(L"delete\*(R" command. -A context diff using fuzz factor 3 may have the same problem. -Until a suitable interactive interface is added, you should probably do -a context diff in these cases to see if the changes made sense. -Of course, compiling without errors is a pretty good indication that the patch -worked, but not always. -.PP -.I Patch -usually produces the correct results, even when it has to do a lot of -guessing. -However, the results are guaranteed to be correct only when the patch is -applied to exactly the same version of the file that the patch was -generated from. -.SH BUGS -Could be smarter about partial matches, excessively \&deviant offsets and -swapped code, but that would take an extra pass. -.PP -If code has been duplicated (for instance with #ifdef OLDCODE ... #else ... -\&#endif), -.I patch -is incapable of patching both versions, and, if it works at all, will likely -patch the wrong one, and tell you that it succeeded to boot. -.PP -If you apply a patch you've already applied, -.I patch -will think it is a reversed patch, and offer to un-apply the patch. -This could be construed as a feature. -.rn }` '' Index: xc/util/patch/patchlevel.h diff -u xc/util/patch/patchlevel.h:1.1.1.3 xc/util/patch/patchlevel.h:removed --- xc/util/patch/patchlevel.h:1.1.1.3 Tue Jan 16 18:41:44 2001 +++ xc/util/patch/patchlevel.h Fri Jan 18 15:27:47 2002 @@ -1,2 +0,0 @@ -/* $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.2 xc/util/patch/pch.c:removed --- xc/util/patch/pch.c:3.2 Wed Jan 17 18:20:07 2001 +++ xc/util/patch/pch.c Fri Jan 18 15:27:47 2002 @@ -1,1313 +0,0 @@ -/* oldHeader: pch.c,v 2.0.1.7 88/06/03 15:13:28 lwall Locked $ -/* $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 - * - * Revision 2.0.1.7 88/06/03 15:13:28 lwall - * patch10: Can now find patches in shar scripts. - * patch10: Hunks that swapped and then swapped back could core dump. - * - * Revision 2.0.1.6 87/06/04 16:18:13 lwall - * pch_swap didn't swap p_bfake and p_efake. - * - * Revision 2.0.1.5 87/01/30 22:47:42 lwall - * Improved responses to mangled patches. - * - * Revision 2.0.1.4 87/01/05 16:59:53 lwall - * New-style context diffs caused double call to free(). - * - * Revision 2.0.1.3 86/11/14 10:08:33 lwall - * Fixed problem where a long pattern wouldn't grow the hunk. - * Also restored p_input_line when backtracking so error messages are right. - * - * Revision 2.0.1.2 86/11/03 17:49:52 lwall - * New-style delete triggers spurious assertion error. - * - * Revision 2.0.1.1 86/10/29 15:52:08 lwall - * Could falsely report new-style context diff. - * - * Revision 2.0 86/09/17 15:39:37 lwall - * Baseline for netwide release. - * - */ - -#include "EXTERN.h" -#include "common.h" -#include "util.h" -#include "INTERN.h" -#include "pch.h" - -/* Patch (diff listing) abstract type. */ - -static long p_filesize; /* size of the patch file */ -static LINENUM p_first; /* 1st line number */ -static LINENUM p_newfirst; /* 1st line number of replacement */ -static LINENUM p_ptrn_lines; /* # lines in pattern */ -static LINENUM p_repl_lines; /* # lines in replacement text */ -static LINENUM p_end = -1; /* last line in hunk */ -static LINENUM p_max; /* max allowed value of p_end */ -static LINENUM p_context = 3; /* # of context lines */ -static LINENUM p_input_line = 0; /* current line # from patch file */ -static char **p_line = Null(char**); /* the text of the hunk */ -static short *p_len = Null(short*); /* length of each line */ -static char *p_char = Nullch; /* +, -, and ! */ -static int hunkmax = INITHUNKMAX; /* size of above arrays to begin with */ -static int p_indent; /* indent to patch */ -static LINENUM p_base; /* where to intuit this time */ -static LINENUM p_bline; /* line # of p_base */ -static LINENUM p_start; /* where intuit found a patch */ -static LINENUM p_sline; /* and the line number for it */ -static LINENUM p_hunk_beg; /* line number of current hunk */ -static LINENUM p_efake = -1; /* end of faked up lines--don't free */ -static LINENUM p_bfake = -1; /* beg of faked up lines */ - -/* Prepare to look for the next patch in the patch file. */ - -void -re_patch() -{ - p_first = Nulline; - p_newfirst = Nulline; - p_ptrn_lines = Nulline; - p_repl_lines = Nulline; - p_end = (LINENUM)-1; - p_max = Nulline; - p_indent = 0; -} - -/* Open the patch file at the beginning of time. */ - -void -open_patch_file(filename) -char *filename; -{ - if (filename == Nullch || !*filename || strEQ(filename, "-")) { - pfp = fopen(TMPPATNAME, "w"); - if (pfp == Nullfp) - pfatal2("can't create %s", TMPPATNAME); - while (fgets(buf, sizeof buf, stdin) != Nullch) - fputs(buf, pfp); - Fclose(pfp); - filename = TMPPATNAME; - } - pfp = fopen(filename, "r"); - if (pfp == Nullfp) - pfatal2("patch file %s not found", filename); - Fstat(fileno(pfp), &filestat); - p_filesize = filestat.st_size; - next_intuit_at(0L,1L); /* start at the beginning */ - set_hunkmax(); -} - -/* Make sure our dynamically realloced tables are malloced to begin with. */ - -void -set_hunkmax() -{ -#ifndef lint - if (p_line == Null(char**)) - p_line = (char**) malloc((MEM)hunkmax * sizeof(char *)); - if (p_len == Null(short*)) - p_len = (short*) malloc((MEM)hunkmax * sizeof(short)); -#endif - if (p_char == Nullch) - p_char = (char*) malloc((MEM)hunkmax * sizeof(char)); -} - -/* Enlarge the arrays containing the current hunk of patch. */ - -void -grow_hunkmax() -{ - hunkmax *= 2; - /* - * Note that on most systems, only the p_line array ever gets fresh memory - * since p_len can move into p_line's old space, and p_char can move into - * p_len's old space. Not on PDP-11's however. But it doesn't matter. - */ - assert(p_line != Null(char**) && p_len != Null(short*) && p_char != Nullch); -#ifndef lint - p_line = (char**) realloc((char*)p_line, (MEM)hunkmax * sizeof(char *)); - p_len = (short*) realloc((char*)p_len, (MEM)hunkmax * sizeof(short)); - p_char = (char*) realloc((char*)p_char, (MEM)hunkmax * sizeof(char)); -#endif - if (p_line != Null(char**) && p_len != Null(short*) && p_char != Nullch) - return; - if (!using_plan_a) - fatal1("out of memory\n"); - out_of_mem = TRUE; /* whatever is null will be allocated again */ - /* from within plan_a(), of all places */ -} - -/* True if the remainder of the patch file contains a diff of some sort. */ - -bool -there_is_another_patch() -{ - if (p_base != 0L && p_base >= p_filesize) { - if (verbose) - say1("done\n"); - return FALSE; - } - if (verbose) - say1("Hmm..."); - diff_type = intuit_diff_type(); - if (!diff_type) { - if (p_base != 0L) { - if (verbose) - say1(" Ignoring the trailing garbage.\ndone\n"); - } - else - say1(" I can't seem to find a patch in there anywhere.\n"); - return FALSE; - } - if (verbose) - say3(" %sooks like %s to me...\n", - (p_base == 0L ? "L" : "The next patch l"), - diff_type == UNI_DIFF ? "a unified diff" : - diff_type == CONTEXT_DIFF ? "a context diff" : - diff_type == NEW_CONTEXT_DIFF ? "a new-style context diff" : - diff_type == NORMAL_DIFF ? "a normal diff" : - "an ed script" ); - if (p_indent && verbose) - say3("(Patch is indented %d space%s.)\n", p_indent, p_indent==1?"":"s"); - skip_to(p_start,p_sline); - while (filearg[0] == Nullch) { - if (force || batch) { - say1("No file to patch. Skipping...\n"); - filearg[0] = savestr(bestguess); - skip_rest_of_patch = TRUE; - return TRUE; - } - ask1("File to patch: "); - if (*buf != '\n') { - if (bestguess) - free(bestguess); - bestguess = savestr(buf); - filearg[0] = fetchname(buf, 0, FALSE); - } - if (filearg[0] == Nullch) { -#ifndef WIN32 - ask1("No file found--skip this patch? [n] "); - if (*buf != 'y') { - continue; - } - if (verbose) - say1("Skipping patch...\n"); -#else - if (verbose) - say1("File not found--skipping patch...\n"); -#endif - filearg[0] = fetchname(bestguess, 0, TRUE); - skip_rest_of_patch = TRUE; - return TRUE; - } - } - return TRUE; -} - -/* Determine what kind of diff is in the remaining part of the patch file. */ - -int -intuit_diff_type() -{ - Reg4 long this_line = 0; - Reg5 long previous_line; - Reg6 long first_command_line = -1; - long fcl_line; - Reg7 bool last_line_was_command = FALSE; - Reg8 bool this_is_a_command = FALSE; - Reg9 bool stars_last_line = FALSE; - Reg10 bool stars_this_line = FALSE; - Reg3 int indent; - Reg1 char *s; - Reg2 char *t; - char *indtmp = Nullch; - char *oldtmp = Nullch; - char *newtmp = Nullch; - char *indname = Nullch; - char *oldname = Nullch; - char *newname = Nullch; - Reg11 int retval; - bool no_filearg = (filearg[0] == Nullch); - - ok_to_create_file = FALSE; - Fseek(pfp, p_base, 0); - p_input_line = p_bline - 1; - for (;;) { - previous_line = this_line; - last_line_was_command = this_is_a_command; - stars_last_line = stars_this_line; - this_line = ftell(pfp); - indent = 0; - p_input_line++; - if (fgets(buf, sizeof buf, pfp) == Nullch) { - if (first_command_line >= 0L) { - /* nothing but deletes!? */ - p_start = first_command_line; - p_sline = fcl_line; - retval = ED_DIFF; - goto scan_exit; - } - else { - p_start = this_line; - p_sline = p_input_line; - retval = 0; - goto scan_exit; - } - } - for (s = buf; *s == ' ' || *s == '\t' || *s == 'X'; s++) { - if (*s == '\t') - indent += 8 - (indent % 8); - else - indent++; - } - for (t=s; isdigit(*t) || *t == ','; t++) ; - this_is_a_command = (isdigit(*s) && - (*t == 'd' || *t == 'c' || *t == 'a') ); - if (first_command_line < 0L && this_is_a_command) { - first_command_line = this_line; - fcl_line = p_input_line; - p_indent = indent; /* assume this for now */ - } - if (!stars_last_line && strnEQ(s, "*** ", 4)) - oldtmp = savestr(s+4); - else if (strnEQ(s, "--- ", 4)) - newtmp = savestr(s+4); - else if (strnEQ(s, "+++ ", 4)) - oldtmp = savestr(s+4); /* pretend it is the old name */ - else if (strnEQ(s, "Index:", 6)) - indtmp = savestr(s+6); - else if (strnEQ(s, "Prereq:", 7)) { - for (t=s+7; isspace(*t); t++) ; - revision = savestr(t); - for (t=revision; *t && !isspace(*t); t++) ; - *t = '\0'; - if (!*revision) { - free(revision); - revision = Nullch; - } - } - if ((!diff_type || diff_type == ED_DIFF) && - first_command_line >= 0L && - strEQ(s, ".\n") ) { - p_indent = indent; - p_start = first_command_line; - p_sline = fcl_line; - retval = ED_DIFF; - goto scan_exit; - } - if ((!diff_type || diff_type == UNI_DIFF) && strnEQ(s, "@@ -", 4)) { - if (!atol(s+3)) - ok_to_create_file = TRUE; - p_indent = indent; - p_start = this_line; - p_sline = p_input_line; - retval = UNI_DIFF; - goto scan_exit; - } - stars_this_line = strnEQ(s, "********", 8); - if ((!diff_type || diff_type == CONTEXT_DIFF) && stars_last_line && - strnEQ(s, "*** ", 4)) { - if (!atol(s+4)) - ok_to_create_file = TRUE; - /* if this is a new context diff the character just before */ - /* the newline is a '*'. */ - while (*s != '\n') - s++; - p_indent = indent; - p_start = previous_line; - p_sline = p_input_line - 1; - retval = (*(s-1) == '*' ? NEW_CONTEXT_DIFF : CONTEXT_DIFF); - goto scan_exit; - } - if ((!diff_type || diff_type == NORMAL_DIFF) && - last_line_was_command && - (strnEQ(s, "< ", 2) || strnEQ(s, "> ", 2)) ) { - p_start = previous_line; - p_sline = p_input_line - 1; - p_indent = indent; - retval = NORMAL_DIFF; - goto scan_exit; - } - } - scan_exit: - if (no_filearg) { - if (indtmp != Nullch) - indname = fetchname(indtmp, strippath, ok_to_create_file); - if (oldtmp != Nullch) - oldname = fetchname(oldtmp, strippath, ok_to_create_file); - if (newtmp != Nullch) - newname = fetchname(newtmp, strippath, ok_to_create_file); - if (oldname && newname) { - if (strlen(oldname) < strlen(newname)) - filearg[0] = savestr(oldname); - else - filearg[0] = savestr(newname); - } - else if (oldname) - filearg[0] = savestr(oldname); - else if (newname) - filearg[0] = savestr(newname); - else if (indname) - filearg[0] = savestr(indname); - } - if (bestguess) { - free(bestguess); - bestguess = Nullch; - } - if (filearg[0] != Nullch) - bestguess = savestr(filearg[0]); - else if (indtmp != Nullch) - bestguess = fetchname(indtmp, strippath, TRUE); - else { - if (oldtmp != Nullch) - oldname = fetchname(oldtmp, strippath, TRUE); - if (newtmp != Nullch) - newname = fetchname(newtmp, strippath, TRUE); - if (oldname && newname) { - if (strlen(oldname) < strlen(newname)) - bestguess = savestr(oldname); - else - bestguess = savestr(newname); - } - else if (oldname) - bestguess = savestr(oldname); - else if (newname) - bestguess = savestr(newname); - } - if (indtmp != Nullch) - free(indtmp); - if (oldtmp != Nullch) - free(oldtmp); - if (newtmp != Nullch) - free(newtmp); - if (indname != Nullch) - free(indname); - if (oldname != Nullch) - free(oldname); - if (newname != Nullch) - free(newname); - return retval; -} - -/* Remember where this patch ends so we know where to start up again. */ - -void -next_intuit_at(file_pos,file_line) -long file_pos; -long file_line; -{ - p_base = file_pos; - p_bline = file_line; -} - -/* Basically a verbose fseek() to the actual diff listing. */ - -void -skip_to(file_pos,file_line) -long file_pos; -long file_line; -{ - char *ret; - - assert(p_base <= file_pos); - if (verbose && p_base < file_pos) { - Fseek(pfp, p_base, 0); - say1("The text leading up to this was:\n--------------------------\n"); - while (ftell(pfp) < file_pos) { - ret = fgets(buf, sizeof buf, pfp); - assert(ret != Nullch); - say2("|%s", buf); - } - say1("--------------------------\n"); - } - else - Fseek(pfp, file_pos, 0); - p_input_line = file_line - 1; -} - -/* Make this a function for better debugging. */ -static void -malformed () -{ - fatal3("malformed patch at line %ld: %s", p_input_line, buf); - /* about as informative as "Syntax error" in C */ -} - -/* True if there is more of the current diff listing to process. */ - -bool -another_hunk() -{ - Reg1 char *s; - Reg8 char *ret; - Reg2 int context = 0; - - while (p_end >= 0) { - if (p_end == p_efake) - p_end = p_bfake; /* don't free twice */ - else - free(p_line[p_end]); - p_end--; - } - assert(p_end == -1); - p_efake = -1; - - p_max = hunkmax; /* gets reduced when --- found */ - if (diff_type == CONTEXT_DIFF || diff_type == NEW_CONTEXT_DIFF) { - long line_beginning = ftell(pfp); - /* file pos of the current line */ - LINENUM repl_beginning = 0; /* index of --- line */ - Reg4 LINENUM fillcnt = 0; /* #lines of missing ptrn or repl */ - Reg5 LINENUM fillsrc; /* index of first line to copy */ - Reg6 LINENUM filldst; /* index of first missing line */ - bool ptrn_spaces_eaten = FALSE; /* ptrn was slightly misformed */ - Reg9 bool repl_could_be_missing = TRUE; - /* no + or ! lines in this hunk */ - bool repl_missing = FALSE; /* we are now backtracking */ - long repl_backtrack_position = 0; - /* file pos of first repl line */ - LINENUM repl_patch_line; /* input line number for same */ - Reg7 LINENUM ptrn_copiable = 0; - /* # of copiable lines in ptrn */ - - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch || strnNE(buf, "********", 8)) { - next_intuit_at(line_beginning,p_input_line); - return FALSE; - } - p_context = 100; - p_hunk_beg = p_input_line + 1; - while (p_end < p_max) { - line_beginning = ftell(pfp); - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) { - if (p_max - p_end < 4) - Strcpy(buf, " \n"); /* assume blank lines got chopped */ - else { - if (repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - fatal1("unexpected end of file in patch\n"); - } - } - p_end++; - assert(p_end < hunkmax); - p_char[p_end] = *buf; -#ifdef zilog - p_line[(short)p_end] = Nullch; -#else - p_line[p_end] = Nullch; -#endif - switch (*buf) { - case '*': - if (strnEQ(buf, "********", 8)) { - if (repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - else - fatal2("unexpected end of hunk at line %ld\n", - p_input_line); - } - if (p_end != 0) { - if (repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - fatal3("unexpected *** at line %ld: %s", p_input_line, buf); - } - context = 0; - p_line[p_end] = savestr(buf); - if (out_of_mem) { - p_end--; - return FALSE; - } - for (s=buf; *s && !isdigit(*s); s++) ; - if (!*s) - malformed (); - if (strnEQ(s,"0,0",3)) - strcpy(s,s+2); - p_first = (LINENUM) atol(s); - while (isdigit(*s)) s++; - if (*s == ',') { - for (; *s && !isdigit(*s); s++) ; - if (!*s) - malformed (); - p_ptrn_lines = ((LINENUM)atol(s)) - p_first + 1; - } - else if (p_first) - p_ptrn_lines = 1; - else { - p_ptrn_lines = 0; - p_first = 1; - } - p_max = p_ptrn_lines + 6; /* we need this much at least */ - while (p_max >= hunkmax) - grow_hunkmax(); - p_max = hunkmax; - break; - case '-': - if (buf[1] == '-') { - if (repl_beginning || - (p_end != p_ptrn_lines + 1 + (p_char[p_end-1] == '\n'))) - { - if (p_end == 1) { - /* `old' lines were omitted - set up to fill */ - /* them in from 'new' context lines. */ - p_end = p_ptrn_lines + 1; - fillsrc = p_end + 1; - filldst = 1; - fillcnt = p_ptrn_lines; - } - else { - if (repl_beginning) { - if (repl_could_be_missing){ - repl_missing = TRUE; - goto hunk_done; - } - fatal3( -"duplicate \"---\" at line %ld--check line numbers at line %ld\n", - p_input_line, p_hunk_beg + repl_beginning); - } - else { - fatal4( -"%s \"---\" at line %ld--check line numbers at line %ld\n", - (p_end <= p_ptrn_lines - ? "Premature" - : "Overdue" ), - p_input_line, p_hunk_beg); - } - } - } - repl_beginning = p_end; - repl_backtrack_position = ftell(pfp); - repl_patch_line = p_input_line; - p_line[p_end] = savestr(buf); - if (out_of_mem) { - p_end--; - return FALSE; - } - p_char[p_end] = '='; - for (s=buf; *s && !isdigit(*s); s++) ; - if (!*s) - malformed (); - p_newfirst = (LINENUM) atol(s); - while (isdigit(*s)) s++; - if (*s == ',') { - for (; *s && !isdigit(*s); s++) ; - if (!*s) - malformed (); - p_repl_lines = ((LINENUM)atol(s)) - p_newfirst + 1; - } - else if (p_newfirst) - p_repl_lines = 1; - else { - p_repl_lines = 0; - p_newfirst = 1; - } - p_max = p_repl_lines + p_end; - if (p_max > MAXHUNKSIZE) - fatal4("hunk too large (%ld lines) at line %ld: %s", - p_max, p_input_line, buf); - while (p_max >= hunkmax) - grow_hunkmax(); - if (p_repl_lines != ptrn_copiable - && (p_context != 0 || p_repl_lines != 1)) - repl_could_be_missing = FALSE; - break; - } - goto change_line; - case '+': case '!': - repl_could_be_missing = FALSE; - change_line: - if (buf[1] == '\n' && canonicalize) - strcpy(buf+1," \n"); - if (!isspace(buf[1]) && buf[1] != '>' && buf[1] != '<' && - repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - if (context >= 0) { - if (context < p_context) - p_context = context; - context = -1000; - } - p_line[p_end] = savestr(buf+2); - if (out_of_mem) { - p_end--; - return FALSE; - } - break; - case '\t': case '\n': /* assume the 2 spaces got eaten */ - if (repl_beginning && repl_could_be_missing && - (!ptrn_spaces_eaten || diff_type == NEW_CONTEXT_DIFF) ) { - repl_missing = TRUE; - goto hunk_done; - } - p_line[p_end] = savestr(buf); - if (out_of_mem) { - p_end--; - return FALSE; - } - if (p_end != p_ptrn_lines + 1) { - ptrn_spaces_eaten |= (repl_beginning != 0); - context++; - if (!repl_beginning) - ptrn_copiable++; - p_char[p_end] = ' '; - } - break; - case ' ': - if (!isspace(buf[1]) && - repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - context++; - if (!repl_beginning) - ptrn_copiable++; - p_line[p_end] = savestr(buf+2); - if (out_of_mem) { - p_end--; - return FALSE; - } - break; - default: - if (repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - malformed (); - } - /* set up p_len for strncmp() so we don't have to */ - /* assume null termination */ - if (p_line[p_end]) - p_len[p_end] = strlen(p_line[p_end]); - else - p_len[p_end] = 0; - } - - hunk_done: - if (p_end >=0 && !repl_beginning) - fatal2("no --- found in patch at line %ld\n", pch_hunk_beg()); - - if (repl_missing) { - - /* reset state back to just after --- */ - p_input_line = repl_patch_line; - for (p_end--; p_end > repl_beginning; p_end--) - free(p_line[p_end]); - Fseek(pfp, repl_backtrack_position, 0); - - /* redundant 'new' context lines were omitted - set */ - /* up to fill them in from the old file context */ - if (!p_context && p_repl_lines == 1) { - p_repl_lines = 0; - p_max--; - } - fillsrc = 1; - filldst = repl_beginning+1; - fillcnt = p_repl_lines; - p_end = p_max; - } - else if (!p_context && fillcnt == 1) { - /* the first hunk was a null hunk with no context */ - /* and we were expecting one line -- fix it up. */ - while (filldst < p_end) { - p_line[filldst] = p_line[filldst+1]; - p_char[filldst] = p_char[filldst+1]; - p_len[filldst] = p_len[filldst+1]; - filldst++; - } -#if 0 - repl_beginning--; /* this doesn't need to be fixed */ -#endif - p_end--; - p_first++; /* do append rather than insert */ - fillcnt = 0; - p_ptrn_lines = 0; - } - - if (diff_type == CONTEXT_DIFF && - (fillcnt || (p_first > 1 && ptrn_copiable > 2*p_context)) ) { - if (verbose) - say4("%s\n%s\n%s\n", -"(Fascinating--this is really a new-style context diff but without", -"the telltale extra asterisks on the *** line that usually indicate", -"the new style...)"); - diff_type = NEW_CONTEXT_DIFF; - } - - /* if there were omitted context lines, fill them in now */ - if (fillcnt) { - p_bfake = filldst; /* remember where not to free() */ - p_efake = filldst + fillcnt - 1; - while (fillcnt-- > 0) { - while (fillsrc <= p_end && p_char[fillsrc] != ' ') - fillsrc++; - if (fillsrc > p_end) - fatal2("replacement text or line numbers mangled in hunk at line %ld\n", - p_hunk_beg); - p_line[filldst] = p_line[fillsrc]; - p_char[filldst] = p_char[fillsrc]; - p_len[filldst] = p_len[fillsrc]; - fillsrc++; filldst++; - } - while (fillsrc <= p_end && fillsrc != repl_beginning && - p_char[fillsrc] != ' ') - fillsrc++; -#ifdef DEBUGGING - if (debug & 64) - printf("fillsrc %ld, filldst %ld, rb %ld, e+1 %ld\n", - fillsrc,filldst,repl_beginning,p_end+1); -#endif - assert(fillsrc==p_end+1 || fillsrc==repl_beginning); - assert(filldst==p_end+1 || filldst==repl_beginning); - } - } - else if (diff_type == UNI_DIFF) { - long line_beginning = ftell(pfp); - /* file pos of the current line */ - Reg4 LINENUM fillsrc; /* index of old lines */ - Reg5 LINENUM filldst; /* index of new lines */ - char ch; - - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch || strnNE(buf, "@@ -", 4)) { - next_intuit_at(line_beginning,p_input_line); - return FALSE; - } - s = buf+4; - if (!*s) - malformed (); - p_first = (LINENUM) atol(s); - while (isdigit(*s)) s++; - if (*s == ',') { - p_ptrn_lines = (LINENUM) atol(++s); - while (isdigit(*s)) s++; - } else - p_ptrn_lines = 1; - if (*s == ' ') s++; - if (*s != '+' || !*++s) - malformed (); - p_newfirst = (LINENUM) atol(s); - while (isdigit(*s)) s++; - if (*s == ',') { - p_repl_lines = (LINENUM) atol(++s); - while (isdigit(*s)) s++; - } else - p_repl_lines = 1; - if (*s == ' ') s++; - if (*s != '@') - malformed (); - if (!p_ptrn_lines) - p_first++; /* do append rather than insert */ - p_max = p_ptrn_lines + p_repl_lines + 1; - while (p_max >= hunkmax) - grow_hunkmax(); - fillsrc = 1; - filldst = fillsrc + p_ptrn_lines; - p_end = filldst + p_repl_lines; - Sprintf(buf,"*** %ld,%ld ****\n",p_first,p_first + p_ptrn_lines - 1); - p_line[0] = savestr(buf); - if (out_of_mem) { - p_end = -1; - return FALSE; - } - p_char[0] = '*'; - Sprintf(buf,"--- %ld,%ld ----\n",p_newfirst,p_newfirst+p_repl_lines-1); - p_line[filldst] = savestr(buf); - if (out_of_mem) { - p_end = 0; - return FALSE; - } - p_char[filldst++] = '='; - p_context = 100; - context = 0; - p_hunk_beg = p_input_line + 1; - while (fillsrc <= p_ptrn_lines || filldst <= p_end) { - line_beginning = ftell(pfp); - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) { - if (p_max - filldst < 3) - Strcpy(buf, " \n"); /* assume blank lines got chopped */ - else { - fatal1("unexpected end of file in patch\n"); - } - } - if (*buf == '\t' || *buf == '\n') { - ch = ' '; /* assume the space got eaten */ - s = savestr(buf); - } - else { - ch = *buf; - s = savestr(buf+1); - } - if (out_of_mem) { - while (--filldst > p_ptrn_lines) - free(p_line[filldst]); - p_end = fillsrc-1; - return FALSE; - } - switch (ch) { - case '-': - if (fillsrc > p_ptrn_lines) { - free(s); - p_end = filldst-1; - malformed (); - } - p_char[fillsrc] = ch; - p_line[fillsrc] = s; - p_len[fillsrc++] = strlen(s); - break; - case '=': - ch = ' '; - /* FALL THROUGH */ - case ' ': - if (fillsrc > p_ptrn_lines) { - free(s); - while (--filldst > p_ptrn_lines) - free(p_line[filldst]); - p_end = fillsrc-1; - malformed (); - } - context++; - p_char[fillsrc] = ch; - p_line[fillsrc] = s; - p_len[fillsrc++] = strlen(s); - s = savestr(s); - if (out_of_mem) { - while (--filldst > p_ptrn_lines) - free(p_line[filldst]); - p_end = fillsrc-1; - return FALSE; - } - /* FALL THROUGH */ - case '+': - if (filldst > p_end) { - free(s); - while (--filldst > p_ptrn_lines) - free(p_line[filldst]); - p_end = fillsrc-1; - malformed (); - } - p_char[filldst] = ch; - p_line[filldst] = s; - p_len[filldst++] = strlen(s); - break; - default: - p_end = filldst; - malformed (); - } - if (ch != ' ' && context > 0) { - if (context < p_context) - p_context = context; - context = -1000; - } - }/* while */ - } - else { /* normal diff--fake it up */ - char hunk_type; - Reg3 int i; - LINENUM min, max; - long line_beginning = ftell(pfp); - - p_context = 0; - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch || !isdigit(*buf)) { - next_intuit_at(line_beginning,p_input_line); - return FALSE; - } - p_first = (LINENUM)atol(buf); - for (s=buf; isdigit(*s); s++) ; - if (*s == ',') { - p_ptrn_lines = (LINENUM)atol(++s) - p_first + 1; - while (isdigit(*s)) s++; - } - else - p_ptrn_lines = (*s != 'a'); - hunk_type = *s; - if (hunk_type == 'a') - p_first++; /* do append rather than insert */ - min = (LINENUM)atol(++s); - for (; isdigit(*s); s++) ; - if (*s == ',') - max = (LINENUM)atol(++s); - else - max = min; - if (hunk_type == 'd') - min++; - p_end = p_ptrn_lines + 1 + max - min + 1; - if (p_end > MAXHUNKSIZE) - fatal4("hunk too large (%ld lines) at line %ld: %s", - p_end, p_input_line, buf); - while (p_end >= hunkmax) - grow_hunkmax(); - p_newfirst = min; - p_repl_lines = max - min + 1; - Sprintf(buf, "*** %ld,%ld\n", p_first, p_first + p_ptrn_lines - 1); - p_line[0] = savestr(buf); - if (out_of_mem) { - p_end = -1; - return FALSE; - } - p_char[0] = '*'; - for (i=1; i<=p_ptrn_lines; i++) { - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) - fatal2("unexpected end of file in patch at line %ld\n", - p_input_line); - if (*buf != '<') - fatal2("< expected at line %ld of patch\n", p_input_line); - p_line[i] = savestr(buf+2); - if (out_of_mem) { - p_end = i-1; - return FALSE; - } - p_len[i] = strlen(p_line[i]); - p_char[i] = '-'; - } - if (hunk_type == 'c') { - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) - fatal2("unexpected end of file in patch at line %ld\n", - p_input_line); - if (*buf != '-') - fatal2("--- expected at line %ld of patch\n", p_input_line); - } - Sprintf(buf, "--- %ld,%ld\n", min, max); - p_line[i] = savestr(buf); - if (out_of_mem) { - p_end = i-1; - return FALSE; - } - p_char[i] = '='; - for (i++; i<=p_end; i++) { - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) - fatal2("unexpected end of file in patch at line %ld\n", - p_input_line); - if (*buf != '>') - fatal2("> expected at line %ld of patch\n", p_input_line); - p_line[i] = savestr(buf+2); - if (out_of_mem) { - p_end = i-1; - return FALSE; - } - p_len[i] = strlen(p_line[i]); - p_char[i] = '+'; - } - } - if (reverse) /* backwards patch? */ - if (!pch_swap()) - say1("Not enough memory to swap next hunk!\n"); -#ifdef DEBUGGING - if (debug & 2) { - int i; - char special; - - for (i=0; i <= p_end; i++) { - if (i == p_ptrn_lines) - special = '^'; - else - special = ' '; - fprintf(stderr, "%3d %c %c %s", i, p_char[i], special, p_line[i]); - Fflush(stderr); - } - } -#endif - if (p_end+1 < hunkmax) /* paranoia reigns supreme... */ - p_char[p_end+1] = '^'; /* add a stopper for apply_hunk */ - return TRUE; -} - -/* Input a line from the patch file, worrying about indentation. */ - -char * -pgets(bf,sz,fp) -char *bf; -int sz; -FILE *fp; -{ - char *ret = fgets(bf, sz, fp); - Reg1 char *s; - Reg2 int indent = 0; - - if (p_indent && ret != Nullch) { - for (s=buf; - indent < p_indent && (*s == ' ' || *s == '\t' || *s == 'X'); s++) { - if (*s == '\t') - indent += 8 - (indent % 7); - else - indent++; - } - if (buf != s) - Strcpy(buf, s); - } - return ret; -} - -/* Reverse the old and new portions of the current hunk. */ - -bool -pch_swap() -{ - char **tp_line; /* the text of the hunk */ - short *tp_len; /* length of each line */ - char *tp_char; /* +, -, and ! */ - Reg1 LINENUM i; - Reg2 LINENUM n; - bool blankline = FALSE; - Reg3 char *s; - - i = p_first; - p_first = p_newfirst; - p_newfirst = i; - - /* make a scratch copy */ - - tp_line = p_line; - tp_len = p_len; - tp_char = p_char; - p_line = Null(char**); /* force set_hunkmax to allocate again */ - p_len = Null(short*); - p_char = Nullch; - set_hunkmax(); - if (p_line == Null(char**) || p_len == Null(short*) || p_char == Nullch) { -#ifndef lint - if (p_line == Null(char**)) - free((char*)p_line); - p_line = tp_line; - if (p_len == Null(short*)) - free((char*)p_len); - p_len = tp_len; -#endif - if (p_char == Nullch) - free((char*)p_char); - p_char = tp_char; - return FALSE; /* not enough memory to swap hunk! */ - } - - /* now turn the new into the old */ - - i = p_ptrn_lines + 1; - if (tp_char[i] == '\n') { /* account for possible blank line */ - blankline = TRUE; - i++; - } - if (p_efake >= 0) { /* fix non-freeable ptr range */ - if (p_efake <= i) - n = p_end - i + 1; - else - n = -i; - p_efake += n; - p_bfake += n; - } - for (n=0; i <= p_end; i++,n++) { - p_line[n] = tp_line[i]; - p_char[n] = tp_char[i]; - if (p_char[n] == '+') - p_char[n] = '-'; - p_len[n] = tp_len[i]; - } - if (blankline) { - i = p_ptrn_lines + 1; - p_line[n] = tp_line[i]; - p_char[n] = tp_char[i]; - p_len[n] = tp_len[i]; - n++; - } - assert(p_char[0] == '='); - p_char[0] = '*'; - for (s=p_line[0]; *s; s++) - if (*s == '-') - *s = '*'; - - /* now turn the old into the new */ - - assert(tp_char[0] == '*'); - tp_char[0] = '='; - for (s=tp_line[0]; *s; s++) - if (*s == '*') - *s = '-'; - for (i=0; n <= p_end; i++,n++) { - p_line[n] = tp_line[i]; - p_char[n] = tp_char[i]; - if (p_char[n] == '-') - p_char[n] = '+'; - p_len[n] = tp_len[i]; - } - assert(i == p_ptrn_lines + 1); - i = p_ptrn_lines; - p_ptrn_lines = p_repl_lines; - p_repl_lines = i; -#ifndef lint - if (tp_line == Null(char**)) - free((char*)tp_line); - if (tp_len == Null(short*)) - free((char*)tp_len); -#endif - if (tp_char == Nullch) - free((char*)tp_char); - return TRUE; -} - -/* Return the specified line position in the old file of the old context. */ - -LINENUM -pch_first() -{ - return p_first; -} - -/* Return the number of lines of old context. */ - -LINENUM -pch_ptrn_lines() -{ - return p_ptrn_lines; -} - -/* Return the probable line position in the new file of the first line. */ - -LINENUM -pch_newfirst() -{ - return p_newfirst; -} - -/* Return the number of lines in the replacement text including context. */ - -LINENUM -pch_repl_lines() -{ - return p_repl_lines; -} - -/* Return the number of lines in the whole hunk. */ - -LINENUM -pch_end() -{ - return p_end; -} - -/* Return the number of context lines before the first changed line. */ - -LINENUM -pch_context() -{ - return p_context; -} - -/* Return the length of a particular patch line. */ - -short -pch_line_len(line) -LINENUM line; -{ - return p_len[line]; -} - -/* Return the control character (+, -, *, !, etc) for a patch line. */ - -char -pch_char(line) -LINENUM line; -{ - return p_char[line]; -} - -/* Return a pointer to a particular patch line. */ - -char * -pfetch(line) -LINENUM line; -{ - return p_line[line]; -} - -/* Return where in the patch file this hunk began, for error messages. */ - -LINENUM -pch_hunk_beg() -{ - return p_hunk_beg; -} - -/* Apply an ed script by feeding ed itself. */ - -#ifndef WIN32 -void -do_ed_script() -{ - Reg1 char *t; - Reg2 long beginning_of_this_line; - Reg3 bool this_line_is_command = FALSE; - Reg4 FILE *pipefp; - - if (!skip_rest_of_patch) { - Unlink(TMPOUTNAME); - copy_file(filearg[0], TMPOUTNAME); - if (verbose) - Sprintf(buf, "/bin/ed %s", TMPOUTNAME); - else - Sprintf(buf, "/bin/ed - %s", TMPOUTNAME); - pipefp = popen(buf, "w"); - } - for (;;) { - beginning_of_this_line = ftell(pfp); - if (pgets(buf, sizeof buf, pfp) == Nullch) { - next_intuit_at(beginning_of_this_line,p_input_line); - break; - } - p_input_line++; - for (t=buf; isdigit(*t) || *t == ','; t++) ; - this_line_is_command = (isdigit(*buf) && - (*t == 'd' || *t == 'c' || *t == 'a') ); - if (this_line_is_command) { - if (!skip_rest_of_patch) - fputs(buf, pipefp); - if (*t != 'd') { - while (pgets(buf, sizeof buf, pfp) != Nullch) { - p_input_line++; - if (!skip_rest_of_patch) - fputs(buf, pipefp); - if (strEQ(buf, ".\n")) - break; - } - } - } - else { - next_intuit_at(beginning_of_this_line,p_input_line); - break; - } - } - if (skip_rest_of_patch) - return; - fprintf(pipefp, "w\n"); - fprintf(pipefp, "q\n"); - Fflush(pipefp); - Pclose(pipefp); - ignore_signals(); - if (move_file(TMPOUTNAME, outname) < 0) { - toutkeep = TRUE; - chmod(TMPOUTNAME, filemode); - } - else - chmod(outname, filemode); - set_signals(1); -} -#endif Index: xc/util/patch/pch.h diff -u xc/util/patch/pch.h:1.1.1.3 xc/util/patch/pch.h:removed --- xc/util/patch/pch.h:1.1.1.3 Tue Jan 16 18:41:46 2001 +++ xc/util/patch/pch.h Fri Jan 18 15:27:47 2002 @@ -1,38 +0,0 @@ -/* oldHeader: pch.h,v 2.0.1.1 87/01/30 22:47:16 lwall 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(). - * - * Revision 2.0 86/09/17 15:39:57 lwall - * Baseline for netwide release. - * - */ - -EXT FILE *pfp INIT(Nullfp); /* patch file pointer */ - -void re_patch(); -void open_patch_file(); -void set_hunkmax(); -void grow_hunkmax(); -bool there_is_another_patch(); -int intuit_diff_type(); -void next_intuit_at(); -void skip_to(); -bool another_hunk(); -bool pch_swap(); -char *pfetch(); -short pch_line_len(); -LINENUM pch_first(); -LINENUM pch_ptrn_lines(); -LINENUM pch_newfirst(); -LINENUM pch_repl_lines(); -LINENUM pch_end(); -LINENUM pch_context(); -LINENUM pch_hunk_beg(); -char pch_char(); -char *pfetch(); -char *pgets(); -#ifndef WIN32 -void do_ed_script(); -#endif Index: xc/util/patch/util.c diff -u xc/util/patch/util.c:3.1 xc/util/patch/util.c:removed --- xc/util/patch/util.c:3.1 Wed Jan 17 18:20:07 2001 +++ xc/util/patch/util.c Fri Jan 18 15:27:47 2002 @@ -1,474 +0,0 @@ -/* $Xorg: util.c,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ */ - -#define const /*nothing*/ - -#include "EXTERN.h" -#include "common.h" -#include "INTERN.h" -#include "util.h" -#include "backupfile.h" - -void my_exit(); - -static char * -private_strerror (errnum) - int errnum; -{ - extern char *sys_errlist[]; - extern int sys_nerr; - - if (errnum > 0 && errnum <= sys_nerr) - return sys_errlist[errnum]; - return "Unknown system error"; -} -#define strerror private_strerror - -/* Rename a file, copying it if necessary. */ - -int -move_file(from,to) -char *from, *to; -{ - char bakname[512]; - Reg1 char *s; - Reg2 int i; - Reg3 int fromfd; - - /* to stdout? */ - - if (strEQ(to, "-")) { -#ifdef DEBUGGING - if (debug & 4) - say2("Moving %s to stdout.\n", from); -#endif - fromfd = open(from, 0); - if (fromfd < 0) - pfatal2("internal error, can't reopen %s", from); - while ((i=read(fromfd, buf, sizeof buf)) > 0) - if (write(1, buf, i) != 1) - pfatal1("write failed"); - Close(fromfd); - return 0; - } - - if (origprae) { - Strcpy(bakname, origprae); - Strcat(bakname, to); - } else { -#ifndef NODIR - char *backupname = find_backup_file_name(to); - if (backupname == (char *) 0) - fatal1("out of memory\n"); - Strcpy(bakname, backupname); - free(backupname); -#else /* NODIR */ - Strcpy(bakname, to); - Strcat(bakname, simple_backup_suffix); -#endif /* NODIR */ - } - - if (stat(to, &filestat) == 0) { /* output file exists */ - dev_t to_device = filestat.st_dev; - ino_t to_inode = filestat.st_ino; - char *simplename = bakname; - - for (s=bakname; *s; s++) { - if (*s == '/') - simplename = s+1; - } - /* Find a backup name that is not the same file. - Change the first lowercase char into uppercase; - if that isn't sufficient, chop off the first char and try again. */ - while (stat(bakname, &filestat) == 0 && - to_device == filestat.st_dev && to_inode == filestat.st_ino) { - /* Skip initial non-lowercase chars. */ - for (s=simplename; *s && !islower(*s); s++) ; - if (*s) - *s = toupper(*s); - else - Strcpy(simplename, simplename+1); - } - while (unlink(bakname) >= 0) ; /* while() is for benefit of Eunice */ -#ifdef DEBUGGING - if (debug & 4) - say3("Moving %s to %s.\n", to, bakname); -#endif -#ifndef WIN32 - if (link(to, bakname) < 0) { - /* Maybe `to' is a symlink into a different file system. - Copying replaces the symlink with a file; using rename - would be better. */ - Reg4 int tofd; - Reg5 int bakfd; - - bakfd = creat(bakname, 0666); - if (bakfd < 0) { - say4("Can't backup %s, output is in %s: %s\n", to, from, - strerror(errno)); - return -1; - } - tofd = open(to, 0); - if (tofd < 0) - pfatal2("internal error, can't open %s", to); - while ((i=read(tofd, buf, sizeof buf)) > 0) - if (write(bakfd, buf, i) != i) - pfatal1("write failed"); - Close(tofd); - Close(bakfd); - } -#endif - while (unlink(to) >= 0) ; - } -#ifdef DEBUGGING - if (debug & 4) - say3("Moving %s to %s.\n", from, to); -#endif -#ifndef WIN32 - if (link(from, to) < 0) { /* different file system? */ - Reg4 int tofd; - - tofd = creat(to, 0666); - if (tofd < 0) { - say4("Can't create %s, output is in %s: %s\n", - to, from, strerror(errno)); - return -1; - } - fromfd = open(from, 0); - if (fromfd < 0) - pfatal2("internal error, can't reopen %s", from); - while ((i=read(fromfd, buf, sizeof buf)) > 0) - if (write(tofd, buf, i) != i) - pfatal1("write failed"); - Close(fromfd); - Close(tofd); - } - Unlink(from); -#else - rename (from, to); -#endif - return 0; -} - -/* Copy a file. */ - -void -copy_file(from,to) -char *from, *to; -{ - Reg3 int tofd; - Reg2 int fromfd; - Reg1 int i; - - tofd = creat(to, 0666); - if (tofd < 0) - pfatal2("can't create %s", to); - fromfd = open(from, 0); - if (fromfd < 0) - pfatal2("internal error, can't reopen %s", from); - while ((i=read(fromfd, buf, sizeof buf)) > 0) - if (write(tofd, buf, i) != i) - pfatal2("write to %s failed", to); - Close(fromfd); - Close(tofd); -} - -/* Allocate a unique area for a string. */ - -char * -savestr(s) -Reg1 char *s; -{ - Reg3 char *rv; - Reg2 char *t; - - if (!s) - s = "Oops"; - t = s; - while (*t++); - rv = malloc((MEM) (t - s)); - if (rv == Nullch) { - if (using_plan_a) - out_of_mem = TRUE; - else - fatal1("out of memory\n"); - } - else { - t = rv; - while (*t++ = *s++); - } - return rv; -} - -#if defined(lint) && defined(CANVARARG) - -/*VARARGS ARGSUSED*/ -say(pat) char *pat; { ; } -/*VARARGS ARGSUSED*/ -fatal(pat) char *pat; { ; } -/*VARARGS ARGSUSED*/ -pfatal(pat) char *pat; { ; } -/*VARARGS ARGSUSED*/ -ask(pat) char *pat; { ; } - -#else - -/* Vanilla terminal output (buffered). */ - -void -say(pat,arg1,arg2,arg3) -char *pat; -long arg1,arg2,arg3; -{ - fprintf(stderr, pat, arg1, arg2, arg3); - Fflush(stderr); -} - -/* Terminal output, pun intended. */ - -void /* very void */ -fatal(pat,arg1,arg2,arg3) -char *pat; -long arg1,arg2,arg3; -{ - fprintf(stderr, "patch: **** "); - fprintf(stderr, pat, arg1, arg2, arg3); - my_exit(1); -} - -/* Say something from patch, something from the system, then silence . . . */ - -void /* very void */ -pfatal(pat,arg1,arg2,arg3) -char *pat; -long arg1,arg2,arg3; -{ - int errnum = errno; - - fprintf(stderr, "patch: **** "); - fprintf(stderr, pat, arg1, arg2, arg3); - fprintf(stderr, ": %s\n", strerror(errnum)); - my_exit(1); -} - -/* Get a response from the user, somehow or other. */ - -void -ask(pat,arg1,arg2,arg3) -char *pat; -long arg1,arg2,arg3; -{ -#ifndef WIN32 - int ttyfd; - int r; - bool tty2 = isatty(2); - - Sprintf(buf, pat, arg1, arg2, arg3); - Fflush(stderr); - write(2, buf, strlen(buf)); - if (tty2) { /* might be redirected to a file */ - r = read(2, buf, sizeof buf); - } - else if (isatty(1)) { /* this may be new file output */ - Fflush(stdout); - write(1, buf, strlen(buf)); - r = read(1, buf, sizeof buf); - } - else if ((ttyfd = open("/dev/tty", 2)) >= 0 && isatty(ttyfd)) { - /* might be deleted or unwriteable */ - write(ttyfd, buf, strlen(buf)); - r = read(ttyfd, buf, sizeof buf); - Close(ttyfd); - } - else if (isatty(0)) { /* this is probably patch input */ - Fflush(stdin); - write(0, buf, strlen(buf)); - r = read(0, buf, sizeof buf); - } - else { /* no terminal at all--default it */ - buf[0] = '\n'; - r = 1; - } - if (r <= 0) - buf[0] = 0; - else - buf[r] = '\0'; - if (!tty2) - say1(buf); -#else - buf[0] = '\n'; buf[1] = '\0'; -#endif -} -#endif /* lint */ - -/* How to handle certain events when not in a critical region. */ - -void -set_signals(reset) -int reset; -{ -#ifndef lint -#ifdef VOIDSIG - static void (*hupval)(),(*intval)(); -#else - static int (*hupval)(),(*intval)(); -#endif - - if (!reset) { -#ifndef WIN32 - hupval = signal(SIGHUP, SIG_IGN); - if (hupval != SIG_IGN) -#ifdef VOIDSIG - hupval = my_exit; -#else - hupval = (int(*)())my_exit; -#endif -#endif - intval = signal(SIGINT, SIG_IGN); - if (intval != SIG_IGN) -#ifdef VOIDSIG - intval = my_exit; -#else - intval = (int(*)())my_exit; -#endif - } -#ifndef WIN32 - Signal(SIGHUP, hupval); -#endif - Signal(SIGINT, intval); -#endif -} - -/* How to handle certain events when in a critical region. */ - -void -ignore_signals() -{ -#ifndef lint -#ifndef WIN32 - Signal(SIGHUP, SIG_IGN); -#endif - Signal(SIGINT, SIG_IGN); -#endif -} - -/* Make sure we'll have the directories to create a file. - If `striplast' is TRUE, ignore the last element of `filename'. */ - -void -makedirs(filename,striplast) -Reg1 char *filename; -bool striplast; -{ - char tmpbuf[256]; - Reg2 char *s = tmpbuf; - char *dirv[20]; /* Point to the NULs between elements. */ - Reg3 int i; - Reg4 int dirvp = 0; /* Number of finished entries in dirv. */ - - /* Copy `filename' into `tmpbuf' with a NUL instead of a slash - between the directories. */ - while (*filename) { - if (*filename == '/') { - filename++; - dirv[dirvp++] = s; - *s++ = '\0'; - } - else { - *s++ = *filename++; - } - } - *s = '\0'; - dirv[dirvp] = s; - if (striplast) - dirvp--; - if (dirvp < 0) - return; - - strcpy(buf, "mkdir"); - s = buf; - for (i=0; i<=dirvp; i++) { - struct stat sbuf; - - if (stat(tmpbuf, &sbuf) && errno == ENOENT) { - while (*s) s++; - *s++ = ' '; - strcpy(s, tmpbuf); - } -#ifndef WIN32 - *dirv[i] = '/'; -#else - *dirv[i] = '\\'; -#endif - } - if (s != buf) - system(buf); -} - -/* Make filenames more reasonable. */ - -char * -fetchname(at,strip_leading,assume_exists) -char *at; -int strip_leading; -int assume_exists; -{ - char *fullname; - char *name; - Reg1 char *t; - char tmpbuf[200]; - int sleading = strip_leading; - - if (!at) - return Nullch; - while (isspace(*at)) - at++; -#ifdef DEBUGGING - if (debug & 128) - say4("fetchname %s %d %d\n",at,strip_leading,assume_exists); -#endif - if (strnEQ(at, "/dev/null", 9)) /* so files can be created by diffing */ - return Nullch; /* against /dev/null. */ - name = fullname = t = savestr(at); - - /* Strip off up to `sleading' leading slashes and null terminate. */ - for (; *t && !isspace(*t); t++) - if (*t == '/') - if (--sleading >= 0) - name = t+1; - *t = '\0'; - - /* If no -p option was given (957 is the default value!), - we were given a relative pathname, - and the leading directories that we just stripped off all exist, - put them back on. */ - if (strip_leading == 957 && name != fullname && *fullname != '/') { - name[-1] = '\0'; - if (stat(fullname, &filestat) == 0 && S_ISDIR (filestat.st_mode)) { - name[-1] = '/'; - name=fullname; - } - } - - name = savestr(name); - free(fullname); - - if (stat(name, &filestat) && !assume_exists) { - char *filebase = basename(name); - int pathlen = filebase - name; - - /* Put any leading path into `tmpbuf'. */ - strncpy(tmpbuf, name, pathlen); - -#define try(f, a1, a2) (Sprintf(tmpbuf + pathlen, f, a1, a2), stat(tmpbuf, &filestat) == 0) - if ( try("RCS/%s%s", filebase, RCSSUFFIX) - || try("RCS/%s" , filebase, 0) - || try( "%s%s", filebase, RCSSUFFIX) - || try("SCCS/%s%s", SCCSPREFIX, filebase) - || try( "%s%s", SCCSPREFIX, filebase)) - return name; - free(name); - name = Nullch; - } - - return name; -} Index: xc/util/patch/util.h diff -u xc/util/patch/util.h:1.1.1.3 xc/util/patch/util.h:removed --- xc/util/patch/util.h:1.1.1.3 Tue Jan 16 18:41:49 2001 +++ xc/util/patch/util.h Fri Jan 18 15:27:47 2002 @@ -1,88 +0,0 @@ -/* oldHeader: util.h,v 2.0 86/09/17 15:40:06 lwall 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. - * - */ - -/* and for those machine that can't handle a variable argument list */ - -#ifdef CANVARARG - -#define say1 say -#define say2 say -#define say3 say -#define say4 say -#define ask1 ask -#define ask2 ask -#define ask3 ask -#define ask4 ask -#define fatal1 fatal -#define fatal2 fatal -#define fatal3 fatal -#define fatal4 fatal -#define pfatal1 pfatal -#define pfatal2 pfatal -#define pfatal3 pfatal -#define pfatal4 pfatal - -#else /* hope they allow multi-line macro actual arguments */ - -#ifdef lint - -#define say1(a) say(a, 0, 0, 0) -#define say2(a,b) say(a, (b)==(b), 0, 0) -#define say3(a,b,c) say(a, (b)==(b), (c)==(c), 0) -#define say4(a,b,c,d) say(a, (b)==(b), (c)==(c), (d)==(d)) -#define ask1(a) ask(a, 0, 0, 0) -#define ask2(a,b) ask(a, (b)==(b), 0, 0) -#define ask3(a,b,c) ask(a, (b)==(b), (c)==(c), 0) -#define ask4(a,b,c,d) ask(a, (b)==(b), (c)==(c), (d)==(d)) -#define fatal1(a) fatal(a, 0, 0, 0) -#define fatal2(a,b) fatal(a, (b)==(b), 0, 0) -#define fatal3(a,b,c) fatal(a, (b)==(b), (c)==(c), 0) -#define fatal4(a,b,c,d) fatal(a, (b)==(b), (c)==(c), (d)==(d)) -#define pfatal1(a) pfatal(a, 0, 0, 0) -#define pfatal2(a,b) pfatal(a, (b)==(b), 0, 0) -#define pfatal3(a,b,c) pfatal(a, (b)==(b), (c)==(c), 0) -#define pfatal4(a,b,c,d) pfatal(a, (b)==(b), (c)==(c), (d)==(d)) - -#else /* lint */ - /* if this doesn't work, try defining CANVARARG above */ -#define say1(a) say(a, Nullch, Nullch, Nullch) -#define say2(a,b) say(a, b, Nullch, Nullch) -#define say3(a,b,c) say(a, b, c, Nullch) -#define say4 say -#define ask1(a) ask(a, Nullch, Nullch, Nullch) -#define ask2(a,b) ask(a, b, Nullch, Nullch) -#define ask3(a,b,c) ask(a, b, c, Nullch) -#define ask4 ask -#define fatal1(a) fatal(a, Nullch, Nullch, Nullch) -#define fatal2(a,b) fatal(a, b, Nullch, Nullch) -#define fatal3(a,b,c) fatal(a, b, c, Nullch) -#define fatal4 fatal -#define pfatal1(a) pfatal(a, Nullch, Nullch, Nullch) -#define pfatal2(a,b) pfatal(a, b, Nullch, Nullch) -#define pfatal3(a,b,c) pfatal(a, b, c, Nullch) -#define pfatal4 pfatal - -#endif /* lint */ - -/* if neither of the above work, join all multi-line macro calls. */ -#endif - -EXT char serrbuf[BUFSIZ]; /* buffer for stderr */ - -char *fetchname(); -int move_file(); -void copy_file(); -void say(); -void fatal(); -void pfatal(); -void ask(); -char *savestr(); -void set_signals(); -void ignore_signals(); -void makedirs(); -char *basename(); Index: xc/util/patch/version.c diff -u xc/util/patch/version.c:1.1.1.3 xc/util/patch/version.c:removed --- xc/util/patch/version.c:1.1.1.3 Tue Jan 16 18:41:50 2001 +++ xc/util/patch/version.c Fri Jan 18 15:27:48 2002 @@ -1,25 +0,0 @@ -/* oldHeader: version.c,v 2.0 86/09/17 15:40:11 lwall 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. - * - */ - -#include "EXTERN.h" -#include "common.h" -#include "util.h" -#include "INTERN.h" -#include "patchlevel.h" -#include "version.h" - -void my_exit(); - -/* Print out the version number and die. */ - -void -version() -{ - fprintf(stderr, "Patch version 2.0, patch level %s\n", PATCHLEVEL); - my_exit(0); -} Index: xc/util/patch/version.h diff -u xc/util/patch/version.h:1.1.1.3 xc/util/patch/version.h:removed --- xc/util/patch/version.h:1.1.1.3 Tue Jan 16 18:41:52 2001 +++ xc/util/patch/version.h Fri Jan 18 15:27:48 2002 @@ -1,9 +0,0 @@ -/* oldHeader: version.h,v 2.0 86/09/17 15:40:14 lwall 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. - * - */ - -void version(); Index: xc/util/patch/winnt.h diff -u xc/util/patch/winnt.h:3.1 xc/util/patch/winnt.h:removed --- xc/util/patch/winnt.h:3.1 Wed Jan 17 18:20:07 2001 +++ xc/util/patch/winnt.h Fri Jan 18 15:27:48 2002 @@ -1,25 +0,0 @@ - -/* $Xorg: winnt.h,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ */ - - -#define stat _stat -#define dev_t _dev_t -#define ino_t _ino_t -#define chdir _chdir -#define chmod(p1,p2) _chmod(p1,_S_IWRITE) -#define open _open -#define close _close -#define creat(p1,p2) _creat(p1,_S_IWRITE) -#define fileno _fileno -#define fstat _fstat -#define isatty _isatty -#define lseek _lseek -#define mktemp _mktemp -#define pclose _pclose -#define popen _popen -#define read _read -#define write _write -#define unlink _unlink -#define sys_errlist _sys_errlist -#define sys_nerr (*_sys_nerr_dll) -